From f94d549da8d47b58ce97625a94165af53793e73d Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Sat, 21 Oct 2023 16:34:28 +0100 Subject: [PATCH 1/7] Run cargo fmt. --- build.rs | 2 +- examples/cubes.rs | 11 +++++++++-- examples/helloworld.rs | 9 +++++++-- src/lib.rs | 1 - 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/build.rs b/build.rs index 934dfe3e..df3d982d 100644 --- a/build.rs +++ b/build.rs @@ -1,7 +1,7 @@ fn main() { let mut build = cc::Build::new(); let env = std::env::var("TARGET").unwrap(); - + // windows includes if env.contains("windows") { build.include("bx/include/compat/msvc"); diff --git a/examples/cubes.rs b/examples/cubes.rs index 44ed8156..573eec84 100644 --- a/examples/cubes.rs +++ b/examples/cubes.rs @@ -170,7 +170,13 @@ fn main() -> std::io::Result<()> { } bgfx_set_debug(BGFX_DEBUG_TEXT); - bgfx_set_view_clear(0, (BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH) as _, 0x103030ff, 1.0, 0); + bgfx_set_view_clear( + 0, + (BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH) as _, + 0x103030ff, + 1.0, + 0, + ); // Setup vertex layout @@ -207,7 +213,8 @@ fn main() -> std::io::Result<()> { (std::mem::size_of::() * 36) as _, ); - let vbh = bgfx_create_vertex_buffer(vertices_mem, &mut vertex_layout, BGFX_BUFFER_NONE as _); + let vbh = + bgfx_create_vertex_buffer(vertices_mem, &mut vertex_layout, BGFX_BUFFER_NONE as _); let ibh = bgfx_create_index_buffer(index_mem, BGFX_BUFFER_NONE as _); // create the shaders diff --git a/examples/helloworld.rs b/examples/helloworld.rs index 7ad28669..b055336b 100644 --- a/examples/helloworld.rs +++ b/examples/helloworld.rs @@ -39,7 +39,6 @@ unsafe fn update_platform_handle(pd: &mut bgfx_platform_data_t, window: &Window) } } - #[cfg(target_os = "linux")] fn get_render_type() -> u32 { BGFX_RENDERER_TYPE_OPENGL @@ -87,7 +86,13 @@ fn main() { } bgfx_set_debug(BGFX_DEBUG_TEXT); - bgfx_set_view_clear(0, (BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH) as _, 0x103030ff, 1.0, 0); + bgfx_set_view_clear( + 0, + (BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH) as _, + 0x103030ff, + 1.0, + 0, + ); } let mut old_size = (0, 0); diff --git a/src/lib.rs b/src/lib.rs index 0df5039c..3f30ec12 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,4 +3,3 @@ #![allow(non_snake_case)] include!("./ffi.rs"); - From 17f0da71d324c482325c1487b5c03e0b4ab54e7e Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Sat, 21 Oct 2023 16:28:42 +0100 Subject: [PATCH 2/7] Run update.sh and update to latest BGFX headers. --- bgfx/.gitattributes | 9 +- bgfx/.github/workflows/main.yml | 39 + bgfx/.gitignore | 10 +- bgfx/3rdparty/cgltf/cgltf.h | 316 +- bgfx/3rdparty/cgltf/cgltf_write.h | 22 +- bgfx/3rdparty/dear-imgui/imgui.cpp | 5002 +++-- bgfx/3rdparty/dear-imgui/imgui.h | 408 +- bgfx/3rdparty/dear-imgui/imgui_demo.cpp | 1012 +- bgfx/3rdparty/dear-imgui/imgui_draw.cpp | 232 +- bgfx/3rdparty/dear-imgui/imgui_internal.h | 763 +- bgfx/3rdparty/dear-imgui/imgui_tables.cpp | 375 +- bgfx/3rdparty/dear-imgui/imgui_widgets.cpp | 1074 +- .../dear-imgui/widgets/memory_editor.inl | 8 +- .../dear-imgui/widgets/range_slider.inl | 2 +- .../src/glsl/ir_print_glsl_visitor.cpp | 6 +- .../glslang/OGLCompilersDLL/InitializeDll.cpp | 128 - .../glslang/OGLCompilersDLL/InitializeDll.h | 8 +- bgfx/3rdparty/glslang/SPIRV/GLSL.ext.ARM.h | 35 + bgfx/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h | 1 + bgfx/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h | 2 + bgfx/3rdparty/glslang/SPIRV/GLSL.ext.NV.h | 3 + bgfx/3rdparty/glslang/SPIRV/GLSL.ext.QCOM.h | 41 + bgfx/3rdparty/glslang/SPIRV/GLSL.std.450.h | 2 +- bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.cpp | 1119 +- bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.h | 4 +- bgfx/3rdparty/glslang/SPIRV/Logger.cpp | 4 - bgfx/3rdparty/glslang/SPIRV/Logger.h | 9 - .../glslang/SPIRV/NonSemanticDebugPrintf.h | 10 +- .../SPIRV/NonSemanticShaderDebugInfo100.h | 10 +- bgfx/3rdparty/glslang/SPIRV/SPVRemapper.cpp | 7 +- bgfx/3rdparty/glslang/SPIRV/SPVRemapper.h | 28 - bgfx/3rdparty/glslang/SPIRV/SpvBuilder.cpp | 230 +- bgfx/3rdparty/glslang/SPIRV/SpvBuilder.h | 32 +- .../3rdparty/glslang/SPIRV/SpvPostProcess.cpp | 8 +- bgfx/3rdparty/glslang/SPIRV/SpvTools.cpp | 52 +- bgfx/3rdparty/glslang/SPIRV/SpvTools.h | 19 + bgfx/3rdparty/glslang/SPIRV/disassemble.cpp | 64 +- bgfx/3rdparty/glslang/SPIRV/doc.cpp | 3063 +-- bgfx/3rdparty/glslang/SPIRV/doc.h | 7 +- bgfx/3rdparty/glslang/SPIRV/hex_float.h | 13 - bgfx/3rdparty/glslang/SPIRV/spirv.hpp | 5321 ++--- bgfx/3rdparty/glslang/SPIRV/spvIR.h | 4 +- .../glslang/StandAlone/StandAlone.cpp | 84 +- .../glslang/StandAlone/spirv-remap.cpp | 99 +- bgfx/3rdparty/glslang/build_info.h | 4 +- .../CInterface/glslang_c_interface.cpp | 59 +- .../glslang/glslang/GenericCodeGen/Link.cpp | 2 +- .../glslang/glslang/HLSL/hlslAttributes.h | 1 + .../glslang/glslang/HLSL/hlslGrammar.cpp | 309 +- .../glslang/glslang/HLSL/hlslGrammar.h | 6 +- .../glslang/glslang/HLSL/hlslParseHelper.cpp | 17 +- .../glslang/glslang/HLSL/hlslParseHelper.h | 8 +- .../glslang/glslang/HLSL/hlslParseables.cpp | 4 +- .../glslang/glslang/HLSL/hlslScanContext.cpp | 160 + .../glslang/glslang/HLSL/hlslTokens.h | 80 + .../glslang/glslang/Include/BaseTypes.h | 26 +- .../3rdparty/glslang/glslang/Include/Common.h | 20 +- .../glslang/glslang/Include/ConstantUnion.h | 36 - .../glslang/Include/InitializeGlobals.h | 2 +- .../glslang/glslang/Include/PoolAlloc.h | 21 +- .../glslang/glslang/Include/ShHandle.h | 16 +- .../glslang/glslang/Include/SpirvIntrinsics.h | 21 +- bgfx/3rdparty/glslang/glslang/Include/Types.h | 540 +- .../3rdparty/glslang/glslang/Include/arrays.h | 29 +- .../glslang/Include/glslang_c_interface.h | 51 +- .../glslang/glslang/Include/intermediate.h | 147 +- .../glslang/MachineIndependent/Constant.cpp | 30 +- .../glslang/MachineIndependent/Initialize.cpp | 638 +- .../glslang/MachineIndependent/Initialize.h | 3 + .../MachineIndependent/Intermediate.cpp | 102 +- .../MachineIndependent/ParseContextBase.cpp | 20 +- .../MachineIndependent/ParseHelper.cpp | 850 +- .../glslang/MachineIndependent/ParseHelper.h | 29 +- .../glslang/MachineIndependent/PoolAlloc.cpp | 48 +- .../glslang/MachineIndependent/Scan.cpp | 56 +- .../glslang/MachineIndependent/ShaderLang.cpp | 159 +- .../MachineIndependent/SpirvIntrinsics.cpp | 74 +- .../MachineIndependent/SymbolTable.cpp | 17 +- .../glslang/MachineIndependent/SymbolTable.h | 49 +- .../glslang/MachineIndependent/Versions.cpp | 86 +- .../glslang/MachineIndependent/Versions.h | 12 + .../glslang/MachineIndependent/attribute.cpp | 4 - .../glslang/MachineIndependent/glslang.m4 | 4422 ----- .../glslang/MachineIndependent/glslang.y | 227 +- .../MachineIndependent/glslang_tab.cpp | 9829 +++++----- .../MachineIndependent/glslang_tab.cpp.h | 603 +- .../glslang/MachineIndependent/intermOut.cpp | 67 +- .../glslang/MachineIndependent/iomapper.cpp | 37 +- .../glslang/MachineIndependent/iomapper.h | 6 +- .../glslang/MachineIndependent/limits.cpp | 2 - .../MachineIndependent/linkValidate.cpp | 153 +- .../MachineIndependent/localintermediate.h | 154 +- .../glslang/MachineIndependent/parseConst.cpp | 2 +- .../MachineIndependent/parseVersions.h | 78 +- .../MachineIndependent/preprocessor/Pp.cpp | 28 +- .../preprocessor/PpContext.cpp | 2 +- .../preprocessor/PpContext.h | 23 +- .../preprocessor/PpScanner.cpp | 119 +- .../preprocessor/PpTokens.cpp | 11 +- .../propagateNoContraction.cpp | 8 +- .../glslang/MachineIndependent/reflection.cpp | 6 +- .../glslang/MachineIndependent/reflection.h | 4 - .../glslang/OSDependent/Unix/ossource.cpp | 105 - .../glslang/OSDependent/Windows/ossource.cpp | 80 - .../glslang/glslang/OSDependent/osinclude.h | 17 - .../Public}/ResourceLimits.h | 10 +- .../glslang/glslang/Public/ShaderLang.h | 9 - .../Public}/resource_limits_c.h | 5 +- .../ResourceLimits}/ResourceLimits.cpp | 16 +- .../ResourceLimits}/resource_limits_c.cpp | 15 +- bgfx/3rdparty/glslang/glslang/updateGrammar | 15 +- bgfx/3rdparty/glslang/hlsl/stub.cpp | 41 - bgfx/3rdparty/khronos/EGL/egl.h | 85 +- bgfx/3rdparty/khronos/EGL/eglext.h | 203 +- bgfx/3rdparty/khronos/EGL/eglplatform.h | 55 +- bgfx/3rdparty/khronos/GLES2/gl2.h | 29 +- bgfx/3rdparty/khronos/GLES2/gl2ext.h | 398 +- bgfx/3rdparty/khronos/GLES2/gl2platform.h | 15 +- bgfx/3rdparty/khronos/GLES3/gl3.h | 37 +- bgfx/3rdparty/khronos/GLES3/gl31.h | 39 +- bgfx/3rdparty/khronos/GLES3/gl32.h | 39 +- bgfx/3rdparty/khronos/GLES3/gl3ext.h | 24 - bgfx/3rdparty/khronos/GLES3/gl3platform.h | 15 +- bgfx/3rdparty/khronos/KHR/khrplatform.h | 37 +- .../3rdparty/khronos/gl/GRemedyGLExtensions.h | 67 - bgfx/3rdparty/khronos/gl/glcorearb.h | 219 +- bgfx/3rdparty/khronos/gl/glext.h | 386 +- bgfx/3rdparty/khronos/glx/glxext.h | 190 +- bgfx/3rdparty/khronos/vulkan-local/vk_icd.h | 47 +- bgfx/3rdparty/khronos/vulkan-local/vk_layer.h | 33 +- .../khronos/vulkan-local/vk_platform.h | 2 +- .../khronos/vulkan-local/vk_sdk_platform.h | 26 +- .../vk_video/vulkan_video_codec_h264std.h | 310 + .../vulkan_video_codec_h264std_decode.h | 75 + .../vulkan_video_codec_h264std_encode.h | 132 + .../vk_video/vulkan_video_codec_h265std.h | 443 + .../vulkan_video_codec_h265std_decode.h | 65 + .../vulkan_video_codec_h265std_encode.h | 146 + .../vk_video/vulkan_video_codecs_common.h | 31 + bgfx/3rdparty/khronos/vulkan-local/vulkan.h | 10 +- .../khronos/vulkan-local/vulkan_android.h | 4 +- .../khronos/vulkan-local/vulkan_beta.h | 1181 +- .../khronos/vulkan-local/vulkan_core.h | 2738 ++- .../khronos/vulkan-local/vulkan_directfb.h | 3 +- .../khronos/vulkan-local/vulkan_fuchsia.h | 6 +- .../khronos/vulkan-local/vulkan_ggp.h | 4 +- .../khronos/vulkan-local/vulkan_ios.h | 3 +- .../khronos/vulkan-local/vulkan_macos.h | 3 +- .../khronos/vulkan-local/vulkan_metal.h | 4 +- .../khronos/vulkan-local/vulkan_screen.h | 56 +- .../3rdparty/khronos/vulkan-local/vulkan_vi.h | 3 +- .../khronos/vulkan-local/vulkan_wayland.h | 3 +- .../khronos/vulkan-local/vulkan_win32.h | 29 +- .../khronos/vulkan-local/vulkan_xcb.h | 3 +- .../khronos/vulkan-local/vulkan_xlib.h | 3 +- .../khronos/vulkan-local/vulkan_xlib_xrandr.h | 3 +- bgfx/3rdparty/khronos/wgl/wgl.h | 936 + bgfx/3rdparty/khronos/wgl/wglext.h | 82 +- bgfx/3rdparty/meshoptimizer/LICENSE.md | 2 +- .../meshoptimizer/src/clusterizer.cpp | 152 +- .../meshoptimizer/src/indexgenerator.cpp | 43 +- .../meshoptimizer/src/meshoptimizer.h | 143 +- .../meshoptimizer/src/overdrawanalyzer.cpp | 2 +- .../meshoptimizer/src/overdrawoptimizer.cpp | 2 +- .../meshoptimizer/src/quantization.cpp | 70 + .../3rdparty/meshoptimizer/src/simplifier.cpp | 401 +- .../meshoptimizer/src/spatialorder.cpp | 4 +- .../meshoptimizer/src/vcacheoptimizer.cpp | 49 +- .../meshoptimizer/src/vertexcodec.cpp | 119 +- .../meshoptimizer/src/vertexfilter.cpp | 105 +- bgfx/3rdparty/native_app_glue/LICENSE | 13 + .../native_app_glue/android_native_app_glue.c | 457 + .../native_app_glue/android_native_app_glue.h | 350 + bgfx/3rdparty/renderdoc/renderdoc_app.h | 66 +- bgfx/3rdparty/spirv-cross/main.cpp | 171 +- bgfx/3rdparty/spirv-cross/spirv_common.hpp | 36 +- bgfx/3rdparty/spirv-cross/spirv_cpp.cpp | 2 - bgfx/3rdparty/spirv-cross/spirv_cross.cpp | 204 +- bgfx/3rdparty/spirv-cross/spirv_cross.hpp | 11 +- bgfx/3rdparty/spirv-cross/spirv_cross_c.cpp | 180 + bgfx/3rdparty/spirv-cross/spirv_cross_c.h | 64 +- .../spirv-cross/spirv_cross_containers.hpp | 12 +- .../spirv-cross/spirv_cross_parsed_ir.cpp | 16 +- .../spirv-cross/spirv_cross_parsed_ir.hpp | 4 +- bgfx/3rdparty/spirv-cross/spirv_glsl.cpp | 1814 +- bgfx/3rdparty/spirv-cross/spirv_glsl.hpp | 81 +- bgfx/3rdparty/spirv-cross/spirv_hlsl.cpp | 745 +- bgfx/3rdparty/spirv-cross/spirv_hlsl.hpp | 38 +- bgfx/3rdparty/spirv-cross/spirv_msl.cpp | 1706 +- bgfx/3rdparty/spirv-cross/spirv_msl.hpp | 113 +- bgfx/3rdparty/spirv-cross/spirv_parser.cpp | 24 +- bgfx/3rdparty/spirv-cross/spirv_reflect.cpp | 2 +- .../include/spirv/1.0/spirv.hpp11 | 1002 + .../include/spirv/1.1/spirv.hpp11 | 1024 + .../include/spirv/1.2/spirv.hpp11 | 1030 + .../spirv-headers/include/spirv/spir-v.xml | 22 +- .../unified1/NonSemanticClspvReflection.h | 16 +- .../spirv/unified1/NonSemanticDebugBreak.h | 50 + ...t.nonsemantic.clspvreflection.grammar.json | 90 +- ...xtinst.nonsemantic.debugbreak.grammar.json | 9 + .../spirv/unified1/spirv.core.grammar.json | 3414 +++- .../include/spirv/unified1/spirv.h | 225 + .../include/spirv/unified1/spirv.hpp11 | 2844 +++ .../include/spirv/unified1/spirv.json | 191 +- .../include/generated/build-version.inc | 2 +- .../include/generated/core.insts-unified1.inc | 1556 +- .../include/generated/enum_string_mapping.inc | 488 +- .../include/generated/extension_enum.inc | 16 + .../include/generated/generators.inc | 9 +- .../include/generated/glsl.std.450.insts.inc | 4 +- .../nonsemantic.clspvreflection.insts.inc | 11 +- .../generated/operand.kinds-unified1.inc | 1166 +- .../include/spirv-tools/instrument.hpp | 113 +- .../include/spirv-tools/libspirv.h | 85 + .../include/spirv-tools/libspirv.hpp | 22 + .../include/spirv-tools/linker.hpp | 17 +- .../include/spirv-tools/optimizer.hpp | 108 +- .../spirv-tools/source/assembly_grammar.cpp | 37 +- .../spirv-tools/source/assembly_grammar.h | 9 +- bgfx/3rdparty/spirv-tools/source/binary.cpp | 60 +- bgfx/3rdparty/spirv-tools/source/cfa.h | 8 +- .../3rdparty/spirv-tools/source/diff/diff.cpp | 506 +- .../spirv-tools/source/disassemble.cpp | 13 +- bgfx/3rdparty/spirv-tools/source/enum_set.h | 527 +- .../spirv-tools/source/enum_string_mapping.h | 2 +- .../spirv-tools/source/extensions.cpp | 9 +- bgfx/3rdparty/spirv-tools/source/extensions.h | 3 +- .../3rdparty/spirv-tools/source/instruction.h | 2 +- .../source/latest_version_spirv_header.h | 2 +- bgfx/3rdparty/spirv-tools/source/libspirv.cpp | 34 + .../spirv-tools/source/link/linker.cpp | 72 +- .../source/lint/divergence_analysis.cpp | 43 +- .../lint/lint_divergent_derivatives.cpp | 46 +- .../spirv-tools/source/lint/linter.cpp | 1 - .../spirv-tools/source/name_mapper.cpp | 58 +- bgfx/3rdparty/spirv-tools/source/opcode.cpp | 773 +- bgfx/3rdparty/spirv-tools/source/opcode.h | 65 +- bgfx/3rdparty/spirv-tools/source/operand.cpp | 131 +- bgfx/3rdparty/spirv-tools/source/operand.h | 2 +- .../opt/aggressive_dead_code_elim_pass.cpp | 233 +- .../opt/aggressive_dead_code_elim_pass.h | 13 +- .../spirv-tools/source/opt/amd_ext_to_khr.cpp | 234 +- .../source/opt/analyze_live_input_pass.cpp | 45 + .../source/opt/analyze_live_input_pass.h | 57 + .../spirv-tools/source/opt/basic_block.cpp | 47 +- .../spirv-tools/source/opt/basic_block.h | 2 +- .../source/opt/block_merge_pass.cpp | 3 - .../source/opt/block_merge_util.cpp | 56 +- .../spirv-tools/source/opt/ccp_pass.cpp | 16 +- bgfx/3rdparty/spirv-tools/source/opt/cfg.cpp | 12 +- .../source/opt/cfg_cleanup_pass.cpp | 4 - .../spirv-tools/source/opt/code_sink.cpp | 87 +- .../source/opt/combine_access_chains.cpp | 54 +- .../source/opt/combine_access_chains.h | 4 +- .../source/opt/const_folding_rules.cpp | 472 +- .../source/opt/const_folding_rules.h | 10 +- .../spirv-tools/source/opt/constants.cpp | 104 +- .../spirv-tools/source/opt/constants.h | 51 +- .../source/opt/control_dependence.cpp | 7 +- .../source/opt/convert_to_half_pass.cpp | 244 +- .../source/opt/convert_to_half_pass.h | 24 +- .../opt/convert_to_sampled_image_pass.cpp | 64 +- .../opt/convert_to_sampled_image_pass.h | 4 +- .../source/opt/copy_prop_arrays.cpp | 108 +- .../spirv-tools/source/opt/copy_prop_arrays.h | 4 +- .../spirv-tools/source/opt/dataflow.cpp | 3 +- .../source/opt/dead_branch_elim_pass.cpp | 57 +- .../source/opt/dead_insert_elim_pass.cpp | 57 +- .../source/opt/dead_variable_elimination.cpp | 15 +- .../source/opt/debug_info_manager.cpp | 88 +- .../source/opt/decoration_manager.cpp | 114 +- .../source/opt/decoration_manager.h | 32 +- .../spirv-tools/source/opt/desc_sroa.cpp | 49 +- .../spirv-tools/source/opt/desc_sroa_util.cpp | 31 +- .../source/opt/dominator_analysis.cpp | 2 +- .../spirv-tools/source/opt/dominator_tree.cpp | 9 +- .../opt/eliminate_dead_constant_pass.cpp | 9 +- .../opt/eliminate_dead_functions_util.cpp | 8 +- .../eliminate_dead_input_components_pass.cpp | 189 - .../opt/eliminate_dead_io_components_pass.cpp | 256 + ....h => eliminate_dead_io_components_pass.h} | 22 +- .../opt/eliminate_dead_members_pass.cpp | 236 +- .../opt/eliminate_dead_output_stores_pass.cpp | 237 + .../opt/eliminate_dead_output_stores_pass.h | 81 + .../source/opt/feature_manager.cpp | 34 +- .../spirv-tools/source/opt/feature_manager.h | 49 +- .../source/opt/fix_func_call_arguments.cpp | 9 +- .../source/opt/fix_storage_class.cpp | 110 +- .../source/opt/fix_storage_class.h | 8 +- .../source/opt/flatten_decoration_pass.cpp | 18 +- bgfx/3rdparty/spirv-tools/source/opt/fold.cpp | 281 +- bgfx/3rdparty/spirv-tools/source/opt/fold.h | 22 +- ...ld_spec_constant_op_and_composite_pass.cpp | 37 +- .../spirv-tools/source/opt/folding_rules.cpp | 700 +- .../spirv-tools/source/opt/folding_rules.h | 10 +- .../opt/freeze_spec_constant_value_pass.cpp | 18 +- .../spirv-tools/source/opt/function.cpp | 4 +- .../spirv-tools/source/opt/function.h | 2 +- .../opt/graphics_robust_access_pass.cpp | 100 +- .../source/opt/graphics_robust_access_pass.h | 2 +- .../spirv-tools/source/opt/if_conversion.cpp | 33 +- .../source/opt/inline_opaque_pass.cpp | 16 +- .../spirv-tools/source/opt/inline_pass.cpp | 82 +- .../spirv-tools/source/opt/inline_pass.h | 2 +- .../source/opt/inst_bindless_check_pass.cpp | 1208 +- .../source/opt/inst_bindless_check_pass.h | 132 +- .../source/opt/inst_buff_addr_check_pass.cpp | 251 +- .../source/opt/inst_buff_addr_check_pass.h | 7 +- .../source/opt/inst_debug_printf_pass.cpp | 52 +- .../spirv-tools/source/opt/instruction.cpp | 490 +- .../spirv-tools/source/opt/instruction.h | 44 +- .../source/opt/instrument_pass.cpp | 731 +- .../spirv-tools/source/opt/instrument_pass.h | 76 +- .../source/opt/interface_var_sroa.cpp | 178 +- .../source/opt/interface_var_sroa.h | 12 +- .../source/opt/interp_fixup_pass.cpp | 12 +- .../spirv-tools/source/opt/ir_builder.h | 103 +- .../spirv-tools/source/opt/ir_context.cpp | 665 +- .../spirv-tools/source/opt/ir_context.h | 138 +- .../spirv-tools/source/opt/ir_loader.cpp | 54 +- .../spirv-tools/source/opt/licm_pass.cpp | 7 +- .../spirv-tools/source/opt/liveness.cpp | 332 + .../spirv-tools/source/opt/liveness.h | 99 + .../opt/local_access_chain_convert_pass.cpp | 143 +- .../opt/local_access_chain_convert_pass.h | 2 +- .../opt/local_single_block_elim_pass.cpp | 143 +- .../opt/local_single_store_elim_pass.cpp | 158 +- .../source/opt/loop_dependence.cpp | 13 +- .../source/opt/loop_dependence_helpers.cpp | 40 +- .../source/opt/loop_descriptor.cpp | 112 +- .../spirv-tools/source/opt/loop_descriptor.h | 16 +- .../spirv-tools/source/opt/loop_fission.cpp | 32 +- .../spirv-tools/source/opt/loop_fusion.cpp | 37 +- .../source/opt/loop_fusion_pass.cpp | 1 - .../spirv-tools/source/opt/loop_peeling.cpp | 89 +- .../spirv-tools/source/opt/loop_unroller.cpp | 24 +- .../source/opt/loop_unswitch_pass.cpp | 36 +- .../spirv-tools/source/opt/loop_utils.cpp | 21 +- .../spirv-tools/source/opt/mem_pass.cpp | 109 +- .../spirv-tools/source/opt/mem_pass.h | 6 +- .../source/opt/merge_return_pass.cpp | 113 +- .../spirv-tools/source/opt/module.cpp | 23 +- bgfx/3rdparty/spirv-tools/source/opt/module.h | 5 +- .../spirv-tools/source/opt/optimizer.cpp | 255 +- bgfx/3rdparty/spirv-tools/source/opt/pass.cpp | 13 +- bgfx/3rdparty/spirv-tools/source/opt/passes.h | 6 +- .../source/opt/private_to_local_pass.cpp | 41 +- .../spirv-tools/source/opt/propagator.cpp | 4 +- .../spirv-tools/source/opt/propagator.h | 4 +- .../source/opt/reduce_load_size.cpp | 33 +- .../3rdparty/spirv-tools/source/opt/reflect.h | 52 +- .../source/opt/register_pressure.cpp | 23 +- .../source/opt/relax_float_ops_pass.cpp | 140 +- .../source/opt/relax_float_ops_pass.h | 12 +- .../source/opt/remove_dontinline_pass.cpp | 5 +- .../source/opt/remove_duplicates_pass.cpp | 12 +- ...remove_unused_interface_variables_pass.cpp | 13 +- .../remove_unused_interface_variables_pass.h | 7 +- ...lace_desc_array_access_using_var_index.cpp | 49 +- .../source/opt/replace_invalid_opc.cpp | 82 +- .../source/opt/replace_invalid_opc.h | 8 +- .../source/opt/scalar_analysis.cpp | 31 +- .../opt/scalar_analysis_simplification.cpp | 5 +- .../source/opt/scalar_replacement_pass.cpp | 378 +- .../source/opt/scalar_replacement_pass.h | 27 +- .../set_spec_constant_default_value_pass.cpp | 37 +- .../source/opt/simplification_pass.cpp | 17 +- .../source/opt/spread_volatile_semantics.cpp | 100 +- .../source/opt/spread_volatile_semantics.h | 5 +- .../source/opt/ssa_rewrite_pass.cpp | 18 +- .../source/opt/strength_reduction_pass.cpp | 24 +- .../source/opt/strip_debug_info_pass.cpp | 7 +- .../opt/strip_nonsemantic_info_pass.cpp | 27 +- .../source/opt/struct_cfg_analysis.cpp | 17 +- .../source/opt/switch_descriptorset_pass.cpp | 46 + .../source/opt/switch_descriptorset_pass.h | 52 + .../source/opt/trim_capabilities_pass.cpp | 525 + .../source/opt/trim_capabilities_pass.h | 191 + .../spirv-tools/source/opt/type_manager.cpp | 194 +- .../spirv-tools/source/opt/type_manager.h | 32 +- .../3rdparty/spirv-tools/source/opt/types.cpp | 67 +- bgfx/3rdparty/spirv-tools/source/opt/types.h | 89 +- .../source/opt/unify_const_pass.cpp | 20 +- .../source/opt/upgrade_memory_model.cpp | 210 +- .../source/opt/upgrade_memory_model.h | 8 +- .../source/opt/value_number_table.cpp | 12 +- .../spirv-tools/source/opt/vector_dce.cpp | 20 +- .../spirv-tools/source/opt/workaround1209.cpp | 4 +- .../spirv-tools/source/opt/wrap_opkill.cpp | 28 +- .../spirv-tools/source/opt/wrap_opkill.h | 2 +- .../spirv-tools/source/parsed_operand.cpp | 1 + bgfx/3rdparty/spirv-tools/source/print.cpp | 2 +- ..._conditional_branch_opportunity_finder.cpp | 4 +- .../merge_blocks_reduction_opportunity.cpp | 2 +- ..._to_const_reduction_opportunity_finder.cpp | 2 +- ..._to_undef_reduction_opportunity_finder.cpp | 6 +- .../source/reduce/reduction_util.cpp | 20 +- ...selection_reduction_opportunity_finder.cpp | 4 +- ...ve_struct_member_reduction_opportunity.cpp | 28 +- ...struction_reduction_opportunity_finder.cpp | 28 +- ...ct_member_reduction_opportunity_finder.cpp | 26 +- ...al_branch_to_branch_opportunity_finder.cpp | 6 +- ...branch_to_branch_reduction_opportunity.cpp | 5 +- ...nstruct_to_block_reduction_opportunity.cpp | 2 +- ...oop_to_selection_reduction_opportunity.cpp | 23 +- .../spirv-tools/source/spirv_target_env.cpp | 1 + bgfx/3rdparty/spirv-tools/source/table.h | 8 +- bgfx/3rdparty/spirv-tools/source/text.cpp | 34 +- .../spirv-tools/source/text_handler.cpp | 4 +- .../spirv-tools/source/util/hex_float.h | 75 +- .../spirv-tools/source/util/small_vector.h | 16 +- .../spirv-tools/source/val/basic_block.cpp | 1 - .../spirv-tools/source/val/construct.cpp | 25 +- .../spirv-tools/source/val/decoration.h | 12 +- .../spirv-tools/source/val/function.cpp | 9 +- .../spirv-tools/source/val/function.h | 16 +- .../spirv-tools/source/val/instruction.h | 6 +- .../spirv-tools/source/val/validate.cpp | 50 +- .../spirv-tools/source/val/validate.h | 20 +- .../source/val/validate_adjacency.cpp | 36 +- .../source/val/validate_annotation.cpp | 300 +- .../source/val/validate_arithmetics.cpp | 225 +- .../source/val/validate_atomics.cpp | 201 +- .../source/val/validate_barriers.cpp | 29 +- .../source/val/validate_bitwise.cpp | 36 +- .../source/val/validate_builtins.cpp | 1101 +- .../source/val/validate_capability.cpp | 282 +- .../spirv-tools/source/val/validate_cfg.cpp | 153 +- .../source/val/validate_composites.cpp | 114 +- .../source/val/validate_constants.cpp | 126 +- .../source/val/validate_conversion.cpp | 128 +- .../spirv-tools/source/val/validate_debug.cpp | 12 +- .../source/val/validate_decorations.cpp | 691 +- .../source/val/validate_derivatives.cpp | 39 +- .../val/validate_execution_limitations.cpp | 4 +- .../source/val/validate_extensions.cpp | 566 +- .../source/val/validate_function.cpp | 106 +- .../spirv-tools/source/val/validate_id.cpp | 49 +- .../spirv-tools/source/val/validate_image.cpp | 916 +- .../source/val/validate_instruction.cpp | 112 +- .../source/val/validate_interfaces.cpp | 155 +- .../source/val/validate_layout.cpp | 30 +- .../source/val/validate_literals.cpp | 5 +- .../source/val/validate_logicals.cpp | 110 +- .../source/val/validate_memory.cpp | 813 +- .../source/val/validate_memory_semantics.cpp | 125 +- .../source/val/validate_mesh_shading.cpp | 22 +- .../spirv-tools/source/val/validate_misc.cpp | 41 +- .../source/val/validate_mode_setting.cpp | 455 +- .../source/val/validate_non_uniform.cpp | 366 +- .../source/val/validate_primitives.cpp | 22 +- .../source/val/validate_ray_query.cpp | 73 +- .../source/val/validate_ray_tracing.cpp | 52 +- .../val/validate_ray_tracing_reorder.cpp | 625 + .../source/val/validate_scopes.cpp | 152 +- .../source/val/validate_small_type_uses.cpp | 16 +- .../spirv-tools/source/val/validate_type.cpp | 152 +- .../source/val/validation_state.cpp | 679 +- .../spirv-tools/source/val/validation_state.h | 86 +- bgfx/LICENSE | 2 +- bgfx/README.md | 320 +- bgfx/bindings/bf/bgfx.bf | 75 +- bgfx/bindings/cs/bgfx.cs | 74 +- bgfx/bindings/cs/bgfx_dllname.cs | 2 +- bgfx/bindings/d/fakeenum.d | 79 + bgfx/bindings/d/funcs.d | 4569 ----- bgfx/bindings/d/package.d | 3581 ++++ bgfx/bindings/d/types.d | 1132 -- bgfx/bindings/zig/bgfx.zig | 53 +- bgfx/docs/build.rst | 33 +- bgfx/docs/internals.rst | 2 +- bgfx/docs/license.rst | 2 +- bgfx/docs/overview.rst | 27 +- bgfx/docs/tools.rst | 43 + bgfx/examples/00-helloworld/helloworld.cpp | 11 +- bgfx/examples/01-cubes/cubes.cpp | 3 +- bgfx/examples/01-cubes/fs_cubes.sc | 2 +- bgfx/examples/01-cubes/makefile | 2 +- bgfx/examples/01-cubes/vs_cubes.sc | 2 +- bgfx/examples/02-metaballs/fs_metaballs.sc | 2 +- bgfx/examples/02-metaballs/makefile | 2 +- bgfx/examples/02-metaballs/metaballs.cpp | 3 +- bgfx/examples/02-metaballs/vs_metaballs.sc | 2 +- bgfx/examples/03-raymarch/fs_raymarching.sc | 2 +- bgfx/examples/03-raymarch/makefile | 2 +- bgfx/examples/03-raymarch/raymarch.cpp | 3 +- bgfx/examples/03-raymarch/vs_raymarching.sc | 2 +- bgfx/examples/04-mesh/fs_mesh.sc | 2 +- bgfx/examples/04-mesh/makefile | 2 +- bgfx/examples/04-mesh/mesh.cpp | 3 +- bgfx/examples/04-mesh/vs_mesh.sc | 2 +- bgfx/examples/05-instancing/fs_instancing.sc | 2 +- bgfx/examples/05-instancing/instancing.cpp | 3 +- bgfx/examples/05-instancing/makefile | 2 +- bgfx/examples/05-instancing/vs_instancing.sc | 2 +- bgfx/examples/06-bump/bump.cpp | 3 +- bgfx/examples/06-bump/fs_bump.sc | 2 +- bgfx/examples/06-bump/makefile | 2 +- bgfx/examples/06-bump/vs_bump.sc | 2 +- bgfx/examples/06-bump/vs_bump_instanced.sc | 2 +- bgfx/examples/07-callback/callback.cpp | 13 +- bgfx/examples/07-callback/fs_callback.sc | 2 +- bgfx/examples/07-callback/makefile | 2 +- bgfx/examples/07-callback/vs_callback.sc | 2 +- bgfx/examples/08-update/fs_update.sc | 2 +- bgfx/examples/08-update/fs_update_3d.sc | 2 +- bgfx/examples/08-update/fs_update_cmp.sc | 2 +- bgfx/examples/08-update/makefile | 2 +- bgfx/examples/08-update/update.cpp | 8 +- bgfx/examples/08-update/vs_update.sc | 2 +- bgfx/examples/09-hdr/common.sh | 2 +- bgfx/examples/09-hdr/fs_hdr_blur.sc | 2 +- bgfx/examples/09-hdr/fs_hdr_bright.sc | 2 +- bgfx/examples/09-hdr/fs_hdr_lum.sc | 2 +- bgfx/examples/09-hdr/fs_hdr_lumavg.sc | 2 +- bgfx/examples/09-hdr/fs_hdr_mesh.sc | 2 +- bgfx/examples/09-hdr/fs_hdr_skybox.sc | 2 +- bgfx/examples/09-hdr/fs_hdr_tonemap.sc | 2 +- bgfx/examples/09-hdr/hdr.cpp | 3 +- bgfx/examples/09-hdr/makefile | 2 +- bgfx/examples/09-hdr/vs_hdr_blur.sc | 2 +- bgfx/examples/09-hdr/vs_hdr_bright.sc | 2 +- bgfx/examples/09-hdr/vs_hdr_lum.sc | 2 +- bgfx/examples/09-hdr/vs_hdr_lumavg.sc | 2 +- bgfx/examples/09-hdr/vs_hdr_mesh.sc | 2 +- bgfx/examples/09-hdr/vs_hdr_skybox.sc | 2 +- bgfx/examples/09-hdr/vs_hdr_tonemap.sc | 2 +- bgfx/examples/10-font/font.cpp | 3 +- bgfx/examples/11-fontsdf/fontsdf.cpp | 3 +- bgfx/examples/12-lod/lod.cpp | 1 + bgfx/examples/12-lod/makefile | 2 +- bgfx/examples/13-stencil/makefile | 2 +- bgfx/examples/13-stencil/stencil.cpp | 1 + bgfx/examples/14-shadowvolumes/makefile | 2 +- .../14-shadowvolumes/shadowvolumes.cpp | 1 + bgfx/examples/15-shadowmaps-simple/makefile | 2 +- .../shadowmaps_simple.cpp | 1 + bgfx/examples/16-shadowmaps/makefile | 2 +- bgfx/examples/16-shadowmaps/shadowmaps.cpp | 1 + .../16-shadowmaps/vs_shadowmaps_hblur.sc | 2 +- bgfx/examples/17-drawstress/drawstress.cpp | 3 +- bgfx/examples/17-drawstress/fs_drawstress.sc | 2 +- bgfx/examples/17-drawstress/makefile | 2 +- bgfx/examples/17-drawstress/vs_drawstress.sc | 2 +- bgfx/examples/18-ibl/ibl.cpp | 5 +- bgfx/examples/18-ibl/makefile | 2 +- bgfx/examples/19-oit/fs_oit.sc | 2 +- bgfx/examples/19-oit/fs_oit_wb.sc | 2 +- bgfx/examples/19-oit/fs_oit_wb_blit.sc | 2 +- bgfx/examples/19-oit/fs_oit_wb_separate.sc | 2 +- .../19-oit/fs_oit_wb_separate_blit.sc | 2 +- bgfx/examples/19-oit/makefile | 2 +- bgfx/examples/19-oit/oit.cpp | 3 +- bgfx/examples/19-oit/vs_oit.sc | 2 +- bgfx/examples/19-oit/vs_oit_blit.sc | 2 +- bgfx/examples/20-nanovg/nanovg.cpp | 3 +- bgfx/examples/21-deferred/common.sh | 2 +- bgfx/examples/21-deferred/deferred.cpp | 3 +- .../21-deferred/fs_deferred_clear_uav.sc | 6 +- .../21-deferred/fs_deferred_combine.sc | 2 +- .../21-deferred/fs_deferred_combine_ta.sc | 2 +- .../examples/21-deferred/fs_deferred_debug.sc | 2 +- .../21-deferred/fs_deferred_debug_line.sc | 2 +- .../21-deferred/fs_deferred_debug_ta.sc | 2 +- bgfx/examples/21-deferred/fs_deferred_geom.sc | 2 +- .../examples/21-deferred/fs_deferred_light.sc | 2 +- .../21-deferred/fs_deferred_light_ta.sc | 2 +- .../21-deferred/fs_deferred_light_uav.sc | 4 +- bgfx/examples/21-deferred/makefile | 2 +- .../21-deferred/vs_deferred_combine.sc | 2 +- .../examples/21-deferred/vs_deferred_debug.sc | 2 +- .../21-deferred/vs_deferred_debug_line.sc | 2 +- bgfx/examples/21-deferred/vs_deferred_geom.sc | 2 +- .../examples/21-deferred/vs_deferred_light.sc | 2 +- bgfx/examples/22-windows/windows.cpp | 7 +- bgfx/examples/23-vectordisplay/makefile | 2 +- bgfx/examples/24-nbody/makefile | 2 +- bgfx/examples/24-nbody/nbody.cpp | 1 + bgfx/examples/25-c99/helloworld.c | 6 +- bgfx/examples/26-occlusion/occlusion.cpp | 3 +- bgfx/examples/27-terrain/makefile | 2 +- bgfx/examples/27-terrain/terrain.cpp | 13 +- bgfx/examples/28-wireframe/makefile | 2 +- bgfx/examples/28-wireframe/wireframe.cpp | 9 +- bgfx/examples/29-debugdraw/debugdraw.cpp | 9 +- bgfx/examples/30-picking/fs_picking_id.sc | 2 +- bgfx/examples/30-picking/fs_picking_shaded.sc | 2 +- bgfx/examples/30-picking/makefile | 2 +- bgfx/examples/30-picking/picking.cpp | 1 + bgfx/examples/30-picking/vs_picking_shaded.sc | 2 +- bgfx/examples/31-rsm/makefile | 2 +- bgfx/examples/31-rsm/reflectiveshadowmap.cpp | 1 + bgfx/examples/32-particles/particles.cpp | 3 +- bgfx/examples/33-pom/makefile | 2 +- bgfx/examples/33-pom/pom.cpp | 3 +- bgfx/examples/34-mvs/mvs.cpp | 3 +- bgfx/examples/35-dynamic/dynamic.cpp | 3 +- bgfx/examples/36-sky/makefile | 2 +- bgfx/examples/36-sky/sky.cpp | 11 +- bgfx/examples/36-sky/vs_sky_landscape.sc | 2 +- .../gpudrivenrendering.cpp | 5 +- bgfx/examples/37-gpudrivenrendering/makefile | 2 +- bgfx/examples/38-bloom/bloom.cpp | 1 + bgfx/examples/38-bloom/fs_bloom_combine.sc | 2 +- bgfx/examples/38-bloom/makefile | 2 +- bgfx/examples/38-bloom/vs_deferred_combine.sc | 2 +- bgfx/examples/39-assao/assao.cpp | 1 + bgfx/examples/39-assao/makefile | 2 +- bgfx/examples/40-svt/fs_vt_mip.sc | 2 +- bgfx/examples/40-svt/fs_vt_unlit.sc | 2 +- bgfx/examples/40-svt/makefile | 2 +- bgfx/examples/40-svt/svt.cpp | 1 + bgfx/examples/40-svt/virtualtexture.sh | 2 +- bgfx/examples/40-svt/vs_vt_generic.sc | 2 +- bgfx/examples/40-svt/vt.cpp | 40 +- bgfx/examples/41-tess/makefile | 2 +- bgfx/examples/41-tess/tess.cpp | 1 + bgfx/examples/42-bunnylod/bunnylod.cpp | 43 +- bgfx/examples/42-bunnylod/fs_bunnylod.sc | 2 +- bgfx/examples/42-bunnylod/makefile | 2 +- bgfx/examples/42-bunnylod/vs_bunnylod.sc | 2 +- bgfx/examples/43-denoise/denoise.cpp | 1 + bgfx/examples/44-sss/screen_space_shadows.cpp | 1 + bgfx/examples/45-bokeh/bokeh.cpp | 1 + bgfx/examples/46-fsr/makefile | 2 +- bgfx/examples/47-pixelformats/makefile | 2 +- .../examples/47-pixelformats/pixelformats.cpp | 93 +- .../examples/48-drawindirect/drawindirect.cpp | 1 + bgfx/examples/48-drawindirect/makefile | 2 +- bgfx/examples/49-hextile/hextile.cpp | 1 + bgfx/examples/49-hextile/makefile | 2 +- bgfx/examples/assets/textures/textures.ninja | 54 +- bgfx/examples/common/aviwriter.h | 2 +- bgfx/examples/common/bgfx_utils.cpp | 32 +- bgfx/examples/common/bgfx_utils.h | 2 +- bgfx/examples/common/camera.cpp | 8 +- bgfx/examples/common/common.h | 2 +- bgfx/examples/common/common.sh | 2 +- bgfx/examples/common/debugdraw/debugdraw.cpp | 48 +- bgfx/examples/common/debugdraw/debugdraw.h | 2 +- .../common/debugdraw/fs_debugdraw_fill.sc | 2 +- .../common/debugdraw/fs_debugdraw_fill_lit.sc | 2 +- .../debugdraw/fs_debugdraw_fill_texture.sc | 2 +- .../common/debugdraw/fs_debugdraw_lines.sc | 2 +- .../debugdraw/fs_debugdraw_lines_stipple.sc | 2 +- bgfx/examples/common/debugdraw/makefile | 2 +- .../common/debugdraw/vs_debugdraw_fill.sc | 2 +- .../common/debugdraw/vs_debugdraw_fill_lit.sc | 2 +- .../debugdraw/vs_debugdraw_fill_lit_mesh.sc | 2 +- .../debugdraw/vs_debugdraw_fill_mesh.sc | 2 +- .../debugdraw/vs_debugdraw_fill_texture.sc | 2 +- .../common/debugdraw/vs_debugdraw_lines.sc | 2 +- .../debugdraw/vs_debugdraw_lines_stipple.sc | 2 +- bgfx/examples/common/entry/cmd.cpp | 4 +- bgfx/examples/common/entry/cmd.h | 2 +- bgfx/examples/common/entry/dbg.h | 2 +- bgfx/examples/common/entry/dialog.cpp | 25 +- bgfx/examples/common/entry/dialog.h | 2 +- bgfx/examples/common/entry/dialog_darwin.mm | 2 +- bgfx/examples/common/entry/entry.cpp | 23 +- bgfx/examples/common/entry/entry.h | 6 +- bgfx/examples/common/entry/entry_android.cpp | 14 +- bgfx/examples/common/entry/entry_glfw.cpp | 15 +- bgfx/examples/common/entry/entry_html5.cpp | 8 +- bgfx/examples/common/entry/entry_ios.mm | 13 +- bgfx/examples/common/entry/entry_noop.cpp | 8 +- bgfx/examples/common/entry/entry_osx.mm | 8 +- bgfx/examples/common/entry/entry_p.h | 4 +- bgfx/examples/common/entry/entry_sdl.cpp | 67 +- bgfx/examples/common/entry/entry_windows.cpp | 8 +- bgfx/examples/common/entry/entry_x11.cpp | 8 +- bgfx/examples/common/entry/input.cpp | 4 +- bgfx/examples/common/entry/input.h | 2 +- bgfx/examples/common/example-glue.cpp | 2 +- bgfx/examples/common/font/makefile | 2 +- bgfx/examples/common/imgui/imgui.cpp | 6 +- bgfx/examples/common/imgui/imgui.h | 2 +- bgfx/examples/common/imgui/makefile | 2 +- bgfx/examples/common/imgui/varying.def.sc | 2 - bgfx/examples/common/nanovg/fontstash.h | 2 +- bgfx/examples/common/nanovg/makefile | 2 +- bgfx/examples/common/nanovg/nanovg_bgfx.cpp | 71 +- bgfx/examples/common/nanovg/nanovg_bgfx.h | 10 +- bgfx/examples/common/packrect.h | 2 +- bgfx/examples/common/ps/fs_particle.sc | 2 +- bgfx/examples/common/ps/makefile | 2 +- bgfx/examples/common/ps/particle_system.cpp | 22 +- bgfx/examples/common/ps/particle_system.h | 2 +- bgfx/examples/common/ps/vs_particle.sc | 2 +- bgfx/examples/common/shaderlib.sh | 2 +- bgfx/examples/makefile | 10 +- .../runtime/shaders/dx11/cs_assao_apply.bin | Bin 2152 -> 2186 bytes .../dx11/cs_assao_generate_importance_map.bin | Bin 2067 -> 2097 bytes .../shaders/dx11/cs_assao_generate_q0.bin | Bin 3518 -> 3606 bytes .../shaders/dx11/cs_assao_generate_q1.bin | Bin 5990 -> 6078 bytes .../shaders/dx11/cs_assao_generate_q2.bin | Bin 7282 -> 7370 bytes .../shaders/dx11/cs_assao_generate_q3.bin | Bin 8028 -> 8146 bytes .../shaders/dx11/cs_assao_generate_q3base.bin | Bin 3770 -> 3858 bytes .../dx11/cs_assao_load_counter_clear.bin | Bin 206 -> 206 bytes .../shaders/dx11/cs_assao_non_smart_apply.bin | Bin 956 -> 990 bytes .../shaders/dx11/cs_assao_non_smart_blur.bin | Bin 1224 -> 1258 bytes .../dx11/cs_assao_non_smart_half_apply.bin | Bin 764 -> 798 bytes .../cs_assao_postprocess_importance_map_a.bin | Bin 843 -> 877 bytes .../cs_assao_postprocess_importance_map_b.bin | Bin 1047 -> 1081 bytes .../dx11/cs_assao_prepare_depth_mip.bin | Bin 3294 -> 3302 bytes .../shaders/dx11/cs_assao_prepare_depths.bin | Bin 1217 -> 1245 bytes .../cs_assao_prepare_depths_and_normals.bin | Bin 8497 -> 8525 bytes ..._assao_prepare_depths_and_normals_half.bin | Bin 4917 -> 4945 bytes .../dx11/cs_assao_prepare_depths_half.bin | Bin 789 -> 817 bytes .../shaders/dx11/cs_assao_smart_blur.bin | Bin 1396 -> 1430 bytes .../shaders/dx11/cs_assao_smart_blur_wide.bin | Bin 2104 -> 2138 bytes .../runtime/shaders/dx11/cs_indirect.bin | Bin 447 -> 449 bytes .../shaders/dx11/cs_init_instances.bin | Bin 6775 -> 6777 bytes .../runtime/shaders/dx11/cs_terrain_init.bin | Bin 1359 -> 1361 bytes .../runtime/shaders/dx11/cs_terrain_lod.bin | Bin 7859 -> 7871 bytes .../shaders/dx11/cs_terrain_update_draw.bin | Bin 583 -> 585 bytes .../dx11/cs_terrain_update_indirect.bin | Bin 442 -> 442 bytes .../runtime/shaders/dx11/cs_update.bin | Bin 793 -> 795 bytes .../shaders/dx11/cs_update_instances.bin | Bin 1619 -> 1621 bytes .../runtime/shaders/dx11/fs_albedo_output.bin | Bin 502 -> 504 bytes .../dx11/fs_assao_deferred_combine.bin | Bin 968 -> 1064 bytes .../runtime/shaders/dx11/fs_assao_gbuffer.bin | Bin 445 -> 480 bytes .../runtime/shaders/dx11/fs_bloom_combine.bin | Bin 600 -> 608 bytes .../runtime/shaders/dx11/fs_bokeh_copy.bin | Bin 358 -> 362 bytes .../dx11/fs_bokeh_copy_linear_to_gamma.bin | Bin 470 -> 474 bytes .../shaders/dx11/fs_bokeh_dof_combine.bin | Bin 684 -> 692 bytes .../shaders/dx11/fs_bokeh_dof_debug.bin | Bin 1019 -> 1029 bytes .../shaders/dx11/fs_bokeh_dof_downsample.bin | Bin 759 -> 769 bytes .../shaders/dx11/fs_bokeh_dof_second_pass.bin | Bin 1930 -> 1940 bytes .../shaders/dx11/fs_bokeh_dof_single_pass.bin | Bin 2514 -> 2528 bytes .../runtime/shaders/dx11/fs_bokeh_forward.bin | Bin 2148 -> 2158 bytes .../shaders/dx11/fs_bokeh_forward_grid.bin | Bin 1316 -> 1318 bytes .../shaders/dx11/fs_bokeh_linear_depth.bin | Bin 467 -> 473 bytes .../examples/runtime/shaders/dx11/fs_bump.bin | Bin 3478 -> 3490 bytes .../runtime/shaders/dx11/fs_bunnylod.bin | Bin 802 -> 802 bytes .../runtime/shaders/dx11/fs_callback.bin | Bin 802 -> 802 bytes .../runtime/shaders/dx11/fs_cubes.bin | Bin 270 -> 270 bytes .../dx11/fs_denoise_apply_lighting.bin | Bin 688 -> 696 bytes .../runtime/shaders/dx11/fs_denoise_copy.bin | Bin 358 -> 362 bytes .../dx11/fs_denoise_deferred_combine.bin | Bin 1409 -> 1415 bytes .../shaders/dx11/fs_denoise_gbuffer.bin | Bin 2158 -> 2168 bytes .../shaders/dx11/fs_denoise_spatial_3x3.bin | Bin 2193 -> 2209 bytes .../shaders/dx11/fs_denoise_spatial_5x5.bin | Bin 2241 -> 2257 bytes .../shaders/dx11/fs_denoise_temporal.bin | Bin 2755 -> 2779 bytes .../runtime/shaders/dx11/fs_denoise_txaa.bin | Bin 5069 -> 5089 bytes .../runtime/shaders/dx11/fs_downsample.bin | Bin 2022 -> 2028 bytes .../runtime/shaders/dx11/fs_hdr_blur.bin | Bin 1292 -> 1296 bytes .../runtime/shaders/dx11/fs_hdr_bright.bin | Bin 2585 -> 2597 bytes .../runtime/shaders/dx11/fs_hdr_lum.bin | Bin 2589 -> 2595 bytes .../runtime/shaders/dx11/fs_hdr_lumavg.bin | Bin 3245 -> 3251 bytes .../runtime/shaders/dx11/fs_hdr_mesh.bin | Bin 1912 -> 1918 bytes .../runtime/shaders/dx11/fs_hdr_skybox.bin | Bin 840 -> 846 bytes .../runtime/shaders/dx11/fs_hdr_tonemap.bin | Bin 2688 -> 2702 bytes .../runtime/shaders/dx11/fs_hextile.bin | Bin 8741 -> 5609 bytes .../runtime/shaders/dx11/fs_ibl_mesh.bin | Bin 3557 -> 3567 bytes .../runtime/shaders/dx11/fs_ibl_skybox.bin | Bin 1437 -> 1447 bytes .../examples/runtime/shaders/dx11/fs_mesh.bin | Bin 1669 -> 1671 bytes bgfx/examples/runtime/shaders/dx11/fs_oit.bin | Bin 298 -> 300 bytes .../runtime/shaders/dx11/fs_oit_wb.bin | Bin 706 -> 708 bytes .../runtime/shaders/dx11/fs_oit_wb_blit.bin | Bin 590 -> 598 bytes .../shaders/dx11/fs_oit_wb_separate.bin | Bin 646 -> 648 bytes .../shaders/dx11/fs_oit_wb_separate_blit.bin | Bin 590 -> 598 bytes .../runtime/shaders/dx11/fs_particle.bin | Bin 615 -> 617 bytes .../runtime/shaders/dx11/fs_picking_id.bin | Bin 399 -> 401 bytes .../shaders/dx11/fs_picking_shaded.bin | Bin 1210 -> 1210 bytes bgfx/examples/runtime/shaders/dx11/fs_pom.bin | Bin 7473 -> 7487 bytes .../runtime/shaders/dx11/fs_raymarching.bin | Bin 10019 -> 10023 bytes .../runtime/shaders/dx11/fs_rsm_combine.bin | Bin 3671 -> 3701 bytes .../runtime/shaders/dx11/fs_rsm_gbuffer.bin | Bin 381 -> 383 bytes .../runtime/shaders/dx11/fs_rsm_lbuffer.bin | Bin 1293 -> 1305 bytes .../runtime/shaders/dx11/fs_rsm_shadow.bin | Bin 329 -> 331 bytes .../shaders/dx11/fs_screen_space_shadows.bin | Bin 2415 -> 2423 bytes .../dx11/fs_shadowmaps_color_black.bin | Bin 238 -> 238 bytes .../dx11/fs_shadowmaps_color_lighting_esm.bin | Bin 3638 -> 3666 bytes .../fs_shadowmaps_color_lighting_esm_csm.bin | Bin 6692 -> 6732 bytes ...s_shadowmaps_color_lighting_esm_linear.bin | Bin 3610 -> 3638 bytes ...adowmaps_color_lighting_esm_linear_csm.bin | Bin 6580 -> 6620 bytes ...dowmaps_color_lighting_esm_linear_omni.bin | Bin 5276 -> 5312 bytes .../fs_shadowmaps_color_lighting_esm_omni.bin | Bin 5304 -> 5340 bytes .../fs_shadowmaps_color_lighting_hard.bin | Bin 3522 -> 3550 bytes .../fs_shadowmaps_color_lighting_hard_csm.bin | Bin 6228 -> 6268 bytes ..._shadowmaps_color_lighting_hard_linear.bin | Bin 3494 -> 3522 bytes ...dowmaps_color_lighting_hard_linear_csm.bin | Bin 6116 -> 6156 bytes ...owmaps_color_lighting_hard_linear_omni.bin | Bin 5160 -> 5196 bytes ...fs_shadowmaps_color_lighting_hard_omni.bin | Bin 5188 -> 5224 bytes .../dx11/fs_shadowmaps_color_lighting_pcf.bin | Bin 12105 -> 12135 bytes .../fs_shadowmaps_color_lighting_pcf_csm.bin | Bin 40711 -> 40753 bytes ...s_shadowmaps_color_lighting_pcf_linear.bin | Bin 11037 -> 11067 bytes ...adowmaps_color_lighting_pcf_linear_csm.bin | Bin 36355 -> 36397 bytes ...dowmaps_color_lighting_pcf_linear_omni.bin | Bin 12631 -> 12669 bytes .../fs_shadowmaps_color_lighting_pcf_omni.bin | Bin 13719 -> 13757 bytes .../dx11/fs_shadowmaps_color_lighting_vsm.bin | Bin 3782 -> 3810 bytes .../fs_shadowmaps_color_lighting_vsm_csm.bin | Bin 7364 -> 7404 bytes ...s_shadowmaps_color_lighting_vsm_linear.bin | Bin 3754 -> 3782 bytes ...adowmaps_color_lighting_vsm_linear_csm.bin | Bin 7252 -> 7292 bytes ...dowmaps_color_lighting_vsm_linear_omni.bin | Bin 5420 -> 5456 bytes .../fs_shadowmaps_color_lighting_vsm_omni.bin | Bin 5448 -> 5484 bytes .../dx11/fs_shadowmaps_color_texture.bin | Bin 664 -> 670 bytes .../shaders/dx11/fs_shadowmaps_hblur.bin | Bin 1928 -> 1932 bytes .../shaders/dx11/fs_shadowmaps_hblur_vsm.bin | Bin 2288 -> 2292 bytes .../shaders/dx11/fs_shadowmaps_packdepth.bin | Bin 438 -> 438 bytes .../dx11/fs_shadowmaps_packdepth_linear.bin | Bin 366 -> 366 bytes .../dx11/fs_shadowmaps_packdepth_vsm.bin | Bin 578 -> 578 bytes .../fs_shadowmaps_packdepth_vsm_linear.bin | Bin 506 -> 506 bytes .../shaders/dx11/fs_shadowmaps_texture.bin | Bin 364 -> 368 bytes .../dx11/fs_shadowmaps_unpackdepth.bin | Bin 542 -> 548 bytes .../dx11/fs_shadowmaps_unpackdepth_vsm.bin | Bin 542 -> 548 bytes .../shaders/dx11/fs_shadowmaps_vblur.bin | Bin 1928 -> 1932 bytes .../shaders/dx11/fs_shadowmaps_vblur_vsm.bin | Bin 2288 -> 2292 bytes .../dx11/fs_shadowvolume_color_lighting.bin | Bin 2520 -> 2546 bytes .../dx11/fs_shadowvolume_color_texture.bin | Bin 664 -> 670 bytes .../dx11/fs_shadowvolume_svbackblank.bin | Bin 238 -> 238 bytes .../dx11/fs_shadowvolume_svbackcolor.bin | Bin 282 -> 284 bytes .../dx11/fs_shadowvolume_svbacktex1.bin | Bin 358 -> 358 bytes .../dx11/fs_shadowvolume_svbacktex2.bin | Bin 358 -> 358 bytes .../dx11/fs_shadowvolume_svfrontblank.bin | Bin 238 -> 238 bytes .../dx11/fs_shadowvolume_svfrontcolor.bin | Bin 282 -> 284 bytes .../dx11/fs_shadowvolume_svfronttex1.bin | Bin 358 -> 358 bytes .../dx11/fs_shadowvolume_svfronttex2.bin | Bin 358 -> 358 bytes .../shaders/dx11/fs_shadowvolume_svside.bin | Bin 474 -> 474 bytes .../dx11/fs_shadowvolume_svsideblank.bin | Bin 266 -> 266 bytes .../dx11/fs_shadowvolume_svsidecolor.bin | Bin 310 -> 312 bytes .../dx11/fs_shadowvolume_svsidetex.bin | Bin 581 -> 583 bytes .../shaders/dx11/fs_shadowvolume_texture.bin | Bin 364 -> 368 bytes .../dx11/fs_shadowvolume_texture_lighting.bin | Bin 2726 -> 2754 bytes bgfx/examples/runtime/shaders/dx11/fs_sky.bin | Bin 1054 -> 1058 bytes .../shaders/dx11/fs_sky_color_banding_fix.bin | Bin 1726 -> 1730 bytes .../runtime/shaders/dx11/fs_sky_landscape.bin | Bin 1808 -> 1820 bytes .../runtime/shaders/dx11/fs_sms_mesh.bin | Bin 4401 -> 4407 bytes .../runtime/shaders/dx11/fs_sms_mesh_pd.bin | Bin 5793 -> 5799 bytes .../runtime/shaders/dx11/fs_sms_shadow.bin | Bin 158 -> 238 bytes .../runtime/shaders/dx11/fs_sms_shadow_pd.bin | Bin 489 -> 491 bytes .../shaders/dx11/fs_sss_deferred_combine.bin | Bin 2361 -> 2379 bytes .../runtime/shaders/dx11/fs_sss_gbuffer.bin | Bin 2482 -> 2490 bytes .../shaders/dx11/fs_sss_linear_depth.bin | Bin 467 -> 473 bytes .../runtime/shaders/dx11/fs_sss_unlit.bin | Bin 1206 -> 1206 bytes .../shaders/dx11/fs_stencil_color_black.bin | Bin 238 -> 238 bytes .../dx11/fs_stencil_color_lighting.bin | Bin 2313 -> 2329 bytes .../shaders/dx11/fs_stencil_color_texture.bin | Bin 664 -> 670 bytes .../shaders/dx11/fs_stencil_texture.bin | Bin 364 -> 368 bytes .../dx11/fs_stencil_texture_lighting.bin | Bin 2535 -> 2555 bytes .../runtime/shaders/dx11/fs_terrain.bin | Bin 358 -> 358 bytes .../shaders/dx11/fs_terrain_render.bin | Bin 581 -> 587 bytes .../shaders/dx11/fs_terrain_render_normal.bin | Bin 593 -> 599 bytes .../examples/runtime/shaders/dx11/fs_tree.bin | Bin 1487 -> 1499 bytes .../runtime/shaders/dx11/fs_update.bin | Bin 362 -> 366 bytes .../runtime/shaders/dx11/fs_update_3d.bin | Bin 547 -> 553 bytes .../runtime/shaders/dx11/fs_update_cmp.bin | Bin 432 -> 436 bytes .../runtime/shaders/dx11/fs_upsample.bin | Bin 1546 -> 1554 bytes .../shaders/dx11/fs_vectordisplay_blit.bin | Bin 521 -> 527 bytes .../shaders/dx11/fs_vectordisplay_blur.bin | Bin 1581 -> 1587 bytes .../shaders/dx11/fs_vectordisplay_fb.bin | Bin 525 -> 531 bytes .../runtime/shaders/dx11/fs_vt_mip.bin | Bin 930 -> 922 bytes .../runtime/shaders/dx11/fs_vt_unlit.bin | Bin 1288 -> 1288 bytes .../runtime/shaders/dx11/fs_wf_mesh.bin | Bin 1567 -> 1569 bytes .../runtime/shaders/dx11/fs_wf_wireframe.bin | Bin 899 -> 901 bytes .../runtime/shaders/dx11/vs_albedo_output.bin | Bin 1117 -> 1121 bytes .../runtime/shaders/dx11/vs_assao.bin | Bin 524 -> 532 bytes .../runtime/shaders/dx11/vs_assao_gbuffer.bin | Bin 952 -> 964 bytes .../runtime/shaders/dx11/vs_bokeh_forward.bin | Bin 1286 -> 1292 bytes .../shaders/dx11/vs_bokeh_screenquad.bin | Bin 530 -> 532 bytes .../examples/runtime/shaders/dx11/vs_bump.bin | Bin 1876 -> 1866 bytes .../shaders/dx11/vs_bump_instanced.bin | Bin 1804 -> 1808 bytes .../runtime/shaders/dx11/vs_bunnylod.bin | Bin 746 -> 750 bytes .../runtime/shaders/dx11/vs_callback.bin | Bin 726 -> 730 bytes .../runtime/shaders/dx11/vs_cubes.bin | Bin 522 -> 524 bytes .../shaders/dx11/vs_denoise_gbuffer.bin | Bin 1539 -> 1547 bytes .../shaders/dx11/vs_denoise_screenquad.bin | Bin 530 -> 532 bytes .../runtime/shaders/dx11/vs_fullscreen.bin | Bin 530 -> 532 bytes .../runtime/shaders/dx11/vs_hdr_blur.bin | Bin 1094 -> 1098 bytes .../runtime/shaders/dx11/vs_hdr_bright.bin | Bin 530 -> 532 bytes .../runtime/shaders/dx11/vs_hdr_lum.bin | Bin 530 -> 532 bytes .../runtime/shaders/dx11/vs_hdr_lumavg.bin | Bin 530 -> 532 bytes .../runtime/shaders/dx11/vs_hdr_mesh.bin | Bin 958 -> 962 bytes .../runtime/shaders/dx11/vs_hdr_skybox.bin | Bin 530 -> 532 bytes .../runtime/shaders/dx11/vs_hdr_tonemap.bin | Bin 1042 -> 1046 bytes .../runtime/shaders/dx11/vs_hextile.bin | Bin 1181 -> 861 bytes .../runtime/shaders/dx11/vs_ibl_mesh.bin | Bin 931 -> 937 bytes .../runtime/shaders/dx11/vs_ibl_skybox.bin | Bin 822 -> 828 bytes .../examples/runtime/shaders/dx11/vs_mesh.bin | Bin 1449 -> 1455 bytes bgfx/examples/runtime/shaders/dx11/vs_oit.bin | Bin 818 -> 824 bytes .../runtime/shaders/dx11/vs_oit_blit.bin | Bin 530 -> 532 bytes .../runtime/shaders/dx11/vs_particle.bin | Bin 1165 -> 1171 bytes .../shaders/dx11/vs_picking_shaded.bin | Bin 1061 -> 1067 bytes bgfx/examples/runtime/shaders/dx11/vs_pom.bin | Bin 1888 -> 1896 bytes .../runtime/shaders/dx11/vs_raymarching.bin | Bin 632 -> 634 bytes .../runtime/shaders/dx11/vs_rsm_combine.bin | Bin 530 -> 532 bytes .../runtime/shaders/dx11/vs_rsm_gbuffer.bin | Bin 826 -> 830 bytes .../runtime/shaders/dx11/vs_rsm_lbuffer.bin | Bin 1175 -> 1189 bytes .../runtime/shaders/dx11/vs_rsm_shadow.bin | Bin 770 -> 774 bytes .../shaders/dx11/vs_shadowmaps_color.bin | Bin 416 -> 418 bytes .../dx11/vs_shadowmaps_color_lighting.bin | Bin 1215 -> 1223 bytes .../dx11/vs_shadowmaps_color_lighting_csm.bin | Bin 2172 -> 2188 bytes .../vs_shadowmaps_color_lighting_linear.bin | Bin 1255 -> 1263 bytes ...s_shadowmaps_color_lighting_linear_csm.bin | Bin 2332 -> 2348 bytes ..._shadowmaps_color_lighting_linear_omni.bin | Bin 2243 -> 2259 bytes .../vs_shadowmaps_color_lighting_omni.bin | Bin 2083 -> 2099 bytes .../dx11/vs_shadowmaps_color_texture.bin | Bin 530 -> 532 bytes .../shaders/dx11/vs_shadowmaps_depth.bin | Bin 416 -> 418 bytes .../shaders/dx11/vs_shadowmaps_hblur.bin | Bin 1165 -> 1171 bytes .../shaders/dx11/vs_shadowmaps_packdepth.bin | Bin 504 -> 506 bytes .../dx11/vs_shadowmaps_packdepth_linear.bin | Bin 512 -> 514 bytes .../shaders/dx11/vs_shadowmaps_texture.bin | Bin 530 -> 532 bytes .../dx11/vs_shadowmaps_texture_lighting.bin | Bin 988 -> 992 bytes .../dx11/vs_shadowmaps_unpackdepth.bin | Bin 530 -> 532 bytes .../shaders/dx11/vs_shadowmaps_vblur.bin | Bin 1165 -> 1171 bytes .../dx11/vs_shadowvolume_color_lighting.bin | Bin 950 -> 954 bytes .../dx11/vs_shadowvolume_color_texture.bin | Bin 530 -> 532 bytes .../shaders/dx11/vs_shadowvolume_svback.bin | Bin 608 -> 612 bytes .../shaders/dx11/vs_shadowvolume_svfront.bin | Bin 416 -> 418 bytes .../shaders/dx11/vs_shadowvolume_svside.bin | Bin 778 -> 782 bytes .../shaders/dx11/vs_shadowvolume_texture.bin | Bin 530 -> 532 bytes .../dx11/vs_shadowvolume_texture_lighting.bin | Bin 988 -> 992 bytes bgfx/examples/runtime/shaders/dx11/vs_sky.bin | Bin 3081 -> 3091 bytes .../runtime/shaders/dx11/vs_sky_landscape.bin | Bin 804 -> 808 bytes .../runtime/shaders/dx11/vs_sms_mesh.bin | Bin 1205 -> 1211 bytes .../runtime/shaders/dx11/vs_sms_shadow.bin | Bin 416 -> 418 bytes .../runtime/shaders/dx11/vs_sms_shadow_pd.bin | Bin 504 -> 506 bytes .../runtime/shaders/dx11/vs_sss_gbuffer.bin | Bin 1080 -> 1084 bytes .../shaders/dx11/vs_sss_screenquad.bin | Bin 530 -> 532 bytes .../runtime/shaders/dx11/vs_stencil_color.bin | Bin 416 -> 418 bytes .../dx11/vs_stencil_color_lighting.bin | Bin 920 -> 924 bytes .../shaders/dx11/vs_stencil_color_texture.bin | Bin 530 -> 532 bytes .../shaders/dx11/vs_stencil_texture.bin | Bin 530 -> 532 bytes .../dx11/vs_stencil_texture_lighting.bin | Bin 988 -> 992 bytes .../runtime/shaders/dx11/vs_terrain.bin | Bin 586 -> 588 bytes .../dx11/vs_terrain_height_texture.bin | Bin 755 -> 761 bytes .../shaders/dx11/vs_terrain_render.bin | Bin 2383 -> 2391 bytes .../examples/runtime/shaders/dx11/vs_tree.bin | Bin 1072 -> 1076 bytes .../runtime/shaders/dx11/vs_update.bin | Bin 530 -> 532 bytes .../shaders/dx11/vs_vectordisplay_fb.bin | Bin 632 -> 634 bytes .../runtime/shaders/dx11/vs_vt_generic.bin | Bin 685 -> 689 bytes .../runtime/shaders/dx11/vs_wf_mesh.bin | Bin 1033 -> 1039 bytes .../runtime/shaders/dx11/vs_wf_wireframe.bin | Bin 775 -> 781 bytes .../runtime/shaders/essl/cs_assao_apply.bin | Bin 0 -> 3601 bytes .../essl/cs_assao_generate_importance_map.bin | Bin 0 -> 2607 bytes .../shaders/essl/cs_assao_generate_q0.bin | Bin 0 -> 15455 bytes .../shaders/essl/cs_assao_generate_q1.bin | Bin 0 -> 15455 bytes .../shaders/essl/cs_assao_generate_q2.bin | Bin 0 -> 15455 bytes .../shaders/essl/cs_assao_generate_q3.bin | Bin 0 -> 15455 bytes .../shaders/essl/cs_assao_generate_q3base.bin | Bin 0 -> 15453 bytes .../essl/cs_assao_load_counter_clear.bin | Bin 0 -> 1693 bytes .../shaders/essl/cs_assao_non_smart_apply.bin | Bin 0 -> 2227 bytes .../shaders/essl/cs_assao_non_smart_blur.bin | Bin 0 -> 2549 bytes .../essl/cs_assao_non_smart_half_apply.bin | Bin 0 -> 2082 bytes .../cs_assao_postprocess_importance_map_a.bin | Bin 0 -> 2666 bytes .../cs_assao_postprocess_importance_map_b.bin | Bin 0 -> 2855 bytes .../essl/cs_assao_prepare_depth_mip.bin | Bin 0 -> 5133 bytes .../shaders/essl/cs_assao_prepare_depths.bin | Bin 0 -> 2841 bytes .../cs_assao_prepare_depths_and_normals.bin | Bin 0 -> 7906 bytes ..._assao_prepare_depths_and_normals_half.bin | Bin 0 -> 6878 bytes .../essl/cs_assao_prepare_depths_half.bin | Bin 0 -> 2413 bytes .../shaders/essl/cs_assao_smart_blur.bin | Bin 0 -> 3414 bytes .../shaders/essl/cs_assao_smart_blur_wide.bin | Bin 0 -> 3591 bytes .../runtime/shaders/essl/cs_drawindirect.bin | Bin 3029 -> 3200 bytes .../shaders/essl/cs_drawindirect_count.bin | Bin 0 -> 3355 bytes .../shaders/essl/cs_fsr_bilinear_16.bin | Bin 0 -> 58581 bytes .../shaders/essl/cs_fsr_bilinear_32.bin | Bin 0 -> 32430 bytes .../runtime/shaders/essl/cs_fsr_easu_16.bin | Bin 0 -> 64058 bytes .../runtime/shaders/essl/cs_fsr_easu_32.bin | Bin 0 -> 37242 bytes .../runtime/shaders/essl/cs_fsr_rcas_16.bin | Bin 0 -> 61164 bytes .../runtime/shaders/essl/cs_fsr_rcas_32.bin | Bin 0 -> 34672 bytes .../runtime/shaders/essl/cs_gdr_copy_z.bin | Bin 0 -> 1913 bytes .../shaders/essl/cs_gdr_downscale_hi_z.bin | Bin 0 -> 2353 bytes .../shaders/essl/cs_gdr_occlude_props.bin | Bin 0 -> 3888 bytes .../shaders/essl/cs_gdr_stream_compaction.bin | Bin 0 -> 4060 bytes .../runtime/shaders/essl/cs_indirect.bin | Bin 1684 -> 1855 bytes .../shaders/essl/cs_init_instances.bin | Bin 3836 -> 4007 bytes .../runtime/shaders/essl/cs_terrain_init.bin | Bin 0 -> 2729 bytes .../runtime/shaders/essl/cs_terrain_lod.bin | Bin 0 -> 8014 bytes .../shaders/essl/cs_terrain_update_draw.bin | Bin 0 -> 1985 bytes .../essl/cs_terrain_update_indirect.bin | Bin 0 -> 2035 bytes .../runtime/shaders/essl/cs_update.bin | Bin 1805 -> 1976 bytes .../shaders/essl/cs_update_instances.bin | Bin 3144 -> 3315 bytes .../runtime/shaders/essl/fs_albedo_output.bin | Bin 137 -> 139 bytes .../essl/fs_assao_deferred_combine.bin | Bin 0 -> 997 bytes .../runtime/shaders/essl/fs_assao_gbuffer.bin | Bin 0 -> 303 bytes .../runtime/shaders/essl/fs_bloom_combine.bin | Bin 386 -> 390 bytes .../runtime/shaders/essl/fs_bokeh_copy.bin | Bin 208 -> 210 bytes .../essl/fs_bokeh_copy_linear_to_gamma.bin | Bin 338 -> 340 bytes .../shaders/essl/fs_bokeh_dof_combine.bin | Bin 554 -> 558 bytes .../shaders/essl/fs_bokeh_dof_debug.bin | Bin 879 -> 885 bytes .../shaders/essl/fs_bokeh_dof_downsample.bin | Bin 451 -> 457 bytes .../shaders/essl/fs_bokeh_dof_second_pass.bin | Bin 2684 -> 2692 bytes .../shaders/essl/fs_bokeh_dof_single_pass.bin | Bin 3162 -> 3172 bytes .../runtime/shaders/essl/fs_bokeh_forward.bin | Bin 2044 -> 2050 bytes .../shaders/essl/fs_bokeh_forward_grid.bin | Bin 1105 -> 1107 bytes .../shaders/essl/fs_bokeh_linear_depth.bin | Bin 416 -> 420 bytes .../examples/runtime/shaders/essl/fs_bump.bin | Bin 4759 -> 4767 bytes .../runtime/shaders/essl/fs_bunnylod.bin | Bin 499 -> 499 bytes .../runtime/shaders/essl/fs_callback.bin | Bin 499 -> 499 bytes .../runtime/shaders/essl/fs_cubes.bin | Bin 93 -> 93 bytes .../shaders/essl/fs_deferred_clear_uav.bin | Bin 0 -> 1685 bytes .../shaders/essl/fs_deferred_combine.bin | Bin 779 -> 783 bytes .../shaders/essl/fs_deferred_combine_ta.bin | Bin 0 -> 862 bytes .../shaders/essl/fs_deferred_debug.bin | Bin 217 -> 219 bytes .../shaders/essl/fs_deferred_debug_line.bin | Bin 93 -> 93 bytes .../shaders/essl/fs_deferred_debug_ta.bin | Bin 0 -> 350 bytes .../runtime/shaders/essl/fs_deferred_geom.bin | Bin 1063 -> 1069 bytes .../shaders/essl/fs_deferred_light.bin | Bin 1898 -> 1910 bytes .../shaders/essl/fs_deferred_light_ta.bin | Bin 0 -> 1994 bytes .../shaders/essl/fs_deferred_light_uav.bin | Bin 0 -> 11654 bytes .../essl/fs_denoise_apply_lighting.bin | Bin 413 -> 417 bytes .../runtime/shaders/essl/fs_denoise_copy.bin | Bin 208 -> 210 bytes .../essl/fs_denoise_deferred_combine.bin | Bin 1705 -> 1709 bytes .../shaders/essl/fs_denoise_gbuffer.bin | Bin 2486 -> 2492 bytes .../shaders/essl/fs_denoise_spatial_3x3.bin | Bin 2146 -> 2154 bytes .../shaders/essl/fs_denoise_spatial_5x5.bin | Bin 2214 -> 2222 bytes .../shaders/essl/fs_denoise_temporal.bin | Bin 3896 -> 3910 bytes .../runtime/shaders/essl/fs_denoise_txaa.bin | Bin 6822 -> 6834 bytes .../runtime/shaders/essl/fs_downsample.bin | Bin 2003 -> 2007 bytes .../essl/fs_fsr_copy_linear_to_gamma.bin | Bin 0 -> 340 bytes .../runtime/shaders/essl/fs_fsr_forward.bin | Bin 0 -> 2050 bytes .../shaders/essl/fs_fsr_forward_grid.bin | Bin 0 -> 1107 bytes .../fs_gdr_instanced_indirect_rendering.bin | Bin 0 -> 494 bytes .../runtime/shaders/essl/fs_hdr_blur.bin | Bin 1013 -> 1015 bytes .../runtime/shaders/essl/fs_hdr_bright.bin | Bin 2443 -> 2451 bytes .../runtime/shaders/essl/fs_hdr_lum.bin | Bin 2367 -> 2371 bytes .../runtime/shaders/essl/fs_hdr_lumavg.bin | Bin 3290 -> 3294 bytes .../runtime/shaders/essl/fs_hdr_mesh.bin | Bin 1805 -> 1809 bytes .../runtime/shaders/essl/fs_hdr_skybox.bin | Bin 708 -> 712 bytes .../runtime/shaders/essl/fs_hdr_tonemap.bin | Bin 2718 -> 2726 bytes .../runtime/shaders/essl/fs_ibl_mesh.bin | Bin 3577 -> 3583 bytes .../runtime/shaders/essl/fs_ibl_skybox.bin | Bin 1865 -> 1871 bytes .../examples/runtime/shaders/essl/fs_mesh.bin | Bin 1425 -> 1427 bytes bgfx/examples/runtime/shaders/essl/fs_oit.bin | Bin 107 -> 109 bytes .../runtime/shaders/essl/fs_oit_wb.bin | Bin 379 -> 380 bytes .../runtime/shaders/essl/fs_oit_wb_blit.bin | Bin 419 -> 423 bytes .../shaders/essl/fs_oit_wb_separate.bin | Bin 447 -> 448 bytes .../shaders/essl/fs_oit_wb_separate_blit.bin | Bin 419 -> 423 bytes .../runtime/shaders/essl/fs_particle.bin | Bin 378 -> 380 bytes .../runtime/shaders/essl/fs_picking_id.bin | Bin 130 -> 132 bytes .../shaders/essl/fs_picking_shaded.bin | Bin 878 -> 878 bytes bgfx/examples/runtime/shaders/essl/fs_pom.bin | Bin 2881 -> 2889 bytes .../runtime/shaders/essl/fs_raymarching.bin | Bin 12624 -> 12628 bytes .../runtime/shaders/essl/fs_rsm_combine.bin | Bin 7994 -> 8014 bytes .../runtime/shaders/essl/fs_rsm_gbuffer.bin | Bin 194 -> 196 bytes .../runtime/shaders/essl/fs_rsm_lbuffer.bin | Bin 1321 -> 1329 bytes .../runtime/shaders/essl/fs_rsm_shadow.bin | Bin 179 -> 181 bytes .../shaders/essl/fs_screen_space_shadows.bin | Bin 3355 -> 3361 bytes .../essl/fs_shadowmaps_color_black.bin | Bin 80 -> 80 bytes .../essl/fs_shadowmaps_color_lighting_esm.bin | Bin 4243 -> 4266 bytes .../fs_shadowmaps_color_lighting_esm_csm.bin | Bin 10258 -> 10281 bytes ...s_shadowmaps_color_lighting_esm_linear.bin | Bin 4287 -> 4310 bytes ...adowmaps_color_lighting_esm_linear_csm.bin | Bin 10478 -> 10501 bytes ...dowmaps_color_lighting_esm_linear_omni.bin | Bin 7625 -> 7656 bytes .../fs_shadowmaps_color_lighting_esm_omni.bin | Bin 7579 -> 7610 bytes .../fs_shadowmaps_color_lighting_hard.bin | Bin 4115 -> 4138 bytes .../fs_shadowmaps_color_lighting_hard_csm.bin | Bin 9714 -> 9737 bytes ..._shadowmaps_color_lighting_hard_linear.bin | Bin 4147 -> 4170 bytes ...dowmaps_color_lighting_hard_linear_csm.bin | Bin 9850 -> 9873 bytes ...owmaps_color_lighting_hard_linear_omni.bin | Bin 7486 -> 7517 bytes ...fs_shadowmaps_color_lighting_hard_omni.bin | Bin 7452 -> 7483 bytes .../essl/fs_shadowmaps_color_lighting_pcf.bin | Bin 15768 -> 15763 bytes .../fs_shadowmaps_color_lighting_pcf_csm.bin | Bin 63510 -> 63415 bytes ...s_shadowmaps_color_lighting_pcf_linear.bin | Bin 15819 -> 15814 bytes ...adowmaps_color_lighting_pcf_linear_csm.bin | Bin 63956 -> 63861 bytes ...dowmaps_color_lighting_pcf_linear_omni.bin | Bin 19357 -> 19360 bytes .../fs_shadowmaps_color_lighting_pcf_omni.bin | Bin 19302 -> 19305 bytes .../essl/fs_shadowmaps_color_lighting_vsm.bin | Bin 4665 -> 4690 bytes .../fs_shadowmaps_color_lighting_vsm_csm.bin | Bin 12188 -> 12219 bytes ...s_shadowmaps_color_lighting_vsm_linear.bin | Bin 4709 -> 4734 bytes ...adowmaps_color_lighting_vsm_linear_csm.bin | Bin 12408 -> 12439 bytes ...dowmaps_color_lighting_vsm_linear_omni.bin | Bin 8049 -> 8082 bytes .../fs_shadowmaps_color_lighting_vsm_omni.bin | Bin 8003 -> 8036 bytes .../essl/fs_shadowmaps_color_texture.bin | Bin 695 -> 699 bytes .../shaders/essl/fs_shadowmaps_hblur.bin | Bin 1752 -> 1735 bytes .../shaders/essl/fs_shadowmaps_hblur_vsm.bin | Bin 2750 -> 2752 bytes .../shaders/essl/fs_shadowmaps_packdepth.bin | Bin 306 -> 305 bytes .../essl/fs_shadowmaps_packdepth_linear.bin | Bin 258 -> 257 bytes .../essl/fs_shadowmaps_packdepth_vsm.bin | Bin 501 -> 501 bytes .../fs_shadowmaps_packdepth_vsm_linear.bin | Bin 412 -> 412 bytes .../shaders/essl/fs_shadowmaps_texture.bin | Bin 217 -> 219 bytes .../essl/fs_shadowmaps_unpackdepth.bin | Bin 429 -> 431 bytes .../essl/fs_shadowmaps_unpackdepth_vsm.bin | Bin 402 -> 406 bytes .../shaders/essl/fs_shadowmaps_vblur.bin | Bin 1752 -> 1735 bytes .../shaders/essl/fs_shadowmaps_vblur_vsm.bin | Bin 2750 -> 2752 bytes .../essl/fs_shadowvolume_color_lighting.bin | Bin 2355 -> 2379 bytes .../essl/fs_shadowvolume_color_texture.bin | Bin 695 -> 699 bytes .../essl/fs_shadowvolume_svbackblank.bin | Bin 169 -> 169 bytes .../essl/fs_shadowvolume_svbackcolor.bin | Bin 140 -> 142 bytes .../essl/fs_shadowvolume_svbacktex1.bin | Bin 445 -> 445 bytes .../essl/fs_shadowvolume_svbacktex2.bin | Bin 445 -> 445 bytes .../essl/fs_shadowvolume_svfrontblank.bin | Bin 177 -> 177 bytes .../essl/fs_shadowvolume_svfrontcolor.bin | Bin 140 -> 142 bytes .../essl/fs_shadowvolume_svfronttex1.bin | Bin 442 -> 442 bytes .../essl/fs_shadowvolume_svfronttex2.bin | Bin 442 -> 442 bytes .../shaders/essl/fs_shadowvolume_svside.bin | Bin 472 -> 472 bytes .../essl/fs_shadowvolume_svsideblank.bin | Bin 80 -> 80 bytes .../essl/fs_shadowvolume_svsidecolor.bin | Bin 140 -> 142 bytes .../essl/fs_shadowvolume_svsidetex.bin | Bin 576 -> 578 bytes .../shaders/essl/fs_shadowvolume_texture.bin | Bin 217 -> 219 bytes .../essl/fs_shadowvolume_texture_lighting.bin | Bin 2586 -> 2610 bytes bgfx/examples/runtime/shaders/essl/fs_sky.bin | Bin 735 -> 739 bytes .../shaders/essl/fs_sky_color_banding_fix.bin | Bin 1149 -> 1152 bytes .../runtime/shaders/essl/fs_sky_landscape.bin | Bin 1295 -> 1304 bytes .../runtime/shaders/essl/fs_sms_mesh.bin | Bin 8407 -> 8411 bytes .../runtime/shaders/essl/fs_sms_mesh_pd.bin | Bin 8660 -> 8632 bytes .../runtime/shaders/essl/fs_sms_shadow.bin | Bin 34 -> 169 bytes .../runtime/shaders/essl/fs_sms_shadow_pd.bin | Bin 406 -> 407 bytes .../shaders/essl/fs_sss_deferred_combine.bin | Bin 2915 -> 2924 bytes .../runtime/shaders/essl/fs_sss_gbuffer.bin | Bin 3097 -> 3101 bytes .../shaders/essl/fs_sss_linear_depth.bin | Bin 416 -> 420 bytes .../runtime/shaders/essl/fs_sss_unlit.bin | Bin 1370 -> 1370 bytes .../shaders/essl/fs_stencil_color_black.bin | Bin 80 -> 80 bytes .../essl/fs_stencil_color_lighting.bin | Bin 2260 -> 2276 bytes .../shaders/essl/fs_stencil_color_texture.bin | Bin 695 -> 699 bytes .../shaders/essl/fs_stencil_texture.bin | Bin 217 -> 219 bytes .../essl/fs_stencil_texture_lighting.bin | Bin 2584 -> 2602 bytes .../runtime/shaders/essl/fs_terrain.bin | Bin 239 -> 239 bytes .../shaders/essl/fs_terrain_render.bin | Bin 0 -> 6089 bytes .../shaders/essl/fs_terrain_render_normal.bin | Bin 0 -> 6028 bytes .../examples/runtime/shaders/essl/fs_tree.bin | Bin 1324 -> 1332 bytes .../runtime/shaders/essl/fs_update.bin | Bin 223 -> 225 bytes .../runtime/shaders/essl/fs_update_3d.bin | Bin 527 -> 531 bytes .../runtime/shaders/essl/fs_update_cmp.bin | Bin 236 -> 238 bytes .../runtime/shaders/essl/fs_upsample.bin | Bin 1603 -> 1609 bytes .../shaders/essl/fs_vectordisplay_blit.bin | Bin 422 -> 426 bytes .../shaders/essl/fs_vectordisplay_blur.bin | Bin 2020 -> 2024 bytes .../shaders/essl/fs_vectordisplay_fb.bin | Bin 406 -> 410 bytes .../runtime/shaders/essl/fs_vt_mip.bin | Bin 824 -> 828 bytes .../runtime/shaders/essl/fs_vt_unlit.bin | Bin 1195 -> 1203 bytes .../runtime/shaders/essl/fs_wf_mesh.bin | Bin 1527 -> 1529 bytes .../runtime/shaders/essl/fs_wf_wireframe.bin | Bin 765 -> 767 bytes .../runtime/shaders/essl/vs_albedo_output.bin | Bin 459 -> 463 bytes .../runtime/shaders/essl/vs_assao.bin | Bin 0 -> 349 bytes .../runtime/shaders/essl/vs_assao_gbuffer.bin | Bin 0 -> 626 bytes .../runtime/shaders/essl/vs_bokeh_forward.bin | Bin 1131 -> 1137 bytes .../shaders/essl/vs_bokeh_screenquad.bin | Bin 347 -> 349 bytes .../examples/runtime/shaders/essl/vs_bump.bin | Bin 1480 -> 1486 bytes .../shaders/essl/vs_bump_instanced.bin | Bin 1805 -> 1809 bytes .../runtime/shaders/essl/vs_bunnylod.bin | Bin 584 -> 588 bytes .../runtime/shaders/essl/vs_callback.bin | Bin 514 -> 518 bytes .../runtime/shaders/essl/vs_cubes.bin | Bin 331 -> 333 bytes .../shaders/essl/vs_deferred_combine.bin | Bin 343 -> 345 bytes .../shaders/essl/vs_deferred_debug.bin | Bin 343 -> 345 bytes .../shaders/essl/vs_deferred_debug_line.bin | Bin 331 -> 333 bytes .../runtime/shaders/essl/vs_deferred_geom.bin | Bin 1753 -> 1759 bytes .../shaders/essl/vs_deferred_light.bin | Bin 343 -> 345 bytes .../shaders/essl/vs_denoise_gbuffer.bin | Bin 1666 -> 1674 bytes .../shaders/essl/vs_denoise_screenquad.bin | Bin 347 -> 349 bytes .../runtime/shaders/essl/vs_fsr_forward.bin | Bin 0 -> 1124 bytes .../shaders/essl/vs_fsr_screenquad.bin | Bin 0 -> 349 bytes .../runtime/shaders/essl/vs_fullscreen.bin | Bin 343 -> 345 bytes .../vs_gdr_instanced_indirect_rendering.bin | Bin 0 -> 631 bytes .../shaders/essl/vs_gdr_render_occlusion.bin | Bin 0 -> 494 bytes .../runtime/shaders/essl/vs_hdr_blur.bin | Bin 1493 -> 1497 bytes .../runtime/shaders/essl/vs_hdr_bright.bin | Bin 343 -> 345 bytes .../runtime/shaders/essl/vs_hdr_lum.bin | Bin 343 -> 345 bytes .../runtime/shaders/essl/vs_hdr_lumavg.bin | Bin 343 -> 345 bytes .../runtime/shaders/essl/vs_hdr_mesh.bin | Bin 682 -> 686 bytes .../runtime/shaders/essl/vs_hdr_skybox.bin | Bin 343 -> 345 bytes .../runtime/shaders/essl/vs_hdr_tonemap.bin | Bin 1411 -> 1415 bytes .../runtime/shaders/essl/vs_ibl_mesh.bin | Bin 681 -> 687 bytes .../runtime/shaders/essl/vs_ibl_skybox.bin | Bin 782 -> 788 bytes .../runtime/shaders/essl/vs_instancing.bin | Bin 616 -> 616 bytes .../examples/runtime/shaders/essl/vs_mesh.bin | Bin 1499 -> 1505 bytes bgfx/examples/runtime/shaders/essl/vs_oit.bin | Bin 614 -> 620 bytes .../runtime/shaders/essl/vs_oit_blit.bin | Bin 343 -> 345 bytes .../runtime/shaders/essl/vs_particle.bin | Bin 895 -> 901 bytes .../shaders/essl/vs_picking_shaded.bin | Bin 803 -> 809 bytes bgfx/examples/runtime/shaders/essl/vs_pom.bin | Bin 1502 -> 1510 bytes .../runtime/shaders/essl/vs_raymarching.bin | Bin 426 -> 428 bytes .../runtime/shaders/essl/vs_rsm_combine.bin | Bin 343 -> 345 bytes .../runtime/shaders/essl/vs_rsm_gbuffer.bin | Bin 514 -> 518 bytes .../runtime/shaders/essl/vs_rsm_lbuffer.bin | Bin 1210 -> 1220 bytes .../runtime/shaders/essl/vs_rsm_shadow.bin | Bin 524 -> 528 bytes .../shaders/essl/vs_shadowmaps_color.bin | Bin 248 -> 250 bytes .../essl/vs_shadowmaps_color_lighting.bin | Bin 970 -> 978 bytes .../essl/vs_shadowmaps_color_lighting_csm.bin | Bin 1598 -> 1614 bytes .../vs_shadowmaps_color_lighting_linear.bin | Bin 1015 -> 1023 bytes ...s_shadowmaps_color_lighting_linear_csm.bin | Bin 1762 -> 1778 bytes ..._shadowmaps_color_lighting_linear_omni.bin | Bin 1688 -> 1704 bytes .../vs_shadowmaps_color_lighting_omni.bin | Bin 1524 -> 1540 bytes .../essl/vs_shadowmaps_color_texture.bin | Bin 343 -> 345 bytes .../shaders/essl/vs_shadowmaps_depth.bin | Bin 248 -> 250 bytes .../shaders/essl/vs_shadowmaps_hblur.bin | Bin 1494 -> 1500 bytes .../shaders/essl/vs_shadowmaps_packdepth.bin | Bin 307 -> 309 bytes .../essl/vs_shadowmaps_packdepth_linear.bin | Bin 320 -> 322 bytes .../shaders/essl/vs_shadowmaps_texture.bin | Bin 343 -> 345 bytes .../essl/vs_shadowmaps_texture_lighting.bin | Bin 728 -> 732 bytes .../essl/vs_shadowmaps_unpackdepth.bin | Bin 343 -> 345 bytes .../shaders/essl/vs_shadowmaps_vblur.bin | Bin 1494 -> 1500 bytes .../essl/vs_shadowvolume_color_lighting.bin | Bin 633 -> 637 bytes .../essl/vs_shadowvolume_color_texture.bin | Bin 343 -> 345 bytes .../shaders/essl/vs_shadowvolume_svback.bin | Bin 452 -> 456 bytes .../shaders/essl/vs_shadowvolume_svfront.bin | Bin 248 -> 250 bytes .../shaders/essl/vs_shadowvolume_svside.bin | Bin 636 -> 640 bytes .../shaders/essl/vs_shadowvolume_texture.bin | Bin 343 -> 345 bytes .../essl/vs_shadowvolume_texture_lighting.bin | Bin 728 -> 732 bytes bgfx/examples/runtime/shaders/essl/vs_sky.bin | Bin 3418 -> 3428 bytes .../runtime/shaders/essl/vs_sky_landscape.bin | Bin 577 -> 581 bytes .../runtime/shaders/essl/vs_sms_mesh.bin | Bin 916 -> 922 bytes .../runtime/shaders/essl/vs_sms_shadow.bin | Bin 248 -> 250 bytes .../runtime/shaders/essl/vs_sms_shadow_pd.bin | Bin 307 -> 309 bytes .../runtime/shaders/essl/vs_sss_gbuffer.bin | Bin 851 -> 855 bytes .../shaders/essl/vs_sss_screenquad.bin | Bin 347 -> 349 bytes .../runtime/shaders/essl/vs_stencil_color.bin | Bin 248 -> 250 bytes .../essl/vs_stencil_color_lighting.bin | Bin 633 -> 637 bytes .../shaders/essl/vs_stencil_color_texture.bin | Bin 343 -> 345 bytes .../shaders/essl/vs_stencil_texture.bin | Bin 343 -> 345 bytes .../essl/vs_stencil_texture_lighting.bin | Bin 728 -> 732 bytes .../runtime/shaders/essl/vs_terrain.bin | Bin 401 -> 403 bytes .../essl/vs_terrain_height_texture.bin | Bin 546 -> 550 bytes .../shaders/essl/vs_terrain_render.bin | Bin 0 -> 6712 bytes .../examples/runtime/shaders/essl/vs_tree.bin | Bin 795 -> 799 bytes .../runtime/shaders/essl/vs_update.bin | Bin 343 -> 345 bytes .../shaders/essl/vs_vectordisplay_fb.bin | Bin 426 -> 428 bytes .../runtime/shaders/essl/vs_vt_generic.bin | Bin 459 -> 463 bytes .../runtime/shaders/essl/vs_wf_mesh.bin | Bin 755 -> 761 bytes .../runtime/shaders/essl/vs_wf_wireframe.bin | Bin 567 -> 573 bytes .../runtime/shaders/glsl/cs_assao_apply.bin | Bin 3434 -> 3592 bytes .../glsl/cs_assao_generate_importance_map.bin | Bin 2438 -> 2598 bytes .../shaders/glsl/cs_assao_generate_q0.bin | Bin 15275 -> 15434 bytes .../shaders/glsl/cs_assao_generate_q1.bin | Bin 15275 -> 15434 bytes .../shaders/glsl/cs_assao_generate_q2.bin | Bin 15275 -> 15434 bytes .../shaders/glsl/cs_assao_generate_q3.bin | Bin 15275 -> 15434 bytes .../shaders/glsl/cs_assao_generate_q3base.bin | Bin 15273 -> 15432 bytes .../glsl/cs_assao_load_counter_clear.bin | Bin 1532 -> 1690 bytes .../shaders/glsl/cs_assao_non_smart_apply.bin | Bin 2060 -> 2218 bytes .../shaders/glsl/cs_assao_non_smart_blur.bin | Bin 2382 -> 2540 bytes .../glsl/cs_assao_non_smart_half_apply.bin | Bin 1915 -> 2073 bytes .../cs_assao_postprocess_importance_map_a.bin | Bin 2509 -> 2657 bytes .../cs_assao_postprocess_importance_map_b.bin | Bin 2698 -> 2846 bytes .../glsl/cs_assao_prepare_depth_mip.bin | Bin 4924 -> 5082 bytes .../shaders/glsl/cs_assao_prepare_depths.bin | Bin 2656 -> 2814 bytes .../cs_assao_prepare_depths_and_normals.bin | Bin 7731 -> 7873 bytes ..._assao_prepare_depths_and_normals_half.bin | Bin 6715 -> 6857 bytes .../glsl/cs_assao_prepare_depths_half.bin | Bin 2240 -> 2398 bytes .../shaders/glsl/cs_assao_smart_blur.bin | Bin 3241 -> 3405 bytes .../shaders/glsl/cs_assao_smart_blur_wide.bin | Bin 3424 -> 3582 bytes .../shaders/glsl/cs_fsr_bilinear_16.bin | Bin 58590 -> 58572 bytes .../shaders/glsl/cs_fsr_bilinear_32.bin | Bin 32439 -> 32421 bytes .../runtime/shaders/glsl/cs_fsr_easu_16.bin | Bin 64067 -> 64049 bytes .../runtime/shaders/glsl/cs_fsr_easu_32.bin | Bin 37251 -> 37233 bytes .../runtime/shaders/glsl/cs_fsr_rcas_16.bin | Bin 61163 -> 61155 bytes .../runtime/shaders/glsl/cs_fsr_rcas_32.bin | Bin 34671 -> 34663 bytes .../runtime/shaders/glsl/cs_gdr_copy_z.bin | Bin 1910 -> 1904 bytes .../shaders/glsl/cs_gdr_downscale_hi_z.bin | Bin 2350 -> 2338 bytes .../runtime/shaders/glsl/cs_indirect.bin | Bin 1852 -> 1852 bytes .../shaders/glsl/cs_init_instances.bin | Bin 4004 -> 4004 bytes .../runtime/shaders/glsl/cs_update.bin | Bin 1967 -> 1967 bytes .../shaders/glsl/cs_update_instances.bin | Bin 3312 -> 3312 bytes .../runtime/shaders/glsl/fs_albedo_output.bin | Bin 131 -> 133 bytes .../glsl/fs_assao_deferred_combine.bin | Bin 949 -> 965 bytes .../runtime/shaders/glsl/fs_assao_gbuffer.bin | Bin 242 -> 246 bytes .../runtime/shaders/glsl/fs_bloom_combine.bin | Bin 375 -> 379 bytes .../runtime/shaders/glsl/fs_bokeh_copy.bin | Bin 157 -> 159 bytes .../glsl/fs_bokeh_copy_linear_to_gamma.bin | Bin 322 -> 324 bytes .../shaders/glsl/fs_bokeh_dof_combine.bin | Bin 533 -> 537 bytes .../shaders/glsl/fs_bokeh_dof_debug.bin | Bin 853 -> 859 bytes .../shaders/glsl/fs_bokeh_dof_downsample.bin | Bin 440 -> 446 bytes .../shaders/glsl/fs_bokeh_dof_second_pass.bin | Bin 2538 -> 2546 bytes .../shaders/glsl/fs_bokeh_dof_single_pass.bin | Bin 2941 -> 2951 bytes .../runtime/shaders/glsl/fs_bokeh_forward.bin | Bin 1882 -> 1888 bytes .../shaders/glsl/fs_bokeh_forward_grid.bin | Bin 1037 -> 1039 bytes .../shaders/glsl/fs_bokeh_linear_depth.bin | Bin 397 -> 401 bytes .../examples/runtime/shaders/glsl/fs_bump.bin | Bin 4441 -> 4449 bytes .../runtime/shaders/glsl/fs_bunnylod.bin | Bin 469 -> 469 bytes .../runtime/shaders/glsl/fs_callback.bin | Bin 469 -> 469 bytes .../runtime/shaders/glsl/fs_cubes.bin | Bin 87 -> 87 bytes .../shaders/glsl/fs_deferred_clear_uav.bin | Bin 2027 -> 2021 bytes .../runtime/shaders/glsl/fs_deferred_geom.bin | Bin 920 -> 920 bytes .../shaders/glsl/fs_deferred_light.bin | Bin 1778 -> 1778 bytes .../shaders/glsl/fs_deferred_light_ta.bin | Bin 1856 -> 1856 bytes .../shaders/glsl/fs_deferred_light_uav.bin | Bin 11996 -> 11990 bytes .../glsl/fs_denoise_apply_lighting.bin | Bin 402 -> 406 bytes .../runtime/shaders/glsl/fs_denoise_copy.bin | Bin 157 -> 159 bytes .../glsl/fs_denoise_deferred_combine.bin | Bin 1548 -> 1552 bytes .../shaders/glsl/fs_denoise_gbuffer.bin | Bin 2191 -> 2197 bytes .../shaders/glsl/fs_denoise_spatial_3x3.bin | Bin 2068 -> 2076 bytes .../shaders/glsl/fs_denoise_spatial_5x5.bin | Bin 2136 -> 2144 bytes .../shaders/glsl/fs_denoise_temporal.bin | Bin 3723 -> 3737 bytes .../runtime/shaders/glsl/fs_denoise_txaa.bin | Bin 6595 -> 6607 bytes .../runtime/shaders/glsl/fs_downsample.bin | Bin 1914 -> 1918 bytes .../runtime/shaders/glsl/fs_hdr_blur.bin | Bin 930 -> 932 bytes .../runtime/shaders/glsl/fs_hdr_bright.bin | Bin 2315 -> 2323 bytes .../runtime/shaders/glsl/fs_hdr_lum.bin | Bin 2249 -> 2253 bytes .../runtime/shaders/glsl/fs_hdr_lumavg.bin | Bin 3132 -> 3136 bytes .../runtime/shaders/glsl/fs_hdr_mesh.bin | Bin 1657 -> 1661 bytes .../runtime/shaders/glsl/fs_hdr_skybox.bin | Bin 616 -> 620 bytes .../runtime/shaders/glsl/fs_hdr_tonemap.bin | Bin 2566 -> 2574 bytes .../runtime/shaders/glsl/fs_ibl_mesh.bin | Bin 3325 -> 3331 bytes .../runtime/shaders/glsl/fs_ibl_skybox.bin | Bin 1718 -> 1724 bytes .../examples/runtime/shaders/glsl/fs_mesh.bin | Bin 1353 -> 1355 bytes bgfx/examples/runtime/shaders/glsl/fs_oit.bin | Bin 101 -> 103 bytes .../runtime/shaders/glsl/fs_oit_wb.bin | Bin 361 -> 362 bytes .../runtime/shaders/glsl/fs_oit_wb_blit.bin | Bin 403 -> 407 bytes .../shaders/glsl/fs_oit_wb_separate.bin | Bin 419 -> 420 bytes .../shaders/glsl/fs_oit_wb_separate_blit.bin | Bin 403 -> 407 bytes .../runtime/shaders/glsl/fs_particle.bin | Bin 364 -> 366 bytes .../runtime/shaders/glsl/fs_picking_id.bin | Bin 124 -> 126 bytes .../shaders/glsl/fs_picking_shaded.bin | Bin 830 -> 830 bytes bgfx/examples/runtime/shaders/glsl/fs_pom.bin | Bin 2740 -> 2748 bytes .../runtime/shaders/glsl/fs_raymarching.bin | Bin 11958 -> 11962 bytes .../runtime/shaders/glsl/fs_rsm_combine.bin | Bin 7589 -> 7609 bytes .../runtime/shaders/glsl/fs_rsm_gbuffer.bin | Bin 182 -> 184 bytes .../runtime/shaders/glsl/fs_rsm_lbuffer.bin | Bin 1114 -> 1122 bytes .../runtime/shaders/glsl/fs_rsm_shadow.bin | Bin 167 -> 169 bytes .../shaders/glsl/fs_screen_space_shadows.bin | Bin 3167 -> 3173 bytes .../glsl/fs_shadowmaps_color_black.bin | Bin 80 -> 80 bytes .../glsl/fs_shadowmaps_color_lighting_esm.bin | Bin 4006 -> 4029 bytes .../fs_shadowmaps_color_lighting_esm_csm.bin | Bin 9876 -> 9899 bytes ...s_shadowmaps_color_lighting_esm_linear.bin | Bin 4050 -> 4073 bytes ...adowmaps_color_lighting_esm_linear_csm.bin | Bin 10096 -> 10119 bytes ...dowmaps_color_lighting_esm_linear_omni.bin | Bin 7269 -> 7300 bytes .../fs_shadowmaps_color_lighting_esm_omni.bin | Bin 7223 -> 7254 bytes .../fs_shadowmaps_color_lighting_hard.bin | Bin 3884 -> 3907 bytes .../fs_shadowmaps_color_lighting_hard_csm.bin | Bin 9356 -> 9379 bytes ..._shadowmaps_color_lighting_hard_linear.bin | Bin 3916 -> 3939 bytes ...dowmaps_color_lighting_hard_linear_csm.bin | Bin 9492 -> 9515 bytes ...owmaps_color_lighting_hard_linear_omni.bin | Bin 7136 -> 7167 bytes ...fs_shadowmaps_color_lighting_hard_omni.bin | Bin 7102 -> 7133 bytes .../glsl/fs_shadowmaps_color_lighting_pcf.bin | Bin 15155 -> 15150 bytes .../fs_shadowmaps_color_lighting_pcf_csm.bin | Bin 61671 -> 61576 bytes ...s_shadowmaps_color_lighting_pcf_linear.bin | Bin 15200 -> 15195 bytes ...adowmaps_color_lighting_pcf_linear_csm.bin | Bin 62093 -> 61998 bytes ...dowmaps_color_lighting_pcf_linear_omni.bin | Bin 18613 -> 18616 bytes .../fs_shadowmaps_color_lighting_pcf_omni.bin | Bin 18564 -> 18567 bytes .../glsl/fs_shadowmaps_color_lighting_vsm.bin | Bin 4403 -> 4428 bytes .../fs_shadowmaps_color_lighting_vsm_csm.bin | Bin 11706 -> 11737 bytes ...s_shadowmaps_color_lighting_vsm_linear.bin | Bin 4447 -> 4472 bytes ...adowmaps_color_lighting_vsm_linear_csm.bin | Bin 11926 -> 11957 bytes ...dowmaps_color_lighting_vsm_linear_omni.bin | Bin 7668 -> 7701 bytes .../fs_shadowmaps_color_lighting_vsm_omni.bin | Bin 7622 -> 7655 bytes .../glsl/fs_shadowmaps_color_texture.bin | Bin 610 -> 614 bytes .../shaders/glsl/fs_shadowmaps_hblur.bin | Bin 1625 -> 1608 bytes .../shaders/glsl/fs_shadowmaps_hblur_vsm.bin | Bin 2563 -> 2565 bytes .../shaders/glsl/fs_shadowmaps_packdepth.bin | Bin 294 -> 293 bytes .../glsl/fs_shadowmaps_packdepth_linear.bin | Bin 246 -> 245 bytes .../glsl/fs_shadowmaps_packdepth_vsm.bin | Bin 469 -> 469 bytes .../fs_shadowmaps_packdepth_vsm_linear.bin | Bin 386 -> 386 bytes .../shaders/glsl/fs_shadowmaps_texture.bin | Bin 166 -> 168 bytes .../glsl/fs_shadowmaps_unpackdepth.bin | Bin 364 -> 366 bytes .../glsl/fs_shadowmaps_unpackdepth_vsm.bin | Bin 337 -> 341 bytes .../shaders/glsl/fs_shadowmaps_vblur.bin | Bin 1625 -> 1608 bytes .../shaders/glsl/fs_shadowmaps_vblur_vsm.bin | Bin 2563 -> 2565 bytes .../glsl/fs_shadowvolume_color_lighting.bin | Bin 2126 -> 2150 bytes .../glsl/fs_shadowvolume_color_texture.bin | Bin 610 -> 614 bytes .../glsl/fs_shadowvolume_svbackblank.bin | Bin 161 -> 161 bytes .../glsl/fs_shadowvolume_svbackcolor.bin | Bin 134 -> 136 bytes .../glsl/fs_shadowvolume_svbacktex1.bin | Bin 431 -> 431 bytes .../glsl/fs_shadowvolume_svbacktex2.bin | Bin 431 -> 431 bytes .../glsl/fs_shadowvolume_svfrontblank.bin | Bin 169 -> 169 bytes .../glsl/fs_shadowvolume_svfrontcolor.bin | Bin 134 -> 136 bytes .../glsl/fs_shadowvolume_svfronttex1.bin | Bin 428 -> 428 bytes .../glsl/fs_shadowvolume_svfronttex2.bin | Bin 428 -> 428 bytes .../shaders/glsl/fs_shadowvolume_svside.bin | Bin 452 -> 452 bytes .../glsl/fs_shadowvolume_svsideblank.bin | Bin 80 -> 80 bytes .../glsl/fs_shadowvolume_svsidecolor.bin | Bin 134 -> 136 bytes .../glsl/fs_shadowvolume_svsidetex.bin | Bin 550 -> 552 bytes .../shaders/glsl/fs_shadowvolume_texture.bin | Bin 166 -> 168 bytes .../glsl/fs_shadowvolume_texture_lighting.bin | Bin 2348 -> 2372 bytes bgfx/examples/runtime/shaders/glsl/fs_sky.bin | Bin 685 -> 689 bytes .../shaders/glsl/fs_sky_color_banding_fix.bin | Bin 1093 -> 1096 bytes .../runtime/shaders/glsl/fs_sky_landscape.bin | Bin 1180 -> 1189 bytes .../runtime/shaders/glsl/fs_sms_mesh.bin | Bin 7924 -> 7928 bytes .../runtime/shaders/glsl/fs_sms_mesh_pd.bin | Bin 8294 -> 8266 bytes .../runtime/shaders/glsl/fs_sms_shadow.bin | Bin 34 -> 161 bytes .../runtime/shaders/glsl/fs_sms_shadow_pd.bin | Bin 388 -> 389 bytes .../shaders/glsl/fs_sss_deferred_combine.bin | Bin 2790 -> 2799 bytes .../runtime/shaders/glsl/fs_sss_gbuffer.bin | Bin 2833 -> 2837 bytes .../shaders/glsl/fs_sss_linear_depth.bin | Bin 397 -> 401 bytes .../runtime/shaders/glsl/fs_sss_unlit.bin | Bin 1288 -> 1288 bytes .../shaders/glsl/fs_stencil_color_black.bin | Bin 80 -> 80 bytes .../glsl/fs_stencil_color_lighting.bin | Bin 2140 -> 2156 bytes .../shaders/glsl/fs_stencil_color_texture.bin | Bin 610 -> 614 bytes .../shaders/glsl/fs_stencil_texture.bin | Bin 166 -> 168 bytes .../glsl/fs_stencil_texture_lighting.bin | Bin 2400 -> 2418 bytes .../runtime/shaders/glsl/fs_terrain.bin | Bin 219 -> 219 bytes .../shaders/glsl/fs_terrain_render.bin | Bin 6144 -> 6179 bytes .../shaders/glsl/fs_terrain_render_normal.bin | Bin 6083 -> 6118 bytes .../examples/runtime/shaders/glsl/fs_tree.bin | Bin 1202 -> 1210 bytes .../runtime/shaders/glsl/fs_update.bin | Bin 167 -> 169 bytes .../runtime/shaders/glsl/fs_update_3d.bin | Bin 446 -> 450 bytes .../runtime/shaders/glsl/fs_update_cmp.bin | Bin 185 -> 187 bytes .../runtime/shaders/glsl/fs_upsample.bin | Bin 1520 -> 1526 bytes .../shaders/glsl/fs_vectordisplay_blit.bin | Bin 359 -> 363 bytes .../shaders/glsl/fs_vectordisplay_blur.bin | Bin 1925 -> 1929 bytes .../shaders/glsl/fs_vectordisplay_fb.bin | Bin 337 -> 341 bytes .../runtime/shaders/glsl/fs_vt_mip.bin | Bin 768 -> 772 bytes .../runtime/shaders/glsl/fs_vt_unlit.bin | Bin 1048 -> 1056 bytes .../runtime/shaders/glsl/fs_wf_mesh.bin | Bin 1485 -> 1487 bytes .../runtime/shaders/glsl/fs_wf_wireframe.bin | Bin 713 -> 715 bytes .../runtime/shaders/glsl/vs_albedo_output.bin | Bin 423 -> 427 bytes .../runtime/shaders/glsl/vs_assao.bin | Bin 315 -> 319 bytes .../runtime/shaders/glsl/vs_assao_gbuffer.bin | Bin 570 -> 578 bytes .../runtime/shaders/glsl/vs_bokeh_forward.bin | Bin 1035 -> 1041 bytes .../shaders/glsl/vs_bokeh_screenquad.bin | Bin 317 -> 319 bytes .../examples/runtime/shaders/glsl/vs_bump.bin | Bin 1354 -> 1360 bytes .../shaders/glsl/vs_bump_instanced.bin | Bin 1631 -> 1635 bytes .../runtime/shaders/glsl/vs_bunnylod.bin | Bin 536 -> 540 bytes .../runtime/shaders/glsl/vs_callback.bin | Bin 472 -> 476 bytes .../runtime/shaders/glsl/vs_cubes.bin | Bin 301 -> 303 bytes .../shaders/glsl/vs_deferred_combine.bin | Bin 315 -> 315 bytes .../shaders/glsl/vs_deferred_debug.bin | Bin 315 -> 315 bytes .../shaders/glsl/vs_deferred_debug_line.bin | Bin 303 -> 303 bytes .../runtime/shaders/glsl/vs_deferred_geom.bin | Bin 1609 -> 1609 bytes .../shaders/glsl/vs_deferred_light.bin | Bin 315 -> 315 bytes .../shaders/glsl/vs_denoise_gbuffer.bin | Bin 1540 -> 1548 bytes .../shaders/glsl/vs_denoise_screenquad.bin | Bin 317 -> 319 bytes .../runtime/shaders/glsl/vs_fsr_forward.bin | Bin 1034 -> 1034 bytes .../shaders/glsl/vs_fsr_screenquad.bin | Bin 319 -> 319 bytes .../runtime/shaders/glsl/vs_fullscreen.bin | Bin 313 -> 315 bytes .../vs_gdr_instanced_indirect_rendering.bin | Bin 527 -> 527 bytes .../shaders/glsl/vs_gdr_render_occlusion.bin | Bin 402 -> 402 bytes .../runtime/shaders/glsl/vs_hdr_blur.bin | Bin 1391 -> 1395 bytes .../runtime/shaders/glsl/vs_hdr_bright.bin | Bin 313 -> 315 bytes .../runtime/shaders/glsl/vs_hdr_lum.bin | Bin 313 -> 315 bytes .../runtime/shaders/glsl/vs_hdr_lumavg.bin | Bin 313 -> 315 bytes .../runtime/shaders/glsl/vs_hdr_mesh.bin | Bin 622 -> 626 bytes .../runtime/shaders/glsl/vs_hdr_skybox.bin | Bin 313 -> 315 bytes .../runtime/shaders/glsl/vs_hdr_tonemap.bin | Bin 1321 -> 1325 bytes .../runtime/shaders/glsl/vs_ibl_mesh.bin | Bin 633 -> 639 bytes .../runtime/shaders/glsl/vs_ibl_skybox.bin | Bin 728 -> 734 bytes .../runtime/shaders/glsl/vs_instancing.bin | Bin 550 -> 550 bytes .../examples/runtime/shaders/glsl/vs_mesh.bin | Bin 1379 -> 1385 bytes bgfx/examples/runtime/shaders/glsl/vs_oit.bin | Bin 566 -> 572 bytes .../runtime/shaders/glsl/vs_oit_blit.bin | Bin 313 -> 315 bytes .../runtime/shaders/glsl/vs_particle.bin | Bin 835 -> 841 bytes .../shaders/glsl/vs_picking_shaded.bin | Bin 731 -> 737 bytes bgfx/examples/runtime/shaders/glsl/vs_pom.bin | Bin 1382 -> 1390 bytes .../runtime/shaders/glsl/vs_raymarching.bin | Bin 384 -> 386 bytes .../runtime/shaders/glsl/vs_rsm_combine.bin | Bin 313 -> 315 bytes .../runtime/shaders/glsl/vs_rsm_gbuffer.bin | Bin 478 -> 482 bytes .../runtime/shaders/glsl/vs_rsm_lbuffer.bin | Bin 1130 -> 1140 bytes .../runtime/shaders/glsl/vs_rsm_shadow.bin | Bin 482 -> 486 bytes .../shaders/glsl/vs_shadowmaps_color.bin | Bin 230 -> 232 bytes .../glsl/vs_shadowmaps_color_lighting.bin | Bin 886 -> 894 bytes .../glsl/vs_shadowmaps_color_lighting_csm.bin | Bin 1466 -> 1482 bytes .../vs_shadowmaps_color_lighting_linear.bin | Bin 931 -> 939 bytes ...s_shadowmaps_color_lighting_linear_csm.bin | Bin 1630 -> 1646 bytes ..._shadowmaps_color_lighting_linear_omni.bin | Bin 1556 -> 1572 bytes .../vs_shadowmaps_color_lighting_omni.bin | Bin 1392 -> 1408 bytes .../glsl/vs_shadowmaps_color_texture.bin | Bin 313 -> 315 bytes .../shaders/glsl/vs_shadowmaps_depth.bin | Bin 230 -> 232 bytes .../shaders/glsl/vs_shadowmaps_hblur.bin | Bin 1398 -> 1404 bytes .../shaders/glsl/vs_shadowmaps_packdepth.bin | Bin 283 -> 285 bytes .../glsl/vs_shadowmaps_packdepth_linear.bin | Bin 296 -> 298 bytes .../shaders/glsl/vs_shadowmaps_texture.bin | Bin 313 -> 315 bytes .../glsl/vs_shadowmaps_texture_lighting.bin | Bin 662 -> 666 bytes .../glsl/vs_shadowmaps_unpackdepth.bin | Bin 313 -> 315 bytes .../shaders/glsl/vs_shadowmaps_vblur.bin | Bin 1398 -> 1404 bytes .../glsl/vs_shadowvolume_color_lighting.bin | Bin 579 -> 583 bytes .../glsl/vs_shadowvolume_color_texture.bin | Bin 313 -> 315 bytes .../shaders/glsl/vs_shadowvolume_svback.bin | Bin 428 -> 432 bytes .../shaders/glsl/vs_shadowvolume_svfront.bin | Bin 230 -> 232 bytes .../shaders/glsl/vs_shadowvolume_svside.bin | Bin 594 -> 598 bytes .../shaders/glsl/vs_shadowvolume_texture.bin | Bin 313 -> 315 bytes .../glsl/vs_shadowvolume_texture_lighting.bin | Bin 662 -> 666 bytes bgfx/examples/runtime/shaders/glsl/vs_sky.bin | Bin 3244 -> 3254 bytes .../runtime/shaders/glsl/vs_sky_landscape.bin | Bin 529 -> 533 bytes .../runtime/shaders/glsl/vs_sms_mesh.bin | Bin 838 -> 844 bytes .../runtime/shaders/glsl/vs_sms_shadow.bin | Bin 230 -> 232 bytes .../runtime/shaders/glsl/vs_sms_shadow_pd.bin | Bin 283 -> 285 bytes .../runtime/shaders/glsl/vs_sss_gbuffer.bin | Bin 779 -> 783 bytes .../shaders/glsl/vs_sss_screenquad.bin | Bin 317 -> 319 bytes .../runtime/shaders/glsl/vs_stencil_color.bin | Bin 230 -> 232 bytes .../glsl/vs_stencil_color_lighting.bin | Bin 579 -> 583 bytes .../shaders/glsl/vs_stencil_color_texture.bin | Bin 313 -> 315 bytes .../shaders/glsl/vs_stencil_texture.bin | Bin 313 -> 315 bytes .../glsl/vs_stencil_texture_lighting.bin | Bin 662 -> 666 bytes .../runtime/shaders/glsl/vs_terrain.bin | Bin 365 -> 367 bytes .../glsl/vs_terrain_height_texture.bin | Bin 509 -> 513 bytes .../shaders/glsl/vs_terrain_render.bin | Bin 6706 -> 6741 bytes .../examples/runtime/shaders/glsl/vs_tree.bin | Bin 723 -> 727 bytes .../runtime/shaders/glsl/vs_update.bin | Bin 313 -> 315 bytes .../shaders/glsl/vs_vectordisplay_fb.bin | Bin 384 -> 386 bytes .../runtime/shaders/glsl/vs_vt_generic.bin | Bin 423 -> 427 bytes .../runtime/shaders/glsl/vs_wf_mesh.bin | Bin 695 -> 701 bytes .../runtime/shaders/glsl/vs_wf_wireframe.bin | Bin 525 -> 531 bytes .../runtime/shaders/metal/cs_assao_apply.bin | Bin 3140 -> 2518 bytes .../cs_assao_generate_importance_map.bin | Bin 1692 -> 1593 bytes .../shaders/metal/cs_assao_generate_q0.bin | Bin 8935 -> 9396 bytes .../shaders/metal/cs_assao_generate_q1.bin | Bin 11499 -> 11679 bytes .../shaders/metal/cs_assao_generate_q2.bin | Bin 13244 -> 13130 bytes .../shaders/metal/cs_assao_generate_q3.bin | Bin 14405 -> 14225 bytes .../metal/cs_assao_generate_q3base.bin | Bin 9035 -> 9527 bytes .../metal/cs_assao_load_counter_clear.bin | Bin 289 -> 263 bytes .../metal/cs_assao_non_smart_apply.bin | Bin 1276 -> 1390 bytes .../shaders/metal/cs_assao_non_smart_blur.bin | Bin 2100 -> 1976 bytes .../metal/cs_assao_non_smart_half_apply.bin | Bin 1035 -> 1135 bytes .../cs_assao_postprocess_importance_map_a.bin | Bin 1632 -> 1415 bytes .../cs_assao_postprocess_importance_map_b.bin | Bin 2114 -> 1863 bytes .../metal/cs_assao_prepare_depth_mip.bin | Bin 3326 -> 4470 bytes .../shaders/metal/cs_assao_prepare_depths.bin | Bin 1658 -> 1585 bytes .../cs_assao_prepare_depths_and_normals.bin | Bin 9215 -> 8359 bytes ..._assao_prepare_depths_and_normals_half.bin | Bin 5765 -> 5181 bytes .../metal/cs_assao_prepare_depths_half.bin | Bin 1174 -> 1103 bytes .../shaders/metal/cs_assao_smart_blur.bin | Bin 2290 -> 2124 bytes .../metal/cs_assao_smart_blur_wide.bin | Bin 3243 -> 3224 bytes .../shaders/metal/cs_drawindirect_count.bin | Bin 0 -> 2798 bytes .../shaders/metal/cs_fsr_bilinear_16.bin | Bin 2857 -> 2536 bytes .../shaders/metal/cs_fsr_bilinear_32.bin | Bin 2857 -> 2536 bytes .../runtime/shaders/metal/cs_fsr_easu_16.bin | Bin 37790 -> 38078 bytes .../runtime/shaders/metal/cs_fsr_easu_32.bin | Bin 52582 -> 48593 bytes .../runtime/shaders/metal/cs_fsr_rcas_16.bin | Bin 9798 -> 9686 bytes .../runtime/shaders/metal/cs_fsr_rcas_32.bin | Bin 9056 -> 8968 bytes .../shaders/metal/cs_gdr_downscale_hi_z.bin | Bin 1235 -> 1238 bytes .../shaders/metal/cs_gdr_occlude_props.bin | Bin 4852 -> 4618 bytes .../metal/cs_gdr_stream_compaction.bin | Bin 4092 -> 3893 bytes .../shaders/metal/cs_init_instances.bin | Bin 8279 -> 7775 bytes .../runtime/shaders/metal/cs_terrain_lod.bin | Bin 11141 -> 11106 bytes .../metal/fs_assao_deferred_combine.bin | Bin 1570 -> 1765 bytes .../shaders/metal/fs_assao_gbuffer.bin | Bin 711 -> 707 bytes .../shaders/metal/fs_bokeh_dof_combine.bin | Bin 1292 -> 1196 bytes .../metal/fs_bokeh_dof_second_pass.bin | Bin 2503 -> 2502 bytes .../metal/fs_bokeh_dof_single_pass.bin | Bin 2932 -> 2931 bytes .../shaders/metal/fs_bokeh_forward.bin | Bin 2341 -> 2281 bytes .../shaders/metal/fs_bokeh_forward_grid.bin | Bin 1214 -> 1218 bytes .../runtime/shaders/metal/fs_bump.bin | Bin 3013 -> 2843 bytes .../shaders/metal/fs_deferred_combine_ta.bin | Bin 1110 -> 1109 bytes .../shaders/metal/fs_deferred_debug_ta.bin | Bin 772 -> 771 bytes .../shaders/metal/fs_deferred_geom.bin | Bin 1553 -> 1524 bytes .../shaders/metal/fs_deferred_light.bin | Bin 1734 -> 1518 bytes .../shaders/metal/fs_deferred_light_ta.bin | Bin 1801 -> 1584 bytes .../shaders/metal/fs_deferred_light_uav.bin | Bin 1579 -> 1600 bytes .../metal/fs_denoise_deferred_combine.bin | Bin 1750 -> 1754 bytes .../shaders/metal/fs_denoise_gbuffer.bin | Bin 2644 -> 2510 bytes .../shaders/metal/fs_denoise_spatial_3x3.bin | Bin 3680 -> 3635 bytes .../shaders/metal/fs_denoise_spatial_5x5.bin | Bin 3726 -> 3681 bytes .../shaders/metal/fs_denoise_temporal.bin | Bin 3860 -> 3882 bytes .../runtime/shaders/metal/fs_denoise_txaa.bin | Bin 8522 -> 8394 bytes .../runtime/shaders/metal/fs_downsample.bin | Bin 1807 -> 1829 bytes .../runtime/shaders/metal/fs_fsr_forward.bin | Bin 2341 -> 2281 bytes .../shaders/metal/fs_fsr_forward_grid.bin | Bin 1214 -> 1218 bytes .../runtime/shaders/metal/fs_hdr_bright.bin | Bin 2670 -> 2714 bytes .../runtime/shaders/metal/fs_hdr_lum.bin | Bin 3028 -> 3046 bytes .../runtime/shaders/metal/fs_hdr_lumavg.bin | Bin 3101 -> 3139 bytes .../runtime/shaders/metal/fs_hdr_mesh.bin | Bin 2197 -> 1985 bytes .../runtime/shaders/metal/fs_hdr_skybox.bin | Bin 1163 -> 947 bytes .../runtime/shaders/metal/fs_hdr_tonemap.bin | Bin 3796 -> 3433 bytes .../runtime/shaders/metal/fs_ibl_mesh.bin | Bin 4130 -> 3658 bytes .../runtime/shaders/metal/fs_ibl_skybox.bin | Bin 2595 -> 2507 bytes .../runtime/shaders/metal/fs_mesh.bin | Bin 1969 -> 1757 bytes .../runtime/shaders/metal/fs_oit_wb.bin | Bin 977 -> 923 bytes .../runtime/shaders/metal/fs_picking_id.bin | Bin 601 -> 399 bytes .../shaders/metal/fs_picking_shaded.bin | Bin 1199 -> 984 bytes .../examples/runtime/shaders/metal/fs_pom.bin | Bin 4179 -> 4228 bytes .../runtime/shaders/metal/fs_raymarching.bin | Bin 6917 -> 6915 bytes .../runtime/shaders/metal/fs_rsm_combine.bin | Bin 7028 -> 6769 bytes .../runtime/shaders/metal/fs_rsm_gbuffer.bin | Bin 782 -> 576 bytes .../runtime/shaders/metal/fs_rsm_lbuffer.bin | Bin 1806 -> 1590 bytes .../runtime/shaders/metal/fs_rsm_shadow.bin | Bin 765 -> 559 bytes .../shaders/metal/fs_screen_space_shadows.bin | Bin 3399 -> 3223 bytes .../fs_shadowmaps_color_lighting_esm.bin | Bin 4721 -> 4432 bytes .../fs_shadowmaps_color_lighting_esm_csm.bin | Bin 9241 -> 8952 bytes ...s_shadowmaps_color_lighting_esm_linear.bin | Bin 4734 -> 4445 bytes ...adowmaps_color_lighting_esm_linear_csm.bin | Bin 9293 -> 9004 bytes ...dowmaps_color_lighting_esm_linear_omni.bin | Bin 6985 -> 6696 bytes .../fs_shadowmaps_color_lighting_esm_omni.bin | Bin 6968 -> 6679 bytes .../fs_shadowmaps_color_lighting_hard.bin | Bin 4646 -> 4357 bytes .../fs_shadowmaps_color_lighting_hard_csm.bin | Bin 8957 -> 8668 bytes ..._shadowmaps_color_lighting_hard_linear.bin | Bin 4663 -> 4374 bytes ...dowmaps_color_lighting_hard_linear_csm.bin | Bin 9009 -> 8720 bytes ...owmaps_color_lighting_hard_linear_omni.bin | Bin 6910 -> 6621 bytes ...fs_shadowmaps_color_lighting_hard_omni.bin | Bin 6894 -> 6605 bytes .../fs_shadowmaps_color_lighting_pcf.bin | Bin 12667 -> 12404 bytes .../fs_shadowmaps_color_lighting_pcf_csm.bin | Bin 48280 -> 47989 bytes ...s_shadowmaps_color_lighting_pcf_linear.bin | Bin 12578 -> 12315 bytes ...adowmaps_color_lighting_pcf_linear_csm.bin | Bin 48084 -> 47781 bytes ...dowmaps_color_lighting_pcf_linear_omni.bin | Bin 14843 -> 14580 bytes .../fs_shadowmaps_color_lighting_pcf_omni.bin | Bin 14778 -> 14515 bytes .../fs_shadowmaps_color_lighting_vsm.bin | Bin 5022 -> 4759 bytes .../fs_shadowmaps_color_lighting_vsm_csm.bin | Bin 10805 -> 10620 bytes ...s_shadowmaps_color_lighting_vsm_linear.bin | Bin 5035 -> 4772 bytes ...adowmaps_color_lighting_vsm_linear_csm.bin | Bin 10857 -> 10672 bytes ...dowmaps_color_lighting_vsm_linear_omni.bin | Bin 7295 -> 7032 bytes .../fs_shadowmaps_color_lighting_vsm_omni.bin | Bin 7279 -> 7016 bytes .../shaders/metal/fs_shadowmaps_hblur.bin | Bin 2353 -> 2355 bytes .../shaders/metal/fs_shadowmaps_hblur_vsm.bin | Bin 2715 -> 2719 bytes .../shaders/metal/fs_shadowmaps_packdepth.bin | Bin 565 -> 564 bytes .../metal/fs_shadowmaps_packdepth_linear.bin | Bin 520 -> 522 bytes .../metal/fs_shadowmaps_packdepth_vsm.bin | Bin 652 -> 655 bytes .../fs_shadowmaps_packdepth_vsm_linear.bin | Bin 598 -> 602 bytes .../shaders/metal/fs_shadowmaps_vblur.bin | Bin 2353 -> 2355 bytes .../shaders/metal/fs_shadowmaps_vblur_vsm.bin | Bin 2715 -> 2719 bytes .../metal/fs_shadowvolume_color_lighting.bin | Bin 2654 -> 2454 bytes .../metal/fs_shadowvolume_svbackcolor.bin | Bin 636 -> 428 bytes .../metal/fs_shadowvolume_svfrontblank.bin | Bin 480 -> 306 bytes .../metal/fs_shadowvolume_svfrontcolor.bin | Bin 636 -> 428 bytes .../metal/fs_shadowvolume_svsidecolor.bin | Bin 636 -> 428 bytes .../fs_shadowvolume_texture_lighting.bin | Bin 2955 -> 2756 bytes .../metal/fs_sky_color_banding_fix.bin | Bin 1538 -> 1538 bytes .../shaders/metal/fs_sky_landscape.bin | Bin 2253 -> 2009 bytes .../runtime/shaders/metal/fs_sms_mesh.bin | Bin 6454 -> 6479 bytes .../runtime/shaders/metal/fs_sms_mesh_pd.bin | Bin 6471 -> 6496 bytes .../shaders/metal/fs_sms_shadow_pd.bin | Bin 734 -> 733 bytes .../shaders/metal/fs_sss_deferred_combine.bin | Bin 3367 -> 3136 bytes .../runtime/shaders/metal/fs_sss_gbuffer.bin | Bin 2684 -> 2577 bytes .../runtime/shaders/metal/fs_sss_unlit.bin | Bin 1072 -> 1075 bytes .../metal/fs_stencil_color_lighting.bin | Bin 2330 -> 2114 bytes .../metal/fs_stencil_texture_lighting.bin | Bin 2669 -> 2454 bytes .../runtime/shaders/metal/fs_tree.bin | Bin 1851 -> 1796 bytes .../runtime/shaders/metal/fs_update_3d.bin | Bin 769 -> 770 bytes .../shaders/metal/fs_vectordisplay_blur.bin | Bin 2193 -> 2233 bytes .../runtime/shaders/metal/fs_vt_unlit.bin | Bin 1672 -> 1673 bytes .../runtime/shaders/metal/fs_wf_mesh.bin | Bin 2774 -> 2524 bytes .../shaders/metal/vs_albedo_output.bin | Bin 1324 -> 1372 bytes .../runtime/shaders/metal/vs_assao.bin | Bin 693 -> 749 bytes .../shaders/metal/vs_assao_gbuffer.bin | Bin 980 -> 1046 bytes .../shaders/metal/vs_bokeh_forward.bin | Bin 1395 -> 1443 bytes .../shaders/metal/vs_bokeh_screenquad.bin | Bin 701 -> 749 bytes .../runtime/shaders/metal/vs_bump.bin | Bin 1816 -> 1864 bytes .../shaders/metal/vs_bump_instanced.bin | Bin 2150 -> 2038 bytes .../runtime/shaders/metal/vs_bunnylod.bin | Bin 886 -> 934 bytes .../runtime/shaders/metal/vs_callback.bin | Bin 873 -> 921 bytes .../runtime/shaders/metal/vs_cubes.bin | Bin 685 -> 733 bytes .../shaders/metal/vs_deferred_combine.bin | Bin 697 -> 745 bytes .../shaders/metal/vs_deferred_debug.bin | Bin 697 -> 745 bytes .../shaders/metal/vs_deferred_debug_line.bin | Bin 685 -> 733 bytes .../shaders/metal/vs_deferred_geom.bin | Bin 1837 -> 1885 bytes .../shaders/metal/vs_deferred_light.bin | Bin 697 -> 745 bytes .../shaders/metal/vs_denoise_gbuffer.bin | Bin 1734 -> 1782 bytes .../shaders/metal/vs_denoise_screenquad.bin | Bin 701 -> 749 bytes .../runtime/shaders/metal/vs_fsr_forward.bin | Bin 1368 -> 1416 bytes .../shaders/metal/vs_fsr_screenquad.bin | Bin 701 -> 749 bytes .../runtime/shaders/metal/vs_fullscreen.bin | Bin 697 -> 745 bytes .../vs_gdr_instanced_indirect_rendering.bin | Bin 1058 -> 920 bytes .../shaders/metal/vs_gdr_render_occlusion.bin | Bin 928 -> 790 bytes .../runtime/shaders/metal/vs_hdr_blur.bin | Bin 1687 -> 1744 bytes .../runtime/shaders/metal/vs_hdr_bright.bin | Bin 697 -> 745 bytes .../runtime/shaders/metal/vs_hdr_lum.bin | Bin 697 -> 745 bytes .../runtime/shaders/metal/vs_hdr_lumavg.bin | Bin 697 -> 745 bytes .../runtime/shaders/metal/vs_hdr_mesh.bin | Bin 1058 -> 1106 bytes .../runtime/shaders/metal/vs_hdr_skybox.bin | Bin 697 -> 745 bytes .../runtime/shaders/metal/vs_hdr_tonemap.bin | Bin 1706 -> 1769 bytes .../runtime/shaders/metal/vs_hextile.bin | Bin 936 -> 984 bytes .../runtime/shaders/metal/vs_ibl_mesh.bin | Bin 1001 -> 1049 bytes .../runtime/shaders/metal/vs_ibl_skybox.bin | Bin 1211 -> 1073 bytes .../runtime/shaders/metal/vs_instancing.bin | Bin 950 -> 998 bytes .../runtime/shaders/metal/vs_mesh.bin | Bin 1633 -> 1681 bytes .../examples/runtime/shaders/metal/vs_oit.bin | Bin 864 -> 912 bytes .../runtime/shaders/metal/vs_oit_blit.bin | Bin 697 -> 745 bytes .../runtime/shaders/metal/vs_particle.bin | Bin 1168 -> 1081 bytes .../shaders/metal/vs_picking_shaded.bin | Bin 1299 -> 1347 bytes .../examples/runtime/shaders/metal/vs_pom.bin | Bin 1678 -> 1726 bytes .../runtime/shaders/metal/vs_raymarching.bin | Bin 842 -> 890 bytes .../runtime/shaders/metal/vs_rsm_combine.bin | Bin 697 -> 745 bytes .../runtime/shaders/metal/vs_rsm_gbuffer.bin | Bin 830 -> 878 bytes .../runtime/shaders/metal/vs_rsm_lbuffer.bin | Bin 2001 -> 1848 bytes .../runtime/shaders/metal/vs_rsm_shadow.bin | Bin 813 -> 861 bytes .../shaders/metal/vs_shadowmaps_color.bin | Bin 540 -> 588 bytes .../metal/vs_shadowmaps_color_lighting.bin | Bin 1255 -> 1303 bytes .../vs_shadowmaps_color_lighting_csm.bin | Bin 2075 -> 2123 bytes .../vs_shadowmaps_color_lighting_linear.bin | Bin 1330 -> 1354 bytes ...s_shadowmaps_color_lighting_linear_csm.bin | Bin 2375 -> 2327 bytes ..._shadowmaps_color_lighting_linear_omni.bin | Bin 2313 -> 2265 bytes .../vs_shadowmaps_color_lighting_omni.bin | Bin 2013 -> 2061 bytes .../metal/vs_shadowmaps_color_texture.bin | Bin 697 -> 745 bytes .../shaders/metal/vs_shadowmaps_depth.bin | Bin 540 -> 588 bytes .../shaders/metal/vs_shadowmaps_hblur.bin | Bin 1688 -> 1844 bytes .../shaders/metal/vs_shadowmaps_packdepth.bin | Bin 663 -> 711 bytes .../metal/vs_shadowmaps_packdepth_linear.bin | Bin 672 -> 721 bytes .../shaders/metal/vs_shadowmaps_texture.bin | Bin 697 -> 745 bytes .../metal/vs_shadowmaps_texture_lighting.bin | Bin 1101 -> 1149 bytes .../metal/vs_shadowmaps_unpackdepth.bin | Bin 697 -> 745 bytes .../shaders/metal/vs_shadowmaps_vblur.bin | Bin 1688 -> 1844 bytes .../metal/vs_shadowvolume_color_lighting.bin | Bin 948 -> 996 bytes .../metal/vs_shadowvolume_color_texture.bin | Bin 697 -> 745 bytes .../shaders/metal/vs_shadowvolume_svback.bin | Bin 749 -> 797 bytes .../shaders/metal/vs_shadowvolume_svfront.bin | Bin 540 -> 588 bytes .../shaders/metal/vs_shadowvolume_svside.bin | Bin 1025 -> 1073 bytes .../shaders/metal/vs_shadowvolume_texture.bin | Bin 697 -> 745 bytes .../vs_shadowvolume_texture_lighting.bin | Bin 1101 -> 1149 bytes .../examples/runtime/shaders/metal/vs_sky.bin | Bin 2950 -> 2857 bytes .../shaders/metal/vs_sky_landscape.bin | Bin 951 -> 999 bytes .../runtime/shaders/metal/vs_sms_mesh.bin | Bin 1230 -> 1278 bytes .../runtime/shaders/metal/vs_sms_shadow.bin | Bin 540 -> 588 bytes .../shaders/metal/vs_sms_shadow_pd.bin | Bin 663 -> 711 bytes .../runtime/shaders/metal/vs_sss_gbuffer.bin | Bin 1137 -> 1185 bytes .../shaders/metal/vs_sss_screenquad.bin | Bin 701 -> 749 bytes .../shaders/metal/vs_stencil_color.bin | Bin 540 -> 588 bytes .../metal/vs_stencil_color_lighting.bin | Bin 946 -> 994 bytes .../metal/vs_stencil_color_texture.bin | Bin 697 -> 745 bytes .../shaders/metal/vs_stencil_texture.bin | Bin 697 -> 745 bytes .../metal/vs_stencil_texture_lighting.bin | Bin 1101 -> 1149 bytes .../runtime/shaders/metal/vs_terrain.bin | Bin 808 -> 856 bytes .../metal/vs_terrain_height_texture.bin | Bin 1167 -> 1221 bytes .../shaders/metal/vs_terrain_render.bin | Bin 2454 -> 2468 bytes .../runtime/shaders/metal/vs_tree.bin | Bin 1232 -> 1280 bytes .../runtime/shaders/metal/vs_update.bin | Bin 697 -> 745 bytes .../shaders/metal/vs_vectordisplay_fb.bin | Bin 842 -> 890 bytes .../runtime/shaders/metal/vs_vt_generic.bin | Bin 765 -> 813 bytes .../runtime/shaders/metal/vs_wf_mesh.bin | Bin 1137 -> 1185 bytes .../runtime/shaders/metal/vs_wf_wireframe.bin | Bin 931 -> 979 bytes .../runtime/shaders/spirv/cs_assao_apply.bin | Bin 4803 -> 4643 bytes .../cs_assao_generate_importance_map.bin | Bin 3002 -> 2902 bytes .../shaders/spirv/cs_assao_generate_q0.bin | Bin 10617 -> 10373 bytes .../shaders/spirv/cs_assao_generate_q1.bin | Bin 14093 -> 13769 bytes .../shaders/spirv/cs_assao_generate_q2.bin | Bin 17045 -> 16653 bytes .../shaders/spirv/cs_assao_generate_q3.bin | Bin 18692 -> 18300 bytes .../spirv/cs_assao_generate_q3base.bin | Bin 10585 -> 10333 bytes .../spirv/cs_assao_load_counter_clear.bin | Bin 558 -> 558 bytes .../spirv/cs_assao_non_smart_apply.bin | Bin 2527 -> 2527 bytes .../shaders/spirv/cs_assao_non_smart_blur.bin | Bin 3523 -> 3443 bytes .../spirv/cs_assao_non_smart_half_apply.bin | Bin 2175 -> 2175 bytes .../cs_assao_postprocess_importance_map_a.bin | Bin 2794 -> 2614 bytes .../cs_assao_postprocess_importance_map_b.bin | Bin 3422 -> 3242 bytes .../spirv/cs_assao_prepare_depth_mip.bin | Bin 5578 -> 5578 bytes .../shaders/spirv/cs_assao_prepare_depths.bin | Bin 3201 -> 3101 bytes .../cs_assao_prepare_depths_and_normals.bin | Bin 15058 -> 14346 bytes ..._assao_prepare_depths_and_normals_half.bin | Bin 9954 -> 9434 bytes .../spirv/cs_assao_prepare_depths_half.bin | Bin 2289 -> 2189 bytes .../shaders/spirv/cs_assao_smart_blur.bin | Bin 3851 -> 3779 bytes .../spirv/cs_assao_smart_blur_wide.bin | Bin 5039 -> 4963 bytes .../runtime/shaders/spirv/cs_drawindirect.bin | Bin 4391 -> 4227 bytes .../shaders/spirv/cs_drawindirect_count.bin | Bin 4757 -> 4593 bytes .../shaders/spirv/cs_fsr_bilinear_16.bin | Bin 4448 -> 4216 bytes .../shaders/spirv/cs_fsr_bilinear_32.bin | Bin 4448 -> 4216 bytes .../runtime/shaders/spirv/cs_fsr_easu_16.bin | Bin 71544 -> 66088 bytes .../runtime/shaders/spirv/cs_fsr_easu_32.bin | Bin 72524 -> 68352 bytes .../runtime/shaders/spirv/cs_fsr_rcas_16.bin | Bin 19100 -> 17976 bytes .../runtime/shaders/spirv/cs_fsr_rcas_32.bin | Bin 13244 -> 12984 bytes .../runtime/shaders/spirv/cs_gdr_copy_z.bin | Bin 1385 -> 1385 bytes .../shaders/spirv/cs_gdr_downscale_hi_z.bin | Bin 2183 -> 2159 bytes .../shaders/spirv/cs_gdr_occlude_props.bin | Bin 5581 -> 5573 bytes .../spirv/cs_gdr_stream_compaction.bin | Bin 7075 -> 7075 bytes .../runtime/shaders/spirv/cs_indirect.bin | Bin 1230 -> 1230 bytes .../shaders/spirv/cs_init_instances.bin | Bin 10567 -> 10395 bytes .../runtime/shaders/spirv/cs_terrain_init.bin | Bin 2552 -> 2552 bytes .../runtime/shaders/spirv/cs_terrain_lod.bin | Bin 12330 -> 12282 bytes .../shaders/spirv/cs_terrain_update_draw.bin | Bin 1632 -> 1632 bytes .../spirv/cs_terrain_update_indirect.bin | Bin 1177 -> 1177 bytes .../runtime/shaders/spirv/cs_update.bin | Bin 1708 -> 1708 bytes .../shaders/spirv/cs_update_instances.bin | Bin 3811 -> 3811 bytes .../shaders/spirv/fs_albedo_output.bin | Bin 1160 -> 692 bytes .../spirv/fs_assao_deferred_combine.bin | Bin 2708 -> 2708 bytes .../shaders/spirv/fs_assao_gbuffer.bin | Bin 1105 -> 1025 bytes .../shaders/spirv/fs_bloom_combine.bin | Bin 1423 -> 1347 bytes .../runtime/shaders/spirv/fs_bokeh_copy.bin | Bin 820 -> 744 bytes .../spirv/fs_bokeh_copy_linear_to_gamma.bin | Bin 1068 -> 992 bytes .../shaders/spirv/fs_bokeh_dof_combine.bin | Bin 1705 -> 1629 bytes .../shaders/spirv/fs_bokeh_dof_debug.bin | Bin 2349 -> 2273 bytes .../shaders/spirv/fs_bokeh_dof_downsample.bin | Bin 1821 -> 1745 bytes .../spirv/fs_bokeh_dof_second_pass.bin | Bin 3822 -> 3722 bytes .../spirv/fs_bokeh_dof_single_pass.bin | Bin 4704 -> 4604 bytes .../shaders/spirv/fs_bokeh_forward.bin | Bin 3632 -> 3572 bytes .../shaders/spirv/fs_bokeh_forward_grid.bin | Bin 2390 -> 2242 bytes .../shaders/spirv/fs_bokeh_linear_depth.bin | Bin 1327 -> 1251 bytes .../runtime/shaders/spirv/fs_bump.bin | Bin 5199 -> 5015 bytes .../runtime/shaders/spirv/fs_bunnylod.bin | Bin 986 -> 926 bytes .../runtime/shaders/spirv/fs_callback.bin | Bin 986 -> 926 bytes .../runtime/shaders/spirv/fs_cubes.bin | Bin 466 -> 406 bytes .../shaders/spirv/fs_deferred_clear_uav.bin | Bin 696 -> 624 bytes .../shaders/spirv/fs_deferred_combine.bin | Bin 1747 -> 1671 bytes .../shaders/spirv/fs_deferred_combine_ta.bin | Bin 1891 -> 1815 bytes .../shaders/spirv/fs_deferred_debug.bin | Bin 831 -> 755 bytes .../shaders/spirv/fs_deferred_debug_line.bin | Bin 466 -> 406 bytes .../shaders/spirv/fs_deferred_debug_ta.bin | Bin 1213 -> 1137 bytes .../shaders/spirv/fs_deferred_geom.bin | Bin 2693 -> 2513 bytes .../shaders/spirv/fs_deferred_light.bin | Bin 3018 -> 2862 bytes .../shaders/spirv/fs_deferred_light_ta.bin | Bin 3146 -> 2990 bytes .../shaders/spirv/fs_deferred_light_uav.bin | Bin 3148 -> 3148 bytes .../spirv/fs_denoise_apply_lighting.bin | Bin 1443 -> 1367 bytes .../runtime/shaders/spirv/fs_denoise_copy.bin | Bin 820 -> 744 bytes .../spirv/fs_denoise_deferred_combine.bin | Bin 2896 -> 2872 bytes .../shaders/spirv/fs_denoise_gbuffer.bin | Bin 3958 -> 3902 bytes .../shaders/spirv/fs_denoise_spatial_3x3.bin | Bin 4178 -> 4070 bytes .../shaders/spirv/fs_denoise_spatial_5x5.bin | Bin 4290 -> 4182 bytes .../shaders/spirv/fs_denoise_temporal.bin | Bin 4480 -> 4444 bytes .../runtime/shaders/spirv/fs_denoise_txaa.bin | Bin 10978 -> 10586 bytes .../runtime/shaders/spirv/fs_downsample.bin | Bin 3340 -> 3264 bytes .../spirv/fs_fsr_copy_linear_to_gamma.bin | Bin 1068 -> 992 bytes .../runtime/shaders/spirv/fs_fsr_forward.bin | Bin 3632 -> 3572 bytes .../shaders/spirv/fs_fsr_forward_grid.bin | Bin 2390 -> 2242 bytes .../fs_gdr_instanced_indirect_rendering.bin | Bin 1264 -> 1264 bytes .../runtime/shaders/spirv/fs_hdr_blur.bin | Bin 2083 -> 2023 bytes .../runtime/shaders/spirv/fs_hdr_bright.bin | Bin 5189 -> 5033 bytes .../runtime/shaders/spirv/fs_hdr_lum.bin | Bin 4282 -> 4150 bytes .../runtime/shaders/spirv/fs_hdr_lumavg.bin | Bin 5922 -> 5614 bytes .../runtime/shaders/spirv/fs_hdr_mesh.bin | Bin 3354 -> 3118 bytes .../runtime/shaders/spirv/fs_hdr_skybox.bin | Bin 1918 -> 1762 bytes .../runtime/shaders/spirv/fs_hdr_tonemap.bin | Bin 4894 -> 4706 bytes .../runtime/shaders/spirv/fs_hextile.bin | Bin 7895 -> 7895 bytes .../runtime/shaders/spirv/fs_ibl_mesh.bin | Bin 6124 -> 5864 bytes .../runtime/shaders/spirv/fs_ibl_skybox.bin | Bin 3532 -> 3456 bytes .../runtime/shaders/spirv/fs_instancing.bin | Bin 466 -> 406 bytes .../runtime/shaders/spirv/fs_mesh.bin | Bin 2915 -> 2695 bytes .../examples/runtime/shaders/spirv/fs_oit.bin | Bin 712 -> 584 bytes .../runtime/shaders/spirv/fs_oit_wb.bin | Bin 1392 -> 1332 bytes .../runtime/shaders/spirv/fs_oit_wb_blit.bin | Bin 1362 -> 1286 bytes .../shaders/spirv/fs_oit_wb_separate.bin | Bin 1164 -> 1104 bytes .../shaders/spirv/fs_oit_wb_separate_blit.bin | Bin 1362 -> 1286 bytes .../runtime/shaders/spirv/fs_particle.bin | Bin 1441 -> 1365 bytes .../runtime/shaders/spirv/fs_picking_id.bin | Bin 1089 -> 685 bytes .../shaders/spirv/fs_picking_shaded.bin | Bin 1682 -> 1482 bytes .../examples/runtime/shaders/spirv/fs_pom.bin | Bin 4739 -> 4663 bytes .../runtime/shaders/spirv/fs_raymarching.bin | Bin 10179 -> 10111 bytes .../runtime/shaders/spirv/fs_rsm_combine.bin | Bin 9470 -> 9314 bytes .../runtime/shaders/spirv/fs_rsm_gbuffer.bin | Bin 1019 -> 863 bytes .../runtime/shaders/spirv/fs_rsm_lbuffer.bin | Bin 2724 -> 2644 bytes .../runtime/shaders/spirv/fs_rsm_shadow.bin | Bin 1037 -> 881 bytes .../shaders/spirv/fs_screen_space_shadows.bin | Bin 5273 -> 5197 bytes .../spirv/fs_shadowmaps_color_black.bin | Bin 438 -> 362 bytes .../fs_shadowmaps_color_lighting_esm.bin | Bin 6752 -> 6588 bytes .../fs_shadowmaps_color_lighting_esm_csm.bin | Bin 11521 -> 11301 bytes ...s_shadowmaps_color_lighting_esm_linear.bin | Bin 6808 -> 6644 bytes ...adowmaps_color_lighting_esm_linear_csm.bin | Bin 11745 -> 11525 bytes ...dowmaps_color_lighting_esm_linear_omni.bin | Bin 9278 -> 9114 bytes .../fs_shadowmaps_color_lighting_esm_omni.bin | Bin 9222 -> 9058 bytes .../fs_shadowmaps_color_lighting_hard.bin | Bin 6568 -> 6404 bytes .../fs_shadowmaps_color_lighting_hard_csm.bin | Bin 10833 -> 10613 bytes ..._shadowmaps_color_lighting_hard_linear.bin | Bin 6624 -> 6460 bytes ...dowmaps_color_lighting_hard_linear_csm.bin | Bin 11057 -> 10837 bytes ...owmaps_color_lighting_hard_linear_omni.bin | Bin 9094 -> 8930 bytes ...fs_shadowmaps_color_lighting_hard_omni.bin | Bin 9038 -> 8874 bytes .../fs_shadowmaps_color_lighting_pcf.bin | Bin 16372 -> 16208 bytes .../fs_shadowmaps_color_lighting_pcf_csm.bin | Bin 48705 -> 48485 bytes ...s_shadowmaps_color_lighting_pcf_linear.bin | Bin 16528 -> 16364 bytes ...adowmaps_color_lighting_pcf_linear_csm.bin | Bin 49329 -> 49109 bytes ...dowmaps_color_lighting_pcf_linear_omni.bin | Bin 19034 -> 18870 bytes .../fs_shadowmaps_color_lighting_pcf_omni.bin | Bin 18878 -> 18714 bytes .../fs_shadowmaps_color_lighting_vsm.bin | Bin 7060 -> 6924 bytes .../fs_shadowmaps_color_lighting_vsm_csm.bin | Bin 12873 -> 12765 bytes ...s_shadowmaps_color_lighting_vsm_linear.bin | Bin 7116 -> 6980 bytes ...adowmaps_color_lighting_vsm_linear_csm.bin | Bin 13097 -> 12989 bytes ...dowmaps_color_lighting_vsm_linear_omni.bin | Bin 9586 -> 9450 bytes .../fs_shadowmaps_color_lighting_vsm_omni.bin | Bin 9530 -> 9394 bytes .../spirv/fs_shadowmaps_color_texture.bin | Bin 1689 -> 1613 bytes .../shaders/spirv/fs_shadowmaps_hblur.bin | Bin 2597 -> 2545 bytes .../shaders/spirv/fs_shadowmaps_hblur_vsm.bin | Bin 3625 -> 3581 bytes .../shaders/spirv/fs_shadowmaps_packdepth.bin | Bin 854 -> 794 bytes .../spirv/fs_shadowmaps_packdepth_linear.bin | Bin 750 -> 682 bytes .../spirv/fs_shadowmaps_packdepth_vsm.bin | Bin 1054 -> 1002 bytes .../fs_shadowmaps_packdepth_vsm_linear.bin | Bin 950 -> 890 bytes .../shaders/spirv/fs_shadowmaps_texture.bin | Bin 831 -> 755 bytes .../spirv/fs_shadowmaps_unpackdepth.bin | Bin 1433 -> 1357 bytes .../spirv/fs_shadowmaps_unpackdepth_vsm.bin | Bin 1421 -> 1345 bytes .../shaders/spirv/fs_shadowmaps_vblur.bin | Bin 2597 -> 2545 bytes .../shaders/spirv/fs_shadowmaps_vblur_vsm.bin | Bin 3625 -> 3581 bytes .../spirv/fs_shadowvolume_color_lighting.bin | Bin 4975 -> 4879 bytes .../spirv/fs_shadowvolume_color_texture.bin | Bin 1689 -> 1613 bytes .../spirv/fs_shadowvolume_svbackblank.bin | Bin 438 -> 362 bytes .../spirv/fs_shadowvolume_svbackcolor.bin | Bin 844 -> 688 bytes .../spirv/fs_shadowvolume_svbacktex1.bin | Bin 1158 -> 1082 bytes .../spirv/fs_shadowvolume_svbacktex2.bin | Bin 1158 -> 1082 bytes .../spirv/fs_shadowvolume_svfrontblank.bin | Bin 534 -> 378 bytes .../spirv/fs_shadowvolume_svfrontcolor.bin | Bin 844 -> 688 bytes .../spirv/fs_shadowvolume_svfronttex1.bin | Bin 1142 -> 1066 bytes .../spirv/fs_shadowvolume_svfronttex2.bin | Bin 1142 -> 1066 bytes .../shaders/spirv/fs_shadowvolume_svside.bin | Bin 1238 -> 1162 bytes .../spirv/fs_shadowvolume_svsideblank.bin | Bin 502 -> 362 bytes .../spirv/fs_shadowvolume_svsidecolor.bin | Bin 908 -> 688 bytes .../spirv/fs_shadowvolume_svsidetex.bin | Bin 1663 -> 1587 bytes .../shaders/spirv/fs_shadowvolume_texture.bin | Bin 831 -> 755 bytes .../fs_shadowvolume_texture_lighting.bin | Bin 5418 -> 5322 bytes .../examples/runtime/shaders/spirv/fs_sky.bin | Bin 1826 -> 1662 bytes .../spirv/fs_sky_color_banding_fix.bin | Bin 2774 -> 2682 bytes .../shaders/spirv/fs_sky_landscape.bin | Bin 3592 -> 3496 bytes .../runtime/shaders/spirv/fs_sms_mesh.bin | Bin 9085 -> 9025 bytes .../runtime/shaders/spirv/fs_sms_mesh_pd.bin | Bin 9113 -> 9053 bytes .../runtime/shaders/spirv/fs_sms_shadow.bin | Bin 438 -> 362 bytes .../shaders/spirv/fs_sms_shadow_pd.bin | Bin 1219 -> 1159 bytes .../shaders/spirv/fs_sss_deferred_combine.bin | Bin 4956 -> 4788 bytes .../runtime/shaders/spirv/fs_sss_gbuffer.bin | Bin 4192 -> 4124 bytes .../shaders/spirv/fs_sss_linear_depth.bin | Bin 1343 -> 1267 bytes .../runtime/shaders/spirv/fs_sss_unlit.bin | Bin 2278 -> 2074 bytes .../shaders/spirv/fs_stencil_color_black.bin | Bin 438 -> 362 bytes .../spirv/fs_stencil_color_lighting.bin | Bin 4141 -> 3985 bytes .../spirv/fs_stencil_color_texture.bin | Bin 1689 -> 1613 bytes .../shaders/spirv/fs_stencil_texture.bin | Bin 831 -> 755 bytes .../spirv/fs_stencil_texture_lighting.bin | Bin 4766 -> 4610 bytes .../runtime/shaders/spirv/fs_terrain.bin | Bin 742 -> 666 bytes .../shaders/spirv/fs_terrain_render.bin | Bin 1517 -> 1441 bytes .../spirv/fs_terrain_render_normal.bin | Bin 1497 -> 1421 bytes .../runtime/shaders/spirv/fs_tree.bin | Bin 3203 -> 3127 bytes .../runtime/shaders/spirv/fs_update.bin | Bin 830 -> 754 bytes .../runtime/shaders/spirv/fs_update_3d.bin | Bin 1428 -> 1344 bytes .../runtime/shaders/spirv/fs_update_cmp.bin | Bin 951 -> 875 bytes .../runtime/shaders/spirv/fs_upsample.bin | Bin 2666 -> 2590 bytes .../shaders/spirv/fs_vectordisplay_blit.bin | Bin 1438 -> 1306 bytes .../shaders/spirv/fs_vectordisplay_blur.bin | Bin 3938 -> 3758 bytes .../shaders/spirv/fs_vectordisplay_fb.bin | Bin 1294 -> 1234 bytes .../runtime/shaders/spirv/fs_vt_mip.bin | Bin 1782 -> 1706 bytes .../runtime/shaders/spirv/fs_vt_unlit.bin | Bin 2753 -> 2669 bytes .../runtime/shaders/spirv/fs_wf_mesh.bin | Bin 3985 -> 3761 bytes .../runtime/shaders/spirv/fs_wf_wireframe.bin | Bin 1733 -> 1605 bytes .../shaders/spirv/vs_albedo_output.bin | Bin 2097 -> 1969 bytes .../runtime/shaders/spirv/vs_assao.bin | Bin 1080 -> 1080 bytes .../shaders/spirv/vs_assao_gbuffer.bin | Bin 1896 -> 1896 bytes .../shaders/spirv/vs_bokeh_forward.bin | Bin 2576 -> 2576 bytes .../shaders/spirv/vs_bokeh_screenquad.bin | Bin 1080 -> 1080 bytes .../runtime/shaders/spirv/vs_bump.bin | Bin 2990 -> 2990 bytes .../shaders/spirv/vs_bump_instanced.bin | Bin 3184 -> 3104 bytes .../runtime/shaders/spirv/vs_bunnylod.bin | Bin 1590 -> 1590 bytes .../runtime/shaders/spirv/vs_callback.bin | Bin 1518 -> 1518 bytes .../runtime/shaders/spirv/vs_cubes.bin | Bin 1060 -> 1060 bytes .../shaders/spirv/vs_deferred_combine.bin | Bin 1096 -> 1096 bytes .../shaders/spirv/vs_deferred_debug.bin | Bin 1096 -> 1096 bytes .../shaders/spirv/vs_deferred_debug_line.bin | Bin 1060 -> 1060 bytes .../shaders/spirv/vs_deferred_geom.bin | Bin 3302 -> 3302 bytes .../shaders/spirv/vs_deferred_light.bin | Bin 1096 -> 1096 bytes .../shaders/spirv/vs_denoise_gbuffer.bin | Bin 3407 -> 3407 bytes .../shaders/spirv/vs_denoise_screenquad.bin | Bin 1080 -> 1080 bytes .../runtime/shaders/spirv/vs_fsr_forward.bin | Bin 2570 -> 2570 bytes .../shaders/spirv/vs_fsr_screenquad.bin | Bin 1080 -> 1080 bytes .../runtime/shaders/spirv/vs_fullscreen.bin | Bin 1096 -> 1096 bytes .../vs_gdr_instanced_indirect_rendering.bin | Bin 1529 -> 1449 bytes .../shaders/spirv/vs_gdr_render_occlusion.bin | Bin 1301 -> 1221 bytes .../runtime/shaders/spirv/vs_hdr_blur.bin | Bin 2662 -> 2662 bytes .../runtime/shaders/spirv/vs_hdr_bright.bin | Bin 1096 -> 1096 bytes .../runtime/shaders/spirv/vs_hdr_lum.bin | Bin 1096 -> 1096 bytes .../runtime/shaders/spirv/vs_hdr_lumavg.bin | Bin 1096 -> 1096 bytes .../runtime/shaders/spirv/vs_hdr_mesh.bin | Bin 1826 -> 1826 bytes .../runtime/shaders/spirv/vs_hdr_skybox.bin | Bin 1096 -> 1096 bytes .../runtime/shaders/spirv/vs_hdr_tonemap.bin | Bin 2418 -> 2438 bytes .../runtime/shaders/spirv/vs_hextile.bin | Bin 1705 -> 1705 bytes .../runtime/shaders/spirv/vs_ibl_mesh.bin | Bin 2033 -> 2033 bytes .../runtime/shaders/spirv/vs_ibl_skybox.bin | Bin 2056 -> 1976 bytes .../runtime/shaders/spirv/vs_instancing.bin | Bin 1485 -> 1485 bytes .../runtime/shaders/spirv/vs_mesh.bin | Bin 2719 -> 2671 bytes .../examples/runtime/shaders/spirv/vs_oit.bin | Bin 1584 -> 1584 bytes .../runtime/shaders/spirv/vs_oit_blit.bin | Bin 1096 -> 1096 bytes .../runtime/shaders/spirv/vs_particle.bin | Bin 2047 -> 1975 bytes .../shaders/spirv/vs_picking_shaded.bin | Bin 2103 -> 2103 bytes .../examples/runtime/shaders/spirv/vs_pom.bin | Bin 3056 -> 3056 bytes .../runtime/shaders/spirv/vs_raymarching.bin | Bin 1270 -> 1270 bytes .../runtime/shaders/spirv/vs_rsm_combine.bin | Bin 1096 -> 1096 bytes .../runtime/shaders/spirv/vs_rsm_gbuffer.bin | Bin 1634 -> 1634 bytes .../runtime/shaders/spirv/vs_rsm_lbuffer.bin | Bin 2875 -> 2779 bytes .../runtime/shaders/spirv/vs_rsm_shadow.bin | Bin 1494 -> 1494 bytes .../shaders/spirv/vs_shadowmaps_color.bin | Bin 886 -> 886 bytes .../spirv/vs_shadowmaps_color_lighting.bin | Bin 2355 -> 2355 bytes .../vs_shadowmaps_color_lighting_csm.bin | Bin 3640 -> 3640 bytes .../vs_shadowmaps_color_lighting_linear.bin | Bin 2435 -> 2435 bytes ...s_shadowmaps_color_lighting_linear_csm.bin | Bin 3912 -> 3912 bytes ..._shadowmaps_color_lighting_linear_omni.bin | Bin 3723 -> 3723 bytes .../vs_shadowmaps_color_lighting_omni.bin | Bin 3451 -> 3451 bytes .../spirv/vs_shadowmaps_color_texture.bin | Bin 1096 -> 1096 bytes .../shaders/spirv/vs_shadowmaps_depth.bin | Bin 886 -> 886 bytes .../shaders/spirv/vs_shadowmaps_hblur.bin | Bin 2559 -> 2599 bytes .../shaders/spirv/vs_shadowmaps_packdepth.bin | Bin 974 -> 974 bytes .../spirv/vs_shadowmaps_packdepth_linear.bin | Bin 1062 -> 1054 bytes .../shaders/spirv/vs_shadowmaps_texture.bin | Bin 1096 -> 1096 bytes .../spirv/vs_shadowmaps_texture_lighting.bin | Bin 1944 -> 1944 bytes .../spirv/vs_shadowmaps_unpackdepth.bin | Bin 1096 -> 1096 bytes .../shaders/spirv/vs_shadowmaps_vblur.bin | Bin 2559 -> 2599 bytes .../spirv/vs_shadowvolume_color_lighting.bin | Bin 1882 -> 1738 bytes .../spirv/vs_shadowvolume_color_texture.bin | Bin 1096 -> 1096 bytes .../shaders/spirv/vs_shadowvolume_svback.bin | Bin 1268 -> 1268 bytes .../shaders/spirv/vs_shadowvolume_svfront.bin | Bin 886 -> 886 bytes .../shaders/spirv/vs_shadowvolume_svside.bin | Bin 1618 -> 1618 bytes .../shaders/spirv/vs_shadowvolume_texture.bin | Bin 1096 -> 1096 bytes .../vs_shadowvolume_texture_lighting.bin | Bin 1944 -> 1944 bytes .../examples/runtime/shaders/spirv/vs_sky.bin | Bin 4695 -> 4603 bytes .../shaders/spirv/vs_sky_landscape.bin | Bin 1772 -> 1772 bytes .../runtime/shaders/spirv/vs_sms_mesh.bin | Bin 2199 -> 2199 bytes .../runtime/shaders/spirv/vs_sms_shadow.bin | Bin 886 -> 886 bytes .../shaders/spirv/vs_sms_shadow_pd.bin | Bin 974 -> 974 bytes .../runtime/shaders/spirv/vs_sss_gbuffer.bin | Bin 2088 -> 2088 bytes .../shaders/spirv/vs_sss_screenquad.bin | Bin 1080 -> 1080 bytes .../shaders/spirv/vs_stencil_color.bin | Bin 886 -> 886 bytes .../spirv/vs_stencil_color_lighting.bin | Bin 1824 -> 1736 bytes .../spirv/vs_stencil_color_texture.bin | Bin 1096 -> 1096 bytes .../shaders/spirv/vs_stencil_texture.bin | Bin 1096 -> 1096 bytes .../spirv/vs_stencil_texture_lighting.bin | Bin 1944 -> 1944 bytes .../runtime/shaders/spirv/vs_terrain.bin | Bin 1200 -> 1200 bytes .../spirv/vs_terrain_height_texture.bin | Bin 1630 -> 1630 bytes .../shaders/spirv/vs_terrain_render.bin | Bin 3989 -> 3965 bytes .../runtime/shaders/spirv/vs_tree.bin | Bin 2100 -> 2100 bytes .../runtime/shaders/spirv/vs_update.bin | Bin 1064 -> 1064 bytes .../shaders/spirv/vs_vectordisplay_fb.bin | Bin 1270 -> 1270 bytes .../runtime/shaders/spirv/vs_vt_generic.bin | Bin 1413 -> 1413 bytes .../runtime/shaders/spirv/vs_wf_mesh.bin | Bin 2171 -> 2171 bytes .../runtime/shaders/spirv/vs_wf_wireframe.bin | Bin 1737 -> 1737 bytes .../texture_compression_astc_10x10.dds | Bin 0 -> 4000 bytes .../texture_compression_astc_10x5.dds | Bin 7648 -> 7648 bytes .../texture_compression_astc_10x6.dds | Bin 0 -> 6496 bytes .../texture_compression_astc_10x8.dds | Bin 0 -> 4736 bytes .../texture_compression_astc_12x10.dds | Bin 0 -> 3408 bytes .../texture_compression_astc_12x12.dds | Bin 0 -> 2912 bytes .../textures/texture_compression_astc_4x4.dds | Bin 22000 -> 22000 bytes .../textures/texture_compression_astc_5x4.dds | Bin 0 -> 18032 bytes .../textures/texture_compression_astc_5x5.dds | Bin 14800 -> 14800 bytes .../textures/texture_compression_astc_6x5.dds | Bin 0 -> 12544 bytes .../textures/texture_compression_astc_6x6.dds | Bin 10640 -> 10640 bytes .../textures/texture_compression_astc_8x5.dds | Bin 9104 -> 9104 bytes .../textures/texture_compression_astc_8x6.dds | Bin 7728 -> 7728 bytes .../textures/texture_compression_astc_8x8.dds | Bin 0 -> 5632 bytes bgfx/include/bgfx/bgfx.h | 46 +- bgfx/include/bgfx/c99/bgfx.h | 165 +- bgfx/include/bgfx/defines.h | 9 +- bgfx/include/bgfx/embedded_shader.h | 2 +- bgfx/include/bgfx/platform.h | 2 +- bgfx/makefile | 73 +- bgfx/scripts/bgfx-codegen.lua | 2 +- bgfx/scripts/bgfx.idl | 121 +- bgfx/scripts/bgfx.lua | 4 +- bgfx/scripts/bindings-bf.lua | 4 +- bgfx/scripts/bindings-cs.lua | 6 +- bgfx/scripts/bindings-d.lua | 964 +- bgfx/scripts/bindings-zig.lua | 4 +- bgfx/scripts/build.ninja | 42 + bgfx/scripts/example-common.lua | 7 +- bgfx/scripts/genie.lua | 18 +- bgfx/scripts/geometryc.lua | 2 +- bgfx/scripts/geometryv.lua | 20 +- bgfx/scripts/idl.lua | 1 + bgfx/scripts/shader-embeded.mk | 28 +- bgfx/scripts/shader.mk | 26 +- bgfx/scripts/shaderc.lua | 50 +- bgfx/scripts/temp.bgfx.h | 2 +- bgfx/scripts/temp.bgfx.idl.inl | 2 +- bgfx/scripts/temp.defines.h | 2 +- bgfx/scripts/texturec.lua | 2 +- bgfx/scripts/texturev.lua | 20 +- bgfx/scripts/tools.mk | 2 +- bgfx/src/amalgamated.cpp | 3 +- bgfx/src/amalgamated.mm | 4 +- bgfx/src/bgfx.cpp | 115 +- bgfx/src/bgfx.idl.inl | 2 +- bgfx/src/bgfx_compute.sh | 2 +- bgfx/src/bgfx_p.h | 106 +- bgfx/src/bgfx_shader.sh | 48 +- bgfx/src/charset.h | 2 +- bgfx/src/config.h | 9 +- bgfx/src/debug_renderdoc.cpp | 2 +- bgfx/src/debug_renderdoc.h | 2 +- bgfx/src/dxgi.cpp | 208 +- bgfx/src/dxgi.h | 4 +- bgfx/src/emscripten.h | 2 +- bgfx/src/fs_clear0.sc | 2 +- bgfx/src/fs_clear1.sc | 2 +- bgfx/src/fs_clear2.sc | 2 +- bgfx/src/fs_clear3.sc | 2 +- bgfx/src/fs_clear4.sc | 2 +- bgfx/src/fs_clear5.sc | 2 +- bgfx/src/fs_clear6.sc | 2 +- bgfx/src/fs_clear7.sc | 2 +- bgfx/src/fs_debugfont.sc | 2 +- bgfx/src/glcontext_eagl.h | 62 - bgfx/src/glcontext_eagl.mm | 375 - bgfx/src/glcontext_egl.cpp | 226 +- bgfx/src/glcontext_egl.h | 13 +- bgfx/src/glcontext_glx.cpp | 392 - bgfx/src/glcontext_glx.h | 58 - bgfx/src/glcontext_html5.cpp | 10 +- bgfx/src/glcontext_html5.h | 2 +- bgfx/src/glcontext_nsgl.h | 51 - bgfx/src/glcontext_nsgl.mm | 394 - bgfx/src/glcontext_wgl.cpp | 4 +- bgfx/src/glcontext_wgl.h | 2 +- bgfx/src/glimports.h | 24 +- bgfx/src/makefile | 2 +- bgfx/src/nvapi.cpp | 2 +- bgfx/src/nvapi.h | 2 +- bgfx/src/renderer.h | 2 +- bgfx/src/renderer_agc.cpp | 2 +- bgfx/src/renderer_d3d.h | 2 +- bgfx/src/renderer_d3d11.cpp | 121 +- bgfx/src/renderer_d3d11.h | 2 +- bgfx/src/renderer_d3d12.cpp | 334 +- bgfx/src/renderer_d3d12.h | 2 +- bgfx/src/renderer_d3d9.cpp | 50 +- bgfx/src/renderer_d3d9.h | 6 +- bgfx/src/renderer_gl.cpp | 384 +- bgfx/src/renderer_gl.h | 199 +- bgfx/src/renderer_gnm.cpp | 2 +- bgfx/src/renderer_mtl.h | 29 +- bgfx/src/renderer_mtl.mm | 444 +- bgfx/src/renderer_noop.cpp | 4 +- bgfx/src/renderer_nvn.cpp | 2 +- bgfx/src/renderer_vk.cpp | 257 +- bgfx/src/renderer_vk.h | 44 +- bgfx/src/renderer_webgpu.cpp | 54 +- bgfx/src/renderer_webgpu.h | 8 +- bgfx/src/shader.cpp | 6 +- bgfx/src/shader.h | 2 +- bgfx/src/shader_dx9bc.cpp | 2 +- bgfx/src/shader_dx9bc.h | 2 +- bgfx/src/shader_dxbc.cpp | 4 +- bgfx/src/shader_dxbc.h | 4 +- bgfx/src/shader_spirv.cpp | 2 +- bgfx/src/shader_spirv.h | 2 +- bgfx/src/topology.cpp | 10 +- bgfx/src/topology.h | 2 +- bgfx/src/version.h | 6 +- bgfx/src/vertexlayout.cpp | 6 +- bgfx/src/vertexlayout.h | 2 +- bgfx/src/vs_clear.sc | 2 +- bgfx/src/vs_debugfont.sc | 2 +- bgfx/tools/geometryc/geometryc.cpp | 85 +- bgfx/tools/geometryv/geometryv.cpp | 6 +- bgfx/tools/shaderc/shaderc.cpp | 193 +- bgfx/tools/shaderc/shaderc.h | 12 +- bgfx/tools/shaderc/shaderc_glsl.cpp | 38 +- bgfx/tools/shaderc/shaderc_hlsl.cpp | 97 +- bgfx/tools/shaderc/shaderc_metal.cpp | 158 +- bgfx/tools/shaderc/shaderc_pssl.cpp | 9 +- bgfx/tools/shaderc/shaderc_spirv.cpp | 74 +- bgfx/tools/texturev/common.sh | 2 +- bgfx/tools/texturev/fs_texture.sc | 2 +- bgfx/tools/texturev/fs_texture_3d.sc | 2 +- bgfx/tools/texturev/fs_texture_array.sc | 2 +- bgfx/tools/texturev/fs_texture_cube.sc | 2 +- bgfx/tools/texturev/fs_texture_cube2.sc | 2 +- bgfx/tools/texturev/fs_texture_msdf.sc | 2 +- bgfx/tools/texturev/fs_texture_sdf.sc | 2 +- bgfx/tools/texturev/makefile | 2 +- bgfx/tools/texturev/texturev.cpp | 6 +- bgfx/tools/texturev/vs_texture.sc | 2 +- bgfx/tools/texturev/vs_texture_cube.sc | 2 +- bimg/.appveyor.yml | 20 - bimg/3rdparty/astc-codec/.gitignore | 5 - bimg/3rdparty/astc-codec/BUILD.bazel | 29 - bimg/3rdparty/astc-codec/CMakeLists.txt | 46 - bimg/3rdparty/astc-codec/CONTRIBUTING.md | 28 - .../astc-codec/GoogleTest-CMakeLists.txt.in | 15 - bimg/3rdparty/astc-codec/README.md | 71 - bimg/3rdparty/astc-codec/WORKSPACE | 37 - bimg/3rdparty/astc-codec/cmake-format.json | 38 - .../include/astc-codec/astc-codec.h | 75 - bimg/3rdparty/astc-codec/src/.clang-format | 4 - bimg/3rdparty/astc-codec/src/base/BUILD.bazel | 49 - .../astc-codec/src/base/CMakeLists.txt | 27 - .../3rdparty/astc-codec/src/base/bit_stream.h | 77 - bimg/3rdparty/astc-codec/src/base/bottom_n.h | 78 - .../3rdparty/astc-codec/src/base/math_utils.h | 80 - bimg/3rdparty/astc-codec/src/base/optional.h | 520 - .../astc-codec/src/base/string_utils.h | 69 - .../src/base/test/bit_stream_test.cpp | 141 - .../src/base/test/bottom_n_test.cpp | 108 - .../src/base/test/math_utils_test.cpp | 78 - .../src/base/test/optional_test.cpp | 481 - .../src/base/test/string_utils_test.cpp | 110 - .../src/base/test/type_traits_test.cpp | 130 - .../astc-codec/src/base/test/uint128_test.cpp | 140 - .../astc-codec/src/base/type_traits.h | 172 - bimg/3rdparty/astc-codec/src/base/uint128.h | 175 - bimg/3rdparty/astc-codec/src/base/utils.h | 35 - .../astc-codec/src/decoder/BUILD.bazel | 246 - .../astc-codec/src/decoder/CMakeLists.txt | 95 - .../astc-codec/src/decoder/astc_file.cc | 185 - .../astc-codec/src/decoder/astc_file.h | 97 - bimg/3rdparty/astc-codec/src/decoder/codec.cc | 132 - bimg/3rdparty/astc-codec/src/decoder/codec.h | 41 - .../astc-codec/src/decoder/endpoint_codec.cc | 963 - .../astc-codec/src/decoder/endpoint_codec.h | 90 - .../astc-codec/src/decoder/footprint.cc | 162 - .../astc-codec/src/decoder/footprint.h | 106 - .../src/decoder/integer_sequence_codec.cc | 574 - .../src/decoder/integer_sequence_codec.h | 169 - .../src/decoder/intermediate_astc_block.cc | 591 - .../src/decoder/intermediate_astc_block.h | 128 - .../src/decoder/logical_astc_block.cc | 262 - .../src/decoder/logical_astc_block.h | 127 - .../astc-codec/src/decoder/partition.cc | 601 - .../astc-codec/src/decoder/partition.h | 97 - .../src/decoder/physical_astc_block.cc | 761 - .../src/decoder/physical_astc_block.h | 128 - .../astc-codec/src/decoder/quantization.cc | 462 - .../astc-codec/src/decoder/quantization.h | 65 - .../src/decoder/test/astc_fuzzer.cc | 36 - .../astc-codec/src/decoder/test/codec_test.cc | 181 - .../src/decoder/test/endpoint_codec_test.cc | 463 - .../src/decoder/test/footprint_test.cc | 97 - .../astc-codec/src/decoder/test/image_utils.h | 217 - .../test/integer_sequence_codec_test.cc | 336 - .../test/intermediate_astc_block_test.cc | 454 - .../decoder/test/logical_astc_block_test.cc | 273 - .../src/decoder/test/partition_test.cc | 263 - .../decoder/test/physical_astc_block_test.cc | 361 - .../src/decoder/test/quantization_test.cc | 288 - .../src/decoder/test/weight_infill_test.cc | 69 - .../src/decoder/testdata/atlas_small_4x4.astc | Bin 65552 -> 0 bytes .../src/decoder/testdata/atlas_small_4x4.bmp | Bin 262282 -> 0 bytes .../src/decoder/testdata/atlas_small_5x5.astc | Bin 43280 -> 0 bytes .../src/decoder/testdata/atlas_small_5x5.bmp | Bin 262282 -> 0 bytes .../src/decoder/testdata/atlas_small_6x6.astc | Bin 29600 -> 0 bytes .../src/decoder/testdata/atlas_small_6x6.bmp | Bin 262282 -> 0 bytes .../src/decoder/testdata/atlas_small_8x8.astc | Bin 16400 -> 0 bytes .../src/decoder/testdata/atlas_small_8x8.bmp | Bin 262282 -> 0 bytes .../src/decoder/testdata/checkerboard.astc | Bin 80 -> 0 bytes .../src/decoder/testdata/checkered_10.astc | Bin 1616 -> 0 bytes .../src/decoder/testdata/checkered_11.astc | Bin 1952 -> 0 bytes .../src/decoder/testdata/checkered_12.astc | Bin 2320 -> 0 bytes .../src/decoder/testdata/checkered_4.astc | Bin 272 -> 0 bytes .../src/decoder/testdata/checkered_5.astc | Bin 416 -> 0 bytes .../src/decoder/testdata/checkered_6.astc | Bin 592 -> 0 bytes .../src/decoder/testdata/checkered_7.astc | Bin 800 -> 0 bytes .../src/decoder/testdata/checkered_8.astc | Bin 1040 -> 0 bytes .../src/decoder/testdata/checkered_9.astc | Bin 1312 -> 0 bytes .../src/decoder/testdata/footprint_10x10.astc | Bin 272 -> 0 bytes .../src/decoder/testdata/footprint_10x10.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_10x5.astc | Bin 464 -> 0 bytes .../src/decoder/testdata/footprint_10x5.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_10x6.astc | Bin 400 -> 0 bytes .../src/decoder/testdata/footprint_10x6.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_10x8.astc | Bin 272 -> 0 bytes .../src/decoder/testdata/footprint_10x8.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_12x10.astc | Bin 208 -> 0 bytes .../src/decoder/testdata/footprint_12x10.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_12x12.astc | Bin 160 -> 0 bytes .../src/decoder/testdata/footprint_12x12.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_4x4.astc | Bin 1040 -> 0 bytes .../src/decoder/testdata/footprint_4x4.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_5x4.astc | Bin 912 -> 0 bytes .../src/decoder/testdata/footprint_5x4.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_5x5.astc | Bin 800 -> 0 bytes .../src/decoder/testdata/footprint_5x5.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_6x5.astc | Bin 688 -> 0 bytes .../src/decoder/testdata/footprint_6x5.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_6x6.astc | Bin 592 -> 0 bytes .../src/decoder/testdata/footprint_6x6.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_8x5.astc | Bin 464 -> 0 bytes .../src/decoder/testdata/footprint_8x5.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_8x6.astc | Bin 400 -> 0 bytes .../src/decoder/testdata/footprint_8x6.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/footprint_8x8.astc | Bin 272 -> 0 bytes .../src/decoder/testdata/footprint_8x8.bmp | Bin 3210 -> 0 bytes .../src/decoder/testdata/rgb_12x12.astc | Bin 7312 -> 0 bytes .../src/decoder/testdata/rgb_12x12.bmp | Bin 193674 -> 0 bytes .../src/decoder/testdata/rgb_4x4.astc | Bin 64528 -> 0 bytes .../src/decoder/testdata/rgb_4x4.bmp | Bin 193674 -> 0 bytes .../src/decoder/testdata/rgb_5x4.astc | Bin 51856 -> 0 bytes .../src/decoder/testdata/rgb_5x4.bmp | Bin 193674 -> 0 bytes .../src/decoder/testdata/rgb_6x6.astc | Bin 29200 -> 0 bytes .../src/decoder/testdata/rgb_6x6.bmp | Bin 193674 -> 0 bytes .../src/decoder/testdata/rgb_8x8.astc | Bin 16144 -> 0 bytes .../src/decoder/testdata/rgb_8x8.bmp | Bin 193674 -> 0 bytes .../src/decoder/tools/astc_inspector_cli.cc | 785 - bimg/3rdparty/astc-codec/src/decoder/types.h | 74 - .../astc-codec/src/decoder/weight_infill.cc | 122 - .../astc-codec/src/decoder/weight_infill.h | 38 - bimg/3rdparty/astc-codec/third_party/BUILD | 0 .../astc-codec/third_party/honggfuzz.BUILD | 39 - .../astc-codec/tools/build-ci/linux/build.sh | 76 - .../tools/build-ci/linux/continuous.cfg | 3 - .../tools/build-ci/linux/presubmit.cfg | 3 - .../LICENSE => astc-encoder/LICENSE.txt} | 29 +- bimg/3rdparty/astc-encoder/include/astcenc.h | 829 + .../astcenc_averages_and_directions.cpp | 948 + .../source/astcenc_block_sizes.cpp | 1184 ++ .../source/astcenc_color_quantize.cpp | 2149 ++ .../source/astcenc_color_unquantize.cpp | 925 + .../source/astcenc_compress_symbolic.cpp | 1456 ++ .../source/astcenc_compute_variance.cpp | 472 + .../source/astcenc_decompress_symbolic.cpp | 623 + .../source/astcenc_diagnostic_trace.cpp | 245 + .../source/astcenc_diagnostic_trace.h | 219 + .../astc-encoder/source/astcenc_entry.cpp | 1366 ++ .../source/astcenc_find_best_partitioning.cpp | 781 + .../astcenc_ideal_endpoints_and_weights.cpp | 1663 ++ .../astc-encoder/source/astcenc_image.cpp | 558 + .../source/astcenc_integer_sequence.cpp | 739 + .../astc-encoder/source/astcenc_internal.h | 2187 +++ .../source/astcenc_internal_entry.h | 273 + .../astc-encoder/source/astcenc_mathlib.cpp | 48 + .../astc-encoder/source/astcenc_mathlib.h | 476 + .../source/astcenc_mathlib_softfloat.cpp} | 173 +- .../source/astcenc_partition_tables.cpp | 481 + .../source/astcenc_percentile_tables.cpp | 1251 ++ .../astcenc_pick_best_endpoint_format.cpp | 1350 ++ .../source/astcenc_quantization.cpp | 903 + .../source/astcenc_symbolic_physical.cpp | 541 + .../astc-encoder/source/astcenc_vecmathlib.h | 570 + .../source/astcenc_vecmathlib_avx2_8.h | 1212 ++ .../source/astcenc_vecmathlib_common_4.h | 423 + .../source/astcenc_vecmathlib_neon_4.h | 1099 ++ .../source/astcenc_vecmathlib_none_4.h | 1199 ++ .../source/astcenc_vecmathlib_sse_4.h | 1319 ++ .../source/astcenc_weight_align.cpp | 479 + .../astcenc_weight_quant_xfer_tables.cpp | 147 + .../astc/astc_averages_and_directions.cpp | 627 - bimg/3rdparty/astc/astc_block_sizes2.cpp | 977 - bimg/3rdparty/astc/astc_codec_internals.h | 816 - bimg/3rdparty/astc/astc_color_quantize.cpp | 2096 -- bimg/3rdparty/astc/astc_color_unquantize.cpp | 970 - bimg/3rdparty/astc/astc_compress_symbolic.cpp | 1792 -- bimg/3rdparty/astc/astc_compute_variance.cpp | 524 - .../astc/astc_decompress_symbolic.cpp | 317 - .../astc/astc_encoding_choice_error.cpp | 310 - .../astc/astc_find_best_partitioning.cpp | 865 - .../astc/astc_ideal_endpoints_and_weights.cpp | 2163 --- bimg/3rdparty/astc/astc_imageblock.cpp | 324 - bimg/3rdparty/astc/astc_integer_sequence.cpp | 649 - .../astc/astc_kmeans_partitioning.cpp | 520 - bimg/3rdparty/astc/astc_lib.cpp | 565 - bimg/3rdparty/astc/astc_lib.h | 75 - bimg/3rdparty/astc/astc_partition_tables.cpp | 323 - bimg/3rdparty/astc/astc_percentile_tables.cpp | 4768 ----- .../astc/astc_pick_best_endpoint_format.cpp | 938 - bimg/3rdparty/astc/astc_quantization.cpp | 558 - bimg/3rdparty/astc/astc_symbolic_physical.cpp | 431 - bimg/3rdparty/astc/astc_weight_align.cpp | 600 - .../astc/astc_weight_quant_xfer_tables.cpp | 1003 - bimg/3rdparty/astc/license.txt | 137 - bimg/3rdparty/astc/mathlib.cpp | 781 - bimg/3rdparty/astc/mathlib.h | 200 - bimg/3rdparty/astc/readme.txt | 1 - bimg/3rdparty/astc/softfloat.h | 95 - bimg/3rdparty/astc/vectypes.h | 16209 ---------------- bimg/3rdparty/lodepng/lodepng.cpp | 546 +- bimg/3rdparty/lodepng/lodepng.h | 210 +- bimg/3rdparty/nvtt/nvcore/nvcore.h | 12 + bimg/3rdparty/nvtt/nvcore/posh.h | 12 +- bimg/3rdparty/nvtt/nvtt.cpp | 2 +- bimg/3rdparty/stb/stb_image.h | 417 +- bimg/3rdparty/stb/stb_image_write.h | 1690 -- bimg/LICENSE | 2 +- bimg/README.md | 5 +- bimg/include/bimg/bimg.h | 10 +- bimg/include/bimg/decode.h | 2 +- bimg/include/bimg/encode.h | 2 +- bimg/makefile | 10 +- bimg/scripts/bimg.lua | 26 +- bimg/scripts/bimg_decode.lua | 2 +- bimg/scripts/bimg_encode.lua | 13 +- bimg/scripts/genie.lua | 2 +- bimg/scripts/texturec.lua | 2 +- bimg/src/bimg_p.h | 2 +- bimg/src/config.h | 2 +- bimg/src/image.cpp | 296 +- bimg/src/image_cubemap_filter.cpp | 6 +- bimg/src/image_decode.cpp | 7 +- bimg/src/image_encode.cpp | 154 +- bimg/src/image_gnf.cpp | 2 +- bimg/tools/texturec/texturec.cpp | 111 +- build.rs | 2 +- bx/.appveyor.yml | 19 - bx/3rdparty/ini/ini.h | 105 +- bx/LICENSE | 2 +- bx/README.md | 7 +- bx/include/bx/allocator.h | 60 +- bx/include/bx/bounds.h | 46 +- bx/include/bx/bx.h | 77 +- bx/include/bx/commandline.h | 2 +- bx/include/bx/config.h | 2 +- bx/include/bx/constants.h | 43 +- bx/include/bx/cpu.h | 2 +- bx/include/bx/debug.h | 2 +- bx/include/bx/easing.h | 2 +- bx/include/bx/endian.h | 2 +- bx/include/bx/error.h | 2 +- bx/include/bx/file.h | 2 +- bx/include/bx/filepath.h | 9 +- bx/include/bx/float4x4_t.h | 2 +- bx/include/bx/handlealloc.h | 2 +- bx/include/bx/hash.h | 2 +- bx/include/bx/inline/allocator.inl | 34 +- bx/include/bx/inline/bounds.inl | 2 +- bx/include/bx/inline/bx.inl | 2 +- bx/include/bx/inline/cpu.inl | 2 +- bx/include/bx/inline/easing.inl | 2 +- bx/include/bx/inline/endian.inl | 2 +- bx/include/bx/inline/error.inl | 2 +- bx/include/bx/inline/float4x4_t.inl | 2 +- bx/include/bx/inline/handlealloc.inl | 6 +- bx/include/bx/inline/hash.inl | 2 +- bx/include/bx/inline/math.inl | 140 +- bx/include/bx/inline/mpscqueue.inl | 2 +- bx/include/bx/inline/mutex.inl | 2 +- bx/include/bx/inline/os.inl | 2 +- bx/include/bx/inline/pixelformat.inl | 2 +- bx/include/bx/inline/readerwriter.inl | 33 +- bx/include/bx/inline/ringbuffer.inl | 2 +- bx/include/bx/inline/rng.inl | 2 +- bx/include/bx/inline/simd128_langext.inl | 2 +- bx/include/bx/inline/simd128_neon.inl | 33 +- bx/include/bx/inline/simd128_ref.inl | 2 +- bx/include/bx/inline/simd128_sse.inl | 6 +- bx/include/bx/inline/simd256_avx.inl | 2 +- bx/include/bx/inline/simd256_ref.inl | 2 +- bx/include/bx/inline/simd_ni.inl | 16 +- bx/include/bx/inline/sort.inl | 8 +- bx/include/bx/inline/spscqueue.inl | 6 +- bx/include/bx/inline/string.inl | 52 +- bx/include/bx/inline/typetraits.inl | 202 +- bx/include/bx/inline/uint32_t.inl | 50 +- bx/include/bx/macros.h | 52 +- bx/include/bx/maputil.h | 2 +- bx/include/bx/math.h | 72 +- bx/include/bx/mpscqueue.h | 2 +- bx/include/bx/mutex.h | 2 +- bx/include/bx/os.h | 2 +- bx/include/bx/pixelformat.h | 2 +- bx/include/bx/platform.h | 18 +- bx/include/bx/process.h | 2 +- bx/include/bx/readerwriter.h | 5 +- bx/include/bx/ringbuffer.h | 2 +- bx/include/bx/rng.h | 2 +- bx/include/bx/semaphore.h | 2 +- bx/include/bx/settings.h | 2 +- bx/include/bx/simd_t.h | 2 +- bx/include/bx/sort.h | 2 +- bx/include/bx/spscqueue.h | 2 +- bx/include/bx/string.h | 58 +- bx/include/bx/thread.h | 2 +- bx/include/bx/timer.h | 2 +- bx/include/bx/typetraits.h | 2 +- bx/include/bx/uint32_t.h | 2 +- bx/include/bx/url.h | 2 +- bx/makefile | 2 +- bx/scripts/bin2c.lua | 2 +- bx/scripts/bx.lua | 2 +- bx/scripts/genie.lua | 2 +- bx/scripts/lemon.lua | 2 +- bx/scripts/toolchain.lua | 283 +- bx/src/allocator.cpp | 16 +- bx/src/amalgamated.cpp | 2 +- bx/src/bounds.cpp | 56 +- bx/src/bx.cpp | 12 +- bx/src/commandline.cpp | 2 +- bx/src/crtnone.cpp | 2 +- bx/src/debug.cpp | 2 +- bx/src/dtoa.cpp | 2 +- bx/src/easing.cpp | 2 +- bx/src/file.cpp | 13 +- bx/src/filepath.cpp | 62 +- bx/src/hash.cpp | 2 +- bx/src/math.cpp | 40 +- bx/src/mutex.cpp | 2 +- bx/src/os.cpp | 2 +- bx/src/process.cpp | 2 +- bx/src/semaphore.cpp | 2 +- bx/src/settings.cpp | 14 +- bx/src/sort.cpp | 2 +- bx/src/string.cpp | 60 +- bx/src/thread.cpp | 6 +- bx/src/timer.cpp | 2 +- bx/src/url.cpp | 2 +- bx/tests/atomic_test.cpp | 2 +- bx/tests/crt_test.cpp | 2 +- bx/tests/dbg.h | 2 +- bx/tests/easing_test.cpp | 2 +- bx/tests/filepath_test.cpp | 33 +- bx/tests/handle_bench.cpp | 2 +- bx/tests/handle_test.cpp | 2 +- bx/tests/hash_test.cpp | 2 +- bx/tests/macros_test.cpp | 2 +- bx/tests/main_test.cpp | 2 +- bx/tests/math_bench.cpp | 2 +- bx/tests/math_test.cpp | 288 +- bx/tests/os_test.cpp | 2 +- bx/tests/queue_test.cpp | 2 +- bx/tests/readerwriter_test.cpp | 2 +- bx/tests/ringbuffer_test.cpp | 2 +- bx/tests/rng_test.cpp | 2 +- bx/tests/run_test.cpp | 2 +- bx/tests/settings_test.cpp | 2 +- bx/tests/simd_bench.cpp | 6 +- bx/tests/simd_test.cpp | 2 +- bx/tests/sort_test.cpp | 62 +- bx/tests/string_test.cpp | 93 +- bx/tests/test.h | 2 +- bx/tests/thread_test.cpp | 2 +- bx/tests/tokenizecmd_test.cpp | 2 +- bx/tests/typetraits_test.cpp | 2 +- bx/tests/uint32_test.cpp | 34 +- bx/tests/url_test.cpp | 4 +- bx/tests/vsnprintf_test.cpp | 57 +- bx/tools/bin2c/bin2c.cpp | 8 +- 2453 files changed, 98472 insertions(+), 100341 deletions(-) create mode 100644 bgfx/3rdparty/glslang/SPIRV/GLSL.ext.ARM.h create mode 100644 bgfx/3rdparty/glslang/SPIRV/GLSL.ext.QCOM.h mode change 100644 => 100755 bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.cpp mode change 100644 => 100755 bgfx/3rdparty/glslang/SPIRV/doc.cpp mode change 100644 => 100755 bgfx/3rdparty/glslang/glslang/Include/BaseTypes.h mode change 100644 => 100755 bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp mode change 100644 => 100755 bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.h delete mode 100644 bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.m4 rename bgfx/3rdparty/glslang/{StandAlone => glslang/Public}/ResourceLimits.h (90%) rename bgfx/3rdparty/glslang/{StandAlone => glslang/Public}/resource_limits_c.h (93%) rename bgfx/3rdparty/glslang/{StandAlone => glslang/ResourceLimits}/ResourceLimits.cpp (99%) rename bgfx/3rdparty/glslang/{StandAlone => glslang/ResourceLimits}/resource_limits_c.cpp (82%) delete mode 100644 bgfx/3rdparty/glslang/hlsl/stub.cpp delete mode 100644 bgfx/3rdparty/khronos/GLES3/gl3ext.h delete mode 100644 bgfx/3rdparty/khronos/gl/GRemedyGLExtensions.h create mode 100644 bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std.h create mode 100644 bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std_decode.h create mode 100644 bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std_encode.h create mode 100644 bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std.h create mode 100644 bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std_decode.h create mode 100644 bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std_encode.h create mode 100644 bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codecs_common.h create mode 100644 bgfx/3rdparty/khronos/wgl/wgl.h create mode 100644 bgfx/3rdparty/meshoptimizer/src/quantization.cpp create mode 100644 bgfx/3rdparty/native_app_glue/LICENSE create mode 100644 bgfx/3rdparty/native_app_glue/android_native_app_glue.c create mode 100644 bgfx/3rdparty/native_app_glue/android_native_app_glue.h create mode 100644 bgfx/3rdparty/spirv-headers/include/spirv/1.0/spirv.hpp11 create mode 100644 bgfx/3rdparty/spirv-headers/include/spirv/1.1/spirv.hpp11 create mode 100644 bgfx/3rdparty/spirv-headers/include/spirv/1.2/spirv.hpp11 create mode 100644 bgfx/3rdparty/spirv-headers/include/spirv/unified1/NonSemanticDebugBreak.h create mode 100644 bgfx/3rdparty/spirv-headers/include/spirv/unified1/extinst.nonsemantic.debugbreak.grammar.json create mode 100644 bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.hpp11 create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/analyze_live_input_pass.cpp create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/analyze_live_input_pass.h delete mode 100644 bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_input_components_pass.cpp create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_io_components_pass.cpp rename bgfx/3rdparty/spirv-tools/source/opt/{eliminate_dead_input_components_pass.h => eliminate_dead_io_components_pass.h} (69%) create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_output_stores_pass.cpp create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_output_stores_pass.h create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/liveness.cpp create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/liveness.h create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/switch_descriptorset_pass.cpp create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/switch_descriptorset_pass.h create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/trim_capabilities_pass.cpp create mode 100644 bgfx/3rdparty/spirv-tools/source/opt/trim_capabilities_pass.h create mode 100644 bgfx/3rdparty/spirv-tools/source/val/validate_ray_tracing_reorder.cpp create mode 100644 bgfx/bindings/d/fakeenum.d delete mode 100644 bgfx/bindings/d/funcs.d create mode 100644 bgfx/bindings/d/package.d delete mode 100644 bgfx/bindings/d/types.d create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_apply.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_generate_importance_map.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_generate_q0.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_generate_q1.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_generate_q2.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_generate_q3.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_generate_q3base.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_load_counter_clear.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_non_smart_apply.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_non_smart_blur.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_non_smart_half_apply.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_postprocess_importance_map_a.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_postprocess_importance_map_b.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depth_mip.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depths.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depths_and_normals.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depths_and_normals_half.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depths_half.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_smart_blur.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_assao_smart_blur_wide.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_drawindirect_count.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_fsr_bilinear_16.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_fsr_bilinear_32.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_fsr_easu_16.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_fsr_easu_32.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_fsr_rcas_16.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_fsr_rcas_32.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_gdr_copy_z.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_gdr_downscale_hi_z.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_gdr_occlude_props.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_gdr_stream_compaction.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_terrain_init.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_terrain_lod.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_terrain_update_draw.bin create mode 100644 bgfx/examples/runtime/shaders/essl/cs_terrain_update_indirect.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_assao_deferred_combine.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_assao_gbuffer.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_deferred_clear_uav.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_deferred_combine_ta.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_deferred_debug_ta.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_deferred_light_ta.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_deferred_light_uav.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_fsr_copy_linear_to_gamma.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_fsr_forward.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_fsr_forward_grid.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_gdr_instanced_indirect_rendering.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_terrain_render.bin create mode 100644 bgfx/examples/runtime/shaders/essl/fs_terrain_render_normal.bin create mode 100644 bgfx/examples/runtime/shaders/essl/vs_assao.bin create mode 100644 bgfx/examples/runtime/shaders/essl/vs_assao_gbuffer.bin create mode 100644 bgfx/examples/runtime/shaders/essl/vs_fsr_forward.bin create mode 100644 bgfx/examples/runtime/shaders/essl/vs_fsr_screenquad.bin create mode 100644 bgfx/examples/runtime/shaders/essl/vs_gdr_instanced_indirect_rendering.bin create mode 100644 bgfx/examples/runtime/shaders/essl/vs_gdr_render_occlusion.bin create mode 100644 bgfx/examples/runtime/shaders/essl/vs_terrain_render.bin create mode 100644 bgfx/examples/runtime/shaders/metal/cs_drawindirect_count.bin create mode 100644 bgfx/examples/runtime/textures/texture_compression_astc_10x10.dds create mode 100644 bgfx/examples/runtime/textures/texture_compression_astc_10x6.dds create mode 100644 bgfx/examples/runtime/textures/texture_compression_astc_10x8.dds create mode 100644 bgfx/examples/runtime/textures/texture_compression_astc_12x10.dds create mode 100644 bgfx/examples/runtime/textures/texture_compression_astc_12x12.dds create mode 100644 bgfx/examples/runtime/textures/texture_compression_astc_5x4.dds create mode 100644 bgfx/examples/runtime/textures/texture_compression_astc_6x5.dds create mode 100644 bgfx/examples/runtime/textures/texture_compression_astc_8x8.dds delete mode 100644 bgfx/src/glcontext_eagl.h delete mode 100644 bgfx/src/glcontext_eagl.mm delete mode 100644 bgfx/src/glcontext_glx.cpp delete mode 100644 bgfx/src/glcontext_glx.h delete mode 100644 bgfx/src/glcontext_nsgl.h delete mode 100644 bgfx/src/glcontext_nsgl.mm delete mode 100644 bimg/.appveyor.yml delete mode 100644 bimg/3rdparty/astc-codec/.gitignore delete mode 100644 bimg/3rdparty/astc-codec/BUILD.bazel delete mode 100644 bimg/3rdparty/astc-codec/CMakeLists.txt delete mode 100644 bimg/3rdparty/astc-codec/CONTRIBUTING.md delete mode 100644 bimg/3rdparty/astc-codec/GoogleTest-CMakeLists.txt.in delete mode 100644 bimg/3rdparty/astc-codec/README.md delete mode 100644 bimg/3rdparty/astc-codec/WORKSPACE delete mode 100644 bimg/3rdparty/astc-codec/cmake-format.json delete mode 100644 bimg/3rdparty/astc-codec/include/astc-codec/astc-codec.h delete mode 100644 bimg/3rdparty/astc-codec/src/.clang-format delete mode 100644 bimg/3rdparty/astc-codec/src/base/BUILD.bazel delete mode 100644 bimg/3rdparty/astc-codec/src/base/CMakeLists.txt delete mode 100644 bimg/3rdparty/astc-codec/src/base/bit_stream.h delete mode 100644 bimg/3rdparty/astc-codec/src/base/bottom_n.h delete mode 100644 bimg/3rdparty/astc-codec/src/base/math_utils.h delete mode 100644 bimg/3rdparty/astc-codec/src/base/optional.h delete mode 100644 bimg/3rdparty/astc-codec/src/base/string_utils.h delete mode 100644 bimg/3rdparty/astc-codec/src/base/test/bit_stream_test.cpp delete mode 100644 bimg/3rdparty/astc-codec/src/base/test/bottom_n_test.cpp delete mode 100644 bimg/3rdparty/astc-codec/src/base/test/math_utils_test.cpp delete mode 100644 bimg/3rdparty/astc-codec/src/base/test/optional_test.cpp delete mode 100644 bimg/3rdparty/astc-codec/src/base/test/string_utils_test.cpp delete mode 100644 bimg/3rdparty/astc-codec/src/base/test/type_traits_test.cpp delete mode 100644 bimg/3rdparty/astc-codec/src/base/test/uint128_test.cpp delete mode 100644 bimg/3rdparty/astc-codec/src/base/type_traits.h delete mode 100644 bimg/3rdparty/astc-codec/src/base/uint128.h delete mode 100644 bimg/3rdparty/astc-codec/src/base/utils.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/BUILD.bazel delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/CMakeLists.txt delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/astc_file.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/astc_file.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/codec.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/codec.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/endpoint_codec.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/endpoint_codec.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/footprint.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/footprint.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/integer_sequence_codec.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/integer_sequence_codec.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/intermediate_astc_block.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/intermediate_astc_block.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/logical_astc_block.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/logical_astc_block.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/partition.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/partition.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/physical_astc_block.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/physical_astc_block.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/quantization.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/quantization.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/astc_fuzzer.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/codec_test.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/endpoint_codec_test.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/footprint_test.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/image_utils.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/integer_sequence_codec_test.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/intermediate_astc_block_test.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/logical_astc_block_test.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/partition_test.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/physical_astc_block_test.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/quantization_test.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/test/weight_infill_test.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/atlas_small_4x4.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/atlas_small_4x4.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/atlas_small_5x5.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/atlas_small_5x5.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/atlas_small_6x6.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/atlas_small_6x6.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/atlas_small_8x8.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/atlas_small_8x8.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/checkerboard.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/checkered_10.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/checkered_11.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/checkered_12.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/checkered_4.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/checkered_5.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/checkered_6.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/checkered_7.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/checkered_8.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/checkered_9.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_10x10.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_10x10.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_10x5.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_10x5.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_10x6.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_10x6.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_10x8.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_10x8.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_12x10.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_12x10.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_12x12.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_12x12.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_4x4.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_4x4.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_5x4.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_5x4.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_5x5.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_5x5.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_6x5.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_6x5.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_6x6.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_6x6.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_8x5.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_8x5.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_8x6.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_8x6.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_8x8.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/footprint_8x8.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/rgb_12x12.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/rgb_12x12.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/rgb_4x4.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/rgb_4x4.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/rgb_5x4.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/rgb_5x4.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/rgb_6x6.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/rgb_6x6.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/rgb_8x8.astc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/testdata/rgb_8x8.bmp delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/tools/astc_inspector_cli.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/types.h delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/weight_infill.cc delete mode 100644 bimg/3rdparty/astc-codec/src/decoder/weight_infill.h delete mode 100644 bimg/3rdparty/astc-codec/third_party/BUILD delete mode 100644 bimg/3rdparty/astc-codec/third_party/honggfuzz.BUILD delete mode 100755 bimg/3rdparty/astc-codec/tools/build-ci/linux/build.sh delete mode 100644 bimg/3rdparty/astc-codec/tools/build-ci/linux/continuous.cfg delete mode 100644 bimg/3rdparty/astc-codec/tools/build-ci/linux/presubmit.cfg rename bimg/3rdparty/{astc-codec/LICENSE => astc-encoder/LICENSE.txt} (88%) create mode 100644 bimg/3rdparty/astc-encoder/include/astcenc.h create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_averages_and_directions.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_block_sizes.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_color_quantize.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_color_unquantize.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_compress_symbolic.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_compute_variance.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_decompress_symbolic.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_diagnostic_trace.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_diagnostic_trace.h create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_entry.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_find_best_partitioning.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_ideal_endpoints_and_weights.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_image.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_integer_sequence.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_internal.h create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_internal_entry.h create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_mathlib.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_mathlib.h rename bimg/3rdparty/{astc/softfloat.cpp => astc-encoder/source/astcenc_mathlib_softfloat.cpp} (71%) create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_partition_tables.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_percentile_tables.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_pick_best_endpoint_format.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_quantization.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_symbolic_physical.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_vecmathlib.h create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_vecmathlib_avx2_8.h create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_vecmathlib_common_4.h create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_vecmathlib_neon_4.h create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_vecmathlib_none_4.h create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_vecmathlib_sse_4.h create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_weight_align.cpp create mode 100644 bimg/3rdparty/astc-encoder/source/astcenc_weight_quant_xfer_tables.cpp delete mode 100644 bimg/3rdparty/astc/astc_averages_and_directions.cpp delete mode 100644 bimg/3rdparty/astc/astc_block_sizes2.cpp delete mode 100644 bimg/3rdparty/astc/astc_codec_internals.h delete mode 100644 bimg/3rdparty/astc/astc_color_quantize.cpp delete mode 100644 bimg/3rdparty/astc/astc_color_unquantize.cpp delete mode 100644 bimg/3rdparty/astc/astc_compress_symbolic.cpp delete mode 100644 bimg/3rdparty/astc/astc_compute_variance.cpp delete mode 100644 bimg/3rdparty/astc/astc_decompress_symbolic.cpp delete mode 100644 bimg/3rdparty/astc/astc_encoding_choice_error.cpp delete mode 100644 bimg/3rdparty/astc/astc_find_best_partitioning.cpp delete mode 100644 bimg/3rdparty/astc/astc_ideal_endpoints_and_weights.cpp delete mode 100644 bimg/3rdparty/astc/astc_imageblock.cpp delete mode 100644 bimg/3rdparty/astc/astc_integer_sequence.cpp delete mode 100644 bimg/3rdparty/astc/astc_kmeans_partitioning.cpp delete mode 100644 bimg/3rdparty/astc/astc_lib.cpp delete mode 100644 bimg/3rdparty/astc/astc_lib.h delete mode 100644 bimg/3rdparty/astc/astc_partition_tables.cpp delete mode 100644 bimg/3rdparty/astc/astc_percentile_tables.cpp delete mode 100644 bimg/3rdparty/astc/astc_pick_best_endpoint_format.cpp delete mode 100644 bimg/3rdparty/astc/astc_quantization.cpp delete mode 100644 bimg/3rdparty/astc/astc_symbolic_physical.cpp delete mode 100644 bimg/3rdparty/astc/astc_weight_align.cpp delete mode 100644 bimg/3rdparty/astc/astc_weight_quant_xfer_tables.cpp delete mode 100644 bimg/3rdparty/astc/license.txt delete mode 100644 bimg/3rdparty/astc/mathlib.cpp delete mode 100644 bimg/3rdparty/astc/mathlib.h delete mode 100644 bimg/3rdparty/astc/readme.txt delete mode 100644 bimg/3rdparty/astc/softfloat.h delete mode 100644 bimg/3rdparty/astc/vectypes.h delete mode 100644 bimg/3rdparty/stb/stb_image_write.h delete mode 100644 bx/.appveyor.yml diff --git a/bgfx/.gitattributes b/bgfx/.gitattributes index e89cf412..dde21f78 100644 --- a/bgfx/.gitattributes +++ b/bgfx/.gitattributes @@ -1,11 +1,12 @@ +*.bin binary diff=hex *.c eol=lf *.cpp eol=lf *.h eol=lf -*.sc eol=lf -*.sh eol=lf +*.lua eol=lf *.m eol=lf -*.mm eol=lf *.md eol=lf -*.lua eol=lf *.mk eol=lf +*.mm eol=lf +*.sc eol=lf +*.sh eol=lf makefile eol=lf diff --git a/bgfx/.github/workflows/main.yml b/bgfx/.github/workflows/main.yml index dd79dc51..2c55b275 100644 --- a/bgfx/.github/workflows/main.yml +++ b/bgfx/.github/workflows/main.yml @@ -206,3 +206,42 @@ jobs: ".build/osx-x64/bin/geometryc${{ matrix.binsuffix}}" --version ".build/osx-x64/bin/shaderc${{ matrix.binsuffix}}" --version ".build/osx-x64/bin/texturec${{ matrix.binsuffix}}" --version + android: + strategy: + fail-fast: true + matrix: + include: [ + { platform: arm64 }, + ] + name: android-${{ matrix.platform }} + runs-on: ubuntu-22.04 + steps: + - uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r25b + add-to-path: false + - name: Checkout bgfx + uses: actions/checkout@v3 + with: + path: bgfx + - name: Checkout bx + uses: actions/checkout@v3 + with: + repository: bkaradzic/bx + path: bx + - name: Checkout bimg + uses: actions/checkout@v3 + with: + repository: bkaradzic/bimg + path: bimg + - name: Build + run: | + cd bgfx + make -j$(sysctl -n hw.physicalcpu) android-${{ matrix.platform }} + env: + ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} + - name: Check + run: | + cd bgfx + ls -lash ".build/android-${{ matrix.platform }}/bin" diff --git a/bgfx/.gitignore b/bgfx/.gitignore index 362a7c69..0e292f5c 100644 --- a/bgfx/.gitignore +++ b/bgfx/.gitignore @@ -1,9 +1,11 @@ +*.TMP +*.dxvk-cache +*.log +.DS_Store .build .debug -.DS_Store +.gdb_history .git .svn -tags -.gdb_history .vscode -*.TMP +tags diff --git a/bgfx/3rdparty/cgltf/cgltf.h b/bgfx/3rdparty/cgltf/cgltf.h index a534cefb..af24c65e 100644 --- a/bgfx/3rdparty/cgltf/cgltf.h +++ b/bgfx/3rdparty/cgltf/cgltf.h @@ -65,7 +65,8 @@ * * `cgltf_num_components` is a tiny utility that tells you the dimensionality of * a certain accessor type. This can be used before `cgltf_accessor_unpack_floats` to help allocate - * the necessary amount of memory. + * the necessary amount of memory. `cgltf_component_size` and `cgltf_calc_size` exist for + * similar purposes. * * `cgltf_accessor_read_float` reads a certain element from a non-sparse accessor and converts it to * floating point, assuming that `cgltf_load_buffers` has already been called. The passed-in element @@ -89,6 +90,7 @@ #define CGLTF_H_INCLUDED__ #include +#include /* For uint8_t, uint32_t */ #ifdef __cplusplus extern "C" { @@ -502,6 +504,13 @@ typedef struct cgltf_iridescence cgltf_texture_view iridescence_thickness_texture; } cgltf_iridescence; +typedef struct cgltf_anisotropy +{ + cgltf_float anisotropy_strength; + cgltf_float anisotropy_rotation; + cgltf_texture_view anisotropy_texture; +} cgltf_anisotropy; + typedef struct cgltf_material { char* name; @@ -515,6 +524,7 @@ typedef struct cgltf_material cgltf_bool has_sheen; cgltf_bool has_emissive_strength; cgltf_bool has_iridescence; + cgltf_bool has_anisotropy; cgltf_pbr_metallic_roughness pbr_metallic_roughness; cgltf_pbr_specular_glossiness pbr_specular_glossiness; cgltf_clearcoat clearcoat; @@ -525,6 +535,7 @@ typedef struct cgltf_material cgltf_volume volume; cgltf_emissive_strength emissive_strength; cgltf_iridescence iridescence; + cgltf_anisotropy anisotropy; cgltf_texture_view normal_texture; cgltf_texture_view occlusion_texture; cgltf_texture_view emissive_texture; @@ -557,7 +568,6 @@ typedef struct cgltf_draco_mesh_compression { } cgltf_draco_mesh_compression; typedef struct cgltf_mesh_gpu_instancing { - cgltf_buffer_view* buffer_view; cgltf_attribute* attributes; cgltf_size attributes_count; } cgltf_mesh_gpu_instancing; @@ -829,17 +839,39 @@ void cgltf_free(cgltf_data* data); void cgltf_node_transform_local(const cgltf_node* node, cgltf_float* out_matrix); void cgltf_node_transform_world(const cgltf_node* node, cgltf_float* out_matrix); +const uint8_t* cgltf_buffer_view_data(const cgltf_buffer_view* view); + cgltf_bool cgltf_accessor_read_float(const cgltf_accessor* accessor, cgltf_size index, cgltf_float* out, cgltf_size element_size); cgltf_bool cgltf_accessor_read_uint(const cgltf_accessor* accessor, cgltf_size index, cgltf_uint* out, cgltf_size element_size); cgltf_size cgltf_accessor_read_index(const cgltf_accessor* accessor, cgltf_size index); cgltf_size cgltf_num_components(cgltf_type type); +cgltf_size cgltf_component_size(cgltf_component_type component_type); +cgltf_size cgltf_calc_size(cgltf_type type, cgltf_component_type component_type); cgltf_size cgltf_accessor_unpack_floats(const cgltf_accessor* accessor, cgltf_float* out, cgltf_size float_count); +cgltf_size cgltf_accessor_unpack_indices(const cgltf_accessor* accessor, cgltf_uint* out, cgltf_size index_count); /* this function is deprecated and will be removed in the future; use cgltf_extras::data instead */ cgltf_result cgltf_copy_extras_json(const cgltf_data* data, const cgltf_extras* extras, char* dest, cgltf_size* dest_size); +cgltf_size cgltf_mesh_index(const cgltf_data* data, const cgltf_mesh* object); +cgltf_size cgltf_material_index(const cgltf_data* data, const cgltf_material* object); +cgltf_size cgltf_accessor_index(const cgltf_data* data, const cgltf_accessor* object); +cgltf_size cgltf_buffer_view_index(const cgltf_data* data, const cgltf_buffer_view* object); +cgltf_size cgltf_buffer_index(const cgltf_data* data, const cgltf_buffer* object); +cgltf_size cgltf_image_index(const cgltf_data* data, const cgltf_image* object); +cgltf_size cgltf_texture_index(const cgltf_data* data, const cgltf_texture* object); +cgltf_size cgltf_sampler_index(const cgltf_data* data, const cgltf_sampler* object); +cgltf_size cgltf_skin_index(const cgltf_data* data, const cgltf_skin* object); +cgltf_size cgltf_camera_index(const cgltf_data* data, const cgltf_camera* object); +cgltf_size cgltf_light_index(const cgltf_data* data, const cgltf_light* object); +cgltf_size cgltf_node_index(const cgltf_data* data, const cgltf_node* object); +cgltf_size cgltf_scene_index(const cgltf_data* data, const cgltf_scene* object); +cgltf_size cgltf_animation_index(const cgltf_data* data, const cgltf_animation* object); +cgltf_size cgltf_animation_sampler_index(const cgltf_animation* animation, const cgltf_animation_sampler* object); +cgltf_size cgltf_animation_channel_index(const cgltf_animation* animation, const cgltf_animation_channel* object); + #ifdef __cplusplus } #endif @@ -860,7 +892,7 @@ cgltf_result cgltf_copy_extras_json(const cgltf_data* data, const cgltf_extras* #ifdef CGLTF_IMPLEMENTATION -#include /* For uint8_t, uint32_t */ +#include /* For assert */ #include /* For strncpy */ #include /* For fopen */ #include /* For UINT_MAX etc */ @@ -870,10 +902,6 @@ cgltf_result cgltf_copy_extras_json(const cgltf_data* data, const cgltf_extras* #include /* For malloc, free, atoi, atof */ #endif -#if CGLTF_VALIDATE_ENABLE_ASSERTS -#include -#endif - /* JSMN_PARENT_LINKS is necessary to make parsing large structures linear in input size */ #define JSMN_PARENT_LINKS @@ -902,15 +930,15 @@ enum jsmnerr { }; typedef struct { jsmntype_t type; - int start; - int end; + ptrdiff_t start; + ptrdiff_t end; int size; #ifdef JSMN_PARENT_LINKS int parent; #endif } jsmntok_t; typedef struct { - unsigned int pos; /* offset in the JSON string */ + size_t pos; /* offset in the JSON string */ unsigned int toknext; /* next token to allocate */ int toksuper; /* superior token node, e.g parent object or array */ } jsmn_parser; @@ -995,7 +1023,7 @@ static cgltf_result cgltf_default_file_read(const struct cgltf_memory_options* m { fseek(file, 0, SEEK_END); -#ifdef _WIN32 +#ifdef _MSC_VER __int64 length = _ftelli64(file); #else long length = ftell(file); @@ -1486,8 +1514,6 @@ cgltf_result cgltf_load_buffers(const cgltf_options* options, cgltf_data* data, return cgltf_result_success; } -static cgltf_size cgltf_calc_size(cgltf_type type, cgltf_component_type component_type); - static cgltf_size cgltf_calc_index_bound(cgltf_buffer_view* buffer_view, cgltf_size offset, cgltf_component_type component_type, cgltf_size count) { char* data = (char*)buffer_view->buffer->data + offset + buffer_view->offset; @@ -1936,6 +1962,10 @@ void cgltf_free(cgltf_data* data) cgltf_free_texture_view(data, &data->materials[i].iridescence.iridescence_texture); cgltf_free_texture_view(data, &data->materials[i].iridescence.iridescence_thickness_texture); } + if (data->materials[i].has_anisotropy) + { + cgltf_free_texture_view(data, &data->materials[i].anisotropy.anisotropy_texture); + } cgltf_free_texture_view(data, &data->materials[i].normal_texture); cgltf_free_texture_view(data, &data->materials[i].occlusion_texture); @@ -2215,7 +2245,7 @@ static cgltf_size cgltf_component_read_index(const void* in, cgltf_component_typ case cgltf_component_type_r_32u: return *((const uint32_t*) in); case cgltf_component_type_r_32f: - return (cgltf_size)*((const float*) in); + return (cgltf_size)((cgltf_ssize)*((const float*) in)); case cgltf_component_type_r_8u: return *((const uint8_t*) in); default: @@ -2251,8 +2281,6 @@ static cgltf_float cgltf_component_read_float(const void* in, cgltf_component_ty return (cgltf_float)cgltf_component_read_integer(in, component_type); } -static cgltf_size cgltf_component_size(cgltf_component_type component_type); - static cgltf_bool cgltf_element_read_float(const uint8_t* element, cgltf_type type, cgltf_component_type component_type, cgltf_bool normalized, cgltf_float* out, cgltf_size element_size) { cgltf_size num_components = cgltf_num_components(type); @@ -2355,21 +2383,41 @@ cgltf_size cgltf_accessor_unpack_floats(const cgltf_accessor* accessor, cgltf_fl cgltf_size element_count = float_count / floats_per_element; // First pass: convert each element in the base accessor. - cgltf_float* dest = out; - cgltf_accessor dense = *accessor; - dense.is_sparse = 0; - for (cgltf_size index = 0; index < element_count; index++, dest += floats_per_element) + if (accessor->buffer_view == NULL) { - if (!cgltf_accessor_read_float(&dense, index, dest, floats_per_element)) + memset(out, 0, element_count * floats_per_element * sizeof(cgltf_float)); + } + else + { + const uint8_t* element = cgltf_buffer_view_data(accessor->buffer_view); + if (element == NULL) { return 0; } + element += accessor->offset; + + if (accessor->component_type == cgltf_component_type_r_32f && accessor->stride == floats_per_element * sizeof(cgltf_float)) + { + memcpy(out, element, element_count * floats_per_element * sizeof(cgltf_float)); + } + else + { + cgltf_float* dest = out; + + for (cgltf_size index = 0; index < element_count; index++, dest += floats_per_element, element += accessor->stride) + { + if (!cgltf_element_read_float(element, accessor->type, accessor->component_type, accessor->normalized, dest, floats_per_element)) + { + return 0; + } + } + } } // Second pass: write out each element in the sparse accessor. if (accessor->is_sparse) { - const cgltf_accessor_sparse* sparse = &dense.sparse; + const cgltf_accessor_sparse* sparse = &accessor->sparse; const uint8_t* index_data = cgltf_buffer_view_data(sparse->indices_buffer_view); const uint8_t* reader_head = cgltf_buffer_view_data(sparse->values_buffer_view); @@ -2383,17 +2431,15 @@ cgltf_size cgltf_accessor_unpack_floats(const cgltf_accessor* accessor, cgltf_fl reader_head += sparse->values_byte_offset; cgltf_size index_stride = cgltf_component_size(sparse->indices_component_type); - for (cgltf_size reader_index = 0; reader_index < sparse->count; reader_index++, index_data += index_stride) + for (cgltf_size reader_index = 0; reader_index < sparse->count; reader_index++, index_data += index_stride, reader_head += accessor->stride) { size_t writer_index = cgltf_component_read_index(index_data, sparse->indices_component_type); float* writer_head = out + writer_index * floats_per_element; - if (!cgltf_element_read_float(reader_head, dense.type, dense.component_type, dense.normalized, writer_head, floats_per_element)) + if (!cgltf_element_read_float(reader_head, accessor->type, accessor->component_type, accessor->normalized, writer_head, floats_per_element)) { return 0; } - - reader_head += dense.stride; } } @@ -2487,6 +2533,143 @@ cgltf_size cgltf_accessor_read_index(const cgltf_accessor* accessor, cgltf_size return cgltf_component_read_index(element, accessor->component_type); } +cgltf_size cgltf_mesh_index(const cgltf_data* data, const cgltf_mesh* object) +{ + assert(object && (cgltf_size)(object - data->meshes) < data->meshes_count); + return (cgltf_size)(object - data->meshes); +} + +cgltf_size cgltf_material_index(const cgltf_data* data, const cgltf_material* object) +{ + assert(object && (cgltf_size)(object - data->materials) < data->materials_count); + return (cgltf_size)(object - data->materials); +} + +cgltf_size cgltf_accessor_index(const cgltf_data* data, const cgltf_accessor* object) +{ + assert(object && (cgltf_size)(object - data->accessors) < data->accessors_count); + return (cgltf_size)(object - data->accessors); +} + +cgltf_size cgltf_buffer_view_index(const cgltf_data* data, const cgltf_buffer_view* object) +{ + assert(object && (cgltf_size)(object - data->buffer_views) < data->buffer_views_count); + return (cgltf_size)(object - data->buffer_views); +} + +cgltf_size cgltf_buffer_index(const cgltf_data* data, const cgltf_buffer* object) +{ + assert(object && (cgltf_size)(object - data->buffers) < data->buffers_count); + return (cgltf_size)(object - data->buffers); +} + +cgltf_size cgltf_image_index(const cgltf_data* data, const cgltf_image* object) +{ + assert(object && (cgltf_size)(object - data->images) < data->images_count); + return (cgltf_size)(object - data->images); +} + +cgltf_size cgltf_texture_index(const cgltf_data* data, const cgltf_texture* object) +{ + assert(object && (cgltf_size)(object - data->textures) < data->textures_count); + return (cgltf_size)(object - data->textures); +} + +cgltf_size cgltf_sampler_index(const cgltf_data* data, const cgltf_sampler* object) +{ + assert(object && (cgltf_size)(object - data->samplers) < data->samplers_count); + return (cgltf_size)(object - data->samplers); +} + +cgltf_size cgltf_skin_index(const cgltf_data* data, const cgltf_skin* object) +{ + assert(object && (cgltf_size)(object - data->skins) < data->skins_count); + return (cgltf_size)(object - data->skins); +} + +cgltf_size cgltf_camera_index(const cgltf_data* data, const cgltf_camera* object) +{ + assert(object && (cgltf_size)(object - data->cameras) < data->cameras_count); + return (cgltf_size)(object - data->cameras); +} + +cgltf_size cgltf_light_index(const cgltf_data* data, const cgltf_light* object) +{ + assert(object && (cgltf_size)(object - data->lights) < data->lights_count); + return (cgltf_size)(object - data->lights); +} + +cgltf_size cgltf_node_index(const cgltf_data* data, const cgltf_node* object) +{ + assert(object && (cgltf_size)(object - data->nodes) < data->nodes_count); + return (cgltf_size)(object - data->nodes); +} + +cgltf_size cgltf_scene_index(const cgltf_data* data, const cgltf_scene* object) +{ + assert(object && (cgltf_size)(object - data->scenes) < data->scenes_count); + return (cgltf_size)(object - data->scenes); +} + +cgltf_size cgltf_animation_index(const cgltf_data* data, const cgltf_animation* object) +{ + assert(object && (cgltf_size)(object - data->animations) < data->animations_count); + return (cgltf_size)(object - data->animations); +} + +cgltf_size cgltf_animation_sampler_index(const cgltf_animation* animation, const cgltf_animation_sampler* object) +{ + assert(object && (cgltf_size)(object - animation->samplers) < animation->samplers_count); + return (cgltf_size)(object - animation->samplers); +} + +cgltf_size cgltf_animation_channel_index(const cgltf_animation* animation, const cgltf_animation_channel* object) +{ + assert(object && (cgltf_size)(object - animation->channels) < animation->channels_count); + return (cgltf_size)(object - animation->channels); +} + +cgltf_size cgltf_accessor_unpack_indices(const cgltf_accessor* accessor, cgltf_uint* out, cgltf_size index_count) +{ + if (out == NULL) + { + return accessor->count; + } + + index_count = accessor->count < index_count ? accessor->count : index_count; + + if (accessor->is_sparse) + { + return 0; + } + if (accessor->buffer_view == NULL) + { + return 0; + } + const uint8_t* element = cgltf_buffer_view_data(accessor->buffer_view); + if (element == NULL) + { + return 0; + } + element += accessor->offset; + + if (accessor->component_type == cgltf_component_type_r_32u && accessor->stride == sizeof(cgltf_uint)) + { + memcpy(out, element, index_count * sizeof(cgltf_uint)); + } + else + { + cgltf_uint* dest = out; + + for (cgltf_size index = 0; index < index_count; index++, dest++, element += accessor->stride) + { + *dest = (cgltf_uint)cgltf_component_read_index(element, accessor->component_type); + } + } + + return index_count; +} + #define CGLTF_ERROR_JSON -1 #define CGLTF_ERROR_NOMEM -2 #define CGLTF_ERROR_LEGACY -3 @@ -2503,7 +2686,7 @@ static int cgltf_json_strcmp(jsmntok_t const* tok, const uint8_t* json_chunk, co { CGLTF_CHECK_TOKTYPE(*tok, JSMN_STRING); size_t const str_len = strlen(str); - size_t const name_length = tok->end - tok->start; + size_t const name_length = (size_t)(tok->end - tok->start); return (str_len == name_length) ? strncmp((const char*)json_chunk + tok->start, str, str_len) : 128; } @@ -2511,7 +2694,7 @@ static int cgltf_json_to_int(jsmntok_t const* tok, const uint8_t* json_chunk) { CGLTF_CHECK_TOKTYPE(*tok, JSMN_PRIMITIVE); char tmp[128]; - int size = (cgltf_size)(tok->end - tok->start) < sizeof(tmp) ? tok->end - tok->start : (int)(sizeof(tmp) - 1); + int size = (size_t)(tok->end - tok->start) < sizeof(tmp) ? (int)(tok->end - tok->start) : (int)(sizeof(tmp) - 1); strncpy(tmp, (const char*)json_chunk + tok->start, size); tmp[size] = 0; return CGLTF_ATOI(tmp); @@ -2521,7 +2704,7 @@ static cgltf_size cgltf_json_to_size(jsmntok_t const* tok, const uint8_t* json_c { CGLTF_CHECK_TOKTYPE_RETTYPE(*tok, JSMN_PRIMITIVE, cgltf_size); char tmp[128]; - int size = (cgltf_size)(tok->end - tok->start) < sizeof(tmp) ? tok->end - tok->start : (int)(sizeof(tmp) - 1); + int size = (size_t)(tok->end - tok->start) < sizeof(tmp) ? (int)(tok->end - tok->start) : (int)(sizeof(tmp) - 1); strncpy(tmp, (const char*)json_chunk + tok->start, size); tmp[size] = 0; return (cgltf_size)CGLTF_ATOLL(tmp); @@ -2531,7 +2714,7 @@ static cgltf_float cgltf_json_to_float(jsmntok_t const* tok, const uint8_t* json { CGLTF_CHECK_TOKTYPE(*tok, JSMN_PRIMITIVE); char tmp[128]; - int size = (cgltf_size)(tok->end - tok->start) < sizeof(tmp) ? tok->end - tok->start : (int)(sizeof(tmp) - 1); + int size = (size_t)(tok->end - tok->start) < sizeof(tmp) ? (int)(tok->end - tok->start) : (int)(sizeof(tmp) - 1); strncpy(tmp, (const char*)json_chunk + tok->start, size); tmp[size] = 0; return (cgltf_float)CGLTF_ATOF(tmp); @@ -2539,7 +2722,7 @@ static cgltf_float cgltf_json_to_float(jsmntok_t const* tok, const uint8_t* json static cgltf_bool cgltf_json_to_bool(jsmntok_t const* tok, const uint8_t* json_chunk) { - int size = tok->end - tok->start; + int size = (int)(tok->end - tok->start); return size == 4 && memcmp(json_chunk + tok->start, "true", 4) == 0; } @@ -2605,7 +2788,7 @@ static int cgltf_parse_json_string(cgltf_options* options, jsmntok_t const* toke { return CGLTF_ERROR_JSON; } - int size = tokens[i].end - tokens[i].start; + int size = (int)(tokens[i].end - tokens[i].start); char* result = (char*)options->memory.alloc_func(options->memory.user_data, size + 1); if (!result) { @@ -2863,6 +3046,10 @@ static int cgltf_parse_json_draco_mesh_compression(cgltf_options* options, jsmnt out_draco_mesh_compression->buffer_view = CGLTF_PTRINDEX(cgltf_buffer_view, cgltf_json_to_int(tokens + i, json_chunk)); ++i; } + else + { + i = cgltf_skip_json(tokens, i+1); + } if (i < 0) { @@ -2888,11 +3075,9 @@ static int cgltf_parse_json_mesh_gpu_instancing(cgltf_options* options, jsmntok_ { i = cgltf_parse_json_attribute_list(options, tokens, i + 1, json_chunk, &out_mesh_gpu_instancing->attributes, &out_mesh_gpu_instancing->attributes_count); } - else if (cgltf_json_strcmp(tokens + i, json_chunk, "bufferView") == 0) + else { - ++i; - out_mesh_gpu_instancing->buffer_view = CGLTF_PTRINDEX(cgltf_buffer_view, cgltf_json_to_int(tokens + i, json_chunk)); - ++i; + i = cgltf_skip_json(tokens, i+1); } if (i < 0) @@ -4127,6 +4312,47 @@ static int cgltf_parse_json_iridescence(cgltf_options* options, jsmntok_t const* return i; } +static int cgltf_parse_json_anisotropy(cgltf_options* options, jsmntok_t const* tokens, int i, const uint8_t* json_chunk, cgltf_anisotropy* out_anisotropy) +{ + CGLTF_CHECK_TOKTYPE(tokens[i], JSMN_OBJECT); + int size = tokens[i].size; + ++i; + + + for (int j = 0; j < size; ++j) + { + CGLTF_CHECK_KEY(tokens[i]); + + if (cgltf_json_strcmp(tokens + i, json_chunk, "anisotropyStrength") == 0) + { + ++i; + out_anisotropy->anisotropy_strength = cgltf_json_to_float(tokens + i, json_chunk); + ++i; + } + else if (cgltf_json_strcmp(tokens + i, json_chunk, "anisotropyRotation") == 0) + { + ++i; + out_anisotropy->anisotropy_rotation = cgltf_json_to_float(tokens + i, json_chunk); + ++i; + } + else if (cgltf_json_strcmp(tokens + i, json_chunk, "anisotropyTexture") == 0) + { + i = cgltf_parse_json_texture_view(options, tokens, i + 1, json_chunk, &out_anisotropy->anisotropy_texture); + } + else + { + i = cgltf_skip_json(tokens, i + 1); + } + + if (i < 0) + { + return i; + } + } + + return i; +} + static int cgltf_parse_json_image(cgltf_options* options, jsmntok_t const* tokens, int i, const uint8_t* json_chunk, cgltf_image* out_image) { CGLTF_CHECK_TOKTYPE(tokens[i], JSMN_OBJECT); @@ -4515,6 +4741,11 @@ static int cgltf_parse_json_material(cgltf_options* options, jsmntok_t const* to out_material->has_iridescence = 1; i = cgltf_parse_json_iridescence(options, tokens, i + 1, json_chunk, &out_material->iridescence); } + else if (cgltf_json_strcmp(tokens + i, json_chunk, "KHR_materials_anisotropy") == 0) + { + out_material->has_anisotropy = 1; + i = cgltf_parse_json_anisotropy(options, tokens, i + 1, json_chunk, &out_material->anisotropy); + } else { i = cgltf_parse_json_unprocessed_extension(options, tokens, i, json_chunk, &(out_material->extensions[out_material->extensions_count++])); @@ -5963,7 +6194,7 @@ cgltf_size cgltf_num_components(cgltf_type type) { } } -static cgltf_size cgltf_component_size(cgltf_component_type component_type) { +cgltf_size cgltf_component_size(cgltf_component_type component_type) { switch (component_type) { case cgltf_component_type_r_8: @@ -5981,7 +6212,7 @@ static cgltf_size cgltf_component_size(cgltf_component_type component_type) { } } -static cgltf_size cgltf_calc_size(cgltf_type type, cgltf_component_type component_type) +cgltf_size cgltf_calc_size(cgltf_type type, cgltf_component_type component_type) { cgltf_size component_size = cgltf_component_size(component_type); if (type == cgltf_type_mat2 && component_size == 1) @@ -6366,6 +6597,8 @@ static int cgltf_fixup_pointers(cgltf_data* data) CGLTF_PTRFIXUP(data->materials[i].iridescence.iridescence_texture.texture, data->textures, data->textures_count); CGLTF_PTRFIXUP(data->materials[i].iridescence.iridescence_thickness_texture.texture, data->textures, data->textures_count); + + CGLTF_PTRFIXUP(data->materials[i].anisotropy.anisotropy_texture.texture, data->textures, data->textures_count); } for (cgltf_size i = 0; i < data->buffer_views_count; ++i) @@ -6410,7 +6643,6 @@ static int cgltf_fixup_pointers(cgltf_data* data) if (data->nodes[i].has_mesh_gpu_instancing) { - CGLTF_PTRFIXUP_REQ(data->nodes[i].mesh_gpu_instancing.buffer_view, data->buffer_views, data->buffer_views_count); for (cgltf_size m = 0; m < data->nodes[i].mesh_gpu_instancing.attributes_count; ++m) { CGLTF_PTRFIXUP_REQ(data->nodes[i].mesh_gpu_instancing.attributes[m].data, data->accessors, data->accessors_count); @@ -6499,7 +6731,7 @@ static jsmntok_t *jsmn_alloc_token(jsmn_parser *parser, * Fills token type and boundaries. */ static void jsmn_fill_token(jsmntok_t *token, jsmntype_t type, - int start, int end) { + ptrdiff_t start, ptrdiff_t end) { token->type = type; token->start = start; token->end = end; @@ -6512,7 +6744,7 @@ static void jsmn_fill_token(jsmntok_t *token, jsmntype_t type, static int jsmn_parse_primitive(jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, size_t num_tokens) { jsmntok_t *token; - int start; + ptrdiff_t start; start = parser->pos; @@ -6562,7 +6794,7 @@ static int jsmn_parse_string(jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, size_t num_tokens) { jsmntok_t *token; - int start = parser->pos; + ptrdiff_t start = parser->pos; parser->pos++; diff --git a/bgfx/3rdparty/cgltf/cgltf_write.h b/bgfx/3rdparty/cgltf/cgltf_write.h index 033b0d1c..be22b888 100644 --- a/bgfx/3rdparty/cgltf/cgltf_write.h +++ b/bgfx/3rdparty/cgltf/cgltf_write.h @@ -85,6 +85,7 @@ cgltf_size cgltf_write(const cgltf_options* options, char* buffer, cgltf_size si #define CGLTF_EXTENSION_FLAG_MATERIALS_EMISSIVE_STRENGTH (1 << 13) #define CGLTF_EXTENSION_FLAG_MESH_GPU_INSTANCING (1 << 14) #define CGLTF_EXTENSION_FLAG_MATERIALS_IRIDESCENCE (1 << 15) +#define CGLTF_EXTENSION_FLAG_MATERIALS_ANISOTROPY (1 << 16) typedef struct { char* buffer; @@ -641,6 +642,11 @@ static void cgltf_write_material(cgltf_write_context* context, const cgltf_mater context->extension_flags |= CGLTF_EXTENSION_FLAG_MATERIALS_IRIDESCENCE; } + if (material->has_anisotropy) + { + context->extension_flags |= CGLTF_EXTENSION_FLAG_MATERIALS_ANISOTROPY; + } + if (material->has_pbr_metallic_roughness) { const cgltf_pbr_metallic_roughness* params = &material->pbr_metallic_roughness; @@ -656,7 +662,7 @@ static void cgltf_write_material(cgltf_write_context* context, const cgltf_mater cgltf_write_line(context, "}"); } - if (material->unlit || material->has_pbr_specular_glossiness || material->has_clearcoat || material->has_ior || material->has_specular || material->has_transmission || material->has_sheen || material->has_volume || material->has_emissive_strength || material->has_iridescence) + if (material->unlit || material->has_pbr_specular_glossiness || material->has_clearcoat || material->has_ior || material->has_specular || material->has_transmission || material->has_sheen || material->has_volume || material->has_emissive_strength || material->has_iridescence || material->has_anisotropy) { cgltf_write_line(context, "\"extensions\": {"); if (material->has_clearcoat) @@ -767,6 +773,15 @@ static void cgltf_write_material(cgltf_write_context* context, const cgltf_mater CGLTF_WRITE_TEXTURE_INFO("iridescenceThicknessTexture", params->iridescence_thickness_texture); cgltf_write_line(context, "}"); } + if (material->has_anisotropy) + { + cgltf_write_line(context, "\"KHR_materials_anisotropy\": {"); + const cgltf_anisotropy* params = &material->anisotropy; + cgltf_write_floatprop(context, "anisotropyFactor", params->anisotropy_strength, 0.f); + cgltf_write_floatprop(context, "anisotropyRotation", params->anisotropy_rotation, 0.f); + CGLTF_WRITE_TEXTURE_INFO("anisotropyTexture", params->anisotropy_texture); + cgltf_write_line(context, "}"); + } cgltf_write_line(context, "}"); } @@ -977,7 +992,6 @@ static void cgltf_write_node(cgltf_write_context* context, const cgltf_node* nod cgltf_write_line(context, "\"EXT_mesh_gpu_instancing\": {"); { - CGLTF_WRITE_IDXPROP("bufferView", node->mesh_gpu_instancing.buffer_view, context->data->buffer_views); cgltf_write_line(context, "\"attributes\": {"); { for (cgltf_size i = 0; i < node->mesh_gpu_instancing.attributes_count; ++i) @@ -1123,6 +1137,7 @@ static void cgltf_write_light(cgltf_write_context* context, const cgltf_light* l cgltf_write_floatprop(context, "outerConeAngle", light->spot_outer_cone_angle, 3.14159265358979323846f/4.0f); cgltf_write_line(context, "}"); } + cgltf_write_extras( context, &light->extras ); cgltf_write_line(context, "}"); } @@ -1249,6 +1264,9 @@ static void cgltf_write_extensions(cgltf_write_context* context, uint32_t extens if (extension_flags & CGLTF_EXTENSION_FLAG_MATERIALS_IRIDESCENCE) { cgltf_write_stritem(context, "KHR_materials_iridescence"); } + if (extension_flags & CGLTF_EXTENSION_FLAG_MATERIALS_ANISOTROPY) { + cgltf_write_stritem(context, "KHR_materials_anisotropy"); + } if (extension_flags & CGLTF_EXTENSION_FLAG_MESH_GPU_INSTANCING) { cgltf_write_stritem(context, "EXT_mesh_gpu_instancing"); } diff --git a/bgfx/3rdparty/dear-imgui/imgui.cpp b/bgfx/3rdparty/dear-imgui/imgui.cpp index fae18545..b1cf3790 100644 --- a/bgfx/3rdparty/dear-imgui/imgui.cpp +++ b/bgfx/3rdparty/dear-imgui/imgui.cpp @@ -1,30 +1,34 @@ -// dear imgui, v1.89 WIP +// dear imgui, v1.89.9 // (main code and documentation) // Help: -// - Read FAQ at http://dearimgui.org/faq +// - Read FAQ at http://dearimgui.com/faq // - Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase. // - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications in examples/ are doing that. // Read imgui.cpp for details, links and comments. // Resources: -// - FAQ http://dearimgui.org/faq -// - Homepage & latest https://github.com/ocornut/imgui +// - FAQ http://dearimgui.com/faq +// - Homepage https://github.com/ocornut/imgui // - Releases & changelog https://github.com/ocornut/imgui/releases -// - Gallery https://github.com/ocornut/imgui/issues/5243 (please post your screenshots/video there!) +// - Gallery https://github.com/ocornut/imgui/issues/6478 (please post your screenshots/video there!) // - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there) +// - Getting Started https://github.com/ocornut/imgui/wiki/Getting-Started // - Glossary https://github.com/ocornut/imgui/wiki/Glossary // - Issues & support https://github.com/ocornut/imgui/issues +// - Tests & Automation https://github.com/ocornut/imgui_test_engine // Getting Started? -// - For first-time users having issues compiling/linking/running or issues loading fonts: +// - Read https://github.com/ocornut/imgui/wiki/Getting-Started +// - For first-time users having issues compiling/linking/running/loading fonts: // please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above. // Developed by Omar Cornut and every direct or indirect contributors to the GitHub. // See LICENSE.txt for copyright and licensing details (standard MIT License). // This library is free but needs your support to sustain development and maintenance. -// Businesses: you can support continued development via invoiced technical support, maintenance and sponsoring contracts. Please reach out to "contact AT dearimgui.com". -// Individuals: you can support continued development via donations. See docs/README or web page. +// Businesses: you can support continued development via B2B invoiced technical support, maintenance and sponsoring contracts. +// PLEASE reach out at contact AT dearimgui DOT com. See https://github.com/ocornut/imgui/wiki/Sponsors +// Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine. // It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library. // Note that 'ImGui::' being a namespace, you can add functions into the namespace from your own source files, without @@ -39,17 +43,16 @@ Index of this file: DOCUMENTATION - MISSION STATEMENT -- END-USER GUIDE +- CONTROLS GUIDE - PROGRAMMER GUIDE - READ FIRST - HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI - GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE - HOW A SIMPLE APPLICATION MAY LOOK LIKE - HOW A SIMPLE RENDERING FUNCTION MAY LOOK LIKE - - USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS - API BREAKING CHANGES (read me when you update!) - FREQUENTLY ASKED QUESTIONS (FAQ) - - Read all answers online: https://www.dearimgui.org/faq, or in docs/FAQ.md (with a Markdown viewer) + - Read all answers online: https://www.dearimgui.com/faq, or in docs/FAQ.md (with a Markdown viewer) CODE (search for "[SECTION]" in the code to find them) @@ -65,10 +68,11 @@ CODE // [SECTION] MISC HELPERS/UTILITIES (Color functions) // [SECTION] ImGuiStorage // [SECTION] ImGuiTextFilter -// [SECTION] ImGuiTextBuffer +// [SECTION] ImGuiTextBuffer, ImGuiTextIndex // [SECTION] ImGuiListClipper // [SECTION] STYLING // [SECTION] RENDER HELPERS +// [SECTION] INITIALIZATION, SHUTDOWN // [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!) // [SECTION] INPUTS // [SECTION] ERROR CHECKING @@ -80,7 +84,8 @@ CODE // [SECTION] DRAG AND DROP // [SECTION] LOGGING/CAPTURING // [SECTION] SETTINGS -// [SECTION] VIEWPORTS +// [SECTION] LOCALIZATION +// [SECTION] VIEWPORTS, PLATFORM WINDOWS // [SECTION] PLATFORM DEPENDENT HELPERS // [SECTION] METRICS/DEBUGGER WINDOW // [SECTION] DEBUG LOG WINDOW @@ -106,33 +111,80 @@ CODE - Portable, minimize dependencies, run on target (consoles, phones, etc.). - Efficient runtime and memory consumption. - Designed for developers and content-creators, not the typical end-user! Some of the current weaknesses includes: + Designed primarily for developers and content-creators, not the typical end-user! + Some of the current weaknesses (which we aim to address in the future) includes: - - Doesn't look fancy, doesn't animate. + - Doesn't look fancy. - Limited layout features, intricate layouts are typically crafted in code. - END-USER GUIDE + CONTROLS GUIDE ============== - - Double-click on title bar to collapse window. - - Click upper right corner to close a window, available when 'bool* p_open' is passed to ImGui::Begin(). - - Click and drag on lower right corner to resize window (double-click to auto fit window to its contents). - - Click and drag on any empty space to move window. - - TAB/SHIFT+TAB to cycle through keyboard editable fields. - - CTRL+Click on a slider or drag box to input value as text. - - Use mouse wheel to scroll. - - Text editor: - - Hold SHIFT or use mouse to select text. - - CTRL+Left/Right to word jump. - - CTRL+Shift+Left/Right to select words. - - CTRL+A or Double-Click to select all. - - CTRL+X,CTRL+C,CTRL+V to use OS clipboard/ - - CTRL+Z,CTRL+Y to undo/redo. - - ESCAPE to revert text to its original value. - - Controls are automatically adjusted for OSX to match standard OSX text editing operations. - - General Keyboard controls: enable with ImGuiConfigFlags_NavEnableKeyboard. - - General Gamepad controls: enable with ImGuiConfigFlags_NavEnableGamepad. Download controller mapping PNG/PSD at http://dearimgui.org/controls_sheets + - MOUSE CONTROLS + - Mouse wheel: Scroll vertically. + - SHIFT+Mouse wheel: Scroll horizontally. + - Click [X]: Close a window, available when 'bool* p_open' is passed to ImGui::Begin(). + - Click ^, Double-Click title: Collapse window. + - Drag on corner/border: Resize window (double-click to auto fit window to its contents). + - Drag on any empty space: Move window (unless io.ConfigWindowsMoveFromTitleBarOnly = true). + - Left-click outside popup: Close popup stack (right-click over underlying popup: Partially close popup stack). + + - TEXT EDITOR + - Hold SHIFT or Drag Mouse: Select text. + - CTRL+Left/Right: Word jump. + - CTRL+Shift+Left/Right: Select words. + - CTRL+A or Double-Click: Select All. + - CTRL+X, CTRL+C, CTRL+V: Use OS clipboard. + - CTRL+Z, CTRL+Y: Undo, Redo. + - ESCAPE: Revert text to its original value. + - On OSX, controls are automatically adjusted to match standard OSX text editing shortcuts and behaviors. + + - KEYBOARD CONTROLS + - Basic: + - Tab, SHIFT+Tab Cycle through text editable fields. + - CTRL+Tab, CTRL+Shift+Tab Cycle through windows. + - CTRL+Click Input text into a Slider or Drag widget. + - Extended features with `io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard`: + - Tab, SHIFT+Tab: Cycle through every items. + - Arrow keys Move through items using directional navigation. Tweak value. + - Arrow keys + Alt, Shift Tweak slower, tweak faster (when using arrow keys). + - Enter Activate item (prefer text input when possible). + - Space Activate item (prefer tweaking with arrows when possible). + - Escape Deactivate item, leave child window, close popup. + - Page Up, Page Down Previous page, next page. + - Home, End Scroll to top, scroll to bottom. + - Alt Toggle between scrolling layer and menu layer. + - CTRL+Tab then Ctrl+Arrows Move window. Hold SHIFT to resize instead of moving. + - Output when ImGuiConfigFlags_NavEnableKeyboard set, + - io.WantCaptureKeyboard flag is set when keyboard is claimed. + - io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set. + - io.NavVisible: true when the navigation cursor is visible (usually goes to back false when mouse is used). + + - GAMEPAD CONTROLS + - Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. + - Particularly useful to use Dear ImGui on a console system (e.g. PlayStation, Switch, Xbox) without a mouse! + - Download controller mapping PNG/PSD at http://dearimgui.com/controls_sheets + - Backend support: backend needs to: + - Set 'io.BackendFlags |= ImGuiBackendFlags_HasGamepad' + call io.AddKeyEvent/AddKeyAnalogEvent() with ImGuiKey_Gamepad_XXX keys. + - For analog values (0.0f to 1.0f), backend is responsible to handling a dead-zone and rescaling inputs accordingly. + Backend code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.). + - BEFORE 1.87, BACKENDS USED TO WRITE TO io.NavInputs[]. This is now obsolete. Please call io functions instead! + - If you need to share inputs between your game and the Dear ImGui interface, the easiest approach is to go all-or-nothing, + with a buttons combo to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved. + + - REMOTE INPUTS SHARING & MOUSE EMULATION + - PS4/PS5 users: Consider emulating a mouse cursor with DualShock touch pad or a spare analog stick as a mouse-emulation fallback. + - Consoles/Tablet/Phone users: Consider using a Synergy 1.x server (on your PC) + run examples/libs/synergy/uSynergy.c (on your console/tablet/phone app) + in order to share your PC mouse/keyboard. + - See https://github.com/ocornut/imgui/wiki/Useful-Extensions#remoting for other remoting solutions. + - On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the ImGuiConfigFlags_NavEnableSetMousePos flag. + Enabling ImGuiConfigFlags_NavEnableSetMousePos + ImGuiBackendFlags_HasSetMousePos instructs Dear ImGui to move your mouse cursor along with navigation movements. + When enabled, the NewFrame() function may alter 'io.MousePos' and set 'io.WantSetMousePos' to notify you that it wants the mouse cursor to be moved. + When that happens your backend NEEDS to move the OS or underlying mouse cursor on the next frame. Some of the backends in examples/ do that. + (If you set the NavEnableSetMousePos flag but don't honor 'io.WantSetMousePos' properly, Dear ImGui will misbehave as it will see your mouse moving back & forth!) + (In a setup when you may not have easy control over the mouse cursor, e.g. uSynergy.c doesn't expose moving remote mouse cursor, you may want + to set a boolean to ignore your other external mouse positions until the external source is moved again.) PROGRAMMER GUIDE @@ -141,9 +193,11 @@ CODE READ FIRST ---------- - Remember to check the wonderful Wiki (https://github.com/ocornut/imgui/wiki) - - Your code creates the UI, if your code doesn't run the UI is gone! The UI can be highly dynamic, there are no construction or - destruction steps, less superfluous data retention on your side, less state duplication, less state synchronization, fewer bugs. + - Your code creates the UI every frame of your application loop, if your code doesn't run the UI is gone! + The UI can be highly dynamic, there are no construction or destruction steps, less superfluous + data retention on your side, less state duplication, less state synchronization, fewer bugs. - Call and read ImGui::ShowDemoWindow() for demo code demonstrating most features. + Or browse https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html for interactive web version. - The library is designed to be built from sources. Avoid pre-compiled binaries and packaged versions. See imconfig.h to configure your build. - Dear ImGui is an implementation of the IMGUI paradigm (immediate-mode graphical user interface, a term coined by Casey Muratori). You can learn about IMGUI principles at http://www.johno.se/book/imgui.html, http://mollyrocket.com/861 & more links in Wiki. @@ -151,18 +205,38 @@ CODE For every application frame, your UI code will be called only once. This is in contrast to e.g. Unity's implementation of an IMGUI, where the UI code is called multiple times ("multiple passes") from a single entry point. There are pros and cons to both approaches. - Our origin is on the top-left. In axis aligned bounding boxes, Min = top-left, Max = bottom-right. - - This codebase is also optimized to yield decent performances with typical "Debug" builds settings. - Please make sure you have asserts enabled (IM_ASSERT redirects to assert() by default, but can be redirected). If you get an assert, read the messages and comments around the assert. - - C++: this is a very C-ish codebase: we don't rely on C++11, we don't include any C++ headers, and ImGui:: is a namespace. - - C++: ImVec2/ImVec4 do not expose math operators by default, because it is expected that you use your own math types. - See FAQ "How can I use my own math types instead of ImVec2/ImVec4?" for details about setting up imconfig.h for that. - However, imgui_internal.h can optionally export math operators for ImVec2/ImVec4, which we use in this codebase. - - C++: pay attention that ImVector<> manipulates plain-old-data and does not honor construction/destruction (avoid using it in your code!). + - This codebase aims to be highly optimized: + - A typical idle frame should never call malloc/free. + - We rely on a maximum of constant-time or O(N) algorithms. Limiting searches/scans as much as possible. + - We put particular energy in making sure performances are decent with typical "Debug" build settings as well. + Which mean we tend to avoid over-relying on "zero-cost abstraction" as they aren't zero-cost at all. + - This codebase aims to be both highly opinionated and highly flexible: + - This code works because of the things it choose to solve or not solve. + - C++: this is a pragmatic C-ish codebase: we don't use fancy C++ features, we don't include C++ headers, + and ImGui:: is a namespace. We rarely use member functions (and when we did, I am mostly regretting it now). + This is to increase compatibility, increase maintainability and facilitate use from other languages. + - C++: ImVec2/ImVec4 do not expose math operators by default, because it is expected that you use your own math types. + See FAQ "How can I use my own math types instead of ImVec2/ImVec4?" for details about setting up imconfig.h for that. + We can can optionally export math operators for ImVec2/ImVec4 using IMGUI_DEFINE_MATH_OPERATORS, which we use internally. + - C++: pay attention that ImVector<> manipulates plain-old-data and does not honor construction/destruction + (so don't use ImVector in your code or at our own risk!). + - Building: We don't use nor mandate a build system for the main library. + This is in an effort to ensure that it works in the real world aka with any esoteric build setup. + This is also because providing a build system for the main library would be of little-value. + The build problems are almost never coming from the main library but from specific backends. HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI ---------------------------------------------- + - Update submodule or copy/overwrite every file. + - About imconfig.h: + - You may modify your copy of imconfig.h, in this case don't overwrite it. + - or you may locally branch to modify imconfig.h and merge/rebase latest. + - or you may '#define IMGUI_USER_CONFIG "my_config_file.h"' globally from your build system to + specify a custom path for your imconfig.h file and instead not have to modify the default one. + - Overwrite all the sources files except for imconfig.h (if you have modified your copy of imconfig.h) - Or maintain your own branch where you have imconfig.h modified as a top-most commit which you can regularly rebase over "master". - You can also use '#define IMGUI_USER_CONFIG "my_config_file.h" to redirect configuration to your own file. @@ -171,11 +245,12 @@ CODE from the public API. If you have a problem with a missing function/symbols, search for its name in the code, there will likely be a comment about it. Please report any issue to the GitHub page! - To find out usage of old API, you can add '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in your configuration file. - - Try to keep your copy of Dear ImGui reasonably up to date. + - Try to keep your copy of Dear ImGui reasonably up to date! GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE --------------------------------------------------------------- + - See https://github.com/ocornut/imgui/wiki/Getting-Started. - Run and study the examples and demo in imgui_demo.cpp to get acquainted with the library. - In the majority of cases you should be able to use unmodified backends files available in the backends/ folder. - Add the Dear ImGui source files + selected backend source files to your projects or using your preferred build system. @@ -239,7 +314,7 @@ CODE // Build and load the texture atlas into a texture // (In the examples/ app this is usually done within the ImGui_ImplXXX_Init() function from one of the demo Renderer) int width, height; - unsigned char* pixels = NULL; + unsigned char* pixels = nullptr; io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // At this point you've got the texture data and you need to upload that to your graphic system: @@ -342,40 +417,6 @@ CODE } - USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS - ------------------------------------------ - - The gamepad/keyboard navigation is fairly functional and keeps being improved. - - Gamepad support is particularly useful to use Dear ImGui on a console system (e.g. PlayStation, Switch, Xbox) without a mouse! - - The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable. - - Keyboard: - - Application: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. - - When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), - the io.WantCaptureKeyboard flag will be set. For more advanced uses, you may want to read from: - - io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set. - - io.NavVisible: true when the navigation cursor is visible (and usually goes false when mouse is used). - - or query focus information with e.g. IsWindowFocused(ImGuiFocusedFlags_AnyWindow), IsItemFocused() etc. functions. - Please reach out if you think the game vs navigation input sharing could be improved. - - Gamepad: - - Application: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. - - Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + call io.AddKeyEvent/AddKeyAnalogEvent() with ImGuiKey_Gamepad_XXX keys. - For analog values (0.0f to 1.0f), backend is responsible to handling a dead-zone and rescaling inputs accordingly. - Backend code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.). - - BEFORE 1.87, BACKENDS USED TO WRITE TO io.NavInputs[]. This is now obsolete. Please call io functions instead! - - You can download PNG/PSD files depicting the gamepad controls for common controllers at: http://dearimgui.org/controls_sheets - - If you need to share inputs between your game and the Dear ImGui interface, the easiest approach is to go all-or-nothing, - with a buttons combo to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved. - - Mouse: - - PS4/PS5 users: Consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback. - - Consoles/Tablet/Phone users: Consider using a Synergy 1.x server (on your PC) + uSynergy.c (on your console/tablet/phone app) to share your PC mouse/keyboard. - - On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the ImGuiConfigFlags_NavEnableSetMousePos flag. - Enabling ImGuiConfigFlags_NavEnableSetMousePos + ImGuiBackendFlags_HasSetMousePos instructs dear imgui to move your mouse cursor along with navigation movements. - When enabled, the NewFrame() function may alter 'io.MousePos' and set 'io.WantSetMousePos' to notify you that it wants the mouse cursor to be moved. - When that happens your backend NEEDS to move the OS or underlying mouse cursor on the next frame. Some of the backends in examples/ do that. - (If you set the NavEnableSetMousePos flag but don't honor 'io.WantSetMousePos' properly, imgui will misbehave as it will see your mouse moving back and forth!) - (In a setup when you may not have easy control over the mouse cursor, e.g. uSynergy.c doesn't expose moving remote mouse cursor, you may want - to set a boolean to ignore your other external mouse positions until the external source is moved again.) - - API BREAKING CHANGES ==================== @@ -384,15 +425,49 @@ CODE When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. You can read releases logs https://github.com/ocornut/imgui/releases for more details. - - 2022/09/26 (1.89) - renamed and merged keyboard modifiers key enums and flags into a same set. Kept inline redirection enums (will obsolete). - - ImGuiKey_ModCtrl and ImGuiModFlags_Ctrl -> ImGuiMod_Ctrl - - ImGuiKey_ModShift and ImGuiModFlags_Shift -> ImGuiMod_Shift - - ImGuiKey_ModAlt and ImGuiModFlags_Alt -> ImGuiMod_Alt - - ImGuiKey_ModSuper and ImGuiModFlags_Super -> ImGuiMod_Super - the ImGuiKey_ModXXX were introduced in 1.87 and mostly used by backends. - the ImGuiModFlags_XXX have been exposed in imgui.h but not really used by any public api only by third-party extensions. - exceptionally commenting out the older ImGuiKeyModFlags_XXX names ahead of obsolescence schedule to reduce confusion and because they were not meant to be used anyway. - - 2022/09/12 (1.89) - removed the bizarre legacy default argument for 'TreePush(const void* ptr = NULL)', always pass a pointer value explicitly, NULL is ok. + - 2023/08/25 (1.89.9) - Clipper: Renamed IncludeRangeByIndices() (also called ForceDisplayRangeByIndices() before 1.89.6) to IncludeItemsByIndex(). Kept inline redirection function. Sorry! + - 2023/07/12 (1.89.8) - ImDrawData: CmdLists now owned, changed from ImDrawList** to ImVector. Majority of users shouldn't be affected, but you cannot compare to NULL nor reassign manually anymore. Instead use AddDrawList(). (#6406, #4879, #1878) + - 2023/06/28 (1.89.7) - overlapping items: obsoleted 'SetItemAllowOverlap()' (called after item) in favor of calling 'SetNextItemAllowOverlap()' (called before item). 'SetItemAllowOverlap()' didn't and couldn't work reliably since 1.89 (2022-11-15). + - 2023/06/28 (1.89.7) - overlapping items: renamed 'ImGuiTreeNodeFlags_AllowItemOverlap' to 'ImGuiTreeNodeFlags_AllowOverlap', 'ImGuiSelectableFlags_AllowItemOverlap' to 'ImGuiSelectableFlags_AllowOverlap'. Kept redirecting enums (will obsolete). + - 2023/06/28 (1.89.7) - overlapping items: IsItemHovered() now by default return false when querying an item using AllowOverlap mode which is being overlapped. Use ImGuiHoveredFlags_AllowWhenOverlappedByItem to revert to old behavior. + - 2023/06/28 (1.89.7) - overlapping items: Selectable and TreeNode don't allow overlap when active so overlapping widgets won't appear as hovered. While this fixes a common small visual issue, it also means that calling IsItemHovered() after a non-reactive elements - e.g. Text() - overlapping an active one may fail if you don't use IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem). (#6610) + - 2023/06/20 (1.89.7) - moved io.HoverDelayShort/io.HoverDelayNormal to style.HoverDelayShort/style.HoverDelayNormal. As the fields were added in 1.89 and expected to be left unchanged by most users, or only tweaked once during app initialization, we are exceptionally accepting the breakage. + - 2023/05/30 (1.89.6) - backends: renamed "imgui_impl_sdlrenderer.cpp" to "imgui_impl_sdlrenderer2.cpp" and "imgui_impl_sdlrenderer.h" to "imgui_impl_sdlrenderer2.h". This is in prevision for the future release of SDL3. + - 2023/05/22 (1.89.6) - listbox: commented out obsolete/redirecting functions that were marked obsolete more than two years ago: + - ListBoxHeader() -> use BeginListBox() (note how two variants of ListBoxHeader() existed. Check commented versions in imgui.h for reference) + - ListBoxFooter() -> use EndListBox() + - 2023/05/15 (1.89.6) - clipper: commented out obsolete redirection constructor 'ImGuiListClipper(int items_count, float items_height = -1.0f)' that was marked obsolete in 1.79. Use default constructor + clipper.Begin(). + - 2023/05/15 (1.89.6) - clipper: renamed ImGuiListClipper::ForceDisplayRangeByIndices() to ImGuiListClipper::IncludeRangeByIndices(). + - 2023/03/14 (1.89.4) - commented out redirecting enums/functions names that were marked obsolete two years ago: + - ImGuiSliderFlags_ClampOnInput -> use ImGuiSliderFlags_AlwaysClamp + - ImGuiInputTextFlags_AlwaysInsertMode -> use ImGuiInputTextFlags_AlwaysOverwrite + - ImDrawList::AddBezierCurve() -> use ImDrawList::AddBezierCubic() + - ImDrawList::PathBezierCurveTo() -> use ImDrawList::PathBezierCubicCurveTo() + - 2023/03/09 (1.89.4) - renamed PushAllowKeyboardFocus()/PopAllowKeyboardFocus() to PushTabStop()/PopTabStop(). Kept inline redirection functions (will obsolete). + - 2023/03/09 (1.89.4) - tooltips: Added 'bool' return value to BeginTooltip() for API consistency. Please only submit contents and call EndTooltip() if BeginTooltip() returns true. In reality the function will _currently_ always return true, but further changes down the line may change this, best to clarify API sooner. + - 2023/02/15 (1.89.4) - moved the optional "courtesy maths operators" implementation from imgui_internal.h in imgui.h. + Even though we encourage using your own maths types and operators by setting up IM_VEC2_CLASS_EXTRA, + it has been frequently requested by people to use our own. We had an opt-in define which was + previously fulfilled in imgui_internal.h. It is now fulfilled in imgui.h. (#6164) + - OK: #define IMGUI_DEFINE_MATH_OPERATORS / #include "imgui.h" / #include "imgui_internal.h" + - Error: #include "imgui.h" / #define IMGUI_DEFINE_MATH_OPERATORS / #include "imgui_internal.h" + - 2023/02/07 (1.89.3) - backends: renamed "imgui_impl_sdl.cpp" to "imgui_impl_sdl2.cpp" and "imgui_impl_sdl.h" to "imgui_impl_sdl2.h". (#6146) This is in prevision for the future release of SDL3. + - 2022/10/26 (1.89) - commented out redirecting OpenPopupContextItem() which was briefly the name of OpenPopupOnItemClick() from 1.77 to 1.79. + - 2022/10/12 (1.89) - removed runtime patching of invalid "%f"/"%0.f" format strings for DragInt()/SliderInt(). This was obsoleted in 1.61 (May 2018). See 1.61 changelog for details. + - 2022/09/26 (1.89) - renamed and merged keyboard modifiers key enums and flags into a same set. Kept inline redirection enums (will obsolete). + - ImGuiKey_ModCtrl and ImGuiModFlags_Ctrl -> ImGuiMod_Ctrl + - ImGuiKey_ModShift and ImGuiModFlags_Shift -> ImGuiMod_Shift + - ImGuiKey_ModAlt and ImGuiModFlags_Alt -> ImGuiMod_Alt + - ImGuiKey_ModSuper and ImGuiModFlags_Super -> ImGuiMod_Super + the ImGuiKey_ModXXX were introduced in 1.87 and mostly used by backends. + the ImGuiModFlags_XXX have been exposed in imgui.h but not really used by any public api only by third-party extensions. + exceptionally commenting out the older ImGuiKeyModFlags_XXX names ahead of obsolescence schedule to reduce confusion and because they were not meant to be used anyway. + - 2022/09/20 (1.89) - ImGuiKey is now a typed enum, allowing ImGuiKey_XXX symbols to be named in debuggers. + this will require uses of legacy backend-dependent indices to be casted, e.g. + - with imgui_impl_glfw: IsKeyPressed(GLFW_KEY_A) -> IsKeyPressed((ImGuiKey)GLFW_KEY_A); + - with imgui_impl_win32: IsKeyPressed('A') -> IsKeyPressed((ImGuiKey)'A') + - etc. However if you are upgrading code you might well use the better, backend-agnostic IsKeyPressed(ImGuiKey_A) now! + - 2022/09/12 (1.89) - removed the bizarre legacy default argument for 'TreePush(const void* ptr = NULL)', always pass a pointer value explicitly. NULL/nullptr is ok but require cast, e.g. TreePush((void*)nullptr); - 2022/09/05 (1.89) - commented out redirecting functions/enums names that were marked obsolete in 1.77 and 1.78 (June 2020): - DragScalar(), DragScalarN(), DragFloat(), DragFloat2(), DragFloat3(), DragFloat4(): For old signatures ending with (..., const char* format, float power = 1.0f) -> use (..., format ImGuiSliderFlags_Logarithmic) if power != 1.0f. - SliderScalar(), SliderScalarN(), SliderFloat(), SliderFloat2(), SliderFloat3(), SliderFloat4(): For old signatures ending with (..., const char* format, float power = 1.0f) -> use (..., format ImGuiSliderFlags_Logarithmic) if power != 1.0f. @@ -749,7 +824,7 @@ CODE ================================ Read all answers online: - https://www.dearimgui.org/faq or https://github.com/ocornut/imgui/blob/master/docs/FAQ.md (same url) + https://www.dearimgui.com/faq or https://github.com/ocornut/imgui/blob/master/docs/FAQ.md (same url) Read all answers locally (with a text editor or ideally a Markdown viewer): docs/FAQ.md Some answers are copied down here to facilitate searching in code. @@ -759,11 +834,12 @@ CODE Q: Where is the documentation? A: This library is poorly documented at the moment and expects the user to be acquainted with C/C++. - - Run the examples/ and explore them. + - Run the examples/ applications and explore them. + - Read Getting Started (https://github.com/ocornut/imgui/wiki/Getting-Started) guide. - See demo code in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function. - The demo covers most features of Dear ImGui, so you can read the code and see its output. - See documentation and comments at the top of imgui.cpp + effectively imgui.h. - - Dozens of standalone example applications using e.g. OpenGL/DirectX are provided in the + - 20+ standalone example applications using e.g. OpenGL/DirectX are provided in the examples/ folder to explain how to integrate Dear ImGui with your own engine/application. - The Wiki (https://github.com/ocornut/imgui/wiki) has many resources and links. - The Glossary (https://github.com/ocornut/imgui/wiki/Glossary) page also may be useful. @@ -773,24 +849,24 @@ CODE Q: What is this library called? Q: Which version should I get? >> This library is called "Dear ImGui", please don't call it "ImGui" :) - >> See https://www.dearimgui.org/faq for details. + >> See https://www.dearimgui.com/faq for details. Q&A: Integration ================ Q: How to get started? - A: Read 'PROGRAMMER GUIDE' above. Read examples/README.txt. + A: Read https://github.com/ocornut/imgui/wiki/Getting-Started. Read 'PROGRAMMER GUIDE' above. Read examples/README.txt. Q: How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application? A: You should read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags! - >> See https://www.dearimgui.org/faq for a fully detailed answer. You really want to read this. + >> See https://www.dearimgui.com/faq for a fully detailed answer. You really want to read this. - Q. How can I enable keyboard controls? - Q: How can I use this without a mouse, without a keyboard or without a screen? (gamepad, input share, remote display) + Q. How can I enable keyboard or gamepad controls? + Q: How can I use this on a machine without mouse, keyboard or screen? (input share, remote display) Q: I integrated Dear ImGui in my engine and little squares are showing instead of text... Q: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around... Q: I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries... - >> See https://www.dearimgui.org/faq + >> See https://www.dearimgui.com/faq Q&A: Usage ---------- @@ -801,10 +877,10 @@ CODE - How can I have multiple widgets with the same label? - How can I have multiple windows with the same label? Q: How can I display an image? What is ImTextureID, how does it work? - Q: How can I use my own math types instead of ImVec2/ImVec4? + Q: How can I use my own math types instead of ImVec2? Q: How can I interact with standard C++ types (such as std::string and std::vector)? Q: How can I display custom shapes? (using low-level ImDrawList API) - >> See https://www.dearimgui.org/faq + >> See https://www.dearimgui.com/faq Q&A: Fonts, Text ================ @@ -814,7 +890,7 @@ CODE Q: How can I easily use icons in my application? Q: How can I load multiple fonts? Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic? - >> See https://www.dearimgui.org/faq and https://github.com/ocornut/imgui/edit/master/docs/FONTS.md + >> See https://www.dearimgui.com/faq and https://github.com/ocornut/imgui/edit/master/docs/FONTS.md Q&A: Concerns ============= @@ -823,7 +899,7 @@ CODE Q: Can you create elaborate/serious tools with Dear ImGui? Q: Can you reskin the look of Dear ImGui? Q: Why using C++ (as opposed to C)? - >> See https://www.dearimgui.org/faq + >> See https://www.dearimgui.com/faq Q&A: Community ============== @@ -831,10 +907,10 @@ CODE Q: How can I help? A: - Businesses: please reach out to "contact AT dearimgui.com" if you work in a place using Dear ImGui! We can discuss ways for your company to fund development via invoiced technical support, maintenance or sponsoring contacts. - This is among the most useful thing you can do for Dear ImGui. With increased funding, we can hire more people working on this project. - - Individuals: you can support continued development via PayPal donations. See README. - - If you are experienced with Dear ImGui and C++, look at the GitHub issues, look at the Wiki, read docs/TODO.txt - and see how you want to help and can help! + This is among the most useful thing you can do for Dear ImGui. With increased funding, we sustain and grow work on this project. + Also see https://github.com/ocornut/imgui/wiki/Sponsors + - Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine. + - If you are experienced with Dear ImGui and C++, look at the GitHub issues, look at the Wiki, and see how you want to help and can help! - Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc. You may post screenshot or links in the gallery threads. Visuals are ideal as they inspire other programmers. But even without visuals, disclosing your use of dear imgui helps the library grow credibility, and help other teams and programmers with taking decisions. @@ -850,22 +926,17 @@ CODE #define _CRT_SECURE_NO_WARNINGS #endif -#include "imgui.h" -#ifndef IMGUI_DISABLE - #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif + +#include "imgui.h" +#ifndef IMGUI_DISABLE #include "imgui_internal.h" // System includes -#include // toupper #include // vsnprintf, sscanf, printf -#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier -#include // intptr_t -#else #include // intptr_t -#endif // [Windows] On non-Visual Studio compilers, we default to IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS unless explicitly enabled #if defined(_WIN32) && !defined(_MSC_VER) && !defined(IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS) @@ -946,7 +1017,6 @@ CODE // Debug options #define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Display last moving direction matches when holding CTRL #define IMGUI_DEBUG_NAV_RECTS 0 // Display the reference navigation rectangle for each window -#define IMGUI_DEBUG_INI_SETTINGS 0 // Save additional comments in .ini file (particularly helps for Docking, but makes saving slower) // When using CTRL+TAB (or Gamepad Square+L/R) we delay the visual a little in order to reduce visual noise doing a fast switch. static const float NAV_WINDOWING_HIGHLIGHT_DELAY = 0.20f; // Time before the highlight and screen dimming starts fading in @@ -955,7 +1025,10 @@ static const float NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15f; // Time // Window resizing from edges (when io.ConfigWindowsResizeFromEdges = true and ImGuiBackendFlags_HasMouseCursors is set in io.BackendFlags by backend) static const float WINDOWS_HOVER_PADDING = 4.0f; // Extend outside window for hovering/resizing (maxxed with TouchPadding) and inside windows for borders. Affect FindHoveredWindow(). static const float WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER = 0.04f; // Reduce visual noise by only highlighting the border after a certain time. -static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 2.00f; // Lock scrolled window (so it doesn't pick child windows that are scrolling through) for a certain time, unless mouse moved. +static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 0.70f; // Lock scrolled window (so it doesn't pick child windows that are scrolling through) for a certain time, unless mouse moved. + +// Tooltip offset +static const ImVec2 TOOLTIP_DEFAULT_OFFSET = ImVec2(16, 10); // Multiplied by g.Style.MouseCursorScale //------------------------------------------------------------------------- // [SECTION] FORWARD DECLARATIONS @@ -966,7 +1039,6 @@ static void FindHoveredWindow(); static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags); static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window); -static void AddDrawListToDrawData(ImVector* out_list, ImDrawList* draw_list); static void AddWindowToSortBuffer(ImVector* out_sorted_windows, ImGuiWindow* window); // Settings @@ -977,8 +1049,8 @@ static void WindowSettingsHandler_ApplyAll(ImGuiContext*, ImGuiSetti static void WindowSettingsHandler_WriteAll(ImGuiContext*, ImGuiSettingsHandler*, ImGuiTextBuffer* buf); // Platform Dependents default implementation for IO functions -static const char* GetClipboardTextFn_DefaultImpl(void* user_data); -static void SetClipboardTextFn_DefaultImpl(void* user_data, const char* text); +static const char* GetClipboardTextFn_DefaultImpl(void* user_data_ctx); +static void SetClipboardTextFn_DefaultImpl(void* user_data_ctx, const char* text); static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport* viewport, ImGuiPlatformImeData* data); namespace ImGui @@ -997,7 +1069,7 @@ static void NavEndFrame(); static bool NavScoreItem(ImGuiNavItemData* result); static void NavApplyItemToResult(ImGuiNavItemData* result); static void NavProcessItem(); -static void NavProcessItemForTabbingRequest(ImGuiID id); +static void NavProcessItemForTabbingRequest(ImGuiID id, ImGuiItemFlags item_flags, ImGuiNavMoveFlags move_flags); static ImVec2 NavCalcPreferredRefPos(); static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window); static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window); @@ -1011,18 +1083,20 @@ static void ErrorCheckEndFrameSanityChecks(); static void UpdateDebugToolItemPicker(); static void UpdateDebugToolStackQueries(); -// Misc -static void UpdateSettings(); +// Inputs static void UpdateKeyboardInputs(); static void UpdateMouseInputs(); static void UpdateMouseWheel(); +static void UpdateKeyRoutingTable(ImGuiKeyRoutingTable* rt); + +// Misc +static void UpdateSettings(); static bool UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect); static void RenderWindowOuterBorders(ImGuiWindow* window); -static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size); +static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size); static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open); static void RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 col); static void RenderDimmedBackgrounds(); -static ImGuiWindow* FindBlockingModal(ImGuiWindow* window); // Viewports static void UpdateViewportsNewFrame(); @@ -1094,7 +1168,7 @@ ImGuiStyle::ImGuiStyle() FrameBorderSize = 0.0f; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested. ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label) - CellPadding = ImVec2(4,2); // Padding within a table cell + CellPadding = ImVec2(4,2); // Padding within a table cell. CellPadding.y may be altered between different rows. TouchExtraPadding = ImVec2(0,0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! IndentSpacing = 21.0f; // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). @@ -1109,6 +1183,9 @@ ImGuiStyle::ImGuiStyle() ColorButtonPosition = ImGuiDir_Right; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text. SelectableTextAlign = ImVec2(0.0f,0.0f);// Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line. + SeparatorTextBorderSize = 3.0f; // Thickkness of border in SeparatorText() + SeparatorTextAlign = ImVec2(0.0f,0.5f);// Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center). + SeparatorTextPadding = ImVec2(20.0f,3.f);// Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y. DisplayWindowPadding = ImVec2(19,19); // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows. DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. MouseCursorScale = 1.0f; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. @@ -1118,6 +1195,13 @@ ImGuiStyle::ImGuiStyle() CurveTessellationTol = 1.25f; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. CircleTessellationMaxError = 0.30f; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. + // Behaviors + HoverStationaryDelay = 0.15f; // Delay for IsItemHovered(ImGuiHoveredFlags_Stationary). Time required to consider mouse stationary. + HoverDelayShort = 0.15f; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayShort). Usually used along with HoverStationaryDelay. + HoverDelayNormal = 0.40f; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayNormal). " + HoverFlagsForTooltipMouse = ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort; // Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using mouse. + HoverFlagsForTooltipNav = ImGuiHoveredFlags_NoSharedDelay | ImGuiHoveredFlags_DelayNormal; // Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using keyboard/gamepad. + // Default theme ImGui::StyleColorsDark(this); } @@ -1146,6 +1230,7 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor) LogSliderDeadzone = ImFloor(LogSliderDeadzone * scale_factor); TabRounding = ImFloor(TabRounding * scale_factor); TabMinWidthForCloseButton = (TabMinWidthForCloseButton != FLT_MAX) ? ImFloor(TabMinWidthForCloseButton * scale_factor) : FLT_MAX; + SeparatorTextPadding = ImFloor(SeparatorTextPadding * scale_factor); DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor); DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor); MouseCursorScale = ImFloor(MouseCursorScale * scale_factor); @@ -1165,16 +1250,10 @@ ImGuiIO::ImGuiIO() IniSavingRate = 5.0f; IniFilename = "imgui.ini"; // Important: "imgui.ini" is relative to current working dir, most apps will want to lock this to an absolute path (e.g. same path as executables). LogFilename = "imgui_log.txt"; - MouseDoubleClickTime = 0.30f; - MouseDoubleClickMaxDist = 6.0f; #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO for (int i = 0; i < ImGuiKey_COUNT; i++) KeyMap[i] = -1; #endif - KeyRepeatDelay = 0.275f; - KeyRepeatRate = 0.050f; - HoverDelayNormal = 0.30f; - HoverDelayShort = 0.10f; UserData = NULL; Fonts = NULL; @@ -1183,6 +1262,12 @@ ImGuiIO::ImGuiIO() FontAllowUserScaling = false; DisplayFramebufferScale = ImVec2(1.0f, 1.0f); + MouseDoubleClickTime = 0.30f; + MouseDoubleClickMaxDist = 6.0f; + MouseDragThreshold = 6.0f; + KeyRepeatDelay = 0.275f; + KeyRepeatRate = 0.050f; + // Miscellaneous options MouseDrawCursor = false; #ifdef __APPLE__ @@ -1197,19 +1282,19 @@ ImGuiIO::ImGuiIO() ConfigWindowsResizeFromEdges = true; ConfigWindowsMoveFromTitleBarOnly = false; ConfigMemoryCompactTimer = 60.0f; + ConfigDebugBeginReturnValueOnce = false; + ConfigDebugBeginReturnValueLoop = false; // Platform Functions + // Note: Initialize() will setup default clipboard/ime handlers. BackendPlatformName = BackendRendererName = NULL; BackendPlatformUserData = BackendRendererUserData = BackendLanguageUserData = NULL; - GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations - SetClipboardTextFn = SetClipboardTextFn_DefaultImpl; - ClipboardUserData = NULL; - SetPlatformImeDataFn = SetPlatformImeDataFn_DefaultImpl; + PlatformLocaleDecimalPoint = '.'; // Input (NB: we already have memset zero the entire structure!) MousePos = ImVec2(-FLT_MAX, -FLT_MAX); MousePosPrev = ImVec2(-FLT_MAX, -FLT_MAX); - MouseDragThreshold = 6.0f; + MouseSource = ImGuiMouseSource_Mouse; for (int i = 0; i < IM_ARRAYSIZE(MouseDownDuration); i++) MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f; for (int i = 0; i < IM_ARRAYSIZE(KeysData); i++) { KeysData[i].DownDuration = KeysData[i].DownDurationPrev = -1.0f; } AppAcceptingEvents = true; @@ -1223,14 +1308,15 @@ ImGuiIO::ImGuiIO() // FIXME: Should in theory be called "AddCharacterEvent()" to be consistent with new API void ImGuiIO::AddInputCharacter(unsigned int c) { - ImGuiContext& g = *GImGui; - IM_ASSERT(&g.IO == this && "Can only add events to current context."); + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; if (c == 0 || !AppAcceptingEvents) return; ImGuiInputEvent e; e.Type = ImGuiInputEventType_Text; e.Source = ImGuiInputSource_Keyboard; + e.EventId = g.InputEventsNextEventId++; e.Text.Char = c; g.InputEventsQueue.push_back(e); } @@ -1279,18 +1365,19 @@ void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars) { unsigned int c = 0; utf8_chars += ImTextCharFromUtf8(&c, utf8_chars, NULL); - if (c != 0) - AddInputCharacter(c); + AddInputCharacter(c); } } -// FIXME: Perhaps we could clear queued events as well? -void ImGuiIO::ClearInputCharacters() +// Clear all incoming events. +void ImGuiIO::ClearEventsQueue() { - InputQueueCharacters.resize(0); + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; + g.InputEventsQueue.clear(); } -// FIXME: Perhaps we could clear queued events as well? +// Clear current keyboard/mouse/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons. void ImGuiIO::ClearInputKeys() { #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO @@ -1304,11 +1391,28 @@ void ImGuiIO::ClearInputKeys() } KeyCtrl = KeyShift = KeyAlt = KeySuper = false; KeyMods = ImGuiMod_None; + MousePos = ImVec2(-FLT_MAX, -FLT_MAX); + for (int n = 0; n < IM_ARRAYSIZE(MouseDown); n++) + { + MouseDown[n] = false; + MouseDownDuration[n] = MouseDownDurationPrev[n] = -1.0f; + } + MouseWheel = MouseWheelH = 0.0f; + InputQueueCharacters.resize(0); // Behavior of old ClearInputCharacters(). } -static ImGuiInputEvent* FindLatestInputEvent(ImGuiInputEventType type, int arg = -1) +// Removed this as it is ambiguous/misleading and generally incorrect to use with the existence of a higher-level input queue. +// Current frame character buffer is now also cleared by ClearInputKeys(). +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS +void ImGuiIO::ClearInputCharacters() { - ImGuiContext& g = *GImGui; + InputQueueCharacters.resize(0); +} +#endif + +static ImGuiInputEvent* FindLatestInputEvent(ImGuiContext* ctx, ImGuiInputEventType type, int arg = -1) +{ + ImGuiContext& g = *ctx; for (int n = g.InputEventsQueue.Size - 1; n >= 0; n--) { ImGuiInputEvent* e = &g.InputEventsQueue[n]; @@ -1327,15 +1431,18 @@ static ImGuiInputEvent* FindLatestInputEvent(ImGuiInputEventType type, int arg = // - ImGuiKey key: Translated key (as in, generally ImGuiKey_A matches the key end-user would use to emit an 'A' character) // - bool down: Is the key down? use false to signify a key release. // - float analog_value: 0.0f..1.0f +// IMPORTANT: THIS FUNCTION AND OTHER "ADD" GRABS THE CONTEXT FROM OUR INSTANCE. +// WE NEED TO ENSURE THAT ALL FUNCTION CALLS ARE FULLFILLING THIS, WHICH IS WHY GetKeyData() HAS AN EXPLICIT CONTEXT. void ImGuiIO::AddKeyAnalogEvent(ImGuiKey key, bool down, float analog_value) { //if (e->Down) { IMGUI_DEBUG_LOG_IO("AddKeyEvent() Key='%s' %d, NativeKeycode = %d, NativeScancode = %d\n", ImGui::GetKeyName(e->Key), e->Down, e->NativeKeycode, e->NativeScancode); } + IM_ASSERT(Ctx != NULL); if (key == ImGuiKey_None || !AppAcceptingEvents) return; - ImGuiContext& g = *GImGui; - IM_ASSERT(&g.IO == this && "Can only add events to current context."); + ImGuiContext& g = *Ctx; IM_ASSERT(ImGui::IsNamedKeyOrModKey(key)); // Backend needs to pass a valid ImGuiKey_ constant. 0..511 values are legacy native key codes which are not accepted by this API. - IM_ASSERT(!ImGui::IsAliasKey(key)); // Backend cannot submit ImGuiKey_MouseXXX values they are automatically inferred from AddMouseXXX() events. + IM_ASSERT(ImGui::IsAliasKey(key) == false); // Backend cannot submit ImGuiKey_MouseXXX values they are automatically inferred from AddMouseXXX() events. + IM_ASSERT(key != ImGuiMod_Shortcut); // We could easily support the translation here but it seems saner to not accept it (TestEngine perform a translation itself) // Verify that backend isn't mixing up using new io.AddKeyEvent() api and old io.KeysDown[] + io.KeyMap[] data. #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO @@ -1349,8 +1456,8 @@ void ImGuiIO::AddKeyAnalogEvent(ImGuiKey key, bool down, float analog_value) BackendUsingLegacyNavInputArray = false; // Filter duplicate (in particular: key mods and gamepad analog values are commonly spammed) - const ImGuiInputEvent* latest_event = FindLatestInputEvent(ImGuiInputEventType_Key, (int)key); - const ImGuiKeyData* key_data = ImGui::GetKeyData(key); + const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_Key, (int)key); + const ImGuiKeyData* key_data = ImGui::GetKeyData(&g, key); const bool latest_key_down = latest_event ? latest_event->Key.Down : key_data->Down; const float latest_key_analog = latest_event ? latest_event->Key.AnalogValue : key_data->AnalogValue; if (latest_key_down == down && latest_key_analog == analog_value) @@ -1360,6 +1467,7 @@ void ImGuiIO::AddKeyAnalogEvent(ImGuiKey key, bool down, float analog_value) ImGuiInputEvent e; e.Type = ImGuiInputEventType_Key; e.Source = ImGui::IsGamepadKey(key) ? ImGuiInputSource_Gamepad : ImGuiInputSource_Keyboard; + e.EventId = g.InputEventsNextEventId++; e.Key.Key = key; e.Key.Down = down; e.Key.AnalogValue = analog_value; @@ -1407,8 +1515,8 @@ void ImGuiIO::SetAppAcceptingEvents(bool accepting_events) // Queue a mouse move event void ImGuiIO::AddMousePosEvent(float x, float y) { - ImGuiContext& g = *GImGui; - IM_ASSERT(&g.IO == this && "Can only add events to current context."); + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; if (!AppAcceptingEvents) return; @@ -1416,7 +1524,7 @@ void ImGuiIO::AddMousePosEvent(float x, float y) ImVec2 pos((x > -FLT_MAX) ? ImFloorSigned(x) : x, (y > -FLT_MAX) ? ImFloorSigned(y) : y); // Filter duplicate - const ImGuiInputEvent* latest_event = FindLatestInputEvent(ImGuiInputEventType_MousePos); + const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_MousePos); const ImVec2 latest_pos = latest_event ? ImVec2(latest_event->MousePos.PosX, latest_event->MousePos.PosY) : g.IO.MousePos; if (latest_pos.x == pos.x && latest_pos.y == pos.y) return; @@ -1424,21 +1532,23 @@ void ImGuiIO::AddMousePosEvent(float x, float y) ImGuiInputEvent e; e.Type = ImGuiInputEventType_MousePos; e.Source = ImGuiInputSource_Mouse; + e.EventId = g.InputEventsNextEventId++; e.MousePos.PosX = pos.x; e.MousePos.PosY = pos.y; + e.MousePos.MouseSource = g.InputEventsNextMouseSource; g.InputEventsQueue.push_back(e); } void ImGuiIO::AddMouseButtonEvent(int mouse_button, bool down) { - ImGuiContext& g = *GImGui; - IM_ASSERT(&g.IO == this && "Can only add events to current context."); + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; IM_ASSERT(mouse_button >= 0 && mouse_button < ImGuiMouseButton_COUNT); if (!AppAcceptingEvents) return; // Filter duplicate - const ImGuiInputEvent* latest_event = FindLatestInputEvent(ImGuiInputEventType_MouseButton, (int)mouse_button); + const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_MouseButton, (int)mouse_button); const bool latest_button_down = latest_event ? latest_event->MouseButton.Down : g.IO.MouseDown[mouse_button]; if (latest_button_down == down) return; @@ -1446,16 +1556,18 @@ void ImGuiIO::AddMouseButtonEvent(int mouse_button, bool down) ImGuiInputEvent e; e.Type = ImGuiInputEventType_MouseButton; e.Source = ImGuiInputSource_Mouse; + e.EventId = g.InputEventsNextEventId++; e.MouseButton.Button = mouse_button; e.MouseButton.Down = down; + e.MouseButton.MouseSource = g.InputEventsNextMouseSource; g.InputEventsQueue.push_back(e); } -// Queue a mouse wheel event (most mouse/API will only have a Y component) +// Queue a mouse wheel event (some mouse/API may only have a Y component) void ImGuiIO::AddMouseWheelEvent(float wheel_x, float wheel_y) { - ImGuiContext& g = *GImGui; - IM_ASSERT(&g.IO == this && "Can only add events to current context."); + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; // Filter duplicate (unlike most events, wheel values are relative and easy to filter) if (!AppAcceptingEvents || (wheel_x == 0.0f && wheel_y == 0.0f)) @@ -1464,24 +1576,36 @@ void ImGuiIO::AddMouseWheelEvent(float wheel_x, float wheel_y) ImGuiInputEvent e; e.Type = ImGuiInputEventType_MouseWheel; e.Source = ImGuiInputSource_Mouse; + e.EventId = g.InputEventsNextEventId++; e.MouseWheel.WheelX = wheel_x; e.MouseWheel.WheelY = wheel_y; + e.MouseWheel.MouseSource = g.InputEventsNextMouseSource; g.InputEventsQueue.push_back(e); } +// This is not a real event, the data is latched in order to be stored in actual Mouse events. +// This is so that duplicate events (e.g. Windows sending extraneous WM_MOUSEMOVE) gets filtered and are not leading to actual source changes. +void ImGuiIO::AddMouseSourceEvent(ImGuiMouseSource source) +{ + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; + g.InputEventsNextMouseSource = source; +} + void ImGuiIO::AddFocusEvent(bool focused) { - ImGuiContext& g = *GImGui; - IM_ASSERT(&g.IO == this && "Can only add events to current context."); + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; // Filter duplicate - const ImGuiInputEvent* latest_event = FindLatestInputEvent(ImGuiInputEventType_Focus); + const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_Focus); const bool latest_focused = latest_event ? latest_event->AppFocused.Focused : !g.IO.AppFocusLost; - if (latest_focused == focused) + if (latest_focused == focused || (ConfigDebugIgnoreFocusLoss && !focused)) return; ImGuiInputEvent e; e.Type = ImGuiInputEventType_Focus; + e.EventId = g.InputEventsNextEventId++; e.AppFocused.Focused = focused; g.InputEventsQueue.push_back(e); } @@ -1614,14 +1738,14 @@ ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, int ImStricmp(const char* str1, const char* str2) { int d; - while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } + while ((d = ImToUpper(*str2) - ImToUpper(*str1)) == 0 && *str1) { str1++; str2++; } return d; } int ImStrnicmp(const char* str1, const char* str2, size_t count) { int d = 0; - while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; } + while (count > 0 && (d = ImToUpper(*str2) - ImToUpper(*str1)) == 0 && *str1) { str1++; str2++; count--; } return d; } @@ -1688,14 +1812,14 @@ const char* ImStristr(const char* haystack, const char* haystack_end, const char if (!needle_end) needle_end = needle + strlen(needle); - const char un0 = (char)toupper(*needle); + const char un0 = (char)ImToUpper(*needle); while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end)) { - if (toupper(*haystack) == un0) + if (ImToUpper(*haystack) == un0) { const char* b = needle + 1; for (const char* a = haystack + 1; b < needle_end; a++, b++) - if (toupper(*a) != toupper(*b)) + if (ImToUpper(*a) != ImToUpper(*b)) break; if (b == needle_end) return haystack; @@ -1738,13 +1862,15 @@ const char* ImStrSkipBlank(const char* str) // and setup the wrapper yourself. (FIXME-OPT: Some of our high-level operations such as ImGuiTextBuffer::appendfv() are // designed using two-passes worst case, which probably could be improved using the stbsp_vsprintfcb() function.) #ifdef IMGUI_USE_STB_SPRINTF +#ifndef IMGUI_DISABLE_STB_SPRINTF_IMPLEMENTATION #define STB_SPRINTF_IMPLEMENTATION +#endif #ifdef IMGUI_STB_SPRINTF_FILENAME #include IMGUI_STB_SPRINTF_FILENAME #else #include "stb_sprintf.h" #endif -#endif +#endif // #ifdef IMGUI_USE_STB_SPRINTF #if defined(_MSC_VER) && !defined(vsnprintf) #define vsnprintf _vsnprintf @@ -1789,18 +1915,36 @@ void ImFormatStringToTempBuffer(const char** out_buf, const char** out_buf_end, ImGuiContext& g = *GImGui; va_list args; va_start(args, fmt); - int buf_len = ImFormatStringV(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args); - *out_buf = g.TempBuffer.Data; - if (out_buf_end) { *out_buf_end = g.TempBuffer.Data + buf_len; } + if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0) + { + const char* buf = va_arg(args, const char*); // Skip formatting when using "%s" + *out_buf = buf; + if (out_buf_end) { *out_buf_end = buf + strlen(buf); } + } + else + { + int buf_len = ImFormatStringV(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args); + *out_buf = g.TempBuffer.Data; + if (out_buf_end) { *out_buf_end = g.TempBuffer.Data + buf_len; } + } va_end(args); } void ImFormatStringToTempBufferV(const char** out_buf, const char** out_buf_end, const char* fmt, va_list args) { ImGuiContext& g = *GImGui; - int buf_len = ImFormatStringV(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args); - *out_buf = g.TempBuffer.Data; - if (out_buf_end) { *out_buf_end = g.TempBuffer.Data + buf_len; } + if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0) + { + const char* buf = va_arg(args, const char*); // Skip formatting when using "%s" + *out_buf = buf; + if (out_buf_end) { *out_buf_end = buf + strlen(buf); } + } + else + { + int buf_len = ImFormatStringV(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args); + *out_buf = g.TempBuffer.Data; + if (out_buf_end) { *out_buf_end = g.TempBuffer.Data + buf_len; } + } } // CRC32 needs a 1KB lookup table (not cache friendly) @@ -1829,7 +1973,7 @@ static const ImU32 GCrc32LookupTable[256] = // Known size hash // It is ok to call ImHashData on a string with known length but the ### operator won't be supported. // FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements. -ImGuiID ImHashData(const void* data_p, size_t data_size, ImU32 seed) +ImGuiID ImHashData(const void* data_p, size_t data_size, ImGuiID seed) { ImU32 crc = ~seed; const unsigned char* data = (const unsigned char*)data_p; @@ -1845,7 +1989,7 @@ ImGuiID ImHashData(const void* data_p, size_t data_size, ImU32 seed) // - If we reach ### in the string we discard the hash so far and reset to the seed. // - We don't do 'current += 2; continue;' after handling ### to keep the code smaller/faster (measured ~10% diff in Debug build) // FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements. -ImGuiID ImHashStr(const char* data_p, size_t data_size, ImU32 seed) +ImGuiID ImHashStr(const char* data_p, size_t data_size, ImGuiID seed) { seed = ~seed; ImU32 crc = seed; @@ -1887,7 +2031,7 @@ ImFileHandle ImFileOpen(const char* filename, const char* mode) // Previously we used ImTextCountCharsFromUtf8/ImTextStrFromUtf8 here but we now need to support ImWchar16 and ImWchar32! const int filename_wsize = ::MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0); const int mode_wsize = ::MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0); - ImVector buf; + ImVector buf; buf.resize(filename_wsize + mode_wsize); ::MultiByteToWideChar(CP_UTF8, 0, filename, -1, (wchar_t*)&buf[0], filename_wsize); ::MultiByteToWideChar(CP_UTF8, 0, mode, -1, (wchar_t*)&buf[filename_wsize], mode_wsize); @@ -1950,6 +2094,8 @@ void* ImFileLoadToMemory(const char* filename, const char* mode, size_t* out_f // [SECTION] MISC HELPERS/UTILITIES (ImText* functions) //----------------------------------------------------------------------------- +IM_MSVC_RUNTIME_CHECKS_OFF + // Convert UTF-8 to 32-bit character, process single character input. // A nearly-branchless UTF-8 decoder, based on work of Christopher Wellons (https://github.com/skeeto/branchless-utf8). // We handle UTF-8 decoding error by skipping forward. @@ -1961,7 +2107,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* static const int shiftc[] = { 0, 18, 12, 6, 0 }; static const int shifte[] = { 0, 6, 4, 2, 0 }; int len = lengths[*(const unsigned char*)in_text >> 3]; - int wanted = len + !len; + int wanted = len + (len ? 0 : 1); if (in_text_end == NULL) in_text_end = in_text + wanted; // Max length, nulls will be taken into account. @@ -2013,8 +2159,6 @@ int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const cha { unsigned int c; in_text += ImTextCharFromUtf8(&c, in_text, in_text_end); - if (c == 0) - break; *buf_out++ = (ImWchar)c; } *buf_out = 0; @@ -2030,8 +2174,6 @@ int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end) { unsigned int c; in_text += ImTextCharFromUtf8(&c, in_text, in_text_end); - if (c == 0) - break; char_count++; } return char_count; @@ -2125,6 +2267,7 @@ int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_e } return bytes_count; } +IM_MSVC_RUNTIME_CHECKS_RESTORE //----------------------------------------------------------------------------- // [SECTION] MISC HELPERS/UTILITIES (Color functions) @@ -2410,16 +2553,15 @@ void ImGuiTextFilter::Build() input_range.split(',', &Filters); CountGrep = 0; - for (int i = 0; i != Filters.Size; i++) + for (ImGuiTextRange& f : Filters) { - ImGuiTextRange& f = Filters[i]; while (f.b < f.e && ImCharIsBlankA(f.b[0])) f.b++; while (f.e > f.b && ImCharIsBlankA(f.e[-1])) f.e--; if (f.empty()) continue; - if (Filters[i].b[0] != '-') + if (f.b[0] != '-') CountGrep += 1; } } @@ -2432,9 +2574,8 @@ bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const if (text == NULL) text = ""; - for (int i = 0; i != Filters.Size; i++) + for (const ImGuiTextRange& f : Filters) { - const ImGuiTextRange& f = Filters[i]; if (f.empty()) continue; if (f.b[0] == '-') @@ -2459,7 +2600,7 @@ bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const } //----------------------------------------------------------------------------- -// [SECTION] ImGuiTextBuffer +// [SECTION] ImGuiTextBuffer, ImGuiTextIndex //----------------------------------------------------------------------------- // On some platform vsnprintf() takes va_list by reference and modifies it. @@ -2527,6 +2668,20 @@ void ImGuiTextBuffer::appendfv(const char* fmt, va_list args) va_end(args_copy); } +void ImGuiTextIndex::append(const char* base, int old_size, int new_size) +{ + IM_ASSERT(old_size >= 0 && new_size >= old_size && new_size >= EndOffset); + if (old_size == new_size) + return; + if (EndOffset == 0 || base[EndOffset - 1] == '\n') + LineOffsets.push_back(EndOffset); + const char* base_end = base + new_size; + for (const char* p = base + old_size; (p = (const char*)memchr(p, '\n', base_end - p)) != 0; ) + if (++p < base_end) // Don't push a trailing offset on last \n + LineOffsets.push_back((int)(intptr_t)(p - base)); + EndOffset = ImMax(EndOffset, new_size); +} + //----------------------------------------------------------------------------- // [SECTION] ImGuiListClipper // This is currently not as flexible/powerful as it should be and really confusing/spaghetti, mostly because we changed @@ -2650,7 +2805,6 @@ static void ImGuiListClipper_SeekCursorForItem(ImGuiListClipper* clipper, int it ImGuiListClipper::ImGuiListClipper() { memset(this, 0, sizeof(*this)); - ItemsCount = -1; } ImGuiListClipper::~ImGuiListClipper() @@ -2660,7 +2814,10 @@ ImGuiListClipper::~ImGuiListClipper() void ImGuiListClipper::Begin(int items_count, float items_height) { - ImGuiContext& g = *GImGui; + if (Ctx == NULL) + Ctx = ImGui::GetCurrentContext(); + + ImGuiContext& g = *Ctx; ImGuiWindow* window = g.CurrentWindow; IMGUI_DEBUG_LOG_CLIPPER("Clipper: Begin(%d,%.2f) in '%s'\n", items_count, items_height, window->Name); @@ -2685,10 +2842,10 @@ void ImGuiListClipper::Begin(int items_count, float items_height) void ImGuiListClipper::End() { - ImGuiContext& g = *GImGui; if (ImGuiListClipperData* data = (ImGuiListClipperData*)TempData) { // In theory here we should assert that we are already at the right position, but it seems saner to just seek at the end and not assert/crash the user. + ImGuiContext& g = *Ctx; IMGUI_DEBUG_LOG_CLIPPER("Clipper: End() in '%s'\n", g.CurrentWindow->Name); if (ItemsCount >= 0 && ItemsCount < INT_MAX && DisplayStart >= 0) ImGuiListClipper_SeekCursorForItem(this, ItemsCount); @@ -2706,18 +2863,18 @@ void ImGuiListClipper::End() ItemsCount = -1; } -void ImGuiListClipper::ForceDisplayRangeByIndices(int item_min, int item_max) +void ImGuiListClipper::IncludeItemsByIndex(int item_begin, int item_end) { ImGuiListClipperData* data = (ImGuiListClipperData*)TempData; IM_ASSERT(DisplayStart < 0); // Only allowed after Begin() and if there has not been a specified range yet. - IM_ASSERT(item_min <= item_max); - if (item_min < item_max) - data->Ranges.push_back(ImGuiListClipperRange::FromIndices(item_min, item_max)); + IM_ASSERT(item_begin <= item_end); + if (item_begin < item_end) + data->Ranges.push_back(ImGuiListClipperRange::FromIndices(item_begin, item_end)); } static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *clipper->Ctx; ImGuiWindow* window = g.CurrentWindow; ImGuiListClipperData* data = (ImGuiListClipperData*)clipper->TempData; IM_ASSERT(data != NULL && "Called ImGuiListClipper::Step() too many times, or before ImGuiListClipper::Begin() ?"); @@ -2789,7 +2946,7 @@ static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper) const bool is_nav_request = (g.NavMoveScoringItems && g.NavWindow && g.NavWindow->RootWindowForNav == window->RootWindowForNav); if (is_nav_request) data->Ranges.push_back(ImGuiListClipperRange::FromPositions(g.NavScoringNoClipRect.Min.y, g.NavScoringNoClipRect.Max.y, 0, 0)); - if (is_nav_request && (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) && g.NavTabbingDir == -1) + if (is_nav_request && (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) && g.NavTabbingDir == -1) data->Ranges.push_back(ImGuiListClipperRange::FromIndices(clipper->ItemsCount - 1, clipper->ItemsCount)); // Add focused/active item @@ -2807,26 +2964,28 @@ static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper) // - Very important: when a starting position is after our maximum item, we set Min to (ItemsCount - 1). This allows us to handle most forms of wrapping. // - Due to how Selectable extra padding they tend to be "unaligned" with exact unit in the item list, // which with the flooring/ceiling tend to lead to 2 items instead of one being submitted. - for (int i = 0; i < data->Ranges.Size; i++) - if (data->Ranges[i].PosToIndexConvert) + for (ImGuiListClipperRange& range : data->Ranges) + if (range.PosToIndexConvert) { - int m1 = (int)(((double)data->Ranges[i].Min - window->DC.CursorPos.y - data->LossynessOffset) / clipper->ItemsHeight); - int m2 = (int)((((double)data->Ranges[i].Max - window->DC.CursorPos.y - data->LossynessOffset) / clipper->ItemsHeight) + 0.999999f); - data->Ranges[i].Min = ImClamp(already_submitted + m1 + data->Ranges[i].PosToIndexOffsetMin, already_submitted, clipper->ItemsCount - 1); - data->Ranges[i].Max = ImClamp(already_submitted + m2 + data->Ranges[i].PosToIndexOffsetMax, data->Ranges[i].Min + 1, clipper->ItemsCount); - data->Ranges[i].PosToIndexConvert = false; + int m1 = (int)(((double)range.Min - window->DC.CursorPos.y - data->LossynessOffset) / clipper->ItemsHeight); + int m2 = (int)((((double)range.Max - window->DC.CursorPos.y - data->LossynessOffset) / clipper->ItemsHeight) + 0.999999f); + range.Min = ImClamp(already_submitted + m1 + range.PosToIndexOffsetMin, already_submitted, clipper->ItemsCount - 1); + range.Max = ImClamp(already_submitted + m2 + range.PosToIndexOffsetMax, range.Min + 1, clipper->ItemsCount); + range.PosToIndexConvert = false; } ImGuiListClipper_SortAndFuseRanges(data->Ranges, data->StepNo); } // Step 0+ (if item height is given in advance) or 1+: Display the next range in line. - if (data->StepNo < data->Ranges.Size) + while (data->StepNo < data->Ranges.Size) { clipper->DisplayStart = ImMax(data->Ranges[data->StepNo].Min, already_submitted); clipper->DisplayEnd = ImMin(data->Ranges[data->StepNo].Max, clipper->ItemsCount); if (clipper->DisplayStart > already_submitted) //-V1051 ImGuiListClipper_SeekCursorForItem(clipper, clipper->DisplayStart); data->StepNo++; + if (clipper->DisplayStart == clipper->DisplayEnd && data->StepNo < data->Ranges.Size) + continue; return true; } @@ -2840,7 +2999,7 @@ static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper) bool ImGuiListClipper::Step() { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *Ctx; bool need_items_height = (ItemsHeight <= 0.0f); bool ret = ImGuiListClipper_StepInternal(this); if (ret && (DisplayStart == DisplayEnd)) @@ -2850,11 +3009,14 @@ bool ImGuiListClipper::Step() if (need_items_height && ItemsHeight > 0.0f) IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): computed ItemsHeight: %.2f.\n", ItemsHeight); if (ret) + { IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): display %d to %d.\n", DisplayStart, DisplayEnd); + } else + { IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): End.\n"); - if (!ret) End(); + } return ret; } @@ -2938,15 +3100,7 @@ void ImGui::PopStyleColor(int count) } } -struct ImGuiStyleVarInfo -{ - ImGuiDataType Type; - ImU32 Count; - ImU32 Offset; - void* GetVarPtr(ImGuiStyle* style) const { return (void*)((unsigned char*)style + Offset); } -}; - -static const ImGuiStyleVarInfo GStyleVarInfo[] = +static const ImGuiDataVarInfo GStyleVarInfo[] = { { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, Alpha) }, // ImGuiStyleVar_Alpha { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, DisabledAlpha) }, // ImGuiStyleVar_DisabledAlpha @@ -2973,41 +3127,44 @@ static const ImGuiStyleVarInfo GStyleVarInfo[] = { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, TabRounding) }, // ImGuiStyleVar_TabRounding { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ButtonTextAlign) }, // ImGuiStyleVar_ButtonTextAlign { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SelectableTextAlign) }, // ImGuiStyleVar_SelectableTextAlign + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, SeparatorTextBorderSize) },// ImGuiStyleVar_SeparatorTextBorderSize + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SeparatorTextAlign) }, // ImGuiStyleVar_SeparatorTextAlign + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SeparatorTextPadding) }, // ImGuiStyleVar_SeparatorTextPadding }; -static const ImGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx) +const ImGuiDataVarInfo* ImGui::GetStyleVarInfo(ImGuiStyleVar idx) { IM_ASSERT(idx >= 0 && idx < ImGuiStyleVar_COUNT); - IM_ASSERT(IM_ARRAYSIZE(GStyleVarInfo) == ImGuiStyleVar_COUNT); + IM_STATIC_ASSERT(IM_ARRAYSIZE(GStyleVarInfo) == ImGuiStyleVar_COUNT); return &GStyleVarInfo[idx]; } void ImGui::PushStyleVar(ImGuiStyleVar idx, float val) { - const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx); + ImGuiContext& g = *GImGui; + const ImGuiDataVarInfo* var_info = GetStyleVarInfo(idx); if (var_info->Type == ImGuiDataType_Float && var_info->Count == 1) { - ImGuiContext& g = *GImGui; float* pvar = (float*)var_info->GetVarPtr(&g.Style); g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar)); *pvar = val; return; } - IM_ASSERT(0 && "Called PushStyleVar() float variant but variable is not a float!"); + IM_ASSERT_USER_ERROR(0, "Called PushStyleVar() variant with wrong type!"); } void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val) { - const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx); + ImGuiContext& g = *GImGui; + const ImGuiDataVarInfo* var_info = GetStyleVarInfo(idx); if (var_info->Type == ImGuiDataType_Float && var_info->Count == 2) { - ImGuiContext& g = *GImGui; ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style); g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar)); *pvar = val; return; } - IM_ASSERT(0 && "Called PushStyleVar() ImVec2 variant but variable is not a ImVec2!"); + IM_ASSERT_USER_ERROR(0, "Called PushStyleVar() variant with wrong type!"); } void ImGui::PopStyleVar(int count) @@ -3022,7 +3179,7 @@ void ImGui::PopStyleVar(int count) { // We avoid a generic memcpy(data, &backup.Backup.., GDataTypeSize[info->Type] * info->Count), the overhead in Debug is not worth it. ImGuiStyleMod& backup = g.StyleVarStack.back(); - const ImGuiStyleVarInfo* info = GetStyleVarInfo(backup.VarIdx); + const ImGuiDataVarInfo* info = GetStyleVarInfo(backup.VarIdx); void* data = info->GetVarPtr(&g.Style); if (info->Type == ImGuiDataType_Float && info->Count == 1) { ((float*)data)[0] = backup.BackupFloat[0]; } else if (info->Type == ImGuiDataType_Float && info->Count == 2) { ((float*)data)[0] = backup.BackupFloat[0]; ((float*)data)[1] = backup.BackupFloat[1]; } @@ -3159,6 +3316,9 @@ void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end // Default clip_rect uses (pos_min,pos_max) // Handle clipping on CPU immediately (vs typically let the GPU clip the triangles that are overlapping the clipping rectangle edges) +// FIXME-OPT: Since we have or calculate text_size we could coarse clip whole block immediately, especally for text above draw_list->DrawList. +// Effectively as this is called from widget doing their own coarse clipping it's not very valuable presently. Next time function will take +// better advantage of the render function taking size into account for coarse clipping. void ImGui::RenderTextClippedEx(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_display_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect) { // Perform CPU side clipping for single clipped element to avoid using scissor state @@ -3202,7 +3362,6 @@ void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, cons LogRenderedText(&pos_min, text, text_display_end); } - // Another overly complex function until we reorganize everything into a nice all-in-one helper. // This is made more complex because we have dissociated the layout rectangle (pos_min..pos_max) which define _where_ the ellipsis is, from actual clipping of text and limit of the ellipsis display. // This is because in the context of tabs we selectively hide part of the text when the Close Button appears, but we don't want the ellipsis to move. @@ -3226,30 +3385,12 @@ void ImGui::RenderTextEllipsis(ImDrawList* draw_list, const ImVec2& pos_min, con const ImFont* font = draw_list->_Data->Font; const float font_size = draw_list->_Data->FontSize; + const float font_scale = font_size / font->FontSize; const char* text_end_ellipsis = NULL; - - ImWchar ellipsis_char = font->EllipsisChar; - int ellipsis_char_count = 1; - if (ellipsis_char == (ImWchar)-1) - { - ellipsis_char = font->DotChar; - ellipsis_char_count = 3; - } - const ImFontGlyph* glyph = font->FindGlyph(ellipsis_char); - - float ellipsis_glyph_width = glyph->X1; // Width of the glyph with no padding on either side - float ellipsis_total_width = ellipsis_glyph_width; // Full width of entire ellipsis - - if (ellipsis_char_count > 1) - { - // Full ellipsis size without free spacing after it. - const float spacing_between_dots = 1.0f * (draw_list->_Data->FontSize / font->FontSize); - ellipsis_glyph_width = glyph->X1 - glyph->X0 + spacing_between_dots; - ellipsis_total_width = ellipsis_glyph_width * (float)ellipsis_char_count - spacing_between_dots; - } + const float ellipsis_width = font->EllipsisWidth * font_scale; // We can now claim the space between pos_max.x and ellipsis_max.x - const float text_avail_width = ImMax((ImMax(pos_max.x, ellipsis_max_x) - ellipsis_total_width) - pos_min.x, 1.0f); + const float text_avail_width = ImMax((ImMax(pos_max.x, ellipsis_max_x) - ellipsis_width) - pos_min.x, 1.0f); float text_size_clipped_x = font->CalcTextSizeA(font_size, text_avail_width, 0.0f, text, text_end_full, &text_end_ellipsis).x; if (text == text_end_ellipsis && text_end_ellipsis < text_end_full) { @@ -3266,13 +3407,10 @@ void ImGui::RenderTextEllipsis(ImDrawList* draw_list, const ImVec2& pos_min, con // Render text, render ellipsis RenderTextClippedEx(draw_list, pos_min, ImVec2(clip_max_x, pos_max.y), text, text_end_ellipsis, &text_size, ImVec2(0.0f, 0.0f)); - float ellipsis_x = pos_min.x + text_size_clipped_x; - if (ellipsis_x + ellipsis_total_width <= ellipsis_max_x) - for (int i = 0; i < ellipsis_char_count; i++) - { - font->RenderChar(draw_list, font_size, ImVec2(ellipsis_x, pos_min.y), GetColorU32(ImGuiCol_Text), ellipsis_char); - ellipsis_x += ellipsis_glyph_width; - } + ImVec2 ellipsis_pos = ImFloor(ImVec2(pos_min.x + text_size_clipped_x, pos_min.y)); + if (ellipsis_pos.x + ellipsis_width <= ellipsis_max_x) + for (int i = 0; i < font->EllipsisCharCount; i++, ellipsis_pos.x += font->EllipsisCharStep * font_scale) + font->RenderChar(draw_list, font_size, ellipsis_pos, GetColorU32(ImGuiCol_Text), font->EllipsisChar); } else { @@ -3345,162 +3483,396 @@ void ImGui::RenderMouseCursor(ImVec2 base_pos, float base_scale, ImGuiMouseCurso { ImGuiContext& g = *GImGui; IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT); - for (int n = 0; n < g.Viewports.Size; n++) + ImFontAtlas* font_atlas = g.DrawListSharedData.Font->ContainerAtlas; + for (ImGuiViewportP* viewport : g.Viewports) { - ImGuiViewportP* viewport = g.Viewports[n]; - ImDrawList* draw_list = GetForegroundDrawList(viewport); - ImFontAtlas* font_atlas = draw_list->_Data->Font->ContainerAtlas; + // We scale cursor with current viewport/monitor, however Windows 10 for its own hardware cursor seems to be using a different scale factor. ImVec2 offset, size, uv[4]; - if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2])) - { - const ImVec2 pos = base_pos - offset; - const float scale = base_scale; - ImTextureID tex_id = font_atlas->TexID; - draw_list->PushTextureID(tex_id); - draw_list->AddImage(tex_id, pos + ImVec2(1, 0) * scale, pos + (ImVec2(1, 0) + size) * scale, uv[2], uv[3], col_shadow); - draw_list->AddImage(tex_id, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv[2], uv[3], col_shadow); - draw_list->AddImage(tex_id, pos, pos + size * scale, uv[2], uv[3], col_border); - draw_list->AddImage(tex_id, pos, pos + size * scale, uv[0], uv[1], col_fill); - draw_list->PopTextureID(); - } + if (!font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2])) + continue; + const ImVec2 pos = base_pos - offset; + const float scale = base_scale; + if (!viewport->GetMainRect().Overlaps(ImRect(pos, pos + ImVec2(size.x + 2, size.y + 2) * scale))) + continue; + ImDrawList* draw_list = GetForegroundDrawList(viewport); + ImTextureID tex_id = font_atlas->TexID; + draw_list->PushTextureID(tex_id); + draw_list->AddImage(tex_id, pos + ImVec2(1, 0) * scale, pos + (ImVec2(1, 0) + size) * scale, uv[2], uv[3], col_shadow); + draw_list->AddImage(tex_id, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv[2], uv[3], col_shadow); + draw_list->AddImage(tex_id, pos, pos + size * scale, uv[2], uv[3], col_border); + draw_list->AddImage(tex_id, pos, pos + size * scale, uv[0], uv[1], col_fill); + draw_list->PopTextureID(); } } - //----------------------------------------------------------------------------- -// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!) +// [SECTION] INITIALIZATION, SHUTDOWN //----------------------------------------------------------------------------- -// ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods -ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name) : DrawListInst(NULL) +// Internal state access - if you want to share Dear ImGui state between modules (e.g. DLL) or allocate it yourself +// Note that we still point to some static data and members (such as GFontAtlas), so the state instance you end up using will point to the static data within its module +ImGuiContext* ImGui::GetCurrentContext() { - memset(this, 0, sizeof(*this)); - Name = ImStrdup(name); - NameBufLen = (int)strlen(name) + 1; - ID = ImHashStr(name); - IDStack.push_back(ID); - MoveId = GetID("#MOVE"); - ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); - ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f); - AutoFitFramesX = AutoFitFramesY = -1; - AutoPosLastDirection = ImGuiDir_None; - SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; - SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX); - LastFrameActive = -1; - LastTimeActive = -1.0f; - FontWindowScale = 1.0f; - SettingsOffset = -1; - DrawList = &DrawListInst; - DrawList->_Data = &context->DrawListSharedData; - DrawList->_OwnerName = Name; + return GImGui; } -ImGuiWindow::~ImGuiWindow() +void ImGui::SetCurrentContext(ImGuiContext* ctx) { - IM_ASSERT(DrawList == &DrawListInst); - IM_DELETE(Name); - ColumnsStorage.clear_destruct(); +#ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC + IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx); // For custom thread-based hackery you may want to have control over this. +#else + GImGui = ctx; +#endif } -ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end) +void ImGui::SetAllocatorFunctions(ImGuiMemAllocFunc alloc_func, ImGuiMemFreeFunc free_func, void* user_data) { - ImGuiID seed = IDStack.back(); - ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed); - ImGuiContext& g = *GImGui; - if (g.DebugHookIdInfo == id) - ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end); - return id; + GImAllocatorAllocFunc = alloc_func; + GImAllocatorFreeFunc = free_func; + GImAllocatorUserData = user_data; } -ImGuiID ImGuiWindow::GetID(const void* ptr) +// This is provided to facilitate copying allocators from one static/DLL boundary to another (e.g. retrieve default allocator of your executable address space) +void ImGui::GetAllocatorFunctions(ImGuiMemAllocFunc* p_alloc_func, ImGuiMemFreeFunc* p_free_func, void** p_user_data) { - ImGuiID seed = IDStack.back(); - ImGuiID id = ImHashData(&ptr, sizeof(void*), seed); - ImGuiContext& g = *GImGui; - if (g.DebugHookIdInfo == id) - ImGui::DebugHookIdInfo(id, ImGuiDataType_Pointer, ptr, NULL); - return id; + *p_alloc_func = GImAllocatorAllocFunc; + *p_free_func = GImAllocatorFreeFunc; + *p_user_data = GImAllocatorUserData; } -ImGuiID ImGuiWindow::GetID(int n) +ImGuiContext* ImGui::CreateContext(ImFontAtlas* shared_font_atlas) { - ImGuiID seed = IDStack.back(); - ImGuiID id = ImHashData(&n, sizeof(n), seed); - ImGuiContext& g = *GImGui; - if (g.DebugHookIdInfo == id) - ImGui::DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL); - return id; + ImGuiContext* prev_ctx = GetCurrentContext(); + ImGuiContext* ctx = IM_NEW(ImGuiContext)(shared_font_atlas); + SetCurrentContext(ctx); + Initialize(); + if (prev_ctx != NULL) + SetCurrentContext(prev_ctx); // Restore previous context if any, else keep new one. + return ctx; } -// This is only used in rare/specific situations to manufacture an ID out of nowhere. -ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs) +void ImGui::DestroyContext(ImGuiContext* ctx) { - ImGuiID seed = IDStack.back(); - ImRect r_rel = ImGui::WindowRectAbsToRel(this, r_abs); - ImGuiID id = ImHashData(&r_rel, sizeof(r_rel), seed); - return id; + ImGuiContext* prev_ctx = GetCurrentContext(); + if (ctx == NULL) //-V1051 + ctx = prev_ctx; + SetCurrentContext(ctx); + Shutdown(); + SetCurrentContext((prev_ctx != ctx) ? prev_ctx : NULL); + IM_DELETE(ctx); } -static void SetCurrentWindow(ImGuiWindow* window) +// IMPORTANT: ###xxx suffixes must be same in ALL languages +static const ImGuiLocEntry GLocalizationEntriesEnUS[] = { - ImGuiContext& g = *GImGui; - g.CurrentWindow = window; - g.CurrentTable = window && window->DC.CurrentTableIdx != -1 ? g.Tables.GetByIndex(window->DC.CurrentTableIdx) : NULL; - if (window) - g.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize(); -} + { ImGuiLocKey_VersionStr, "Dear ImGui " IMGUI_VERSION " (" IM_STRINGIFY(IMGUI_VERSION_NUM) ")" }, + { ImGuiLocKey_TableSizeOne, "Size column to fit###SizeOne" }, + { ImGuiLocKey_TableSizeAllFit, "Size all columns to fit###SizeAll" }, + { ImGuiLocKey_TableSizeAllDefault, "Size all columns to default###SizeAll" }, + { ImGuiLocKey_TableResetOrder, "Reset order###ResetOrder" }, + { ImGuiLocKey_WindowingMainMenuBar, "(Main menu bar)" }, + { ImGuiLocKey_WindowingPopup, "(Popup)" }, + { ImGuiLocKey_WindowingUntitled, "(Untitled)" }, +}; -void ImGui::GcCompactTransientMiscBuffers() +void ImGui::Initialize() { ImGuiContext& g = *GImGui; - g.ItemFlagsStack.clear(); - g.GroupStack.clear(); - TableGcCompactSettings(); -} + IM_ASSERT(!g.Initialized && !g.SettingsLoaded); -// Free up/compact internal window buffers, we can use this when a window becomes unused. -// Not freed: -// - ImGuiWindow, ImGuiWindowSettings, Name, StateStorage, ColumnsStorage (may hold useful data) -// This should have no noticeable visual effect. When the window reappear however, expect new allocation/buffer growth/copy cost. -void ImGui::GcCompactTransientWindowBuffers(ImGuiWindow* window) -{ - window->MemoryCompacted = true; - window->MemoryDrawListIdxCapacity = window->DrawList->IdxBuffer.Capacity; - window->MemoryDrawListVtxCapacity = window->DrawList->VtxBuffer.Capacity; - window->IDStack.clear(); - window->DrawList->_ClearFreeMemory(); - window->DC.ChildWindows.clear(); - window->DC.ItemWidthStack.clear(); - window->DC.TextWrapPosStack.clear(); -} + // Add .ini handle for ImGuiWindow and ImGuiTable types + { + ImGuiSettingsHandler ini_handler; + ini_handler.TypeName = "Window"; + ini_handler.TypeHash = ImHashStr("Window"); + ini_handler.ClearAllFn = WindowSettingsHandler_ClearAll; + ini_handler.ReadOpenFn = WindowSettingsHandler_ReadOpen; + ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine; + ini_handler.ApplyAllFn = WindowSettingsHandler_ApplyAll; + ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll; + AddSettingsHandler(&ini_handler); + } + TableSettingsAddSettingsHandler(); -void ImGui::GcAwakeTransientWindowBuffers(ImGuiWindow* window) -{ - // We stored capacity of the ImDrawList buffer to reduce growth-caused allocation/copy when awakening. - // The other buffers tends to amortize much faster. - window->MemoryCompacted = false; - window->DrawList->IdxBuffer.reserve(window->MemoryDrawListIdxCapacity); - window->DrawList->VtxBuffer.reserve(window->MemoryDrawListVtxCapacity); - window->MemoryDrawListIdxCapacity = window->MemoryDrawListVtxCapacity = 0; -} + // Setup default localization table + LocalizeRegisterEntries(GLocalizationEntriesEnUS, IM_ARRAYSIZE(GLocalizationEntriesEnUS)); -void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window) -{ - ImGuiContext& g = *GImGui; + // Setup default platform clipboard/IME handlers. + g.IO.GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations + g.IO.SetClipboardTextFn = SetClipboardTextFn_DefaultImpl; + g.IO.ClipboardUserData = (void*)&g; // Default implementation use the ImGuiContext as user data (ideally those would be arguments to the function) + g.IO.SetPlatformImeDataFn = SetPlatformImeDataFn_DefaultImpl; - // While most behaved code would make an effort to not steal active id during window move/drag operations, - // we at least need to be resilient to it. Cancelling the move is rather aggressive and users of 'master' branch - // may prefer the weird ill-defined half working situation ('docking' did assert), so may need to rework that. - if (g.MovingWindow != NULL && g.ActiveId == g.MovingWindow->MoveId) - { - IMGUI_DEBUG_LOG_ACTIVEID("SetActiveID() cancel MovingWindow\n"); - g.MovingWindow = NULL; - } + // Create default viewport + ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)(); + g.Viewports.push_back(viewport); + g.TempBuffer.resize(1024 * 3 + 1, 0); - // Set active id - g.ActiveIdIsJustActivated = (g.ActiveId != id); - if (g.ActiveIdIsJustActivated) - { +#ifdef IMGUI_HAS_DOCK +#endif + + g.Initialized = true; +} + +// This function is merely here to free heap allocations. +void ImGui::Shutdown() +{ + // The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame) + ImGuiContext& g = *GImGui; + if (g.IO.Fonts && g.FontAtlasOwnedByContext) + { + g.IO.Fonts->Locked = false; + IM_DELETE(g.IO.Fonts); + } + g.IO.Fonts = NULL; + g.DrawListSharedData.TempBuffer.clear(); + + // Cleanup of other data are conditional on actually having initialized Dear ImGui. + if (!g.Initialized) + return; + + // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) + if (g.SettingsLoaded && g.IO.IniFilename != NULL) + SaveIniSettingsToDisk(g.IO.IniFilename); + + CallContextHooks(&g, ImGuiContextHookType_Shutdown); + + // Clear everything else + g.Windows.clear_delete(); + g.WindowsFocusOrder.clear(); + g.WindowsTempSortBuffer.clear(); + g.CurrentWindow = NULL; + g.CurrentWindowStack.clear(); + g.WindowsById.Clear(); + g.NavWindow = NULL; + g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; + g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL; + g.MovingWindow = NULL; + + g.KeysRoutingTable.Clear(); + + g.ColorStack.clear(); + g.StyleVarStack.clear(); + g.FontStack.clear(); + g.OpenPopupStack.clear(); + g.BeginPopupStack.clear(); + g.NavTreeNodeStack.clear(); + + g.Viewports.clear_delete(); + + g.TabBars.Clear(); + g.CurrentTabBarStack.clear(); + g.ShrinkWidthBuffer.clear(); + + g.ClipperTempData.clear_destruct(); + + g.Tables.Clear(); + g.TablesTempData.clear_destruct(); + g.DrawChannelsTempMergeBuffer.clear(); + + g.ClipboardHandlerData.clear(); + g.MenusIdSubmittedThisFrame.clear(); + g.InputTextState.ClearFreeMemory(); + g.InputTextDeactivatedState.ClearFreeMemory(); + + g.SettingsWindows.clear(); + g.SettingsHandlers.clear(); + + if (g.LogFile) + { +#ifndef IMGUI_DISABLE_TTY_FUNCTIONS + if (g.LogFile != stdout) +#endif + ImFileClose(g.LogFile); + g.LogFile = NULL; + } + g.LogBuffer.clear(); + g.DebugLogBuf.clear(); + g.DebugLogIndex.clear(); + + g.Initialized = false; +} + +// No specific ordering/dependency support, will see as needed +ImGuiID ImGui::AddContextHook(ImGuiContext* ctx, const ImGuiContextHook* hook) +{ + ImGuiContext& g = *ctx; + IM_ASSERT(hook->Callback != NULL && hook->HookId == 0 && hook->Type != ImGuiContextHookType_PendingRemoval_); + g.Hooks.push_back(*hook); + g.Hooks.back().HookId = ++g.HookIdNext; + return g.HookIdNext; +} + +// Deferred removal, avoiding issue with changing vector while iterating it +void ImGui::RemoveContextHook(ImGuiContext* ctx, ImGuiID hook_id) +{ + ImGuiContext& g = *ctx; + IM_ASSERT(hook_id != 0); + for (ImGuiContextHook& hook : g.Hooks) + if (hook.HookId == hook_id) + hook.Type = ImGuiContextHookType_PendingRemoval_; +} + +// Call context hooks (used by e.g. test engine) +// We assume a small number of hooks so all stored in same array +void ImGui::CallContextHooks(ImGuiContext* ctx, ImGuiContextHookType hook_type) +{ + ImGuiContext& g = *ctx; + for (ImGuiContextHook& hook : g.Hooks) + if (hook.Type == hook_type) + hook.Callback(&g, &hook); +} + + +//----------------------------------------------------------------------------- +// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!) +//----------------------------------------------------------------------------- + +// ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods +ImGuiWindow::ImGuiWindow(ImGuiContext* ctx, const char* name) : DrawListInst(NULL) +{ + memset(this, 0, sizeof(*this)); + Ctx = ctx; + Name = ImStrdup(name); + NameBufLen = (int)strlen(name) + 1; + ID = ImHashStr(name); + IDStack.push_back(ID); + MoveId = GetID("#MOVE"); + ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); + ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f); + AutoFitFramesX = AutoFitFramesY = -1; + AutoPosLastDirection = ImGuiDir_None; + SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = 0; + SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX); + LastFrameActive = -1; + LastTimeActive = -1.0f; + FontWindowScale = 1.0f; + SettingsOffset = -1; + DrawList = &DrawListInst; + DrawList->_Data = &Ctx->DrawListSharedData; + DrawList->_OwnerName = Name; + NavPreferredScoringPosRel[0] = NavPreferredScoringPosRel[1] = ImVec2(FLT_MAX, FLT_MAX); +} + +ImGuiWindow::~ImGuiWindow() +{ + IM_ASSERT(DrawList == &DrawListInst); + IM_DELETE(Name); + ColumnsStorage.clear_destruct(); +} + +ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end) +{ + ImGuiID seed = IDStack.back(); + ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed); + ImGuiContext& g = *Ctx; + if (g.DebugHookIdInfo == id) + ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end); + return id; +} + +ImGuiID ImGuiWindow::GetID(const void* ptr) +{ + ImGuiID seed = IDStack.back(); + ImGuiID id = ImHashData(&ptr, sizeof(void*), seed); + ImGuiContext& g = *Ctx; + if (g.DebugHookIdInfo == id) + ImGui::DebugHookIdInfo(id, ImGuiDataType_Pointer, ptr, NULL); + return id; +} + +ImGuiID ImGuiWindow::GetID(int n) +{ + ImGuiID seed = IDStack.back(); + ImGuiID id = ImHashData(&n, sizeof(n), seed); + ImGuiContext& g = *Ctx; + if (g.DebugHookIdInfo == id) + ImGui::DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL); + return id; +} + +// This is only used in rare/specific situations to manufacture an ID out of nowhere. +ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs) +{ + ImGuiID seed = IDStack.back(); + ImRect r_rel = ImGui::WindowRectAbsToRel(this, r_abs); + ImGuiID id = ImHashData(&r_rel, sizeof(r_rel), seed); + return id; +} + +static void SetCurrentWindow(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + g.CurrentWindow = window; + g.CurrentTable = window && window->DC.CurrentTableIdx != -1 ? g.Tables.GetByIndex(window->DC.CurrentTableIdx) : NULL; + if (window) + { + g.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize(); + ImGui::NavUpdateCurrentWindowIsScrollPushableX(); + } +} + +void ImGui::GcCompactTransientMiscBuffers() +{ + ImGuiContext& g = *GImGui; + g.ItemFlagsStack.clear(); + g.GroupStack.clear(); + TableGcCompactSettings(); +} + +// Free up/compact internal window buffers, we can use this when a window becomes unused. +// Not freed: +// - ImGuiWindow, ImGuiWindowSettings, Name, StateStorage, ColumnsStorage (may hold useful data) +// This should have no noticeable visual effect. When the window reappear however, expect new allocation/buffer growth/copy cost. +void ImGui::GcCompactTransientWindowBuffers(ImGuiWindow* window) +{ + window->MemoryCompacted = true; + window->MemoryDrawListIdxCapacity = window->DrawList->IdxBuffer.Capacity; + window->MemoryDrawListVtxCapacity = window->DrawList->VtxBuffer.Capacity; + window->IDStack.clear(); + window->DrawList->_ClearFreeMemory(); + window->DC.ChildWindows.clear(); + window->DC.ItemWidthStack.clear(); + window->DC.TextWrapPosStack.clear(); +} + +void ImGui::GcAwakeTransientWindowBuffers(ImGuiWindow* window) +{ + // We stored capacity of the ImDrawList buffer to reduce growth-caused allocation/copy when awakening. + // The other buffers tends to amortize much faster. + window->MemoryCompacted = false; + window->DrawList->IdxBuffer.reserve(window->MemoryDrawListIdxCapacity); + window->DrawList->VtxBuffer.reserve(window->MemoryDrawListVtxCapacity); + window->MemoryDrawListIdxCapacity = window->MemoryDrawListVtxCapacity = 0; +} + +void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + + // Clear previous active id + if (g.ActiveId != 0) + { + // While most behaved code would make an effort to not steal active id during window move/drag operations, + // we at least need to be resilient to it. Canceling the move is rather aggressive and users of 'master' branch + // may prefer the weird ill-defined half working situation ('docking' did assert), so may need to rework that. + if (g.MovingWindow != NULL && g.ActiveId == g.MovingWindow->MoveId) + { + IMGUI_DEBUG_LOG_ACTIVEID("SetActiveID() cancel MovingWindow\n"); + g.MovingWindow = NULL; + } + + // This could be written in a more general way (e.g associate a hook to ActiveId), + // but since this is currently quite an exception we'll leave it as is. + // One common scenario leading to this is: pressing Key ->NavMoveRequestApplyResult() -> ClearActiveId() + if (g.InputTextState.ID == g.ActiveId) + InputTextDeactivateHook(g.ActiveId); + } + + // Set active id + g.ActiveIdIsJustActivated = (g.ActiveId != id); + if (g.ActiveIdIsJustActivated) + { IMGUI_DEBUG_LOG_ACTIVEID("SetActiveID() old:0x%08X (window \"%s\") -> new:0x%08X (window \"%s\")\n", g.ActiveId, g.ActiveIdWindow ? g.ActiveIdWindow->Name : "", id, window ? window->Name : ""); g.ActiveIdTimer = 0.0f; g.ActiveIdHasBeenPressedBefore = false; @@ -3520,13 +3892,14 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window) if (id) { g.ActiveIdIsAlive = id; - g.ActiveIdSource = (g.NavActivateId == id || g.NavActivateInputId == id || g.NavJustMovedToId == id) ? (ImGuiInputSource)ImGuiInputSource_Nav : ImGuiInputSource_Mouse; + g.ActiveIdSource = (g.NavActivateId == id || g.NavJustMovedToId == id) ? g.NavInputSource : ImGuiInputSource_Mouse; + IM_ASSERT(g.ActiveIdSource != ImGuiInputSource_None); } // Clear declaration of inputs claimed by the widget // (Please note that this is WIP and not all keys/inputs are thoroughly declared by all widgets yet) g.ActiveIdUsingNavDirMask = 0x00; - g.ActiveIdUsingKeyInputMask.ClearAllBits(); + g.ActiveIdUsingAllKeyboardKeys = false; #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO g.ActiveIdUsingNavInputMask = 0x00; #endif @@ -3542,7 +3915,6 @@ void ImGui::SetHoveredID(ImGuiID id) ImGuiContext& g = *GImGui; g.HoveredId = id; g.HoveredIdAllowOverlap = false; - g.HoveredIdUsingMouseWheel = false; if (id != 0 && g.HoveredIdPreviousFrame != id) g.HoveredIdTimer = g.HoveredIdNotActiveTimer = 0.0f; } @@ -3569,15 +3941,23 @@ void ImGui::MarkItemEdited(ImGuiID id) // This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit(). // ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need to fill the data. ImGuiContext& g = *GImGui; - IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive); - IM_UNUSED(id); // Avoid unused variable warnings when asserts are compiled out. + if (g.LockMarkEdited > 0) + return; + if (g.ActiveId == id || g.ActiveId == 0) + { + g.ActiveIdHasBeenEditedThisFrame = true; + g.ActiveIdHasBeenEditedBefore = true; + } + + // We accept a MarkItemEdited() on drag and drop targets (see https://github.com/ocornut/imgui/issues/1875#issuecomment-978243343) + // We accept 'ActiveIdPreviousFrame == id' for InputText() returning an edit after it has been taken ActiveId away (#4714) + IM_ASSERT(g.DragDropActive || g.ActiveId == id || g.ActiveId == 0 || g.ActiveIdPreviousFrame == id); + //IM_ASSERT(g.CurrentWindow->DC.LastItemId == id); - g.ActiveIdHasBeenEditedThisFrame = true; - g.ActiveIdHasBeenEditedBefore = true; g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_Edited; } -static inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags) +bool ImGui::IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags) { // An active popup disable hovering on other windows (apart from its own children) // FIXME-OPT: This could be cached/stored within the window. @@ -3596,12 +3976,22 @@ static inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFla // Inhibit hover unless the window is within the stack of our modal/popup if (want_inhibit) - if (!ImGui::IsWindowWithinBeginStackOf(window->RootWindow, focused_root_window)) + if (!IsWindowWithinBeginStackOf(window->RootWindow, focused_root_window)) return false; } return true; } +static inline float CalcDelayFromHoveredFlags(ImGuiHoveredFlags flags) +{ + ImGuiContext& g = *GImGui; + if (flags & ImGuiHoveredFlags_DelayShort) + return g.Style.HoverDelayShort; + if (flags & ImGuiHoveredFlags_DelayNormal) + return g.Style.HoverDelayNormal; + return 0.0f; +} + // This is roughly matching the behavior of internal-facing ItemHoverable() // - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered() // - this should work even for non-interactive items that have no ID, so we cannot use LastItemId @@ -3609,12 +3999,17 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; + IM_ASSERT((flags & ~ImGuiHoveredFlags_AllowedMaskForIsItemHovered) == 0 && "Invalid flags for IsItemHovered()!"); + if (g.NavDisableMouseHover && !g.NavDisableHighlight && !(flags & ImGuiHoveredFlags_NoNavOverride)) { if ((g.LastItemData.InFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled)) return false; if (!IsItemFocused()) return false; + + if (flags & ImGuiHoveredFlags_ForTooltip) + flags |= g.Style.HoverFlagsForTooltipNav; } else { @@ -3622,6 +4017,10 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) ImGuiItemStatusFlags status_flags = g.LastItemData.StatusFlags; if (!(status_flags & ImGuiItemStatusFlags_HoveredRect)) return false; + + if (flags & ImGuiHoveredFlags_ForTooltip) + flags |= g.Style.HoverFlagsForTooltipMouse; + IM_ASSERT((flags & (ImGuiHoveredFlags_AnyWindow | ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_NoPopupHierarchy)) == 0); // Flags not supported by this function // Done with rectangle culling so we can perform heavier checks now @@ -3631,17 +4030,18 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) // to use IsItemHovered() after EndChild() itself. Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was // the test that has been running for a long while. if (g.HoveredWindow != window && (status_flags & ImGuiItemStatusFlags_HoveredWindow) == 0) - if ((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0) + if ((flags & ImGuiHoveredFlags_AllowWhenOverlappedByWindow) == 0) return false; // Test if another item is active (e.g. being dragged) + const ImGuiID id = g.LastItemData.ID; if ((flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) == 0) - if (g.ActiveId != 0 && g.ActiveId != g.LastItemData.ID && !g.ActiveIdAllowOverlap && g.ActiveId != window->MoveId) + if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap && g.ActiveId != window->MoveId) return false; // Test if interactions on this window are blocked by an active popup or modal. // The ImGuiHoveredFlags_AllowWhenBlockedByPopup flag will be tested here. - if (!IsWindowContentHoverable(window, flags)) + if (!IsWindowContentHoverable(window, flags) && !(g.LastItemData.InFlags & ImGuiItemFlags_NoWindowHoverableCheck)) return false; // Test if the item is disabled @@ -3649,49 +4049,61 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) return false; // Special handling for calling after Begin() which represent the title bar or tab. - // When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case. - if (g.LastItemData.ID == window->MoveId && window->WriteAccessed) + // When the window is skipped/collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case. + if (id == window->MoveId && window->WriteAccessed) return false; + + // Test if using AllowOverlap and overlapped + if ((g.LastItemData.InFlags & ImGuiItemFlags_AllowOverlap) && id != 0) + if ((flags & ImGuiHoveredFlags_AllowWhenOverlappedByItem) == 0) + if (g.HoveredIdPreviousFrame != g.LastItemData.ID) + return false; } // Handle hover delay // (some ideas: https://www.nngroup.com/articles/timing-exposing-content) - float delay; - if (flags & ImGuiHoveredFlags_DelayNormal) - delay = g.IO.HoverDelayNormal; - else if (flags & ImGuiHoveredFlags_DelayShort) - delay = g.IO.HoverDelayShort; - else - delay = 0.0f; - if (delay > 0.0f) + const float delay = CalcDelayFromHoveredFlags(flags); + if (delay > 0.0f || (flags & ImGuiHoveredFlags_Stationary)) { ImGuiID hover_delay_id = (g.LastItemData.ID != 0) ? g.LastItemData.ID : window->GetIDFromRectangle(g.LastItemData.Rect); - if ((flags & ImGuiHoveredFlags_NoSharedDelay) && (g.HoverDelayIdPreviousFrame != hover_delay_id)) - g.HoverDelayTimer = 0.0f; - g.HoverDelayId = hover_delay_id; - return g.HoverDelayTimer >= delay; + if ((flags & ImGuiHoveredFlags_NoSharedDelay) && (g.HoverItemDelayIdPreviousFrame != hover_delay_id)) + g.HoverItemDelayTimer = 0.0f; + g.HoverItemDelayId = hover_delay_id; + + // When changing hovered item we requires a bit of stationary delay before activating hover timer, + // but once unlocked on a given item we also moving. + //if (g.HoverDelayTimer >= delay && (g.HoverDelayTimer - g.IO.DeltaTime < delay || g.MouseStationaryTimer - g.IO.DeltaTime < g.Style.HoverStationaryDelay)) { IMGUI_DEBUG_LOG("HoverDelayTimer = %f/%f, MouseStationaryTimer = %f\n", g.HoverDelayTimer, delay, g.MouseStationaryTimer); } + if ((flags & ImGuiHoveredFlags_Stationary) != 0 && g.HoverItemUnlockedStationaryId != hover_delay_id) + return false; + + if (g.HoverItemDelayTimer < delay) + return false; } return true; } // Internal facing ItemHoverable() used when submitting widgets. Differs slightly from IsItemHovered(). -bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id) +// (this does not rely on LastItemData it can be called from a ButtonBehavior() call not following an ItemAdd() call) +// FIXME-LEGACY: the 'ImGuiItemFlags item_flags' parameter was added on 2023-06-28. +// If you used this in your legacy/custom widgets code: +// - Commonly: if your ItemHoverable() call comes after an ItemAdd() call: pass 'item_flags = g.LastItemData.InFlags'. +// - Rare: otherwise you may pass 'item_flags = 0' (ImGuiItemFlags_None) unless you want to benefit from special behavior handled by ItemHoverable. +bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flags) { ImGuiContext& g = *GImGui; - if (g.HoveredId != 0 && g.HoveredId != id && !g.HoveredIdAllowOverlap) - return false; - ImGuiWindow* window = g.CurrentWindow; if (g.HoveredWindow != window) return false; - if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap) - return false; if (!IsMouseHoveringRect(bb.Min, bb.Max)) return false; + if (g.HoveredId != 0 && g.HoveredId != id && !g.HoveredIdAllowOverlap) + return false; + if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap) + return false; + // Done with rectangle culling so we can perform heavier checks now. - ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.InFlags : g.CurrentItemFlags); if (!(item_flags & ImGuiItemFlags_NoWindowHoverableCheck) && !IsWindowContentHoverable(window, ImGuiHoveredFlags_None)) { g.HoveredIdDisabled = true; @@ -3701,13 +4113,28 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id) // We exceptionally allow this function to be called with id==0 to allow using it for easy high-level // hover test in widgets code. We could also decide to split this function is two. if (id != 0) + { + // Drag source doesn't report as hovered + if (g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover)) + return false; + SetHoveredID(id); + // AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. + // This allows using patterns where a later submitted widget overlaps a previous one. Generally perceived as a front-to-back hit-test. + if (item_flags & ImGuiItemFlags_AllowOverlap) + { + g.HoveredIdAllowOverlap = true; + if (g.HoveredIdPreviousFrame != id) + return false; + } + } + // When disabled we'll return false but still set HoveredId if (item_flags & ImGuiItemFlags_Disabled) { // Release active id if turning disabled - if (g.ActiveId == id) + if (g.ActiveId == id && id != 0) ClearActiveID(); g.HoveredIdDisabled = true; return false; @@ -3718,8 +4145,7 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id) // [DEBUG] Item Picker tool! // We perform the check here because SetHoveredID() is not frequently called (1~ time a frame), making // the cost of this tool near-zero. We can get slightly better call-stack and support picking non-hovered - // items if we perform the test in ItemAdd(), but that would incur a small runtime cost. - // #define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX in imconfig.h if you want this check to also be performed in ItemAdd(). + // items if we performed the test in ItemAdd(), but that would incur a small runtime cost. if (g.DebugItemPickerActive && g.HoveredIdPreviousFrame == id) GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255)); if (g.DebugItemPickerBreakId == id) @@ -3732,6 +4158,7 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id) return true; } +// FIXME: This is inlined/duplicated in ItemAdd() bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id) { ImGuiContext& g = *GImGui; @@ -3744,14 +4171,14 @@ bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id) } // This is also inlined in ItemAdd() -// Note: if ImGuiItemStatusFlags_HasDisplayRect is set, user needs to set window->DC.LastItemDisplayRect! +// Note: if ImGuiItemStatusFlags_HasDisplayRect is set, user needs to set g.LastItemData.DisplayRect. void ImGui::SetLastItemData(ImGuiID item_id, ImGuiItemFlags in_flags, ImGuiItemStatusFlags item_flags, const ImRect& item_rect) { ImGuiContext& g = *GImGui; g.LastItemData.ID = item_id; g.LastItemData.InFlags = in_flags; g.LastItemData.StatusFlags = item_flags; - g.LastItemData.Rect = item_rect; + g.LastItemData.Rect = g.LastItemData.NavRect = item_rect; } float ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x) @@ -3813,89 +4240,6 @@ const char* ImGui::GetVersion() return IMGUI_VERSION; } -// Internal state access - if you want to share Dear ImGui state between modules (e.g. DLL) or allocate it yourself -// Note that we still point to some static data and members (such as GFontAtlas), so the state instance you end up using will point to the static data within its module -ImGuiContext* ImGui::GetCurrentContext() -{ - return GImGui; -} - -void ImGui::SetCurrentContext(ImGuiContext* ctx) -{ -#ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC - IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx); // For custom thread-based hackery you may want to have control over this. -#else - GImGui = ctx; -#endif -} - -void ImGui::SetAllocatorFunctions(ImGuiMemAllocFunc alloc_func, ImGuiMemFreeFunc free_func, void* user_data) -{ - GImAllocatorAllocFunc = alloc_func; - GImAllocatorFreeFunc = free_func; - GImAllocatorUserData = user_data; -} - -// This is provided to facilitate copying allocators from one static/DLL boundary to another (e.g. retrieve default allocator of your executable address space) -void ImGui::GetAllocatorFunctions(ImGuiMemAllocFunc* p_alloc_func, ImGuiMemFreeFunc* p_free_func, void** p_user_data) -{ - *p_alloc_func = GImAllocatorAllocFunc; - *p_free_func = GImAllocatorFreeFunc; - *p_user_data = GImAllocatorUserData; -} - -ImGuiContext* ImGui::CreateContext(ImFontAtlas* shared_font_atlas) -{ - ImGuiContext* prev_ctx = GetCurrentContext(); - ImGuiContext* ctx = IM_NEW(ImGuiContext)(shared_font_atlas); - SetCurrentContext(ctx); - Initialize(); - if (prev_ctx != NULL) - SetCurrentContext(prev_ctx); // Restore previous context if any, else keep new one. - return ctx; -} - -void ImGui::DestroyContext(ImGuiContext* ctx) -{ - ImGuiContext* prev_ctx = GetCurrentContext(); - if (ctx == NULL) //-V1051 - ctx = prev_ctx; - SetCurrentContext(ctx); - Shutdown(); - SetCurrentContext((prev_ctx != ctx) ? prev_ctx : NULL); - IM_DELETE(ctx); -} - -// No specific ordering/dependency support, will see as needed -ImGuiID ImGui::AddContextHook(ImGuiContext* ctx, const ImGuiContextHook* hook) -{ - ImGuiContext& g = *ctx; - IM_ASSERT(hook->Callback != NULL && hook->HookId == 0 && hook->Type != ImGuiContextHookType_PendingRemoval_); - g.Hooks.push_back(*hook); - g.Hooks.back().HookId = ++g.HookIdNext; - return g.HookIdNext; -} - -// Deferred removal, avoiding issue with changing vector while iterating it -void ImGui::RemoveContextHook(ImGuiContext* ctx, ImGuiID hook_id) -{ - ImGuiContext& g = *ctx; - IM_ASSERT(hook_id != 0); - for (int n = 0; n < g.Hooks.Size; n++) - if (g.Hooks[n].HookId == hook_id) - g.Hooks[n].Type = ImGuiContextHookType_PendingRemoval_; -} - -// Call context hooks (used by e.g. test engine) -// We assume a small number of hooks so all stored in same array -void ImGui::CallContextHooks(ImGuiContext* ctx, ImGuiContextHookType hook_type) -{ - ImGuiContext& g = *ctx; - for (int n = 0; n < g.Hooks.Size; n++) - if (g.Hooks[n].Type == hook_type) - g.Hooks[n].Callback(&g, &g.Hooks[n]); -} - ImGuiIO& ImGui::GetIO() { IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?"); @@ -3920,33 +4264,33 @@ int ImGui::GetFrameCount() return GImGui->FrameCount; } -static ImDrawList* GetViewportDrawList(ImGuiViewportP* viewport, size_t drawlist_no, const char* drawlist_name) +static ImDrawList* GetViewportBgFgDrawList(ImGuiViewportP* viewport, size_t drawlist_no, const char* drawlist_name) { // Create the draw list on demand, because they are not frequently used for all viewports ImGuiContext& g = *GImGui; - IM_ASSERT(drawlist_no < IM_ARRAYSIZE(viewport->DrawLists)); - ImDrawList* draw_list = viewport->DrawLists[drawlist_no]; + IM_ASSERT(drawlist_no < IM_ARRAYSIZE(viewport->BgFgDrawLists)); + ImDrawList* draw_list = viewport->BgFgDrawLists[drawlist_no]; if (draw_list == NULL) { draw_list = IM_NEW(ImDrawList)(&g.DrawListSharedData); draw_list->_OwnerName = drawlist_name; - viewport->DrawLists[drawlist_no] = draw_list; + viewport->BgFgDrawLists[drawlist_no] = draw_list; } // Our ImDrawList system requires that there is always a command - if (viewport->DrawListsLastFrame[drawlist_no] != g.FrameCount) + if (viewport->BgFgDrawListsLastFrame[drawlist_no] != g.FrameCount) { draw_list->_ResetForNewFrame(); draw_list->PushTextureID(g.IO.Fonts->TexID); draw_list->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size, false); - viewport->DrawListsLastFrame[drawlist_no] = g.FrameCount; + viewport->BgFgDrawListsLastFrame[drawlist_no] = g.FrameCount; } return draw_list; } ImDrawList* ImGui::GetBackgroundDrawList(ImGuiViewport* viewport) { - return GetViewportDrawList((ImGuiViewportP*)viewport, 0, "##Background"); + return GetViewportBgFgDrawList((ImGuiViewportP*)viewport, 0, "##Background"); } ImDrawList* ImGui::GetBackgroundDrawList() @@ -3957,7 +4301,7 @@ ImDrawList* ImGui::GetBackgroundDrawList() ImDrawList* ImGui::GetForegroundDrawList(ImGuiViewport* viewport) { - return GetViewportDrawList((ImGuiViewportP*)viewport, 1, "##Foreground"); + return GetViewportBgFgDrawList((ImGuiViewportP*)viewport, 1, "##Foreground"); } ImDrawList* ImGui::GetForegroundDrawList() @@ -4064,10 +4408,10 @@ void ImGui::UpdateMouseMovingWindowEndFrame() if (g.HoveredIdDisabled) g.MovingWindow = NULL; } - else if (root_window == NULL && g.NavWindow != NULL && GetTopMostPopupModal() == NULL) + else if (root_window == NULL && g.NavWindow != NULL) { // Clicking on void disable focus - FocusWindow(NULL); + FocusWindow(NULL, ImGuiFocusRequestFlags_UnlessBelowModal); } } @@ -4089,367 +4433,86 @@ static bool IsWindowActiveAndVisible(ImGuiWindow* window) return (window->Active) && (!window->Hidden); } -static void UpdateAliasKey(ImGuiKey key, bool v, float analog_value) -{ - IM_ASSERT(ImGui::IsAliasKey(key)); - ImGuiKeyData* key_data = ImGui::GetKeyData(key); - key_data->Down = v; - key_data->AnalogValue = analog_value; -} - -// [Internal] Do not use directly (should read io.KeyMods instead) -static ImGuiKeyChord GetMergedModsFromBools() -{ - ImGuiContext& g = *GImGui; - ImGuiKeyChord key_chord = 0; - if (g.IO.KeyCtrl) { key_chord |= ImGuiMod_Ctrl; } - if (g.IO.KeyShift) { key_chord |= ImGuiMod_Shift; } - if (g.IO.KeyAlt) { key_chord |= ImGuiMod_Alt; } - if (g.IO.KeySuper) { key_chord |= ImGuiMod_Super; } - return key_chord; -} - -static void ImGui::UpdateKeyboardInputs() +// The reason this is exposed in imgui_internal.h is: on touch-based system that don't have hovering, we want to dispatch inputs to the right target (imgui vs imgui+app) +void ImGui::UpdateHoveredWindowAndCaptureFlags() { ImGuiContext& g = *GImGui; ImGuiIO& io = g.IO; + g.WindowsHoverPadding = ImMax(g.Style.TouchExtraPadding, ImVec2(WINDOWS_HOVER_PADDING, WINDOWS_HOVER_PADDING)); - // Import legacy keys or verify they are not used -#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO - if (io.BackendUsingLegacyKeyArrays == 0) - { - // Backend used new io.AddKeyEvent() API: Good! Verify that old arrays are never written to externally. - for (int n = 0; n < ImGuiKey_LegacyNativeKey_END; n++) - IM_ASSERT((io.KeysDown[n] == false || IsKeyDown((ImGuiKey)n)) && "Backend needs to either only use io.AddKeyEvent(), either only fill legacy io.KeysDown[] + io.KeyMap[]. Not both!"); - } - else - { - if (g.FrameCount == 0) - for (int n = ImGuiKey_LegacyNativeKey_BEGIN; n < ImGuiKey_LegacyNativeKey_END; n++) - IM_ASSERT(g.IO.KeyMap[n] == -1 && "Backend is not allowed to write to io.KeyMap[0..511]!"); + // Find the window hovered by mouse: + // - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow. + // - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point of the frame. + // - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms. + bool clear_hovered_windows = false; + FindHoveredWindow(); - // Build reverse KeyMap (Named -> Legacy) - for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_NamedKey_END; n++) - if (io.KeyMap[n] != -1) - { - IM_ASSERT(IsLegacyKey((ImGuiKey)io.KeyMap[n])); - io.KeyMap[io.KeyMap[n]] = n; - } + // Modal windows prevents mouse from hovering behind them. + ImGuiWindow* modal_window = GetTopMostPopupModal(); + if (modal_window && g.HoveredWindow && !IsWindowWithinBeginStackOf(g.HoveredWindow->RootWindow, modal_window)) + clear_hovered_windows = true; - // Import legacy keys into new ones - for (int n = ImGuiKey_LegacyNativeKey_BEGIN; n < ImGuiKey_LegacyNativeKey_END; n++) - if (io.KeysDown[n] || io.BackendUsingLegacyKeyArrays == 1) - { - const ImGuiKey key = (ImGuiKey)(io.KeyMap[n] != -1 ? io.KeyMap[n] : n); - IM_ASSERT(io.KeyMap[n] == -1 || IsNamedKey(key)); - io.KeysData[key].Down = io.KeysDown[n]; - if (key != n) - io.KeysDown[key] = io.KeysDown[n]; // Allow legacy code using io.KeysDown[GetKeyIndex()] with old backends - io.BackendUsingLegacyKeyArrays = 1; - } - if (io.BackendUsingLegacyKeyArrays == 1) - { - GetKeyData(ImGuiMod_Ctrl)->Down = io.KeyCtrl; - GetKeyData(ImGuiMod_Shift)->Down = io.KeyShift; - GetKeyData(ImGuiMod_Alt)->Down = io.KeyAlt; - GetKeyData(ImGuiMod_Super)->Down = io.KeySuper; - } - } + // Disabled mouse? + if (io.ConfigFlags & ImGuiConfigFlags_NoMouse) + clear_hovered_windows = true; -#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO - const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; - if (io.BackendUsingLegacyNavInputArray && nav_gamepad_active) + // We track click ownership. When clicked outside of a window the click is owned by the application and + // won't report hovering nor request capture even while dragging over our windows afterward. + const bool has_open_popup = (g.OpenPopupStack.Size > 0); + const bool has_open_modal = (modal_window != NULL); + int mouse_earliest_down = -1; + bool mouse_any_down = false; + for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) { - #define MAP_LEGACY_NAV_INPUT_TO_KEY1(_KEY, _NAV1) do { io.KeysData[_KEY].Down = (io.NavInputs[_NAV1] > 0.0f); io.KeysData[_KEY].AnalogValue = io.NavInputs[_NAV1]; } while (0) - #define MAP_LEGACY_NAV_INPUT_TO_KEY2(_KEY, _NAV1, _NAV2) do { io.KeysData[_KEY].Down = (io.NavInputs[_NAV1] > 0.0f) || (io.NavInputs[_NAV2] > 0.0f); io.KeysData[_KEY].AnalogValue = ImMax(io.NavInputs[_NAV1], io.NavInputs[_NAV2]); } while (0) - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceDown, ImGuiNavInput_Activate); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceRight, ImGuiNavInput_Cancel); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceLeft, ImGuiNavInput_Menu); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceUp, ImGuiNavInput_Input); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadLeft, ImGuiNavInput_DpadLeft); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadRight, ImGuiNavInput_DpadRight); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadUp, ImGuiNavInput_DpadUp); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadDown, ImGuiNavInput_DpadDown); - MAP_LEGACY_NAV_INPUT_TO_KEY2(ImGuiKey_GamepadL1, ImGuiNavInput_FocusPrev, ImGuiNavInput_TweakSlow); - MAP_LEGACY_NAV_INPUT_TO_KEY2(ImGuiKey_GamepadR1, ImGuiNavInput_FocusNext, ImGuiNavInput_TweakFast); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickLeft, ImGuiNavInput_LStickLeft); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickRight, ImGuiNavInput_LStickRight); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickUp, ImGuiNavInput_LStickUp); - MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickDown, ImGuiNavInput_LStickDown); - #undef NAV_MAP_KEY + if (io.MouseClicked[i]) + { + io.MouseDownOwned[i] = (g.HoveredWindow != NULL) || has_open_popup; + io.MouseDownOwnedUnlessPopupClose[i] = (g.HoveredWindow != NULL) || has_open_modal; + } + mouse_any_down |= io.MouseDown[i]; + if (io.MouseDown[i]) + if (mouse_earliest_down == -1 || io.MouseClickedTime[i] < io.MouseClickedTime[mouse_earliest_down]) + mouse_earliest_down = i; } -#endif - -#endif + const bool mouse_avail = (mouse_earliest_down == -1) || io.MouseDownOwned[mouse_earliest_down]; + const bool mouse_avail_unless_popup_close = (mouse_earliest_down == -1) || io.MouseDownOwnedUnlessPopupClose[mouse_earliest_down]; - // Synchronize io.KeyMods with individual modifiers io.KeyXXX bools, update aliases - io.KeyMods = GetMergedModsFromBools(); - for (int n = 0; n < ImGuiMouseButton_COUNT; n++) - UpdateAliasKey(MouseButtonToKey(n), io.MouseDown[n], io.MouseDown[n] ? 1.0f : 0.0f); - UpdateAliasKey(ImGuiKey_MouseWheelX, io.MouseWheelH != 0.0f, io.MouseWheelH); - UpdateAliasKey(ImGuiKey_MouseWheelY, io.MouseWheel != 0.0f, io.MouseWheel); + // If mouse was first clicked outside of ImGui bounds we also cancel out hovering. + // FIXME: For patterns of drag and drop across OS windows, we may need to rework/remove this test (first committed 311c0ca9 on 2015/02) + const bool mouse_dragging_extern_payload = g.DragDropActive && (g.DragDropSourceFlags & ImGuiDragDropFlags_SourceExtern) != 0; + if (!mouse_avail && !mouse_dragging_extern_payload) + clear_hovered_windows = true; - // Clear gamepad data if disabled - if ((io.BackendFlags & ImGuiBackendFlags_HasGamepad) == 0) - for (int i = ImGuiKey_Gamepad_BEGIN; i < ImGuiKey_Gamepad_END; i++) - { - io.KeysData[i - ImGuiKey_KeysData_OFFSET].Down = false; - io.KeysData[i - ImGuiKey_KeysData_OFFSET].AnalogValue = 0.0f; - } + if (clear_hovered_windows) + g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; - // Update keys - for (int i = 0; i < IM_ARRAYSIZE(io.KeysData); i++) + // Update io.WantCaptureMouse for the user application (true = dispatch mouse info to Dear ImGui only, false = dispatch mouse to Dear ImGui + underlying app) + // Update io.WantCaptureMouseAllowPopupClose (experimental) to give a chance for app to react to popup closure with a drag + if (g.WantCaptureMouseNextFrame != -1) { - ImGuiKeyData* key_data = &io.KeysData[i]; - key_data->DownDurationPrev = key_data->DownDuration; - key_data->DownDuration = key_data->Down ? (key_data->DownDuration < 0.0f ? 0.0f : key_data->DownDuration + io.DeltaTime) : -1.0f; + io.WantCaptureMouse = io.WantCaptureMouseUnlessPopupClose = (g.WantCaptureMouseNextFrame != 0); + } + else + { + io.WantCaptureMouse = (mouse_avail && (g.HoveredWindow != NULL || mouse_any_down)) || has_open_popup; + io.WantCaptureMouseUnlessPopupClose = (mouse_avail_unless_popup_close && (g.HoveredWindow != NULL || mouse_any_down)) || has_open_modal; } + + // Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to Dear ImGui only, false = dispatch keyboard info to Dear ImGui + underlying app) + if (g.WantCaptureKeyboardNextFrame != -1) + io.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != 0); + else + io.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL); + if (io.NavActive && (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && !(io.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard)) + io.WantCaptureKeyboard = true; + + // Update io.WantTextInput flag, this is to allow systems without a keyboard (e.g. mobile, hand-held) to show a software keyboard if possible + io.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false; } -static void ImGui::UpdateMouseInputs() +void ImGui::NewFrame() { - ImGuiContext& g = *GImGui; - ImGuiIO& io = g.IO; - - // Round mouse position to avoid spreading non-rounded position (e.g. UpdateManualResize doesn't support them well) - if (IsMousePosValid(&io.MousePos)) - io.MousePos = g.MouseLastValidPos = ImFloorSigned(io.MousePos); - - // If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta - if (IsMousePosValid(&io.MousePos) && IsMousePosValid(&io.MousePosPrev)) - io.MouseDelta = io.MousePos - io.MousePosPrev; - else - io.MouseDelta = ImVec2(0.0f, 0.0f); - - // If mouse moved we re-enable mouse hovering in case it was disabled by gamepad/keyboard. In theory should use a >0.0f threshold but would need to reset in everywhere we set this to true. - if (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f) - g.NavDisableMouseHover = false; - - io.MousePosPrev = io.MousePos; - for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) - { - io.MouseClicked[i] = io.MouseDown[i] && io.MouseDownDuration[i] < 0.0f; - io.MouseClickedCount[i] = 0; // Will be filled below - io.MouseReleased[i] = !io.MouseDown[i] && io.MouseDownDuration[i] >= 0.0f; - io.MouseDownDurationPrev[i] = io.MouseDownDuration[i]; - io.MouseDownDuration[i] = io.MouseDown[i] ? (io.MouseDownDuration[i] < 0.0f ? 0.0f : io.MouseDownDuration[i] + io.DeltaTime) : -1.0f; - if (io.MouseClicked[i]) - { - bool is_repeated_click = false; - if ((float)(g.Time - io.MouseClickedTime[i]) < io.MouseDoubleClickTime) - { - ImVec2 delta_from_click_pos = IsMousePosValid(&io.MousePos) ? (io.MousePos - io.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f); - if (ImLengthSqr(delta_from_click_pos) < io.MouseDoubleClickMaxDist * io.MouseDoubleClickMaxDist) - is_repeated_click = true; - } - if (is_repeated_click) - io.MouseClickedLastCount[i]++; - else - io.MouseClickedLastCount[i] = 1; - io.MouseClickedTime[i] = g.Time; - io.MouseClickedPos[i] = io.MousePos; - io.MouseClickedCount[i] = io.MouseClickedLastCount[i]; - io.MouseDragMaxDistanceSqr[i] = 0.0f; - } - else if (io.MouseDown[i]) - { - // Maintain the maximum distance we reaching from the initial click position, which is used with dragging threshold - float delta_sqr_click_pos = IsMousePosValid(&io.MousePos) ? ImLengthSqr(io.MousePos - io.MouseClickedPos[i]) : 0.0f; - io.MouseDragMaxDistanceSqr[i] = ImMax(io.MouseDragMaxDistanceSqr[i], delta_sqr_click_pos); - } - - // We provide io.MouseDoubleClicked[] as a legacy service - io.MouseDoubleClicked[i] = (io.MouseClickedCount[i] == 2); - - // Clicking any mouse button reactivate mouse hovering which may have been deactivated by gamepad/keyboard navigation - if (io.MouseClicked[i]) - g.NavDisableMouseHover = false; - } -} - -static void StartLockWheelingWindow(ImGuiWindow* window) -{ - ImGuiContext& g = *GImGui; - if (g.WheelingWindow == window) - return; - IMGUI_DEBUG_LOG_IO("StartLockWheelingWindow() \"%s\"\n", window ? window->Name : "NULL"); - g.WheelingWindow = window; - g.WheelingWindowRefMousePos = g.IO.MousePos; - g.WheelingWindowTimer = WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER; -} - -void ImGui::UpdateMouseWheel() -{ - ImGuiContext& g = *GImGui; - - // Reset the locked window if we move the mouse or after the timer elapses - if (g.WheelingWindow != NULL) - { - g.WheelingWindowTimer -= g.IO.DeltaTime; - if (IsMousePosValid() && ImLengthSqr(g.IO.MousePos - g.WheelingWindowRefMousePos) > g.IO.MouseDragThreshold * g.IO.MouseDragThreshold) - g.WheelingWindowTimer = 0.0f; - if (g.WheelingWindowTimer <= 0.0f) - { - IMGUI_DEBUG_LOG_IO("UpdateMouseWheel() release WheelingWindow lock \"%s\"\n", g.WheelingWindow->Name); - g.WheelingWindow = NULL; - g.WheelingWindowTimer = 0.0f; - } - } - - const bool hovered_id_using_mouse_wheel = (g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrameUsingMouseWheel); - const bool active_id_using_mouse_wheel_x = g.ActiveIdUsingKeyInputMask.TestBit(ImGuiKey_MouseWheelX); - const bool active_id_using_mouse_wheel_y = g.ActiveIdUsingKeyInputMask.TestBit(ImGuiKey_MouseWheelY); - - float wheel_x = (!hovered_id_using_mouse_wheel && !active_id_using_mouse_wheel_x) ? g.IO.MouseWheelH : 0.0f; - float wheel_y = (!hovered_id_using_mouse_wheel && !active_id_using_mouse_wheel_y) ? g.IO.MouseWheel : 0; - if (wheel_x == 0.0f && wheel_y == 0.0f) - return; - - ImGuiWindow* window = g.WheelingWindow ? g.WheelingWindow : g.HoveredWindow; - if (!window || window->Collapsed) - return; - - // Zoom / Scale window - // FIXME-OBSOLETE: This is an old feature, it still works but pretty much nobody is using it and may be best redesigned. - if (wheel_y != 0.0f && g.IO.KeyCtrl && g.IO.FontAllowUserScaling) - { - StartLockWheelingWindow(window); - const float new_font_scale = ImClamp(window->FontWindowScale + g.IO.MouseWheel * 0.10f, 0.50f, 2.50f); - const float scale = new_font_scale / window->FontWindowScale; - window->FontWindowScale = new_font_scale; - if (window == window->RootWindow) - { - const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size; - SetWindowPos(window, window->Pos + offset, 0); - window->Size = ImFloor(window->Size * scale); - window->SizeFull = ImFloor(window->SizeFull * scale); - } - return; - } - - // Mouse wheel scrolling - // If a child window has the ImGuiWindowFlags_NoScrollWithMouse flag, we give a chance to scroll its parent - if (g.IO.KeyCtrl) - return; - - // As a standard behavior holding SHIFT while using Vertical Mouse Wheel triggers Horizontal scroll instead - // (we avoid doing it on OSX as it the OS input layer handles this already) - const bool swap_axis = g.IO.KeyShift && !g.IO.ConfigMacOSXBehaviors; - if (swap_axis) - { - wheel_x = wheel_y; - wheel_y = 0.0f; - } - - // Vertical Mouse Wheel scrolling - if (wheel_y != 0.0f) - { - StartLockWheelingWindow(window); - while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.y == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs)))) - window = window->ParentWindow; - if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs)) - { - float max_step = window->InnerRect.GetHeight() * 0.67f; - float scroll_step = ImFloor(ImMin(5 * window->CalcFontSize(), max_step)); - SetScrollY(window, window->Scroll.y - wheel_y * scroll_step); - } - } - - // Horizontal Mouse Wheel scrolling, or Vertical Mouse Wheel w/ Shift held - if (wheel_x != 0.0f) - { - StartLockWheelingWindow(window); - while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.x == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs)))) - window = window->ParentWindow; - if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs)) - { - float max_step = window->InnerRect.GetWidth() * 0.67f; - float scroll_step = ImFloor(ImMin(2 * window->CalcFontSize(), max_step)); - SetScrollX(window, window->Scroll.x - wheel_x * scroll_step); - } - } -} - -// The reason this is exposed in imgui_internal.h is: on touch-based system that don't have hovering, we want to dispatch inputs to the right target (imgui vs imgui+app) -void ImGui::UpdateHoveredWindowAndCaptureFlags() -{ - ImGuiContext& g = *GImGui; - ImGuiIO& io = g.IO; - g.WindowsHoverPadding = ImMax(g.Style.TouchExtraPadding, ImVec2(WINDOWS_HOVER_PADDING, WINDOWS_HOVER_PADDING)); - - // Find the window hovered by mouse: - // - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow. - // - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point of the frame. - // - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms. - bool clear_hovered_windows = false; - FindHoveredWindow(); - - // Modal windows prevents mouse from hovering behind them. - ImGuiWindow* modal_window = GetTopMostPopupModal(); - if (modal_window && g.HoveredWindow && !IsWindowWithinBeginStackOf(g.HoveredWindow->RootWindow, modal_window)) - clear_hovered_windows = true; - - // Disabled mouse? - if (io.ConfigFlags & ImGuiConfigFlags_NoMouse) - clear_hovered_windows = true; - - // We track click ownership. When clicked outside of a window the click is owned by the application and - // won't report hovering nor request capture even while dragging over our windows afterward. - const bool has_open_popup = (g.OpenPopupStack.Size > 0); - const bool has_open_modal = (modal_window != NULL); - int mouse_earliest_down = -1; - bool mouse_any_down = false; - for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) - { - if (io.MouseClicked[i]) - { - io.MouseDownOwned[i] = (g.HoveredWindow != NULL) || has_open_popup; - io.MouseDownOwnedUnlessPopupClose[i] = (g.HoveredWindow != NULL) || has_open_modal; - } - mouse_any_down |= io.MouseDown[i]; - if (io.MouseDown[i]) - if (mouse_earliest_down == -1 || io.MouseClickedTime[i] < io.MouseClickedTime[mouse_earliest_down]) - mouse_earliest_down = i; - } - const bool mouse_avail = (mouse_earliest_down == -1) || io.MouseDownOwned[mouse_earliest_down]; - const bool mouse_avail_unless_popup_close = (mouse_earliest_down == -1) || io.MouseDownOwnedUnlessPopupClose[mouse_earliest_down]; - - // If mouse was first clicked outside of ImGui bounds we also cancel out hovering. - // FIXME: For patterns of drag and drop across OS windows, we may need to rework/remove this test (first committed 311c0ca9 on 2015/02) - const bool mouse_dragging_extern_payload = g.DragDropActive && (g.DragDropSourceFlags & ImGuiDragDropFlags_SourceExtern) != 0; - if (!mouse_avail && !mouse_dragging_extern_payload) - clear_hovered_windows = true; - - if (clear_hovered_windows) - g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; - - // Update io.WantCaptureMouse for the user application (true = dispatch mouse info to Dear ImGui only, false = dispatch mouse to Dear ImGui + underlying app) - // Update io.WantCaptureMouseAllowPopupClose (experimental) to give a chance for app to react to popup closure with a drag - if (g.WantCaptureMouseNextFrame != -1) - { - io.WantCaptureMouse = io.WantCaptureMouseUnlessPopupClose = (g.WantCaptureMouseNextFrame != 0); - } - else - { - io.WantCaptureMouse = (mouse_avail && (g.HoveredWindow != NULL || mouse_any_down)) || has_open_popup; - io.WantCaptureMouseUnlessPopupClose = (mouse_avail_unless_popup_close && (g.HoveredWindow != NULL || mouse_any_down)) || has_open_modal; - } - - // Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to Dear ImGui only, false = dispatch keyboard info to Dear ImGui + underlying app) - if (g.WantCaptureKeyboardNextFrame != -1) - io.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != 0); - else - io.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL); - if (io.NavActive && (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && !(io.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard)) - io.WantCaptureKeyboard = true; - - // Update io.WantTextInput flag, this is to allow systems without a keyboard (e.g. mobile, hand-held) to show a software keyboard if possible - io.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false; -} - -void ImGui::NewFrame() -{ - IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?"); + IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?"); ImGuiContext& g = *GImGui; // Remove pending delete hooks before frame start. @@ -4480,6 +4543,11 @@ void ImGui::NewFrame() g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_ARRAYSIZE(g.FramerateSecPerFrame)); g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX; + // Process input queue (trickle as many events as possible), turn events into writes to IO structure + g.InputEventsTrail.resize(0); + UpdateInputEvents(g.IO.ConfigInputTrickleEventQueue); + + // Update viewports (after processing input queue, so io.MouseHoveredViewport is set) UpdateViewportsNewFrame(); // Setup current font and draw list shared data @@ -4487,8 +4555,8 @@ void ImGui::NewFrame() SetCurrentFont(GetDefaultFont()); IM_ASSERT(g.Font->IsLoaded()); ImRect virtual_space(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX); - for (int n = 0; n < g.Viewports.Size; n++) - virtual_space.Add(g.Viewports[n]->GetMainRect()); + for (ImGuiViewportP* viewport : g.Viewports) + virtual_space.Add(viewport->GetMainRect()); g.DrawListSharedData.ClipRectFullscreen = virtual_space.ToVec4(); g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol; g.DrawListSharedData.SetCircleTessellationMaxError(g.Style.CircleTessellationMaxError); @@ -4503,11 +4571,8 @@ void ImGui::NewFrame() g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AllowVtxOffset; // Mark rendering data as invalid to prevent user who may have a handle on it to use it. - for (int n = 0; n < g.Viewports.Size; n++) - { - ImGuiViewportP* viewport = g.Viewports[n]; - viewport->DrawDataP.Clear(); - } + for (ImGuiViewportP* viewport : g.Viewports) + viewport->DrawDataP.Valid = false; // Drag and drop keep the source ID alive so even if the source disappear our state is consistent if (g.DragDropActive && g.DragDropPayload.SourceId == g.ActiveId) @@ -4523,10 +4588,8 @@ void ImGui::NewFrame() if (g.HoveredId && g.ActiveId != g.HoveredId) g.HoveredIdNotActiveTimer += g.IO.DeltaTime; g.HoveredIdPreviousFrame = g.HoveredId; - g.HoveredIdPreviousFrameUsingMouseWheel = g.HoveredIdUsingMouseWheel; g.HoveredId = 0; g.HoveredIdAllowOverlap = false; - g.HoveredIdUsingMouseWheel = false; g.HoveredIdDisabled = false; // Clear ActiveID if the item is not alive anymore. @@ -4554,7 +4617,10 @@ void ImGui::NewFrame() if (g.ActiveId == 0) { g.ActiveIdUsingNavDirMask = 0x00; - g.ActiveIdUsingKeyInputMask.ClearAllBits(); + g.ActiveIdUsingAllKeyboardKeys = false; +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + g.ActiveIdUsingNavInputMask = 0x00; +#endif } #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO @@ -4563,29 +4629,41 @@ void ImGui::NewFrame() else if (g.ActiveIdUsingNavInputMask != 0) { // If your custom widget code used: { g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel); } - // Since IMGUI_VERSION_NUM >= 18804 it should be: { SetActiveIdUsingKey(ImGuiKey_Escape); SetActiveIdUsingKey(ImGuiKey_NavGamepadCancel); } + // Since IMGUI_VERSION_NUM >= 18804 it should be: { SetKeyOwner(ImGuiKey_Escape, g.ActiveId); SetKeyOwner(ImGuiKey_NavGamepadCancel, g.ActiveId); } if (g.ActiveIdUsingNavInputMask & (1 << ImGuiNavInput_Cancel)) - SetActiveIdUsingKey(ImGuiKey_Escape); + SetKeyOwner(ImGuiKey_Escape, g.ActiveId); if (g.ActiveIdUsingNavInputMask & ~(1 << ImGuiNavInput_Cancel)) IM_ASSERT(0); // Other values unsupported } #endif + // Record when we have been stationary as this state is preserved while over same item. + // FIXME: The way this is expressed means user cannot alter HoverStationaryDelay during the frame to use varying values. + // To allow this we should store HoverItemMaxStationaryTime+ID and perform the >= check in IsItemHovered() function. + if (g.HoverItemDelayId != 0 && g.MouseStationaryTimer >= g.Style.HoverStationaryDelay) + g.HoverItemUnlockedStationaryId = g.HoverItemDelayId; + else if (g.HoverItemDelayId == 0) + g.HoverItemUnlockedStationaryId = 0; + if (g.HoveredWindow != NULL && g.MouseStationaryTimer >= g.Style.HoverStationaryDelay) + g.HoverWindowUnlockedStationaryId = g.HoveredWindow->ID; + else if (g.HoveredWindow == NULL) + g.HoverWindowUnlockedStationaryId = 0; + // Update hover delay for IsItemHovered() with delays and tooltips - g.HoverDelayIdPreviousFrame = g.HoverDelayId; - if (g.HoverDelayId != 0) + g.HoverItemDelayIdPreviousFrame = g.HoverItemDelayId; + if (g.HoverItemDelayId != 0) { - //if (g.IO.MouseDelta.x == 0.0f && g.IO.MouseDelta.y == 0.0f) // Need design/flags - g.HoverDelayTimer += g.IO.DeltaTime; - g.HoverDelayClearTimer = 0.0f; - g.HoverDelayId = 0; + g.HoverItemDelayTimer += g.IO.DeltaTime; + g.HoverItemDelayClearTimer = 0.0f; + g.HoverItemDelayId = 0; } - else if (g.HoverDelayTimer > 0.0f) + else if (g.HoverItemDelayTimer > 0.0f) { // This gives a little bit of leeway before clearing the hover timer, allowing mouse to cross gaps - g.HoverDelayClearTimer += g.IO.DeltaTime; - if (g.HoverDelayClearTimer >= ImMax(0.20f, g.IO.DeltaTime * 2.0f)) // ~6 frames at 30 Hz + allow for low framerate - g.HoverDelayTimer = g.HoverDelayClearTimer = 0.0f; // May want a decaying timer, in which case need to clamp at max first, based on max of caller last requested timer. + // We could expose 0.25f as style.HoverClearDelay but I am not sure of the logic yet, this is particularly subtle. + g.HoverItemDelayClearTimer += g.IO.DeltaTime; + if (g.HoverItemDelayClearTimer >= ImMax(0.25f, g.IO.DeltaTime * 2.0f)) // ~7 frames at 30 Hz + allow for low framerate + g.HoverItemDelayTimer = g.HoverItemDelayClearTimer = 0.0f; // May want a decaying timer, in which case need to clamp at max first, based on max of caller last requested timer. } // Drag and drop @@ -4600,10 +4678,6 @@ void ImGui::NewFrame() //if (g.IO.AppFocusLost) // ClosePopupsExceptModals(); - // Process input queue (trickle as many events as possible) - g.InputEventsTrail.resize(0); - UpdateInputEvents(g.IO.ConfigInputTrickleEventQueue); - // Update keyboard input state UpdateKeyboardInputs(); @@ -4644,9 +4718,8 @@ void ImGui::NewFrame() // Mark all windows as not visible and compact unused memory. IM_ASSERT(g.WindowsFocusOrder.Size <= g.Windows.Size); const float memory_compact_start_time = (g.GcCompactAll || g.IO.ConfigMemoryCompactTimer < 0.0f) ? FLT_MAX : (float)g.Time - g.IO.ConfigMemoryCompactTimer; - for (int i = 0; i != g.Windows.Size; i++) + for (ImGuiWindow* window : g.Windows) { - ImGuiWindow* window = g.Windows[i]; window->WasActive = window->Active; window->Active = false; window->WriteAccessed = false; @@ -4662,16 +4735,16 @@ void ImGui::NewFrame() for (int i = 0; i < g.TablesLastTimeActive.Size; i++) if (g.TablesLastTimeActive[i] >= 0.0f && g.TablesLastTimeActive[i] < memory_compact_start_time) TableGcCompactTransientBuffers(g.Tables.GetByIndex(i)); - for (int i = 0; i < g.TablesTempData.Size; i++) - if (g.TablesTempData[i].LastTimeActive >= 0.0f && g.TablesTempData[i].LastTimeActive < memory_compact_start_time) - TableGcCompactTransientBuffers(&g.TablesTempData[i]); + for (ImGuiTableTempData& table_temp_data : g.TablesTempData) + if (table_temp_data.LastTimeActive >= 0.0f && table_temp_data.LastTimeActive < memory_compact_start_time) + TableGcCompactTransientBuffers(&table_temp_data); if (g.GcCompactAll) GcCompactTransientMiscBuffers(); g.GcCompactAll = false; // Closing the focused window restore focus to the first active root window in descending z-order if (g.NavWindow && !g.NavWindow->WasActive) - FocusTopMostWindowUnderOne(NULL, NULL); + FocusTopMostWindowUnderOne(NULL, NULL, NULL, ImGuiFocusRequestFlags_RestoreFocusedChild); // No window should be open at the beginning of the frame. // But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear. @@ -4684,6 +4757,13 @@ void ImGui::NewFrame() // [DEBUG] Update debug features UpdateDebugToolItemPicker(); UpdateDebugToolStackQueries(); + if (g.DebugLocateFrames > 0 && --g.DebugLocateFrames == 0) + g.DebugLocateId = 0; + if (g.DebugLogClipperAutoDisableFrames > 0 && --g.DebugLogClipperAutoDisableFrames == 0) + { + DebugLog("(Auto-disabled ImGuiDebugLogFlags_EventClipper to avoid spamming)\n"); + g.DebugLogFlags &= ~ImGuiDebugLogFlags_EventClipper; + } // Create implicit/fallback window - which we will only render it if the user has added something to it. // We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags. @@ -4693,175 +4773,42 @@ void ImGui::NewFrame() Begin("Debug##Default"); IM_ASSERT(g.CurrentWindow->IsFallbackWindow == true); + // [DEBUG] When io.ConfigDebugBeginReturnValue is set, we make Begin()/BeginChild() return false at different level of the window-stack, + // allowing to validate correct Begin/End behavior in user code. + if (g.IO.ConfigDebugBeginReturnValueLoop) + g.DebugBeginReturnValueCullDepth = (g.DebugBeginReturnValueCullDepth == -1) ? 0 : ((g.DebugBeginReturnValueCullDepth + ((g.FrameCount % 4) == 0 ? 1 : 0)) % 10); + else + g.DebugBeginReturnValueCullDepth = -1; + CallContextHooks(&g, ImGuiContextHookType_NewFramePost); } -void ImGui::Initialize() +// FIXME: Add a more explicit sort order in the window structure. +static int IMGUI_CDECL ChildWindowComparer(const void* lhs, const void* rhs) { - ImGuiContext& g = *GImGui; - IM_ASSERT(!g.Initialized && !g.SettingsLoaded); + const ImGuiWindow* const a = *(const ImGuiWindow* const *)lhs; + const ImGuiWindow* const b = *(const ImGuiWindow* const *)rhs; + if (int d = (a->Flags & ImGuiWindowFlags_Popup) - (b->Flags & ImGuiWindowFlags_Popup)) + return d; + if (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip)) + return d; + return (a->BeginOrderWithinParent - b->BeginOrderWithinParent); +} - // Add .ini handle for ImGuiWindow type +static void AddWindowToSortBuffer(ImVector* out_sorted_windows, ImGuiWindow* window) +{ + out_sorted_windows->push_back(window); + if (window->Active) { - ImGuiSettingsHandler ini_handler; - ini_handler.TypeName = "Window"; - ini_handler.TypeHash = ImHashStr("Window"); - ini_handler.ClearAllFn = WindowSettingsHandler_ClearAll; - ini_handler.ReadOpenFn = WindowSettingsHandler_ReadOpen; - ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine; - ini_handler.ApplyAllFn = WindowSettingsHandler_ApplyAll; - ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll; - AddSettingsHandler(&ini_handler); + int count = window->DC.ChildWindows.Size; + ImQsort(window->DC.ChildWindows.Data, (size_t)count, sizeof(ImGuiWindow*), ChildWindowComparer); + for (int i = 0; i < count; i++) + { + ImGuiWindow* child = window->DC.ChildWindows[i]; + if (child->Active) + AddWindowToSortBuffer(out_sorted_windows, child); + } } - - // Add .ini handle for ImGuiTable type - TableSettingsAddSettingsHandler(); - - // Create default viewport - ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)(); - g.Viewports.push_back(viewport); - g.TempBuffer.resize(1024 * 3 + 1, 0); - -#ifdef IMGUI_HAS_DOCK -#endif - - g.Initialized = true; -} - -// This function is merely here to free heap allocations. -void ImGui::Shutdown() -{ - // The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame) - ImGuiContext& g = *GImGui; - if (g.IO.Fonts && g.FontAtlasOwnedByContext) - { - g.IO.Fonts->Locked = false; - IM_DELETE(g.IO.Fonts); - } - g.IO.Fonts = NULL; - g.DrawListSharedData.TempBuffer.clear(); - - // Cleanup of other data are conditional on actually having initialized Dear ImGui. - if (!g.Initialized) - return; - - // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) - if (g.SettingsLoaded && g.IO.IniFilename != NULL) - SaveIniSettingsToDisk(g.IO.IniFilename); - - CallContextHooks(&g, ImGuiContextHookType_Shutdown); - - // Clear everything else - g.Windows.clear_delete(); - g.WindowsFocusOrder.clear(); - g.WindowsTempSortBuffer.clear(); - g.CurrentWindow = NULL; - g.CurrentWindowStack.clear(); - g.WindowsById.Clear(); - g.NavWindow = NULL; - g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; - g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL; - g.MovingWindow = NULL; - g.ColorStack.clear(); - g.StyleVarStack.clear(); - g.FontStack.clear(); - g.OpenPopupStack.clear(); - g.BeginPopupStack.clear(); - - g.Viewports.clear_delete(); - - g.TabBars.Clear(); - g.CurrentTabBarStack.clear(); - g.ShrinkWidthBuffer.clear(); - - g.ClipperTempData.clear_destruct(); - - g.Tables.Clear(); - g.TablesTempData.clear_destruct(); - g.DrawChannelsTempMergeBuffer.clear(); - - g.ClipboardHandlerData.clear(); - g.MenusIdSubmittedThisFrame.clear(); - g.InputTextState.ClearFreeMemory(); - - g.SettingsWindows.clear(); - g.SettingsHandlers.clear(); - - if (g.LogFile) - { -#ifndef IMGUI_DISABLE_TTY_FUNCTIONS - if (g.LogFile != stdout) -#endif - ImFileClose(g.LogFile); - g.LogFile = NULL; - } - g.LogBuffer.clear(); - g.DebugLogBuf.clear(); - - g.Initialized = false; -} - -// FIXME: Add a more explicit sort order in the window structure. -static int IMGUI_CDECL ChildWindowComparer(const void* lhs, const void* rhs) -{ - const ImGuiWindow* const a = *(const ImGuiWindow* const *)lhs; - const ImGuiWindow* const b = *(const ImGuiWindow* const *)rhs; - if (int d = (a->Flags & ImGuiWindowFlags_Popup) - (b->Flags & ImGuiWindowFlags_Popup)) - return d; - if (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip)) - return d; - return (a->BeginOrderWithinParent - b->BeginOrderWithinParent); -} - -static void AddWindowToSortBuffer(ImVector* out_sorted_windows, ImGuiWindow* window) -{ - out_sorted_windows->push_back(window); - if (window->Active) - { - int count = window->DC.ChildWindows.Size; - ImQsort(window->DC.ChildWindows.Data, (size_t)count, sizeof(ImGuiWindow*), ChildWindowComparer); - for (int i = 0; i < count; i++) - { - ImGuiWindow* child = window->DC.ChildWindows[i]; - if (child->Active) - AddWindowToSortBuffer(out_sorted_windows, child); - } - } -} - -static void AddDrawListToDrawData(ImVector* out_list, ImDrawList* draw_list) -{ - if (draw_list->CmdBuffer.Size == 0) - return; - if (draw_list->CmdBuffer.Size == 1 && draw_list->CmdBuffer[0].ElemCount == 0 && draw_list->CmdBuffer[0].UserCallback == NULL) - return; - - // Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. - // May trigger for you if you are using PrimXXX functions incorrectly. - IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size); - IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size); - if (!(draw_list->Flags & ImDrawListFlags_AllowVtxOffset)) - IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); - - // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per ImDrawList = per window) - // If this assert triggers because you are drawing lots of stuff manually: - // - First, make sure you are coarse clipping yourself and not trying to draw many things outside visible bounds. - // Be mindful that the ImDrawList API doesn't filter vertices. Use the Metrics/Debugger window to inspect draw list contents. - // - If you want large meshes with more than 64K vertices, you can either: - // (A) Handle the ImDrawCmd::VtxOffset value in your renderer backend, and set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset'. - // Most example backends already support this from 1.71. Pre-1.71 backends won't. - // Some graphics API such as GL ES 1/2 don't have a way to offset the starting vertex so it is not supported for them. - // (B) Or handle 32-bit indices in your renderer backend, and uncomment '#define ImDrawIdx unsigned int' line in imconfig.h. - // Most example backends already support this. For example, the OpenGL example code detect index size at compile-time: - // glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset); - // Your own engine or render API may use different parameters or function calls to specify index sizes. - // 2 and 4 bytes indices are generally supported by most graphics API. - // - If for some reason neither of those solutions works for you, a workaround is to call BeginChild()/EndChild() before reaching - // the 64K limit to split your draw commands in multiple draw lists. - if (sizeof(ImDrawIdx) == 2) - IM_ASSERT(draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above"); - - out_list->push_back(draw_list); } static void AddWindowToDrawData(ImGuiWindow* window, int layer) @@ -4869,13 +4816,12 @@ static void AddWindowToDrawData(ImGuiWindow* window, int layer) ImGuiContext& g = *GImGui; ImGuiViewportP* viewport = g.Viewports[0]; g.IO.MetricsRenderWindows++; - AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[layer], window->DrawList); - for (int i = 0; i < window->DC.ChildWindows.Size; i++) - { - ImGuiWindow* child = window->DC.ChildWindows[i]; + if (window->DrawList->_Splitter._Count > 1) + window->DrawList->ChannelsMerge(); // Merge if user forgot to merge back. Also required in Docking branch for ImGuiWindowFlags_DockNodeHost windows. + ImGui::AddDrawListToDrawDataEx(&viewport->DrawDataP, viewport->DrawDataBuilder.Layers[layer], window->DrawList); + for (ImGuiWindow* child : window->DC.ChildWindows) if (IsWindowActiveAndVisible(child)) // Clipped children may have been marked not active AddWindowToDrawData(child, layer); - } } static inline int GetWindowDisplayLayer(ImGuiWindow* window) @@ -4889,42 +4835,41 @@ static inline void AddRootWindowToDrawData(ImGuiWindow* window) AddWindowToDrawData(window, GetWindowDisplayLayer(window)); } -void ImDrawDataBuilder::FlattenIntoSingleLayer() +static void FlattenDrawDataIntoSingleLayer(ImDrawDataBuilder* builder) { - int n = Layers[0].Size; - int size = n; - for (int i = 1; i < IM_ARRAYSIZE(Layers); i++) - size += Layers[i].Size; - Layers[0].resize(size); - for (int layer_n = 1; layer_n < IM_ARRAYSIZE(Layers); layer_n++) + int n = builder->Layers[0]->Size; + int full_size = n; + for (int i = 1; i < IM_ARRAYSIZE(builder->Layers); i++) + full_size += builder->Layers[i]->Size; + builder->Layers[0]->resize(full_size); + for (int layer_n = 1; layer_n < IM_ARRAYSIZE(builder->Layers); layer_n++) { - ImVector& layer = Layers[layer_n]; - if (layer.empty()) + ImVector* layer = builder->Layers[layer_n]; + if (layer->empty()) continue; - memcpy(&Layers[0][n], &layer[0], layer.Size * sizeof(ImDrawList*)); - n += layer.Size; - layer.resize(0); + memcpy(builder->Layers[0]->Data + n, layer->Data, layer->Size * sizeof(ImDrawList*)); + n += layer->Size; + layer->resize(0); } } -static void SetupViewportDrawData(ImGuiViewportP* viewport, ImVector* draw_lists) +static void InitViewportDrawData(ImGuiViewportP* viewport) { ImGuiIO& io = ImGui::GetIO(); ImDrawData* draw_data = &viewport->DrawDataP; + + viewport->DrawDataBuilder.Layers[0] = &draw_data->CmdLists; + viewport->DrawDataBuilder.Layers[1] = &viewport->DrawDataBuilder.LayerData1; + viewport->DrawDataBuilder.Layers[0]->resize(0); + viewport->DrawDataBuilder.Layers[1]->resize(0); + draw_data->Valid = true; - draw_data->CmdLists = (draw_lists->Size > 0) ? draw_lists->Data : NULL; - draw_data->CmdListsCount = draw_lists->Size; + draw_data->CmdListsCount = 0; draw_data->TotalVtxCount = draw_data->TotalIdxCount = 0; draw_data->DisplayPos = viewport->Pos; draw_data->DisplaySize = viewport->Size; draw_data->FramebufferScale = io.DisplayFramebufferScale; - for (int n = 0; n < draw_lists->Size; n++) - { - ImDrawList* draw_list = draw_lists->Data[n]; - draw_list->_PopUnusedDrawCmd(); - draw_data->TotalVtxCount += draw_list->VtxBuffer.Size; - draw_data->TotalIdxCount += draw_list->IdxBuffer.Size; - } + draw_data->OwnerViewport = viewport; } // Push a clipping rectangle for both ImGui logic (hit-testing etc.) and low-level ImDrawList rendering. @@ -4963,14 +4908,14 @@ static void ImGui::RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 ImDrawList* draw_list = window->RootWindow->DrawList; if (draw_list->CmdBuffer.Size == 0) draw_list->AddDrawCmd(); - draw_list->PushClipRect(viewport_rect.Min - ImVec2(1, 1), viewport_rect.Max + ImVec2(1, 1), false); // Ensure ImDrawCmd are not merged + draw_list->PushClipRect(viewport_rect.Min - ImVec2(1, 1), viewport_rect.Max + ImVec2(1, 1), false); // FIXME: Need to stricty ensure ImDrawCmd are not merged (ElemCount==6 checks below will verify that) draw_list->AddRectFilled(viewport_rect.Min, viewport_rect.Max, col); ImDrawCmd cmd = draw_list->CmdBuffer.back(); IM_ASSERT(cmd.ElemCount == 6); draw_list->CmdBuffer.pop_back(); draw_list->CmdBuffer.push_front(cmd); - draw_list->PopClipRect(); draw_list->AddDrawCmd(); // We need to create a command as CmdBuffer.back().IdxOffset won't be correct if we append to same command. + draw_list->PopClipRect(); } } @@ -5045,8 +4990,24 @@ void ImGui::EndFrame() ErrorCheckEndFrameSanityChecks(); // Notify Platform/OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) - if (g.IO.SetPlatformImeDataFn && memcmp(&g.PlatformImeData, &g.PlatformImeDataPrev, sizeof(ImGuiPlatformImeData)) != 0) - g.IO.SetPlatformImeDataFn(GetMainViewport(), &g.PlatformImeData); + ImGuiPlatformImeData* ime_data = &g.PlatformImeData; + if (g.IO.SetPlatformImeDataFn && memcmp(ime_data, &g.PlatformImeDataPrev, sizeof(ImGuiPlatformImeData)) != 0) + { + IMGUI_DEBUG_LOG_IO("[io] Calling io.SetPlatformImeDataFn(): WantVisible: %d, InputPos (%.2f,%.2f)\n", ime_data->WantVisible, ime_data->InputPos.x, ime_data->InputPos.y); + ImGuiViewport* viewport = GetMainViewport(); +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + if (viewport->PlatformHandleRaw == NULL && g.IO.ImeWindowHandle != NULL) + { + viewport->PlatformHandleRaw = g.IO.ImeWindowHandle; + g.IO.SetPlatformImeDataFn(viewport, ime_data); + viewport->PlatformHandleRaw = NULL; + } + else +#endif + { + g.IO.SetPlatformImeDataFn(viewport, ime_data); + } + } // Hide implicit/fallback "Debug" window if it hasn't been used g.WithinFrameScopeWithImplicitWindow = false; @@ -5085,9 +5046,8 @@ void ImGui::EndFrame() // We cannot do that on FocusWindow() because children may not exist yet g.WindowsTempSortBuffer.resize(0); g.WindowsTempSortBuffer.reserve(g.Windows.Size); - for (int i = 0; i != g.Windows.Size; i++) + for (ImGuiWindow* window : g.Windows) { - ImGuiWindow* window = g.Windows[i]; if (window->Active && (window->Flags & ImGuiWindowFlags_ChildWindow)) // if a child is active its parent will add it continue; AddWindowToSortBuffer(&g.WindowsTempSortBuffer, window); @@ -5102,6 +5062,7 @@ void ImGui::EndFrame() g.IO.Fonts->Locked = false; // Clear Input data for next frame + g.IO.AppFocusLost = false; g.IO.MouseWheel = g.IO.MouseWheelH = 0.0f; g.IO.InputQueueCharacters.resize(0); @@ -5118,32 +5079,30 @@ void ImGui::Render() if (g.FrameCountEnded != g.FrameCount) EndFrame(); - const bool first_render_of_frame = (g.FrameCountRendered != g.FrameCount); + if (g.FrameCountRendered == g.FrameCount) + return; g.FrameCountRendered = g.FrameCount; - g.IO.MetricsRenderWindows = 0; + g.IO.MetricsRenderWindows = 0; CallContextHooks(&g, ImGuiContextHookType_RenderPre); + // Draw modal/window whitening backgrounds + RenderDimmedBackgrounds(); + // Add background ImDrawList (for each active viewport) - for (int n = 0; n != g.Viewports.Size; n++) + for (ImGuiViewportP* viewport : g.Viewports) { - ImGuiViewportP* viewport = g.Viewports[n]; - viewport->DrawDataBuilder.Clear(); - if (viewport->DrawLists[0] != NULL) - AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetBackgroundDrawList(viewport)); + InitViewportDrawData(viewport); + if (viewport->BgFgDrawLists[0] != NULL) + AddDrawListToDrawDataEx(&viewport->DrawDataP, viewport->DrawDataBuilder.Layers[0], GetBackgroundDrawList(viewport)); } - // Draw modal/window whitening backgrounds - if (first_render_of_frame) - RenderDimmedBackgrounds(); - // Add ImDrawList to render ImGuiWindow* windows_to_render_top_most[2]; windows_to_render_top_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindow : NULL; windows_to_render_top_most[1] = (g.NavWindowingTarget ? g.NavWindowingListWindow : NULL); - for (int n = 0; n != g.Windows.Size; n++) + for (ImGuiWindow* window : g.Windows) { - ImGuiWindow* window = g.Windows[n]; IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive "warning C6011: Dereferencing NULL pointer 'window'" if (IsWindowActiveAndVisible(window) && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != windows_to_render_top_most[0] && window != windows_to_render_top_most[1]) AddRootWindowToDrawData(window); @@ -5153,22 +5112,25 @@ void ImGui::Render() AddRootWindowToDrawData(windows_to_render_top_most[n]); // Draw software mouse cursor if requested by io.MouseDrawCursor flag - if (g.IO.MouseDrawCursor && first_render_of_frame && g.MouseCursor != ImGuiMouseCursor_None) + if (g.IO.MouseDrawCursor && g.MouseCursor != ImGuiMouseCursor_None) RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48)); // Setup ImDrawData structures for end-user g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = 0; - for (int n = 0; n < g.Viewports.Size; n++) + for (ImGuiViewportP* viewport : g.Viewports) { - ImGuiViewportP* viewport = g.Viewports[n]; - viewport->DrawDataBuilder.FlattenIntoSingleLayer(); + FlattenDrawDataIntoSingleLayer(&viewport->DrawDataBuilder); // Add foreground ImDrawList (for each active viewport) - if (viewport->DrawLists[1] != NULL) - AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetForegroundDrawList(viewport)); + if (viewport->BgFgDrawLists[1] != NULL) + AddDrawListToDrawDataEx(&viewport->DrawDataP, viewport->DrawDataBuilder.Layers[0], GetForegroundDrawList(viewport)); - SetupViewportDrawData(viewport, &viewport->DrawDataBuilder.Layers[0]); + // We call _PopUnusedDrawCmd() last thing, as RenderDimmedBackgrounds() rely on a valid command being there (especially in docking branch). ImDrawData* draw_data = &viewport->DrawDataP; + IM_ASSERT(draw_data->CmdLists.Size == draw_data->CmdListsCount); + for (ImDrawList* draw_list : draw_data->CmdLists) + draw_list->_PopUnusedDrawCmd(); + g.IO.MetricsRenderVertices += draw_data->TotalVtxCount; g.IO.MetricsRenderIndices += draw_data->TotalIdxCount; } @@ -5340,7 +5302,7 @@ bool ImGui::IsAnyItemFocused() bool ImGui::IsItemVisible() { ImGuiContext& g = *GImGui; - return g.CurrentWindow->ClipRect.Overlaps(g.LastItemData.Rect); + return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Visible) != 0; } bool ImGui::IsItemEdited() @@ -5349,44 +5311,45 @@ bool ImGui::IsItemEdited() return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Edited) != 0; } -// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority. -// FIXME: Although this is exposed, its interaction and ideal idiom with using ImGuiButtonFlags_AllowItemOverlap flag are extremely confusing, need rework. -void ImGui::SetItemAllowOverlap() +// Allow next item to be overlapped by subsequent items. +// This works by requiring HoveredId to match for two subsequent frames, +// so if a following items overwrite it our interactions will naturally be disabled. +void ImGui::SetNextItemAllowOverlap() { ImGuiContext& g = *GImGui; - ImGuiID id = g.LastItemData.ID; - if (g.HoveredId == id) - g.HoveredIdAllowOverlap = true; - if (g.ActiveId == id) - g.ActiveIdAllowOverlap = true; + g.NextItemData.ItemFlags |= ImGuiItemFlags_AllowOverlap; } -void ImGui::SetItemUsingMouseWheel() +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS +// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority. +// FIXME-LEGACY: Use SetNextItemAllowOverlap() *before* your item instead. +void ImGui::SetItemAllowOverlap() { ImGuiContext& g = *GImGui; ImGuiID id = g.LastItemData.ID; if (g.HoveredId == id) - g.HoveredIdUsingMouseWheel = true; - if (g.ActiveId == id) - { - g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_MouseWheelX); - g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_MouseWheelY); - } + g.HoveredIdAllowOverlap = true; + if (g.ActiveId == id) // Before we made this obsolete, most calls to SetItemAllowOverlap() used to avoid this path by testing g.ActiveId != id. + g.ActiveIdAllowOverlap = true; } +#endif +// FIXME: It might be undesirable that this will likely disable KeyOwner-aware shortcuts systems. Consider a more fine-tuned version for the two users of this function. void ImGui::SetActiveIdUsingAllKeyboardKeys() { ImGuiContext& g = *GImGui; IM_ASSERT(g.ActiveId != 0); g.ActiveIdUsingNavDirMask = (1 << ImGuiDir_COUNT) - 1; - g.ActiveIdUsingKeyInputMask.SetBitRange(ImGuiKey_Keyboard_BEGIN, ImGuiKey_Keyboard_END); - //g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_ModCtrl); - //g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_ModShift); - //g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_ModAlt); - //g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_ModSuper); + g.ActiveIdUsingAllKeyboardKeys = true; NavMoveRequestCancel(); } +ImGuiID ImGui::GetItemID() +{ + ImGuiContext& g = *GImGui; + return g.LastItemData.ID; +} + ImVec2 ImGui::GetItemRectMin() { ImGuiContext& g = *GImGui; @@ -5446,12 +5409,16 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b parent_window->DC.CursorPos = child_window->Pos; // Process navigation-in immediately so NavInit can run on first frame - if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayersActiveMask != 0 || child_window->DC.NavHasScroll)) + // Can enter a child if (A) it has navigatable items or (B) it can be scrolled. + const ImGuiID temp_id_for_activation = ImHashStr("##Child", 0, id); + if (g.ActiveId == temp_id_for_activation) + ClearActiveID(); + if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayersActiveMask != 0 || child_window->DC.NavWindowHasScrollY)) { FocusWindow(child_window); NavInitWindow(child_window, false); - SetActiveID(id + 1, child_window); // Steal ActiveId with another arbitrary id so that key-press won't activate child item - g.ActiveIdSource = ImGuiInputSource_Nav; + SetActiveID(temp_id_for_activation, child_window); // Steal ActiveId with another arbitrary id so that key-press won't activate child item + g.ActiveIdSource = g.NavInputSource; } return ret; } @@ -5493,7 +5460,7 @@ void ImGui::EndChild() ImGuiWindow* parent_window = g.CurrentWindow; ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz); ItemSize(sz); - if ((window->DC.NavLayersActiveMask != 0 || window->DC.NavHasScroll) && !(window->Flags & ImGuiWindowFlags_NavFlattened)) + if ((window->DC.NavLayersActiveMask != 0 || window->DC.NavWindowHasScrollY) && !(window->Flags & ImGuiWindowFlags_NavFlattened)) { ItemAdd(bb, window->ChildId); RenderNavHighlight(bb, window->ChildId); @@ -5506,6 +5473,10 @@ void ImGui::EndChild() { // Not navigable into ItemAdd(bb, 0); + + // But when flattened we directly reach items, adjust active layer mask accordingly + if (window->Flags & ImGuiWindowFlags_NavFlattened) + parent_window->DC.NavLayersActiveMaskNext |= window->DC.NavLayersActiveMaskNext; } if (g.HoveredWindow == window) g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow; @@ -5584,32 +5555,22 @@ static void UpdateWindowInFocusOrderList(ImGuiWindow* window, bool just_created, window->IsExplicitChild = new_is_explicit_child; } -static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags) +static void InitOrLoadWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* settings) { - ImGuiContext& g = *GImGui; - //IMGUI_DEBUG_LOG("CreateNewWindow '%s', flags = 0x%08X\n", name, flags); - - // Create window the first time - ImGuiWindow* window = IM_NEW(ImGuiWindow)(&g, name); - window->Flags = flags; - g.WindowsById.SetVoidPtr(window->ID, window); - - // Default/arbitrary window position. Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. + // Initial window state with e.g. default/arbitrary window position + // Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. const ImGuiViewport* main_viewport = ImGui::GetMainViewport(); window->Pos = main_viewport->Pos + ImVec2(60, 60); + window->SetWindowPosAllowFlags = window->SetWindowSizeAllowFlags = window->SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; - // User can disable loading and saving of settings. Tooltip and child windows also don't store settings. - if (!(flags & ImGuiWindowFlags_NoSavedSettings)) - if (ImGuiWindowSettings* settings = ImGui::FindWindowSettings(window->ID)) - { - // Retrieve settings from .ini file - window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings); - SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false); - ApplyWindowSettings(window, settings); - } + if (settings != NULL) + { + SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false); + ApplyWindowSettings(window, settings); + } window->DC.CursorStartPos = window->DC.CursorMaxPos = window->DC.IdealMaxPos = window->Pos; // So first call to CalcWindowContentSizes() doesn't return crazy values - if ((flags & ImGuiWindowFlags_AlwaysAutoResize) != 0) + if ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0) { window->AutoFitFramesX = window->AutoFitFramesY = 2; window->AutoFitOnlyGrows = false; @@ -5622,6 +5583,23 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags) window->AutoFitFramesY = 2; window->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0); } +} + +static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags) +{ + // Create window the first time + //IMGUI_DEBUG_LOG("CreateNewWindow '%s', flags = 0x%08X\n", name, flags); + ImGuiContext& g = *GImGui; + ImGuiWindow* window = IM_NEW(ImGuiWindow)(&g, name); + window->Flags = flags; + g.WindowsById.SetVoidPtr(window->ID, window); + + ImGuiWindowSettings* settings = NULL; + if (!(flags & ImGuiWindowFlags_NoSavedSettings)) + if ((settings = ImGui::FindWindowSettingsByWindow(window)) != 0) + window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings); + + InitOrLoadWindowSettings(window, settings); if (flags & ImGuiWindowFlags_NoBringToFrontOnFocus) g.Windows.push_front(window); // Quite slow but rare and only once @@ -5659,9 +5637,9 @@ static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, const ImVec2& s if (!(window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysAutoResize))) { ImGuiWindow* window_for_height = window; - const float decoration_up_height = window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight(); new_size = ImMax(new_size, g.Style.WindowMinSize); - new_size.y = ImMax(new_size.y, decoration_up_height + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows + const float minimum_height = window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f); + new_size.y = ImMax(new_size.y, minimum_height); // Reduce artifacts with very small windows } return new_size; } @@ -5690,9 +5668,10 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont { ImGuiContext& g = *GImGui; ImGuiStyle& style = g.Style; - const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight(); + const float decoration_w_without_scrollbars = window->DecoOuterSizeX1 + window->DecoOuterSizeX2 - window->ScrollbarSizes.x; + const float decoration_h_without_scrollbars = window->DecoOuterSizeY1 + window->DecoOuterSizeY2 - window->ScrollbarSizes.y; ImVec2 size_pad = window->WindowPadding * 2.0f; - ImVec2 size_desired = size_contents + size_pad + ImVec2(0.0f, decoration_up_height); + ImVec2 size_desired = size_contents + size_pad + ImVec2(decoration_w_without_scrollbars, decoration_h_without_scrollbars); if (window->Flags & ImGuiWindowFlags_Tooltip) { // Tooltip always resize @@ -5707,15 +5686,14 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont if (is_popup || is_menu) // Popups and menus bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups) size_min = ImMin(size_min, ImVec2(4.0f, 4.0f)); - // FIXME-VIEWPORT-WORKAREA: May want to use GetWorkSize() instead of Size depending on the type of windows? - ImVec2 avail_size = ImGui::GetMainViewport()->Size; + ImVec2 avail_size = ImGui::GetMainViewport()->WorkSize; ImVec2 size_auto_fit = ImClamp(size_desired, size_min, ImMax(size_min, avail_size - style.DisplaySafeAreaPadding * 2.0f)); // When the window cannot fit all contents (either because of constraints, either because screen is too small), // we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than ViewportSize-WindowPadding. ImVec2 size_auto_fit_after_constraint = CalcWindowSizeAfterConstraint(window, size_auto_fit); - bool will_have_scrollbar_x = (size_auto_fit_after_constraint.x - size_pad.x - 0.0f < size_contents.x && !(window->Flags & ImGuiWindowFlags_NoScrollbar) && (window->Flags & ImGuiWindowFlags_HorizontalScrollbar)) || (window->Flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar); - bool will_have_scrollbar_y = (size_auto_fit_after_constraint.y - size_pad.y - decoration_up_height < size_contents.y && !(window->Flags & ImGuiWindowFlags_NoScrollbar)) || (window->Flags & ImGuiWindowFlags_AlwaysVerticalScrollbar); + bool will_have_scrollbar_x = (size_auto_fit_after_constraint.x - size_pad.x - decoration_w_without_scrollbars < size_contents.x && !(window->Flags & ImGuiWindowFlags_NoScrollbar) && (window->Flags & ImGuiWindowFlags_HorizontalScrollbar)) || (window->Flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar); + bool will_have_scrollbar_y = (size_auto_fit_after_constraint.y - size_pad.y - decoration_h_without_scrollbars < size_contents.y && !(window->Flags & ImGuiWindowFlags_NoScrollbar)) || (window->Flags & ImGuiWindowFlags_AlwaysVerticalScrollbar); if (will_have_scrollbar_x) size_auto_fit.y += style.ScrollbarSize; if (will_have_scrollbar_y) @@ -5839,6 +5817,11 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s const float grip_hover_inner_size = IM_FLOOR(grip_draw_size * 0.75f); const float grip_hover_outer_size = g.IO.ConfigWindowsResizeFromEdges ? WINDOWS_HOVER_PADDING : 0.0f; + ImRect clamp_rect = visibility_rect; + const bool window_move_from_title_bar = g.IO.ConfigWindowsMoveFromTitleBarOnly && !(window->Flags & ImGuiWindowFlags_NoTitleBar); + if (window_move_from_title_bar) + clamp_rect.Min.y -= window->TitleBarHeight(); + ImVec2 pos_target(FLT_MAX, FLT_MAX); ImVec2 size_target(FLT_MAX, FLT_MAX); @@ -5858,7 +5841,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s if (resize_rect.Min.x > resize_rect.Max.x) ImSwap(resize_rect.Min.x, resize_rect.Max.x); if (resize_rect.Min.y > resize_rect.Max.y) ImSwap(resize_rect.Min.y, resize_rect.Max.y); ImGuiID resize_grip_id = window->GetID(resize_grip_n); // == GetWindowResizeCornerID() - KeepAliveID(resize_grip_id); + ItemAdd(resize_rect, resize_grip_id, NULL, ImGuiItemFlags_NoNav); ButtonBehavior(resize_rect, resize_grip_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus); //GetForegroundDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255)); if (hovered || held) @@ -5875,8 +5858,8 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s { // Resize from any of the four corners // We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position - ImVec2 clamp_min = ImVec2(def.CornerPosN.x == 1.0f ? visibility_rect.Min.x : -FLT_MAX, def.CornerPosN.y == 1.0f ? visibility_rect.Min.y : -FLT_MAX); - ImVec2 clamp_max = ImVec2(def.CornerPosN.x == 0.0f ? visibility_rect.Max.x : +FLT_MAX, def.CornerPosN.y == 0.0f ? visibility_rect.Max.y : +FLT_MAX); + ImVec2 clamp_min = ImVec2(def.CornerPosN.x == 1.0f ? clamp_rect.Min.x : -FLT_MAX, (def.CornerPosN.y == 1.0f || (def.CornerPosN.y == 0.0f && window_move_from_title_bar)) ? clamp_rect.Min.y : -FLT_MAX); + ImVec2 clamp_max = ImVec2(def.CornerPosN.x == 0.0f ? clamp_rect.Max.x : +FLT_MAX, def.CornerPosN.y == 0.0f ? clamp_rect.Max.y : +FLT_MAX); ImVec2 corner_target = g.IO.MousePos - g.ActiveIdClickOffset + ImLerp(def.InnerDir * grip_hover_outer_size, def.InnerDir * -grip_hover_inner_size, def.CornerPosN); // Corner of the window corresponding to our corner grip corner_target = ImClamp(corner_target, clamp_min, clamp_max); CalcResizePosSizeFromAnyCorner(window, corner_target, def.CornerPosN, &pos_target, &size_target); @@ -5894,7 +5877,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s bool hovered, held; ImRect border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, WINDOWS_HOVER_PADDING); ImGuiID border_id = window->GetID(border_n + 4); // == GetWindowResizeBorderID() - KeepAliveID(border_id); + ItemAdd(border_rect, border_id, NULL, ImGuiItemFlags_NoNav); ButtonBehavior(border_rect, border_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus); //GetForegroundDrawLists(window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255)); if ((hovered && g.HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER) || held) @@ -5905,8 +5888,8 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s } if (held) { - ImVec2 clamp_min(border_n == ImGuiDir_Right ? visibility_rect.Min.x : -FLT_MAX, border_n == ImGuiDir_Down ? visibility_rect.Min.y : -FLT_MAX); - ImVec2 clamp_max(border_n == ImGuiDir_Left ? visibility_rect.Max.x : +FLT_MAX, border_n == ImGuiDir_Up ? visibility_rect.Max.y : +FLT_MAX); + ImVec2 clamp_min(border_n == ImGuiDir_Right ? clamp_rect.Min.x : -FLT_MAX, border_n == ImGuiDir_Down || (border_n == ImGuiDir_Up && window_move_from_title_bar) ? clamp_rect.Min.y : -FLT_MAX); + ImVec2 clamp_max(border_n == ImGuiDir_Left ? clamp_rect.Max.x : +FLT_MAX, border_n == ImGuiDir_Up ? clamp_rect.Max.y : +FLT_MAX); ImVec2 border_target = window->Pos; border_target[axis] = g.IO.MousePos[axis] - g.ActiveIdClickOffset[axis] + WINDOWS_HOVER_PADDING; border_target = ImClamp(border_target, clamp_min, clamp_max); @@ -5925,15 +5908,15 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s { ImVec2 nav_resize_dir; if (g.NavInputSource == ImGuiInputSource_Keyboard && g.IO.KeyShift) - nav_resize_dir = GetKeyVector2d(ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow); + nav_resize_dir = GetKeyMagnitude2d(ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow); if (g.NavInputSource == ImGuiInputSource_Gamepad) - nav_resize_dir = GetKeyVector2d(ImGuiKey_GamepadDpadLeft, ImGuiKey_GamepadDpadRight, ImGuiKey_GamepadDpadUp, ImGuiKey_GamepadDpadDown); + nav_resize_dir = GetKeyMagnitude2d(ImGuiKey_GamepadDpadLeft, ImGuiKey_GamepadDpadRight, ImGuiKey_GamepadDpadUp, ImGuiKey_GamepadDpadDown); if (nav_resize_dir.x != 0.0f || nav_resize_dir.y != 0.0f) { const float NAV_RESIZE_SPEED = 600.0f; const float resize_step = NAV_RESIZE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y); g.NavWindowingAccumDeltaSize += nav_resize_dir * resize_step; - g.NavWindowingAccumDeltaSize = ImMax(g.NavWindowingAccumDeltaSize, visibility_rect.Min - window->Pos - window->Size); // We need Pos+Size >= visibility_rect.Min, so Size >= visibility_rect.Min - Pos, so size_delta >= visibility_rect.Min - window->Pos - window->Size + g.NavWindowingAccumDeltaSize = ImMax(g.NavWindowingAccumDeltaSize, clamp_rect.Min - window->Pos - window->Size); // We need Pos+Size >= clmap_rect.Min, so Size >= clmap_rect.Min - Pos, so size_delta >= clmap_rect.Min - window->Pos - window->Size g.NavWindowingToggleLayer = false; g.NavDisableMouseHover = true; resize_grip_col[0] = GetColorU32(ImGuiCol_ResizeGripActive); @@ -5963,7 +5946,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s return ret_auto_fit; } -static inline void ClampWindowRect(ImGuiWindow* window, const ImRect& visibility_rect) +static inline void ClampWindowPos(ImGuiWindow* window, const ImRect& visibility_rect) { ImGuiContext& g = *GImGui; ImVec2 size_for_clamping = window->Size; @@ -5998,7 +5981,7 @@ static void ImGui::RenderWindowOuterBorders(ImGuiWindow* window) // Draw background and borders // Draw and handle scrollbars -void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size) +void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size) { ImGuiContext& g = *GImGui; ImGuiStyle& style = g.Style; @@ -6015,7 +5998,7 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar if (window->Collapsed) { // Title bar only - float backup_border_size = style.FrameBorderSize; + const float backup_border_size = style.FrameBorderSize; g.Style.FrameBorderSize = window->WindowBorderSize; ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed); RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding); @@ -6063,21 +6046,25 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar Scrollbar(ImGuiAxis_Y); // Render resize grips (after their input handling so we don't have a frame of latency) - if (!(flags & ImGuiWindowFlags_NoResize)) + if (handle_borders_and_resize_grips && !(flags & ImGuiWindowFlags_NoResize)) { for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++) { + const ImU32 col = resize_grip_col[resize_grip_n]; + if ((col & IM_COL32_A_MASK) == 0) + continue; const ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n]; const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPosN); window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(window_border_size, resize_grip_draw_size) : ImVec2(resize_grip_draw_size, window_border_size))); window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(resize_grip_draw_size, window_border_size) : ImVec2(window_border_size, resize_grip_draw_size))); window->DrawList->PathArcToFast(ImVec2(corner.x + grip.InnerDir.x * (window_rounding + window_border_size), corner.y + grip.InnerDir.y * (window_rounding + window_border_size)), window_rounding, grip.AngleMin12, grip.AngleMax12); - window->DrawList->PathFillConvex(resize_grip_col[resize_grip_n]); + window->DrawList->PathFillConvex(col); } } // Borders - RenderWindowOuterBorders(window); + if (handle_borders_and_resize_grips) + RenderWindowOuterBorders(window); } } @@ -6106,18 +6093,18 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl ImVec2 collapse_button_pos; if (has_close_button) { - pad_r += button_sz; - close_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - style.FramePadding.x, title_bar_rect.Min.y); + close_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - button_sz, title_bar_rect.Min.y + style.FramePadding.y); + pad_r += button_sz + style.ItemInnerSpacing.x; } if (has_collapse_button && style.WindowMenuButtonPosition == ImGuiDir_Right) { - pad_r += button_sz; - collapse_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - style.FramePadding.x, title_bar_rect.Min.y); + collapse_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - button_sz, title_bar_rect.Min.y + style.FramePadding.y); + pad_r += button_sz + style.ItemInnerSpacing.x; } if (has_collapse_button && style.WindowMenuButtonPosition == ImGuiDir_Left) { - collapse_button_pos = ImVec2(title_bar_rect.Min.x + pad_l - style.FramePadding.x, title_bar_rect.Min.y); - pad_l += button_sz; + collapse_button_pos = ImVec2(title_bar_rect.Min.x + pad_l, title_bar_rect.Min.y + style.FramePadding.y); + pad_l += button_sz + style.ItemInnerSpacing.x; } // Collapse button (submitting first so it gets priority when choosing a navigation init fallback) @@ -6190,31 +6177,35 @@ void ImGui::UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags // When a modal popup is open, newly created windows that want focus (i.e. are not popups and do not specify ImGuiWindowFlags_NoFocusOnAppearing) // should be positioned behind that modal window, unless the window was created inside the modal begin-stack. // In case of multiple stacked modals newly created window honors begin stack order and does not go below its own modal parent. -// - Window // FindBlockingModal() returns Modal1 -// - Window // .. returns Modal1 +// - WindowA // FindBlockingModal() returns Modal1 +// - WindowB // .. returns Modal1 // - Modal1 // .. returns Modal2 -// - Window // .. returns Modal2 -// - Window // .. returns Modal2 +// - WindowC // .. returns Modal2 +// - WindowD // .. returns Modal2 // - Modal2 // .. returns Modal2 -static ImGuiWindow* ImGui::FindBlockingModal(ImGuiWindow* window) +// - WindowE // .. returns NULL +// Notes: +// - FindBlockingModal(NULL) == NULL is generally equivalent to GetTopMostPopupModal() == NULL. +// Only difference is here we check for ->Active/WasActive but it may be unecessary. +ImGuiWindow* ImGui::FindBlockingModal(ImGuiWindow* window) { ImGuiContext& g = *GImGui; if (g.OpenPopupStack.Size <= 0) return NULL; // Find a modal that has common parent with specified window. Specified window should be positioned behind that modal. - for (int i = g.OpenPopupStack.Size - 1; i >= 0; i--) + for (ImGuiPopupData& popup_data : g.OpenPopupStack) { - ImGuiWindow* popup_window = g.OpenPopupStack.Data[i].Window; + ImGuiWindow* popup_window = popup_data.Window; if (popup_window == NULL || !(popup_window->Flags & ImGuiWindowFlags_Modal)) continue; if (!popup_window->Active && !popup_window->WasActive) // Check WasActive, because this code may run before popup renders on current frame, also check Active to handle newly created windows. continue; - if (IsWindowWithinBeginStackOf(window, popup_window)) // Window is rendered over last modal, no render order change needed. - break; - for (ImGuiWindow* parent = popup_window->ParentWindowInBeginStack->RootWindow; parent != NULL; parent = parent->ParentWindowInBeginStack->RootWindow) - if (IsWindowWithinBeginStackOf(window, parent)) - return popup_window; // Place window above its begin stack parent. + if (window == NULL) // FindBlockingModal(NULL) test for if FocusWindow(NULL) is naturally possible via a mouse click. + return popup_window; + if (IsWindowWithinBeginStackOf(window, popup_window)) // Window may be over modal + continue; + return popup_window; // Place window right below first block modal } return NULL; } @@ -6293,12 +6284,24 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) ImGuiWindowStackData window_stack_data; window_stack_data.Window = window; window_stack_data.ParentLastItemDataBackup = g.LastItemData; - window_stack_data.StackSizesOnBegin.SetToCurrentState(); + window_stack_data.StackSizesOnBegin.SetToContextState(&g); g.CurrentWindowStack.push_back(window_stack_data); - g.CurrentWindow = NULL; if (flags & ImGuiWindowFlags_ChildMenu) g.BeginMenuCount++; + // Update ->RootWindow and others pointers (before any possible call to FocusWindow) + if (first_begin_of_the_frame) + { + UpdateWindowParentAndRootLinks(window, flags, parent_window); + window->ParentWindowInBeginStack = parent_window_in_stack; + } + + // Add to focus scope stack + PushFocusScope(window->ID); + window->NavRootFocusScopeId = g.CurrentFocusScopeId; + g.CurrentWindow = NULL; + + // Add to popup stack if (flags & ImGuiWindowFlags_Popup) { ImGuiPopupData& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size]; @@ -6308,13 +6311,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->PopupId = popup_ref.PopupId; } - // Update ->RootWindow and others pointers (before any possible call to FocusWindow) - if (first_begin_of_the_frame) - { - UpdateWindowParentAndRootLinks(window, flags, parent_window); - window->ParentWindowInBeginStack = parent_window_in_stack; - } - // Process SetNextWindow***() calls // (FIXME: Consider splitting the HasXXX flags into X/Y components bool window_pos_set_by_api = false; @@ -6445,6 +6441,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->DC.MenuBarOffset.x = ImMax(ImMax(window->WindowPadding.x, style.ItemSpacing.x), g.NextWindowData.MenuBarOffsetMinVal.x); window->DC.MenuBarOffset.y = g.NextWindowData.MenuBarOffsetMinVal.y; + bool use_current_size_for_scrollbar_x = window_just_created; + bool use_current_size_for_scrollbar_y = window_just_created; + // Collapse window by double-clicking on title bar // At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing if (!(flags & ImGuiWindowFlags_NoTitleBar) && !(flags & ImGuiWindowFlags_NoCollapse)) @@ -6456,6 +6455,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) if (window->WantCollapseToggle) { window->Collapsed = !window->Collapsed; + if (!window->Collapsed) + use_current_size_for_scrollbar_y = true; MarkIniSettingsDirty(window); } } @@ -6467,10 +6468,17 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // SIZE + // Outer Decoration Sizes + // (we need to clear ScrollbarSize immediatly as CalcWindowAutoFitSize() needs it and can be called from other locations). + const ImVec2 scrollbar_sizes_from_last_frame = window->ScrollbarSizes; + window->DecoOuterSizeX1 = 0.0f; + window->DecoOuterSizeX2 = 0.0f; + window->DecoOuterSizeY1 = window->TitleBarHeight() + window->MenuBarHeight(); + window->DecoOuterSizeY2 = 0.0f; + window->ScrollbarSizes = ImVec2(0.0f, 0.0f); + // Calculate auto-fit size, handle automatic resize const ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, window->ContentSizeIdeal); - bool use_current_size_for_scrollbar_x = window_just_created; - bool use_current_size_for_scrollbar_y = window_just_created; if ((flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed) { // Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc. @@ -6507,9 +6515,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->SizeFull = CalcWindowSizeAfterConstraint(window, window->SizeFull); window->Size = window->Collapsed && !(flags & ImGuiWindowFlags_ChildWindow) ? window->TitleBarRect().GetSize() : window->SizeFull; - // Decoration size - const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight(); - // POSITION // Popup latch its initial position, will position itself when it appears next frame @@ -6549,9 +6554,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // Clamp position/size so window stays visible within its viewport or monitor // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing. - if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) + if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow)) if (viewport_rect.GetWidth() > 0.0f && viewport_rect.GetHeight() > 0.0f) - ClampWindowRect(window, visibility_rect); + ClampWindowPos(window, visibility_rect); window->Pos = ImFloor(window->Pos); // Lock window rounding for the frame (so that altering them doesn't cause inconsistencies) @@ -6570,31 +6575,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) want_focus = true; else if ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) == 0) want_focus = true; - - ImGuiWindow* modal = GetTopMostPopupModal(); - if (modal != NULL && !IsWindowWithinBeginStackOf(window, modal)) - { - // Avoid focusing a window that is created outside of active modal. This will prevent active modal from being closed. - // Since window is not focused it would reappear at the same display position like the last time it was visible. - // In case of completely new windows it would go to the top (over current modal), but input to such window would still be blocked by modal. - // Position window behind a modal that is not a begin-parent of this window. - want_focus = false; - if (window == window->RootWindow) - { - ImGuiWindow* blocking_modal = FindBlockingModal(window); - IM_ASSERT(blocking_modal != NULL); - BringWindowToDisplayBehind(window, blocking_modal); - } - } } - // [Test Engine] Register whole window in the item system + // [Test Engine] Register whole window in the item system (before submitting further decorations) #ifdef IMGUI_ENABLE_TEST_ENGINE if (g.TestEngineHookItems) { IM_ASSERT(window->IDStack.Size == 1); window->IDStack.Size = 0; // As window->IDStack[0] == window->ID here, make sure TestEngine doesn't erroneously see window as parent of itself. - IMGUI_TEST_ENGINE_ITEM_ADD(window->Rect(), window->ID); + IMGUI_TEST_ENGINE_ITEM_ADD(window->ID, window->Rect(), NULL); IMGUI_TEST_ENGINE_ITEM_INFO(window->ID, window->Name, (g.HoveredWindow == window) ? ImGuiItemStatusFlags_HoveredRect : 0); window->IDStack.Size = 1; } @@ -6616,9 +6605,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) if (!window->Collapsed) { // When reading the current size we need to read it after size constraints have been applied. - // When we use InnerRect here we are intentionally reading last frame size, same for ScrollbarSizes values before we set them again. - ImVec2 avail_size_from_current_frame = ImVec2(window->SizeFull.x, window->SizeFull.y - decoration_up_height); - ImVec2 avail_size_from_last_frame = window->InnerRect.GetSize() + window->ScrollbarSizes; + // Intentionally use previous frame values for InnerRect and ScrollbarSizes. + // And when we use window->DecorationUp here it doesn't have ScrollbarSizes.y applied yet. + ImVec2 avail_size_from_current_frame = ImVec2(window->SizeFull.x, window->SizeFull.y - (window->DecoOuterSizeY1 + window->DecoOuterSizeY2)); + ImVec2 avail_size_from_last_frame = window->InnerRect.GetSize() + scrollbar_sizes_from_last_frame; ImVec2 needed_size_from_last_frame = window_just_created ? ImVec2(0, 0) : window->ContentSize + window->WindowPadding * 2.0f; float size_x_for_scrollbars = use_current_size_for_scrollbar_x ? avail_size_from_current_frame.x : avail_size_from_last_frame.x; float size_y_for_scrollbars = use_current_size_for_scrollbar_y ? avail_size_from_current_frame.y : avail_size_from_last_frame.y; @@ -6628,6 +6618,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) if (window->ScrollbarX && !window->ScrollbarY) window->ScrollbarY = (needed_size_from_last_frame.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar); window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f); + + // Amend the partially filled window->DecorationXXX values. + window->DecoOuterSizeX2 += window->ScrollbarSizes.x; + window->DecoOuterSizeY2 += window->ScrollbarSizes.y; } // UPDATE RECTANGLES (1- THOSE NOT AFFECTED BY SCROLLING) @@ -6651,10 +6645,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // - ScrollToRectEx() // - NavUpdatePageUpPageDown() // - Scrollbar() - window->InnerRect.Min.x = window->Pos.x; - window->InnerRect.Min.y = window->Pos.y + decoration_up_height; - window->InnerRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x; - window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->ScrollbarSizes.y; + window->InnerRect.Min.x = window->Pos.x + window->DecoOuterSizeX1; + window->InnerRect.Min.y = window->Pos.y + window->DecoOuterSizeY1; + window->InnerRect.Max.x = window->Pos.x + window->Size.x - window->DecoOuterSizeX2; + window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->DecoOuterSizeY2; // Inner clipping rectangle. // Will extend a little bit outside the normal work region. @@ -6687,6 +6681,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // Apply scrolling window->Scroll = CalcNextScrollFromScrollTargetAndClamp(window); window->ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); + window->DecoInnerSizeX1 = window->DecoInnerSizeY1 = 0.0f; // DRAWING @@ -6706,8 +6701,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // - We disable this when the parent window has zero vertices, which is a common pattern leading to laying out multiple overlapping childs ImGuiWindow* previous_child = parent_window->DC.ChildWindows.Size >= 2 ? parent_window->DC.ChildWindows[parent_window->DC.ChildWindows.Size - 2] : NULL; bool previous_child_overlapping = previous_child ? previous_child->Rect().Overlaps(window->Rect()) : false; - bool parent_is_empty = parent_window->DrawList->VtxBuffer.Size > 0; - if (window->DrawList->CmdBuffer.back().ElemCount == 0 && parent_is_empty && !previous_child_overlapping) + bool parent_is_empty = (parent_window->DrawList->VtxBuffer.Size == 0); + if (window->DrawList->CmdBuffer.back().ElemCount == 0 && !parent_is_empty && !previous_child_overlapping) render_decorations_in_parent = true; } if (render_decorations_in_parent) @@ -6716,7 +6711,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // Handle title bar, scrollbar, resize grips and resize borders const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow; const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight); - RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, resize_grip_count, resize_grip_col, resize_grip_draw_size); + const bool handle_borders_and_resize_grips = true; // This exists to facilitate merge with 'docking' branch. + RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, handle_borders_and_resize_grips, resize_grip_count, resize_grip_col, resize_grip_draw_size); if (render_decorations_in_parent) window->DrawList = &window->DrawListInst; @@ -6731,8 +6727,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // - BeginTabBar() for right-most edge const bool allow_scrollbar_x = !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar); const bool allow_scrollbar_y = !(flags & ImGuiWindowFlags_NoScrollbar); - const float work_rect_size_x = (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : ImMax(allow_scrollbar_x ? window->ContentSize.x : 0.0f, window->Size.x - window->WindowPadding.x * 2.0f - window->ScrollbarSizes.x)); - const float work_rect_size_y = (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : ImMax(allow_scrollbar_y ? window->ContentSize.y : 0.0f, window->Size.y - window->WindowPadding.y * 2.0f - decoration_up_height - window->ScrollbarSizes.y)); + const float work_rect_size_x = (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : ImMax(allow_scrollbar_x ? window->ContentSize.x : 0.0f, window->Size.x - window->WindowPadding.x * 2.0f - (window->DecoOuterSizeX1 + window->DecoOuterSizeX2))); + const float work_rect_size_y = (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : ImMax(allow_scrollbar_y ? window->ContentSize.y : 0.0f, window->Size.y - window->WindowPadding.y * 2.0f - (window->DecoOuterSizeY1 + window->DecoOuterSizeY2))); window->WorkRect.Min.x = ImFloor(window->InnerRect.Min.x - window->Scroll.x + ImMax(window->WindowPadding.x, window->WindowBorderSize)); window->WorkRect.Min.y = ImFloor(window->InnerRect.Min.y - window->Scroll.y + ImMax(window->WindowPadding.y, window->WindowBorderSize)); window->WorkRect.Max.x = window->WorkRect.Min.x + work_rect_size_x; @@ -6741,23 +6737,24 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // [LEGACY] Content Region // FIXME-OBSOLETE: window->ContentRegionRect.Max is currently very misleading / partly faulty, but some BeginChild() patterns relies on it. + // Unless explicit content size is specified by user, this currently represent the region leading to no scrolling. // Used by: // - Mouse wheel scrolling + many other things - window->ContentRegionRect.Min.x = window->Pos.x - window->Scroll.x + window->WindowPadding.x; - window->ContentRegionRect.Min.y = window->Pos.y - window->Scroll.y + window->WindowPadding.y + decoration_up_height; - window->ContentRegionRect.Max.x = window->ContentRegionRect.Min.x + (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : (window->Size.x - window->WindowPadding.x * 2.0f - window->ScrollbarSizes.x)); - window->ContentRegionRect.Max.y = window->ContentRegionRect.Min.y + (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : (window->Size.y - window->WindowPadding.y * 2.0f - decoration_up_height - window->ScrollbarSizes.y)); + window->ContentRegionRect.Min.x = window->Pos.x - window->Scroll.x + window->WindowPadding.x + window->DecoOuterSizeX1; + window->ContentRegionRect.Min.y = window->Pos.y - window->Scroll.y + window->WindowPadding.y + window->DecoOuterSizeY1; + window->ContentRegionRect.Max.x = window->ContentRegionRect.Min.x + (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : (window->Size.x - window->WindowPadding.x * 2.0f - (window->DecoOuterSizeX1 + window->DecoOuterSizeX2))); + window->ContentRegionRect.Max.y = window->ContentRegionRect.Min.y + (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : (window->Size.y - window->WindowPadding.y * 2.0f - (window->DecoOuterSizeY1 + window->DecoOuterSizeY2))); // Setup drawing context // (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.) - window->DC.Indent.x = 0.0f + window->WindowPadding.x - window->Scroll.x; + window->DC.Indent.x = window->DecoOuterSizeX1 + window->WindowPadding.x - window->Scroll.x; window->DC.GroupOffset.x = 0.0f; window->DC.ColumnsOffset.x = 0.0f; // Record the loss of precision of CursorStartPos which can happen due to really large scrolling amount. // This is used by clipper to compensate and fix the most common use case of large scroll area. Easy and cheap, next best thing compared to switching everything to double or ImU64. - double start_pos_highp_x = (double)window->Pos.x + window->WindowPadding.x - (double)window->Scroll.x + window->DC.ColumnsOffset.x; - double start_pos_highp_y = (double)window->Pos.y + window->WindowPadding.y - (double)window->Scroll.y + decoration_up_height; + double start_pos_highp_x = (double)window->Pos.x + window->WindowPadding.x - (double)window->Scroll.x + window->DecoOuterSizeX1 + window->DC.ColumnsOffset.x; + double start_pos_highp_y = (double)window->Pos.y + window->WindowPadding.y - (double)window->Scroll.y + window->DecoOuterSizeY1; window->DC.CursorStartPos = ImVec2((float)start_pos_highp_x, (float)start_pos_highp_y); window->DC.CursorStartPosLossyness = ImVec2((float)(start_pos_highp_x - window->DC.CursorStartPos.x), (float)(start_pos_highp_y - window->DC.CursorStartPos.y)); window->DC.CursorPos = window->DC.CursorStartPos; @@ -6771,8 +6768,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->DC.NavLayerCurrent = ImGuiNavLayer_Main; window->DC.NavLayersActiveMask = window->DC.NavLayersActiveMaskNext; window->DC.NavLayersActiveMaskNext = 0x00; + window->DC.NavIsScrollPushableX = true; window->DC.NavHideHighlightOneFrame = false; - window->DC.NavHasScroll = (window->ScrollMax.y > 0.0f); + window->DC.NavWindowHasScrollY = (window->ScrollMax.y > 0.0f); window->DC.MenuBarAppending = false; window->DC.MenuColumns.Update(style.ItemSpacing.x, window_just_activated_by_user); @@ -6795,11 +6793,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->AutoFitFramesY--; // Apply focus (we need to call FocusWindow() AFTER setting DC.CursorStartPos so our initial navigation reference rectangle can start around there) + // We ImGuiFocusRequestFlags_UnlessBelowModal to: + // - Avoid focusing a window that is created outside of a modal. This will prevent active modal from being closed. + // - Position window behind the modal that is not a begin-parent of this window. if (want_focus) - { - FocusWindow(window); + FocusWindow(window, ImGuiFocusRequestFlags_UnlessBelowModal); + if (want_focus && window == g.NavWindow) NavInitWindow(window, false); // <-- this is in the way for us to be able to defer and sort reappearing FocusWindow() calls - } // Title bar if (!(flags & ImGuiWindowFlags_NoTitleBar)) @@ -6822,9 +6822,17 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // This is useful to allow creating context menus on title bar only, etc. SetLastItemData(window->MoveId, g.CurrentItemFlags, IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0, title_bar_rect); - // [Test Engine] Register title bar / tab + // [DEBUG] +#ifndef IMGUI_DISABLE_DEBUG_TOOLS + if (g.DebugLocateId != 0 && (window->ID == g.DebugLocateId || window->MoveId == g.DebugLocateId)) + DebugLocateItemResolveWithLastItem(); +#endif + + // [Test Engine] Register title bar / tab with MoveId. +#ifdef IMGUI_ENABLE_TEST_ENGINE if (!(window->Flags & ImGuiWindowFlags_NoTitleBar)) - IMGUI_TEST_ENGINE_ITEM_ADD(g.LastItemData.Rect, g.LastItemData.ID); + IMGUI_TEST_ENGINE_ITEM_ADD(g.LastItemData.ID, g.LastItemData.Rect, &g.LastItemData); +#endif } else { @@ -6832,9 +6840,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) SetCurrentWindow(window); } - // Pull/inherit current state - window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : window->GetID("#FOCUSSCOPE"); // Inherit from parent only // -V595 - PushClipRect(window->InnerClipRect.Min, window->InnerClipRect.Max, true); // Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default "Debug" window is unused) @@ -6888,6 +6893,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->SkipItems = skip_items; } + // [DEBUG] io.ConfigDebugBeginReturnValue override return value to test Begin/End and BeginChild/EndChild behaviors. + // (The implicit fallback window is NOT automatically ended allowing it to always be able to receive commands without crashing) + if (!window->IsFallbackWindow && ((g.IO.ConfigDebugBeginReturnValueOnce && window_just_created) || (g.IO.ConfigDebugBeginReturnValueLoop && g.DebugBeginReturnValueCullDepth == g.CurrentWindowStack.Size))) + { + if (window->AutoFitFramesX > 0) { window->AutoFitFramesX++; } + if (window->AutoFitFramesY > 0) { window->AutoFitFramesY++; } + return false; + } + return !window->SkipItems; } @@ -6912,6 +6926,7 @@ void ImGui::End() if (window->DC.CurrentColumns) EndColumns(); PopClipRect(); // Inner window clip rectangle + PopFocusScope(); // Stop logging if (!(window->Flags & ImGuiWindowFlags_ChildWindow)) // FIXME: add more options for scope of logging @@ -6926,7 +6941,7 @@ void ImGui::End() g.BeginMenuCount--; if (window->Flags & ImGuiWindowFlags_Popup) g.BeginPopupStack.pop_back(); - g.CurrentWindowStack.back().StackSizesOnBegin.CompareWithCurrentState(); + g.CurrentWindowStack.back().StackSizesOnBegin.CompareWithContextState(&g); g.CurrentWindowStack.pop_back(); SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window); } @@ -7010,10 +7025,25 @@ int ImGui::FindWindowDisplayIndex(ImGuiWindow* window) } // Moving window to front of display and set focus (which happens to be back of our sorted list) -void ImGui::FocusWindow(ImGuiWindow* window) +void ImGui::FocusWindow(ImGuiWindow* window, ImGuiFocusRequestFlags flags) { ImGuiContext& g = *GImGui; + // Modal check? + if ((flags & ImGuiFocusRequestFlags_UnlessBelowModal) && (g.NavWindow != window)) // Early out in common case. + if (ImGuiWindow* blocking_modal = FindBlockingModal(window)) + { + IMGUI_DEBUG_LOG_FOCUS("[focus] FocusWindow(\"%s\", UnlessBelowModal): prevented by \"%s\".\n", window ? window->Name : "", blocking_modal->Name); + if (window && window == window->RootWindow && (window->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus) == 0) + BringWindowToDisplayBehind(window, blocking_modal); // Still bring to right below modal. + return; + } + + // Find last focused child (if any) and focus it instead. + if ((flags & ImGuiFocusRequestFlags_RestoreFocusedChild) && window != NULL) + window = NavRestoreLastChildNavWindow(window); + + // Apply focus if (g.NavWindow != window) { SetNavWindow(window); @@ -7021,12 +7051,12 @@ void ImGui::FocusWindow(ImGuiWindow* window) g.NavMousePosDirty = true; g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId g.NavLayer = ImGuiNavLayer_Main; - g.NavFocusScopeId = 0; + g.NavFocusScopeId = window ? window->NavRootFocusScopeId : 0; g.NavIdIsAlive = false; - } - // Close popups if any - ClosePopupsOverWindow(window, false); + // Close popups if any + ClosePopupsOverWindow(window, false); + } // Move the root window to the top of the pile IM_ASSERT(window == NULL || window->RootWindow != NULL); @@ -7050,9 +7080,10 @@ void ImGui::FocusWindow(ImGuiWindow* window) BringWindowToDisplayFront(display_front_window); } -void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window) +void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window, ImGuiViewport* filter_viewport, ImGuiFocusRequestFlags flags) { ImGuiContext& g = *GImGui; + IM_UNUSED(filter_viewport); // Unused in master branch. int start_idx = g.WindowsFocusOrder.Size - 1; if (under_this_window != NULL) { @@ -7070,15 +7101,15 @@ void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWind // We may later decide to test for different NoXXXInputs based on the active navigation input (mouse vs nav) but that may feel more confusing to the user. ImGuiWindow* window = g.WindowsFocusOrder[i]; IM_ASSERT(window == window->RootWindow); - if (window != ignore_window && window->WasActive) - if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) - { - ImGuiWindow* focus_window = NavRestoreLastChildNavWindow(window); - FocusWindow(focus_window); - return; - } + if (window == ignore_window || !window->WasActive) + continue; + if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) + { + FocusWindow(window, flags); + return; + } } - FocusWindow(NULL); + FocusWindow(NULL, flags); } // Important: this alone doesn't alter current ImDrawList state. This is called by PushFont/PopFont only. @@ -7171,13 +7202,12 @@ void ImGui::EndDisabled() g.Style.Alpha = g.DisabledAlphaBackup; //PopStyleVar(); } -// FIXME: Look into renaming this once we have settled the new Focus/Activation/TabStop system. -void ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus) +void ImGui::PushTabStop(bool tab_stop) { - PushItemFlag(ImGuiItemFlags_NoTabStop, !allow_keyboard_focus); + PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop); } -void ImGui::PopAllowKeyboardFocus() +void ImGui::PopTabStop() { PopItemFlag(); } @@ -7270,7 +7300,8 @@ bool ImGui::IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_b bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags) { - IM_ASSERT((flags & (ImGuiHoveredFlags_AllowWhenOverlapped | ImGuiHoveredFlags_AllowWhenDisabled)) == 0); // Flags not supported by this function + IM_ASSERT((flags & ~ImGuiHoveredFlags_AllowedMaskForIsWindowHovered) == 0 && "Invalid flags for IsWindowHovered()!"); + ImGuiContext& g = *GImGui; ImGuiWindow* ref_window = g.HoveredWindow; ImGuiWindow* cur_window = g.CurrentWindow; @@ -7298,6 +7329,17 @@ bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags) if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) if (g.ActiveId != 0 && !g.ActiveIdAllowOverlap && g.ActiveId != ref_window->MoveId) return false; + + // When changing hovered window we requires a bit of stationary delay before activating hover timer. + // FIXME: We don't support delay other than stationary one for now, other delay would need a way + // to fullfill the possibility that multiple IsWindowHovered() with varying flag could return true + // for different windows of the hierarchy. Possibly need a Hash(Current+Flags) ==> (Timer) cache. + // We can implement this for _Stationary because the data is linked to HoveredWindow rather than CurrentWindow. + if (flags & ImGuiHoveredFlags_ForTooltip) + flags |= g.Style.HoverFlagsForTooltipMouse; + if ((flags & ImGuiHoveredFlags_Stationary) != 0 && g.HoverWindowUnlockedStationaryId != ref_window->ID) + return false; + return true; } @@ -7445,6 +7487,12 @@ void ImGui::SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const I window->HitTestHoleOffset = ImVec2ih(pos - window->Pos); } +void ImGui::SetWindowHiddendAndSkipItemsForCurrentFrame(ImGuiWindow* window) +{ + window->Hidden = window->SkipItems = true; + window->HiddenFramesCanSkipItems = 1; +} + void ImGui::SetWindowCollapsed(bool collapsed, ImGuiCond cond) { SetWindowCollapsed(GImGui->CurrentWindow, collapsed, cond); @@ -7582,37 +7630,55 @@ void ImGui::SetWindowFontScale(float scale) g.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize(); } -void ImGui::ActivateItem(ImGuiID id) +void ImGui::PushFocusScope(ImGuiID id) { ImGuiContext& g = *GImGui; - g.NavNextActivateId = id; - g.NavNextActivateFlags = ImGuiActivateFlags_None; + g.FocusScopeStack.push_back(id); + g.CurrentFocusScopeId = id; } -void ImGui::PushFocusScope(ImGuiID id) +void ImGui::PopFocusScope() { ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - g.FocusScopeStack.push_back(window->DC.NavFocusScopeIdCurrent); - window->DC.NavFocusScopeIdCurrent = id; + IM_ASSERT(g.FocusScopeStack.Size > 0); // Too many PopFocusScope() ? + g.FocusScopeStack.pop_back(); + g.CurrentFocusScopeId = g.FocusScopeStack.Size ? g.FocusScopeStack.back() : 0; } -void ImGui::PopFocusScope() +// Focus = move navigation cursor, set scrolling, set focus window. +void ImGui::FocusItem() { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - IM_ASSERT(g.FocusScopeStack.Size > 0); // Too many PopFocusScope() ? - window->DC.NavFocusScopeIdCurrent = g.FocusScopeStack.back(); - g.FocusScopeStack.pop_back(); + IMGUI_DEBUG_LOG_FOCUS("FocusItem(0x%08x) in window \"%s\"\n", g.LastItemData.ID, window->Name); + if (g.DragDropActive || g.MovingWindow != NULL) // FIXME: Opt-in flags for this? + { + IMGUI_DEBUG_LOG_FOCUS("FocusItem() ignored while DragDropActive!\n"); + return; + } + + ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_IsTabbing | ImGuiNavMoveFlags_FocusApi | ImGuiNavMoveFlags_NoSelect; + ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY; + SetNavWindow(window); + NavMoveRequestSubmit(ImGuiDir_None, ImGuiDir_Up, move_flags, scroll_flags); + NavMoveRequestResolveWithLastItem(&g.NavMoveResultLocal); +} + +void ImGui::ActivateItemByID(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + g.NavNextActivateId = id; + g.NavNextActivateFlags = ImGuiActivateFlags_None; } // Note: this will likely be called ActivateItem() once we rework our Focus/Activation system! +// But ActivateItem() should function without altering scroll/focus? void ImGui::SetKeyboardFocusHere(int offset) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; IM_ASSERT(offset >= -1); // -1 is allowed but not below - IMGUI_DEBUG_LOG_ACTIVEID("SetKeyboardFocusHere(%d) in window \"%s\"\n", offset, window->Name); + IMGUI_DEBUG_LOG_FOCUS("SetKeyboardFocusHere(%d) in window \"%s\"\n", offset, window->Name); // It makes sense in the vast majority of cases to never interrupt a drag and drop. // When we refactor this function into ActivateItem() we may want to make this an option. @@ -7620,14 +7686,15 @@ void ImGui::SetKeyboardFocusHere(int offset) // is also automatically dropped in the event g.ActiveId is stolen. if (g.DragDropActive || g.MovingWindow != NULL) { - IMGUI_DEBUG_LOG_ACTIVEID("SetKeyboardFocusHere() ignored while DragDropActive!\n"); + IMGUI_DEBUG_LOG_FOCUS("SetKeyboardFocusHere() ignored while DragDropActive!\n"); return; } SetNavWindow(window); + ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_IsTabbing | ImGuiNavMoveFlags_Activate | ImGuiNavMoveFlags_FocusApi; ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY; - NavMoveRequestSubmit(ImGuiDir_None, offset < 0 ? ImGuiDir_Up : ImGuiDir_Down, ImGuiNavMoveFlags_Tabbing | ImGuiNavMoveFlags_FocusApi, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. + NavMoveRequestSubmit(ImGuiDir_None, offset < 0 ? ImGuiDir_Up : ImGuiDir_Down, move_flags, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. if (offset == -1) { NavMoveRequestResolveWithLastItem(&g.NavMoveResultLocal); @@ -7645,16 +7712,15 @@ void ImGui::SetItemDefaultFocus() ImGuiWindow* window = g.CurrentWindow; if (!window->Appearing) return; - if (g.NavWindow != window->RootWindowForNav || (!g.NavInitRequest && g.NavInitResultId == 0) || g.NavLayer != window->DC.NavLayerCurrent) + if (g.NavWindow != window->RootWindowForNav || (!g.NavInitRequest && g.NavInitResult.ID == 0) || g.NavLayer != window->DC.NavLayerCurrent) return; g.NavInitRequest = false; - g.NavInitResultId = g.LastItemData.ID; - g.NavInitResultRectRel = WindowRectAbsToRel(window, g.LastItemData.Rect); + NavApplyItemToResult(&g.NavInitResult); NavUpdateAnyRequestFlag(); // Scroll could be done in NavInitRequestApplyResult() via an opt-in flag (we however don't want regular init requests to scroll) - if (!IsItemVisible()) + if (!window->ClipRect.Contains(g.LastItemData.Rect)) ScrollToRectEx(window, g.LastItemData.Rect, ImGuiScrollFlags_None); } @@ -7724,6 +7790,15 @@ ImGuiID ImGui::GetIDWithSeed(const char* str, const char* str_end, ImGuiID seed) return id; } +ImGuiID ImGui::GetIDWithSeed(int n, ImGuiID seed) +{ + ImGuiID id = ImHashData(&n, sizeof(n), seed); + ImGuiContext& g = *GImGui; + if (g.DebugHookIdInfo == id) + DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL); + return id; +} + void ImGui::PopID() { ImGuiWindow* window = GImGui->CurrentWindow; @@ -7765,46 +7840,82 @@ bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max) //----------------------------------------------------------------------------- // [SECTION] INPUTS //----------------------------------------------------------------------------- +// - GetKeyData() [Internal] +// - GetKeyIndex() [Internal] +// - GetKeyName() +// - GetKeyChordName() [Internal] +// - CalcTypematicRepeatAmount() [Internal] +// - GetTypematicRepeatRate() [Internal] +// - GetKeyPressedAmount() [Internal] +// - GetKeyMagnitude2d() [Internal] +//----------------------------------------------------------------------------- +// - UpdateKeyRoutingTable() [Internal] +// - GetRoutingIdFromOwnerId() [Internal] +// - GetShortcutRoutingData() [Internal] +// - CalcRoutingScore() [Internal] +// - SetShortcutRouting() [Internal] +// - TestShortcutRouting() [Internal] +//----------------------------------------------------------------------------- +// - IsKeyDown() +// - IsKeyPressed() +// - IsKeyReleased() +//----------------------------------------------------------------------------- +// - IsMouseDown() +// - IsMouseClicked() +// - IsMouseReleased() +// - IsMouseDoubleClicked() +// - GetMouseClickedCount() +// - IsMouseHoveringRect() [Internal] +// - IsMouseDragPastThreshold() [Internal] +// - IsMouseDragging() +// - GetMousePos() +// - GetMousePosOnOpeningCurrentPopup() +// - IsMousePosValid() +// - IsAnyMouseDown() +// - GetMouseDragDelta() +// - ResetMouseDragDelta() +// - GetMouseCursor() +// - SetMouseCursor() +//----------------------------------------------------------------------------- +// - UpdateAliasKey() +// - GetMergedModsFromKeys() +// - UpdateKeyboardInputs() +// - UpdateMouseInputs() +//----------------------------------------------------------------------------- +// - LockWheelingWindow [Internal] +// - FindBestWheelingWindow [Internal] +// - UpdateMouseWheel() [Internal] +//----------------------------------------------------------------------------- +// - SetNextFrameWantCaptureKeyboard() +// - SetNextFrameWantCaptureMouse() +//----------------------------------------------------------------------------- +// - GetInputSourceName() [Internal] +// - DebugPrintInputEvent() [Internal] +// - UpdateInputEvents() [Internal] +//----------------------------------------------------------------------------- +// - GetKeyOwner() [Internal] +// - TestKeyOwner() [Internal] +// - SetKeyOwner() [Internal] +// - SetItemKeyOwner() [Internal] +// - Shortcut() [Internal] +//----------------------------------------------------------------------------- -// Test if mouse cursor is hovering given rectangle -// NB- Rectangle is clipped by our current clip setting -// NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding) -bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip) -{ - ImGuiContext& g = *GImGui; - - // Clip - ImRect rect_clipped(r_min, r_max); - if (clip) - rect_clipped.ClipWith(g.CurrentWindow->ClipRect); - - // Expand for touch input - const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding); - if (!rect_for_touch.Contains(g.IO.MousePos)) - return false; - return true; -} - -ImGuiKeyData* ImGui::GetKeyData(ImGuiKey key) +ImGuiKeyData* ImGui::GetKeyData(ImGuiContext* ctx, ImGuiKey key) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *ctx; // Special storage location for mods if (key & ImGuiMod_Mask_) - key = ConvertSingleModFlagToKey(key); + key = ConvertSingleModFlagToKey(ctx, key); - int index; #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO IM_ASSERT(key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_NamedKey_END); - if (IsLegacyKey(key)) - index = (g.IO.KeyMap[key] != -1) ? g.IO.KeyMap[key] : key; // Remap native->imgui or imgui->native - else - index = key; + if (IsLegacyKey(key) && g.IO.KeyMap[key] != -1) + key = (ImGuiKey)g.IO.KeyMap[key]; // Remap native->imgui or imgui->native #else IM_ASSERT(IsNamedKey(key) && "Support for user key indices was dropped in favor of ImGuiKey. Please update backend & user code."); - index = key - ImGuiKey_NamedKey_BEGIN; #endif - return &g.IO.KeysData[index]; + return &g.IO.KeysData[key - ImGuiKey_KeysData_OFFSET]; } #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO @@ -7844,31 +7955,34 @@ IM_STATIC_ASSERT(ImGuiKey_NamedKey_COUNT == IM_ARRAYSIZE(GKeyNames)); const char* ImGui::GetKeyName(ImGuiKey key) { + ImGuiContext& g = *GImGui; #ifdef IMGUI_DISABLE_OBSOLETE_KEYIO - IM_ASSERT((IsNamedKey(key) || key == ImGuiKey_None) && "Support for user key indices was dropped in favor of ImGuiKey. Please update backend and user code."); + IM_ASSERT((IsNamedKeyOrModKey(key) || key == ImGuiKey_None) && "Support for user key indices was dropped in favor of ImGuiKey. Please update backend and user code."); #else if (IsLegacyKey(key)) { - ImGuiIO& io = GetIO(); - if (io.KeyMap[key] == -1) + if (g.IO.KeyMap[key] == -1) return "N/A"; - IM_ASSERT(IsNamedKey((ImGuiKey)io.KeyMap[key])); - key = (ImGuiKey)io.KeyMap[key]; + IM_ASSERT(IsNamedKey((ImGuiKey)g.IO.KeyMap[key])); + key = (ImGuiKey)g.IO.KeyMap[key]; } #endif if (key == ImGuiKey_None) return "None"; if (key & ImGuiMod_Mask_) - key = ConvertSingleModFlagToKey(key); + key = ConvertSingleModFlagToKey(&g, key); if (!IsNamedKey(key)) return "Unknown"; return GKeyNames[key - ImGuiKey_NamedKey_BEGIN]; } +// ImGuiMod_Shortcut is translated to either Ctrl or Super. void ImGui::GetKeyChordName(ImGuiKeyChord key_chord, char* out_buf, int out_buf_size) { ImGuiContext& g = *GImGui; + if (key_chord & ImGuiMod_Shortcut) + key_chord = ConvertShortcutMod(key_chord); ImFormatString(out_buf, (size_t)out_buf_size, "%s%s%s%s%s", (key_chord & ImGuiMod_Ctrl) ? "Ctrl+" : "", (key_chord & ImGuiMod_Shift) ? "Shift+" : "", @@ -7912,45 +8026,232 @@ int ImGui::GetKeyPressedAmount(ImGuiKey key, float repeat_delay, float repeat_ra { ImGuiContext& g = *GImGui; const ImGuiKeyData* key_data = GetKeyData(key); - if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on input ownership) + if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on key ownership) return 0; const float t = key_data->DownDuration; return CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, repeat_delay, repeat_rate); } // Return 2D vector representing the combination of four cardinal direction, with analog value support (for e.g. ImGuiKey_GamepadLStick* values). -ImVec2 ImGui::GetKeyVector2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down) +ImVec2 ImGui::GetKeyMagnitude2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down) { return ImVec2( GetKeyData(key_right)->AnalogValue - GetKeyData(key_left)->AnalogValue, GetKeyData(key_down)->AnalogValue - GetKeyData(key_up)->AnalogValue); } +// Rewrite routing data buffers to strip old entries + sort by key to make queries not touch scattered data. +// Entries D,A,B,B,A,C,B --> A,A,B,B,B,C,D +// Index A:1 B:2 C:5 D:0 --> A:0 B:2 C:5 D:6 +// See 'Metrics->Key Owners & Shortcut Routing' to visualize the result of that operation. +static void ImGui::UpdateKeyRoutingTable(ImGuiKeyRoutingTable* rt) +{ + ImGuiContext& g = *GImGui; + rt->EntriesNext.resize(0); + for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) + { + const int new_routing_start_idx = rt->EntriesNext.Size; + ImGuiKeyRoutingData* routing_entry; + for (int old_routing_idx = rt->Index[key - ImGuiKey_NamedKey_BEGIN]; old_routing_idx != -1; old_routing_idx = routing_entry->NextEntryIndex) + { + routing_entry = &rt->Entries[old_routing_idx]; + routing_entry->RoutingCurr = routing_entry->RoutingNext; // Update entry + routing_entry->RoutingNext = ImGuiKeyOwner_None; + routing_entry->RoutingNextScore = 255; + if (routing_entry->RoutingCurr == ImGuiKeyOwner_None) + continue; + rt->EntriesNext.push_back(*routing_entry); // Write alive ones into new buffer + + // Apply routing to owner if there's no owner already (RoutingCurr == None at this point) + if (routing_entry->Mods == g.IO.KeyMods) + { + ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key); + if (owner_data->OwnerCurr == ImGuiKeyOwner_None) + owner_data->OwnerCurr = routing_entry->RoutingCurr; + } + } + + // Rewrite linked-list + rt->Index[key - ImGuiKey_NamedKey_BEGIN] = (ImGuiKeyRoutingIndex)(new_routing_start_idx < rt->EntriesNext.Size ? new_routing_start_idx : -1); + for (int n = new_routing_start_idx; n < rt->EntriesNext.Size; n++) + rt->EntriesNext[n].NextEntryIndex = (ImGuiKeyRoutingIndex)((n + 1 < rt->EntriesNext.Size) ? n + 1 : -1); + } + rt->Entries.swap(rt->EntriesNext); // Swap new and old indexes +} + +// owner_id may be None/Any, but routing_id needs to be always be set, so we default to GetCurrentFocusScope(). +static inline ImGuiID GetRoutingIdFromOwnerId(ImGuiID owner_id) +{ + ImGuiContext& g = *GImGui; + return (owner_id != ImGuiKeyOwner_None && owner_id != ImGuiKeyOwner_Any) ? owner_id : g.CurrentFocusScopeId; +} + +ImGuiKeyRoutingData* ImGui::GetShortcutRoutingData(ImGuiKeyChord key_chord) +{ + // Majority of shortcuts will be Key + any number of Mods + // We accept _Single_ mod with ImGuiKey_None. + // - Shortcut(ImGuiKey_S | ImGuiMod_Ctrl); // Legal + // - Shortcut(ImGuiKey_S | ImGuiMod_Ctrl | ImGuiMod_Shift); // Legal + // - Shortcut(ImGuiMod_Ctrl); // Legal + // - Shortcut(ImGuiMod_Ctrl | ImGuiMod_Shift); // Not legal + ImGuiContext& g = *GImGui; + ImGuiKeyRoutingTable* rt = &g.KeysRoutingTable; + ImGuiKeyRoutingData* routing_data; + if (key_chord & ImGuiMod_Shortcut) + key_chord = ConvertShortcutMod(key_chord); + ImGuiKey key = (ImGuiKey)(key_chord & ~ImGuiMod_Mask_); + ImGuiKey mods = (ImGuiKey)(key_chord & ImGuiMod_Mask_); + if (key == ImGuiKey_None) + key = ConvertSingleModFlagToKey(&g, mods); + IM_ASSERT(IsNamedKey(key)); + + // Get (in the majority of case, the linked list will have one element so this should be 2 reads. + // Subsequent elements will be contiguous in memory as list is sorted/rebuilt in NewFrame). + for (ImGuiKeyRoutingIndex idx = rt->Index[key - ImGuiKey_NamedKey_BEGIN]; idx != -1; idx = routing_data->NextEntryIndex) + { + routing_data = &rt->Entries[idx]; + if (routing_data->Mods == mods) + return routing_data; + } + + // Add to linked-list + ImGuiKeyRoutingIndex routing_data_idx = (ImGuiKeyRoutingIndex)rt->Entries.Size; + rt->Entries.push_back(ImGuiKeyRoutingData()); + routing_data = &rt->Entries[routing_data_idx]; + routing_data->Mods = (ImU16)mods; + routing_data->NextEntryIndex = rt->Index[key - ImGuiKey_NamedKey_BEGIN]; // Setup linked list + rt->Index[key - ImGuiKey_NamedKey_BEGIN] = routing_data_idx; + return routing_data; +} + +// Current score encoding (lower is highest priority): +// - 0: ImGuiInputFlags_RouteGlobalHigh +// - 1: ImGuiInputFlags_RouteFocused (if item active) +// - 2: ImGuiInputFlags_RouteGlobal +// - 3+: ImGuiInputFlags_RouteFocused (if window in focus-stack) +// - 254: ImGuiInputFlags_RouteGlobalLow +// - 255: never route +// 'flags' should include an explicit routing policy +static int CalcRoutingScore(ImGuiWindow* location, ImGuiID owner_id, ImGuiInputFlags flags) +{ + if (flags & ImGuiInputFlags_RouteFocused) + { + ImGuiContext& g = *GImGui; + ImGuiWindow* focused = g.NavWindow; + + // ActiveID gets top priority + // (we don't check g.ActiveIdUsingAllKeys here. Routing is applied but if input ownership is tested later it may discard it) + if (owner_id != 0 && g.ActiveId == owner_id) + return 1; + + // Score based on distance to focused window (lower is better) + // Assuming both windows are submitting a routing request, + // - When Window....... is focused -> Window scores 3 (best), Window/ChildB scores 255 (no match) + // - When Window/ChildB is focused -> Window scores 4, Window/ChildB scores 3 (best) + // Assuming only WindowA is submitting a routing request, + // - When Window/ChildB is focused -> Window scores 4 (best), Window/ChildB doesn't have a score. + if (focused != NULL && focused->RootWindow == location->RootWindow) + for (int next_score = 3; focused != NULL; next_score++) + { + if (focused == location) + { + IM_ASSERT(next_score < 255); + return next_score; + } + focused = (focused->RootWindow != focused) ? focused->ParentWindow : NULL; // FIXME: This could be later abstracted as a focus path + } + return 255; + } + + // ImGuiInputFlags_RouteGlobalHigh is default, so calls without flags are not conditional + if (flags & ImGuiInputFlags_RouteGlobal) + return 2; + if (flags & ImGuiInputFlags_RouteGlobalLow) + return 254; + return 0; +} + +// Request a desired route for an input chord (key + mods). +// Return true if the route is available this frame. +// - Routes and key ownership are attributed at the beginning of next frame based on best score and mod state. +// (Conceptually this does a "Submit for next frame" + "Test for current frame". +// As such, it could be called TrySetXXX or SubmitXXX, or the Submit and Test operations should be separate.) +// - Using 'owner_id == ImGuiKeyOwner_Any/0': auto-assign an owner based on current focus scope (each window has its focus scope by default) +// - Using 'owner_id == ImGuiKeyOwner_None': allows disabling/locking a shortcut. +bool ImGui::SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags) +{ + ImGuiContext& g = *GImGui; + if ((flags & ImGuiInputFlags_RouteMask_) == 0) + flags |= ImGuiInputFlags_RouteGlobalHigh; // IMPORTANT: This is the default for SetShortcutRouting() but NOT Shortcut() + else + IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiInputFlags_RouteMask_)); // Check that only 1 routing flag is used + + if (flags & ImGuiInputFlags_RouteUnlessBgFocused) + if (g.NavWindow == NULL) + return false; + if (flags & ImGuiInputFlags_RouteAlways) + return true; + + const int score = CalcRoutingScore(g.CurrentWindow, owner_id, flags); + if (score == 255) + return false; + + // Submit routing for NEXT frame (assuming score is sufficient) + // FIXME: Could expose a way to use a "serve last" policy for same score resolution (using <= instead of <). + ImGuiKeyRoutingData* routing_data = GetShortcutRoutingData(key_chord); + const ImGuiID routing_id = GetRoutingIdFromOwnerId(owner_id); + //const bool set_route = (flags & ImGuiInputFlags_ServeLast) ? (score <= routing_data->RoutingNextScore) : (score < routing_data->RoutingNextScore); + if (score < routing_data->RoutingNextScore) + { + routing_data->RoutingNext = routing_id; + routing_data->RoutingNextScore = (ImU8)score; + } + + // Return routing state for CURRENT frame + return routing_data->RoutingCurr == routing_id; +} + +// Currently unused by core (but used by tests) +// Note: this cannot be turned into GetShortcutRouting() because we do the owner_id->routing_id translation, name would be more misleading. +bool ImGui::TestShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id) +{ + const ImGuiID routing_id = GetRoutingIdFromOwnerId(owner_id); + ImGuiKeyRoutingData* routing_data = GetShortcutRoutingData(key_chord); // FIXME: Could avoid creating entry. + return routing_data->RoutingCurr == routing_id; +} + // Note that Dear ImGui doesn't know the meaning/semantic of ImGuiKey from 0..511: they are legacy native keycodes. // Consider transitioning from 'IsKeyDown(MY_ENGINE_KEY_A)' (<1.87) to IsKeyDown(ImGuiKey_A) (>= 1.87) bool ImGui::IsKeyDown(ImGuiKey key) +{ + return IsKeyDown(key, ImGuiKeyOwner_Any); +} + +bool ImGui::IsKeyDown(ImGuiKey key, ImGuiID owner_id) { const ImGuiKeyData* key_data = GetKeyData(key); if (!key_data->Down) return false; + if (!TestKeyOwner(key, owner_id)) + return false; return true; } bool ImGui::IsKeyPressed(ImGuiKey key, bool repeat) { - return IsKeyPressedEx(key, repeat ? ImGuiInputFlags_Repeat : ImGuiInputFlags_None); + return IsKeyPressed(key, ImGuiKeyOwner_Any, repeat ? ImGuiInputFlags_Repeat : ImGuiInputFlags_None); } -// Important: unlike legacy IsKeyPressed(ImGuiKey, bool repeat=true) which DEFAULT to repeat, this requires EXPLICIT repeat. -// [Internal] 2022/07: Do not call this directly! It is a temporary entry point which we will soon replace with an overload for IsKeyPressed() when we introduce key ownership. -bool ImGui::IsKeyPressedEx(ImGuiKey key, ImGuiInputFlags flags) +// Important: unless legacy IsKeyPressed(ImGuiKey, bool repeat=true) which DEFAULT to repeat, this requires EXPLICIT repeat. +bool ImGui::IsKeyPressed(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags) { const ImGuiKeyData* key_data = GetKeyData(key); - if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on input ownership) + if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on key ownership) return false; const float t = key_data->DownDuration; if (t < 0.0f) return false; + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedByIsKeyPressed) == 0); // Passing flags not supported by this function! bool pressed = (t == 0.0f); if (!pressed && ((flags & ImGuiInputFlags_Repeat) != 0)) @@ -7959,17 +8260,25 @@ bool ImGui::IsKeyPressedEx(ImGuiKey key, ImGuiInputFlags flags) GetTypematicRepeatRate(flags, &repeat_delay, &repeat_rate); pressed = (t > repeat_delay) && GetKeyPressedAmount(key, repeat_delay, repeat_rate) > 0; } - if (!pressed) return false; + if (!TestKeyOwner(key, owner_id)) + return false; return true; } bool ImGui::IsKeyReleased(ImGuiKey key) +{ + return IsKeyReleased(key, ImGuiKeyOwner_Any); +} + +bool ImGui::IsKeyReleased(ImGuiKey key, ImGuiID owner_id) { const ImGuiKeyData* key_data = GetKeyData(key); if (key_data->DownDurationPrev < 0.0f || key_data->Down) return false; + if (!TestKeyOwner(key, owner_id)) + return false; return true; } @@ -7977,35 +8286,62 @@ bool ImGui::IsMouseDown(ImGuiMouseButton button) { ImGuiContext& g = *GImGui; IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - return g.IO.MouseDown[button]; + return g.IO.MouseDown[button] && TestKeyOwner(MouseButtonToKey(button), ImGuiKeyOwner_Any); // should be same as IsKeyDown(MouseButtonToKey(button), ImGuiKeyOwner_Any), but this allows legacy code hijacking the io.Mousedown[] array. +} + +bool ImGui::IsMouseDown(ImGuiMouseButton button, ImGuiID owner_id) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseDown[button] && TestKeyOwner(MouseButtonToKey(button), owner_id); // Should be same as IsKeyDown(MouseButtonToKey(button), owner_id), but this allows legacy code hijacking the io.Mousedown[] array. } bool ImGui::IsMouseClicked(ImGuiMouseButton button, bool repeat) +{ + return IsMouseClicked(button, ImGuiKeyOwner_Any, repeat ? ImGuiInputFlags_Repeat : ImGuiInputFlags_None); +} + +bool ImGui::IsMouseClicked(ImGuiMouseButton button, ImGuiID owner_id, ImGuiInputFlags flags) { ImGuiContext& g = *GImGui; IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - if (!g.IO.MouseDown[button]) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on input ownership) + if (!g.IO.MouseDown[button]) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on key ownership) return false; const float t = g.IO.MouseDownDuration[button]; - if (t == 0.0f) - return true; - if (repeat && t > g.IO.KeyRepeatDelay) - return CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0; - return false; + if (t < 0.0f) + return false; + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedByIsKeyPressed) == 0); // Passing flags not supported by this function! + + const bool repeat = (flags & ImGuiInputFlags_Repeat) != 0; + const bool pressed = (t == 0.0f) || (repeat && t > g.IO.KeyRepeatDelay && CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0); + if (!pressed) + return false; + + if (!TestKeyOwner(MouseButtonToKey(button), owner_id)) + return false; + + return true; } bool ImGui::IsMouseReleased(ImGuiMouseButton button) { ImGuiContext& g = *GImGui; IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - return g.IO.MouseReleased[button]; + return g.IO.MouseReleased[button] && TestKeyOwner(MouseButtonToKey(button), ImGuiKeyOwner_Any); // Should be same as IsKeyReleased(MouseButtonToKey(button), ImGuiKeyOwner_Any) +} + +bool ImGui::IsMouseReleased(ImGuiMouseButton button, ImGuiID owner_id) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseReleased[button] && TestKeyOwner(MouseButtonToKey(button), owner_id); // Should be same as IsKeyReleased(MouseButtonToKey(button), owner_id) } bool ImGui::IsMouseDoubleClicked(ImGuiMouseButton button) { ImGuiContext& g = *GImGui; IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - return g.IO.MouseClickedCount[button] == 2; + return g.IO.MouseClickedCount[button] == 2 && TestKeyOwner(MouseButtonToKey(button), ImGuiKeyOwner_Any); } int ImGui::GetMouseClickedCount(ImGuiMouseButton button) @@ -8015,6 +8351,25 @@ int ImGui::GetMouseClickedCount(ImGuiMouseButton button) return g.IO.MouseClickedCount[button]; } +// Test if mouse cursor is hovering given rectangle +// NB- Rectangle is clipped by our current clip setting +// NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding) +bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip) +{ + ImGuiContext& g = *GImGui; + + // Clip + ImRect rect_clipped(r_min, r_max); + if (clip) + rect_clipped.ClipWith(g.CurrentWindow->ClipRect); + + // Expand for touch input + const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding); + if (!rect_for_touch.Contains(g.IO.MousePos)) + return false; + return true; +} + // Return if a mouse click/drag went past the given threshold. Valid to call during the MouseReleased frame. // [Internal] This doesn't test if the button is pressed bool ImGui::IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold) @@ -8050,61 +8405,422 @@ ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup() return g.IO.MousePos; } -// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position. -bool ImGui::IsMousePosValid(const ImVec2* mouse_pos) -{ - // The assert is only to silence a false-positive in XCode Static Analysis. - // Because GImGui is not dereferenced in every code path, the static analyzer assume that it may be NULL (which it doesn't for other functions). - IM_ASSERT(GImGui != NULL); - const float MOUSE_INVALID = -256000.0f; - ImVec2 p = mouse_pos ? *mouse_pos : GImGui->IO.MousePos; - return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID; +// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position. +bool ImGui::IsMousePosValid(const ImVec2* mouse_pos) +{ + // The assert is only to silence a false-positive in XCode Static Analysis. + // Because GImGui is not dereferenced in every code path, the static analyzer assume that it may be NULL (which it doesn't for other functions). + IM_ASSERT(GImGui != NULL); + const float MOUSE_INVALID = -256000.0f; + ImVec2 p = mouse_pos ? *mouse_pos : GImGui->IO.MousePos; + return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID; +} + +// [WILL OBSOLETE] This was designed for backends, but prefer having backend maintain a mask of held mouse buttons, because upcoming input queue system will make this invalid. +bool ImGui::IsAnyMouseDown() +{ + ImGuiContext& g = *GImGui; + for (int n = 0; n < IM_ARRAYSIZE(g.IO.MouseDown); n++) + if (g.IO.MouseDown[n]) + return true; + return false; +} + +// Return the delta from the initial clicking position while the mouse button is clicked or was just released. +// This is locked and return 0.0f until the mouse moves past a distance threshold at least once. +// NB: This is only valid if IsMousePosValid(). backends in theory should always keep mouse position valid when dragging even outside the client window. +ImVec2 ImGui::GetMouseDragDelta(ImGuiMouseButton button, float lock_threshold) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + if (lock_threshold < 0.0f) + lock_threshold = g.IO.MouseDragThreshold; + if (g.IO.MouseDown[button] || g.IO.MouseReleased[button]) + if (g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold) + if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MouseClickedPos[button])) + return g.IO.MousePos - g.IO.MouseClickedPos[button]; + return ImVec2(0.0f, 0.0f); +} + +void ImGui::ResetMouseDragDelta(ImGuiMouseButton button) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + // NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr + g.IO.MouseClickedPos[button] = g.IO.MousePos; +} + +// Get desired mouse cursor shape. +// Important: this is meant to be used by a platform backend, it is reset in ImGui::NewFrame(), +// updated during the frame, and locked in EndFrame()/Render(). +// If you use software rendering by setting io.MouseDrawCursor then Dear ImGui will render those for you +ImGuiMouseCursor ImGui::GetMouseCursor() +{ + ImGuiContext& g = *GImGui; + return g.MouseCursor; +} + +void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type) +{ + ImGuiContext& g = *GImGui; + g.MouseCursor = cursor_type; +} + +static void UpdateAliasKey(ImGuiKey key, bool v, float analog_value) +{ + IM_ASSERT(ImGui::IsAliasKey(key)); + ImGuiKeyData* key_data = ImGui::GetKeyData(key); + key_data->Down = v; + key_data->AnalogValue = analog_value; +} + +// [Internal] Do not use directly +static ImGuiKeyChord GetMergedModsFromKeys() +{ + ImGuiKeyChord mods = 0; + if (ImGui::IsKeyDown(ImGuiMod_Ctrl)) { mods |= ImGuiMod_Ctrl; } + if (ImGui::IsKeyDown(ImGuiMod_Shift)) { mods |= ImGuiMod_Shift; } + if (ImGui::IsKeyDown(ImGuiMod_Alt)) { mods |= ImGuiMod_Alt; } + if (ImGui::IsKeyDown(ImGuiMod_Super)) { mods |= ImGuiMod_Super; } + return mods; +} + +static void ImGui::UpdateKeyboardInputs() +{ + ImGuiContext& g = *GImGui; + ImGuiIO& io = g.IO; + + // Import legacy keys or verify they are not used +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + if (io.BackendUsingLegacyKeyArrays == 0) + { + // Backend used new io.AddKeyEvent() API: Good! Verify that old arrays are never written to externally. + for (int n = 0; n < ImGuiKey_LegacyNativeKey_END; n++) + IM_ASSERT((io.KeysDown[n] == false || IsKeyDown((ImGuiKey)n)) && "Backend needs to either only use io.AddKeyEvent(), either only fill legacy io.KeysDown[] + io.KeyMap[]. Not both!"); + } + else + { + if (g.FrameCount == 0) + for (int n = ImGuiKey_LegacyNativeKey_BEGIN; n < ImGuiKey_LegacyNativeKey_END; n++) + IM_ASSERT(g.IO.KeyMap[n] == -1 && "Backend is not allowed to write to io.KeyMap[0..511]!"); + + // Build reverse KeyMap (Named -> Legacy) + for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_NamedKey_END; n++) + if (io.KeyMap[n] != -1) + { + IM_ASSERT(IsLegacyKey((ImGuiKey)io.KeyMap[n])); + io.KeyMap[io.KeyMap[n]] = n; + } + + // Import legacy keys into new ones + for (int n = ImGuiKey_LegacyNativeKey_BEGIN; n < ImGuiKey_LegacyNativeKey_END; n++) + if (io.KeysDown[n] || io.BackendUsingLegacyKeyArrays == 1) + { + const ImGuiKey key = (ImGuiKey)(io.KeyMap[n] != -1 ? io.KeyMap[n] : n); + IM_ASSERT(io.KeyMap[n] == -1 || IsNamedKey(key)); + io.KeysData[key].Down = io.KeysDown[n]; + if (key != n) + io.KeysDown[key] = io.KeysDown[n]; // Allow legacy code using io.KeysDown[GetKeyIndex()] with old backends + io.BackendUsingLegacyKeyArrays = 1; + } + if (io.BackendUsingLegacyKeyArrays == 1) + { + GetKeyData(ImGuiMod_Ctrl)->Down = io.KeyCtrl; + GetKeyData(ImGuiMod_Shift)->Down = io.KeyShift; + GetKeyData(ImGuiMod_Alt)->Down = io.KeyAlt; + GetKeyData(ImGuiMod_Super)->Down = io.KeySuper; + } + } + +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; + if (io.BackendUsingLegacyNavInputArray && nav_gamepad_active) + { + #define MAP_LEGACY_NAV_INPUT_TO_KEY1(_KEY, _NAV1) do { io.KeysData[_KEY].Down = (io.NavInputs[_NAV1] > 0.0f); io.KeysData[_KEY].AnalogValue = io.NavInputs[_NAV1]; } while (0) + #define MAP_LEGACY_NAV_INPUT_TO_KEY2(_KEY, _NAV1, _NAV2) do { io.KeysData[_KEY].Down = (io.NavInputs[_NAV1] > 0.0f) || (io.NavInputs[_NAV2] > 0.0f); io.KeysData[_KEY].AnalogValue = ImMax(io.NavInputs[_NAV1], io.NavInputs[_NAV2]); } while (0) + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceDown, ImGuiNavInput_Activate); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceRight, ImGuiNavInput_Cancel); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceLeft, ImGuiNavInput_Menu); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceUp, ImGuiNavInput_Input); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadLeft, ImGuiNavInput_DpadLeft); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadRight, ImGuiNavInput_DpadRight); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadUp, ImGuiNavInput_DpadUp); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadDown, ImGuiNavInput_DpadDown); + MAP_LEGACY_NAV_INPUT_TO_KEY2(ImGuiKey_GamepadL1, ImGuiNavInput_FocusPrev, ImGuiNavInput_TweakSlow); + MAP_LEGACY_NAV_INPUT_TO_KEY2(ImGuiKey_GamepadR1, ImGuiNavInput_FocusNext, ImGuiNavInput_TweakFast); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickLeft, ImGuiNavInput_LStickLeft); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickRight, ImGuiNavInput_LStickRight); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickUp, ImGuiNavInput_LStickUp); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickDown, ImGuiNavInput_LStickDown); + #undef NAV_MAP_KEY + } +#endif +#endif + + // Update aliases + for (int n = 0; n < ImGuiMouseButton_COUNT; n++) + UpdateAliasKey(MouseButtonToKey(n), io.MouseDown[n], io.MouseDown[n] ? 1.0f : 0.0f); + UpdateAliasKey(ImGuiKey_MouseWheelX, io.MouseWheelH != 0.0f, io.MouseWheelH); + UpdateAliasKey(ImGuiKey_MouseWheelY, io.MouseWheel != 0.0f, io.MouseWheel); + + // Synchronize io.KeyMods and io.KeyXXX values. + // - New backends (1.87+): send io.AddKeyEvent(ImGuiMod_XXX) -> -> (here) deriving io.KeyMods + io.KeyXXX from key array. + // - Legacy backends: set io.KeyXXX bools -> (above) set key array from io.KeyXXX -> (here) deriving io.KeyMods + io.KeyXXX from key array. + // So with legacy backends the 4 values will do a unnecessary back-and-forth but it makes the code simpler and future facing. + io.KeyMods = GetMergedModsFromKeys(); + io.KeyCtrl = (io.KeyMods & ImGuiMod_Ctrl) != 0; + io.KeyShift = (io.KeyMods & ImGuiMod_Shift) != 0; + io.KeyAlt = (io.KeyMods & ImGuiMod_Alt) != 0; + io.KeySuper = (io.KeyMods & ImGuiMod_Super) != 0; + + // Clear gamepad data if disabled + if ((io.BackendFlags & ImGuiBackendFlags_HasGamepad) == 0) + for (int i = ImGuiKey_Gamepad_BEGIN; i < ImGuiKey_Gamepad_END; i++) + { + io.KeysData[i - ImGuiKey_KeysData_OFFSET].Down = false; + io.KeysData[i - ImGuiKey_KeysData_OFFSET].AnalogValue = 0.0f; + } + + // Update keys + for (int i = 0; i < ImGuiKey_KeysData_SIZE; i++) + { + ImGuiKeyData* key_data = &io.KeysData[i]; + key_data->DownDurationPrev = key_data->DownDuration; + key_data->DownDuration = key_data->Down ? (key_data->DownDuration < 0.0f ? 0.0f : key_data->DownDuration + io.DeltaTime) : -1.0f; + } + + // Update keys/input owner (named keys only): one entry per key + for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) + { + ImGuiKeyData* key_data = &io.KeysData[key - ImGuiKey_KeysData_OFFSET]; + ImGuiKeyOwnerData* owner_data = &g.KeysOwnerData[key - ImGuiKey_NamedKey_BEGIN]; + owner_data->OwnerCurr = owner_data->OwnerNext; + if (!key_data->Down) // Important: ownership is released on the frame after a release. Ensure a 'MouseDown -> CloseWindow -> MouseUp' chain doesn't lead to someone else seeing the MouseUp. + owner_data->OwnerNext = ImGuiKeyOwner_None; + owner_data->LockThisFrame = owner_data->LockUntilRelease = owner_data->LockUntilRelease && key_data->Down; // Clear LockUntilRelease when key is not Down anymore + } + + UpdateKeyRoutingTable(&g.KeysRoutingTable); +} + +static void ImGui::UpdateMouseInputs() +{ + ImGuiContext& g = *GImGui; + ImGuiIO& io = g.IO; + + // Mouse Wheel swapping flag + // As a standard behavior holding SHIFT while using Vertical Mouse Wheel triggers Horizontal scroll instead + // - We avoid doing it on OSX as it the OS input layer handles this already. + // - FIXME: However this means when running on OSX over Emscripten, Shift+WheelY will incur two swapping (1 in OS, 1 here), canceling the feature. + // - FIXME: When we can distinguish e.g. touchpad scroll events from mouse ones, we'll set this accordingly based on input source. + io.MouseWheelRequestAxisSwap = io.KeyShift && !io.ConfigMacOSXBehaviors; + + // Round mouse position to avoid spreading non-rounded position (e.g. UpdateManualResize doesn't support them well) + if (IsMousePosValid(&io.MousePos)) + io.MousePos = g.MouseLastValidPos = ImFloorSigned(io.MousePos); + + // If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta + if (IsMousePosValid(&io.MousePos) && IsMousePosValid(&io.MousePosPrev)) + io.MouseDelta = io.MousePos - io.MousePosPrev; + else + io.MouseDelta = ImVec2(0.0f, 0.0f); + + // Update stationary timer. + // FIXME: May need to rework again to have some tolerance for occasional small movement, while being functional on high-framerates. + const float mouse_stationary_threshold = (io.MouseSource == ImGuiMouseSource_Mouse) ? 2.0f : 3.0f; // Slightly higher threshold for ImGuiMouseSource_TouchScreen/ImGuiMouseSource_Pen, may need rework. + const bool mouse_stationary = (ImLengthSqr(io.MouseDelta) <= mouse_stationary_threshold * mouse_stationary_threshold); + g.MouseStationaryTimer = mouse_stationary ? (g.MouseStationaryTimer + io.DeltaTime) : 0.0f; + //IMGUI_DEBUG_LOG("%.4f\n", g.MouseStationaryTimer); + + // If mouse moved we re-enable mouse hovering in case it was disabled by gamepad/keyboard. In theory should use a >0.0f threshold but would need to reset in everywhere we set this to true. + if (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f) + g.NavDisableMouseHover = false; + + io.MousePosPrev = io.MousePos; + for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) + { + io.MouseClicked[i] = io.MouseDown[i] && io.MouseDownDuration[i] < 0.0f; + io.MouseClickedCount[i] = 0; // Will be filled below + io.MouseReleased[i] = !io.MouseDown[i] && io.MouseDownDuration[i] >= 0.0f; + io.MouseDownDurationPrev[i] = io.MouseDownDuration[i]; + io.MouseDownDuration[i] = io.MouseDown[i] ? (io.MouseDownDuration[i] < 0.0f ? 0.0f : io.MouseDownDuration[i] + io.DeltaTime) : -1.0f; + if (io.MouseClicked[i]) + { + bool is_repeated_click = false; + if ((float)(g.Time - io.MouseClickedTime[i]) < io.MouseDoubleClickTime) + { + ImVec2 delta_from_click_pos = IsMousePosValid(&io.MousePos) ? (io.MousePos - io.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f); + if (ImLengthSqr(delta_from_click_pos) < io.MouseDoubleClickMaxDist * io.MouseDoubleClickMaxDist) + is_repeated_click = true; + } + if (is_repeated_click) + io.MouseClickedLastCount[i]++; + else + io.MouseClickedLastCount[i] = 1; + io.MouseClickedTime[i] = g.Time; + io.MouseClickedPos[i] = io.MousePos; + io.MouseClickedCount[i] = io.MouseClickedLastCount[i]; + io.MouseDragMaxDistanceSqr[i] = 0.0f; + } + else if (io.MouseDown[i]) + { + // Maintain the maximum distance we reaching from the initial click position, which is used with dragging threshold + float delta_sqr_click_pos = IsMousePosValid(&io.MousePos) ? ImLengthSqr(io.MousePos - io.MouseClickedPos[i]) : 0.0f; + io.MouseDragMaxDistanceSqr[i] = ImMax(io.MouseDragMaxDistanceSqr[i], delta_sqr_click_pos); + } + + // We provide io.MouseDoubleClicked[] as a legacy service + io.MouseDoubleClicked[i] = (io.MouseClickedCount[i] == 2); + + // Clicking any mouse button reactivate mouse hovering which may have been deactivated by gamepad/keyboard navigation + if (io.MouseClicked[i]) + g.NavDisableMouseHover = false; + } } -// [WILL OBSOLETE] This was designed for backends, but prefer having backend maintain a mask of held mouse buttons, because upcoming input queue system will make this invalid. -bool ImGui::IsAnyMouseDown() +static void LockWheelingWindow(ImGuiWindow* window, float wheel_amount) { ImGuiContext& g = *GImGui; - for (int n = 0; n < IM_ARRAYSIZE(g.IO.MouseDown); n++) - if (g.IO.MouseDown[n]) - return true; - return false; + if (window) + g.WheelingWindowReleaseTimer = ImMin(g.WheelingWindowReleaseTimer + ImAbs(wheel_amount) * WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER, WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER); + else + g.WheelingWindowReleaseTimer = 0.0f; + if (g.WheelingWindow == window) + return; + IMGUI_DEBUG_LOG_IO("[io] LockWheelingWindow() \"%s\"\n", window ? window->Name : "NULL"); + g.WheelingWindow = window; + g.WheelingWindowRefMousePos = g.IO.MousePos; + if (window == NULL) + { + g.WheelingWindowStartFrame = -1; + g.WheelingAxisAvg = ImVec2(0.0f, 0.0f); + } } -// Return the delta from the initial clicking position while the mouse button is clicked or was just released. -// This is locked and return 0.0f until the mouse moves past a distance threshold at least once. -// NB: This is only valid if IsMousePosValid(). backends in theory should always keep mouse position valid when dragging even outside the client window. -ImVec2 ImGui::GetMouseDragDelta(ImGuiMouseButton button, float lock_threshold) +static ImGuiWindow* FindBestWheelingWindow(const ImVec2& wheel) { + // For each axis, find window in the hierarchy that may want to use scrolling ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - if (lock_threshold < 0.0f) - lock_threshold = g.IO.MouseDragThreshold; - if (g.IO.MouseDown[button] || g.IO.MouseReleased[button]) - if (g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold) - if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MouseClickedPos[button])) - return g.IO.MousePos - g.IO.MouseClickedPos[button]; - return ImVec2(0.0f, 0.0f); -} + ImGuiWindow* windows[2] = { NULL, NULL }; + for (int axis = 0; axis < 2; axis++) + if (wheel[axis] != 0.0f) + for (ImGuiWindow* window = windows[axis] = g.HoveredWindow; window->Flags & ImGuiWindowFlags_ChildWindow; window = windows[axis] = window->ParentWindow) + { + // Bubble up into parent window if: + // - a child window doesn't allow any scrolling. + // - a child window has the ImGuiWindowFlags_NoScrollWithMouse flag. + //// - a child window doesn't need scrolling because it is already at the edge for the direction we are going in (FIXME-WIP) + const bool has_scrolling = (window->ScrollMax[axis] != 0.0f); + const bool inputs_disabled = (window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs); + //const bool scrolling_past_limits = (wheel_v < 0.0f) ? (window->Scroll[axis] <= 0.0f) : (window->Scroll[axis] >= window->ScrollMax[axis]); + if (has_scrolling && !inputs_disabled) // && !scrolling_past_limits) + break; // select this window + } + if (windows[0] == NULL && windows[1] == NULL) + return NULL; -void ImGui::ResetMouseDragDelta(ImGuiMouseButton button) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - // NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr - g.IO.MouseClickedPos[button] = g.IO.MousePos; -} + // If there's only one window or only one axis then there's no ambiguity + if (windows[0] == windows[1] || windows[0] == NULL || windows[1] == NULL) + return windows[1] ? windows[1] : windows[0]; -ImGuiMouseCursor ImGui::GetMouseCursor() -{ - ImGuiContext& g = *GImGui; - return g.MouseCursor; + // If candidate are different windows we need to decide which one to prioritize + // - First frame: only find a winner if one axis is zero. + // - Subsequent frames: only find a winner when one is more than the other. + if (g.WheelingWindowStartFrame == -1) + g.WheelingWindowStartFrame = g.FrameCount; + if ((g.WheelingWindowStartFrame == g.FrameCount && wheel.x != 0.0f && wheel.y != 0.0f) || (g.WheelingAxisAvg.x == g.WheelingAxisAvg.y)) + { + g.WheelingWindowWheelRemainder = wheel; + return NULL; + } + return (g.WheelingAxisAvg.x > g.WheelingAxisAvg.y) ? windows[0] : windows[1]; } -void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type) +// Called by NewFrame() +void ImGui::UpdateMouseWheel() { + // Reset the locked window if we move the mouse or after the timer elapses. + // FIXME: Ideally we could refactor to have one timer for "changing window w/ same axis" and a shorter timer for "changing window or axis w/ other axis" (#3795) ImGuiContext& g = *GImGui; - g.MouseCursor = cursor_type; + if (g.WheelingWindow != NULL) + { + g.WheelingWindowReleaseTimer -= g.IO.DeltaTime; + if (IsMousePosValid() && ImLengthSqr(g.IO.MousePos - g.WheelingWindowRefMousePos) > g.IO.MouseDragThreshold * g.IO.MouseDragThreshold) + g.WheelingWindowReleaseTimer = 0.0f; + if (g.WheelingWindowReleaseTimer <= 0.0f) + LockWheelingWindow(NULL, 0.0f); + } + + ImVec2 wheel; + wheel.x = TestKeyOwner(ImGuiKey_MouseWheelX, ImGuiKeyOwner_None) ? g.IO.MouseWheelH : 0.0f; + wheel.y = TestKeyOwner(ImGuiKey_MouseWheelY, ImGuiKeyOwner_None) ? g.IO.MouseWheel : 0.0f; + + //IMGUI_DEBUG_LOG("MouseWheel X:%.3f Y:%.3f\n", wheel_x, wheel_y); + ImGuiWindow* mouse_window = g.WheelingWindow ? g.WheelingWindow : g.HoveredWindow; + if (!mouse_window || mouse_window->Collapsed) + return; + + // Zoom / Scale window + // FIXME-OBSOLETE: This is an old feature, it still works but pretty much nobody is using it and may be best redesigned. + if (wheel.y != 0.0f && g.IO.KeyCtrl && g.IO.FontAllowUserScaling) + { + LockWheelingWindow(mouse_window, wheel.y); + ImGuiWindow* window = mouse_window; + const float new_font_scale = ImClamp(window->FontWindowScale + g.IO.MouseWheel * 0.10f, 0.50f, 2.50f); + const float scale = new_font_scale / window->FontWindowScale; + window->FontWindowScale = new_font_scale; + if (window == window->RootWindow) + { + const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size; + SetWindowPos(window, window->Pos + offset, 0); + window->Size = ImFloor(window->Size * scale); + window->SizeFull = ImFloor(window->SizeFull * scale); + } + return; + } + if (g.IO.KeyCtrl) + return; + + // Mouse wheel scrolling + // Read about io.MouseWheelRequestAxisSwap and its issue on Mac+Emscripten in UpdateMouseInputs() + if (g.IO.MouseWheelRequestAxisSwap) + wheel = ImVec2(wheel.y, 0.0f); + + // Maintain a rough average of moving magnitude on both axises + // FIXME: should by based on wall clock time rather than frame-counter + g.WheelingAxisAvg.x = ImExponentialMovingAverage(g.WheelingAxisAvg.x, ImAbs(wheel.x), 30); + g.WheelingAxisAvg.y = ImExponentialMovingAverage(g.WheelingAxisAvg.y, ImAbs(wheel.y), 30); + + // In the rare situation where FindBestWheelingWindow() had to defer first frame of wheeling due to ambiguous main axis, reinject it now. + wheel += g.WheelingWindowWheelRemainder; + g.WheelingWindowWheelRemainder = ImVec2(0.0f, 0.0f); + if (wheel.x == 0.0f && wheel.y == 0.0f) + return; + + // Mouse wheel scrolling: find target and apply + // - don't renew lock if axis doesn't apply on the window. + // - select a main axis when both axises are being moved. + if (ImGuiWindow* window = (g.WheelingWindow ? g.WheelingWindow : FindBestWheelingWindow(wheel))) + if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs)) + { + bool do_scroll[2] = { wheel.x != 0.0f && window->ScrollMax.x != 0.0f, wheel.y != 0.0f && window->ScrollMax.y != 0.0f }; + if (do_scroll[ImGuiAxis_X] && do_scroll[ImGuiAxis_Y]) + do_scroll[(g.WheelingAxisAvg.x > g.WheelingAxisAvg.y) ? ImGuiAxis_Y : ImGuiAxis_X] = false; + if (do_scroll[ImGuiAxis_X]) + { + LockWheelingWindow(window, wheel.x); + float max_step = window->InnerRect.GetWidth() * 0.67f; + float scroll_step = ImFloor(ImMin(2 * window->CalcFontSize(), max_step)); + SetScrollX(window, window->Scroll.x - wheel.x * scroll_step); + } + if (do_scroll[ImGuiAxis_Y]) + { + LockWheelingWindow(window, wheel.y); + float max_step = window->InnerRect.GetHeight() * 0.67f; + float scroll_step = ImFloor(ImMin(5 * window->CalcFontSize(), max_step)); + SetScrollY(window, window->Scroll.y - wheel.y * scroll_step); + } + } } void ImGui::SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard) @@ -8122,19 +8838,25 @@ void ImGui::SetNextFrameWantCaptureMouse(bool want_capture_mouse) #ifndef IMGUI_DISABLE_DEBUG_TOOLS static const char* GetInputSourceName(ImGuiInputSource source) { - const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad", "Nav", "Clipboard" }; + const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad", "Clipboard" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT && source >= 0 && source < ImGuiInputSource_COUNT); return input_source_names[source]; } +static const char* GetMouseSourceName(ImGuiMouseSource source) +{ + const char* mouse_source_names[] = { "Mouse", "TouchScreen", "Pen" }; + IM_ASSERT(IM_ARRAYSIZE(mouse_source_names) == ImGuiMouseSource_COUNT && source >= 0 && source < ImGuiMouseSource_COUNT); + return mouse_source_names[source]; +} static void DebugPrintInputEvent(const char* prefix, const ImGuiInputEvent* e) { ImGuiContext& g = *GImGui; - if (e->Type == ImGuiInputEventType_MousePos) { if (e->MousePos.PosX == -FLT_MAX && e->MousePos.PosY == -FLT_MAX) IMGUI_DEBUG_LOG_IO("%s: MousePos (-FLT_MAX, -FLT_MAX)\n", prefix); else IMGUI_DEBUG_LOG_IO("%s: MousePos (%.1f, %.1f)\n", prefix, e->MousePos.PosX, e->MousePos.PosY); return; } - if (e->Type == ImGuiInputEventType_MouseButton) { IMGUI_DEBUG_LOG_IO("%s: MouseButton %d %s\n", prefix, e->MouseButton.Button, e->MouseButton.Down ? "Down" : "Up"); return; } - if (e->Type == ImGuiInputEventType_MouseWheel) { IMGUI_DEBUG_LOG_IO("%s: MouseWheel (%.1f, %.1f)\n", prefix, e->MouseWheel.WheelX, e->MouseWheel.WheelY); return; } - if (e->Type == ImGuiInputEventType_Key) { IMGUI_DEBUG_LOG_IO("%s: Key \"%s\" %s\n", prefix, ImGui::GetKeyName(e->Key.Key), e->Key.Down ? "Down" : "Up"); return; } - if (e->Type == ImGuiInputEventType_Text) { IMGUI_DEBUG_LOG_IO("%s: Text: %c (U+%08X)\n", prefix, e->Text.Char, e->Text.Char); return; } - if (e->Type == ImGuiInputEventType_Focus) { IMGUI_DEBUG_LOG_IO("%s: AppFocused %d\n", prefix, e->AppFocused.Focused); return; } + if (e->Type == ImGuiInputEventType_MousePos) { if (e->MousePos.PosX == -FLT_MAX && e->MousePos.PosY == -FLT_MAX) IMGUI_DEBUG_LOG_IO("[io] %s: MousePos (-FLT_MAX, -FLT_MAX)\n", prefix); else IMGUI_DEBUG_LOG_IO("[io] %s: MousePos (%.1f, %.1f) (%s)\n", prefix, e->MousePos.PosX, e->MousePos.PosY, GetMouseSourceName(e->MousePos.MouseSource)); return; } + if (e->Type == ImGuiInputEventType_MouseButton) { IMGUI_DEBUG_LOG_IO("[io] %s: MouseButton %d %s (%s)\n", prefix, e->MouseButton.Button, e->MouseButton.Down ? "Down" : "Up", GetMouseSourceName(e->MouseButton.MouseSource)); return; } + if (e->Type == ImGuiInputEventType_MouseWheel) { IMGUI_DEBUG_LOG_IO("[io] %s: MouseWheel (%.3f, %.3f) (%s)\n", prefix, e->MouseWheel.WheelX, e->MouseWheel.WheelY, GetMouseSourceName(e->MouseWheel.MouseSource)); return; } + if (e->Type == ImGuiInputEventType_Key) { IMGUI_DEBUG_LOG_IO("[io] %s: Key \"%s\" %s\n", prefix, ImGui::GetKeyName(e->Key.Key), e->Key.Down ? "Down" : "Up"); return; } + if (e->Type == ImGuiInputEventType_Text) { IMGUI_DEBUG_LOG_IO("[io] %s: Text: %c (U+%08X)\n", prefix, e->Text.Char, e->Text.Char); return; } + if (e->Type == ImGuiInputEventType_Focus) { IMGUI_DEBUG_LOG_IO("[io] %s: AppFocused %d\n", prefix, e->AppFocused.Focused); return; } } #endif @@ -8167,6 +8889,7 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs) if (trickle_fast_inputs && (mouse_button_changed != 0 || mouse_wheeled || key_changed || text_inputted)) break; io.MousePos = event_pos; + io.MouseSource = e->MousePos.MouseSource; mouse_moved = true; } else if (e->Type == ImGuiInputEventType_MouseButton) @@ -8176,7 +8899,10 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs) IM_ASSERT(button >= 0 && button < ImGuiMouseButton_COUNT); if (trickle_fast_inputs && ((mouse_button_changed & (1 << button)) || mouse_wheeled)) break; + if (trickle_fast_inputs && e->MouseButton.MouseSource == ImGuiMouseSource_TouchScreen && mouse_moved) // #2702: TouchScreen have no initial hover. + break; io.MouseDown[button] = e->MouseButton.Down; + io.MouseSource = e->MouseButton.MouseSource; mouse_button_changed |= (1 << button); } else if (e->Type == ImGuiInputEventType_MouseWheel) @@ -8186,6 +8912,7 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs) break; io.MouseWheelH += e->MouseWheel.WheelX; io.MouseWheel += e->MouseWheel.WheelY; + io.MouseSource = e->MouseWheel.MouseSource; mouse_wheeled = true; } else if (e->Type == ImGuiInputEventType_Key) @@ -8202,15 +8929,6 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs) key_changed = true; key_changed_mask.SetBit(key_data_index); - if (key == ImGuiMod_Ctrl || key == ImGuiMod_Shift || key == ImGuiMod_Alt || key == ImGuiMod_Super) - { - if (key == ImGuiMod_Ctrl) { io.KeyCtrl = key_data->Down; } - if (key == ImGuiMod_Shift) { io.KeyShift = key_data->Down; } - if (key == ImGuiMod_Alt) { io.KeyAlt = key_data->Down; } - if (key == ImGuiMod_Super) { io.KeySuper = key_data->Down; } - io.KeyMods = GetMergedModsFromBools(); - } - // Allow legacy code using io.KeysDown[GetKeyIndex()] with new backends #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO io.KeysDown[key_data_index] = key_data->Down; @@ -8260,14 +8978,141 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs) g.InputEventsQueue.erase(g.InputEventsQueue.Data, g.InputEventsQueue.Data + event_n); // Clear buttons state when focus is lost - // (this is useful so e.g. releasing Alt after focus loss on Alt-Tab doesn't trigger the Alt menu toggle) + // - this is useful so e.g. releasing Alt after focus loss on Alt-Tab doesn't trigger the Alt menu toggle. + // - we clear in EndFrame() and not now in order allow application/user code polling this flag + // (e.g. custom backend may want to clear additional data, custom widgets may want to react with a "canceling" event). if (g.IO.AppFocusLost) - { g.IO.ClearInputKeys(); - g.IO.AppFocusLost = false; +} + +ImGuiID ImGui::GetKeyOwner(ImGuiKey key) +{ + if (!IsNamedKeyOrModKey(key)) + return ImGuiKeyOwner_None; + + ImGuiContext& g = *GImGui; + ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key); + ImGuiID owner_id = owner_data->OwnerCurr; + + if (g.ActiveIdUsingAllKeyboardKeys && owner_id != g.ActiveId && owner_id != ImGuiKeyOwner_Any) + if (key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END) + return ImGuiKeyOwner_None; + + return owner_id; +} + +// TestKeyOwner(..., ID) : (owner == None || owner == ID) +// TestKeyOwner(..., None) : (owner == None) +// TestKeyOwner(..., Any) : no owner test +// All paths are also testing for key not being locked, for the rare cases that key have been locked with using ImGuiInputFlags_LockXXX flags. +bool ImGui::TestKeyOwner(ImGuiKey key, ImGuiID owner_id) +{ + if (!IsNamedKeyOrModKey(key)) + return true; + + ImGuiContext& g = *GImGui; + if (g.ActiveIdUsingAllKeyboardKeys && owner_id != g.ActiveId && owner_id != ImGuiKeyOwner_Any) + if (key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END) + return false; + + ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key); + if (owner_id == ImGuiKeyOwner_Any) + return (owner_data->LockThisFrame == false); + + // Note: SetKeyOwner() sets OwnerCurr. It is not strictly required for most mouse routing overlap (because of ActiveId/HoveredId + // are acting as filter before this has a chance to filter), but sane as soon as user tries to look into things. + // Setting OwnerCurr in SetKeyOwner() is more consistent than testing OwnerNext here: would be inconsistent with getter and other functions. + if (owner_data->OwnerCurr != owner_id) + { + if (owner_data->LockThisFrame) + return false; + if (owner_data->OwnerCurr != ImGuiKeyOwner_None) + return false; + } + + return true; +} + +// _LockXXX flags are useful to lock keys away from code which is not input-owner aware. +// When using _LockXXX flags, you can use ImGuiKeyOwner_Any to lock keys from everyone. +// - SetKeyOwner(..., None) : clears owner +// - SetKeyOwner(..., Any, !Lock) : illegal (assert) +// - SetKeyOwner(..., Any or None, Lock) : set lock +void ImGui::SetKeyOwner(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags) +{ + IM_ASSERT(IsNamedKeyOrModKey(key) && (owner_id != ImGuiKeyOwner_Any || (flags & (ImGuiInputFlags_LockThisFrame | ImGuiInputFlags_LockUntilRelease)))); // Can only use _Any with _LockXXX flags (to eat a key away without an ID to retrieve it) + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedBySetKeyOwner) == 0); // Passing flags not supported by this function! + + ImGuiContext& g = *GImGui; + ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key); + owner_data->OwnerCurr = owner_data->OwnerNext = owner_id; + + // We cannot lock by default as it would likely break lots of legacy code. + // In the case of using LockUntilRelease while key is not down we still lock during the frame (no key_data->Down test) + owner_data->LockUntilRelease = (flags & ImGuiInputFlags_LockUntilRelease) != 0; + owner_data->LockThisFrame = (flags & ImGuiInputFlags_LockThisFrame) != 0 || (owner_data->LockUntilRelease); +} + +// Rarely used helper +void ImGui::SetKeyOwnersForKeyChord(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags) +{ + if (key_chord & ImGuiMod_Ctrl) { SetKeyOwner(ImGuiMod_Ctrl, owner_id, flags); } + if (key_chord & ImGuiMod_Shift) { SetKeyOwner(ImGuiMod_Shift, owner_id, flags); } + if (key_chord & ImGuiMod_Alt) { SetKeyOwner(ImGuiMod_Alt, owner_id, flags); } + if (key_chord & ImGuiMod_Super) { SetKeyOwner(ImGuiMod_Super, owner_id, flags); } + if (key_chord & ImGuiMod_Shortcut) { SetKeyOwner(ImGuiMod_Shortcut, owner_id, flags); } + if (key_chord & ~ImGuiMod_Mask_) { SetKeyOwner((ImGuiKey)(key_chord & ~ImGuiMod_Mask_), owner_id, flags); } +} + +// This is more or less equivalent to: +// if (IsItemHovered() || IsItemActive()) +// SetKeyOwner(key, GetItemID()); +// Extensive uses of that (e.g. many calls for a single item) may want to manually perform the tests once and then call SetKeyOwner() multiple times. +// More advanced usage scenarios may want to call SetKeyOwner() manually based on different condition. +// Worth noting is that only one item can be hovered and only one item can be active, therefore this usage pattern doesn't need to bother with routing and priority. +void ImGui::SetItemKeyOwner(ImGuiKey key, ImGuiInputFlags flags) +{ + ImGuiContext& g = *GImGui; + ImGuiID id = g.LastItemData.ID; + if (id == 0 || (g.HoveredId != id && g.ActiveId != id)) + return; + if ((flags & ImGuiInputFlags_CondMask_) == 0) + flags |= ImGuiInputFlags_CondDefault_; + if ((g.HoveredId == id && (flags & ImGuiInputFlags_CondHovered)) || (g.ActiveId == id && (flags & ImGuiInputFlags_CondActive))) + { + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedBySetItemKeyOwner) == 0); // Passing flags not supported by this function! + SetKeyOwner(key, id, flags & ~ImGuiInputFlags_CondMask_); } } +bool ImGui::Shortcut(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags) +{ + ImGuiContext& g = *GImGui; + + // When using (owner_id == 0/Any): SetShortcutRouting() will use CurrentFocusScopeId and filter with this, so IsKeyPressed() is fine with he 0/Any. + if ((flags & ImGuiInputFlags_RouteMask_) == 0) + flags |= ImGuiInputFlags_RouteFocused; + if (!SetShortcutRouting(key_chord, owner_id, flags)) + return false; + + if (key_chord & ImGuiMod_Shortcut) + key_chord = ConvertShortcutMod(key_chord); + ImGuiKey mods = (ImGuiKey)(key_chord & ImGuiMod_Mask_); + if (g.IO.KeyMods != mods) + return false; + + // Special storage location for mods + ImGuiKey key = (ImGuiKey)(key_chord & ~ImGuiMod_Mask_); + if (key == ImGuiKey_None) + key = ConvertSingleModFlagToKey(&g, mods); + + if (!IsKeyPressed(key, owner_id, (flags & (ImGuiInputFlags_Repeat | (ImGuiInputFlags)ImGuiInputFlags_RepeatRateMask_)))) + return false; + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedByShortcut) == 0); // Passing flags not supported by this function! + + return true; +} + //----------------------------------------------------------------------------- // [SECTION] ERROR CHECKING @@ -8318,6 +9163,8 @@ void ImGui::ErrorCheckUsingSetCursorPosToExtendParentBoundaries() #ifdef IMGUI_DISABLE_OBSOLETE_FUNCTIONS if (window->DC.CursorPos.x <= window->DC.CursorMaxPos.x && window->DC.CursorPos.y <= window->DC.CursorMaxPos.y) return; + if (window->SkipItems) + return; IM_ASSERT(0 && "Code uses SetCursorPos()/SetCursorScreenPos() to extend window/parent boundaries. Please submit an item e.g. Dummy() to validate extent."); #else window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos); @@ -8336,6 +9183,13 @@ static void ImGui::ErrorCheckNewFrameSanityChecks() // #define IM_ASSERT(EXPR) do { if (SomeCode(EXPR)) SomeMoreCode(); } while (0) // Correct! if (true) IM_ASSERT(1); else IM_ASSERT(0); + // Emscripten backends are often imprecise in their submission of DeltaTime. (#6114, #3644) + // Ideally the Emscripten app/backend should aim to fix or smooth this value and avoid feeding zero, but we tolerate it. +#ifdef __EMSCRIPTEN__ + if (g.IO.DeltaTime <= 0.0f && g.FrameCount > 0) + g.IO.DeltaTime = 0.00001f; +#endif + // Check user data // (We pass an error message in the assert expression to make it visible to programmers who are not using a debugger, as most assert handlers display their argument) IM_ASSERT(g.Initialized); @@ -8371,9 +9225,9 @@ static void ImGui::ErrorCheckEndFrameSanityChecks() // One possible reason leading to this assert is that your backends update inputs _AFTER_ NewFrame(). // It is known that when some modal native windows called mid-frame takes focus away, some backends such as GLFW will // send key release events mid-frame. This would normally trigger this assertion and lead to sheared inputs. - // We silently accommodate for this case by ignoring/ the case where all io.KeyXXX modifiers were released (aka key_mod_flags == 0), + // We silently accommodate for this case by ignoring the case where all io.KeyXXX modifiers were released (aka key_mod_flags == 0), // while still correctly asserting on mid-frame key press events. - const ImGuiKeyChord key_mods = GetMergedModsFromBools(); + const ImGuiKeyChord key_mods = GetMergedModsFromKeys(); IM_ASSERT((key_mods == 0 || g.IO.KeyMods == key_mods) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods"); IM_UNUSED(key_mods); @@ -8386,7 +9240,9 @@ static void ImGui::ErrorCheckEndFrameSanityChecks() { if (g.CurrentWindowStack.Size > 1) { + ImGuiWindow* window = g.CurrentWindowStack.back().Window; // <-- This window was not Ended! IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?"); + IM_UNUSED(window); while (g.CurrentWindowStack.Size > 1) End(); } @@ -8483,7 +9339,12 @@ void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, vo if (log_callback) log_callback(user_data, "Recovered from missing PopStyleVar() in '%s'", window->Name); PopStyleVar(); } - while (g.FocusScopeStack.Size > stack_sizes->SizeOfFocusScopeStack) //-V1044 + while (g.FontStack.Size > stack_sizes->SizeOfFontStack) //-V1044 + { + if (log_callback) log_callback(user_data, "Recovered from missing PopFont() in '%s'", window->Name); + PopFont(); + } + while (g.FocusScopeStack.Size > stack_sizes->SizeOfFocusScopeStack + 1) //-V1044 { if (log_callback) log_callback(user_data, "Recovered from missing PopFocusScope() in '%s'", window->Name); PopFocusScope(); @@ -8491,9 +9352,9 @@ void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, vo } // Save current stack sizes for later compare -void ImGuiStackSizes::SetToCurrentState() +void ImGuiStackSizes::SetToContextState(ImGuiContext* ctx) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *ctx; ImGuiWindow* window = g.CurrentWindow; SizeOfIDStack = (short)window->IDStack.Size; SizeOfColorStack = (short)g.ColorStack.Size; @@ -8507,9 +9368,9 @@ void ImGuiStackSizes::SetToCurrentState() } // Compare to detect usage errors -void ImGuiStackSizes::CompareWithCurrentState() +void ImGuiStackSizes::CompareWithContextState(ImGuiContext* ctx) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *ctx; ImGuiWindow* window = g.CurrentWindow; IM_UNUSED(window); @@ -8585,7 +9446,7 @@ void ImGui::ItemSize(const ImVec2& size, float text_baseline_y) window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x + size.x; window->DC.CursorPosPrevLine.y = line_y1; window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); // Next line - window->DC.CursorPos.y = IM_FLOOR(line_y1 + line_height + g.Style.ItemSpacing.y); // Next line + window->DC.CursorPos.y = IM_FLOOR(line_y1 + line_height + g.Style.ItemSpacing.y); // Next line window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x); window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y - g.Style.ItemSpacing.y); //if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG] @@ -8614,7 +9475,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu g.LastItemData.ID = id; g.LastItemData.Rect = bb; g.LastItemData.NavRect = nav_bb_arg ? *nav_bb_arg : bb; - g.LastItemData.InFlags = g.CurrentItemFlags | extra_flags; + g.LastItemData.InFlags = g.CurrentItemFlags | g.NextItemData.ItemFlags | extra_flags; g.LastItemData.StatusFlags = ImGuiItemStatusFlags_None; // Directional navigation processing @@ -8631,40 +9492,51 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu // to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick). // We intentionally don't check if g.NavWindow != NULL because g.NavAnyRequest should only be set when it is non null. // If we crash on a NULL g.NavWindow we need to fix the bug elsewhere. - window->DC.NavLayersActiveMaskNext |= (1 << window->DC.NavLayerCurrent); - if (g.NavId == id || g.NavAnyRequest) - if (g.NavWindow->RootWindowForNav == window->RootWindowForNav) - if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened)) - NavProcessItem(); + if (!(g.LastItemData.InFlags & ImGuiItemFlags_NoNav)) + { + window->DC.NavLayersActiveMaskNext |= (1 << window->DC.NavLayerCurrent); + if (g.NavId == id || g.NavAnyRequest) + if (g.NavWindow->RootWindowForNav == window->RootWindowForNav) + if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened)) + NavProcessItem(); + } // [DEBUG] People keep stumbling on this problem and using "" as identifier in the root of a window instead of "##something". // Empty identifier are valid and useful in a small amount of cases, but 99.9% of the time you want to use "##something". - // READ THE FAQ: https://dearimgui.org/faq + // READ THE FAQ: https://dearimgui.com/faq IM_ASSERT(id != window->ID && "Cannot have an empty ID at the root of a window. If you need an empty label, use ## and read the FAQ about how the ID Stack works!"); - - // [DEBUG] Item Picker tool, when enabling the "extended" version we perform the check in ItemAdd() -#ifdef IMGUI_DEBUG_TOOL_ITEM_PICKER_EX - if (id == g.DebugItemPickerBreakId) - { - IM_DEBUG_BREAK(); - g.DebugItemPickerBreakId = 0; - } -#endif } g.NextItemData.Flags = ImGuiNextItemDataFlags_None; + g.NextItemData.ItemFlags = ImGuiItemFlags_None; #ifdef IMGUI_ENABLE_TEST_ENGINE if (id != 0) - IMGUI_TEST_ENGINE_ITEM_ADD(nav_bb_arg ? *nav_bb_arg : bb, id); + IMGUI_TEST_ENGINE_ITEM_ADD(id, g.LastItemData.NavRect, &g.LastItemData); #endif // Clipping test - const bool is_clipped = IsClippedEx(bb, id); - if (is_clipped) - return false; + // (FIXME: This is a modified copy of IsClippedEx() so we can reuse the is_rect_visible value) + //const bool is_clipped = IsClippedEx(bb, id); + //if (is_clipped) + // return false; + const bool is_rect_visible = bb.Overlaps(window->ClipRect); + if (!is_rect_visible) + if (id == 0 || (id != g.ActiveId && id != g.ActiveIdPreviousFrame && id != g.NavId)) + if (!g.LogEnabled) + return false; + + // [DEBUG] +#ifndef IMGUI_DISABLE_DEBUG_TOOLS + if (id != 0 && id == g.DebugLocateId) + DebugLocateItemResolveWithLastItem(); +#endif //if (g.IO.KeyAlt) window->DrawList->AddRect(bb.Min, bb.Max, IM_COL32(255,255,0,120)); // [DEBUG] + //if ((g.LastItemData.InFlags & ImGuiItemFlags_NoNav) == 0) + // window->DrawList->AddRect(g.LastItemData.NavRect.Min, g.LastItemData.NavRect.Max, IM_COL32(255,255,0,255)); // [DEBUG] // We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them) + if (is_rect_visible) + g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_Visible; if (IsMouseHoveringRect(bb.Min, bb.Max)) g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredRect; return true; @@ -8673,7 +9545,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu // Gets back to previous line and continue with horizontal layout // offset_from_start_x == 0 : follow right after previous item // offset_from_start_x != 0 : align to specified x position (relative to window/group left) -// spacing_w < 0 : use default spacing if pos_x == 0, no spacing if pos_x != 0 +// spacing_w < 0 : use default spacing if offset_from_start_x == 0, no spacing if offset_from_start_x != 0 // spacing_w >= 0 : enforce spacing amount void ImGui::SameLine(float offset_from_start_x, float spacing_w) { @@ -8707,9 +9579,6 @@ ImVec2 ImGui::GetCursorScreenPos() return window->DC.CursorPos; } -// 2022/08/05: Setting cursor position also extend boundaries (via modifying CursorMaxPos) used to compute window size, group size etc. -// I believe this was is a judicious choice but it's probably being relied upon (it has been the case since 1.31 and 1.50) -// It would be sane if we requested user to use SetCursorPos() + Dummy(ImVec2(0,0)) to extend CursorMaxPos... void ImGui::SetCursorScreenPos(const ImVec2& pos) { ImGuiWindow* window = GetCurrentWindow(); @@ -8901,10 +9770,8 @@ ImVec2 ImGui::GetContentRegionMax() { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - ImVec2 mx = window->ContentRegionRect.Max - window->Pos; - if (window->DC.CurrentColumns || g.CurrentTable) - mx.x = window->WorkRect.Max.x - window->Pos.x; - return mx; + ImVec2 mx = (window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max; + return mx - window->Pos; } // [Internal] Absolute coordinate. Saner. This is not exposed until we finishing refactoring work rect features. @@ -8912,9 +9779,7 @@ ImVec2 ImGui::GetContentRegionMaxAbs() { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - ImVec2 mx = window->ContentRegionRect.Max; - if (window->DC.CurrentColumns || g.CurrentTable) - mx.x = window->WorkRect.Max.x; + ImVec2 mx = (window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max; return mx; } @@ -9051,38 +9916,24 @@ static float CalcScrollEdgeSnap(float target, float snap_min, float snap_max, fl static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window) { ImVec2 scroll = window->Scroll; - if (window->ScrollTarget.x < FLT_MAX) + ImVec2 decoration_size(window->DecoOuterSizeX1 + window->DecoInnerSizeX1 + window->DecoOuterSizeX2, window->DecoOuterSizeY1 + window->DecoInnerSizeY1 + window->DecoOuterSizeY2); + for (int axis = 0; axis < 2; axis++) { - float decoration_total_width = window->ScrollbarSizes.x; - float center_x_ratio = window->ScrollTargetCenterRatio.x; - float scroll_target_x = window->ScrollTarget.x; - if (window->ScrollTargetEdgeSnapDist.x > 0.0f) + if (window->ScrollTarget[axis] < FLT_MAX) { - float snap_x_min = 0.0f; - float snap_x_max = window->ScrollMax.x + window->SizeFull.x - decoration_total_width; - scroll_target_x = CalcScrollEdgeSnap(scroll_target_x, snap_x_min, snap_x_max, window->ScrollTargetEdgeSnapDist.x, center_x_ratio); - } - scroll.x = scroll_target_x - center_x_ratio * (window->SizeFull.x - decoration_total_width); - } - if (window->ScrollTarget.y < FLT_MAX) - { - float decoration_total_height = window->TitleBarHeight() + window->MenuBarHeight() + window->ScrollbarSizes.y; - float center_y_ratio = window->ScrollTargetCenterRatio.y; - float scroll_target_y = window->ScrollTarget.y; - if (window->ScrollTargetEdgeSnapDist.y > 0.0f) - { - float snap_y_min = 0.0f; - float snap_y_max = window->ScrollMax.y + window->SizeFull.y - decoration_total_height; - scroll_target_y = CalcScrollEdgeSnap(scroll_target_y, snap_y_min, snap_y_max, window->ScrollTargetEdgeSnapDist.y, center_y_ratio); + float center_ratio = window->ScrollTargetCenterRatio[axis]; + float scroll_target = window->ScrollTarget[axis]; + if (window->ScrollTargetEdgeSnapDist[axis] > 0.0f) + { + float snap_min = 0.0f; + float snap_max = window->ScrollMax[axis] + window->SizeFull[axis] - decoration_size[axis]; + scroll_target = CalcScrollEdgeSnap(scroll_target, snap_min, snap_max, window->ScrollTargetEdgeSnapDist[axis], center_ratio); + } + scroll[axis] = scroll_target - center_ratio * (window->SizeFull[axis] - decoration_size[axis]); } - scroll.y = scroll_target_y - center_y_ratio * (window->SizeFull.y - decoration_total_height); - } - scroll.x = IM_FLOOR(ImMax(scroll.x, 0.0f)); - scroll.y = IM_FLOOR(ImMax(scroll.y, 0.0f)); - if (!window->Collapsed && !window->SkipItems) - { - scroll.x = ImMin(scroll.x, window->ScrollMax.x); - scroll.y = ImMin(scroll.y, window->ScrollMax.y); + scroll[axis] = IM_FLOOR(ImMax(scroll[axis], 0.0f)); + if (!window->Collapsed && !window->SkipItems) + scroll[axis] = ImMin(scroll[axis], window->ScrollMax[axis]); } return scroll; } @@ -9103,8 +9954,11 @@ void ImGui::ScrollToRect(ImGuiWindow* window, const ImRect& item_rect, ImGuiScro ImVec2 ImGui::ScrollToRectEx(ImGuiWindow* window, const ImRect& item_rect, ImGuiScrollFlags flags) { ImGuiContext& g = *GImGui; - ImRect window_rect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1)); - //GetForegroundDrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG] + ImRect scroll_rect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1)); + scroll_rect.Min.x = ImMin(scroll_rect.Min.x + window->DecoInnerSizeX1, scroll_rect.Max.x); + scroll_rect.Min.y = ImMin(scroll_rect.Min.y + window->DecoInnerSizeY1, scroll_rect.Max.y); + //GetForegroundDrawList(window)->AddRect(item_rect.Min, item_rect.Max, IM_COL32(255,0,0,255), 0.0f, 0, 5.0f); // [DEBUG] + //GetForegroundDrawList(window)->AddRect(scroll_rect.Min, scroll_rect.Max, IM_COL32_WHITE); // [DEBUG] // Check that only one behavior is selected per axis IM_ASSERT((flags & ImGuiScrollFlags_MaskX_) == 0 || ImIsPowerOfTwo(flags & ImGuiScrollFlags_MaskX_)); @@ -9117,35 +9971,39 @@ ImVec2 ImGui::ScrollToRectEx(ImGuiWindow* window, const ImRect& item_rect, ImGui if ((flags & ImGuiScrollFlags_MaskY_) == 0) flags |= window->Appearing ? ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeY; - const bool fully_visible_x = item_rect.Min.x >= window_rect.Min.x && item_rect.Max.x <= window_rect.Max.x; - const bool fully_visible_y = item_rect.Min.y >= window_rect.Min.y && item_rect.Max.y <= window_rect.Max.y; - const bool can_be_fully_visible_x = (item_rect.GetWidth() + g.Style.ItemSpacing.x * 2.0f) <= window_rect.GetWidth(); - const bool can_be_fully_visible_y = (item_rect.GetHeight() + g.Style.ItemSpacing.y * 2.0f) <= window_rect.GetHeight(); + const bool fully_visible_x = item_rect.Min.x >= scroll_rect.Min.x && item_rect.Max.x <= scroll_rect.Max.x; + const bool fully_visible_y = item_rect.Min.y >= scroll_rect.Min.y && item_rect.Max.y <= scroll_rect.Max.y; + const bool can_be_fully_visible_x = (item_rect.GetWidth() + g.Style.ItemSpacing.x * 2.0f) <= scroll_rect.GetWidth() || (window->AutoFitFramesX > 0) || (window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0; + const bool can_be_fully_visible_y = (item_rect.GetHeight() + g.Style.ItemSpacing.y * 2.0f) <= scroll_rect.GetHeight() || (window->AutoFitFramesY > 0) || (window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0; if ((flags & ImGuiScrollFlags_KeepVisibleEdgeX) && !fully_visible_x) { - if (item_rect.Min.x < window_rect.Min.x || !can_be_fully_visible_x) + if (item_rect.Min.x < scroll_rect.Min.x || !can_be_fully_visible_x) SetScrollFromPosX(window, item_rect.Min.x - g.Style.ItemSpacing.x - window->Pos.x, 0.0f); - else if (item_rect.Max.x >= window_rect.Max.x) + else if (item_rect.Max.x >= scroll_rect.Max.x) SetScrollFromPosX(window, item_rect.Max.x + g.Style.ItemSpacing.x - window->Pos.x, 1.0f); } else if (((flags & ImGuiScrollFlags_KeepVisibleCenterX) && !fully_visible_x) || (flags & ImGuiScrollFlags_AlwaysCenterX)) { - float target_x = can_be_fully_visible_x ? ImFloor((item_rect.Min.x + item_rect.Max.x - window->InnerRect.GetWidth()) * 0.5f) : item_rect.Min.x; - SetScrollFromPosX(window, target_x - window->Pos.x, 0.0f); + if (can_be_fully_visible_x) + SetScrollFromPosX(window, ImFloor((item_rect.Min.x + item_rect.Max.x) * 0.5f) - window->Pos.x, 0.5f); + else + SetScrollFromPosX(window, item_rect.Min.x - window->Pos.x, 0.0f); } if ((flags & ImGuiScrollFlags_KeepVisibleEdgeY) && !fully_visible_y) { - if (item_rect.Min.y < window_rect.Min.y || !can_be_fully_visible_y) + if (item_rect.Min.y < scroll_rect.Min.y || !can_be_fully_visible_y) SetScrollFromPosY(window, item_rect.Min.y - g.Style.ItemSpacing.y - window->Pos.y, 0.0f); - else if (item_rect.Max.y >= window_rect.Max.y) + else if (item_rect.Max.y >= scroll_rect.Max.y) SetScrollFromPosY(window, item_rect.Max.y + g.Style.ItemSpacing.y - window->Pos.y, 1.0f); } else if (((flags & ImGuiScrollFlags_KeepVisibleCenterY) && !fully_visible_y) || (flags & ImGuiScrollFlags_AlwaysCenterY)) { - float target_y = can_be_fully_visible_y ? ImFloor((item_rect.Min.y + item_rect.Max.y - window->InnerRect.GetHeight()) * 0.5f) : item_rect.Min.y; - SetScrollFromPosY(window, target_y - window->Pos.y, 0.0f); + if (can_be_fully_visible_y) + SetScrollFromPosY(window, ImFloor((item_rect.Min.y + item_rect.Max.y) * 0.5f) - window->Pos.y, 0.5f); + else + SetScrollFromPosY(window, item_rect.Min.y - window->Pos.y, 0.0f); } ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp(window); @@ -9228,7 +10086,7 @@ void ImGui::SetScrollY(float scroll_y) void ImGui::SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio) { IM_ASSERT(center_x_ratio >= 0.0f && center_x_ratio <= 1.0f); - window->ScrollTarget.x = IM_FLOOR(local_x + window->Scroll.x); // Convert local position to scroll offset + window->ScrollTarget.x = IM_FLOOR(local_x - window->DecoOuterSizeX1 - window->DecoInnerSizeX1 + window->Scroll.x); // Convert local position to scroll offset window->ScrollTargetCenterRatio.x = center_x_ratio; window->ScrollTargetEdgeSnapDist.x = 0.0f; } @@ -9236,9 +10094,7 @@ void ImGui::SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x void ImGui::SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio) { IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f); - const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight(); // FIXME: Would be nice to have a more standardized access to our scrollable/client rect; - local_y -= decoration_up_height; - window->ScrollTarget.y = IM_FLOOR(local_y + window->Scroll.y); // Convert local position to scroll offset + window->ScrollTarget.y = IM_FLOOR(local_y - window->DecoOuterSizeY1 - window->DecoInnerSizeY1 + window->Scroll.y); // Convert local position to scroll offset window->ScrollTargetCenterRatio.y = center_y_ratio; window->ScrollTargetEdgeSnapDist.y = 0.0f; } @@ -9285,41 +10141,55 @@ void ImGui::SetScrollHereY(float center_y_ratio) // [SECTION] TOOLTIPS //----------------------------------------------------------------------------- -void ImGui::BeginTooltip() +bool ImGui::BeginTooltip() +{ + return BeginTooltipEx(ImGuiTooltipFlags_None, ImGuiWindowFlags_None); +} + +bool ImGui::BeginItemTooltip() { - BeginTooltipEx(ImGuiTooltipFlags_None, ImGuiWindowFlags_None); + if (!IsItemHovered(ImGuiHoveredFlags_ForTooltip)) + return false; + return BeginTooltipEx(ImGuiTooltipFlags_None, ImGuiWindowFlags_None); } -void ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags) +bool ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags) { ImGuiContext& g = *GImGui; if (g.DragDropWithinSource || g.DragDropWithinTarget) { - // The default tooltip position is a little offset to give space to see the context menu (it's also clamped within the current viewport/monitor) - // In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor. - // Whatever we do we want to call SetNextWindowPos() to enforce a tooltip position and disable clipping the tooltip without our display area, like regular tooltip do. + // Drag and Drop tooltips are positioning differently than other tooltips: + // - offset visibility to increase visibility around mouse. + // - never clamp within outer viewport boundary. + // We call SetNextWindowPos() to enforce position and disable clamping. + // See FindBestWindowPosForPopup() for positionning logic of other tooltips (not drag and drop ones). //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding; - ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale); + ImVec2 tooltip_pos = g.IO.MousePos + TOOLTIP_DEFAULT_OFFSET * g.Style.MouseCursorScale; SetNextWindowPos(tooltip_pos); SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f); //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :( - tooltip_flags |= ImGuiTooltipFlags_OverridePreviousTooltip; + tooltip_flags |= ImGuiTooltipFlags_OverridePrevious; } char window_name[16]; ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", g.TooltipOverrideCount); - if (tooltip_flags & ImGuiTooltipFlags_OverridePreviousTooltip) + if (tooltip_flags & ImGuiTooltipFlags_OverridePrevious) if (ImGuiWindow* window = FindWindowByName(window_name)) if (window->Active) { // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one. - window->Hidden = true; - window->HiddenFramesCanSkipItems = 1; // FIXME: This may not be necessary? + SetWindowHiddendAndSkipItemsForCurrentFrame(window); ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount); } ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize; Begin(window_name, NULL, flags | extra_window_flags); + // 2023-03-09: Added bool return value to the API, but currently always returning true. + // If this ever returns false we need to update BeginDragDropSource() accordingly. + //if (!ret) + // End(); + //return ret; + return true; } void ImGui::EndTooltip() @@ -9328,21 +10198,40 @@ void ImGui::EndTooltip() End(); } +void ImGui::SetTooltip(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + SetTooltipV(fmt, args); + va_end(args); +} + void ImGui::SetTooltipV(const char* fmt, va_list args) { - BeginTooltipEx(ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_None); + if (!BeginTooltipEx(ImGuiTooltipFlags_OverridePrevious, ImGuiWindowFlags_None)) + return; TextV(fmt, args); EndTooltip(); } -void ImGui::SetTooltip(const char* fmt, ...) +// Shortcut to use 'style.HoverFlagsForTooltipMouse' or 'style.HoverFlagsForTooltipNav'. +// Defaults to == ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort when using the mouse. +void ImGui::SetItemTooltip(const char* fmt, ...) { va_list args; va_start(args, fmt); - SetTooltipV(fmt, args); + if (IsItemHovered(ImGuiHoveredFlags_ForTooltip)) + SetTooltipV(fmt, args); va_end(args); } +void ImGui::SetItemTooltipV(const char* fmt, va_list args) +{ + if (IsItemHovered(ImGuiHoveredFlags_ForTooltip)) + SetTooltipV(fmt, args); +} + + //----------------------------------------------------------------------------- // [SECTION] POPUPS //----------------------------------------------------------------------------- @@ -9388,6 +10277,7 @@ bool ImGui::IsPopupOpen(const char* str_id, ImGuiPopupFlags popup_flags) return IsPopupOpen(id, popup_flags); } +// Also see FindBlockingModal(NULL) ImGuiWindow* ImGui::GetTopMostPopupModal() { ImGuiContext& g = *GImGui; @@ -9398,6 +10288,7 @@ ImGuiWindow* ImGui::GetTopMostPopupModal() return NULL; } +// See Demo->Stacked Modal to confirm what this is for. ImGuiWindow* ImGui::GetTopMostAndVisiblePopupModal() { ImGuiContext& g = *GImGui; @@ -9412,7 +10303,7 @@ void ImGui::OpenPopup(const char* str_id, ImGuiPopupFlags popup_flags) { ImGuiContext& g = *GImGui; ImGuiID id = g.CurrentWindow->GetID(str_id); - IMGUI_DEBUG_LOG_POPUP("[popup] OpenPopup(\"%s\" -> 0x%08X\n", str_id, id); + IMGUI_DEBUG_LOG_POPUP("[popup] OpenPopup(\"%s\" -> 0x%08X)\n", str_id, id); OpenPopupEx(id, popup_flags); } @@ -9432,7 +10323,7 @@ void ImGui::OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags) const int current_stack_size = g.BeginPopupStack.Size; if (popup_flags & ImGuiPopupFlags_NoOpenOverExistingPopup) - if (IsPopupOpen(0u, ImGuiPopupFlags_AnyPopupId)) + if (IsPopupOpen((ImGuiID)0, ImGuiPopupFlags_AnyPopupId)) return; ImGuiPopupData popup_ref; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack. @@ -9526,7 +10417,7 @@ void ImGui::ClosePopupsExceptModals() for (popup_count_to_keep = g.OpenPopupStack.Size; popup_count_to_keep > 0; popup_count_to_keep--) { ImGuiWindow* window = g.OpenPopupStack[popup_count_to_keep - 1].Window; - if (!window || window->Flags & ImGuiWindowFlags_Modal) + if (!window || (window->Flags & ImGuiWindowFlags_Modal)) break; } if (popup_count_to_keep < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the statement below @@ -9548,16 +10439,9 @@ void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_ { ImGuiWindow* focus_window = (popup_window && popup_window->Flags & ImGuiWindowFlags_ChildMenu) ? popup_window->ParentWindow : popup_backup_nav_window; if (focus_window && !focus_window->WasActive && popup_window) - { - // Fallback - FocusTopMostWindowUnderOne(popup_window, NULL); - } + FocusTopMostWindowUnderOne(popup_window, NULL, NULL, ImGuiFocusRequestFlags_RestoreFocusedChild); // Fallback else - { - if (g.NavLayer == ImGuiNavLayer_Main && focus_window) - focus_window = NavRestoreLastChildNavWindow(focus_window); - FocusWindow(focus_window); - } + FocusWindow(focus_window, (g.NavLayer == ImGuiNavLayer_Main) ? ImGuiFocusRequestFlags_RestoreFocusedChild : ImGuiFocusRequestFlags_None); } } @@ -9870,15 +10754,20 @@ ImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window) } if (window->Flags & ImGuiWindowFlags_Tooltip) { - // Position tooltip (always follows mouse) - float sc = g.Style.MouseCursorScale; - ImVec2 ref_pos = NavCalcPreferredRefPos(); + // Position tooltip (always follows mouse + clamp within outer boundaries) + // Note that drag and drop tooltips are NOT using this path: BeginTooltipEx() manually sets their position. + // In theory we could handle both cases in same location, but requires a bit of shuffling as drag and drop tooltips are calling SetWindowPos() leading to 'window_pos_set_by_api' being set in Begin() + IM_ASSERT(g.CurrentWindow == window); + const float scale = g.Style.MouseCursorScale; + const ImVec2 ref_pos = NavCalcPreferredRefPos(); + const ImVec2 tooltip_pos = ref_pos + TOOLTIP_DEFAULT_OFFSET * scale; ImRect r_avoid; if (!g.NavDisableHighlight && g.NavDisableMouseHover && !(g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos)) r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 16, ref_pos.y + 8); else - r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24 * sc, ref_pos.y + 24 * sc); // FIXME: Hard-coded based on mouse cursor shape expectation. Exact dimension not very important. - return FindBestWindowPosForPopupEx(ref_pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy_Tooltip); + r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24 * scale, ref_pos.y + 24 * scale); // FIXME: Hard-coded based on mouse cursor shape expectation. Exact dimension not very important. + //GetForegroundDrawList()->AddRect(r_avoid.Min, r_avoid.Max, IM_COL32(255, 0, 255, 255)); + return FindBestWindowPosForPopupEx(tooltip_pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy_Tooltip); } IM_ASSERT(0); return window->Pos; @@ -9904,6 +10793,12 @@ void ImGui::SetNavWindow(ImGuiWindow* window) NavUpdateAnyRequestFlag(); } +void ImGui::NavClearPreferredPosForAxis(ImGuiAxis axis) +{ + ImGuiContext& g = *GImGui; + g.NavWindow->RootWindowForNav->NavPreferredScoringPosRel[g.NavLayer][axis] = FLT_MAX; +} + void ImGui::SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel) { ImGuiContext& g = *GImGui; @@ -9914,6 +10809,10 @@ void ImGui::SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id g.NavFocusScopeId = focus_scope_id; g.NavWindow->NavLastIds[nav_layer] = id; g.NavWindow->NavRectRel[nav_layer] = rect_rel; + + // Clear preferred scoring position (NavMoveRequestApplyResult() will tend to restore it) + NavClearPreferredPosForAxis(ImGuiAxis_X); + NavClearPreferredPosForAxis(ImGuiAxis_Y); } void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window) @@ -9924,52 +10823,42 @@ void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window) if (g.NavWindow != window) SetNavWindow(window); - // Assume that SetFocusID() is called in the context where its window->DC.NavLayerCurrent and window->DC.NavFocusScopeIdCurrent are valid. + // Assume that SetFocusID() is called in the context where its window->DC.NavLayerCurrent and g.CurrentFocusScopeId are valid. // Note that window may be != g.CurrentWindow (e.g. SetFocusID call in InputTextEx for multi-line text) const ImGuiNavLayer nav_layer = window->DC.NavLayerCurrent; g.NavId = id; g.NavLayer = nav_layer; - g.NavFocusScopeId = window->DC.NavFocusScopeIdCurrent; + g.NavFocusScopeId = g.CurrentFocusScopeId; window->NavLastIds[nav_layer] = id; if (g.LastItemData.ID == id) window->NavRectRel[nav_layer] = WindowRectAbsToRel(window, g.LastItemData.NavRect); - if (g.ActiveIdSource == ImGuiInputSource_Nav) + if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) g.NavDisableMouseHover = true; else g.NavDisableHighlight = true; + + // Clear preferred scoring position (NavMoveRequestApplyResult() will tend to restore it) + NavClearPreferredPosForAxis(ImGuiAxis_X); + NavClearPreferredPosForAxis(ImGuiAxis_Y); } -ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy) +static ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy) { if (ImFabs(dx) > ImFabs(dy)) return (dx > 0.0f) ? ImGuiDir_Right : ImGuiDir_Left; return (dy > 0.0f) ? ImGuiDir_Down : ImGuiDir_Up; } -static float inline NavScoreItemDistInterval(float a0, float a1, float b0, float b1) +static float inline NavScoreItemDistInterval(float cand_min, float cand_max, float curr_min, float curr_max) { - if (a1 < b0) - return a1 - b0; - if (b1 < a0) - return a0 - b1; + if (cand_max < curr_min) + return cand_max - curr_min; + if (curr_max < cand_min) + return cand_min - curr_max; return 0.0f; } -static void inline NavClampRectToVisibleAreaForMoveDir(ImGuiDir move_dir, ImRect& r, const ImRect& clip_rect) -{ - if (move_dir == ImGuiDir_Left || move_dir == ImGuiDir_Right) - { - r.Min.y = ImClamp(r.Min.y, clip_rect.Min.y, clip_rect.Max.y); - r.Max.y = ImClamp(r.Max.y, clip_rect.Min.y, clip_rect.Max.y); - } - else // FIXME: PageUp/PageDown are leaving move_dir == None - { - r.Min.x = ImClamp(r.Min.x, clip_rect.Min.x, clip_rect.Max.x); - r.Max.x = ImClamp(r.Max.x, clip_rect.Min.x, clip_rect.Max.x); - } -} - // Scoring function for gamepad/keyboard directional navigation. Based on https://gist.github.com/rygorous/6981057 static bool ImGui::NavScoreItem(ImGuiNavItemData* result) { @@ -9992,10 +10881,6 @@ static bool ImGui::NavScoreItem(ImGuiNavItemData* result) cand.ClipWithFull(window->ClipRect); // This allows the scored item to not overlap other candidates in the parent window } - // We perform scoring on items bounding box clipped by the current clipping rectangle on the other axis (clipping on our movement axis would give us equal scores for all clipped items) - // For example, this ensures that items in one column are not reached when moving vertically from items in another column. - NavClampRectToVisibleAreaForMoveDir(g.NavMoveClipDir, cand, window->ClipRect); - // Compute distance between boxes // FIXME-NAV: Introducing biases for vertical navigation, needs to be removed. float dbx = NavScoreItemDistInterval(cand.Min.x, cand.Max.x, curr.Min.x, curr.Max.x); @@ -10034,32 +10919,41 @@ static bool ImGui::NavScoreItem(ImGuiNavItemData* result) quadrant = (g.LastItemData.ID < g.NavId) ? ImGuiDir_Left : ImGuiDir_Right; } + const ImGuiDir move_dir = g.NavMoveDir; #if IMGUI_DEBUG_NAV_SCORING - char buf[128]; - if (IsMouseHoveringRect(cand.Min, cand.Max)) - { - ImFormatString(buf, IM_ARRAYSIZE(buf), "dbox (%.2f,%.2f->%.4f)\ndcen (%.2f,%.2f->%.4f)\nd (%.2f,%.2f->%.4f)\nnav %c, quadrant %c", dbx, dby, dist_box, dcx, dcy, dist_center, dax, day, dist_axial, "WENS"[g.NavMoveDir], "WENS"[quadrant]); - ImDrawList* draw_list = GetForegroundDrawList(window); - draw_list->AddRect(curr.Min, curr.Max, IM_COL32(255,200,0,100)); - draw_list->AddRect(cand.Min, cand.Max, IM_COL32(255,255,0,200)); - draw_list->AddRectFilled(cand.Max - ImVec2(4, 4), cand.Max + CalcTextSize(buf) + ImVec2(4, 4), IM_COL32(40,0,0,150)); - draw_list->AddText(cand.Max, ~0U, buf); - } - else if (g.IO.KeyCtrl) // Hold to preview score in matching quadrant. Press C to rotate. + char buf[200]; + if (g.IO.KeyCtrl) // Hold CTRL to preview score in matching quadrant. CTRL+Arrow to rotate. { - if (quadrant == g.NavMoveDir) + if (quadrant == move_dir) { ImFormatString(buf, IM_ARRAYSIZE(buf), "%.0f/%.0f", dist_box, dist_center); ImDrawList* draw_list = GetForegroundDrawList(window); - draw_list->AddRectFilled(cand.Min, cand.Max, IM_COL32(255, 0, 0, 200)); + draw_list->AddRectFilled(cand.Min, cand.Max, IM_COL32(255, 0, 0, 80)); + draw_list->AddRectFilled(cand.Min, cand.Min + CalcTextSize(buf), IM_COL32(255, 0, 0, 200)); draw_list->AddText(cand.Min, IM_COL32(255, 255, 255, 255), buf); } } + const bool debug_hovering = IsMouseHoveringRect(cand.Min, cand.Max); + const bool debug_tty = (g.IO.KeyCtrl && IsKeyPressed(ImGuiKey_Space)); + if (debug_hovering || debug_tty) + { + ImFormatString(buf, IM_ARRAYSIZE(buf), + "d-box (%7.3f,%7.3f) -> %7.3f\nd-center (%7.3f,%7.3f) -> %7.3f\nd-axial (%7.3f,%7.3f) -> %7.3f\nnav %c, quadrant %c", + dbx, dby, dist_box, dcx, dcy, dist_center, dax, day, dist_axial, "-WENS"[move_dir+1], "-WENS"[quadrant+1]); + if (debug_hovering) + { + ImDrawList* draw_list = GetForegroundDrawList(window); + draw_list->AddRect(curr.Min, curr.Max, IM_COL32(255, 200, 0, 100)); + draw_list->AddRect(cand.Min, cand.Max, IM_COL32(255, 255, 0, 200)); + draw_list->AddRectFilled(cand.Max - ImVec2(4, 4), cand.Max + CalcTextSize(buf) + ImVec2(4, 4), IM_COL32(40, 0, 0, 200)); + draw_list->AddText(cand.Max, ~0U, buf); + } + if (debug_tty) { IMGUI_DEBUG_LOG_NAV("id 0x%08X\n%s\n", g.LastItemData.ID, buf); } + } #endif // Is it in the quadrant we're interested in moving to? bool new_best = false; - const ImGuiDir move_dir = g.NavMoveDir; if (quadrant == move_dir) { // Does it beat the current best candidate? @@ -10110,11 +11004,20 @@ static void ImGui::NavApplyItemToResult(ImGuiNavItemData* result) ImGuiWindow* window = g.CurrentWindow; result->Window = window; result->ID = g.LastItemData.ID; - result->FocusScopeId = window->DC.NavFocusScopeIdCurrent; + result->FocusScopeId = g.CurrentFocusScopeId; result->InFlags = g.LastItemData.InFlags; result->RectRel = WindowRectAbsToRel(window, g.LastItemData.NavRect); } +// True when current work location may be scrolled horizontally when moving left / right. +// This is generally always true UNLESS within a column. We don't have a vertical equivalent. +void ImGui::NavUpdateCurrentWindowIsScrollPushableX() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + window->DC.NavIsScrollPushableX = (g.CurrentTable == NULL && window->DC.CurrentColumns == NULL); +} + // We get there when either NavId == id, or when g.NavAnyRequest is set (which is updated by NavUpdateAnyRequestFlag above) // This is called after LastItemData is set. static void ImGui::NavProcessItem() @@ -10122,18 +11025,24 @@ static void ImGui::NavProcessItem() ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; const ImGuiID id = g.LastItemData.ID; - const ImRect nav_bb = g.LastItemData.NavRect; const ImGuiItemFlags item_flags = g.LastItemData.InFlags; + // When inside a container that isn't scrollable with Left<>Right, clip NavRect accordingly (#2221) + if (window->DC.NavIsScrollPushableX == false) + { + g.LastItemData.NavRect.Min.x = ImClamp(g.LastItemData.NavRect.Min.x, window->ClipRect.Min.x, window->ClipRect.Max.x); + g.LastItemData.NavRect.Max.x = ImClamp(g.LastItemData.NavRect.Max.x, window->ClipRect.Min.x, window->ClipRect.Max.x); + } + const ImRect nav_bb = g.LastItemData.NavRect; + // Process Init Request if (g.NavInitRequest && g.NavLayer == window->DC.NavLayerCurrent && (item_flags & ImGuiItemFlags_Disabled) == 0) { // Even if 'ImGuiItemFlags_NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback const bool candidate_for_nav_default_focus = (item_flags & ImGuiItemFlags_NoNavDefaultFocus) == 0; - if (candidate_for_nav_default_focus || g.NavInitResultId == 0) + if (candidate_for_nav_default_focus || g.NavInitResult.ID == 0) { - g.NavInitResultId = id; - g.NavInitResultRectRel = WindowRectAbsToRel(window, nav_bb); + NavApplyItemToResult(&g.NavInitResult); } if (candidate_for_nav_default_focus) { @@ -10144,42 +11053,37 @@ static void ImGui::NavProcessItem() // Process Move Request (scoring for navigation) // FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRect + scoring from a rect wrapped according to current wrapping policy) - if (g.NavMoveScoringItems) + if (g.NavMoveScoringItems && (item_flags & ImGuiItemFlags_Disabled) == 0) { - const bool is_tab_stop = (item_flags & ImGuiItemFlags_Inputable) && (item_flags & (ImGuiItemFlags_NoTabStop | ImGuiItemFlags_Disabled)) == 0; - const bool is_tabbing = (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) != 0; + const bool is_tabbing = (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) != 0; if (is_tabbing) { - if (is_tab_stop || (g.NavMoveFlags & ImGuiNavMoveFlags_FocusApi)) - NavProcessItemForTabbingRequest(id); + NavProcessItemForTabbingRequest(id, item_flags, g.NavMoveFlags); } - else if ((g.NavId != id || (g.NavMoveFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) && !(item_flags & (ImGuiItemFlags_Disabled | ImGuiItemFlags_NoNav))) + else if (g.NavId != id || (g.NavMoveFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) { ImGuiNavItemData* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther; - if (!is_tabbing) - { - if (NavScoreItem(result)) - NavApplyItemToResult(result); - - // Features like PageUp/PageDown need to maintain a separate score for the visible set of items. - const float VISIBLE_RATIO = 0.70f; - if ((g.NavMoveFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb)) - if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO) - if (NavScoreItem(&g.NavMoveResultLocalVisible)) - NavApplyItemToResult(&g.NavMoveResultLocalVisible); - } + if (NavScoreItem(result)) + NavApplyItemToResult(result); + + // Features like PageUp/PageDown need to maintain a separate score for the visible set of items. + const float VISIBLE_RATIO = 0.70f; + if ((g.NavMoveFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb)) + if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO) + if (NavScoreItem(&g.NavMoveResultLocalVisible)) + NavApplyItemToResult(&g.NavMoveResultLocalVisible); } } - // Update window-relative bounding box of navigated item + // Update information for currently focused/navigated item if (g.NavId == id) { if (g.NavWindow != window) SetNavWindow(window); // Always refresh g.NavWindow, because some operations such as FocusItem() may not have a window. g.NavLayer = window->DC.NavLayerCurrent; - g.NavFocusScopeId = window->DC.NavFocusScopeIdCurrent; + g.NavFocusScopeId = g.CurrentFocusScopeId; g.NavIdIsAlive = true; - window->NavRectRel[window->DC.NavLayerCurrent] = WindowRectAbsToRel(window, nav_bb); // Store item bounding box (relative to window position) + window->NavRectRel[window->DC.NavLayerCurrent] = WindowRectAbsToRel(window, nav_bb); // Store item bounding box (relative to window position) } } @@ -10190,18 +11094,31 @@ static void ImGui::NavProcessItem() // - Case 3: tab forward wrap: set result to first eligible item (preemptively), on ref id set counter, on next frame if counter hasn't elapsed store result. // FIXME-TABBING: Could be done as a next-frame forwarded request // - Case 4: tab backward: store all results, on ref id pick prev, stop storing // - Case 5: tab backward wrap: store all results, on ref id if no result keep storing until last // FIXME-TABBING: Could be done as next-frame forwarded requested -void ImGui::NavProcessItemForTabbingRequest(ImGuiID id) +void ImGui::NavProcessItemForTabbingRequest(ImGuiID id, ImGuiItemFlags item_flags, ImGuiNavMoveFlags move_flags) { ImGuiContext& g = *GImGui; + if ((move_flags & ImGuiNavMoveFlags_FocusApi) == 0) + if (g.NavLayer != g.CurrentWindow->DC.NavLayerCurrent) + return; + + // - Can always land on an item when using API call. + // - Tabbing with _NavEnableKeyboard (space/enter/arrows): goes through every item. + // - Tabbing without _NavEnableKeyboard: goes through inputable items only. + bool can_stop; + if (move_flags & ImGuiNavMoveFlags_FocusApi) + can_stop = true; + else + can_stop = (item_flags & ImGuiItemFlags_NoTabStop) == 0 && ((g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) || (item_flags & ImGuiItemFlags_Inputable)); + // Always store in NavMoveResultLocal (unlike directional request which uses NavMoveResultOther on sibling/flattened windows) ImGuiNavItemData* result = &g.NavMoveResultLocal; if (g.NavTabbingDir == +1) { // Tab Forward or SetKeyboardFocusHere() with >= 0 - if (g.NavTabbingResultFirst.ID == 0) + if (can_stop && g.NavTabbingResultFirst.ID == 0) NavApplyItemToResult(&g.NavTabbingResultFirst); - if (--g.NavTabbingCounter == 0) + if (can_stop && g.NavTabbingCounter > 0 && --g.NavTabbingCounter == 0) NavMoveRequestResolveWithLastItem(result); else if (g.NavId == id) g.NavTabbingCounter = 1; @@ -10217,16 +11134,18 @@ void ImGui::NavProcessItemForTabbingRequest(ImGuiID id) NavUpdateAnyRequestFlag(); } } - else + else if (can_stop) { + // Keep applying until reaching NavId NavApplyItemToResult(result); } } else if (g.NavTabbingDir == 0) { - // Tab Init - if (g.NavTabbingResultFirst.ID == 0) - NavMoveRequestResolveWithLastItem(&g.NavTabbingResultFirst); + if (can_stop && g.NavId == id) + NavMoveRequestResolveWithLastItem(result); + if (can_stop && g.NavTabbingResultFirst.ID == 0) // Tab init + NavApplyItemToResult(&g.NavTabbingResultFirst); } } @@ -10242,7 +11161,7 @@ void ImGui::NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavM ImGuiContext& g = *GImGui; IM_ASSERT(g.NavWindow != NULL); - if (move_flags & ImGuiNavMoveFlags_Tabbing) + if (move_flags & ImGuiNavMoveFlags_IsTabbing) move_flags |= ImGuiNavMoveFlags_AllowCurrentNavId; g.NavMoveSubmitted = g.NavMoveScoringItems = true; @@ -10269,6 +11188,19 @@ void ImGui::NavMoveRequestResolveWithLastItem(ImGuiNavItemData* result) NavUpdateAnyRequestFlag(); } +// Called by TreePop() to implement ImGuiTreeNodeFlags_NavLeftJumpsBackHere +void ImGui::NavMoveRequestResolveWithPastTreeNode(ImGuiNavItemData* result, ImGuiNavTreeNodeData* tree_node_data) +{ + ImGuiContext& g = *GImGui; + g.NavMoveScoringItems = false; + g.LastItemData.ID = tree_node_data->ID; + g.LastItemData.InFlags = tree_node_data->InFlags; + g.LastItemData.NavRect = tree_node_data->NavRect; + NavApplyItemToResult(result); // Result this instead of implementing a NavApplyPastTreeNodeToResult() + NavClearPreferredPosForAxis(ImGuiAxis_Y); + NavUpdateAnyRequestFlag(); +} + void ImGui::NavMoveRequestCancel() { ImGuiContext& g = *GImGui; @@ -10294,10 +11226,12 @@ void ImGui::NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNav void ImGui::NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags wrap_flags) { ImGuiContext& g = *GImGui; - IM_ASSERT(wrap_flags != 0); // Call with _WrapX, _WrapY, _LoopX, _LoopY - // In theory we should test for NavMoveRequestButNoResultYet() but there's no point doing it, NavEndFrame() will do the same test + IM_ASSERT((wrap_flags & ImGuiNavMoveFlags_WrapMask_ ) != 0 && (wrap_flags & ~ImGuiNavMoveFlags_WrapMask_) == 0); // Call with _WrapX, _WrapY, _LoopX, _LoopY + + // In theory we should test for NavMoveRequestButNoResultYet() but there's no point doing it: + // as NavEndFrame() will do the same test. It will end up calling NavUpdateCreateWrappingRequest(). if (g.NavWindow == window && g.NavMoveScoringItems && g.NavLayer == ImGuiNavLayer_Main) - g.NavMoveFlags |= wrap_flags; + g.NavMoveFlags = (g.NavMoveFlags & ~ImGuiNavMoveFlags_WrapMask_) | wrap_flags; } // FIXME: This could be replaced by updating a frame number in each window when (window == NavWindow) and (NavLayer == 0). @@ -10365,7 +11299,8 @@ void ImGui::NavInitWindow(ImGuiWindow* window, bool force_reinit) if (window->Flags & ImGuiWindowFlags_NoNavInputs) { - g.NavId = g.NavFocusScopeId = 0; + g.NavId = 0; + g.NavFocusScopeId = window->NavRootFocusScopeId; return; } @@ -10375,17 +11310,16 @@ void ImGui::NavInitWindow(ImGuiWindow* window, bool force_reinit) IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from NavInitWindow(), init_for_nav=%d, window=\"%s\", layer=%d\n", init_for_nav, window->Name, g.NavLayer); if (init_for_nav) { - SetNavID(0, g.NavLayer, 0, ImRect()); + SetNavID(0, g.NavLayer, window->NavRootFocusScopeId, ImRect()); g.NavInitRequest = true; g.NavInitRequestFromMove = false; - g.NavInitResultId = 0; - g.NavInitResultRectRel = ImRect(); + g.NavInitResult.ID = 0; NavUpdateAnyRequestFlag(); } else { g.NavId = window->NavLastIds[0]; - g.NavFocusScopeId = 0; + g.NavFocusScopeId = window->NavRootFocusScopeId; } } @@ -10464,12 +11398,12 @@ static void ImGui::NavUpdate() g.NavInputSource = ImGuiInputSource_Keyboard; // Process navigation init request (select first/default focus) - if (g.NavInitResultId != 0) + g.NavJustMovedToId = 0; + if (g.NavInitResult.ID != 0) NavInitRequestApplyResult(); g.NavInitRequest = false; g.NavInitRequestFromMove = false; - g.NavInitResultId = 0; - g.NavJustMovedToId = 0; + g.NavInitResult.ID = 0; // Process navigation move request if (g.NavMoveSubmitted) @@ -10502,7 +11436,7 @@ static void ImGui::NavUpdate() NavUpdateCancelRequest(); // Process manual activation request - g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavActivateInputId = 0; + g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = 0; g.NavActivateFlags = ImGuiActivateFlags_None; if (g.NavId != 0 && !g.NavDisableHighlight && !g.NavWindowingTarget && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs)) { @@ -10517,12 +11451,12 @@ static void ImGui::NavUpdate() } if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && input_pressed) { - g.NavActivateInputId = g.NavId; + g.NavActivateId = g.NavId; g.NavActivateFlags = ImGuiActivateFlags_PreferInput; } - if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_down) + if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && (activate_down || input_down)) g.NavActivateDownId = g.NavId; - if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_pressed) + if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && (activate_pressed || input_pressed)) g.NavActivatePressedId = g.NavId; } if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs)) @@ -10534,10 +11468,7 @@ static void ImGui::NavUpdate() // FIXME-NAV: Those should eventually be queued (unlike focus they don't cancel each others) if (g.NavNextActivateId != 0) { - if (g.NavNextActivateFlags & ImGuiActivateFlags_PreferInput) - g.NavActivateInputId = g.NavNextActivateId; - else - g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavNextActivateId; + g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavNextActivateId; g.NavActivateFlags = g.NavNextActivateFlags; } g.NavNextActivateId = 0; @@ -10556,7 +11487,7 @@ static void ImGui::NavUpdate() ImGuiWindow* window = g.NavWindow; const float scroll_speed = IM_ROUND(window->CalcFontSize() * 100 * io.DeltaTime); // We need round the scrolling speed because sub-pixel scroll isn't reliably supported. const ImGuiDir move_dir = g.NavMoveDir; - if (window->DC.NavLayersActiveMask == 0x00 && window->DC.NavHasScroll && move_dir != ImGuiDir_None) + if (window->DC.NavLayersActiveMask == 0x00 && window->DC.NavWindowHasScrollY && move_dir != ImGuiDir_None) { if (move_dir == ImGuiDir_Left || move_dir == ImGuiDir_Right) SetScrollX(window, ImFloor(window->Scroll.x + ((move_dir == ImGuiDir_Left) ? -1.0f : +1.0f) * scroll_speed)); @@ -10568,7 +11499,7 @@ static void ImGui::NavUpdate() // Next movement request will clamp the NavId reference rectangle to the visible area, so navigation will resume within those bounds. if (nav_gamepad_active) { - const ImVec2 scroll_dir = GetKeyVector2d(ImGuiKey_GamepadLStickLeft, ImGuiKey_GamepadLStickRight, ImGuiKey_GamepadLStickUp, ImGuiKey_GamepadLStickDown); + const ImVec2 scroll_dir = GetKeyMagnitude2d(ImGuiKey_GamepadLStickLeft, ImGuiKey_GamepadLStickRight, ImGuiKey_GamepadLStickUp, ImGuiKey_GamepadLStickDown); const float tweak_factor = IsKeyDown(ImGuiKey_NavGamepadTweakSlow) ? 1.0f / 10.0f : IsKeyDown(ImGuiKey_NavGamepadTweakFast) ? 10.0f : 1.0f; if (scroll_dir.x != 0.0f && window->ScrollbarX) SetScrollX(window, ImFloor(window->Scroll.x + scroll_dir.x * scroll_speed * tweak_factor)); @@ -10596,11 +11527,11 @@ static void ImGui::NavUpdate() // [DEBUG] g.NavScoringDebugCount = 0; #if IMGUI_DEBUG_NAV_RECTS - if (g.NavWindow) + if (ImGuiWindow* debug_window = g.NavWindow) { - ImDrawList* draw_list = GetForegroundDrawList(g.NavWindow); - if (1) { for (int layer = 0; layer < 2; layer++) { ImRect r = WindowRectRelToAbs(g.NavWindow, g.NavWindow->NavRectRel[layer]); draw_list->AddRect(r.Min, r.Max, IM_COL32(255,200,0,255)); } } // [DEBUG] - if (1) { ImU32 col = (!g.NavWindow->Hidden) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredRefPos(); char buf[32]; ImFormatString(buf, 32, "%d", g.NavLayer); draw_list->AddCircleFilled(p, 3.0f, col); draw_list->AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); } + ImDrawList* draw_list = GetForegroundDrawList(debug_window); + int layer = g.NavLayer; /* for (int layer = 0; layer < 2; layer++)*/ { ImRect r = WindowRectRelToAbs(debug_window, debug_window->NavRectRel[layer]); draw_list->AddRect(r.Min, r.Max, IM_COL32(255, 200, 0, 255)); } + //if (1) { ImU32 col = (!debug_window->Hidden) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredRefPos(); char buf[32]; ImFormatString(buf, 32, "%d", g.NavLayer); draw_list->AddCircleFilled(p, 3.0f, col); draw_list->AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); } } #endif } @@ -10612,15 +11543,48 @@ void ImGui::NavInitRequestApplyResult() if (!g.NavWindow) return; + ImGuiNavItemData* result = &g.NavInitResult; + if (g.NavId != result->ID) + { + g.NavJustMovedToId = result->ID; + g.NavJustMovedToFocusScopeId = result->FocusScopeId; + g.NavJustMovedToKeyMods = 0; + } + // Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called) // FIXME-NAV: On _NavFlattened windows, g.NavWindow will only be updated during subsequent frame. Not a problem currently. - IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: ApplyResult: NavID 0x%08X in Layer %d Window \"%s\"\n", g.NavInitResultId, g.NavLayer, g.NavWindow->Name); - SetNavID(g.NavInitResultId, g.NavLayer, 0, g.NavInitResultRectRel); + IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: ApplyResult: NavID 0x%08X in Layer %d Window \"%s\"\n", result->ID, g.NavLayer, g.NavWindow->Name); + SetNavID(result->ID, g.NavLayer, result->FocusScopeId, result->RectRel); g.NavIdIsAlive = true; // Mark as alive from previous frame as we got a result if (g.NavInitRequestFromMove) NavRestoreHighlightAfterMove(); } +// Bias scoring rect ahead of scoring + update preferred pos (if missing) using source position +static void NavBiasScoringRect(ImRect& r, ImVec2& preferred_pos_rel, ImGuiDir move_dir, ImGuiNavMoveFlags move_flags) +{ + // Bias initial rect + ImGuiContext& g = *GImGui; + const ImVec2 rel_to_abs_offset = g.NavWindow->DC.CursorStartPos; + + // Initialize bias on departure if we don't have any. So mouse-click + arrow will record bias. + // - We default to L/U bias, so moving down from a large source item into several columns will land on left-most column. + // - But each successful move sets new bias on one axis, only cleared when using mouse. + if ((move_flags & ImGuiNavMoveFlags_Forwarded) == 0) + { + if (preferred_pos_rel.x == FLT_MAX) + preferred_pos_rel.x = ImMin(r.Min.x + 1.0f, r.Max.x) - rel_to_abs_offset.x; + if (preferred_pos_rel.y == FLT_MAX) + preferred_pos_rel.y = r.GetCenter().y - rel_to_abs_offset.y; + } + + // Apply general bias on the other axis + if ((move_dir == ImGuiDir_Up || move_dir == ImGuiDir_Down) && preferred_pos_rel.x != FLT_MAX) + r.Min.x = r.Max.x = preferred_pos_rel.x + rel_to_abs_offset.x; + else if ((move_dir == ImGuiDir_Left || move_dir == ImGuiDir_Right) && preferred_pos_rel.y != FLT_MAX) + r.Min.y = r.Max.y = preferred_pos_rel.y + rel_to_abs_offset.y; +} + void ImGui::NavUpdateCreateMoveRequest() { ImGuiContext& g = *GImGui; @@ -10645,11 +11609,11 @@ void ImGui::NavUpdateCreateMoveRequest() g.NavMoveScrollFlags = ImGuiScrollFlags_None; if (window && !g.NavWindowingTarget && !(window->Flags & ImGuiWindowFlags_NoNavInputs)) { - const ImGuiInputFlags repeat_mode = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateNavMove; - if (!IsActiveIdUsingNavDir(ImGuiDir_Left) && ((nav_gamepad_active && IsKeyPressedEx(ImGuiKey_GamepadDpadLeft, repeat_mode)) || (nav_keyboard_active && IsKeyPressedEx(ImGuiKey_LeftArrow, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Left; } - if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && ((nav_gamepad_active && IsKeyPressedEx(ImGuiKey_GamepadDpadRight, repeat_mode)) || (nav_keyboard_active && IsKeyPressedEx(ImGuiKey_RightArrow, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Right; } - if (!IsActiveIdUsingNavDir(ImGuiDir_Up) && ((nav_gamepad_active && IsKeyPressedEx(ImGuiKey_GamepadDpadUp, repeat_mode)) || (nav_keyboard_active && IsKeyPressedEx(ImGuiKey_UpArrow, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Up; } - if (!IsActiveIdUsingNavDir(ImGuiDir_Down) && ((nav_gamepad_active && IsKeyPressedEx(ImGuiKey_GamepadDpadDown, repeat_mode)) || (nav_keyboard_active && IsKeyPressedEx(ImGuiKey_DownArrow, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Down; } + const ImGuiInputFlags repeat_mode = ImGuiInputFlags_Repeat | (ImGuiInputFlags)ImGuiInputFlags_RepeatRateNavMove; + if (!IsActiveIdUsingNavDir(ImGuiDir_Left) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadLeft, ImGuiKeyOwner_None, repeat_mode)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_LeftArrow, ImGuiKeyOwner_None, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Left; } + if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadRight, ImGuiKeyOwner_None, repeat_mode)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_RightArrow, ImGuiKeyOwner_None, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Right; } + if (!IsActiveIdUsingNavDir(ImGuiDir_Up) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadUp, ImGuiKeyOwner_None, repeat_mode)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_UpArrow, ImGuiKeyOwner_None, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Up; } + if (!IsActiveIdUsingNavDir(ImGuiDir_Down) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadDown, ImGuiKeyOwner_None, repeat_mode)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_DownArrow, ImGuiKeyOwner_None, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Down; } } g.NavMoveClipDir = g.NavMoveDir; g.NavScoringNoClipRect = ImRect(+FLT_MAX, +FLT_MAX, -FLT_MAX, -FLT_MAX); @@ -10666,13 +11630,15 @@ void ImGui::NavUpdateCreateMoveRequest() g.NavScoringNoClipRect.TranslateY(scoring_rect_offset_y); } - // [DEBUG] Always send a request + // [DEBUG] Always send a request when holding CTRL. Hold CTRL + Arrow change the direction. #if IMGUI_DEBUG_NAV_SCORING - if (io.KeyCtrl && IsKeyPressed(ImGuiKey_C)) - g.NavMoveDirForDebug = (ImGuiDir)((g.NavMoveDirForDebug + 1) & 3); - if (io.KeyCtrl && g.NavMoveDir == ImGuiDir_None) + //if (io.KeyCtrl && IsKeyPressed(ImGuiKey_C)) + // g.NavMoveDirForDebug = (ImGuiDir)((g.NavMoveDirForDebug + 1) & 3); + if (io.KeyCtrl) { - g.NavMoveDir = g.NavMoveDirForDebug; + if (g.NavMoveDir == ImGuiDir_None) + g.NavMoveDir = g.NavMoveDirForDebug; + g.NavMoveClipDir = g.NavMoveDir; g.NavMoveFlags |= ImGuiNavMoveFlags_DebugNoResult; } #endif @@ -10687,21 +11653,26 @@ void ImGui::NavUpdateCreateMoveRequest() { IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n", window ? window->Name : "", g.NavLayer); g.NavInitRequest = g.NavInitRequestFromMove = true; - g.NavInitResultId = 0; + g.NavInitResult.ID = 0; g.NavDisableHighlight = false; } // When using gamepad, we project the reference nav bounding box into window visible area. - // This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, since with gamepad all movements are relative - // (can't focus a visible object like we can with the mouse). + // This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, + // since with gamepad all movements are relative (can't focus a visible object like we can with the mouse). if (g.NavMoveSubmitted && g.NavInputSource == ImGuiInputSource_Gamepad && g.NavLayer == ImGuiNavLayer_Main && window != NULL)// && (g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded)) { bool clamp_x = (g.NavMoveFlags & (ImGuiNavMoveFlags_LoopX | ImGuiNavMoveFlags_WrapX)) == 0; bool clamp_y = (g.NavMoveFlags & (ImGuiNavMoveFlags_LoopY | ImGuiNavMoveFlags_WrapY)) == 0; ImRect inner_rect_rel = WindowRectAbsToRel(window, ImRect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1))); + + // Take account of changing scroll to handle triggering a new move request on a scrolling frame. (#6171) + // Otherwise 'inner_rect_rel' would be off on the move result frame. + inner_rect_rel.Translate(CalcNextScrollFromScrollTargetAndClamp(window) - window->Scroll); + if ((clamp_x || clamp_y) && !inner_rect_rel.Contains(window->NavRectRel[g.NavLayer])) { - //IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequest: clamp NavRectRel for gamepad move\n"); + IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequest: clamp NavRectRel for gamepad move\n"); float pad_x = ImMin(inner_rect_rel.GetWidth(), window->CalcFontSize() * 0.5f); float pad_y = ImMin(inner_rect_rel.GetHeight(), window->CalcFontSize() * 0.5f); // Terrible approximation for the intent of starting navigation from first fully visible item inner_rect_rel.Min.x = clamp_x ? (inner_rect_rel.Min.x + pad_x) : -FLT_MAX; @@ -10709,7 +11680,7 @@ void ImGui::NavUpdateCreateMoveRequest() inner_rect_rel.Min.y = clamp_y ? (inner_rect_rel.Min.y + pad_y) : -FLT_MAX; inner_rect_rel.Max.y = clamp_y ? (inner_rect_rel.Max.y - pad_y) : +FLT_MAX; window->NavRectRel[g.NavLayer].ClipWithFull(inner_rect_rel); - g.NavId = g.NavFocusScopeId = 0; + g.NavId = 0; } } @@ -10720,9 +11691,9 @@ void ImGui::NavUpdateCreateMoveRequest() ImRect nav_rect_rel = !window->NavRectRel[g.NavLayer].IsInverted() ? window->NavRectRel[g.NavLayer] : ImRect(0, 0, 0, 0); scoring_rect = WindowRectRelToAbs(window, nav_rect_rel); scoring_rect.TranslateY(scoring_rect_offset_y); - scoring_rect.Min.x = ImMin(scoring_rect.Min.x + 1.0f, scoring_rect.Max.x); - scoring_rect.Max.x = scoring_rect.Min.x; - IM_ASSERT(!scoring_rect.IsInverted()); // Ensure if we have a finite, non-inverted bounding box here will allow us to remove extraneous ImFabs() calls in NavScoreItem(). + if (g.NavMoveSubmitted) + NavBiasScoringRect(scoring_rect, window->RootWindowForNav->NavPreferredScoringPosRel[g.NavLayer], g.NavMoveDir, g.NavMoveFlags); + IM_ASSERT(!scoring_rect.IsInverted()); // Ensure we have a non-inverted bounding box here will allow us to remove extraneous ImFabs() calls in NavScoreItem(). //GetForegroundDrawList()->AddRect(scoring_rect.Min, scoring_rect.Max, IM_COL32(255,200,0,255)); // [DEBUG] //if (!g.NavScoringNoClipRect.IsInverted()) { GetForegroundDrawList()->AddRect(g.NavScoringNoClipRect.Min, g.NavScoringNoClipRect.Max, IM_COL32(255, 200, 0, 255)); } // [DEBUG] } @@ -10738,7 +11709,7 @@ void ImGui::NavUpdateCreateTabbingRequest() if (window == NULL || g.NavWindowingTarget != NULL || (window->Flags & ImGuiWindowFlags_NoNavInputs)) return; - const bool tab_pressed = IsKeyPressed(ImGuiKey_Tab, true) && !IsActiveIdUsingKey(ImGuiKey_Tab) && !g.IO.KeyCtrl && !g.IO.KeyAlt; + const bool tab_pressed = IsKeyPressed(ImGuiKey_Tab, ImGuiKeyOwner_None, ImGuiInputFlags_Repeat) && !g.IO.KeyCtrl && !g.IO.KeyAlt; if (!tab_pressed) return; @@ -10746,11 +11717,15 @@ void ImGui::NavUpdateCreateTabbingRequest() // (this is ALWAYS ENABLED, regardless of ImGuiConfigFlags_NavEnableKeyboard flag!) // Initially this was designed to use counters and modulo arithmetic, but that could not work with unsubmitted items (list clipper). Instead we use a strategy close to other move requests. // See NavProcessItemForTabbingRequest() for a description of the various forward/backward tabbing cases with and without wrapping. - //// FIXME: We use (g.ActiveId == 0) but (g.NavDisableHighlight == false) might be righter once we can tab through anything - g.NavTabbingDir = g.IO.KeyShift ? -1 : (g.ActiveId == 0) ? 0 : +1; + const bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; + if (nav_keyboard_active) + g.NavTabbingDir = g.IO.KeyShift ? -1 : (g.NavDisableHighlight == true && g.ActiveId == 0) ? 0 : +1; + else + g.NavTabbingDir = g.IO.KeyShift ? -1 : (g.ActiveId == 0) ? 0 : +1; + ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_IsTabbing | ImGuiNavMoveFlags_Activate; ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY; ImGuiDir clip_dir = (g.NavTabbingDir < 0) ? ImGuiDir_Up : ImGuiDir_Down; - NavMoveRequestSubmit(ImGuiDir_None, clip_dir, ImGuiNavMoveFlags_Tabbing, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. + NavMoveRequestSubmit(ImGuiDir_None, clip_dir, move_flags, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. g.NavTabbingCounter = -1; } @@ -10767,17 +11742,20 @@ void ImGui::NavMoveRequestApplyResult() ImGuiNavItemData* result = (g.NavMoveResultLocal.ID != 0) ? &g.NavMoveResultLocal : (g.NavMoveResultOther.ID != 0) ? &g.NavMoveResultOther : NULL; // Tabbing forward wrap - if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) + if ((g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) && result == NULL) if ((g.NavTabbingCounter == 1 || g.NavTabbingDir == 0) && g.NavTabbingResultFirst.ID) result = &g.NavTabbingResultFirst; // In a situation when there are no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result) + const ImGuiAxis axis = (g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down) ? ImGuiAxis_Y : ImGuiAxis_X; if (result == NULL) { - if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) - g.NavMoveFlags |= ImGuiNavMoveFlags_DontSetNavHighlight; - if (g.NavId != 0 && (g.NavMoveFlags & ImGuiNavMoveFlags_DontSetNavHighlight) == 0) + if (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) + g.NavMoveFlags |= ImGuiNavMoveFlags_NoSetNavHighlight; + if (g.NavId != 0 && (g.NavMoveFlags & ImGuiNavMoveFlags_NoSetNavHighlight) == 0) NavRestoreHighlightAfterMove(); + NavClearPreferredPosForAxis(axis); // On a failed move, clear preferred pos for this axis. + IMGUI_DEBUG_LOG_NAV("[nav] NavMoveSubmitted but not led to a result!\n"); return; } @@ -10795,17 +11773,15 @@ void ImGui::NavMoveRequestApplyResult() // Scroll to keep newly navigated item fully into view. if (g.NavLayer == ImGuiNavLayer_Main) { + ImRect rect_abs = WindowRectRelToAbs(result->Window, result->RectRel); + ScrollToRectEx(result->Window, rect_abs, g.NavMoveScrollFlags); + if (g.NavMoveFlags & ImGuiNavMoveFlags_ScrollToEdgeY) { - // FIXME: Should remove this + // FIXME: Should remove this? Or make more precise: use ScrollToRectEx() with edge? float scroll_target = (g.NavMoveDir == ImGuiDir_Up) ? result->Window->ScrollMax.y : 0.0f; SetScrollY(result->Window, scroll_target); } - else - { - ImRect rect_abs = WindowRectRelToAbs(result->Window, result->RectRel); - ScrollToRectEx(result->Window, rect_abs, g.NavMoveScrollFlags); - } } if (g.NavWindow != result->Window) @@ -10815,35 +11791,45 @@ void ImGui::NavMoveRequestApplyResult() } if (g.ActiveId != result->ID) ClearActiveID(); - if (g.NavId != result->ID) + + // Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId) + // PageUp/PageDown however sets always set NavJustMovedTo (vs Home/End which doesn't) mimicking Windows behavior. + if ((g.NavId != result->ID || (g.NavMoveFlags & ImGuiNavMoveFlags_IsPageMove)) && (g.NavMoveFlags & ImGuiNavMoveFlags_NoSelect) == 0) { - // Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId) g.NavJustMovedToId = result->ID; g.NavJustMovedToFocusScopeId = result->FocusScopeId; g.NavJustMovedToKeyMods = g.NavMoveKeyMods; } - // Focus + // Apply new NavID/Focus IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequest: result NavID 0x%08X in Layer %d Window \"%s\"\n", result->ID, g.NavLayer, g.NavWindow->Name); + ImVec2 preferred_scoring_pos_rel = g.NavWindow->RootWindowForNav->NavPreferredScoringPosRel[g.NavLayer]; SetNavID(result->ID, g.NavLayer, result->FocusScopeId, result->RectRel); - // Tabbing: Activates Inputable or Focus non-Inputable - if ((g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) && (result->InFlags & ImGuiItemFlags_Inputable)) + // Restore last preferred position for current axis + // (storing in RootWindowForNav-> as the info is desirable at the beginning of a Move Request. In theory all storage should use RootWindowForNav..) + if ((g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) == 0) { - g.NavNextActivateId = result->ID; - g.NavNextActivateFlags = ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState; - g.NavMoveFlags |= ImGuiNavMoveFlags_DontSetNavHighlight; + preferred_scoring_pos_rel[axis] = result->RectRel.GetCenter()[axis]; + g.NavWindow->RootWindowForNav->NavPreferredScoringPosRel[g.NavLayer] = preferred_scoring_pos_rel; } + // Tabbing: Activates Inputable, otherwise only Focus + if ((g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) && (result->InFlags & ImGuiItemFlags_Inputable) == 0) + g.NavMoveFlags &= ~ImGuiNavMoveFlags_Activate; + // Activate if (g.NavMoveFlags & ImGuiNavMoveFlags_Activate) { g.NavNextActivateId = result->ID; g.NavNextActivateFlags = ImGuiActivateFlags_None; + g.NavMoveFlags |= ImGuiNavMoveFlags_NoSetNavHighlight; + if (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) + g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState; } // Enable nav highlight - if ((g.NavMoveFlags & ImGuiNavMoveFlags_DontSetNavHighlight) == 0) + if ((g.NavMoveFlags & ImGuiNavMoveFlags_NoSetNavHighlight) == 0) NavRestoreHighlightAfterMove(); } @@ -10856,14 +11842,13 @@ static void ImGui::NavUpdateCancelRequest() ImGuiContext& g = *GImGui; const bool nav_gamepad_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (g.IO.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; const bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; - if (!(nav_keyboard_active && IsKeyPressed(ImGuiKey_Escape, false)) && !(nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadCancel, false))) + if (!(nav_keyboard_active && IsKeyPressed(ImGuiKey_Escape, ImGuiKeyOwner_None)) && !(nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadCancel, ImGuiKeyOwner_None))) return; IMGUI_DEBUG_LOG_NAV("[nav] NavUpdateCancelRequest()\n"); if (g.ActiveId != 0) { - if (!IsActiveIdUsingKey(ImGuiKey_Escape) && !IsActiveIdUsingKey(ImGuiKey_NavGamepadCancel)) - ClearActiveID(); + ClearActiveID(); } else if (g.NavLayer != ImGuiNavLayer_Main) { @@ -10892,7 +11877,7 @@ static void ImGui::NavUpdateCancelRequest() // Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were if (g.NavWindow && ((g.NavWindow->Flags & ImGuiWindowFlags_Popup) || !(g.NavWindow->Flags & ImGuiWindowFlags_ChildWindow))) g.NavWindow->NavLastIds[0] = 0; - g.NavId = g.NavFocusScopeId = 0; + g.NavId = 0; } } @@ -10907,22 +11892,22 @@ static float ImGui::NavUpdatePageUpPageDown() if ((window->Flags & ImGuiWindowFlags_NoNavInputs) || g.NavWindowingTarget != NULL) return 0.0f; - const bool page_up_held = IsKeyDown(ImGuiKey_PageUp) && !IsActiveIdUsingKey(ImGuiKey_PageUp); - const bool page_down_held = IsKeyDown(ImGuiKey_PageDown) && !IsActiveIdUsingKey(ImGuiKey_PageDown); - const bool home_pressed = IsKeyPressed(ImGuiKey_Home) && !IsActiveIdUsingKey(ImGuiKey_Home); - const bool end_pressed = IsKeyPressed(ImGuiKey_End) && !IsActiveIdUsingKey(ImGuiKey_End); + const bool page_up_held = IsKeyDown(ImGuiKey_PageUp, ImGuiKeyOwner_None); + const bool page_down_held = IsKeyDown(ImGuiKey_PageDown, ImGuiKeyOwner_None); + const bool home_pressed = IsKeyPressed(ImGuiKey_Home, ImGuiKeyOwner_None, ImGuiInputFlags_Repeat); + const bool end_pressed = IsKeyPressed(ImGuiKey_End, ImGuiKeyOwner_None, ImGuiInputFlags_Repeat); if (page_up_held == page_down_held && home_pressed == end_pressed) // Proceed if either (not both) are pressed, otherwise early out return 0.0f; if (g.NavLayer != ImGuiNavLayer_Main) NavRestoreLayer(ImGuiNavLayer_Main); - if (window->DC.NavLayersActiveMask == 0x00 && window->DC.NavHasScroll) + if (window->DC.NavLayersActiveMask == 0x00 && window->DC.NavWindowHasScrollY) { // Fallback manual-scroll when window has no navigable item - if (IsKeyPressed(ImGuiKey_PageUp, true)) + if (IsKeyPressed(ImGuiKey_PageUp, ImGuiKeyOwner_None, ImGuiInputFlags_Repeat)) SetScrollY(window, window->Scroll.y - window->InnerRect.GetHeight()); - else if (IsKeyPressed(ImGuiKey_PageDown, true)) + else if (IsKeyPressed(ImGuiKey_PageDown, ImGuiKeyOwner_None, ImGuiInputFlags_Repeat)) SetScrollY(window, window->Scroll.y + window->InnerRect.GetHeight()); else if (home_pressed) SetScrollY(window, 0.0f); @@ -10939,14 +11924,14 @@ static float ImGui::NavUpdatePageUpPageDown() nav_scoring_rect_offset_y = -page_offset_y; g.NavMoveDir = ImGuiDir_Down; // Because our scoring rect is offset up, we request the down direction (so we can always land on the last item) g.NavMoveClipDir = ImGuiDir_Up; - g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet; + g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet | ImGuiNavMoveFlags_IsPageMove; } else if (IsKeyPressed(ImGuiKey_PageDown, true)) { nav_scoring_rect_offset_y = +page_offset_y; g.NavMoveDir = ImGuiDir_Up; // Because our scoring rect is offset down, we request the up direction (so we can always land on the last item) g.NavMoveClipDir = ImGuiDir_Down; - g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet; + g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet | ImGuiNavMoveFlags_IsPageMove; } else if (home_pressed) { @@ -10985,8 +11970,7 @@ static void ImGui::NavEndFrame() // Perform wrap-around in menus // FIXME-NAV: Wrap may need to apply a weight bias on the other axis. e.g. 4x4 grid with 2 last items missing on last item won't handle LoopY/WrapY correctly. // FIXME-NAV: Wrap (not Loop) support could be handled by the scoring function and then WrapX would function without an extra frame. - const ImGuiNavMoveFlags wanted_flags = ImGuiNavMoveFlags_WrapX | ImGuiNavMoveFlags_LoopX | ImGuiNavMoveFlags_WrapY | ImGuiNavMoveFlags_LoopY; - if (g.NavWindow && NavMoveRequestButNoResultYet() && (g.NavMoveFlags & wanted_flags) && (g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded) == 0) + if (g.NavWindow && NavMoveRequestButNoResultYet() && (g.NavMoveFlags & ImGuiNavMoveFlags_WrapMask_) && (g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded) == 0) NavUpdateCreateWrappingRequest(); } @@ -10998,7 +11982,9 @@ static void ImGui::NavUpdateCreateWrappingRequest() bool do_forward = false; ImRect bb_rel = window->NavRectRel[g.NavLayer]; ImGuiDir clip_dir = g.NavMoveDir; + const ImGuiNavMoveFlags move_flags = g.NavMoveFlags; + //const ImGuiAxis move_axis = (g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down) ? ImGuiAxis_Y : ImGuiAxis_X; if (g.NavMoveDir == ImGuiDir_Left && (move_flags & (ImGuiNavMoveFlags_WrapX | ImGuiNavMoveFlags_LoopX))) { bb_rel.Min.x = bb_rel.Max.x = window->ContentSize.x + window->WindowPadding.x; @@ -11042,6 +12028,8 @@ static void ImGui::NavUpdateCreateWrappingRequest() if (!do_forward) return; window->NavRectRel[g.NavLayer] = bb_rel; + NavClearPreferredPosForAxis(ImGuiAxis_X); + NavClearPreferredPosForAxis(ImGuiAxis_Y); NavMoveRequestForward(g.NavMoveDir, clip_dir, move_flags, g.NavMoveScrollFlags); } @@ -11095,7 +12083,7 @@ static void ImGui::NavUpdateWindowing() bool apply_toggle_layer = false; ImGuiWindow* modal_window = GetTopMostPopupModal(); - bool allow_windowing = (modal_window == NULL); + bool allow_windowing = (modal_window == NULL); // FIXME: This prevent CTRL+TAB from being usable with windows that are inside the Begin-stack of that modal. if (!allow_windowing) g.NavWindowingTarget = NULL; @@ -11108,10 +12096,13 @@ static void ImGui::NavUpdateWindowing() } // Start CTRL+Tab or Square+L/R window selection + const ImGuiID owner_id = ImHashStr("###NavUpdateWindowing"); const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; - const bool start_windowing_with_gamepad = allow_windowing && nav_gamepad_active && !g.NavWindowingTarget && IsKeyPressed(ImGuiKey_NavGamepadMenu, false); - const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && io.KeyCtrl && IsKeyPressed(ImGuiKey_Tab, false); // Note: enabled even without NavEnableKeyboard! + const bool keyboard_next_window = allow_windowing && g.ConfigNavWindowingKeyNext && Shortcut(g.ConfigNavWindowingKeyNext, owner_id, ImGuiInputFlags_Repeat | ImGuiInputFlags_RouteAlways); + const bool keyboard_prev_window = allow_windowing && g.ConfigNavWindowingKeyPrev && Shortcut(g.ConfigNavWindowingKeyPrev, owner_id, ImGuiInputFlags_Repeat | ImGuiInputFlags_RouteAlways); + const bool start_windowing_with_gamepad = allow_windowing && nav_gamepad_active && !g.NavWindowingTarget && IsKeyPressed(ImGuiKey_NavGamepadMenu, 0, ImGuiInputFlags_None); + const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && (keyboard_next_window || keyboard_prev_window); // Note: enabled even without NavEnableKeyboard! if (start_windowing_with_gamepad || start_windowing_with_keyboard) if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1)) { @@ -11120,6 +12111,10 @@ static void ImGui::NavUpdateWindowing() g.NavWindowingAccumDeltaPos = g.NavWindowingAccumDeltaSize = ImVec2(0.0f, 0.0f); g.NavWindowingToggleLayer = start_windowing_with_gamepad ? true : false; // Gamepad starts toggling layer g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_Keyboard : ImGuiInputSource_Gamepad; + + // Register ownership of our mods. Using ImGuiInputFlags_RouteGlobalHigh in the Shortcut() calls instead would probably be correct but may have more side-effects. + if (keyboard_next_window || keyboard_prev_window) + SetKeyOwnersForKeyChord((g.ConfigNavWindowingKeyNext | g.ConfigNavWindowingKeyPrev) & ImGuiMod_Mask_, owner_id); } // Gamepad update @@ -11153,17 +12148,19 @@ static void ImGui::NavUpdateWindowing() if (g.NavWindowingTarget && g.NavInputSource == ImGuiInputSource_Keyboard) { // Visuals only appears after a brief time after pressing TAB the first time, so that a fast CTRL+TAB doesn't add visual noise + ImGuiKeyChord shared_mods = ((g.ConfigNavWindowingKeyNext ? g.ConfigNavWindowingKeyNext : ImGuiMod_Mask_) & (g.ConfigNavWindowingKeyPrev ? g.ConfigNavWindowingKeyPrev : ImGuiMod_Mask_)) & ImGuiMod_Mask_; + IM_ASSERT(shared_mods != 0); // Next/Prev shortcut currently needs a shared modifier to "hold", otherwise Prev actions would keep cycling between two windows. g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f)); // 1.0f - if (IsKeyPressed(ImGuiKey_Tab, true)) - NavUpdateWindowingHighlightWindow(io.KeyShift ? +1 : -1); - if (!io.KeyCtrl) + if (keyboard_next_window || keyboard_prev_window) + NavUpdateWindowingHighlightWindow(keyboard_next_window ? -1 : +1); + else if ((io.KeyMods & shared_mods) != shared_mods) apply_focus_window = g.NavWindowingTarget; } // Keyboard: Press and Release ALT to toggle menu layer // - Testing that only Alt is tested prevents Alt+Shift or AltGR from toggling menu layer. // - AltGR is normally Alt+Ctrl but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). But even on keyboards without AltGR we don't want Alt+Ctrl to open menu anyway. - if (nav_keyboard_active && IsKeyPressed(ImGuiMod_Alt)) + if (nav_keyboard_active && IsKeyPressed(ImGuiMod_Alt, ImGuiKeyOwner_None)) { g.NavWindowingToggleLayer = true; g.NavInputSource = ImGuiInputSource_Keyboard; @@ -11172,7 +12169,8 @@ static void ImGui::NavUpdateWindowing() { // We cancel toggling nav layer when any text has been typed (generally while holding Alt). (See #370) // We cancel toggling nav layer when other modifiers are pressed. (See #4439) - if (io.InputQueueCharacters.Size > 0 || io.KeyCtrl || io.KeyShift || io.KeySuper) + // We cancel toggling nav layer if an owner has claimed the key. + if (io.InputQueueCharacters.Size > 0 || io.KeyCtrl || io.KeyShift || io.KeySuper || TestKeyOwner(ImGuiMod_Alt, ImGuiKeyOwner_None) == false) g.NavWindowingToggleLayer = false; // Apply layer toggle on release @@ -11190,9 +12188,9 @@ static void ImGui::NavUpdateWindowing() { ImVec2 nav_move_dir; if (g.NavInputSource == ImGuiInputSource_Keyboard && !io.KeyShift) - nav_move_dir = GetKeyVector2d(ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow); + nav_move_dir = GetKeyMagnitude2d(ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow); if (g.NavInputSource == ImGuiInputSource_Gamepad) - nav_move_dir = GetKeyVector2d(ImGuiKey_GamepadLStickLeft, ImGuiKey_GamepadLStickRight, ImGuiKey_GamepadLStickUp, ImGuiKey_GamepadLStickDown); + nav_move_dir = GetKeyMagnitude2d(ImGuiKey_GamepadLStickLeft, ImGuiKey_GamepadLStickRight, ImGuiKey_GamepadLStickUp, ImGuiKey_GamepadLStickDown); if (nav_move_dir.x != 0.0f || nav_move_dir.y != 0.0f) { const float NAV_MOVE_SPEED = 800.0f; @@ -11214,9 +12212,9 @@ static void ImGui::NavUpdateWindowing() { ClearActiveID(); NavRestoreHighlightAfterMove(); - apply_focus_window = NavRestoreLastChildNavWindow(apply_focus_window); ClosePopupsOverWindow(apply_focus_window, false); - FocusWindow(apply_focus_window); + FocusWindow(apply_focus_window, ImGuiFocusRequestFlags_RestoreFocusedChild); + apply_focus_window = g.NavWindow; if (apply_focus_window->NavLastIds[0] == 0) NavInitWindow(apply_focus_window, false); @@ -11269,10 +12267,10 @@ static void ImGui::NavUpdateWindowing() static const char* GetFallbackWindowNameForWindowingList(ImGuiWindow* window) { if (window->Flags & ImGuiWindowFlags_Popup) - return "(Popup)"; + return ImGui::LocalizeGetMsg(ImGuiLocKey_WindowingPopup); if ((window->Flags & ImGuiWindowFlags_MenuBar) && strcmp(window->Name, "##MainMenuBar") == 0) - return "(Main menu bar)"; - return "(Untitled)"; + return ImGui::LocalizeGetMsg(ImGuiLocKey_WindowingMainMenuBar); + return ImGui::LocalizeGetMsg(ImGuiLocKey_WindowingUntitled); } // Overlay displayed when using CTRL+TAB. Called by EndFrame(). @@ -11387,7 +12385,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags) // Rely on keeping other window->LastItemXXX fields intact. source_id = g.LastItemData.ID = window->GetIDFromRectangle(g.LastItemData.Rect); KeepAliveID(source_id); - bool is_hovered = ItemHoverable(g.LastItemData.Rect, source_id); + bool is_hovered = ItemHoverable(g.LastItemData.Rect, source_id, g.LastItemData.InFlags); if (is_hovered && g.IO.MouseClicked[mouse_button]) { SetActiveID(source_id, window); @@ -11433,13 +12431,12 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags) { // Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit) // We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents. - BeginTooltip(); + bool ret = BeginTooltip(); + IM_ASSERT(ret); // FIXME-NEWBEGIN: If this ever becomes false, we need to Begin("##Hidden", NULL, ImGuiWindowFlags_NoSavedSettings) + SetWindowHiddendAndSkipItemsForCurrentFrame(). + IM_UNUSED(ret); + if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip)) - { - ImGuiWindow* tooltip_window = g.CurrentWindow; - tooltip_window->Hidden = tooltip_window->SkipItems = true; - tooltip_window->HiddenFramesCanSkipItems = 1; - } + SetWindowHiddendAndSkipItemsForCurrentFrame(g.CurrentWindow); } if (!(flags & ImGuiDragDropFlags_SourceNoDisableHover) && !(flags & ImGuiDragDropFlags_SourceExtern)) @@ -11588,41 +12585,51 @@ const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDrop const bool was_accepted_previously = (g.DragDropAcceptIdPrev == g.DragDropTargetId); ImRect r = g.DragDropTargetRect; float r_surface = r.GetWidth() * r.GetHeight(); - if (r_surface <= g.DragDropAcceptIdCurrRectSurface) - { - g.DragDropAcceptFlags = flags; - g.DragDropAcceptIdCurr = g.DragDropTargetId; - g.DragDropAcceptIdCurrRectSurface = r_surface; - } + if (r_surface > g.DragDropAcceptIdCurrRectSurface) + return NULL; + + g.DragDropAcceptFlags = flags; + g.DragDropAcceptIdCurr = g.DragDropTargetId; + g.DragDropAcceptIdCurrRectSurface = r_surface; + //IMGUI_DEBUG_LOG("AcceptDragDropPayload(): %08X: accept\n", g.DragDropTargetId); // Render default drop visuals - // FIXME-DRAGDROP: Settle on a proper default visuals for drop target. payload.Preview = was_accepted_previously; flags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that live for 1 frame) if (!(flags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect) && payload.Preview) window->DrawList->AddRect(r.Min - ImVec2(3.5f,3.5f), r.Max + ImVec2(3.5f, 3.5f), GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f); g.DragDropAcceptFrameCount = g.FrameCount; - payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting os window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased() + payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting OS window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased() if (!payload.Delivery && !(flags & ImGuiDragDropFlags_AcceptBeforeDelivery)) return NULL; + //IMGUI_DEBUG_LOG("AcceptDragDropPayload(): %08X: return payload\n", g.DragDropTargetId); return &payload; } +// FIXME-DRAGDROP: Settle on a proper default visuals for drop target. +void ImGui::RenderDragDropTargetRect(const ImRect& bb) +{ + GetWindowDrawList()->AddRect(bb.Min - ImVec2(3.5f, 3.5f), bb.Max + ImVec2(3.5f, 3.5f), GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f); +} + const ImGuiPayload* ImGui::GetDragDropPayload() { ImGuiContext& g = *GImGui; - return g.DragDropActive ? &g.DragDropPayload : NULL; + return (g.DragDropActive && g.DragDropPayload.DataFrameCount != -1) ? &g.DragDropPayload : NULL; } -// We don't really use/need this now, but added it for the sake of consistency and because we might need it later. void ImGui::EndDragDropTarget() { ImGuiContext& g = *GImGui; IM_ASSERT(g.DragDropActive); IM_ASSERT(g.DragDropWithinTarget); g.DragDropWithinTarget = false; + + // Clear drag and drop state payload right after delivery + if (g.DragDropPayload.Delivery) + ClearDragDrop(); } //----------------------------------------------------------------------------- @@ -11856,10 +12863,10 @@ void ImGui::LogButtons() #endif const bool log_to_file = Button("Log To File"); SameLine(); const bool log_to_clipboard = Button("Log To Clipboard"); SameLine(); - PushAllowKeyboardFocus(false); + PushTabStop(false); SetNextItemWidth(80.0f); SliderInt("Default Depth", &g.LogDepthToExpandDefault, 0, 9, NULL); - PopAllowKeyboardFocus(); + PopTabStop(); PopID(); // Start logging at the end of the function so that the buttons don't appear in the log @@ -11877,15 +12884,17 @@ void ImGui::LogButtons() //----------------------------------------------------------------------------- // - UpdateSettings() [Internal] // - MarkIniSettingsDirty() [Internal] -// - CreateNewWindowSettings() [Internal] -// - FindWindowSettings() [Internal] -// - FindOrCreateWindowSettings() [Internal] // - FindSettingsHandler() [Internal] // - ClearIniSettings() [Internal] // - LoadIniSettingsFromDisk() // - LoadIniSettingsFromMemory() // - SaveIniSettingsToDisk() // - SaveIniSettingsToMemory() +//----------------------------------------------------------------------------- +// - CreateNewWindowSettings() [Internal] +// - FindWindowSettingsByID() [Internal] +// - FindWindowSettingsByWindow() [Internal] +// - ClearWindowSettings() [Internal] // - WindowSettingsHandler_***() [Internal] //----------------------------------------------------------------------------- @@ -11932,44 +12941,6 @@ void ImGui::MarkIniSettingsDirty(ImGuiWindow* window) g.SettingsDirtyTimer = g.IO.IniSavingRate; } -ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name) -{ - ImGuiContext& g = *GImGui; - -#if !IMGUI_DEBUG_INI_SETTINGS - // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID() - // Preserve the full string when IMGUI_DEBUG_INI_SETTINGS is set to make .ini inspection easier. - if (const char* p = strstr(name, "###")) - name = p; -#endif - const size_t name_len = strlen(name); - - // Allocate chunk - const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1; - ImGuiWindowSettings* settings = g.SettingsWindows.alloc_chunk(chunk_size); - IM_PLACEMENT_NEW(settings) ImGuiWindowSettings(); - settings->ID = ImHashStr(name, name_len); - memcpy(settings->GetName(), name, name_len + 1); // Store with zero terminator - - return settings; -} - -ImGuiWindowSettings* ImGui::FindWindowSettings(ImGuiID id) -{ - ImGuiContext& g = *GImGui; - for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings)) - if (settings->ID == id) - return settings; - return NULL; -} - -ImGuiWindowSettings* ImGui::FindOrCreateWindowSettings(const char* name) -{ - if (ImGuiWindowSettings* settings = FindWindowSettings(ImHashStr(name))) - return settings; - return CreateNewWindowSettings(name); -} - void ImGui::AddSettingsHandler(const ImGuiSettingsHandler* handler) { ImGuiContext& g = *GImGui; @@ -11988,19 +12959,20 @@ ImGuiSettingsHandler* ImGui::FindSettingsHandler(const char* type_name) { ImGuiContext& g = *GImGui; const ImGuiID type_hash = ImHashStr(type_name); - for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++) - if (g.SettingsHandlers[handler_n].TypeHash == type_hash) - return &g.SettingsHandlers[handler_n]; + for (ImGuiSettingsHandler& handler : g.SettingsHandlers) + if (handler.TypeHash == type_hash) + return &handler; return NULL; } +// Clear all settings (windows, tables, docking etc.) void ImGui::ClearIniSettings() { ImGuiContext& g = *GImGui; g.SettingsIniData.clear(); - for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++) - if (g.SettingsHandlers[handler_n].ClearAllFn) - g.SettingsHandlers[handler_n].ClearAllFn(&g, &g.SettingsHandlers[handler_n]); + for (ImGuiSettingsHandler& handler : g.SettingsHandlers) + if (handler.ClearAllFn != NULL) + handler.ClearAllFn(&g, &handler); } void ImGui::LoadIniSettingsFromDisk(const char* ini_filename) @@ -12015,6 +12987,7 @@ void ImGui::LoadIniSettingsFromDisk(const char* ini_filename) } // Zero-tolerance, no error reporting, cheap .ini parsing +// Set ini_size==0 to let us use strlen(ini_data). Do not call this function with a 0 if your buffer is actually empty! void ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size) { ImGuiContext& g = *GImGui; @@ -12034,9 +13007,9 @@ void ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size) // Call pre-read handlers // Some types will clear their data (e.g. dock information) some types will allow merge/override (window) - for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++) - if (g.SettingsHandlers[handler_n].ReadInitFn) - g.SettingsHandlers[handler_n].ReadInitFn(&g, &g.SettingsHandlers[handler_n]); + for (ImGuiSettingsHandler& handler : g.SettingsHandlers) + if (handler.ReadInitFn != NULL) + handler.ReadInitFn(&g, &handler); void* entry_data = NULL; ImGuiSettingsHandler* entry_handler = NULL; @@ -12080,9 +13053,9 @@ void ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size) memcpy(buf, ini_data, ini_size); // Call post-read handlers - for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++) - if (g.SettingsHandlers[handler_n].ApplyAllFn) - g.SettingsHandlers[handler_n].ApplyAllFn(&g, &g.SettingsHandlers[handler_n]); + for (ImGuiSettingsHandler& handler : g.SettingsHandlers) + if (handler.ApplyAllFn != NULL) + handler.ApplyAllFn(&g, &handler); } void ImGui::SaveIniSettingsToDisk(const char* ini_filename) @@ -12108,29 +13081,86 @@ const char* ImGui::SaveIniSettingsToMemory(size_t* out_size) g.SettingsDirtyTimer = 0.0f; g.SettingsIniData.Buf.resize(0); g.SettingsIniData.Buf.push_back(0); - for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++) - { - ImGuiSettingsHandler* handler = &g.SettingsHandlers[handler_n]; - handler->WriteAllFn(&g, handler, &g.SettingsIniData); - } + for (ImGuiSettingsHandler& handler : g.SettingsHandlers) + handler.WriteAllFn(&g, &handler, &g.SettingsIniData); if (out_size) *out_size = (size_t)g.SettingsIniData.size(); return g.SettingsIniData.c_str(); } +ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name) +{ + ImGuiContext& g = *GImGui; + + if (g.IO.ConfigDebugIniSettings == false) + { + // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID() + // Preserve the full string when ConfigDebugVerboseIniSettings is set to make .ini inspection easier. + if (const char* p = strstr(name, "###")) + name = p; + } + const size_t name_len = strlen(name); + + // Allocate chunk + const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1; + ImGuiWindowSettings* settings = g.SettingsWindows.alloc_chunk(chunk_size); + IM_PLACEMENT_NEW(settings) ImGuiWindowSettings(); + settings->ID = ImHashStr(name, name_len); + memcpy(settings->GetName(), name, name_len + 1); // Store with zero terminator + + return settings; +} + +// We don't provide a FindWindowSettingsByName() because Docking system doesn't always hold on names. +// This is called once per window .ini entry + once per newly instantiated window. +ImGuiWindowSettings* ImGui::FindWindowSettingsByID(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings)) + if (settings->ID == id && !settings->WantDelete) + return settings; + return NULL; +} + +// This is faster if you are holding on a Window already as we don't need to perform a search. +ImGuiWindowSettings* ImGui::FindWindowSettingsByWindow(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + if (window->SettingsOffset != -1) + return g.SettingsWindows.ptr_from_offset(window->SettingsOffset); + return FindWindowSettingsByID(window->ID); +} + +// This will revert window to its initial state, including enabling the ImGuiCond_FirstUseEver/ImGuiCond_Once conditions once more. +void ImGui::ClearWindowSettings(const char* name) +{ + //IMGUI_DEBUG_LOG("ClearWindowSettings('%s')\n", name); + ImGuiWindow* window = FindWindowByName(name); + if (window != NULL) + { + window->Flags |= ImGuiWindowFlags_NoSavedSettings; + InitOrLoadWindowSettings(window, NULL); + } + if (ImGuiWindowSettings* settings = window ? FindWindowSettingsByWindow(window) : FindWindowSettingsByID(ImHashStr(name))) + settings->WantDelete = true; +} + static void WindowSettingsHandler_ClearAll(ImGuiContext* ctx, ImGuiSettingsHandler*) { ImGuiContext& g = *ctx; - for (int i = 0; i != g.Windows.Size; i++) - g.Windows[i]->SettingsOffset = -1; + for (ImGuiWindow* window : g.Windows) + window->SettingsOffset = -1; g.SettingsWindows.clear(); } static void* WindowSettingsHandler_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name) { - ImGuiWindowSettings* settings = ImGui::FindOrCreateWindowSettings(name); - ImGuiID id = settings->ID; - *settings = ImGuiWindowSettings(); // Clear existing if recycling previous entry + ImGuiID id = ImHashStr(name); + ImGuiWindowSettings* settings = ImGui::FindWindowSettingsByID(id); + if (settings) + *settings = ImGuiWindowSettings(); // Clear existing if recycling previous entry + else + settings = ImGui::CreateNewWindowSettings(name); settings->ID = id; settings->WantApply = true; return (void*)settings; @@ -12164,13 +13194,12 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl // Gather data from windows that were active during this session // (if a window wasn't opened in this session we preserve its settings) ImGuiContext& g = *ctx; - for (int i = 0; i != g.Windows.Size; i++) + for (ImGuiWindow* window : g.Windows) { - ImGuiWindow* window = g.Windows[i]; if (window->Flags & ImGuiWindowFlags_NoSavedSettings) continue; - ImGuiWindowSettings* settings = (window->SettingsOffset != -1) ? g.SettingsWindows.ptr_from_offset(window->SettingsOffset) : ImGui::FindWindowSettings(window->ID); + ImGuiWindowSettings* settings = ImGui::FindWindowSettingsByWindow(window); if (!settings) { settings = ImGui::CreateNewWindowSettings(window->Name); @@ -12181,12 +13210,15 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl settings->Size = ImVec2ih(window->SizeFull); settings->Collapsed = window->Collapsed; + settings->WantDelete = false; } // Write to text buffer buf->reserve(buf->size() + g.SettingsWindows.size() * 6); // ballpark reserve for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings)) { + if (settings->WantDelete) + continue; const char* settings_name = settings->GetName(); buf->appendf("[%s][%s]\n", handler->TypeName, settings_name); buf->appendf("Pos=%d,%d\n", settings->Pos.x, settings->Pos.y); @@ -12197,6 +13229,18 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl } +//----------------------------------------------------------------------------- +// [SECTION] LOCALIZATION +//----------------------------------------------------------------------------- + +void ImGui::LocalizeRegisterEntries(const ImGuiLocEntry* entries, int count) +{ + ImGuiContext& g = *GImGui; + for (int n = 0; n < count; n++) + g.LocalizationTable[entries[n].Key] = entries[n].Text; +} + + //----------------------------------------------------------------------------- // [SECTION] VIEWPORTS, PLATFORM WINDOWS //----------------------------------------------------------------------------- @@ -12230,10 +13274,8 @@ static void ImGui::UpdateViewportsNewFrame() main_viewport->Pos = ImVec2(0.0f, 0.0f); main_viewport->Size = g.IO.DisplaySize; - for (int n = 0; n < g.Viewports.Size; n++) + for (ImGuiViewportP* viewport : g.Viewports) { - ImGuiViewportP* viewport = g.Viewports[n]; - // Lock down space taken by menu bars and status bars, reset the offset for fucntions like BeginMainMenuBar() to alter them again. viewport->WorkOffsetMin = viewport->BuildWorkOffsetMin; viewport->WorkOffsetMax = viewport->BuildWorkOffsetMax; @@ -12262,9 +13304,9 @@ static void ImGui::UpdateViewportsNewFrame() // Win32 clipboard implementation // We use g.ClipboardHandlerData for temporary storage to ensure it is freed on Shutdown() -static const char* GetClipboardTextFn_DefaultImpl(void*) +static const char* GetClipboardTextFn_DefaultImpl(void* user_data_ctx) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *(ImGuiContext*)user_data_ctx; g.ClipboardHandlerData.clear(); if (!::OpenClipboard(NULL)) return NULL; @@ -12325,8 +13367,9 @@ static void SetClipboardTextFn_DefaultImpl(void*, const char* text) } } -static const char* GetClipboardTextFn_DefaultImpl(void*) +static const char* GetClipboardTextFn_DefaultImpl(void* user_data_ctx) { + ImGuiContext& g = *(ImGuiContext*)user_data_ctx; if (!main_clipboard) PasteboardCreate(kPasteboardClipboard, &main_clipboard); PasteboardSynchronize(main_clipboard); @@ -12344,7 +13387,6 @@ static const char* GetClipboardTextFn_DefaultImpl(void*) CFDataRef cf_data; if (PasteboardCopyItemFlavorData(main_clipboard, item_id, CFSTR("public.utf8-plain-text"), &cf_data) == noErr) { - ImGuiContext& g = *GImGui; g.ClipboardHandlerData.clear(); int length = (int)CFDataGetLength(cf_data); g.ClipboardHandlerData.resize(length + 1); @@ -12361,15 +13403,15 @@ static const char* GetClipboardTextFn_DefaultImpl(void*) #else // Local Dear ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers. -static const char* GetClipboardTextFn_DefaultImpl(void*) +static const char* GetClipboardTextFn_DefaultImpl(void* user_data_ctx) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *(ImGuiContext*)user_data_ctx; return g.ClipboardHandlerData.empty() ? NULL : g.ClipboardHandlerData.begin(); } -static void SetClipboardTextFn_DefaultImpl(void*, const char* text) +static void SetClipboardTextFn_DefaultImpl(void* user_data_ctx, const char* text) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *(ImGuiContext*)user_data_ctx; g.ClipboardHandlerData.clear(); const char* text_end = text + strlen(text); g.ClipboardHandlerData.resize((int)(text_end - text) + 1); @@ -12391,10 +13433,6 @@ static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport* viewport, ImGuiPlatf { // Notify OS Input Method Editor of text input position HWND hwnd = (HWND)viewport->PlatformHandleRaw; -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - if (hwnd == 0) - hwnd = (HWND)ImGui::GetIO().ImeWindowHandle; -#endif if (hwnd == 0) return; @@ -12455,9 +13493,8 @@ void ImGui::DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* ImVec2 off = bb.Min - viewport->Pos * scale; float alpha_mul = 1.0f; window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul * 0.40f)); - for (int i = 0; i != g.Windows.Size; i++) + for (ImGuiWindow* thumb_window : g.Windows) { - ImGuiWindow* thumb_window = g.Windows[i]; if (!thumb_window->WasActive || (thumb_window->Flags & ImGuiWindowFlags_ChildWindow)) continue; @@ -12484,24 +13521,72 @@ static void RenderViewportsThumbnails() // We don't display full monitor bounds (we could, but it often looks awkward), instead we display just enough to cover all of our viewports. float SCALE = 1.0f / 8.0f; ImRect bb_full(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX); - for (int n = 0; n < g.Viewports.Size; n++) - bb_full.Add(g.Viewports[n]->GetMainRect()); + for (ImGuiViewportP* viewport : g.Viewports) + bb_full.Add(viewport->GetMainRect()); ImVec2 p = window->DC.CursorPos; ImVec2 off = p - bb_full.Min * SCALE; - for (int n = 0; n < g.Viewports.Size; n++) + for (ImGuiViewportP* viewport : g.Viewports) { - ImGuiViewportP* viewport = g.Viewports[n]; ImRect viewport_draw_bb(off + (viewport->Pos) * SCALE, off + (viewport->Pos + viewport->Size) * SCALE); ImGui::DebugRenderViewportThumbnail(window->DrawList, viewport, viewport_draw_bb); } ImGui::Dummy(bb_full.GetSize() * SCALE); } +// Draw an arbitrary US keyboard layout to visualize translated keys +void ImGui::DebugRenderKeyboardPreview(ImDrawList* draw_list) +{ + const ImVec2 key_size = ImVec2(35.0f, 35.0f); + const float key_rounding = 3.0f; + const ImVec2 key_face_size = ImVec2(25.0f, 25.0f); + const ImVec2 key_face_pos = ImVec2(5.0f, 3.0f); + const float key_face_rounding = 2.0f; + const ImVec2 key_label_pos = ImVec2(7.0f, 4.0f); + const ImVec2 key_step = ImVec2(key_size.x - 1.0f, key_size.y - 1.0f); + const float key_row_offset = 9.0f; + + ImVec2 board_min = GetCursorScreenPos(); + ImVec2 board_max = ImVec2(board_min.x + 3 * key_step.x + 2 * key_row_offset + 10.0f, board_min.y + 3 * key_step.y + 10.0f); + ImVec2 start_pos = ImVec2(board_min.x + 5.0f - key_step.x, board_min.y); + + struct KeyLayoutData { int Row, Col; const char* Label; ImGuiKey Key; }; + const KeyLayoutData keys_to_display[] = + { + { 0, 0, "", ImGuiKey_Tab }, { 0, 1, "Q", ImGuiKey_Q }, { 0, 2, "W", ImGuiKey_W }, { 0, 3, "E", ImGuiKey_E }, { 0, 4, "R", ImGuiKey_R }, + { 1, 0, "", ImGuiKey_CapsLock }, { 1, 1, "A", ImGuiKey_A }, { 1, 2, "S", ImGuiKey_S }, { 1, 3, "D", ImGuiKey_D }, { 1, 4, "F", ImGuiKey_F }, + { 2, 0, "", ImGuiKey_LeftShift },{ 2, 1, "Z", ImGuiKey_Z }, { 2, 2, "X", ImGuiKey_X }, { 2, 3, "C", ImGuiKey_C }, { 2, 4, "V", ImGuiKey_V } + }; + + // Elements rendered manually via ImDrawList API are not clipped automatically. + // While not strictly necessary, here IsItemVisible() is used to avoid rendering these shapes when they are out of view. + Dummy(board_max - board_min); + if (!IsItemVisible()) + return; + draw_list->PushClipRect(board_min, board_max, true); + for (int n = 0; n < IM_ARRAYSIZE(keys_to_display); n++) + { + const KeyLayoutData* key_data = &keys_to_display[n]; + ImVec2 key_min = ImVec2(start_pos.x + key_data->Col * key_step.x + key_data->Row * key_row_offset, start_pos.y + key_data->Row * key_step.y); + ImVec2 key_max = key_min + key_size; + draw_list->AddRectFilled(key_min, key_max, IM_COL32(204, 204, 204, 255), key_rounding); + draw_list->AddRect(key_min, key_max, IM_COL32(24, 24, 24, 255), key_rounding); + ImVec2 face_min = ImVec2(key_min.x + key_face_pos.x, key_min.y + key_face_pos.y); + ImVec2 face_max = ImVec2(face_min.x + key_face_size.x, face_min.y + key_face_size.y); + draw_list->AddRect(face_min, face_max, IM_COL32(193, 193, 193, 255), key_face_rounding, ImDrawFlags_None, 2.0f); + draw_list->AddRectFilled(face_min, face_max, IM_COL32(252, 252, 252, 255), key_face_rounding); + ImVec2 label_min = ImVec2(key_min.x + key_label_pos.x, key_min.y + key_label_pos.y); + draw_list->AddText(label_min, IM_COL32(64, 64, 64, 255), key_data->Label); + if (IsKeyDown(key_data->Key)) + draw_list->AddRectFilled(key_min, key_max, IM_COL32(255, 0, 0, 128), key_rounding); + } + draw_list->PopClipRect(); +} + // Helper tool to diagnose between text encoding issues and font loading issues. Pass your UTF-8 string and verify that there are correct. void ImGui::DebugTextEncoding(const char* str) { Text("Text: \"%s\"", str); - if (!BeginTable("list", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit)) + if (!BeginTable("##DebugTextEncoding", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable)) return; TableSetupColumn("Offset"); TableSetupColumn("UTF-8"); @@ -12537,9 +13622,8 @@ void ImGui::DebugTextEncoding(const char* str) static void MetricsHelpMarker(const char* desc) { ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort)) + if (ImGui::BeginItemTooltip()) { - ImGui::BeginTooltip(); ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); ImGui::TextUnformatted(desc); ImGui::PopTextWrapPos(); @@ -12550,17 +13634,19 @@ static void MetricsHelpMarker(const char* desc) // [DEBUG] List fonts in a font atlas and display its texture void ImGui::ShowFontAtlas(ImFontAtlas* atlas) { - for (int i = 0; i < atlas->Fonts.Size; i++) + for (ImFont* font : atlas->Fonts) { - ImFont* font = atlas->Fonts[i]; PushID(font); DebugNodeFont(font); PopID(); } - if (TreeNode("Atlas texture", "Atlas texture (%dx%d pixels)", atlas->TexWidth, atlas->TexHeight)) + if (TreeNode("Font Atlas", "Font Atlas (%dx%d pixels)", atlas->TexWidth, atlas->TexHeight)) { - ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); - ImVec4 border_col = ImVec4(1.0f, 1.0f, 1.0f, 0.5f); + ImGuiContext& g = *GImGui; + ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; + Checkbox("Tint with Text Color", &cfg->ShowAtlasTintedWithTextColor); // Using text color ensure visibility of core atlas data, but will alter custom colored icons + ImVec4 tint_col = cfg->ShowAtlasTintedWithTextColor ? GetStyleColorVec4(ImGuiCol_Text) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f); + ImVec4 border_col = GetStyleColorVec4(ImGuiCol_Border); Image(atlas->TexID, ImVec2((float)atlas->TexWidth, (float)atlas->TexHeight), ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), tint_col, border_col); TreePop(); } @@ -12617,8 +13703,8 @@ void ImGui::ShowMetricsWindow(bool* p_open) else if (rect_type == TRT_ColumnsClipRect) { ImGuiTableColumn* c = &table->Columns[n]; return c->ClipRect; } else if (rect_type == TRT_ColumnsContentHeadersUsed){ ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersUsed, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight); } // Note: y1/y2 not always accurate else if (rect_type == TRT_ColumnsContentHeadersIdeal){ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersIdeal, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight); } - else if (rect_type == TRT_ColumnsContentFrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXFrozen, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight); } - else if (rect_type == TRT_ColumnsContentUnfrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight, c->ContentMaxXUnfrozen, table->InnerClipRect.Max.y); } + else if (rect_type == TRT_ColumnsContentFrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXFrozen, table->InnerClipRect.Min.y + table_instance->LastFrozenHeight); } + else if (rect_type == TRT_ColumnsContentUnfrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y + table_instance->LastFrozenHeight, c->ContentMaxXUnfrozen, table->InnerClipRect.Max.y); } IM_ASSERT(0); return ImRect(); } @@ -12630,7 +13716,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) else if (rect_type == WRT_InnerRect) { return window->InnerRect; } else if (rect_type == WRT_InnerClipRect) { return window->InnerClipRect; } else if (rect_type == WRT_WorkRect) { return window->WorkRect; } - else if (rect_type == WRT_Content) { ImVec2 min = window->InnerRect.Min - window->Scroll + window->WindowPadding; return ImRect(min, min + window->ContentSize); } + else if (rect_type == WRT_Content) { ImVec2 min = window->InnerRect.Min - window->Scroll + window->WindowPadding; return ImRect(min, min + window->ContentSize); } else if (rect_type == WRT_ContentIdeal) { ImVec2 min = window->InnerRect.Min - window->Scroll + window->WindowPadding; return ImRect(min, min + window->ContentSizeIdeal); } else if (rect_type == WRT_ContentRegionRect) { return window->ContentRegionRect; } IM_ASSERT(0); @@ -12732,6 +13818,10 @@ void ImGui::ShowMetricsWindow(bool* p_open) } } + Checkbox("Debug Begin/BeginChild return value", &io.ConfigDebugBeginReturnValueLoop); + SameLine(); + MetricsHelpMarker("Some calls to Begin()/BeginChild() will return false.\n\nWill cycle through window depths then repeat. Windows should be flickering while running."); + TreePop(); } @@ -12746,9 +13836,9 @@ void ImGui::ShowMetricsWindow(bool* p_open) // Here we display windows in their submitted order/hierarchy, however note that the Begin stack doesn't constitute a Parent<>Child relationship! ImVector& temp_buffer = g.WindowsTempSortBuffer; temp_buffer.resize(0); - for (int i = 0; i < g.Windows.Size; i++) - if (g.Windows[i]->LastFrameActive + 1 >= g.FrameCount) - temp_buffer.push_back(g.Windows[i]); + for (ImGuiWindow* window : g.Windows) + if (window->LastFrameActive + 1 >= g.FrameCount) + temp_buffer.push_back(window); struct Func { static int IMGUI_CDECL WindowComparerByBeginOrder(const void* lhs, const void* rhs) { return ((int)(*(const ImGuiWindow* const *)lhs)->BeginOrderWithinContext - (*(const ImGuiWindow* const*)rhs)->BeginOrderWithinContext); } }; ImQsort(temp_buffer.Data, (size_t)temp_buffer.Size, sizeof(ImGuiWindow*), Func::WindowComparerByBeginOrder); DebugNodeWindowsListByBeginStackParent(temp_buffer.Data, temp_buffer.Size, NULL); @@ -12760,19 +13850,15 @@ void ImGui::ShowMetricsWindow(bool* p_open) // DrawLists int drawlist_count = 0; - for (int viewport_i = 0; viewport_i < g.Viewports.Size; viewport_i++) - drawlist_count += g.Viewports[viewport_i]->DrawDataBuilder.GetDrawListCount(); + for (ImGuiViewportP* viewport : g.Viewports) + drawlist_count += viewport->DrawDataP.CmdLists.Size; if (TreeNode("DrawLists", "DrawLists (%d)", drawlist_count)) { Checkbox("Show ImDrawCmd mesh when hovering", &cfg->ShowDrawCmdMesh); Checkbox("Show ImDrawCmd bounding boxes when hovering", &cfg->ShowDrawCmdBoundingBoxes); - for (int viewport_i = 0; viewport_i < g.Viewports.Size; viewport_i++) - { - ImGuiViewportP* viewport = g.Viewports[viewport_i]; - for (int layer_i = 0; layer_i < IM_ARRAYSIZE(viewport->DrawDataBuilder.Layers); layer_i++) - for (int draw_list_i = 0; draw_list_i < viewport->DrawDataBuilder.Layers[layer_i].Size; draw_list_i++) - DebugNodeDrawList(NULL, viewport->DrawDataBuilder.Layers[layer_i][draw_list_i], "DrawList"); - } + for (ImGuiViewportP* viewport : g.Viewports) + for (ImDrawList* draw_list : viewport->DrawDataP.CmdLists) + DebugNodeDrawList(NULL, viewport, draw_list, "DrawList"); TreePop(); } @@ -12782,22 +13868,21 @@ void ImGui::ShowMetricsWindow(bool* p_open) Indent(GetTreeNodeToLabelSpacing()); RenderViewportsThumbnails(); Unindent(GetTreeNodeToLabelSpacing()); - for (int i = 0; i < g.Viewports.Size; i++) - DebugNodeViewport(g.Viewports[i]); + for (ImGuiViewportP* viewport : g.Viewports) + DebugNodeViewport(viewport); TreePop(); } // Details for Popups if (TreeNode("Popups", "Popups (%d)", g.OpenPopupStack.Size)) { - for (int i = 0; i < g.OpenPopupStack.Size; i++) + for (const ImGuiPopupData& popup_data : g.OpenPopupStack) { // As it's difficult to interact with tree nodes while popups are open, we display everything inline. - const ImGuiPopupData* popup_data = &g.OpenPopupStack[i]; - ImGuiWindow* window = popup_data->Window; + ImGuiWindow* window = popup_data.Window; BulletText("PopupID: %08x, Window: '%s' (%s%s), BackupNavWindow '%s', ParentWindow '%s'", - popup_data->PopupId, window ? window->Name : "NULL", window && (window->Flags & ImGuiWindowFlags_ChildWindow) ? "Child;" : "", window && (window->Flags & ImGuiWindowFlags_ChildMenu) ? "Menu;" : "", - popup_data->BackupNavWindow ? popup_data->BackupNavWindow->Name : "NULL", window && window->ParentWindow ? window->ParentWindow->Name : "NULL"); + popup_data.PopupId, window ? window->Name : "NULL", window && (window->Flags & ImGuiWindowFlags_ChildWindow) ? "Child;" : "", window && (window->Flags & ImGuiWindowFlags_ChildMenu) ? "Menu;" : "", + popup_data.BackupNavWindow ? popup_data.BackupNavWindow->Name : "NULL", window && window->ParentWindow ? window->ParentWindow->Name : "NULL"); } TreePop(); } @@ -12863,11 +13948,12 @@ void ImGui::ShowMetricsWindow(bool* p_open) Text("\"%s\"", g.IO.IniFilename); else TextUnformatted(""); + Checkbox("io.ConfigDebugIniSettings", &io.ConfigDebugIniSettings); Text("SettingsDirtyTimer %.2f", g.SettingsDirtyTimer); if (TreeNode("SettingsHandlers", "Settings handlers: (%d)", g.SettingsHandlers.Size)) { - for (int n = 0; n < g.SettingsHandlers.Size; n++) - BulletText("%s", g.SettingsHandlers[n].TypeName); + for (ImGuiSettingsHandler& handler : g.SettingsHandlers) + BulletText("\"%s\"", handler.TypeName); TreePop(); } if (TreeNode("SettingsWindows", "Settings packed data: Windows: %d bytes", g.SettingsWindows.size())) @@ -12895,7 +13981,100 @@ void ImGui::ShowMetricsWindow(bool* p_open) TreePop(); } - // Misc Details + if (TreeNode("Inputs")) + { + Text("KEYBOARD/GAMEPAD/MOUSE KEYS"); + { + // We iterate both legacy native range and named ImGuiKey ranges, which is a little odd but this allows displaying the data for old/new backends. + // User code should never have to go through such hoops! You can generally iterate between ImGuiKey_NamedKey_BEGIN and ImGuiKey_NamedKey_END. + Indent(); +#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO + struct funcs { static bool IsLegacyNativeDupe(ImGuiKey) { return false; } }; +#else + struct funcs { static bool IsLegacyNativeDupe(ImGuiKey key) { return key < 512 && GetIO().KeyMap[key] != -1; } }; // Hide Native<>ImGuiKey duplicates when both exists in the array + //Text("Legacy raw:"); for (ImGuiKey key = ImGuiKey_KeysData_OFFSET; key < ImGuiKey_COUNT; key++) { if (io.KeysDown[key]) { SameLine(); Text("\"%s\" %d", GetKeyName(key), key); } } +#endif + Text("Keys down:"); for (ImGuiKey key = ImGuiKey_KeysData_OFFSET; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key) || !IsKeyDown(key)) continue; SameLine(); Text(IsNamedKey(key) ? "\"%s\"" : "\"%s\" %d", GetKeyName(key), key); SameLine(); Text("(%.02f)", GetKeyData(key)->DownDuration); } + Text("Keys pressed:"); for (ImGuiKey key = ImGuiKey_KeysData_OFFSET; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key) || !IsKeyPressed(key)) continue; SameLine(); Text(IsNamedKey(key) ? "\"%s\"" : "\"%s\" %d", GetKeyName(key), key); } + Text("Keys released:"); for (ImGuiKey key = ImGuiKey_KeysData_OFFSET; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key) || !IsKeyReleased(key)) continue; SameLine(); Text(IsNamedKey(key) ? "\"%s\"" : "\"%s\" %d", GetKeyName(key), key); } + Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : ""); + Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; SameLine(); Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public. + DebugRenderKeyboardPreview(GetWindowDrawList()); + Unindent(); + } + + Text("MOUSE STATE"); + { + Indent(); + if (IsMousePosValid()) + Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y); + else + Text("Mouse pos: "); + Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y); + int count = IM_ARRAYSIZE(io.MouseDown); + Text("Mouse down:"); for (int i = 0; i < count; i++) if (IsMouseDown(i)) { SameLine(); Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); } + Text("Mouse clicked:"); for (int i = 0; i < count; i++) if (IsMouseClicked(i)) { SameLine(); Text("b%d (%d)", i, io.MouseClickedCount[i]); } + Text("Mouse released:"); for (int i = 0; i < count; i++) if (IsMouseReleased(i)) { SameLine(); Text("b%d", i); } + Text("Mouse wheel: %.1f", io.MouseWheel); + Text("MouseStationaryTimer: %.2f", g.MouseStationaryTimer); + Text("Mouse source: %s", GetMouseSourceName(io.MouseSource)); + Text("Pen Pressure: %.1f", io.PenPressure); // Note: currently unused + Unindent(); + } + + Text("MOUSE WHEELING"); + { + Indent(); + Text("WheelingWindow: '%s'", g.WheelingWindow ? g.WheelingWindow->Name : "NULL"); + Text("WheelingWindowReleaseTimer: %.2f", g.WheelingWindowReleaseTimer); + Text("WheelingAxisAvg[] = { %.3f, %.3f }, Main Axis: %s", g.WheelingAxisAvg.x, g.WheelingAxisAvg.y, (g.WheelingAxisAvg.x > g.WheelingAxisAvg.y) ? "X" : (g.WheelingAxisAvg.x < g.WheelingAxisAvg.y) ? "Y" : ""); + Unindent(); + } + + Text("KEY OWNERS"); + { + Indent(); + if (BeginListBox("##owners", ImVec2(-FLT_MIN, GetTextLineHeightWithSpacing() * 6))) + { + for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) + { + ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key); + if (owner_data->OwnerCurr == ImGuiKeyOwner_None) + continue; + Text("%s: 0x%08X%s", GetKeyName(key), owner_data->OwnerCurr, + owner_data->LockUntilRelease ? " LockUntilRelease" : owner_data->LockThisFrame ? " LockThisFrame" : ""); + DebugLocateItemOnHover(owner_data->OwnerCurr); + } + EndListBox(); + } + Unindent(); + } + Text("SHORTCUT ROUTING"); + { + Indent(); + if (BeginListBox("##routes", ImVec2(-FLT_MIN, GetTextLineHeightWithSpacing() * 6))) + { + for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) + { + ImGuiKeyRoutingTable* rt = &g.KeysRoutingTable; + for (ImGuiKeyRoutingIndex idx = rt->Index[key - ImGuiKey_NamedKey_BEGIN]; idx != -1; ) + { + char key_chord_name[64]; + ImGuiKeyRoutingData* routing_data = &rt->Entries[idx]; + GetKeyChordName(key | routing_data->Mods, key_chord_name, IM_ARRAYSIZE(key_chord_name)); + Text("%s: 0x%08X", key_chord_name, routing_data->RoutingCurr); + DebugLocateItemOnHover(routing_data->RoutingCurr); + idx = routing_data->NextEntryIndex; + } + } + EndListBox(); + } + Text("(ActiveIdUsing: AllKeyboardKeys: %d, NavDirMask: 0x%X)", g.ActiveIdUsingAllKeyboardKeys, g.ActiveIdUsingNavDirMask); + Unindent(); + } + TreePop(); + } + if (TreeNode("Internal state")) { Text("WINDOWING"); @@ -12909,24 +14088,23 @@ void ImGui::ShowMetricsWindow(bool* p_open) Text("ITEMS"); Indent(); Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, GetInputSourceName(g.ActiveIdSource)); + DebugLocateItemOnHover(g.ActiveId); Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL"); - - int active_id_using_key_input_count = 0; - for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_NamedKey_END; n++) - active_id_using_key_input_count += g.ActiveIdUsingKeyInputMask[n] ? 1 : 0; - Text("ActiveIdUsing: NavDirMask: %X, KeyInputMask: %d key(s)", g.ActiveIdUsingNavDirMask, active_id_using_key_input_count); + Text("ActiveIdUsing: AllKeyboardKeys: %d, NavDirMask: %X", g.ActiveIdUsingAllKeyboardKeys, g.ActiveIdUsingNavDirMask); Text("HoveredId: 0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Not displaying g.HoveredId as it is update mid-frame - Text("HoverDelayId: 0x%08X, Timer: %.2f, ClearTimer: %.2f", g.HoverDelayId, g.HoverDelayTimer, g.HoverDelayClearTimer); + Text("HoverItemDelayId: 0x%08X, Timer: %.2f, ClearTimer: %.2f", g.HoverItemDelayId, g.HoverItemDelayTimer, g.HoverItemDelayClearTimer); Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize); + DebugLocateItemOnHover(g.DragDropPayload.SourceId); Unindent(); Text("NAV,FOCUS"); Indent(); Text("NavWindow: '%s'", g.NavWindow ? g.NavWindow->Name : "NULL"); Text("NavId: 0x%08X, NavLayer: %d", g.NavId, g.NavLayer); + DebugLocateItemOnHover(g.NavId); Text("NavInputSource: %s", GetInputSourceName(g.NavInputSource)); Text("NavActive: %d, NavVisible: %d", g.IO.NavActive, g.IO.NavVisible); - Text("NavActivateId/DownId/PressedId/InputId: %08X/%08X/%08X/%08X", g.NavActivateId, g.NavActivateDownId, g.NavActivatePressedId, g.NavActivateInputId); + Text("NavActivateId/DownId/PressedId: %08X/%08X/%08X", g.NavActivateId, g.NavActivateDownId, g.NavActivatePressedId); Text("NavActivateFlags: %04X", g.NavActivateFlags); Text("NavDisableHighlight: %d, NavDisableMouseHover: %d", g.NavDisableHighlight, g.NavDisableMouseHover); Text("NavFocusScopeId = 0x%08X", g.NavFocusScopeId); @@ -12939,9 +14117,8 @@ void ImGui::ShowMetricsWindow(bool* p_open) // Overlay: Display windows Rectangles and Begin Order if (cfg->ShowWindowsRects || cfg->ShowWindowsBeginOrder) { - for (int n = 0; n < g.Windows.Size; n++) + for (ImGuiWindow* window : g.Windows) { - ImGuiWindow* window = g.Windows[n]; if (!window->WasActive) continue; ImDrawList* draw_list = GetForegroundDrawList(window); @@ -13004,15 +14181,16 @@ void ImGui::DebugNodeColumns(ImGuiOldColumns* columns) if (!TreeNode((void*)(uintptr_t)columns->ID, "Columns Id: 0x%08X, Count: %d, Flags: 0x%04X", columns->ID, columns->Count, columns->Flags)) return; BulletText("Width: %.1f (MinX: %.1f, MaxX: %.1f)", columns->OffMaxX - columns->OffMinX, columns->OffMinX, columns->OffMaxX); - for (int column_n = 0; column_n < columns->Columns.Size; column_n++) - BulletText("Column %02d: OffsetNorm %.3f (= %.1f px)", column_n, columns->Columns[column_n].OffsetNorm, GetColumnOffsetFromNorm(columns, columns->Columns[column_n].OffsetNorm)); + for (ImGuiOldColumnData& column : columns->Columns) + BulletText("Column %02d: OffsetNorm %.3f (= %.1f px)", (int)columns->Columns.index_from_ptr(&column), column.OffsetNorm, GetColumnOffsetFromNorm(columns, column.OffsetNorm)); TreePop(); } // [DEBUG] Display contents of ImDrawList -void ImGui::DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label) +void ImGui::DebugNodeDrawList(ImGuiWindow* window, ImGuiViewportP* viewport, const ImDrawList* draw_list, const char* label) { ImGuiContext& g = *GImGui; + IM_UNUSED(viewport); // Used in docking branch ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; int cmd_count = draw_list->CmdBuffer.Size; if (cmd_count > 0 && draw_list->CmdBuffer.back().ElemCount == 0 && draw_list->CmdBuffer.back().UserCallback == NULL) @@ -13210,9 +14388,8 @@ void ImGui::DebugNodeFont(ImFont* font) if (!glyph) continue; font->RenderChar(draw_list, cell_size, cell_p1, glyph_col, (ImWchar)(base + n)); - if (IsMouseHoveringRect(cell_p1, cell_p2)) + if (IsMouseHoveringRect(cell_p1, cell_p2) && BeginTooltip()) { - BeginTooltip(); DebugNodeFontGlyph(font, glyph); EndTooltip(); } @@ -13240,11 +14417,8 @@ void ImGui::DebugNodeStorage(ImGuiStorage* storage, const char* label) { if (!TreeNode(label, "%s: %d entries, %d bytes", label, storage->Data.Size, storage->Data.size_in_bytes())) return; - for (int n = 0; n < storage->Data.Size; n++) - { - const ImGuiStorage::ImGuiStoragePair& p = storage->Data[n]; + for (const ImGuiStorage::ImGuiStoragePair& p : storage->Data) BulletText("Key 0x%08X Value { i: %d }", p.key, p.val_i); // Important: we currently don't store a type, real value may not be integer. - } TreePop(); } @@ -13256,13 +14430,11 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label) char* p = buf; const char* buf_end = buf + IM_ARRAYSIZE(buf); const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2); - p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*"); - p += ImFormatString(p, buf_end - p, " { "); + p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s {", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*"); for (int tab_n = 0; tab_n < ImMin(tab_bar->Tabs.Size, 3); tab_n++) { ImGuiTabItem* tab = &tab_bar->Tabs[tab_n]; - p += ImFormatString(p, buf_end - p, "%s'%s'", - tab_n > 0 ? ", " : "", (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "???"); + p += ImFormatString(p, buf_end - p, "%s'%s'", tab_n > 0 ? ", " : "", TabBarGetTabName(tab_bar, tab)); } p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } "); if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); } @@ -13279,12 +14451,12 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label) { for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++) { - const ImGuiTabItem* tab = &tab_bar->Tabs[tab_n]; + ImGuiTabItem* tab = &tab_bar->Tabs[tab_n]; PushID(tab); if (SmallButton("<")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2); if (SmallButton(">")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine(); Text("%02d%c Tab 0x%08X '%s' Offset: %.2f, Width: %.2f/%.2f", - tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "???", tab->Offset, tab->Width, tab->ContentWidth); + tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, TabBarGetTabName(tab_bar, tab), tab->Offset, tab->Width, tab->ContentWidth); PopID(); } TreePop(); @@ -13304,9 +14476,8 @@ void ImGui::DebugNodeViewport(ImGuiViewportP* viewport) (flags & ImGuiViewportFlags_IsPlatformWindow) ? " IsPlatformWindow" : "", (flags & ImGuiViewportFlags_IsPlatformMonitor) ? " IsPlatformMonitor" : "", (flags & ImGuiViewportFlags_OwnedByApp) ? " OwnedByApp" : ""); - for (int layer_i = 0; layer_i < IM_ARRAYSIZE(viewport->DrawDataBuilder.Layers); layer_i++) - for (int draw_list_i = 0; draw_list_i < viewport->DrawDataBuilder.Layers[layer_i].Size; draw_list_i++) - DebugNodeDrawList(NULL, viewport->DrawDataBuilder.Layers[layer_i][draw_list_i], "DrawList"); + for (ImDrawList* draw_list : viewport->DrawDataP.CmdLists) + DebugNodeDrawList(NULL, viewport, draw_list, "DrawList"); TreePop(); } } @@ -13334,7 +14505,7 @@ void ImGui::DebugNodeWindow(ImGuiWindow* window, const char* label) TextDisabled("Note: some memory buffers have been compacted/freed."); ImGuiWindowFlags flags = window->Flags; - DebugNodeDrawList(window, window->DrawList, "DrawList"); + DebugNodeDrawList(window, window->Viewport, window->DrawList, "DrawList"); BulletText("Pos: (%.1f,%.1f), Size: (%.1f,%.1f), ContentSize (%.1f,%.1f) Ideal (%.1f,%.1f)", window->Pos.x, window->Pos.y, window->Size.x, window->Size.y, window->ContentSize.x, window->ContentSize.y, window->ContentSizeIdeal.x, window->ContentSizeIdeal.y); BulletText("Flags: 0x%08X (%s%s%s%s%s%s%s%s%s..)", flags, (flags & ImGuiWindowFlags_ChildWindow) ? "Child " : "", (flags & ImGuiWindowFlags_Tooltip) ? "Tooltip " : "", (flags & ImGuiWindowFlags_Popup) ? "Popup " : "", @@ -13347,22 +14518,22 @@ void ImGui::DebugNodeWindow(ImGuiWindow* window, const char* label) { ImRect r = window->NavRectRel[layer]; if (r.Min.x >= r.Max.y && r.Min.y >= r.Max.y) - { BulletText("NavLastIds[%d]: 0x%08X", layer, window->NavLastIds[layer]); - continue; - } - BulletText("NavLastIds[%d]: 0x%08X at +(%.1f,%.1f)(%.1f,%.1f)", layer, window->NavLastIds[layer], r.Min.x, r.Min.y, r.Max.x, r.Max.y); - if (IsItemHovered()) - GetForegroundDrawList(window)->AddRect(r.Min + window->Pos, r.Max + window->Pos, IM_COL32(255, 255, 0, 255)); + else + BulletText("NavLastIds[%d]: 0x%08X at +(%.1f,%.1f)(%.1f,%.1f)", layer, window->NavLastIds[layer], r.Min.x, r.Min.y, r.Max.x, r.Max.y); + DebugLocateItemOnHover(window->NavLastIds[layer]); } + const ImVec2* pr = window->NavPreferredScoringPosRel; + for (int layer = 0; layer < ImGuiNavLayer_COUNT; layer++) + BulletText("NavPreferredScoringPosRel[%d] = {%.1f,%.1f)", layer, (pr[layer].x == FLT_MAX ? -99999.0f : pr[layer].x), (pr[layer].y == FLT_MAX ? -99999.0f : pr[layer].y)); // Display as 99999.0f so it looks neater. BulletText("NavLayersActiveMask: %X, NavLastChildNavWindow: %s", window->DC.NavLayersActiveMask, window->NavLastChildNavWindow ? window->NavLastChildNavWindow->Name : "NULL"); if (window->RootWindow != window) { DebugNodeWindow(window->RootWindow, "RootWindow"); } if (window->ParentWindow != NULL) { DebugNodeWindow(window->ParentWindow, "ParentWindow"); } if (window->DC.ChildWindows.Size > 0) { DebugNodeWindowsList(&window->DC.ChildWindows, "ChildWindows"); } if (window->ColumnsStorage.Size > 0 && TreeNode("Columns", "Columns sets (%d)", window->ColumnsStorage.Size)) { - for (int n = 0; n < window->ColumnsStorage.Size; n++) - DebugNodeColumns(&window->ColumnsStorage[n]); + for (ImGuiOldColumns& columns : window->ColumnsStorage) + DebugNodeColumns(&columns); TreePop(); } DebugNodeStorage(&window->StateStorage, "Storage"); @@ -13371,8 +14542,12 @@ void ImGui::DebugNodeWindow(ImGuiWindow* window, const char* label) void ImGui::DebugNodeWindowSettings(ImGuiWindowSettings* settings) { + if (settings->WantDelete) + BeginDisabled(); Text("0x%08X \"%s\" Pos (%d,%d) Size (%d,%d) Collapsed=%d", settings->ID, settings->GetName(), settings->Pos.x, settings->Pos.y, settings->Size.x, settings->Size.y, settings->Collapsed); + if (settings->WantDelete) + EndDisabled(); } void ImGui::DebugNodeWindowsList(ImVector* windows, const char* label) @@ -13407,7 +14582,7 @@ void ImGui::DebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows, int wi } //----------------------------------------------------------------------------- -// [SECTION] DEBUG LOG +// [SECTION] DEBUG LOG WINDOW //----------------------------------------------------------------------------- void ImGui::DebugLog(const char* fmt, ...) @@ -13426,6 +14601,7 @@ void ImGui::DebugLogV(const char* fmt, va_list args) g.DebugLogBuf.appendfv(fmt, args); if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY) IMGUI_DEBUG_PRINTF("%s", g.DebugLogBuf.begin() + old_size); + g.DebugLogIndex.append(g.DebugLogBuf.c_str(), old_size, g.DebugLogBuf.size()); } void ImGui::ShowDebugLogWindow(bool* p_open) @@ -13439,23 +14615,48 @@ void ImGui::ShowDebugLogWindow(bool* p_open) return; } - AlignTextToFramePadding(); - Text("Log events:"); - SameLine(); CheckboxFlags("All", &g.DebugLogFlags, ImGuiDebugLogFlags_EventMask_); + CheckboxFlags("All", &g.DebugLogFlags, ImGuiDebugLogFlags_EventMask_); SameLine(); CheckboxFlags("ActiveId", &g.DebugLogFlags, ImGuiDebugLogFlags_EventActiveId); SameLine(); CheckboxFlags("Focus", &g.DebugLogFlags, ImGuiDebugLogFlags_EventFocus); SameLine(); CheckboxFlags("Popup", &g.DebugLogFlags, ImGuiDebugLogFlags_EventPopup); SameLine(); CheckboxFlags("Nav", &g.DebugLogFlags, ImGuiDebugLogFlags_EventNav); - SameLine(); CheckboxFlags("Clipper", &g.DebugLogFlags, ImGuiDebugLogFlags_EventClipper); + SameLine(); if (CheckboxFlags("Clipper", &g.DebugLogFlags, ImGuiDebugLogFlags_EventClipper)) { g.DebugLogClipperAutoDisableFrames = 2; } if (IsItemHovered()) SetTooltip("Clipper log auto-disabled after 2 frames"); + //SameLine(); CheckboxFlags("Selection", &g.DebugLogFlags, ImGuiDebugLogFlags_EventSelection); SameLine(); CheckboxFlags("IO", &g.DebugLogFlags, ImGuiDebugLogFlags_EventIO); if (SmallButton("Clear")) + { g.DebugLogBuf.clear(); + g.DebugLogIndex.clear(); + } SameLine(); if (SmallButton("Copy")) SetClipboardText(g.DebugLogBuf.c_str()); BeginChild("##log", ImVec2(0.0f, 0.0f), true, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar); - TextUnformatted(g.DebugLogBuf.begin(), g.DebugLogBuf.end()); // FIXME-OPT: Could use a line index, but TextUnformatted() has a semi-decent fast path for large text. + + ImGuiListClipper clipper; + clipper.Begin(g.DebugLogIndex.size()); + while (clipper.Step()) + for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++) + { + const char* line_begin = g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no); + const char* line_end = g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no); + TextUnformatted(line_begin, line_end); + ImRect text_rect = g.LastItemData.Rect; + if (IsItemHovered()) + for (const char* p = line_begin; p <= line_end - 10; p++) + { + ImGuiID id = 0; + if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1) + continue; + ImVec2 p0 = CalcTextSize(line_begin, p); + ImVec2 p1 = CalcTextSize(p, p + 10); + g.LastItemData.Rect = ImRect(text_rect.Min + ImVec2(p0.x, 0.0f), text_rect.Min + ImVec2(p0.x + p1.x, p1.y)); + if (IsMouseHoveringRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, true)) + DebugLocateItemOnHover(id); + p += 10; + } + } if (GetScrollY() >= GetScrollMaxY()) SetScrollHereY(1.0f); EndChild(); @@ -13467,6 +14668,70 @@ void ImGui::ShowDebugLogWindow(bool* p_open) // [SECTION] OTHER DEBUG TOOLS (ITEM PICKER, STACK TOOL) //----------------------------------------------------------------------------- +// Draw a small cross at current CursorPos in current window's DrawList +void ImGui::DebugDrawCursorPos(ImU32 col) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + ImVec2 pos = window->DC.CursorPos; + window->DrawList->AddLine(ImVec2(pos.x, pos.y - 3.0f), ImVec2(pos.x, pos.y + 4.0f), col, 1.0f); + window->DrawList->AddLine(ImVec2(pos.x - 3.0f, pos.y), ImVec2(pos.x + 4.0f, pos.y), col, 1.0f); +} + +// Draw a 10px wide rectangle around CurposPos.x using Line Y1/Y2 in current window's DrawList +void ImGui::DebugDrawLineExtents(ImU32 col) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + float curr_x = window->DC.CursorPos.x; + float line_y1 = (window->DC.IsSameLine ? window->DC.CursorPosPrevLine.y : window->DC.CursorPos.y); + float line_y2 = line_y1 + (window->DC.IsSameLine ? window->DC.PrevLineSize.y : window->DC.CurrLineSize.y); + window->DrawList->AddLine(ImVec2(curr_x - 5.0f, line_y1), ImVec2(curr_x + 5.0f, line_y1), col, 1.0f); + window->DrawList->AddLine(ImVec2(curr_x - 0.5f, line_y1), ImVec2(curr_x - 0.5f, line_y2), col, 1.0f); + window->DrawList->AddLine(ImVec2(curr_x - 5.0f, line_y2), ImVec2(curr_x + 5.0f, line_y2), col, 1.0f); +} + +// Draw last item rect in ForegroundDrawList (so it is always visible) +void ImGui::DebugDrawItemRect(ImU32 col) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); +} + +// [DEBUG] Locate item position/rectangle given an ID. +static const ImU32 DEBUG_LOCATE_ITEM_COLOR = IM_COL32(0, 255, 0, 255); // Green + +void ImGui::DebugLocateItem(ImGuiID target_id) +{ + ImGuiContext& g = *GImGui; + g.DebugLocateId = target_id; + g.DebugLocateFrames = 2; +} + +void ImGui::DebugLocateItemOnHover(ImGuiID target_id) +{ + if (target_id == 0 || !IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenBlockedByPopup)) + return; + ImGuiContext& g = *GImGui; + DebugLocateItem(target_id); + GetForegroundDrawList(g.CurrentWindow)->AddRect(g.LastItemData.Rect.Min - ImVec2(3.0f, 3.0f), g.LastItemData.Rect.Max + ImVec2(3.0f, 3.0f), DEBUG_LOCATE_ITEM_COLOR); +} + +void ImGui::DebugLocateItemResolveWithLastItem() +{ + ImGuiContext& g = *GImGui; + ImGuiLastItemData item_data = g.LastItemData; + g.DebugLocateId = 0; + ImDrawList* draw_list = GetForegroundDrawList(g.CurrentWindow); + ImRect r = item_data.Rect; + r.Expand(3.0f); + ImVec2 p1 = g.IO.MousePos; + ImVec2 p2 = ImVec2((p1.x < r.Min.x) ? r.Min.x : (p1.x > r.Max.x) ? r.Max.x : p1.x, (p1.y < r.Min.y) ? r.Min.y : (p1.y > r.Max.y) ? r.Max.y : p1.y); + draw_list->AddRect(r.Min, r.Max, DEBUG_LOCATE_ITEM_COLOR); + draw_list->AddLine(p1, p2, DEBUG_LOCATE_ITEM_COLOR); +} + // [DEBUG] Item picker tool - start with DebugStartItemPicker() - useful to visually select an item and break into its call-stack. void ImGui::UpdateDebugToolItemPicker() { @@ -13489,7 +14754,8 @@ void ImGui::UpdateDebugToolItemPicker() if (change_mapping && IsMouseClicked(mouse_button)) g.DebugItemPickerMouseButton = (ImU8)mouse_button; SetNextWindowBgAlpha(0.70f); - BeginTooltip(); + if (!BeginTooltip()) + return; Text("HoveredId: 0x%08X", hovered_id); Text("Press ESC to abort picking."); const char* mouse_button_names[] = { "Left", "Right", "Middle" }; @@ -13687,7 +14953,7 @@ void ImGui::ShowStackToolWindow(bool* p_open) void ImGui::ShowMetricsWindow(bool*) {} void ImGui::ShowFontAtlas(ImFontAtlas*) {} void ImGui::DebugNodeColumns(ImGuiOldColumns*) {} -void ImGui::DebugNodeDrawList(ImGuiWindow*, const ImDrawList*, const char*) {} +void ImGui::DebugNodeDrawList(ImGuiWindow*, ImGuiViewportP*, const ImDrawList*, const char*) {} void ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList*, const ImDrawList*, const ImDrawCmd*, bool, bool) {} void ImGui::DebugNodeFont(ImFont*) {} void ImGui::DebugNodeStorage(ImGuiStorage*, const char*) {} diff --git a/bgfx/3rdparty/dear-imgui/imgui.h b/bgfx/3rdparty/dear-imgui/imgui.h index 917e208c..c7f53448 100644 --- a/bgfx/3rdparty/dear-imgui/imgui.h +++ b/bgfx/3rdparty/dear-imgui/imgui.h @@ -1,29 +1,32 @@ -// dear imgui, v1.89 WIP +// dear imgui, v1.89.9 // (headers) // Help: -// - Read FAQ at http://dearimgui.org/faq +// - Read FAQ at http://dearimgui.com/faq // - Newcomers, read 'Programmer guide' in imgui.cpp for notes on how to setup Dear ImGui in your codebase. // - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications in examples/ are doing that. // Read imgui.cpp for details, links and comments. // Resources: -// - FAQ http://dearimgui.org/faq -// - Homepage & latest https://github.com/ocornut/imgui +// - FAQ http://dearimgui.com/faq +// - Homepage https://github.com/ocornut/imgui // - Releases & changelog https://github.com/ocornut/imgui/releases -// - Gallery https://github.com/ocornut/imgui/issues/5243 (please post your screenshots/video there!) +// - Gallery https://github.com/ocornut/imgui/issues/6478 (please post your screenshots/video there!) // - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there) +// - Getting Started https://github.com/ocornut/imgui/wiki/Getting-Started // - Glossary https://github.com/ocornut/imgui/wiki/Glossary // - Issues & support https://github.com/ocornut/imgui/issues +// - Tests & Automation https://github.com/ocornut/imgui_test_engine // Getting Started? -// - For first-time users having issues compiling/linking/running or issues loading fonts: +// - Read https://github.com/ocornut/imgui/wiki/Getting-Started +// - For first-time users having issues compiling/linking/running/loading fonts: // please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above. // Library Version -// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345') -#define IMGUI_VERSION "1.89 WIP" -#define IMGUI_VERSION_NUM 18829 +// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') +#define IMGUI_VERSION "1.89.9" +#define IMGUI_VERSION_NUM 18990 #define IMGUI_HAS_TABLE /* @@ -37,7 +40,7 @@ Index of this file: // [SECTION] ImGuiStyle // [SECTION] ImGuiIO // [SECTION] Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiPayload, ImGuiTableSortSpecs, ImGuiTableColumnSortSpecs) -// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor) +// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, Math Operators, ImColor) // [SECTION] Drawing API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawFlags, ImDrawListFlags, ImDrawList, ImDrawData) // [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont) // [SECTION] Viewports (ImGuiViewportFlags, ImGuiViewport) @@ -115,10 +118,13 @@ Index of this file: #endif #if defined(__clang__) #pragma clang diagnostic push +#if __has_warning("-Wunknown-warning-option") +#pragma clang diagnostic ignored "-Wunknown-warning-option" // warning: unknown warning group 'xxx' +#endif +#pragma clang diagnostic ignored "-Wunknown-pragmas" // warning: unknown warning group 'xxx' #pragma clang diagnostic ignored "-Wold-style-cast" -#if __has_warning("-Wzero-as-null-pointer-constant") #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" -#endif +#pragma clang diagnostic ignored "-Wreserved-identifier" // warning: identifier '_Xxx' is reserved because it starts with '_' followed by a capital letter #elif defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind @@ -167,12 +173,13 @@ struct ImGuiViewport; // A Platform Window (always only one in 'ma // In Visual Studio IDE: CTRL+comma ("Edit.GoToAll") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments. enum ImGuiKey : int; // -> enum ImGuiKey // Enum: A key identifier (ImGuiKey_XXX or ImGuiMod_XXX value) +enum ImGuiMouseSource : int; // -> enum ImGuiMouseSource // Enum; A mouse input source identifier (Mouse, TouchScreen, Pen) typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle) -typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier +typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor shape typedef int ImGuiSortDirection; // -> enum ImGuiSortDirection_ // Enum: A sorting direction (ascending or descending) typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A color target for TableSetBgColor() @@ -255,8 +262,8 @@ struct ImVec2 float x, y; constexpr ImVec2() : x(0.0f), y(0.0f) { } constexpr ImVec2(float _x, float _y) : x(_x), y(_y) { } - float operator[] (size_t idx) const { IM_ASSERT(idx <= 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine. - float& operator[] (size_t idx) { IM_ASSERT(idx <= 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine. + float& operator[] (size_t idx) { IM_ASSERT(idx == 0 || idx == 1); return ((float*)(void*)(char*)this)[idx]; } // We very rarely use this [] operator, so the assert overhead is fine. + float operator[] (size_t idx) const { IM_ASSERT(idx == 0 || idx == 1); return ((const float*)(const void*)(const char*)this)[idx]; } #ifdef IM_VEC2_CLASS_EXTRA IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2. #endif @@ -349,8 +356,8 @@ namespace ImGui IMGUI_API bool IsWindowFocused(ImGuiFocusedFlags flags=0); // is current window focused? or its root/child, depending on flags. see flags for options. IMGUI_API bool IsWindowHovered(ImGuiHoveredFlags flags=0); // is current window hovered (and typically: not blocked by a popup/modal)? see flags for options. NB: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that! Please read the FAQ! IMGUI_API ImDrawList* GetWindowDrawList(); // get draw list associated to the current window, to append your own drawing primitives - IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (useful if you want to do your own drawing via the DrawList API) - IMGUI_API ImVec2 GetWindowSize(); // get current window size + IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (note: it is unlikely you need to use this. Consider using current layout pos instead, GetScreenCursorPos()) + IMGUI_API ImVec2 GetWindowSize(); // get current window size (note: it is unlikely you need to use this. Consider using GetScreenCursorPos() and e.g. GetContentRegionAvail() instead) IMGUI_API float GetWindowWidth(); // get current window width (shortcut for GetWindowSize().x) IMGUI_API float GetWindowHeight(); // get current window height (shortcut for GetWindowSize().y) @@ -362,6 +369,7 @@ namespace ImGui IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before Begin() IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // set next window collapsed state. call before Begin() IMGUI_API void SetNextWindowFocus(); // set next window to be focused / top-most. call before Begin() + IMGUI_API void SetNextWindowScroll(const ImVec2& scroll); // set next window scrolling value (use < 0.0f to not affect a given axis). IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily override the Alpha component of ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground. IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects. IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0, 0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects. @@ -382,6 +390,8 @@ namespace ImGui IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be overridden with SetNextWindowContentSize(), in window coordinates // Windows Scrolling + // - Any change of Scroll will be applied at the beginning of next frame in the first call to Begin(). + // - You may instead use SetNextWindowScroll() prior to calling Begin() to avoid this delay, as an alternative to using SetScrollX()/SetScrollY(). IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()] IMGUI_API float GetScrollY(); // get scrolling amount [0 .. GetScrollMaxY()] IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0 .. GetScrollMaxX()] @@ -402,8 +412,8 @@ namespace ImGui IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val); // modify a style float variable. always use this if you modify the style after NewFrame(). IMGUI_API void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val); // modify a style ImVec2 variable. always use this if you modify the style after NewFrame(). IMGUI_API void PopStyleVar(int count = 1); - IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus); // == tab stop enable. Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets - IMGUI_API void PopAllowKeyboardFocus(); + IMGUI_API void PushTabStop(bool tab_stop); // == tab stop enable. Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets + IMGUI_API void PopTabStop(); IMGUI_API void PushButtonRepeat(bool repeat); // in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame. IMGUI_API void PopButtonRepeat(); @@ -416,7 +426,7 @@ namespace ImGui IMGUI_API void PopTextWrapPos(); // Style read access - // - Use the style editor (ShowStyleEditor() function) to interactively see what the colors are) + // - Use the ShowStyleEditor() function to interactively see/edit the colors. IMGUI_API ImFont* GetFont(); // get current font IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API @@ -457,7 +467,7 @@ namespace ImGui IMGUI_API float GetFrameHeightWithSpacing(); // ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets) // ID stack/scopes - // Read the FAQ (docs/FAQ.md or http://dearimgui.org/faq) for more details about how ID are handled in dear imgui. + // Read the FAQ (docs/FAQ.md or http://dearimgui.com/faq) for more details about how ID are handled in dear imgui. // - Those questions are answered and impacted by understanding of the ID stack system: // - "Q: Why is my widget not reacting when I click on it?" // - "Q: How can I have widgets with an empty label?" @@ -490,6 +500,7 @@ namespace ImGui IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args) IM_FMTLIST(2); IMGUI_API void BulletText(const char* fmt, ...) IM_FMTARGS(1); // shortcut for Bullet()+Text() IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1); + IMGUI_API void SeparatorText(const char* label); // currently: formatted text with an horizontal line // Widgets: Main // - Most widgets return true when the value has been changed or when pressed/selected @@ -511,7 +522,7 @@ namespace ImGui IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0)); IMGUI_API bool ImageButton(const char* str_id, ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1)); - // Widgets: Combo Box + // Widgets: Combo Box (Dropdown) // - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items. // - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created. IMGUI_API bool BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags = 0); @@ -660,12 +671,21 @@ namespace ImGui IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL // Tooltips - // - Tooltip are windows following the mouse. They do not take focus away. - IMGUI_API void BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of items). - IMGUI_API void EndTooltip(); - IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip, typically use with ImGui::IsItemHovered(). override any previous call to SetTooltip(). + // - Tooltips are windows following the mouse. They do not take focus away. + // - A tooltip window can contain items of any types. SetTooltip() is a shortcut for the 'if (BeginTooltip()) { Text(...); EndTooltip(); }' idiom. + IMGUI_API bool BeginTooltip(); // begin/append a tooltip window. + IMGUI_API void EndTooltip(); // only call EndTooltip() if BeginTooltip()/BeginItemTooltip() returns true! + IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip. Often used after a ImGui::IsItemHovered() check. Override any previous call to SetTooltip(). IMGUI_API void SetTooltipV(const char* fmt, va_list args) IM_FMTLIST(1); + // Tooltips: helpers for showing a tooltip when hovering an item + // - BeginItemTooltip() is a shortcut for the 'if (IsItemHovered(ImGuiHoveredFlags_Tooltip) && BeginTooltip())' idiom. + // - SetItemTooltip() is a shortcut for the 'if (IsItemHovered(ImGuiHoveredFlags_Tooltip)) { SetTooltip(...); }' idiom. + // - Where 'ImGuiHoveredFlags_Tooltip' itself is a shortcut to use 'style.HoverFlagsForTooltipMouse' or 'style.HoverFlagsForTooltipNav' depending on active input type. For mouse it defaults to 'ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort'. + IMGUI_API bool BeginItemTooltip(); // begin/append a tooltip window if preceding item was hovered. + IMGUI_API void SetItemTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip if preceeding item was hovered. override any previous call to SetTooltip(). + IMGUI_API void SetItemTooltipV(const char* fmt, va_list args) IM_FMTLIST(1); + // Popups, Modals // - They block normal mouse hovering detection (and therefore most mouse interactions) behind them. // - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. @@ -779,6 +799,7 @@ namespace ImGui IMGUI_API int GetColumnsCount(); // Tab Bars, Tabs + // - Note: Tabs are automatically created by the docking system (when in 'docking' branch). Use this to create tab bars/tabs yourself. IMGUI_API bool BeginTabBar(const char* str_id, ImGuiTabBarFlags flags = 0); // create and append into a TabBar IMGUI_API void EndTabBar(); // only call EndTabBar() if BeginTabBar() returns true! IMGUI_API bool BeginTabItem(const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0); // create a Tab. Returns true if the Tab is selected. @@ -826,6 +847,9 @@ namespace ImGui IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. + // Overlapping mode + IMGUI_API void SetNextItemAllowOverlap(); // allow next item to be overlapped by a subsequent item. Useful with invisible buttons, selectable, treenode covering an area where subsequent items may need to be added. Note that both Selectable() and TreeNode() have dedicated flags doing this. + // Item/Widgets Utilities and Query Functions // - Most of the functions are referring to the previous Item that has been submitted. // - See Demo Window under "Widgets->Querying Status" for an interactive visualization of most of those functions. @@ -842,10 +866,10 @@ namespace ImGui IMGUI_API bool IsAnyItemHovered(); // is any item hovered? IMGUI_API bool IsAnyItemActive(); // is any item active? IMGUI_API bool IsAnyItemFocused(); // is any item focused? + IMGUI_API ImGuiID GetItemID(); // get ID of last item (~~ often same ImGui::GetID(label) beforehand) IMGUI_API ImVec2 GetItemRectMin(); // get upper-left bounding rectangle of the last item (screen space) IMGUI_API ImVec2 GetItemRectMax(); // get lower-right bounding rectangle of the last item (screen space) IMGUI_API ImVec2 GetItemRectSize(); // get size of last item - IMGUI_API void SetItemAllowOverlap(); // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area. // Viewports // - Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows. @@ -878,12 +902,11 @@ namespace ImGui IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v); IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b); - // Inputs Utilities: Keyboard - // Without IMGUI_DISABLE_OBSOLETE_KEYIO: (legacy support) - // - For 'ImGuiKey key' you can still use your legacy native/user indices according to how your backend/engine stored them in io.KeysDown[]. - // With IMGUI_DISABLE_OBSOLETE_KEYIO: (this is the way forward) - // - Any use of 'ImGuiKey' will assert when key < 512 will be passed, previously reserved as native/user keys indices - // - GetKeyIndex() is pass-through and therefore deprecated (gone if IMGUI_DISABLE_OBSOLETE_KEYIO is defined) + // Inputs Utilities: Keyboard/Mouse/Gamepad + // - the ImGuiKey enum contains all possible keyboard, mouse and gamepad inputs (e.g. ImGuiKey_A, ImGuiKey_MouseLeft, ImGuiKey_GamepadDpadUp...). + // - before v1.87, we used ImGuiKey to carry native/user indices as defined by each backends. About use of those legacy ImGuiKey values: + // - without IMGUI_DISABLE_OBSOLETE_KEYIO (legacy support): you can still use your legacy native/user indices (< 512) according to how your backend/engine stored them in io.KeysDown[], but need to cast them to ImGuiKey. + // - with IMGUI_DISABLE_OBSOLETE_KEYIO (this is the way forward): any use of ImGuiKey will assert with key < 512. GetKeyIndex() is pass-through and therefore deprecated (gone if IMGUI_DISABLE_OBSOLETE_KEYIO is defined). IMGUI_API bool IsKeyDown(ImGuiKey key); // is key being held. IMGUI_API bool IsKeyPressed(ImGuiKey key, bool repeat = true); // was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate IMGUI_API bool IsKeyReleased(ImGuiKey key); // was key released (went from Down to !Down)? @@ -891,7 +914,7 @@ namespace ImGui IMGUI_API const char* GetKeyName(ImGuiKey key); // [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared. IMGUI_API void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard); // Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call. - // Inputs Utilities: Mouse + // Inputs Utilities: Mouse specific // - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right. // - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle. // - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold') @@ -908,8 +931,8 @@ namespace ImGui IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_threshold = -1.0f); // is mouse dragging? (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold) IMGUI_API ImVec2 GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold) IMGUI_API void ResetMouseDragDelta(ImGuiMouseButton button = 0); // - IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you - IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired cursor type + IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired mouse cursor shape. Important: reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you + IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired mouse cursor shape IMGUI_API void SetNextFrameWantCaptureMouse(bool want_capture_mouse); // Override io.WantCaptureMouse flag next frame (said flag is left for your application to handle, typical when true it instucts your app to ignore inputs). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse;" after the next NewFrame() call. // Clipboard Utilities @@ -1008,12 +1031,10 @@ enum ImGuiInputTextFlags_ ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input) ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this) ImGuiInputTextFlags_CallbackEdit = 1 << 19, // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active) - ImGuiInputTextFlags_EscapeClearsAll = 1 << 20, // Escape key clears content if not empty, and deactivate otherwise (constrast to default behavior of Escape to revert) + ImGuiInputTextFlags_EscapeClearsAll = 1 << 20, // Escape key clears content if not empty, and deactivate otherwise (contrast to default behavior of Escape to revert) - // Obsolete names (will be removed soon) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior -#endif + // Obsolete names + //ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior }; // Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*() @@ -1022,20 +1043,24 @@ enum ImGuiTreeNodeFlags_ ImGuiTreeNodeFlags_None = 0, ImGuiTreeNodeFlags_Selected = 1 << 0, // Draw as selected ImGuiTreeNodeFlags_Framed = 1 << 1, // Draw frame with background (e.g. for CollapsingHeader) - ImGuiTreeNodeFlags_AllowItemOverlap = 1 << 2, // Hit testing to allow subsequent widgets to overlap this one + ImGuiTreeNodeFlags_AllowOverlap = 1 << 2, // Hit testing to allow subsequent widgets to overlap this one ImGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3, // Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack ImGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4, // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes) ImGuiTreeNodeFlags_DefaultOpen = 1 << 5, // Default node to be open ImGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6, // Need double-click to open node ImGuiTreeNodeFlags_OpenOnArrow = 1 << 7, // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. ImGuiTreeNodeFlags_Leaf = 1 << 8, // No collapsing, no arrow (use as a convenience for leaf nodes). - ImGuiTreeNodeFlags_Bullet = 1 << 9, // Display a bullet instead of arrow + ImGuiTreeNodeFlags_Bullet = 1 << 9, // Display a bullet instead of arrow. IMPORTANT: node can still be marked open/close if you don't set the _Leaf flag! ImGuiTreeNodeFlags_FramePadding = 1 << 10, // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding(). ImGuiTreeNodeFlags_SpanAvailWidth = 1 << 11, // Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line. In the future we may refactor the hit system to be front-to-back, allowing natural overlaps and then this can become the default. ImGuiTreeNodeFlags_SpanFullWidth = 1 << 12, // Extend hit box to the left-most and right-most edges (bypass the indented area). ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13, // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop) //ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 14, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog, + +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + ImGuiTreeNodeFlags_AllowItemOverlap = ImGuiTreeNodeFlags_AllowOverlap, // Renamed in 1.89.7 +#endif }; // Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions. @@ -1069,7 +1094,11 @@ enum ImGuiSelectableFlags_ ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Selectable frame can span all columns (text will still fit in current column) ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, // Generate press events on double clicks too ImGuiSelectableFlags_Disabled = 1 << 3, // Cannot be selected, display grayed out text - ImGuiSelectableFlags_AllowItemOverlap = 1 << 4, // (WIP) Hit testing to allow subsequent widgets to overlap this one + ImGuiSelectableFlags_AllowOverlap = 1 << 4, // (WIP) Hit testing to allow subsequent widgets to overlap this one + +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + ImGuiSelectableFlags_AllowItemOverlap = ImGuiSelectableFlags_AllowOverlap, // Renamed in 1.89.7 +#endif }; // Flags for ImGui::BeginCombo() @@ -1186,12 +1215,6 @@ enum ImGuiTableFlags_ // [Internal] Combinations and masks ImGuiTableFlags_SizingMask_ = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_SizingStretchSame, - - // Obsolete names (will be removed soon) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - //, ImGuiTableFlags_ColumnsWidthFixed = ImGuiTableFlags_SizingFixedFit, ImGuiTableFlags_ColumnsWidthStretch = ImGuiTableFlags_SizingStretchSame // WIP Tables 2020/12 - //, ImGuiTableFlags_SizingPolicyFixed = ImGuiTableFlags_SizingFixedFit, ImGuiTableFlags_SizingPolicyStretch = ImGuiTableFlags_SizingStretchSame // WIP Tables 2021/01 -#endif }; // Flags for ImGui::TableSetupColumn() @@ -1229,11 +1252,6 @@ enum ImGuiTableColumnFlags_ ImGuiTableColumnFlags_IndentMask_ = ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_IndentDisable, ImGuiTableColumnFlags_StatusMask_ = ImGuiTableColumnFlags_IsEnabled | ImGuiTableColumnFlags_IsVisible | ImGuiTableColumnFlags_IsSorted | ImGuiTableColumnFlags_IsHovered, ImGuiTableColumnFlags_NoDirectResize_ = 1 << 30, // [Internal] Disable user resizing this column directly (it may however we resized indirectly from its left edge) - - // Obsolete names (will be removed soon) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - //ImGuiTableColumnFlags_WidthAuto = ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoResize, // Column will not stretch and keep resizing based on submitted contents. -#endif }; // Flags for ImGui::TableNextRow() @@ -1286,16 +1304,30 @@ enum ImGuiHoveredFlags_ ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 5, // Return true even if a popup window is normally blocking access to this item/window //ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 6, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet. ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 7, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. - ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 8, // IsItemHovered() only: Return true even if the position is obstructed or overlapped by another window - ImGuiHoveredFlags_AllowWhenDisabled = 1 << 9, // IsItemHovered() only: Return true even if the item is disabled - ImGuiHoveredFlags_NoNavOverride = 1 << 10, // Disable using gamepad/keyboard navigation state when active, always query mouse. + ImGuiHoveredFlags_AllowWhenOverlappedByItem = 1 << 8, // IsItemHovered() only: Return true even if the item uses AllowOverlap mode and is overlapped by another hoverable item. + ImGuiHoveredFlags_AllowWhenOverlappedByWindow = 1 << 9, // IsItemHovered() only: Return true even if the position is obstructed or overlapped by another window. + ImGuiHoveredFlags_AllowWhenDisabled = 1 << 10, // IsItemHovered() only: Return true even if the item is disabled + ImGuiHoveredFlags_NoNavOverride = 1 << 11, // IsItemHovered() only: Disable using gamepad/keyboard navigation state when active, always query mouse + ImGuiHoveredFlags_AllowWhenOverlapped = ImGuiHoveredFlags_AllowWhenOverlappedByItem | ImGuiHoveredFlags_AllowWhenOverlappedByWindow, ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped, ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows, - // Hovering delays (for tooltips) - ImGuiHoveredFlags_DelayNormal = 1 << 11, // Return true after io.HoverDelayNormal elapsed (~0.30 sec) - ImGuiHoveredFlags_DelayShort = 1 << 12, // Return true after io.HoverDelayShort elapsed (~0.10 sec) - ImGuiHoveredFlags_NoSharedDelay = 1 << 13, // Disable shared delay system where moving from one item to the next keeps the previous timer for a short time (standard for tooltips with long delays) + // Tooltips mode + // - typically used in IsItemHovered() + SetTooltip() sequence. + // - this is a shortcut to pull flags from 'style.HoverFlagsForTooltipMouse' or 'style.HoverFlagsForTooltipNav' where you can reconfigure desired behavior. + // e.g. 'TooltipHoveredFlagsForMouse' defaults to 'ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort'. + // - for frequently actioned or hovered items providing a tooltip, you want may to use ImGuiHoveredFlags_ForTooltip (stationary + delay) so the tooltip doesn't show too often. + // - for items which main purpose is to be hovered, or items with low affordance, or in less consistent apps, prefer no delay or shorter delay. + ImGuiHoveredFlags_ForTooltip = 1 << 12, // Shortcut for standard flags when using IsItemHovered() + SetTooltip() sequence. + + // (Advanced) Mouse Hovering delays. + // - generally you can use ImGuiHoveredFlags_ForTooltip to use application-standardized flags. + // - use those if you need specific overrides. + ImGuiHoveredFlags_Stationary = 1 << 13, // Require mouse to be stationary for style.HoverStationaryDelay (~0.15 sec) _at least one time_. After this, can move on same item/window. Using the stationary test tends to reduces the need for a long delay. + ImGuiHoveredFlags_DelayNone = 1 << 14, // IsItemHovered() only: Return true immediately (default). As this is the default you generally ignore this. + ImGuiHoveredFlags_DelayShort = 1 << 15, // IsItemHovered() only: Return true after style.HoverDelayShort elapsed (~0.15 sec) (shared between items) + requires mouse to be stationary for style.HoverStationaryDelay (once per item). + ImGuiHoveredFlags_DelayNormal = 1 << 16, // IsItemHovered() only: Return true after style.HoverDelayNormal elapsed (~0.40 sec) (shared between items) + requires mouse to be stationary for style.HoverStationaryDelay (once per item). + ImGuiHoveredFlags_NoSharedDelay = 1 << 17, // IsItemHovered() only: Disable shared delay system where moving from one item to the next keeps the previous timer for a short time (standard for tooltips with long delays) }; // Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload() @@ -1303,7 +1335,7 @@ enum ImGuiDragDropFlags_ { ImGuiDragDropFlags_None = 0, // BeginDragDropSource() flags - ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disables this behavior. + ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // Disable preview tooltip. By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disables this behavior. ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disables this behavior so you can still call IsItemHovered() on the source item. ImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2, // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item. ImGuiDragDropFlags_SourceAllowNullID = 1 << 3, // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit. @@ -1355,8 +1387,11 @@ enum ImGuiSortDirection_ ImGuiSortDirection_Descending = 2 // Descending = 9->0, Z->A etc. }; -// Keys value 0 to 511 are left unused as legacy native/opaque key values (< 1.87) -// Keys value >= 512 are named keys (>= 1.87) +// A key identifier (ImGuiKey_XXX or ImGuiMod_XXX value): can represent Keyboard, Mouse and Gamepad values. +// All our named keys are >= 512. Keys value 0 to 511 are left unused as legacy native/opaque key values (< 1.87). +// Since >= 1.89 we increased typing (went from int to enum), some legacy code may need a cast to ImGuiKey. +// Read details about the 1.87 and 1.89 transition : https://github.com/ocornut/imgui/issues/4921 +// Note that "Keys" related to physical keys and are not the same concept as input "Characters", the later are submitted via io.AddInputCharacter(). enum ImGuiKey : int { // Keyboard @@ -1411,8 +1446,8 @@ enum ImGuiKey : int ImGuiKey_KeypadEnter, ImGuiKey_KeypadEqual, - // Gamepad (some of those are analog values, 0.0f to 1.0f) // GAME NAVIGATION ACTION - // (download controller mapping PNG/PSD at http://dearimgui.org/controls_sheets) + // Gamepad (some of those are analog values, 0.0f to 1.0f) // NAVIGATION ACTION + // (download controller mapping PNG/PSD at http://dearimgui.com/controls_sheets) ImGuiKey_GamepadStart, // Menu (Xbox) + (Switch) Start/Options (PS) ImGuiKey_GamepadBack, // View (Xbox) - (Switch) Share (PS) ImGuiKey_GamepadFaceLeft, // X (Xbox) Y (Switch) Square (PS) // Tap: Toggle Menu. Hold: Windowing mode (Focus/Move/Resize windows) @@ -1438,7 +1473,7 @@ enum ImGuiKey : int ImGuiKey_GamepadRStickUp, // [Analog] ImGuiKey_GamepadRStickDown, // [Analog] - // Mouse Buttons (auto-submitted from AddMouseButtonEvent() calls) + // Aliases: Mouse Buttons (auto-submitted from AddMouseButtonEvent() calls) // - This is mirroring the data also written to io.MouseDown[], io.MouseWheel, in a format allowing them to be accessed via standard key API. ImGuiKey_MouseLeft, ImGuiKey_MouseRight, ImGuiKey_MouseMiddle, ImGuiKey_MouseX1, ImGuiKey_MouseX2, ImGuiKey_MouseWheelX, ImGuiKey_MouseWheelY, @@ -1455,28 +1490,25 @@ enum ImGuiKey : int // In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and // backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user... ImGuiMod_None = 0, - ImGuiMod_Ctrl = 1 << 12, - ImGuiMod_Shift = 1 << 13, + ImGuiMod_Ctrl = 1 << 12, // Ctrl + ImGuiMod_Shift = 1 << 13, // Shift ImGuiMod_Alt = 1 << 14, // Option/Menu ImGuiMod_Super = 1 << 15, // Cmd/Super/Windows - ImGuiMod_Mask_ = 0xF000, -#if defined(__APPLE__) - ImGuiMod_Shortcut = ImGuiMod_Super, -#else - ImGuiMod_Shortcut = ImGuiMod_Ctrl, -#endif + ImGuiMod_Shortcut = 1 << 11, // Alias for Ctrl (non-macOS) _or_ Super (macOS). + ImGuiMod_Mask_ = 0xF800, // 5-bits // [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + the io.KeyMap[] array. // We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE) + // If you need to iterate all keys (for e.g. an input mapper) you may use ImGuiKey_NamedKey_BEGIN..ImGuiKey_NamedKey_END. ImGuiKey_NamedKey_BEGIN = 512, ImGuiKey_NamedKey_END = ImGuiKey_COUNT, ImGuiKey_NamedKey_COUNT = ImGuiKey_NamedKey_END - ImGuiKey_NamedKey_BEGIN, #ifdef IMGUI_DISABLE_OBSOLETE_KEYIO - ImGuiKey_KeysData_SIZE = ImGuiKey_NamedKey_COUNT, // Size of KeysData[]: only hold named keys - ImGuiKey_KeysData_OFFSET = ImGuiKey_NamedKey_BEGIN, // First key stored in io.KeysData[0]. Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET). + ImGuiKey_KeysData_SIZE = ImGuiKey_NamedKey_COUNT, // Size of KeysData[]: only hold named keys + ImGuiKey_KeysData_OFFSET = ImGuiKey_NamedKey_BEGIN, // Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET) index. #else - ImGuiKey_KeysData_SIZE = ImGuiKey_COUNT, // Size of KeysData[]: hold legacy 0..512 keycodes + named keys - ImGuiKey_KeysData_OFFSET = 0, // First key stored in io.KeysData[0]. Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET). + ImGuiKey_KeysData_SIZE = ImGuiKey_COUNT, // Size of KeysData[]: hold legacy 0..512 keycodes + named keys + ImGuiKey_KeysData_OFFSET = 0, // Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET) index. #endif #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS @@ -1501,7 +1533,7 @@ enum ImGuiNavInput enum ImGuiConfigFlags_ { ImGuiConfigFlags_None = 0, - ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. + ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. Enable full Tabbing + directional arrows + space/enter to activate. ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. Backend also needs to set ImGuiBackendFlags_HasGamepad. ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your backend, otherwise ImGui will react as if the mouse is jumping around back and forth. ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set. @@ -1617,6 +1649,9 @@ enum ImGuiStyleVar_ ImGuiStyleVar_TabRounding, // float TabRounding ImGuiStyleVar_ButtonTextAlign, // ImVec2 ButtonTextAlign ImGuiStyleVar_SelectableTextAlign, // ImVec2 SelectableTextAlign + ImGuiStyleVar_SeparatorTextBorderSize,// float SeparatorTextBorderSize + ImGuiStyleVar_SeparatorTextAlign, // ImVec2 SeparatorTextAlign + ImGuiStyleVar_SeparatorTextPadding,// ImVec2 SeparatorTextPadding ImGuiStyleVar_COUNT }; @@ -1673,8 +1708,8 @@ enum ImGuiColorEditFlags_ ImGuiColorEditFlags_PickerMask_ = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar, ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV, - // Obsolete names (will be removed) - // ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex // [renamed in 1.69] + // Obsolete names + //ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex // [renamed in 1.69] }; // Flags for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc. @@ -1689,10 +1724,8 @@ enum ImGuiSliderFlags_ ImGuiSliderFlags_NoInput = 1 << 7, // Disable CTRL+Click or Enter key allowing to input text directly into the widget ImGuiSliderFlags_InvalidMask_ = 0x7000000F, // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed. - // Obsolete names (will be removed) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp, // [renamed in 1.79] -#endif + // Obsolete names + //ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp, // [renamed in 1.79] }; // Identify a mouse button. @@ -1722,6 +1755,18 @@ enum ImGuiMouseCursor_ ImGuiMouseCursor_COUNT }; +// Enumeration for AddMouseSourceEvent() actual source of Mouse Input data. +// Historically we use "Mouse" terminology everywhere to indicate pointer data, e.g. MousePos, IsMousePressed(), io.AddMousePosEvent() +// But that "Mouse" data can come from different source which occasionally may be useful for application to know about. +// You can submit a change of pointer type using io.AddMouseSourceEvent(). +enum ImGuiMouseSource : int +{ + ImGuiMouseSource_Mouse = 0, // Input is coming from an actual mouse. + ImGuiMouseSource_TouchScreen, // Input is coming from a touch screen (no hovering prior to initial press, less precise initial press aiming, dual-axis wheeling possible). + ImGuiMouseSource_Pen, // Input is coming from a pressure/magnetic pen (often used in conjunction with high-sampling rates). + ImGuiMouseSource_COUNT +}; + // Enumeration for ImGui::SetWindow***(), SetNextWindow***(), SetNextItem***() functions // Represent a condition. // Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ImGuiCond_Always. @@ -1856,7 +1901,7 @@ struct ImGuiStyle float FrameBorderSize; // Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines. ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label). - ImVec2 CellPadding; // Padding within a table cell + ImVec2 CellPadding; // Padding within a table cell. CellPadding.y may be altered between different rows. ImVec2 TouchExtraPadding; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! float IndentSpacing; // Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). float ColumnsMinSpacing; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). @@ -1871,6 +1916,9 @@ struct ImGuiStyle ImGuiDir ColorButtonPosition; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered). ImVec2 SelectableTextAlign; // Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line. + float SeparatorTextBorderSize; // Thickkness of border in SeparatorText() + ImVec2 SeparatorTextAlign; // Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center). + ImVec2 SeparatorTextPadding; // Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y. ImVec2 DisplayWindowPadding; // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows. ImVec2 DisplaySafeAreaPadding; // If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly! float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. @@ -1881,6 +1929,14 @@ struct ImGuiStyle float CircleTessellationMaxError; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. ImVec4 Colors[ImGuiCol_COUNT]; + // Behaviors + // (It is possible to modify those fields mid-frame if specific behavior need it, unlike e.g. configuration fields in ImGuiIO) + float HoverStationaryDelay; // Delay for IsItemHovered(ImGuiHoveredFlags_Stationary). Time required to consider mouse stationary. + float HoverDelayShort; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayShort). Usually used along with HoverStationaryDelay. + float HoverDelayNormal; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayNormal). " + ImGuiHoveredFlags HoverFlagsForTooltipMouse;// Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using mouse. + ImGuiHoveredFlags HoverFlagsForTooltipNav; // Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using keyboard/gamepad. + IMGUI_API ImGuiStyle(); IMGUI_API void ScaleAllSizes(float scale_factor); }; @@ -1915,14 +1971,7 @@ struct ImGuiIO float IniSavingRate; // = 5.0f // Minimum time between saving positions/sizes to .ini file, in seconds. const char* IniFilename; // = "imgui.ini" // Path to .ini file (important: default "imgui.ini" is relative to current working dir!). Set NULL to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions. const char* LogFilename; // = "imgui_log.txt"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified). - float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds. - float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels. - float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging. - float KeyRepeatDelay; // = 0.275f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). - float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds. - float HoverDelayNormal; // = 0.30 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayNormal) returns true. - float HoverDelayShort; // = 0.10 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayShort) returns true. - void* UserData; // = NULL // Store your own data for retrieval by callbacks. + void* UserData; // = NULL // Store your own data. ImFontAtlas*Fonts; // // Font atlas: load, rasterize and pack one or more fonts into a single texture. float FontGlobalScale; // = 1.0f // Global scale all fonts @@ -1941,6 +1990,33 @@ struct ImGuiIO bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar. float ConfigMemoryCompactTimer; // = 60.0f // Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1.0f to disable. + // Inputs Behaviors + // (other variables, ones which are expected to be tweaked within UI code, are exposed in ImGuiStyle) + float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds. + float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels. + float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging. + float KeyRepeatDelay; // = 0.275f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). + float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds. + + //------------------------------------------------------------------ + // Debug options + //------------------------------------------------------------------ + + // Tools to test correct Begin/End and BeginChild/EndChild behaviors. + // Presently Begin()/End() and BeginChild()/EndChild() needs to ALWAYS be called in tandem, regardless of return value of BeginXXX() + // This is inconsistent with other BeginXXX functions and create confusion for many users. + // We expect to update the API eventually. In the meanwhile we provide tools to facilitate checking user-code behavior. + bool ConfigDebugBeginReturnValueOnce;// = false // First-time calls to Begin()/BeginChild() will return false. NEEDS TO BE SET AT APPLICATION BOOT TIME if you don't want to miss windows. + bool ConfigDebugBeginReturnValueLoop;// = false // Some calls to Begin()/BeginChild() will return false. Will cycle through window depths then repeat. Suggested use: add "io.ConfigDebugBeginReturnValue = io.KeyShift" in your main loop then occasionally press SHIFT. Windows should be flickering while running. + + // Option to deactivate io.AddFocusEvent(false) handling. May facilitate interactions with a debugger when focus loss leads to clearing inputs data. + // Backends may have other side-effects on focus loss, so this will reduce side-effects but not necessary remove all of them. + // Consider using e.g. Win32's IsDebuggerPresent() as an additional filter (or see ImOsIsDebuggerPresent() in imgui_test_engine/imgui_te_utils.cpp for a Unix compatible version). + bool ConfigDebugIgnoreFocusLoss; // = false // Ignore io.AddFocusEvent(false), consequently not calling io.ClearInputKeys() in input processing. + + // Options to audit .ini data + bool ConfigDebugIniSettings; // = false // Save .ini data with extra comments (particularly helpful for Docking, but makes saving slower) + //------------------------------------------------------------------ // Platform Functions // (the imgui_impl_xxxx backend files are setting those up for you) @@ -1968,6 +2044,9 @@ struct ImGuiIO void* _UnusedPadding; // Unused field to keep data structure the same size. #endif + // Optional: Platform locale + ImWchar PlatformLocaleDecimalPoint; // '.' // [Experimental] Configure decimal point e.g. '.' or ',' useful for some languages (e.g. German), generally pulled from *localeconv()->decimal_point + //------------------------------------------------------------------ // Input - Call before calling NewFrame() //------------------------------------------------------------------ @@ -1977,7 +2056,8 @@ struct ImGuiIO IMGUI_API void AddKeyAnalogEvent(ImGuiKey key, bool down, float v); // Queue a new key down/up event for analog values (e.g. ImGuiKey_Gamepad_ values). Dead-zones should be handled by the backend. IMGUI_API void AddMousePosEvent(float x, float y); // Queue a mouse position update. Use -FLT_MAX,-FLT_MAX to signify no mouse (e.g. app not focused and not hovered) IMGUI_API void AddMouseButtonEvent(int button, bool down); // Queue a mouse button change - IMGUI_API void AddMouseWheelEvent(float wh_x, float wh_y); // Queue a mouse wheel update + IMGUI_API void AddMouseWheelEvent(float wheel_x, float wheel_y); // Queue a mouse wheel update. wheel_y<0: scroll down, wheel_y>0: scroll up, wheel_x<0: scroll right, wheel_x>0: scroll left. + IMGUI_API void AddMouseSourceEvent(ImGuiMouseSource source); // Queue a mouse source change (Mouse/TouchScreen/Pen) IMGUI_API void AddFocusEvent(bool focused); // Queue a gain/loss of focus for the application (generally based on OS/platform focus of your window) IMGUI_API void AddInputCharacter(unsigned int c); // Queue a new character input IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue a new character input from a UTF-16 character, it can be a surrogate @@ -1985,8 +2065,11 @@ struct ImGuiIO IMGUI_API void SetKeyEventNativeData(ImGuiKey key, int native_keycode, int native_scancode, int native_legacy_index = -1); // [Optional] Specify index for legacy <1.87 IsKeyXXX() functions with native indices + specify native keycode, scancode. IMGUI_API void SetAppAcceptingEvents(bool accepting_events); // Set master flag for accepting key/mouse/text events (default to true). Useful if you have native dialog boxes that are interrupting your application loop/refresh, and you want to disable events being queued while your app is frozen. - IMGUI_API void ClearInputCharacters(); // [Internal] Clear the text input buffer manually - IMGUI_API void ClearInputKeys(); // [Internal] Release all keys + IMGUI_API void ClearEventsQueue(); // Clear all incoming events. + IMGUI_API void ClearInputKeys(); // Clear current keyboard/mouse/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons. +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + IMGUI_API void ClearInputCharacters(); // [Obsolete] Clear the current frame text input buffer. Now included within ClearInputKeys(). +#endif //------------------------------------------------------------------ // Output - Updated by NewFrame() or EndFrame()/Render() @@ -2011,6 +2094,7 @@ struct ImGuiIO // Legacy: before 1.87, we required backend to fill io.KeyMap[] (imgui->native map) during initialization and io.KeysDown[] (native indices) every frame. // This is still temporarily supported as a legacy feature. However the new preferred scheme is for backend to call io.AddKeyEvent(). + // Old (<1.87): ImGui::IsKeyPressed(ImGui::GetIO().KeyMap[ImGuiKey_Space]) --> New (1.87+) ImGui::IsKeyPressed(ImGuiKey_Space) #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO int KeyMap[ImGuiKey_COUNT]; // [LEGACY] Input: map of indices into the KeysDown[512] entries array which represent your "native" keyboard state. The first 512 are now unused and should be kept zero. Legacy backend will write into KeyMap[] using ImGuiKey_ indices which are always >512. bool KeysDown[ImGuiKey_COUNT]; // [LEGACY] Input: Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys). This used to be [512] sized. It is now ImGuiKey_COUNT to allow legacy io.KeysDown[GetKeyIndex(...)] to work without an overflow. @@ -2021,20 +2105,23 @@ struct ImGuiIO // [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed! //------------------------------------------------------------------ + ImGuiContext* Ctx; // Parent UI context (needs to be set explicitly by parent). + // Main Input State // (this block used to be written by backend, since 1.87 it is best to NOT write to those directly, call the AddXXX functions above instead) // (reading from those variables is fair game, as they are extremely unlikely to be moving anywhere) ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. Other buttons allow us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. - float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text. - float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with a horizontal wheel, may not be filled by all backends. + float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text. >0 scrolls Up, <0 scrolls Down. Hold SHIFT to turn vertical scroll into horizontal scroll. + float MouseWheelH; // Mouse wheel Horizontal. >0 scrolls Left, <0 scrolls Right. Most users don't have a mouse with a horizontal wheel, may not be filled by all backends. + ImGuiMouseSource MouseSource; // Mouse actual input peripheral (Mouse/TouchScreen/Pen). bool KeyCtrl; // Keyboard modifier down: Control bool KeyShift; // Keyboard modifier down: Shift bool KeyAlt; // Keyboard modifier down: Alt bool KeySuper; // Keyboard modifier down: Cmd/Super/Windows // Other state maintained from data above + IO function calls - ImGuiKeyChord KeyMods; // Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags). Read-only, updated by NewFrame() + ImGuiKeyChord KeyMods; // Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags. DOES NOT CONTAINS ImGuiMod_Shortcut which is pretranslated). Read-only, updated by NewFrame() ImGuiKeyData KeysData[ImGuiKey_KeysData_SIZE]; // Key state for all known keys. Use IsKeyXXX() functions to access this. bool WantCaptureMouseUnlessPopupClose; // Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup. ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid) @@ -2047,6 +2134,7 @@ struct ImGuiIO bool MouseReleased[5]; // Mouse button went from Down to !Down bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds. bool MouseDownOwnedUnlessPopupClose[5]; // Track if button was clicked inside a dear imgui window. + bool MouseWheelRequestAxisSwap; // On a non-Mac system, holding SHIFT requests WheelY to perform the equivalent of a WheelX event. On a Mac system this is already enforced by the system. float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked) float MouseDownDurationPrev[5]; // Previous time the mouse button has been down float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point (used for moving thresholds) @@ -2076,6 +2164,7 @@ struct ImGuiIO // - ImGuiInputTextFlags_CallbackResize: Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. struct ImGuiInputTextCallbackData { + ImGuiContext* Ctx; // Parent UI context ImGuiInputTextFlags EventFlag; // One ImGuiInputTextFlags_Callback* // Read-only ImGuiInputTextFlags Flags; // What user passed to InputText() // Read-only void* UserData; // What user passed to InputText() // Read-only @@ -2160,7 +2249,7 @@ struct ImGuiTableSortSpecs }; //----------------------------------------------------------------------------- -// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor) +// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, Math Operators, ImColor) //----------------------------------------------------------------------------- // Helper: Unicode defines @@ -2300,6 +2389,7 @@ struct ImGuiStorage // - The clipper also handles various subtleties related to keyboard/gamepad navigation, wrapping etc. struct ImGuiListClipper { + ImGuiContext* Ctx; // Parent UI context int DisplayStart; // First item to display, updated by each call to Step() int DisplayEnd; // End of items to display (exclusive) int ItemsCount; // [Internal] Number of items @@ -2315,14 +2405,44 @@ struct ImGuiListClipper IMGUI_API void End(); // Automatically called on the last call of Step() that returns false. IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items. - // Call ForceDisplayRangeByIndices() before first call to Step() if you need a range of items to be displayed regardless of visibility. - IMGUI_API void ForceDisplayRangeByIndices(int item_min, int item_max); // item_max is exclusive e.g. use (42, 42+1) to make item 42 always visible BUT due to alignment/padding of certain items it is likely that an extra item may be included on either end of the display range. + // Call IncludeItemByIndex() or IncludeItemsByIndex() *BEFORE* first call to Step() if you need a range of items to not be clipped, regardless of their visibility. + // (Due to alignment / padding of certain items it is possible that an extra item may be included on either end of the display range). + inline void IncludeItemByIndex(int item_index) { IncludeItemsByIndex(item_index, item_index + 1); } + IMGUI_API void IncludeItemsByIndex(int item_begin, int item_end); // item_end is exclusive e.g. use (42, 42+1) to make item 42 never clipped. #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79] + inline void IncludeRangeByIndices(int item_begin, int item_end) { IncludeItemsByIndex(item_begin, item_end); } // [renamed in 1.89.9] + inline void ForceDisplayRangeByIndices(int item_begin, int item_end) { IncludeItemsByIndex(item_begin, item_end); } // [renamed in 1.89.6] + //inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79] #endif }; +// Helpers: ImVec2/ImVec4 operators +// - It is important that we are keeping those disabled by default so they don't leak in user space. +// - This is in order to allow user enabling implicit cast operators between ImVec2/ImVec4 and their own types (using IM_VEC2_CLASS_EXTRA in imconfig.h) +// - You can use '#define IMGUI_DEFINE_MATH_OPERATORS' to import our operators, provided as a courtesy. +#ifdef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS_IMPLEMENTED +IM_MSVC_RUNTIME_CHECKS_OFF +static inline ImVec2 operator*(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x * rhs, lhs.y * rhs); } +static inline ImVec2 operator/(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x / rhs, lhs.y / rhs); } +static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x + rhs.x, lhs.y + rhs.y); } +static inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x - rhs.x, lhs.y - rhs.y); } +static inline ImVec2 operator*(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); } +static inline ImVec2 operator/(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x / rhs.x, lhs.y / rhs.y); } +static inline ImVec2 operator-(const ImVec2& lhs) { return ImVec2(-lhs.x, -lhs.y); } +static inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; } +static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; } +static inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; } +static inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; } +static inline ImVec2& operator*=(ImVec2& lhs, const ImVec2& rhs) { lhs.x *= rhs.x; lhs.y *= rhs.y; return lhs; } +static inline ImVec2& operator/=(ImVec2& lhs, const ImVec2& rhs) { lhs.x /= rhs.x; lhs.y /= rhs.y; return lhs; } +static inline ImVec4 operator+(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z, lhs.w + rhs.w); } +static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z, lhs.w - rhs.w); } +static inline ImVec4 operator*(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z, lhs.w * rhs.w); } +IM_MSVC_RUNTIME_CHECKS_RESTORE +#endif + // Helpers macros to generate 32-bit encoded colors // User can declare their own format by #defining the 5 _SHIFT/_MASK macros in their imconfig file. #ifndef IM_COL32_R_SHIFT @@ -2356,8 +2476,8 @@ struct ImColor constexpr ImColor() { } constexpr ImColor(float r, float g, float b, float a = 1.0f) : Value(r, g, b, a) { } constexpr ImColor(const ImVec4& col) : Value(col) {} - ImColor(int r, int g, int b, int a = 255) { float sc = 1.0f / 255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; } - ImColor(ImU32 rgba) { float sc = 1.0f / 255.0f; Value.x = (float)((rgba >> IM_COL32_R_SHIFT) & 0xFF) * sc; Value.y = (float)((rgba >> IM_COL32_G_SHIFT) & 0xFF) * sc; Value.z = (float)((rgba >> IM_COL32_B_SHIFT) & 0xFF) * sc; Value.w = (float)((rgba >> IM_COL32_A_SHIFT) & 0xFF) * sc; } + constexpr ImColor(int r, int g, int b, int a = 255) : Value((float)r * (1.0f / 255.0f), (float)g * (1.0f / 255.0f), (float)b * (1.0f / 255.0f), (float)a* (1.0f / 255.0f)) {} + constexpr ImColor(ImU32 rgba) : Value((float)((rgba >> IM_COL32_R_SHIFT) & 0xFF) * (1.0f / 255.0f), (float)((rgba >> IM_COL32_G_SHIFT) & 0xFF) * (1.0f / 255.0f), (float)((rgba >> IM_COL32_B_SHIFT) & 0xFF) * (1.0f / 255.0f), (float)((rgba >> IM_COL32_A_SHIFT) & 0xFF) * (1.0f / 255.0f)) {} inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); } inline operator ImVec4() const { return Value; } @@ -2591,7 +2711,7 @@ struct ImDrawList // Advanced: Channels // - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit FG primitives before BG primitives) // - Use to minimize draw calls (e.g. if going back-and-forth between multiple clipping rectangles, prefer to append into separate channels then merge at the end) - // - FIXME-OBSOLETE: This API shouldn't have been in ImDrawList in the first place! + // - This API shouldn't have been in ImDrawList in the first place! // Prefer using your own persistent instance of ImDrawListSplitter as you can stack them. // Using the ImDrawList::ChannelsXXXX you cannot stack a split over another. inline void ChannelsSplit(int count) { _Splitter.Split(this, count); } @@ -2610,10 +2730,9 @@ struct ImDrawList inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - inline void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0) { AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); } // OBSOLETED in 1.80 (Jan 2021) - inline void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0) { PathBezierCubicCurveTo(p2, p3, p4, num_segments); } // OBSOLETED in 1.80 (Jan 2021) -#endif + // Obsolete names + //inline void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0) { AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); } // OBSOLETED in 1.80 (Jan 2021) + //inline void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0) { PathBezierCubicCurveTo(p2, p3, p4, num_segments); } // OBSOLETED in 1.80 (Jan 2021) // [Internal helpers] IMGUI_API void _ResetForNewFrame(); @@ -2633,18 +2752,20 @@ struct ImDrawList // as this is one of the oldest structure exposed by the library! Basically, ImDrawList == CmdList) struct ImDrawData { - bool Valid; // Only valid after Render() is called and before the next NewFrame() is called. - int CmdListsCount; // Number of ImDrawList* to render - int TotalIdxCount; // For convenience, sum of all ImDrawList's IdxBuffer.Size - int TotalVtxCount; // For convenience, sum of all ImDrawList's VtxBuffer.Size - ImDrawList** CmdLists; // Array of ImDrawList* to render. The ImDrawList are owned by ImGuiContext and only pointed to from here. - ImVec2 DisplayPos; // Top-left position of the viewport to render (== top-left of the orthogonal projection matrix to use) (== GetMainViewport()->Pos for the main viewport, == (0.0) in most single-viewport applications) - ImVec2 DisplaySize; // Size of the viewport to render (== GetMainViewport()->Size for the main viewport, == io.DisplaySize in most single-viewport applications) - ImVec2 FramebufferScale; // Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display. + bool Valid; // Only valid after Render() is called and before the next NewFrame() is called. + int CmdListsCount; // Number of ImDrawList* to render (should always be == CmdLists.size) + int TotalIdxCount; // For convenience, sum of all ImDrawList's IdxBuffer.Size + int TotalVtxCount; // For convenience, sum of all ImDrawList's VtxBuffer.Size + ImVector CmdLists; // Array of ImDrawList* to render. The ImDrawLists are owned by ImGuiContext and only pointed to from here. + ImVec2 DisplayPos; // Top-left position of the viewport to render (== top-left of the orthogonal projection matrix to use) (== GetMainViewport()->Pos for the main viewport, == (0.0) in most single-viewport applications) + ImVec2 DisplaySize; // Size of the viewport to render (== GetMainViewport()->Size for the main viewport, == io.DisplaySize in most single-viewport applications) + ImVec2 FramebufferScale; // Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display. + ImGuiViewport* OwnerViewport; // Viewport carrying the ImDrawData instance, might be of use to the renderer (generally not). // Functions ImDrawData() { Clear(); } - void Clear() { memset(this, 0, sizeof(*this)); } // The ImDrawList are owned by ImGuiContext! + IMGUI_API void Clear(); + IMGUI_API void AddDrawList(ImDrawList* draw_list); // Helper to add an external draw list into an existing ImDrawData. IMGUI_API void DeIndexAllBuffers(); // Helper to convert all buffers from indexed to non-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering! IMGUI_API void ScaleClipRects(const ImVec2& fb_scale); // Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than Dear ImGui expects, or if there is a difference between your window resolution and framebuffer resolution. }; @@ -2660,12 +2781,12 @@ struct ImFontConfig bool FontDataOwnedByAtlas; // true // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself). int FontNo; // 0 // Index of font within TTF/OTF file float SizePixels; // // Size in pixels for rasterizer (more or less maps to the resulting font height). - int OversampleH; // 3 // Rasterize at higher quality for sub-pixel positioning. Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details. + int OversampleH; // 2 // Rasterize at higher quality for sub-pixel positioning. Note the difference between 2 and 3 is minimal. You can reduce this to 1 for large glyphs save memory. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details. int OversampleV; // 1 // Rasterize at higher quality for sub-pixel positioning. This is not really useful as we don't use sub-pixel positions on the Y axis. bool PixelSnapH; // false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1. ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now. ImVec2 GlyphOffset; // 0, 0 // Offset all glyphs from this font input. - const ImWchar* GlyphRanges; // NULL // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. + const ImWchar* GlyphRanges; // NULL // THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). float GlyphMinAdvanceX; // 0 // Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font float GlyphMaxAdvanceX; // FLT_MAX // Maximum AdvanceX for glyphs bool MergeMode; // false // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights. @@ -2778,7 +2899,8 @@ struct ImFontAtlas //------------------------------------------- // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list) - // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details. + // NB: Make sure that your string are UTF-8 and NOT in your local code page. + // Read https://github.com/ocornut/imgui/blob/master/docs/FONTS.md/#about-utf-8-encoding for details. // NB: Consider using ImFontGlyphRangesBuilder to build glyph ranges from textual data. IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin IMGUI_API const ImWchar* GetGlyphRangesGreek(); // Default + Greek and Coptic @@ -2818,6 +2940,7 @@ struct ImFontAtlas int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height. int TexGlyphPadding; // Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0 (will also need to set AntiAliasedLinesUseTex = false). bool Locked; // Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert. + void* UserData; // Store your own atlas related user-data (if e.g. you have multiple font atlas). // [Internal] // NB: Access texture data via GetTexData*() calls! Which will setup a default font for you. @@ -2866,8 +2989,10 @@ struct ImFont const ImFontConfig* ConfigData; // 4-8 // in // // Pointer within ContainerAtlas->ConfigData short ConfigDataCount; // 2 // in // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont. ImWchar FallbackChar; // 2 // out // = FFFD/'?' // Character used if a glyph isn't found. - ImWchar EllipsisChar; // 2 // out // = '...' // Character used for ellipsis rendering. - ImWchar DotChar; // 2 // out // = '.' // Character used for ellipsis rendering (if a single '...' character isn't found) + ImWchar EllipsisChar; // 2 // out // = '...'/'.'// Character used for ellipsis rendering. + short EllipsisCharCount; // 1 // out // 1 or 3 + float EllipsisWidth; // 4 // out // Width + float EllipsisCharStep; // 4 // out // Step between characters when EllipsisCount > 0 bool DirtyLookupTables; // 1 // out // float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale() float Ascent, Descent; // 4+4 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] @@ -2970,24 +3095,29 @@ namespace ImGui #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS namespace ImGui { + // OBSOLETED in 1.89.7 (from June 2023) + IMGUI_API void SetItemAllowOverlap(); // Use SetNextItemAllowOverlap() before item. + // OBSOLETED in 1.89.4 (from March 2023) + static inline void PushAllowKeyboardFocus(bool tab_stop) { PushTabStop(tab_stop); } + static inline void PopAllowKeyboardFocus() { PopTabStop(); } // OBSOLETED in 1.89 (from August 2022) IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1)); // Use new ImageButton() signature (explicit item id, regular FramePadding) // OBSOLETED in 1.88 (from May 2022) - static inline void CaptureKeyboardFromApp(bool want_capture_keyboard = true) { SetNextFrameWantCaptureKeyboard(want_capture_keyboard); } // Renamed as name was misleading + removed default value. - static inline void CaptureMouseFromApp(bool want_capture_mouse = true) { SetNextFrameWantCaptureMouse(want_capture_mouse); } // Renamed as name was misleading + removed default value. + static inline void CaptureKeyboardFromApp(bool want_capture_keyboard = true) { SetNextFrameWantCaptureKeyboard(want_capture_keyboard); } // Renamed as name was misleading + removed default value. + static inline void CaptureMouseFromApp(bool want_capture_mouse = true) { SetNextFrameWantCaptureMouse(want_capture_mouse); } // Renamed as name was misleading + removed default value. // OBSOLETED in 1.86 (from November 2021) IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // Calculate coarse clipping for large list of evenly sized items. Prefer using ImGuiListClipper. // OBSOLETED in 1.85 (from August 2021) - static inline float GetWindowContentRegionWidth() { return GetWindowContentRegionMax().x - GetWindowContentRegionMin().x; } - // OBSOLETED in 1.81 (from February 2021) - IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // Helper to calculate size from items_count and height_in_items - static inline bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) { return BeginListBox(label, size); } - static inline void ListBoxFooter() { EndListBox(); } - // OBSOLETED in 1.79 (from August 2020) - static inline void OpenPopupContextItem(const char* str_id = NULL, ImGuiMouseButton mb = 1) { OpenPopupOnItemClick(str_id, mb); } // Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry! + static inline float GetWindowContentRegionWidth() { return GetWindowContentRegionMax().x - GetWindowContentRegionMin().x; } // Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE) - // [OBSOLETED in 1.78 (from June 2020] Old drag/sliders functions that took a 'float power > 1.0f' argument instead of ImGuiSliderFlags_Logarithmic. See github.com/ocornut/imgui/issues/3361 for details. + //-- OBSOLETED in 1.81 (from February 2021) + //static inline bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) { return BeginListBox(label, size); } + //static inline bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1) { float height = GetTextLineHeightWithSpacing() * ((height_in_items < 0 ? ImMin(items_count, 7) : height_in_items) + 0.25f) + GetStyle().FramePadding.y * 2.0f; return BeginListBox(label, ImVec2(0.0f, height)); } // Helper to calculate size from items_count and height_in_items + //static inline void ListBoxFooter() { EndListBox(); } + //-- OBSOLETED in 1.79 (from August 2020) + //static inline void OpenPopupContextItem(const char* str_id = NULL, ImGuiMouseButton mb = 1) { OpenPopupOnItemClick(str_id, mb); } // Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry! + //-- OBSOLETED in 1.78 (from June 2020): Old drag/sliders functions that took a 'float power > 1.0f' argument instead of ImGuiSliderFlags_Logarithmic. See github.com/ocornut/imgui/issues/3361 for details. //IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power = 1.0f) // OBSOLETED in 1.78 (from June 2020) //IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power = 1.0f); // OBSOLETED in 1.78 (from June 2020) //IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power = 1.0f); // OBSOLETED in 1.78 (from June 2020) @@ -3000,7 +3130,7 @@ namespace ImGui //static inline bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) //static inline bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) //static inline bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) - // [OBSOLETED in 1.77 and before] + //-- OBSOLETED in 1.77 and before //static inline bool BeginPopupContextWindow(const char* str_id, ImGuiMouseButton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_items ? 0 : ImGuiPopupFlags_NoOpenOverItems)); } // OBSOLETED in 1.77 (from June 2020) //static inline void TreeAdvanceToLabelPos() { SetCursorPosX(GetCursorPosX() + GetTreeNodeToLabelSpacing()); } // OBSOLETED in 1.72 (from July 2019) //static inline void SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { SetNextItemOpen(open, cond); } // OBSOLETED in 1.71 (from June 2019) @@ -3008,6 +3138,7 @@ namespace ImGui //static inline ImDrawList* GetOverlayDrawList() { return GetForegroundDrawList(); } // OBSOLETED in 1.69 (from Mar 2019) //static inline void SetScrollHere(float ratio = 0.5f) { SetScrollHereY(ratio); } // OBSOLETED in 1.66 (from Nov 2018) //static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); } // OBSOLETED in 1.63 (from Aug 2018) + //-- OBSOLETED in 1.60 and before //static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); } // OBSOLETED in 1.60 (from Apr 2018) //static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } // OBSOLETED in 1.60 (between Dec 2017 and Apr 2018) //static inline void ShowTestWindow() { return ShowDemoWindow(); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) @@ -3023,6 +3154,7 @@ namespace ImGui //static inline bool IsPosHoveringAnyWindow(const ImVec2&) { IM_ASSERT(0); return false; } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017): This was misleading and partly broken. You probably want to use the io.WantCaptureMouse flag instead. //static inline bool IsMouseHoveringAnyWindow() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017) //static inline bool IsMouseHoveringWindow() { return IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017) + //-- OBSOLETED in 1.50 and before //static inline bool CollapsingHeader(char* label, const char* str_id, bool framed = true, bool default_open = false) { return CollapsingHeader(label, (default_open ? (1 << 5) : 0)); } // OBSOLETED in 1.49 //static inline ImFont*GetWindowFont() { return GetFont(); } // OBSOLETED in 1.48 //static inline float GetWindowFontSize() { return GetFontSize(); } // OBSOLETED in 1.48 diff --git a/bgfx/3rdparty/dear-imgui/imgui_demo.cpp b/bgfx/3rdparty/dear-imgui/imgui_demo.cpp index 349e7020..ab529e37 100644 --- a/bgfx/3rdparty/dear-imgui/imgui_demo.cpp +++ b/bgfx/3rdparty/dear-imgui/imgui_demo.cpp @@ -1,16 +1,18 @@ -// dear imgui, v1.89 WIP +// dear imgui, v1.89.9 // (demo code) // Help: -// - Read FAQ at http://dearimgui.org/faq -// - Newcomers, read 'Programmer guide' in imgui.cpp for notes on how to setup Dear ImGui in your codebase. +// - Read FAQ at http://dearimgui.com/faq // - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications in examples/ are doing that. +// - Need help integrating Dear ImGui in your codebase? +// - Read Getting Started https://github.com/ocornut/imgui/wiki/Getting-Started +// - Read 'Programmer guide' in imgui.cpp for notes on how to setup Dear ImGui in your codebase. // Read imgui.cpp for more details, documentation and comments. // Get the latest version at https://github.com/ocornut/imgui -// ------------------------------------------------- +//--------------------------------------------------- // PLEASE DO NOT REMOVE THIS FILE FROM YOUR PROJECT! -// ------------------------------------------------- +//--------------------------------------------------- // Message to the person tempted to delete this file when integrating Dear ImGui into their codebase: // Think again! It is the most useful reference code that you and other coders will want to refer to and call. // Have the ImGui::ShowDemoWindow() function wired in an always-available debug menu of your game/app! @@ -24,21 +26,30 @@ // Thank you, // -Your beloved friend, imgui_demo.cpp (which you won't delete) -// Message to beginner C/C++ programmers about the meaning of the 'static' keyword: -// In this demo code, we frequently use 'static' variables inside functions. A static variable persists across calls, -// so it is essentially like a global variable but declared inside the scope of the function. We do this as a way to -// gather code and data in the same place, to make the demo source code faster to read, faster to write, and smaller -// in size. It also happens to be a convenient way of storing simple UI related information as long as your function -// doesn't need to be reentrant or used in multiple threads. This might be a pattern you will want to use in your code, -// but most of the real data you would be editing is likely going to be stored outside your functions. - +//-------------------------------------------- +// ABOUT THE MEANING OF THE 'static' KEYWORD: +//-------------------------------------------- +// In this demo code, we frequently use 'static' variables inside functions. +// A static variable persists across calls. It is essentially a global variable but declared inside the scope of the function. +// Think of "static int n = 0;" as "global int n = 0;" ! +// We do this IN THE DEMO because we want: +// - to gather code and data in the same place. +// - to make the demo source code faster to read, faster to change, smaller in size. +// - it is also a convenient way of storing simple UI related information as long as your function +// doesn't need to be reentrant or used in multiple threads. +// This might be a pattern you will want to use in your code, but most of the data you would be working +// with in a complex codebase is likely going to be stored outside your functions. + +//----------------------------------------- +// ABOUT THE CODING STYLE OF OUR DEMO CODE +//----------------------------------------- // The Demo code in this file is designed to be easy to copy-and-paste into your application! // Because of this: // - We never omit the ImGui:: prefix when calling functions, even though most code here is in the same namespace. // - We try to declare static variables in the local scope, as close as possible to the code using them. // - We never use any of the helpers/facilities used internally by Dear ImGui, unless available in the public API. // - We never use maths operators on ImVec2/ImVec4. For our other sources files we use them, and they are provided -// by imgui_internal.h using the IMGUI_DEFINE_MATH_OPERATORS define. For your own sources file they are optional +// by imgui.h using the IMGUI_DEFINE_MATH_OPERATORS define. For your own sources file they are optional // and require you either enable those, either provide your own via IM_VEC2_CLASS_EXTRA in imconfig.h. // Because we can't assume anything about your support of maths operators, we cannot use them in imgui_demo.cpp. @@ -91,10 +102,9 @@ Index of this file: #include // sqrtf, powf, cosf, sinf, floorf, ceilf #include // vsnprintf, sscanf, printf #include // NULL, malloc, free, atoi -#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier -#include // intptr_t -#else #include // intptr_t +#if !defined(_MSC_VER) || _MSC_VER >= 1800 +#include // PRId64/PRIu64, not avail in some MinGW headers. #endif // Visual Studio warnings @@ -144,14 +154,13 @@ Index of this file: #define vsnprintf _vsnprintf #endif -// Format specifiers, printing 64-bit hasn't been decently standardized... -// In a real application you should be using PRId64 and PRIu64 from (non-windows) and on Windows define them yourself. -#ifdef _MSC_VER -#define IM_PRId64 "I64d" -#define IM_PRIu64 "I64u" -#else -#define IM_PRId64 "lld" -#define IM_PRIu64 "llu" +// Format specifiers for 64-bit values (hasn't been decently standardized before VS2013) +#if !defined(PRId64) && defined(_MSC_VER) +#define PRId64 "I64d" +#define PRIu64 "I64u" +#elif !defined(PRId64) +#define PRId64 "lld" +#define PRIu64 "llu" #endif // Helpers macros @@ -178,19 +187,19 @@ Index of this file: #if !defined(IMGUI_DISABLE_DEMO_WINDOWS) // Forward Declarations -static void ShowExampleAppDocuments(bool* p_open); static void ShowExampleAppMainMenuBar(); static void ShowExampleAppConsole(bool* p_open); +static void ShowExampleAppCustomRendering(bool* p_open); +static void ShowExampleAppDocuments(bool* p_open); static void ShowExampleAppLog(bool* p_open); static void ShowExampleAppLayout(bool* p_open); static void ShowExampleAppPropertyEditor(bool* p_open); -static void ShowExampleAppLongText(bool* p_open); +static void ShowExampleAppSimpleOverlay(bool* p_open); static void ShowExampleAppAutoResize(bool* p_open); static void ShowExampleAppConstrainedResize(bool* p_open); -static void ShowExampleAppSimpleOverlay(bool* p_open); static void ShowExampleAppFullscreen(bool* p_open); +static void ShowExampleAppLongText(bool* p_open); static void ShowExampleAppWindowTitles(bool* p_open); -static void ShowExampleAppCustomRendering(bool* p_open); static void ShowExampleMenuFile(); // We split the contents of the big ShowDemoWindow() function into smaller functions @@ -211,9 +220,8 @@ static void ShowDemoWindowInputs(); static void HelpMarker(const char* desc) { ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort)) + if (ImGui::BeginItemTooltip()) { - ImGui::BeginTooltip(); ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); ImGui::TextUnformatted(desc); ImGui::PopTextWrapPos(); @@ -247,59 +255,59 @@ void* GImGuiDemoMarkerCallbackUserData = NULL; void ImGui::ShowDemoWindow(bool* p_open) { // Exceptionally add an extra assert here for people confused about initial Dear ImGui setup - // Most functions would normally just crash if the context is missing. - IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!"); + // Most functions would normally just assert/crash if the context is missing. + IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing Dear ImGui context. Refer to examples app!"); // Examples Apps (accessible from the "Examples" menu) static bool show_app_main_menu_bar = false; - static bool show_app_documents = false; static bool show_app_console = false; + static bool show_app_custom_rendering = false; + static bool show_app_documents = false; static bool show_app_log = false; static bool show_app_layout = false; static bool show_app_property_editor = false; - static bool show_app_long_text = false; + static bool show_app_simple_overlay = false; static bool show_app_auto_resize = false; static bool show_app_constrained_resize = false; - static bool show_app_simple_overlay = false; static bool show_app_fullscreen = false; + static bool show_app_long_text = false; static bool show_app_window_titles = false; - static bool show_app_custom_rendering = false; if (show_app_main_menu_bar) ShowExampleAppMainMenuBar(); if (show_app_documents) ShowExampleAppDocuments(&show_app_documents); if (show_app_console) ShowExampleAppConsole(&show_app_console); + if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering); if (show_app_log) ShowExampleAppLog(&show_app_log); if (show_app_layout) ShowExampleAppLayout(&show_app_layout); if (show_app_property_editor) ShowExampleAppPropertyEditor(&show_app_property_editor); - if (show_app_long_text) ShowExampleAppLongText(&show_app_long_text); + if (show_app_simple_overlay) ShowExampleAppSimpleOverlay(&show_app_simple_overlay); if (show_app_auto_resize) ShowExampleAppAutoResize(&show_app_auto_resize); if (show_app_constrained_resize) ShowExampleAppConstrainedResize(&show_app_constrained_resize); - if (show_app_simple_overlay) ShowExampleAppSimpleOverlay(&show_app_simple_overlay); if (show_app_fullscreen) ShowExampleAppFullscreen(&show_app_fullscreen); + if (show_app_long_text) ShowExampleAppLongText(&show_app_long_text); if (show_app_window_titles) ShowExampleAppWindowTitles(&show_app_window_titles); - if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering); - // Dear ImGui Tools/Apps (accessible from the "Tools" menu) - static bool show_app_metrics = false; - static bool show_app_debug_log = false; - static bool show_app_stack_tool = false; - static bool show_app_about = false; - static bool show_app_style_editor = false; - - if (show_app_metrics) - ImGui::ShowMetricsWindow(&show_app_metrics); - if (show_app_debug_log) - ImGui::ShowDebugLogWindow(&show_app_debug_log); - if (show_app_stack_tool) - ImGui::ShowStackToolWindow(&show_app_stack_tool); - if (show_app_about) - ImGui::ShowAboutWindow(&show_app_about); - if (show_app_style_editor) - { - ImGui::Begin("Dear ImGui Style Editor", &show_app_style_editor); + // Dear ImGui Tools (accessible from the "Tools" menu) + static bool show_tool_metrics = false; + static bool show_tool_debug_log = false; + static bool show_tool_stack_tool = false; + static bool show_tool_style_editor = false; + static bool show_tool_about = false; + + if (show_tool_metrics) + ImGui::ShowMetricsWindow(&show_tool_metrics); + if (show_tool_debug_log) + ImGui::ShowDebugLogWindow(&show_tool_debug_log); + if (show_tool_stack_tool) + ImGui::ShowStackToolWindow(&show_tool_stack_tool); + if (show_tool_style_editor) + { + ImGui::Begin("Dear ImGui Style Editor", &show_tool_style_editor); ImGui::ShowStyleEditor(); ImGui::End(); } + if (show_tool_about) + ImGui::ShowAboutWindow(&show_tool_about); // Demonstrate the various window flags. Typically you would just use the default! static bool no_titlebar = false; @@ -360,18 +368,23 @@ void ImGui::ShowDemoWindow(bool* p_open) { IMGUI_DEMO_MARKER("Menu/Examples"); ImGui::MenuItem("Main menu bar", NULL, &show_app_main_menu_bar); + + ImGui::SeparatorText("Mini apps"); ImGui::MenuItem("Console", NULL, &show_app_console); + ImGui::MenuItem("Custom rendering", NULL, &show_app_custom_rendering); + ImGui::MenuItem("Documents", NULL, &show_app_documents); ImGui::MenuItem("Log", NULL, &show_app_log); - ImGui::MenuItem("Simple layout", NULL, &show_app_layout); ImGui::MenuItem("Property editor", NULL, &show_app_property_editor); - ImGui::MenuItem("Long text display", NULL, &show_app_long_text); + ImGui::MenuItem("Simple layout", NULL, &show_app_layout); + ImGui::MenuItem("Simple overlay", NULL, &show_app_simple_overlay); + + ImGui::SeparatorText("Concepts"); ImGui::MenuItem("Auto-resizing window", NULL, &show_app_auto_resize); ImGui::MenuItem("Constrained-resizing window", NULL, &show_app_constrained_resize); - ImGui::MenuItem("Simple overlay", NULL, &show_app_simple_overlay); ImGui::MenuItem("Fullscreen window", NULL, &show_app_fullscreen); + ImGui::MenuItem("Long text display", NULL, &show_app_long_text); ImGui::MenuItem("Manipulating window titles", NULL, &show_app_window_titles); - ImGui::MenuItem("Custom rendering", NULL, &show_app_custom_rendering); - ImGui::MenuItem("Documents", NULL, &show_app_documents); + ImGui::EndMenu(); } //if (ImGui::MenuItem("MenuItem")) {} // You can also use MenuItem() inside a menu bar! @@ -383,11 +396,11 @@ void ImGui::ShowDemoWindow(bool* p_open) #else const bool has_debug_tools = false; #endif - ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics, has_debug_tools); - ImGui::MenuItem("Debug Log", NULL, &show_app_debug_log, has_debug_tools); - ImGui::MenuItem("Stack Tool", NULL, &show_app_stack_tool, has_debug_tools); - ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor); - ImGui::MenuItem("About Dear ImGui", NULL, &show_app_about); + ImGui::MenuItem("Metrics/Debugger", NULL, &show_tool_metrics, has_debug_tools); + ImGui::MenuItem("Debug Log", NULL, &show_tool_debug_log, has_debug_tools); + ImGui::MenuItem("Stack Tool", NULL, &show_tool_stack_tool, has_debug_tools); + ImGui::MenuItem("Style Editor", NULL, &show_tool_style_editor); + ImGui::MenuItem("About Dear ImGui", NULL, &show_tool_about); ImGui::EndMenu(); } ImGui::EndMenuBar(); @@ -399,23 +412,21 @@ void ImGui::ShowDemoWindow(bool* p_open) IMGUI_DEMO_MARKER("Help"); if (ImGui::CollapsingHeader("Help")) { - ImGui::Text("ABOUT THIS DEMO:"); + ImGui::SeparatorText("ABOUT THIS DEMO:"); ImGui::BulletText("Sections below are demonstrating many aspects of the library."); ImGui::BulletText("The \"Examples\" menu above leads to more demo contents."); ImGui::BulletText("The \"Tools\" menu above gives access to: About Box, Style Editor,\n" "and Metrics/Debugger (general purpose Dear ImGui debugging tool)."); - ImGui::Separator(); - ImGui::Text("PROGRAMMER GUIDE:"); + ImGui::SeparatorText("PROGRAMMER GUIDE:"); ImGui::BulletText("See the ShowDemoWindow() code in imgui_demo.cpp. <- you are here!"); ImGui::BulletText("See comments in imgui.cpp."); ImGui::BulletText("See example applications in the examples/ folder."); - ImGui::BulletText("Read the FAQ at http://www.dearimgui.org/faq/"); + ImGui::BulletText("Read the FAQ at http://www.dearimgui.com/faq/"); ImGui::BulletText("Set 'io.ConfigFlags |= NavEnableKeyboard' for keyboard controls."); ImGui::BulletText("Set 'io.ConfigFlags |= NavEnableGamepad' for gamepad controls."); - ImGui::Separator(); - ImGui::Text("USER GUIDE:"); + ImGui::SeparatorText("USER GUIDE:"); ImGui::ShowUserGuide(); } @@ -426,6 +437,7 @@ void ImGui::ShowDemoWindow(bool* p_open) if (ImGui::TreeNode("Configuration##2")) { + ImGui::SeparatorText("General"); ImGui::CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", &io.ConfigFlags, ImGuiConfigFlags_NavEnableKeyboard); ImGui::SameLine(); HelpMarker("Enable keyboard controls."); ImGui::CheckboxFlags("io.ConfigFlags: NavEnableGamepad", &io.ConfigFlags, ImGuiConfigFlags_NavEnableGamepad); @@ -448,6 +460,10 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::SameLine(); HelpMarker("Instruct backend to not alter mouse cursor shape and visibility."); ImGui::Checkbox("io.ConfigInputTrickleEventQueue", &io.ConfigInputTrickleEventQueue); ImGui::SameLine(); HelpMarker("Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates."); + ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor); + ImGui::SameLine(); HelpMarker("Instruct Dear ImGui to render a mouse cursor itself. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something)."); + + ImGui::SeparatorText("Widgets"); ImGui::Checkbox("io.ConfigInputTextCursorBlink", &io.ConfigInputTextCursorBlink); ImGui::SameLine(); HelpMarker("Enable blinking cursor (optional as some users consider it to be distracting)."); ImGui::Checkbox("io.ConfigInputTextEnterKeepActive", &io.ConfigInputTextEnterKeepActive); @@ -457,11 +473,23 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::Checkbox("io.ConfigWindowsResizeFromEdges", &io.ConfigWindowsResizeFromEdges); ImGui::SameLine(); HelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback."); ImGui::Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", &io.ConfigWindowsMoveFromTitleBarOnly); - ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor); - ImGui::SameLine(); HelpMarker("Instruct Dear ImGui to render a mouse cursor itself. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something)."); + ImGui::Checkbox("io.ConfigMacOSXBehaviors", &io.ConfigMacOSXBehaviors); ImGui::Text("Also see Style->Rendering for rendering options."); + + ImGui::SeparatorText("Debug"); + ImGui::BeginDisabled(); + ImGui::Checkbox("io.ConfigDebugBeginReturnValueOnce", &io.ConfigDebugBeginReturnValueOnce); // . + ImGui::EndDisabled(); + ImGui::SameLine(); HelpMarker("First calls to Begin()/BeginChild() will return false.\n\nTHIS OPTION IS DISABLED because it needs to be set at application boot-time to make sense. Showing the disabled option is a way to make this feature easier to discover"); + ImGui::Checkbox("io.ConfigDebugBeginReturnValueLoop", &io.ConfigDebugBeginReturnValueLoop); + ImGui::SameLine(); HelpMarker("Some calls to Begin()/BeginChild() will return false.\n\nWill cycle through window depths then repeat. Windows should be flickering while running."); + ImGui::Checkbox("io.ConfigDebugIgnoreFocusLoss", &io.ConfigDebugIgnoreFocusLoss); + ImGui::SameLine(); HelpMarker("Option to deactivate io.AddFocusEvent(false) handling. May facilitate interactions with a debugger when focus loss leads to clearing inputs data."); + ImGui::Checkbox("io.ConfigDebugIniSettings", &io.ConfigDebugIniSettings); + ImGui::SameLine(); HelpMarker("Option to save .ini data with extra comments (particularly helpful for Docking, but makes saving slower)."); + ImGui::TreePop(); - ImGui::Separator(); + ImGui::Spacing(); } IMGUI_DEMO_MARKER("Configuration/Backend Flags"); @@ -471,15 +499,15 @@ void ImGui::ShowDemoWindow(bool* p_open) "Those flags are set by the backends (imgui_impl_xxx files) to specify their capabilities.\n" "Here we expose them as read-only fields to avoid breaking interactions with your backend."); - // Make a local copy to avoid modifying actual backend flags. - // FIXME: We don't use BeginDisabled() to keep label bright, maybe we need a BeginReadonly() equivalent.. - ImGuiBackendFlags backend_flags = io.BackendFlags; - ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", &backend_flags, ImGuiBackendFlags_HasGamepad); - ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", &backend_flags, ImGuiBackendFlags_HasMouseCursors); - ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", &backend_flags, ImGuiBackendFlags_HasSetMousePos); - ImGui::CheckboxFlags("io.BackendFlags: RendererHasVtxOffset", &backend_flags, ImGuiBackendFlags_RendererHasVtxOffset); + // FIXME: Maybe we need a BeginReadonly() equivalent to keep label bright? + ImGui::BeginDisabled(); + ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", &io.BackendFlags, ImGuiBackendFlags_HasGamepad); + ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", &io.BackendFlags, ImGuiBackendFlags_HasMouseCursors); + ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", &io.BackendFlags, ImGuiBackendFlags_HasSetMousePos); + ImGui::CheckboxFlags("io.BackendFlags: RendererHasVtxOffset", &io.BackendFlags, ImGuiBackendFlags_RendererHasVtxOffset); + ImGui::EndDisabled(); ImGui::TreePop(); - ImGui::Separator(); + ImGui::Spacing(); } IMGUI_DEMO_MARKER("Configuration/Style"); @@ -488,7 +516,7 @@ void ImGui::ShowDemoWindow(bool* p_open) HelpMarker("The same contents can be accessed in 'Tools->Style Editor' or by calling the ShowStyleEditor() function."); ImGui::ShowStyleEditor(); ImGui::TreePop(); - ImGui::Separator(); + ImGui::Spacing(); } IMGUI_DEMO_MARKER("Configuration/Capture, Logging"); @@ -556,6 +584,8 @@ static void ShowDemoWindowWidgets() IMGUI_DEMO_MARKER("Widgets/Basic"); if (ImGui::TreeNode("Basic")) { + ImGui::SeparatorText("General"); + IMGUI_DEMO_MARKER("Widgets/Basic/Button"); static int clicked = 0; if (ImGui::Button("Button")) @@ -610,19 +640,12 @@ static void ShowDemoWindowWidgets() ImGui::SameLine(); ImGui::Text("%d", counter); - ImGui::Separator(); + ImGui::Button("Tooltip"); + ImGui::SetItemTooltip("I am a tooltip"); + ImGui::LabelText("label", "Value"); - { - // Using the _simplified_ one-liner Combo() api here - // See "Combo" section for examples of how to use the more flexible BeginCombo()/EndCombo() api. - IMGUI_DEMO_MARKER("Widgets/Basic/Combo"); - const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIIIIII", "JJJJ", "KKKKKKK" }; - static int item_current = 0; - ImGui::Combo("combo", &item_current, items, IM_ARRAYSIZE(items)); - ImGui::SameLine(); HelpMarker( - "Using the simplified one-liner Combo API here.\nRefer to the \"Combo\" section below for an explanation of how to use the more flexible and general BeginCombo/EndCombo API."); - } + ImGui::SeparatorText("Inputs"); { // To wire InputText() with std::string or any other custom string type, @@ -666,6 +689,8 @@ static void ShowDemoWindowWidgets() ImGui::InputFloat3("input float3", vec4a); } + ImGui::SeparatorText("Drags"); + { IMGUI_DEMO_MARKER("Widgets/Basic/DragInt, DragFloat"); static int i1 = 50, i2 = 42; @@ -682,6 +707,8 @@ static void ShowDemoWindowWidgets() ImGui::DragFloat("drag small float", &f2, 0.0001f, 0.0f, 0.0f, "%.06f ns"); } + ImGui::SeparatorText("Sliders"); + { IMGUI_DEMO_MARKER("Widgets/Basic/SliderInt, SliderFloat"); static int i1 = 0; @@ -704,10 +731,12 @@ static void ShowDemoWindowWidgets() static int elem = Element_Fire; const char* elems_names[Element_COUNT] = { "Fire", "Earth", "Air", "Water" }; const char* elem_name = (elem >= 0 && elem < Element_COUNT) ? elems_names[elem] : "Unknown"; - ImGui::SliderInt("slider enum", &elem, 0, Element_COUNT - 1, elem_name); + ImGui::SliderInt("slider enum", &elem, 0, Element_COUNT - 1, elem_name); // Use ImGuiSliderFlags_NoInput flag to disable CTRL+Click here. ImGui::SameLine(); HelpMarker("Using the format string parameter to display a name instead of the underlying integer."); } + ImGui::SeparatorText("Selectors/Pickers"); + { IMGUI_DEMO_MARKER("Widgets/Basic/ColorEdit3, ColorEdit4"); static float col1[3] = { 1.0f, 0.0f, 0.2f }; @@ -722,6 +751,17 @@ static void ShowDemoWindowWidgets() ImGui::ColorEdit4("color 2", col2); } + { + // Using the _simplified_ one-liner Combo() api here + // See "Combo" section for examples of how to use the more flexible BeginCombo()/EndCombo() api. + IMGUI_DEMO_MARKER("Widgets/Basic/Combo"); + const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIIIIII", "JJJJ", "KKKKKKK" }; + static int item_current = 0; + ImGui::Combo("combo", &item_current, items, IM_ARRAYSIZE(items)); + ImGui::SameLine(); HelpMarker( + "Using the simplified one-liner Combo API here.\nRefer to the \"Combo\" section below for an explanation of how to use the more flexible and general BeginCombo/EndCombo API."); + } + { // Using the _simplified_ one-liner ListBox() api here // See "List boxes" section for examples of how to use the more flexible BeginListBox()/EndListBox() api. @@ -733,40 +773,85 @@ static void ShowDemoWindowWidgets() "Using the simplified one-liner ListBox API here.\nRefer to the \"List boxes\" section below for an explanation of how to use the more flexible and general BeginListBox/EndListBox API."); } - { - // Tooltips - IMGUI_DEMO_MARKER("Widgets/Basic/Tooltips"); - ImGui::AlignTextToFramePadding(); - ImGui::Text("Tooltips:"); + ImGui::TreePop(); + } - ImGui::SameLine(); - ImGui::Button("Button"); - if (ImGui::IsItemHovered()) - ImGui::SetTooltip("I am a tooltip"); + IMGUI_DEMO_MARKER("Widgets/Tooltips"); + if (ImGui::TreeNode("Tooltips")) + { + // Tooltips are windows following the mouse. They do not take focus away. + ImGui::SeparatorText("General"); - ImGui::SameLine(); - ImGui::Button("Fancy"); - if (ImGui::IsItemHovered()) - { - ImGui::BeginTooltip(); - ImGui::Text("I am a fancy tooltip"); - static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f }; - ImGui::PlotLines("Curve", arr, IM_ARRAYSIZE(arr)); - ImGui::Text("Sin(time) = %f", sinf((float)ImGui::GetTime())); - ImGui::EndTooltip(); - } + // Typical use cases: + // - Short-form (text only): SetItemTooltip("Hello"); + // - Short-form (any contents): if (BeginItemTooltip()) { Text("Hello"); EndTooltip(); } - ImGui::SameLine(); - ImGui::Button("Delayed"); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) // Delay best used on items that highlight on hover, so this not a great example! - ImGui::SetTooltip("I am a tooltip with a delay."); + // - Full-form (text only): if (IsItemHovered(...)) { SetTooltip("Hello"); } + // - Full-form (any contents): if (IsItemHovered(...) && BeginTooltip()) { Text("Hello"); EndTooltip(); } - ImGui::SameLine(); - HelpMarker( - "Tooltip are created by using the IsItemHovered() function over any kind of item."); + HelpMarker( + "Tooltip are typically created by using a IsItemHovered() + SetTooltip() sequence.\n\n" + "We provide a helper SetItemTooltip() function to perform the two with standards flags."); + + ImVec2 sz = ImVec2(-FLT_MIN, 0.0f); + + ImGui::Button("Basic", sz); + ImGui::SetItemTooltip("I am a tooltip"); + + ImGui::Button("Fancy", sz); + if (ImGui::BeginItemTooltip()) + { + ImGui::Text("I am a fancy tooltip"); + static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f }; + ImGui::PlotLines("Curve", arr, IM_ARRAYSIZE(arr)); + ImGui::Text("Sin(time) = %f", sinf((float)ImGui::GetTime())); + ImGui::EndTooltip(); + } + + ImGui::SeparatorText("Always On"); + // Showcase NOT relying on a IsItemHovered() to emit a tooltip. + // Here the tooltip is always emitted when 'always_on == true'. + static int always_on = 0; + ImGui::RadioButton("Off", &always_on, 0); + ImGui::SameLine(); + ImGui::RadioButton("Always On (Simple)", &always_on, 1); + ImGui::SameLine(); + ImGui::RadioButton("Always On (Advanced)", &always_on, 2); + if (always_on == 1) + ImGui::SetTooltip("I am following you around."); + else if (always_on == 2 && ImGui::BeginTooltip()) + { + ImGui::ProgressBar(sinf((float)ImGui::GetTime()) * 0.5f + 0.5f, ImVec2(ImGui::GetFontSize() * 25, 0.0f)); + ImGui::EndTooltip(); } + ImGui::SeparatorText("Custom"); + + // The following examples are passed for documentation purpose but may not be useful to most users. + // Passing ImGuiHoveredFlags_Tooltip to IsItemHovered() will pull ImGuiHoveredFlags flags values from + // 'style.HoverFlagsForTooltipMouse' or 'style.HoverFlagsForTooltipNav' depending on whether mouse or gamepad/keyboard is being used. + // With default settings, ImGuiHoveredFlags_Tooltip is equivalent to ImGuiHoveredFlags_DelayShort + ImGuiHoveredFlags_Stationary. + ImGui::Button("Manual", sz); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip)) + ImGui::SetTooltip("I am a manually emitted tooltip"); + + ImGui::Button("DelayNone", sz); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNone)) + ImGui::SetTooltip("I am a tooltip with no delay."); + + ImGui::Button("DelayShort", sz); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort | ImGuiHoveredFlags_NoSharedDelay)) + ImGui::SetTooltip("I am a tooltip with a short delay (%0.2f sec).", ImGui::GetStyle().HoverDelayShort); + + ImGui::Button("DelayLong", sz); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_NoSharedDelay)) + ImGui::SetTooltip("I am a tooltip with a long delay (%0.2f sec)", ImGui::GetStyle().HoverDelayNormal); + + ImGui::Button("Stationary", sz); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary)) + ImGui::SetTooltip("I am a tooltip requiring mouse to be stationary before activating."); + ImGui::TreePop(); } @@ -1026,16 +1111,17 @@ static void ShowDemoWindowWidgets() float my_tex_w = (float)io.Fonts->TexWidth; float my_tex_h = (float)io.Fonts->TexHeight; { + static bool use_text_color_for_tint = false; + ImGui::Checkbox("Use Text Color for Tint", &use_text_color_for_tint); ImGui::Text("%.0fx%.0f", my_tex_w, my_tex_h); ImVec2 pos = ImGui::GetCursorScreenPos(); ImVec2 uv_min = ImVec2(0.0f, 0.0f); // Top-left ImVec2 uv_max = ImVec2(1.0f, 1.0f); // Lower-right - ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint - ImVec4 border_col = ImVec4(1.0f, 1.0f, 1.0f, 0.5f); // 50% opaque white + ImVec4 tint_col = use_text_color_for_tint ? ImGui::GetStyleColorVec4(ImGuiCol_Text) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint + ImVec4 border_col = ImGui::GetStyleColorVec4(ImGuiCol_Border); ImGui::Image(my_tex_id, ImVec2(my_tex_w, my_tex_h), uv_min, uv_max, tint_col, border_col); - if (ImGui::IsItemHovered()) + if (ImGui::BeginItemTooltip()) { - ImGui::BeginTooltip(); float region_sz = 32.0f; float region_x = io.MousePos.x - pos.x - region_sz * 0.5f; float region_y = io.MousePos.y - pos.y - region_sz * 0.5f; @@ -1084,6 +1170,7 @@ static void ShowDemoWindowWidgets() IMGUI_DEMO_MARKER("Widgets/Combo"); if (ImGui::TreeNode("Combo")) { + // Combo Boxes are also called "Dropdown" in other systems // Expose flags as checkbox for the demo static ImGuiComboFlags flags = 0; ImGui::CheckboxFlags("ImGuiComboFlags_PopupAlignLeft", &flags, ImGuiComboFlags_PopupAlignLeft); @@ -1187,16 +1274,16 @@ static void ShowDemoWindowWidgets() IMGUI_DEMO_MARKER("Widgets/Selectables/Basic"); if (ImGui::TreeNode("Basic")) { - static bool selection[5] = { false, true, false, false, false }; + static bool selection[5] = { false, true, false, false }; ImGui::Selectable("1. I am selectable", &selection[0]); ImGui::Selectable("2. I am selectable", &selection[1]); - ImGui::Text("(I am not selectable)"); - ImGui::Selectable("4. I am selectable", &selection[3]); - if (ImGui::Selectable("5. I am double clickable", selection[4], ImGuiSelectableFlags_AllowDoubleClick)) + ImGui::Selectable("3. I am selectable", &selection[2]); + if (ImGui::Selectable("4. I am double clickable", selection[3], ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::IsMouseDoubleClicked(0)) - selection[4] = !selection[4]; + selection[3] = !selection[3]; ImGui::TreePop(); } + IMGUI_DEMO_MARKER("Widgets/Selectables/Single Selection"); if (ImGui::TreeNode("Selection State: Single Selection")) { @@ -1228,17 +1315,18 @@ static void ShowDemoWindowWidgets() } ImGui::TreePop(); } - IMGUI_DEMO_MARKER("Widgets/Selectables/Rendering more text into the same line"); - if (ImGui::TreeNode("Rendering more text into the same line")) + IMGUI_DEMO_MARKER("Widgets/Selectables/Rendering more items on the same line"); + if (ImGui::TreeNode("Rendering more items on the same line")) { - // Using the Selectable() override that takes "bool* p_selected" parameter, - // this function toggle your bool value automatically. + // (1) Using SetNextItemAllowOverlap() + // (2) Using the Selectable() override that takes "bool* p_selected" parameter, the bool value is toggled automatically. static bool selected[3] = { false, false, false }; - ImGui::Selectable("main.c", &selected[0]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes"); - ImGui::Selectable("Hello.cpp", &selected[1]); ImGui::SameLine(300); ImGui::Text("12,345 bytes"); - ImGui::Selectable("Hello.h", &selected[2]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes"); + ImGui::SetNextItemAllowOverlap(); ImGui::Selectable("main.c", &selected[0]); ImGui::SameLine(); ImGui::SmallButton("Link 1"); + ImGui::SetNextItemAllowOverlap(); ImGui::Selectable("Hello.cpp", &selected[1]); ImGui::SameLine(); ImGui::SmallButton("Link 2"); + ImGui::SetNextItemAllowOverlap(); ImGui::Selectable("Hello.h", &selected[2]); ImGui::SameLine(); ImGui::SmallButton("Link 3"); ImGui::TreePop(); } + IMGUI_DEMO_MARKER("Widgets/Selectables/In columns"); if (ImGui::TreeNode("In columns")) { @@ -1274,6 +1362,7 @@ static void ShowDemoWindowWidgets() } ImGui::TreePop(); } + IMGUI_DEMO_MARKER("Widgets/Selectables/Grid"); if (ImGui::TreeNode("Grid")) { @@ -1369,7 +1458,15 @@ static void ShowDemoWindowWidgets() { struct TextFilters { - // Return 0 (pass) if the character is 'i' or 'm' or 'g' or 'u' or 'i' + // Modify character input by altering 'data->Eventchar' (ImGuiInputTextFlags_CallbackCharFilter callback) + static int FilterCasingSwap(ImGuiInputTextCallbackData* data) + { + if (data->EventChar >= 'a' && data->EventChar <= 'z') { data->EventChar -= 'a' - 'A'; } // Lowercase becomes uppercase + else if (data->EventChar >= 'A' && data->EventChar <= 'Z') { data->EventChar += 'a' - 'A'; } // Uppercase becomes lowercase + return 0; + } + + // Return 0 (pass) if the character is 'i' or 'm' or 'g' or 'u' or 'i', otherwise return 1 (filter out) static int FilterImGuiLetters(ImGuiInputTextCallbackData* data) { if (data->EventChar < 256 && strchr("imgui", (char)data->EventChar)) @@ -1378,12 +1475,13 @@ static void ShowDemoWindowWidgets() } }; - static char buf1[64] = ""; ImGui::InputText("default", buf1, 64); - static char buf2[64] = ""; ImGui::InputText("decimal", buf2, 64, ImGuiInputTextFlags_CharsDecimal); - static char buf3[64] = ""; ImGui::InputText("hexadecimal", buf3, 64, ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase); - static char buf4[64] = ""; ImGui::InputText("uppercase", buf4, 64, ImGuiInputTextFlags_CharsUppercase); - static char buf5[64] = ""; ImGui::InputText("no blank", buf5, 64, ImGuiInputTextFlags_CharsNoBlank); - static char buf6[64] = ""; ImGui::InputText("\"imgui\" letters", buf6, 64, ImGuiInputTextFlags_CallbackCharFilter, TextFilters::FilterImGuiLetters); + static char buf1[32] = ""; ImGui::InputText("default", buf1, 32); + static char buf2[32] = ""; ImGui::InputText("decimal", buf2, 32, ImGuiInputTextFlags_CharsDecimal); + static char buf3[32] = ""; ImGui::InputText("hexadecimal", buf3, 32, ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase); + static char buf4[32] = ""; ImGui::InputText("uppercase", buf4, 32, ImGuiInputTextFlags_CharsUppercase); + static char buf5[32] = ""; ImGui::InputText("no blank", buf5, 32, ImGuiInputTextFlags_CharsNoBlank); + static char buf6[32] = ""; ImGui::InputText("casing swap", buf6, 32, ImGuiInputTextFlags_CallbackCharFilter, TextFilters::FilterCasingSwap); // Use CharFilter callback to replace characters. + static char buf7[32] = ""; ImGui::InputText("\"imgui\"", buf7, 32, ImGuiInputTextFlags_CallbackCharFilter, TextFilters::FilterImGuiLetters); // Use CharFilter callback to disable some characters. ImGui::TreePop(); } @@ -1398,6 +1496,7 @@ static void ShowDemoWindowWidgets() ImGui::TreePop(); } + IMGUI_DEMO_MARKER("Widgets/Text Input/Completion, History, Edit Callbacks"); if (ImGui::TreeNode("Completion, History, Edit Callbacks")) { struct Funcs @@ -1497,6 +1596,18 @@ static void ShowDemoWindowWidgets() ImGui::TreePop(); } + IMGUI_DEMO_MARKER("Widgets/Text Input/Miscellaneous"); + if (ImGui::TreeNode("Miscellaneous")) + { + static char buf1[16]; + static ImGuiInputTextFlags flags = ImGuiInputTextFlags_EscapeClearsAll; + ImGui::CheckboxFlags("ImGuiInputTextFlags_EscapeClearsAll", &flags, ImGuiInputTextFlags_EscapeClearsAll); + ImGui::CheckboxFlags("ImGuiInputTextFlags_ReadOnly", &flags, ImGuiInputTextFlags_ReadOnly); + ImGui::CheckboxFlags("ImGuiInputTextFlags_NoUndoRedo", &flags, ImGuiInputTextFlags_NoUndoRedo); + ImGui::InputText("Hello", buf1, IM_ARRAYSIZE(buf1), flags); + ImGui::TreePop(); + } + ImGui::TreePop(); } @@ -1688,7 +1799,7 @@ static void ShowDemoWindowWidgets() } // Use functions to generate output - // FIXME: This is rather awkward because current plot API only pass in indices. + // FIXME: This is actually VERY awkward because current plot API only pass in indices. // We probably want an API passing floats and user provide sample rate/count. struct Funcs { @@ -1696,7 +1807,7 @@ static void ShowDemoWindowWidgets() static float Saw(void*, int i) { return (i & 1) ? 1.0f : -1.0f; } }; static int func_type = 0, display_count = 70; - ImGui::Separator(); + ImGui::SeparatorText("Functions"); ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8); ImGui::Combo("func", &func_type, "Sin\0Saw\0"); ImGui::SameLine(); @@ -1739,6 +1850,7 @@ static void ShowDemoWindowWidgets() static bool drag_and_drop = true; static bool options_menu = true; static bool hdr = false; + ImGui::SeparatorText("Options"); ImGui::Checkbox("With Alpha Preview", &alpha_preview); ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview); ImGui::Checkbox("With Drag and Drop", &drag_and_drop); @@ -1747,6 +1859,7 @@ static void ShowDemoWindowWidgets() ImGuiColorEditFlags misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (drag_and_drop ? 0 : ImGuiColorEditFlags_NoDragDrop) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions); IMGUI_DEMO_MARKER("Widgets/Color/ColorEdit"); + ImGui::SeparatorText("Inline color editor"); ImGui::Text("Color widget:"); ImGui::SameLine(); HelpMarker( "Click on the color square to open a color picker.\n" @@ -1844,7 +1957,7 @@ static void ShowDemoWindowWidgets() ImGui::ColorButton("MyColor##3c", *(ImVec4*)&color, misc_flags | (no_border ? ImGuiColorEditFlags_NoBorder : 0), ImVec2(80, 80)); IMGUI_DEMO_MARKER("Widgets/Color/ColorPicker"); - ImGui::Text("Color picker:"); + ImGui::SeparatorText("Color picker"); static bool alpha = true; static bool alpha_bar = true; static bool side_preview = true; @@ -2015,7 +2128,7 @@ static void ShowDemoWindowWidgets() const float drag_speed = 0.2f; static bool drag_clamp = false; IMGUI_DEMO_MARKER("Widgets/Data Types/Drags"); - ImGui::Text("Drags:"); + ImGui::SeparatorText("Drags"); ImGui::Checkbox("Clamp integers to 0..50", &drag_clamp); ImGui::SameLine(); HelpMarker( "As with every widget in dear imgui, we never modify values unless there is a user interaction.\n" @@ -2035,7 +2148,7 @@ static void ShowDemoWindowWidgets() ImGui::DragScalar("drag double log",ImGuiDataType_Double, &f64_v, 0.0005f, &f64_zero, &f64_one, "0 < %.10f < 1", ImGuiSliderFlags_Logarithmic); IMGUI_DEMO_MARKER("Widgets/Data Types/Sliders"); - ImGui::Text("Sliders"); + ImGui::SeparatorText("Sliders"); ImGui::SliderScalar("slider s8 full", ImGuiDataType_S8, &s8_v, &s8_min, &s8_max, "%d"); ImGui::SliderScalar("slider u8 full", ImGuiDataType_U8, &u8_v, &u8_min, &u8_max, "%u"); ImGui::SliderScalar("slider s16 full", ImGuiDataType_S16, &s16_v, &s16_min, &s16_max, "%d"); @@ -2047,12 +2160,12 @@ static void ShowDemoWindowWidgets() ImGui::SliderScalar("slider u32 low", ImGuiDataType_U32, &u32_v, &u32_zero, &u32_fifty,"%u"); ImGui::SliderScalar("slider u32 high", ImGuiDataType_U32, &u32_v, &u32_hi_a, &u32_hi_b, "%u"); ImGui::SliderScalar("slider u32 full", ImGuiDataType_U32, &u32_v, &u32_min, &u32_max, "%u"); - ImGui::SliderScalar("slider s64 low", ImGuiDataType_S64, &s64_v, &s64_zero, &s64_fifty,"%" IM_PRId64); - ImGui::SliderScalar("slider s64 high", ImGuiDataType_S64, &s64_v, &s64_hi_a, &s64_hi_b, "%" IM_PRId64); - ImGui::SliderScalar("slider s64 full", ImGuiDataType_S64, &s64_v, &s64_min, &s64_max, "%" IM_PRId64); - ImGui::SliderScalar("slider u64 low", ImGuiDataType_U64, &u64_v, &u64_zero, &u64_fifty,"%" IM_PRIu64 " ms"); - ImGui::SliderScalar("slider u64 high", ImGuiDataType_U64, &u64_v, &u64_hi_a, &u64_hi_b, "%" IM_PRIu64 " ms"); - ImGui::SliderScalar("slider u64 full", ImGuiDataType_U64, &u64_v, &u64_min, &u64_max, "%" IM_PRIu64 " ms"); + ImGui::SliderScalar("slider s64 low", ImGuiDataType_S64, &s64_v, &s64_zero, &s64_fifty,"%" PRId64); + ImGui::SliderScalar("slider s64 high", ImGuiDataType_S64, &s64_v, &s64_hi_a, &s64_hi_b, "%" PRId64); + ImGui::SliderScalar("slider s64 full", ImGuiDataType_S64, &s64_v, &s64_min, &s64_max, "%" PRId64); + ImGui::SliderScalar("slider u64 low", ImGuiDataType_U64, &u64_v, &u64_zero, &u64_fifty,"%" PRIu64 " ms"); + ImGui::SliderScalar("slider u64 high", ImGuiDataType_U64, &u64_v, &u64_hi_a, &u64_hi_b, "%" PRIu64 " ms"); + ImGui::SliderScalar("slider u64 full", ImGuiDataType_U64, &u64_v, &u64_min, &u64_max, "%" PRIu64 " ms"); ImGui::SliderScalar("slider float low", ImGuiDataType_Float, &f32_v, &f32_zero, &f32_one); ImGui::SliderScalar("slider float low log", ImGuiDataType_Float, &f32_v, &f32_zero, &f32_one, "%.10f", ImGuiSliderFlags_Logarithmic); ImGui::SliderScalar("slider float high", ImGuiDataType_Float, &f32_v, &f32_lo_a, &f32_hi_a, "%e"); @@ -2060,17 +2173,17 @@ static void ShowDemoWindowWidgets() ImGui::SliderScalar("slider double low log",ImGuiDataType_Double, &f64_v, &f64_zero, &f64_one, "%.10f", ImGuiSliderFlags_Logarithmic); ImGui::SliderScalar("slider double high", ImGuiDataType_Double, &f64_v, &f64_lo_a, &f64_hi_a, "%e grams"); - ImGui::Text("Sliders (reverse)"); + ImGui::SeparatorText("Sliders (reverse)"); ImGui::SliderScalar("slider s8 reverse", ImGuiDataType_S8, &s8_v, &s8_max, &s8_min, "%d"); ImGui::SliderScalar("slider u8 reverse", ImGuiDataType_U8, &u8_v, &u8_max, &u8_min, "%u"); ImGui::SliderScalar("slider s32 reverse", ImGuiDataType_S32, &s32_v, &s32_fifty, &s32_zero, "%d"); ImGui::SliderScalar("slider u32 reverse", ImGuiDataType_U32, &u32_v, &u32_fifty, &u32_zero, "%u"); - ImGui::SliderScalar("slider s64 reverse", ImGuiDataType_S64, &s64_v, &s64_fifty, &s64_zero, "%" IM_PRId64); - ImGui::SliderScalar("slider u64 reverse", ImGuiDataType_U64, &u64_v, &u64_fifty, &u64_zero, "%" IM_PRIu64 " ms"); + ImGui::SliderScalar("slider s64 reverse", ImGuiDataType_S64, &s64_v, &s64_fifty, &s64_zero, "%" PRId64); + ImGui::SliderScalar("slider u64 reverse", ImGuiDataType_U64, &u64_v, &u64_fifty, &u64_zero, "%" PRIu64 " ms"); IMGUI_DEMO_MARKER("Widgets/Data Types/Inputs"); static bool inputs_step = true; - ImGui::Text("Inputs"); + ImGui::SeparatorText("Inputs"); ImGui::Checkbox("Show step buttons", &inputs_step); ImGui::InputScalar("input s8", ImGuiDataType_S8, &s8_v, inputs_step ? &s8_one : NULL, NULL, "%d"); ImGui::InputScalar("input u8", ImGuiDataType_U8, &u8_v, inputs_step ? &u8_one : NULL, NULL, "%u"); @@ -2094,22 +2207,23 @@ static void ShowDemoWindowWidgets() static float vec4f[4] = { 0.10f, 0.20f, 0.30f, 0.44f }; static int vec4i[4] = { 1, 5, 100, 255 }; + ImGui::SeparatorText("2-wide"); ImGui::InputFloat2("input float2", vec4f); ImGui::DragFloat2("drag float2", vec4f, 0.01f, 0.0f, 1.0f); ImGui::SliderFloat2("slider float2", vec4f, 0.0f, 1.0f); ImGui::InputInt2("input int2", vec4i); ImGui::DragInt2("drag int2", vec4i, 1, 0, 255); ImGui::SliderInt2("slider int2", vec4i, 0, 255); - ImGui::Spacing(); + ImGui::SeparatorText("3-wide"); ImGui::InputFloat3("input float3", vec4f); ImGui::DragFloat3("drag float3", vec4f, 0.01f, 0.0f, 1.0f); ImGui::SliderFloat3("slider float3", vec4f, 0.0f, 1.0f); ImGui::InputInt3("input int3", vec4i); ImGui::DragInt3("drag int3", vec4i, 1, 0, 255); ImGui::SliderInt3("slider int3", vec4i, 0, 255); - ImGui::Spacing(); + ImGui::SeparatorText("4-wide"); ImGui::InputFloat4("input float4", vec4f); ImGui::DragFloat4("drag float4", vec4f, 0.01f, 0.0f, 1.0f); ImGui::SliderFloat4("slider float4", vec4f, 0.0f, 1.0f); @@ -2342,8 +2456,10 @@ static void ShowDemoWindowWidgets() if (item_type == 15){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); } bool hovered_delay_none = ImGui::IsItemHovered(); + bool hovered_delay_stationary = ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary); bool hovered_delay_short = ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort); bool hovered_delay_normal = ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal); + bool hovered_delay_tooltip = ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip); // = Normal + Stationary // Display the values of IsItemHovered() and other common item state functions. // Note that the ImGuiHoveredFlags_XXX flags can be combined. @@ -2355,7 +2471,8 @@ static void ShowDemoWindowWidgets() "IsItemHovered() = %d\n" "IsItemHovered(_AllowWhenBlockedByPopup) = %d\n" "IsItemHovered(_AllowWhenBlockedByActiveItem) = %d\n" - "IsItemHovered(_AllowWhenOverlapped) = %d\n" + "IsItemHovered(_AllowWhenOverlappedByItem) = %d\n" + "IsItemHovered(_AllowWhenOverlappedByWindow) = %d\n" "IsItemHovered(_AllowWhenDisabled) = %d\n" "IsItemHovered(_RectOnly) = %d\n" "IsItemActive() = %d\n" @@ -2374,7 +2491,8 @@ static void ShowDemoWindowWidgets() ImGui::IsItemHovered(), ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup), ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem), - ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlapped), + ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlappedByItem), + ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlappedByWindow), ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled), ImGui::IsItemHovered(ImGuiHoveredFlags_RectOnly), ImGui::IsItemActive(), @@ -2390,7 +2508,13 @@ static void ShowDemoWindowWidgets() ImGui::GetItemRectSize().x, ImGui::GetItemRectSize().y ); ImGui::BulletText( - "w/ Hovering Delay: None = %d, Fast %d, Normal = %d", hovered_delay_none, hovered_delay_short, hovered_delay_normal); + "with Hovering Delay or Stationary test:\n" + "IsItemHovered() = = %d\n" + "IsItemHovered(_Stationary) = %d\n" + "IsItemHovered(_DelayShort) = %d\n" + "IsItemHovered(_DelayNormal) = %d\n" + "IsItemHovered(_Tooltip) = %d", + hovered_delay_none, hovered_delay_stationary, hovered_delay_short, hovered_delay_normal, hovered_delay_tooltip); if (item_disabled) ImGui::EndDisabled(); @@ -2442,7 +2566,8 @@ static void ShowDemoWindowWidgets() "IsWindowHovered(_RootWindow) = %d\n" "IsWindowHovered(_RootWindow|_NoPopupHierarchy) = %d\n" "IsWindowHovered(_ChildWindows|_AllowWhenBlockedByPopup) = %d\n" - "IsWindowHovered(_AnyWindow) = %d\n", + "IsWindowHovered(_AnyWindow) = %d\n" + "IsWindowHovered(_Stationary) = %d\n", ImGui::IsWindowHovered(), ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup), ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem), @@ -2453,7 +2578,8 @@ static void ShowDemoWindowWidgets() ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow), ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_NoPopupHierarchy), ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_AllowWhenBlockedByPopup), - ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow)); + ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow), + ImGui::IsWindowHovered(ImGuiHoveredFlags_Stationary)); ImGui::BeginChild("child", ImVec2(0, 50), true); ImGui::Text("This is another child window for testing the _ChildWindows flag."); @@ -2526,6 +2652,8 @@ static void ShowDemoWindowLayout() IMGUI_DEMO_MARKER("Layout/Child windows"); if (ImGui::TreeNode("Child windows")) { + ImGui::SeparatorText("Child windows"); + HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window."); static bool disable_mouse_wheel = false; static bool disable_menu = false; @@ -2578,7 +2706,7 @@ static void ShowDemoWindowLayout() ImGui::PopStyleVar(); } - ImGui::Separator(); + ImGui::SeparatorText("Misc/Advanced"); // Demonstrate a few extra things // - Changing ImGuiCol_ChildBg (which is transparent black in default styles) @@ -2694,11 +2822,11 @@ static void ShowDemoWindowLayout() // Text IMGUI_DEMO_MARKER("Layout/Basic Horizontal Layout/SameLine"); ImGui::Text("Two items: Hello"); ImGui::SameLine(); - ImGui::TextColored(ImVec4(1,1,0,1), "Sailor"); + ImGui::TextColored(ImVec4(1, 1, 0, 1), "Sailor"); // Adjust spacing ImGui::Text("More spacing: Hello"); ImGui::SameLine(0, 20); - ImGui::TextColored(ImVec4(1,1,0,1), "Sailor"); + ImGui::TextColored(ImVec4(1, 1, 0, 1), "Sailor"); // Button ImGui::AlignTextToFramePadding(); @@ -2749,7 +2877,7 @@ static void ShowDemoWindowLayout() ImGui::PushID(i); ImGui::ListBox("", &selection[i], items, IM_ARRAYSIZE(items)); ImGui::PopID(); - //if (ImGui::IsItemHovered()) ImGui::SetTooltip("ListBox %d hovered", i); + //ImGui::SetItemTooltip("ListBox %d hovered", i); } ImGui::PopItemWidth(); @@ -2802,8 +2930,7 @@ static void ShowDemoWindowLayout() ImGui::SameLine(); ImGui::Button("EEE"); ImGui::EndGroup(); - if (ImGui::IsItemHovered()) - ImGui::SetTooltip("First group hovered"); + ImGui::SetItemTooltip("First group hovered"); } // Capture the group size and create widgets using the same size ImVec2 size = ImGui::GetItemRectSize(); @@ -3297,6 +3424,36 @@ static void ShowDemoWindowLayout() ImGui::TreePop(); } + + IMGUI_DEMO_MARKER("Layout/Overlap Mode"); + if (ImGui::TreeNode("Overlap Mode")) + { + static bool enable_allow_overlap = true; + + HelpMarker( + "Hit-testing is by default performed in item submission order, which generally is perceived as 'back-to-front'.\n\n" + "By using SetNextItemAllowOverlap() you can notify that an item may be overlapped by another. Doing so alters the hovering logic: items using AllowOverlap mode requires an extra frame to accept hovered state."); + ImGui::Checkbox("Enable AllowOverlap", &enable_allow_overlap); + + ImVec2 button1_pos = ImGui::GetCursorScreenPos(); + ImVec2 button2_pos = ImVec2(button1_pos.x + 50.0f, button1_pos.y + 50.0f); + if (enable_allow_overlap) + ImGui::SetNextItemAllowOverlap(); + ImGui::Button("Button 1", ImVec2(80, 80)); + ImGui::SetCursorScreenPos(button2_pos); + ImGui::Button("Button 2", ImVec2(80, 80)); + + // This is typically used with width-spanning items. + // (note that Selectable() has a dedicated flag ImGuiSelectableFlags_AllowOverlap, which is a shortcut + // for using SetNextItemAllowOverlap(). For demo purpose we use SetNextItemAllowOverlap() here.) + if (enable_allow_overlap) + ImGui::SetNextItemAllowOverlap(); + ImGui::Selectable("Some Selectable", false); + ImGui::SameLine(); + ImGui::SmallButton("++"); + + ImGui::TreePop(); + } } static void ShowDemoWindowPopups() @@ -3342,8 +3499,7 @@ static void ShowDemoWindowPopups() ImGui::TextUnformatted(selected_fish == -1 ? "" : names[selected_fish]); if (ImGui::BeginPopup("my_select_popup")) { - ImGui::Text("Aquarium"); - ImGui::Separator(); + ImGui::SeparatorText("Aquarium"); for (int i = 0; i < IM_ARRAYSIZE(names); i++) if (ImGui::Selectable(names[i])) selected_fish = i; @@ -3365,8 +3521,7 @@ static void ShowDemoWindowPopups() ImGui::Separator(); ImGui::Text("Tooltip here"); - if (ImGui::IsItemHovered()) - ImGui::SetTooltip("I am a tooltip over a popup"); + ImGui::SetItemTooltip("I am a tooltip over a popup"); if (ImGui::Button("Stacked Popup")) ImGui::OpenPopup("another popup"); @@ -3437,18 +3592,20 @@ static void ShowDemoWindowPopups() // and BeginPopupContextItem() will use the last item ID as the popup ID. { const char* names[5] = { "Label1", "Label2", "Label3", "Label4", "Label5" }; + static int selected = -1; for (int n = 0; n < 5; n++) { - ImGui::Selectable(names[n]); + if (ImGui::Selectable(names[n], selected == n)) + selected = n; if (ImGui::BeginPopupContextItem()) // <-- use last item id as popup id { + selected = n; ImGui::Text("This a popup for \"%s\"!", names[n]); if (ImGui::Button("Close")) ImGui::CloseCurrentPopup(); ImGui::EndPopup(); } - if (ImGui::IsItemHovered()) - ImGui::SetTooltip("Right-click to open popup"); + ImGui::SetItemTooltip("Right-click to open popup"); } } @@ -3517,7 +3674,7 @@ static void ShowDemoWindowPopups() if (ImGui::BeginPopupModal("Delete?", NULL, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::Text("All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n"); + ImGui::Text("All those beautiful files will be deleted.\nThis operation cannot be undone!"); ImGui::Separator(); //static int unused_i = 0; @@ -3628,6 +3785,14 @@ struct MyItem // very often by the sorting algorithm it would be a little wasteful. static const ImGuiTableSortSpecs* s_current_sort_specs; + static void SortWithSortSpecs(ImGuiTableSortSpecs* sort_specs, MyItem* items, int items_count) + { + s_current_sort_specs = sort_specs; // Store in variable accessible by the sort function. + if (items_count > 1) + qsort(items, (size_t)items_count, sizeof(items[0]), MyItem::CompareWithSortSpecs); + s_current_sort_specs = NULL; + } + // Compare function to be used by qsort() static int IMGUI_CDECL CompareWithSortSpecs(const void* lhs, const void* rhs) { @@ -3700,9 +3865,8 @@ static void EditTableSizingFlags(ImGuiTableFlags* p_flags) } ImGui::SameLine(); ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered()) + if (ImGui::BeginItemTooltip()) { - ImGui::BeginTooltip(); ImGui::PushTextWrapPos(ImGui::GetFontSize() * 50.0f); for (int m = 0; m < IM_ARRAYSIZE(policies); m++) { @@ -4624,9 +4788,9 @@ static void ShowDemoWindowTables() if (ImGui::TreeNode("Row height")) { HelpMarker("You can pass a 'min_row_height' to TableNextRow().\n\nRows are padded with 'style.CellPadding.y' on top and bottom, so effectively the minimum row height will always be >= 'style.CellPadding.y * 2.0f'.\n\nWe cannot honor a _maximum_ row height as that would require a unique clipping rectangle per row."); - if (ImGui::BeginTable("table_row_height", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInnerV)) + if (ImGui::BeginTable("table_row_height", 1, ImGuiTableFlags_Borders)) { - for (int row = 0; row < 10; row++) + for (int row = 0; row < 8; row++) { float min_row_height = (float)(int)(TEXT_BASE_HEIGHT * 0.30f * row); ImGui::TableNextRow(ImGuiTableRowFlags_None, min_row_height); @@ -4635,6 +4799,45 @@ static void ShowDemoWindowTables() } ImGui::EndTable(); } + + HelpMarker("Showcase using SameLine(0,0) to share Current Line Height between cells.\n\nPlease note that Tables Row Height is not the same thing as Current Line Height, as a table cell may contains multiple lines."); + if (ImGui::BeginTable("table_share_lineheight", 2, ImGuiTableFlags_Borders)) + { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::ColorButton("##1", ImVec4(0.13f, 0.26f, 0.40f, 1.0f), ImGuiColorEditFlags_None, ImVec2(40, 40)); + ImGui::TableNextColumn(); + ImGui::Text("Line 1"); + ImGui::Text("Line 2"); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::ColorButton("##2", ImVec4(0.13f, 0.26f, 0.40f, 1.0f), ImGuiColorEditFlags_None, ImVec2(40, 40)); + ImGui::TableNextColumn(); + ImGui::SameLine(0.0f, 0.0f); // Reuse line height from previous column + ImGui::Text("Line 1, with SameLine(0,0)"); + ImGui::Text("Line 2"); + + ImGui::EndTable(); + } + + HelpMarker("Showcase altering CellPadding.y between rows. Note that CellPadding.x is locked for the entire table."); + if (ImGui::BeginTable("table_changing_cellpadding_y", 1, ImGuiTableFlags_Borders)) + { + ImGuiStyle& style = ImGui::GetStyle(); + for (int row = 0; row < 8; row++) + { + if ((row % 3) == 2) + ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(style.CellPadding.x, 20.0f)); + ImGui::TableNextRow(ImGuiTableRowFlags_None); + ImGui::TableNextColumn(); + ImGui::Text("CellPadding.y = %.2f", style.CellPadding.y); + if ((row % 3) == 2) + ImGui::PopStyleVar(); + } + ImGui::EndTable(); + } + ImGui::TreePop(); } @@ -5042,18 +5245,23 @@ static void ShowDemoWindowTables() if (ImGui::TreeNode("Synced instances")) { HelpMarker("Multiple tables with the same identifier will share their settings, width, visibility, order etc."); + + static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoSavedSettings; + ImGui::CheckboxFlags("ImGuiTableFlags_ScrollY", &flags, ImGuiTableFlags_ScrollY); + ImGui::CheckboxFlags("ImGuiTableFlags_SizingFixedFit", &flags, ImGuiTableFlags_SizingFixedFit); for (int n = 0; n < 3; n++) { char buf[32]; sprintf(buf, "Synced Table %d", n); bool open = ImGui::CollapsingHeader(buf, ImGuiTreeNodeFlags_DefaultOpen); - if (open && ImGui::BeginTable("Table", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoSavedSettings)) + if (open && ImGui::BeginTable("Table", 3, flags, ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 5))) { ImGui::TableSetupColumn("One"); ImGui::TableSetupColumn("Two"); ImGui::TableSetupColumn("Three"); ImGui::TableHeadersRow(); - for (int cell = 0; cell < 9; cell++) + const int cell_count = (n == 1) ? 27 : 9; // Make second table have a scrollbar to verify that additional decoration is not affecting column positions. + for (int cell = 0; cell < cell_count; cell++) { ImGui::TableNextColumn(); ImGui::Text("this cell %d", cell); @@ -5121,14 +5329,11 @@ static void ShowDemoWindowTables() ImGui::TableHeadersRow(); // Sort our data if sort specs have been changed! - if (ImGuiTableSortSpecs* sorts_specs = ImGui::TableGetSortSpecs()) - if (sorts_specs->SpecsDirty) + if (ImGuiTableSortSpecs* sort_specs = ImGui::TableGetSortSpecs()) + if (sort_specs->SpecsDirty) { - MyItem::s_current_sort_specs = sorts_specs; // Store in variable accessible by the sort function. - if (items.Size > 1) - qsort(&items[0], (size_t)items.Size, sizeof(items[0]), MyItem::CompareWithSortSpecs); - MyItem::s_current_sort_specs = NULL; - sorts_specs->SpecsDirty = false; + MyItem::SortWithSortSpecs(sort_specs, items.Data, items.Size); + sort_specs->SpecsDirty = false; } // Demonstrate using clipper for large vertical lists @@ -5336,15 +5541,13 @@ static void ShowDemoWindowTables() ImGui::TableSetupScrollFreeze(freeze_cols, freeze_rows); // Sort our data if sort specs have been changed! - ImGuiTableSortSpecs* sorts_specs = ImGui::TableGetSortSpecs(); - if (sorts_specs && sorts_specs->SpecsDirty) + ImGuiTableSortSpecs* sort_specs = ImGui::TableGetSortSpecs(); + if (sort_specs && sort_specs->SpecsDirty) items_need_sort = true; - if (sorts_specs && items_need_sort && items.Size > 1) + if (sort_specs && items_need_sort && items.Size > 1) { - MyItem::s_current_sort_specs = sorts_specs; // Store in variable accessible by the sort function. - qsort(&items[0], (size_t)items.Size, sizeof(items[0]), MyItem::CompareWithSortSpecs); - MyItem::s_current_sort_specs = NULL; - sorts_specs->SpecsDirty = false; + MyItem::SortWithSortSpecs(sort_specs, items.Data, items.Size); + sort_specs->SpecsDirty = false; } items_need_sort = false; @@ -5394,7 +5597,7 @@ static void ShowDemoWindowTables() ImGui::Button(label, ImVec2(-FLT_MIN, 0.0f)); else if (contents_type == CT_Selectable || contents_type == CT_SelectableSpanRow) { - ImGuiSelectableFlags selectable_flags = (contents_type == CT_SelectableSpanRow) ? ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap : ImGuiSelectableFlags_None; + ImGuiSelectableFlags selectable_flags = (contents_type == CT_SelectableSpanRow) ? ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap : ImGuiSelectableFlags_None; if (ImGui::Selectable(label, item_is_selected, selectable_flags, ImVec2(0, row_min_height))) { if (ImGui::GetIO().KeyCtrl) @@ -5681,50 +5884,93 @@ static void ShowDemoWindowColumns() ImGui::TreePop(); } -namespace ImGui { extern ImGuiKeyData* GetKeyData(ImGuiKey key); } - static void ShowDemoWindowInputs() { - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus"); - if (ImGui::CollapsingHeader("Inputs, Navigation & Focus")) + IMGUI_DEMO_MARKER("Inputs & Focus"); + if (ImGui::CollapsingHeader("Inputs & Focus")) { ImGuiIO& io = ImGui::GetIO(); + // Display inputs submitted to ImGuiIO + IMGUI_DEMO_MARKER("Inputs & Focus/Inputs"); + ImGui::SetNextItemOpen(true, ImGuiCond_Once); + if (ImGui::TreeNode("Inputs")) + { + HelpMarker( + "This is a simplified view. See more detailed input state:\n" + "- in 'Tools->Metrics/Debugger->Inputs'.\n" + "- in 'Tools->Debug Log->IO'."); + if (ImGui::IsMousePosValid()) + ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y); + else + ImGui::Text("Mouse pos: "); + ImGui::Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y); + ImGui::Text("Mouse down:"); + for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDown(i)) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); } + ImGui::Text("Mouse wheel: %.1f", io.MouseWheel); + + // We iterate both legacy native range and named ImGuiKey ranges, which is a little odd but this allows displaying the data for old/new backends. + // User code should never have to go through such hoops! You can generally iterate between ImGuiKey_NamedKey_BEGIN and ImGuiKey_NamedKey_END. +#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO + struct funcs { static bool IsLegacyNativeDupe(ImGuiKey) { return false; } }; + ImGuiKey start_key = ImGuiKey_NamedKey_BEGIN; +#else + struct funcs { static bool IsLegacyNativeDupe(ImGuiKey key) { return key < 512 && ImGui::GetIO().KeyMap[key] != -1; } }; // Hide Native<>ImGuiKey duplicates when both exists in the array + ImGuiKey start_key = (ImGuiKey)0; +#endif + ImGui::Text("Keys down:"); for (ImGuiKey key = start_key; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key) || !ImGui::IsKeyDown(key)) continue; ImGui::SameLine(); ImGui::Text((key < ImGuiKey_NamedKey_BEGIN) ? "\"%s\"" : "\"%s\" %d", ImGui::GetKeyName(key), key); } + ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : ""); + ImGui::Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine(); ImGui::Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public. + + ImGui::TreePop(); + } + // Display ImGuiIO output flags - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Output"); + IMGUI_DEMO_MARKER("Inputs & Focus/Outputs"); ImGui::SetNextItemOpen(true, ImGuiCond_Once); - if (ImGui::TreeNode("Output")) + if (ImGui::TreeNode("Outputs")) { + HelpMarker( + "The value of io.WantCaptureMouse and io.WantCaptureKeyboard are normally set by Dear ImGui " + "to instruct your application of how to route inputs. Typically, when a value is true, it means " + "Dear ImGui wants the corresponding inputs and we expect the underlying application to ignore them.\n\n" + "The most typical case is: when hovering a window, Dear ImGui set io.WantCaptureMouse to true, " + "and underlying application should ignore mouse inputs (in practice there are many and more subtle " + "rules leading to how those flags are set)."); ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse); ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose); ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard); ImGui::Text("io.WantTextInput: %d", io.WantTextInput); ImGui::Text("io.WantSetMousePos: %d", io.WantSetMousePos); ImGui::Text("io.NavActive: %d, io.NavVisible: %d", io.NavActive, io.NavVisible); - ImGui::TreePop(); - } - // Display Mouse state - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse State"); - if (ImGui::TreeNode("Mouse State")) - { - if (ImGui::IsMousePosValid()) - ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y); - else - ImGui::Text("Mouse pos: "); - ImGui::Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y); + IMGUI_DEMO_MARKER("Inputs & Focus/Outputs/WantCapture override"); + if (ImGui::TreeNode("WantCapture override")) + { + HelpMarker( + "Hovering the colored canvas will override io.WantCaptureXXX fields.\n" + "Notice how normally (when set to none), the value of io.WantCaptureKeyboard would be false when hovering and true when clicking."); + static int capture_override_mouse = -1; + static int capture_override_keyboard = -1; + const char* capture_override_desc[] = { "None", "Set to false", "Set to true" }; + ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15); + ImGui::SliderInt("SetNextFrameWantCaptureMouse() on hover", &capture_override_mouse, -1, +1, capture_override_desc[capture_override_mouse + 1], ImGuiSliderFlags_AlwaysClamp); + ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15); + ImGui::SliderInt("SetNextFrameWantCaptureKeyboard() on hover", &capture_override_keyboard, -1, +1, capture_override_desc[capture_override_keyboard + 1], ImGuiSliderFlags_AlwaysClamp); + + ImGui::ColorButton("##panel", ImVec4(0.7f, 0.1f, 0.7f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, ImVec2(128.0f, 96.0f)); // Dummy item + if (ImGui::IsItemHovered() && capture_override_mouse != -1) + ImGui::SetNextFrameWantCaptureMouse(capture_override_mouse == 1); + if (ImGui::IsItemHovered() && capture_override_keyboard != -1) + ImGui::SetNextFrameWantCaptureKeyboard(capture_override_keyboard == 1); - int count = IM_ARRAYSIZE(io.MouseDown); - ImGui::Text("Mouse down:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseDown(i)) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); } - ImGui::Text("Mouse clicked:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d (%d)", i, ImGui::GetMouseClickedCount(i)); } - ImGui::Text("Mouse released:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseReleased(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); } - ImGui::Text("Mouse wheel: %.1f", io.MouseWheel); - ImGui::Text("Pen Pressure: %.1f", io.PenPressure); // Note: currently unused + ImGui::TreePop(); + } ImGui::TreePop(); } // Display mouse cursors - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse Cursors"); + IMGUI_DEMO_MARKER("Inputs & Focus/Mouse Cursors"); if (ImGui::TreeNode("Mouse Cursors")) { const char* mouse_cursors_names[] = { "Arrow", "TextInput", "ResizeAll", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand", "NotAllowed" }; @@ -5752,113 +5998,7 @@ static void ShowDemoWindowInputs() ImGui::TreePop(); } - // Display Keyboard/Mouse state - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Keyboard, Gamepad & Navigation State"); - if (ImGui::TreeNode("Keyboard, Gamepad & Navigation State")) - { - // We iterate both legacy native range and named ImGuiKey ranges, which is a little odd but this allows displaying the data for old/new backends. - // User code should never have to go through such hoops: old code may use native keycodes, new code may use ImGuiKey codes. -#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO - struct funcs { static bool IsLegacyNativeDupe(ImGuiKey) { return false; } }; - const ImGuiKey key_first = (ImGuiKey)ImGuiKey_NamedKey_BEGIN; -#else - struct funcs { static bool IsLegacyNativeDupe(ImGuiKey key) { return key < 512 && ImGui::GetIO().KeyMap[key] != -1; } }; // Hide Native<>ImGuiKey duplicates when both exists in the array - const ImGuiKey key_first = (ImGuiKey)0; - //ImGui::Text("Legacy raw:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key++) { if (io.KeysDown[key]) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } } -#endif - ImGui::Text("Keys down:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyDown(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d (%.02f secs)", ImGui::GetKeyName(key), key, ImGui::GetKeyData(key)->DownDuration); } } - ImGui::Text("Keys pressed:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyPressed(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } } - ImGui::Text("Keys released:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyReleased(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } } - ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : ""); - ImGui::Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine(); ImGui::Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public. - - // Draw an arbitrary US keyboard layout to visualize translated keys - { - const ImVec2 key_size = ImVec2(35.0f, 35.0f); - const float key_rounding = 3.0f; - const ImVec2 key_face_size = ImVec2(25.0f, 25.0f); - const ImVec2 key_face_pos = ImVec2(5.0f, 3.0f); - const float key_face_rounding = 2.0f; - const ImVec2 key_label_pos = ImVec2(7.0f, 4.0f); - const ImVec2 key_step = ImVec2(key_size.x - 1.0f, key_size.y - 1.0f); - const float key_row_offset = 9.0f; - - ImVec2 board_min = ImGui::GetCursorScreenPos(); - ImVec2 board_max = ImVec2(board_min.x + 3 * key_step.x + 2 * key_row_offset + 10.0f, board_min.y + 3 * key_step.y + 10.0f); - ImVec2 start_pos = ImVec2(board_min.x + 5.0f - key_step.x, board_min.y); - - struct KeyLayoutData { int Row, Col; const char* Label; ImGuiKey Key; }; - const KeyLayoutData keys_to_display[] = - { - { 0, 0, "", ImGuiKey_Tab }, { 0, 1, "Q", ImGuiKey_Q }, { 0, 2, "W", ImGuiKey_W }, { 0, 3, "E", ImGuiKey_E }, { 0, 4, "R", ImGuiKey_R }, - { 1, 0, "", ImGuiKey_CapsLock }, { 1, 1, "A", ImGuiKey_A }, { 1, 2, "S", ImGuiKey_S }, { 1, 3, "D", ImGuiKey_D }, { 1, 4, "F", ImGuiKey_F }, - { 2, 0, "", ImGuiKey_LeftShift },{ 2, 1, "Z", ImGuiKey_Z }, { 2, 2, "X", ImGuiKey_X }, { 2, 3, "C", ImGuiKey_C }, { 2, 4, "V", ImGuiKey_V } - }; - - // Elements rendered manually via ImDrawList API are not clipped automatically. - // While not strictly necessary, here IsItemVisible() is used to avoid rendering these shapes when they are out of view. - ImGui::Dummy(ImVec2(board_max.x - board_min.x, board_max.y - board_min.y)); - if (ImGui::IsItemVisible()) - { - ImDrawList* draw_list = ImGui::GetWindowDrawList(); - draw_list->PushClipRect(board_min, board_max, true); - for (int n = 0; n < IM_ARRAYSIZE(keys_to_display); n++) - { - const KeyLayoutData* key_data = &keys_to_display[n]; - ImVec2 key_min = ImVec2(start_pos.x + key_data->Col * key_step.x + key_data->Row * key_row_offset, start_pos.y + key_data->Row * key_step.y); - ImVec2 key_max = ImVec2(key_min.x + key_size.x, key_min.y + key_size.y); - draw_list->AddRectFilled(key_min, key_max, IM_COL32(204, 204, 204, 255), key_rounding); - draw_list->AddRect(key_min, key_max, IM_COL32(24, 24, 24, 255), key_rounding); - ImVec2 face_min = ImVec2(key_min.x + key_face_pos.x, key_min.y + key_face_pos.y); - ImVec2 face_max = ImVec2(face_min.x + key_face_size.x, face_min.y + key_face_size.y); - draw_list->AddRect(face_min, face_max, IM_COL32(193, 193, 193, 255), key_face_rounding, ImDrawFlags_None, 2.0f); - draw_list->AddRectFilled(face_min, face_max, IM_COL32(252, 252, 252, 255), key_face_rounding); - ImVec2 label_min = ImVec2(key_min.x + key_label_pos.x, key_min.y + key_label_pos.y); - draw_list->AddText(label_min, IM_COL32(64, 64, 64, 255), key_data->Label); - if (ImGui::IsKeyDown(key_data->Key)) - draw_list->AddRectFilled(key_min, key_max, IM_COL32(255, 0, 0, 128), key_rounding); - } - draw_list->PopClipRect(); - } - } - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Capture override")) - { - HelpMarker( - "The value of io.WantCaptureMouse and io.WantCaptureKeyboard are normally set by Dear ImGui " - "to instruct your application of how to route inputs. Typically, when a value is true, it means " - "Dear ImGui wants the corresponding inputs and we expect the underlying application to ignore them.\n\n" - "The most typical case is: when hovering a window, Dear ImGui set io.WantCaptureMouse to true, " - "and underlying application should ignore mouse inputs (in practice there are many and more subtle " - "rules leading to how those flags are set)."); - - ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse); - ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose); - ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard); - - HelpMarker( - "Hovering the colored canvas will override io.WantCaptureXXX fields.\n" - "Notice how normally (when set to none), the value of io.WantCaptureKeyboard would be false when hovering and true when clicking."); - static int capture_override_mouse = -1; - static int capture_override_keyboard = -1; - const char* capture_override_desc[] = { "None", "Set to false", "Set to true" }; - ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15); - ImGui::SliderInt("SetNextFrameWantCaptureMouse()", &capture_override_mouse, -1, +1, capture_override_desc[capture_override_mouse + 1], ImGuiSliderFlags_AlwaysClamp); - ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15); - ImGui::SliderInt("SetNextFrameWantCaptureKeyboard()", &capture_override_keyboard, -1, +1, capture_override_desc[capture_override_keyboard + 1], ImGuiSliderFlags_AlwaysClamp); - - ImGui::ColorButton("##panel", ImVec4(0.7f, 0.1f, 0.7f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, ImVec2(256.0f, 192.0f)); // Dummy item - if (ImGui::IsItemHovered() && capture_override_mouse != -1) - ImGui::SetNextFrameWantCaptureMouse(capture_override_mouse == 1); - if (ImGui::IsItemHovered() && capture_override_keyboard != -1) - ImGui::SetNextFrameWantCaptureKeyboard(capture_override_keyboard == 1); - - ImGui::TreePop(); - } - - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Tabbing"); + IMGUI_DEMO_MARKER("Inputs & Focus/Tabbing"); if (ImGui::TreeNode("Tabbing")) { ImGui::Text("Use TAB/SHIFT+TAB to cycle through keyboard editable fields."); @@ -5866,15 +6006,15 @@ static void ShowDemoWindowInputs() ImGui::InputText("1", buf, IM_ARRAYSIZE(buf)); ImGui::InputText("2", buf, IM_ARRAYSIZE(buf)); ImGui::InputText("3", buf, IM_ARRAYSIZE(buf)); - ImGui::PushAllowKeyboardFocus(false); + ImGui::PushTabStop(false); ImGui::InputText("4 (tab skip)", buf, IM_ARRAYSIZE(buf)); ImGui::SameLine(); HelpMarker("Item won't be cycled through when using TAB or Shift+Tab."); - ImGui::PopAllowKeyboardFocus(); + ImGui::PopTabStop(); ImGui::InputText("5", buf, IM_ARRAYSIZE(buf)); ImGui::TreePop(); } - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Focus from code"); + IMGUI_DEMO_MARKER("Inputs & Focus/Focus from code"); if (ImGui::TreeNode("Focus from code")) { bool focus_1 = ImGui::Button("Focus on 1"); ImGui::SameLine(); @@ -5891,12 +6031,12 @@ static void ShowDemoWindowInputs() ImGui::InputText("2", buf, IM_ARRAYSIZE(buf)); if (ImGui::IsItemActive()) has_focus = 2; - ImGui::PushAllowKeyboardFocus(false); + ImGui::PushTabStop(false); if (focus_3) ImGui::SetKeyboardFocusHere(); ImGui::InputText("3 (tab skip)", buf, IM_ARRAYSIZE(buf)); if (ImGui::IsItemActive()) has_focus = 3; ImGui::SameLine(); HelpMarker("Item won't be cycled through when using TAB or Shift+Tab."); - ImGui::PopAllowKeyboardFocus(); + ImGui::PopTabStop(); if (has_focus) ImGui::Text("Item with focus: %d", has_focus); @@ -5916,7 +6056,7 @@ static void ShowDemoWindowInputs() ImGui::TreePop(); } - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Dragging"); + IMGUI_DEMO_MARKER("Inputs & Focus/Dragging"); if (ImGui::TreeNode("Dragging")) { ImGui::TextWrapped("You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget."); @@ -5960,10 +6100,11 @@ void ImGui::ShowAboutWindow(bool* p_open) return; } IMGUI_DEMO_MARKER("Tools/About Dear ImGui"); - ImGui::Text("Dear ImGui %s", ImGui::GetVersion()); + ImGui::Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM); ImGui::Separator(); ImGui::Text("By Omar Cornut and all Dear ImGui contributors."); ImGui::Text("Dear ImGui is licensed under the MIT License, see LICENSE for more information."); + ImGui::Text("If your company uses this, please consider sponsoring the project!"); static bool show_config_info = false; ImGui::Checkbox("Config/Build Information", &show_config_info); @@ -6047,6 +6188,9 @@ void ImGui::ShowAboutWindow(bool* p_open) #endif #ifdef __clang_version__ ImGui::Text("define: __clang_version__=%s", __clang_version__); +#endif +#ifdef __EMSCRIPTEN__ + ImGui::Text("define: __EMSCRIPTEN__"); #endif ImGui::Separator(); ImGui::Text("io.BackendPlatformName: %s", io.BackendPlatformName ? io.BackendPlatformName : "NULL"); @@ -6111,9 +6255,8 @@ void ImGui::ShowFontSelector(const char* label) ImFont* font_current = ImGui::GetFont(); if (ImGui::BeginCombo(label, font_current->GetDebugName())) { - for (int n = 0; n < io.Fonts->Fonts.Size; n++) + for (ImFont* font : io.Fonts->Fonts) { - ImFont* font = io.Fonts->Fonts[n]; ImGui::PushID((void*)font); if (ImGui::Selectable(font->GetDebugName(), font == font_current)) io.FontDefault = font; @@ -6196,7 +6339,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) { if (ImGui::BeginTabItem("Sizes")) { - ImGui::Text("Main"); + ImGui::SeparatorText("Main"); ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f"); ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f"); ImGui::SliderFloat2("CellPadding", (float*)&style.CellPadding, 0.0f, 20.0f, "%.0f"); @@ -6206,22 +6349,24 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f"); ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f"); - ImGui::Text("Borders"); + + ImGui::SeparatorText("Borders"); ImGui::SliderFloat("WindowBorderSize", &style.WindowBorderSize, 0.0f, 1.0f, "%.0f"); ImGui::SliderFloat("ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f, "%.0f"); ImGui::SliderFloat("PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f, "%.0f"); ImGui::SliderFloat("FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f, "%.0f"); ImGui::SliderFloat("TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f, "%.0f"); - ImGui::Text("Rounding"); + + ImGui::SeparatorText("Rounding"); ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("ChildRounding", &style.ChildRounding, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f"); - ImGui::SliderFloat("LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("TabRounding", &style.TabRounding, 0.0f, 12.0f, "%.0f"); - ImGui::Text("Alignment"); + + ImGui::SeparatorText("Widgets"); ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f"); int window_menu_button_position = style.WindowMenuButtonPosition + 1; if (ImGui::Combo("WindowMenuButtonPosition", (int*)&window_menu_button_position, "None\0Left\0Right\0")) @@ -6231,9 +6376,27 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) ImGui::SameLine(); HelpMarker("Alignment applies when a button is larger than its text content."); ImGui::SliderFloat2("SelectableTextAlign", (float*)&style.SelectableTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); HelpMarker("Alignment applies when a selectable is larger than its text content."); - ImGui::Text("Safe Area Padding"); - ImGui::SameLine(); HelpMarker("Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured)."); - ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); + ImGui::SliderFloat("SeparatorTextBorderSize", &style.SeparatorTextBorderSize, 0.0f, 10.0f, "%.0f"); + ImGui::SliderFloat2("SeparatorTextAlign", (float*)&style.SeparatorTextAlign, 0.0f, 1.0f, "%.2f"); + ImGui::SliderFloat2("SeparatorTextPadding", (float*)&style.SeparatorTextPadding, 0.0f, 40.0f, "%.0f"); + ImGui::SliderFloat("LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f"); + + ImGui::SeparatorText("Tooltips"); + for (int n = 0; n < 2; n++) + if (ImGui::TreeNodeEx(n == 0 ? "HoverFlagsForTooltipMouse" : "HoverFlagsForTooltipNav")) + { + ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse : &style.HoverFlagsForTooltipNav; + ImGui::CheckboxFlags("ImGuiHoveredFlags_DelayNone", p, ImGuiHoveredFlags_DelayNone); + ImGui::CheckboxFlags("ImGuiHoveredFlags_DelayShort", p, ImGuiHoveredFlags_DelayShort); + ImGui::CheckboxFlags("ImGuiHoveredFlags_DelayNormal", p, ImGuiHoveredFlags_DelayNormal); + ImGui::CheckboxFlags("ImGuiHoveredFlags_Stationary", p, ImGuiHoveredFlags_Stationary); + ImGui::CheckboxFlags("ImGuiHoveredFlags_NoSharedDelay", p, ImGuiHoveredFlags_NoSharedDelay); + ImGui::TreePop(); + } + + ImGui::SeparatorText("Misc"); + ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); ImGui::SameLine(); HelpMarker("Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured)."); + ImGui::EndTabItem(); } @@ -6343,10 +6506,11 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) // When editing the "Circle Segment Max Error" value, draw a preview of its effect on auto-tessellated circles. ImGui::DragFloat("Circle Tessellation Max Error", &style.CircleTessellationMaxError , 0.005f, 0.10f, 5.0f, "%.2f", ImGuiSliderFlags_AlwaysClamp); - if (ImGui::IsItemActive()) - { + const bool show_samples = ImGui::IsItemActive(); + if (show_samples) ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos()); - ImGui::BeginTooltip(); + if (show_samples && ImGui::BeginTooltip()) + { ImGui::TextUnformatted("(R = radius, N = number of segments)"); ImGui::Spacing(); ImDrawList* draw_list = ImGui::GetWindowDrawList(); @@ -6543,6 +6707,7 @@ static void ShowExampleMenuFile() IM_ASSERT(0); } if (ImGui::MenuItem("Checked", NULL, true)) {} + ImGui::Separator(); if (ImGui::MenuItem("Quit", "Alt+F4")) {} } @@ -6699,9 +6864,8 @@ struct ExampleAppConsole ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 1)); // Tighten spacing if (copy_to_clipboard) ImGui::LogToClipboard(); - for (int i = 0; i < Items.Size; i++) + for (const char* item : Items) { - const char* item = Items[i]; if (!Filter.PassFilter(item)) continue; @@ -6720,6 +6884,8 @@ struct ExampleAppConsole if (copy_to_clipboard) ImGui::LogFinish(); + // Keep up at the bottom of the scroll region if we were already at the bottom at the beginning of the frame. + // Using a scrollbar or mouse-wheel will take away from the bottom edge. if (ScrollToBottom || (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())) ImGui::SetScrollHereY(1.0f); ScrollToBottom = false; @@ -7028,6 +7194,8 @@ struct ExampleAppLog } ImGui::PopStyleVar(); + // Keep up at the bottom of the scroll region if we were already at the bottom at the beginning of the frame. + // Using a scrollbar or mouse-wheel will take away from the bottom edge. if (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) ImGui::SetScrollHereY(1.0f); } @@ -7082,7 +7250,7 @@ static void ShowExampleAppLayout(bool* p_open) { if (ImGui::BeginMenu("File")) { - if (ImGui::MenuItem("Close")) *p_open = false; + if (ImGui::MenuItem("Close", "Ctrl+W")) { *p_open = false; } ImGui::EndMenu(); } ImGui::EndMenuBar(); @@ -7186,6 +7354,7 @@ static void ShowPlaceholderObject(const char* prefix, int uid) } // Demonstrate create a simple property editor. +// This demo is a bit lackluster nowadays, would be nice to improve. static void ShowExampleAppPropertyEditor(bool* p_open) { ImGui::SetNextWindowSize(ImVec2(430, 450), ImGuiCond_FirstUseEver); @@ -7194,23 +7363,24 @@ static void ShowExampleAppPropertyEditor(bool* p_open) ImGui::End(); return; } - IMGUI_DEMO_MARKER("Examples/Property Editor"); + IMGUI_DEMO_MARKER("Examples/Property Editor"); HelpMarker( "This example shows how you may implement a property editor using two columns.\n" - "All objects/fields data are dummies here.\n" - "Remember that in many simple cases, you can use ImGui::SameLine(xxx) to position\n" - "your cursor horizontally instead of using the Columns() API."); + "All objects/fields data are dummies here.\n"); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2, 2)); - if (ImGui::BeginTable("split", 2, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_Resizable)) + if (ImGui::BeginTable("##split", 2, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollY)) { + ImGui::TableSetupScrollFreeze(0, 1); + ImGui::TableSetupColumn("Object"); + ImGui::TableSetupColumn("Contents"); + ImGui::TableHeadersRow(); + // Iterate placeholder objects (all the same data) for (int obj_i = 0; obj_i < 4; obj_i++) - { ShowPlaceholderObject("Object", obj_i); - //ImGui::Separator(); - } + ImGui::EndTable(); } ImGui::PopStyleVar(); @@ -7457,7 +7627,7 @@ static void ShowExampleAppFullscreen(bool* p_open) static ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings; // We demonstrate using the full viewport area or the work area (without menu-bars, task-bars etc.) - // Based on your use case you may want one of the other. + // Based on your use case you may want one or the other. const ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(use_work_area ? viewport->WorkPos : viewport->Pos); ImGui::SetNextWindowSize(use_work_area ? viewport->WorkSize : viewport->Size); @@ -7754,6 +7924,43 @@ static void ShowExampleAppCustomRendering(bool* p_open) ImGui::EndTabItem(); } + // Demonstrate out-of-order rendering via channels splitting + // We use functions in ImDrawList as each draw list contains a convenience splitter, + // but you can also instantiate your own ImDrawListSplitter if you need to nest them. + if (ImGui::BeginTabItem("Draw Channels")) + { + ImDrawList* draw_list = ImGui::GetWindowDrawList(); + { + ImGui::Text("Blue shape is drawn first: appears in back"); + ImGui::Text("Red shape is drawn after: appears in front"); + ImVec2 p0 = ImGui::GetCursorScreenPos(); + draw_list->AddRectFilled(ImVec2(p0.x, p0.y), ImVec2(p0.x + 50, p0.y + 50), IM_COL32(0, 0, 255, 255)); // Blue + draw_list->AddRectFilled(ImVec2(p0.x + 25, p0.y + 25), ImVec2(p0.x + 75, p0.y + 75), IM_COL32(255, 0, 0, 255)); // Red + ImGui::Dummy(ImVec2(75, 75)); + } + ImGui::Separator(); + { + ImGui::Text("Blue shape is drawn first, into channel 1: appears in front"); + ImGui::Text("Red shape is drawn after, into channel 0: appears in back"); + ImVec2 p1 = ImGui::GetCursorScreenPos(); + + // Create 2 channels and draw a Blue shape THEN a Red shape. + // You can create any number of channels. Tables API use 1 channel per column in order to better batch draw calls. + draw_list->ChannelsSplit(2); + draw_list->ChannelsSetCurrent(1); + draw_list->AddRectFilled(ImVec2(p1.x, p1.y), ImVec2(p1.x + 50, p1.y + 50), IM_COL32(0, 0, 255, 255)); // Blue + draw_list->ChannelsSetCurrent(0); + draw_list->AddRectFilled(ImVec2(p1.x + 25, p1.y + 25), ImVec2(p1.x + 75, p1.y + 75), IM_COL32(255, 0, 0, 255)); // Red + + // Flatten/reorder channels. Red shape is in channel 0 and it appears below the Blue shape in channel 1. + // This works by copying draw indices only (vertices are not copied). + draw_list->ChannelsMerge(); + ImGui::Dummy(ImVec2(75, 75)); + ImGui::Text("After reordering, contents of channel 0 appears below channel 1."); + } + ImGui::EndTabItem(); + } + ImGui::EndTabBar(); } @@ -7845,12 +8052,11 @@ struct ExampleAppDocuments // Note that this completely optional, and only affect tab bars with the ImGuiTabBarFlags_Reorderable flag. static void NotifyOfDocumentsClosedElsewhere(ExampleAppDocuments& app) { - for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++) + for (MyDocument& doc : app.Documents) { - MyDocument* doc = &app.Documents[doc_n]; - if (!doc->Open && doc->OpenPrev) - ImGui::SetTabItemClosed(doc->Name); - doc->OpenPrev = doc->Open; + if (!doc.Open && doc.OpenPrev) + ImGui::SetTabItemClosed(doc.Name); + doc.OpenPrev = doc.Open; } } @@ -7875,23 +8081,19 @@ void ShowExampleAppDocuments(bool* p_open) if (ImGui::BeginMenu("File")) { int open_count = 0; - for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++) - open_count += app.Documents[doc_n].Open ? 1 : 0; + for (MyDocument& doc : app.Documents) + open_count += doc.Open ? 1 : 0; if (ImGui::BeginMenu("Open", open_count < app.Documents.Size)) { - for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++) - { - MyDocument* doc = &app.Documents[doc_n]; - if (!doc->Open) - if (ImGui::MenuItem(doc->Name)) - doc->DoOpen(); - } + for (MyDocument& doc : app.Documents) + if (!doc.Open && ImGui::MenuItem(doc.Name)) + doc.DoOpen(); ImGui::EndMenu(); } if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0)) - for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++) - app.Documents[doc_n].DoQueueClose(); + for (MyDocument& doc : app.Documents) + doc.DoQueueClose(); if (ImGui::MenuItem("Exit", "Ctrl+F4") && p_open) *p_open = false; ImGui::EndMenu(); @@ -7902,13 +8104,13 @@ void ShowExampleAppDocuments(bool* p_open) // [Debug] List documents with one checkbox for each for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++) { - MyDocument* doc = &app.Documents[doc_n]; + MyDocument& doc = app.Documents[doc_n]; if (doc_n > 0) ImGui::SameLine(); - ImGui::PushID(doc); - if (ImGui::Checkbox(doc->Name, &doc->Open)) - if (!doc->Open) - doc->DoForceClose(); + ImGui::PushID(&doc); + if (ImGui::Checkbox(doc.Name, &doc.Open)) + if (!doc.Open) + doc.DoForceClose(); ImGui::PopID(); } @@ -7937,26 +8139,25 @@ void ShowExampleAppDocuments(bool* p_open) //if (ImGui::GetIO().KeyCtrl) ImGui::SetTabItemSelected(docs[1].Name); // [DEBUG] Test SetTabItemSelected(), probably not very useful as-is anyway.. // Submit Tabs - for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++) + for (MyDocument& doc : app.Documents) { - MyDocument* doc = &app.Documents[doc_n]; - if (!doc->Open) + if (!doc.Open) continue; - ImGuiTabItemFlags tab_flags = (doc->Dirty ? ImGuiTabItemFlags_UnsavedDocument : 0); - bool visible = ImGui::BeginTabItem(doc->Name, &doc->Open, tab_flags); + ImGuiTabItemFlags tab_flags = (doc.Dirty ? ImGuiTabItemFlags_UnsavedDocument : 0); + bool visible = ImGui::BeginTabItem(doc.Name, &doc.Open, tab_flags); // Cancel attempt to close when unsaved add to save queue so we can display a popup. - if (!doc->Open && doc->Dirty) + if (!doc.Open && doc.Dirty) { - doc->Open = true; - doc->DoQueueClose(); + doc.Open = true; + doc.DoQueueClose(); } - MyDocument::DisplayContextMenu(doc); + MyDocument::DisplayContextMenu(&doc); if (visible) { - MyDocument::DisplayContents(doc); + MyDocument::DisplayContents(&doc); ImGui::EndTabItem(); } } @@ -7970,15 +8171,12 @@ void ShowExampleAppDocuments(bool* p_open) if (close_queue.empty()) { // Close queue is locked once we started a popup - for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++) - { - MyDocument* doc = &app.Documents[doc_n]; - if (doc->WantClose) + for (MyDocument& doc : app.Documents) + if (doc.WantClose) { - doc->WantClose = false; - close_queue.push_back(doc); + doc.WantClose = false; + close_queue.push_back(&doc); } - } } // Display closing confirmation UI @@ -8009,8 +8207,8 @@ void ShowExampleAppDocuments(bool* p_open) for (int n = 0; n < close_queue.Size; n++) if (close_queue[n]->Dirty) ImGui::Text("%s", close_queue[n]->Name); - ImGui::EndChildFrame(); } + ImGui::EndChildFrame(); ImVec2 button_size(ImGui::GetFontSize() * 7.0f, 0.0f); if (ImGui::Button("Yes", button_size)) diff --git a/bgfx/3rdparty/dear-imgui/imgui_draw.cpp b/bgfx/3rdparty/dear-imgui/imgui_draw.cpp index a0b94974..205ce76f 100644 --- a/bgfx/3rdparty/dear-imgui/imgui_draw.cpp +++ b/bgfx/3rdparty/dear-imgui/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89 WIP +// dear imgui, v1.89.9 // (drawing and font code) /* @@ -26,13 +26,12 @@ Index of this file: #define _CRT_SECURE_NO_WARNINGS #endif -#include "imgui.h" -#ifndef IMGUI_DISABLE - #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif +#include "imgui.h" +#ifndef IMGUI_DISABLE #include "imgui_internal.h" #ifdef IMGUI_ENABLE_FREETYPE #include "misc/freetype/imgui_freetype.h" @@ -64,6 +63,7 @@ Index of this file: #pragma clang diagnostic ignored "-Wreserved-id-macro" // warning: macro name is a reserved identifier #pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double. #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision +#pragma clang diagnostic ignored "-Wreserved-identifier" // warning: identifier '_Xxx' is reserved because it starts with '_' followed by a capital letter #elif defined(__GNUC__) #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used @@ -389,6 +389,8 @@ void ImDrawList::_ResetForNewFrame() IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, ClipRect) == 0); IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, TextureId) == sizeof(ImVec4)); IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID)); + if (_Splitter._Count > 1) + _Splitter.Merge(this); CmdBuffer.resize(0); IdxBuffer.resize(0); @@ -447,11 +449,13 @@ void ImDrawList::AddDrawCmd() // Note that this leaves the ImDrawList in a state unfit for further commands, as most code assume that CmdBuffer.Size > 0 && CmdBuffer.back().UserCallback == NULL void ImDrawList::_PopUnusedDrawCmd() { - if (CmdBuffer.Size == 0) - return; - ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; - if (curr_cmd->ElemCount == 0 && curr_cmd->UserCallback == NULL) + while (CmdBuffer.Size > 0) + { + ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; + if (curr_cmd->ElemCount != 0 || curr_cmd->UserCallback != NULL) + return;// break; CmdBuffer.pop_back(); + } } void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data) @@ -557,7 +561,7 @@ int ImDrawList::_CalcCircleAutoSegmentCount(float radius) const { // Automatic segment count const int radius_idx = (int)(radius + 0.999999f); // ceil to never reduce accuracy - if (radius_idx < IM_ARRAYSIZE(_Data->CircleSegmentCounts)) + if (radius_idx >= 0 && radius_idx < IM_ARRAYSIZE(_Data->CircleSegmentCounts)) return _Data->CircleSegmentCounts[radius_idx]; // Use cached value else return IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, _Data->CircleSegmentMaxError); @@ -704,7 +708,7 @@ void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, c // We avoid using the ImVec2 math operators here to reduce cost to a minimum for debug/non-inlined builds. void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 col, ImDrawFlags flags, float thickness) { - if (points_count < 2) + if (points_count < 2 || (col & IM_COL32_A_MASK) == 0) return; const bool closed = (flags & ImDrawFlags_Closed) != 0; @@ -962,7 +966,7 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 // - Filled shapes must always use clockwise winding order. The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing. void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col) { - if (points_count < 3) + if (points_count < 3 || (col & IM_COL32_A_MASK) == 0) return; const ImVec2 uv = _Data->TexUvWhitePixel; @@ -1312,6 +1316,7 @@ IM_STATIC_ASSERT(ImDrawFlags_RoundCornersTopLeft == (1 << 4)); static inline ImDrawFlags FixRectCornerFlags(ImDrawFlags flags) { #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + // Obsoleted in 1.82 (from February 2021) // Legacy Support for hard coded ~0 (used to be a suggested equivalent to ImDrawCornerFlags_All) // ~0 --> ImDrawFlags_RoundCornersAll or 0 if (flags == ~0) @@ -1344,10 +1349,12 @@ static inline ImDrawFlags FixRectCornerFlags(ImDrawFlags flags) void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, ImDrawFlags flags) { - flags = FixRectCornerFlags(flags); - rounding = ImMin(rounding, ImFabs(b.x - a.x) * ( ((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0.5f : 1.0f ) - 1.0f); - rounding = ImMin(rounding, ImFabs(b.y - a.y) * ( ((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0.5f : 1.0f ) - 1.0f); - + if (rounding >= 0.5f) + { + flags = FixRectCornerFlags(flags); + rounding = ImMin(rounding, ImFabs(b.x - a.x) * (((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0.5f : 1.0f) - 1.0f); + rounding = ImMin(rounding, ImFabs(b.y - a.y) * (((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0.5f : 1.0f) - 1.0f); + } if (rounding < 0.5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone) { PathLineTo(a); @@ -1804,6 +1811,63 @@ void ImDrawListSplitter::SetCurrentChannel(ImDrawList* draw_list, int idx) // [SECTION] ImDrawData //----------------------------------------------------------------------------- +void ImDrawData::Clear() +{ + Valid = false; + CmdListsCount = TotalIdxCount = TotalVtxCount = 0; + CmdLists.resize(0); // The ImDrawList are NOT owned by ImDrawData but e.g. by ImGuiContext, so we don't clear them. + DisplayPos = DisplaySize = FramebufferScale = ImVec2(0.0f, 0.0f); + OwnerViewport = NULL; +} + +// Important: 'out_list' is generally going to be draw_data->CmdLists, but may be another temporary list +// as long at it is expected that the result will be later merged into draw_data->CmdLists[]. +void ImGui::AddDrawListToDrawDataEx(ImDrawData* draw_data, ImVector* out_list, ImDrawList* draw_list) +{ + if (draw_list->CmdBuffer.Size == 0) + return; + if (draw_list->CmdBuffer.Size == 1 && draw_list->CmdBuffer[0].ElemCount == 0 && draw_list->CmdBuffer[0].UserCallback == NULL) + return; + + // Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. + // May trigger for you if you are using PrimXXX functions incorrectly. + IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size); + IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size); + if (!(draw_list->Flags & ImDrawListFlags_AllowVtxOffset)) + IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); + + // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per ImDrawList = per window) + // If this assert triggers because you are drawing lots of stuff manually: + // - First, make sure you are coarse clipping yourself and not trying to draw many things outside visible bounds. + // Be mindful that the lower-level ImDrawList API doesn't filter vertices. Use the Metrics/Debugger window to inspect draw list contents. + // - If you want large meshes with more than 64K vertices, you can either: + // (A) Handle the ImDrawCmd::VtxOffset value in your renderer backend, and set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset'. + // Most example backends already support this from 1.71. Pre-1.71 backends won't. + // Some graphics API such as GL ES 1/2 don't have a way to offset the starting vertex so it is not supported for them. + // (B) Or handle 32-bit indices in your renderer backend, and uncomment '#define ImDrawIdx unsigned int' line in imconfig.h. + // Most example backends already support this. For example, the OpenGL example code detect index size at compile-time: + // glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset); + // Your own engine or render API may use different parameters or function calls to specify index sizes. + // 2 and 4 bytes indices are generally supported by most graphics API. + // - If for some reason neither of those solutions works for you, a workaround is to call BeginChild()/EndChild() before reaching + // the 64K limit to split your draw commands in multiple draw lists. + if (sizeof(ImDrawIdx) == 2) + IM_ASSERT(draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above"); + + // Add to output list + records state in ImDrawData + out_list->push_back(draw_list); + draw_data->CmdListsCount++; + draw_data->TotalVtxCount += draw_list->VtxBuffer.Size; + draw_data->TotalIdxCount += draw_list->IdxBuffer.Size; +} + +void ImDrawData::AddDrawList(ImDrawList* draw_list) +{ + IM_ASSERT(CmdLists.Size == CmdListsCount); + draw_list->_PopUnusedDrawCmd(); + ImGui::AddDrawListToDrawDataEx(this, &CmdLists, draw_list); +} + // For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering! void ImDrawData::DeIndexAllBuffers() { @@ -1828,15 +1892,9 @@ void ImDrawData::DeIndexAllBuffers() // or if there is a difference between your window resolution and framebuffer resolution. void ImDrawData::ScaleClipRects(const ImVec2& fb_scale) { - for (int i = 0; i < CmdListsCount; i++) - { - ImDrawList* cmd_list = CmdLists[i]; - for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) - { - ImDrawCmd* cmd = &cmd_list->CmdBuffer[cmd_i]; - cmd->ClipRect = ImVec4(cmd->ClipRect.x * fb_scale.x, cmd->ClipRect.y * fb_scale.y, cmd->ClipRect.z * fb_scale.x, cmd->ClipRect.w * fb_scale.y); - } - } + for (ImDrawList* draw_list : CmdLists) + for (ImDrawCmd& cmd : draw_list->CmdBuffer) + cmd.ClipRect = ImVec4(cmd.ClipRect.x * fb_scale.x, cmd.ClipRect.y * fb_scale.y, cmd.ClipRect.z * fb_scale.x, cmd.ClipRect.w * fb_scale.y); } //----------------------------------------------------------------------------- @@ -1900,7 +1958,7 @@ ImFontConfig::ImFontConfig() { memset(this, 0, sizeof(*this)); FontDataOwnedByAtlas = true; - OversampleH = 3; // FIXME: 2 may be a better default? + OversampleH = 2; OversampleV = 1; GlyphMaxAdvanceX = FLT_MAX; RasterizerMultiply = 1.0f; @@ -1977,19 +2035,19 @@ ImFontAtlas::~ImFontAtlas() void ImFontAtlas::ClearInputData() { IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!"); - for (int i = 0; i < ConfigData.Size; i++) - if (ConfigData[i].FontData && ConfigData[i].FontDataOwnedByAtlas) + for (ImFontConfig& font_cfg : ConfigData) + if (font_cfg.FontData && font_cfg.FontDataOwnedByAtlas) { - IM_FREE(ConfigData[i].FontData); - ConfigData[i].FontData = NULL; + IM_FREE(font_cfg.FontData); + font_cfg.FontData = NULL; } // When clearing this we lose access to the font name and other information used to build the font. - for (int i = 0; i < Fonts.Size; i++) - if (Fonts[i]->ConfigData >= ConfigData.Data && Fonts[i]->ConfigData < ConfigData.Data + ConfigData.Size) + for (ImFont* font : Fonts) + if (font->ConfigData >= ConfigData.Data && font->ConfigData < ConfigData.Data + ConfigData.Size) { - Fonts[i]->ConfigData = NULL; - Fonts[i]->ConfigDataCount = 0; + font->ConfigData = NULL; + font->ConfigDataCount = 0; } ConfigData.clear(); CustomRects.clear(); @@ -2379,7 +2437,12 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) ImFontBuildDstData& dst_tmp = dst_tmp_array[src_tmp.DstIndex]; src_tmp.SrcRanges = cfg.GlyphRanges ? cfg.GlyphRanges : atlas->GetGlyphRangesDefault(); for (const ImWchar* src_range = src_tmp.SrcRanges; src_range[0] && src_range[1]; src_range += 2) + { + // Check for valid range. This may also help detect *some* dangling pointers, because a common + // user error is to setup ImFontConfig::GlyphRanges with a pointer to data that isn't persistent. + IM_ASSERT(src_range[0] <= src_range[1]); src_tmp.GlyphsHighest = ImMax(src_tmp.GlyphsHighest, (int)src_range[1]); + } dst_tmp.SrcCount++; dst_tmp.GlyphsHighest = ImMax(dst_tmp.GlyphsHighest, src_tmp.GlyphsHighest); } @@ -2544,13 +2607,10 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) // 9. Setup ImFont and glyphs for runtime for (int src_i = 0; src_i < src_tmp_array.Size; src_i++) { - ImFontBuildSrcData& src_tmp = src_tmp_array[src_i]; - if (src_tmp.GlyphsCount == 0) - continue; - // When merging fonts with MergeMode=true: // - We can have multiple input fonts writing into a same destination font. // - dst_font->ConfigData is != from cfg which is our source configuration. + ImFontBuildSrcData& src_tmp = src_tmp_array[src_i]; ImFontConfig& cfg = atlas->ConfigData[src_i]; ImFont* dst_font = cfg.DstFont; @@ -2614,6 +2674,9 @@ void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opa ImVector& user_rects = atlas->CustomRects; IM_ASSERT(user_rects.Size >= 1); // We expect at least the default custom rects to be registered, else something went wrong. +#ifdef __GNUC__ + if (user_rects.Size < 1) { __builtin_unreachable(); } // Workaround for GCC bug if IM_ASSERT() is defined to conditionally throw (see #5343) +#endif ImVector pack_rects; pack_rects.resize(user_rects.Size); @@ -2789,9 +2852,9 @@ void ImFontAtlasBuildFinish(ImFontAtlas* atlas) } // Build all fonts lookup tables - for (int i = 0; i < atlas->Fonts.Size; i++) - if (atlas->Fonts[i]->DirtyLookupTables) - atlas->Fonts[i]->BuildLookupTable(); + for (ImFont* font : atlas->Fonts) + if (font->DirtyLookupTables) + font->BuildLookupTable(); atlas->TexReady = true; } @@ -2934,19 +2997,19 @@ const ImWchar* ImFontAtlas::GetGlyphRangesJapanese() // 2999 ideograms code points for Japanese // - 2136 Joyo (meaning "for regular use" or "for common use") Kanji code points // - 863 Jinmeiyo (meaning "for personal name") Kanji code points - // - Sourced from the character information database of the Information-technology Promotion Agency, Japan - // - https://mojikiban.ipa.go.jp/mji/ - // - Available under the terms of the Creative Commons Attribution-ShareAlike 2.1 Japan (CC BY-SA 2.1 JP). - // - https://creativecommons.org/licenses/by-sa/2.1/jp/deed.en - // - https://creativecommons.org/licenses/by-sa/2.1/jp/legalcode - // - You can generate this code by the script at: - // - https://github.com/vaiorabbit/everyday_use_kanji + // - Sourced from official information provided by the government agencies of Japan: + // - List of Joyo Kanji by the Agency for Cultural Affairs + // - https://www.bunka.go.jp/kokugo_nihongo/sisaku/joho/joho/kijun/naikaku/kanji/ + // - List of Jinmeiyo Kanji by the Ministry of Justice + // - http://www.moj.go.jp/MINJI/minji86.html + // - Available under the terms of the Creative Commons Attribution 4.0 International (CC BY 4.0). + // - https://creativecommons.org/licenses/by/4.0/legalcode + // - You can generate this code by the script at: + // - https://github.com/vaiorabbit/everyday_use_kanji // - References: // - List of Joyo Kanji - // - (Official list by the Agency for Cultural Affairs) https://www.bunka.go.jp/kokugo_nihongo/sisaku/joho/joho/kakuki/14/tosin02/index.html // - (Wikipedia) https://en.wikipedia.org/wiki/List_of_j%C5%8Dy%C5%8D_kanji // - List of Jinmeiyo Kanji - // - (Official list by the Ministry of Justice) http://www.moj.go.jp/MINJI/minji86.html // - (Wikipedia) https://en.wikipedia.org/wiki/Jinmeiy%C5%8D_kanji // - Missing 1 Joyo Kanji: U+20B9F (Kun'yomi: Shikaru, On'yomi: Shitsu,shichi), see https://github.com/ocornut/imgui/pull/3627 for details. // You can use ImFontGlyphRangesBuilder to create your own ranges derived from this, by merging existing ranges or adding new characters. @@ -3109,7 +3172,8 @@ ImFont::ImFont() FallbackAdvanceX = 0.0f; FallbackChar = (ImWchar)-1; EllipsisChar = (ImWchar)-1; - DotChar = (ImWchar)-1; + EllipsisWidth = EllipsisCharStep = 0.0f; + EllipsisCharCount = 0; FallbackGlyph = NULL; ContainerAtlas = NULL; ConfigData = NULL; @@ -3190,17 +3254,7 @@ void ImFont::BuildLookupTable() SetGlyphVisible((ImWchar)' ', false); SetGlyphVisible((ImWchar)'\t', false); - // Ellipsis character is required for rendering elided text. We prefer using U+2026 (horizontal ellipsis). - // However some old fonts may contain ellipsis at U+0085. Here we auto-detect most suitable ellipsis character. - // FIXME: Note that 0x2026 is rarely included in our font ranges. Because of this we are more likely to use three individual dots. - const ImWchar ellipsis_chars[] = { (ImWchar)0x2026, (ImWchar)0x0085 }; - const ImWchar dots_chars[] = { (ImWchar)'.', (ImWchar)0xFF0E }; - if (EllipsisChar == (ImWchar)-1) - EllipsisChar = FindFirstExistingGlyph(this, ellipsis_chars, IM_ARRAYSIZE(ellipsis_chars)); - if (DotChar == (ImWchar)-1) - DotChar = FindFirstExistingGlyph(this, dots_chars, IM_ARRAYSIZE(dots_chars)); - - // Setup fallback character + // Setup Fallback character const ImWchar fallback_chars[] = { (ImWchar)IM_UNICODE_CODEPOINT_INVALID, (ImWchar)'?', (ImWchar)' ' }; FallbackGlyph = FindGlyphNoFallback(FallbackChar); if (FallbackGlyph == NULL) @@ -3213,11 +3267,32 @@ void ImFont::BuildLookupTable() FallbackChar = (ImWchar)FallbackGlyph->Codepoint; } } - FallbackAdvanceX = FallbackGlyph->AdvanceX; for (int i = 0; i < max_codepoint + 1; i++) if (IndexAdvanceX[i] < 0.0f) IndexAdvanceX[i] = FallbackAdvanceX; + + // Setup Ellipsis character. It is required for rendering elided text. We prefer using U+2026 (horizontal ellipsis). + // However some old fonts may contain ellipsis at U+0085. Here we auto-detect most suitable ellipsis character. + // FIXME: Note that 0x2026 is rarely included in our font ranges. Because of this we are more likely to use three individual dots. + const ImWchar ellipsis_chars[] = { (ImWchar)0x2026, (ImWchar)0x0085 }; + const ImWchar dots_chars[] = { (ImWchar)'.', (ImWchar)0xFF0E }; + if (EllipsisChar == (ImWchar)-1) + EllipsisChar = FindFirstExistingGlyph(this, ellipsis_chars, IM_ARRAYSIZE(ellipsis_chars)); + const ImWchar dot_char = FindFirstExistingGlyph(this, dots_chars, IM_ARRAYSIZE(dots_chars)); + if (EllipsisChar != (ImWchar)-1) + { + EllipsisCharCount = 1; + EllipsisWidth = EllipsisCharStep = FindGlyph(EllipsisChar)->X1; + } + else if (dot_char != (ImWchar)-1) + { + const ImFontGlyph* glyph = FindGlyph(dot_char); + EllipsisChar = dot_char; + EllipsisCharCount = 3; + EllipsisCharStep = (glyph->X1 - glyph->X0) + 1.0f; + EllipsisWidth = EllipsisCharStep * 3.0f - 1.0f; + } } // API is designed this way to avoid exposing the 4K page size @@ -3366,6 +3441,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c bool inside_word = true; const char* s = text; + IM_ASSERT(text_end != NULL); while (s < text_end) { unsigned int c = (unsigned int)*s; @@ -3374,8 +3450,6 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c next_s = s + 1; else next_s = s + ImTextCharFromUtf8(&c, s, text_end); - if (c == 0) - break; if (c < 32) { @@ -3481,15 +3555,9 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons const char* prev_s = s; unsigned int c = (unsigned int)*s; if (c < 0x80) - { s += 1; - } else - { s += ImTextCharFromUtf8(&c, s, text_end); - if (c == 0) // Malformed UTF-8? - break; - } if (c < 32) { @@ -3569,7 +3637,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im // FIXME-OPT: This is not optimal as do first do a search for \n before calling CalcWordWrapPositionA(). // If the specs for CalcWordWrapPositionA() were reworked to optionally return on \n we could combine both. // However it is still better than nothing performing the fast-forward! - s = CalcWordWrapPositionA(scale, s, line_end, wrap_width); + s = CalcWordWrapPositionA(scale, s, line_end ? line_end : text_end, wrap_width); s = CalcWordWrapNextLineStartA(s, text_end); } else @@ -3601,10 +3669,9 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im const int idx_count_max = (int)(text_end - s) * 6; const int idx_expected_size = draw_list->IdxBuffer.Size + idx_count_max; draw_list->PrimReserve(idx_count_max, vtx_count_max); - - ImDrawVert* vtx_write = draw_list->_VtxWritePtr; - ImDrawIdx* idx_write = draw_list->_IdxWritePtr; - unsigned int vtx_current_idx = draw_list->_VtxCurrentIdx; + ImDrawVert* vtx_write = draw_list->_VtxWritePtr; + ImDrawIdx* idx_write = draw_list->_IdxWritePtr; + unsigned int vtx_index = draw_list->_VtxCurrentIdx; const ImU32 col_untinted = col | ~IM_COL32_A_MASK; const char* word_wrap_eol = NULL; @@ -3630,15 +3697,9 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im // Decode and advance source unsigned int c = (unsigned int)*s; if (c < 0x80) - { s += 1; - } else - { s += ImTextCharFromUtf8(&c, s, text_end); - if (c == 0) // Malformed UTF-8? - break; - } if (c < 32) { @@ -3709,14 +3770,14 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im // We are NOT calling PrimRectUV() here because non-inlined causes too much overhead in a debug builds. Inlined here: { - idx_write[0] = (ImDrawIdx)(vtx_current_idx); idx_write[1] = (ImDrawIdx)(vtx_current_idx+1); idx_write[2] = (ImDrawIdx)(vtx_current_idx+2); - idx_write[3] = (ImDrawIdx)(vtx_current_idx); idx_write[4] = (ImDrawIdx)(vtx_current_idx+2); idx_write[5] = (ImDrawIdx)(vtx_current_idx+3); vtx_write[0].pos.x = x1; vtx_write[0].pos.y = y1; vtx_write[0].col = glyph_col; vtx_write[0].uv.x = u1; vtx_write[0].uv.y = v1; vtx_write[1].pos.x = x2; vtx_write[1].pos.y = y1; vtx_write[1].col = glyph_col; vtx_write[1].uv.x = u2; vtx_write[1].uv.y = v1; vtx_write[2].pos.x = x2; vtx_write[2].pos.y = y2; vtx_write[2].col = glyph_col; vtx_write[2].uv.x = u2; vtx_write[2].uv.y = v2; vtx_write[3].pos.x = x1; vtx_write[3].pos.y = y2; vtx_write[3].col = glyph_col; vtx_write[3].uv.x = u1; vtx_write[3].uv.y = v2; + idx_write[0] = (ImDrawIdx)(vtx_index); idx_write[1] = (ImDrawIdx)(vtx_index + 1); idx_write[2] = (ImDrawIdx)(vtx_index + 2); + idx_write[3] = (ImDrawIdx)(vtx_index); idx_write[4] = (ImDrawIdx)(vtx_index + 2); idx_write[5] = (ImDrawIdx)(vtx_index + 3); vtx_write += 4; - vtx_current_idx += 4; + vtx_index += 4; idx_write += 6; } } @@ -3730,7 +3791,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im draw_list->CmdBuffer[draw_list->CmdBuffer.Size - 1].ElemCount -= (idx_expected_size - draw_list->IdxBuffer.Size); draw_list->_VtxWritePtr = vtx_write; draw_list->_IdxWritePtr = idx_write; - draw_list->_VtxCurrentIdx = vtx_current_idx; + draw_list->_VtxCurrentIdx = vtx_index; } //----------------------------------------------------------------------------- @@ -3782,6 +3843,7 @@ void ImGui::RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir d void ImGui::RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col) { + // FIXME-OPT: This should be baked in font. draw_list->AddCircleFilled(pos, draw_list->_Data->FontSize * 0.20f, col, 8); } diff --git a/bgfx/3rdparty/dear-imgui/imgui_internal.h b/bgfx/3rdparty/dear-imgui/imgui_internal.h index 599b4e10..70a62334 100644 --- a/bgfx/3rdparty/dear-imgui/imgui_internal.h +++ b/bgfx/3rdparty/dear-imgui/imgui_internal.h @@ -1,10 +1,12 @@ -// dear imgui, v1.89 WIP +// dear imgui, v1.89.9 // (internal structures/api) -// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility! -// Set: -// #define IMGUI_DEFINE_MATH_OPERATORS -// To implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators) +// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility. +// To implement maths operators for ImVec2 (disabled by default to not conflict with using IM_VEC2_CLASS_EXTRA with your own math types+operators), use: +/* +#define IMGUI_DEFINE_MATH_OPERATORS +#include "imgui_internal.h" +*/ /* @@ -26,6 +28,7 @@ Index of this file: // [SECTION] Docking support // [SECTION] Viewport support // [SECTION] Settings support +// [SECTION] Localization support // [SECTION] Metrics, Debug tools // [SECTION] Generic context hooks // [SECTION] ImGuiContext (main imgui context) @@ -55,7 +58,7 @@ Index of this file: #include // INT_MIN, INT_MAX // Enable SSE intrinsics if available -#if (defined __SSE__ || defined __x86_64__ || defined _M_X64) && !defined(IMGUI_DISABLE_SSE) +#if (defined __SSE__ || defined __x86_64__ || defined _M_X64 || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1))) && !defined(IMGUI_DISABLE_SSE) #define IMGUI_ENABLE_SSE #include #endif @@ -92,6 +95,12 @@ Index of this file: #pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead #endif +// In 1.89.4, we moved the implementation of "courtesy maths operators" from imgui_internal.h in imgui.h +// As they are frequently requested, we do not want to encourage to many people using imgui_internal.h +#if defined(IMGUI_DEFINE_MATH_OPERATORS) && !defined(IMGUI_DEFINE_MATH_OPERATORS_IMPLEMENTED) +#error Please '#define IMGUI_DEFINE_MATH_OPERATORS' _BEFORE_ including imgui.h! +#endif + // Legacy defines #ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Renamed in 1.74 #error Use IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS @@ -117,12 +126,16 @@ struct ImDrawListSharedData; // Data shared between all ImDrawList instan struct ImGuiColorMod; // Stacked color modifier, backup of modified data so we can restore it struct ImGuiContext; // Main Dear ImGui context struct ImGuiContextHook; // Hook for extensions like ImGuiTestEngine +struct ImGuiDataVarInfo; // Variable information (e.g. to avoid style variables from an enum) struct ImGuiDataTypeInfo; // Type information associated to a ImGuiDataType enum struct ImGuiGroupData; // Stacked storage data for BeginGroup()/EndGroup() struct ImGuiInputTextState; // Internal state of the currently focused/edited text input box +struct ImGuiInputTextDeactivateData;// Short term storage to backup text of a deactivating InputText() while another is stealing active id struct ImGuiLastItemData; // Status storage for last submitted items +struct ImGuiLocEntry; // A localization entry. struct ImGuiMenuColumns; // Simple column measurement, currently used for MenuItem() only struct ImGuiNavItemData; // Result of a gamepad/keyboard directional navigation move query result +struct ImGuiNavTreeNodeData; // Temporary storage for last TreeNode() being a Left arrow landing candidate. struct ImGuiMetricsConfig; // Storage for ShowMetricsWindow() and DebugNodeXXX() functions struct ImGuiNextWindowData; // Storage for SetNextWindow** functions struct ImGuiNextItemData; // Storage for SetNextItem** functions @@ -144,11 +157,16 @@ struct ImGuiWindow; // Storage for one window struct ImGuiWindowTempData; // Temporary storage for one window (that's the data which in theory we could ditch at the end of the frame, in practice we currently keep it for each window) struct ImGuiWindowSettings; // Storage for a window .ini settings (we keep one of those even if the actual window wasn't instanced during this session) +// Enumerations // Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists. +enum ImGuiLocKey : int; // -> enum ImGuiLocKey // Enum: a localization entry for translation. typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical + +// Flags typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later) typedef int ImGuiDebugLogFlags; // -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags -typedef int ImGuiInputFlags; // -> enum ImGuiInputFlags_ // Flags: for IsKeyPressedEx() +typedef int ImGuiFocusRequestFlags; // -> enum ImGuiFocusRequestFlags_ // Flags: for FocusWindow(); +typedef int ImGuiInputFlags; // -> enum ImGuiInputFlags_ // Flags: for IsKeyPressed(), IsMouseClicked(), SetKeyOwner(), SetItemKeyOwner() etc. typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag(), g.LastItemData.InFlags typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for g.LastItemData.StatusFlags typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns() @@ -200,16 +218,21 @@ namespace ImStb #ifndef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS #define IMGUI_DEBUG_PRINTF(_FMT,...) printf(_FMT, __VA_ARGS__) #else -#define IMGUI_DEBUG_PRINTF(_FMT,...) +#define IMGUI_DEBUG_PRINTF(_FMT,...) ((void)0) #endif #endif // Debug Logging for ShowDebugLogWindow(). This is designed for relatively rare events so please don't spam. +#ifndef IMGUI_DISABLE_DEBUG_TOOLS #define IMGUI_DEBUG_LOG(...) ImGui::DebugLog(__VA_ARGS__) +#else +#define IMGUI_DEBUG_LOG(...) ((void)0) +#endif #define IMGUI_DEBUG_LOG_ACTIVEID(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventActiveId) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) #define IMGUI_DEBUG_LOG_FOCUS(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventFocus) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) #define IMGUI_DEBUG_LOG_POPUP(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventPopup) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) #define IMGUI_DEBUG_LOG_NAV(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventNav) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) +#define IMGUI_DEBUG_LOG_SELECTION(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventSelection)IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) #define IMGUI_DEBUG_LOG_CLIPPER(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventClipper) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) #define IMGUI_DEBUG_LOG_IO(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventIO) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) @@ -246,6 +269,8 @@ namespace ImStb #define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255 #define IM_FLOOR(_VAL) ((float)(int)(_VAL)) // ImFloor() is not inlined in MSVC debug builds #define IM_ROUND(_VAL) ((float)(int)((_VAL) + 0.5f)) // +#define IM_STRINGIFY_HELPER(_X) #_X +#define IM_STRINGIFY(_X) IM_STRINGIFY_HELPER(_X) // Preprocessor idiom to stringify e.g. an integer. // Enforce cdecl calling convention for functions called by the standard library, in case compilation settings changed the default to e.g. __vectorcall #ifdef _MSC_VER @@ -302,11 +327,12 @@ namespace ImStb // - Helper: ImSpan<>, ImSpanAllocator<> // - Helper: ImPool<> // - Helper: ImChunkStream<> +// - Helper: ImGuiTextIndex //----------------------------------------------------------------------------- // Helpers: Hashing -IMGUI_API ImGuiID ImHashData(const void* data, size_t data_size, ImU32 seed = 0); -IMGUI_API ImGuiID ImHashStr(const char* data, size_t data_size = 0, ImU32 seed = 0); +IMGUI_API ImGuiID ImHashData(const void* data, size_t data_size, ImGuiID seed = 0); +IMGUI_API ImGuiID ImHashStr(const char* data, size_t data_size = 0, ImGuiID seed = 0); // Helpers: Sorting #ifndef ImQsort @@ -335,6 +361,7 @@ IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end IMGUI_API void ImStrTrimBlanks(char* str); IMGUI_API const char* ImStrSkipBlank(const char* str); IM_MSVC_RUNTIME_CHECKS_OFF +static inline char ImToUpper(char c) { return (c >= 'a' && c <= 'z') ? c &= ~32 : c; } static inline bool ImCharIsBlankA(char c) { return c == ' ' || c == '\t'; } static inline bool ImCharIsBlankW(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; } IM_MSVC_RUNTIME_CHECKS_RESTORE @@ -360,29 +387,6 @@ IMGUI_API int ImTextCountCharsFromUtf8(const char* in_text, const char IMGUI_API int ImTextCountUtf8BytesFromChar(const char* in_text, const char* in_text_end); // return number of bytes to express one char in UTF-8 IMGUI_API int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end); // return number of bytes to express string in UTF-8 -// Helpers: ImVec2/ImVec4 operators -// We are keeping those disabled by default so they don't leak in user space, to allow user enabling implicit cast operators between ImVec2 and their own types (using IM_VEC2_CLASS_EXTRA etc.) -// We unfortunately don't have a unary- operator for ImVec2 because this would needs to be defined inside the class itself. -#ifdef IMGUI_DEFINE_MATH_OPERATORS -IM_MSVC_RUNTIME_CHECKS_OFF -static inline ImVec2 operator*(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x * rhs, lhs.y * rhs); } -static inline ImVec2 operator/(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x / rhs, lhs.y / rhs); } -static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x + rhs.x, lhs.y + rhs.y); } -static inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x - rhs.x, lhs.y - rhs.y); } -static inline ImVec2 operator*(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); } -static inline ImVec2 operator/(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x / rhs.x, lhs.y / rhs.y); } -static inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; } -static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; } -static inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; } -static inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; } -static inline ImVec2& operator*=(ImVec2& lhs, const ImVec2& rhs) { lhs.x *= rhs.x; lhs.y *= rhs.y; return lhs; } -static inline ImVec2& operator/=(ImVec2& lhs, const ImVec2& rhs) { lhs.x /= rhs.x; lhs.y /= rhs.y; return lhs; } -static inline ImVec4 operator+(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z, lhs.w + rhs.w); } -static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z, lhs.w - rhs.w); } -static inline ImVec4 operator*(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z, lhs.w * rhs.w); } -IM_MSVC_RUNTIME_CHECKS_RESTORE -#endif - // Helpers: File System #ifdef IMGUI_DISABLE_FILE_FUNCTIONS #define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS @@ -465,6 +469,7 @@ static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; } static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); } static inline bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; } +static inline float ImExponentialMovingAverage(float avg, float sample, int n) { avg -= avg / n; avg += sample / n; return avg; } IM_MSVC_RUNTIME_CHECKS_RESTORE // Helpers: Geometry @@ -477,7 +482,6 @@ IMGUI_API bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, c IMGUI_API ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p); IMGUI_API void ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w); inline float ImTriangleArea(const ImVec2& a, const ImVec2& b, const ImVec2& c) { return ImFabs((a.x * (b.y - c.y)) + (b.x * (c.y - a.y)) + (c.x * (a.y - b.y))) * 0.5f; } -IMGUI_API ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy); // Helper: ImVec1 (1D vector) // (this odd construct is used to facilitate the transition between 1D and 2D, and the maintenance of some branches/patches) @@ -535,9 +539,12 @@ struct IMGUI_API ImRect bool IsInverted() const { return Min.x > Max.x || Min.y > Max.y; } ImVec4 ToVec4() const { return ImVec4(Min.x, Min.y, Max.x, Max.y); } }; -IM_MSVC_RUNTIME_CHECKS_RESTORE // Helper: ImBitArray +#define IM_BITARRAY_TESTBIT(_ARRAY, _N) ((_ARRAY[(_N) >> 5] & ((ImU32)1 << ((_N) & 31))) != 0) // Macro version of ImBitArrayTestBit(): ensure args have side-effect or are costly! +#define IM_BITARRAY_CLEARBIT(_ARRAY, _N) ((_ARRAY[(_N) >> 5] &= ~((ImU32)1 << ((_N) & 31)))) // Macro version of ImBitArrayClearBit(): ensure args have side-effect or are costly! +inline size_t ImBitArrayGetStorageSizeInBytes(int bitcount) { return (size_t)((bitcount + 31) >> 5) << 2; } +inline void ImBitArrayClearAllBits(ImU32* arr, int bitcount){ memset(arr, 0, ImBitArrayGetStorageSizeInBytes(bitcount)); } inline bool ImBitArrayTestBit(const ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); return (arr[n >> 5] & mask) != 0; } inline void ImBitArrayClearBit(ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); arr[n >> 5] &= ~mask; } inline void ImBitArraySetBit(ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); arr[n >> 5] |= mask; } @@ -554,6 +561,8 @@ inline void ImBitArraySetBitRange(ImU32* arr, int n, int n2) // Works on ran } } +typedef ImU32* ImBitArrayPtr; // Name for use in structs + // Helper: ImBitArray class (wrapper over ImBitArray functions) // Store 1-bit per value. template @@ -563,11 +572,11 @@ struct ImBitArray ImBitArray() { ClearAllBits(); } void ClearAllBits() { memset(Storage, 0, sizeof(Storage)); } void SetAllBits() { memset(Storage, 255, sizeof(Storage)); } - bool TestBit(int n) const { n += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT); return ImBitArrayTestBit(Storage, n); } + bool TestBit(int n) const { n += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT); return IM_BITARRAY_TESTBIT(Storage, n); } void SetBit(int n) { n += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT); ImBitArraySetBit(Storage, n); } void ClearBit(int n) { n += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT); ImBitArrayClearBit(Storage, n); } void SetBitRange(int n, int n2) { n += OFFSET; n2 += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT && n2 > n && n2 <= BITCOUNT); ImBitArraySetBitRange(Storage, n, n2); } // Works on range [n..n2) - bool operator[](int n) const { n += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT); return ImBitArrayTestBit(Storage, n); } + bool operator[](int n) const { n += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT); return IM_BITARRAY_TESTBIT(Storage, n); } }; // Helper: ImBitVector @@ -577,10 +586,11 @@ struct IMGUI_API ImBitVector ImVector Storage; void Create(int sz) { Storage.resize((sz + 31) >> 5); memset(Storage.Data, 0, (size_t)Storage.Size * sizeof(Storage.Data[0])); } void Clear() { Storage.clear(); } - bool TestBit(int n) const { IM_ASSERT(n < (Storage.Size << 5)); return ImBitArrayTestBit(Storage.Data, n); } + bool TestBit(int n) const { IM_ASSERT(n < (Storage.Size << 5)); return IM_BITARRAY_TESTBIT(Storage.Data, n); } void SetBit(int n) { IM_ASSERT(n < (Storage.Size << 5)); ImBitArraySetBit(Storage.Data, n); } void ClearBit(int n) { IM_ASSERT(n < (Storage.Size << 5)); ImBitArrayClearBit(Storage.Data, n); } }; +IM_MSVC_RUNTIME_CHECKS_RESTORE // Helper: ImSpan<> // Pointing to a span of data we don't own. @@ -693,6 +703,20 @@ struct ImChunkStream }; +// Helper: ImGuiTextIndex<> +// Maintain a line index for a text buffer. This is a strong candidate to be moved into the public API. +struct ImGuiTextIndex +{ + ImVector LineOffsets; + int EndOffset = 0; // Because we don't own text buffer we need to maintain EndOffset (may bake in LineOffsets?) + + void clear() { LineOffsets.clear(); EndOffset = 0; } + int size() { return LineOffsets.Size; } + const char* get_line_begin(const char* base, int n) { return base + LineOffsets[n]; } + const char* get_line_end(const char* base, int n) { return base + (n + 1 < LineOffsets.Size ? (LineOffsets[n + 1] - 1) : EndOffset); } + void append(const char* base, int old_size, int new_size); +}; + //----------------------------------------------------------------------------- // [SECTION] ImDrawList support //----------------------------------------------------------------------------- @@ -749,12 +773,10 @@ struct IMGUI_API ImDrawListSharedData struct ImDrawDataBuilder { - ImVector Layers[2]; // Global layers for: regular, tooltip + ImVector* Layers[2]; // Pointers to global layers for: regular, tooltip. LayersP[0] is owned by DrawData. + ImVector LayerData1; - void Clear() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].resize(0); } - void ClearFreeMemory() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].clear(); } - int GetDrawListCount() const { int count = 0; for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) count += Layers[n].Size; return count; } - IMGUI_API void FlattenIntoSingleLayer(); + ImDrawDataBuilder() { memset(this, 0, sizeof(*this)); } }; //----------------------------------------------------------------------------- @@ -770,15 +792,16 @@ enum ImGuiItemFlags_ { // Controlled by user ImGuiItemFlags_None = 0, - ImGuiItemFlags_NoTabStop = 1 << 0, // false // Disable keyboard tabbing (FIXME: should merge with _NoNav) + ImGuiItemFlags_NoTabStop = 1 << 0, // false // Disable keyboard tabbing. This is a "lighter" version of ImGuiItemFlags_NoNav. ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings. ImGuiItemFlags_Disabled = 1 << 2, // false // Disable interactions but doesn't affect visuals. See BeginDisabled()/EndDisabled(). See github.com/ocornut/imgui/issues/211 - ImGuiItemFlags_NoNav = 1 << 3, // false // Disable keyboard/gamepad directional navigation (FIXME: should merge with _NoTabStop) + ImGuiItemFlags_NoNav = 1 << 3, // false // Disable any form of focusing (keyboard/gamepad directional navigation and SetKeyboardFocusHere() calls) ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false // Disable item being a candidate for default focus (e.g. used by title bar items) ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // Disable MenuItem/Selectable() automatically closing their popup window ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets) ImGuiItemFlags_ReadOnly = 1 << 7, // false // [ALPHA] Allow hovering interactions but underlying value is not changed. ImGuiItemFlags_NoWindowHoverableCheck = 1 << 8, // false // Disable hoverable check in ItemHoverable() + ImGuiItemFlags_AllowOverlap = 1 << 9, // false // Allow being overlapped by another widget. Not-hovered to Hovered transition deferred by a frame. // Controlled by widget code ImGuiItemFlags_Inputable = 1 << 10, // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature. @@ -798,15 +821,26 @@ enum ImGuiItemStatusFlags_ ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set. ImGuiItemStatusFlags_HoveredWindow = 1 << 7, // Override the HoveredWindow test to allow cross-window hover testing. ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8, // Set when the Focusable item just got focused by Tabbing (FIXME: to be removed soon) + ImGuiItemStatusFlags_Visible = 1 << 9, // [WIP] Set when item is overlapping the current clipping rectangle (Used internally. Please don't use yet: API/system will change as we refactor Itemadd()). + // Additional status + semantic for ImGuiTestEngine #ifdef IMGUI_ENABLE_TEST_ENGINE ImGuiItemStatusFlags_Openable = 1 << 20, // Item is an openable (e.g. TreeNode) - ImGuiItemStatusFlags_Opened = 1 << 21, // + ImGuiItemStatusFlags_Opened = 1 << 21, // Opened status ImGuiItemStatusFlags_Checkable = 1 << 22, // Item is a checkable (e.g. CheckBox, MenuItem) - ImGuiItemStatusFlags_Checked = 1 << 23, // + ImGuiItemStatusFlags_Checked = 1 << 23, // Checked status + ImGuiItemStatusFlags_Inputable = 1 << 24, // Item is a text-inputable (e.g. InputText, SliderXXX, DragXXX) #endif }; +// Extend ImGuiHoveredFlags_ +enum ImGuiHoveredFlagsPrivate_ +{ + ImGuiHoveredFlags_DelayMask_ = ImGuiHoveredFlags_DelayNone | ImGuiHoveredFlags_DelayShort | ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_NoSharedDelay, + ImGuiHoveredFlags_AllowedMaskForIsWindowHovered = ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_AnyWindow | ImGuiHoveredFlags_NoPopupHierarchy | ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_ForTooltip | ImGuiHoveredFlags_Stationary, + ImGuiHoveredFlags_AllowedMaskForIsItemHovered = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped | ImGuiHoveredFlags_AllowWhenDisabled | ImGuiHoveredFlags_NoNavOverride | ImGuiHoveredFlags_ForTooltip | ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayMask_, +}; + // Extend ImGuiInputTextFlags_ enum ImGuiInputTextFlagsPrivate_ { @@ -827,14 +861,16 @@ enum ImGuiButtonFlagsPrivate_ ImGuiButtonFlags_PressedOnDragDropHold = 1 << 9, // return true when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers) ImGuiButtonFlags_Repeat = 1 << 10, // hold to repeat ImGuiButtonFlags_FlattenChildren = 1 << 11, // allow interactions even if a child window is overlapping - ImGuiButtonFlags_AllowItemOverlap = 1 << 12, // require previous frame HoveredId to either match id or be null before being usable, use along with SetItemAllowOverlap() + ImGuiButtonFlags_AllowOverlap = 1 << 12, // require previous frame HoveredId to either match id or be null before being usable. ImGuiButtonFlags_DontClosePopups = 1 << 13, // disable automatically closing parent popup on press // [UNUSED] //ImGuiButtonFlags_Disabled = 1 << 14, // disable interactions -> use BeginDisabled() or ImGuiItemFlags_Disabled ImGuiButtonFlags_AlignTextBaseLine = 1 << 15, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine ImGuiButtonFlags_NoKeyModifiers = 1 << 16, // disable mouse interaction if a key modifier is held ImGuiButtonFlags_NoHoldingActiveId = 1 << 17, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only) - ImGuiButtonFlags_NoNavFocus = 1 << 18, // don't override navigation focus when activated + ImGuiButtonFlags_NoNavFocus = 1 << 18, // don't override navigation focus when activated (FIXME: this is essentially used everytime an item uses ImGuiItemFlags_NoNav, but because legacy specs don't requires LastItemData to be set ButtonBehavior(), we can't poll g.LastItemData.InFlags) ImGuiButtonFlags_NoHoveredOnFocus = 1 << 19, // don't report as hovered when nav focus is on this item + ImGuiButtonFlags_NoSetKeyOwner = 1 << 20, // don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!) + ImGuiButtonFlags_NoTestKeyOwner = 1 << 21, // don't test key/input owner when polling the key (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!) ImGuiButtonFlags_PressedOnMask_ = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold, ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease, }; @@ -849,7 +885,7 @@ enum ImGuiComboFlagsPrivate_ enum ImGuiSliderFlagsPrivate_ { ImGuiSliderFlags_Vertical = 1 << 20, // Should this slider be orientated vertically? - ImGuiSliderFlags_ReadOnly = 1 << 21, + ImGuiSliderFlags_ReadOnly = 1 << 21, // Consider using g.NextItemData.ItemFlags |= ImGuiItemFlags_ReadOnly instead. }; // Extend ImGuiSelectableFlags_ @@ -861,15 +897,16 @@ enum ImGuiSelectableFlagsPrivate_ ImGuiSelectableFlags_SelectOnClick = 1 << 22, // Override button behavior to react on Click (default is Click+Release) ImGuiSelectableFlags_SelectOnRelease = 1 << 23, // Override button behavior to react on Release (default is Click+Release) ImGuiSelectableFlags_SpanAvailWidth = 1 << 24, // Span all avail width even if we declared less for layout purpose. FIXME: We may be able to remove this (added in 6251d379, 2bcafc86 for menus) - ImGuiSelectableFlags_DrawHoveredWhenHeld = 1 << 25, // Always show active when held, even is not hovered. This concept could probably be renamed/formalized somehow. - ImGuiSelectableFlags_SetNavIdOnHover = 1 << 26, // Set Nav/Focus ID on mouse hover (used by MenuItem) - ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 27, // Disable padding each side with ItemSpacing * 0.5f + ImGuiSelectableFlags_SetNavIdOnHover = 1 << 25, // Set Nav/Focus ID on mouse hover (used by MenuItem) + ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 26, // Disable padding each side with ItemSpacing * 0.5f + ImGuiSelectableFlags_NoSetKeyOwner = 1 << 27, // Don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!) }; // Extend ImGuiTreeNodeFlags_ enum ImGuiTreeNodeFlagsPrivate_ { ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 20, + ImGuiTreeNodeFlags_UpsideDownArrow = 1 << 21,// (FIXME-WIP) Turn Down arrow into an Up arrow, but reversed trees (#6517) }; enum ImGuiSeparatorFlags_ @@ -877,7 +914,17 @@ enum ImGuiSeparatorFlags_ ImGuiSeparatorFlags_None = 0, ImGuiSeparatorFlags_Horizontal = 1 << 0, // Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar ImGuiSeparatorFlags_Vertical = 1 << 1, - ImGuiSeparatorFlags_SpanAllColumns = 1 << 2, + ImGuiSeparatorFlags_SpanAllColumns = 1 << 2, // Make separator cover all columns of a legacy Columns() set. +}; + +// Flags for FocusWindow(). This is not called ImGuiFocusFlags to avoid confusion with public-facing ImGuiFocusedFlags. +// FIXME: Once we finishing replacing more uses of GetTopMostPopupModal()+IsWindowWithinBeginStackOf() +// and FindBlockingModal() with this, we may want to change the flag to be opt-out instead of opt-in. +enum ImGuiFocusRequestFlags_ +{ + ImGuiFocusRequestFlags_None = 0, + ImGuiFocusRequestFlags_RestoreFocusedChild = 1 << 0, // Find last focused child (if any) and focus it instead. + ImGuiFocusRequestFlags_UnlessBelowModal = 1 << 1, // Do not set focus if the window is below a modal. }; enum ImGuiTextFlags_ @@ -889,7 +936,7 @@ enum ImGuiTextFlags_ enum ImGuiTooltipFlags_ { ImGuiTooltipFlags_None = 0, - ImGuiTooltipFlags_OverridePreviousTooltip = 1 << 0, // Override will clear/ignore previously submitted tooltip (defaults to append) + ImGuiTooltipFlags_OverridePrevious = 1 << 1, // Clear/ignore previously submitted tooltip (defaults to append) }; // FIXME: this is in development, not exposed/functional as a generic feature yet. @@ -930,6 +977,14 @@ enum ImGuiPopupPositionPolicy ImGuiPopupPositionPolicy_Tooltip, }; +struct ImGuiDataVarInfo +{ + ImGuiDataType Type; + ImU32 Count; // 1+ + ImU32 Offset; // Offset in parent structure + void* GetVarPtr(void* parent) const { return (void*)((unsigned char*)parent + Offset); } +}; + struct ImGuiDataTypeTempStorage { ImU8 Data[8]; // Can fit any data up to ImGuiDataType_COUNT @@ -1016,10 +1071,20 @@ struct IMGUI_API ImGuiMenuColumns void CalcNextTotalWidth(bool update_offsets); }; +// Internal temporary state for deactivating InputText() instances. +struct IMGUI_API ImGuiInputTextDeactivatedState +{ + ImGuiID ID; // widget id owning the text state (which just got deactivated) + ImVector TextA; // text buffer + + ImGuiInputTextDeactivatedState() { memset(this, 0, sizeof(*this)); } + void ClearFreeMemory() { ID = 0; TextA.clear(); } +}; // Internal state of the currently focused/edited text input box // For a given item ID, access with ImGui::GetInputTextState() struct IMGUI_API ImGuiInputTextState { + ImGuiContext* Ctx; // parent UI context (needs to be set explicitly by parent). ImGuiID ID; // widget id owning the text state int CurLenW, CurLenA; // we need to maintain our buffer length in both UTF-8 and wchar format. UTF-8 length is valid even if TextA is not. ImVector TextW; // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer. @@ -1114,13 +1179,14 @@ enum ImGuiNextItemDataFlags_ struct ImGuiNextItemData { ImGuiNextItemDataFlags Flags; + ImGuiItemFlags ItemFlags; // Currently only tested/used for ImGuiItemFlags_AllowOverlap. float Width; // Set by SetNextItemWidth() ImGuiID FocusScopeId; // Set by SetNextItemMultiSelectData() (!= 0 signify value has been set, so it's an alternate version of HasSelectionData, we don't use Flags for this because they are cleared too early. This is mostly used for debugging) ImGuiCond OpenCond; bool OpenVal; // Set by SetNextItemOpen() ImGuiNextItemData() { memset(this, 0, sizeof(*this)); } - inline void ClearFlags() { Flags = ImGuiNextItemDataFlags_None; } // Also cleared manually by ItemAdd()! + inline void ClearFlags() { Flags = ImGuiNextItemDataFlags_None; ItemFlags = ImGuiItemFlags_None; } // Also cleared manually by ItemAdd()! }; // Status storage for the last submitted item @@ -1136,6 +1202,16 @@ struct ImGuiLastItemData ImGuiLastItemData() { memset(this, 0, sizeof(*this)); } }; +// Store data emitted by TreeNode() for usage by TreePop() to implement ImGuiTreeNodeFlags_NavLeftJumpsBackHere. +// This is the minimum amount of data that we need to perform the equivalent of NavApplyItemToResult() and which we can't infer in TreePop() +// Only stored when the node is a potential candidate for landing on a Left arrow jump. +struct ImGuiNavTreeNodeData +{ + ImGuiID ID; + ImGuiItemFlags InFlags; + ImRect NavRect; +}; + struct IMGUI_API ImGuiStackSizes { short SizeOfIDStack; @@ -1149,8 +1225,8 @@ struct IMGUI_API ImGuiStackSizes short SizeOfDisabledStack; ImGuiStackSizes() { memset(this, 0, sizeof(*this)); } - void SetToCurrentState(); - void CompareWithCurrentState(); + void SetToContextState(ImGuiContext* ctx); + void CompareWithContextState(ImGuiContext* ctx); }; // Data saved for each window pushed into the stack @@ -1181,6 +1257,7 @@ struct ImGuiPtrOrIndex // [SECTION] Inputs support //----------------------------------------------------------------------------- +// Bit array for named keys typedef ImBitArray ImBitArrayForNamedKeys; // [Internal] Key ranges @@ -1190,8 +1267,10 @@ typedef ImBitArray ImBitAr #define ImGuiKey_Keyboard_END (ImGuiKey_GamepadStart) #define ImGuiKey_Gamepad_BEGIN (ImGuiKey_GamepadStart) #define ImGuiKey_Gamepad_END (ImGuiKey_GamepadRStickDown + 1) -#define ImGuiKey_Aliases_BEGIN (ImGuiKey_MouseLeft) -#define ImGuiKey_Aliases_END (ImGuiKey_MouseWheelY + 1) +#define ImGuiKey_Mouse_BEGIN (ImGuiKey_MouseLeft) +#define ImGuiKey_Mouse_END (ImGuiKey_MouseWheelY + 1) +#define ImGuiKey_Aliases_BEGIN (ImGuiKey_Mouse_BEGIN) +#define ImGuiKey_Aliases_END (ImGuiKey_Mouse_END) // [Internal] Named shortcuts for Navigation #define ImGuiKey_NavKeyboardTweakSlow ImGuiMod_Ctrl @@ -1218,19 +1297,18 @@ enum ImGuiInputEventType enum ImGuiInputSource { ImGuiInputSource_None = 0, - ImGuiInputSource_Mouse, + ImGuiInputSource_Mouse, // Note: may be Mouse or TouchScreen or Pen. See io.MouseSource to distinguish them. ImGuiInputSource_Keyboard, ImGuiInputSource_Gamepad, ImGuiInputSource_Clipboard, // Currently only used by InputText() - ImGuiInputSource_Nav, // Stored in g.ActiveIdSource only ImGuiInputSource_COUNT }; // FIXME: Structures in the union below need to be declared as anonymous unions appears to be an extension? // Using ImVec2() would fail on Clang 'union member 'MousePos' has a non-trivial default constructor' -struct ImGuiInputEventMousePos { float PosX, PosY; }; -struct ImGuiInputEventMouseWheel { float WheelX, WheelY; }; -struct ImGuiInputEventMouseButton { int Button; bool Down; }; +struct ImGuiInputEventMousePos { float PosX, PosY; ImGuiMouseSource MouseSource; }; +struct ImGuiInputEventMouseWheel { float WheelX, WheelY; ImGuiMouseSource MouseSource; }; +struct ImGuiInputEventMouseButton { int Button; bool Down; ImGuiMouseSource MouseSource; }; struct ImGuiInputEventKey { ImGuiKey Key; bool Down; float AnalogValue; }; struct ImGuiInputEventText { unsigned int Char; }; struct ImGuiInputEventAppFocused { bool Focused; }; @@ -1239,6 +1317,7 @@ struct ImGuiInputEvent { ImGuiInputEventType Type; ImGuiInputSource Source; + ImU32 EventId; // Unique, sequential increasing integer to identify an event (if you need to correlate them to other data). union { ImGuiInputEventMousePos MousePos; // if Type == ImGuiInputEventType_MousePos @@ -1253,23 +1332,101 @@ struct ImGuiInputEvent ImGuiInputEvent() { memset(this, 0, sizeof(*this)); } }; -// Flags for IsKeyPressedEx(). In upcoming feature this will be used more (and IsKeyPressedEx() renamed) +// Input function taking an 'ImGuiID owner_id' argument defaults to (ImGuiKeyOwner_Any == 0) aka don't test ownership, which matches legacy behavior. +#define ImGuiKeyOwner_Any ((ImGuiID)0) // Accept key that have an owner, UNLESS a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease. +#define ImGuiKeyOwner_None ((ImGuiID)-1) // Require key to have no owner. + +typedef ImS16 ImGuiKeyRoutingIndex; + +// Routing table entry (sizeof() == 16 bytes) +struct ImGuiKeyRoutingData +{ + ImGuiKeyRoutingIndex NextEntryIndex; + ImU16 Mods; // Technically we'd only need 4-bits but for simplify we store ImGuiMod_ values which need 16-bits. ImGuiMod_Shortcut is already translated to Ctrl/Super. + ImU8 RoutingNextScore; // Lower is better (0: perfect score) + ImGuiID RoutingCurr; + ImGuiID RoutingNext; + + ImGuiKeyRoutingData() { NextEntryIndex = -1; Mods = 0; RoutingNextScore = 255; RoutingCurr = RoutingNext = ImGuiKeyOwner_None; } +}; + +// Routing table: maintain a desired owner for each possible key-chord (key + mods), and setup owner in NewFrame() when mods are matching. +// Stored in main context (1 instance) +struct ImGuiKeyRoutingTable +{ + ImGuiKeyRoutingIndex Index[ImGuiKey_NamedKey_COUNT]; // Index of first entry in Entries[] + ImVector Entries; + ImVector EntriesNext; // Double-buffer to avoid reallocation (could use a shared buffer) + + ImGuiKeyRoutingTable() { Clear(); } + void Clear() { for (int n = 0; n < IM_ARRAYSIZE(Index); n++) Index[n] = -1; Entries.clear(); EntriesNext.clear(); } +}; + +// This extends ImGuiKeyData but only for named keys (legacy keys don't support the new features) +// Stored in main context (1 per named key). In the future it might be merged into ImGuiKeyData. +struct ImGuiKeyOwnerData +{ + ImGuiID OwnerCurr; + ImGuiID OwnerNext; + bool LockThisFrame; // Reading this key requires explicit owner id (until end of frame). Set by ImGuiInputFlags_LockThisFrame. + bool LockUntilRelease; // Reading this key requires explicit owner id (until key is released). Set by ImGuiInputFlags_LockUntilRelease. When this is true LockThisFrame is always true as well. + + ImGuiKeyOwnerData() { OwnerCurr = OwnerNext = ImGuiKeyOwner_None; LockThisFrame = LockUntilRelease = false; } +}; + +// Flags for extended versions of IsKeyPressed(), IsMouseClicked(), Shortcut(), SetKeyOwner(), SetItemKeyOwner() // Don't mistake with ImGuiInputTextFlags! (for ImGui::InputText() function) enum ImGuiInputFlags_ { - // Flags for IsKeyPressedEx() + // Flags for IsKeyPressed(), IsMouseClicked(), Shortcut() ImGuiInputFlags_None = 0, ImGuiInputFlags_Repeat = 1 << 0, // Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1. ImGuiInputFlags_RepeatRateDefault = 1 << 1, // Repeat rate: Regular (default) ImGuiInputFlags_RepeatRateNavMove = 1 << 2, // Repeat rate: Fast ImGuiInputFlags_RepeatRateNavTweak = 1 << 3, // Repeat rate: Faster ImGuiInputFlags_RepeatRateMask_ = ImGuiInputFlags_RepeatRateDefault | ImGuiInputFlags_RepeatRateNavMove | ImGuiInputFlags_RepeatRateNavTweak, + + // Flags for SetItemKeyOwner() + ImGuiInputFlags_CondHovered = 1 << 4, // Only set if item is hovered (default to both) + ImGuiInputFlags_CondActive = 1 << 5, // Only set if item is active (default to both) + ImGuiInputFlags_CondDefault_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive, + ImGuiInputFlags_CondMask_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive, + + // Flags for SetKeyOwner(), SetItemKeyOwner() + ImGuiInputFlags_LockThisFrame = 1 << 6, // Access to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared at end of frame. This is useful to make input-owner-aware code steal keys from non-input-owner-aware code. + ImGuiInputFlags_LockUntilRelease = 1 << 7, // Access to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared when the key is released or at end of each frame if key is released. This is useful to make input-owner-aware code steal keys from non-input-owner-aware code. + + // Routing policies for Shortcut() + low-level SetShortcutRouting() + // - The general idea is that several callers register interest in a shortcut, and only one owner gets it. + // - When a policy (other than _RouteAlways) is set, Shortcut() will register itself with SetShortcutRouting(), + // allowing the system to decide where to route the input among other route-aware calls. + // - Shortcut() uses ImGuiInputFlags_RouteFocused by default: meaning that a simple Shortcut() poll + // will register a route and only succeed when parent window is in the focus stack and if no-one + // with a higher priority is claiming the shortcut. + // - Using ImGuiInputFlags_RouteAlways is roughly equivalent to doing e.g. IsKeyPressed(key) + testing mods. + // - Priorities: GlobalHigh > Focused (when owner is active item) > Global > Focused (when focused window) > GlobalLow. + // - Can select only 1 policy among all available. + ImGuiInputFlags_RouteFocused = 1 << 8, // (Default) Register focused route: Accept inputs if window is in focus stack. Deep-most focused window takes inputs. ActiveId takes inputs over deep-most focused window. + ImGuiInputFlags_RouteGlobalLow = 1 << 9, // Register route globally (lowest priority: unless a focused window or active item registered the route) -> recommended Global priority. + ImGuiInputFlags_RouteGlobal = 1 << 10, // Register route globally (medium priority: unless an active item registered the route, e.g. CTRL+A registered by InputText). + ImGuiInputFlags_RouteGlobalHigh = 1 << 11, // Register route globally (highest priority: unlikely you need to use that: will interfere with every active items) + ImGuiInputFlags_RouteMask_ = ImGuiInputFlags_RouteFocused | ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteGlobalLow | ImGuiInputFlags_RouteGlobalHigh, // _Always not part of this! + ImGuiInputFlags_RouteAlways = 1 << 12, // Do not register route, poll keys directly. + ImGuiInputFlags_RouteUnlessBgFocused= 1 << 13, // Global routes will not be applied if underlying background/void is focused (== no Dear ImGui windows are focused). Useful for overlay applications. + ImGuiInputFlags_RouteExtraMask_ = ImGuiInputFlags_RouteAlways | ImGuiInputFlags_RouteUnlessBgFocused, + + // [Internal] Mask of which function support which flags + ImGuiInputFlags_SupportedByIsKeyPressed = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_, + ImGuiInputFlags_SupportedByShortcut = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_ | ImGuiInputFlags_RouteMask_ | ImGuiInputFlags_RouteExtraMask_, + ImGuiInputFlags_SupportedBySetKeyOwner = ImGuiInputFlags_LockThisFrame | ImGuiInputFlags_LockUntilRelease, + ImGuiInputFlags_SupportedBySetItemKeyOwner = ImGuiInputFlags_SupportedBySetKeyOwner | ImGuiInputFlags_CondMask_, }; //----------------------------------------------------------------------------- // [SECTION] Clipper support //----------------------------------------------------------------------------- +// Note that Max is exclusive, so perhaps should be using a Begin/End convention. struct ImGuiListClipperRange { int Min; @@ -1302,8 +1459,8 @@ struct ImGuiListClipperData enum ImGuiActivateFlags_ { ImGuiActivateFlags_None = 0, - ImGuiActivateFlags_PreferInput = 1 << 0, // Favor activation that requires keyboard text input (e.g. for Slider/Drag). Default if keyboard is available. - ImGuiActivateFlags_PreferTweak = 1 << 1, // Favor activation for tweaking with arrows or gamepad (e.g. for Slider/Drag). Default if keyboard is not available. + ImGuiActivateFlags_PreferInput = 1 << 0, // Favor activation that requires keyboard text input (e.g. for Slider/Drag). Default for Enter key. + ImGuiActivateFlags_PreferTweak = 1 << 1, // Favor activation for tweaking with arrows or gamepad (e.g. for Slider/Drag). Default for Space key and if keyboard is not used. ImGuiActivateFlags_TryToPreserveState = 1 << 2, // Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection) }; @@ -1338,15 +1495,18 @@ enum ImGuiNavMoveFlags_ ImGuiNavMoveFlags_LoopY = 1 << 1, ImGuiNavMoveFlags_WrapX = 1 << 2, // On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left) ImGuiNavMoveFlags_WrapY = 1 << 3, // This is not super useful but provided for completeness + ImGuiNavMoveFlags_WrapMask_ = ImGuiNavMoveFlags_LoopX | ImGuiNavMoveFlags_LoopY | ImGuiNavMoveFlags_WrapX | ImGuiNavMoveFlags_WrapY, ImGuiNavMoveFlags_AllowCurrentNavId = 1 << 4, // Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place) ImGuiNavMoveFlags_AlsoScoreVisibleSet = 1 << 5, // Store alternate result in NavMoveResultLocalVisible that only comprise elements that are already fully visible (used by PageUp/PageDown) ImGuiNavMoveFlags_ScrollToEdgeY = 1 << 6, // Force scrolling to min/max (used by Home/End) // FIXME-NAV: Aim to remove or reword, probably unnecessary ImGuiNavMoveFlags_Forwarded = 1 << 7, ImGuiNavMoveFlags_DebugNoResult = 1 << 8, // Dummy scoring for debug purpose, don't apply result - ImGuiNavMoveFlags_FocusApi = 1 << 9, - ImGuiNavMoveFlags_Tabbing = 1 << 10, // == Focus + Activate if item is Inputable + DontChangeNavHighlight - ImGuiNavMoveFlags_Activate = 1 << 11, - ImGuiNavMoveFlags_DontSetNavHighlight = 1 << 12, // Do not alter the visible state of keyboard vs mouse nav highlight + ImGuiNavMoveFlags_FocusApi = 1 << 9, // Requests from focus API can land/focus/activate items even if they are marked with _NoTabStop (see NavProcessItemForTabbingRequest() for details) + ImGuiNavMoveFlags_IsTabbing = 1 << 10, // == Focus + Activate if item is Inputable + DontChangeNavHighlight + ImGuiNavMoveFlags_IsPageMove = 1 << 11, // Identify a PageDown/PageUp request. + ImGuiNavMoveFlags_Activate = 1 << 12, // Activate/select target item. + ImGuiNavMoveFlags_NoSelect = 1 << 13, // Don't trigger selection by not setting g.NavJustMovedTo + ImGuiNavMoveFlags_NoSetNavHighlight = 1 << 14, // Do not alter the visible state of keyboard vs mouse nav highlight }; enum ImGuiNavLayer @@ -1451,18 +1611,17 @@ struct ImGuiOldColumns // Every instance of ImGuiViewport is in fact a ImGuiViewportP. struct ImGuiViewportP : public ImGuiViewport { - int DrawListsLastFrame[2]; // Last frame number the background (0) and foreground (1) draw lists were used - ImDrawList* DrawLists[2]; // Convenience background (0) and foreground (1) draw lists. We use them to draw software mouser cursor when io.MouseDrawCursor is set and to draw most debug overlays. + int BgFgDrawListsLastFrame[2]; // Last frame number the background (0) and foreground (1) draw lists were used + ImDrawList* BgFgDrawLists[2]; // Convenience background (0) and foreground (1) draw lists. We use them to draw software mouser cursor when io.MouseDrawCursor is set and to draw most debug overlays. ImDrawData DrawDataP; - ImDrawDataBuilder DrawDataBuilder; - + ImDrawDataBuilder DrawDataBuilder; // Temporary data while building final ImDrawData ImVec2 WorkOffsetMin; // Work Area: Offset from Pos to top-left corner of Work Area. Generally (0,0) or (0,+main_menu_bar_height). Work Area is Full Area but without menu-bars/status-bars (so WorkArea always fit inside Pos/Size!) ImVec2 WorkOffsetMax; // Work Area: Offset from Pos+Size to bottom-right corner of Work Area. Generally (0,0) or (0,-status_bar_height). ImVec2 BuildWorkOffsetMin; // Work Area: Offset being built during current frame. Generally >= 0.0f. ImVec2 BuildWorkOffsetMax; // Work Area: Offset being built during current frame. Generally <= 0.0f. - ImGuiViewportP() { DrawListsLastFrame[0] = DrawListsLastFrame[1] = -1; DrawLists[0] = DrawLists[1] = NULL; } - ~ImGuiViewportP() { if (DrawLists[0]) IM_DELETE(DrawLists[0]); if (DrawLists[1]) IM_DELETE(DrawLists[1]); } + ImGuiViewportP() { BgFgDrawListsLastFrame[0] = BgFgDrawListsLastFrame[1] = -1; BgFgDrawLists[0] = BgFgDrawLists[1] = NULL; } + ~ImGuiViewportP() { if (BgFgDrawLists[0]) IM_DELETE(BgFgDrawLists[0]); if (BgFgDrawLists[1]) IM_DELETE(BgFgDrawLists[1]); } // Calculate work rect pos/size given a set of offset (we have 1 pair of offset for rect locked from last frame data, and 1 pair for currently building rect) ImVec2 CalcWorkRectPos(const ImVec2& off_min) const { return ImVec2(Pos.x + off_min.x, Pos.y + off_min.y); } @@ -1489,6 +1648,7 @@ struct ImGuiWindowSettings ImVec2ih Size; bool Collapsed; bool WantApply; // Set when loaded from .ini data (to enable merging/loading .ini data into an already running context) + bool WantDelete; // Set to invalidate/delete the settings entry ImGuiWindowSettings() { memset(this, 0, sizeof(*this)); } char* GetName() { return (char*)(this + 1); } @@ -1509,6 +1669,31 @@ struct ImGuiSettingsHandler ImGuiSettingsHandler() { memset(this, 0, sizeof(*this)); } }; +//----------------------------------------------------------------------------- +// [SECTION] Localization support +//----------------------------------------------------------------------------- + +// This is experimental and not officially supported, it'll probably fall short of features, if/when it does we may backtrack. +enum ImGuiLocKey : int +{ + ImGuiLocKey_VersionStr, + ImGuiLocKey_TableSizeOne, + ImGuiLocKey_TableSizeAllFit, + ImGuiLocKey_TableSizeAllDefault, + ImGuiLocKey_TableResetOrder, + ImGuiLocKey_WindowingMainMenuBar, + ImGuiLocKey_WindowingPopup, + ImGuiLocKey_WindowingUntitled, + ImGuiLocKey_COUNT +}; + +struct ImGuiLocEntry +{ + ImGuiLocKey Key; + const char* Text; +}; + + //----------------------------------------------------------------------------- // [SECTION] Metrics, Debug Tools //----------------------------------------------------------------------------- @@ -1522,30 +1707,24 @@ enum ImGuiDebugLogFlags_ ImGuiDebugLogFlags_EventPopup = 1 << 2, ImGuiDebugLogFlags_EventNav = 1 << 3, ImGuiDebugLogFlags_EventClipper = 1 << 4, - ImGuiDebugLogFlags_EventIO = 1 << 5, - ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventIO, + ImGuiDebugLogFlags_EventSelection = 1 << 5, + ImGuiDebugLogFlags_EventIO = 1 << 6, + ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventSelection | ImGuiDebugLogFlags_EventIO, ImGuiDebugLogFlags_OutputToTTY = 1 << 10, // Also send output to TTY }; struct ImGuiMetricsConfig { - bool ShowDebugLog; - bool ShowStackTool; - bool ShowWindowsRects; - bool ShowWindowsBeginOrder; - bool ShowTablesRects; - bool ShowDrawCmdMesh; - bool ShowDrawCmdBoundingBoxes; - int ShowWindowsRectsType; - int ShowTablesRectsType; - - ImGuiMetricsConfig() - { - ShowDebugLog = ShowStackTool = ShowWindowsRects = ShowWindowsBeginOrder = ShowTablesRects = false; - ShowDrawCmdMesh = true; - ShowDrawCmdBoundingBoxes = true; - ShowWindowsRectsType = ShowTablesRectsType = -1; - } + bool ShowDebugLog = false; + bool ShowStackTool = false; + bool ShowWindowsRects = false; + bool ShowWindowsBeginOrder = false; + bool ShowTablesRects = false; + bool ShowDrawCmdMesh = true; + bool ShowDrawCmdBoundingBoxes = true; + bool ShowAtlasTintedWithTextColor = false; + int ShowWindowsRectsType = -1; + int ShowTablesRectsType = -1; }; struct ImGuiStackLevelInfo @@ -1599,8 +1778,6 @@ struct ImGuiContext bool Initialized; bool FontAtlasOwnedByContext; // IO.Fonts-> is owned by the ImGuiContext and will be destructed along with it. ImGuiIO IO; - ImVector InputEventsQueue; // Input events which will be tricked/written into IO structure. - ImVector InputEventsTrail; // Past input events processed in NewFrame(). This is to allow domain-specific application to access e.g mouse/pen trail. ImGuiStyle Style; ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back() float FontSize; // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window. @@ -1617,6 +1794,12 @@ struct ImGuiContext bool TestEngineHookItems; // Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log() void* TestEngine; // Test engine user data + // Inputs + ImVector InputEventsQueue; // Input events which will be trickled/written into IO structure. + ImVector InputEventsTrail; // Past input events processed in NewFrame(). This is to allow domain-specific application to access e.g mouse/pen trail. + ImGuiMouseSource InputEventsNextMouseSource; + ImU32 InputEventsNextEventId; + // Windows state ImVector Windows; // Windows, sorted in display order, back to front ImVector WindowsFocusOrder; // Root windows, sorted in focus order, back to front. @@ -1631,15 +1814,16 @@ struct ImGuiContext ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow->RootWindow. ImGuiWindow* WheelingWindow; // Track the window we started mouse-wheeling on. Until a timer elapse or mouse has moved, generally keep scrolling the same window even if during the course of scrolling the mouse ends up hovering a child window. ImVec2 WheelingWindowRefMousePos; - float WheelingWindowTimer; + int WheelingWindowStartFrame; // This may be set one frame before WheelingWindow is != NULL + float WheelingWindowReleaseTimer; + ImVec2 WheelingWindowWheelRemainder; + ImVec2 WheelingAxisAvg; // Item/widgets state and tracking information ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line] ImGuiID HoveredId; // Hovered widget, filled during the frame ImGuiID HoveredIdPreviousFrame; bool HoveredIdAllowOverlap; - bool HoveredIdUsingMouseWheel; // Hovered widget will use mouse wheel. Blocks scrolling the underlying window. - bool HoveredIdPreviousFrameUsingMouseWheel; bool HoveredIdDisabled; // At least one widget passed the rect test, but has been discarded by disabled flag or popup inhibit. May be true even if HoveredId == 0. float HoveredIdTimer; // Measure contiguous hovering time float HoveredIdNotActiveTimer; // Measure contiguous hovering time where the item has not been active @@ -1654,7 +1838,7 @@ struct ImGuiContext bool ActiveIdHasBeenEditedThisFrame; ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior) ImGuiWindow* ActiveIdWindow; - ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard) + ImGuiInputSource ActiveIdSource; // Activating source: ImGuiInputSource_Mouse OR ImGuiInputSource_Keyboard OR ImGuiInputSource_Gamepad int ActiveIdMouseButton; ImGuiID ActiveIdPreviousFrame; bool ActiveIdPreviousFrameIsAlive; @@ -1663,15 +1847,22 @@ struct ImGuiContext ImGuiID LastActiveId; // Store the last non-zero ActiveId, useful for animation. float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation. - // Input Ownership + // [EXPERIMENTAL] Key/Input Ownership + Shortcut Routing system + // - The idea is that instead of "eating" a given key, we can link to an owner. + // - Input query can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_None (== -1) or a custom ID. + // - Routing is requested ahead of time for a given chord (Key + Mods) and granted in NewFrame(). + ImGuiKeyOwnerData KeysOwnerData[ImGuiKey_NamedKey_COUNT]; + ImGuiKeyRoutingTable KeysRoutingTable; ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it) - ImBitArrayForNamedKeys ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array. + bool ActiveIdUsingAllKeyboardKeys; // Active widget will want to read all keyboard keys inputs. (FIXME: This is a shortcut for not taking ownership of 100+ keys but perhaps best to not have the inconsistency) #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO - ImU32 ActiveIdUsingNavInputMask; // If you used this. Since (IMGUI_VERSION_NUM >= 18804) : 'g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel);' becomes 'SetActiveIdUsingKey(ImGuiKey_Escape); SetActiveIdUsingKey(ImGuiKey_NavGamepadCancel);' + ImU32 ActiveIdUsingNavInputMask; // If you used this. Since (IMGUI_VERSION_NUM >= 18804) : 'g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel);' becomes 'SetKeyOwner(ImGuiKey_Escape, g.ActiveId) and/or SetKeyOwner(ImGuiKey_NavGamepadCancel, g.ActiveId);' #endif // Next window/item data + ImGuiID CurrentFocusScopeId; // == g.FocusScopeStack.back() ImGuiItemFlags CurrentItemFlags; // == g.ItemFlagsStack.back() + ImGuiID DebugLocateId; // Storage for DebugLocateItemOnHover() feature: this is read by ItemAdd() so we keep it in a hot/cached location ImGuiNextItemData NextItemData; // Storage for SetNextItem** functions ImGuiLastItemData LastItemData; // Storage for last submitted item (setup by ItemAdd) ImGuiNextWindowData NextWindowData; // Storage for SetNextWindow** functions @@ -1680,11 +1871,13 @@ struct ImGuiContext ImVector ColorStack; // Stack for PushStyleColor()/PopStyleColor() - inherited by Begin() ImVector StyleVarStack; // Stack for PushStyleVar()/PopStyleVar() - inherited by Begin() ImVector FontStack; // Stack for PushFont()/PopFont() - inherited by Begin() - ImVector FocusScopeStack; // Stack for PushFocusScope()/PopFocusScope() - not inherited by Begin(), unless child window + ImVector FocusScopeStack; // Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin() ImVectorItemFlagsStack; // Stack for PushItemFlag()/PopItemFlag() - inherited by Begin() ImVectorGroupStack; // Stack for BeginGroup()/EndGroup() - not inherited by Begin() ImVectorOpenPopupStack; // Which popups are open (persistent) ImVectorBeginPopupStack; // Which level of BeginPopup() we are in (reset every frame) + ImVector NavTreeNodeStack; // Stack for TreeNode() when a NavLeft requested is emitted. + int BeginMenuCount; // Viewports @@ -1694,17 +1887,16 @@ struct ImGuiContext ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow' ImGuiID NavId; // Focused item for navigation ImGuiID NavFocusScopeId; // Identify a selection scope (selection code often wants to "clear other items" when landing on an item of the selection set) - ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem() - ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0 - ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat) - ImGuiID NavActivateInputId; // ~~ IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadInput) ? NavId : 0; ImGuiActivateFlags_PreferInput will be set and NavActivateId will be 0. + ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem() + ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0 + ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat) ImGuiActivateFlags NavActivateFlags; ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest). ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest). ImGuiKeyChord NavJustMovedToKeyMods; ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame. ImGuiActivateFlags NavNextActivateFlags; - ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard. + ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource_Keyboard or ImGuiInputSource_Mouse ImGuiNavLayer NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later. bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRectRel is valid bool NavMousePosDirty; // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default) @@ -1715,8 +1907,7 @@ struct ImGuiContext bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest this is to perform early out in ItemAdd() bool NavInitRequest; // Init request for appearing window to select first item bool NavInitRequestFromMove; - ImGuiID NavInitResultId; // Init request result (first item of the window, or one for which SetItemDefaultFocus() was called) - ImRect NavInitResultRectRel; // Init request result rectangle (relative to parent window) + ImGuiNavItemData NavInitResult; // Init request result (first item of the window, or one for which SetItemDefaultFocus() was called) bool NavMoveSubmitted; // Move request submitted, will process result on next NewFrame() bool NavMoveScoringItems; // Move request submitted, still scoring incoming items bool NavMoveForwardToNextFrame; @@ -1737,6 +1928,8 @@ struct ImGuiContext ImGuiNavItemData NavTabbingResultFirst; // First tabbing request candidate within NavWindow and flattened hierarchy // Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize) + ImGuiKeyChord ConfigNavWindowingKeyNext; // = ImGuiMod_Ctrl | ImGuiKey_Tab, for reconfiguration (see #4828) + ImGuiKeyChord ConfigNavWindowingKeyPrev; // = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab ImGuiWindow* NavWindowingTarget; // Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most! ImGuiWindow* NavWindowingTargetAnim; // Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f, so the fade-out can stay on it. ImGuiWindow* NavWindowingListWindow; // Internal window actually listing the CTRL+Tab contents @@ -1748,7 +1941,6 @@ struct ImGuiContext // Render float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list) - ImGuiMouseCursor MouseCursor; // Drag and Drop bool DragDropActive; @@ -1788,20 +1980,29 @@ struct ImGuiContext ImVector ShrinkWidthBuffer; // Hover Delay system - ImGuiID HoverDelayId; - ImGuiID HoverDelayIdPreviousFrame; - float HoverDelayTimer; // Currently used IsItemHovered(), generally inferred from g.HoveredIdTimer but kept uncleared until clear timer elapse. - float HoverDelayClearTimer; // Currently used IsItemHovered(): grace time before g.TooltipHoverTimer gets cleared. + ImGuiID HoverItemDelayId; + ImGuiID HoverItemDelayIdPreviousFrame; + float HoverItemDelayTimer; // Currently used by IsItemHovered() + float HoverItemDelayClearTimer; // Currently used by IsItemHovered(): grace time before g.TooltipHoverTimer gets cleared. + ImGuiID HoverItemUnlockedStationaryId; // Mouse has once been stationary on this item. Only reset after departing the item. + ImGuiID HoverWindowUnlockedStationaryId; // Mouse has once been stationary on this window. Only reset after departing the window. + + // Mouse state + ImGuiMouseCursor MouseCursor; + float MouseStationaryTimer; // Time the mouse has been stationary (with some loose heuristic) + ImVec2 MouseLastValidPos; // Widget state - ImVec2 MouseLastValidPos; ImGuiInputTextState InputTextState; + ImGuiInputTextDeactivatedState InputTextDeactivatedState; ImFont InputTextPasswordFont; ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc. ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets - float ColorEditLastHue; // Backup of last Hue associated to LastColor, so we can restore Hue in lossy RGB<>HSV round trips - float ColorEditLastSat; // Backup of last Saturation associated to LastColor, so we can restore Saturation in lossy RGB<>HSV round trips - ImU32 ColorEditLastColor; // RGB value with alpha set to 0. + ImGuiID ColorEditCurrentID; // Set temporarily while inside of the parent-most ColorEdit4/ColorPicker4 (because they call each others). + ImGuiID ColorEditSavedID; // ID we are saving/restoring HS for + float ColorEditSavedHue; // Backup of last Hue associated to LastColor, so we can restore Hue in lossy RGB<>HSV round trips + float ColorEditSavedSat; // Backup of last Saturation associated to LastColor, so we can restore Saturation in lossy RGB<>HSV round trips + ImU32 ColorEditSavedColor; // RGB value with alpha set to 0. ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker. ImGuiComboPreviewData ComboPreviewData; float SliderGrabClickOffset; @@ -1813,6 +2014,7 @@ struct ImGuiContext float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage? float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled() short DisabledStackSize; + short LockMarkEdited; short TooltipOverrideCount; ImVector ClipboardHandlerData; // If no custom clipboard handler is defined ImVector MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once @@ -1820,7 +2022,6 @@ struct ImGuiContext // Platform support ImGuiPlatformImeData PlatformImeData; // Data updated by current frame ImGuiPlatformImeData PlatformImeDataPrev; // Previous frame data (when changing we will call io.SetPlatformImeDataFn - char PlatformLocaleDecimalPoint; // '.' or *localeconv()->decimal_point // Settings bool SettingsLoaded; @@ -1832,6 +2033,9 @@ struct ImGuiContext ImVector Hooks; // Hooks for extensions (e.g. test engine) ImGuiID HookIdNext; // Next available HookId + // Localization + const char* LocalizationTable[ImGuiLocKey_COUNT]; + // Capture/Logging bool LogEnabled; // Currently capturing ImGuiLogType LogType; // Capture target @@ -1848,6 +2052,10 @@ struct ImGuiContext // Debug Tools ImGuiDebugLogFlags DebugLogFlags; ImGuiTextBuffer DebugLogBuf; + ImGuiTextIndex DebugLogIndex; + ImU8 DebugLogClipperAutoDisableFrames; + ImU8 DebugLocateFrames; // For DebugLocateItemOnHover(). This is used together with DebugLocateId which is in a hot/cached spot above. + ImS8 DebugBeginReturnValueCullDepth; // Cycle between 0..9 then wrap around. bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker()) ImU8 DebugItemPickerMouseButton; ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this ID @@ -1866,6 +2074,9 @@ struct ImGuiContext ImGuiContext(ImFontAtlas* shared_font_atlas) { + IO.Ctx = this; + InputTextState.Ctx = this; + Initialized = false; FontAtlasOwnedByContext = shared_font_atlas ? false : true; Font = NULL; @@ -1879,18 +2090,21 @@ struct ImGuiContext TestEngineHookItems = false; TestEngine = NULL; + InputEventsNextMouseSource = ImGuiMouseSource_Mouse; + InputEventsNextEventId = 1; + WindowsActiveCount = 0; CurrentWindow = NULL; HoveredWindow = NULL; HoveredWindowUnderMovingWindow = NULL; MovingWindow = NULL; WheelingWindow = NULL; - WheelingWindowTimer = 0.0f; + WheelingWindowStartFrame = -1; + WheelingWindowReleaseTimer = 0.0f; DebugHookIdInfo = 0; HoveredId = HoveredIdPreviousFrame = 0; HoveredIdAllowOverlap = false; - HoveredIdUsingMouseWheel = HoveredIdPreviousFrameUsingMouseWheel = false; HoveredIdDisabled = false; HoveredIdTimer = HoveredIdNotActiveTimer = 0.0f; ActiveId = 0; @@ -1914,20 +2128,21 @@ struct ImGuiContext LastActiveIdTimer = 0.0f; ActiveIdUsingNavDirMask = 0x00; - ActiveIdUsingKeyInputMask.ClearAllBits(); + ActiveIdUsingAllKeyboardKeys = false; #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO ActiveIdUsingNavInputMask = 0x00; #endif + CurrentFocusScopeId = 0; CurrentItemFlags = ImGuiItemFlags_None; BeginMenuCount = 0; NavWindow = NULL; - NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavActivateInputId = 0; + NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = 0; NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0; NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None; NavJustMovedToKeyMods = ImGuiMod_None; - NavInputSource = ImGuiInputSource_None; + NavInputSource = ImGuiInputSource_Keyboard; NavLayer = ImGuiNavLayer_Main; NavIdIsAlive = false; NavMousePosDirty = false; @@ -1936,7 +2151,6 @@ struct ImGuiContext NavAnyRequest = false; NavInitRequest = false; NavInitRequestFromMove = false; - NavInitResultId = 0; NavMoveSubmitted = false; NavMoveScoringItems = false; NavMoveForwardToNextFrame = false; @@ -1948,12 +2162,13 @@ struct ImGuiContext NavTabbingDir = 0; NavTabbingCounter = 0; + ConfigNavWindowingKeyNext = ImGuiMod_Ctrl | ImGuiKey_Tab; + ConfigNavWindowingKeyPrev = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab; NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL; NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f; NavWindowingToggleLayer = false; DimBgRatio = 0.0f; - MouseCursor = ImGuiMouseCursor_Arrow; DragDropActive = DragDropWithinSource = DragDropWithinTarget = false; DragDropSourceFlags = ImGuiDragDropFlags_None; @@ -1973,13 +2188,17 @@ struct ImGuiContext TablesTempDataStacked = 0; CurrentTabBar = NULL; - HoverDelayId = HoverDelayIdPreviousFrame = 0; - HoverDelayTimer = HoverDelayClearTimer = 0.0f; + HoverItemDelayId = HoverItemDelayIdPreviousFrame = HoverItemUnlockedStationaryId = HoverWindowUnlockedStationaryId = 0; + HoverItemDelayTimer = HoverItemDelayClearTimer = 0.0f; + + MouseCursor = ImGuiMouseCursor_Arrow; + MouseStationaryTimer = 0.0f; TempInputId = 0; ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_; - ColorEditLastHue = ColorEditLastSat = 0.0f; - ColorEditLastColor = 0; + ColorEditCurrentID = ColorEditSavedID = 0; + ColorEditSavedHue = ColorEditSavedSat = 0.0f; + ColorEditSavedColor = 0; SliderGrabClickOffset = 0.0f; SliderCurrentAccum = 0.0f; SliderCurrentAccumDirty = false; @@ -1989,16 +2208,18 @@ struct ImGuiContext ScrollbarClickDeltaToGrabCenter = 0.0f; DisabledAlphaBackup = 0.0f; DisabledStackSize = 0; + LockMarkEdited = 0; TooltipOverrideCount = 0; PlatformImeData.InputPos = ImVec2(0.0f, 0.0f); PlatformImeDataPrev.InputPos = ImVec2(-1.0f, -1.0f); // Different to ensure initial submission - PlatformLocaleDecimalPoint = '.'; SettingsLoaded = false; SettingsDirtyTimer = 0.0f; HookIdNext = 0; + memset(LocalizationTable, 0, sizeof(LocalizationTable)); + LogEnabled = false; LogType = ImGuiLogType_None; LogNextPrefix = LogNextSuffix = NULL; @@ -2009,6 +2230,10 @@ struct ImGuiContext LogDepthToExpand = LogDepthToExpandDefault = 2; DebugLogFlags = ImGuiDebugLogFlags_OutputToTTY; + DebugLocateId = 0; + DebugLogClipperAutoDisableFrames = 0; + DebugLocateFrames = 0; + DebugBeginReturnValueCullDepth = -1; DebugItemPickerActive = false; DebugItemPickerMouseButton = ImGuiMouseButton_Left; DebugItemPickerBreakId = 0; @@ -2044,15 +2269,15 @@ struct IMGUI_API ImGuiWindowTempData ImVec1 Indent; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.) ImVec1 ColumnsOffset; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API. ImVec1 GroupOffset; - ImVec2 CursorStartPosLossyness;// Record the loss of precision of CursorStartPos due to really large scrolling amount. This is used by clipper to compensentate and fix the most common use case of large scroll area. + ImVec2 CursorStartPosLossyness;// Record the loss of precision of CursorStartPos due to really large scrolling amount. This is used by clipper to compensate and fix the most common use case of large scroll area. // Keyboard/Gamepad navigation ImGuiNavLayer NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1) short NavLayersActiveMask; // Which layers have been written to (result from previous frame) short NavLayersActiveMaskNext;// Which layers have been written to (accumulator for current frame) - ImGuiID NavFocusScopeIdCurrent; // Current focus scope ID while appending + bool NavIsScrollPushableX; // Set when current work location may be scrolled horizontally when moving left / right. This is generally always true UNLESS within a column. bool NavHideHighlightOneFrame; - bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f) + bool NavWindowHasScrollY; // Set per window when scrolling can be used (== ScrollMax.y > 0.0f) // Miscellaneous bool MenuBarAppending; // FIXME: Remove this @@ -2078,6 +2303,7 @@ struct IMGUI_API ImGuiWindowTempData // Storage for one window struct IMGUI_API ImGuiWindow { + ImGuiContext* Ctx; // Parent UI context (needs to be set explicitly by parent). char* Name; // Window name, owned by the window. ImGuiID ID; // == ImHashStr(Name) ImGuiWindowFlags Flags; // See enum ImGuiWindowFlags_ @@ -2091,6 +2317,9 @@ struct IMGUI_API ImGuiWindow ImVec2 WindowPadding; // Window padding at the time of Begin(). float WindowRounding; // Window rounding at the time of Begin(). May be clamped lower to avoid rendering artifacts with title bar, menu bar etc. float WindowBorderSize; // Window border size at the time of Begin(). + float DecoOuterSizeX1, DecoOuterSizeY1; // Left/Up offsets. Sum of non-scrolling outer decorations (X1 generally == 0.0f. Y1 generally = TitleBarHeight + MenuBarHeight). Locked during Begin(). + float DecoOuterSizeX2, DecoOuterSizeY2; // Right/Down offsets (X2 generally == ScrollbarSize.x, Y2 == ScrollbarSizes.y). + float DecoInnerSizeX1, DecoInnerSizeY1; // Applied AFTER/OVER InnerRect. Specialized for Tables as they use specialized form of clipping and frozen rows/columns are inside InnerRect (and not part of regular decoration sizes). int NameBufLen; // Size of buffer storing Name. May be larger than strlen(Name)! ImGuiID MoveId; // == window->GetID("#MOVE") ImGuiID ChildId; // ID of corresponding item in parent window (for navigation to return from child window to parent window) @@ -2168,6 +2397,8 @@ struct IMGUI_API ImGuiWindow ImGuiWindow* NavLastChildNavWindow; // When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.) ImGuiID NavLastIds[ImGuiNavLayer_COUNT]; // Last known NavId for this window, per layer (0/1) ImRect NavRectRel[ImGuiNavLayer_COUNT]; // Reference rectangle, in window relative space + ImVec2 NavPreferredScoringPosRel[ImGuiNavLayer_COUNT]; // Preferred X/Y position updated when moving on a given axis, reset to FLT_MAX. + ImGuiID NavRootFocusScopeId; // Focus Scope ID at the time of Begin() int MemoryDrawListIdxCapacity; // Backup of last idx/vtx count, so when waking up the window we can preallocate and avoid iterative alloc/copy int MemoryDrawListVtxCapacity; @@ -2184,10 +2415,10 @@ struct IMGUI_API ImGuiWindow // We don't use g.FontSize because the window may be != g.CurrentWindow. ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); } - float CalcFontSize() const { ImGuiContext& g = *GImGui; float scale = g.FontBaseSize * FontWindowScale; if (ParentWindow) scale *= ParentWindow->FontWindowScale; return scale; } - float TitleBarHeight() const { ImGuiContext& g = *GImGui; return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + g.Style.FramePadding.y * 2.0f; } + float CalcFontSize() const { ImGuiContext& g = *Ctx; float scale = g.FontBaseSize * FontWindowScale; if (ParentWindow) scale *= ParentWindow->FontWindowScale; return scale; } + float TitleBarHeight() const { ImGuiContext& g = *Ctx; return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + g.Style.FramePadding.y * 2.0f; } ImRect TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight())); } - float MenuBarHeight() const { ImGuiContext& g = *GImGui; return (Flags & ImGuiWindowFlags_MenuBar) ? DC.MenuBarOffset.y + CalcFontSize() + g.Style.FramePadding.y * 2.0f : 0.0f; } + float MenuBarHeight() const { ImGuiContext& g = *Ctx; return (Flags & ImGuiWindowFlags_MenuBar) ? DC.MenuBarOffset.y + CalcFontSize() + g.Style.FramePadding.y * 2.0f : 0.0f; } ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); } }; @@ -2224,7 +2455,7 @@ struct ImGuiTabItem float RequestedWidth; // Width optionally requested by caller, -1.0f is unused ImS32 NameOffset; // When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames ImS16 BeginOrder; // BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable - ImS16 IndexDuringLayout; // Index only used during TabBarLayout() + ImS16 IndexDuringLayout; // Index only used during TabBarLayout(). Tabs gets reordered so 'Tabs[n].IndexDuringLayout == n' but may mismatch during additions. bool WantClose; // Marked as closed by SetTabItemClosed() ImGuiTabItem() { memset(this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; RequestedWidth = -1.0f; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; } @@ -2266,12 +2497,6 @@ struct IMGUI_API ImGuiTabBar ImGuiTextBuffer TabsNames; // For non-docking tab bar we re-append names in a contiguous buffer. ImGuiTabBar(); - int GetTabOrder(const ImGuiTabItem* tab) const { return Tabs.index_from_ptr(tab); } - const char* GetTabName(const ImGuiTabItem* tab) const - { - IM_ASSERT(tab->NameOffset != -1 && tab->NameOffset < TabsNames.Buf.Size); - return TabsNames.Buf.Data + tab->NameOffset; - } }; //----------------------------------------------------------------------------- @@ -2279,14 +2504,13 @@ struct IMGUI_API ImGuiTabBar //----------------------------------------------------------------------------- #define IM_COL32_DISABLE IM_COL32(0,0,0,1) // Special sentinel code which cannot be used as a regular color. -#define IMGUI_TABLE_MAX_COLUMNS 64 // sizeof(ImU64) * 8. This is solely because we frequently encode columns set in a ImU64. -#define IMGUI_TABLE_MAX_DRAW_CHANNELS (4 + 64 * 2) // See TableSetupDrawChannels() +#define IMGUI_TABLE_MAX_COLUMNS 512 // May be further lifted // Our current column maximum is 64 but we may raise that in the future. -typedef ImS8 ImGuiTableColumnIdx; -typedef ImU8 ImGuiTableDrawChannelIdx; +typedef ImS16 ImGuiTableColumnIdx; +typedef ImU16 ImGuiTableDrawChannelIdx; -// [Internal] sizeof() ~ 104 +// [Internal] sizeof() ~ 112 // We use the terminology "Enabled" to refer to a column that is not Hidden by user/api. // We use the terminology "Clipped" to refer to a column that is out of sight because of scrolling/clipping. // This is in contrast with some user-facing api such as IsItemVisible() / IsRectVisible() which use "Visible" to mean "not clipped". @@ -2332,7 +2556,7 @@ struct ImGuiTableColumn ImU8 SortDirection : 2; // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending ImU8 SortDirectionsAvailCount : 2; // Number of available sort directions (0 to 3) ImU8 SortDirectionsAvailMask : 4; // Mask of available sort directions (1-bit each) - ImU8 SortDirectionsAvailList; // Ordered of available sort directions (2-bits each) + ImU8 SortDirectionsAvailList; // Ordered list of available sort directions (2-bits each, total 8-bits) ImGuiTableColumn() { @@ -2355,16 +2579,21 @@ struct ImGuiTableCellData ImGuiTableColumnIdx Column; // Column number }; -// Per-instance data that needs preserving across frames (seemingly most others do not need to be preserved aside from debug needs, does that needs they could be moved to ImGuiTableTempData ?) +// Per-instance data that needs preserving across frames (seemingly most others do not need to be preserved aside from debug needs. Does that means they could be moved to ImGuiTableTempData?) struct ImGuiTableInstanceData { - float LastOuterHeight; // Outer height from last frame // FIXME: multi-instance issue (#3955) - float LastFirstRowHeight; // Height of first row from last frame // FIXME: possible multi-instance issue? + ImGuiID TableInstanceID; + float LastOuterHeight; // Outer height from last frame + float LastFirstRowHeight; // Height of first row from last frame (FIXME: this is used as "header height" and may be reworked) + float LastFrozenHeight; // Height of frozen section from last frame + int HoveredRowLast; // Index of row which was hovered last frame. + int HoveredRowNext; // Index of row hovered this frame, set after encountering it. - ImGuiTableInstanceData() { LastOuterHeight = LastFirstRowHeight = 0.0f; } + ImGuiTableInstanceData() { TableInstanceID = 0; LastOuterHeight = LastFirstRowHeight = LastFrozenHeight = 0.0f; HoveredRowLast = HoveredRowNext = -1; } }; -// FIXME-TABLE: more transient data could be stored in a per-stacked table structure: DrawSplitter, SortSpecs, incoming RowData +// FIXME-TABLE: more transient data could be stored in a stacked ImGuiTableTempData: e.g. SortSpecs, incoming RowData +// sizeof() ~ 580 bytes + heap allocs described in TableBeginInitMemory() struct IMGUI_API ImGuiTable { ImGuiID ID; @@ -2374,10 +2603,9 @@ struct IMGUI_API ImGuiTable ImSpan Columns; // Point within RawData[] ImSpan DisplayOrderToIndex; // Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1) ImSpan RowCellData; // Point within RawData[]. Store cells background requests for current row. - ImU64 EnabledMaskByDisplayOrder; // Column DisplayOrder -> IsEnabled map - ImU64 EnabledMaskByIndex; // Column Index -> IsEnabled map (== not hidden by user/api) in a format adequate for iterating column without touching cold data - ImU64 VisibleMaskByIndex; // Column Index -> IsVisibleX|IsVisibleY map (== not hidden by user/api && not hidden by scrolling/cliprect) - ImU64 RequestOutputMaskByIndex; // Column Index -> IsVisible || AutoFit (== expect user to submit items) + ImBitArrayPtr EnabledMaskByDisplayOrder; // Column DisplayOrder -> IsEnabled map + ImBitArrayPtr EnabledMaskByIndex; // Column Index -> IsEnabled map (== not hidden by user/api) in a format adequate for iterating column without touching cold data + ImBitArrayPtr VisibleMaskByIndex; // Column Index -> IsVisibleX|IsVisibleY map (== not hidden by user/api && not hidden by scrolling/cliprect) ImGuiTableFlags SettingsLoadedFlags; // Which data were loaded from the .ini file (e.g. when order is not altered we won't save order) int SettingsOffset; // Offset in g.SettingsTables int LastFrameActive; @@ -2389,6 +2617,7 @@ struct IMGUI_API ImGuiTable float RowPosY1; float RowPosY2; float RowMinHeight; // Height submitted to TableNextRow() + float RowCellPaddingY; // Top and bottom padding. Reloaded during row change. float RowTextBaseline; float RowIndentOffsetX; ImGuiTableRowFlags RowFlags : 16; // Current row flags, see ImGuiTableRowFlags_ @@ -2402,9 +2631,8 @@ struct IMGUI_API ImGuiTable float HostIndentX; float MinColumnWidth; float OuterPaddingX; - float CellPaddingX; // Padding from each borders - float CellPaddingY; - float CellSpacingX1; // Spacing between non-bordered cells + float CellPaddingX; // Padding from each borders. Locked in BeginTable()/Layout. + float CellSpacingX1; // Spacing between non-bordered cells. Locked in BeginTable()/Layout. float CellSpacingX2; float InnerWidth; // User value passed to BeginTable(), see comments at the top of BeginTable() for details. float ColumnsGivenWidth; // Sum of current column width @@ -2469,6 +2697,8 @@ struct IMGUI_API ImGuiTable bool IsResetDisplayOrderRequest; bool IsUnfrozenRows; // Set when we got past the frozen row. bool IsDefaultSizingPolicy; // Set if user didn't explicitly set a sizing policy in BeginTable() + bool HasScrollbarYCurr; // Whether ANY instance of this table had a vertical scrollbar during the current frame. + bool HasScrollbarYPrev; // Whether ANY instance of this table had a vertical scrollbar during the previous. bool MemoryCompacted; bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis @@ -2479,6 +2709,7 @@ struct IMGUI_API ImGuiTable // Transient data that are only needed between BeginTable() and EndTable(), those buffers are shared (1 per level of stacked table). // - Accessing those requires chasing an extra pointer so for very frequently used data we leave them in the main table structure. // - We also leave out of this structure data that tend to be particularly useful for debugging/metrics. +// sizeof() ~ 112 bytes. struct IMGUI_API ImGuiTableTempData { int TableIndex; // Index in g.Tables.Buf[] pool @@ -2563,12 +2794,14 @@ namespace ImGui IMGUI_API void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond = 0); IMGUI_API void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond = 0); IMGUI_API void SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const ImVec2& size); + IMGUI_API void SetWindowHiddendAndSkipItemsForCurrentFrame(ImGuiWindow* window); inline ImRect WindowRectAbsToRel(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x - off.x, r.Min.y - off.y, r.Max.x - off.x, r.Max.y - off.y); } inline ImRect WindowRectRelToAbs(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x + off.x, r.Min.y + off.y, r.Max.x + off.x, r.Max.y + off.y); } + inline ImVec2 WindowPosRelToAbs(ImGuiWindow* window, const ImVec2& p) { ImVec2 off = window->DC.CursorStartPos; return ImVec2(p.x + off.x, p.y + off.y); } // Windows: Display Order and Focus Order - IMGUI_API void FocusWindow(ImGuiWindow* window); - IMGUI_API void FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window); + IMGUI_API void FocusWindow(ImGuiWindow* window, ImGuiFocusRequestFlags flags = 0); + IMGUI_API void FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window, ImGuiViewport* filter_viewport, ImGuiFocusRequestFlags flags); IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window); IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window); IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window); @@ -2582,6 +2815,7 @@ namespace ImGui inline ImDrawList* GetForegroundDrawList(ImGuiWindow* window) { IM_UNUSED(window); return GetForegroundDrawList(); } // This seemingly unnecessary wrapper simplifies compatibility between the 'master' and 'docking' branches. IMGUI_API ImDrawList* GetBackgroundDrawList(ImGuiViewport* viewport); // get background draw list for the given viewport. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents. IMGUI_API ImDrawList* GetForegroundDrawList(ImGuiViewport* viewport); // get foreground draw list for the given viewport. this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents. + IMGUI_API void AddDrawListToDrawDataEx(ImDrawData* draw_data, ImVector* out_list, ImDrawList* draw_list); // Init IMGUI_API void Initialize(); @@ -2606,15 +2840,21 @@ namespace ImGui IMGUI_API void MarkIniSettingsDirty(); IMGUI_API void MarkIniSettingsDirty(ImGuiWindow* window); IMGUI_API void ClearIniSettings(); - IMGUI_API ImGuiWindowSettings* CreateNewWindowSettings(const char* name); - IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id); - IMGUI_API ImGuiWindowSettings* FindOrCreateWindowSettings(const char* name); IMGUI_API void AddSettingsHandler(const ImGuiSettingsHandler* handler); IMGUI_API void RemoveSettingsHandler(const char* type_name); IMGUI_API ImGuiSettingsHandler* FindSettingsHandler(const char* type_name); + // Settings - Windows + IMGUI_API ImGuiWindowSettings* CreateNewWindowSettings(const char* name); + IMGUI_API ImGuiWindowSettings* FindWindowSettingsByID(ImGuiID id); + IMGUI_API ImGuiWindowSettings* FindWindowSettingsByWindow(ImGuiWindow* window); + IMGUI_API void ClearWindowSettings(const char* name); + + // Localization + IMGUI_API void LocalizeRegisterEntries(const ImGuiLocEntry* entries, int count); + inline const char* LocalizeGetMsg(ImGuiLocKey key) { ImGuiContext& g = *GImGui; const char* msg = g.LocalizationTable[key]; return msg ? msg : "*Missing Text*"; } + // Scrolling - IMGUI_API void SetNextWindowScroll(const ImVec2& scroll); // Use -1.0f on one axis to leave as-is IMGUI_API void SetScrollX(ImGuiWindow* window, float scroll_x); IMGUI_API void SetScrollY(ImGuiWindow* window, float scroll_y); IMGUI_API void SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio); @@ -2629,7 +2869,6 @@ namespace ImGui //#endif // Basic Accessors - inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.LastItemData.ID; } // Get ID of last item (~~ often same ImGui::GetID(label) beforehand) inline ImGuiItemStatusFlags GetItemStatusFlags(){ ImGuiContext& g = *GImGui; return g.LastItemData.StatusFlags; } inline ImGuiItemFlags GetItemFlags() { ImGuiContext& g = *GImGui; return g.LastItemData.InFlags; } inline ImGuiID GetActiveID() { ImGuiContext& g = *GImGui; return g.ActiveId; } @@ -2643,12 +2882,14 @@ namespace ImGui IMGUI_API void MarkItemEdited(ImGuiID id); // Mark data associated to given item as "edited", used by IsItemDeactivatedAfterEdit() function. IMGUI_API void PushOverrideID(ImGuiID id); // Push given value as-is at the top of the ID stack (whereas PushID combines old and new hashes) IMGUI_API ImGuiID GetIDWithSeed(const char* str_id_begin, const char* str_id_end, ImGuiID seed); + IMGUI_API ImGuiID GetIDWithSeed(int n, ImGuiID seed); // Basic Helpers for widget code IMGUI_API void ItemSize(const ImVec2& size, float text_baseline_y = -1.0f); inline void ItemSize(const ImRect& bb, float text_baseline_y = -1.0f) { ItemSize(bb.GetSize(), text_baseline_y); } // FIXME: This is a misleading API since we expect CursorPos to be bb.Min. IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL, ImGuiItemFlags extra_flags = 0); - IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id); + IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flags); + IMGUI_API bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags = 0); IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id); IMGUI_API void SetLastItemData(ImGuiID item_id, ImGuiItemFlags in_flags, ImGuiItemStatusFlags status_flags, const ImRect& item_rect); IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h); @@ -2661,6 +2902,7 @@ namespace ImGui // Parameter stacks (shared) IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled); IMGUI_API void PopItemFlag(); + IMGUI_API const ImGuiDataVarInfo* GetStyleVarInfo(ImGuiStyleVar idx); // Logging/Capture IMGUI_API void LogBegin(ImGuiLogType type, int auto_open_depth); // -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name. @@ -2676,10 +2918,11 @@ namespace ImGui IMGUI_API void ClosePopupsExceptModals(); IMGUI_API bool IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags); IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags); - IMGUI_API void BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags); + IMGUI_API bool BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags); IMGUI_API ImRect GetPopupAllowedExtentRect(ImGuiWindow* window); IMGUI_API ImGuiWindow* GetTopMostPopupModal(); IMGUI_API ImGuiWindow* GetTopMostAndVisiblePopupModal(); + IMGUI_API ImGuiWindow* FindBlockingModal(ImGuiWindow* window); IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow* window); IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy); @@ -2700,60 +2943,118 @@ namespace ImGui IMGUI_API void NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags); IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags); IMGUI_API void NavMoveRequestResolveWithLastItem(ImGuiNavItemData* result); + IMGUI_API void NavMoveRequestResolveWithPastTreeNode(ImGuiNavItemData* result, ImGuiNavTreeNodeData* tree_node_data); IMGUI_API void NavMoveRequestCancel(); IMGUI_API void NavMoveRequestApplyResult(); IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags); - IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again. + IMGUI_API void NavClearPreferredPosForAxis(ImGuiAxis axis); + IMGUI_API void NavUpdateCurrentWindowIsScrollPushableX(); IMGUI_API void SetNavWindow(ImGuiWindow* window); IMGUI_API void SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel); - // Focus Scope (WIP) - // This is generally used to identify a selection set (multiple of which may be in the same window), as selection - // patterns generally need to react (e.g. clear selection) when landing on an item of the set. - IMGUI_API void PushFocusScope(ImGuiID id); - IMGUI_API void PopFocusScope(); - inline ImGuiID GetFocusedFocusScope() { ImGuiContext& g = *GImGui; return g.NavFocusScopeId; } // Focus scope which is actually active - inline ImGuiID GetFocusScope() { ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.NavFocusScopeIdCurrent; } // Focus scope we are outputting into, set by PushFocusScope() + // Focus/Activation + // This should be part of a larger set of API: FocusItem(offset = -1), FocusItemByID(id), ActivateItem(offset = -1), ActivateItemByID(id) etc. which are + // much harder to design and implement than expected. I have a couple of private branches on this matter but it's not simple. For now implementing the easy ones. + IMGUI_API void FocusItem(); // Focus last item (no selection/activation). + IMGUI_API void ActivateItemByID(ImGuiID id); // Activate an item by ID (button, checkbox, tree node etc.). Activation is queued and processed on the next frame when the item is encountered again. // Inputs // FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions. inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; } - inline bool IsNamedKeyOrModKey(ImGuiKey key) { return (key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END) || key == ImGuiMod_Ctrl || key == ImGuiMod_Shift || key == ImGuiMod_Alt || key == ImGuiMod_Super; } + inline bool IsNamedKeyOrModKey(ImGuiKey key) { return (key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END) || key == ImGuiMod_Ctrl || key == ImGuiMod_Shift || key == ImGuiMod_Alt || key == ImGuiMod_Super || key == ImGuiMod_Shortcut; } inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; } + inline bool IsKeyboardKey(ImGuiKey key) { return key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END; } inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; } + inline bool IsMouseKey(ImGuiKey key) { return key >= ImGuiKey_Mouse_BEGIN && key < ImGuiKey_Mouse_END; } inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; } - inline ImGuiKey ConvertSingleModFlagToKey(ImGuiKey key) + inline ImGuiKeyChord ConvertShortcutMod(ImGuiKeyChord key_chord) { ImGuiContext& g = *GImGui; IM_ASSERT_PARANOID(key_chord & ImGuiMod_Shortcut); return (key_chord & ~ImGuiMod_Shortcut) | (g.IO.ConfigMacOSXBehaviors ? ImGuiMod_Super : ImGuiMod_Ctrl); } + inline ImGuiKey ConvertSingleModFlagToKey(ImGuiContext* ctx, ImGuiKey key) { + ImGuiContext& g = *ctx; if (key == ImGuiMod_Ctrl) return ImGuiKey_ReservedForModCtrl; if (key == ImGuiMod_Shift) return ImGuiKey_ReservedForModShift; if (key == ImGuiMod_Alt) return ImGuiKey_ReservedForModAlt; if (key == ImGuiMod_Super) return ImGuiKey_ReservedForModSuper; + if (key == ImGuiMod_Shortcut) return (g.IO.ConfigMacOSXBehaviors ? ImGuiKey_ReservedForModSuper : ImGuiKey_ReservedForModCtrl); return key; } - IMGUI_API ImGuiKeyData* GetKeyData(ImGuiKey key); + IMGUI_API ImGuiKeyData* GetKeyData(ImGuiContext* ctx, ImGuiKey key); + inline ImGuiKeyData* GetKeyData(ImGuiKey key) { ImGuiContext& g = *GImGui; return GetKeyData(&g, key); } IMGUI_API void GetKeyChordName(ImGuiKeyChord key_chord, char* out_buf, int out_buf_size); - IMGUI_API void SetItemUsingMouseWheel(); - IMGUI_API void SetActiveIdUsingAllKeyboardKeys(); - inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; } - inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; return g.ActiveIdUsingKeyInputMask[key]; } - inline void SetActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; g.ActiveIdUsingKeyInputMask.SetBit(key); } inline ImGuiKey MouseButtonToKey(ImGuiMouseButton button) { IM_ASSERT(button >= 0 && button < ImGuiMouseButton_COUNT); return (ImGuiKey)(ImGuiKey_MouseLeft + button); } IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f); - IMGUI_API ImVec2 GetKeyVector2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down); + IMGUI_API ImVec2 GetKeyMagnitude2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down); IMGUI_API float GetNavTweakPressedAmount(ImGuiAxis axis); IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate); IMGUI_API void GetTypematicRepeatRate(ImGuiInputFlags flags, float* repeat_delay, float* repeat_rate); - IMGUI_API bool IsKeyPressedEx(ImGuiKey key, ImGuiInputFlags flags = 0); -#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO - inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // [removed in 1.87] -#endif + IMGUI_API void SetActiveIdUsingAllKeyboardKeys(); + inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; } + + // [EXPERIMENTAL] Low-Level: Key/Input Ownership + // - The idea is that instead of "eating" a given input, we can link to an owner id. + // - Ownership is most often claimed as a result of reacting to a press/down event (but occasionally may be claimed ahead). + // - Input queries can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_None (== -1) or a custom ID. + // - Legacy input queries (without specifying an owner or _Any or _None) are equivalent to using ImGuiKeyOwner_Any (== 0). + // - Input ownership is automatically released on the frame after a key is released. Therefore: + // - for ownership registration happening as a result of a down/press event, the SetKeyOwner() call may be done once (common case). + // - for ownership registration happening ahead of a down/press event, the SetKeyOwner() call needs to be made every frame (happens if e.g. claiming ownership on hover). + // - SetItemKeyOwner() is a shortcut for common simple case. A custom widget will probably want to call SetKeyOwner() multiple times directly based on its interaction state. + // - This is marked experimental because not all widgets are fully honoring the Set/Test idioms. We will need to move forward step by step. + // Please open a GitHub Issue to submit your usage scenario or if there's a use case you need solved. + IMGUI_API ImGuiID GetKeyOwner(ImGuiKey key); + IMGUI_API void SetKeyOwner(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags = 0); + IMGUI_API void SetKeyOwnersForKeyChord(ImGuiKeyChord key, ImGuiID owner_id, ImGuiInputFlags flags = 0); + IMGUI_API void SetItemKeyOwner(ImGuiKey key, ImGuiInputFlags flags = 0); // Set key owner to last item if it is hovered or active. Equivalent to 'if (IsItemHovered() || IsItemActive()) { SetKeyOwner(key, GetItemID());'. + IMGUI_API bool TestKeyOwner(ImGuiKey key, ImGuiID owner_id); // Test that key is either not owned, either owned by 'owner_id' + inline ImGuiKeyOwnerData* GetKeyOwnerData(ImGuiContext* ctx, ImGuiKey key) { if (key & ImGuiMod_Mask_) key = ConvertSingleModFlagToKey(ctx, key); IM_ASSERT(IsNamedKey(key)); return &ctx->KeysOwnerData[key - ImGuiKey_NamedKey_BEGIN]; } + + // [EXPERIMENTAL] High-Level: Input Access functions w/ support for Key/Input Ownership + // - Important: legacy IsKeyPressed(ImGuiKey, bool repeat=true) _DEFAULTS_ to repeat, new IsKeyPressed() requires _EXPLICIT_ ImGuiInputFlags_Repeat flag. + // - Expected to be later promoted to public API, the prototypes are designed to replace existing ones (since owner_id can default to Any == 0) + // - Specifying a value for 'ImGuiID owner' will test that EITHER the key is NOT owned (UNLESS locked), EITHER the key is owned by 'owner'. + // Legacy functions use ImGuiKeyOwner_Any meaning that they typically ignore ownership, unless a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease. + // - Binding generators may want to ignore those for now, or suffix them with Ex() until we decide if this gets moved into public API. + IMGUI_API bool IsKeyDown(ImGuiKey key, ImGuiID owner_id); + IMGUI_API bool IsKeyPressed(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags = 0); // Important: when transitioning from old to new IsKeyPressed(): old API has "bool repeat = true", so would default to repeat. New API requiress explicit ImGuiInputFlags_Repeat. + IMGUI_API bool IsKeyReleased(ImGuiKey key, ImGuiID owner_id); + IMGUI_API bool IsMouseDown(ImGuiMouseButton button, ImGuiID owner_id); + IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, ImGuiID owner_id, ImGuiInputFlags flags = 0); + IMGUI_API bool IsMouseReleased(ImGuiMouseButton button, ImGuiID owner_id); + + // [EXPERIMENTAL] Shortcut Routing + // - ImGuiKeyChord = a ImGuiKey optionally OR-red with ImGuiMod_Alt/ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Super. + // ImGuiKey_C (accepted by functions taking ImGuiKey or ImGuiKeyChord) + // ImGuiKey_C | ImGuiMod_Ctrl (accepted by functions taking ImGuiKeyChord) + // ONLY ImGuiMod_XXX values are legal to 'OR' with an ImGuiKey. You CANNOT 'OR' two ImGuiKey values. + // - When using one of the routing flags (e.g. ImGuiInputFlags_RouteFocused): routes requested ahead of time given a chord (key + modifiers) and a routing policy. + // - Routes are resolved during NewFrame(): if keyboard modifiers are matching current ones: SetKeyOwner() is called + route is granted for the frame. + // - Route is granted to a single owner. When multiple requests are made we have policies to select the winning route. + // - Multiple read sites may use the same owner id and will all get the granted route. + // - For routing: when owner_id is 0 we use the current Focus Scope ID as a default owner in order to identify our location. + IMGUI_API bool Shortcut(ImGuiKeyChord key_chord, ImGuiID owner_id = 0, ImGuiInputFlags flags = 0); + IMGUI_API bool SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id = 0, ImGuiInputFlags flags = 0); + IMGUI_API bool TestShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id); + IMGUI_API ImGuiKeyRoutingData* GetShortcutRoutingData(ImGuiKeyChord key_chord); + + // [EXPERIMENTAL] Focus Scope + // This is generally used to identify a unique input location (for e.g. a selection set) + // There is one per window (automatically set in Begin), but: + // - Selection patterns generally need to react (e.g. clear a selection) when landing on one item of the set. + // So in order to identify a set multiple lists in same window may each need a focus scope. + // If you imagine an hypothetical BeginSelectionGroup()/EndSelectionGroup() api, it would likely call PushFocusScope()/EndFocusScope() + // - Shortcut routing also use focus scope as a default location identifier if an owner is not provided. + // We don't use the ID Stack for this as it is common to want them separate. + IMGUI_API void PushFocusScope(ImGuiID id); + IMGUI_API void PopFocusScope(); + inline ImGuiID GetCurrentFocusScope() { ImGuiContext& g = *GImGui; return g.CurrentFocusScopeId; } // Focus scope we are outputting into, set by PushFocusScope() // Drag and Drop IMGUI_API bool IsDragDropActive(); IMGUI_API bool BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id); IMGUI_API void ClearDragDrop(); IMGUI_API bool IsDragDropPayloadBeingAccepted(); + IMGUI_API void RenderDragDropTargetRect(const ImRect& bb); // Internal Columns API (this is not exposed because we will encourage transitioning to the Tables API) IMGUI_API void SetWindowClipRectBeforeSetChannel(ImGuiWindow* window, const ImRect& clip_rect); @@ -2771,7 +3072,8 @@ namespace ImGui IMGUI_API void TableOpenContextMenu(int column_n = -1); IMGUI_API void TableSetColumnWidth(int column_n, float width); IMGUI_API void TableSetColumnSortDirection(int column_n, ImGuiSortDirection sort_direction, bool append_to_sort_specs); - IMGUI_API int TableGetHoveredColumn(); // May use (TableGetColumnFlags() & ImGuiTableColumnFlags_IsHovered) instead. Return hovered column. return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered. + IMGUI_API int TableGetHoveredColumn(); // May use (TableGetColumnFlags() & ImGuiTableColumnFlags_IsHovered) instead. Return hovered column. return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered. + IMGUI_API int TableGetHoveredRow(); // Retrieve *PREVIOUS FRAME* hovered row. This difference with TableGetHoveredColumn() is the reason why this is not public yet. IMGUI_API float TableGetHeaderRowHeight(); IMGUI_API void TablePushBackgroundChannel(); IMGUI_API void TablePopBackgroundChannel(); @@ -2790,7 +3092,8 @@ namespace ImGui IMGUI_API void TableDrawContextMenu(ImGuiTable* table); IMGUI_API bool TableBeginContextMenuPopup(ImGuiTable* table); IMGUI_API void TableMergeDrawChannels(ImGuiTable* table); - inline ImGuiTableInstanceData* TableGetInstanceData(ImGuiTable* table, int instance_no) { if (instance_no == 0) return &table->InstanceDataFirst; return &table->InstanceDataExtra[instance_no - 1]; } + inline ImGuiTableInstanceData* TableGetInstanceData(ImGuiTable* table, int instance_no) { if (instance_no == 0) return &table->InstanceDataFirst; return &table->InstanceDataExtra[instance_no - 1]; } + inline ImGuiID TableGetInstanceID(ImGuiTable* table, int instance_no) { return TableGetInstanceData(table, instance_no)->TableInstanceID; } IMGUI_API void TableSortSpecsSanitize(ImGuiTable* table); IMGUI_API void TableSortSpecsBuild(ImGuiTable* table); IMGUI_API ImGuiSortDirection TableGetColumnNextSortDirection(ImGuiTableColumn* column); @@ -2802,7 +3105,7 @@ namespace ImGui IMGUI_API void TableEndCell(ImGuiTable* table); IMGUI_API ImRect TableGetCellBgRect(const ImGuiTable* table, int column_n); IMGUI_API const char* TableGetColumnName(const ImGuiTable* table, int column_n); - IMGUI_API ImGuiID TableGetColumnResizeID(const ImGuiTable* table, int column_n, int instance_no = 0); + IMGUI_API ImGuiID TableGetColumnResizeID(ImGuiTable* table, int column_n, int instance_no = 0); IMGUI_API float TableGetMaxColumnWidth(const ImGuiTable* table, int column_n); IMGUI_API void TableSetColumnWidthAutoSingle(ImGuiTable* table, int column_n); IMGUI_API void TableSetColumnWidthAutoAll(ImGuiTable* table); @@ -2821,15 +3124,22 @@ namespace ImGui IMGUI_API ImGuiTableSettings* TableSettingsFindByID(ImGuiID id); // Tab Bars + inline ImGuiTabBar* GetCurrentTabBar() { ImGuiContext& g = *GImGui; return g.CurrentTabBar; } IMGUI_API bool BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& bb, ImGuiTabBarFlags flags); IMGUI_API ImGuiTabItem* TabBarFindTabByID(ImGuiTabBar* tab_bar, ImGuiID tab_id); + IMGUI_API ImGuiTabItem* TabBarFindTabByOrder(ImGuiTabBar* tab_bar, int order); + IMGUI_API ImGuiTabItem* TabBarGetCurrentTab(ImGuiTabBar* tab_bar); + inline int TabBarGetTabOrder(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) { return tab_bar->Tabs.index_from_ptr(tab); } + IMGUI_API const char* TabBarGetTabName(ImGuiTabBar* tab_bar, ImGuiTabItem* tab); IMGUI_API void TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id); IMGUI_API void TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab); - IMGUI_API void TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int offset); - IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, ImVec2 mouse_pos); + IMGUI_API void TabBarQueueFocus(ImGuiTabBar* tab_bar, ImGuiTabItem* tab); + IMGUI_API void TabBarQueueReorder(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, int offset); + IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, ImVec2 mouse_pos); IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar); - IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags); - IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button); + IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window); + IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker); + IMGUI_API ImVec2 TabItemCalcSize(ImGuiWindow* window); IMGUI_API void TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col); IMGUI_API void TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char* label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool* out_just_closed, bool* out_text_clipped); @@ -2859,25 +3169,28 @@ namespace ImGui // Widgets IMGUI_API void TextEx(const char* text, const char* text_end = NULL, ImGuiTextFlags flags = 0); IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0); + IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0); + IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col, ImGuiButtonFlags flags = 0); + IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags, float thickness = 1.0f); + IMGUI_API void SeparatorTextEx(ImGuiID id, const char* label, const char* label_end, float extra_width); + IMGUI_API bool CheckboxFlags(const char* label, ImS64* flags, ImS64 flags_value); + IMGUI_API bool CheckboxFlags(const char* label, ImU64* flags, ImU64 flags_value); + + // Widgets: Window Decorations IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos); IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos); - IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0); IMGUI_API void Scrollbar(ImGuiAxis axis); IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 avail_v, ImS64 contents_v, ImDrawFlags flags); - IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col); IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis); IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis); IMGUI_API ImGuiID GetWindowResizeCornerID(ImGuiWindow* window, int n); // 0..3: corners IMGUI_API ImGuiID GetWindowResizeBorderID(ImGuiWindow* window, ImGuiDir dir); - IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags); - IMGUI_API bool CheckboxFlags(const char* label, ImS64* flags, ImS64 flags_value); - IMGUI_API bool CheckboxFlags(const char* label, ImU64* flags, ImU64 flags_value); // Widgets low-level behaviors IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0); IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags); IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb); - IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f); + IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f, ImU32 bg_col = 0); IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL); IMGUI_API void TreePushOverrideID(ImGuiID id); IMGUI_API void TreeNodeSetOpen(ImGuiID id, bool open); @@ -2903,6 +3216,7 @@ namespace ImGui // InputText IMGUI_API bool InputTextEx(const char* label, const char* hint, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); + IMGUI_API void InputTextDeactivateHook(ImGuiID id); IMGUI_API bool TempInputText(const ImRect& bb, ImGuiID id, const char* label, char* buf, int buf_size, ImGuiInputTextFlags flags); IMGUI_API bool TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min = NULL, const void* p_clamp_max = NULL); inline bool TempInputIsActive(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.ActiveId == id && g.TempInputId == id); } @@ -2914,7 +3228,7 @@ namespace ImGui IMGUI_API void ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags); // Plot - IMGUI_API int PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size); + IMGUI_API int PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, const ImVec2& size_arg); // Shade functions (write over already created vertices) IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1); @@ -2933,12 +3247,17 @@ namespace ImGui IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL); IMGUI_API void ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL); IMGUI_API void ErrorCheckUsingSetCursorPosToExtendParentBoundaries(); - inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); } + IMGUI_API void DebugDrawCursorPos(ImU32 col = IM_COL32(255, 0, 0, 255)); + IMGUI_API void DebugDrawLineExtents(ImU32 col = IM_COL32(255, 0, 0, 255)); + IMGUI_API void DebugDrawItemRect(ImU32 col = IM_COL32(255, 0, 0, 255)); + IMGUI_API void DebugLocateItem(ImGuiID target_id); // Call sparingly: only 1 at the same time! + IMGUI_API void DebugLocateItemOnHover(ImGuiID target_id); // Only call on reaction to a mouse Hover: because only 1 at the same time! + IMGUI_API void DebugLocateItemResolveWithLastItem(); inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; } IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas); IMGUI_API void DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* data_id, const void* data_id_end); IMGUI_API void DebugNodeColumns(ImGuiOldColumns* columns); - IMGUI_API void DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label); + IMGUI_API void DebugNodeDrawList(ImGuiWindow* window, ImGuiViewportP* viewport, const ImDrawList* draw_list, const char* label); IMGUI_API void DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, const ImDrawList* draw_list, const ImDrawCmd* draw_cmd, bool show_mesh, bool show_aabb); IMGUI_API void DebugNodeFont(ImFont* font); IMGUI_API void DebugNodeFontGlyph(ImFont* font, const ImFontGlyph* glyph); @@ -2952,20 +3271,25 @@ namespace ImGui IMGUI_API void DebugNodeWindowsList(ImVector* windows, const char* label); IMGUI_API void DebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows, int windows_size, ImGuiWindow* parent_in_begin_stack); IMGUI_API void DebugNodeViewport(ImGuiViewportP* viewport); + IMGUI_API void DebugRenderKeyboardPreview(ImDrawList* draw_list); IMGUI_API void DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb); // Obsolete functions #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + inline void SetItemUsingMouseWheel() { SetItemKeyOwner(ImGuiKey_MouseWheelY); } // Changed in 1.89 inline bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0) { return TreeNodeUpdateNextOpen(id, flags); } // Renamed in 1.89 // Refactored focus/nav/tabbing system in 1.82 and 1.84. If you have old/custom copy-and-pasted widgets that used FocusableItemRegister(): // (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool tab_focused = FocusableItemRegister(...)' // (Old) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0' - // (New) IMGUI_VERSION_NUM >= 18413: using 'ItemAdd(..., ImGuiItemFlags_Inputable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_FocusedTabbing) != 0 || g.NavActivateInputId == id' (WIP) + // (New) IMGUI_VERSION_NUM >= 18413: using 'ItemAdd(..., ImGuiItemFlags_Inputable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_FocusedTabbing) != 0 || (g.NavActivateId == id && (g.NavActivateFlags & ImGuiActivateFlags_PreferInput))' (WIP) // Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText() inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) { IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Inputable flag to ItemAdd() inline void FocusableItemUnregister(ImGuiWindow* window) { IM_ASSERT(0); IM_UNUSED(window); } // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem #endif +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // Removed in 1.87: Mapping from named key is always identity! +#endif } // namespace ImGui @@ -2998,14 +3322,15 @@ IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table //----------------------------------------------------------------------------- #ifdef IMGUI_ENABLE_TEST_ENGINE -extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, const ImRect& bb, ImGuiID id); +extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, ImGuiID id, const ImRect& bb, const ImGuiLastItemData* item_data); // item_data may be NULL extern void ImGuiTestEngineHook_ItemInfo(ImGuiContext* ctx, ImGuiID id, const char* label, ImGuiItemStatusFlags flags); extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const char* fmt, ...); extern const char* ImGuiTestEngine_FindItemDebugLabel(ImGuiContext* ctx, ImGuiID id); -#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID) // Register item bounding box -#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional) -#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log +// In IMGUI_VERSION_NUM >= 18934: changed IMGUI_TEST_ENGINE_ITEM_ADD(bb,id) to IMGUI_TEST_ENGINE_ITEM_ADD(id,bb,item_data); +#define IMGUI_TEST_ENGINE_ITEM_ADD(_ID,_BB,_ITEM_DATA) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _ID, _BB, _ITEM_DATA) // Register item bounding box +#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional) +#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log #else #define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) ((void)0) #define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)g) diff --git a/bgfx/3rdparty/dear-imgui/imgui_tables.cpp b/bgfx/3rdparty/dear-imgui/imgui_tables.cpp index 3692c248..8fdcbcf8 100644 --- a/bgfx/3rdparty/dear-imgui/imgui_tables.cpp +++ b/bgfx/3rdparty/dear-imgui/imgui_tables.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89 WIP +// dear imgui, v1.89.9 // (tables and columns code) /* @@ -80,20 +80,20 @@ Index of this file: // - outer_size.x <= 0.0f -> Right-align from window/work-rect right-most edge. With -FLT_MIN or 0.0f will align exactly on right-most edge. // - outer_size.x > 0.0f -> Set Fixed width. // Y with ScrollX/ScrollY disabled: we output table directly in current window -// - outer_size.y < 0.0f -> Bottom-align (but will auto extend, unless _NoHostExtendY is set). Not meaningful is parent window can vertically scroll. +// - outer_size.y < 0.0f -> Bottom-align (but will auto extend, unless _NoHostExtendY is set). Not meaningful if parent window can vertically scroll. // - outer_size.y = 0.0f -> No minimum height (but will auto extend, unless _NoHostExtendY is set) -// - outer_size.y > 0.0f -> Set Minimum height (but will auto extend, unless _NoHostExtenY is set) +// - outer_size.y > 0.0f -> Set Minimum height (but will auto extend, unless _NoHostExtendY is set) // Y with ScrollX/ScrollY enabled: using a child window for scrolling -// - outer_size.y < 0.0f -> Bottom-align. Not meaningful is parent window can vertically scroll. +// - outer_size.y < 0.0f -> Bottom-align. Not meaningful if parent window can vertically scroll. // - outer_size.y = 0.0f -> Bottom-align, consistent with BeginChild(). Not recommended unless table is last item in parent window. // - outer_size.y > 0.0f -> Set Exact height. Recommended when using Scrolling on any axis. //----------------------------------------------------------------------------- // Outer size is also affected by the NoHostExtendX/NoHostExtendY flags. -// Important to that note how the two flags have slightly different behaviors! +// Important to note how the two flags have slightly different behaviors! // - ImGuiTableFlags_NoHostExtendX -> Make outer width auto-fit to columns (overriding outer_size.x value). Only available when ScrollX/ScrollY are disabled and Stretch columns are not used. // - ImGuiTableFlags_NoHostExtendY -> Make outer height stop exactly at outer_size.y (prevent auto-extending table past the limit). Only available when ScrollX/ScrollY is disabled. Data below the limit will be clipped and not visible. // In theory ImGuiTableFlags_NoHostExtendY could be the default and any non-scrolling tables with outer_size.y != 0.0f would use exact height. -// This would be consistent but perhaps less useful and more confusing (as vertically clipped items are not easily noticeable) +// This would be consistent but perhaps less useful and more confusing (as vertically clipped items are not useful and not easily noticeable). //----------------------------------------------------------------------------- // About 'inner_width': // With ScrollX disabled: @@ -112,15 +112,16 @@ Index of this file: //----------------------------------------------------------------------------- // COLUMNS SIZING POLICIES +// (Reference: ImGuiTableFlags_SizingXXX flags and ImGuiTableColumnFlags_WidthXXX flags) //----------------------------------------------------------------------------- // About overriding column sizing policy and width/weight with TableSetupColumn(): -// We use a default parameter of 'init_width_or_weight == -1'. +// We use a default parameter of -1 for 'init_width'/'init_weight'. // - with ImGuiTableColumnFlags_WidthFixed, init_width <= 0 (default) --> width is automatic // - with ImGuiTableColumnFlags_WidthFixed, init_width > 0 (explicit) --> width is custom // - with ImGuiTableColumnFlags_WidthStretch, init_weight <= 0 (default) --> weight is 1.0f // - with ImGuiTableColumnFlags_WidthStretch, init_weight > 0 (explicit) --> weight is custom // Widths are specified _without_ CellPadding. If you specify a width of 100.0f, the column will be cover (100.0f + Padding * 2.0f) -// and you can fit a 100.0f wide item in it without clipping and with full padding. +// and you can fit a 100.0f wide item in it without clipping and with padding honored. //----------------------------------------------------------------------------- // About default sizing policy (if you don't specify a ImGuiTableColumnFlags_WidthXXXX flag) // - with Table policy ImGuiTableFlags_SizingFixedFit --> default Column policy is ImGuiTableColumnFlags_WidthFixed, default Width is equal to contents width @@ -134,10 +135,10 @@ Index of this file: // - using mixed policies with ScrollX does not make much sense, as using Stretch columns with ScrollX does not make much sense in the first place! // that is, unless 'inner_width' is passed to BeginTable() to explicitly provide a total width to layout columns in. // - when using ImGuiTableFlags_SizingFixedSame with mixed columns, only the Fixed/Auto columns will match their widths to the width of the maximum contents. -// - when using ImGuiTableFlags_SizingStretchSame with mixed columns, only the Stretch columns will match their weight/widths. +// - when using ImGuiTableFlags_SizingStretchSame with mixed columns, only the Stretch columns will match their weights/widths. //----------------------------------------------------------------------------- // About using column width: -// If a column is manual resizable or has a width specified with TableSetupColumn(): +// If a column is manually resizable or has a width specified with TableSetupColumn(): // - you may use GetContentRegionAvail().x to query the width available in a given column. // - right-side alignment features such as SetNextItemWidth(-x) or PushItemWidth(-x) will rely on this width. // If the column is not resizable and has no width specified with TableSetupColumn(): @@ -151,7 +152,7 @@ Index of this file: // TABLES CLIPPING/CULLING //----------------------------------------------------------------------------- // About clipping/culling of Rows in Tables: -// - For large numbers of rows, it is recommended you use ImGuiListClipper to only submit visible rows. +// - For large numbers of rows, it is recommended you use ImGuiListClipper to submit only visible rows. // ImGuiListClipper is reliant on the fact that rows are of equal height. // See 'Demo->Tables->Vertical Scrolling' or 'Demo->Tables->Advanced' for a demo of using the clipper. // - Note that auto-resizing columns don't play well with using the clipper. @@ -168,7 +169,7 @@ Index of this file: // - Case C: column is hidden explicitly by the user (e.g. via the context menu, or _DefaultHide column flag, etc.). // // [A] [B] [C] -// TableNextColumn(): true false false -> [userland] when TableNextColumn() / TableSetColumnIndex() return false, user can skip submitting items but only if the column doesn't contribute to row height. +// TableNextColumn(): true false false -> [userland] when TableNextColumn() / TableSetColumnIndex() returns false, user can skip submitting items but only if the column doesn't contribute to row height. // SkipItems: false false true -> [internal] when SkipItems is true, most widgets will early out if submitted, resulting is no layout output. // ClipRect: normal zero-width zero-width -> [internal] when ClipRect is zero, ItemAdd() will return false and most widgets will early out mid-way. // ImDrawList output: normal dummy dummy -> [internal] when using the dummy channel, ImDrawList submissions (if any) will be wasted (because cliprect is zero-width anyway). @@ -188,20 +189,16 @@ Index of this file: #define _CRT_SECURE_NO_WARNINGS #endif -#include "imgui.h" -#ifndef IMGUI_DISABLE - #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif + +#include "imgui.h" +#ifndef IMGUI_DISABLE #include "imgui_internal.h" // System includes -#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier -#include // intptr_t -#else #include // intptr_t -#endif // Visual Studio warnings #ifdef _MSC_VER @@ -315,11 +312,11 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG return false; // Sanity checks - IM_ASSERT(columns_count > 0 && columns_count <= IMGUI_TABLE_MAX_COLUMNS && "Only 1..64 columns allowed!"); + IM_ASSERT(columns_count > 0 && columns_count < IMGUI_TABLE_MAX_COLUMNS); if (flags & ImGuiTableFlags_ScrollX) IM_ASSERT(inner_width >= 0.0f); - // If an outer size is specified ahead we will be able to early out when not visible. Exact clipping rules may evolve. + // If an outer size is specified ahead we will be able to early out when not visible. Exact clipping criteria may evolve. const bool use_child_window = (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) != 0; const ImVec2 avail_size = GetContentRegionAvail(); ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f); @@ -332,11 +329,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG // Acquire storage for the table ImGuiTable* table = g.Tables.GetOrAddByKey(id); - const int instance_no = (table->LastFrameActive != g.FrameCount) ? 0 : table->InstanceCurrent + 1; - const ImGuiID instance_id = id + instance_no; const ImGuiTableFlags table_last_flags = table->Flags; - if (instance_no > 0) - IM_ASSERT(table->ColumnsCount == columns_count && "BeginTable(): Cannot change columns count mid-frame while preserving same ID"); // Acquire temporary buffers const int table_idx = g.Tables.GetIndex(table); @@ -352,17 +345,32 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG flags = TableFixFlags(flags, outer_window); // Initialize + const int instance_no = (table->LastFrameActive != g.FrameCount) ? 0 : table->InstanceCurrent + 1; table->ID = id; table->Flags = flags; - table->InstanceCurrent = (ImS16)instance_no; table->LastFrameActive = g.FrameCount; table->OuterWindow = table->InnerWindow = outer_window; table->ColumnsCount = columns_count; table->IsLayoutLocked = false; table->InnerWidth = inner_width; temp_data->UserOuterSize = outer_size; - if (instance_no > 0 && table->InstanceDataExtra.Size < instance_no) - table->InstanceDataExtra.push_back(ImGuiTableInstanceData()); + + // Instance data (for instance 0, TableID == TableInstanceID) + ImGuiID instance_id; + table->InstanceCurrent = (ImS16)instance_no; + if (instance_no > 0) + { + IM_ASSERT(table->ColumnsCount == columns_count && "BeginTable(): Cannot change columns count mid-frame while preserving same ID"); + if (table->InstanceDataExtra.Size < instance_no) + table->InstanceDataExtra.push_back(ImGuiTableInstanceData()); + instance_id = GetIDWithSeed(instance_no, GetIDWithSeed("##Instances", NULL, id)); // Push "##Instances" followed by (int)instance_no in ID stack. + } + else + { + instance_id = id; + } + ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); + table_instance->TableInstanceID = instance_id; // When not using a child window, WorkRect.Max will grow as we append contents. if (use_child_window) @@ -395,6 +403,14 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG table->OuterRect = table->InnerWindow->Rect(); table->InnerRect = table->InnerWindow->InnerRect; IM_ASSERT(table->InnerWindow->WindowPadding.x == 0.0f && table->InnerWindow->WindowPadding.y == 0.0f && table->InnerWindow->WindowBorderSize == 0.0f); + + // When using multiple instances, ensure they have the same amount of horizontal decorations (aka vertical scrollbar) so stretched columns can be aligned) + if (instance_no == 0) + { + table->HasScrollbarYPrev = table->HasScrollbarYCurr; + table->HasScrollbarYCurr = false; + } + table->HasScrollbarYCurr |= table->InnerWindow->ScrollbarY; } else { @@ -404,7 +420,9 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG } // Push a standardized ID for both child-using and not-child-using tables - PushOverrideID(instance_id); + PushOverrideID(id); + if (instance_no > 0) + PushOverrideID(instance_id); // FIXME: Somehow this is not resolved by stack-tool, even tho GetIDWithSeed() submitted the symbol. // Backup a copy of host window members we will modify ImGuiWindow* inner_window = table->InnerWindow; @@ -434,7 +452,6 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG table->CellSpacingX1 = inner_spacing_explicit + inner_spacing_for_border; table->CellSpacingX2 = inner_spacing_explicit; table->CellPaddingX = inner_padding_explicit; - table->CellPaddingY = g.Style.CellPadding.y; const float outer_padding_for_border = (flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f; const float outer_padding_explicit = pad_outer_x ? g.Style.CellPadding.x : 0.0f; @@ -451,17 +468,19 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow() + table->RowCellPaddingY = 0.0f; table->FreezeRowsRequest = table->FreezeRowsCount = 0; // This will be setup by TableSetupScrollFreeze(), if any table->FreezeColumnsRequest = table->FreezeColumnsCount = 0; table->IsUnfrozenRows = true; table->DeclColumnsCount = 0; - // Using opaque colors facilitate overlapping elements of the grid + // Using opaque colors facilitate overlapping lines of the grid, otherwise we'd need to improve TableDrawBorders() table->BorderColorStrong = GetColorU32(ImGuiCol_TableBorderStrong); table->BorderColorLight = GetColorU32(ImGuiCol_TableBorderLight); // Make table current g.CurrentTable = table; + outer_window->DC.NavIsScrollPushableX = false; // Shortcut for NavUpdateCurrentWindowIsScrollPushableX(); outer_window->DC.CurrentTableIdx = table_idx; if (inner_window != outer_window) // So EndChild() within the inner window can restore the table properly. inner_window->DC.CurrentTableIdx = table_idx; @@ -469,7 +488,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG if ((table_last_flags & ImGuiTableFlags_Reorderable) && (flags & ImGuiTableFlags_Reorderable) == 0) table->IsResetDisplayOrderRequest = true; - // Mark as used + // Mark as used to avoid GC if (table_idx >= g.TablesLastTimeActive.Size) g.TablesLastTimeActive.resize(table_idx + 1, -1.0f); g.TablesLastTimeActive[table_idx] = (float)g.Time; @@ -562,34 +581,40 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG } // For reference, the average total _allocation count_ for a table is: -// + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables) +// + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables[]) // + 1 (for table->RawData allocated below) // + 1 (for table->ColumnsNames, if names are used) -// Shared allocations per number of nested tables +// Shared allocations for the maximum number of simultaneously nested tables (generally a very small number) // + 1 (for table->Splitter._Channels) // + 2 * active_channels_count (for ImDrawCmd and ImDrawIdx buffers inside channels) -// Where active_channels_count is variable but often == columns_count or columns_count + 1, see TableSetupDrawChannels() for details. +// Where active_channels_count is variable but often == columns_count or == columns_count + 1, see TableSetupDrawChannels() for details. // Unused channels don't perform their +2 allocations. void ImGui::TableBeginInitMemory(ImGuiTable* table, int columns_count) { // Allocate single buffer for our arrays - ImSpanAllocator<3> span_allocator; + const int columns_bit_array_size = (int)ImBitArrayGetStorageSizeInBytes(columns_count); + ImSpanAllocator<6> span_allocator; span_allocator.Reserve(0, columns_count * sizeof(ImGuiTableColumn)); span_allocator.Reserve(1, columns_count * sizeof(ImGuiTableColumnIdx)); span_allocator.Reserve(2, columns_count * sizeof(ImGuiTableCellData), 4); + for (int n = 3; n < 6; n++) + span_allocator.Reserve(n, columns_bit_array_size); table->RawData = IM_ALLOC(span_allocator.GetArenaSizeInBytes()); memset(table->RawData, 0, span_allocator.GetArenaSizeInBytes()); span_allocator.SetArenaBasePtr(table->RawData); span_allocator.GetSpan(0, &table->Columns); span_allocator.GetSpan(1, &table->DisplayOrderToIndex); span_allocator.GetSpan(2, &table->RowCellData); + table->EnabledMaskByDisplayOrder = (ImU32*)span_allocator.GetSpanPtrBegin(3); + table->EnabledMaskByIndex = (ImU32*)span_allocator.GetSpanPtrBegin(4); + table->VisibleMaskByIndex = (ImU32*)span_allocator.GetSpanPtrBegin(5); } // Apply queued resizing/reordering/hiding requests void ImGui::TableBeginApplyRequests(ImGuiTable* table) { // Handle resizing request - // (We process this at the first TableBegin of the frame) + // (We process this in the TableBegin() of the first instance of each table) // FIXME-TABLE: Contains columns if our work area doesn't allow for scrolling? if (table->InstanceCurrent == 0) { @@ -634,8 +659,7 @@ void ImGui::TableBeginApplyRequests(ImGuiTable* table) table->Columns[table->DisplayOrderToIndex[order_n]].DisplayOrder -= (ImGuiTableColumnIdx)reorder_dir; IM_ASSERT(dst_column->DisplayOrder == dst_order - reorder_dir); - // Display order is stored in both columns->IndexDisplayOrder and table->DisplayOrder[], - // rebuild the later from the former. + // Display order is stored in both columns->IndexDisplayOrder and table->DisplayOrder[]. Rebuild later from the former. for (int column_n = 0; column_n < table->ColumnsCount; column_n++) table->DisplayOrderToIndex[table->Columns[column_n].DisplayOrder] = (ImGuiTableColumnIdx)column_n; table->ReorderColumnDir = 0; @@ -709,8 +733,8 @@ static void TableSetupColumnFlags(ImGuiTable* table, ImGuiTableColumn* column, I } } -// Layout columns for the frame. This is in essence the followup to BeginTable(). -// Runs on the first call to TableNextRow(), to give a chance for TableSetupColumn() to be called first. +// Layout columns for the frame. This is in essence the followup to BeginTable() and this is our largest function. +// Runs on the first call to TableNextRow(), to give a chance for TableSetupColumn() and other TableSetupXXXXX() functions to be called first. // FIXME-TABLE: Our width (and therefore our WorkRect) will be minimal in the first frame for _WidthAuto columns. // Increase feedback side-effect with widgets relying on WorkRect.Max.x... Maybe provide a default distribution for _WidthAuto columns? void ImGui::TableUpdateLayout(ImGuiTable* table) @@ -721,8 +745,8 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) const ImGuiTableFlags table_sizing_policy = (table->Flags & ImGuiTableFlags_SizingMask_); table->IsDefaultDisplayOrder = true; table->ColumnsEnabledCount = 0; - table->EnabledMaskByIndex = 0x00; - table->EnabledMaskByDisplayOrder = 0x00; + ImBitArrayClearAllBits(table->EnabledMaskByIndex, table->ColumnsCount); + ImBitArrayClearAllBits(table->EnabledMaskByDisplayOrder, table->ColumnsCount); table->LeftMostEnabledColumn = -1; table->MinColumnWidth = ImMax(1.0f, g.Style.FramePadding.x * 1.0f); // g.Style.ColumnsMinSpacing; // FIXME-TABLE @@ -787,8 +811,8 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) else table->LeftMostEnabledColumn = (ImGuiTableColumnIdx)column_n; column->IndexWithinEnabledSet = table->ColumnsEnabledCount++; - table->EnabledMaskByIndex |= (ImU64)1 << column_n; - table->EnabledMaskByDisplayOrder |= (ImU64)1 << column->DisplayOrder; + ImBitArraySetBit(table->EnabledMaskByIndex, column_n); + ImBitArraySetBit(table->EnabledMaskByDisplayOrder, column->DisplayOrder); prev_visible_column_idx = column_n; IM_ASSERT(column->IndexWithinEnabledSet <= column->DisplayOrder); @@ -831,12 +855,12 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) table->IsSettingsDirty = true; // [Part 3] Fix column flags and record a few extra information. - float sum_width_requests = 0.0f; // Sum of all width for fixed and auto-resize columns, excluding width contributed by Stretch columns but including spacing/padding. - float stretch_sum_weights = 0.0f; // Sum of all weights for stretch columns. + float sum_width_requests = 0.0f; // Sum of all width for fixed and auto-resize columns, excluding width contributed by Stretch columns but including spacing/padding. + float stretch_sum_weights = 0.0f; // Sum of all weights for stretch columns. table->LeftMostStretchedColumn = table->RightMostStretchedColumn = -1; for (int column_n = 0; column_n < table->ColumnsCount; column_n++) { - if (!(table->EnabledMaskByIndex & ((ImU64)1 << column_n))) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByIndex, column_n)) continue; ImGuiTableColumn* column = &table->Columns[column_n]; @@ -852,7 +876,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) // Latch initial size for fixed columns and update it constantly for auto-resizing column (unless clipped!) if (column->AutoFitQueue != 0x00) column->WidthRequest = width_auto; - else if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !column_is_resizable && (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n))) + else if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !column_is_resizable && column->IsRequestOutput) column->WidthRequest = width_auto; // FIXME-TABLE: Increase minimum size during init frame to avoid biasing auto-fitting widgets @@ -893,13 +917,14 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) // [Part 4] Apply final widths based on requested widths const ImRect work_rect = table->WorkRect; const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1); - const float width_avail = ((table->Flags & ImGuiTableFlags_ScrollX) && table->InnerWidth == 0.0f) ? table->InnerClipRect.GetWidth() : work_rect.GetWidth(); + const float width_removed = (table->HasScrollbarYPrev && !table->InnerWindow->ScrollbarY) ? g.Style.ScrollbarSize : 0.0f; // To synchronize decoration width of synched tables with mismatching scrollbar state (#5920) + const float width_avail = ImMax(1.0f, (((table->Flags & ImGuiTableFlags_ScrollX) && table->InnerWidth == 0.0f) ? table->InnerClipRect.GetWidth() : work_rect.GetWidth()) - width_removed); const float width_avail_for_stretched_columns = width_avail - width_spacings - sum_width_requests; float width_remaining_for_stretched_columns = width_avail_for_stretched_columns; table->ColumnsGivenWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount; for (int column_n = 0; column_n < table->ColumnsCount; column_n++) { - if (!(table->EnabledMaskByIndex & ((ImU64)1 << column_n))) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByIndex, column_n)) continue; ImGuiTableColumn* column = &table->Columns[column_n]; @@ -926,7 +951,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) if (width_remaining_for_stretched_columns >= 1.0f && !(table->Flags & ImGuiTableFlags_PreciseWidths)) for (int order_n = table->ColumnsCount - 1; stretch_sum_weights > 0.0f && width_remaining_for_stretched_columns >= 1.0f && order_n >= 0; order_n--) { - if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n))) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByDisplayOrder, order_n)) continue; ImGuiTableColumn* column = &table->Columns[table->DisplayOrderToIndex[order_n]]; if (!(column->Flags & ImGuiTableColumnFlags_WidthStretch)) @@ -936,11 +961,21 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) width_remaining_for_stretched_columns -= 1.0f; } + // Determine if table is hovered which will be used to flag columns as hovered. + // - In principle we'd like to use the equivalent of IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem), + // but because our item is partially submitted at this point we use ItemHoverable() and a workaround (temporarily + // clear ActiveId, which is equivalent to the change provided by _AllowWhenBLockedByActiveItem). + // - This allows columns to be marked as hovered when e.g. clicking a button inside the column, or using drag and drop. ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); + table_instance->HoveredRowLast = table_instance->HoveredRowNext; + table_instance->HoveredRowNext = -1; table->HoveredColumnBody = -1; table->HoveredColumnBorder = -1; const ImRect mouse_hit_rect(table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.Max.x, ImMax(table->OuterRect.Max.y, table->OuterRect.Min.y + table_instance->LastOuterHeight)); - const bool is_hovering_table = ItemHoverable(mouse_hit_rect, 0); + const ImGuiID backup_active_id = g.ActiveId; + g.ActiveId = 0; + const bool is_hovering_table = ItemHoverable(mouse_hit_rect, 0, ImGuiItemFlags_None); + g.ActiveId = backup_active_id; // [Part 6] Setup final position, offset, skip/clip states and clipping rectangles, detect hovered column // Process columns in their visible orders as we are comparing the visible order and adjusting host_clip_rect while looping. @@ -949,14 +984,13 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) float offset_x = ((table->FreezeColumnsCount > 0) ? table->OuterRect.Min.x : work_rect.Min.x) + table->OuterPaddingX - table->CellSpacingX1; ImRect host_clip_rect = table->InnerClipRect; //host_clip_rect.Max.x += table->CellPaddingX + table->CellSpacingX2; - table->VisibleMaskByIndex = 0x00; - table->RequestOutputMaskByIndex = 0x00; + ImBitArrayClearAllBits(table->VisibleMaskByIndex, table->ColumnsCount); for (int order_n = 0; order_n < table->ColumnsCount; order_n++) { const int column_n = table->DisplayOrderToIndex[order_n]; ImGuiTableColumn* column = &table->Columns[column_n]; - column->NavLayerCurrent = (ImS8)((table->FreezeRowsCount > 0 || column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main); + column->NavLayerCurrent = (ImS8)(table->FreezeRowsCount > 0 ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main); // Use Count NOT request so Header line changes layer when frozen if (offset_x_frozen && table->FreezeColumnsCount == visible_n) { @@ -967,7 +1001,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) // Clear status flags column->Flags &= ~ImGuiTableColumnFlags_StatusMask_; - if ((table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)) == 0) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByDisplayOrder, order_n)) { // Hidden column: clear a few fields and we are done with it for the remainder of the function. // We set a zero-width clip rect but set Min.y/Max.y properly to not interfere with the clipper. @@ -1020,12 +1054,10 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) column->IsVisibleY = true; // (column->ClipRect.Max.y > column->ClipRect.Min.y); const bool is_visible = column->IsVisibleX; //&& column->IsVisibleY; if (is_visible) - table->VisibleMaskByIndex |= ((ImU64)1 << column_n); + ImBitArraySetBit(table->VisibleMaskByIndex, column_n); // Mark column as requesting output from user. Note that fixed + non-resizable sets are auto-fitting at all times and therefore always request output. column->IsRequestOutput = is_visible || column->AutoFitQueue != 0 || column->CannotSkipItemsQueue != 0; - if (column->IsRequestOutput) - table->RequestOutputMaskByIndex |= ((ImU64)1 << column_n); // Mark column as SkipItems (ignoring all items/layout) column->IsSkipItems = !column->IsEnabled || table->HostSkipItems; @@ -1094,6 +1126,14 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) table->BorderX1 = table->InnerClipRect.Min.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : -1.0f); table->BorderX2 = table->InnerClipRect.Max.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : +1.0f); + // Setup window's WorkRect.Max.y for GetContentRegionAvail(). Other values will be updated in each TableBeginCell() call. + float window_content_max_y; + if (table->Flags & ImGuiTableFlags_NoHostExtendY) + window_content_max_y = table->OuterRect.Max.y; + else + window_content_max_y = ImMax(table->InnerWindow->ContentRegionRect.Max.y, (table->Flags & ImGuiTableFlags_ScrollY) ? 0.0f : table->OuterRect.Max.y); + table->InnerWindow->WorkRect.Max.y = ImClamp(window_content_max_y - g.Style.CellPadding.y, table->InnerWindow->WorkRect.Min.y, table->InnerWindow->WorkRect.Max.y); + // [Part 9] Allocate draw channels and setup background cliprect TableSetupDrawChannels(table); @@ -1111,11 +1151,18 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) EndPopup(); } - // [Part 13] Sanitize and build sort specs before we have a change to use them for display. + // [Part 12] Sanitize and build sort specs before we have a chance to use them for display. // This path will only be exercised when sort specs are modified before header rows (e.g. init or visibility change) if (table->IsSortSpecsDirty && (table->Flags & ImGuiTableFlags_Sortable)) TableSortSpecsBuild(table); + // [Part 13] Setup inner window decoration size (for scrolling / nav tracking to properly take account of frozen rows/columns) + if (table->FreezeColumnsRequest > 0) + table->InnerWindow->DecoInnerSizeX1 = table->Columns[table->DisplayOrderToIndex[table->FreezeColumnsRequest - 1]].MaxX - table->OuterRect.Min.x; + if (table->FreezeRowsRequest > 0) + table->InnerWindow->DecoInnerSizeY1 = table_instance->LastFrozenHeight; + table_instance->LastFrozenHeight = 0.0f; + // Initial state ImGuiWindow* inner_window = table->InnerWindow; if (table->Flags & ImGuiTableFlags_NoClip) @@ -1125,9 +1172,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) } // Process hit-testing on resizing borders. Actual size change will be applied in EndTable() -// - Set table->HoveredColumnBorder with a short delay/timer to reduce feedback noise -// - Submit ahead of table contents and header, use ImGuiButtonFlags_AllowItemOverlap to prioritize widgets -// overlapping the same area. +// - Set table->HoveredColumnBorder with a short delay/timer to reduce visual feedback noise. void ImGui::TableUpdateBorders(ImGuiTable* table) { ImGuiContext& g = *GImGui; @@ -1145,7 +1190,7 @@ void ImGui::TableUpdateBorders(ImGuiTable* table) for (int order_n = 0; order_n < table->ColumnsCount; order_n++) { - if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n))) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByDisplayOrder, order_n)) continue; const int column_n = table->DisplayOrderToIndex[order_n]; @@ -1163,11 +1208,11 @@ void ImGui::TableUpdateBorders(ImGuiTable* table) ImGuiID column_id = TableGetColumnResizeID(table, column_n, table->InstanceCurrent); ImRect hit_rect(column->MaxX - hit_half_width, hit_y1, column->MaxX + hit_half_width, border_y2_hit); + ItemAdd(hit_rect, column_id, NULL, ImGuiItemFlags_NoNav); //GetForegroundDrawList()->AddRect(hit_rect.Min, hit_rect.Max, IM_COL32(255, 0, 0, 100)); - KeepAliveID(column_id); bool hovered = false, held = false; - bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_NoNavFocus); + bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_NoNavFocus); if (pressed && IsMouseDoubleClicked(0)) { TableSetColumnWidthAutoSingle(table, column_n); @@ -1281,7 +1326,7 @@ void ImGui::EndTable() float auto_fit_width_for_stretched = 0.0f; float auto_fit_width_for_stretched_min = 0.0f; for (int column_n = 0; column_n < table->ColumnsCount; column_n++) - if (table->EnabledMaskByIndex & ((ImU64)1 << column_n)) + if (IM_BITARRAY_TESTBIT(table->EnabledMaskByIndex, column_n)) { ImGuiTableColumn* column = &table->Columns[column_n]; float column_width_request = ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !(column->Flags & ImGuiTableColumnFlags_NoResize)) ? column->WidthRequest : TableGetColumnWidthAuto(table, column); @@ -1321,8 +1366,10 @@ void ImGui::EndTable() } // Pop from id stack - IM_ASSERT_USER_ERROR(inner_window->IDStack.back() == table->ID + table->InstanceCurrent, "Mismatching PushID/PopID!"); + IM_ASSERT_USER_ERROR(inner_window->IDStack.back() == table_instance->TableInstanceID, "Mismatching PushID/PopID!"); IM_ASSERT_USER_ERROR(outer_window->DC.ItemWidthStack.Size >= temp_data->HostBackupItemWidthStackSize, "Too many PopItemWidth!"); + if (table->InstanceCurrent > 0) + PopID(); PopID(); // Restore window data that we modified @@ -1394,6 +1441,7 @@ void ImGui::EndTable() g.CurrentTable->DrawSplitter = &temp_data->DrawSplitter; } outer_window->DC.CurrentTableIdx = g.CurrentTable ? g.Tables.GetIndex(g.CurrentTable) : -1; + NavUpdateCurrentWindowIsScrollPushableX(); } // See "COLUMN SIZING POLICIES" comments at the top of this file @@ -1505,6 +1553,7 @@ void ImGui::TableSetupScrollFreeze(int columns, int rows) // - TableGetCellBgRect() [Internal] // - TableGetColumnResizeID() [Internal] // - TableGetHoveredColumn() [Internal] +// - TableGetHoveredRow() [Internal] // - TableSetBgColor() //----------------------------------------------------------------------------- @@ -1592,14 +1641,14 @@ ImRect ImGui::TableGetCellBgRect(const ImGuiTable* table, int column_n) } // Return the resizing ID for the right-side of the given column. -ImGuiID ImGui::TableGetColumnResizeID(const ImGuiTable* table, int column_n, int instance_no) +ImGuiID ImGui::TableGetColumnResizeID(ImGuiTable* table, int column_n, int instance_no) { IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount); - ImGuiID id = table->ID + 1 + (instance_no * table->ColumnsCount) + column_n; - return id; + ImGuiID instance_id = TableGetInstanceID(table, instance_no); + return instance_id + 1 + column_n; // FIXME: #6140: still not ideal } -// Return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered. +// Return -1 when table is not hovered. return columns_count if hovering the unused space at the right of the right-most visible column. int ImGui::TableGetHoveredColumn() { ImGuiContext& g = *GImGui; @@ -1609,6 +1658,19 @@ int ImGui::TableGetHoveredColumn() return (int)table->HoveredColumnBody; } +// Return -1 when table is not hovered. Return maxrow+1 if in table but below last submitted row. +// *IMPORTANT* Unlike TableGetHoveredColumn(), this has a one frame latency in updating the value. +// This difference with is the reason why this is not public yet. +int ImGui::TableGetHoveredRow() +{ + ImGuiContext& g = *GImGui; + ImGuiTable* table = g.CurrentTable; + if (!table) + return -1; + ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); + return (int)table_instance->HoveredRowLast; +} + void ImGui::TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n) { ImGuiContext& g = *GImGui; @@ -1627,7 +1689,7 @@ void ImGui::TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n return; if (column_n == -1) column_n = table->CurrentColumn; - if ((table->VisibleMaskByIndex & ((ImU64)1 << column_n)) == 0) + if (!IM_BITARRAY_TESTBIT(table->VisibleMaskByIndex, column_n)) return; if (table->RowCellDataCurrent < 0 || table->RowCellData[table->RowCellDataCurrent].Column != column_n) table->RowCellDataCurrent++; @@ -1683,19 +1745,20 @@ void ImGui::TableNextRow(ImGuiTableRowFlags row_flags, float row_min_height) table->LastRowFlags = table->RowFlags; table->RowFlags = row_flags; + table->RowCellPaddingY = g.Style.CellPadding.y; table->RowMinHeight = row_min_height; TableBeginRow(table); // We honor min_row_height requested by user, but cannot guarantee per-row maximum height, // because that would essentially require a unique clipping rectangle per-cell. - table->RowPosY2 += table->CellPaddingY * 2.0f; + table->RowPosY2 += table->RowCellPaddingY * 2.0f; table->RowPosY2 = ImMax(table->RowPosY2, table->RowPosY1 + row_min_height); // Disable output until user calls TableNextColumn() table->InnerWindow->SkipItems = true; } -// [Internal] Called by TableNextRow() +// [Internal] Only called by TableNextRow() void ImGui::TableBeginRow(ImGuiTable* table) { ImGuiWindow* window = table->InnerWindow; @@ -1716,8 +1779,10 @@ void ImGui::TableBeginRow(ImGuiTable* table) table->RowPosY1 = table->RowPosY2 = next_y1; table->RowTextBaseline = 0.0f; table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent + window->DC.PrevLineTextBaseOffset = 0.0f; - window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); + window->DC.CursorPosPrevLine = ImVec2(window->DC.CursorPos.x, window->DC.CursorPos.y + table->RowCellPaddingY); // This allows users to call SameLine() to share LineSize between columns. + window->DC.PrevLineSize = window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); // This allows users to call SameLine() to share LineSize between columns, and to call it from first column too. window->DC.IsSameLine = window->DC.IsSetPos = false; window->DC.CursorMaxPos.y = next_y1; @@ -1760,6 +1825,10 @@ void ImGui::TableEndRow(ImGuiTable* table) const bool is_visible = (bg_y2 >= table->InnerClipRect.Min.y && bg_y1 <= table->InnerClipRect.Max.y); if (is_visible) { + // Update data for TableGetHoveredRow() + if (table->HoveredColumnBody != -1 && g.IO.MousePos.y >= bg_y1 && g.IO.MousePos.y < bg_y2) + TableGetInstanceData(table, table->InstanceCurrent)->HoveredRowNext = table->CurrentRow; + // Decide of background color for the row ImU32 bg_col0 = 0; ImU32 bg_col1 = 0; @@ -1831,17 +1900,15 @@ void ImGui::TableEndRow(ImGuiTable* table) // get the new cursor position. if (unfreeze_rows_request) for (int column_n = 0; column_n < table->ColumnsCount; column_n++) - { - ImGuiTableColumn* column = &table->Columns[column_n]; - column->NavLayerCurrent = (ImS8)((column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main); - } + table->Columns[column_n].NavLayerCurrent = ImGuiNavLayer_Main; if (unfreeze_rows_actual) { IM_ASSERT(table->IsUnfrozenRows == false); + const float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y); table->IsUnfrozenRows = true; + TableGetInstanceData(table, table->InstanceCurrent)->LastFrozenHeight = y0 - table->OuterRect.Min.y; // BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect - float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y); table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, window->InnerClipRect.Max.y); table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = window->InnerClipRect.Max.y; table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen; @@ -1904,7 +1971,7 @@ bool ImGui::TableSetColumnIndex(int column_n) // Return whether the column is visible. User may choose to skip submitting items based on this return value, // however they shouldn't skip submitting for columns that may have the tallest contribution to row height. - return (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n)) != 0; + return table->Columns[column_n].IsRequestOutput; } // [Public] Append into the next column, wrap and create a new row when already on last column @@ -1929,8 +1996,7 @@ bool ImGui::TableNextColumn() // Return whether the column is visible. User may choose to skip submitting items based on this return value, // however they shouldn't skip submitting for columns that may have the tallest contribution to row height. - int column_n = table->CurrentColumn; - return (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n)) != 0; + return table->Columns[table->CurrentColumn].IsRequestOutput; } @@ -1939,6 +2005,7 @@ bool ImGui::TableNextColumn() // FIXME-TABLE FIXME-OPT: Could probably shortcut some things for non-active or clipped columns. void ImGui::TableBeginCell(ImGuiTable* table, int column_n) { + ImGuiContext& g = *GImGui; ImGuiTableColumn* column = &table->Columns[column_n]; ImGuiWindow* window = table->InnerWindow; table->CurrentColumn = column_n; @@ -1949,25 +2016,22 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n) start_x += table->RowIndentOffsetX; // ~~ += window.DC.Indent.x - table->HostIndentX, except we locked it for the row. window->DC.CursorPos.x = start_x; - window->DC.CursorPos.y = table->RowPosY1 + table->CellPaddingY; + window->DC.CursorPos.y = table->RowPosY1 + table->RowCellPaddingY; window->DC.CursorMaxPos.x = window->DC.CursorPos.x; window->DC.ColumnsOffset.x = start_x - window->Pos.x - window->DC.Indent.x; // FIXME-WORKRECT + window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x; // PrevLine.y is preserved. This allows users to call SameLine() to share LineSize between columns. window->DC.CurrLineTextBaseOffset = table->RowTextBaseline; window->DC.NavLayerCurrent = (ImGuiNavLayer)column->NavLayerCurrent; + // Note how WorkRect.Max.y is only set once during layout window->WorkRect.Min.y = window->DC.CursorPos.y; window->WorkRect.Min.x = column->WorkMinX; window->WorkRect.Max.x = column->WorkMaxX; window->DC.ItemWidth = column->ItemWidth; - // To allow ImGuiListClipper to function we propagate our row height - if (!column->IsEnabled) - window->DC.CursorPos.y = ImMax(window->DC.CursorPos.y, table->RowPosY2); - window->SkipItems = column->IsSkipItems; if (column->IsSkipItems) { - ImGuiContext& g = *GImGui; g.LastItemData.ID = 0; g.LastItemData.StatusFlags = 0; } @@ -1986,7 +2050,6 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n) } // Logging - ImGuiContext& g = *GImGui; if (g.LogEnabled && !column->IsSkipItems) { LogRenderedText(&window->DC.CursorPos, "|"); @@ -2010,7 +2073,8 @@ void ImGui::TableEndCell(ImGuiTable* table) else p_max_pos_x = table->IsUnfrozenRows ? &column->ContentMaxXUnfrozen : &column->ContentMaxXFrozen; *p_max_pos_x = ImMax(*p_max_pos_x, window->DC.CursorMaxPos.x); - table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY); + if (column->IsEnabled) + table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->RowCellPaddingY); column->ItemWidth = window->DC.ItemWidth; // Propagate text baseline for the entire row @@ -2105,7 +2169,7 @@ void ImGui::TableSetColumnWidth(int column_n, float width) // - All stretch: easy. // - One or more fixed + one stretch: easy. // - One or more fixed + more than one stretch: tricky. - // Qt when manual resize is enabled only support a single _trailing_ stretch column. + // Qt when manual resize is enabled only supports a single _trailing_ stretch column, we support more cases here. // When forwarding resize from Wn| to Fn+1| we need to be considerate of the _NoResize flag on Fn+1. // FIXME-TABLE: Find a way to rewrite all of this so interactions feel more consistent for the user. @@ -2188,7 +2252,7 @@ void ImGui::TableUpdateColumnsWeightFromWidth(ImGuiTable* table) { IM_ASSERT(table->LeftMostStretchedColumn != -1 && table->RightMostStretchedColumn != -1); - // Measure existing quantity + // Measure existing quantities float visible_weight = 0.0f; float visible_width = 0.0f; for (int column_n = 0; column_n < table->ColumnsCount; column_n++) @@ -2270,7 +2334,7 @@ void ImGui::TableSetupDrawChannels(ImGuiTable* table) const int freeze_row_multiplier = (table->FreezeRowsCount > 0) ? 2 : 1; const int channels_for_row = (table->Flags & ImGuiTableFlags_NoClip) ? 1 : table->ColumnsEnabledCount; const int channels_for_bg = 1 + 1 * freeze_row_multiplier; - const int channels_for_dummy = (table->ColumnsEnabledCount < table->ColumnsCount || table->VisibleMaskByIndex != table->EnabledMaskByIndex) ? +1 : 0; + const int channels_for_dummy = (table->ColumnsEnabledCount < table->ColumnsCount || (memcmp(table->VisibleMaskByIndex, table->EnabledMaskByIndex, ImBitArrayGetStorageSizeInBytes(table->ColumnsCount)) != 0)) ? +1 : 0; const int channels_total = channels_for_bg + (channels_for_row * freeze_row_multiplier) + channels_for_dummy; table->DrawSplitter->Split(table->InnerWindow->DrawList, channels_total); table->DummyDrawChannel = (ImGuiTableDrawChannelIdx)((channels_for_dummy > 0) ? channels_total - 1 : -1); @@ -2344,19 +2408,26 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) // Track which groups we are going to attempt to merge, and which channels goes into each group. struct MergeGroup { - ImRect ClipRect; - int ChannelsCount; - ImBitArray ChannelsMask; - - MergeGroup() { ChannelsCount = 0; } + ImRect ClipRect; + int ChannelsCount = 0; + ImBitArrayPtr ChannelsMask = NULL; }; int merge_group_mask = 0x00; MergeGroup merge_groups[4]; + // Use a reusable temp buffer for the merge masks as they are dynamically sized. + const int max_draw_channels = (4 + table->ColumnsCount * 2); + const int size_for_masks_bitarrays_one = (int)ImBitArrayGetStorageSizeInBytes(max_draw_channels); + g.TempBuffer.reserve(size_for_masks_bitarrays_one * 5); + memset(g.TempBuffer.Data, 0, size_for_masks_bitarrays_one * 5); + for (int n = 0; n < IM_ARRAYSIZE(merge_groups); n++) + merge_groups[n].ChannelsMask = (ImBitArrayPtr)(void*)(g.TempBuffer.Data + (size_for_masks_bitarrays_one * n)); + ImBitArrayPtr remaining_mask = (ImBitArrayPtr)(void*)(g.TempBuffer.Data + (size_for_masks_bitarrays_one * 4)); + // 1. Scan channels and take note of those which can be merged for (int column_n = 0; column_n < table->ColumnsCount; column_n++) { - if ((table->VisibleMaskByIndex & ((ImU64)1 << column_n)) == 0) + if (!IM_BITARRAY_TESTBIT(table->VisibleMaskByIndex, column_n)) continue; ImGuiTableColumn* column = &table->Columns[column_n]; @@ -2388,11 +2459,11 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) } const int merge_group_n = (has_freeze_h && column_n < table->FreezeColumnsCount ? 0 : 1) + (has_freeze_v && merge_group_sub_n == 0 ? 0 : 2); - IM_ASSERT(channel_no < IMGUI_TABLE_MAX_DRAW_CHANNELS); + IM_ASSERT(channel_no < max_draw_channels); MergeGroup* merge_group = &merge_groups[merge_group_n]; if (merge_group->ChannelsCount == 0) merge_group->ClipRect = ImRect(+FLT_MAX, +FLT_MAX, -FLT_MAX, -FLT_MAX); - merge_group->ChannelsMask.SetBit(channel_no); + ImBitArraySetBit(merge_group->ChannelsMask, channel_no); merge_group->ChannelsCount++; merge_group->ClipRect.Add(src_channel->_CmdBuffer[0].ClipRect); merge_group_mask |= (1 << merge_group_n); @@ -2428,9 +2499,8 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) const int LEADING_DRAW_CHANNELS = 2; g.DrawChannelsTempMergeBuffer.resize(splitter->_Count - LEADING_DRAW_CHANNELS); // Use shared temporary storage so the allocation gets amortized ImDrawChannel* dst_tmp = g.DrawChannelsTempMergeBuffer.Data; - ImBitArray remaining_mask; // We need 132-bit of storage - remaining_mask.SetBitRange(LEADING_DRAW_CHANNELS, splitter->_Count); - remaining_mask.ClearBit(table->Bg2DrawChannelUnfrozen); + ImBitArraySetBitRange(remaining_mask, LEADING_DRAW_CHANNELS, splitter->_Count); + ImBitArrayClearBit(remaining_mask, table->Bg2DrawChannelUnfrozen); IM_ASSERT(has_freeze_v == false || table->Bg2DrawChannelUnfrozen != TABLE_DRAW_CHANNEL_BG2_FROZEN); int remaining_count = splitter->_Count - (has_freeze_v ? LEADING_DRAW_CHANNELS + 1 : LEADING_DRAW_CHANNELS); //ImRect host_rect = (table->InnerWindow == table->OuterWindow) ? table->InnerClipRect : table->HostClipRect; @@ -2457,20 +2527,18 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) merge_clip_rect.Max.x = ImMax(merge_clip_rect.Max.x, host_rect.Max.x); if ((merge_group_n & 2) != 0 && (table->Flags & ImGuiTableFlags_NoHostExtendY) == 0) merge_clip_rect.Max.y = ImMax(merge_clip_rect.Max.y, host_rect.Max.y); -#if 0 - GetOverlayDrawList()->AddRect(merge_group->ClipRect.Min, merge_group->ClipRect.Max, IM_COL32(255, 0, 0, 200), 0.0f, 0, 1.0f); - GetOverlayDrawList()->AddLine(merge_group->ClipRect.Min, merge_clip_rect.Min, IM_COL32(255, 100, 0, 200)); - GetOverlayDrawList()->AddLine(merge_group->ClipRect.Max, merge_clip_rect.Max, IM_COL32(255, 100, 0, 200)); -#endif + //GetForegroundDrawList()->AddRect(merge_group->ClipRect.Min, merge_group->ClipRect.Max, IM_COL32(255, 0, 0, 200), 0.0f, 0, 1.0f); // [DEBUG] + //GetForegroundDrawList()->AddLine(merge_group->ClipRect.Min, merge_clip_rect.Min, IM_COL32(255, 100, 0, 200)); + //GetForegroundDrawList()->AddLine(merge_group->ClipRect.Max, merge_clip_rect.Max, IM_COL32(255, 100, 0, 200)); remaining_count -= merge_group->ChannelsCount; - for (int n = 0; n < IM_ARRAYSIZE(remaining_mask.Storage); n++) - remaining_mask.Storage[n] &= ~merge_group->ChannelsMask.Storage[n]; + for (int n = 0; n < (size_for_masks_bitarrays_one >> 2); n++) + remaining_mask[n] &= ~merge_group->ChannelsMask[n]; for (int n = 0; n < splitter->_Count && merge_channels_count != 0; n++) { // Copy + overwrite new clip rect - if (!merge_group->ChannelsMask.TestBit(n)) + if (!IM_BITARRAY_TESTBIT(merge_group->ChannelsMask, n)) continue; - merge_group->ChannelsMask.ClearBit(n); + IM_BITARRAY_CLEARBIT(merge_group->ChannelsMask, n); merge_channels_count--; ImDrawChannel* channel = &splitter->_Channels[n]; @@ -2488,7 +2556,7 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) // Append unmergeable channels that we didn't reorder at the end of the list for (int n = 0; n < splitter->_Count && remaining_count != 0; n++) { - if (!remaining_mask.TestBit(n)) + if (!IM_BITARRAY_TESTBIT(remaining_mask, n)) continue; ImDrawChannel* channel = &splitter->_Channels[n]; memcpy(dst_tmp++, channel, sizeof(ImDrawChannel)); @@ -2520,7 +2588,7 @@ void ImGui::TableDrawBorders(ImGuiTable* table) { for (int order_n = 0; order_n < table->ColumnsCount; order_n++) { - if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n))) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByDisplayOrder, order_n)) continue; const int column_n = table->DisplayOrderToIndex[order_n]; @@ -2608,8 +2676,9 @@ void ImGui::TableDrawBorders(ImGuiTable* table) //------------------------------------------------------------------------- // Return NULL if no sort specs (most often when ImGuiTableFlags_Sortable is not set) -// You can sort your data again when 'SpecsChanged == true'. It will be true with sorting specs have changed since -// last call, or the first time. +// When 'sort_specs->SpecsDirty == true' you should sort your data. It will be true when sorting specs have +// changed since last call, or the first time. Make sure to set 'SpecsDirty = false' after sorting, +// else you may wastefully sort your data every frame! // Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable()! ImGuiTableSortSpecs* ImGui::TableGetSortSpecs() { @@ -2625,7 +2694,6 @@ ImGuiTableSortSpecs* ImGui::TableGetSortSpecs() TableUpdateLayout(table); TableSortSpecsBuild(table); - return &table->SortSpecs; } @@ -2744,7 +2812,7 @@ void ImGui::TableSortSpecsSanitize(ImGuiTable* table) } } - // Fallback default sort order (if no column had the ImGuiTableColumnFlags_DefaultSort flag) + // Fallback default sort order (if no column with the ImGuiTableColumnFlags_DefaultSort flag) if (sort_order_count == 0 && !(table->Flags & ImGuiTableFlags_SortTristate)) for (int column_n = 0; column_n < table->ColumnsCount; column_n++) { @@ -2848,10 +2916,9 @@ void ImGui::TableHeadersRow() continue; // Push an id to allow unnamed labels (generally accidental, but let's behave nicely with them) - // - in your own code you may omit the PushID/PopID all-together, provided you know they won't collide - // - table->InstanceCurrent is only >0 when we use multiple BeginTable/EndTable calls with same identifier. + // In your own code you may omit the PushID/PopID all-together, provided you know they won't collide. const char* name = (TableGetColumnFlags(column_n) & ImGuiTableColumnFlags_NoHeaderLabel) ? "" : TableGetColumnName(column_n); - PushID(table->InstanceCurrent * table->ColumnsCount + column_n); + PushID(column_n); TableHeader(name); PopID(); } @@ -2889,7 +2956,7 @@ void ImGui::TableHeader(const char* label) // If we already got a row height, there's use that. // FIXME-TABLE: Padding problem if the correct outer-padding CellBgRect strays off our ClipRect? ImRect cell_r = TableGetCellBgRect(table, column_n); - float label_height = ImMax(label_size.y, table->RowMinHeight - table->CellPaddingY * 2.0f); + float label_height = ImMax(label_size.y, table->RowMinHeight - table->RowCellPaddingY * 2.0f); // Calculate ideal size for sort order arrow float w_arrow = 0.0f; @@ -2922,11 +2989,9 @@ void ImGui::TableHeader(const char* label) //GetForegroundDrawList()->AddRect(cell_r.Min, cell_r.Max, IM_COL32(255, 0, 0, 255)); // [DEBUG] //GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 0, 0, 255)); // [DEBUG] - // Using AllowItemOverlap mode because we cover the whole cell, and we want user to be able to submit subsequent items. + // Using AllowOverlap mode because we cover the whole cell, and we want user to be able to submit subsequent items. bool hovered, held; - bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_AllowItemOverlap); - if (g.ActiveId != id) - SetItemAllowOverlap(); + bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_AllowOverlap); if (held || hovered || selected) { const ImU32 col = GetColorU32(held ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); @@ -2966,7 +3031,7 @@ void ImGui::TableHeader(const char* label) } // Sort order arrow - const float ellipsis_max = cell_r.Max.x - w_arrow - w_sort_text; + const float ellipsis_max = ImMax(cell_r.Max.x - w_arrow - w_sort_text, label_pos.x); if ((table->Flags & ImGuiTableFlags_Sortable) && !(column->Flags & ImGuiTableColumnFlags_NoSort)) { if (column->SortOrder != -1) @@ -2997,8 +3062,8 @@ void ImGui::TableHeader(const char* label) RenderTextEllipsis(window->DrawList, label_pos, ImVec2(ellipsis_max, label_pos.y + label_height + g.Style.FramePadding.y), ellipsis_max, ellipsis_max, label, label_end, &label_size); const bool text_clipped = label_size.x > (ellipsis_max - label_pos.x); - if (text_clipped && hovered && g.ActiveId == 0 && IsItemHovered(ImGuiHoveredFlags_DelayNormal)) - SetTooltip("%.*s", (int)(label_end - label), label); + if (text_clipped && hovered && g.ActiveId == 0) + SetItemTooltip("%.*s", (int)(label_end - label), label); // We don't use BeginPopupContextItem() because we want the popup to stay up even after the column is hidden if (IsMouseReleased(1) && IsItemHovered()) @@ -3062,15 +3127,15 @@ void ImGui::TableDrawContextMenu(ImGuiTable* table) if (column != NULL) { const bool can_resize = !(column->Flags & ImGuiTableColumnFlags_NoResize) && column->IsEnabled; - if (MenuItem("Size column to fit###SizeOne", NULL, false, can_resize)) + if (MenuItem(LocalizeGetMsg(ImGuiLocKey_TableSizeOne), NULL, false, can_resize)) // "###SizeOne" TableSetColumnWidthAutoSingle(table, column_n); } const char* size_all_desc; if (table->ColumnsEnabledFixedCount == table->ColumnsEnabledCount && (table->Flags & ImGuiTableFlags_SizingMask_) != ImGuiTableFlags_SizingFixedSame) - size_all_desc = "Size all columns to fit###SizeAll"; // All fixed + size_all_desc = LocalizeGetMsg(ImGuiLocKey_TableSizeAllFit); // "###SizeAll" All fixed else - size_all_desc = "Size all columns to default###SizeAll"; // All stretch or mixed + size_all_desc = LocalizeGetMsg(ImGuiLocKey_TableSizeAllDefault); // "###SizeAll" All stretch or mixed if (MenuItem(size_all_desc, NULL)) TableSetColumnWidthAutoAll(table); want_separator = true; @@ -3079,7 +3144,7 @@ void ImGui::TableDrawContextMenu(ImGuiTable* table) // Ordering if (table->Flags & ImGuiTableFlags_Reorderable) { - if (MenuItem("Reset order", NULL, false, !table->IsDefaultDisplayOrder)) + if (MenuItem(LocalizeGetMsg(ImGuiLocKey_TableResetOrder), NULL, false, !table->IsDefaultDisplayOrder)) table->IsResetDisplayOrderRequest = true; want_separator = true; } @@ -3436,12 +3501,12 @@ static void TableSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandle if (!save_column) continue; buf->appendf("Column %-2d", column_n); - if (column->UserID != 0) buf->appendf(" UserID=%08X", column->UserID); - if (save_size && column->IsStretch) buf->appendf(" Weight=%.4f", column->WidthOrWeight); - if (save_size && !column->IsStretch) buf->appendf(" Width=%d", (int)column->WidthOrWeight); - if (save_visible) buf->appendf(" Visible=%d", column->IsEnabled); - if (save_order) buf->appendf(" Order=%d", column->DisplayOrder); - if (save_sort && column->SortOrder != -1) buf->appendf(" Sort=%d%c", column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? 'v' : '^'); + if (column->UserID != 0) { buf->appendf(" UserID=%08X", column->UserID); } + if (save_size && column->IsStretch) { buf->appendf(" Weight=%.4f", column->WidthOrWeight); } + if (save_size && !column->IsStretch) { buf->appendf(" Width=%d", (int)column->WidthOrWeight); } + if (save_visible) { buf->appendf(" Visible=%d", column->IsEnabled); } + if (save_order) { buf->appendf(" Order=%d", column->DisplayOrder); } + if (save_sort && column->SortOrder != -1) { buf->appendf(" Sort=%d%c", column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? 'v' : '^'); } buf->append("\n"); } buf->append("\n"); @@ -3489,7 +3554,7 @@ void ImGui::TableGcCompactTransientBuffers(ImGuiTable* table) IM_ASSERT(table->MemoryCompacted == false); table->SortSpecs.Specs = NULL; table->SortSpecsMulti.clear(); - table->IsSortSpecsDirty = true; // FIXME: shouldn't have to leak into user performing a sort + table->IsSortSpecsDirty = true; // FIXME: In theory shouldn't have to leak into user performing a sort on resume. table->ColumnsNames.clear(); table->MemoryCompacted = true; for (int n = 0; n < table->ColumnsCount; n++) @@ -3542,13 +3607,9 @@ static const char* DebugNodeTableGetSizingPolicyDesc(ImGuiTableFlags sizing_poli void ImGui::DebugNodeTable(ImGuiTable* table) { - char buf[512]; - char* p = buf; - const char* buf_end = buf + IM_ARRAYSIZE(buf); - const bool is_active = (table->LastFrameActive >= ImGui::GetFrameCount() - 2); // Note that fully clipped early out scrolling tables will appear as inactive here. - ImFormatString(p, buf_end - p, "Table 0x%08X (%d columns, in '%s')%s", table->ID, table->ColumnsCount, table->OuterWindow->Name, is_active ? "" : " *Inactive*"); + const bool is_active = (table->LastFrameActive >= GetFrameCount() - 2); // Note that fully clipped early out scrolling tables will appear as inactive here. if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); } - bool open = TreeNode(table, "%s", buf); + bool open = TreeNode(table, "Table 0x%08X (%d columns, in '%s')%s", table->ID, table->ColumnsCount, table->OuterWindow->Name, is_active ? "" : " *Inactive*"); if (!is_active) { PopStyleColor(); } if (IsItemHovered()) GetForegroundDrawList()->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255)); @@ -3557,13 +3618,18 @@ void ImGui::DebugNodeTable(ImGuiTable* table) if (!open) return; if (table->InstanceCurrent > 0) - ImGui::Text("** %d instances of same table! Some data below will refer to last instance.", table->InstanceCurrent + 1); + Text("** %d instances of same table! Some data below will refer to last instance.", table->InstanceCurrent + 1); bool clear_settings = SmallButton("Clear settings"); BulletText("OuterRect: Pos: (%.1f,%.1f) Size: (%.1f,%.1f) Sizing: '%s'", table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.GetWidth(), table->OuterRect.GetHeight(), DebugNodeTableGetSizingPolicyDesc(table->Flags)); BulletText("ColumnsGivenWidth: %.1f, ColumnsAutoFitWidth: %.1f, InnerWidth: %.1f%s", table->ColumnsGivenWidth, table->ColumnsAutoFitWidth, table->InnerWidth, table->InnerWidth == 0.0f ? " (auto)" : ""); BulletText("CellPaddingX: %.1f, CellSpacingX: %.1f/%.1f, OuterPaddingX: %.1f", table->CellPaddingX, table->CellSpacingX1, table->CellSpacingX2, table->OuterPaddingX); BulletText("HoveredColumnBody: %d, HoveredColumnBorder: %d", table->HoveredColumnBody, table->HoveredColumnBorder); BulletText("ResizedColumn: %d, ReorderColumn: %d, HeldHeaderColumn: %d", table->ResizedColumn, table->ReorderColumn, table->HeldHeaderColumn); + for (int n = 0; n < table->InstanceCurrent + 1; n++) + { + ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, n); + BulletText("Instance %d: HoveredRow: %d, LastOuterHeight: %.2f", n, table_instance->HoveredRowLast, table_instance->LastOuterHeight); + } //BulletText("BgDrawChannels: %d/%d", 0, table->BgDrawChannelUnfrozen); float sum_weights = 0.0f; for (int n = 0; n < table->ColumnsCount; n++) @@ -3573,6 +3639,7 @@ void ImGui::DebugNodeTable(ImGuiTable* table) { ImGuiTableColumn* column = &table->Columns[n]; const char* name = TableGetColumnName(table, n); + char buf[512]; ImFormatString(buf, IM_ARRAYSIZE(buf), "Column %d order %d '%s': offset %+.2f to %+.2f%s\n" "Enabled: %d, VisibleX/Y: %d/%d, RequestOutput: %d, SkipItems: %d, DrawChannels: %d,%d\n" @@ -3861,6 +3928,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiOldColumnFl columns->Count = columns_count; columns->Flags = flags; window->DC.CurrentColumns = columns; + window->DC.NavIsScrollPushableX = false; // Shortcut for NavUpdateCurrentWindowIsScrollPushableX(); columns->HostCursorPosY = window->DC.CursorPos.y; columns->HostCursorMaxPosX = window->DC.CursorMaxPos.x; @@ -3920,6 +3988,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiOldColumnFl window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f); window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding; + window->WorkRect.Max.y = window->ContentRegionRect.Max.y; } void ImGui::NextColumn() @@ -4014,8 +4083,7 @@ void ImGui::EndColumns() const ImGuiID column_id = columns->ID + ImGuiID(n); const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH; const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2)); - KeepAliveID(column_id); - if (IsClippedEx(column_hit_rect, column_id)) // FIXME: Can be removed or replaced with a lower-level test + if (!ItemAdd(column_hit_rect, column_id, NULL, ImGuiItemFlags_NoNav)) continue; bool hovered = false, held = false; @@ -4052,6 +4120,7 @@ void ImGui::EndColumns() window->DC.CurrentColumns = NULL; window->DC.ColumnsOffset.x = 0.0f; window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); + NavUpdateCurrentWindowIsScrollPushableX(); } void ImGui::Columns(int columns_count, const char* id, bool border) diff --git a/bgfx/3rdparty/dear-imgui/imgui_widgets.cpp b/bgfx/3rdparty/dear-imgui/imgui_widgets.cpp index 6a428368..22bb2a40 100644 --- a/bgfx/3rdparty/dear-imgui/imgui_widgets.cpp +++ b/bgfx/3rdparty/dear-imgui/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89 WIP +// dear imgui, v1.89.9 // (widgets code) /* @@ -32,21 +32,16 @@ Index of this file: #define _CRT_SECURE_NO_WARNINGS #endif -#include "imgui.h" -#ifndef IMGUI_DISABLE - #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif + +#include "imgui.h" +#ifndef IMGUI_DISABLE #include "imgui_internal.h" // System includes -#include // toupper -#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier -#include // intptr_t -#else #include // intptr_t -#endif //------------------------------------------------------------------------- // Warnings @@ -125,9 +120,9 @@ static const ImU64 IM_U64_MAX = (2ULL * 9223372036854775807LL + 1); //------------------------------------------------------------------------- // For InputTextEx() -static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source); +static bool InputTextFilterCharacter(ImGuiContext* ctx, unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source); static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end); -static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false); +static ImVec2 InputTextCalcTextSizeW(ImGuiContext* ctx, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false); //------------------------------------------------------------------------- // [SECTION] Widgets: Text, etc. @@ -275,7 +270,6 @@ void ImGui::TextV(const char* fmt, va_list args) if (window->SkipItems) return; - // FIXME-OPT: Handle the %s shortcut? const char* text, *text_end; ImFormatStringToTempBufferV(&text, &text_end, fmt, args); TextEx(text, text_end, ImGuiTextFlags_NoWidthForLargeClippedText); @@ -292,10 +286,7 @@ void ImGui::TextColored(const ImVec4& col, const char* fmt, ...) void ImGui::TextColoredV(const ImVec4& col, const char* fmt, va_list args) { PushStyleColor(ImGuiCol_Text, col); - if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0) - TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting - else - TextV(fmt, args); + TextV(fmt, args); PopStyleColor(); } @@ -311,10 +302,7 @@ void ImGui::TextDisabledV(const char* fmt, va_list args) { ImGuiContext& g = *GImGui; PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]); - if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0) - TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting - else - TextV(fmt, args); + TextV(fmt, args); PopStyleColor(); } @@ -329,13 +317,10 @@ void ImGui::TextWrapped(const char* fmt, ...) void ImGui::TextWrappedV(const char* fmt, va_list args) { ImGuiContext& g = *GImGui; - bool need_backup = (g.CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position if one is already set + const bool need_backup = (g.CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position if one is already set if (need_backup) PushTextWrapPos(0.0f); - if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0) - TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting - else - TextV(fmt, args); + TextV(fmt, args); if (need_backup) PopTextWrapPos(); } @@ -503,22 +488,27 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool if ((flags & ImGuiButtonFlags_PressedOnMask_) == 0) flags |= ImGuiButtonFlags_PressedOnDefault_; + // Default behavior inherited from item flags + // Note that _both_ ButtonFlags and ItemFlags are valid sources, so copy one into the item_flags and only check that. + ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.InFlags : g.CurrentItemFlags); + if (flags & ImGuiButtonFlags_AllowOverlap) + item_flags |= ImGuiItemFlags_AllowOverlap; + if (flags & ImGuiButtonFlags_Repeat) + item_flags |= ImGuiItemFlags_ButtonRepeat; + ImGuiWindow* backup_hovered_window = g.HoveredWindow; const bool flatten_hovered_children = (flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredWindow && g.HoveredWindow->RootWindow == window; if (flatten_hovered_children) g.HoveredWindow = window; #ifdef IMGUI_ENABLE_TEST_ENGINE + // Alternate registration spot, for when caller didn't use ItemAdd() if (id != 0 && g.LastItemData.ID != id) - IMGUI_TEST_ENGINE_ITEM_ADD(bb, id); + IMGUI_TEST_ENGINE_ITEM_ADD(id, bb, NULL); #endif bool pressed = false; - bool hovered = ItemHoverable(bb, id); - - // Drag source doesn't report as hovered - if (hovered && g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover)) - hovered = false; + bool hovered = ItemHoverable(bb, id, item_flags); // Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button if (g.DragDropActive && (flags & ImGuiButtonFlags_PressedOnDragDropHold) && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers)) @@ -537,23 +527,29 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool if (flatten_hovered_children) g.HoveredWindow = backup_hovered_window; - // AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one. - if (hovered && (flags & ImGuiButtonFlags_AllowItemOverlap) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0)) - hovered = false; - // Mouse handling + const ImGuiID test_owner_id = (flags & ImGuiButtonFlags_NoTestKeyOwner) ? ImGuiKeyOwner_Any : id; if (hovered) { + // Poll mouse buttons + // - 'mouse_button_clicked' is generally carried into ActiveIdMouseButton when setting ActiveId. + // - Technically we only need some values in one code path, but since this is gated by hovered test this is fine. + int mouse_button_clicked = -1; + int mouse_button_released = -1; + for (int button = 0; button < 3; button++) + if (flags & (ImGuiButtonFlags_MouseButtonLeft << button)) // Handle ImGuiButtonFlags_MouseButtonRight and ImGuiButtonFlags_MouseButtonMiddle here. + { + if (IsMouseClicked(button, test_owner_id) && mouse_button_clicked == -1) { mouse_button_clicked = button; } + if (IsMouseReleased(button, test_owner_id) && mouse_button_released == -1) { mouse_button_released = button; } + } + + // Process initial action if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt)) { - // Poll buttons - int mouse_button_clicked = -1; - if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseClicked[0]) { mouse_button_clicked = 0; } - else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseClicked[1]) { mouse_button_clicked = 1; } - else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseClicked[2]) { mouse_button_clicked = 2; } - if (mouse_button_clicked != -1 && g.ActiveId != id) { + if (!(flags & ImGuiButtonFlags_NoSetKeyOwner)) + SetKeyOwner(MouseButtonToKey(mouse_button_clicked), id); if (flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere)) { SetActiveID(id, window); @@ -577,13 +573,9 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool } if (flags & ImGuiButtonFlags_PressedOnRelease) { - int mouse_button_released = -1; - if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseReleased[0]) { mouse_button_released = 0; } - else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseReleased[1]) { mouse_button_released = 1; } - else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseReleased[2]) { mouse_button_released = 2; } if (mouse_button_released != -1) { - const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay; // Repeat mode trumps on release behavior + const bool has_repeated_at_least_once = (item_flags & ImGuiItemFlags_ButtonRepeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay; // Repeat mode trumps on release behavior if (!has_repeated_at_least_once) pressed = true; if (!(flags & ImGuiButtonFlags_NoNavFocus)) @@ -594,8 +586,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool // 'Repeat' mode acts when held regardless of _PressedOn flags (see table above). // Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings. - if (g.ActiveId == id && (flags & ImGuiButtonFlags_Repeat)) - if (g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0f && IsMouseClicked(g.ActiveIdMouseButton, true)) + if (g.ActiveId == id && (item_flags & ImGuiItemFlags_ButtonRepeat)) + if (g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0f && IsMouseClicked(g.ActiveIdMouseButton, test_owner_id, ImGuiInputFlags_Repeat)) pressed = true; } @@ -612,12 +604,13 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool { bool nav_activated_by_code = (g.NavActivateId == id); bool nav_activated_by_inputs = (g.NavActivatePressedId == id); - if (!nav_activated_by_inputs && (flags & ImGuiButtonFlags_Repeat)) + if (!nav_activated_by_inputs && (item_flags & ImGuiItemFlags_ButtonRepeat)) { - // Avoid pressing both keys from triggering double amount of repeat events + // Avoid pressing multiple keys from triggering excessive amount of repeat events const ImGuiKeyData* key1 = GetKeyData(ImGuiKey_Space); - const ImGuiKeyData* key2 = GetKeyData(ImGuiKey_NavGamepadActivate); - const float t1 = ImMax(key1->DownDuration, key2->DownDuration); + const ImGuiKeyData* key2 = GetKeyData(ImGuiKey_Enter); + const ImGuiKeyData* key3 = GetKeyData(ImGuiKey_NavGamepadActivate); + const float t1 = ImMax(ImMax(key1->DownDuration, key2->DownDuration), key3->DownDuration); nav_activated_by_inputs = CalcTypematicRepeatAmount(t1 - g.IO.DeltaTime, t1, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0; } if (nav_activated_by_code || nav_activated_by_inputs) @@ -625,7 +618,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool // Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button. pressed = true; SetActiveID(id, window); - g.ActiveIdSource = ImGuiInputSource_Nav; + g.ActiveIdSource = g.NavInputSource; if (!(flags & ImGuiButtonFlags_NoNavFocus)) SetFocusID(id, window); } @@ -641,8 +634,12 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; const int mouse_button = g.ActiveIdMouseButton; - IM_ASSERT(mouse_button >= 0 && mouse_button < ImGuiMouseButton_COUNT); - if (g.IO.MouseDown[mouse_button]) + if (mouse_button == -1) + { + // Fallback for the rare situation were g.ActiveId was set programmatically or from another widget (e.g. #6304). + ClearActiveID(); + } + else if (IsMouseDown(mouse_button, test_owner_id)) { held = true; } @@ -654,8 +651,9 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool { // Report as pressed when releasing the mouse (this is the most common path) bool is_double_click_release = (flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseReleased[mouse_button] && g.IO.MouseClickedLastCount[mouse_button] == 2; - bool is_repeating_already = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay; // Repeat mode trumps - if (!is_double_click_release && !is_repeating_already) + bool is_repeating_already = (item_flags & ImGuiItemFlags_ButtonRepeat) && g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay; // Repeat mode trumps + bool is_button_avail_or_owned = TestKeyOwner(MouseButtonToKey(mouse_button), test_owner_id); + if (!is_double_click_release && !is_repeating_already && is_button_avail_or_owned) pressed = true; } ClearActiveID(); @@ -663,7 +661,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool if (!(flags & ImGuiButtonFlags_NoNavFocus)) g.NavDisableHighlight = true; } - else if (g.ActiveIdSource == ImGuiInputSource_Nav) + else if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) { // When activated using Nav, we hold on the ActiveID until activation button is released if (g.NavActivateDownId != id) @@ -700,9 +698,6 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags if (!ItemAdd(bb, id)) return false; - if (g.LastItemData.InFlags & ImGuiItemFlags_ButtonRepeat) - flags |= ImGuiButtonFlags_Repeat; - bool hovered, held; bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); @@ -779,9 +774,6 @@ bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiBu if (!ItemAdd(bb, id)) return false; - if (g.LastItemData.InFlags & ImGuiItemFlags_ButtonRepeat) - flags |= ImGuiButtonFlags_Repeat; - bool hovered, held; bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); @@ -810,14 +802,14 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos) // Tweak 1: Shrink hit-testing area if button covers an abnormally large proportion of the visible region. That's in order to facilitate moving the window away. (#3825) // This may better be applied as a general hit-rect reduction mechanism for all widgets to ensure the area to move window is always accessible? - const ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f); + const ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize)); ImRect bb_interact = bb; const float area_to_visible_ratio = window->OuterRectClipped.GetArea() / bb.GetArea(); if (area_to_visible_ratio < 1.5f) bb_interact.Expand(ImFloor(bb_interact.GetSize() * -0.25f)); // Tweak 2: We intentionally allow interaction when clipped so that a mechanical Alt,Right,Activate sequence can always close a window. - // (this isn't the regular behavior of buttons, but it doesn't affect the user much because navigation tends to keep items visible). + // (this isn't the common behavior of buttons, but it doesn't affect the user because navigation tends to keep items visible in scrolling layer). bool is_clipped = !ItemAdd(bb_interact, id); bool hovered, held; @@ -830,7 +822,7 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos) ImU32 col = GetColorU32(held ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered); ImVec2 center = bb.GetCenter(); if (hovered) - window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col, 12); + window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col); float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f; ImU32 cross_col = GetColorU32(ImGuiCol_Text); @@ -846,17 +838,19 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos) ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f); - ItemAdd(bb, id); + ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize)); + bool is_clipped = !ItemAdd(bb, id); bool hovered, held; bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None); + if (is_clipped) + return pressed; // Render ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); ImU32 text_col = GetColorU32(ImGuiCol_Text); if (hovered || held) - window->DrawList->AddCircleFilled(bb.GetCenter()/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col, 12); - RenderArrow(window->DrawList, bb.Min + g.Style.FramePadding, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f); + window->DrawList->AddCircleFilled(bb.GetCenter() + ImVec2(0.0f, -0.5f), g.FontSize * 0.5f + 1.0f, bg_col); + RenderArrow(window->DrawList, bb.Min, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f); // Switch to moving the window after mouse is moved beyond the initial drag threshold if (IsItemActive() && IsMouseDragging(0)) @@ -879,9 +873,9 @@ ImRect ImGui::GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis) const float scrollbar_size = window->ScrollbarSizes[axis ^ 1]; // (ScrollbarSizes.x = width of Y scrollbar; ScrollbarSizes.y = height of X scrollbar) IM_ASSERT(scrollbar_size > 0.0f); if (axis == ImGuiAxis_X) - return ImRect(inner_rect.Min.x, ImMax(outer_rect.Min.y, outer_rect.Max.y - border_size - scrollbar_size), inner_rect.Max.x, outer_rect.Max.y); + return ImRect(inner_rect.Min.x, ImMax(outer_rect.Min.y, outer_rect.Max.y - border_size - scrollbar_size), inner_rect.Max.x - border_size, outer_rect.Max.y - border_size); else - return ImRect(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y, outer_rect.Max.x, inner_rect.Max.y); + return ImRect(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y, outer_rect.Max.x - border_size, inner_rect.Max.y - border_size); } void ImGui::Scrollbar(ImGuiAxis axis) @@ -926,8 +920,6 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6 if (window->SkipItems) return false; - KeepAliveID(id); - const float bb_frame_width = bb_frame.GetWidth(); const float bb_frame_height = bb_frame.GetHeight(); if (bb_frame_width <= 0.0f || bb_frame_height <= 0.0f) @@ -959,6 +951,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6 // Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar(). bool held = false; bool hovered = false; + ItemAdd(bb_frame, id, NULL, ImGuiItemFlags_NoNav); ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavFocus); const ImS64 scroll_max = ImMax((ImS64)1, size_contents_v - size_avail_v); @@ -1038,7 +1031,7 @@ void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& // ImageButton() is flawed as 'id' is always derived from 'texture_id' (see #2464 #1390) // We provide this internal helper to write your own variant while we figure out how to redesign the public ImageButton() API. -bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col) +bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col, ImGuiButtonFlags flags) { ImGuiContext& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); @@ -1052,7 +1045,7 @@ bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size return false; bool hovered, held; - bool pressed = ButtonBehavior(bb, id, &hovered, &held); + bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); // Render const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); @@ -1167,10 +1160,8 @@ bool ImGui::CheckboxFlagsT(const char* label, T* flags, T flags_value) if (!all_on && any_on) { ImGuiContext& g = *GImGui; - ImGuiItemFlags backup_item_flags = g.CurrentItemFlags; - g.CurrentItemFlags |= ImGuiItemFlags_MixedValue; + g.NextItemData.ItemFlags |= ImGuiItemFlags_MixedValue; pressed = Checkbox(label, &all_on); - g.CurrentItemFlags = backup_item_flags; } else { @@ -1237,17 +1228,18 @@ bool ImGui::RadioButton(const char* label, bool active) MarkItemEdited(id); RenderNavHighlight(total_bb, id); - window->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), 16); + const int num_segment = window->DrawList->_CalcCircleAutoSegmentCount(radius); + window->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), num_segment); if (active) { const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f)); - window->DrawList->AddCircleFilled(center, radius - pad, GetColorU32(ImGuiCol_CheckMark), 16); + window->DrawList->AddCircleFilled(center, radius - pad, GetColorU32(ImGuiCol_CheckMark)); } if (style.FrameBorderSize > 0.0f) { - window->DrawList->AddCircle(center + ImVec2(1, 1), radius, GetColorU32(ImGuiCol_BorderShadow), 16, style.FrameBorderSize); - window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), 16, style.FrameBorderSize); + window->DrawList->AddCircle(center + ImVec2(1, 1), radius, GetColorU32(ImGuiCol_BorderShadow), num_segment, style.FrameBorderSize); + window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), num_segment, style.FrameBorderSize); } ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y); @@ -1390,7 +1382,9 @@ void ImGui::AlignTextToFramePadding() } // Horizontal/vertical separating line -void ImGui::SeparatorEx(ImGuiSeparatorFlags flags) +// FIXME: Surprisingly, this seemingly trivial widget is a victim of many different legacy/tricky layout issues. +// Note how thickness == 1.0f is handled specifically as not moving CursorPos by 'thickness', but other values are. +void ImGui::SeparatorEx(ImGuiSeparatorFlags flags, float thickness) { ImGuiWindow* window = GetCurrentWindow(); if (window->SkipItems) @@ -1398,21 +1392,20 @@ void ImGui::SeparatorEx(ImGuiSeparatorFlags flags) ImGuiContext& g = *GImGui; IM_ASSERT(ImIsPowerOfTwo(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical))); // Check that only 1 option is selected + IM_ASSERT(thickness > 0.0f); - float thickness_draw = 1.0f; - float thickness_layout = 0.0f; if (flags & ImGuiSeparatorFlags_Vertical) { - // Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout. + // Vertical separator, for menu bars (use current line height). float y1 = window->DC.CursorPos.y; float y2 = window->DC.CursorPos.y + window->DC.CurrLineSize.y; - const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + thickness_draw, y2)); - ItemSize(ImVec2(thickness_layout, 0.0f)); + const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + thickness, y2)); + ItemSize(ImVec2(thickness, 0.0f)); if (!ItemAdd(bb, 0)) return; // Draw - window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator)); + window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Separator)); if (g.LogEnabled) LogText(" |"); } @@ -1434,19 +1427,22 @@ void ImGui::SeparatorEx(ImGuiSeparatorFlags flags) x2 = table->Columns[table->CurrentColumn].MaxX; } + // Before Tables API happened, we relied on Separator() to span all columns of a Columns() set. + // We currently don't need to provide the same feature for tables because tables naturally have border features. ImGuiOldColumns* columns = (flags & ImGuiSeparatorFlags_SpanAllColumns) ? window->DC.CurrentColumns : NULL; if (columns) PushColumnsBackground(); // We don't provide our width to the layout so that it doesn't get feed back into AutoFit // FIXME: This prevents ->CursorMaxPos based bounding box evaluation from working (e.g. TableEndCell) - const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + thickness_draw)); - ItemSize(ImVec2(0.0f, thickness_layout)); - const bool item_visible = ItemAdd(bb, 0); - if (item_visible) + const float thickness_for_layout = (thickness == 1.0f) ? 0.0f : thickness; // FIXME: See 1.70/1.71 Separator() change: makes legacy 1-px separator not affect layout yet. Should change. + const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + thickness)); + ItemSize(ImVec2(0.0f, thickness_for_layout)); + + if (ItemAdd(bb, 0)) { // Draw - window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x, bb.Min.y), GetColorU32(ImGuiCol_Separator)); + window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Separator)); if (g.LogEnabled) LogRenderedText(&bb.Min, "--------------------------------\n"); @@ -1466,33 +1462,101 @@ void ImGui::Separator() if (window->SkipItems) return; - // Those flags should eventually be overridable by the user + // Those flags should eventually be configurable by the user + // FIXME: We cannot g.Style.SeparatorTextBorderSize for thickness as it relates to SeparatorText() which is a decorated separator, not defaulting to 1.0f. ImGuiSeparatorFlags flags = (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal; flags |= ImGuiSeparatorFlags_SpanAllColumns; // NB: this only applies to legacy Columns() api as they relied on Separator() a lot. - SeparatorEx(flags); + SeparatorEx(flags, 1.0f); +} + +void ImGui::SeparatorTextEx(ImGuiID id, const char* label, const char* label_end, float extra_w) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + ImGuiStyle& style = g.Style; + + const ImVec2 label_size = CalcTextSize(label, label_end, false); + const ImVec2 pos = window->DC.CursorPos; + const ImVec2 padding = style.SeparatorTextPadding; + + const float separator_thickness = style.SeparatorTextBorderSize; + const ImVec2 min_size(label_size.x + extra_w + padding.x * 2.0f, ImMax(label_size.y + padding.y * 2.0f, separator_thickness)); + const ImRect bb(pos, ImVec2(window->WorkRect.Max.x, pos.y + min_size.y)); + const float text_baseline_y = ImFloor((bb.GetHeight() - label_size.y) * style.SeparatorTextAlign.y + 0.99999f); //ImMax(padding.y, ImFloor((style.SeparatorTextSize - label_size.y) * 0.5f)); + ItemSize(min_size, text_baseline_y); + if (!ItemAdd(bb, id)) + return; + + const float sep1_x1 = pos.x; + const float sep2_x2 = bb.Max.x; + const float seps_y = ImFloor((bb.Min.y + bb.Max.y) * 0.5f + 0.99999f); + + const float label_avail_w = ImMax(0.0f, sep2_x2 - sep1_x1 - padding.x * 2.0f); + const ImVec2 label_pos(pos.x + padding.x + ImMax(0.0f, (label_avail_w - label_size.x - extra_w) * style.SeparatorTextAlign.x), pos.y + text_baseline_y); // FIXME-ALIGN + + // This allows using SameLine() to position something in the 'extra_w' + window->DC.CursorPosPrevLine.x = label_pos.x + label_size.x; + + const ImU32 separator_col = GetColorU32(ImGuiCol_Separator); + if (label_size.x > 0.0f) + { + const float sep1_x2 = label_pos.x - style.ItemSpacing.x; + const float sep2_x1 = label_pos.x + label_size.x + extra_w + style.ItemSpacing.x; + if (sep1_x2 > sep1_x1 && separator_thickness > 0.0f) + window->DrawList->AddLine(ImVec2(sep1_x1, seps_y), ImVec2(sep1_x2, seps_y), separator_col, separator_thickness); + if (sep2_x2 > sep2_x1 && separator_thickness > 0.0f) + window->DrawList->AddLine(ImVec2(sep2_x1, seps_y), ImVec2(sep2_x2, seps_y), separator_col, separator_thickness); + if (g.LogEnabled) + LogSetNextTextDecoration("---", NULL); + RenderTextEllipsis(window->DrawList, label_pos, ImVec2(bb.Max.x, bb.Max.y + style.ItemSpacing.y), bb.Max.x, bb.Max.x, label, label_end, &label_size); + } + else + { + if (g.LogEnabled) + LogText("---"); + if (separator_thickness > 0.0f) + window->DrawList->AddLine(ImVec2(sep1_x1, seps_y), ImVec2(sep2_x2, seps_y), separator_col, separator_thickness); + } +} + +void ImGui::SeparatorText(const char* label) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + // The SeparatorText() vs SeparatorTextEx() distinction is designed to be considerate that we may want: + // - allow separator-text to be draggable items (would require a stable ID + a noticeable highlight) + // - this high-level entry point to allow formatting? (which in turns may require ID separate from formatted string) + // - because of this we probably can't turn 'const char* label' into 'const char* fmt, ...' + // Otherwise, we can decide that users wanting to drag this would layout a dedicated drag-item, + // and then we can turn this into a format function. + SeparatorTextEx(0, label, FindRenderedTextEnd(label), 0.0f); } // Using 'hover_visibility_delay' allows us to hide the highlight and mouse cursor for a short time, which can be convenient to reduce visual noise. -bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend, float hover_visibility_delay) +bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend, float hover_visibility_delay, ImU32 bg_col) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - const ImGuiItemFlags item_flags_backup = g.CurrentItemFlags; - g.CurrentItemFlags |= ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus; - bool item_add = ItemAdd(bb, id); - g.CurrentItemFlags = item_flags_backup; - if (!item_add) + if (!ItemAdd(bb, id, NULL, ImGuiItemFlags_NoNav)) return false; + // FIXME: AFAIK the only leftover reason for passing ImGuiButtonFlags_AllowOverlap here is + // to allow caller of SplitterBehavior() to call SetItemAllowOverlap() after the item. + // Nowadays we would instead want to use SetNextItemAllowOverlap() before the item. + ImGuiButtonFlags button_flags = ImGuiButtonFlags_FlattenChildren; +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + button_flags |= ImGuiButtonFlags_AllowOverlap; +#endif + bool hovered, held; ImRect bb_interact = bb; bb_interact.Expand(axis == ImGuiAxis_Y ? ImVec2(0.0f, hover_extend) : ImVec2(hover_extend, 0.0f)); - ButtonBehavior(bb_interact, id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap); + ButtonBehavior(bb_interact, id, &hovered, &held, button_flags); if (hovered) g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredRect; // for IsItemHovered(), because bb_interact is larger than bb - if (g.ActiveId != id) - SetItemAllowOverlap(); if (held || (hovered && g.HoveredIdPreviousFrame == id && g.HoveredIdTimer >= hover_visibility_delay)) SetMouseCursor(axis == ImGuiAxis_Y ? ImGuiMouseCursor_ResizeNS : ImGuiMouseCursor_ResizeEW); @@ -1525,7 +1589,9 @@ bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float } } - // Render + // Render at new position + if (bg_col & IM_COL32_A_MASK) + window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, bg_col, 0.0f); const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : (hovered && g.HoveredIdTimer >= hover_visibility_delay) ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator); window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0f); @@ -1703,7 +1769,12 @@ bool ImGui::BeginComboPopup(ImGuiID popup_id, const ImRect& bb, ImGuiComboFlags if (flags & ImGuiComboFlags_HeightRegular) popup_max_height_in_items = 8; else if (flags & ImGuiComboFlags_HeightSmall) popup_max_height_in_items = 4; else if (flags & ImGuiComboFlags_HeightLarge) popup_max_height_in_items = 20; - SetNextWindowSizeConstraints(ImVec2(w, 0.0f), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items))); + ImVec2 constraint_min(0.0f, 0.0f), constraint_max(FLT_MAX, FLT_MAX); + if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) == 0 || g.NextWindowData.SizeVal.x <= 0.0f) // Don't apply constraints if user specified a size + constraint_min.x = w; + if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) == 0 || g.NextWindowData.SizeVal.y <= 0.0f) + constraint_max.y = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items); + SetNextWindowSizeConstraints(constraint_min, constraint_max); } // This is essentially a specialized version of BeginPopupEx() @@ -1751,10 +1822,10 @@ bool ImGui::BeginComboPreview() ImGuiWindow* window = g.CurrentWindow; ImGuiComboPreviewData* preview_data = &g.ComboPreviewData; - if (window->SkipItems || !window->ClipRect.Overlaps(g.LastItemData.Rect)) // FIXME: Because we don't have a ImGuiItemStatusFlags_Visible flag to test last ItemAdd() result + if (window->SkipItems || !(g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Visible)) return false; IM_ASSERT(g.LastItemData.Rect.Min.x == preview_data->PreviewRect.Min.x && g.LastItemData.Rect.Min.y == preview_data->PreviewRect.Min.y); // Didn't call after BeginCombo/EndCombo block or forgot to pass ImGuiComboFlags_CustomPreview flag? - if (!window->ClipRect.Contains(preview_data->PreviewRect)) // Narrower test (optional) + if (!window->ClipRect.Overlaps(preview_data->PreviewRect)) // Narrower test (optional) return false; // FIXME: This could be contained in a PushWorkRect() api @@ -1853,7 +1924,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi const char* item_text; if (!items_getter(data, i, &item_text)) item_text = "*Unknown item*"; - if (Selectable(item_text, item_selected)) + if (Selectable(item_text, item_selected) && *current_item != i) { value_changed = true; *current_item = i; @@ -1895,7 +1966,6 @@ bool ImGui::Combo(const char* label, int* current_item, const char* items_separa //------------------------------------------------------------------------- // [SECTION] Data Type and Data Formatting Helpers [Internal] //------------------------------------------------------------------------- -// - PatchFormatStringFloatToInt() // - DataTypeGetInfo() // - DataTypeFormatString() // - DataTypeApplyOp() @@ -1926,30 +1996,6 @@ static const ImGuiDataTypeInfo GDataTypeInfo[] = }; IM_STATIC_ASSERT(IM_ARRAYSIZE(GDataTypeInfo) == ImGuiDataType_COUNT); -// FIXME-LEGACY: Prior to 1.61 our DragInt() function internally used floats and because of this the compile-time default value for format was "%.0f". -// Even though we changed the compile-time default, we expect users to have carried %f around, which would break the display of DragInt() calls. -// To honor backward compatibility we are rewriting the format string, unless IMGUI_DISABLE_OBSOLETE_FUNCTIONS is enabled. What could possibly go wrong?! -static const char* PatchFormatStringFloatToInt(const char* fmt) -{ - if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '0' && fmt[3] == 'f' && fmt[4] == 0) // Fast legacy path for "%.0f" which is expected to be the most common case. - return "%d"; - const char* fmt_start = ImParseFormatFindStart(fmt); // Find % (if any, and ignore %%) - const char* fmt_end = ImParseFormatFindEnd(fmt_start); // Find end of format specifier, which itself is an exercise of confidence/recklessness (because snprintf is dependent on libc or user). - if (fmt_end > fmt_start && fmt_end[-1] == 'f') - { -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - if (fmt_start == fmt && fmt_end[0] == 0) - return "%d"; - const char* tmp_format; - ImFormatStringToTempBuffer(&tmp_format, NULL, "%.*s%%d%s", (int)(fmt_start - fmt), fmt, fmt_end); // Honor leading and trailing decorations, but lose alignment/precision. - return tmp_format; -#else - IM_ASSERT(0 && "DragInt(): Invalid format string!"); // Old versions used a default parameter of "%.0f", please replace with e.g. "%d" -#endif - } - return fmt; -} - const ImGuiDataTypeInfo* ImGui::DataTypeGetInfo(ImGuiDataType data_type) { IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT); @@ -2044,7 +2090,8 @@ bool ImGui::DataTypeApplyFromText(const char* buf, ImGuiDataType data_type, void memcpy(&data_backup, p_data, type_info->Size); // Sanitize format - // For float/double we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in, so force them into %f and %lf + // - For float/double we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in, so force them into %f and %lf + // - In theory could treat empty format as using default, but this would only cover rare/bizarre case of using InputScalar() + integer + format string without %. char format_sanitized[32]; if (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) format = type_info->ScanFmt; @@ -2205,7 +2252,7 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const if (g.IO.KeyShift) adjust_delta *= 10.0f; } - else if (g.ActiveIdSource == ImGuiInputSource_Nav) + else if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) { const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0; const bool tweak_slow = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakSlow : ImGuiKey_NavKeyboardTweakSlow); @@ -2312,7 +2359,7 @@ bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v // Those are the things we can do easily outside the DragBehaviorT<> template, saves code generation. if (g.ActiveIdSource == ImGuiInputSource_Mouse && !g.IO.MouseDown[0]) ClearActiveID(); - else if (g.ActiveIdSource == ImGuiInputSource_Nav && g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated) + else if ((g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) && g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated) ClearActiveID(); } if (g.ActiveId != id) @@ -2363,27 +2410,27 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data, // Default format string when passing NULL if (format == NULL) format = DataTypeGetInfo(data_type)->PrintFmt; - else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.) - format = PatchFormatStringFloatToInt(format); - const bool hovered = ItemHoverable(frame_bb, id); + const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags); bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id); if (!temp_input_is_active) { // Tabbing or CTRL-clicking on Drag turns it into an InputText const bool input_requested_by_tabbing = temp_input_allowed && (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_FocusedByTabbing) != 0; - const bool clicked = (hovered && g.IO.MouseClicked[0]); - const bool double_clicked = (hovered && g.IO.MouseClickedCount[0] == 2); - const bool make_active = (input_requested_by_tabbing || clicked || double_clicked || g.NavActivateId == id || g.NavActivateInputId == id); + const bool clicked = hovered && IsMouseClicked(0, id); + const bool double_clicked = (hovered && g.IO.MouseClickedCount[0] == 2 && TestKeyOwner(ImGuiKey_MouseLeft, id)); + const bool make_active = (input_requested_by_tabbing || clicked || double_clicked || g.NavActivateId == id); + if (make_active && (clicked || double_clicked)) + SetKeyOwner(ImGuiKey_MouseLeft, id); if (make_active && temp_input_allowed) - if (input_requested_by_tabbing || (clicked && g.IO.KeyCtrl) || double_clicked || g.NavActivateInputId == id) + if (input_requested_by_tabbing || (clicked && g.IO.KeyCtrl) || double_clicked || (g.NavActivateId == id && (g.NavActivateFlags & ImGuiActivateFlags_PreferInput))) temp_input_is_active = true; // (Optional) simple click (without moving) turns Drag into an InputText if (g.IO.ConfigDragClickToInputText && temp_input_allowed && !temp_input_is_active) if (g.ActiveId == id && hovered && g.IO.MouseReleased[0] && !IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR)) { - g.NavActivateId = g.NavActivateInputId = id; + g.NavActivateId = id; g.NavActivateFlags = ImGuiActivateFlags_PreferInput; temp_input_is_active = true; } @@ -2424,7 +2471,7 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data, if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); - IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags); + IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | (temp_input_allowed ? ImGuiItemStatusFlags_Inputable : 0)); return value_changed; } @@ -2742,14 +2789,14 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ const ImGuiAxis axis = (flags & ImGuiSliderFlags_Vertical) ? ImGuiAxis_Y : ImGuiAxis_X; const bool is_logarithmic = (flags & ImGuiSliderFlags_Logarithmic) != 0; const bool is_floating_point = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double); - const SIGNEDTYPE v_range = (v_min < v_max ? v_max - v_min : v_min - v_max); + const float v_range_f = (float)(v_min < v_max ? v_max - v_min : v_min - v_max); // We don't need high precision for what we do with it. // Calculate bounds const float grab_padding = 2.0f; // FIXME: Should be part of style. const float slider_sz = (bb.Max[axis] - bb.Min[axis]) - grab_padding * 2.0f; float grab_sz = style.GrabMinSize; - if (!is_floating_point && v_range >= 0) // v_range < 0 may happen on integer overflows - grab_sz = ImMax((float)(slider_sz / (v_range + 1)), style.GrabMinSize); // For integer sliders: if possible have the grab size represent 1 unit + if (!is_floating_point && v_range_f >= 0.0f) // v_range_f < 0 may happen on integer overflows + grab_sz = ImMax(slider_sz / (v_range_f + 1), style.GrabMinSize); // For integer sliders: if possible have the grab size represent 1 unit grab_sz = ImMin(grab_sz, slider_sz); const float slider_usable_sz = slider_sz - grab_sz; const float slider_usable_pos_min = bb.Min[axis] + grab_padding + grab_sz * 0.5f; @@ -2796,7 +2843,7 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ set_new_value = true; } } - else if (g.ActiveIdSource == ImGuiInputSource_Nav) + else if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) { if (g.ActiveIdIsJustActivated) { @@ -2818,8 +2865,8 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ } else { - if ((v_range >= -100.0f && v_range <= 100.0f) || tweak_slow) - input_delta = ((input_delta < 0.0f) ? -1.0f : +1.0f) / (float)v_range; // Gamepad/keyboard tweak speeds in integer steps + if ((v_range_f >= -100.0f && v_range_f <= 100.0f && v_range_f != 0.0f) || tweak_slow) + input_delta = ((input_delta < 0.0f) ? -1.0f : +1.0f) / v_range_f; // Gamepad/keyboard tweak speeds in integer steps else input_delta /= 100.0f; } @@ -2866,6 +2913,10 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ } } + if (set_new_value) + if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly)) + set_new_value = false; + if (set_new_value) { TYPE v_new = ScaleValueFromRatioT(data_type, clicked_t, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize); @@ -2911,11 +2962,6 @@ bool ImGui::SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type // Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert. IM_ASSERT((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && "Invalid ImGuiSliderFlags flag! Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead."); - // Those are the things we can do easily outside the SliderBehaviorT<> template, saves code generation. - ImGuiContext& g = *GImGui; - if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly)) - return false; - switch (data_type) { case ImGuiDataType_S8: { ImS32 v32 = (ImS32)*(ImS8*)p_v; bool r = SliderBehaviorT(bb, id, ImGuiDataType_S32, &v32, *(const ImS8*)p_min, *(const ImS8*)p_max, format, flags, out_grab_bb); if (r) *(ImS8*)p_v = (ImS8)v32; return r; } @@ -2971,19 +3017,19 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat // Default format string when passing NULL if (format == NULL) format = DataTypeGetInfo(data_type)->PrintFmt; - else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.) - format = PatchFormatStringFloatToInt(format); - const bool hovered = ItemHoverable(frame_bb, id); + const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags); bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id); if (!temp_input_is_active) { // Tabbing or CTRL-clicking on Slider turns it into an input box const bool input_requested_by_tabbing = temp_input_allowed && (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_FocusedByTabbing) != 0; - const bool clicked = (hovered && g.IO.MouseClicked[0]); - const bool make_active = (input_requested_by_tabbing || clicked || g.NavActivateId == id || g.NavActivateInputId == id); + const bool clicked = hovered && IsMouseClicked(0, id); + const bool make_active = (input_requested_by_tabbing || clicked || g.NavActivateId == id); + if (make_active && clicked) + SetKeyOwner(ImGuiKey_MouseLeft, id); if (make_active && temp_input_allowed) - if (input_requested_by_tabbing || (clicked && g.IO.KeyCtrl) || g.NavActivateInputId == id) + if (input_requested_by_tabbing || (clicked && g.IO.KeyCtrl) || (g.NavActivateId == id && (g.NavActivateFlags & ImGuiActivateFlags_PreferInput))) temp_input_is_active = true; if (make_active && !temp_input_is_active) @@ -3027,7 +3073,7 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); - IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags); + IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | (temp_input_allowed ? ImGuiItemStatusFlags_Inputable : 0)); return value_changed; } @@ -3138,12 +3184,13 @@ bool ImGui::VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType d // Default format string when passing NULL if (format == NULL) format = DataTypeGetInfo(data_type)->PrintFmt; - else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.) - format = PatchFormatStringFloatToInt(format); - const bool hovered = ItemHoverable(frame_bb, id); - if ((hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || g.NavActivateInputId == id) + const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags); + const bool clicked = hovered && IsMouseClicked(0, id); + if (clicked || g.NavActivateId == id) { + if (clicked) + SetKeyOwner(ImGuiKey_MouseLeft, id); SetActiveID(id, window); SetFocusID(id, window); FocusWindow(window); @@ -3241,7 +3288,7 @@ const char* ImParseFormatFindEnd(const char* fmt) } // Extract the format out of a format string with leading or trailing decorations -// fmt = "blah blah" -> return fmt +// fmt = "blah blah" -> return "" // fmt = "%.3f" -> return fmt // fmt = "hello %.3f" -> return fmt + 6 // fmt = "%.3f hello" -> return buf written with "%.3f" @@ -3249,7 +3296,7 @@ const char* ImParseFormatTrimDecorations(const char* fmt, char* buf, size_t buf_ { const char* fmt_start = ImParseFormatFindStart(fmt); if (fmt_start[0] != '%') - return fmt; + return ""; const char* fmt_end = ImParseFormatFindEnd(fmt_start); if (fmt_end[0] == 0) // If we only have leading decoration, we don't need to copy the data. return fmt_start; @@ -3274,7 +3321,7 @@ void ImParseFormatSanitizeForPrinting(const char* fmt_in, char* fmt_out, size_t *fmt_out = 0; // Zero-terminate } -// - For scanning we need to remove all width and precision fields "%3.7f" -> "%f". BUT don't strip types like "%I64d" which includes digits. ! "%07I64d" -> "%I64d" +// - For scanning we need to remove all width and precision fields and flags "%+3.7f" -> "%f". BUT don't strip types like "%I64d" which includes digits. ! "%07I64d" -> "%I64d" const char* ImParseFormatSanitizeForScanning(const char* fmt_in, char* fmt_out, size_t fmt_out_size) { const char* fmt_end = ImParseFormatFindEnd(fmt_in); @@ -3285,7 +3332,7 @@ const char* ImParseFormatSanitizeForScanning(const char* fmt_in, char* fmt_out, while (fmt_in < fmt_end) { char c = *fmt_in++; - if (!has_type && ((c >= '0' && c <= '9') || c == '.')) + if (!has_type && ((c >= '0' && c <= '9') || c == '.' || c == '+' || c == '#')) continue; has_type |= ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); // Stop skipping digits if (c != '\'' && c != '$' && c != '_') // Custom flags provided by stb_sprintf.h. POSIX 2008 also supports '. @@ -3367,9 +3414,14 @@ static inline ImGuiInputTextFlags InputScalar_DefaultCharsFilter(ImGuiDataType d // However this may not be ideal for all uses, as some user code may break on out of bound values. bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min, const void* p_clamp_max) { + // FIXME: May need to clarify display behavior if format doesn't contain %. + // "%d" -> "%d" / "There are %d items" -> "%d" / "items" -> "%d" (fallback). Also see #6405 + const ImGuiDataTypeInfo* type_info = DataTypeGetInfo(data_type); char fmt_buf[32]; char data_buf[32]; format = ImParseFormatTrimDecorations(format, fmt_buf, IM_ARRAYSIZE(fmt_buf)); + if (format[0] == 0) + format = type_info->PrintFmt; DataTypeFormatString(data_buf, IM_ARRAYSIZE(data_buf), data_type, p_data, format); ImStrTrimBlanks(data_buf); @@ -3380,7 +3432,7 @@ bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImG if (TempInputText(bb, id, label, data_buf, IM_ARRAYSIZE(data_buf), flags)) { // Backup old value - size_t data_type_size = DataTypeGetInfo(data_type)->Size; + size_t data_type_size = type_info->Size; ImGuiDataTypeTempStorage data_backup; memcpy(&data_backup, p_data, data_type_size); @@ -3424,7 +3476,12 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data flags |= ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves by comparing the actual data rather than the string. bool value_changed = false; - if (p_step != NULL) + if (p_step == NULL) + { + if (InputText(label, buf, IM_ARRAYSIZE(buf), flags)) + value_changed = DataTypeApplyFromText(buf, data_type, p_data, format); + } + else { const float button_size = GetFrameHeight(); @@ -3433,7 +3490,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data SetNextItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2)); if (InputText("", buf, IM_ARRAYSIZE(buf), flags)) // PushId(label) + "" gives us the expected ID from outside point of view value_changed = DataTypeApplyFromText(buf, data_type, p_data, format); - IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags); + IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Inputable); // Step buttons const ImVec2 backup_frame_padding = style.FramePadding; @@ -3467,11 +3524,6 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data PopID(); EndGroup(); } - else - { - if (InputText(label, buf, IM_ARRAYSIZE(buf), flags)) - value_changed = DataTypeApplyFromText(buf, data_type, p_data, format); - } if (value_changed) MarkItemEdited(g.LastItemData.ID); @@ -3606,9 +3658,9 @@ static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** return line_count; } -static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line) +static ImVec2 InputTextCalcTextSizeW(ImGuiContext* ctx, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *ctx; ImFont* font = g.Font; const float line_height = g.FontSize; const float scale = line_height / font->FontSize; @@ -3657,14 +3709,14 @@ namespace ImStb static int STB_TEXTEDIT_STRINGLEN(const ImGuiInputTextState* obj) { return obj->CurLenW; } static ImWchar STB_TEXTEDIT_GETCHAR(const ImGuiInputTextState* obj, int idx) { return obj->TextW[idx]; } -static float STB_TEXTEDIT_GETWIDTH(ImGuiInputTextState* obj, int line_start_idx, int char_idx) { ImWchar c = obj->TextW[line_start_idx + char_idx]; if (c == '\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; ImGuiContext& g = *GImGui; return g.Font->GetCharAdvance(c) * (g.FontSize / g.Font->FontSize); } +static float STB_TEXTEDIT_GETWIDTH(ImGuiInputTextState* obj, int line_start_idx, int char_idx) { ImWchar c = obj->TextW[line_start_idx + char_idx]; if (c == '\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; ImGuiContext& g = *obj->Ctx; return g.Font->GetCharAdvance(c) * (g.FontSize / g.Font->FontSize); } static int STB_TEXTEDIT_KEYTOTEXT(int key) { return key >= 0x200000 ? 0 : key; } static ImWchar STB_TEXTEDIT_NEWLINE = '\n'; static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, ImGuiInputTextState* obj, int line_start_idx) { const ImWchar* text = obj->TextW.Data; const ImWchar* text_remaining = NULL; - const ImVec2 size = InputTextCalcTextSizeW(text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true); + const ImVec2 size = InputTextCalcTextSizeW(obj->Ctx, text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true); r->x0 = 0.0f; r->x1 = size.x; r->baseline_y_delta = size.y; @@ -3673,14 +3725,38 @@ static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, ImGuiInputTextState* ob r->num_chars = (int)(text_remaining - (text + line_start_idx)); } -// When ImGuiInputTextFlags_Password is set, we don't want actions such as CTRL+Arrow to leak the fact that underlying data are blanks or separators. -static bool is_separator(unsigned int c) { return ImCharIsBlankW(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|' || c=='\n' || c=='\r'; } -static int is_word_boundary_from_right(ImGuiInputTextState* obj, int idx) { if (obj->Flags & ImGuiInputTextFlags_Password) return 0; return idx > 0 ? (is_separator(obj->TextW[idx - 1]) && !is_separator(obj->TextW[idx]) ) : 1; } -static int is_word_boundary_from_left(ImGuiInputTextState* obj, int idx) { if (obj->Flags & ImGuiInputTextFlags_Password) return 0; return idx > 0 ? (!is_separator(obj->TextW[idx - 1]) && is_separator(obj->TextW[idx])) : 1; } +static bool is_separator(unsigned int c) +{ + return c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|' || c=='\n' || c=='\r' || c=='.' || c=='!'; +} + +static int is_word_boundary_from_right(ImGuiInputTextState* obj, int idx) +{ + // When ImGuiInputTextFlags_Password is set, we don't want actions such as CTRL+Arrow to leak the fact that underlying data are blanks or separators. + if ((obj->Flags & ImGuiInputTextFlags_Password) || idx <= 0) + return 0; + + bool prev_white = ImCharIsBlankW(obj->TextW[idx - 1]); + bool prev_separ = is_separator(obj->TextW[idx - 1]); + bool curr_white = ImCharIsBlankW(obj->TextW[idx]); + bool curr_separ = is_separator(obj->TextW[idx]); + return ((prev_white || prev_separ) && !(curr_separ || curr_white)) || (curr_separ && !prev_separ); +} +static int is_word_boundary_from_left(ImGuiInputTextState* obj, int idx) +{ + if ((obj->Flags & ImGuiInputTextFlags_Password) || idx <= 0) + return 0; + + bool prev_white = ImCharIsBlankW(obj->TextW[idx]); + bool prev_separ = is_separator(obj->TextW[idx]); + bool curr_white = ImCharIsBlankW(obj->TextW[idx - 1]); + bool curr_separ = is_separator(obj->TextW[idx - 1]); + return ((prev_white) && !(curr_separ || curr_white)) || (curr_separ && !prev_separ); +} static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(ImGuiInputTextState* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; } static int STB_TEXTEDIT_MOVEWORDRIGHT_MAC(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; } static int STB_TEXTEDIT_MOVEWORDRIGHT_WIN(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; } -static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(ImGuiInputTextState* obj, int idx) { if (ImGui::GetIO().ConfigMacOSXBehaviors) return STB_TEXTEDIT_MOVEWORDRIGHT_MAC(obj, idx); else return STB_TEXTEDIT_MOVEWORDRIGHT_WIN(obj, idx); } +static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(ImGuiInputTextState* obj, int idx) { ImGuiContext& g = *obj->Ctx; if (g.IO.ConfigMacOSXBehaviors) return STB_TEXTEDIT_MOVEWORDRIGHT_MAC(obj, idx); else return STB_TEXTEDIT_MOVEWORDRIGHT_WIN(obj, idx); } #define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h #define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL @@ -3752,6 +3828,7 @@ static bool STB_TEXTEDIT_INSERTCHARS(ImGuiInputTextState* obj, int pos, const Im #define STB_TEXTEDIT_K_SHIFT 0x400000 #define STB_TEXTEDIT_IMPLEMENTATION +#define STB_TEXTEDIT_memmove memmove #include "imstb_textedit.h" // stb_textedit internally allows for a single undo record to do addition and deletion, but somehow, calling @@ -3809,6 +3886,10 @@ void ImGuiInputTextCallbackData::DeleteChars(int pos, int bytes_count) void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, const char* new_text_end) { + // Accept null ranges + if (new_text == new_text_end) + return; + const bool is_resizable = (Flags & ImGuiInputTextFlags_CallbackResize) != 0; const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)strlen(new_text); if (new_text_len + BufTextLen >= BufSize) @@ -3817,7 +3898,7 @@ void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, cons return; // Contrary to STB_TEXTEDIT_INSERTCHARS() this is working in the UTF8 buffer, hence the mildly similar code (until we remove the U16 buffer altogether!) - ImGuiContext& g = *GImGui; + ImGuiContext& g = *Ctx; ImGuiInputTextState* edit_state = &g.InputTextState; IM_ASSERT(edit_state->ID != 0 && g.ActiveId == edit_state->ID); IM_ASSERT(Buf == edit_state->TextA.Data); @@ -3840,7 +3921,7 @@ void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, cons } // Return false to discard a character. -static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source) +static bool InputTextFilterCharacter(ImGuiContext* ctx, unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source) { IM_ASSERT(input_source == ImGuiInputSource_Keyboard || input_source == ImGuiInputSource_Clipboard); unsigned int c = *p_char; @@ -3879,10 +3960,13 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f // The standard mandate that programs starts in the "C" locale where the decimal point is '.'. // We don't really intend to provide widespread support for it, but out of empathy for people stuck with using odd API, we support the bare minimum aka overriding the decimal point. // Change the default decimal_point with: - // ImGui::GetCurrentContext()->PlatformLocaleDecimalPoint = *localeconv()->decimal_point; + // ImGui::GetIO()->PlatformLocaleDecimalPoint = *localeconv()->decimal_point; // Users of non-default decimal point (in particular ',') may be affected by word-selection logic (is_word_boundary_from_right/is_word_boundary_from_left) functions. - ImGuiContext& g = *GImGui; - const unsigned c_decimal_point = (unsigned int)g.PlatformLocaleDecimalPoint; + ImGuiContext& g = *ctx; + const unsigned c_decimal_point = (unsigned int)g.IO.PlatformLocaleDecimalPoint; + if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsScientific)) + if (c == '.' || c == ',') + c = c_decimal_point; // Full-width -> half-width conversion for numeric fields (https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block) // While this is mostly convenient, this has the side-effect for uninformed users accidentally inputting full-width characters that they may @@ -3921,8 +4005,9 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f // Custom callback filter if (flags & ImGuiInputTextFlags_CallbackCharFilter) { + ImGuiContext& g = *GImGui; ImGuiInputTextCallbackData callback_data; - memset(&callback_data, 0, sizeof(ImGuiInputTextCallbackData)); + callback_data.Ctx = &g; callback_data.EventFlag = ImGuiInputTextFlags_CallbackCharFilter; callback_data.EventChar = (ImWchar)c; callback_data.Flags = flags; @@ -3972,6 +4057,29 @@ static void InputTextReconcileUndoStateAfterUserCallback(ImGuiInputTextState* st p[i] = ImStb::STB_TEXTEDIT_GETCHAR(state, first_diff + i); } +// As InputText() retain textual data and we currently provide a path for user to not retain it (via local variables) +// we need some form of hook to reapply data back to user buffer on deactivation frame. (#4714) +// It would be more desirable that we discourage users from taking advantage of the "user not retaining data" trick, +// but that more likely be attractive when we do have _NoLiveEdit flag available. +void ImGui::InputTextDeactivateHook(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + ImGuiInputTextState* state = &g.InputTextState; + if (id == 0 || state->ID != id) + return; + g.InputTextDeactivatedState.ID = state->ID; + if (state->Flags & ImGuiInputTextFlags_ReadOnly) + { + g.InputTextDeactivatedState.TextA.resize(0); // In theory this data won't be used, but clear to be neat. + } + else + { + IM_ASSERT(state->TextA.Data != 0); + g.InputTextDeactivatedState.TextA.resize(state->CurLenA + 1); + memcpy(g.InputTextDeactivatedState.TextA.Data, state->TextA.Data, state->CurLenA + 1); + } +} + // Edit a string of text // - buf_size account for the zero-terminator, so a buf_size of 6 can hold "Hello" but not "Hello!". // This is so we can easily call InputText() on static arrays using ARRAYSIZE() and to match @@ -4059,7 +4167,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ return false; item_status_flags = g.LastItemData.StatusFlags; } - const bool hovered = ItemHoverable(frame_bb, id); + const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags); if (hovered) g.MouseCursor = ImGuiMouseCursor_TextInput; @@ -4067,7 +4175,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ ImGuiInputTextState* state = GetInputTextState(id); const bool input_requested_by_tabbing = (item_status_flags & ImGuiItemStatusFlags_FocusedByTabbing) != 0; - const bool input_requested_by_nav = (g.ActiveId != id) && ((g.NavActivateInputId == id) || (g.NavActivateId == id && g.NavInputSource == ImGuiInputSource_Keyboard)); + const bool input_requested_by_nav = (g.ActiveId != id) && ((g.NavActivateId == id) && ((g.NavActivateFlags & ImGuiActivateFlags_PreferInput) || (g.NavInputSource == ImGuiInputSource_Keyboard))); const bool user_clicked = hovered && io.MouseClicked[0]; const bool user_scroll_finish = is_multiline && state != NULL && g.ActiveId == 0 && g.ActiveIdPreviousFrame == GetWindowScrollbarID(draw_window, ImGuiAxis_Y); @@ -4077,7 +4185,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ float scroll_y = is_multiline ? draw_window->Scroll.y : FLT_MAX; - const bool init_changed_specs = (state != NULL && state->Stb.single_line != !is_multiline); + const bool init_changed_specs = (state != NULL && state->Stb.single_line != !is_multiline); // state != NULL means its our state. const bool init_make_active = (user_clicked || user_scroll_finish || input_requested_by_nav || input_requested_by_tabbing); const bool init_state = (init_make_active || user_scroll_active); if ((init_state && g.ActiveId != id) || init_changed_specs) @@ -4086,6 +4194,9 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ state = &g.InputTextState; state->CursorAnimReset(); + // Backup state of deactivating item so they'll have a chance to do a write to output buffer on the same frame they report IsItemDeactivatedAfterEdit (#4714) + InputTextDeactivateHook(state->ID); + // Take a copy of the initial buffer value (both in original UTF-8 format and converted to wchar) // From the moment we focused we are ignoring the content of 'buf' (unless we are in read-only mode) const int buf_len = (int)strlen(buf); @@ -4133,30 +4244,33 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ state->Stb.insert_mode = 1; // stb field name is indeed incorrect (see #2863) } + const bool is_osx = io.ConfigMacOSXBehaviors; if (g.ActiveId != id && init_make_active) { IM_ASSERT(state && state->ID == id); SetActiveID(id, window); SetFocusID(id, window); FocusWindow(window); - - // Declare our inputs + } + if (g.ActiveId == id) + { + // Declare some inputs, the other are registered and polled via Shortcut() routing system. + if (user_clicked) + SetKeyOwner(ImGuiKey_MouseLeft, id); g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right); if (is_multiline || (flags & ImGuiInputTextFlags_CallbackHistory)) g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); - SetActiveIdUsingKey(ImGuiKey_Escape); - SetActiveIdUsingKey(ImGuiKey_NavGamepadCancel); - SetActiveIdUsingKey(ImGuiKey_Home); - SetActiveIdUsingKey(ImGuiKey_End); + SetKeyOwner(ImGuiKey_Home, id); + SetKeyOwner(ImGuiKey_End, id); if (is_multiline) { - SetActiveIdUsingKey(ImGuiKey_PageUp); - SetActiveIdUsingKey(ImGuiKey_PageDown); + SetKeyOwner(ImGuiKey_PageUp, id); + SetKeyOwner(ImGuiKey_PageDown, id); } + if (is_osx) + SetKeyOwner(ImGuiMod_Alt, id); if (flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_AllowTabInput)) // Disable keyboard tabbing out as we will use the \t character. - { - SetActiveIdUsingKey(ImGuiKey_Tab); - } + SetShortcutRouting(ImGuiKey_Tab, id); } // We have an edge case if ActiveId was set through another widget (e.g. widget being swapped), clear id immediately (don't wait until the end of the function) @@ -4218,13 +4332,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ // Although we are active we don't prevent mouse from hovering other elements unless we are interacting right now with the widget. // Down the line we should have a cleaner library-wide concept of Selected vs Active. g.ActiveIdAllowOverlap = !io.MouseDown[0]; - g.WantTextInputNextFrame = 1; // Edit in progress const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + state->ScrollX; const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y) : (g.FontSize * 0.5f)); - const bool is_osx = io.ConfigMacOSXBehaviors; if (select_all) { state->SelectAll(); @@ -4287,16 +4399,16 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ // We expect backends to emit a Tab key but some also emit a Tab character which we ignore (#2467, #1336) // (For Tab and Enter: Win32/SFML/Allegro are sending both keys and chars, GLFW and SDL are only sending keys. For Space they all send all threes) - const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper); - if ((flags & ImGuiInputTextFlags_AllowTabInput) && IsKeyPressed(ImGuiKey_Tab) && !ignore_char_inputs && !io.KeyShift && !is_readonly) + if ((flags & ImGuiInputTextFlags_AllowTabInput) && Shortcut(ImGuiKey_Tab, id) && !is_readonly) { unsigned int c = '\t'; // Insert TAB - if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard)) + if (InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard)) state->OnKeyPressed((int)c); } // Process regular text input (before we check for Return because using some IME will effectively send a Return?) // We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters. + const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper); if (io.InputQueueCharacters.Size > 0) { if (!ignore_char_inputs && !is_readonly && !input_requested_by_nav) @@ -4306,7 +4418,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ unsigned int c = (unsigned int)io.InputQueueCharacters[n]; if (c == '\t') // Skip Tab, see above. continue; - if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard)) + if (InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard)) state->OnKeyPressed((int)c); } @@ -4325,27 +4437,26 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ state->Stb.row_count_per_page = row_count_per_page; const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0); - const bool is_osx = io.ConfigMacOSXBehaviors; - const bool is_osx_shift_shortcut = is_osx && (io.KeyMods == (ImGuiMod_Super | ImGuiMod_Shift)); const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl const bool is_startend_key_down = is_osx && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End - const bool is_ctrl_key_only = (io.KeyMods == ImGuiMod_Ctrl); - const bool is_shift_key_only = (io.KeyMods == ImGuiMod_Shift); - const bool is_shortcut_key = g.IO.ConfigMacOSXBehaviors ? (io.KeyMods == ImGuiMod_Super) : (io.KeyMods == ImGuiMod_Ctrl); - const bool is_cut = ((is_shortcut_key && IsKeyPressed(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Delete))) && !is_readonly && !is_password && (!is_multiline || state->HasSelection()); - const bool is_copy = ((is_shortcut_key && IsKeyPressed(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressed(ImGuiKey_Insert))) && !is_password && (!is_multiline || state->HasSelection()); - const bool is_paste = ((is_shortcut_key && IsKeyPressed(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressed(ImGuiKey_Insert))) && !is_readonly; - const bool is_undo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Z)) && !is_readonly && is_undoable); - const bool is_redo = ((is_shortcut_key && IsKeyPressed(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressed(ImGuiKey_Z))) && !is_readonly && is_undoable; - const bool is_select_all = is_shortcut_key && IsKeyPressed(ImGuiKey_A); + // Using Shortcut() with ImGuiInputFlags_RouteFocused (default policy) to allow routing operations for other code (e.g. calling window trying to use CTRL+A and CTRL+B: formet would be handled by InputText) + // Otherwise we could simply assume that we own the keys as we are active. + const ImGuiInputFlags f_repeat = ImGuiInputFlags_Repeat; + const bool is_cut = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_X, id, f_repeat) || Shortcut(ImGuiMod_Shift | ImGuiKey_Delete, id, f_repeat)) && !is_readonly && !is_password && (!is_multiline || state->HasSelection()); + const bool is_copy = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_C, id) || Shortcut(ImGuiMod_Ctrl | ImGuiKey_Insert, id)) && !is_password && (!is_multiline || state->HasSelection()); + const bool is_paste = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_V, id, f_repeat) || Shortcut(ImGuiMod_Shift | ImGuiKey_Insert, id, f_repeat)) && !is_readonly; + const bool is_undo = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_Z, id, f_repeat)) && !is_readonly && is_undoable; + const bool is_redo = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_Y, id, f_repeat) || (is_osx && Shortcut(ImGuiMod_Shortcut | ImGuiMod_Shift | ImGuiKey_Z, id, f_repeat))) && !is_readonly && is_undoable; + const bool is_select_all = Shortcut(ImGuiMod_Shortcut | ImGuiKey_A, id); // We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful. const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; const bool is_enter_pressed = IsKeyPressed(ImGuiKey_Enter, true) || IsKeyPressed(ImGuiKey_KeypadEnter, true); const bool is_gamepad_validate = nav_gamepad_active && (IsKeyPressed(ImGuiKey_NavGamepadActivate, false) || IsKeyPressed(ImGuiKey_NavGamepadInput, false)); - const bool is_cancel = IsKeyPressed(ImGuiKey_Escape, false) || (nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadCancel, false)); + const bool is_cancel = Shortcut(ImGuiKey_Escape, id, f_repeat) || (nav_gamepad_active && Shortcut(ImGuiKey_NavGamepadCancel, id, f_repeat)); + // FIXME: Should use more Shortcut() and reduce IsKeyPressed()+SetKeyOwner(), but requires modifiers combination to be taken account of. if (IsKeyPressed(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); } else if (IsKeyPressed(ImGuiKey_RightArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); } else if (IsKeyPressed(ImGuiKey_UpArrow) && is_multiline) { if (io.KeyCtrl) SetScrollY(draw_window, ImMax(draw_window->Scroll.y - g.FontSize, 0.0f)); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTSTART : STB_TEXTEDIT_K_UP) | k_mask); } @@ -4354,7 +4465,16 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ else if (IsKeyPressed(ImGuiKey_PageDown) && is_multiline) { state->OnKeyPressed(STB_TEXTEDIT_K_PGDOWN | k_mask); scroll_y += row_count_per_page * g.FontSize; } else if (IsKeyPressed(ImGuiKey_Home)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); } else if (IsKeyPressed(ImGuiKey_End)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); } - else if (IsKeyPressed(ImGuiKey_Delete) && !is_readonly && !is_cut) { state->OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); } + else if (IsKeyPressed(ImGuiKey_Delete) && !is_readonly && !is_cut) + { + if (!state->HasSelection()) + { + // OSX doesn't seem to have Super+Delete to delete until end-of-line, so we don't emulate that (as opposed to Super+Backspace) + if (is_wordmove_key_down) + state->OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT); + } + state->OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); + } else if (IsKeyPressed(ImGuiKey_Backspace) && !is_readonly) { if (!state->HasSelection()) @@ -4381,7 +4501,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ else if (!is_readonly) { unsigned int c = '\n'; // Insert new line - if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard)) + if (InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard)) state->OnKeyPressed((int)c); } } @@ -4389,7 +4509,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ { if (flags & ImGuiInputTextFlags_EscapeClearsAll) { - if (state->CurLenA > 0) + if (buf[0] != 0) { revert_edit = true; } @@ -4444,13 +4564,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ const int clipboard_len = (int)strlen(clipboard); ImWchar* clipboard_filtered = (ImWchar*)IM_ALLOC((clipboard_len + 1) * sizeof(ImWchar)); int clipboard_filtered_len = 0; - for (const char* s = clipboard; *s; ) + for (const char* s = clipboard; *s != 0; ) { unsigned int c; s += ImTextCharFromUtf8(&c, s, NULL); - if (c == 0) - break; - if (!InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Clipboard)) + if (!InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data, ImGuiInputSource_Clipboard)) continue; clipboard_filtered[clipboard_filtered_len++] = (ImWchar)c; } @@ -4479,8 +4597,10 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (flags & ImGuiInputTextFlags_EscapeClearsAll) { // Clear input + IM_ASSERT(buf[0] != 0); apply_new_text = ""; apply_new_text_length = 0; + value_changed = true; STB_TEXTEDIT_CHARTYPE empty_string; stb_textedit_replace(state, &state->Stb, &empty_string, 0); } @@ -4490,6 +4610,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ // Push records into the undo stack so we can CTRL+Z the revert operation itself apply_new_text = state->InitialTextA.Data; apply_new_text_length = state->InitialTextA.Size - 1; + value_changed = true; ImVector w_text; if (apply_new_text_length > 0) { @@ -4508,9 +4629,12 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ ImTextStrToUtf8(state->TextA.Data, state->TextA.Size, state->TextW.Data, NULL); } - // When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame. + // When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer + // before clearing ActiveId, even though strictly speaking it wasn't modified on this frame. // If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail. - // This also allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage (please note that if you use this property along ImGuiInputTextFlags_CallbackResize you can end up with your temporary string object unnecessarily allocating once a frame, either store your string data, either if you don't then don't use ImGuiInputTextFlags_CallbackResize). + // This also allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage + // (please note that if you use this property along ImGuiInputTextFlags_CallbackResize you can end up with your temporary string object + // unnecessarily allocating once a frame, either store your string data, either if you don't then don't use ImGuiInputTextFlags_CallbackResize). const bool apply_edit_back_to_user_buffer = !revert_edit || (validated && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0); if (apply_edit_back_to_user_buffer) { @@ -4527,7 +4651,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ // The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment. ImGuiInputTextFlags event_flag = 0; ImGuiKey event_key = ImGuiKey_None; - if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && IsKeyPressed(ImGuiKey_Tab)) + if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && Shortcut(ImGuiKey_Tab, id)) { event_flag = ImGuiInputTextFlags_CallbackCompletion; event_key = ImGuiKey_Tab; @@ -4554,7 +4678,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (event_flag) { ImGuiInputTextCallbackData callback_data; - memset(&callback_data, 0, sizeof(ImGuiInputTextCallbackData)); + callback_data.Ctx = &g; callback_data.EventFlag = event_flag; callback_data.Flags = flags; callback_data.UserData = callback_user_data; @@ -4603,10 +4727,24 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ { apply_new_text = state->TextA.Data; apply_new_text_length = state->CurLenA; + value_changed = true; } } } + // Handle reapplying final data on deactivation (see InputTextDeactivateHook() for details) + if (g.InputTextDeactivatedState.ID == id) + { + if (g.ActiveId != id && IsItemDeactivatedAfterEdit() && !is_readonly && strcmp(g.InputTextDeactivatedState.TextA.Data, buf) != 0) + { + apply_new_text = g.InputTextDeactivatedState.TextA.Data; + apply_new_text_length = g.InputTextDeactivatedState.TextA.Size - 1; + value_changed = true; + //IMGUI_DEBUG_LOG("InputText(): apply Deactivated data for 0x%08X: \"%.*s\".\n", id, apply_new_text_length, apply_new_text); + } + g.InputTextDeactivatedState.ID = 0; + } + // Copy result to user buffer. This can currently only happen when (g.ActiveId == id) if (apply_new_text != NULL) { @@ -4617,6 +4755,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (is_resizable) { ImGuiInputTextCallbackData callback_data; + callback_data.Ctx = &g; callback_data.EventFlag = ImGuiInputTextFlags_CallbackResize; callback_data.Flags = flags; callback_data.Buf = buf; @@ -4633,12 +4772,14 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ // If the underlying buffer resize was denied or not carried to the next frame, apply_new_text_length+1 may be >= buf_size. ImStrncpy(buf, apply_new_text, ImMin(apply_new_text_length + 1, buf_size)); - value_changed = true; } // Release active ID at the end of the function (so e.g. pressing Return still does a final application of the value) - if (clear_active_id && g.ActiveId == id) + // Otherwise request text input ahead for next frame. + if (g.ActiveId == id && clear_active_id) ClearActiveID(); + else if (g.ActiveId == id) + g.WantTextInputNextFrame = 1; // Render frame if (!is_multiline) @@ -4718,11 +4859,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ searches_result_line_no[1] = line_count; // Calculate 2d position by finding the beginning of the line and measuring distance - cursor_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x; + cursor_offset.x = InputTextCalcTextSizeW(&g, ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x; cursor_offset.y = searches_result_line_no[0] * g.FontSize; if (searches_result_line_no[1] >= 0) { - select_start_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x; + select_start_offset.x = InputTextCalcTextSizeW(&g, ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x; select_start_offset.y = searches_result_line_no[1] * g.FontSize; } @@ -4791,7 +4932,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ } else { - ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true); + ImVec2 rect_size = InputTextCalcTextSizeW(&g, p, text_selected_end, &p, NULL, true); if (rect_size.x <= 0.0f) rect_size.x = IM_FLOOR(g.Font->GetCharAdvance((ImWchar)' ') * 0.50f); // So we can see selected empty lines ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos + ImVec2(rect_size.x, bg_offy_dn)); rect.ClipWith(clip_rect); @@ -4853,11 +4994,9 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ { // For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags_Inputable (ref issue #4761)... Dummy(ImVec2(text_size.x, text_size.y + style.FramePadding.y)); - ImGuiItemFlags backup_item_flags = g.CurrentItemFlags; - g.CurrentItemFlags |= ImGuiItemFlags_Inputable | ImGuiItemFlags_NoTabStop; + g.NextItemData.ItemFlags |= ImGuiItemFlags_Inputable | ImGuiItemFlags_NoTabStop; EndChild(); item_data_backup.StatusFlags |= (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredWindow); - g.CurrentItemFlags = backup_item_flags; // ...and then we need to undo the group overriding last item data, which gets a bit messy as EndGroup() tries to forward scrollbar being active... // FIXME: This quite messy/tricky, should attempt to get rid of the child window. @@ -4883,7 +5022,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (value_changed && !(flags & ImGuiInputTextFlags_NoMarkEdited)) MarkItemEdited(id); - IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags); + IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Inputable); if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0) return validated; else @@ -4897,7 +5036,9 @@ void ImGui::DebugNodeInputTextState(ImGuiInputTextState* state) ImStb::STB_TexteditState* stb_state = &state->Stb; ImStb::StbUndoState* undo_state = &stb_state->undostate; Text("ID: 0x%08X, ActiveID: 0x%08X", state->ID, g.ActiveId); - Text("CurLenW: %d, CurLenA: %d, Cursor: %d, Selection: %d..%d", state->CurLenA, state->CurLenW, stb_state->cursor, stb_state->select_start, stb_state->select_end); + DebugLocateItemOnHover(state->ID); + Text("CurLenW: %d, CurLenA: %d, Cursor: %d, Selection: %d..%d", state->CurLenW, state->CurLenA, stb_state->cursor, stb_state->select_start, stb_state->select_end); + Text("has_preferred_x: %d (%.2f)", stb_state->has_preferred_x, stb_state->preferred_x); Text("undo_point: %d, redo_point: %d, undo_char_point: %d, redo_char_point: %d", undo_state->undo_point, undo_state->redo_point, undo_state->undo_char_point, undo_state->redo_char_point); if (BeginChild("undopoints", ImVec2(0.0f, GetTextLineHeight() * 15), true)) // Visualize undo state { @@ -4944,28 +5085,32 @@ bool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flag return ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha); } +static void ColorEditRestoreH(const float* col, float* H) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.ColorEditCurrentID != 0); + if (g.ColorEditSavedID != g.ColorEditCurrentID || g.ColorEditSavedColor != ImGui::ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0))) + return; + *H = g.ColorEditSavedHue; +} + // ColorEdit supports RGB and HSV inputs. In case of RGB input resulting color may have undefined hue and/or saturation. // Since widget displays both RGB and HSV values we must preserve hue and saturation to prevent these values resetting. static void ColorEditRestoreHS(const float* col, float* H, float* S, float* V) { - // This check is optional. Suppose we have two color widgets side by side, both widgets display different colors, but both colors have hue and/or saturation undefined. - // With color check: hue/saturation is preserved in one widget. Editing color in one widget would reset hue/saturation in another one. - // Without color check: common hue/saturation would be displayed in all widgets that have hue/saturation undefined. - // g.ColorEditLastColor is stored as ImU32 RGB value: this essentially gives us color equality check with reduced precision. - // Tiny external color changes would not be detected and this check would still pass. This is OK, since we only restore hue/saturation _only_ if they are undefined, - // therefore this change flipping hue/saturation from undefined to a very tiny value would still be represented in color picker. ImGuiContext& g = *GImGui; - if (g.ColorEditLastColor != ImGui::ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0))) + IM_ASSERT(g.ColorEditCurrentID != 0); + if (g.ColorEditSavedID != g.ColorEditCurrentID || g.ColorEditSavedColor != ImGui::ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0))) return; // When S == 0, H is undefined. // When H == 1 it wraps around to 0. - if (*S == 0.0f || (*H == 0.0f && g.ColorEditLastHue == 1)) - *H = g.ColorEditLastHue; + if (*S == 0.0f || (*H == 0.0f && g.ColorEditSavedHue == 1)) + *H = g.ColorEditSavedHue; // When V == 0, S is undefined. if (*V == 0.0f) - *S = g.ColorEditLastSat; + *S = g.ColorEditSavedSat; } // Edit colors components (each component in 0.0f..1.0f range). @@ -4988,6 +5133,9 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag BeginGroup(); PushID(label); + const bool set_current_color_edit_id = (g.ColorEditCurrentID == 0); + if (set_current_color_edit_id) + g.ColorEditCurrentID = window->IDStack.back(); // If we're not showing any slider there's no point in doing any HSV conversions const ImGuiColorEditFlags flags_untouched = flags; @@ -5021,7 +5169,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]); else if ((flags & ImGuiColorEditFlags_InputRGB) && (flags & ImGuiColorEditFlags_DisplayHSV)) { - // Hue is lost when converting from greyscale rgb (saturation=0). Restore it. + // Hue is lost when converting from grayscale rgb (saturation=0). Restore it. ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]); ColorEditRestoreHS(col, &f[0], &f[1], &f[2]); } @@ -5145,7 +5293,10 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel)) { + // Position not necessarily next to last submitted button (e.g. if style.ColorButtonPosition == ImGuiDir_Left), + // but we need to use SameLine() to setup baseline correctly. Might want to refactor SameLine() to simplify this. SameLine(0.0f, style.ItemInnerSpacing.x); + window->DC.CursorPos.x = pos.x + ((flags & ImGuiColorEditFlags_NoInputs) ? w_button : w_full + style.ItemInnerSpacing.x); TextEx(label, label_display_end); } @@ -5157,10 +5308,11 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag f[n] = i[n] / 255.0f; if ((flags & ImGuiColorEditFlags_DisplayHSV) && (flags & ImGuiColorEditFlags_InputRGB)) { - g.ColorEditLastHue = f[0]; - g.ColorEditLastSat = f[1]; + g.ColorEditSavedHue = f[0]; + g.ColorEditSavedSat = f[1]; ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]); - g.ColorEditLastColor = ColorConvertFloat4ToU32(ImVec4(f[0], f[1], f[2], 0)); + g.ColorEditSavedID = g.ColorEditCurrentID; + g.ColorEditSavedColor = ColorConvertFloat4ToU32(ImVec4(f[0], f[1], f[2], 0)); } if ((flags & ImGuiColorEditFlags_DisplayRGB) && (flags & ImGuiColorEditFlags_InputHSV)) ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]); @@ -5172,6 +5324,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag col[3] = f[3]; } + if (set_current_color_edit_id) + g.ColorEditCurrentID = 0; PopID(); EndGroup(); @@ -5245,6 +5399,9 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl g.NextItemData.ClearFlags(); PushID(label); + const bool set_current_color_edit_id = (g.ColorEditCurrentID == 0); + if (set_current_color_edit_id) + g.ColorEditCurrentID = window->IDStack.back(); BeginGroup(); if (!(flags & ImGuiColorEditFlags_NoSidePreview)) @@ -5293,7 +5450,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl float R = col[0], G = col[1], B = col[2]; if (flags & ImGuiColorEditFlags_InputRGB) { - // Hue is lost when converting from greyscale rgb (saturation=0). Restore it. + // Hue is lost when converting from grayscale rgb (saturation=0). Restore it. ColorConvertRGBtoHSV(R, G, B, H, S, V); ColorEditRestoreHS(col, &H, &S, &V); } @@ -5348,10 +5505,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl { S = ImSaturate((io.MousePos.x - picker_pos.x) / (sv_picker_size - 1)); V = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1)); - - // Greatly reduces hue jitter and reset to 0 when hue == 255 and color is rapidly modified using SV square. - if (g.ColorEditLastColor == ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0))) - H = g.ColorEditLastHue; + ColorEditRestoreH(col, &H); // Greatly reduces hue jitter and reset to 0 when hue == 255 and color is rapidly modified using SV square. value_changed = value_changed_sv = true; } if (!(flags & ImGuiColorEditFlags_NoOptions)) @@ -5426,9 +5580,10 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl if (flags & ImGuiColorEditFlags_InputRGB) { ColorConvertHSVtoRGB(H, S, V, col[0], col[1], col[2]); - g.ColorEditLastHue = H; - g.ColorEditLastSat = S; - g.ColorEditLastColor = ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0)); + g.ColorEditSavedHue = H; + g.ColorEditSavedSat = S; + g.ColorEditSavedID = g.ColorEditCurrentID; + g.ColorEditSavedColor = ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0)); } else if (flags & ImGuiColorEditFlags_InputHSV) { @@ -5530,7 +5685,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl float sin_hue_angle = ImSin(H * 2.0f * IM_PI); ImVec2 hue_cursor_pos(wheel_center.x + cos_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5f, wheel_center.y + sin_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5f); float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f; - int hue_cursor_segments = ImClamp((int)(hue_cursor_rad / 1.4f), 9, 32); + int hue_cursor_segments = draw_list->_CalcCircleAutoSegmentCount(hue_cursor_rad); // Lock segment count so the +1 one matches others. draw_list->AddCircleFilled(hue_cursor_pos, hue_cursor_rad, hue_color32, hue_cursor_segments); draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad + 1, col_midgrey, hue_cursor_segments); draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad, col_white, hue_cursor_segments); @@ -5540,13 +5695,10 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl ImVec2 trb = wheel_center + ImRotate(triangle_pb, cos_hue_angle, sin_hue_angle); ImVec2 trc = wheel_center + ImRotate(triangle_pc, cos_hue_angle, sin_hue_angle); ImVec2 uv_white = GetFontTexUvWhitePixel(); - draw_list->PrimReserve(6, 6); + draw_list->PrimReserve(3, 3); draw_list->PrimVtx(tra, uv_white, hue_color32); - draw_list->PrimVtx(trb, uv_white, hue_color32); - draw_list->PrimVtx(trc, uv_white, col_white); - draw_list->PrimVtx(tra, uv_white, 0); draw_list->PrimVtx(trb, uv_white, col_black); - draw_list->PrimVtx(trc, uv_white, 0); + draw_list->PrimVtx(trc, uv_white, col_white); draw_list->AddTriangle(tra, trb, trc, col_midgrey, 1.5f); sv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V)); } @@ -5569,9 +5721,10 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl // Render cursor/preview circle (clamp S/V within 0..1 range because floating points colors may lead HSV values to be out of range) float sv_cursor_rad = value_changed_sv ? 10.0f : 6.0f; - draw_list->AddCircleFilled(sv_cursor_pos, sv_cursor_rad, user_col32_striped_of_alpha, 12); - draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad + 1, col_midgrey, 12); - draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad, col_white, 12); + int sv_cursor_segments = draw_list->_CalcCircleAutoSegmentCount(sv_cursor_rad); // Lock segment count so the +1 one matches others. + draw_list->AddCircleFilled(sv_cursor_pos, sv_cursor_rad, user_col32_striped_of_alpha, sv_cursor_segments); + draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad + 1, col_midgrey, sv_cursor_segments); + draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad, col_white, sv_cursor_segments); // Render alpha bar if (alpha_bar) @@ -5592,6 +5745,8 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl if (value_changed && g.LastItemData.ID != 0) // In case of ID collision, the second EndGroup() won't catch g.ActiveId MarkItemEdited(g.LastItemData.ID); + if (set_current_color_edit_id) + g.ColorEditCurrentID = 0; PopID(); return value_changed; @@ -5675,7 +5830,7 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl } // Tooltip - if (!(flags & ImGuiColorEditFlags_NoTooltip) && hovered) + if (!(flags & ImGuiColorEditFlags_NoTooltip) && hovered && IsItemHovered(ImGuiHoveredFlags_ForTooltip)) ColorTooltip(desc_id, &col.x, flags & (ImGuiColorEditFlags_InputMask_ | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf)); return pressed; @@ -5705,7 +5860,8 @@ void ImGui::ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags { ImGuiContext& g = *GImGui; - BeginTooltipEx(ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_None); + if (!BeginTooltipEx(ImGuiTooltipFlags_OverridePrevious, ImGuiWindowFlags_None)) + return; const char* text_end = text ? FindRenderedTextEnd(text, NULL) : text; if (text_end > text) { @@ -5742,6 +5898,7 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags) if ((!allow_opt_inputs && !allow_opt_datatype) || !BeginPopup("context")) return; ImGuiContext& g = *GImGui; + g.LockMarkEdited++; ImGuiColorEditFlags opts = g.ColorEditOptions; if (allow_opt_inputs) { @@ -5784,6 +5941,7 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags) g.ColorEditOptions = opts; EndPopup(); + g.LockMarkEdited--; } void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags) @@ -5793,6 +5951,7 @@ void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags fl if ((!allow_opt_picker && !allow_opt_alpha_bar) || !BeginPopup("context")) return; ImGuiContext& g = *GImGui; + g.LockMarkEdited++; if (allow_opt_picker) { ImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function @@ -5822,6 +5981,7 @@ void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags fl CheckboxFlags("Alpha Bar", &g.ColorEditOptions, ImGuiColorEditFlags_AlphaBar); } EndPopup(); + g.LockMarkEdited--; } //------------------------------------------------------------------------- @@ -6018,18 +6178,29 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l if (!display_frame && (flags & (ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_SpanFullWidth)) == 0) interact_bb.Max.x = frame_bb.Min.x + text_width + style.ItemSpacing.x * 2.0f; - // Store a flag for the current depth to tell if we will allow closing this node when navigating one of its child. - // For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop(). - // This is currently only support 32 level deep and we are fine with (1 << Depth) overflowing into a zero. - const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0; + // Compute open and multi-select states before ItemAdd() as it clear NextItem data. bool is_open = TreeNodeUpdateNextOpen(id, flags); - if (is_open && !g.NavIdIsAlive && (flags & ImGuiTreeNodeFlags_NavLeftJumpsBackHere) && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)) - window->DC.TreeJumpToParentOnPopMask |= (1 << window->DC.TreeDepth); - bool item_add = ItemAdd(interact_bb, id); g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HasDisplayRect; g.LastItemData.DisplayRect = frame_bb; + // If a NavLeft request is happening and ImGuiTreeNodeFlags_NavLeftJumpsBackHere enabled: + // Store data for the current depth to allow returning to this node from any child item. + // For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop(). + // It will become tempting to enable ImGuiTreeNodeFlags_NavLeftJumpsBackHere by default or move it to ImGuiStyle. + // Currently only supports 32 level deep and we are fine with (1 << Depth) overflowing into a zero, easy to increase. + if (is_open && !g.NavIdIsAlive && (flags & ImGuiTreeNodeFlags_NavLeftJumpsBackHere) && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)) + if (g.NavMoveDir == ImGuiDir_Left && g.NavWindow == window && NavMoveRequestButNoResultYet()) + { + g.NavTreeNodeStack.resize(g.NavTreeNodeStack.Size + 1); + ImGuiNavTreeNodeData* nav_tree_node_data = &g.NavTreeNodeStack.back(); + nav_tree_node_data->ID = id; + nav_tree_node_data->InFlags = g.LastItemData.InFlags; + nav_tree_node_data->NavRect = g.LastItemData.NavRect; + window->DC.TreeJumpToParentOnPopMask |= (1 << window->DC.TreeDepth); + } + + const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0; if (!item_add) { if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)) @@ -6039,8 +6210,8 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l } ImGuiButtonFlags button_flags = ImGuiTreeNodeFlags_None; - if (flags & ImGuiTreeNodeFlags_AllowItemOverlap) - button_flags |= ImGuiButtonFlags_AllowItemOverlap; + if ((flags & ImGuiTreeNodeFlags_AllowOverlap) || (g.LastItemData.InFlags & ImGuiItemFlags_AllowOverlap)) + button_flags |= ImGuiButtonFlags_AllowOverlap; if (!is_leaf) button_flags |= ImGuiButtonFlags_PressedOnDragDropHold; @@ -6096,11 +6267,13 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l if (g.NavId == id && g.NavMoveDir == ImGuiDir_Left && is_open) { toggled = true; + NavClearPreferredPosForAxis(ImGuiAxis_X); NavMoveRequestCancel(); } if (g.NavId == id && g.NavMoveDir == ImGuiDir_Right && !is_open) // If there's something upcoming on the line we may want to give it the priority? { toggled = true; + NavClearPreferredPosForAxis(ImGuiAxis_X); NavMoveRequestCancel(); } @@ -6111,8 +6284,6 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledOpen; } } - if (flags & ImGuiTreeNodeFlags_AllowItemOverlap) - SetItemAllowOverlap(); // In this branch, TreeNodeBehavior() cannot toggle the selection so this will never trigger. if (selected != was_selected) //-V547 @@ -6130,9 +6301,9 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l if (flags & ImGuiTreeNodeFlags_Bullet) RenderBullet(window->DrawList, ImVec2(text_pos.x - text_offset_x * 0.60f, text_pos.y + g.FontSize * 0.5f), text_col); else if (!is_leaf) - RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y), text_col, is_open ? ImGuiDir_Down : ImGuiDir_Right, 1.0f); + RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y), text_col, is_open ? ((flags & ImGuiTreeNodeFlags_UpsideDownArrow) ? ImGuiDir_Up : ImGuiDir_Down) : ImGuiDir_Right, 1.0f); else // Leaf without bullet, left-adjusted text - text_pos.x -= text_offset_x; + text_pos.x -= text_offset_x -padding.x; if (flags & ImGuiTreeNodeFlags_ClipLabelForTrailingButton) frame_bb.Max.x -= g.FontSize + style.FramePadding.x; @@ -6152,7 +6323,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l if (flags & ImGuiTreeNodeFlags_Bullet) RenderBullet(window->DrawList, ImVec2(text_pos.x - text_offset_x * 0.5f, text_pos.y + g.FontSize * 0.5f), text_col); else if (!is_leaf) - RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.15f), text_col, is_open ? ImGuiDir_Down : ImGuiDir_Right, 0.70f); + RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.15f), text_col, is_open ? ((flags & ImGuiTreeNodeFlags_UpsideDownArrow) ? ImGuiDir_Up : ImGuiDir_Down) : ImGuiDir_Right, 0.70f); if (g.LogEnabled) LogSetNextTextDecoration(">", NULL); RenderText(text_pos, label, label_end, false); @@ -6199,12 +6370,14 @@ void ImGui::TreePop() ImU32 tree_depth_mask = (1 << window->DC.TreeDepth); // Handle Left arrow to move to parent tree node (when ImGuiTreeNodeFlags_NavLeftJumpsBackHere is enabled) - if (g.NavMoveDir == ImGuiDir_Left && g.NavWindow == window && NavMoveRequestButNoResultYet()) - if (g.NavIdIsAlive && (window->DC.TreeJumpToParentOnPopMask & tree_depth_mask)) - { - SetNavID(window->IDStack.back(), g.NavLayer, 0, ImRect()); - NavMoveRequestCancel(); - } + if (window->DC.TreeJumpToParentOnPopMask & tree_depth_mask) // Only set during request + { + ImGuiNavTreeNodeData* nav_tree_node_data = &g.NavTreeNodeStack.back(); + IM_ASSERT(nav_tree_node_data->ID == window->IDStack.back()); + if (g.NavIdIsAlive && g.NavMoveDir == ImGuiDir_Left && g.NavWindow == window && NavMoveRequestButNoResultYet()) + NavMoveRequestResolveWithPastTreeNode(&g.NavMoveResultLocal, nav_tree_node_data); + g.NavTreeNodeStack.pop_back(); + } window->DC.TreeJumpToParentOnPopMask &= tree_depth_mask - 1; IM_ASSERT(window->IDStack.Size > 1); // There should always be 1 element in the IDStack (pushed during window creation). If this triggers you called TreePop/PopID too much. @@ -6256,7 +6429,7 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_visible, ImGuiTreeNodeFl ImGuiID id = window->GetID(label); flags |= ImGuiTreeNodeFlags_CollapsingHeader; if (p_visible) - flags |= ImGuiTreeNodeFlags_AllowItemOverlap | ImGuiTreeNodeFlags_ClipLabelForTrailingButton; + flags |= ImGuiTreeNodeFlags_AllowOverlap | ImGuiTreeNodeFlags_ClipLabelForTrailingButton; bool is_open = TreeNodeBehavior(id, flags, label); if (p_visible != NULL) { @@ -6266,8 +6439,8 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_visible, ImGuiTreeNodeFl ImGuiContext& g = *GImGui; ImGuiLastItemData last_item_backup = g.LastItemData; float button_size = g.FontSize; - float button_x = ImMax(g.LastItemData.Rect.Min.x, g.LastItemData.Rect.Max.x - g.Style.FramePadding.x * 2.0f - button_size); - float button_y = g.LastItemData.Rect.Min.y; + float button_x = ImMax(g.LastItemData.Rect.Min.x, g.LastItemData.Rect.Max.x - g.Style.FramePadding.x - button_size); + float button_y = g.LastItemData.Rect.Min.y + g.Style.FramePadding.y; ImGuiID close_button_id = GetIDWithSeed("#CLOSE", NULL, id); if (CloseButton(close_button_id, ImVec2(button_x, button_y))) *p_visible = false; @@ -6285,7 +6458,7 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_visible, ImGuiTreeNodeFl // Tip: pass a non-visible label (e.g. "##hello") then you can use the space to draw other text or image. // But you need to make sure the ID is unique, e.g. enclose calls in PushID/PopID or use ##unique_id. -// With this scheme, ImGuiSelectableFlags_SpanAllColumns and ImGuiSelectableFlags_AllowItemOverlap are also frequently used flags. +// With this scheme, ImGuiSelectableFlags_SpanAllColumns and ImGuiSelectableFlags_AllowOverlap are also frequently used flags. // FIXME: Selectable() with (size.x == 0.0f) and (SelectableTextAlign.x > 0.0f) followed by SameLine() is currently not supported. bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags flags, const ImVec2& size_arg) { @@ -6365,10 +6538,11 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl // We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries ImGuiButtonFlags button_flags = 0; if (flags & ImGuiSelectableFlags_NoHoldingActiveID) { button_flags |= ImGuiButtonFlags_NoHoldingActiveId; } + if (flags & ImGuiSelectableFlags_NoSetKeyOwner) { button_flags |= ImGuiButtonFlags_NoSetKeyOwner; } if (flags & ImGuiSelectableFlags_SelectOnClick) { button_flags |= ImGuiButtonFlags_PressedOnClick; } if (flags & ImGuiSelectableFlags_SelectOnRelease) { button_flags |= ImGuiButtonFlags_PressedOnRelease; } if (flags & ImGuiSelectableFlags_AllowDoubleClick) { button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick; } - if (flags & ImGuiSelectableFlags_AllowItemOverlap) { button_flags |= ImGuiButtonFlags_AllowItemOverlap; } + if ((flags & ImGuiSelectableFlags_AllowOverlap) || (g.LastItemData.InFlags & ImGuiItemFlags_AllowOverlap)) { button_flags |= ImGuiButtonFlags_AllowOverlap; } const bool was_selected = selected; bool hovered, held; @@ -6381,7 +6555,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl // - (1) it would require focus scope to be set, need exposing PushFocusScope() or equivalent (e.g. BeginSelection() calling PushFocusScope()) // - (2) usage will fail with clipped items // The multi-select API aim to fix those issues, e.g. may be replaced with a BeginSelection() API. - if ((flags & ImGuiSelectableFlags_SelectOnNav) && g.NavJustMovedToId != 0 && g.NavJustMovedToFocusScopeId == window->DC.NavFocusScopeIdCurrent) + if ((flags & ImGuiSelectableFlags_SelectOnNav) && g.NavJustMovedToId != 0 && g.NavJustMovedToFocusScopeId == g.CurrentFocusScopeId) if (g.NavJustMovedToId == id) selected = pressed = true; @@ -6390,29 +6564,25 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl { if (!g.NavDisableMouseHover && g.NavWindow == window && g.NavLayer == window->DC.NavLayerCurrent) { - SetNavID(id, window->DC.NavLayerCurrent, window->DC.NavFocusScopeIdCurrent, WindowRectAbsToRel(window, bb)); // (bb == NavRect) + SetNavID(id, window->DC.NavLayerCurrent, g.CurrentFocusScopeId, WindowRectAbsToRel(window, bb)); // (bb == NavRect) g.NavDisableHighlight = true; } } if (pressed) MarkItemEdited(id); - if (flags & ImGuiSelectableFlags_AllowItemOverlap) - SetItemAllowOverlap(); - // In this branch, Selectable() cannot toggle the selection so this will never trigger. if (selected != was_selected) //-V547 g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledSelection; // Render - if (held && (flags & ImGuiSelectableFlags_DrawHoveredWhenHeld)) - hovered = true; if (hovered || selected) { const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); RenderFrame(bb.Min, bb.Max, col, false, 0.0f); } - RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding); + if (g.NavId == id) + RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding); if (span_all_columns && window->DC.CurrentColumns) PopColumnsBackground(); @@ -6491,20 +6661,6 @@ bool ImGui::BeginListBox(const char* label, const ImVec2& size_arg) return true; } -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS -// OBSOLETED in 1.81 (from February 2021) -bool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_items) -{ - // If height_in_items == -1, default height is maximum 7. - ImGuiContext& g = *GImGui; - float height_in_items_f = (height_in_items < 0 ? ImMin(items_count, 7) : height_in_items) + 0.25f; - ImVec2 size; - size.x = 0.0f; - size.y = GetTextLineHeightWithSpacing() * height_in_items_f + g.Style.FramePadding.y * 2.0f; - return BeginListBox(label, size); -} -#endif - void ImGui::EndListBox() { ImGuiContext& g = *GImGui; @@ -6581,7 +6737,7 @@ bool ImGui::ListBox(const char* label, int* current_item, bool (*items_getter)(v // - others https://github.com/ocornut/imgui/wiki/Useful-Extensions //------------------------------------------------------------------------- -int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size) +int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, const ImVec2& size_arg) { ImGuiContext& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); @@ -6592,10 +6748,7 @@ int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_get const ImGuiID id = window->GetID(label); const ImVec2 label_size = CalcTextSize(label, NULL, true); - if (frame_size.x == 0.0f) - frame_size.x = CalcItemWidth(); - if (frame_size.y == 0.0f) - frame_size.y = label_size.y + (style.FramePadding.y * 2); + const ImVec2 frame_size = CalcItemSize(size_arg, CalcItemWidth(), label_size.y + style.FramePadding.y * 2.0f); const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size); const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding); @@ -6603,7 +6756,7 @@ int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_get ItemSize(total_bb, style.FramePadding.y); if (!ItemAdd(total_bb, 0, &frame_bb)) return -1; - const bool hovered = ItemHoverable(frame_bb, id); + const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags); // Determine scale from values if not specified if (scale_min == FLT_MAX || scale_max == FLT_MAX) @@ -6881,7 +7034,7 @@ void ImGui::EndMenuBar() // To do so we claim focus back, restore NavId and then process the movement request for yet another frame. // This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth bothering) const ImGuiNavLayer layer = ImGuiNavLayer_Menu; - IM_ASSERT(window->DC.NavLayersActiveMaskNext & (1 << layer)); // Sanity check + IM_ASSERT(window->DC.NavLayersActiveMaskNext & (1 << layer)); // Sanity check (FIXME: Seems unnecessary) FocusWindow(window); SetNavID(window->NavLastIds[layer], layer, 0, window->NavRectRel[layer]); g.NavDisableHighlight = true; // Hide highlight for the current frame so we don't see the intermediary selection. @@ -6971,7 +7124,7 @@ void ImGui::EndMainMenuBar() // FIXME: With this strategy we won't be able to restore a NULL focus. ImGuiContext& g = *GImGui; if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest) - FocusTopMostWindowUnderOne(g.NavWindow, NULL); + FocusTopMostWindowUnderOne(g.NavWindow, NULL, NULL, ImGuiFocusRequestFlags_UnlessBelowModal | ImGuiFocusRequestFlags_RestoreFocusedChild); End(); } @@ -6985,9 +7138,9 @@ static bool IsRootOfOpenMenuSet() // Initially we used 'upper_popup->OpenParentId == window->IDStack.back()' to differentiate multiple menu sets from each others // (e.g. inside menu bar vs loose menu items) based on parent ID. - // This would however prevent the use of e.g. PuhsID() user code submitting menus. + // This would however prevent the use of e.g. PushID() user code submitting menus. // Previously this worked between popup and a first child menu because the first child menu always had the _ChildWindow flag, - // making hovering on parent popup possible while first child menu was focused - but this was generally a bug with other side effects. + // making hovering on parent popup possible while first child menu was focused - but this was generally a bug with other side effects. // Instead we don't treat Popup specifically (in order to consistently support menu features in them), maybe the first child menu of a Popup // doesn't have the _ChildWindow flag, and we rely on this IsRootOfOpenMenuSet() check to allow hovering between root window/popup and first child menu. // In the end, lack of ID check made it so we could no longer differentiate between separate menu sets. To compensate for that, we at least check parent window nav layer. @@ -6995,7 +7148,9 @@ static bool IsRootOfOpenMenuSet() // open on hover, but that should be a lesser problem, because if such menus are close in proximity in window content then it won't feel weird and if they are far apart // it likely won't be a problem anyone runs into. const ImGuiPopupData* upper_popup = &g.OpenPopupStack[g.BeginPopupStack.Size]; - return (window->DC.NavLayerCurrent == upper_popup->ParentNavLayer && upper_popup->Window && (upper_popup->Window->Flags & ImGuiWindowFlags_ChildMenu)); + if (window->DC.NavLayerCurrent != upper_popup->ParentNavLayer) + return false; + return upper_popup->Window && (upper_popup->Window->Flags & ImGuiWindowFlags_ChildMenu) && ImGui::IsWindowChildOf(upper_popup->Window, window, true); } bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) @@ -7011,9 +7166,9 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) // Sub-menus are ChildWindow so that mouse can be hovering across them (otherwise top-most popup menu would steal focus and not allow hovering on parent menu) // The first menu in a hierarchy isn't so hovering doesn't get across (otherwise e.g. resizing borders with ImGuiButtonFlags_FlattenChildren would react), but top-most BeginMenu() will bypass that limitation. - ImGuiWindowFlags flags = ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus; + ImGuiWindowFlags window_flags = ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus; if (window->Flags & ImGuiWindowFlags_ChildMenu) - flags |= ImGuiWindowFlags_ChildWindow; + window_flags |= ImGuiWindowFlags_ChildWindow; // If a menu with same the ID was already submitted, we will append to it, matching the behavior of Begin(). // We are relying on a O(N) search - so O(N log N) over the frame - which seems like the most efficient for the expected small amount of BeginMenu() calls per frame. @@ -7021,7 +7176,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) if (g.MenusIdSubmittedThisFrame.contains(id)) { if (menu_is_open) - menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) + menu_is_open = BeginPopupEx(id, window_flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) else g.NextWindowData.ClearFlags(); // we behave like Begin() and need to consume those values return menu_is_open; @@ -7047,7 +7202,9 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) BeginDisabled(); const ImGuiMenuColumns* offsets = &window->DC.MenuColumns; bool pressed; - const ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_SelectOnClick | ImGuiSelectableFlags_DontClosePopups; + + // We use ImGuiSelectableFlags_NoSetKeyOwner to allow down on one menu item, move, up on another. + const ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_NoSetKeyOwner | ImGuiSelectableFlags_SelectOnClick | ImGuiSelectableFlags_DontClosePopups; if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) { // Menu inside an horizontal menu bar @@ -7058,7 +7215,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y)); float w = label_size.x; ImVec2 text_pos(window->DC.CursorPos.x + offsets->OffsetLabel, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset); - pressed = Selectable("", menu_is_open, selectable_flags, ImVec2(w, 0.0f)); + pressed = Selectable("", menu_is_open, selectable_flags, ImVec2(w, label_size.y)); RenderText(text_pos, label); PopStyleVar(); window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar(). @@ -7074,7 +7231,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) float min_w = window->DC.MenuColumns.DeclColumns(icon_w, label_size.x, 0.0f, checkmark_w); // Feedback to next frame float extra_w = ImMax(0.0f, GetContentRegionAvail().x - min_w); ImVec2 text_pos(window->DC.CursorPos.x + offsets->OffsetLabel, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset); - pressed = Selectable("", menu_is_open, selectable_flags | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, 0.0f)); + pressed = Selectable("", menu_is_open, selectable_flags | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, label_size.y)); RenderText(text_pos, label); if (icon_w > 0.0f) RenderText(pos + ImVec2(offsets->OffsetIcon, 0.0f), icon); @@ -7158,24 +7315,32 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Openable | (menu_is_open ? ImGuiItemStatusFlags_Opened : 0)); PopID(); - if (!menu_is_open && want_open && g.OpenPopupStack.Size > g.BeginPopupStack.Size) + if (want_open && !menu_is_open && g.OpenPopupStack.Size > g.BeginPopupStack.Size) { - // Don't recycle same menu level in the same frame, first close the other menu and yield for a frame. + // Don't reopen/recycle same menu level in the same frame, first close the other menu and yield for a frame. OpenPopup(label); - return false; } - - menu_is_open |= want_open; - if (want_open) + else if (want_open) + { + menu_is_open = true; OpenPopup(label); + } if (menu_is_open) { - // FIXME: This technically breaks functions relying on LastItemData, somehow nobody complained yet. Should backup/restore LastItemData. + ImGuiLastItemData last_item_in_parent = g.LastItemData; SetNextWindowPos(popup_pos, ImGuiCond_Always); // Note: misleading: the value will serve as reference for FindBestWindowPosForPopup(), not actual pos. PushStyleVar(ImGuiStyleVar_ChildRounding, style.PopupRounding); // First level will use _PopupRounding, subsequent will use _ChildRounding - menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) + menu_is_open = BeginPopupEx(id, window_flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) PopStyleVar(); + if (menu_is_open) + { + // Restore LastItemData so IsItemXXXX functions can work after BeginMenu()/EndMenu() + // (This fixes using IsItemClicked() and IsItemHovered(), but IsItemHovered() also relies on its support for ImGuiItemFlags_NoWindowHoverableCheck) + g.LastItemData = last_item_in_parent; + if (g.HoveredWindow == window) + g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow; + } } else { @@ -7231,7 +7396,8 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut if (!enabled) BeginDisabled(); - const ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_SelectOnRelease | ImGuiSelectableFlags_SetNavIdOnHover; + // We use ImGuiSelectableFlags_NoSetKeyOwner to allow down on one menu item, move, up on another. + const ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_SelectOnRelease | ImGuiSelectableFlags_NoSetKeyOwner | ImGuiSelectableFlags_SetNavIdOnHover; const ImGuiMenuColumns* offsets = &window->DC.MenuColumns; if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) { @@ -7243,7 +7409,8 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y)); pressed = Selectable("", selected, selectable_flags, ImVec2(w, 0.0f)); PopStyleVar(); - RenderText(text_pos, label); + if (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Visible) + RenderText(text_pos, label); window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar(). } else @@ -7256,18 +7423,21 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut float checkmark_w = IM_FLOOR(g.FontSize * 1.20f); float min_w = window->DC.MenuColumns.DeclColumns(icon_w, label_size.x, shortcut_w, checkmark_w); // Feedback for next frame float stretch_w = ImMax(0.0f, GetContentRegionAvail().x - min_w); - pressed = Selectable("", false, selectable_flags | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, 0.0f)); - RenderText(pos + ImVec2(offsets->OffsetLabel, 0.0f), label); - if (icon_w > 0.0f) - RenderText(pos + ImVec2(offsets->OffsetIcon, 0.0f), icon); - if (shortcut_w > 0.0f) + pressed = Selectable("", false, selectable_flags | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, label_size.y)); + if (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Visible) { - PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); - RenderText(pos + ImVec2(offsets->OffsetShortcut + stretch_w, 0.0f), shortcut, NULL, false); - PopStyleColor(); + RenderText(pos + ImVec2(offsets->OffsetLabel, 0.0f), label); + if (icon_w > 0.0f) + RenderText(pos + ImVec2(offsets->OffsetIcon, 0.0f), icon); + if (shortcut_w > 0.0f) + { + PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); + RenderText(pos + ImVec2(offsets->OffsetShortcut + stretch_w, 0.0f), shortcut, NULL, false); + PopStyleColor(); + } + if (selected) + RenderCheckMark(window->DrawList, pos + ImVec2(offsets->OffsetMark + stretch_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(ImGuiCol_Text), g.FontSize * 0.866f); } - if (selected) - RenderCheckMark(window->DrawList, pos + ImVec2(offsets->OffsetMark + stretch_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(ImGuiCol_Text), g.FontSize * 0.866f); } IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (selected ? ImGuiItemStatusFlags_Checked : 0)); if (!enabled) @@ -7305,11 +7475,17 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool* p_selected, // - TabBarCalcTabID() [Internal] // - TabBarCalcMaxTabWidth() [Internal] // - TabBarFindTabById() [Internal] +// - TabBarFindTabByOrder() [Internal] +// - TabBarGetCurrentTab() [Internal] +// - TabBarGetTabName() [Internal] // - TabBarRemoveTab() [Internal] // - TabBarCloseTab() [Internal] // - TabBarScrollClamp() [Internal] // - TabBarScrollToTab() [Internal] -// - TabBarQueueChangeTabOrder() [Internal] +// - TabBarQueueFocus() [Internal] +// - TabBarQueueReorder() [Internal] +// - TabBarProcessReorderFromMousePos() [Internal] +// - TabBarProcessReorder() [Internal] // - TabBarScrollingButtons() [Internal] // - TabBarTabListPopupButton() [Internal] //------------------------------------------------------------------------- @@ -7326,7 +7502,7 @@ struct ImGuiTabBarSection namespace ImGui { static void TabBarLayout(ImGuiTabBar* tab_bar); - static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label); + static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, ImGuiWindow* docked_window); static float TabBarCalcMaxTabWidth(); static float TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling); static void TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGuiTabBarSection* sections); @@ -7434,6 +7610,7 @@ bool ImGui::BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& tab_bar_bb, ImG tab_bar->ItemSpacingY = g.Style.ItemSpacing.y; tab_bar->FramePadding = g.Style.FramePadding; tab_bar->TabsActiveCount = 0; + tab_bar->LastTabItemIdx = -1; tab_bar->BeginCount = 1; // Set cursor pos in a way which only be used in the off-chance the user erroneously submits item before BeginTabItem(): items will overlap @@ -7482,6 +7659,7 @@ void ImGui::EndTabBar() if (tab_bar->BeginCount > 1) window->DC.CursorPos = tab_bar->BackupCursorPos; + tab_bar->LastTabItemIdx = -1; if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0) PopID(); @@ -7489,6 +7667,12 @@ void ImGui::EndTabBar() g.CurrentTabBar = g.CurrentTabBarStack.empty() ? NULL : GetTabBarFromTabBarRef(g.CurrentTabBarStack.back()); } +// Scrolling happens only in the central section (leading/trailing sections are not scrolling) +static float TabBarCalcScrollableWidth(ImGuiTabBar* tab_bar, ImGuiTabBarSection* sections) +{ + return tab_bar->BarRect.GetWidth() - sections[0].Width - sections[2].Width - sections[1].Spacing; +} + // This is called only once a frame before by the first call to ItemTab() // The reason we're not calling it in BeginTabBar() is to leave a chance to the user to call the SetTabItemClosed() functions. static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) @@ -7591,9 +7775,9 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) // Refresh tab width immediately, otherwise changes of style e.g. style.FramePadding.x would noticeably lag in the tab bar. // Additionally, when using TabBarAddTab() to manipulate tab bar order we occasionally insert new tabs that don't have a width yet, // and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window. - const char* tab_name = tab_bar->GetTabName(tab); - const bool has_close_button = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) ? false : true; - tab->ContentWidth = (tab->RequestedWidth >= 0.0f) ? tab->RequestedWidth : TabItemCalcSize(tab_name, has_close_button).x; + const char* tab_name = TabBarGetTabName(tab_bar, tab); + const bool has_close_button_or_unsaved_marker = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) == 0 || (tab->Flags & ImGuiTabItemFlags_UnsavedDocument); + tab->ContentWidth = (tab->RequestedWidth >= 0.0f) ? tab->RequestedWidth : TabItemCalcSize(tab_name, has_close_button_or_unsaved_marker).x; int section_n = TabItemGetSectionIdx(tab); ImGuiTabBarSection* section = §ions[section_n]; @@ -7670,6 +7854,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) { ImGuiTabItem* tab = &tab_bar->Tabs[section_tab_index + tab_n]; tab->Offset = tab_offset; + tab->NameOffset = -1; tab_offset += tab->Width + (tab_n < section->TabCount - 1 ? g.Style.ItemInnerSpacing.x : 0.0f); } tab_bar->WidthAllTabs += ImMax(section->Width + section->Spacing, 0.0f); @@ -7677,6 +7862,9 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) section_tab_index += section->TabCount; } + // Clear name buffers + tab_bar->TabsNames.Buf.resize(0); + // If we have lost the selected tab, select the next most recently active one if (found_selected_tab_id == false) tab_bar->SelectedTabId = 0; @@ -7687,9 +7875,23 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) tab_bar->VisibleTabId = tab_bar->SelectedTabId; tab_bar->VisibleTabWasSubmitted = false; - // Update scrolling + // Apply request requests if (scroll_to_tab_id != 0) TabBarScrollToTab(tab_bar, scroll_to_tab_id, sections); + else if ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll) && IsMouseHoveringRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, true) && IsWindowContentHoverable(g.CurrentWindow)) + { + const float wheel = g.IO.MouseWheelRequestAxisSwap ? g.IO.MouseWheel : g.IO.MouseWheelH; + const ImGuiKey wheel_key = g.IO.MouseWheelRequestAxisSwap ? ImGuiKey_MouseWheelY : ImGuiKey_MouseWheelX; + if (TestKeyOwner(wheel_key, tab_bar->ID) && wheel != 0.0f) + { + const float scroll_step = wheel * TabBarCalcScrollableWidth(tab_bar, sections) / 3.0f; + tab_bar->ScrollingTargetDistToVisibility = 0.0f; + tab_bar->ScrollingTarget = TabBarScrollClamp(tab_bar, tab_bar->ScrollingTarget - scroll_step); + } + SetKeyOwner(wheel_key, tab_bar->ID); + } + + // Update scrolling tab_bar->ScrollingAnim = TabBarScrollClamp(tab_bar, tab_bar->ScrollingAnim); tab_bar->ScrollingTarget = TabBarScrollClamp(tab_bar, tab_bar->ScrollingTarget); if (tab_bar->ScrollingAnim != tab_bar->ScrollingTarget) @@ -7708,10 +7910,6 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) tab_bar->ScrollingRectMinX = tab_bar->BarRect.Min.x + sections[0].Width + sections[0].Spacing; tab_bar->ScrollingRectMaxX = tab_bar->BarRect.Max.x - sections[2].Width - sections[1].Spacing; - // Clear name buffers - if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0) - tab_bar->TabsNames.Buf.resize(0); - // Actual layout in host window (we don't do it in BeginTabBar() so as not to waste an extra frame) ImGuiWindow* window = g.CurrentWindow; window->DC.CursorPos = tab_bar->BarRect.Min; @@ -7719,9 +7917,11 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal); } -// Dockables uses Name/ID in the global namespace. Non-dockable items use the ID stack. -static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label) +// Dockable windows uses Name/ID in the global namespace. Non-dockable items use the ID stack. +static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, ImGuiWindow* docked_window) { + IM_ASSERT(docked_window == NULL); // master branch only + IM_UNUSED(docked_window); if (tab_bar->Flags & ImGuiTabBarFlags_DockNode) { ImGuiID id = ImHashStr(label); @@ -7750,7 +7950,30 @@ ImGuiTabItem* ImGui::TabBarFindTabByID(ImGuiTabBar* tab_bar, ImGuiID tab_id) return NULL; } -// The *TabId fields be already set by the docking system _before_ the actual TabItem was created, so we clear them regardless. +// Order = visible order, not submission order! (which is tab->BeginOrder) +ImGuiTabItem* ImGui::TabBarFindTabByOrder(ImGuiTabBar* tab_bar, int order) +{ + if (order < 0 || order >= tab_bar->Tabs.Size) + return NULL; + return &tab_bar->Tabs[order]; +} + +ImGuiTabItem* ImGui::TabBarGetCurrentTab(ImGuiTabBar* tab_bar) +{ + if (tab_bar->LastTabItemIdx <= 0 || tab_bar->LastTabItemIdx >= tab_bar->Tabs.Size) + return NULL; + return &tab_bar->Tabs[tab_bar->LastTabItemIdx]; +} + +const char* ImGui::TabBarGetTabName(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) +{ + if (tab->NameOffset == -1) + return "N/A"; + IM_ASSERT(tab->NameOffset < tab_bar->TabsNames.Buf.Size); + return tab_bar->TabsNames.Buf.Data + tab->NameOffset; +} + +// The *TabId fields are already set by the docking system _before_ the actual TabItem was created, so we clear them regardless. void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id) { if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id)) @@ -7781,7 +8004,7 @@ void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) { // Actually select before expecting closure attempt (on an UnsavedDocument tab user is expect to e.g. show a popup) if (tab_bar->VisibleTabId != tab->ID) - tab_bar->NextSelectedTabId = tab->ID; + TabBarQueueFocus(tab_bar, tab); } } @@ -7802,11 +8025,10 @@ static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGui ImGuiContext& g = *GImGui; float margin = g.FontSize * 1.0f; // When to scroll to make Tab N+1 visible always make a bit of N visible to suggest more scrolling area (since we don't have a scrollbar) - int order = tab_bar->GetTabOrder(tab); + int order = TabBarGetTabOrder(tab_bar, tab); // Scrolling happens only in the central section (leading/trailing sections are not scrolling) - // FIXME: This is all confusing. - float scrollable_width = tab_bar->BarRect.GetWidth() - sections[0].Width - sections[2].Width - sections[1].Spacing; + float scrollable_width = TabBarCalcScrollableWidth(tab_bar, sections); // We make all tabs positions all relative Sections[0].Width to make code simpler float tab_x1 = tab->Offset - sections[0].Width + (order > sections[0].TabCount - 1 ? -margin : 0.0f); @@ -7826,7 +8048,12 @@ static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGui } } -void ImGui::TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int offset) +void ImGui::TabBarQueueFocus(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) +{ + tab_bar->NextSelectedTabId = tab->ID; +} + +void ImGui::TabBarQueueReorder(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, int offset) { IM_ASSERT(offset != 0); IM_ASSERT(tab_bar->ReorderRequestTabId == 0); @@ -7834,7 +8061,7 @@ void ImGui::TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, in tab_bar->ReorderRequestOffset = (ImS16)offset; } -void ImGui::TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* src_tab, ImVec2 mouse_pos) +void ImGui::TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, ImGuiTabItem* src_tab, ImVec2 mouse_pos) { ImGuiContext& g = *GImGui; IM_ASSERT(tab_bar->ReorderRequestTabId == 0); @@ -7877,7 +8104,7 @@ bool ImGui::TabBarProcessReorder(ImGuiTabBar* tab_bar) return false; //IM_ASSERT(tab_bar->Flags & ImGuiTabBarFlags_Reorderable); // <- this may happen when using debug tools - int tab2_order = tab_bar->GetTabOrder(tab1) + tab_bar->ReorderRequestOffset; + int tab2_order = TabBarGetTabOrder(tab_bar, tab1) + tab_bar->ReorderRequestOffset; if (tab2_order < 0 || tab2_order >= tab_bar->Tabs.Size) return false; @@ -7937,7 +8164,7 @@ static ImGuiTabItem* ImGui::TabBarScrollingButtons(ImGuiTabBar* tab_bar) if (select_dir != 0) if (ImGuiTabItem* tab_item = TabBarFindTabByID(tab_bar, tab_bar->SelectedTabId)) { - int selected_order = tab_bar->GetTabOrder(tab_item); + int selected_order = TabBarGetTabOrder(tab_bar, tab_item); int target_order = selected_order + select_dir; // Skip tab item buttons until another tab item is found or end is reached @@ -7989,7 +8216,7 @@ static ImGuiTabItem* ImGui::TabBarTabListPopupButton(ImGuiTabBar* tab_bar) if (tab->Flags & ImGuiTabItemFlags_Button) continue; - const char* tab_name = tab_bar->GetTabName(tab); + const char* tab_name = TabBarGetTabName(tab_bar, tab); if (Selectable(tab_name, tab_bar->SelectedTabId == tab->ID)) tab_to_select = tab; } @@ -8028,7 +8255,7 @@ bool ImGui::BeginTabItem(const char* label, bool* p_open, ImGuiTabItemFlags f } IM_ASSERT(!(flags & ImGuiTabItemFlags_Button)); // BeginTabItem() Can't be used with button flags, use TabItemButton() instead! - bool ret = TabItemEx(tab_bar, label, p_open, flags); + bool ret = TabItemEx(tab_bar, label, p_open, flags, NULL); if (ret && !(flags & ImGuiTabItemFlags_NoPushId)) { ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx]; @@ -8069,10 +8296,10 @@ bool ImGui::TabItemButton(const char* label, ImGuiTabItemFlags flags) IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!"); return false; } - return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder); + return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder, NULL); } -bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags) +bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window) { // Layout whole tab bar if not already done ImGuiContext& g = *GImGui; @@ -8087,14 +8314,14 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, return false; const ImGuiStyle& style = g.Style; - const ImGuiID id = TabBarCalcTabID(tab_bar, label); + const ImGuiID id = TabBarCalcTabID(tab_bar, label, docked_window); // If the user called us with *p_open == false, we early out and don't render. // We make a call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID. IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags); if (p_open && !*p_open) { - ItemAdd(ImRect(), id, NULL, ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus); + ItemAdd(ImRect(), id, NULL, ImGuiItemFlags_NoNav); return false; } @@ -8120,7 +8347,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, tab_bar->LastTabItemIdx = (ImS16)tab_bar->Tabs.index_from_ptr(tab); // Calculate tab contents size - ImVec2 size = TabItemCalcSize(label, p_open != NULL); + ImVec2 size = TabItemCalcSize(label, (p_open != NULL) || (flags & ImGuiTabItemFlags_UnsavedDocument)); tab->RequestedWidth = -1.0f; if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasWidth) size.x = tab->RequestedWidth = g.NextItemData.Width; @@ -8132,22 +8359,30 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount); const bool tab_bar_focused = (tab_bar->Flags & ImGuiTabBarFlags_IsFocused) != 0; const bool tab_appearing = (tab->LastFrameVisible + 1 < g.FrameCount); + const bool tab_just_unsaved = (flags & ImGuiTabItemFlags_UnsavedDocument) && !(tab->Flags & ImGuiTabItemFlags_UnsavedDocument); const bool is_tab_button = (flags & ImGuiTabItemFlags_Button) != 0; tab->LastFrameVisible = g.FrameCount; tab->Flags = flags; - // Append name with zero-terminator - tab->NameOffset = (ImS32)tab_bar->TabsNames.size(); - tab_bar->TabsNames.append(label, label + strlen(label) + 1); + // Append name _WITH_ the zero-terminator + if (docked_window != NULL) + { + IM_ASSERT(docked_window == NULL); // master branch only + } + else + { + tab->NameOffset = (ImS32)tab_bar->TabsNames.size(); + tab_bar->TabsNames.append(label, label + strlen(label) + 1); + } // Update selected tab if (!is_tab_button) { if (tab_appearing && (tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs) && tab_bar->NextSelectedTabId == 0) if (!tab_bar_appearing || tab_bar->SelectedTabId == 0) - tab_bar->NextSelectedTabId = id; // New tabs gets activated + TabBarQueueFocus(tab_bar, tab); // New tabs gets activated if ((flags & ImGuiTabItemFlags_SetSelected) && (tab_bar->SelectedTabId != id)) // _SetSelected can only be passed on explicit tab bar - tab_bar->NextSelectedTabId = id; + TabBarQueueFocus(tab_bar, tab); } // Lock visibility @@ -8165,7 +8400,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, // and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'. if (tab_appearing && (!tab_bar_appearing || tab_is_new)) { - ItemAdd(ImRect(), id, NULL, ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus); + ItemAdd(ImRect(), id, NULL, ImGuiItemFlags_NoNav); if (is_tab_button) return false; return tab_contents_visible; @@ -8205,17 +8440,14 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, } // Click to Select a tab - ImGuiButtonFlags button_flags = ((is_tab_button ? ImGuiButtonFlags_PressedOnClickRelease : ImGuiButtonFlags_PressedOnClick) | ImGuiButtonFlags_AllowItemOverlap); + // Allow the close button to overlap + ImGuiButtonFlags button_flags = ((is_tab_button ? ImGuiButtonFlags_PressedOnClickRelease : ImGuiButtonFlags_PressedOnClick) | ImGuiButtonFlags_AllowOverlap); if (g.DragDropActive) button_flags |= ImGuiButtonFlags_PressedOnDragDropHold; bool hovered, held; bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags); if (pressed && !is_tab_button) - tab_bar->NextSelectedTabId = id; - - // Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered) - if (g.ActiveId != id) - SetItemAllowOverlap(); + TabBarQueueFocus(tab_bar, tab); // Drag and drop: re-order tabs if (held && !tab_appearing && IsMouseDragging(0)) @@ -8252,9 +8484,8 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, // Select with right mouse button. This is so the common idiom for context menu automatically highlight the current widget. const bool hovered_unblocked = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup); - if (hovered_unblocked && (IsMouseClicked(1) || IsMouseReleased(1))) - if (!is_tab_button) - tab_bar->NextSelectedTabId = id; + if (hovered_unblocked && (IsMouseClicked(1) || IsMouseReleased(1)) && !is_tab_button) + TabBarQueueFocus(tab_bar, tab); if (tab_bar->Flags & ImGuiTabBarFlags_NoCloseWithMiddleMouseButton) flags |= ImGuiTabItemFlags_NoCloseWithMiddleMouseButton; @@ -8263,7 +8494,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, const ImGuiID close_button_id = p_open ? GetIDWithSeed("#CLOSE", NULL, id) : 0; bool just_closed; bool text_clipped; - TabItemLabelAndCloseButton(display_draw_list, bb, flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible, &just_closed, &text_clipped); + TabItemLabelAndCloseButton(display_draw_list, bb, tab_just_unsaved ? (flags & ~ImGuiTabItemFlags_UnsavedDocument) : flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible, &just_closed, &text_clipped); if (just_closed && p_open != NULL) { *p_open = false; @@ -8282,8 +8513,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, // FIXME: We may want disabled tab to still display the tooltip? if (text_clipped && g.HoveredId == id && !held) if (!(tab_bar->Flags & ImGuiTabBarFlags_NoTooltip) && !(tab->Flags & ImGuiTabItemFlags_NoTooltip)) - if (IsItemHovered(ImGuiHoveredFlags_DelayNormal)) - SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label); + SetItemTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label); IM_ASSERT(!is_tab_button || !(tab_bar->SelectedTabId == tab->ID && is_tab_button)); // TabItemButton should not be selected if (is_tab_button) @@ -8301,24 +8531,30 @@ void ImGui::SetTabItemClosed(const char* label) if (is_within_manual_tab_bar) { ImGuiTabBar* tab_bar = g.CurrentTabBar; - ImGuiID tab_id = TabBarCalcTabID(tab_bar, label); + ImGuiID tab_id = TabBarCalcTabID(tab_bar, label, NULL); if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id)) tab->WantClose = true; // Will be processed by next call to TabBarLayout() } } -ImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button) +ImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker) { ImGuiContext& g = *GImGui; ImVec2 label_size = CalcTextSize(label, NULL, true); ImVec2 size = ImVec2(label_size.x + g.Style.FramePadding.x, label_size.y + g.Style.FramePadding.y * 2.0f); - if (has_close_button) + if (has_close_button_or_unsaved_marker) size.x += g.Style.FramePadding.x + (g.Style.ItemInnerSpacing.x + g.FontSize); // We use Y intentionally to fit the close button circle. else size.x += g.Style.FramePadding.x + 1.0f; return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y); } +ImVec2 ImGui::TabItemCalcSize(ImGuiWindow*) +{ + IM_ASSERT(0); // This function exists to facilitate merge with 'docking' branch. + return ImVec2(0.0f, 0.0f); +} + void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col) { // While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it. @@ -8379,7 +8615,7 @@ void ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, } const float button_sz = g.FontSize; - const ImVec2 button_pos(ImMax(bb.Min.x, bb.Max.x - frame_padding.x * 2.0f - button_sz), bb.Min.y); + const ImVec2 button_pos(ImMax(bb.Min.x, bb.Max.x - frame_padding.x - button_sz), bb.Min.y + frame_padding.y); // Close Button & Unsaved Marker // We are relying on a subtle and confusing distinction between 'hovered' and 'g.HoveredId' which happens because we are using ImGuiButtonFlags_AllowOverlapMode + SetItemAllowOverlap() @@ -8397,10 +8633,8 @@ void ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, if (close_button_visible) { ImGuiLastItemData last_item_backup = g.LastItemData; - PushStyleVar(ImGuiStyleVar_FramePadding, frame_padding); if (CloseButton(close_button_id, button_pos)) close_button_pressed = true; - PopStyleVar(); g.LastItemData = last_item_backup; // Close with middle mouse button diff --git a/bgfx/3rdparty/dear-imgui/widgets/memory_editor.inl b/bgfx/3rdparty/dear-imgui/widgets/memory_editor.inl index 907e0313..4ca722f4 100644 --- a/bgfx/3rdparty/dear-imgui/widgets/memory_editor.inl +++ b/bgfx/3rdparty/dear-imgui/widgets/memory_editor.inl @@ -1,3 +1,5 @@ +#include + #ifdef _MSC_VER # define snprintf _snprintf #endif @@ -142,7 +144,7 @@ namespace ImGui if (HexII) { unsigned char byte = mem_data[addr]; - if (isprint(byte) ) + if (bx::isPrint(byte) ) { Text(".%c ", byte); } @@ -205,7 +207,7 @@ namespace ImGui AlignTextToFramePadding(); PushItemWidth(50); - PushAllowKeyboardFocus(false); + PushTabStop(false); int rows_backup = Rows; if (DragInt("##rows", &Rows, 0.2f, 4, 32, "%.0f rows")) { @@ -214,7 +216,7 @@ namespace ImGui SetWindowSize(new_window_size); } - PopAllowKeyboardFocus(); + PopTabStop(); PopItemWidth(); SameLine(); Text("Range %0*x..%0*x", addr_digits_count, (int)base_display_addr, addr_digits_count, (int)base_display_addr+mem_size-1); diff --git a/bgfx/3rdparty/dear-imgui/widgets/range_slider.inl b/bgfx/3rdparty/dear-imgui/widgets/range_slider.inl index 419ec763..6d6180b3 100644 --- a/bgfx/3rdparty/dear-imgui/widgets/range_slider.inl +++ b/bgfx/3rdparty/dear-imgui/widgets/range_slider.inl @@ -173,7 +173,7 @@ bool RangeSliderFloat(const char* label, float* v1, float* v2, float v_min, floa return false; } - const bool hovered = ItemHoverable(frame_bb, id); + const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags); if (hovered) SetHoveredID(id); diff --git a/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_glsl_visitor.cpp b/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_glsl_visitor.cpp index 0b70d4c4..22d8af42 100644 --- a/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_glsl_visitor.cpp +++ b/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_glsl_visitor.cpp @@ -449,7 +449,9 @@ void ir_print_glsl_visitor::visit(ir_variable *ir) const char *const interp[] = { "", "smooth ", "flat ", "noperspective " }; - if (this->state->language_version >= 300 && ir->data.explicit_location) + bool built_in = (strstr(ir->name, "gl_") == ir->name); + + if (this->state->language_version >= 300 && ir->data.explicit_location && !built_in) { const int binding_base = (this->state->stage == MESA_SHADER_VERTEX ? (int)VERT_ATTRIB_GENERIC0 : (int)FRAG_RESULT_DATA0); const int location = ir->data.location - binding_base; @@ -488,7 +490,7 @@ void ir_print_glsl_visitor::visit(ir_variable *ir) } // keep invariant declaration for builtin variables - if (strstr(ir->name, "gl_") == ir->name) { + if (built_in) { buffer.asprintf_append ("%s", inv); print_var_name (ir); return; diff --git a/bgfx/3rdparty/glslang/OGLCompilersDLL/InitializeDll.cpp b/bgfx/3rdparty/glslang/OGLCompilersDLL/InitializeDll.cpp index abea9108..ab3762e0 100644 --- a/bgfx/3rdparty/glslang/OGLCompilersDLL/InitializeDll.cpp +++ b/bgfx/3rdparty/glslang/OGLCompilersDLL/InitializeDll.cpp @@ -32,134 +32,6 @@ // POSSIBILITY OF SUCH DAMAGE. // -#define SH_EXPORTING - -#include - -#include "InitializeDll.h" -#include "../glslang/Include/InitializeGlobals.h" -#include "../glslang/Public/ShaderLang.h" -#include "../glslang/Include/PoolAlloc.h" - namespace glslang { -OS_TLSIndex ThreadInitializeIndex = OS_INVALID_TLS_INDEX; - -// Per-process initialization. -// Needs to be called at least once before parsing, etc. is done. -// Will also do thread initialization for the calling thread; other -// threads will need to do that explicitly. -bool InitProcess() -{ - glslang::GetGlobalLock(); - - if (ThreadInitializeIndex != OS_INVALID_TLS_INDEX) { - // - // Function is re-entrant. - // - - glslang::ReleaseGlobalLock(); - return true; - } - - ThreadInitializeIndex = OS_AllocTLSIndex(); - - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "InitProcess(): Failed to allocate TLS area for init flag"); - - glslang::ReleaseGlobalLock(); - return false; - } - - if (! InitializePoolIndex()) { - assert(0 && "InitProcess(): Failed to initialize global pool"); - - glslang::ReleaseGlobalLock(); - return false; - } - - if (! InitThread()) { - assert(0 && "InitProcess(): Failed to initialize thread"); - - glslang::ReleaseGlobalLock(); - return false; - } - - glslang::ReleaseGlobalLock(); - return true; -} - -// Per-thread scoped initialization. -// Must be called at least once by each new thread sharing the -// symbol tables, etc., needed to parse. -bool InitThread() -{ - // - // This function is re-entrant - // - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "InitThread(): Process hasn't been initalised."); - return false; - } - - if (OS_GetTLSValue(ThreadInitializeIndex) != 0) - return true; - - if (! OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) { - assert(0 && "InitThread(): Unable to set init flag."); - return false; - } - - glslang::SetThreadPoolAllocator(nullptr); - - return true; -} - -// Not necessary to call this: InitThread() is reentrant, and the need -// to do per thread tear down has been removed. -// -// This is kept, with memory management removed, to satisfy any exiting -// calls to it that rely on it. -bool DetachThread() -{ - bool success = true; - - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) - return true; - - // - // Function is re-entrant and this thread may not have been initialized. - // - if (OS_GetTLSValue(ThreadInitializeIndex) != 0) { - if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)0)) { - assert(0 && "DetachThread(): Unable to clear init flag."); - success = false; - } - } - - return success; -} - -// Not necessary to call this: InitProcess() is reentrant. -// -// This is kept, with memory management removed, to satisfy any exiting -// calls to it that rely on it. -// -// Users of glslang should call shFinalize() or glslang::FinalizeProcess() for -// process-scoped memory tear down. -bool DetachProcess() -{ - bool success = true; - - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) - return true; - - success = DetachThread(); - - OS_FreeTLSIndex(ThreadInitializeIndex); - ThreadInitializeIndex = OS_INVALID_TLS_INDEX; - - return success; -} - } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/OGLCompilersDLL/InitializeDll.h b/bgfx/3rdparty/glslang/OGLCompilersDLL/InitializeDll.h index 661cee4d..b18e2ab3 100644 --- a/bgfx/3rdparty/glslang/OGLCompilersDLL/InitializeDll.h +++ b/bgfx/3rdparty/glslang/OGLCompilersDLL/InitializeDll.h @@ -38,10 +38,10 @@ namespace glslang { -bool InitProcess(); -bool InitThread(); -bool DetachThread(); // not called from standalone, perhaps other tools rely on parts of it -bool DetachProcess(); // not called from standalone, perhaps other tools rely on parts of it +inline bool InitProcess() { return true; } // DEPRECATED +inline bool InitThread() { return true; } // DEPRECATED +inline bool DetachThread() { return true; } // DEPRECATED +inline bool DetachProcess() { return true; } // DEPRECATED } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.ARM.h b/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.ARM.h new file mode 100644 index 00000000..14425be1 --- /dev/null +++ b/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.ARM.h @@ -0,0 +1,35 @@ +/* +** Copyright (c) 2022 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"), +** 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 GLSLextARM_H +#define GLSLextARM_H + +static const int GLSLextARMVersion = 100; +static const int GLSLextARMRevision = 1; + +static const char * const E_SPV_ARM_core_builtins = "SPV_ARM_core_builtins"; + +#endif // #ifndef GLSLextARM_H diff --git a/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h b/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h index a247b4cd..caab2793 100644 --- a/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h +++ b/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h @@ -39,6 +39,7 @@ static const char* const E_SPV_EXT_shader_atomic_float_add = "SPV_EXT_shader_ato static const char* const E_SPV_EXT_shader_atomic_float16_add = "SPV_EXT_shader_atomic_float16_add"; static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader_atomic_float_min_max"; 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"; #endif // #ifndef GLSLextEXT_H diff --git a/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h b/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h index d5c670f0..121defa1 100644 --- a/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h +++ b/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h @@ -54,5 +54,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_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"; #endif // #ifndef GLSLextKHR_H diff --git a/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.NV.h b/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.NV.h index 93c98bf6..5b0f7eb1 100644 --- a/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.NV.h +++ b/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.NV.h @@ -81,4 +81,7 @@ const char* const E_SPV_NV_cooperative_matrix = "SPV_NV_cooperative_matrix"; //SPV_NV_shader_sm_builtins const char* const E_SPV_NV_shader_sm_builtins = "SPV_NV_shader_sm_builtins"; +//SPV_NV_shader_execution_reorder +const char* const E_SPV_NV_shader_invocation_reorder = "SPV_NV_shader_invocation_reorder"; + #endif // #ifndef GLSLextNV_H diff --git a/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.QCOM.h b/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.QCOM.h new file mode 100644 index 00000000..f13bb693 --- /dev/null +++ b/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.QCOM.h @@ -0,0 +1,41 @@ +/* +** Copyright (c) 2021 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 GLSLextQCOM_H +#define GLSLextQCOM_H + +enum BuiltIn; +enum Decoration; +enum Op; +enum Capability; + +static const int GLSLextQCOMVersion = 100; +static const int GLSLextQCOMRevision = 1; + +//SPV_QCOM_image_processing +const char* const E_SPV_QCOM_image_processing = "SPV_QCOM_image_processing"; + +#endif // #ifndef GLSLextQCOM_H diff --git a/bgfx/3rdparty/glslang/SPIRV/GLSL.std.450.h b/bgfx/3rdparty/glslang/SPIRV/GLSL.std.450.h index df31092b..86d3da80 100644 --- a/bgfx/3rdparty/glslang/SPIRV/GLSL.std.450.h +++ b/bgfx/3rdparty/glslang/SPIRV/GLSL.std.450.h @@ -13,7 +13,7 @@ ** ** 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/ +** 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, diff --git a/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.cpp b/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.cpp old mode 100644 new mode 100755 index 601c872e..373e95f0 --- a/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.cpp +++ b/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.cpp @@ -49,6 +49,8 @@ namespace spv { #include "GLSL.ext.EXT.h" #include "GLSL.ext.AMD.h" #include "GLSL.ext.NV.h" + #include "GLSL.ext.ARM.h" + #include "GLSL.ext.QCOM.h" #include "NonSemanticDebugPrintf.h" } @@ -94,26 +96,18 @@ struct OpDecorations { public: OpDecorations(spv::Decoration precision, spv::Decoration noContraction, spv::Decoration nonUniform) : precision(precision) -#ifndef GLSLANG_WEB , noContraction(noContraction), nonUniform(nonUniform) -#endif { } spv::Decoration precision; -#ifdef GLSLANG_WEB - void addNoContraction(spv::Builder&, spv::Id) const { } - void addNonUniform(spv::Builder&, spv::Id) const { } -#else void addNoContraction(spv::Builder& builder, spv::Id t) { builder.addDecoration(t, noContraction); } void addNonUniform(spv::Builder& builder, spv::Id t) { builder.addDecoration(t, nonUniform); } protected: spv::Decoration noContraction; spv::Decoration nonUniform; -#endif - }; } // namespace @@ -174,8 +168,8 @@ class TGlslangToSpvTraverser : public glslang::TIntermTraverser { spv::Id convertGlslangStructToSpvType(const glslang::TType&, const glslang::TTypeList* glslangStruct, glslang::TLayoutPacking, const glslang::TQualifier&); void decorateStructType(const glslang::TType&, const glslang::TTypeList* glslangStruct, glslang::TLayoutPacking, - const glslang::TQualifier&, spv::Id); - spv::Id makeArraySizeId(const glslang::TArraySizes&, int dim); + const glslang::TQualifier&, spv::Id, const std::vector& spvMembers); + spv::Id makeArraySizeId(const glslang::TArraySizes&, int dim, bool allowZero = false); spv::Id accessChainLoad(const glslang::TType& type); void accessChainStore(const glslang::TType& type, spv::Id rvalue); void multiTypeStore(const glslang::TType&, spv::Id rValue); @@ -211,7 +205,7 @@ class TGlslangToSpvTraverser : public glslang::TIntermTraverser { glslang::TBasicType typeProxy); spv::Id createConversion(glslang::TOperator op, OpDecorations&, spv::Id destTypeId, spv::Id operand, glslang::TBasicType typeProxy); - spv::Id createIntWidthConversion(glslang::TOperator op, spv::Id operand, int vectorSize); + spv::Id createIntWidthConversion(glslang::TOperator op, spv::Id operand, int vectorSize, spv::Id destType); spv::Id makeSmearedConstant(spv::Id constant, int vectorSize); spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy, @@ -227,6 +221,7 @@ class TGlslangToSpvTraverser : public glslang::TIntermTraverser { spv::Id createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId); spv::Id getSymbolId(const glslang::TIntermSymbol* node); void addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier & qualifier); + void addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor); spv::Id createSpvConstant(const glslang::TIntermTyped&); spv::Id createSpvConstantFromConstUnionArray(const glslang::TType& type, const glslang::TConstUnionArray&, int& nextConst, bool specConstant); @@ -277,12 +272,10 @@ class TGlslangToSpvTraverser : public glslang::TIntermTraverser { // requiring local translation to and from SPIR-V type on every access. // Maps AST-required-type-id> std::unordered_map forceType; - - // Used later for generating OpTraceKHR/OpExecuteCallableKHR - std::unordered_map locationToSymbol[2]; - // Used by Task shader while generating opearnds for OpEmitMeshTasksEXT spv::Id taskPayloadID; + // Used later for generating OpTraceKHR/OpExecuteCallableKHR/OpHitObjectRecordHit*/OpHitObjectGetShaderBindingTableData + std::unordered_map locationToSymbol[4]; }; // @@ -292,12 +285,6 @@ class TGlslangToSpvTraverser : public glslang::TIntermTraverser { // Translate glslang profile to SPIR-V source language. spv::SourceLanguage TranslateSourceLanguage(glslang::EShSource source, EProfile profile) { -#ifdef GLSLANG_WEB - return spv::SourceLanguageESSL; -#elif defined(GLSLANG_ANGLE) - return spv::SourceLanguageGLSL; -#endif - switch (source) { case glslang::EShSourceGlsl: switch (profile) { @@ -324,7 +311,6 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage, bool isMeshShader case EShLangVertex: return spv::ExecutionModelVertex; case EShLangFragment: return spv::ExecutionModelFragment; case EShLangCompute: return spv::ExecutionModelGLCompute; -#ifndef GLSLANG_WEB case EShLangTessControl: return spv::ExecutionModelTessellationControl; case EShLangTessEvaluation: return spv::ExecutionModelTessellationEvaluation; case EShLangGeometry: return spv::ExecutionModelGeometry; @@ -336,7 +322,6 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage, bool isMeshShader case EShLangCallable: return spv::ExecutionModelCallableKHR; case EShLangTask: return (isMeshShaderEXT)? spv::ExecutionModelTaskEXT : spv::ExecutionModelTaskNV; case EShLangMesh: return (isMeshShaderEXT)? spv::ExecutionModelMeshEXT: spv::ExecutionModelMeshNV; -#endif default: assert(0); return spv::ExecutionModelFragment; @@ -354,6 +339,7 @@ spv::Dim TranslateDimensionality(const glslang::TSampler& sampler) case glslang::EsdRect: return spv::DimRect; case glslang::EsdBuffer: return spv::DimBuffer; case glslang::EsdSubpass: return spv::DimSubpassData; + case glslang::EsdAttachmentEXT: return spv::DimTileImageDataEXT; default: assert(0); return spv::Dim2D; @@ -378,26 +364,23 @@ spv::Decoration TranslatePrecisionDecoration(const glslang::TType& type) } // Translate glslang type to SPIR-V block decorations. -spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useStorageBuffer) +spv::Decoration TranslateBlockDecoration(const glslang::TStorageQualifier storage, bool useStorageBuffer) { - if (type.getBasicType() == glslang::EbtBlock) { - switch (type.getQualifier().storage) { - case glslang::EvqUniform: return spv::DecorationBlock; - case glslang::EvqBuffer: return useStorageBuffer ? spv::DecorationBlock : spv::DecorationBufferBlock; - case glslang::EvqVaryingIn: return spv::DecorationBlock; - case glslang::EvqVaryingOut: return spv::DecorationBlock; - case glslang::EvqShared: return spv::DecorationBlock; -#ifndef GLSLANG_WEB - case glslang::EvqPayload: return spv::DecorationBlock; - case glslang::EvqPayloadIn: return spv::DecorationBlock; - case glslang::EvqHitAttr: return spv::DecorationBlock; - case glslang::EvqCallableData: return spv::DecorationBlock; - case glslang::EvqCallableDataIn: return spv::DecorationBlock; -#endif - default: - assert(0); - break; - } + switch (storage) { + case glslang::EvqUniform: return spv::DecorationBlock; + case glslang::EvqBuffer: return useStorageBuffer ? spv::DecorationBlock : spv::DecorationBufferBlock; + case glslang::EvqVaryingIn: return spv::DecorationBlock; + case glslang::EvqVaryingOut: return spv::DecorationBlock; + case glslang::EvqShared: return spv::DecorationBlock; + case glslang::EvqPayload: return spv::DecorationBlock; + case glslang::EvqPayloadIn: return spv::DecorationBlock; + case glslang::EvqHitAttr: return spv::DecorationBlock; + case glslang::EvqCallableData: return spv::DecorationBlock; + case glslang::EvqCallableDataIn: return spv::DecorationBlock; + case glslang::EvqHitObjectAttrNV: return spv::DecorationBlock; + default: + assert(0); + break; } return spv::DecorationMax; @@ -464,14 +447,13 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T assert(type.getQualifier().layoutPacking == glslang::ElpNone); } return spv::DecorationMax; -#ifndef GLSLANG_WEB case glslang::EvqPayload: case glslang::EvqPayloadIn: case glslang::EvqHitAttr: case glslang::EvqCallableData: case glslang::EvqCallableDataIn: + case glslang::EvqHitObjectAttrNV: return spv::DecorationMax; -#endif default: assert(0); return spv::DecorationMax; @@ -507,14 +489,12 @@ spv::Decoration TGlslangToSpvTraverser::TranslateAuxiliaryStorageDecoration(cons { if (qualifier.centroid) return spv::DecorationCentroid; -#ifndef GLSLANG_WEB else if (qualifier.patch) return spv::DecorationPatch; else if (qualifier.sample) { builder.addCapability(spv::CapabilitySampleRateShading); return spv::DecorationSample; } -#endif return spv::DecorationMax; } @@ -531,24 +511,20 @@ spv::Decoration TranslateInvariantDecoration(const glslang::TQualifier& qualifie // If glslang type is noContraction, return SPIR-V NoContraction decoration. spv::Decoration TranslateNoContractionDecoration(const glslang::TQualifier& qualifier) { -#ifndef GLSLANG_WEB if (qualifier.isNoContraction()) return spv::DecorationNoContraction; else -#endif return spv::DecorationMax; } // If glslang type is nonUniform, return SPIR-V NonUniform decoration. spv::Decoration TGlslangToSpvTraverser::TranslateNonUniformDecoration(const glslang::TQualifier& qualifier) { -#ifndef GLSLANG_WEB if (qualifier.isNonUniform()) { builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5); builder.addCapability(spv::CapabilityShaderNonUniformEXT); return spv::DecorationNonUniformEXT; } else -#endif return spv::DecorationMax; } @@ -556,13 +532,11 @@ spv::Decoration TGlslangToSpvTraverser::TranslateNonUniformDecoration(const glsl spv::Decoration TGlslangToSpvTraverser::TranslateNonUniformDecoration( const spv::Builder::AccessChain::CoherentFlags& coherentFlags) { -#ifndef GLSLANG_WEB if (coherentFlags.isNonUniform()) { builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5); builder.addCapability(spv::CapabilityShaderNonUniformEXT); return spv::DecorationNonUniformEXT; } else -#endif return spv::DecorationMax; } @@ -571,7 +545,6 @@ spv::MemoryAccessMask TGlslangToSpvTraverser::TranslateMemoryAccess( { spv::MemoryAccessMask mask = spv::MemoryAccessMaskNone; -#ifndef GLSLANG_WEB if (!glslangIntermediate->usingVulkanMemoryModel() || coherentFlags.isImage) return mask; @@ -589,7 +562,6 @@ spv::MemoryAccessMask TGlslangToSpvTraverser::TranslateMemoryAccess( if (mask != spv::MemoryAccessMaskNone) { builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); } -#endif return mask; } @@ -599,7 +571,6 @@ spv::ImageOperandsMask TGlslangToSpvTraverser::TranslateImageOperands( { spv::ImageOperandsMask mask = spv::ImageOperandsMaskNone; -#ifndef GLSLANG_WEB if (!glslangIntermediate->usingVulkanMemoryModel()) return mask; @@ -617,7 +588,6 @@ spv::ImageOperandsMask TGlslangToSpvTraverser::TranslateImageOperands( if (mask != spv::ImageOperandsMaskNone) { builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); } -#endif return mask; } @@ -625,7 +595,6 @@ spv::ImageOperandsMask TGlslangToSpvTraverser::TranslateImageOperands( spv::Builder::AccessChain::CoherentFlags TGlslangToSpvTraverser::TranslateCoherent(const glslang::TType& type) { spv::Builder::AccessChain::CoherentFlags flags = {}; -#ifndef GLSLANG_WEB flags.coherent = type.getQualifier().coherent; flags.devicecoherent = type.getQualifier().devicecoherent; flags.queuefamilycoherent = type.getQualifier().queuefamilycoherent; @@ -640,7 +609,6 @@ spv::Builder::AccessChain::CoherentFlags TGlslangToSpvTraverser::TranslateCohere flags.anyCoherent() || flags.volatil; flags.isImage = type.getBasicType() == glslang::EbtSampler; -#endif flags.nonUniform = type.getQualifier().nonUniform; return flags; } @@ -650,7 +618,6 @@ spv::Scope TGlslangToSpvTraverser::TranslateMemoryScope( { spv::Scope scope = spv::ScopeMax; -#ifndef GLSLANG_WEB if (coherentFlags.volatil || coherentFlags.coherent) { // coherent defaults to Device scope in the old model, QueueFamilyKHR scope in the new model scope = glslangIntermediate->usingVulkanMemoryModel() ? spv::ScopeQueueFamilyKHR : spv::ScopeDevice; @@ -668,7 +635,6 @@ spv::Scope TGlslangToSpvTraverser::TranslateMemoryScope( if (glslangIntermediate->usingVulkanMemoryModel() && scope == spv::ScopeDevice) { builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR); } -#endif return scope; } @@ -683,7 +649,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI { switch (builtIn) { case glslang::EbvPointSize: -#ifndef GLSLANG_WEB // Defer adding the capability until the built-in is actually used. if (! memberDeclaration) { switch (glslangIntermediate->getStage()) { @@ -698,7 +663,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI break; } } -#endif return spv::BuiltInPointSize; case glslang::EbvPosition: return spv::BuiltInPosition; @@ -719,7 +683,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI case glslang::EbvLocalInvocationIndex: return spv::BuiltInLocalInvocationIndex; case glslang::EbvGlobalInvocationId: return spv::BuiltInGlobalInvocationId; -#ifndef GLSLANG_WEB // These *Distance capabilities logically belong here, but if the member is declared and // then never used, consumers of SPIR-V prefer the capability not be declared. // They are now generated when used, rather than here when declared. @@ -1013,6 +976,8 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI return spv::BuiltInRayTmaxKHR; case glslang::EbvCullMask: return spv::BuiltInCullMaskKHR; + case glslang::EbvPositionFetch: + return spv::BuiltInHitTriangleVertexPositionsKHR; case glslang::EbvInstanceCustomIndex: return spv::BuiltInInstanceCustomIndexKHR; case glslang::EbvHitT: @@ -1108,7 +1073,28 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addExtension(spv::E_SPV_NV_shader_sm_builtins); builder.addCapability(spv::CapabilityShaderSMBuiltinsNV); return spv::BuiltInSMIDNV; -#endif + + // ARM builtins + case glslang::EbvCoreCountARM: + builder.addExtension(spv::E_SPV_ARM_core_builtins); + builder.addCapability(spv::CapabilityCoreBuiltinsARM); + return spv::BuiltInCoreCountARM; + case glslang::EbvCoreIDARM: + builder.addExtension(spv::E_SPV_ARM_core_builtins); + builder.addCapability(spv::CapabilityCoreBuiltinsARM); + return spv::BuiltInCoreIDARM; + case glslang::EbvCoreMaxIDARM: + builder.addExtension(spv::E_SPV_ARM_core_builtins); + builder.addCapability(spv::CapabilityCoreBuiltinsARM); + return spv::BuiltInCoreMaxIDARM; + case glslang::EbvWarpIDARM: + builder.addExtension(spv::E_SPV_ARM_core_builtins); + builder.addCapability(spv::CapabilityCoreBuiltinsARM); + return spv::BuiltInWarpIDARM; + case glslang::EbvWarpMaxIDARM: + builder.addExtension(spv::E_SPV_ARM_core_builtins); + builder.addCapability(spv::CapabilityCoreBuiltinsARM); + return spv::BuiltInWarpMaxIDARM; default: return spv::BuiltInMax; @@ -1120,10 +1106,6 @@ spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TTy { assert(type.getBasicType() == glslang::EbtSampler); -#ifdef GLSLANG_WEB - return spv::ImageFormatUnknown; -#endif - // Check for capabilities switch (type.getQualifier().getFormat()) { case glslang::ElfRg32f: @@ -1278,24 +1260,27 @@ spv::LoopControlMask TGlslangToSpvTraverser::TranslateLoopControl(const glslang: // Translate glslang type to SPIR-V storage class. spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::TType& type) { - if (type.getBasicType() == glslang::EbtRayQuery) + if (type.getBasicType() == glslang::EbtRayQuery || type.getBasicType() == glslang::EbtHitObjectNV) return spv::StorageClassPrivate; -#ifndef GLSLANG_WEB if (type.getQualifier().isSpirvByReference()) { if (type.getQualifier().isParamInput() || type.getQualifier().isParamOutput()) return spv::StorageClassFunction; } -#endif if (type.getQualifier().isPipeInput()) return spv::StorageClassInput; if (type.getQualifier().isPipeOutput()) return spv::StorageClassOutput; + if (type.getQualifier().storage == glslang::EvqTileImageEXT || type.isAttachmentEXT()) { + builder.addExtension(spv::E_SPV_EXT_shader_tile_image); + builder.addCapability(spv::CapabilityTileImageColorReadAccessEXT); + return spv::StorageClassTileImageEXT; + } if (glslangIntermediate->getSource() != glslang::EShSourceHlsl || type.getQualifier().storage == glslang::EvqUniform) { if (type.isAtomic()) return spv::StorageClassAtomicCounter; - if (type.containsOpaque()) + if (type.containsOpaque() && !glslangIntermediate->getBindlessMode()) return spv::StorageClassUniformConstant; } @@ -1328,15 +1313,14 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T case glslang::EvqConstReadOnly: return spv::StorageClassFunction; case glslang::EvqTemporary: return spv::StorageClassFunction; case glslang::EvqShared: return spv::StorageClassWorkgroup; -#ifndef GLSLANG_WEB case glslang::EvqPayload: return spv::StorageClassRayPayloadKHR; case glslang::EvqPayloadIn: return spv::StorageClassIncomingRayPayloadKHR; case glslang::EvqHitAttr: return spv::StorageClassHitAttributeKHR; case glslang::EvqCallableData: return spv::StorageClassCallableDataKHR; case glslang::EvqCallableDataIn: return spv::StorageClassIncomingCallableDataKHR; case glslang::EvqtaskPayloadSharedEXT : return spv::StorageClassTaskPayloadWorkgroupEXT; + case glslang::EvqHitObjectAttrNV: return spv::StorageClassHitObjectAttributeNV; case glslang::EvqSpirvStorageClass: return static_cast(type.getQualifier().spirvStorageClass); -#endif default: assert(0); break; @@ -1397,7 +1381,6 @@ void TGlslangToSpvTraverser::TranslateLiterals(const glslang::TVectorgetSource(), glslangIntermediate->getProfile()), glslangIntermediate->getVersion()); - if (options.generateDebugInfo) { + if (options.emitNonSemanticShaderDebugSource) + this->options.emitNonSemanticShaderDebugInfo = true; + if (options.emitNonSemanticShaderDebugInfo) + this->options.generateDebugInfo = true; + + if (this->options.generateDebugInfo) { builder.setEmitOpLines(); builder.setSourceFile(glslangIntermediate->getSourceFile()); @@ -1579,8 +1564,8 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, builder.addInclude(iItr->first, iItr->second); } - builder.setEmitNonSemanticShaderDebugInfo(options.emitNonSemanticShaderDebugInfo); - builder.setEmitNonSemanticShaderDebugSource(options.emitNonSemanticShaderDebugSource); + builder.setEmitNonSemanticShaderDebugInfo(this->options.emitNonSemanticShaderDebugInfo); + builder.setEmitNonSemanticShaderDebugSource(this->options.emitNonSemanticShaderDebugSource); stdBuiltins = builder.import("GLSL.std.450"); @@ -1622,12 +1607,10 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, builder.addCapability(spv::CapabilityRayTraversalPrimitiveCullingKHR); } -#ifndef GLSLANG_WEB if (glslangIntermediate->getSubgroupUniformControlFlow()) { builder.addExtension(spv::E_SPV_KHR_subgroup_uniform_control_flow); builder.addExecutionMode(shaderEntry, spv::ExecutionModeSubgroupUniformControlFlowKHR); } -#endif unsigned int mode; switch (glslangIntermediate->getStage()) { @@ -1660,14 +1643,30 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, builder.addExtension(spv::E_SPV_KHR_post_depth_coverage); } + if (glslangIntermediate->getNonCoherentColorAttachmentReadEXT()) { + builder.addCapability(spv::CapabilityTileImageColorReadAccessEXT); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeNonCoherentColorAttachmentReadEXT); + builder.addExtension(spv::E_SPV_EXT_shader_tile_image); + } + + if (glslangIntermediate->getNonCoherentDepthAttachmentReadEXT()) { + builder.addCapability(spv::CapabilityTileImageDepthReadAccessEXT); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeNonCoherentDepthAttachmentReadEXT); + builder.addExtension(spv::E_SPV_EXT_shader_tile_image); + } + + if (glslangIntermediate->getNonCoherentStencilAttachmentReadEXT()) { + builder.addCapability(spv::CapabilityTileImageStencilReadAccessEXT); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeNonCoherentStencilAttachmentReadEXT); + builder.addExtension(spv::E_SPV_EXT_shader_tile_image); + } + if (glslangIntermediate->isDepthReplacing()) builder.addExecutionMode(shaderEntry, spv::ExecutionModeDepthReplacing); if (glslangIntermediate->isStencilReplacing()) builder.addExecutionMode(shaderEntry, spv::ExecutionModeStencilRefReplacingEXT); -#ifndef GLSLANG_WEB - switch(glslangIntermediate->getDepth()) { case glslang::EldGreater: mode = spv::ExecutionModeDepthGreater; break; case glslang::EldLess: mode = spv::ExecutionModeDepthLess; break; @@ -1719,7 +1718,6 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, } builder.addExtension(spv::E_SPV_EXT_fragment_shader_interlock); } -#endif break; case EShLangCompute: @@ -1750,7 +1748,6 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives); } break; -#ifndef GLSLANG_WEB case EShLangTessEvaluation: case EShLangTessControl: builder.addCapability(spv::CapabilityTessellation); @@ -1837,13 +1834,16 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, builder.addCapability(spv::CapabilityRayTracingNV); builder.addExtension("SPV_NV_ray_tracing"); } - if (glslangIntermediate->getStage() != EShLangRayGen && glslangIntermediate->getStage() != EShLangCallable) - { - if (extensions.find("GL_EXT_ray_cull_mask") != extensions.end()) { - builder.addCapability(spv::CapabilityRayCullMaskKHR); - builder.addExtension("SPV_KHR_ray_cull_mask"); - } - } + if (glslangIntermediate->getStage() != EShLangRayGen && glslangIntermediate->getStage() != EShLangCallable) { + if (extensions.find("GL_EXT_ray_cull_mask") != extensions.end()) { + builder.addCapability(spv::CapabilityRayCullMaskKHR); + builder.addExtension("SPV_KHR_ray_cull_mask"); + } + if (extensions.find("GL_EXT_ray_tracing_position_fetch") != extensions.end()) { + builder.addCapability(spv::CapabilityRayTracingPositionFetchKHR); + builder.addExtension("SPV_KHR_ray_tracing_position_fetch"); + } + } break; } case EShLangTask: @@ -1887,13 +1887,11 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, builder.addExecutionMode(shaderEntry, (spv::ExecutionMode)mode); } break; -#endif default: break; } -#ifndef GLSLANG_WEB // // Add SPIR-V requirements (GL_EXT_spirv_intrinsics) // @@ -1938,7 +1936,6 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, builder.addExecutionModeId(shaderEntry, static_cast(modeId.first), operandIds); } } -#endif } // Finish creating SPV, after the traversal is complete. @@ -1984,6 +1981,10 @@ void TGlslangToSpvTraverser::dumpSpv(std::vector& out) // void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) { + // We update the line information even though no code might be generated here + // This is helpful to yield correct lines for control flow instructions + builder.setLine(symbol->getLoc().line, symbol->getLoc().getFilename()); + SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder); if (symbol->getType().isStruct()) glslangTypeToIdMap[symbol->getType().getStruct()] = symbol->getId(); @@ -2013,7 +2014,7 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) spv::StorageClass sc = builder.getStorageClass(id); // Before SPIR-V 1.4, we only want to include Input and Output. // Starting with SPIR-V 1.4, we want all globals. - if ((glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4 && builder.isGlobalStorage(id)) || + if ((glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4 && builder.isGlobalVariable(id)) || (sc == spv::StorageClassInput || sc == spv::StorageClassOutput)) { iOSet.insert(id); } @@ -2135,6 +2136,9 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T node->getRight()->traverse(this); spv::Id rValue = accessChainLoad(node->getRight()->getType()); + // reset line number for assignment + builder.setLine(node->getLoc().line, node->getLoc().getFilename()); + if (node->getOp() != glslang::EOpAssign) { // the left is also an r-value builder.setAccessChain(lValue); @@ -2499,12 +2503,15 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI spv::Id length; if (node->getOperand()->getType().isCoopMat()) { - spec_constant_op_mode_setter.turnOnSpecConstantOpMode(); - spv::Id typeId = convertGlslangToSpvType(node->getOperand()->getType()); assert(builder.isCooperativeMatrixType(typeId)); - length = builder.createCooperativeMatrixLength(typeId); + if (node->getOperand()->getType().isCoopMatKHR()) { + length = builder.createCooperativeMatrixLengthKHR(typeId); + } else { + spec_constant_op_mode_setter.turnOnSpecConstantOpMode(); + length = builder.createCooperativeMatrixLengthNV(typeId); + } } else { glslang::TIntermTyped* block = node->getOperand()->getAsBinaryNode()->getLeft(); block->traverse(this); @@ -2561,7 +2568,35 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI spv::Builder::AccessChain::CoherentFlags lvalueCoherentFlags; -#ifndef GLSLANG_WEB + const auto hitObjectOpsWithLvalue = [](glslang::TOperator op) { + switch(op) { + case glslang::EOpReorderThreadNV: + case glslang::EOpHitObjectGetCurrentTimeNV: + case glslang::EOpHitObjectGetHitKindNV: + case glslang::EOpHitObjectGetPrimitiveIndexNV: + case glslang::EOpHitObjectGetGeometryIndexNV: + case glslang::EOpHitObjectGetInstanceIdNV: + case glslang::EOpHitObjectGetInstanceCustomIndexNV: + case glslang::EOpHitObjectGetObjectRayDirectionNV: + case glslang::EOpHitObjectGetObjectRayOriginNV: + case glslang::EOpHitObjectGetWorldRayDirectionNV: + case glslang::EOpHitObjectGetWorldRayOriginNV: + case glslang::EOpHitObjectGetWorldToObjectNV: + case glslang::EOpHitObjectGetObjectToWorldNV: + case glslang::EOpHitObjectGetRayTMaxNV: + case glslang::EOpHitObjectGetRayTMinNV: + case glslang::EOpHitObjectIsEmptyNV: + case glslang::EOpHitObjectIsHitNV: + case glslang::EOpHitObjectIsMissNV: + case glslang::EOpHitObjectRecordEmptyNV: + case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV: + case glslang::EOpHitObjectGetShaderRecordBufferHandleNV: + return true; + default: + return false; + } + }; + if (node->getOp() == glslang::EOpAtomicCounterIncrement || node->getOp() == glslang::EOpAtomicCounterDecrement || node->getOp() == glslang::EOpAtomicCounter || @@ -2575,16 +2610,15 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI node->getOp() == glslang::EOpRayQueryGetIntersectionCandidateAABBOpaque || node->getOp() == glslang::EOpRayQueryTerminate || node->getOp() == glslang::EOpRayQueryConfirmIntersection || - (node->getOp() == glslang::EOpSpirvInst && operandNode->getAsTyped()->getQualifier().isSpirvByReference())) { + (node->getOp() == glslang::EOpSpirvInst && operandNode->getAsTyped()->getQualifier().isSpirvByReference()) || + hitObjectOpsWithLvalue(node->getOp())) { operand = builder.accessChainGetLValue(); // Special case l-value operands lvalueCoherentFlags = builder.getAccessChain().coherentFlags; lvalueCoherentFlags |= TranslateCoherent(operandNode->getAsTyped()->getType()); } else if (operandNode->getAsTyped()->getQualifier().isSpirvLiteral()) { // Will be translated to a literal value, make a placeholder here operand = spv::NoResult; - } else -#endif - { + } else { operand = accessChainLoad(node->getOperand()->getType()); } @@ -2602,7 +2636,6 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI result = createUnaryOperation(node->getOp(), decorations, resultType(), operand, node->getOperand()->getBasicType(), lvalueCoherentFlags); -#ifndef GLSLANG_WEB // it could be attached to a SPIR-V intruction if (!result) { if (node->getOp() == glslang::EOpSpirvInst) { @@ -2632,7 +2665,6 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI return false; // done with this node } } -#endif if (result) { if (invertedType) { @@ -2657,7 +2689,6 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI spv::Id one = 0; if (node->getBasicType() == glslang::EbtFloat) one = builder.makeFloatConstant(1.0F); -#ifndef GLSLANG_WEB else if (node->getBasicType() == glslang::EbtDouble) one = builder.makeDoubleConstant(1.0); else if (node->getBasicType() == glslang::EbtFloat16) @@ -2668,7 +2699,6 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI one = builder.makeInt16Constant(1); else if (node->getBasicType() == glslang::EbtInt64 || node->getBasicType() == glslang::EbtUint64) one = builder.makeInt64Constant(1); -#endif else one = builder.makeIntConstant(1); glslang::TOperator op; @@ -2697,7 +2727,6 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI return false; -#ifndef GLSLANG_WEB case glslang::EOpEmitStreamVertex: builder.createNoResultOp(spv::OpEmitStreamVertex, operand); return false; @@ -2710,7 +2739,12 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI case glslang::EOpRayQueryConfirmIntersection: builder.createNoResultOp(spv::OpRayQueryConfirmIntersectionKHR, operand); return false; -#endif + case glslang::EOpReorderThreadNV: + builder.createNoResultOp(spv::OpReorderThreadWithHitObjectNV, operand); + return false; + case glslang::EOpHitObjectRecordEmptyNV: + builder.createNoResultOp(spv::OpHitObjectRecordEmptyNV, operand); + return false; default: logger->missingFunctionality("unknown glslang unary"); @@ -2775,15 +2809,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.setAccessChainRValue(result); return false; - } -#ifndef GLSLANG_WEB - else if (node->getOp() == glslang::EOpImageStore || + } else if (node->getOp() == glslang::EOpImageStore || node->getOp() == glslang::EOpImageStoreLod || node->getOp() == glslang::EOpImageAtomicStore) { // "imageStore" is a special case, which has no result return false; } -#endif glslang::TOperator binOp = glslang::EOpNull; bool reduceComparison = true; @@ -3002,7 +3033,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpConstructStruct: case glslang::EOpConstructTextureSampler: case glslang::EOpConstructReference: - case glslang::EOpConstructCooperativeMatrix: + case glslang::EOpConstructCooperativeMatrixNV: + case glslang::EOpConstructCooperativeMatrixKHR: { builder.setLine(node->getLoc().line, node->getLoc().getFilename()); std::vector arguments; @@ -3019,7 +3051,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt } else constructed = builder.createOp(spv::OpSampledImage, resultType(), arguments); } else if (node->getOp() == glslang::EOpConstructStruct || - node->getOp() == glslang::EOpConstructCooperativeMatrix || + node->getOp() == glslang::EOpConstructCooperativeMatrixNV || + node->getOp() == glslang::EOpConstructCooperativeMatrixKHR || node->getType().isArray()) { std::vector constituents; for (int c = 0; c < (int)arguments.size(); ++c) @@ -3117,7 +3150,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt atomic = true; break; -#ifndef GLSLANG_WEB case glslang::EOpAtomicStore: noReturnValue = true; // fallthrough @@ -3194,6 +3226,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt break; case glslang::EOpCooperativeMatrixLoad: case glslang::EOpCooperativeMatrixStore: + case glslang::EOpCooperativeMatrixLoadNV: + case glslang::EOpCooperativeMatrixStoreNV: noReturnValue = true; break; case glslang::EOpBeginInvocationInterlock: @@ -3201,7 +3235,62 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.addExtension(spv::E_SPV_EXT_fragment_shader_interlock); noReturnValue = true; break; -#endif + + case glslang::EOpHitObjectTraceRayNV: + case glslang::EOpHitObjectTraceRayMotionNV: + case glslang::EOpHitObjectGetAttributesNV: + case glslang::EOpHitObjectExecuteShaderNV: + case glslang::EOpHitObjectRecordEmptyNV: + case glslang::EOpHitObjectRecordMissNV: + case glslang::EOpHitObjectRecordMissMotionNV: + case glslang::EOpHitObjectRecordHitNV: + case glslang::EOpHitObjectRecordHitMotionNV: + case glslang::EOpHitObjectRecordHitWithIndexNV: + case glslang::EOpHitObjectRecordHitWithIndexMotionNV: + case glslang::EOpReorderThreadNV: + noReturnValue = true; + //Fallthrough + case glslang::EOpHitObjectIsEmptyNV: + case glslang::EOpHitObjectIsMissNV: + case glslang::EOpHitObjectIsHitNV: + case glslang::EOpHitObjectGetRayTMinNV: + case glslang::EOpHitObjectGetRayTMaxNV: + case glslang::EOpHitObjectGetObjectRayOriginNV: + case glslang::EOpHitObjectGetObjectRayDirectionNV: + case glslang::EOpHitObjectGetWorldRayOriginNV: + case glslang::EOpHitObjectGetWorldRayDirectionNV: + case glslang::EOpHitObjectGetObjectToWorldNV: + case glslang::EOpHitObjectGetWorldToObjectNV: + case glslang::EOpHitObjectGetInstanceCustomIndexNV: + case glslang::EOpHitObjectGetInstanceIdNV: + case glslang::EOpHitObjectGetGeometryIndexNV: + case glslang::EOpHitObjectGetPrimitiveIndexNV: + case glslang::EOpHitObjectGetHitKindNV: + case glslang::EOpHitObjectGetCurrentTimeNV: + case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV: + case glslang::EOpHitObjectGetShaderRecordBufferHandleNV: + builder.addExtension(spv::E_SPV_NV_shader_invocation_reorder); + builder.addCapability(spv::CapabilityShaderInvocationReorderNV); + break; + case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: + builder.addExtension(spv::E_SPV_KHR_ray_tracing_position_fetch); + builder.addCapability(spv::CapabilityRayQueryPositionFetchKHR); + noReturnValue = true; + break; + + case glslang::EOpImageSampleWeightedQCOM: + builder.addCapability(spv::CapabilityTextureSampleWeightedQCOM); + builder.addExtension(spv::E_SPV_QCOM_image_processing); + break; + case glslang::EOpImageBoxFilterQCOM: + builder.addCapability(spv::CapabilityTextureBoxFilterQCOM); + builder.addExtension(spv::E_SPV_QCOM_image_processing); + break; + case glslang::EOpImageBlockMatchSADQCOM: + case glslang::EOpImageBlockMatchSSDQCOM: + builder.addCapability(spv::CapabilityTextureBlockMatchQCOM); + builder.addExtension(spv::E_SPV_QCOM_image_processing); + break; case glslang::EOpDebugPrintf: noReturnValue = true; @@ -3258,6 +3347,22 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt lvalue = true; break; + + + case glslang::EOpHitObjectRecordHitNV: + case glslang::EOpHitObjectRecordHitMotionNV: + case glslang::EOpHitObjectRecordHitWithIndexNV: + case glslang::EOpHitObjectRecordHitWithIndexMotionNV: + case glslang::EOpHitObjectTraceRayNV: + case glslang::EOpHitObjectTraceRayMotionNV: + case glslang::EOpHitObjectExecuteShaderNV: + case glslang::EOpHitObjectRecordMissNV: + case glslang::EOpHitObjectRecordMissMotionNV: + case glslang::EOpHitObjectGetAttributesNV: + if (arg == 0) + lvalue = true; + break; + case glslang::EOpRayQueryInitialize: case glslang::EOpRayQueryTerminate: case glslang::EOpRayQueryConfirmIntersection: @@ -3293,7 +3398,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt lvalue = true; break; -#ifndef GLSLANG_WEB case glslang::EOpFrexp: if (arg == 1) lvalue = true; @@ -3347,10 +3451,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt lvalue = true; break; case glslang::EOpCooperativeMatrixLoad: + case glslang::EOpCooperativeMatrixLoadNV: if (arg == 0 || arg == 1) lvalue = true; break; case glslang::EOpCooperativeMatrixStore: + case glslang::EOpCooperativeMatrixStoreNV: if (arg == 1) lvalue = true; break; @@ -3358,7 +3464,15 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt if (glslangOperands[arg]->getAsTyped()->getQualifier().isSpirvByReference()) lvalue = true; break; -#endif + case glslang::EOpReorderThreadNV: + //Three variants of reorderThreadNV, two of them use hitObjectNV + if (arg == 0 && glslangOperands.size() != 2) + lvalue = true; + break; + case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: + if (arg == 0 || arg == 2) + lvalue = true; + break; default: break; } @@ -3368,9 +3482,10 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt else glslangOperands[arg]->traverse(this); -#ifndef GLSLANG_WEB if (node->getOp() == glslang::EOpCooperativeMatrixLoad || - node->getOp() == glslang::EOpCooperativeMatrixStore) { + node->getOp() == glslang::EOpCooperativeMatrixStore || + node->getOp() == glslang::EOpCooperativeMatrixLoadNV || + node->getOp() == glslang::EOpCooperativeMatrixStoreNV) { if (arg == 1) { // fold "element" parameter into the access chain @@ -3391,9 +3506,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt unsigned int alignment = builder.getAccessChain().alignment; int memoryAccess = TranslateMemoryAccess(coherentFlags); - if (node->getOp() == glslang::EOpCooperativeMatrixLoad) + if (node->getOp() == glslang::EOpCooperativeMatrixLoad || + node->getOp() == glslang::EOpCooperativeMatrixLoadNV) memoryAccess &= ~spv::MemoryAccessMakePointerAvailableKHRMask; - if (node->getOp() == glslang::EOpCooperativeMatrixStore) + if (node->getOp() == glslang::EOpCooperativeMatrixStore || + node->getOp() == glslang::EOpCooperativeMatrixStoreNV) memoryAccess &= ~spv::MemoryAccessMakePointerVisibleKHRMask; if (builder.getStorageClass(builder.getAccessChain().base) == spv::StorageClassPhysicalStorageBufferEXT) { @@ -3415,7 +3532,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt continue; } } -#endif // for l-values, pass the address, for r-values, pass the value if (lvalue) { @@ -3450,26 +3566,37 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt glslangOp == glslang::EOpRayQueryGetIntersectionObjectRayDirection || glslangOp == glslang::EOpRayQueryGetIntersectionObjectRayOrigin || glslangOp == glslang::EOpRayQueryGetIntersectionObjectToWorld || - glslangOp == glslang::EOpRayQueryGetIntersectionWorldToObject + glslangOp == glslang::EOpRayQueryGetIntersectionWorldToObject || + glslangOp == glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT )) { bool cond = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getBConst(); operands.push_back(builder.makeIntConstant(cond ? 1 : 0)); } else if ((arg == 10 && glslangOp == glslang::EOpTraceKHR) || (arg == 11 && glslangOp == glslang::EOpTraceRayMotionNV) || - (arg == 1 && glslangOp == glslang::EOpExecuteCallableKHR)) { - const int opdNum = glslangOp == glslang::EOpTraceKHR ? 10 : (glslangOp == glslang::EOpTraceRayMotionNV ? 11 : 1); + (arg == 1 && glslangOp == glslang::EOpExecuteCallableKHR) || + (arg == 1 && glslangOp == glslang::EOpHitObjectExecuteShaderNV) || + (arg == 11 && glslangOp == glslang::EOpHitObjectTraceRayNV) || + (arg == 12 && glslangOp == glslang::EOpHitObjectTraceRayMotionNV)) { const int set = glslangOp == glslang::EOpExecuteCallableKHR ? 1 : 0; - - const int location = glslangOperands[opdNum]->getAsConstantUnion()->getConstArray()[0].getUConst(); + const int location = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getUConst(); + auto itNode = locationToSymbol[set].find(location); + visitSymbol(itNode->second); + spv::Id symId = getSymbolId(itNode->second); + operands.push_back(symId); + } else if ((arg == 12 && glslangOp == glslang::EOpHitObjectRecordHitNV) || + (arg == 13 && glslangOp == glslang::EOpHitObjectRecordHitMotionNV) || + (arg == 11 && glslangOp == glslang::EOpHitObjectRecordHitWithIndexNV) || + (arg == 12 && glslangOp == glslang::EOpHitObjectRecordHitWithIndexMotionNV) || + (arg == 1 && glslangOp == glslang::EOpHitObjectGetAttributesNV)) { + const int location = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getUConst(); + const int set = 2; auto itNode = locationToSymbol[set].find(location); visitSymbol(itNode->second); spv::Id symId = getSymbolId(itNode->second); operands.push_back(symId); -#ifndef GLSLANG_WEB } else if (glslangOperands[arg]->getAsTyped()->getQualifier().isSpirvLiteral()) { // Will be translated to a literal value, make a placeholder here operands.push_back(spv::NoResult); -#endif } else { operands.push_back(accessChainLoad(glslangOperands[arg]->getAsTyped()->getType())); } @@ -3477,42 +3604,94 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt } builder.setLine(node->getLoc().line, node->getLoc().getFilename()); -#ifndef GLSLANG_WEB - if (node->getOp() == glslang::EOpCooperativeMatrixLoad) { + if (node->getOp() == glslang::EOpCooperativeMatrixLoad || + node->getOp() == glslang::EOpCooperativeMatrixLoadNV) { std::vector idImmOps; idImmOps.push_back(spv::IdImmediate(true, operands[1])); // buf - idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride - idImmOps.push_back(spv::IdImmediate(true, operands[3])); // colMajor + if (node->getOp() == glslang::EOpCooperativeMatrixLoad) { + idImmOps.push_back(spv::IdImmediate(true, operands[3])); // matrixLayout + idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride + } else { + idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride + idImmOps.push_back(spv::IdImmediate(true, operands[3])); // colMajor + } idImmOps.insert(idImmOps.end(), memoryAccessOperands.begin(), memoryAccessOperands.end()); // get the pointee type spv::Id typeId = builder.getContainedTypeId(builder.getTypeId(operands[0])); assert(builder.isCooperativeMatrixType(typeId)); // do the op - spv::Id result = builder.createOp(spv::OpCooperativeMatrixLoadNV, typeId, idImmOps); + spv::Id result = node->getOp() == glslang::EOpCooperativeMatrixLoad + ? builder.createOp(spv::OpCooperativeMatrixLoadKHR, typeId, idImmOps) + : builder.createOp(spv::OpCooperativeMatrixLoadNV, typeId, idImmOps); // store the result to the pointer (out param 'm') builder.createStore(result, operands[0]); result = 0; - } else if (node->getOp() == glslang::EOpCooperativeMatrixStore) { + } else if (node->getOp() == glslang::EOpCooperativeMatrixStore || + node->getOp() == glslang::EOpCooperativeMatrixStoreNV) { std::vector idImmOps; idImmOps.push_back(spv::IdImmediate(true, operands[1])); // buf idImmOps.push_back(spv::IdImmediate(true, operands[0])); // object - idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride - idImmOps.push_back(spv::IdImmediate(true, operands[3])); // colMajor + if (node->getOp() == glslang::EOpCooperativeMatrixStore) { + idImmOps.push_back(spv::IdImmediate(true, operands[3])); // matrixLayout + idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride + } else { + idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride + idImmOps.push_back(spv::IdImmediate(true, operands[3])); // colMajor + } idImmOps.insert(idImmOps.end(), memoryAccessOperands.begin(), memoryAccessOperands.end()); - builder.createNoResultOp(spv::OpCooperativeMatrixStoreNV, idImmOps); + if (node->getOp() == glslang::EOpCooperativeMatrixStore) + builder.createNoResultOp(spv::OpCooperativeMatrixStoreKHR, idImmOps); + else + builder.createNoResultOp(spv::OpCooperativeMatrixStoreNV, idImmOps); result = 0; - } else -#endif - if (atomic) { + } else if (node->getOp() == glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT) { + std::vector idImmOps; + + idImmOps.push_back(spv::IdImmediate(true, operands[0])); // q + idImmOps.push_back(spv::IdImmediate(true, operands[1])); // committed + + spv::Id typeId = builder.makeArrayType(builder.makeVectorType(builder.makeFloatType(32), 3), + builder.makeUintConstant(3), 0); + // do the op + spv::Id result = builder.createOp(spv::OpRayQueryGetIntersectionTriangleVertexPositionsKHR, typeId, idImmOps); + // store the result to the pointer (out param 'm') + builder.createStore(result, operands[2]); + result = 0; + } else if (node->getOp() == glslang::EOpCooperativeMatrixMulAdd) { + uint32_t matrixOperands = 0; + + // If the optional operand is present, initialize matrixOperands to that value. + if (glslangOperands.size() == 4 && glslangOperands[3]->getAsConstantUnion()) { + matrixOperands = glslangOperands[3]->getAsConstantUnion()->getConstArray()[0].getIConst(); + } + + // Determine Cooperative Matrix Operands bits from the signedness of the types. + if (isTypeSignedInt(glslangOperands[0]->getAsTyped()->getBasicType())) + matrixOperands |= spv::CooperativeMatrixOperandsMatrixASignedComponentsMask; + if (isTypeSignedInt(glslangOperands[1]->getAsTyped()->getBasicType())) + matrixOperands |= spv::CooperativeMatrixOperandsMatrixBSignedComponentsMask; + if (isTypeSignedInt(glslangOperands[2]->getAsTyped()->getBasicType())) + matrixOperands |= spv::CooperativeMatrixOperandsMatrixCSignedComponentsMask; + if (isTypeSignedInt(node->getBasicType())) + matrixOperands |= spv::CooperativeMatrixOperandsMatrixResultSignedComponentsMask; + + std::vector idImmOps; + idImmOps.push_back(spv::IdImmediate(true, operands[0])); + idImmOps.push_back(spv::IdImmediate(true, operands[1])); + idImmOps.push_back(spv::IdImmediate(true, operands[2])); + if (matrixOperands != 0) + idImmOps.push_back(spv::IdImmediate(false, matrixOperands)); + + result = builder.createOp(spv::OpCooperativeMatrixMulAddKHR, resultType(), idImmOps); + } else if (atomic) { // Handle all atomics glslang::TBasicType typeProxy = (node->getOp() == glslang::EOpAtomicStore) ? node->getSequence()[0]->getAsTyped()->getBasicType() : node->getBasicType(); result = createAtomicOperation(node->getOp(), precision, resultType(), operands, typeProxy, lvalueCoherentFlags); -#ifndef GLSLANG_WEB } else if (node->getOp() == glslang::EOpSpirvInst) { const auto& spirvInst = node->getSpirvInstruction(); if (spirvInst.set == "") { @@ -3539,7 +3718,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt spirvInst.id, operands); } noReturnValue = node->getBasicType() == glslang::EbtVoid; -#endif } else if (node->getOp() == glslang::EOpDebugPrintf) { if (!nonSemanticDebugPrintf) { nonSemanticDebugPrintf = builder.import("NonSemantic.DebugPrintf"); @@ -3656,10 +3834,11 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang // Find a way of executing both sides and selecting the right result. const auto executeBothSides = [&]() -> void { // execute both sides + spv::Id resultType = convertGlslangToSpvType(node->getType()); node->getTrueBlock()->traverse(this); spv::Id trueValue = accessChainLoad(node->getTrueBlock()->getAsTyped()->getType()); node->getFalseBlock()->traverse(this); - spv::Id falseValue = accessChainLoad(node->getTrueBlock()->getAsTyped()->getType()); + spv::Id falseValue = accessChainLoad(node->getFalseBlock()->getAsTyped()->getType()); builder.setLine(node->getLoc().line, node->getLoc().getFilename()); @@ -3668,8 +3847,8 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang return; // emit code to select between trueValue and falseValue - - // see if OpSelect can handle it + // see if OpSelect can handle the result type, and that the SPIR-V types + // of the inputs match the result type. if (isOpSelectable()) { // Emit OpSelect for this selection. @@ -3681,10 +3860,18 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang builder.getNumComponents(trueValue))); } + // If the types do not match, it is because of mismatched decorations on aggregates. + // Since isOpSelectable only lets us get here for SPIR-V >= 1.4, we can use OpCopyObject + // to get matching types. + if (builder.getTypeId(trueValue) != resultType) { + trueValue = builder.createUnaryOp(spv::OpCopyLogical, resultType, trueValue); + } + if (builder.getTypeId(falseValue) != resultType) { + falseValue = builder.createUnaryOp(spv::OpCopyLogical, resultType, falseValue); + } + // OpSelect - result = builder.createTriOp(spv::OpSelect, - convertGlslangToSpvType(node->getType()), condition, - trueValue, falseValue); + result = builder.createTriOp(spv::OpSelect, resultType, condition, trueValue, falseValue); builder.clearAccessChain(); builder.setAccessChainRValue(result); @@ -3692,7 +3879,7 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang // We need control flow to select the result. // TODO: Once SPIR-V OpSelect allows arbitrary types, eliminate this path. result = builder.createVariable(TranslatePrecisionDecoration(node->getType()), - spv::StorageClassFunction, convertGlslangToSpvType(node->getType())); + spv::StorageClassFunction, resultType); // Selection control: const spv::SelectionControlMask control = TranslateSelectionControl(*node); @@ -3701,10 +3888,15 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang spv::Builder::If ifBuilder(condition, control, builder); // emit the "then" statement - builder.createStore(trueValue, result); + builder.clearAccessChain(); + builder.setAccessChainLValue(result); + multiTypeStore(node->getType(), trueValue); + ifBuilder.makeBeginElse(); // emit the "else" statement - builder.createStore(falseValue, result); + builder.clearAccessChain(); + builder.setAccessChainLValue(result); + multiTypeStore(node->getType(), falseValue); // finish off the control flow ifBuilder.makeEndIf(); @@ -3731,16 +3923,26 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang // emit the "then" statement if (node->getTrueBlock() != nullptr) { node->getTrueBlock()->traverse(this); - if (result != spv::NoResult) - builder.createStore(accessChainLoad(node->getTrueBlock()->getAsTyped()->getType()), result); + if (result != spv::NoResult) { + spv::Id load = accessChainLoad(node->getTrueBlock()->getAsTyped()->getType()); + + builder.clearAccessChain(); + builder.setAccessChainLValue(result); + multiTypeStore(node->getType(), load); + } } if (node->getFalseBlock() != nullptr) { ifBuilder.makeBeginElse(); // emit the "else" statement node->getFalseBlock()->traverse(this); - if (result != spv::NoResult) - builder.createStore(accessChainLoad(node->getFalseBlock()->getAsTyped()->getType()), result); + if (result != spv::NoResult) { + spv::Id load = accessChainLoad(node->getFalseBlock()->getAsTyped()->getType()); + + builder.clearAccessChain(); + builder.setAccessChainLValue(result); + multiTypeStore(node->getType(), load); + } } // finish off the control flow @@ -3820,10 +4022,8 @@ bool TGlslangToSpvTraverser::visitSwitch(glslang::TVisit /* visit */, glslang::T void TGlslangToSpvTraverser::visitConstantUnion(glslang::TIntermConstantUnion* node) { -#ifndef GLSLANG_WEB if (node->getQualifier().isSpirvLiteral()) return; // Translated to a literal value, skip further processing -#endif int nextConst = 0; spv::Id constant = createSpvConstantFromConstUnionArray(node->getType(), node->getConstArray(), nextConst, false); @@ -3954,7 +4154,6 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T builder.clearAccessChain(); break; -#ifndef GLSLANG_WEB case glslang::EOpDemote: builder.createNoResultOp(spv::OpDemoteToHelperInvocationEXT); builder.addExtension(spv::E_SPV_EXT_demote_to_helper_invocation); @@ -3966,7 +4165,6 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T case glslang::EOpIgnoreIntersectionKHR: builder.makeStatementTerminator(spv::OpIgnoreIntersectionKHR, "post-ignoreIntersectionKHR"); break; -#endif default: assert(0); @@ -4008,7 +4206,6 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* else builder.addCapability(spv::CapabilityStorageUniform16); break; -#ifndef GLSLANG_WEB case spv::StorageClassPushConstant: builder.addIncorporatedExtension(spv::E_SPV_KHR_16bit_storage, spv::Spv_1_3); builder.addCapability(spv::CapabilityStoragePushConstant16); @@ -4018,7 +4215,6 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* builder.addIncorporatedExtension(spv::E_SPV_KHR_16bit_storage, spv::Spv_1_3); builder.addCapability(spv::CapabilityStorageUniformBufferBlock16); break; -#endif default: if (storageClass == spv::StorageClassWorkgroup && node->getType().getBasicType() == glslang::EbtBlock) { @@ -4077,7 +4273,6 @@ spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler) case glslang::EbtInt: return builder.makeIntType(32); case glslang::EbtUint: return builder.makeUintType(32); case glslang::EbtFloat: return builder.makeFloatType(32); -#ifndef GLSLANG_WEB case glslang::EbtFloat16: builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float_fetch); builder.addCapability(spv::CapabilityFloat16ImageAMD); @@ -4090,7 +4285,6 @@ spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler) builder.addExtension(spv::E_SPV_EXT_shader_image_int64); builder.addCapability(spv::CapabilityInt64ImageEXT); return builder.makeUintType(64); -#endif default: assert(0); return builder.makeFloatType(32); @@ -4166,7 +4360,6 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty case glslang::EbtFloat: spvType = builder.makeFloatType(32); break; -#ifndef GLSLANG_WEB case glslang::EbtDouble: spvType = builder.makeFloatType(64); break; @@ -4244,7 +4437,6 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty } } break; -#endif case glslang::EbtSampler: { const glslang::TSampler& sampler = type.getSampler(); @@ -4286,7 +4478,13 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty case glslang::EbtString: // no type used for OpString return 0; -#ifndef GLSLANG_WEB + + case glslang::EbtHitObjectNV: { + builder.addExtension(spv::E_SPV_NV_shader_invocation_reorder); + builder.addCapability(spv::CapabilityShaderInvocationReorderNV); + spvType = builder.makeHitObjectNVType(); + } + break; case glslang::EbtSpirvType: { // GL_EXT_spirv_intrinsics const auto& spirvType = type.getSpirvType(); @@ -4294,50 +4492,56 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty std::vector operands; for (const auto& typeParam : spirvType.typeParams) { - // Constant expression - if (typeParam.constant->isLiteral()) { - if (typeParam.constant->getBasicType() == glslang::EbtFloat) { - float floatValue = static_cast(typeParam.constant->getConstArray()[0].getDConst()); - unsigned literal; - static_assert(sizeof(literal) == sizeof(floatValue), "sizeof(unsigned) != sizeof(float)"); - memcpy(&literal, &floatValue, sizeof(literal)); - operands.push_back({false, literal}); - } else if (typeParam.constant->getBasicType() == glslang::EbtInt) { - unsigned literal = typeParam.constant->getConstArray()[0].getIConst(); - operands.push_back({false, literal}); - } else if (typeParam.constant->getBasicType() == glslang::EbtUint) { - unsigned literal = typeParam.constant->getConstArray()[0].getUConst(); - operands.push_back({false, literal}); - } else if (typeParam.constant->getBasicType() == glslang::EbtBool) { - unsigned literal = typeParam.constant->getConstArray()[0].getBConst(); - operands.push_back({false, literal}); - } else if (typeParam.constant->getBasicType() == glslang::EbtString) { - auto str = typeParam.constant->getConstArray()[0].getSConst()->c_str(); - unsigned literal = 0; - char* literalPtr = reinterpret_cast(&literal); - unsigned charCount = 0; - char ch = 0; - do { - ch = *(str++); - *(literalPtr++) = ch; - ++charCount; - if (charCount == 4) { + if (typeParam.constant != nullptr) { + // Constant expression + if (typeParam.constant->isLiteral()) { + if (typeParam.constant->getBasicType() == glslang::EbtFloat) { + float floatValue = static_cast(typeParam.constant->getConstArray()[0].getDConst()); + unsigned literal; + static_assert(sizeof(literal) == sizeof(floatValue), "sizeof(unsigned) != sizeof(float)"); + memcpy(&literal, &floatValue, sizeof(literal)); + operands.push_back({false, literal}); + } else if (typeParam.constant->getBasicType() == glslang::EbtInt) { + unsigned literal = typeParam.constant->getConstArray()[0].getIConst(); + operands.push_back({false, literal}); + } else if (typeParam.constant->getBasicType() == glslang::EbtUint) { + unsigned literal = typeParam.constant->getConstArray()[0].getUConst(); + operands.push_back({false, literal}); + } else if (typeParam.constant->getBasicType() == glslang::EbtBool) { + unsigned literal = typeParam.constant->getConstArray()[0].getBConst(); + operands.push_back({false, literal}); + } else if (typeParam.constant->getBasicType() == glslang::EbtString) { + auto str = typeParam.constant->getConstArray()[0].getSConst()->c_str(); + unsigned literal = 0; + char* literalPtr = reinterpret_cast(&literal); + unsigned charCount = 0; + char ch = 0; + do { + ch = *(str++); + *(literalPtr++) = ch; + ++charCount; + if (charCount == 4) { + operands.push_back({false, literal}); + literalPtr = reinterpret_cast(&literal); + charCount = 0; + } + } while (ch != 0); + + // Partial literal is padded with 0 + if (charCount > 0) { + for (; charCount < 4; ++charCount) + *(literalPtr++) = 0; operands.push_back({false, literal}); - literalPtr = reinterpret_cast(&literal); - charCount = 0; } - } while (ch != 0); - - // Partial literal is padded with 0 - if (charCount > 0) { - for (; charCount < 4; ++charCount) - *(literalPtr++) = 0; - operands.push_back({false, literal}); - } + } else + assert(0); // Unexpected type } else - assert(0); // Unexpected type - } else - operands.push_back({true, createSpvConstant(*typeParam.constant)}); + operands.push_back({true, createSpvConstant(*typeParam.constant)}); + } else { + // Type specifier + assert(typeParam.type != nullptr); + operands.push_back({true, convertGlslangToSpvType(*typeParam.type)}); + } } assert(spirvInst.set == ""); // Currently, couldn't be extended instructions. @@ -4345,7 +4549,6 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty break; } -#endif default: assert(0); break; @@ -4359,9 +4562,10 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty spvType = builder.makeVectorType(spvType, type.getVectorSize()); } - if (type.isCoopMat()) { + if (type.isCoopMatNV()) { builder.addCapability(spv::CapabilityCooperativeMatrixNV); builder.addExtension(spv::E_SPV_NV_cooperative_matrix); + if (type.getBasicType() == glslang::EbtFloat16) builder.addCapability(spv::CapabilityFloat16); if (type.getBasicType() == glslang::EbtUint8 || @@ -4369,11 +4573,29 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty builder.addCapability(spv::CapabilityInt8); } - spv::Id scope = makeArraySizeId(*type.getTypeParameters(), 1); - spv::Id rows = makeArraySizeId(*type.getTypeParameters(), 2); - spv::Id cols = makeArraySizeId(*type.getTypeParameters(), 3); + spv::Id scope = makeArraySizeId(*type.getTypeParameters()->arraySizes, 1); + spv::Id rows = makeArraySizeId(*type.getTypeParameters()->arraySizes, 2); + spv::Id cols = makeArraySizeId(*type.getTypeParameters()->arraySizes, 3); - spvType = builder.makeCooperativeMatrixType(spvType, scope, rows, cols); + spvType = builder.makeCooperativeMatrixTypeNV(spvType, scope, rows, cols); + } + + if (type.isCoopMatKHR()) { + builder.addCapability(spv::CapabilityCooperativeMatrixKHR); + builder.addExtension(spv::E_SPV_KHR_cooperative_matrix); + + if (type.getBasicType() == glslang::EbtFloat16) + builder.addCapability(spv::CapabilityFloat16); + if (type.getBasicType() == glslang::EbtUint8 || type.getBasicType() == glslang::EbtInt8) { + builder.addCapability(spv::CapabilityInt8); + } + + spv::Id scope = makeArraySizeId(*type.getTypeParameters()->arraySizes, 0); + spv::Id rows = makeArraySizeId(*type.getTypeParameters()->arraySizes, 1); + spv::Id cols = makeArraySizeId(*type.getTypeParameters()->arraySizes, 2); + spv::Id use = builder.makeUintConstant(type.getCoopMatKHRuse()); + + spvType = builder.makeCooperativeMatrixTypeKHR(spvType, scope, rows, cols, use); } if (type.isArray()) { @@ -4414,12 +4636,10 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty if (type.isSizedArray()) spvType = builder.makeArrayType(spvType, makeArraySizeId(*type.getArraySizes(), 0), stride); else { -#ifndef GLSLANG_WEB if (!lastBufferBlockMember) { builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5); builder.addCapability(spv::CapabilityRuntimeDescriptorArrayEXT); } -#endif spvType = builder.makeRuntimeArray(spvType); } if (stride > 0) @@ -4435,7 +4655,6 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty // bool TGlslangToSpvTraverser::filterMember(const glslang::TType& member) { -#ifndef GLSLANG_WEB auto& extensions = glslangIntermediate->getRequestedExtensions(); if (member.getFieldName() == "gl_SecondaryViewportMaskNV" && @@ -4445,6 +4664,12 @@ bool TGlslangToSpvTraverser::filterMember(const glslang::TType& member) extensions.find("GL_NV_stereo_view_rendering") == extensions.end()) return true; + if (glslangIntermediate->getStage() == EShLangMesh) { + if (member.getFieldName() == "gl_PrimitiveShadingRateEXT" && + extensions.find("GL_EXT_fragment_shading_rate") == extensions.end()) + return true; + } + if (glslangIntermediate->getStage() != EShLangMesh) { if (member.getFieldName() == "gl_ViewportMask" && extensions.find("GL_NV_viewport_array2") == extensions.end()) @@ -4456,7 +4681,6 @@ bool TGlslangToSpvTraverser::filterMember(const glslang::TType& member) extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end()) return true; } -#endif return false; }; @@ -4537,7 +4761,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy structMap[explicitLayout][qualifier.layoutMatrix][glslangMembers] = spvType; // Decorate it - decorateStructType(type, glslangMembers, explicitLayout, qualifier, spvType); + decorateStructType(type, glslangMembers, explicitLayout, qualifier, spvType, spvMembers); for (int i = 0; i < (int)deferredForwardPointers.size(); ++i) { auto it = deferredForwardPointers[i]; @@ -4551,7 +4775,8 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, const glslang::TTypeList* glslangMembers, glslang::TLayoutPacking explicitLayout, const glslang::TQualifier& qualifier, - spv::Id spvType) + spv::Id spvType, + const std::vector& spvMembers) { // Name and decorate the non-hidden members int offset = -1; @@ -4586,14 +4811,11 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, glslangIntermediate->getSource() == glslang::EShSourceHlsl) { builder.addMemberDecoration(spvType, member, TranslateInterpolationDecoration(memberQualifier)); builder.addMemberDecoration(spvType, member, TranslateAuxiliaryStorageDecoration(memberQualifier)); -#ifndef GLSLANG_WEB addMeshNVDecoration(spvType, member, memberQualifier); -#endif } } builder.addMemberDecoration(spvType, member, TranslateInvariantDecoration(memberQualifier)); -#ifndef GLSLANG_WEB if (type.getBasicType() == glslang::EbtBlock && qualifier.storage == glslang::EvqBuffer) { // Add memory decorations only to top-level members of shader storage block @@ -4603,8 +4825,6 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, builder.addMemberDecoration(spvType, member, memory[i]); } -#endif - // Location assignment was already completed correctly by the front end, // just track whether a member needs to be decorated. // Ignore member locations if the container is an array, as that's @@ -4637,7 +4857,6 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, if (builtIn != spv::BuiltInMax) builder.addMemberDecoration(spvType, member, spv::DecorationBuiltIn, (int)builtIn); -#ifndef GLSLANG_WEB // nonuniform builder.addMemberDecoration(spvType, member, TranslateNonUniformDecoration(glslangMember.getQualifier())); @@ -4699,19 +4918,30 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, builder.addDecoration(spvType, static_cast(decorateString.first), strings); } } -#endif } // Decorate the structure builder.addDecoration(spvType, TranslateLayoutDecoration(type, qualifier.layoutMatrix)); - builder.addDecoration(spvType, TranslateBlockDecoration(type, glslangIntermediate->usingStorageBuffer())); + const auto basicType = type.getBasicType(); + const auto typeStorageQualifier = type.getQualifier().storage; + if (basicType == glslang::EbtBlock) { + builder.addDecoration(spvType, TranslateBlockDecoration(typeStorageQualifier, glslangIntermediate->usingStorageBuffer())); + } else if (basicType == glslang::EbtStruct && glslangIntermediate->getSpv().vulkan > 0) { + const auto hasRuntimeArray = !spvMembers.empty() && builder.getOpCode(spvMembers.back()) == spv::OpTypeRuntimeArray; + if (hasRuntimeArray) { + builder.addDecoration(spvType, TranslateBlockDecoration(typeStorageQualifier, glslangIntermediate->usingStorageBuffer())); + } + } + + if (qualifier.hasHitObjectShaderRecordNV()) + builder.addDecoration(spvType, spv::DecorationHitObjectShaderRecordBufferNV); } // Turn the expression forming the array size into an id. // This is not quite trivial, because of specialization constants. // Sometimes, a raw constant is turned into an Id, and sometimes // a specialization constant expression is. -spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arraySizes, int dim) +spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arraySizes, int dim, bool allowZero) { // First, see if this is sized with a node, meaning a specialization constant: glslang::TIntermTyped* specNode = arraySizes.getDimNode(dim); @@ -4725,7 +4955,10 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra // Otherwise, need a compile-time (front end) size, get it: int size = arraySizes.getDimSize(dim); - assert(size > 0); + + if (!allowZero) + assert(size > 0); + return builder.makeUintConstant(size); } @@ -4741,6 +4974,16 @@ spv::Id TGlslangToSpvTraverser::accessChainLoad(const glslang::TType& type) spv::Builder::AccessChain::CoherentFlags coherentFlags = builder.getAccessChain().coherentFlags; coherentFlags |= TranslateCoherent(type); + spv::MemoryAccessMask accessMask = spv::MemoryAccessMask(TranslateMemoryAccess(coherentFlags) & ~spv::MemoryAccessMakePointerAvailableKHRMask); + // If the value being loaded is HelperInvocation, SPIR-V 1.6 is being generated (so that + // SPV_EXT_demote_to_helper_invocation is in core) and the memory model is in use, add + // the Volatile MemoryAccess semantic. + if (type.getQualifier().builtIn == glslang::EbvHelperInvocation && + glslangIntermediate->usingVulkanMemoryModel() && + glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) { + accessMask = spv::MemoryAccessMask(accessMask | spv::MemoryAccessVolatileMask); + } + unsigned int alignment = builder.getAccessChain().alignment; alignment |= type.getBufferReferenceAlignment(); @@ -4748,7 +4991,7 @@ spv::Id TGlslangToSpvTraverser::accessChainLoad(const glslang::TType& type) TranslateNonUniformDecoration(builder.getAccessChain().coherentFlags), TranslateNonUniformDecoration(type.getQualifier()), nominalTypeId, - spv::MemoryAccessMask(TranslateMemoryAccess(coherentFlags) & ~spv::MemoryAccessMakePointerAvailableKHRMask), + accessMask, TranslateMemoryScope(coherentFlags), alignment); @@ -5020,7 +5263,6 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList& switch (glslangBuiltIn) { case glslang::EbvPointSize: -#ifndef GLSLANG_WEB case glslang::EbvClipDistance: case glslang::EbvCullDistance: case glslang::EbvViewportMaskNV: @@ -5036,7 +5278,6 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList& case glslang::EbvLayerPerViewNV: case glslang::EbvMeshViewCountNV: case glslang::EbvMeshViewIndicesNV: -#endif // Generate the associated capability. Delegate to TranslateBuiltInDecoration. // Alternately, we could just call this for any glslang built-in, since the // capability already guards against duplicates. @@ -5075,10 +5316,8 @@ bool TGlslangToSpvTraverser::originalParam(glslang::TStorageQualifier qualifier, return true; if (glslangIntermediate->getSource() == glslang::EShSourceHlsl) return paramType.getBasicType() == glslang::EbtBlock; - return paramType.containsOpaque() || // sampler, etc. -#ifndef GLSLANG_WEB + return (paramType.containsOpaque() && !glslangIntermediate->getBindlessMode()) || // sampler, etc. paramType.getQualifier().isSpirvByReference() || // spirv_by_reference -#endif (paramType.getBasicType() == glslang::EbtBlock && qualifier == glslang::EvqBuffer); // SSBO } @@ -5222,6 +5461,10 @@ void TGlslangToSpvTraverser::collectRayTracingLinkerObjects() set = 1; break; + case glslang::EvqHitObjectAttrNV: + set = 2; + break; + default: set = -1; } @@ -5258,23 +5501,18 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& glslang::TSampler sampler = {}; bool cubeCompare = false; -#ifndef GLSLANG_WEB bool f16ShadowCompare = false; -#endif if (node.isTexture() || node.isImage()) { sampler = glslangArguments[0]->getAsTyped()->getType().getSampler(); cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow; -#ifndef GLSLANG_WEB f16ShadowCompare = sampler.shadow && glslangArguments[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16; -#endif } for (int i = 0; i < (int)glslangArguments.size(); ++i) { builder.clearAccessChain(); glslangArguments[i]->traverse(this); -#ifndef GLSLANG_WEB // Special case l-value operands bool lvalue = false; switch (node.getOp()) { @@ -5370,6 +5608,10 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if (i == 7) lvalue = true; break; + case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: + if (i == 2) + lvalue = true; + break; default: break; } @@ -5381,7 +5623,6 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& builder.addDecoration(lvalue_id, TranslateNonUniformDecoration(lvalueCoherentFlags)); lvalueCoherentFlags |= TranslateCoherent(glslangArguments[i]->getAsTyped()->getType()); } else -#endif arguments.push_back(accessChainLoad(glslangArguments[i]->getAsTyped()->getType())); } } @@ -5406,13 +5647,9 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ? node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType() : node->getAsUnaryNode()->getOperand()->getAsTyped()->getType(); const glslang::TSampler sampler = imageType.getSampler(); -#ifdef GLSLANG_WEB - const bool f16ShadowCompare = false; -#else bool f16ShadowCompare = (sampler.shadow && node->getAsAggregate()) ? node->getAsAggregate()->getSequence()[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16 : false; -#endif const auto signExtensionMask = [&]() { if (builder.getSpvVersion() >= spv::Spv_1_4) { @@ -5458,7 +5695,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO return builder.createTextureQueryCall(spv::OpImageQuerySizeLod, params, isUnsignedResult); } else return builder.createTextureQueryCall(spv::OpImageQuerySize, params, isUnsignedResult); -#ifndef GLSLANG_WEB case glslang::EOpImageQuerySamples: case glslang::EOpTextureQuerySamples: return builder.createTextureQueryCall(spv::OpImageQuerySamples, params, isUnsignedResult); @@ -5469,7 +5705,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO return builder.createTextureQueryCall(spv::OpImageQueryLevels, params, isUnsignedResult); case glslang::EOpSparseTexelsResident: return builder.createUnaryOp(spv::OpImageSparseTexelsResident, builder.makeBoolType(), arguments[0]); -#endif default: assert(0); break; @@ -5529,6 +5764,17 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO return result; } + if (cracked.attachmentEXT) { + if (opIt != arguments.end()) { + spv::IdImmediate sample = { true, *opIt }; + operands.push_back(sample); + } + spv::Id result = builder.createOp(spv::OpColorAttachmentReadEXT, resultType(), operands); + builder.addExtension(spv::E_SPV_EXT_shader_tile_image); + builder.setPrecision(result, precision); + return result; + } + spv::IdImmediate coord = { true, *(opIt++) }; operands.push_back(coord); if (node->getOp() == glslang::EOpImageLoad || node->getOp() == glslang::EOpImageLoadLod) { @@ -5700,7 +5946,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } } -#ifndef GLSLANG_WEB // Check for fragment mask functions other than queries if (cracked.fragMask) { assert(sampler.ms); @@ -5734,7 +5979,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO builder.addCapability(spv::CapabilityFragmentMaskAMD); return builder.createOp(fragMaskOp, resultType(), operands); } -#endif // Check for texture functions other than queries bool sparse = node->isSparseTexture(); @@ -5768,7 +6012,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO bias = true; } -#ifndef GLSLANG_WEB if (cracked.gather) { const auto& sourceExtensions = glslangIntermediate->getRequestedExtensions(); if (bias || cracked.lod || @@ -5777,7 +6020,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO builder.addCapability(spv::CapabilityImageGatherBiasLodAMD); } } -#endif // set the rest of the arguments @@ -5837,7 +6079,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ++extraArgs; } -#ifndef GLSLANG_WEB // lod clamp if (cracked.lodClamp) { params.lodClamp = arguments[2 + extraArgs]; @@ -5866,14 +6107,13 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO resultStruct = arguments[4 + extraArgs]; extraArgs += 3; } -#endif + // bias if (bias) { params.bias = arguments[2 + extraArgs]; ++extraArgs; } -#ifndef GLSLANG_WEB if (imageFootprint) { builder.addExtension(spv::E_SPV_NV_shader_image_footprint); builder.addCapability(spv::CapabilityImageFootprintNV); @@ -5931,7 +6171,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } return builder.createCompositeExtract(res, resultType(), 0); } -#endif // projective component (might not to move) // GLSL: "The texture coordinates consumed from P, not including the last component of P, @@ -5956,7 +6195,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } } -#ifndef GLSLANG_WEB // nonprivate if (imageType.getQualifier().nonprivate) { params.nonprivate = true; @@ -5966,7 +6204,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO if (imageType.getQualifier().volatil) { params.volatil = true; } -#endif std::vector result( 1, builder.createTextureCall(precision, resultType(), sparse, cracked.fetch, cracked.proj, cracked.gather, @@ -6620,7 +6857,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpUnpackHalf2x16: libCall = spv::GLSLstd450UnpackHalf2x16; break; -#ifndef GLSLANG_WEB case glslang::EOpPackSnorm4x8: libCall = spv::GLSLstd450PackSnorm4x8; break; @@ -6639,7 +6875,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpUnpackDouble2x32: libCall = spv::GLSLstd450UnpackDouble2x32; break; -#endif case glslang::EOpPackInt2x32: case glslang::EOpUnpackInt2x32: @@ -6694,7 +6929,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe libCall = spv::GLSLstd450SSign; break; -#ifndef GLSLANG_WEB case glslang::EOpDPdxFine: unaryOp = spv::OpDPdxFine; break; @@ -6866,12 +7100,100 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpConvUvec2ToAccStruct: unaryOp = spv::OpConvertUToAccelerationStructureKHR; break; -#endif + + case glslang::EOpHitObjectIsEmptyNV: + unaryOp = spv::OpHitObjectIsEmptyNV; + break; + + case glslang::EOpHitObjectIsMissNV: + unaryOp = spv::OpHitObjectIsMissNV; + break; + + case glslang::EOpHitObjectIsHitNV: + unaryOp = spv::OpHitObjectIsHitNV; + break; + + case glslang::EOpHitObjectGetObjectRayOriginNV: + unaryOp = spv::OpHitObjectGetObjectRayOriginNV; + break; + + case glslang::EOpHitObjectGetObjectRayDirectionNV: + unaryOp = spv::OpHitObjectGetObjectRayDirectionNV; + break; + + case glslang::EOpHitObjectGetWorldRayOriginNV: + unaryOp = spv::OpHitObjectGetWorldRayOriginNV; + break; + + case glslang::EOpHitObjectGetWorldRayDirectionNV: + unaryOp = spv::OpHitObjectGetWorldRayDirectionNV; + break; + + case glslang::EOpHitObjectGetObjectToWorldNV: + unaryOp = spv::OpHitObjectGetObjectToWorldNV; + break; + + case glslang::EOpHitObjectGetWorldToObjectNV: + unaryOp = spv::OpHitObjectGetWorldToObjectNV; + break; + + case glslang::EOpHitObjectGetRayTMinNV: + unaryOp = spv::OpHitObjectGetRayTMinNV; + break; + + case glslang::EOpHitObjectGetRayTMaxNV: + unaryOp = spv::OpHitObjectGetRayTMaxNV; + break; + + case glslang::EOpHitObjectGetPrimitiveIndexNV: + unaryOp = spv::OpHitObjectGetPrimitiveIndexNV; + break; + + case glslang::EOpHitObjectGetInstanceIdNV: + unaryOp = spv::OpHitObjectGetInstanceIdNV; + break; + + case glslang::EOpHitObjectGetInstanceCustomIndexNV: + unaryOp = spv::OpHitObjectGetInstanceCustomIndexNV; + break; + + case glslang::EOpHitObjectGetGeometryIndexNV: + unaryOp = spv::OpHitObjectGetGeometryIndexNV; + break; + + case glslang::EOpHitObjectGetHitKindNV: + unaryOp = spv::OpHitObjectGetHitKindNV; + break; + + case glslang::EOpHitObjectGetCurrentTimeNV: + unaryOp = spv::OpHitObjectGetCurrentTimeNV; + break; + + case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV: + unaryOp = spv::OpHitObjectGetShaderBindingTableRecordIndexNV; + break; + + case glslang::EOpHitObjectGetShaderRecordBufferHandleNV: + unaryOp = spv::OpHitObjectGetShaderRecordBufferHandleNV; + break; case glslang::EOpCopyObject: unaryOp = spv::OpCopyObject; break; + case glslang::EOpDepthAttachmentReadEXT: + builder.addExtension(spv::E_SPV_EXT_shader_tile_image); + builder.addCapability(spv::CapabilityTileImageDepthReadAccessEXT); + unaryOp = spv::OpDepthAttachmentReadEXT; + decorations.precision = spv::NoPrecision; + break; + case glslang::EOpStencilAttachmentReadEXT: + builder.addExtension(spv::E_SPV_EXT_shader_tile_image); + builder.addCapability(spv::CapabilityTileImageStencilReadAccessEXT); + unaryOp = spv::OpStencilAttachmentReadEXT; + decorations.precision = spv::DecorationRelaxedPrecision; + break; + default: return 0; } @@ -6928,7 +7250,9 @@ spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, OpDecorat // For converting integers where both the bitwidth and the signedness could // change, but only do the width change here. The caller is still responsible // for the signedness conversion. -spv::Id TGlslangToSpvTraverser::createIntWidthConversion(glslang::TOperator op, spv::Id operand, int vectorSize) +// destType is the final type that will be converted to, but this function +// may only be doing part of that conversion. +spv::Id TGlslangToSpvTraverser::createIntWidthConversion(glslang::TOperator op, spv::Id operand, int vectorSize, spv::Id destType) { // Get the result type width, based on the type to convert to. int width = 32; @@ -6999,6 +7323,11 @@ spv::Id TGlslangToSpvTraverser::createIntWidthConversion(glslang::TOperator op, if (vectorSize > 0) type = builder.makeVectorType(type, vectorSize); + else if (builder.getOpCode(destType) == spv::OpTypeCooperativeMatrixKHR || + builder.getOpCode(destType) == spv::OpTypeCooperativeMatrixNV) { + + type = builder.makeCooperativeMatrixTypeWithSameShape(type, destType); + } return builder.createUnaryOp(convOp, type, operand); } @@ -7030,13 +7359,10 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora case glslang::EOpConvBoolToInt: case glslang::EOpConvBoolToInt64: -#ifndef GLSLANG_WEB if (op == glslang::EOpConvBoolToInt64) { zero = builder.makeInt64Constant(0); one = builder.makeInt64Constant(1); - } else -#endif - { + } else { zero = builder.makeIntConstant(0); one = builder.makeIntConstant(1); } @@ -7046,13 +7372,10 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora case glslang::EOpConvBoolToUint: case glslang::EOpConvBoolToUint64: -#ifndef GLSLANG_WEB if (op == glslang::EOpConvBoolToUint64) { zero = builder.makeUint64Constant(0); one = builder.makeUint64Constant(1); - } else -#endif - { + } else { zero = builder.makeUintConstant(0); one = builder.makeUintConstant(1); } @@ -7115,16 +7438,13 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora case glslang::EOpConvInt64ToUint64: if (builder.isInSpecConstCodeGenMode()) { // Build zero scalar or vector for OpIAdd. -#ifndef GLSLANG_WEB if(op == glslang::EOpConvUint8ToInt8 || op == glslang::EOpConvInt8ToUint8) { zero = builder.makeUint8Constant(0); } else if (op == glslang::EOpConvUint16ToInt16 || op == glslang::EOpConvInt16ToUint16) { zero = builder.makeUint16Constant(0); } else if (op == glslang::EOpConvUint64ToInt64 || op == glslang::EOpConvInt64ToUint64) { zero = builder.makeUint64Constant(0); - } else -#endif - { + } else { zero = builder.makeUintConstant(0); } zero = makeSmearedConstant(zero, vectorSize); @@ -7151,7 +7471,6 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora convOp = spv::OpConvertFToU; break; -#ifndef GLSLANG_WEB case glslang::EOpConvInt8ToBool: case glslang::EOpConvUint8ToBool: zero = builder.makeUint8Constant(0); @@ -7271,7 +7590,7 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora case glslang::EOpConvUint64ToInt16: case glslang::EOpConvUint64ToInt: // OpSConvert/OpUConvert + OpBitCast - operand = createIntWidthConversion(op, operand, vectorSize); + operand = createIntWidthConversion(op, operand, vectorSize, destType); if (builder.isInSpecConstCodeGenMode()) { // Build zero scalar or vector for OpIAdd. @@ -7330,7 +7649,6 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora case glslang::EOpConvUvec2ToPtr: convOp = spv::OpBitcast; break; -#endif default: break; @@ -8322,7 +8640,6 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: } break; -#ifndef GLSLANG_WEB case glslang::EOpInterpolateAtSample: if (typeProxy == glslang::EbtFloat16) builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); @@ -8604,10 +8921,146 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: case glslang::EOpSetMeshOutputsEXT: builder.createNoResultOp(spv::OpSetMeshOutputsEXT, operands); return 0; - case glslang::EOpCooperativeMatrixMulAdd: + case glslang::EOpCooperativeMatrixMulAddNV: opCode = spv::OpCooperativeMatrixMulAddNV; break; -#endif // GLSLANG_WEB + case glslang::EOpHitObjectTraceRayNV: + builder.createNoResultOp(spv::OpHitObjectTraceRayNV, operands); + return 0; + case glslang::EOpHitObjectTraceRayMotionNV: + builder.createNoResultOp(spv::OpHitObjectTraceRayMotionNV, operands); + return 0; + case glslang::EOpHitObjectRecordHitNV: + builder.createNoResultOp(spv::OpHitObjectRecordHitNV, operands); + return 0; + case glslang::EOpHitObjectRecordHitMotionNV: + builder.createNoResultOp(spv::OpHitObjectRecordHitMotionNV, operands); + return 0; + case glslang::EOpHitObjectRecordHitWithIndexNV: + builder.createNoResultOp(spv::OpHitObjectRecordHitWithIndexNV, operands); + return 0; + case glslang::EOpHitObjectRecordHitWithIndexMotionNV: + builder.createNoResultOp(spv::OpHitObjectRecordHitWithIndexMotionNV, operands); + return 0; + case glslang::EOpHitObjectRecordMissNV: + builder.createNoResultOp(spv::OpHitObjectRecordMissNV, operands); + return 0; + case glslang::EOpHitObjectRecordMissMotionNV: + builder.createNoResultOp(spv::OpHitObjectRecordMissMotionNV, operands); + return 0; + case glslang::EOpHitObjectExecuteShaderNV: + builder.createNoResultOp(spv::OpHitObjectExecuteShaderNV, operands); + return 0; + case glslang::EOpHitObjectIsEmptyNV: + typeId = builder.makeBoolType(); + opCode = spv::OpHitObjectIsEmptyNV; + break; + case glslang::EOpHitObjectIsMissNV: + typeId = builder.makeBoolType(); + opCode = spv::OpHitObjectIsMissNV; + break; + case glslang::EOpHitObjectIsHitNV: + typeId = builder.makeBoolType(); + opCode = spv::OpHitObjectIsHitNV; + break; + case glslang::EOpHitObjectGetRayTMinNV: + typeId = builder.makeFloatType(32); + opCode = spv::OpHitObjectGetRayTMinNV; + break; + case glslang::EOpHitObjectGetRayTMaxNV: + typeId = builder.makeFloatType(32); + opCode = spv::OpHitObjectGetRayTMaxNV; + break; + case glslang::EOpHitObjectGetObjectRayOriginNV: + typeId = builder.makeVectorType(builder.makeFloatType(32), 3); + opCode = spv::OpHitObjectGetObjectRayOriginNV; + break; + case glslang::EOpHitObjectGetObjectRayDirectionNV: + typeId = builder.makeVectorType(builder.makeFloatType(32), 3); + opCode = spv::OpHitObjectGetObjectRayDirectionNV; + break; + case glslang::EOpHitObjectGetWorldRayOriginNV: + typeId = builder.makeVectorType(builder.makeFloatType(32), 3); + opCode = spv::OpHitObjectGetWorldRayOriginNV; + break; + case glslang::EOpHitObjectGetWorldRayDirectionNV: + typeId = builder.makeVectorType(builder.makeFloatType(32), 3); + opCode = spv::OpHitObjectGetWorldRayDirectionNV; + break; + case glslang::EOpHitObjectGetWorldToObjectNV: + typeId = builder.makeMatrixType(builder.makeFloatType(32), 4, 3); + opCode = spv::OpHitObjectGetWorldToObjectNV; + break; + case glslang::EOpHitObjectGetObjectToWorldNV: + typeId = builder.makeMatrixType(builder.makeFloatType(32), 4, 3); + opCode = spv::OpHitObjectGetObjectToWorldNV; + break; + case glslang::EOpHitObjectGetInstanceCustomIndexNV: + typeId = builder.makeIntegerType(32, 1); + opCode = spv::OpHitObjectGetInstanceCustomIndexNV; + break; + case glslang::EOpHitObjectGetInstanceIdNV: + typeId = builder.makeIntegerType(32, 1); + opCode = spv::OpHitObjectGetInstanceIdNV; + break; + case glslang::EOpHitObjectGetGeometryIndexNV: + typeId = builder.makeIntegerType(32, 1); + opCode = spv::OpHitObjectGetGeometryIndexNV; + break; + case glslang::EOpHitObjectGetPrimitiveIndexNV: + typeId = builder.makeIntegerType(32, 1); + opCode = spv::OpHitObjectGetPrimitiveIndexNV; + break; + case glslang::EOpHitObjectGetHitKindNV: + typeId = builder.makeIntegerType(32, 0); + opCode = spv::OpHitObjectGetHitKindNV; + break; + case glslang::EOpHitObjectGetCurrentTimeNV: + typeId = builder.makeFloatType(32); + opCode = spv::OpHitObjectGetCurrentTimeNV; + break; + case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV: + typeId = builder.makeIntegerType(32, 0); + opCode = spv::OpHitObjectGetShaderBindingTableRecordIndexNV; + return 0; + case glslang::EOpHitObjectGetAttributesNV: + builder.createNoResultOp(spv::OpHitObjectGetAttributesNV, operands); + return 0; + case glslang::EOpHitObjectGetShaderRecordBufferHandleNV: + typeId = builder.makeVectorType(builder.makeUintType(32), 2); + opCode = spv::OpHitObjectGetShaderRecordBufferHandleNV; + break; + case glslang::EOpReorderThreadNV: { + if (operands.size() == 2) { + builder.createNoResultOp(spv::OpReorderThreadWithHintNV, operands); + } else { + builder.createNoResultOp(spv::OpReorderThreadWithHitObjectNV, operands); + } + return 0; + + } + + case glslang::EOpImageSampleWeightedQCOM: + typeId = builder.makeVectorType(builder.makeFloatType(32), 4); + opCode = spv::OpImageSampleWeightedQCOM; + addImageProcessingQCOMDecoration(operands[2], spv::DecorationWeightTextureQCOM); + break; + case glslang::EOpImageBoxFilterQCOM: + typeId = builder.makeVectorType(builder.makeFloatType(32), 4); + opCode = spv::OpImageBoxFilterQCOM; + break; + case glslang::EOpImageBlockMatchSADQCOM: + typeId = builder.makeVectorType(builder.makeFloatType(32), 4); + opCode = spv::OpImageBlockMatchSADQCOM; + addImageProcessingQCOMDecoration(operands[0], spv::DecorationBlockMatchTextureQCOM); + addImageProcessingQCOMDecoration(operands[2], spv::DecorationBlockMatchTextureQCOM); + break; + case glslang::EOpImageBlockMatchSSDQCOM: + typeId = builder.makeVectorType(builder.makeFloatType(32), 4); + opCode = spv::OpImageBlockMatchSSDQCOM; + addImageProcessingQCOMDecoration(operands[0], spv::DecorationBlockMatchTextureQCOM); + addImageProcessingQCOMDecoration(operands[2], spv::DecorationBlockMatchTextureQCOM); + break; default: return 0; } @@ -8651,7 +9104,6 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: } } -#ifndef GLSLANG_WEB // Decode the return types that were structures switch (op) { case glslang::EOpAddCarry: @@ -8681,7 +9133,6 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: default: break; } -#endif return builder.setPrecision(id, precision); } @@ -8726,7 +9177,6 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: builder.createMemoryBarrier(spv::ScopeWorkgroup, spv::MemorySemanticsAllMemory | spv::MemorySemanticsAcquireReleaseMask); return 0; -#ifndef GLSLANG_WEB case glslang::EOpMemoryBarrierAtomicCounter: builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAtomicCounterMemoryMask | spv::MemorySemanticsAcquireReleaseMask); @@ -8845,7 +9295,30 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: builder.addCapability(spv::CapabilityShaderClockKHR); return builder.createOp(spv::OpReadClockKHR, typeId, args); } -#endif + case glslang::EOpStencilAttachmentReadEXT: + case glslang::EOpDepthAttachmentReadEXT: + { + builder.addExtension(spv::E_SPV_EXT_shader_tile_image); + + spv::Decoration precision; + spv::Op spv_op; + if (op == glslang::EOpStencilAttachmentReadEXT) + { + precision = spv::DecorationRelaxedPrecision; + spv_op = spv::OpStencilAttachmentReadEXT; + builder.addCapability(spv::CapabilityTileImageStencilReadAccessEXT); + } + else + { + precision = spv::NoPrecision; + spv_op = spv::OpDepthAttachmentReadEXT; + builder.addCapability(spv::CapabilityTileImageDepthReadAccessEXT); + } + + std::vector args; // Dummy args + spv::Id result = builder.createOp(spv_op, typeId, args); + return builder.setPrecision(result, precision); + } default: break; } @@ -8901,13 +9374,11 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builder.addDecoration(id, TranslatePrecisionDecoration(symbol->getType())); builder.addDecoration(id, TranslateInterpolationDecoration(symbol->getType().getQualifier())); builder.addDecoration(id, TranslateAuxiliaryStorageDecoration(symbol->getType().getQualifier())); -#ifndef GLSLANG_WEB addMeshNVDecoration(id, /*member*/ -1, symbol->getType().getQualifier()); if (symbol->getQualifier().hasComponent()) builder.addDecoration(id, spv::DecorationComponent, symbol->getQualifier().layoutComponent); if (symbol->getQualifier().hasIndex()) builder.addDecoration(id, spv::DecorationIndex, symbol->getQualifier().layoutIndex); -#endif if (symbol->getType().getQualifier().hasSpecConstantId()) builder.addDecoration(id, spv::DecorationSpecId, symbol->getType().getQualifier().layoutSpecConstantId); // atomic counters use this: @@ -8916,13 +9387,17 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol } if (symbol->getQualifier().hasLocation()) { - if (!(glslangIntermediate->isRayTracingStage() && glslangIntermediate->IsRequestedExtension(glslang::E_GL_EXT_ray_tracing) + if (!(glslangIntermediate->isRayTracingStage() && + (glslangIntermediate->IsRequestedExtension(glslang::E_GL_EXT_ray_tracing) || + glslangIntermediate->IsRequestedExtension(glslang::E_GL_NV_shader_invocation_reorder)) && (builder.getStorageClass(id) == spv::StorageClassRayPayloadKHR || builder.getStorageClass(id) == spv::StorageClassIncomingRayPayloadKHR || builder.getStorageClass(id) == spv::StorageClassCallableDataKHR || - builder.getStorageClass(id) == spv::StorageClassIncomingCallableDataKHR))) { - // Location values are used to link TraceRayKHR and ExecuteCallableKHR to corresponding variables - // but are not valid in SPIRV since they are supported only for Input/Output Storage classes. + builder.getStorageClass(id) == spv::StorageClassIncomingCallableDataKHR || + builder.getStorageClass(id) == spv::StorageClassHitObjectAttributeNV))) { + // Location values are used to link TraceRayKHR/ExecuteCallableKHR/HitObjectGetAttributesNV + // to corresponding variables but are not valid in SPIRV since they are supported only + // for Input/Output Storage classes. builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation); } } @@ -8968,11 +9443,11 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol // Add volatile decoration to HelperInvocation for spirv1.6 and beyond if (builtIn == spv::BuiltInHelperInvocation && + !glslangIntermediate->usingVulkanMemoryModel() && glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) { builder.addDecoration(id, spv::DecorationVolatile); } -#ifndef GLSLANG_WEB // Subgroup builtins which have input storage class are volatile for ray tracing stages. if (symbol->getType().isImage() || symbol->getQualifier().isPipeInput()) { std::vector memory; @@ -9060,10 +9535,10 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol std::vector operandIds; assert(!decorateId.second.empty()); for (auto extraOperand : decorateId.second) { - if (extraOperand->getQualifier().isSpecConstant()) - operandIds.push_back(getSymbolId(extraOperand->getAsSymbolNode())); - else + if (extraOperand->getQualifier().isFrontEndConstant()) operandIds.push_back(createSpvConstant(*extraOperand)); + else + operandIds.push_back(getSymbolId(extraOperand->getAsSymbolNode())); } builder.addDecorationId(id, static_cast(decorateId.first), operandIds); } @@ -9079,12 +9554,10 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builder.addDecoration(id, static_cast(decorateString.first), strings); } } -#endif return id; } -#ifndef GLSLANG_WEB // add per-primitive, per-view. per-task decorations to a struct member (member >= 0) or an object void TGlslangToSpvTraverser::addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier& qualifier) { @@ -9131,7 +9604,20 @@ void TGlslangToSpvTraverser::addMeshNVDecoration(spv::Id id, int member, const g builder.addDecoration(id, spv::DecorationPerTaskNV); } } -#endif + +void TGlslangToSpvTraverser::addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor) +{ + spv::Op opc = builder.getOpCode(id); + if (opc == spv::OpSampledImage) { + id = builder.getIdOperand(id, 0); + opc = builder.getOpCode(id); + } + + if (opc == spv::OpLoad) { + spv::Id texid = builder.getIdOperand(id, 0); + builder.addDecoration(texid, decor); + } +} // Make a full tree of instructions to build a SPIR-V specialization constant, // or regular constant if possible. @@ -9259,7 +9745,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla case glslang::EbtBool: spvConsts.push_back(builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst())); break; -#ifndef GLSLANG_WEB case glslang::EbtInt8: builder.addCapability(spv::CapabilityInt8); spvConsts.push_back(builder.makeInt8Constant(zero ? 0 : consts[nextConst].getI8Const())); @@ -9289,7 +9774,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla builder.addCapability(spv::CapabilityFloat16); spvConsts.push_back(builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst())); break; -#endif default: assert(0); break; @@ -9313,7 +9797,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla case glslang::EbtBool: scalar = builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst(), specConstant); break; -#ifndef GLSLANG_WEB case glslang::EbtInt8: builder.addCapability(spv::CapabilityInt8); scalar = builder.makeInt8Constant(zero ? 0 : consts[nextConst].getI8Const(), specConstant); @@ -9347,7 +9830,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla scalar = builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const(), specConstant); scalar = builder.createUnaryOp(spv::OpBitcast, typeId, scalar); break; -#endif case glslang::EbtString: scalar = builder.getStringId(consts[nextConst].getSConst()->c_str()); break; @@ -9495,7 +9977,6 @@ spv::Id TGlslangToSpvTraverser::createShortCircuit(glslang::TOperator op, glslan return builder.createOp(spv::OpPhi, boolTypeId, phiOperands); } -#ifndef GLSLANG_WEB // Return type Id of the imported set of extended instructions corresponds to the name. // Import this set if it has not been imported yet. spv::Id TGlslangToSpvTraverser::getExtBuiltins(const char* name) @@ -9509,7 +9990,6 @@ spv::Id TGlslangToSpvTraverser::getExtBuiltins(const char* name) return extBuiltins; } } -#endif }; // end anonymous namespace @@ -9538,31 +10018,36 @@ int GetSpirvGeneratorVersion() // return 7; // GLSL volatile keyword maps to both SPIR-V decorations Volatile and Coherent // return 8; // switch to new dead block eliminator; use OpUnreachable // return 9; // don't include opaque function parameters in OpEntryPoint global's operand list - return 10; // Generate OpFUnordNotEqual for != comparisons + // return 10; // Generate OpFUnordNotEqual for != comparisons + return 11; // Make OpEmitMeshTasksEXT a terminal instruction } // Write SPIR-V out to a binary file -void OutputSpvBin(const std::vector& spirv, const char* baseName) +bool OutputSpvBin(const std::vector& spirv, const char* baseName) { std::ofstream out; out.open(baseName, std::ios::binary | std::ios::out); - if (out.fail()) + if (out.fail()) { printf("ERROR: Failed to open file: %s\n", baseName); + return false; + } for (int i = 0; i < (int)spirv.size(); ++i) { unsigned int word = spirv[i]; out.write((const char*)&word, 4); } out.close(); + return true; } // Write SPIR-V out to a text file with 32-bit hexadecimal words -void OutputSpvHex(const std::vector& spirv, const char* baseName, const char* varName) +bool OutputSpvHex(const std::vector& spirv, const char* baseName, const char* varName) { -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) std::ofstream out; out.open(baseName, std::ios::binary | std::ios::out); - if (out.fail()) + if (out.fail()) { printf("ERROR: Failed to open file: %s\n", baseName); + return false; + } out << "\t// " << GetSpirvGeneratorVersion() << GLSLANG_VERSION_MAJOR << "." << GLSLANG_VERSION_MINOR << "." << GLSLANG_VERSION_PATCH << @@ -9588,7 +10073,7 @@ void OutputSpvHex(const std::vector& spirv, const char* baseName, out << std::endl; } out.close(); -#endif + return true; } // @@ -9605,7 +10090,7 @@ void GlslangToSpv(const TIntermediate& intermediate, std::vector& { TIntermNode* root = intermediate.getTreeRoot(); - if (root == 0) + if (root == nullptr) return; SpvOptions defaultOptions; diff --git a/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.h b/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.h index 3907be43..b9736d7c 100644 --- a/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.h +++ b/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.h @@ -55,7 +55,7 @@ void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, spv::SpvBuildLogger* logger, SpvOptions* options = nullptr); -void OutputSpvBin(const std::vector& spirv, const char* baseName); -void OutputSpvHex(const std::vector& spirv, const char* baseName, const char* varName); +bool OutputSpvBin(const std::vector& spirv, const char* baseName); +bool OutputSpvHex(const std::vector& spirv, const char* baseName, const char* varName); } diff --git a/bgfx/3rdparty/glslang/SPIRV/Logger.cpp b/bgfx/3rdparty/glslang/SPIRV/Logger.cpp index cdc8469c..48bd4e3a 100644 --- a/bgfx/3rdparty/glslang/SPIRV/Logger.cpp +++ b/bgfx/3rdparty/glslang/SPIRV/Logger.cpp @@ -32,8 +32,6 @@ // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -#ifndef GLSLANG_WEB - #include "Logger.h" #include @@ -68,5 +66,3 @@ std::string SpvBuildLogger::getAllMessages() const { } } // end spv namespace - -#endif diff --git a/bgfx/3rdparty/glslang/SPIRV/Logger.h b/bgfx/3rdparty/glslang/SPIRV/Logger.h index 411367c0..2e4ddaf5 100644 --- a/bgfx/3rdparty/glslang/SPIRV/Logger.h +++ b/bgfx/3rdparty/glslang/SPIRV/Logger.h @@ -46,14 +46,6 @@ class SpvBuildLogger { public: SpvBuildLogger() {} -#ifdef GLSLANG_WEB - void tbdFunctionality(const std::string& f) { } - void missingFunctionality(const std::string& f) { } - void warning(const std::string& w) { } - void error(const std::string& e) { errors.push_back(e); } - std::string getAllMessages() { return ""; } -#else - // Registers a TBD functionality. void tbdFunctionality(const std::string& f); // Registers a missing functionality. @@ -67,7 +59,6 @@ class SpvBuildLogger { // Returns all messages accumulated in the order of: // TBD functionalities, missing functionalities, warnings, errors. std::string getAllMessages() const; -#endif private: SpvBuildLogger(const SpvBuildLogger&); diff --git a/bgfx/3rdparty/glslang/SPIRV/NonSemanticDebugPrintf.h b/bgfx/3rdparty/glslang/SPIRV/NonSemanticDebugPrintf.h index 83796d75..3ca7247f 100644 --- a/bgfx/3rdparty/glslang/SPIRV/NonSemanticDebugPrintf.h +++ b/bgfx/3rdparty/glslang/SPIRV/NonSemanticDebugPrintf.h @@ -1,5 +1,5 @@ // Copyright (c) 2020 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 @@ -7,15 +7,15 @@ // 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. @@ -23,7 +23,7 @@ // 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_NonSemanticDebugPrintf_H_ #define SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_ diff --git a/bgfx/3rdparty/glslang/SPIRV/NonSemanticShaderDebugInfo100.h b/bgfx/3rdparty/glslang/SPIRV/NonSemanticShaderDebugInfo100.h index c52f32f8..f74abcb6 100644 --- a/bgfx/3rdparty/glslang/SPIRV/NonSemanticShaderDebugInfo100.h +++ b/bgfx/3rdparty/glslang/SPIRV/NonSemanticShaderDebugInfo100.h @@ -1,19 +1,19 @@ // 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/ -// +// 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 diff --git a/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.cpp b/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.cpp index 6aca8cbc..f8f50a95 100644 --- a/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.cpp +++ b/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.cpp @@ -36,10 +36,6 @@ #include "SPVRemapper.h" #include "doc.h" -#if !defined (use_cpp11) -// ... not supported before C++11 -#else // defined (use_cpp11) - #include #include #include "../glslang/Include/Common.h" @@ -684,6 +680,7 @@ namespace spv { case spv::OperandKernelEnqueueFlags: case spv::OperandKernelProfilingInfo: case spv::OperandCapability: + case spv::OperandCooperativeMatrixOperands: ++word; break; @@ -1528,5 +1525,3 @@ namespace spv { } // namespace SPV -#endif // defined (use_cpp11) - diff --git a/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.h b/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.h index d2169463..42b01686 100644 --- a/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.h +++ b/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.h @@ -43,12 +43,6 @@ namespace spv { -// MSVC defines __cplusplus as an older value, even when it supports almost all of 11. -// We handle that here by making our own symbol. -#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700) -# define use_cpp11 1 -#endif - class spirvbin_base_t { public: @@ -74,27 +68,6 @@ class spirvbin_base_t } // namespace SPV -#if !defined (use_cpp11) -#include -#include - -namespace spv { -class spirvbin_t : public spirvbin_base_t -{ -public: - spirvbin_t(int /*verbose = 0*/) { } - - void remap(std::vector& /*spv*/, unsigned int /*opts = 0*/) - { - printf("Tool not compiled for C++11, which is required for SPIR-V remapping.\n"); - exit(5); - } -}; - -} // namespace SPV - -#else // defined (use_cpp11) - #include #include #include @@ -308,5 +281,4 @@ class spirvbin_t : public spirvbin_base_t } // namespace SPV -#endif // defined (use_cpp11) #endif // SPIRVREMAPPER_H diff --git a/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.cpp b/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.cpp index 7c5ea874..57e03d5d 100644 --- a/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.cpp +++ b/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.cpp @@ -46,10 +46,7 @@ #include #include "SpvBuilder.h" - -#ifndef GLSLANG_WEB #include "hex_float.h" -#endif #ifndef _WIN32 #include @@ -71,9 +68,9 @@ Builder::Builder(unsigned int spvVersion, unsigned int magicNumber, SpvBuildLogg addressModel(AddressingModelLogical), memoryModel(MemoryModelGLSL450), builderNumber(magicNumber), - buildPoint(0), + buildPoint(nullptr), uniqueId(0), - entryPointFunction(0), + entryPointFunction(nullptr), generatingOpCodeForSpecConst(false), logger(buildLogger) { @@ -144,6 +141,7 @@ void Builder::addLine(Id fileName, int lineNum, int column) void Builder::addDebugScopeAndLine(Id fileName, int lineNum, int column) { + assert(!currentDebugScopeId.empty()); if (currentDebugScopeId.top() != lastDebugScopeId) { spv::Id resultId = getUniqueId(); Instruction* scopeInst = new Instruction(resultId, makeVoidType(), OpExtInst); @@ -282,11 +280,6 @@ Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardP Id Builder::makeIntegerType(int width, bool hasSign) { -#ifdef GLSLANG_WEB - assert(width == 32); - width = 32; -#endif - // try to find it Instruction* type; for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) { @@ -328,11 +321,6 @@ Id Builder::makeIntegerType(int width, bool hasSign) Id Builder::makeFloatType(int width) { -#ifdef GLSLANG_WEB - assert(width == 32); - width = 32; -#endif - // try to find it Instruction* type; for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) { @@ -480,15 +468,41 @@ Id Builder::makeMatrixType(Id component, int cols, int rows) return type->getResultId(); } -Id Builder::makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols) +Id Builder::makeCooperativeMatrixTypeKHR(Id component, Id scope, Id rows, Id cols, Id use) { // try to find it Instruction* type; - for (int t = 0; t < (int)groupedTypes[OpTypeCooperativeMatrixNV].size(); ++t) { - type = groupedTypes[OpTypeCooperativeMatrixNV][t]; + for (int t = 0; t < (int)groupedTypes[OpTypeCooperativeMatrixKHR].size(); ++t) { + type = groupedTypes[OpTypeCooperativeMatrixKHR][t]; if (type->getIdOperand(0) == component && type->getIdOperand(1) == scope && type->getIdOperand(2) == rows && + type->getIdOperand(3) == cols && + type->getIdOperand(4) == use) + return type->getResultId(); + } + + // not found, make it + type = new Instruction(getUniqueId(), NoType, OpTypeCooperativeMatrixKHR); + type->addIdOperand(component); + type->addIdOperand(scope); + type->addIdOperand(rows); + type->addIdOperand(cols); + type->addIdOperand(use); + groupedTypes[OpTypeCooperativeMatrixKHR].push_back(type); + constantsTypesGlobals.push_back(std::unique_ptr(type)); + module.mapInstruction(type); + + return type->getResultId(); +} + +Id Builder::makeCooperativeMatrixTypeNV(Id component, Id scope, Id rows, Id cols) +{ + // try to find it + Instruction* type; + for (int t = 0; t < (int)groupedTypes[OpTypeCooperativeMatrixNV].size(); ++t) { + type = groupedTypes[OpTypeCooperativeMatrixNV][t]; + if (type->getIdOperand(0) == component && type->getIdOperand(1) == scope && type->getIdOperand(2) == rows && type->getIdOperand(3) == cols) return type->getResultId(); } @@ -506,6 +520,17 @@ Id Builder::makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols) return type->getResultId(); } +Id Builder::makeCooperativeMatrixTypeWithSameShape(Id component, Id otherType) +{ + Instruction* instr = module.getInstruction(otherType); + if (instr->getOpCode() == OpTypeCooperativeMatrixNV) { + return makeCooperativeMatrixTypeNV(component, instr->getIdOperand(1), instr->getIdOperand(2), instr->getIdOperand(3)); + } else { + assert(instr->getOpCode() == OpTypeCooperativeMatrixKHR); + return makeCooperativeMatrixTypeKHR(component, instr->getIdOperand(1), instr->getIdOperand(2), instr->getIdOperand(3), instr->getIdOperand(4)); + } +} + Id Builder::makeGenericType(spv::Op opcode, std::vector& operands) { // try to find it @@ -650,8 +675,12 @@ Id Builder::makeDebugFunctionType(Id returnType, const std::vector& paramTyp type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic)); type->addIdOperand(debugId[returnType]); for (auto const paramType : paramTypes) { - assert(isPointerType(paramType) || isArrayType(paramType)); - type->addIdOperand(debugId[getContainedTypeId(paramType)]); + if (isPointerType(paramType) || isArrayType(paramType)) { + type->addIdOperand(debugId[getContainedTypeId(paramType)]); + } + else { + type->addIdOperand(debugId[paramType]); + } } constantsTypesGlobals.push_back(std::unique_ptr(type)); module.mapInstruction(type); @@ -691,7 +720,6 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo constantsTypesGlobals.push_back(std::unique_ptr(type)); module.mapInstruction(type); -#ifndef GLSLANG_WEB // deal with capabilities switch (dim) { case DimBuffer: @@ -737,7 +765,6 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo addCapability(CapabilityImageMSArray); } } -#endif if (emitNonSemanticShaderDebugInfo) { @@ -929,7 +956,7 @@ Id Builder::makeArrayDebugType(Id const baseType, Id const componentCount) Id Builder::makeVectorDebugType(Id const baseType, int const componentCount) { - return makeSequentialDebugType(baseType, makeUintConstant(componentCount), NonSemanticShaderDebugInfo100DebugTypeVector);; + return makeSequentialDebugType(baseType, makeUintConstant(componentCount), NonSemanticShaderDebugInfo100DebugTypeVector); } Id Builder::makeMatrixDebugType(Id const vectorType, int const vectorCount, bool columnMajor) @@ -1067,6 +1094,12 @@ Id Builder::makeDebugCompilationUnit() { constantsTypesGlobals.push_back(std::unique_ptr(sourceInst)); module.mapInstruction(sourceInst); nonSemanticShaderCompilationUnitId = resultId; + + // We can reasonably assume that makeDebugCompilationUnit will be called before any of + // debug-scope stack. Function scopes and lexical scopes will occur afterward. + assert(currentDebugScopeId.empty()); + currentDebugScopeId.push(nonSemanticShaderCompilationUnitId); + return resultId; } @@ -1096,6 +1129,8 @@ Id Builder::createDebugGlobalVariable(Id const type, char const*const name, Id c Id Builder::createDebugLocalVariable(Id type, char const*const name, size_t const argNumber) { assert(name != nullptr); + assert(!currentDebugScopeId.empty()); + Instruction* inst = new Instruction(getUniqueId(), makeVoidType(), OpExtInst); inst->addIdOperand(nonSemanticShaderDebugInfo); inst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugLocalVariable); @@ -1146,7 +1181,6 @@ Id Builder::makeDebugDeclare(Id const debugLocalVariable, Id const localVariable return inst->getResultId(); } -#ifndef GLSLANG_WEB Id Builder::makeAccelerationStructureType() { Instruction *type; @@ -1176,7 +1210,21 @@ Id Builder::makeRayQueryType() return type->getResultId(); } -#endif + +Id Builder::makeHitObjectNVType() +{ + Instruction *type; + if (groupedTypes[OpTypeHitObjectNV].size() == 0) { + type = new Instruction(getUniqueId(), NoType, OpTypeHitObjectNV); + groupedTypes[OpTypeHitObjectNV].push_back(type); + constantsTypesGlobals.push_back(std::unique_ptr(type)); + module.mapInstruction(type); + } else { + type = groupedTypes[OpTypeHitObjectNV].back(); + } + + return type->getResultId(); +} Id Builder::getDerefTypeId(Id resultId) const { @@ -1226,6 +1274,7 @@ int Builder::getNumTypeConstituents(Id typeId) const } case OpTypeStruct: return instr->getNumOperands(); + case OpTypeCooperativeMatrixKHR: case OpTypeCooperativeMatrixNV: // has only one constituent when used with OpCompositeConstruct. return 1; @@ -1275,6 +1324,7 @@ Id Builder::getContainedTypeId(Id typeId, int member) const case OpTypeMatrix: case OpTypeArray: case OpTypeRuntimeArray: + case OpTypeCooperativeMatrixKHR: case OpTypeCooperativeMatrixNV: return instr->getIdOperand(0); case OpTypePointer: @@ -1345,7 +1395,7 @@ bool Builder::containsType(Id typeId, spv::Op typeOp, unsigned int width) const } // return true if the type is a pointer to PhysicalStorageBufferEXT or an -// array of such pointers. These require restrict/aliased decorations. +// contains such a pointer. These require restrict/aliased decorations. bool Builder::containsPhysicalStorageBufferOrArray(Id typeId) const { const Instruction& instr = *module.getInstruction(typeId); @@ -1357,6 +1407,12 @@ bool Builder::containsPhysicalStorageBufferOrArray(Id typeId) const return getTypeStorageClass(typeId) == StorageClassPhysicalStorageBufferEXT; case OpTypeArray: return containsPhysicalStorageBufferOrArray(getContainedTypeId(typeId)); + case OpTypeStruct: + for (int m = 0; m < instr.getNumOperands(); ++m) { + if (containsPhysicalStorageBufferOrArray(instr.getIdOperand(m))) + return true; + } + return false; default: return false; } @@ -1570,10 +1626,6 @@ Id Builder::makeFloatConstant(float f, bool specConstant) Id Builder::makeDoubleConstant(double d, bool specConstant) { -#ifdef GLSLANG_WEB - assert(0); - return NoResult; -#else Op opcode = specConstant ? OpSpecConstant : OpConstant; Id typeId = makeFloatType(64); union { double db; unsigned long long ull; } u; @@ -1598,15 +1650,10 @@ Id Builder::makeDoubleConstant(double d, bool specConstant) module.mapInstruction(c); return c->getResultId(); -#endif } Id Builder::makeFloat16Constant(float f16, bool specConstant) { -#ifdef GLSLANG_WEB - assert(0); - return NoResult; -#else Op opcode = specConstant ? OpSpecConstant : OpConstant; Id typeId = makeFloatType(16); @@ -1631,17 +1678,11 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant) module.mapInstruction(c); return c->getResultId(); -#endif } Id Builder::makeFpConstant(Id type, double d, bool specConstant) { -#ifdef GLSLANG_WEB - const int width = 32; - assert(width == getScalarTypeWidth(type)); -#else const int width = getScalarTypeWidth(type); -#endif assert(isFloatType(type)); @@ -1675,7 +1716,7 @@ Id Builder::importNonSemanticShaderDebugInfoInstructions() Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector& comps) { - Instruction* constant = 0; + Instruction* constant = nullptr; bool found = false; for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) { constant = groupedConstants[typeClass][i]; @@ -1702,7 +1743,7 @@ Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector Id Builder::findStructConstant(Id typeId, const std::vector& comps) { - Instruction* constant = 0; + Instruction* constant = nullptr; bool found = false; for (int i = 0; i < (int)groupedStructConstants[typeId].size(); ++i) { constant = groupedStructConstants[typeId][i]; @@ -1735,6 +1776,7 @@ Id Builder::makeCompositeConstant(Id typeId, const std::vector& members, boo case OpTypeVector: case OpTypeArray: case OpTypeMatrix: + case OpTypeCooperativeMatrixKHR: case OpTypeCooperativeMatrixNV: if (! specConstant) { Id existing = findCompositeConstant(typeClass, typeId, members); @@ -2047,11 +2089,16 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const assert(paramTypes.size() == paramNames.size()); for(size_t p = 0; p < paramTypes.size(); ++p) { - auto const& paramType = paramTypes[p]; - assert(isPointerType(paramType) || isArrayType(paramType)); - assert(debugId[getContainedTypeId(paramType)] != 0); + auto getParamTypeId = [this](Id const& typeId) { + if (isPointerType(typeId) || isArrayType(typeId)) { + return getContainedTypeId(typeId); + } + else { + return typeId; + } + }; auto const& paramName = paramNames[p]; - auto const debugLocalVariableId = createDebugLocalVariable(debugId[getContainedTypeId(paramType)], paramName, p+1); + auto const debugLocalVariableId = createDebugLocalVariable(debugId[getParamTypeId(paramTypes[p])], paramName, p+1); debugId[firstParamId + p] = debugLocalVariableId; makeDebugDeclare(debugLocalVariableId, firstParamId + p); @@ -2070,7 +2117,8 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const return function; } -Id Builder::makeDebugFunction(Function* function, Id nameId, Id funcTypeId) { +Id Builder::makeDebugFunction([[maybe_unused]] Function* function, Id nameId, Id funcTypeId) +{ assert(function != nullptr); assert(nameId != 0); assert(funcTypeId != 0); @@ -2095,6 +2143,8 @@ Id Builder::makeDebugFunction(Function* function, Id nameId, Id funcTypeId) { } Id Builder::makeDebugLexicalBlock(uint32_t line) { + assert(!currentDebugScopeId.empty()); + Id lexId = getUniqueId(); auto lex = new Instruction(lexId, makeVoidType(), OpExtInst); lex->addIdOperand(nonSemanticShaderDebugInfo); @@ -2363,7 +2413,24 @@ Id Builder::createArrayLength(Id base, unsigned int member) return length->getResultId(); } -Id Builder::createCooperativeMatrixLength(Id type) +Id Builder::createCooperativeMatrixLengthKHR(Id type) +{ + spv::Id intType = makeUintType(32); + + // Generate code for spec constants if in spec constant operation + // generation mode. + if (generatingOpCodeForSpecConst) { + return createSpecConstantOp(OpCooperativeMatrixLengthKHR, intType, std::vector(1, type), std::vector()); + } + + Instruction* length = new Instruction(getUniqueId(), intType, OpCooperativeMatrixLengthKHR); + length->addIdOperand(type); + buildPoint->addInstruction(std::unique_ptr(length)); + + return length->getResultId(); +} + +Id Builder::createCooperativeMatrixLengthNV(Id type) { spv::Id intType = makeUintType(32); @@ -2734,52 +2801,47 @@ Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, const Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, bool noImplicitLod, const TextureParameters& parameters, ImageOperandsMask signExtensionMask) { - static const int maxTextureArgs = 10; - Id texArgs[maxTextureArgs] = {}; + std::vector texArgs; // // Set up the fixed arguments // - int numArgs = 0; bool explicitLod = false; - texArgs[numArgs++] = parameters.sampler; - texArgs[numArgs++] = parameters.coords; + texArgs.push_back(parameters.sampler); + texArgs.push_back(parameters.coords); if (parameters.Dref != NoResult) - texArgs[numArgs++] = parameters.Dref; + texArgs.push_back(parameters.Dref); if (parameters.component != NoResult) - texArgs[numArgs++] = parameters.component; + texArgs.push_back(parameters.component); -#ifndef GLSLANG_WEB if (parameters.granularity != NoResult) - texArgs[numArgs++] = parameters.granularity; + texArgs.push_back(parameters.granularity); if (parameters.coarse != NoResult) - texArgs[numArgs++] = parameters.coarse; -#endif + texArgs.push_back(parameters.coarse); // // Set up the optional arguments // - int optArgNum = numArgs; // track which operand, if it exists, is the mask of optional arguments - ++numArgs; // speculatively make room for the mask operand + size_t optArgNum = texArgs.size(); // the position of the mask for the optional arguments, if any. ImageOperandsMask mask = ImageOperandsMaskNone; // the mask operand if (parameters.bias) { mask = (ImageOperandsMask)(mask | ImageOperandsBiasMask); - texArgs[numArgs++] = parameters.bias; + texArgs.push_back(parameters.bias); } if (parameters.lod) { mask = (ImageOperandsMask)(mask | ImageOperandsLodMask); - texArgs[numArgs++] = parameters.lod; + texArgs.push_back(parameters.lod); explicitLod = true; } else if (parameters.gradX) { mask = (ImageOperandsMask)(mask | ImageOperandsGradMask); - texArgs[numArgs++] = parameters.gradX; - texArgs[numArgs++] = parameters.gradY; + texArgs.push_back(parameters.gradX); + texArgs.push_back(parameters.gradY); explicitLod = true; } else if (noImplicitLod && ! fetch && ! gather) { // have to explicitly use lod of 0 if not allowed to have them be implicit, and // we would otherwise be about to issue an implicit instruction mask = (ImageOperandsMask)(mask | ImageOperandsLodMask); - texArgs[numArgs++] = makeFloatConstant(0.0); + texArgs.push_back(makeFloatConstant(0.0)); explicitLod = true; } if (parameters.offset) { @@ -2789,24 +2851,23 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, addCapability(CapabilityImageGatherExtended); mask = (ImageOperandsMask)(mask | ImageOperandsOffsetMask); } - texArgs[numArgs++] = parameters.offset; + texArgs.push_back(parameters.offset); } if (parameters.offsets) { addCapability(CapabilityImageGatherExtended); mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetsMask); - texArgs[numArgs++] = parameters.offsets; + texArgs.push_back(parameters.offsets); } -#ifndef GLSLANG_WEB if (parameters.sample) { mask = (ImageOperandsMask)(mask | ImageOperandsSampleMask); - texArgs[numArgs++] = parameters.sample; + texArgs.push_back(parameters.sample); } if (parameters.lodClamp) { // capability if this bit is used addCapability(CapabilityMinLod); mask = (ImageOperandsMask)(mask | ImageOperandsMinLodMask); - texArgs[numArgs++] = parameters.lodClamp; + texArgs.push_back(parameters.lodClamp); } if (parameters.nonprivate) { mask = mask | ImageOperandsNonPrivateTexelKHRMask; @@ -2814,12 +2875,10 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, if (parameters.volatil) { mask = mask | ImageOperandsVolatileTexelKHRMask; } -#endif mask = mask | signExtensionMask; - if (mask == ImageOperandsMaskNone) - --numArgs; // undo speculative reservation for the mask argument - else - texArgs[optArgNum] = mask; + // insert the operand for the mask, if any bits were set. + if (mask != ImageOperandsMaskNone) + texArgs.insert(texArgs.begin() + optArgNum, mask); // // Set up the instruction @@ -2830,7 +2889,6 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, opCode = OpImageSparseFetch; else opCode = OpImageFetch; -#ifndef GLSLANG_WEB } else if (parameters.granularity && parameters.coarse) { opCode = OpImageSampleFootprintNV; } else if (gather) { @@ -2844,7 +2902,6 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, opCode = OpImageSparseGather; else opCode = OpImageGather; -#endif } else if (explicitLod) { if (parameters.Dref) { if (proj) @@ -2923,11 +2980,11 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, // Build the SPIR-V instruction Instruction* textureInst = new Instruction(getUniqueId(), resultType, opCode); - for (int op = 0; op < optArgNum; ++op) + for (size_t op = 0; op < optArgNum; ++op) textureInst->addIdOperand(texArgs[op]); - if (optArgNum < numArgs) + if (optArgNum < texArgs.size()) textureInst->addImmediateOperand(texArgs[optArgNum]); - for (int op = optArgNum + 1; op < numArgs; ++op) + for (size_t op = optArgNum + 1; op < texArgs.size(); ++op) textureInst->addIdOperand(texArgs[op]); setPrecision(textureInst->getResultId(), precision); buildPoint->addInstruction(std::unique_ptr(textureInst)); @@ -3207,12 +3264,7 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector& int numRows = getTypeNumRows(resultTypeId); Instruction* instr = module.getInstruction(componentTypeId); -#ifdef GLSLANG_WEB - const unsigned bitCount = 32; - assert(bitCount == instr->getImmediateOperand(0)); -#else const unsigned bitCount = instr->getImmediateOperand(0); -#endif // Optimize matrix constructed from a bigger matrix if (isMatrix(sources[0]) && getNumColumns(sources[0]) >= numCols && getNumRows(sources[0]) >= numRows) { @@ -3332,7 +3384,7 @@ Builder::If::If(Id cond, unsigned int ctrl, Builder& gb) : builder(gb), condition(cond), control(ctrl), - elseBlock(0) + elseBlock(nullptr) { function = &builder.getBuildPoint()->getParent(); @@ -4033,4 +4085,4 @@ void Builder::dumpModuleProcesses(std::vector& out) const } } -}; // end spv namespace +} // end spv namespace diff --git a/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.h b/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.h index f7fdc6ad..79d2681f 100644 --- a/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.h +++ b/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.h @@ -103,7 +103,7 @@ class Builder { stringIds[file_c_str] = strId; return strId; } - spv::Id getSourceFile() const + spv::Id getSourceFile() const { return sourceFileStringId; } @@ -203,7 +203,9 @@ class Builder { Id makeImageType(Id sampledType, Dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format); Id makeSamplerType(); Id makeSampledImageType(Id imageType); - Id makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols); + 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 makeGenericType(spv::Op opcode, std::vector& operands); // SPIR-V NonSemantic Shader DebugInfo Instructions @@ -240,6 +242,8 @@ class Builder { Id makeAccelerationStructureType(); // rayQueryEXT type Id makeRayQueryType(); + // hitObjectNV type + Id makeHitObjectNVType(); // For querying about types. Id getTypeId(Id resultId) const { return module.getTypeId(resultId); } @@ -257,6 +261,7 @@ class Builder { ImageFormat getImageTypeFormat(Id typeId) const { return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); } Id getResultingAccessChainType() const; + Id getIdOperand(Id resultId, int idx) { return module.getInstruction(resultId)->getIdOperand(idx); } bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); } bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); } @@ -281,11 +286,10 @@ class Builder { bool isMatrixType(Id typeId) const { return getTypeClass(typeId) == OpTypeMatrix; } bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; } bool isArrayType(Id typeId) const { return getTypeClass(typeId) == OpTypeArray; } -#ifdef GLSLANG_WEB - bool isCooperativeMatrixType(Id typeId)const { return false; } -#else - bool isCooperativeMatrixType(Id typeId)const { return getTypeClass(typeId) == OpTypeCooperativeMatrixNV; } -#endif + bool isCooperativeMatrixType(Id typeId)const + { + return getTypeClass(typeId) == OpTypeCooperativeMatrixKHR || getTypeClass(typeId) == OpTypeCooperativeMatrixNV; + } bool isAggregateType(Id typeId) const { return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); } bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; } @@ -414,7 +418,7 @@ class Builder { // The returned pointer is only valid for the lifetime of this builder. Function* makeFunctionEntry(Decoration precision, Id returnType, const char* name, const std::vector& paramTypes, const std::vector& paramNames, - const std::vector>& precisions, Block **entry = 0); + const std::vector>& precisions, Block **entry = nullptr); // Create a return. An 'implicit' return is one not appearing in the source // code. In the case of an implicit return, no post-return block is inserted. @@ -462,8 +466,10 @@ class Builder { // Create an OpArrayLength instruction Id createArrayLength(Id base, unsigned int member); + // Create an OpCooperativeMatrixLengthKHR instruction + Id createCooperativeMatrixLengthKHR(Id type); // Create an OpCooperativeMatrixLengthNV instruction - Id createCooperativeMatrixLength(Id type); + Id createCooperativeMatrixLengthNV(Id type); // Create an OpCompositeExtract instruction Id createCompositeExtract(Id composite, Id typeId, unsigned index); @@ -698,11 +704,6 @@ class Builder { // Accumulate whether anything in the chain of structures has coherent decorations. struct CoherentFlags { CoherentFlags() { clear(); } -#ifdef GLSLANG_WEB - void clear() { } - bool isVolatile() const { return false; } - CoherentFlags operator |=(const CoherentFlags &other) { return *this; } -#else bool isVolatile() const { return volatil; } bool isNonUniform() const { return nonUniform; } bool anyCoherent() const { @@ -747,7 +748,6 @@ class Builder { nonUniform |= other.nonUniform; return *this; } -#endif }; CoherentFlags coherentFlags; }; @@ -833,14 +833,12 @@ class Builder { // Prune unreachable blocks in the CFG and remove unneeded decorations. void postProcessCFG(); -#ifndef GLSLANG_WEB // Add capabilities, extensions based on instructions in the module. void postProcessFeatures(); // Hook to visit each instruction in a block in a function void postProcess(Instruction&); // Hook to visit each non-32-bit sized float/int operation in a block. void postProcessType(const Instruction&, spv::Id typeId); -#endif void dump(std::vector&) const; diff --git a/bgfx/3rdparty/glslang/SPIRV/SpvPostProcess.cpp b/bgfx/3rdparty/glslang/SPIRV/SpvPostProcess.cpp index dd6dabce..50fb793b 100644 --- a/bgfx/3rdparty/glslang/SPIRV/SpvPostProcess.cpp +++ b/bgfx/3rdparty/glslang/SPIRV/SpvPostProcess.cpp @@ -52,11 +52,12 @@ namespace spv { #include "GLSL.ext.EXT.h" #include "GLSL.ext.AMD.h" #include "GLSL.ext.NV.h" + #include "GLSL.ext.ARM.h" + #include "GLSL.ext.QCOM.h" } namespace spv { -#ifndef GLSLANG_WEB // Hook to visit each operand type and result type of an instruction. // Will be called multiple times for one instruction, once for each typed // operand and the result. @@ -333,7 +334,6 @@ void Builder::postProcess(Instruction& inst) } } } -#endif // comment in header void Builder::postProcessCFG() @@ -394,7 +394,6 @@ void Builder::postProcessCFG() decorations.end()); } -#ifndef GLSLANG_WEB // comment in header void Builder::postProcessFeatures() { // Add per-instruction capabilities, extensions, etc., @@ -482,14 +481,11 @@ void Builder::postProcessFeatures() { } } } -#endif // comment in header void Builder::postProcess() { postProcessCFG(); -#ifndef GLSLANG_WEB postProcessFeatures(); -#endif } }; // end spv namespace diff --git a/bgfx/3rdparty/glslang/SPIRV/SpvTools.cpp b/bgfx/3rdparty/glslang/SPIRV/SpvTools.cpp index 8cc17cca..ff04f4f9 100644 --- a/bgfx/3rdparty/glslang/SPIRV/SpvTools.cpp +++ b/bgfx/3rdparty/glslang/SPIRV/SpvTools.cpp @@ -212,7 +212,7 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector optimizer.RegisterPass(spvtools::CreateInterpolateFixupPass()); if (options->optimizeSize) { optimizer.RegisterPass(spvtools::CreateRedundancyEliminationPass()); - optimizer.RegisterPass(spvtools::CreateEliminateDeadInputComponentsPass()); + optimizer.RegisterPass(spvtools::CreateEliminateDeadInputComponentsSafePass()); } optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass()); optimizer.RegisterPass(spvtools::CreateCFGCleanupPass()); @@ -223,6 +223,56 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions); } +bool SpirvToolsAnalyzeDeadOutputStores(spv_target_env target_env, std::vector& spirv, + std::unordered_set* live_locs, + std::unordered_set* live_builtins, + spv::SpvBuildLogger*) +{ + spvtools::Optimizer optimizer(target_env); + optimizer.SetMessageConsumer(OptimizerMesssageConsumer); + + optimizer.RegisterPass(spvtools::CreateAnalyzeLiveInputPass(live_locs, live_builtins)); + + spvtools::OptimizerOptions spvOptOptions; + optimizer.SetTargetEnv(target_env); + spvOptOptions.set_run_validator(false); + return optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions); +} + +void SpirvToolsEliminateDeadOutputStores(spv_target_env target_env, std::vector& spirv, + std::unordered_set* live_locs, + std::unordered_set* live_builtins, + spv::SpvBuildLogger*) +{ + spvtools::Optimizer optimizer(target_env); + optimizer.SetMessageConsumer(OptimizerMesssageConsumer); + + optimizer.RegisterPass(spvtools::CreateEliminateDeadOutputStoresPass(live_locs, live_builtins)); + optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass(false, true)); + optimizer.RegisterPass(spvtools::CreateEliminateDeadOutputComponentsPass()); + optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass(false, true)); + + spvtools::OptimizerOptions spvOptOptions; + optimizer.SetTargetEnv(target_env); + spvOptOptions.set_run_validator(false); + optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions); +} + +void SpirvToolsEliminateDeadInputComponents(spv_target_env target_env, std::vector& spirv, + spv::SpvBuildLogger*) +{ + spvtools::Optimizer optimizer(target_env); + optimizer.SetMessageConsumer(OptimizerMesssageConsumer); + + optimizer.RegisterPass(spvtools::CreateEliminateDeadInputComponentsPass()); + optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass()); + + spvtools::OptimizerOptions spvOptOptions; + optimizer.SetTargetEnv(target_env); + spvOptOptions.set_run_validator(false); + optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions); +} + // Apply the SPIRV-Tools optimizer to strip debug info from SPIR-V. This is implicitly done by // SpirvToolsTransform if spvOptions->stripDebugInfo is set, but can be called separately if // optimization is disabled. diff --git a/bgfx/3rdparty/glslang/SPIRV/SpvTools.h b/bgfx/3rdparty/glslang/SPIRV/SpvTools.h index 5386048a..6fc4e40b 100644 --- a/bgfx/3rdparty/glslang/SPIRV/SpvTools.h +++ b/bgfx/3rdparty/glslang/SPIRV/SpvTools.h @@ -65,6 +65,9 @@ struct SpvOptions { #if ENABLE_OPT +// Translate glslang's view of target versioning to what SPIRV-Tools uses. +spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger); + // Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment. void SpirvToolsDisassemble(std::ostream& out, const std::vector& spirv); @@ -80,6 +83,22 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector< void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector& spirv, spv::SpvBuildLogger*, const SpvOptions*); +// Apply the SPIRV-Tools EliminateDeadInputComponents pass to generated SPIR-V. Put result in |spirv|. +void SpirvToolsEliminateDeadInputComponents(spv_target_env target_env, std::vector& spirv, + spv::SpvBuildLogger*); + +// Apply the SPIRV-Tools AnalyzeDeadOutputStores pass to generated SPIR-V. Put result in |live_locs|. +// Return true if the result is valid. +bool SpirvToolsAnalyzeDeadOutputStores(spv_target_env target_env, std::vector& spirv, + std::unordered_set* live_locs, + std::unordered_set* live_builtins, spv::SpvBuildLogger*); + +// Apply the SPIRV-Tools EliminateDeadOutputStores and AggressiveDeadCodeElimination passes to generated SPIR-V using +// |live_locs|. Put result in |spirv|. +void SpirvToolsEliminateDeadOutputStores(spv_target_env target_env, std::vector& spirv, + std::unordered_set* live_locs, + std::unordered_set* live_builtins, spv::SpvBuildLogger*); + // Apply the SPIRV-Tools optimizer to strip debug info from SPIR-V. This is implicitly done by // SpirvToolsTransform if spvOptions->stripDebugInfo is set, but can be called separately if // optimization is disabled. diff --git a/bgfx/3rdparty/glslang/SPIRV/disassemble.cpp b/bgfx/3rdparty/glslang/SPIRV/disassemble.cpp index 74dd6054..c5e961cf 100644 --- a/bgfx/3rdparty/glslang/SPIRV/disassemble.cpp +++ b/bgfx/3rdparty/glslang/SPIRV/disassemble.cpp @@ -54,6 +54,9 @@ namespace spv { #include "GLSL.std.450.h" #include "GLSL.ext.AMD.h" #include "GLSL.ext.NV.h" + #include "GLSL.ext.ARM.h" + #include "NonSemanticShaderDebugInfo100.h" + #include "GLSL.ext.QCOM.h" } } const char* GlslStd450DebugNames[spv::GLSLstd450Count]; @@ -62,6 +65,7 @@ namespace spv { static const char* GLSLextAMDGetDebugNames(const char*, unsigned); static const char* GLSLextNVGetDebugNames(const char*, unsigned); +static const char* NonSemanticShaderDebugInfo100GetDebugNames(unsigned); static void Kill(std::ostream& out, const char* message) { @@ -76,6 +80,7 @@ enum ExtInstSet { GLSLextNVInst, OpenCLExtInst, NonSemanticDebugPrintfExtInst, + NonSemanticShaderDebugInfo100 }; // Container class for a single instance of a SPIR-V stream, with methods for disassembly. @@ -501,6 +506,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, extInstSet = OpenCLExtInst; } else if (strcmp("NonSemantic.DebugPrintf", name) == 0) { extInstSet = NonSemanticDebugPrintfExtInst; + } else if (strcmp("NonSemantic.Shader.DebugInfo.100", name) == 0) { + extInstSet = NonSemanticShaderDebugInfo100; } 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 || @@ -509,7 +516,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, } else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 || strcmp(spv::E_SPV_NV_geometry_shader_passthrough, name) == 0 || strcmp(spv::E_SPV_NV_viewport_array2, name) == 0 || - strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0 || + strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0 || strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 || strcmp(spv::E_SPV_NV_mesh_shader, name) == 0) { extInstSet = GLSLextNVInst; @@ -526,6 +533,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, out << "(" << GLSLextNVGetDebugNames(name, entrypoint) << ")"; } else if (extInstSet == NonSemanticDebugPrintfExtInst) { out << "(DebugPrintf)"; + } else if (extInstSet == NonSemanticShaderDebugInfo100) { + out << "(" << NonSemanticShaderDebugInfo100GetDebugNames(entrypoint) << ")"; } } break; @@ -749,6 +758,59 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint) return "Bad"; } +static const char* NonSemanticShaderDebugInfo100GetDebugNames(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"; + default: return "Bad"; + } + + return "Bad"; +} + void Disassemble(std::ostream& out, const std::vector& stream) { SpirvStream SpirvStream(out, stream); diff --git a/bgfx/3rdparty/glslang/SPIRV/doc.cpp b/bgfx/3rdparty/glslang/SPIRV/doc.cpp old mode 100644 new mode 100755 index b7fe3e74..417e6e08 --- a/bgfx/3rdparty/glslang/SPIRV/doc.cpp +++ b/bgfx/3rdparty/glslang/SPIRV/doc.cpp @@ -45,6 +45,7 @@ #include #include #include +#include namespace spv { extern "C" { @@ -53,6 +54,8 @@ namespace spv { #include "GLSL.ext.EXT.h" #include "GLSL.ext.AMD.h" #include "GLSL.ext.NV.h" + #include "GLSL.ext.ARM.h" + #include "GLSL.ext.QCOM.h" } } @@ -214,6 +217,10 @@ const char* ExecutionModeString(int mode) case ExecutionModeNoGlobalOffsetINTEL: return "NoGlobalOffsetINTEL"; case ExecutionModeNumSIMDWorkitemsINTEL: return "NumSIMDWorkitemsINTEL"; + case ExecutionModeNonCoherentColorAttachmentReadEXT: return "NonCoherentColorAttachmentReadEXT"; + case ExecutionModeNonCoherentDepthAttachmentReadEXT: return "NonCoherentDepthAttachmentReadEXT"; + case ExecutionModeNonCoherentStencilAttachmentReadEXT: return "NonCoherentStencilAttachmentReadEXT"; + case ExecutionModeCeiling: default: return "Bad"; } @@ -245,6 +252,8 @@ const char* StorageClassString(int StorageClass) case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT"; case StorageClassTaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT"; + case StorageClassHitObjectAttributeNV: return "HitObjectAttributeNV"; + case StorageClassTileImageEXT: return "TileImageEXT"; default: return "Bad"; } } @@ -303,7 +312,9 @@ const char* DecorationString(int decoration) case DecorationCeiling: default: return "Bad"; - case DecorationExplicitInterpAMD: return "ExplicitInterpAMD"; + case DecorationWeightTextureQCOM: return "DecorationWeightTextureQCOM"; + case DecorationBlockMatchTextureQCOM: return "DecorationBlockMatchTextureQCOM"; + case DecorationExplicitInterpAMD: return "ExplicitInterpAMD"; case DecorationOverrideCoverageNV: return "OverrideCoverageNV"; case DecorationPassthroughNV: return "PassthroughNV"; case DecorationViewportRelativeNV: return "ViewportRelativeNV"; @@ -311,7 +322,7 @@ const char* DecorationString(int decoration) case DecorationPerPrimitiveNV: return "PerPrimitiveNV"; case DecorationPerViewNV: return "PerViewNV"; case DecorationPerTaskNV: return "PerTaskNV"; - + case DecorationPerVertexKHR: return "PerVertexKHR"; case DecorationNonUniformEXT: return "DecorationNonUniformEXT"; @@ -319,6 +330,8 @@ const char* DecorationString(int decoration) case DecorationHlslSemanticGOOGLE: return "DecorationHlslSemanticGOOGLE"; case DecorationRestrictPointerEXT: return "DecorationRestrictPointerEXT"; case DecorationAliasedPointerEXT: return "DecorationAliasedPointerEXT"; + + case DecorationHitObjectShaderRecordBufferNV: return "DecorationHitObjectShaderRecordBufferNV"; } } @@ -400,6 +413,7 @@ const char* BuiltInString(int builtIn) case BuiltInRayTminKHR: return "RayTminKHR"; case BuiltInRayTmaxKHR: return "RayTmaxKHR"; case BuiltInCullMaskKHR: return "CullMaskKHR"; + case BuiltInHitTriangleVertexPositionsKHR: return "HitTriangleVertexPositionsKHR"; case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR"; case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR"; case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR"; @@ -439,6 +453,11 @@ const char* BuiltInString(int builtIn) case BuiltInPrimitiveLineIndicesEXT: return "PrimitiveLineIndicesEXT"; case BuiltInPrimitiveTriangleIndicesEXT: return "PrimitiveTriangleIndicesEXT"; case BuiltInCullPrimitiveEXT: return "CullPrimitiveEXT"; + case BuiltInCoreCountARM: return "CoreCountARM"; + case BuiltInCoreIDARM: return "CoreIDARM"; + case BuiltInCoreMaxIDARM: return "CoreMaxIDARM"; + case BuiltInWarpIDARM: return "WarpIDARM"; + case BuiltInWarpMaxIDARM: return "BuiltInWarpMaxIDARM"; default: return "Bad"; } @@ -454,6 +473,7 @@ const char* DimensionString(int dim) case 4: return "Rect"; case 5: return "Buffer"; case 6: return "SubpassData"; + case DimTileImageDataEXT: return "TileImageDataEXT"; default: return "Bad"; } @@ -568,7 +588,7 @@ const char* ImageChannelOrderString(int format) case 17: return "sRGBA"; case 18: return "sBGRA"; - default: + default: return "Bad"; } } @@ -773,6 +793,21 @@ const char* MemoryAccessString(int mem) } } +const int CooperativeMatrixOperandsCeiling = 6; + +const char* CooperativeMatrixOperandsString(int op) +{ + switch (op) { + case CooperativeMatrixOperandsMatrixASignedComponentsShift: return "ASignedComponents"; + case CooperativeMatrixOperandsMatrixBSignedComponentsShift: return "BSignedComponents"; + case CooperativeMatrixOperandsMatrixCSignedComponentsShift: return "CSignedComponents"; + case CooperativeMatrixOperandsMatrixResultSignedComponentsShift: return "ResultSignedComponents"; + case CooperativeMatrixOperandsSaturatingAccumulationShift: return "SaturatingAccumulation"; + + default: return "Bad"; + } +} + const char* ScopeString(int mem) { switch (mem) { @@ -854,7 +889,7 @@ const char* CapabilityString(int info) case 22: return "Int16"; case 23: return "TessellationPointSize"; case 24: return "GeometryPointSize"; - case 25: return "ImageGatherExtended"; + case 25: return "ImageGatherExtended"; case 26: return "Bad"; case 27: return "StorageImageMultisample"; case 28: return "UniformBufferArrayDynamicIndexing"; @@ -941,6 +976,8 @@ const char* CapabilityString(int info) case CapabilityRayQueryKHR: return "RayQueryKHR"; case CapabilityRayTracingProvisionalKHR: return "RayTracingProvisionalKHR"; case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR"; + case CapabilityRayTracingPositionFetchKHR: return "RayTracingPositionFetchKHR"; + case CapabilityRayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR"; case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV"; case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV"; case CapabilityFragmentBarycentricKHR: return "FragmentBarycentricKHR"; @@ -974,12 +1011,17 @@ const char* CapabilityString(int info) case CapabilityVariablePointers: return "VariablePointers"; case CapabilityCooperativeMatrixNV: return "CooperativeMatrixNV"; + case CapabilityCooperativeMatrixKHR: return "CooperativeMatrixKHR"; case CapabilityShaderSMBuiltinsNV: return "ShaderSMBuiltinsNV"; case CapabilityFragmentShaderSampleInterlockEXT: return "CapabilityFragmentShaderSampleInterlockEXT"; case CapabilityFragmentShaderPixelInterlockEXT: return "CapabilityFragmentShaderPixelInterlockEXT"; case CapabilityFragmentShaderShadingRateInterlockEXT: return "CapabilityFragmentShaderShadingRateInterlockEXT"; + case CapabilityTileImageColorReadAccessEXT: return "TileImageColorReadAccessEXT"; + case CapabilityTileImageDepthReadAccessEXT: return "TileImageDepthReadAccessEXT"; + case CapabilityTileImageStencilReadAccessEXT: return "TileImageStencilReadAccessEXT"; + case CapabilityFragmentShadingRateKHR: return "FragmentShadingRateKHR"; case CapabilityDemoteToHelperInvocationEXT: return "DemoteToHelperInvocationEXT"; @@ -998,6 +1040,13 @@ const char* CapabilityString(int info) case CapabilityWorkgroupMemoryExplicitLayoutKHR: return "CapabilityWorkgroupMemoryExplicitLayoutKHR"; case CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR"; case CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR"; + case CapabilityCoreBuiltinsARM: return "CoreBuiltinsARM"; + + case CapabilityShaderInvocationReorderNV: return "ShaderInvocationReorderNV"; + + case CapabilityTextureSampleWeightedQCOM: return "TextureSampleWeightedQCOM"; + case CapabilityTextureBoxFilterQCOM: return "TextureBoxFilterQCOM"; + case CapabilityTextureBlockMatchQCOM: return "TextureBlockMatchQCOM"; default: return "Bad"; } @@ -1441,18 +1490,67 @@ const char* OpcodeString(int op) case OpRayQueryGetWorldRayOriginKHR: return "OpRayQueryGetWorldRayOriginKHR"; case OpRayQueryGetIntersectionObjectToWorldKHR: return "OpRayQueryGetIntersectionObjectToWorldKHR"; case OpRayQueryGetIntersectionWorldToObjectKHR: return "OpRayQueryGetIntersectionWorldToObjectKHR"; + case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: return "OpRayQueryGetIntersectionTriangleVertexPositionsKHR"; case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV"; case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV"; case OpCooperativeMatrixStoreNV: return "OpCooperativeMatrixStoreNV"; case OpCooperativeMatrixMulAddNV: return "OpCooperativeMatrixMulAddNV"; case OpCooperativeMatrixLengthNV: return "OpCooperativeMatrixLengthNV"; + case OpTypeCooperativeMatrixKHR: return "OpTypeCooperativeMatrixKHR"; + case OpCooperativeMatrixLoadKHR: return "OpCooperativeMatrixLoadKHR"; + case OpCooperativeMatrixStoreKHR: return "OpCooperativeMatrixStoreKHR"; + case OpCooperativeMatrixMulAddKHR: return "OpCooperativeMatrixMulAddKHR"; + case OpCooperativeMatrixLengthKHR: return "OpCooperativeMatrixLengthKHR"; case OpDemoteToHelperInvocationEXT: return "OpDemoteToHelperInvocationEXT"; case OpIsHelperInvocationEXT: return "OpIsHelperInvocationEXT"; case OpBeginInvocationInterlockEXT: return "OpBeginInvocationInterlockEXT"; case OpEndInvocationInterlockEXT: return "OpEndInvocationInterlockEXT"; + case OpTypeHitObjectNV: return "OpTypeHitObjectNV"; + case OpHitObjectTraceRayNV: return "OpHitObjectTraceRayNV"; + case OpHitObjectTraceRayMotionNV: return "OpHitObjectTraceRayMotionNV"; + case OpHitObjectRecordHitNV: return "OpHitObjectRecordHitNV"; + case OpHitObjectRecordHitMotionNV: return "OpHitObjectRecordHitMotionNV"; + case OpHitObjectRecordHitWithIndexNV: return "OpHitObjectRecordHitWithIndexNV"; + case OpHitObjectRecordHitWithIndexMotionNV: return "OpHitObjectRecordHitWithIndexMotionNV"; + case OpHitObjectRecordMissNV: return "OpHitObjectRecordMissNV"; + case OpHitObjectRecordMissMotionNV: return "OpHitObjectRecordMissMotionNV"; + case OpHitObjectRecordEmptyNV: return "OpHitObjectRecordEmptyNV"; + case OpHitObjectExecuteShaderNV: return "OpHitObjectExecuteShaderNV"; + case OpReorderThreadWithHintNV: return "OpReorderThreadWithHintNV"; + case OpReorderThreadWithHitObjectNV: return "OpReorderThreadWithHitObjectNV"; + case OpHitObjectGetCurrentTimeNV: return "OpHitObjectGetCurrentTimeNV"; + case OpHitObjectGetAttributesNV: return "OpHitObjectGetAttributesNV"; + case OpHitObjectGetHitKindNV: return "OpHitObjectGetFrontFaceNV"; + case OpHitObjectGetPrimitiveIndexNV: return "OpHitObjectGetPrimitiveIndexNV"; + case OpHitObjectGetGeometryIndexNV: return "OpHitObjectGetGeometryIndexNV"; + case OpHitObjectGetInstanceIdNV: return "OpHitObjectGetInstanceIdNV"; + case OpHitObjectGetInstanceCustomIndexNV: return "OpHitObjectGetInstanceCustomIndexNV"; + case OpHitObjectGetObjectRayDirectionNV: return "OpHitObjectGetObjectRayDirectionNV"; + case OpHitObjectGetObjectRayOriginNV: return "OpHitObjectGetObjectRayOriginNV"; + case OpHitObjectGetWorldRayDirectionNV: return "OpHitObjectGetWorldRayDirectionNV"; + case OpHitObjectGetWorldRayOriginNV: return "OpHitObjectGetWorldRayOriginNV"; + case OpHitObjectGetWorldToObjectNV: return "OpHitObjectGetWorldToObjectNV"; + case OpHitObjectGetObjectToWorldNV: return "OpHitObjectGetObjectToWorldNV"; + case OpHitObjectGetRayTMaxNV: return "OpHitObjectGetRayTMaxNV"; + case OpHitObjectGetRayTMinNV: return "OpHitObjectGetRayTMinNV"; + case OpHitObjectIsEmptyNV: return "OpHitObjectIsEmptyNV"; + case OpHitObjectIsHitNV: return "OpHitObjectIsHitNV"; + case OpHitObjectIsMissNV: return "OpHitObjectIsMissNV"; + case OpHitObjectGetShaderBindingTableRecordIndexNV: return "OpHitObjectGetShaderBindingTableRecordIndexNV"; + case OpHitObjectGetShaderRecordBufferHandleNV: return "OpHitObjectGetShaderRecordBufferHandleNV"; + + case OpColorAttachmentReadEXT: return "OpColorAttachmentReadEXT"; + case OpDepthAttachmentReadEXT: return "OpDepthAttachmentReadEXT"; + case OpStencilAttachmentReadEXT: return "OpStencilAttachmentReadEXT"; + + case OpImageSampleWeightedQCOM: return "OpImageSampleWeightedQCOM"; + case OpImageBoxFilterQCOM: return "OpImageBoxFilterQCOM"; + case OpImageBlockMatchSADQCOM: return "OpImageBlockMatchSADQCOM"; + case OpImageBlockMatchSSDQCOM: return "OpImageBlockMatchSSDQCOM"; + default: return "Bad"; } @@ -1472,1564 +1570,1817 @@ EnumParameters LoopControlParams[FunctionControlCeiling]; EnumParameters SelectionControlParams[SelectControlCeiling]; EnumParameters FunctionControlParams[FunctionControlCeiling]; EnumParameters MemoryAccessParams[MemoryAccessCeiling]; +EnumParameters CooperativeMatrixOperandsParams[CooperativeMatrixOperandsCeiling]; // Set up all the parameterizing descriptions of the opcodes, operands, etc. void Parameterize() { // only do this once. - static bool initialized = false; - if (initialized) - return; - initialized = true; - - // Exceptions to having a result and a resulting type . - // (Everything is initialized to have both). - - InstructionDesc[OpNop].setResultAndType(false, false); - InstructionDesc[OpSource].setResultAndType(false, false); - InstructionDesc[OpSourceContinued].setResultAndType(false, false); - InstructionDesc[OpSourceExtension].setResultAndType(false, false); - InstructionDesc[OpExtension].setResultAndType(false, false); - InstructionDesc[OpExtInstImport].setResultAndType(true, false); - InstructionDesc[OpCapability].setResultAndType(false, false); - InstructionDesc[OpMemoryModel].setResultAndType(false, false); - InstructionDesc[OpEntryPoint].setResultAndType(false, false); - InstructionDesc[OpExecutionMode].setResultAndType(false, false); - InstructionDesc[OpExecutionModeId].setResultAndType(false, false); - InstructionDesc[OpTypeVoid].setResultAndType(true, false); - InstructionDesc[OpTypeBool].setResultAndType(true, false); - InstructionDesc[OpTypeInt].setResultAndType(true, false); - InstructionDesc[OpTypeFloat].setResultAndType(true, false); - InstructionDesc[OpTypeVector].setResultAndType(true, false); - InstructionDesc[OpTypeMatrix].setResultAndType(true, false); - InstructionDesc[OpTypeImage].setResultAndType(true, false); - InstructionDesc[OpTypeSampler].setResultAndType(true, false); - InstructionDesc[OpTypeSampledImage].setResultAndType(true, false); - InstructionDesc[OpTypeArray].setResultAndType(true, false); - InstructionDesc[OpTypeRuntimeArray].setResultAndType(true, false); - InstructionDesc[OpTypeStruct].setResultAndType(true, false); - InstructionDesc[OpTypeOpaque].setResultAndType(true, false); - InstructionDesc[OpTypePointer].setResultAndType(true, false); - InstructionDesc[OpTypeForwardPointer].setResultAndType(false, false); - InstructionDesc[OpTypeFunction].setResultAndType(true, false); - InstructionDesc[OpTypeEvent].setResultAndType(true, false); - InstructionDesc[OpTypeDeviceEvent].setResultAndType(true, false); - InstructionDesc[OpTypeReserveId].setResultAndType(true, false); - InstructionDesc[OpTypeQueue].setResultAndType(true, false); - InstructionDesc[OpTypePipe].setResultAndType(true, false); - InstructionDesc[OpFunctionEnd].setResultAndType(false, false); - InstructionDesc[OpStore].setResultAndType(false, false); - InstructionDesc[OpImageWrite].setResultAndType(false, false); - InstructionDesc[OpDecorationGroup].setResultAndType(true, false); - InstructionDesc[OpDecorate].setResultAndType(false, false); - InstructionDesc[OpDecorateId].setResultAndType(false, false); - InstructionDesc[OpDecorateStringGOOGLE].setResultAndType(false, false); - InstructionDesc[OpMemberDecorate].setResultAndType(false, false); - InstructionDesc[OpMemberDecorateStringGOOGLE].setResultAndType(false, false); - InstructionDesc[OpGroupDecorate].setResultAndType(false, false); - InstructionDesc[OpGroupMemberDecorate].setResultAndType(false, false); - InstructionDesc[OpName].setResultAndType(false, false); - InstructionDesc[OpMemberName].setResultAndType(false, false); - InstructionDesc[OpString].setResultAndType(true, false); - InstructionDesc[OpLine].setResultAndType(false, false); - InstructionDesc[OpNoLine].setResultAndType(false, false); - InstructionDesc[OpCopyMemory].setResultAndType(false, false); - InstructionDesc[OpCopyMemorySized].setResultAndType(false, false); - InstructionDesc[OpEmitVertex].setResultAndType(false, false); - InstructionDesc[OpEndPrimitive].setResultAndType(false, false); - InstructionDesc[OpEmitStreamVertex].setResultAndType(false, false); - InstructionDesc[OpEndStreamPrimitive].setResultAndType(false, false); - InstructionDesc[OpControlBarrier].setResultAndType(false, false); - InstructionDesc[OpMemoryBarrier].setResultAndType(false, false); - InstructionDesc[OpAtomicStore].setResultAndType(false, false); - InstructionDesc[OpLoopMerge].setResultAndType(false, false); - InstructionDesc[OpSelectionMerge].setResultAndType(false, false); - InstructionDesc[OpLabel].setResultAndType(true, false); - InstructionDesc[OpBranch].setResultAndType(false, false); - InstructionDesc[OpBranchConditional].setResultAndType(false, false); - InstructionDesc[OpSwitch].setResultAndType(false, false); - InstructionDesc[OpKill].setResultAndType(false, false); - InstructionDesc[OpTerminateInvocation].setResultAndType(false, false); - InstructionDesc[OpReturn].setResultAndType(false, false); - InstructionDesc[OpReturnValue].setResultAndType(false, false); - InstructionDesc[OpUnreachable].setResultAndType(false, false); - InstructionDesc[OpLifetimeStart].setResultAndType(false, false); - InstructionDesc[OpLifetimeStop].setResultAndType(false, false); - InstructionDesc[OpCommitReadPipe].setResultAndType(false, false); - InstructionDesc[OpCommitWritePipe].setResultAndType(false, false); - InstructionDesc[OpGroupCommitWritePipe].setResultAndType(false, false); - InstructionDesc[OpGroupCommitReadPipe].setResultAndType(false, false); - InstructionDesc[OpCaptureEventProfilingInfo].setResultAndType(false, false); - InstructionDesc[OpSetUserEventStatus].setResultAndType(false, false); - InstructionDesc[OpRetainEvent].setResultAndType(false, false); - InstructionDesc[OpReleaseEvent].setResultAndType(false, false); - InstructionDesc[OpGroupWaitEvents].setResultAndType(false, false); - InstructionDesc[OpAtomicFlagClear].setResultAndType(false, false); - InstructionDesc[OpModuleProcessed].setResultAndType(false, false); - InstructionDesc[OpTypeCooperativeMatrixNV].setResultAndType(true, false); - InstructionDesc[OpCooperativeMatrixStoreNV].setResultAndType(false, false); - InstructionDesc[OpBeginInvocationInterlockEXT].setResultAndType(false, false); - InstructionDesc[OpEndInvocationInterlockEXT].setResultAndType(false, false); - - // Specific additional context-dependent operands - - ExecutionModeOperands[ExecutionModeInvocations].push(OperandLiteralNumber, "'Number of <>'"); - - ExecutionModeOperands[ExecutionModeLocalSize].push(OperandLiteralNumber, "'x size'"); - ExecutionModeOperands[ExecutionModeLocalSize].push(OperandLiteralNumber, "'y size'"); - ExecutionModeOperands[ExecutionModeLocalSize].push(OperandLiteralNumber, "'z size'"); - - ExecutionModeOperands[ExecutionModeLocalSizeHint].push(OperandLiteralNumber, "'x size'"); - ExecutionModeOperands[ExecutionModeLocalSizeHint].push(OperandLiteralNumber, "'y size'"); - ExecutionModeOperands[ExecutionModeLocalSizeHint].push(OperandLiteralNumber, "'z size'"); - - ExecutionModeOperands[ExecutionModeOutputVertices].push(OperandLiteralNumber, "'Vertex count'"); - ExecutionModeOperands[ExecutionModeVecTypeHint].push(OperandLiteralNumber, "'Vector type'"); - - DecorationOperands[DecorationStream].push(OperandLiteralNumber, "'Stream Number'"); - DecorationOperands[DecorationLocation].push(OperandLiteralNumber, "'Location'"); - DecorationOperands[DecorationComponent].push(OperandLiteralNumber, "'Component'"); - DecorationOperands[DecorationIndex].push(OperandLiteralNumber, "'Index'"); - DecorationOperands[DecorationBinding].push(OperandLiteralNumber, "'Binding Point'"); - DecorationOperands[DecorationDescriptorSet].push(OperandLiteralNumber, "'Descriptor Set'"); - DecorationOperands[DecorationOffset].push(OperandLiteralNumber, "'Byte Offset'"); - DecorationOperands[DecorationXfbBuffer].push(OperandLiteralNumber, "'XFB Buffer Number'"); - DecorationOperands[DecorationXfbStride].push(OperandLiteralNumber, "'XFB Stride'"); - DecorationOperands[DecorationArrayStride].push(OperandLiteralNumber, "'Array Stride'"); - DecorationOperands[DecorationMatrixStride].push(OperandLiteralNumber, "'Matrix Stride'"); - DecorationOperands[DecorationBuiltIn].push(OperandLiteralNumber, "See <>"); - DecorationOperands[DecorationFPRoundingMode].push(OperandFPRoundingMode, "'Floating-Point Rounding Mode'"); - DecorationOperands[DecorationFPFastMathMode].push(OperandFPFastMath, "'Fast-Math Mode'"); - DecorationOperands[DecorationLinkageAttributes].push(OperandLiteralString, "'Name'"); - DecorationOperands[DecorationLinkageAttributes].push(OperandLinkageType, "'Linkage Type'"); - DecorationOperands[DecorationFuncParamAttr].push(OperandFuncParamAttr, "'Function Parameter Attribute'"); - DecorationOperands[DecorationSpecId].push(OperandLiteralNumber, "'Specialization Constant ID'"); - DecorationOperands[DecorationInputAttachmentIndex].push(OperandLiteralNumber, "'Attachment Index'"); - DecorationOperands[DecorationAlignment].push(OperandLiteralNumber, "'Alignment'"); - - OperandClassParams[OperandSource].set(0, SourceString, 0); - OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, nullptr); - OperandClassParams[OperandAddressing].set(0, AddressingString, nullptr); - OperandClassParams[OperandMemory].set(0, MemoryString, nullptr); - OperandClassParams[OperandExecutionMode].set(ExecutionModeCeiling, ExecutionModeString, ExecutionModeParams); - OperandClassParams[OperandExecutionMode].setOperands(ExecutionModeOperands); - OperandClassParams[OperandStorage].set(0, StorageClassString, nullptr); - OperandClassParams[OperandDimensionality].set(0, DimensionString, nullptr); - OperandClassParams[OperandSamplerAddressingMode].set(0, SamplerAddressingModeString, nullptr); - OperandClassParams[OperandSamplerFilterMode].set(0, SamplerFilterModeString, nullptr); - OperandClassParams[OperandSamplerImageFormat].set(0, ImageFormatString, nullptr); - OperandClassParams[OperandImageChannelOrder].set(0, ImageChannelOrderString, nullptr); - OperandClassParams[OperandImageChannelDataType].set(0, ImageChannelDataTypeString, nullptr); - OperandClassParams[OperandImageOperands].set(ImageOperandsCeiling, ImageOperandsString, ImageOperandsParams, true); - OperandClassParams[OperandFPFastMath].set(0, FPFastMathString, nullptr, true); - OperandClassParams[OperandFPRoundingMode].set(0, FPRoundingModeString, nullptr); - OperandClassParams[OperandLinkageType].set(0, LinkageTypeString, nullptr); - OperandClassParams[OperandFuncParamAttr].set(0, FuncParamAttrString, nullptr); - OperandClassParams[OperandAccessQualifier].set(0, AccessQualifierString, nullptr); - OperandClassParams[OperandDecoration].set(DecorationCeiling, DecorationString, DecorationParams); - OperandClassParams[OperandDecoration].setOperands(DecorationOperands); - OperandClassParams[OperandBuiltIn].set(0, BuiltInString, nullptr); - OperandClassParams[OperandSelect].set(SelectControlCeiling, SelectControlString, SelectionControlParams, true); - OperandClassParams[OperandLoop].set(LoopControlCeiling, LoopControlString, LoopControlParams, true); - OperandClassParams[OperandFunction].set(FunctionControlCeiling, FunctionControlString, FunctionControlParams, true); - OperandClassParams[OperandMemorySemantics].set(0, MemorySemanticsString, nullptr, true); - OperandClassParams[OperandMemoryAccess].set(MemoryAccessCeiling, MemoryAccessString, MemoryAccessParams, true); - OperandClassParams[OperandScope].set(0, ScopeString, nullptr); - OperandClassParams[OperandGroupOperation].set(0, GroupOperationString, nullptr); - OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, nullptr); - OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, nullptr, true); - OperandClassParams[OperandCapability].set(0, CapabilityString, nullptr); - OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, 0); - - // set name of operator, an initial set of style operands, and the description - - InstructionDesc[OpSource].operands.push(OperandSource, ""); - InstructionDesc[OpSource].operands.push(OperandLiteralNumber, "'Version'"); - InstructionDesc[OpSource].operands.push(OperandId, "'File'", true); - InstructionDesc[OpSource].operands.push(OperandLiteralString, "'Source'", true); - - InstructionDesc[OpSourceContinued].operands.push(OperandLiteralString, "'Continued Source'"); - - InstructionDesc[OpSourceExtension].operands.push(OperandLiteralString, "'Extension'"); - - InstructionDesc[OpName].operands.push(OperandId, "'Target'"); - InstructionDesc[OpName].operands.push(OperandLiteralString, "'Name'"); - - InstructionDesc[OpMemberName].operands.push(OperandId, "'Type'"); - InstructionDesc[OpMemberName].operands.push(OperandLiteralNumber, "'Member'"); - InstructionDesc[OpMemberName].operands.push(OperandLiteralString, "'Name'"); - - InstructionDesc[OpString].operands.push(OperandLiteralString, "'String'"); - - InstructionDesc[OpLine].operands.push(OperandId, "'File'"); - InstructionDesc[OpLine].operands.push(OperandLiteralNumber, "'Line'"); - InstructionDesc[OpLine].operands.push(OperandLiteralNumber, "'Column'"); - - InstructionDesc[OpExtension].operands.push(OperandLiteralString, "'Name'"); - - InstructionDesc[OpExtInstImport].operands.push(OperandLiteralString, "'Name'"); - - InstructionDesc[OpCapability].operands.push(OperandCapability, "'Capability'"); + static std::once_flag initialized; + std::call_once(initialized, [](){ + + // Exceptions to having a result and a resulting type . + // (Everything is initialized to have both). + + InstructionDesc[OpNop].setResultAndType(false, false); + InstructionDesc[OpSource].setResultAndType(false, false); + InstructionDesc[OpSourceContinued].setResultAndType(false, false); + InstructionDesc[OpSourceExtension].setResultAndType(false, false); + InstructionDesc[OpExtension].setResultAndType(false, false); + InstructionDesc[OpExtInstImport].setResultAndType(true, false); + InstructionDesc[OpCapability].setResultAndType(false, false); + InstructionDesc[OpMemoryModel].setResultAndType(false, false); + InstructionDesc[OpEntryPoint].setResultAndType(false, false); + InstructionDesc[OpExecutionMode].setResultAndType(false, false); + InstructionDesc[OpExecutionModeId].setResultAndType(false, false); + InstructionDesc[OpTypeVoid].setResultAndType(true, false); + InstructionDesc[OpTypeBool].setResultAndType(true, false); + InstructionDesc[OpTypeInt].setResultAndType(true, false); + InstructionDesc[OpTypeFloat].setResultAndType(true, false); + InstructionDesc[OpTypeVector].setResultAndType(true, false); + InstructionDesc[OpTypeMatrix].setResultAndType(true, false); + InstructionDesc[OpTypeImage].setResultAndType(true, false); + InstructionDesc[OpTypeSampler].setResultAndType(true, false); + InstructionDesc[OpTypeSampledImage].setResultAndType(true, false); + InstructionDesc[OpTypeArray].setResultAndType(true, false); + InstructionDesc[OpTypeRuntimeArray].setResultAndType(true, false); + InstructionDesc[OpTypeStruct].setResultAndType(true, false); + InstructionDesc[OpTypeOpaque].setResultAndType(true, false); + InstructionDesc[OpTypePointer].setResultAndType(true, false); + InstructionDesc[OpTypeForwardPointer].setResultAndType(false, false); + InstructionDesc[OpTypeFunction].setResultAndType(true, false); + InstructionDesc[OpTypeEvent].setResultAndType(true, false); + InstructionDesc[OpTypeDeviceEvent].setResultAndType(true, false); + InstructionDesc[OpTypeReserveId].setResultAndType(true, false); + InstructionDesc[OpTypeQueue].setResultAndType(true, false); + InstructionDesc[OpTypePipe].setResultAndType(true, false); + InstructionDesc[OpFunctionEnd].setResultAndType(false, false); + InstructionDesc[OpStore].setResultAndType(false, false); + InstructionDesc[OpImageWrite].setResultAndType(false, false); + InstructionDesc[OpDecorationGroup].setResultAndType(true, false); + InstructionDesc[OpDecorate].setResultAndType(false, false); + InstructionDesc[OpDecorateId].setResultAndType(false, false); + InstructionDesc[OpDecorateStringGOOGLE].setResultAndType(false, false); + InstructionDesc[OpMemberDecorate].setResultAndType(false, false); + InstructionDesc[OpMemberDecorateStringGOOGLE].setResultAndType(false, false); + InstructionDesc[OpGroupDecorate].setResultAndType(false, false); + InstructionDesc[OpGroupMemberDecorate].setResultAndType(false, false); + InstructionDesc[OpName].setResultAndType(false, false); + InstructionDesc[OpMemberName].setResultAndType(false, false); + InstructionDesc[OpString].setResultAndType(true, false); + InstructionDesc[OpLine].setResultAndType(false, false); + InstructionDesc[OpNoLine].setResultAndType(false, false); + InstructionDesc[OpCopyMemory].setResultAndType(false, false); + InstructionDesc[OpCopyMemorySized].setResultAndType(false, false); + InstructionDesc[OpEmitVertex].setResultAndType(false, false); + InstructionDesc[OpEndPrimitive].setResultAndType(false, false); + InstructionDesc[OpEmitStreamVertex].setResultAndType(false, false); + InstructionDesc[OpEndStreamPrimitive].setResultAndType(false, false); + InstructionDesc[OpControlBarrier].setResultAndType(false, false); + InstructionDesc[OpMemoryBarrier].setResultAndType(false, false); + InstructionDesc[OpAtomicStore].setResultAndType(false, false); + InstructionDesc[OpLoopMerge].setResultAndType(false, false); + InstructionDesc[OpSelectionMerge].setResultAndType(false, false); + InstructionDesc[OpLabel].setResultAndType(true, false); + InstructionDesc[OpBranch].setResultAndType(false, false); + InstructionDesc[OpBranchConditional].setResultAndType(false, false); + InstructionDesc[OpSwitch].setResultAndType(false, false); + InstructionDesc[OpKill].setResultAndType(false, false); + InstructionDesc[OpTerminateInvocation].setResultAndType(false, false); + InstructionDesc[OpReturn].setResultAndType(false, false); + InstructionDesc[OpReturnValue].setResultAndType(false, false); + InstructionDesc[OpUnreachable].setResultAndType(false, false); + InstructionDesc[OpLifetimeStart].setResultAndType(false, false); + InstructionDesc[OpLifetimeStop].setResultAndType(false, false); + InstructionDesc[OpCommitReadPipe].setResultAndType(false, false); + InstructionDesc[OpCommitWritePipe].setResultAndType(false, false); + InstructionDesc[OpGroupCommitWritePipe].setResultAndType(false, false); + InstructionDesc[OpGroupCommitReadPipe].setResultAndType(false, false); + InstructionDesc[OpCaptureEventProfilingInfo].setResultAndType(false, false); + InstructionDesc[OpSetUserEventStatus].setResultAndType(false, false); + InstructionDesc[OpRetainEvent].setResultAndType(false, false); + InstructionDesc[OpReleaseEvent].setResultAndType(false, false); + InstructionDesc[OpGroupWaitEvents].setResultAndType(false, false); + InstructionDesc[OpAtomicFlagClear].setResultAndType(false, false); + InstructionDesc[OpModuleProcessed].setResultAndType(false, false); + InstructionDesc[OpTypeCooperativeMatrixNV].setResultAndType(true, false); + InstructionDesc[OpCooperativeMatrixStoreNV].setResultAndType(false, false); + InstructionDesc[OpTypeCooperativeMatrixKHR].setResultAndType(true, false); + InstructionDesc[OpCooperativeMatrixStoreKHR].setResultAndType(false, false); + InstructionDesc[OpBeginInvocationInterlockEXT].setResultAndType(false, false); + InstructionDesc[OpEndInvocationInterlockEXT].setResultAndType(false, false); + + // Specific additional context-dependent operands + + ExecutionModeOperands[ExecutionModeInvocations].push(OperandLiteralNumber, "'Number of <>'"); + + ExecutionModeOperands[ExecutionModeLocalSize].push(OperandLiteralNumber, "'x size'"); + ExecutionModeOperands[ExecutionModeLocalSize].push(OperandLiteralNumber, "'y size'"); + ExecutionModeOperands[ExecutionModeLocalSize].push(OperandLiteralNumber, "'z size'"); + + ExecutionModeOperands[ExecutionModeLocalSizeHint].push(OperandLiteralNumber, "'x size'"); + ExecutionModeOperands[ExecutionModeLocalSizeHint].push(OperandLiteralNumber, "'y size'"); + ExecutionModeOperands[ExecutionModeLocalSizeHint].push(OperandLiteralNumber, "'z size'"); + + ExecutionModeOperands[ExecutionModeOutputVertices].push(OperandLiteralNumber, "'Vertex count'"); + ExecutionModeOperands[ExecutionModeVecTypeHint].push(OperandLiteralNumber, "'Vector type'"); + + DecorationOperands[DecorationStream].push(OperandLiteralNumber, "'Stream Number'"); + DecorationOperands[DecorationLocation].push(OperandLiteralNumber, "'Location'"); + DecorationOperands[DecorationComponent].push(OperandLiteralNumber, "'Component'"); + DecorationOperands[DecorationIndex].push(OperandLiteralNumber, "'Index'"); + DecorationOperands[DecorationBinding].push(OperandLiteralNumber, "'Binding Point'"); + DecorationOperands[DecorationDescriptorSet].push(OperandLiteralNumber, "'Descriptor Set'"); + DecorationOperands[DecorationOffset].push(OperandLiteralNumber, "'Byte Offset'"); + DecorationOperands[DecorationXfbBuffer].push(OperandLiteralNumber, "'XFB Buffer Number'"); + DecorationOperands[DecorationXfbStride].push(OperandLiteralNumber, "'XFB Stride'"); + DecorationOperands[DecorationArrayStride].push(OperandLiteralNumber, "'Array Stride'"); + DecorationOperands[DecorationMatrixStride].push(OperandLiteralNumber, "'Matrix Stride'"); + DecorationOperands[DecorationBuiltIn].push(OperandLiteralNumber, "See <>"); + DecorationOperands[DecorationFPRoundingMode].push(OperandFPRoundingMode, "'Floating-Point Rounding Mode'"); + DecorationOperands[DecorationFPFastMathMode].push(OperandFPFastMath, "'Fast-Math Mode'"); + DecorationOperands[DecorationLinkageAttributes].push(OperandLiteralString, "'Name'"); + DecorationOperands[DecorationLinkageAttributes].push(OperandLinkageType, "'Linkage Type'"); + DecorationOperands[DecorationFuncParamAttr].push(OperandFuncParamAttr, "'Function Parameter Attribute'"); + DecorationOperands[DecorationSpecId].push(OperandLiteralNumber, "'Specialization Constant ID'"); + DecorationOperands[DecorationInputAttachmentIndex].push(OperandLiteralNumber, "'Attachment Index'"); + DecorationOperands[DecorationAlignment].push(OperandLiteralNumber, "'Alignment'"); + + OperandClassParams[OperandSource].set(0, SourceString, nullptr); + OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, nullptr); + OperandClassParams[OperandAddressing].set(0, AddressingString, nullptr); + OperandClassParams[OperandMemory].set(0, MemoryString, nullptr); + OperandClassParams[OperandExecutionMode].set(ExecutionModeCeiling, ExecutionModeString, ExecutionModeParams); + OperandClassParams[OperandExecutionMode].setOperands(ExecutionModeOperands); + OperandClassParams[OperandStorage].set(0, StorageClassString, nullptr); + OperandClassParams[OperandDimensionality].set(0, DimensionString, nullptr); + OperandClassParams[OperandSamplerAddressingMode].set(0, SamplerAddressingModeString, nullptr); + OperandClassParams[OperandSamplerFilterMode].set(0, SamplerFilterModeString, nullptr); + OperandClassParams[OperandSamplerImageFormat].set(0, ImageFormatString, nullptr); + OperandClassParams[OperandImageChannelOrder].set(0, ImageChannelOrderString, nullptr); + OperandClassParams[OperandImageChannelDataType].set(0, ImageChannelDataTypeString, nullptr); + OperandClassParams[OperandImageOperands].set(ImageOperandsCeiling, ImageOperandsString, ImageOperandsParams, true); + OperandClassParams[OperandFPFastMath].set(0, FPFastMathString, nullptr, true); + OperandClassParams[OperandFPRoundingMode].set(0, FPRoundingModeString, nullptr); + OperandClassParams[OperandLinkageType].set(0, LinkageTypeString, nullptr); + OperandClassParams[OperandFuncParamAttr].set(0, FuncParamAttrString, nullptr); + OperandClassParams[OperandAccessQualifier].set(0, AccessQualifierString, nullptr); + OperandClassParams[OperandDecoration].set(DecorationCeiling, DecorationString, DecorationParams); + OperandClassParams[OperandDecoration].setOperands(DecorationOperands); + OperandClassParams[OperandBuiltIn].set(0, BuiltInString, nullptr); + OperandClassParams[OperandSelect].set(SelectControlCeiling, SelectControlString, SelectionControlParams, true); + OperandClassParams[OperandLoop].set(LoopControlCeiling, LoopControlString, LoopControlParams, true); + OperandClassParams[OperandFunction].set(FunctionControlCeiling, FunctionControlString, FunctionControlParams, true); + OperandClassParams[OperandMemorySemantics].set(0, MemorySemanticsString, nullptr, true); + OperandClassParams[OperandMemoryAccess].set(MemoryAccessCeiling, MemoryAccessString, MemoryAccessParams, true); + OperandClassParams[OperandScope].set(0, ScopeString, nullptr); + OperandClassParams[OperandGroupOperation].set(0, GroupOperationString, nullptr); + OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, nullptr); + OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, nullptr, true); + OperandClassParams[OperandCapability].set(0, CapabilityString, nullptr); + OperandClassParams[OperandCooperativeMatrixOperands].set(CooperativeMatrixOperandsCeiling, CooperativeMatrixOperandsString, CooperativeMatrixOperandsParams, true); + OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, nullptr); + + // set name of operator, an initial set of style operands, and the description + + InstructionDesc[OpSource].operands.push(OperandSource, ""); + InstructionDesc[OpSource].operands.push(OperandLiteralNumber, "'Version'"); + InstructionDesc[OpSource].operands.push(OperandId, "'File'", true); + InstructionDesc[OpSource].operands.push(OperandLiteralString, "'Source'", true); + + InstructionDesc[OpSourceContinued].operands.push(OperandLiteralString, "'Continued Source'"); + + InstructionDesc[OpSourceExtension].operands.push(OperandLiteralString, "'Extension'"); + + InstructionDesc[OpName].operands.push(OperandId, "'Target'"); + InstructionDesc[OpName].operands.push(OperandLiteralString, "'Name'"); + + InstructionDesc[OpMemberName].operands.push(OperandId, "'Type'"); + InstructionDesc[OpMemberName].operands.push(OperandLiteralNumber, "'Member'"); + InstructionDesc[OpMemberName].operands.push(OperandLiteralString, "'Name'"); + + InstructionDesc[OpString].operands.push(OperandLiteralString, "'String'"); + + InstructionDesc[OpLine].operands.push(OperandId, "'File'"); + InstructionDesc[OpLine].operands.push(OperandLiteralNumber, "'Line'"); + InstructionDesc[OpLine].operands.push(OperandLiteralNumber, "'Column'"); + + InstructionDesc[OpExtension].operands.push(OperandLiteralString, "'Name'"); + + InstructionDesc[OpExtInstImport].operands.push(OperandLiteralString, "'Name'"); + + InstructionDesc[OpCapability].operands.push(OperandCapability, "'Capability'"); + + InstructionDesc[OpMemoryModel].operands.push(OperandAddressing, ""); + InstructionDesc[OpMemoryModel].operands.push(OperandMemory, ""); + + InstructionDesc[OpEntryPoint].operands.push(OperandExecutionModel, ""); + InstructionDesc[OpEntryPoint].operands.push(OperandId, "'Entry Point'"); + InstructionDesc[OpEntryPoint].operands.push(OperandLiteralString, "'Name'"); + InstructionDesc[OpEntryPoint].operands.push(OperandVariableIds, "'Interface'"); + + InstructionDesc[OpExecutionMode].operands.push(OperandId, "'Entry Point'"); + InstructionDesc[OpExecutionMode].operands.push(OperandExecutionMode, "'Mode'"); + InstructionDesc[OpExecutionMode].operands.push(OperandOptionalLiteral, "See <>"); + + InstructionDesc[OpExecutionModeId].operands.push(OperandId, "'Entry Point'"); + InstructionDesc[OpExecutionModeId].operands.push(OperandExecutionMode, "'Mode'"); + InstructionDesc[OpExecutionModeId].operands.push(OperandVariableIds, "See <>"); + + InstructionDesc[OpTypeInt].operands.push(OperandLiteralNumber, "'Width'"); + InstructionDesc[OpTypeInt].operands.push(OperandLiteralNumber, "'Signedness'"); + + InstructionDesc[OpTypeFloat].operands.push(OperandLiteralNumber, "'Width'"); + + InstructionDesc[OpTypeVector].operands.push(OperandId, "'Component Type'"); + InstructionDesc[OpTypeVector].operands.push(OperandLiteralNumber, "'Component Count'"); + + InstructionDesc[OpTypeMatrix].operands.push(OperandId, "'Column Type'"); + InstructionDesc[OpTypeMatrix].operands.push(OperandLiteralNumber, "'Column Count'"); + + InstructionDesc[OpTypeImage].operands.push(OperandId, "'Sampled Type'"); + InstructionDesc[OpTypeImage].operands.push(OperandDimensionality, ""); + InstructionDesc[OpTypeImage].operands.push(OperandLiteralNumber, "'Depth'"); + InstructionDesc[OpTypeImage].operands.push(OperandLiteralNumber, "'Arrayed'"); + InstructionDesc[OpTypeImage].operands.push(OperandLiteralNumber, "'MS'"); + InstructionDesc[OpTypeImage].operands.push(OperandLiteralNumber, "'Sampled'"); + InstructionDesc[OpTypeImage].operands.push(OperandSamplerImageFormat, ""); + InstructionDesc[OpTypeImage].operands.push(OperandAccessQualifier, "", true); + + InstructionDesc[OpTypeSampledImage].operands.push(OperandId, "'Image Type'"); + + InstructionDesc[OpTypeArray].operands.push(OperandId, "'Element Type'"); + InstructionDesc[OpTypeArray].operands.push(OperandId, "'Length'"); + + InstructionDesc[OpTypeRuntimeArray].operands.push(OperandId, "'Element Type'"); + + InstructionDesc[OpTypeStruct].operands.push(OperandVariableIds, "'Member 0 type', +\n'member 1 type', +\n..."); + + InstructionDesc[OpTypeOpaque].operands.push(OperandLiteralString, "The name of the opaque type."); + + InstructionDesc[OpTypePointer].operands.push(OperandStorage, ""); + InstructionDesc[OpTypePointer].operands.push(OperandId, "'Type'"); + + InstructionDesc[OpTypeForwardPointer].operands.push(OperandId, "'Pointer Type'"); + InstructionDesc[OpTypeForwardPointer].operands.push(OperandStorage, ""); + + InstructionDesc[OpTypePipe].operands.push(OperandAccessQualifier, "'Qualifier'"); - InstructionDesc[OpMemoryModel].operands.push(OperandAddressing, ""); - InstructionDesc[OpMemoryModel].operands.push(OperandMemory, ""); - - InstructionDesc[OpEntryPoint].operands.push(OperandExecutionModel, ""); - InstructionDesc[OpEntryPoint].operands.push(OperandId, "'Entry Point'"); - InstructionDesc[OpEntryPoint].operands.push(OperandLiteralString, "'Name'"); - InstructionDesc[OpEntryPoint].operands.push(OperandVariableIds, "'Interface'"); - - InstructionDesc[OpExecutionMode].operands.push(OperandId, "'Entry Point'"); - InstructionDesc[OpExecutionMode].operands.push(OperandExecutionMode, "'Mode'"); - InstructionDesc[OpExecutionMode].operands.push(OperandOptionalLiteral, "See <>"); - - InstructionDesc[OpExecutionModeId].operands.push(OperandId, "'Entry Point'"); - InstructionDesc[OpExecutionModeId].operands.push(OperandExecutionMode, "'Mode'"); - InstructionDesc[OpExecutionModeId].operands.push(OperandVariableIds, "See <>"); - - InstructionDesc[OpTypeInt].operands.push(OperandLiteralNumber, "'Width'"); - InstructionDesc[OpTypeInt].operands.push(OperandLiteralNumber, "'Signedness'"); - - InstructionDesc[OpTypeFloat].operands.push(OperandLiteralNumber, "'Width'"); - - InstructionDesc[OpTypeVector].operands.push(OperandId, "'Component Type'"); - InstructionDesc[OpTypeVector].operands.push(OperandLiteralNumber, "'Component Count'"); + InstructionDesc[OpTypeFunction].operands.push(OperandId, "'Return Type'"); + InstructionDesc[OpTypeFunction].operands.push(OperandVariableIds, "'Parameter 0 Type', +\n'Parameter 1 Type', +\n..."); - InstructionDesc[OpTypeMatrix].operands.push(OperandId, "'Column Type'"); - InstructionDesc[OpTypeMatrix].operands.push(OperandLiteralNumber, "'Column Count'"); + InstructionDesc[OpConstant].operands.push(OperandVariableLiterals, "'Value'"); - InstructionDesc[OpTypeImage].operands.push(OperandId, "'Sampled Type'"); - InstructionDesc[OpTypeImage].operands.push(OperandDimensionality, ""); - InstructionDesc[OpTypeImage].operands.push(OperandLiteralNumber, "'Depth'"); - InstructionDesc[OpTypeImage].operands.push(OperandLiteralNumber, "'Arrayed'"); - InstructionDesc[OpTypeImage].operands.push(OperandLiteralNumber, "'MS'"); - InstructionDesc[OpTypeImage].operands.push(OperandLiteralNumber, "'Sampled'"); - InstructionDesc[OpTypeImage].operands.push(OperandSamplerImageFormat, ""); - InstructionDesc[OpTypeImage].operands.push(OperandAccessQualifier, "", true); + InstructionDesc[OpConstantComposite].operands.push(OperandVariableIds, "'Constituents'"); - InstructionDesc[OpTypeSampledImage].operands.push(OperandId, "'Image Type'"); + InstructionDesc[OpConstantSampler].operands.push(OperandSamplerAddressingMode, ""); + InstructionDesc[OpConstantSampler].operands.push(OperandLiteralNumber, "'Param'"); + InstructionDesc[OpConstantSampler].operands.push(OperandSamplerFilterMode, ""); - InstructionDesc[OpTypeArray].operands.push(OperandId, "'Element Type'"); - InstructionDesc[OpTypeArray].operands.push(OperandId, "'Length'"); + InstructionDesc[OpSpecConstant].operands.push(OperandVariableLiterals, "'Value'"); - InstructionDesc[OpTypeRuntimeArray].operands.push(OperandId, "'Element Type'"); + InstructionDesc[OpSpecConstantComposite].operands.push(OperandVariableIds, "'Constituents'"); - InstructionDesc[OpTypeStruct].operands.push(OperandVariableIds, "'Member 0 type', +\n'member 1 type', +\n..."); + InstructionDesc[OpSpecConstantOp].operands.push(OperandLiteralNumber, "'Opcode'"); + InstructionDesc[OpSpecConstantOp].operands.push(OperandVariableIds, "'Operands'"); - InstructionDesc[OpTypeOpaque].operands.push(OperandLiteralString, "The name of the opaque type."); + InstructionDesc[OpVariable].operands.push(OperandStorage, ""); + InstructionDesc[OpVariable].operands.push(OperandId, "'Initializer'", true); - InstructionDesc[OpTypePointer].operands.push(OperandStorage, ""); - InstructionDesc[OpTypePointer].operands.push(OperandId, "'Type'"); + InstructionDesc[OpFunction].operands.push(OperandFunction, ""); + InstructionDesc[OpFunction].operands.push(OperandId, "'Function Type'"); - InstructionDesc[OpTypeForwardPointer].operands.push(OperandId, "'Pointer Type'"); - InstructionDesc[OpTypeForwardPointer].operands.push(OperandStorage, ""); + InstructionDesc[OpFunctionCall].operands.push(OperandId, "'Function'"); + InstructionDesc[OpFunctionCall].operands.push(OperandVariableIds, "'Argument 0', +\n'Argument 1', +\n..."); - InstructionDesc[OpTypePipe].operands.push(OperandAccessQualifier, "'Qualifier'"); + InstructionDesc[OpExtInst].operands.push(OperandId, "'Set'"); + InstructionDesc[OpExtInst].operands.push(OperandLiteralNumber, "'Instruction'"); + InstructionDesc[OpExtInst].operands.push(OperandVariableIds, "'Operand 1', +\n'Operand 2', +\n..."); - InstructionDesc[OpTypeFunction].operands.push(OperandId, "'Return Type'"); - InstructionDesc[OpTypeFunction].operands.push(OperandVariableIds, "'Parameter 0 Type', +\n'Parameter 1 Type', +\n..."); + InstructionDesc[OpLoad].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpLoad].operands.push(OperandMemoryAccess, "", true); + InstructionDesc[OpLoad].operands.push(OperandLiteralNumber, "", true); + InstructionDesc[OpLoad].operands.push(OperandId, "", true); - InstructionDesc[OpConstant].operands.push(OperandVariableLiterals, "'Value'"); + InstructionDesc[OpStore].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpStore].operands.push(OperandId, "'Object'"); + InstructionDesc[OpStore].operands.push(OperandMemoryAccess, "", true); + InstructionDesc[OpStore].operands.push(OperandLiteralNumber, "", true); + InstructionDesc[OpStore].operands.push(OperandId, "", true); - InstructionDesc[OpConstantComposite].operands.push(OperandVariableIds, "'Constituents'"); + InstructionDesc[OpPhi].operands.push(OperandVariableIds, "'Variable, Parent, ...'"); - InstructionDesc[OpConstantSampler].operands.push(OperandSamplerAddressingMode, ""); - InstructionDesc[OpConstantSampler].operands.push(OperandLiteralNumber, "'Param'"); - InstructionDesc[OpConstantSampler].operands.push(OperandSamplerFilterMode, ""); + InstructionDesc[OpDecorate].operands.push(OperandId, "'Target'"); + InstructionDesc[OpDecorate].operands.push(OperandDecoration, ""); + InstructionDesc[OpDecorate].operands.push(OperandVariableLiterals, "See <>."); - InstructionDesc[OpSpecConstant].operands.push(OperandVariableLiterals, "'Value'"); + InstructionDesc[OpDecorateId].operands.push(OperandId, "'Target'"); + InstructionDesc[OpDecorateId].operands.push(OperandDecoration, ""); + InstructionDesc[OpDecorateId].operands.push(OperandVariableIds, "See <>."); - InstructionDesc[OpSpecConstantComposite].operands.push(OperandVariableIds, "'Constituents'"); + InstructionDesc[OpDecorateStringGOOGLE].operands.push(OperandId, "'Target'"); + InstructionDesc[OpDecorateStringGOOGLE].operands.push(OperandDecoration, ""); + InstructionDesc[OpDecorateStringGOOGLE].operands.push(OperandVariableLiteralStrings, "'Literal Strings'"); - InstructionDesc[OpSpecConstantOp].operands.push(OperandLiteralNumber, "'Opcode'"); - InstructionDesc[OpSpecConstantOp].operands.push(OperandVariableIds, "'Operands'"); + InstructionDesc[OpMemberDecorate].operands.push(OperandId, "'Structure Type'"); + InstructionDesc[OpMemberDecorate].operands.push(OperandLiteralNumber, "'Member'"); + InstructionDesc[OpMemberDecorate].operands.push(OperandDecoration, ""); + InstructionDesc[OpMemberDecorate].operands.push(OperandVariableLiterals, "See <>."); - InstructionDesc[OpVariable].operands.push(OperandStorage, ""); - InstructionDesc[OpVariable].operands.push(OperandId, "'Initializer'", true); + InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandId, "'Structure Type'"); + InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandLiteralNumber, "'Member'"); + InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandDecoration, ""); + InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandVariableLiteralStrings, "'Literal Strings'"); - InstructionDesc[OpFunction].operands.push(OperandFunction, ""); - InstructionDesc[OpFunction].operands.push(OperandId, "'Function Type'"); + InstructionDesc[OpGroupDecorate].operands.push(OperandId, "'Decoration Group'"); + InstructionDesc[OpGroupDecorate].operands.push(OperandVariableIds, "'Targets'"); - InstructionDesc[OpFunctionCall].operands.push(OperandId, "'Function'"); - InstructionDesc[OpFunctionCall].operands.push(OperandVariableIds, "'Argument 0', +\n'Argument 1', +\n..."); + InstructionDesc[OpGroupMemberDecorate].operands.push(OperandId, "'Decoration Group'"); + InstructionDesc[OpGroupMemberDecorate].operands.push(OperandVariableIdLiteral, "'Targets'"); - InstructionDesc[OpExtInst].operands.push(OperandId, "'Set'"); - InstructionDesc[OpExtInst].operands.push(OperandLiteralNumber, "'Instruction'"); - InstructionDesc[OpExtInst].operands.push(OperandVariableIds, "'Operand 1', +\n'Operand 2', +\n..."); + InstructionDesc[OpVectorExtractDynamic].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpVectorExtractDynamic].operands.push(OperandId, "'Index'"); - InstructionDesc[OpLoad].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpLoad].operands.push(OperandMemoryAccess, "", true); - InstructionDesc[OpLoad].operands.push(OperandLiteralNumber, "", true); - InstructionDesc[OpLoad].operands.push(OperandId, "", true); + InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId, "'Component'"); + InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId, "'Index'"); - InstructionDesc[OpStore].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpStore].operands.push(OperandId, "'Object'"); - InstructionDesc[OpStore].operands.push(OperandMemoryAccess, "", true); - InstructionDesc[OpStore].operands.push(OperandLiteralNumber, "", true); - InstructionDesc[OpStore].operands.push(OperandId, "", true); + InstructionDesc[OpVectorShuffle].operands.push(OperandId, "'Vector 1'"); + InstructionDesc[OpVectorShuffle].operands.push(OperandId, "'Vector 2'"); + InstructionDesc[OpVectorShuffle].operands.push(OperandVariableLiterals, "'Components'"); - InstructionDesc[OpPhi].operands.push(OperandVariableIds, "'Variable, Parent, ...'"); + InstructionDesc[OpCompositeConstruct].operands.push(OperandVariableIds, "'Constituents'"); - InstructionDesc[OpDecorate].operands.push(OperandId, "'Target'"); - InstructionDesc[OpDecorate].operands.push(OperandDecoration, ""); - InstructionDesc[OpDecorate].operands.push(OperandVariableLiterals, "See <>."); + InstructionDesc[OpCompositeExtract].operands.push(OperandId, "'Composite'"); + InstructionDesc[OpCompositeExtract].operands.push(OperandVariableLiterals, "'Indexes'"); - InstructionDesc[OpDecorateId].operands.push(OperandId, "'Target'"); - InstructionDesc[OpDecorateId].operands.push(OperandDecoration, ""); - InstructionDesc[OpDecorateId].operands.push(OperandVariableIds, "See <>."); + InstructionDesc[OpCompositeInsert].operands.push(OperandId, "'Object'"); + InstructionDesc[OpCompositeInsert].operands.push(OperandId, "'Composite'"); + InstructionDesc[OpCompositeInsert].operands.push(OperandVariableLiterals, "'Indexes'"); - InstructionDesc[OpDecorateStringGOOGLE].operands.push(OperandId, "'Target'"); - InstructionDesc[OpDecorateStringGOOGLE].operands.push(OperandDecoration, ""); - InstructionDesc[OpDecorateStringGOOGLE].operands.push(OperandVariableLiteralStrings, "'Literal Strings'"); + InstructionDesc[OpCopyObject].operands.push(OperandId, "'Operand'"); - InstructionDesc[OpMemberDecorate].operands.push(OperandId, "'Structure Type'"); - InstructionDesc[OpMemberDecorate].operands.push(OperandLiteralNumber, "'Member'"); - InstructionDesc[OpMemberDecorate].operands.push(OperandDecoration, ""); - InstructionDesc[OpMemberDecorate].operands.push(OperandVariableLiterals, "See <>."); + InstructionDesc[OpCopyMemory].operands.push(OperandId, "'Target'"); + InstructionDesc[OpCopyMemory].operands.push(OperandId, "'Source'"); + InstructionDesc[OpCopyMemory].operands.push(OperandMemoryAccess, "", true); - InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandId, "'Structure Type'"); - InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandLiteralNumber, "'Member'"); - InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandDecoration, ""); - InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandVariableLiteralStrings, "'Literal Strings'"); + InstructionDesc[OpCopyMemorySized].operands.push(OperandId, "'Target'"); + InstructionDesc[OpCopyMemorySized].operands.push(OperandId, "'Source'"); + InstructionDesc[OpCopyMemorySized].operands.push(OperandId, "'Size'"); + InstructionDesc[OpCopyMemorySized].operands.push(OperandMemoryAccess, "", true); + + InstructionDesc[OpSampledImage].operands.push(OperandId, "'Image'"); + InstructionDesc[OpSampledImage].operands.push(OperandId, "'Sampler'"); + + InstructionDesc[OpImage].operands.push(OperandId, "'Sampled Image'"); + + InstructionDesc[OpImageRead].operands.push(OperandId, "'Image'"); + InstructionDesc[OpImageRead].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageRead].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageRead].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageWrite].operands.push(OperandId, "'Image'"); + InstructionDesc[OpImageWrite].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageWrite].operands.push(OperandId, "'Texel'"); + InstructionDesc[OpImageWrite].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageWrite].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSampleExplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleExplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleExplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleExplicitLod].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageFetch].operands.push(OperandId, "'Image'"); + InstructionDesc[OpImageFetch].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageFetch].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageFetch].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageGather].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageGather].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageGather].operands.push(OperandId, "'Component'"); + InstructionDesc[OpImageGather].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageGather].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageDrefGather].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageDrefGather].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageDrefGather].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpImageDrefGather].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageDrefGather].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpGroupDecorate].operands.push(OperandId, "'Decoration Group'"); - InstructionDesc[OpGroupDecorate].operands.push(OperandVariableIds, "'Targets'"); + InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpGroupMemberDecorate].operands.push(OperandId, "'Decoration Group'"); - InstructionDesc[OpGroupMemberDecorate].operands.push(OperandVariableIdLiteral, "'Targets'"); + InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpVectorExtractDynamic].operands.push(OperandId, "'Vector'"); - InstructionDesc[OpVectorExtractDynamic].operands.push(OperandId, "'Index'"); + InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId, "'Vector'"); - InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId, "'Component'"); - InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId, "'Index'"); + InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpVectorShuffle].operands.push(OperandId, "'Vector 1'"); - InstructionDesc[OpVectorShuffle].operands.push(OperandId, "'Vector 2'"); - InstructionDesc[OpVectorShuffle].operands.push(OperandVariableLiterals, "'Components'"); + InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpCompositeConstruct].operands.push(OperandVariableIds, "'Constituents'"); + InstructionDesc[OpImageSparseFetch].operands.push(OperandId, "'Image'"); + InstructionDesc[OpImageSparseFetch].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseFetch].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseFetch].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpCompositeExtract].operands.push(OperandId, "'Composite'"); - InstructionDesc[OpCompositeExtract].operands.push(OperandVariableLiterals, "'Indexes'"); + InstructionDesc[OpImageSparseGather].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSparseGather].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseGather].operands.push(OperandId, "'Component'"); + InstructionDesc[OpImageSparseGather].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseGather].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpCompositeInsert].operands.push(OperandId, "'Object'"); - InstructionDesc[OpCompositeInsert].operands.push(OperandId, "'Composite'"); - InstructionDesc[OpCompositeInsert].operands.push(OperandVariableLiterals, "'Indexes'"); + InstructionDesc[OpImageSparseDrefGather].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSparseDrefGather].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseDrefGather].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpImageSparseDrefGather].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseDrefGather].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpCopyObject].operands.push(OperandId, "'Operand'"); + InstructionDesc[OpImageSparseRead].operands.push(OperandId, "'Image'"); + InstructionDesc[OpImageSparseRead].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSparseRead].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSparseRead].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpCopyMemory].operands.push(OperandId, "'Target'"); - InstructionDesc[OpCopyMemory].operands.push(OperandId, "'Source'"); - InstructionDesc[OpCopyMemory].operands.push(OperandMemoryAccess, "", true); + InstructionDesc[OpImageSparseTexelsResident].operands.push(OperandId, "'Resident Code'"); - InstructionDesc[OpCopyMemorySized].operands.push(OperandId, "'Target'"); - InstructionDesc[OpCopyMemorySized].operands.push(OperandId, "'Source'"); - InstructionDesc[OpCopyMemorySized].operands.push(OperandId, "'Size'"); - InstructionDesc[OpCopyMemorySized].operands.push(OperandMemoryAccess, "", true); - - InstructionDesc[OpSampledImage].operands.push(OperandId, "'Image'"); - InstructionDesc[OpSampledImage].operands.push(OperandId, "'Sampler'"); - - InstructionDesc[OpImage].operands.push(OperandId, "'Sampled Image'"); - - InstructionDesc[OpImageRead].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageRead].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageRead].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageRead].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageWrite].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageWrite].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageWrite].operands.push(OperandId, "'Texel'"); - InstructionDesc[OpImageWrite].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageWrite].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSampleExplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSampleExplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSampleExplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSampleExplicitLod].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); - InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); - InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); - InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); - InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageFetch].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageFetch].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageFetch].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageFetch].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageGather].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageGather].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageGather].operands.push(OperandId, "'Component'"); - InstructionDesc[OpImageGather].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageGather].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageDrefGather].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageDrefGather].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageDrefGather].operands.push(OperandId, "'D~ref~'"); - InstructionDesc[OpImageDrefGather].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageDrefGather].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); - InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandVariableIds, "", true); + InstructionDesc[OpImageQuerySizeLod].operands.push(OperandId, "'Image'"); + InstructionDesc[OpImageQuerySizeLod].operands.push(OperandId, "'Level of Detail'"); - InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); - InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandVariableIds, "", true); + InstructionDesc[OpImageQuerySize].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandVariableIds, "", true); + InstructionDesc[OpImageQueryLod].operands.push(OperandId, "'Image'"); + InstructionDesc[OpImageQueryLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandVariableIds, "", true); + InstructionDesc[OpImageQueryLevels].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); - InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandVariableIds, "", true); + InstructionDesc[OpImageQuerySamples].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); - InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandVariableIds, "", true); + InstructionDesc[OpImageQueryFormat].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageSparseFetch].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageSparseFetch].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseFetch].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseFetch].operands.push(OperandVariableIds, "", true); + InstructionDesc[OpImageQueryOrder].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageSparseGather].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSparseGather].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseGather].operands.push(OperandId, "'Component'"); - InstructionDesc[OpImageSparseGather].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseGather].operands.push(OperandVariableIds, "", true); + InstructionDesc[OpAccessChain].operands.push(OperandId, "'Base'"); + InstructionDesc[OpAccessChain].operands.push(OperandVariableIds, "'Indexes'"); - InstructionDesc[OpImageSparseDrefGather].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSparseDrefGather].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseDrefGather].operands.push(OperandId, "'D~ref~'"); - InstructionDesc[OpImageSparseDrefGather].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseDrefGather].operands.push(OperandVariableIds, "", true); + InstructionDesc[OpInBoundsAccessChain].operands.push(OperandId, "'Base'"); + InstructionDesc[OpInBoundsAccessChain].operands.push(OperandVariableIds, "'Indexes'"); - InstructionDesc[OpImageSparseRead].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageSparseRead].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSparseRead].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSparseRead].operands.push(OperandVariableIds, "", true); + InstructionDesc[OpPtrAccessChain].operands.push(OperandId, "'Base'"); + InstructionDesc[OpPtrAccessChain].operands.push(OperandId, "'Element'"); + InstructionDesc[OpPtrAccessChain].operands.push(OperandVariableIds, "'Indexes'"); - InstructionDesc[OpImageSparseTexelsResident].operands.push(OperandId, "'Resident Code'"); + InstructionDesc[OpInBoundsPtrAccessChain].operands.push(OperandId, "'Base'"); + InstructionDesc[OpInBoundsPtrAccessChain].operands.push(OperandId, "'Element'"); + InstructionDesc[OpInBoundsPtrAccessChain].operands.push(OperandVariableIds, "'Indexes'"); - InstructionDesc[OpImageQuerySizeLod].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageQuerySizeLod].operands.push(OperandId, "'Level of Detail'"); + InstructionDesc[OpSNegate].operands.push(OperandId, "'Operand'"); - InstructionDesc[OpImageQuerySize].operands.push(OperandId, "'Image'"); + InstructionDesc[OpFNegate].operands.push(OperandId, "'Operand'"); - InstructionDesc[OpImageQueryLod].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageQueryLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpNot].operands.push(OperandId, "'Operand'"); - InstructionDesc[OpImageQueryLevels].operands.push(OperandId, "'Image'"); + InstructionDesc[OpAny].operands.push(OperandId, "'Vector'"); - InstructionDesc[OpImageQuerySamples].operands.push(OperandId, "'Image'"); + InstructionDesc[OpAll].operands.push(OperandId, "'Vector'"); - InstructionDesc[OpImageQueryFormat].operands.push(OperandId, "'Image'"); + InstructionDesc[OpConvertFToU].operands.push(OperandId, "'Float Value'"); - InstructionDesc[OpImageQueryOrder].operands.push(OperandId, "'Image'"); + InstructionDesc[OpConvertFToS].operands.push(OperandId, "'Float Value'"); - InstructionDesc[OpAccessChain].operands.push(OperandId, "'Base'"); - InstructionDesc[OpAccessChain].operands.push(OperandVariableIds, "'Indexes'"); + InstructionDesc[OpConvertSToF].operands.push(OperandId, "'Signed Value'"); - InstructionDesc[OpInBoundsAccessChain].operands.push(OperandId, "'Base'"); - InstructionDesc[OpInBoundsAccessChain].operands.push(OperandVariableIds, "'Indexes'"); + InstructionDesc[OpConvertUToF].operands.push(OperandId, "'Unsigned Value'"); - InstructionDesc[OpPtrAccessChain].operands.push(OperandId, "'Base'"); - InstructionDesc[OpPtrAccessChain].operands.push(OperandId, "'Element'"); - InstructionDesc[OpPtrAccessChain].operands.push(OperandVariableIds, "'Indexes'"); + InstructionDesc[OpUConvert].operands.push(OperandId, "'Unsigned Value'"); - InstructionDesc[OpInBoundsPtrAccessChain].operands.push(OperandId, "'Base'"); - InstructionDesc[OpInBoundsPtrAccessChain].operands.push(OperandId, "'Element'"); - InstructionDesc[OpInBoundsPtrAccessChain].operands.push(OperandVariableIds, "'Indexes'"); + InstructionDesc[OpSConvert].operands.push(OperandId, "'Signed Value'"); - InstructionDesc[OpSNegate].operands.push(OperandId, "'Operand'"); + InstructionDesc[OpFConvert].operands.push(OperandId, "'Float Value'"); - InstructionDesc[OpFNegate].operands.push(OperandId, "'Operand'"); + InstructionDesc[OpSatConvertSToU].operands.push(OperandId, "'Signed Value'"); - InstructionDesc[OpNot].operands.push(OperandId, "'Operand'"); + InstructionDesc[OpSatConvertUToS].operands.push(OperandId, "'Unsigned Value'"); - InstructionDesc[OpAny].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpConvertPtrToU].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAll].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpConvertUToPtr].operands.push(OperandId, "'Integer Value'"); - InstructionDesc[OpConvertFToU].operands.push(OperandId, "'Float Value'"); + InstructionDesc[OpPtrCastToGeneric].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpConvertFToS].operands.push(OperandId, "'Float Value'"); + InstructionDesc[OpGenericCastToPtr].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpConvertSToF].operands.push(OperandId, "'Signed Value'"); + InstructionDesc[OpGenericCastToPtrExplicit].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpGenericCastToPtrExplicit].operands.push(OperandStorage, "'Storage'"); - InstructionDesc[OpConvertUToF].operands.push(OperandId, "'Unsigned Value'"); + InstructionDesc[OpGenericPtrMemSemantics].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpUConvert].operands.push(OperandId, "'Unsigned Value'"); + InstructionDesc[OpBitcast].operands.push(OperandId, "'Operand'"); - InstructionDesc[OpSConvert].operands.push(OperandId, "'Signed Value'"); + InstructionDesc[OpQuantizeToF16].operands.push(OperandId, "'Value'"); - InstructionDesc[OpFConvert].operands.push(OperandId, "'Float Value'"); + InstructionDesc[OpTranspose].operands.push(OperandId, "'Matrix'"); - InstructionDesc[OpSatConvertSToU].operands.push(OperandId, "'Signed Value'"); + InstructionDesc[OpCopyLogical].operands.push(OperandId, "'Operand'"); - InstructionDesc[OpSatConvertUToS].operands.push(OperandId, "'Unsigned Value'"); + InstructionDesc[OpIsNan].operands.push(OperandId, "'x'"); - InstructionDesc[OpConvertPtrToU].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpIsInf].operands.push(OperandId, "'x'"); - InstructionDesc[OpConvertUToPtr].operands.push(OperandId, "'Integer Value'"); + InstructionDesc[OpIsFinite].operands.push(OperandId, "'x'"); - InstructionDesc[OpPtrCastToGeneric].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpIsNormal].operands.push(OperandId, "'x'"); - InstructionDesc[OpGenericCastToPtr].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpSignBitSet].operands.push(OperandId, "'x'"); - InstructionDesc[OpGenericCastToPtrExplicit].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpGenericCastToPtrExplicit].operands.push(OperandStorage, "'Storage'"); + InstructionDesc[OpLessOrGreater].operands.push(OperandId, "'x'"); + InstructionDesc[OpLessOrGreater].operands.push(OperandId, "'y'"); - InstructionDesc[OpGenericPtrMemSemantics].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpOrdered].operands.push(OperandId, "'x'"); + InstructionDesc[OpOrdered].operands.push(OperandId, "'y'"); - InstructionDesc[OpBitcast].operands.push(OperandId, "'Operand'"); + InstructionDesc[OpUnordered].operands.push(OperandId, "'x'"); + InstructionDesc[OpUnordered].operands.push(OperandId, "'y'"); - InstructionDesc[OpQuantizeToF16].operands.push(OperandId, "'Value'"); + InstructionDesc[OpArrayLength].operands.push(OperandId, "'Structure'"); + InstructionDesc[OpArrayLength].operands.push(OperandLiteralNumber, "'Array member'"); - InstructionDesc[OpTranspose].operands.push(OperandId, "'Matrix'"); + InstructionDesc[OpIAdd].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpIAdd].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpCopyLogical].operands.push(OperandId, "'Operand'"); + InstructionDesc[OpFAdd].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFAdd].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpIsNan].operands.push(OperandId, "'x'"); + InstructionDesc[OpISub].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpISub].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpIsInf].operands.push(OperandId, "'x'"); + InstructionDesc[OpFSub].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFSub].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpIsFinite].operands.push(OperandId, "'x'"); + InstructionDesc[OpIMul].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpIMul].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpIsNormal].operands.push(OperandId, "'x'"); + InstructionDesc[OpFMul].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFMul].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpSignBitSet].operands.push(OperandId, "'x'"); + InstructionDesc[OpUDiv].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpUDiv].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpLessOrGreater].operands.push(OperandId, "'x'"); - InstructionDesc[OpLessOrGreater].operands.push(OperandId, "'y'"); + InstructionDesc[OpSDiv].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSDiv].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpOrdered].operands.push(OperandId, "'x'"); - InstructionDesc[OpOrdered].operands.push(OperandId, "'y'"); + InstructionDesc[OpFDiv].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFDiv].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpUnordered].operands.push(OperandId, "'x'"); - InstructionDesc[OpUnordered].operands.push(OperandId, "'y'"); + InstructionDesc[OpUMod].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpUMod].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpArrayLength].operands.push(OperandId, "'Structure'"); - InstructionDesc[OpArrayLength].operands.push(OperandLiteralNumber, "'Array member'"); + InstructionDesc[OpSRem].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSRem].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpIAdd].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpIAdd].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpSMod].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSMod].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFAdd].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFAdd].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFRem].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFRem].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpISub].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpISub].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFMod].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFMod].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFSub].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFSub].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpVectorTimesScalar].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpVectorTimesScalar].operands.push(OperandId, "'Scalar'"); - InstructionDesc[OpIMul].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpIMul].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpMatrixTimesScalar].operands.push(OperandId, "'Matrix'"); + InstructionDesc[OpMatrixTimesScalar].operands.push(OperandId, "'Scalar'"); - InstructionDesc[OpFMul].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFMul].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpVectorTimesMatrix].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpVectorTimesMatrix].operands.push(OperandId, "'Matrix'"); - InstructionDesc[OpUDiv].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpUDiv].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpMatrixTimesVector].operands.push(OperandId, "'Matrix'"); + InstructionDesc[OpMatrixTimesVector].operands.push(OperandId, "'Vector'"); - InstructionDesc[OpSDiv].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpSDiv].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpMatrixTimesMatrix].operands.push(OperandId, "'LeftMatrix'"); + InstructionDesc[OpMatrixTimesMatrix].operands.push(OperandId, "'RightMatrix'"); - InstructionDesc[OpFDiv].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFDiv].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpOuterProduct].operands.push(OperandId, "'Vector 1'"); + InstructionDesc[OpOuterProduct].operands.push(OperandId, "'Vector 2'"); - InstructionDesc[OpUMod].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpUMod].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpDot].operands.push(OperandId, "'Vector 1'"); + InstructionDesc[OpDot].operands.push(OperandId, "'Vector 2'"); - InstructionDesc[OpSRem].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpSRem].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpIAddCarry].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpIAddCarry].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpSMod].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpSMod].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpISubBorrow].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpISubBorrow].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFRem].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFRem].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpUMulExtended].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpUMulExtended].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFMod].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFMod].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpSMulExtended].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSMulExtended].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpVectorTimesScalar].operands.push(OperandId, "'Vector'"); - InstructionDesc[OpVectorTimesScalar].operands.push(OperandId, "'Scalar'"); + InstructionDesc[OpShiftRightLogical].operands.push(OperandId, "'Base'"); + InstructionDesc[OpShiftRightLogical].operands.push(OperandId, "'Shift'"); - InstructionDesc[OpMatrixTimesScalar].operands.push(OperandId, "'Matrix'"); - InstructionDesc[OpMatrixTimesScalar].operands.push(OperandId, "'Scalar'"); + InstructionDesc[OpShiftRightArithmetic].operands.push(OperandId, "'Base'"); + InstructionDesc[OpShiftRightArithmetic].operands.push(OperandId, "'Shift'"); - InstructionDesc[OpVectorTimesMatrix].operands.push(OperandId, "'Vector'"); - InstructionDesc[OpVectorTimesMatrix].operands.push(OperandId, "'Matrix'"); + InstructionDesc[OpShiftLeftLogical].operands.push(OperandId, "'Base'"); + InstructionDesc[OpShiftLeftLogical].operands.push(OperandId, "'Shift'"); - InstructionDesc[OpMatrixTimesVector].operands.push(OperandId, "'Matrix'"); - InstructionDesc[OpMatrixTimesVector].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpLogicalOr].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpLogicalOr].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpMatrixTimesMatrix].operands.push(OperandId, "'LeftMatrix'"); - InstructionDesc[OpMatrixTimesMatrix].operands.push(OperandId, "'RightMatrix'"); + InstructionDesc[OpLogicalAnd].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpLogicalAnd].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpOuterProduct].operands.push(OperandId, "'Vector 1'"); - InstructionDesc[OpOuterProduct].operands.push(OperandId, "'Vector 2'"); + InstructionDesc[OpLogicalEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpLogicalEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpDot].operands.push(OperandId, "'Vector 1'"); - InstructionDesc[OpDot].operands.push(OperandId, "'Vector 2'"); + InstructionDesc[OpLogicalNotEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpLogicalNotEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpIAddCarry].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpIAddCarry].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpLogicalNot].operands.push(OperandId, "'Operand'"); - InstructionDesc[OpISubBorrow].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpISubBorrow].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpBitwiseOr].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpBitwiseOr].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpUMulExtended].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpUMulExtended].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpBitwiseXor].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpBitwiseXor].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpSMulExtended].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpSMulExtended].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpBitwiseAnd].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpBitwiseAnd].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpShiftRightLogical].operands.push(OperandId, "'Base'"); - InstructionDesc[OpShiftRightLogical].operands.push(OperandId, "'Shift'"); + InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Base'"); + InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Insert'"); + InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Count'"); - InstructionDesc[OpShiftRightArithmetic].operands.push(OperandId, "'Base'"); - InstructionDesc[OpShiftRightArithmetic].operands.push(OperandId, "'Shift'"); + InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Base'"); + InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Count'"); - InstructionDesc[OpShiftLeftLogical].operands.push(OperandId, "'Base'"); - InstructionDesc[OpShiftLeftLogical].operands.push(OperandId, "'Shift'"); + InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Base'"); + InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Count'"); - InstructionDesc[OpLogicalOr].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpLogicalOr].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpBitReverse].operands.push(OperandId, "'Base'"); - InstructionDesc[OpLogicalAnd].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpLogicalAnd].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpBitCount].operands.push(OperandId, "'Base'"); - InstructionDesc[OpLogicalEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpLogicalEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpSelect].operands.push(OperandId, "'Condition'"); + InstructionDesc[OpSelect].operands.push(OperandId, "'Object 1'"); + InstructionDesc[OpSelect].operands.push(OperandId, "'Object 2'"); - InstructionDesc[OpLogicalNotEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpLogicalNotEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpIEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpIEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpLogicalNot].operands.push(OperandId, "'Operand'"); + InstructionDesc[OpFOrdEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpBitwiseOr].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpBitwiseOr].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFUnordEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpBitwiseXor].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpBitwiseXor].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpINotEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpINotEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpBitwiseAnd].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpBitwiseAnd].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFOrdNotEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdNotEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Base'"); - InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Insert'"); - InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Offset'"); - InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Count'"); + InstructionDesc[OpFUnordNotEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordNotEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Base'"); - InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Offset'"); - InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Count'"); - - InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Base'"); - InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Offset'"); - InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Count'"); - - InstructionDesc[OpBitReverse].operands.push(OperandId, "'Base'"); + InstructionDesc[OpULessThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpULessThan].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpBitCount].operands.push(OperandId, "'Base'"); + InstructionDesc[OpSLessThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSLessThan].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpSelect].operands.push(OperandId, "'Condition'"); - InstructionDesc[OpSelect].operands.push(OperandId, "'Object 1'"); - InstructionDesc[OpSelect].operands.push(OperandId, "'Object 2'"); + InstructionDesc[OpFOrdLessThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdLessThan].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpIEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpIEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFUnordLessThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordLessThan].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFOrdEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFOrdEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpUGreaterThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpUGreaterThan].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFUnordEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFUnordEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpSGreaterThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSGreaterThan].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpINotEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpINotEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFOrdGreaterThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdGreaterThan].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFOrdNotEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFOrdNotEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFUnordGreaterThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordGreaterThan].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFUnordNotEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFUnordNotEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpULessThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpULessThanEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpULessThan].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpULessThan].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpSLessThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSLessThanEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpSLessThan].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpSLessThan].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFOrdLessThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdLessThanEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFOrdLessThan].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFOrdLessThan].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFUnordLessThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordLessThanEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFUnordLessThan].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFUnordLessThan].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpUGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpUGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpUGreaterThan].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpUGreaterThan].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpSGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpSGreaterThan].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpSGreaterThan].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFOrdGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFOrdGreaterThan].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFOrdGreaterThan].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFUnordGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpFUnordGreaterThan].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFUnordGreaterThan].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpDPdx].operands.push(OperandId, "'P'"); - InstructionDesc[OpULessThanEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpULessThanEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpDPdy].operands.push(OperandId, "'P'"); - InstructionDesc[OpSLessThanEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpSLessThanEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFwidth].operands.push(OperandId, "'P'"); - InstructionDesc[OpFOrdLessThanEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFOrdLessThanEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpDPdxFine].operands.push(OperandId, "'P'"); - InstructionDesc[OpFUnordLessThanEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFUnordLessThanEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpDPdyFine].operands.push(OperandId, "'P'"); - InstructionDesc[OpUGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpUGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFwidthFine].operands.push(OperandId, "'P'"); - InstructionDesc[OpSGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpSGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpDPdxCoarse].operands.push(OperandId, "'P'"); - InstructionDesc[OpFOrdGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFOrdGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpDPdyCoarse].operands.push(OperandId, "'P'"); - InstructionDesc[OpFUnordGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); - InstructionDesc[OpFUnordGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); + InstructionDesc[OpFwidthCoarse].operands.push(OperandId, "'P'"); - InstructionDesc[OpDPdx].operands.push(OperandId, "'P'"); + InstructionDesc[OpEmitStreamVertex].operands.push(OperandId, "'Stream'"); - InstructionDesc[OpDPdy].operands.push(OperandId, "'P'"); + InstructionDesc[OpEndStreamPrimitive].operands.push(OperandId, "'Stream'"); - InstructionDesc[OpFwidth].operands.push(OperandId, "'P'"); + InstructionDesc[OpControlBarrier].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpControlBarrier].operands.push(OperandScope, "'Memory'"); + InstructionDesc[OpControlBarrier].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpDPdxFine].operands.push(OperandId, "'P'"); + InstructionDesc[OpMemoryBarrier].operands.push(OperandScope, "'Memory'"); + InstructionDesc[OpMemoryBarrier].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpDPdyFine].operands.push(OperandId, "'P'"); + InstructionDesc[OpImageTexelPointer].operands.push(OperandId, "'Image'"); + InstructionDesc[OpImageTexelPointer].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageTexelPointer].operands.push(OperandId, "'Sample'"); - InstructionDesc[OpFwidthFine].operands.push(OperandId, "'P'"); + InstructionDesc[OpAtomicLoad].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicLoad].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicLoad].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpDPdxCoarse].operands.push(OperandId, "'P'"); + InstructionDesc[OpAtomicStore].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicStore].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicStore].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicStore].operands.push(OperandId, "'Value'"); - InstructionDesc[OpDPdyCoarse].operands.push(OperandId, "'P'"); + InstructionDesc[OpAtomicExchange].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicExchange].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicExchange].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicExchange].operands.push(OperandId, "'Value'"); - InstructionDesc[OpFwidthCoarse].operands.push(OperandId, "'P'"); + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandMemorySemantics, "'Equal'"); + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandMemorySemantics, "'Unequal'"); + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId, "'Value'"); + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId, "'Comparator'"); - InstructionDesc[OpEmitStreamVertex].operands.push(OperandId, "'Stream'"); + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandMemorySemantics, "'Equal'"); + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandMemorySemantics, "'Unequal'"); + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Value'"); + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Comparator'"); - InstructionDesc[OpEndStreamPrimitive].operands.push(OperandId, "'Stream'"); + InstructionDesc[OpAtomicIIncrement].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicIIncrement].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicIIncrement].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpControlBarrier].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpControlBarrier].operands.push(OperandScope, "'Memory'"); - InstructionDesc[OpControlBarrier].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicIDecrement].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicIDecrement].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicIDecrement].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpMemoryBarrier].operands.push(OperandScope, "'Memory'"); - InstructionDesc[OpMemoryBarrier].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicIAdd].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicIAdd].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicIAdd].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicIAdd].operands.push(OperandId, "'Value'"); - InstructionDesc[OpImageTexelPointer].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageTexelPointer].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageTexelPointer].operands.push(OperandId, "'Sample'"); + InstructionDesc[OpAtomicFAddEXT].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicFAddEXT].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicFAddEXT].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicFAddEXT].operands.push(OperandId, "'Value'"); - InstructionDesc[OpAtomicLoad].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicLoad].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicLoad].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicISub].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicISub].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicISub].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicISub].operands.push(OperandId, "'Value'"); - InstructionDesc[OpAtomicStore].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicStore].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicStore].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicStore].operands.push(OperandId, "'Value'"); + InstructionDesc[OpAtomicUMin].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicUMin].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicUMin].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicUMin].operands.push(OperandId, "'Value'"); - InstructionDesc[OpAtomicExchange].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicExchange].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicExchange].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicExchange].operands.push(OperandId, "'Value'"); + InstructionDesc[OpAtomicUMax].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicUMax].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicUMax].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicUMax].operands.push(OperandId, "'Value'"); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandMemorySemantics, "'Equal'"); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandMemorySemantics, "'Unequal'"); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId, "'Value'"); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId, "'Comparator'"); + InstructionDesc[OpAtomicSMin].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicSMin].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicSMin].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicSMin].operands.push(OperandId, "'Value'"); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandMemorySemantics, "'Equal'"); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandMemorySemantics, "'Unequal'"); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Value'"); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Comparator'"); + InstructionDesc[OpAtomicSMax].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicSMax].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicSMax].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicSMax].operands.push(OperandId, "'Value'"); - InstructionDesc[OpAtomicIIncrement].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicIIncrement].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicIIncrement].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicFMinEXT].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicFMinEXT].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicFMinEXT].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicFMinEXT].operands.push(OperandId, "'Value'"); - InstructionDesc[OpAtomicIDecrement].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicIDecrement].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicIDecrement].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandId, "'Value'"); - InstructionDesc[OpAtomicIAdd].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicIAdd].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicIAdd].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicIAdd].operands.push(OperandId, "'Value'"); + InstructionDesc[OpAtomicAnd].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicAnd].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicAnd].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicAnd].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicOr].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicOr].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicOr].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicOr].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicXor].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicXor].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicXor].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicXor].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicFlagTestAndSet].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicFlagTestAndSet].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicFlagTestAndSet].operands.push(OperandMemorySemantics, "'Semantics'"); + + InstructionDesc[OpAtomicFlagClear].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicFlagClear].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpAtomicFlagClear].operands.push(OperandMemorySemantics, "'Semantics'"); + + InstructionDesc[OpLoopMerge].operands.push(OperandId, "'Merge Block'"); + InstructionDesc[OpLoopMerge].operands.push(OperandId, "'Continue Target'"); + InstructionDesc[OpLoopMerge].operands.push(OperandLoop, ""); + InstructionDesc[OpLoopMerge].operands.push(OperandOptionalLiteral, ""); + + InstructionDesc[OpSelectionMerge].operands.push(OperandId, "'Merge Block'"); + InstructionDesc[OpSelectionMerge].operands.push(OperandSelect, ""); + + InstructionDesc[OpBranch].operands.push(OperandId, "'Target Label'"); + + InstructionDesc[OpBranchConditional].operands.push(OperandId, "'Condition'"); + InstructionDesc[OpBranchConditional].operands.push(OperandId, "'True Label'"); + InstructionDesc[OpBranchConditional].operands.push(OperandId, "'False Label'"); + InstructionDesc[OpBranchConditional].operands.push(OperandVariableLiterals, "'Branch weights'"); + + InstructionDesc[OpSwitch].operands.push(OperandId, "'Selector'"); + InstructionDesc[OpSwitch].operands.push(OperandId, "'Default'"); + InstructionDesc[OpSwitch].operands.push(OperandVariableLiteralId, "'Target'"); + + + InstructionDesc[OpReturnValue].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpLifetimeStart].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpLifetimeStart].operands.push(OperandLiteralNumber, "'Size'"); + + InstructionDesc[OpLifetimeStop].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpLifetimeStop].operands.push(OperandLiteralNumber, "'Size'"); + + InstructionDesc[OpGroupAsyncCopy].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Destination'"); + InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Source'"); + InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Num Elements'"); + InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Stride'"); + InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Event'"); + + InstructionDesc[OpGroupWaitEvents].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupWaitEvents].operands.push(OperandId, "'Num Events'"); + InstructionDesc[OpGroupWaitEvents].operands.push(OperandId, "'Events List'"); + + InstructionDesc[OpGroupAll].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupAll].operands.push(OperandId, "'Predicate'"); + + InstructionDesc[OpGroupAny].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupAny].operands.push(OperandId, "'Predicate'"); + + InstructionDesc[OpGroupBroadcast].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupBroadcast].operands.push(OperandId, "'Value'"); + InstructionDesc[OpGroupBroadcast].operands.push(OperandId, "'LocalId'"); + + InstructionDesc[OpGroupIAdd].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupIAdd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupIAdd].operands.push(OperandId, "'X'"); + + InstructionDesc[OpGroupFAdd].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupFAdd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupFAdd].operands.push(OperandId, "'X'"); + + InstructionDesc[OpGroupUMin].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupUMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupUMin].operands.push(OperandId, "'X'"); + + InstructionDesc[OpGroupSMin].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupSMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupSMin].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupFMin].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupFMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupFMin].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupUMax].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupUMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupUMax].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupSMax].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupSMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupSMax].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupFMax].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupFMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupFMax].operands.push(OperandId, "X"); + + InstructionDesc[OpReadPipe].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpReadPipe].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpReadPipe].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpReadPipe].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpWritePipe].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpWritePipe].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpWritePipe].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpWritePipe].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Reserve Id'"); + InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Index'"); + InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Reserve Id'"); + InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Index'"); + InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Num Packets'"); + InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Num Packets'"); + InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Reserve Id'"); + InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Reserve Id'"); + InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpIsValidReserveId].operands.push(OperandId, "'Reserve Id'"); + + InstructionDesc[OpGetNumPipePackets].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpGetNumPipePackets].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpGetNumPipePackets].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Num Packets'"); + InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Num Packets'"); + InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Reserve Id'"); + InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Pipe'"); + InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Reserve Id'"); + InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Packet Size'"); + InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Packet Alignment'"); + + InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'GlobalWorkSize'"); + InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'LocalWorkSize'"); + InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'GlobalWorkOffset'"); + + InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'Event'"); + InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'Profiling Info'"); + InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpSetUserEventStatus].operands.push(OperandId, "'Event'"); + InstructionDesc[OpSetUserEventStatus].operands.push(OperandId, "'Status'"); + + InstructionDesc[OpIsValidEvent].operands.push(OperandId, "'Event'"); + + InstructionDesc[OpRetainEvent].operands.push(OperandId, "'Event'"); + + InstructionDesc[OpReleaseEvent].operands.push(OperandId, "'Event'"); + + InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Invoke'"); + InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Param'"); + InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Param Size'"); + InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Param Align'"); + + InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Invoke'"); + InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Param'"); + InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Param Size'"); + InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Param Align'"); + + InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'ND Range'"); + InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Invoke'"); + InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Param'"); + InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Param Size'"); + InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Param Align'"); + + InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'ND Range'"); + InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Invoke'"); + InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Param'"); + InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Param Size'"); + InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Param Align'"); + + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Queue'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Flags'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'ND Range'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Num Events'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Wait Events'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Ret Event'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Invoke'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Param'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Param Size'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Param Align'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandVariableIds, "'Local Size'"); + + InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Queue'"); + InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Num Events'"); + InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Wait Events'"); + InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Ret Event'"); + + InstructionDesc[OpGroupNonUniformElect].operands.push(OperandScope, "'Execution'"); + + InstructionDesc[OpGroupNonUniformAll].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformAll].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformAny].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformAny].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformAllEqual].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformAllEqual].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformBroadcast].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBroadcast].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformBroadcast].operands.push(OperandId, "ID"); + + InstructionDesc[OpGroupNonUniformBroadcastFirst].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBroadcastFirst].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformBallot].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBallot].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformInverseBallot].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformInverseBallot].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformBallotBitExtract].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBallotBitExtract].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformBallotBitExtract].operands.push(OperandId, "Bit"); + + InstructionDesc[OpGroupNonUniformBallotBitCount].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBallotBitCount].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformBallotBitCount].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformBallotFindLSB].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBallotFindLSB].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformBallotFindMSB].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBallotFindMSB].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformShuffle].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformShuffle].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformShuffle].operands.push(OperandId, "'Id'"); + + InstructionDesc[OpGroupNonUniformShuffleXor].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformShuffleXor].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformShuffleXor].operands.push(OperandId, "Mask"); + + InstructionDesc[OpGroupNonUniformShuffleUp].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformShuffleUp].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformShuffleUp].operands.push(OperandId, "Offset"); + + InstructionDesc[OpGroupNonUniformShuffleDown].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformShuffleDown].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformShuffleDown].operands.push(OperandId, "Offset"); + + InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandId, "'ClusterSize'", true); - InstructionDesc[OpAtomicFAddEXT].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicFAddEXT].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicFAddEXT].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicFAddEXT].operands.push(OperandId, "'Value'"); + InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandId, "'ClusterSize'", true); - InstructionDesc[OpAtomicISub].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicISub].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicISub].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicISub].operands.push(OperandId, "'Value'"); + InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandId, "'ClusterSize'", true); - InstructionDesc[OpAtomicUMin].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicUMin].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicUMin].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicUMin].operands.push(OperandId, "'Value'"); + InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandId, "'ClusterSize'", true); - InstructionDesc[OpAtomicUMax].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicUMax].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicUMax].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicUMax].operands.push(OperandId, "'Value'"); + InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandId, "'ClusterSize'", true); - InstructionDesc[OpAtomicSMin].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicSMin].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicSMin].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicSMin].operands.push(OperandId, "'Value'"); + InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformQuadBroadcast].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformQuadBroadcast].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformQuadBroadcast].operands.push(OperandId, "'Id'"); + + InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandId, "'Direction'"); + + InstructionDesc[OpSubgroupBallotKHR].operands.push(OperandId, "'Predicate'"); + + InstructionDesc[OpSubgroupFirstInvocationKHR].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpSubgroupAnyKHR].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpSubgroupAnyKHR].operands.push(OperandId, "'Predicate'"); + + InstructionDesc[OpSubgroupAllKHR].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpSubgroupAllKHR].operands.push(OperandId, "'Predicate'"); + + InstructionDesc[OpSubgroupAllEqualKHR].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpSubgroupAllEqualKHR].operands.push(OperandId, "'Predicate'"); + + InstructionDesc[OpSubgroupReadInvocationKHR].operands.push(OperandId, "'Value'"); + InstructionDesc[OpSubgroupReadInvocationKHR].operands.push(OperandId, "'Index'"); + + InstructionDesc[OpModuleProcessed].operands.push(OperandLiteralString, "'process'"); + + InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandId, "'X'"); + + InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandId, "'X'"); + + InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandId, "'X'"); + + InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandId, "X"); + + InstructionDesc[OpFragmentMaskFetchAMD].operands.push(OperandId, "'Image'"); + InstructionDesc[OpFragmentMaskFetchAMD].operands.push(OperandId, "'Coordinate'"); + + InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Image'"); + InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Fragment Index'"); + + InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X"); + + InstructionDesc[OpTypeAccelerationStructureKHR].setResultAndType(true, false); + + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Flags'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Cull Mask'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Miss Index'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Origin'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Direction'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Payload'"); + InstructionDesc[OpTraceNV].setResultAndType(false, false); + + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Flags'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Cull Mask'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Miss Index'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Origin'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Direction'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Time'"); + InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Payload'"); + InstructionDesc[OpTraceRayMotionNV].setResultAndType(false, false); + + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Flags'"); + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Cull Mask'"); + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Miss Index'"); + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Origin'"); + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Direction'"); + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Payload'"); + InstructionDesc[OpTraceRayKHR].setResultAndType(false, false); + + InstructionDesc[OpReportIntersectionKHR].operands.push(OperandId, "'Hit Parameter'"); + InstructionDesc[OpReportIntersectionKHR].operands.push(OperandId, "'Hit Kind'"); + + InstructionDesc[OpIgnoreIntersectionNV].setResultAndType(false, false); + + InstructionDesc[OpIgnoreIntersectionKHR].setResultAndType(false, false); + + InstructionDesc[OpTerminateRayNV].setResultAndType(false, false); + + InstructionDesc[OpTerminateRayKHR].setResultAndType(false, false); + + InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "SBT Record Index"); + InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "CallableData ID"); + InstructionDesc[OpExecuteCallableNV].setResultAndType(false, false); + + InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "SBT Record Index"); + InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "CallableData"); + InstructionDesc[OpExecuteCallableKHR].setResultAndType(false, false); + + InstructionDesc[OpConvertUToAccelerationStructureKHR].operands.push(OperandId, "Value"); + InstructionDesc[OpConvertUToAccelerationStructureKHR].setResultAndType(true, true); + + // Ray Query + InstructionDesc[OpTypeAccelerationStructureKHR].setResultAndType(true, false); + InstructionDesc[OpTypeRayQueryKHR].setResultAndType(true, false); + + InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'AccelerationS'"); + InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'RayFlags'"); + InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'CullMask'"); + InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Origin'"); + InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Tmin'"); + InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Direction'"); + InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Tmax'"); + InstructionDesc[OpRayQueryInitializeKHR].setResultAndType(false, false); + + InstructionDesc[OpRayQueryTerminateKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryTerminateKHR].setResultAndType(false, false); + + InstructionDesc[OpRayQueryGenerateIntersectionKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGenerateIntersectionKHR].operands.push(OperandId, "'THit'"); + InstructionDesc[OpRayQueryGenerateIntersectionKHR].setResultAndType(false, false); + + InstructionDesc[OpRayQueryConfirmIntersectionKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryConfirmIntersectionKHR].setResultAndType(false, false); + + InstructionDesc[OpRayQueryProceedKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryProceedKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionTypeKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionTypeKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionTypeKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetRayTMinKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetRayTMinKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetRayFlagsKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetRayFlagsKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionTKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionTKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionTKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionInstanceCustomIndexKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionInstanceCustomIndexKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionInstanceCustomIndexKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionInstanceIdKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionInstanceIdKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionInstanceIdKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionGeometryIndexKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionGeometryIndexKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionGeometryIndexKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionPrimitiveIndexKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionPrimitiveIndexKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionPrimitiveIndexKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionBarycentricsKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionBarycentricsKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionBarycentricsKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionFrontFaceKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionFrontFaceKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionFrontFaceKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionCandidateAABBOpaqueKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionCandidateAABBOpaqueKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionObjectRayDirectionKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionObjectRayDirectionKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionObjectRayDirectionKHR].setResultAndType(true, true); - InstructionDesc[OpAtomicSMax].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicSMax].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicSMax].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicSMax].operands.push(OperandId, "'Value'"); + InstructionDesc[OpRayQueryGetIntersectionObjectRayOriginKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionObjectRayOriginKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionObjectRayOriginKHR].setResultAndType(true, true); - InstructionDesc[OpAtomicFMinEXT].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicFMinEXT].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicFMinEXT].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicFMinEXT].operands.push(OperandId, "'Value'"); + InstructionDesc[OpRayQueryGetWorldRayDirectionKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetWorldRayDirectionKHR].setResultAndType(true, true); - InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandId, "'Value'"); + InstructionDesc[OpRayQueryGetWorldRayOriginKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetWorldRayOriginKHR].setResultAndType(true, true); - InstructionDesc[OpAtomicAnd].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicAnd].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicAnd].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicAnd].operands.push(OperandId, "'Value'"); - - InstructionDesc[OpAtomicOr].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicOr].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicOr].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicOr].operands.push(OperandId, "'Value'"); - - InstructionDesc[OpAtomicXor].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicXor].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicXor].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicXor].operands.push(OperandId, "'Value'"); - - InstructionDesc[OpAtomicFlagTestAndSet].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicFlagTestAndSet].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicFlagTestAndSet].operands.push(OperandMemorySemantics, "'Semantics'"); - - InstructionDesc[OpAtomicFlagClear].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpAtomicFlagClear].operands.push(OperandScope, "'Scope'"); - InstructionDesc[OpAtomicFlagClear].operands.push(OperandMemorySemantics, "'Semantics'"); - - InstructionDesc[OpLoopMerge].operands.push(OperandId, "'Merge Block'"); - InstructionDesc[OpLoopMerge].operands.push(OperandId, "'Continue Target'"); - InstructionDesc[OpLoopMerge].operands.push(OperandLoop, ""); - InstructionDesc[OpLoopMerge].operands.push(OperandOptionalLiteral, ""); - - InstructionDesc[OpSelectionMerge].operands.push(OperandId, "'Merge Block'"); - InstructionDesc[OpSelectionMerge].operands.push(OperandSelect, ""); - - InstructionDesc[OpBranch].operands.push(OperandId, "'Target Label'"); - - InstructionDesc[OpBranchConditional].operands.push(OperandId, "'Condition'"); - InstructionDesc[OpBranchConditional].operands.push(OperandId, "'True Label'"); - InstructionDesc[OpBranchConditional].operands.push(OperandId, "'False Label'"); - InstructionDesc[OpBranchConditional].operands.push(OperandVariableLiterals, "'Branch weights'"); - - InstructionDesc[OpSwitch].operands.push(OperandId, "'Selector'"); - InstructionDesc[OpSwitch].operands.push(OperandId, "'Default'"); - InstructionDesc[OpSwitch].operands.push(OperandVariableLiteralId, "'Target'"); - - - InstructionDesc[OpReturnValue].operands.push(OperandId, "'Value'"); - - InstructionDesc[OpLifetimeStart].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpLifetimeStart].operands.push(OperandLiteralNumber, "'Size'"); - - InstructionDesc[OpLifetimeStop].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpLifetimeStop].operands.push(OperandLiteralNumber, "'Size'"); - - InstructionDesc[OpGroupAsyncCopy].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Destination'"); - InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Source'"); - InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Num Elements'"); - InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Stride'"); - InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Event'"); - - InstructionDesc[OpGroupWaitEvents].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupWaitEvents].operands.push(OperandId, "'Num Events'"); - InstructionDesc[OpGroupWaitEvents].operands.push(OperandId, "'Events List'"); - - InstructionDesc[OpGroupAll].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupAll].operands.push(OperandId, "'Predicate'"); - - InstructionDesc[OpGroupAny].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupAny].operands.push(OperandId, "'Predicate'"); - - InstructionDesc[OpGroupBroadcast].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupBroadcast].operands.push(OperandId, "'Value'"); - InstructionDesc[OpGroupBroadcast].operands.push(OperandId, "'LocalId'"); - - InstructionDesc[OpGroupIAdd].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupIAdd].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupIAdd].operands.push(OperandId, "'X'"); - - InstructionDesc[OpGroupFAdd].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupFAdd].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupFAdd].operands.push(OperandId, "'X'"); - - InstructionDesc[OpGroupUMin].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupUMin].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupUMin].operands.push(OperandId, "'X'"); - - InstructionDesc[OpGroupSMin].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupSMin].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupSMin].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupFMin].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupFMin].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupFMin].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupUMax].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupUMax].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupUMax].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupSMax].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupSMax].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupSMax].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupFMax].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupFMax].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupFMax].operands.push(OperandId, "X"); - - InstructionDesc[OpReadPipe].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpReadPipe].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpReadPipe].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpReadPipe].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpWritePipe].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpWritePipe].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpWritePipe].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpWritePipe].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Reserve Id'"); - InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Index'"); - InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Reserve Id'"); - InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Index'"); - InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Num Packets'"); - InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Num Packets'"); - InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Reserve Id'"); - InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Reserve Id'"); - InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpIsValidReserveId].operands.push(OperandId, "'Reserve Id'"); - - InstructionDesc[OpGetNumPipePackets].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpGetNumPipePackets].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpGetNumPipePackets].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Num Packets'"); - InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Num Packets'"); - InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Reserve Id'"); - InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Pipe'"); - InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Reserve Id'"); - InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Packet Size'"); - InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Packet Alignment'"); - - InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'GlobalWorkSize'"); - InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'LocalWorkSize'"); - InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'GlobalWorkOffset'"); - - InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'Event'"); - InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'Profiling Info'"); - InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'Value'"); - - InstructionDesc[OpSetUserEventStatus].operands.push(OperandId, "'Event'"); - InstructionDesc[OpSetUserEventStatus].operands.push(OperandId, "'Status'"); - - InstructionDesc[OpIsValidEvent].operands.push(OperandId, "'Event'"); - - InstructionDesc[OpRetainEvent].operands.push(OperandId, "'Event'"); - - InstructionDesc[OpReleaseEvent].operands.push(OperandId, "'Event'"); - - InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Invoke'"); - InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Param'"); - InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Param Size'"); - InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Param Align'"); - - InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Invoke'"); - InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Param'"); - InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Param Size'"); - InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Param Align'"); - - InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'ND Range'"); - InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Invoke'"); - InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Param'"); - InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Param Size'"); - InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Param Align'"); - - InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'ND Range'"); - InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Invoke'"); - InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Param'"); - InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Param Size'"); - InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Param Align'"); - - InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Queue'"); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Flags'"); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'ND Range'"); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Num Events'"); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Wait Events'"); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Ret Event'"); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Invoke'"); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Param'"); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Param Size'"); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Param Align'"); - InstructionDesc[OpEnqueueKernel].operands.push(OperandVariableIds, "'Local Size'"); - - InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Queue'"); - InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Num Events'"); - InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Wait Events'"); - InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Ret Event'"); - - InstructionDesc[OpGroupNonUniformElect].operands.push(OperandScope, "'Execution'"); - - InstructionDesc[OpGroupNonUniformAll].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformAll].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupNonUniformAny].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformAny].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupNonUniformAllEqual].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformAllEqual].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupNonUniformBroadcast].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformBroadcast].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformBroadcast].operands.push(OperandId, "ID"); - - InstructionDesc[OpGroupNonUniformBroadcastFirst].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformBroadcastFirst].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupNonUniformBallot].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformBallot].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupNonUniformInverseBallot].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformInverseBallot].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupNonUniformBallotBitExtract].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformBallotBitExtract].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformBallotBitExtract].operands.push(OperandId, "Bit"); - - InstructionDesc[OpGroupNonUniformBallotBitCount].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformBallotBitCount].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformBallotBitCount].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupNonUniformBallotFindLSB].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformBallotFindLSB].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupNonUniformBallotFindMSB].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformBallotFindMSB].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupNonUniformShuffle].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformShuffle].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformShuffle].operands.push(OperandId, "'Id'"); - - InstructionDesc[OpGroupNonUniformShuffleXor].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformShuffleXor].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformShuffleXor].operands.push(OperandId, "Mask"); - - InstructionDesc[OpGroupNonUniformShuffleUp].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformShuffleUp].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformShuffleUp].operands.push(OperandId, "Offset"); - - InstructionDesc[OpGroupNonUniformShuffleDown].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformShuffleDown].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformShuffleDown].operands.push(OperandId, "Offset"); - - InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandId, "'ClusterSize'", true); + InstructionDesc[OpRayQueryGetIntersectionObjectToWorldKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionObjectToWorldKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionObjectToWorldKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].setResultAndType(true, true); + + InstructionDesc[OpRayQueryGetIntersectionTriangleVertexPositionsKHR].operands.push(OperandId, "'RayQuery'"); + InstructionDesc[OpRayQueryGetIntersectionTriangleVertexPositionsKHR].operands.push(OperandId, "'Committed'"); + InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].setResultAndType(true, true); + + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Granularity'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coarse'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Index Offset'"); + InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Packed Indices'"); - InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandId, "'ClusterSize'", true); + InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'groupCountX'"); + InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'groupCountY'"); + InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'groupCountZ'"); + InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'Payload'"); + InstructionDesc[OpEmitMeshTasksEXT].setResultAndType(false, false); - InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandId, "'ClusterSize'", true); + InstructionDesc[OpSetMeshOutputsEXT].operands.push(OperandId, "'vertexCount'"); + InstructionDesc[OpSetMeshOutputsEXT].operands.push(OperandId, "'primitiveCount'"); + InstructionDesc[OpSetMeshOutputsEXT].setResultAndType(false, false); - InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandId, "'ClusterSize'", true); - InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandId, "'ClusterSize'", true); + InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Component Type'"); + InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Scope'"); + InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Rows'"); + InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Columns'"); - InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandId, "'ClusterSize'", true); - - InstructionDesc[OpGroupNonUniformQuadBroadcast].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformQuadBroadcast].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformQuadBroadcast].operands.push(OperandId, "'Id'"); - - InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandId, "X"); - InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandId, "'Direction'"); - - InstructionDesc[OpSubgroupBallotKHR].operands.push(OperandId, "'Predicate'"); - - InstructionDesc[OpSubgroupFirstInvocationKHR].operands.push(OperandId, "'Value'"); - - InstructionDesc[OpSubgroupAnyKHR].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpSubgroupAnyKHR].operands.push(OperandId, "'Predicate'"); - - InstructionDesc[OpSubgroupAllKHR].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpSubgroupAllKHR].operands.push(OperandId, "'Predicate'"); - - InstructionDesc[OpSubgroupAllEqualKHR].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpSubgroupAllEqualKHR].operands.push(OperandId, "'Predicate'"); - - InstructionDesc[OpSubgroupReadInvocationKHR].operands.push(OperandId, "'Value'"); - InstructionDesc[OpSubgroupReadInvocationKHR].operands.push(OperandId, "'Index'"); - - InstructionDesc[OpModuleProcessed].operands.push(OperandLiteralString, "'process'"); - - InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandId, "'X'"); - - InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandId, "'X'"); - - InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandId, "'X'"); - - InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandId, "X"); - - InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandScope, "'Execution'"); - InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); - InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandId, "X"); - - InstructionDesc[OpFragmentMaskFetchAMD].operands.push(OperandId, "'Image'"); - InstructionDesc[OpFragmentMaskFetchAMD].operands.push(OperandId, "'Coordinate'"); - - InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Image'"); - InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Fragment Index'"); - - InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X"); - - InstructionDesc[OpTypeAccelerationStructureKHR].setResultAndType(true, false); - - InstructionDesc[OpTraceNV].operands.push(OperandId, "'Acceleration Structure'"); - InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Flags'"); - InstructionDesc[OpTraceNV].operands.push(OperandId, "'Cull Mask'"); - InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Offset'"); - InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Stride'"); - InstructionDesc[OpTraceNV].operands.push(OperandId, "'Miss Index'"); - InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Origin'"); - InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMin'"); - InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Direction'"); - InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMax'"); - InstructionDesc[OpTraceNV].operands.push(OperandId, "'Payload'"); - InstructionDesc[OpTraceNV].setResultAndType(false, false); - - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Acceleration Structure'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Flags'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Cull Mask'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'SBT Record Offset'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'SBT Record Stride'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Miss Index'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Origin'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'TMin'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Direction'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'TMax'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Time'"); - InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Payload'"); - InstructionDesc[OpTraceRayMotionNV].setResultAndType(false, false); - - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Acceleration Structure'"); - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Flags'"); - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Cull Mask'"); - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'SBT Record Offset'"); - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'SBT Record Stride'"); - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Miss Index'"); - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Origin'"); - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'TMin'"); - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Direction'"); - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'TMax'"); - InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Payload'"); - InstructionDesc[OpTraceRayKHR].setResultAndType(false, false); - - InstructionDesc[OpReportIntersectionKHR].operands.push(OperandId, "'Hit Parameter'"); - InstructionDesc[OpReportIntersectionKHR].operands.push(OperandId, "'Hit Kind'"); - - InstructionDesc[OpIgnoreIntersectionNV].setResultAndType(false, false); - - InstructionDesc[OpIgnoreIntersectionKHR].setResultAndType(false, false); - - InstructionDesc[OpTerminateRayNV].setResultAndType(false, false); - - InstructionDesc[OpTerminateRayKHR].setResultAndType(false, false); - - InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "SBT Record Index"); - InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "CallableData ID"); - InstructionDesc[OpExecuteCallableNV].setResultAndType(false, false); - - InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "SBT Record Index"); - InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "CallableData"); - InstructionDesc[OpExecuteCallableKHR].setResultAndType(false, false); - - InstructionDesc[OpConvertUToAccelerationStructureKHR].operands.push(OperandId, "Value"); - InstructionDesc[OpConvertUToAccelerationStructureKHR].setResultAndType(true, true); - - // Ray Query - InstructionDesc[OpTypeAccelerationStructureKHR].setResultAndType(true, false); - InstructionDesc[OpTypeRayQueryKHR].setResultAndType(true, false); - - InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'AccelerationS'"); - InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'RayFlags'"); - InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'CullMask'"); - InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Origin'"); - InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Tmin'"); - InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Direction'"); - InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Tmax'"); - InstructionDesc[OpRayQueryInitializeKHR].setResultAndType(false, false); - - InstructionDesc[OpRayQueryTerminateKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryTerminateKHR].setResultAndType(false, false); - - InstructionDesc[OpRayQueryGenerateIntersectionKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGenerateIntersectionKHR].operands.push(OperandId, "'THit'"); - InstructionDesc[OpRayQueryGenerateIntersectionKHR].setResultAndType(false, false); - - InstructionDesc[OpRayQueryConfirmIntersectionKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryConfirmIntersectionKHR].setResultAndType(false, false); - - InstructionDesc[OpRayQueryProceedKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryProceedKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionTypeKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionTypeKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionTypeKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetRayTMinKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetRayTMinKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetRayFlagsKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetRayFlagsKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionTKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionTKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionTKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionInstanceCustomIndexKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionInstanceCustomIndexKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionInstanceCustomIndexKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionInstanceIdKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionInstanceIdKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionInstanceIdKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionGeometryIndexKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionGeometryIndexKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionGeometryIndexKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionPrimitiveIndexKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionPrimitiveIndexKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionPrimitiveIndexKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionBarycentricsKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionBarycentricsKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionBarycentricsKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionFrontFaceKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionFrontFaceKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionFrontFaceKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionCandidateAABBOpaqueKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionCandidateAABBOpaqueKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionObjectRayDirectionKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionObjectRayDirectionKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionObjectRayDirectionKHR].setResultAndType(true, true); + InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "'Stride'"); + InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "'Column Major'"); + InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandMemoryAccess, "'Memory Access'"); + InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandLiteralNumber, "", true); + InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "", true); - InstructionDesc[OpRayQueryGetIntersectionObjectRayOriginKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionObjectRayOriginKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionObjectRayOriginKHR].setResultAndType(true, true); + InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Object'"); + InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Stride'"); + InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Column Major'"); + InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandMemoryAccess, "'Memory Access'"); + InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandLiteralNumber, "", true); + InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "", true); - InstructionDesc[OpRayQueryGetWorldRayDirectionKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetWorldRayDirectionKHR].setResultAndType(true, true); + InstructionDesc[OpCooperativeMatrixMulAddNV].operands.push(OperandId, "'A'"); + InstructionDesc[OpCooperativeMatrixMulAddNV].operands.push(OperandId, "'B'"); + InstructionDesc[OpCooperativeMatrixMulAddNV].operands.push(OperandId, "'C'"); - InstructionDesc[OpRayQueryGetWorldRayOriginKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetWorldRayOriginKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionObjectToWorldKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionObjectToWorldKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionObjectToWorldKHR].setResultAndType(true, true); - - InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].operands.push(OperandId, "'RayQuery'"); - InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].operands.push(OperandId, "'Committed'"); - InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].setResultAndType(true, true); - - InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Sampled Image'"); - InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Granularity'"); - InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coarse'"); - InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandImageOperands, "", true); - InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandVariableIds, "", true); - - InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Index Offset'"); - InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Packed Indices'"); - - InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'groupCountX'"); - InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'groupCountY'"); - InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'groupCountZ'"); - InstructionDesc[OpEmitMeshTasksEXT].operands.push(OperandId, "'Payload'"); - InstructionDesc[OpEmitMeshTasksEXT].setResultAndType(false, false); + InstructionDesc[OpCooperativeMatrixLengthNV].operands.push(OperandId, "'Type'"); - InstructionDesc[OpSetMeshOutputsEXT].operands.push(OperandId, "'vertexCount'"); - InstructionDesc[OpSetMeshOutputsEXT].operands.push(OperandId, "'primitiveCount'"); - InstructionDesc[OpSetMeshOutputsEXT].setResultAndType(false, false); + InstructionDesc[OpTypeCooperativeMatrixKHR].operands.push(OperandId, "'Component Type'"); + InstructionDesc[OpTypeCooperativeMatrixKHR].operands.push(OperandId, "'Scope'"); + InstructionDesc[OpTypeCooperativeMatrixKHR].operands.push(OperandId, "'Rows'"); + InstructionDesc[OpTypeCooperativeMatrixKHR].operands.push(OperandId, "'Columns'"); + InstructionDesc[OpTypeCooperativeMatrixKHR].operands.push(OperandId, "'Use'"); + InstructionDesc[OpCooperativeMatrixLoadKHR].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpCooperativeMatrixLoadKHR].operands.push(OperandId, "'Memory Layout'"); + InstructionDesc[OpCooperativeMatrixLoadKHR].operands.push(OperandId, "'Stride'"); + InstructionDesc[OpCooperativeMatrixLoadKHR].operands.push(OperandMemoryAccess, "'Memory Access'"); + InstructionDesc[OpCooperativeMatrixLoadKHR].operands.push(OperandLiteralNumber, "", true); + InstructionDesc[OpCooperativeMatrixLoadKHR].operands.push(OperandId, "", true); - InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Component Type'"); - InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Scope'"); - InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Rows'"); - InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Columns'"); + InstructionDesc[OpCooperativeMatrixStoreKHR].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpCooperativeMatrixStoreKHR].operands.push(OperandId, "'Object'"); + InstructionDesc[OpCooperativeMatrixStoreKHR].operands.push(OperandId, "'Memory Layout'"); + InstructionDesc[OpCooperativeMatrixStoreKHR].operands.push(OperandId, "'Stride'"); + InstructionDesc[OpCooperativeMatrixStoreKHR].operands.push(OperandMemoryAccess, "'Memory Access'"); + InstructionDesc[OpCooperativeMatrixStoreKHR].operands.push(OperandLiteralNumber, "", true); + InstructionDesc[OpCooperativeMatrixStoreKHR].operands.push(OperandId, "", true); - InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "'Stride'"); - InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "'Column Major'"); - InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandMemoryAccess, "'Memory Access'"); - InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandLiteralNumber, "", true); - InstructionDesc[OpCooperativeMatrixLoadNV].operands.push(OperandId, "", true); + InstructionDesc[OpCooperativeMatrixMulAddKHR].operands.push(OperandId, "'A'"); + InstructionDesc[OpCooperativeMatrixMulAddKHR].operands.push(OperandId, "'B'"); + InstructionDesc[OpCooperativeMatrixMulAddKHR].operands.push(OperandId, "'C'"); + InstructionDesc[OpCooperativeMatrixMulAddKHR].operands.push(OperandCooperativeMatrixOperands, "'Cooperative Matrix Operands'", true); - InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Object'"); - InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Stride'"); - InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "'Column Major'"); - InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandMemoryAccess, "'Memory Access'"); - InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandLiteralNumber, "", true); - InstructionDesc[OpCooperativeMatrixStoreNV].operands.push(OperandId, "", true); - - InstructionDesc[OpCooperativeMatrixMulAddNV].operands.push(OperandId, "'A'"); - InstructionDesc[OpCooperativeMatrixMulAddNV].operands.push(OperandId, "'B'"); - InstructionDesc[OpCooperativeMatrixMulAddNV].operands.push(OperandId, "'C'"); - - InstructionDesc[OpCooperativeMatrixLengthNV].operands.push(OperandId, "'Type'"); - - InstructionDesc[OpDemoteToHelperInvocationEXT].setResultAndType(false, false); - - InstructionDesc[OpReadClockKHR].operands.push(OperandScope, "'Scope'"); + InstructionDesc[OpCooperativeMatrixLengthKHR].operands.push(OperandId, "'Type'"); + + InstructionDesc[OpDemoteToHelperInvocationEXT].setResultAndType(false, false); + + InstructionDesc[OpReadClockKHR].operands.push(OperandScope, "'Scope'"); + + InstructionDesc[OpTypeHitObjectNV].setResultAndType(true, false); + + InstructionDesc[OpHitObjectGetShaderRecordBufferHandleNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetShaderRecordBufferHandleNV].setResultAndType(true, true); + + InstructionDesc[OpReorderThreadWithHintNV].operands.push(OperandId, "'Hint'"); + InstructionDesc[OpReorderThreadWithHintNV].operands.push(OperandId, "'Bits'"); + InstructionDesc[OpReorderThreadWithHintNV].setResultAndType(false, false); + + InstructionDesc[OpReorderThreadWithHitObjectNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpReorderThreadWithHitObjectNV].operands.push(OperandId, "'Hint'"); + InstructionDesc[OpReorderThreadWithHitObjectNV].operands.push(OperandId, "'Bits'"); + InstructionDesc[OpReorderThreadWithHitObjectNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectGetCurrentTimeNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetCurrentTimeNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetHitKindNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetHitKindNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetPrimitiveIndexNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetPrimitiveIndexNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetGeometryIndexNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetGeometryIndexNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetInstanceIdNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetInstanceIdNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetInstanceCustomIndexNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetInstanceCustomIndexNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetObjectRayDirectionNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetObjectRayDirectionNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetObjectRayOriginNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetObjectRayOriginNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetWorldRayDirectionNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetWorldRayDirectionNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetWorldRayOriginNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetWorldRayOriginNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetWorldToObjectNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetWorldToObjectNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetObjectToWorldNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetObjectToWorldNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetRayTMaxNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetRayTMaxNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetRayTMinNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetRayTMinNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetShaderBindingTableRecordIndexNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetShaderBindingTableRecordIndexNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectIsEmptyNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectIsEmptyNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectIsHitNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectIsHitNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectIsMissNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectIsMissNV].setResultAndType(true, true); + + InstructionDesc[OpHitObjectGetAttributesNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectGetAttributesNV].operands.push(OperandId, "'HitObjectAttribute'"); + InstructionDesc[OpHitObjectGetAttributesNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectExecuteShaderNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectExecuteShaderNV].operands.push(OperandId, "'Payload'"); + InstructionDesc[OpHitObjectExecuteShaderNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'InstanceId'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'PrimitiveId'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'GeometryIndex'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'HitKind'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'Origin'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'Direction'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'HitObject Attribute'"); + InstructionDesc[OpHitObjectRecordHitNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'InstanceId'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'PrimitiveId'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'GeometryIndex'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'HitKind'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'Origin'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'Direction'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'Current Time'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'HitObject Attribute'"); + InstructionDesc[OpHitObjectRecordHitMotionNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'InstanceId'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'PrimitiveId'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'GeometryIndex'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'HitKind'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'SBT Record Index'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'Origin'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'Direction'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'HitObject Attribute'"); + InstructionDesc[OpHitObjectRecordHitWithIndexNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'InstanceId'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'PrimitiveId'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'GeometryIndex'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'HitKind'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'SBT Record Index'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'Origin'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'Direction'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'Current Time'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'HitObject Attribute'"); + InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'SBT Index'"); + InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'Origin'"); + InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'Direction'"); + InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpHitObjectRecordMissNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'SBT Index'"); + InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'Origin'"); + InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'Direction'"); + InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'Current Time'"); + InstructionDesc[OpHitObjectRecordMissMotionNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectRecordEmptyNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectRecordEmptyNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'RayFlags'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Cullmask'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Miss Index'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Origin'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Direction'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Payload'"); + InstructionDesc[OpHitObjectTraceRayNV].setResultAndType(false, false); + + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'HitObject'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Acceleration Structure'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'RayFlags'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Cullmask'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Miss Index'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Origin'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Direction'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Time'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Payload'"); + InstructionDesc[OpHitObjectTraceRayMotionNV].setResultAndType(false, false); + + InstructionDesc[OpColorAttachmentReadEXT].operands.push(OperandId, "'Attachment'"); + InstructionDesc[OpColorAttachmentReadEXT].operands.push(OperandId, "'Sample'", true); + InstructionDesc[OpStencilAttachmentReadEXT].operands.push(OperandId, "'Sample'", true); + InstructionDesc[OpDepthAttachmentReadEXT].operands.push(OperandId, "'Sample'", true); + + InstructionDesc[OpImageSampleWeightedQCOM].operands.push(OperandId, "'source texture'"); + InstructionDesc[OpImageSampleWeightedQCOM].operands.push(OperandId, "'texture coordinates'"); + InstructionDesc[OpImageSampleWeightedQCOM].operands.push(OperandId, "'weights texture'"); + InstructionDesc[OpImageSampleWeightedQCOM].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleWeightedQCOM].setResultAndType(true, true); + + InstructionDesc[OpImageBoxFilterQCOM].operands.push(OperandId, "'source texture'"); + InstructionDesc[OpImageBoxFilterQCOM].operands.push(OperandId, "'texture coordinates'"); + InstructionDesc[OpImageBoxFilterQCOM].operands.push(OperandId, "'box size'"); + InstructionDesc[OpImageBoxFilterQCOM].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageBoxFilterQCOM].setResultAndType(true, true); + + InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandId, "'target texture'"); + InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandId, "'target coordinates'"); + InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandId, "'reference texture'"); + InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandId, "'reference coordinates'"); + InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandId, "'block size'"); + InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageBlockMatchSADQCOM].setResultAndType(true, true); + + InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'target texture'"); + InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'target coordinates'"); + InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'reference texture'"); + InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'reference coordinates'"); + InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'block size'"); + InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageBlockMatchSSDQCOM].setResultAndType(true, true); + }); } }; // end spv namespace diff --git a/bgfx/3rdparty/glslang/SPIRV/doc.h b/bgfx/3rdparty/glslang/SPIRV/doc.h index 2a0b28c6..b60ad340 100644 --- a/bgfx/3rdparty/glslang/SPIRV/doc.h +++ b/bgfx/3rdparty/glslang/SPIRV/doc.h @@ -156,6 +156,7 @@ enum OperandClass { OperandKernelEnqueueFlags, OperandKernelProfilingInfo, OperandCapability, + OperandCooperativeMatrixOperands, OperandOpcode, @@ -190,15 +191,15 @@ class OperandParameters { // Parameterize an enumerant class EnumParameters { public: - EnumParameters() : desc(0) { } + EnumParameters() : desc(nullptr) { } const char* desc; }; // Parameterize a set of enumerants that form an enum class EnumDefinition : public EnumParameters { public: - EnumDefinition() : - ceiling(0), bitmask(false), getName(0), enumParams(0), operandParams(0) { } + EnumDefinition() : + ceiling(0), bitmask(false), getName(nullptr), enumParams(nullptr), operandParams(nullptr) { } void set(int ceil, const char* (*name)(int), EnumParameters* ep, bool mask = false) { ceiling = ceil; diff --git a/bgfx/3rdparty/glslang/SPIRV/hex_float.h b/bgfx/3rdparty/glslang/SPIRV/hex_float.h index 8be8e9f7..785e8af1 100644 --- a/bgfx/3rdparty/glslang/SPIRV/hex_float.h +++ b/bgfx/3rdparty/glslang/SPIRV/hex_float.h @@ -23,19 +23,6 @@ #include #include -#if defined(_MSC_VER) && _MSC_VER < 1800 -namespace std { -bool isnan(double f) -{ - return ::_isnan(f) != 0; -} -bool isinf(double f) -{ - return ::_finite(f) == 0; -} -} -#endif - #include "bitutils.h" namespace spvutils { diff --git a/bgfx/3rdparty/glslang/SPIRV/spirv.hpp b/bgfx/3rdparty/glslang/SPIRV/spirv.hpp index 0e40544b..bdc96fa3 100644 --- a/bgfx/3rdparty/glslang/SPIRV/spirv.hpp +++ b/bgfx/3rdparty/glslang/SPIRV/spirv.hpp @@ -1,2533 +1,2788 @@ -// Copyright (c) 2014-2020 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. - -// This header is automatically generated by the same tool that creates -// the Binary Section of the SPIR-V specification. - -// Enumeration tokens for SPIR-V, in various styles: -// C, C++, C++11, JSON, Lua, Python, C#, D -// -// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL -// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL -// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL -// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL -// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] -// - C# will use enum classes in the Specification class located in the "Spv" namespace, -// e.g.: Spv.Specification.SourceLanguage.GLSL -// - D will have tokens under the "spv" module, e.g: spv.SourceLanguage.GLSL -// -// Some tokens act like mask values, which can be OR'd together, -// while others are mutually exclusive. The mask-like ones have -// "Mask" in their name, and a parallel enum that has the shift -// amount (1 << x) for each corresponding enumerant. - -#ifndef spirv_HPP -#define spirv_HPP - -namespace spv { - -typedef unsigned int Id; - -#define SPV_VERSION 0x10600 -#define SPV_REVISION 1 - -static const unsigned int MagicNumber = 0x07230203; -static const unsigned int Version = 0x00010600; -static const unsigned int Revision = 1; -static const unsigned int OpCodeMask = 0xffff; -static const unsigned int WordCountShift = 16; - -enum SourceLanguage { - SourceLanguageUnknown = 0, - SourceLanguageESSL = 1, - SourceLanguageGLSL = 2, - SourceLanguageOpenCL_C = 3, - SourceLanguageOpenCL_CPP = 4, - SourceLanguageHLSL = 5, - SourceLanguageCPP_for_OpenCL = 6, - SourceLanguageMax = 0x7fffffff, -}; - -enum ExecutionModel { - ExecutionModelVertex = 0, - ExecutionModelTessellationControl = 1, - ExecutionModelTessellationEvaluation = 2, - ExecutionModelGeometry = 3, - ExecutionModelFragment = 4, - ExecutionModelGLCompute = 5, - ExecutionModelKernel = 6, - ExecutionModelTaskNV = 5267, - ExecutionModelMeshNV = 5268, - ExecutionModelRayGenerationKHR = 5313, - ExecutionModelRayGenerationNV = 5313, - ExecutionModelIntersectionKHR = 5314, - ExecutionModelIntersectionNV = 5314, - ExecutionModelAnyHitKHR = 5315, - ExecutionModelAnyHitNV = 5315, - ExecutionModelClosestHitKHR = 5316, - ExecutionModelClosestHitNV = 5316, - ExecutionModelMissKHR = 5317, - ExecutionModelMissNV = 5317, - ExecutionModelCallableKHR = 5318, - ExecutionModelCallableNV = 5318, - ExecutionModelTaskEXT = 5364, - ExecutionModelMeshEXT = 5365, - ExecutionModelMax = 0x7fffffff, -}; - -enum AddressingModel { - AddressingModelLogical = 0, - AddressingModelPhysical32 = 1, - AddressingModelPhysical64 = 2, - AddressingModelPhysicalStorageBuffer64 = 5348, - AddressingModelPhysicalStorageBuffer64EXT = 5348, - AddressingModelMax = 0x7fffffff, -}; - -enum MemoryModel { - MemoryModelSimple = 0, - MemoryModelGLSL450 = 1, - MemoryModelOpenCL = 2, - MemoryModelVulkan = 3, - MemoryModelVulkanKHR = 3, - MemoryModelMax = 0x7fffffff, -}; - -enum ExecutionMode { - ExecutionModeInvocations = 0, - ExecutionModeSpacingEqual = 1, - ExecutionModeSpacingFractionalEven = 2, - ExecutionModeSpacingFractionalOdd = 3, - ExecutionModeVertexOrderCw = 4, - ExecutionModeVertexOrderCcw = 5, - ExecutionModePixelCenterInteger = 6, - ExecutionModeOriginUpperLeft = 7, - ExecutionModeOriginLowerLeft = 8, - ExecutionModeEarlyFragmentTests = 9, - ExecutionModePointMode = 10, - ExecutionModeXfb = 11, - ExecutionModeDepthReplacing = 12, - ExecutionModeDepthGreater = 14, - ExecutionModeDepthLess = 15, - ExecutionModeDepthUnchanged = 16, - ExecutionModeLocalSize = 17, - ExecutionModeLocalSizeHint = 18, - ExecutionModeInputPoints = 19, - ExecutionModeInputLines = 20, - ExecutionModeInputLinesAdjacency = 21, - ExecutionModeTriangles = 22, - ExecutionModeInputTrianglesAdjacency = 23, - ExecutionModeQuads = 24, - ExecutionModeIsolines = 25, - ExecutionModeOutputVertices = 26, - ExecutionModeOutputPoints = 27, - ExecutionModeOutputLineStrip = 28, - ExecutionModeOutputTriangleStrip = 29, - ExecutionModeVecTypeHint = 30, - ExecutionModeContractionOff = 31, - ExecutionModeInitializer = 33, - ExecutionModeFinalizer = 34, - ExecutionModeSubgroupSize = 35, - ExecutionModeSubgroupsPerWorkgroup = 36, - ExecutionModeSubgroupsPerWorkgroupId = 37, - ExecutionModeLocalSizeId = 38, - ExecutionModeLocalSizeHintId = 39, - ExecutionModeSubgroupUniformControlFlowKHR = 4421, - ExecutionModePostDepthCoverage = 4446, - ExecutionModeDenormPreserve = 4459, - ExecutionModeDenormFlushToZero = 4460, - ExecutionModeSignedZeroInfNanPreserve = 4461, - ExecutionModeRoundingModeRTE = 4462, - ExecutionModeRoundingModeRTZ = 4463, - ExecutionModeEarlyAndLateFragmentTestsAMD = 5017, - ExecutionModeStencilRefReplacingEXT = 5027, - ExecutionModeStencilRefUnchangedFrontAMD = 5079, - ExecutionModeStencilRefGreaterFrontAMD = 5080, - ExecutionModeStencilRefLessFrontAMD = 5081, - ExecutionModeStencilRefUnchangedBackAMD = 5082, - ExecutionModeStencilRefGreaterBackAMD = 5083, - ExecutionModeStencilRefLessBackAMD = 5084, - ExecutionModeOutputLinesEXT = 5269, - ExecutionModeOutputLinesNV = 5269, - ExecutionModeOutputPrimitivesEXT = 5270, - ExecutionModeOutputPrimitivesNV = 5270, - ExecutionModeDerivativeGroupQuadsNV = 5289, - ExecutionModeDerivativeGroupLinearNV = 5290, - ExecutionModeOutputTrianglesEXT = 5298, - ExecutionModeOutputTrianglesNV = 5298, - ExecutionModePixelInterlockOrderedEXT = 5366, - ExecutionModePixelInterlockUnorderedEXT = 5367, - ExecutionModeSampleInterlockOrderedEXT = 5368, - ExecutionModeSampleInterlockUnorderedEXT = 5369, - ExecutionModeShadingRateInterlockOrderedEXT = 5370, - ExecutionModeShadingRateInterlockUnorderedEXT = 5371, - ExecutionModeSharedLocalMemorySizeINTEL = 5618, - ExecutionModeRoundingModeRTPINTEL = 5620, - ExecutionModeRoundingModeRTNINTEL = 5621, - ExecutionModeFloatingPointModeALTINTEL = 5622, - ExecutionModeFloatingPointModeIEEEINTEL = 5623, - ExecutionModeMaxWorkgroupSizeINTEL = 5893, - ExecutionModeMaxWorkDimINTEL = 5894, - ExecutionModeNoGlobalOffsetINTEL = 5895, - ExecutionModeNumSIMDWorkitemsINTEL = 5896, - ExecutionModeSchedulerTargetFmaxMhzINTEL = 5903, - ExecutionModeMax = 0x7fffffff, -}; - -enum StorageClass { - StorageClassUniformConstant = 0, - StorageClassInput = 1, - StorageClassUniform = 2, - StorageClassOutput = 3, - StorageClassWorkgroup = 4, - StorageClassCrossWorkgroup = 5, - StorageClassPrivate = 6, - StorageClassFunction = 7, - StorageClassGeneric = 8, - StorageClassPushConstant = 9, - StorageClassAtomicCounter = 10, - StorageClassImage = 11, - StorageClassStorageBuffer = 12, - StorageClassCallableDataKHR = 5328, - StorageClassCallableDataNV = 5328, - StorageClassIncomingCallableDataKHR = 5329, - StorageClassIncomingCallableDataNV = 5329, - StorageClassRayPayloadKHR = 5338, - StorageClassRayPayloadNV = 5338, - StorageClassHitAttributeKHR = 5339, - StorageClassHitAttributeNV = 5339, - StorageClassIncomingRayPayloadKHR = 5342, - StorageClassIncomingRayPayloadNV = 5342, - StorageClassShaderRecordBufferKHR = 5343, - StorageClassShaderRecordBufferNV = 5343, - StorageClassPhysicalStorageBuffer = 5349, - StorageClassPhysicalStorageBufferEXT = 5349, - StorageClassTaskPayloadWorkgroupEXT = 5402, - StorageClassCodeSectionINTEL = 5605, - StorageClassDeviceOnlyINTEL = 5936, - StorageClassHostOnlyINTEL = 5937, - StorageClassMax = 0x7fffffff, -}; - -enum Dim { - Dim1D = 0, - Dim2D = 1, - Dim3D = 2, - DimCube = 3, - DimRect = 4, - DimBuffer = 5, - DimSubpassData = 6, - DimMax = 0x7fffffff, -}; - -enum SamplerAddressingMode { - SamplerAddressingModeNone = 0, - SamplerAddressingModeClampToEdge = 1, - SamplerAddressingModeClamp = 2, - SamplerAddressingModeRepeat = 3, - SamplerAddressingModeRepeatMirrored = 4, - SamplerAddressingModeMax = 0x7fffffff, -}; - -enum SamplerFilterMode { - SamplerFilterModeNearest = 0, - SamplerFilterModeLinear = 1, - SamplerFilterModeMax = 0x7fffffff, -}; - -enum ImageFormat { - ImageFormatUnknown = 0, - ImageFormatRgba32f = 1, - ImageFormatRgba16f = 2, - ImageFormatR32f = 3, - ImageFormatRgba8 = 4, - ImageFormatRgba8Snorm = 5, - ImageFormatRg32f = 6, - ImageFormatRg16f = 7, - ImageFormatR11fG11fB10f = 8, - ImageFormatR16f = 9, - ImageFormatRgba16 = 10, - ImageFormatRgb10A2 = 11, - ImageFormatRg16 = 12, - ImageFormatRg8 = 13, - ImageFormatR16 = 14, - ImageFormatR8 = 15, - ImageFormatRgba16Snorm = 16, - ImageFormatRg16Snorm = 17, - ImageFormatRg8Snorm = 18, - ImageFormatR16Snorm = 19, - ImageFormatR8Snorm = 20, - ImageFormatRgba32i = 21, - ImageFormatRgba16i = 22, - ImageFormatRgba8i = 23, - ImageFormatR32i = 24, - ImageFormatRg32i = 25, - ImageFormatRg16i = 26, - ImageFormatRg8i = 27, - ImageFormatR16i = 28, - ImageFormatR8i = 29, - ImageFormatRgba32ui = 30, - ImageFormatRgba16ui = 31, - ImageFormatRgba8ui = 32, - ImageFormatR32ui = 33, - ImageFormatRgb10a2ui = 34, - ImageFormatRg32ui = 35, - ImageFormatRg16ui = 36, - ImageFormatRg8ui = 37, - ImageFormatR16ui = 38, - ImageFormatR8ui = 39, - ImageFormatR64ui = 40, - ImageFormatR64i = 41, - ImageFormatMax = 0x7fffffff, -}; - -enum ImageChannelOrder { - ImageChannelOrderR = 0, - ImageChannelOrderA = 1, - ImageChannelOrderRG = 2, - ImageChannelOrderRA = 3, - ImageChannelOrderRGB = 4, - ImageChannelOrderRGBA = 5, - ImageChannelOrderBGRA = 6, - ImageChannelOrderARGB = 7, - ImageChannelOrderIntensity = 8, - ImageChannelOrderLuminance = 9, - ImageChannelOrderRx = 10, - ImageChannelOrderRGx = 11, - ImageChannelOrderRGBx = 12, - ImageChannelOrderDepth = 13, - ImageChannelOrderDepthStencil = 14, - ImageChannelOrdersRGB = 15, - ImageChannelOrdersRGBx = 16, - ImageChannelOrdersRGBA = 17, - ImageChannelOrdersBGRA = 18, - ImageChannelOrderABGR = 19, - ImageChannelOrderMax = 0x7fffffff, -}; - -enum ImageChannelDataType { - ImageChannelDataTypeSnormInt8 = 0, - ImageChannelDataTypeSnormInt16 = 1, - ImageChannelDataTypeUnormInt8 = 2, - ImageChannelDataTypeUnormInt16 = 3, - ImageChannelDataTypeUnormShort565 = 4, - ImageChannelDataTypeUnormShort555 = 5, - ImageChannelDataTypeUnormInt101010 = 6, - ImageChannelDataTypeSignedInt8 = 7, - ImageChannelDataTypeSignedInt16 = 8, - ImageChannelDataTypeSignedInt32 = 9, - ImageChannelDataTypeUnsignedInt8 = 10, - ImageChannelDataTypeUnsignedInt16 = 11, - ImageChannelDataTypeUnsignedInt32 = 12, - ImageChannelDataTypeHalfFloat = 13, - ImageChannelDataTypeFloat = 14, - ImageChannelDataTypeUnormInt24 = 15, - ImageChannelDataTypeUnormInt101010_2 = 16, - ImageChannelDataTypeMax = 0x7fffffff, -}; - -enum ImageOperandsShift { - ImageOperandsBiasShift = 0, - ImageOperandsLodShift = 1, - ImageOperandsGradShift = 2, - ImageOperandsConstOffsetShift = 3, - ImageOperandsOffsetShift = 4, - ImageOperandsConstOffsetsShift = 5, - ImageOperandsSampleShift = 6, - ImageOperandsMinLodShift = 7, - ImageOperandsMakeTexelAvailableShift = 8, - ImageOperandsMakeTexelAvailableKHRShift = 8, - ImageOperandsMakeTexelVisibleShift = 9, - ImageOperandsMakeTexelVisibleKHRShift = 9, - ImageOperandsNonPrivateTexelShift = 10, - ImageOperandsNonPrivateTexelKHRShift = 10, - ImageOperandsVolatileTexelShift = 11, - ImageOperandsVolatileTexelKHRShift = 11, - ImageOperandsSignExtendShift = 12, - ImageOperandsZeroExtendShift = 13, - ImageOperandsNontemporalShift = 14, - ImageOperandsOffsetsShift = 16, - ImageOperandsMax = 0x7fffffff, -}; - -enum ImageOperandsMask { - ImageOperandsMaskNone = 0, - ImageOperandsBiasMask = 0x00000001, - ImageOperandsLodMask = 0x00000002, - ImageOperandsGradMask = 0x00000004, - ImageOperandsConstOffsetMask = 0x00000008, - ImageOperandsOffsetMask = 0x00000010, - ImageOperandsConstOffsetsMask = 0x00000020, - ImageOperandsSampleMask = 0x00000040, - ImageOperandsMinLodMask = 0x00000080, - ImageOperandsMakeTexelAvailableMask = 0x00000100, - ImageOperandsMakeTexelAvailableKHRMask = 0x00000100, - ImageOperandsMakeTexelVisibleMask = 0x00000200, - ImageOperandsMakeTexelVisibleKHRMask = 0x00000200, - ImageOperandsNonPrivateTexelMask = 0x00000400, - ImageOperandsNonPrivateTexelKHRMask = 0x00000400, - ImageOperandsVolatileTexelMask = 0x00000800, - ImageOperandsVolatileTexelKHRMask = 0x00000800, - ImageOperandsSignExtendMask = 0x00001000, - ImageOperandsZeroExtendMask = 0x00002000, - ImageOperandsNontemporalMask = 0x00004000, - ImageOperandsOffsetsMask = 0x00010000, -}; - -enum FPFastMathModeShift { - FPFastMathModeNotNaNShift = 0, - FPFastMathModeNotInfShift = 1, - FPFastMathModeNSZShift = 2, - FPFastMathModeAllowRecipShift = 3, - FPFastMathModeFastShift = 4, - FPFastMathModeAllowContractFastINTELShift = 16, - FPFastMathModeAllowReassocINTELShift = 17, - FPFastMathModeMax = 0x7fffffff, -}; - -enum FPFastMathModeMask { - FPFastMathModeMaskNone = 0, - FPFastMathModeNotNaNMask = 0x00000001, - FPFastMathModeNotInfMask = 0x00000002, - FPFastMathModeNSZMask = 0x00000004, - FPFastMathModeAllowRecipMask = 0x00000008, - FPFastMathModeFastMask = 0x00000010, - FPFastMathModeAllowContractFastINTELMask = 0x00010000, - FPFastMathModeAllowReassocINTELMask = 0x00020000, -}; - -enum FPRoundingMode { - FPRoundingModeRTE = 0, - FPRoundingModeRTZ = 1, - FPRoundingModeRTP = 2, - FPRoundingModeRTN = 3, - FPRoundingModeMax = 0x7fffffff, -}; - -enum LinkageType { - LinkageTypeExport = 0, - LinkageTypeImport = 1, - LinkageTypeLinkOnceODR = 2, - LinkageTypeMax = 0x7fffffff, -}; - -enum AccessQualifier { - AccessQualifierReadOnly = 0, - AccessQualifierWriteOnly = 1, - AccessQualifierReadWrite = 2, - AccessQualifierMax = 0x7fffffff, -}; - -enum FunctionParameterAttribute { - FunctionParameterAttributeZext = 0, - FunctionParameterAttributeSext = 1, - FunctionParameterAttributeByVal = 2, - FunctionParameterAttributeSret = 3, - FunctionParameterAttributeNoAlias = 4, - FunctionParameterAttributeNoCapture = 5, - FunctionParameterAttributeNoWrite = 6, - FunctionParameterAttributeNoReadWrite = 7, - FunctionParameterAttributeMax = 0x7fffffff, -}; - -enum Decoration { - DecorationRelaxedPrecision = 0, - DecorationSpecId = 1, - DecorationBlock = 2, - DecorationBufferBlock = 3, - DecorationRowMajor = 4, - DecorationColMajor = 5, - DecorationArrayStride = 6, - DecorationMatrixStride = 7, - DecorationGLSLShared = 8, - DecorationGLSLPacked = 9, - DecorationCPacked = 10, - DecorationBuiltIn = 11, - DecorationNoPerspective = 13, - DecorationFlat = 14, - DecorationPatch = 15, - DecorationCentroid = 16, - DecorationSample = 17, - DecorationInvariant = 18, - DecorationRestrict = 19, - DecorationAliased = 20, - DecorationVolatile = 21, - DecorationConstant = 22, - DecorationCoherent = 23, - DecorationNonWritable = 24, - DecorationNonReadable = 25, - DecorationUniform = 26, - DecorationUniformId = 27, - DecorationSaturatedConversion = 28, - DecorationStream = 29, - DecorationLocation = 30, - DecorationComponent = 31, - DecorationIndex = 32, - DecorationBinding = 33, - DecorationDescriptorSet = 34, - DecorationOffset = 35, - DecorationXfbBuffer = 36, - DecorationXfbStride = 37, - DecorationFuncParamAttr = 38, - DecorationFPRoundingMode = 39, - DecorationFPFastMathMode = 40, - DecorationLinkageAttributes = 41, - DecorationNoContraction = 42, - DecorationInputAttachmentIndex = 43, - DecorationAlignment = 44, - DecorationMaxByteOffset = 45, - DecorationAlignmentId = 46, - DecorationMaxByteOffsetId = 47, - DecorationNoSignedWrap = 4469, - DecorationNoUnsignedWrap = 4470, - DecorationExplicitInterpAMD = 4999, - DecorationOverrideCoverageNV = 5248, - DecorationPassthroughNV = 5250, - DecorationViewportRelativeNV = 5252, - DecorationSecondaryViewportRelativeNV = 5256, - DecorationPerPrimitiveEXT = 5271, - DecorationPerPrimitiveNV = 5271, - DecorationPerViewNV = 5272, - DecorationPerTaskNV = 5273, - DecorationPerVertexKHR = 5285, - DecorationPerVertexNV = 5285, - DecorationNonUniform = 5300, - DecorationNonUniformEXT = 5300, - DecorationRestrictPointer = 5355, - DecorationRestrictPointerEXT = 5355, - DecorationAliasedPointer = 5356, - DecorationAliasedPointerEXT = 5356, - DecorationBindlessSamplerNV = 5398, - DecorationBindlessImageNV = 5399, - DecorationBoundSamplerNV = 5400, - DecorationBoundImageNV = 5401, - DecorationSIMTCallINTEL = 5599, - DecorationReferencedIndirectlyINTEL = 5602, - DecorationClobberINTEL = 5607, - DecorationSideEffectsINTEL = 5608, - DecorationVectorComputeVariableINTEL = 5624, - DecorationFuncParamIOKindINTEL = 5625, - DecorationVectorComputeFunctionINTEL = 5626, - DecorationStackCallINTEL = 5627, - DecorationGlobalVariableOffsetINTEL = 5628, - DecorationCounterBuffer = 5634, - DecorationHlslCounterBufferGOOGLE = 5634, - DecorationHlslSemanticGOOGLE = 5635, - DecorationUserSemantic = 5635, - DecorationUserTypeGOOGLE = 5636, - DecorationFunctionRoundingModeINTEL = 5822, - DecorationFunctionDenormModeINTEL = 5823, - DecorationRegisterINTEL = 5825, - DecorationMemoryINTEL = 5826, - DecorationNumbanksINTEL = 5827, - DecorationBankwidthINTEL = 5828, - DecorationMaxPrivateCopiesINTEL = 5829, - DecorationSinglepumpINTEL = 5830, - DecorationDoublepumpINTEL = 5831, - DecorationMaxReplicatesINTEL = 5832, - DecorationSimpleDualPortINTEL = 5833, - DecorationMergeINTEL = 5834, - DecorationBankBitsINTEL = 5835, - DecorationForcePow2DepthINTEL = 5836, - DecorationBurstCoalesceINTEL = 5899, - DecorationCacheSizeINTEL = 5900, - DecorationDontStaticallyCoalesceINTEL = 5901, - DecorationPrefetchINTEL = 5902, - DecorationStallEnableINTEL = 5905, - DecorationFuseLoopsInFunctionINTEL = 5907, - DecorationBufferLocationINTEL = 5921, - DecorationIOPipeStorageINTEL = 5944, - DecorationFunctionFloatingPointModeINTEL = 6080, - DecorationSingleElementVectorINTEL = 6085, - DecorationVectorComputeCallableFunctionINTEL = 6087, - DecorationMediaBlockIOINTEL = 6140, - DecorationMax = 0x7fffffff, -}; - -enum BuiltIn { - BuiltInPosition = 0, - BuiltInPointSize = 1, - BuiltInClipDistance = 3, - BuiltInCullDistance = 4, - BuiltInVertexId = 5, - BuiltInInstanceId = 6, - BuiltInPrimitiveId = 7, - BuiltInInvocationId = 8, - BuiltInLayer = 9, - BuiltInViewportIndex = 10, - BuiltInTessLevelOuter = 11, - BuiltInTessLevelInner = 12, - BuiltInTessCoord = 13, - BuiltInPatchVertices = 14, - BuiltInFragCoord = 15, - BuiltInPointCoord = 16, - BuiltInFrontFacing = 17, - BuiltInSampleId = 18, - BuiltInSamplePosition = 19, - BuiltInSampleMask = 20, - BuiltInFragDepth = 22, - BuiltInHelperInvocation = 23, - BuiltInNumWorkgroups = 24, - BuiltInWorkgroupSize = 25, - BuiltInWorkgroupId = 26, - BuiltInLocalInvocationId = 27, - BuiltInGlobalInvocationId = 28, - BuiltInLocalInvocationIndex = 29, - BuiltInWorkDim = 30, - BuiltInGlobalSize = 31, - BuiltInEnqueuedWorkgroupSize = 32, - BuiltInGlobalOffset = 33, - BuiltInGlobalLinearId = 34, - BuiltInSubgroupSize = 36, - BuiltInSubgroupMaxSize = 37, - BuiltInNumSubgroups = 38, - BuiltInNumEnqueuedSubgroups = 39, - BuiltInSubgroupId = 40, - BuiltInSubgroupLocalInvocationId = 41, - BuiltInVertexIndex = 42, - BuiltInInstanceIndex = 43, - BuiltInSubgroupEqMask = 4416, - BuiltInSubgroupEqMaskKHR = 4416, - BuiltInSubgroupGeMask = 4417, - BuiltInSubgroupGeMaskKHR = 4417, - BuiltInSubgroupGtMask = 4418, - BuiltInSubgroupGtMaskKHR = 4418, - BuiltInSubgroupLeMask = 4419, - BuiltInSubgroupLeMaskKHR = 4419, - BuiltInSubgroupLtMask = 4420, - BuiltInSubgroupLtMaskKHR = 4420, - BuiltInBaseVertex = 4424, - BuiltInBaseInstance = 4425, - BuiltInDrawIndex = 4426, - BuiltInPrimitiveShadingRateKHR = 4432, - BuiltInDeviceIndex = 4438, - BuiltInViewIndex = 4440, - BuiltInShadingRateKHR = 4444, - BuiltInBaryCoordNoPerspAMD = 4992, - BuiltInBaryCoordNoPerspCentroidAMD = 4993, - BuiltInBaryCoordNoPerspSampleAMD = 4994, - BuiltInBaryCoordSmoothAMD = 4995, - BuiltInBaryCoordSmoothCentroidAMD = 4996, - BuiltInBaryCoordSmoothSampleAMD = 4997, - BuiltInBaryCoordPullModelAMD = 4998, - BuiltInFragStencilRefEXT = 5014, - BuiltInViewportMaskNV = 5253, - BuiltInSecondaryPositionNV = 5257, - BuiltInSecondaryViewportMaskNV = 5258, - BuiltInPositionPerViewNV = 5261, - BuiltInViewportMaskPerViewNV = 5262, - BuiltInFullyCoveredEXT = 5264, - BuiltInTaskCountNV = 5274, - BuiltInPrimitiveCountNV = 5275, - BuiltInPrimitiveIndicesNV = 5276, - BuiltInClipDistancePerViewNV = 5277, - BuiltInCullDistancePerViewNV = 5278, - BuiltInLayerPerViewNV = 5279, - BuiltInMeshViewCountNV = 5280, - BuiltInMeshViewIndicesNV = 5281, - BuiltInBaryCoordKHR = 5286, - BuiltInBaryCoordNV = 5286, - BuiltInBaryCoordNoPerspKHR = 5287, - BuiltInBaryCoordNoPerspNV = 5287, - BuiltInFragSizeEXT = 5292, - BuiltInFragmentSizeNV = 5292, - BuiltInFragInvocationCountEXT = 5293, - BuiltInInvocationsPerPixelNV = 5293, - BuiltInPrimitivePointIndicesEXT = 5294, - BuiltInPrimitiveLineIndicesEXT = 5295, - BuiltInPrimitiveTriangleIndicesEXT = 5296, - BuiltInCullPrimitiveEXT = 5299, - BuiltInLaunchIdKHR = 5319, - BuiltInLaunchIdNV = 5319, - BuiltInLaunchSizeKHR = 5320, - BuiltInLaunchSizeNV = 5320, - BuiltInWorldRayOriginKHR = 5321, - BuiltInWorldRayOriginNV = 5321, - BuiltInWorldRayDirectionKHR = 5322, - BuiltInWorldRayDirectionNV = 5322, - BuiltInObjectRayOriginKHR = 5323, - BuiltInObjectRayOriginNV = 5323, - BuiltInObjectRayDirectionKHR = 5324, - BuiltInObjectRayDirectionNV = 5324, - BuiltInRayTminKHR = 5325, - BuiltInRayTminNV = 5325, - BuiltInRayTmaxKHR = 5326, - BuiltInRayTmaxNV = 5326, - BuiltInInstanceCustomIndexKHR = 5327, - BuiltInInstanceCustomIndexNV = 5327, - BuiltInObjectToWorldKHR = 5330, - BuiltInObjectToWorldNV = 5330, - BuiltInWorldToObjectKHR = 5331, - BuiltInWorldToObjectNV = 5331, - BuiltInHitTNV = 5332, - BuiltInHitKindKHR = 5333, - BuiltInHitKindNV = 5333, - BuiltInCurrentRayTimeNV = 5334, - BuiltInIncomingRayFlagsKHR = 5351, - BuiltInIncomingRayFlagsNV = 5351, - BuiltInRayGeometryIndexKHR = 5352, - BuiltInWarpsPerSMNV = 5374, - BuiltInSMCountNV = 5375, - BuiltInWarpIDNV = 5376, - BuiltInSMIDNV = 5377, - BuiltInCullMaskKHR = 6021, - BuiltInMax = 0x7fffffff, -}; - -enum SelectionControlShift { - SelectionControlFlattenShift = 0, - SelectionControlDontFlattenShift = 1, - SelectionControlMax = 0x7fffffff, -}; - -enum SelectionControlMask { - SelectionControlMaskNone = 0, - SelectionControlFlattenMask = 0x00000001, - SelectionControlDontFlattenMask = 0x00000002, -}; - -enum LoopControlShift { - LoopControlUnrollShift = 0, - LoopControlDontUnrollShift = 1, - LoopControlDependencyInfiniteShift = 2, - LoopControlDependencyLengthShift = 3, - LoopControlMinIterationsShift = 4, - LoopControlMaxIterationsShift = 5, - LoopControlIterationMultipleShift = 6, - LoopControlPeelCountShift = 7, - LoopControlPartialCountShift = 8, - LoopControlInitiationIntervalINTELShift = 16, - LoopControlMaxConcurrencyINTELShift = 17, - LoopControlDependencyArrayINTELShift = 18, - LoopControlPipelineEnableINTELShift = 19, - LoopControlLoopCoalesceINTELShift = 20, - LoopControlMaxInterleavingINTELShift = 21, - LoopControlSpeculatedIterationsINTELShift = 22, - LoopControlNoFusionINTELShift = 23, - LoopControlMax = 0x7fffffff, -}; - -enum LoopControlMask { - LoopControlMaskNone = 0, - LoopControlUnrollMask = 0x00000001, - LoopControlDontUnrollMask = 0x00000002, - LoopControlDependencyInfiniteMask = 0x00000004, - LoopControlDependencyLengthMask = 0x00000008, - LoopControlMinIterationsMask = 0x00000010, - LoopControlMaxIterationsMask = 0x00000020, - LoopControlIterationMultipleMask = 0x00000040, - LoopControlPeelCountMask = 0x00000080, - LoopControlPartialCountMask = 0x00000100, - LoopControlInitiationIntervalINTELMask = 0x00010000, - LoopControlMaxConcurrencyINTELMask = 0x00020000, - LoopControlDependencyArrayINTELMask = 0x00040000, - LoopControlPipelineEnableINTELMask = 0x00080000, - LoopControlLoopCoalesceINTELMask = 0x00100000, - LoopControlMaxInterleavingINTELMask = 0x00200000, - LoopControlSpeculatedIterationsINTELMask = 0x00400000, - LoopControlNoFusionINTELMask = 0x00800000, -}; - -enum FunctionControlShift { - FunctionControlInlineShift = 0, - FunctionControlDontInlineShift = 1, - FunctionControlPureShift = 2, - FunctionControlConstShift = 3, - FunctionControlOptNoneINTELShift = 16, - FunctionControlMax = 0x7fffffff, -}; - -enum FunctionControlMask { - FunctionControlMaskNone = 0, - FunctionControlInlineMask = 0x00000001, - FunctionControlDontInlineMask = 0x00000002, - FunctionControlPureMask = 0x00000004, - FunctionControlConstMask = 0x00000008, - FunctionControlOptNoneINTELMask = 0x00010000, -}; - -enum MemorySemanticsShift { - MemorySemanticsAcquireShift = 1, - MemorySemanticsReleaseShift = 2, - MemorySemanticsAcquireReleaseShift = 3, - MemorySemanticsSequentiallyConsistentShift = 4, - MemorySemanticsUniformMemoryShift = 6, - MemorySemanticsSubgroupMemoryShift = 7, - MemorySemanticsWorkgroupMemoryShift = 8, - MemorySemanticsCrossWorkgroupMemoryShift = 9, - MemorySemanticsAtomicCounterMemoryShift = 10, - MemorySemanticsImageMemoryShift = 11, - MemorySemanticsOutputMemoryShift = 12, - MemorySemanticsOutputMemoryKHRShift = 12, - MemorySemanticsMakeAvailableShift = 13, - MemorySemanticsMakeAvailableKHRShift = 13, - MemorySemanticsMakeVisibleShift = 14, - MemorySemanticsMakeVisibleKHRShift = 14, - MemorySemanticsVolatileShift = 15, - MemorySemanticsMax = 0x7fffffff, -}; - -enum MemorySemanticsMask { - MemorySemanticsMaskNone = 0, - MemorySemanticsAcquireMask = 0x00000002, - MemorySemanticsReleaseMask = 0x00000004, - MemorySemanticsAcquireReleaseMask = 0x00000008, - MemorySemanticsSequentiallyConsistentMask = 0x00000010, - MemorySemanticsUniformMemoryMask = 0x00000040, - MemorySemanticsSubgroupMemoryMask = 0x00000080, - MemorySemanticsWorkgroupMemoryMask = 0x00000100, - MemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, - MemorySemanticsAtomicCounterMemoryMask = 0x00000400, - MemorySemanticsImageMemoryMask = 0x00000800, - MemorySemanticsOutputMemoryMask = 0x00001000, - MemorySemanticsOutputMemoryKHRMask = 0x00001000, - MemorySemanticsMakeAvailableMask = 0x00002000, - MemorySemanticsMakeAvailableKHRMask = 0x00002000, - MemorySemanticsMakeVisibleMask = 0x00004000, - MemorySemanticsMakeVisibleKHRMask = 0x00004000, - MemorySemanticsVolatileMask = 0x00008000, -}; - -enum MemoryAccessShift { - MemoryAccessVolatileShift = 0, - MemoryAccessAlignedShift = 1, - MemoryAccessNontemporalShift = 2, - MemoryAccessMakePointerAvailableShift = 3, - MemoryAccessMakePointerAvailableKHRShift = 3, - MemoryAccessMakePointerVisibleShift = 4, - MemoryAccessMakePointerVisibleKHRShift = 4, - MemoryAccessNonPrivatePointerShift = 5, - MemoryAccessNonPrivatePointerKHRShift = 5, - MemoryAccessMax = 0x7fffffff, -}; - -enum MemoryAccessMask { - MemoryAccessMaskNone = 0, - MemoryAccessVolatileMask = 0x00000001, - MemoryAccessAlignedMask = 0x00000002, - MemoryAccessNontemporalMask = 0x00000004, - MemoryAccessMakePointerAvailableMask = 0x00000008, - MemoryAccessMakePointerAvailableKHRMask = 0x00000008, - MemoryAccessMakePointerVisibleMask = 0x00000010, - MemoryAccessMakePointerVisibleKHRMask = 0x00000010, - MemoryAccessNonPrivatePointerMask = 0x00000020, - MemoryAccessNonPrivatePointerKHRMask = 0x00000020, -}; - -enum Scope { - ScopeCrossDevice = 0, - ScopeDevice = 1, - ScopeWorkgroup = 2, - ScopeSubgroup = 3, - ScopeInvocation = 4, - ScopeQueueFamily = 5, - ScopeQueueFamilyKHR = 5, - ScopeShaderCallKHR = 6, - ScopeMax = 0x7fffffff, -}; - -enum GroupOperation { - GroupOperationReduce = 0, - GroupOperationInclusiveScan = 1, - GroupOperationExclusiveScan = 2, - GroupOperationClusteredReduce = 3, - GroupOperationPartitionedReduceNV = 6, - GroupOperationPartitionedInclusiveScanNV = 7, - GroupOperationPartitionedExclusiveScanNV = 8, - GroupOperationMax = 0x7fffffff, -}; - -enum KernelEnqueueFlags { - KernelEnqueueFlagsNoWait = 0, - KernelEnqueueFlagsWaitKernel = 1, - KernelEnqueueFlagsWaitWorkGroup = 2, - KernelEnqueueFlagsMax = 0x7fffffff, -}; - -enum KernelProfilingInfoShift { - KernelProfilingInfoCmdExecTimeShift = 0, - KernelProfilingInfoMax = 0x7fffffff, -}; - -enum KernelProfilingInfoMask { - KernelProfilingInfoMaskNone = 0, - KernelProfilingInfoCmdExecTimeMask = 0x00000001, -}; - -enum Capability { - CapabilityMatrix = 0, - CapabilityShader = 1, - CapabilityGeometry = 2, - CapabilityTessellation = 3, - CapabilityAddresses = 4, - CapabilityLinkage = 5, - CapabilityKernel = 6, - CapabilityVector16 = 7, - CapabilityFloat16Buffer = 8, - CapabilityFloat16 = 9, - CapabilityFloat64 = 10, - CapabilityInt64 = 11, - CapabilityInt64Atomics = 12, - CapabilityImageBasic = 13, - CapabilityImageReadWrite = 14, - CapabilityImageMipmap = 15, - CapabilityPipes = 17, - CapabilityGroups = 18, - CapabilityDeviceEnqueue = 19, - CapabilityLiteralSampler = 20, - CapabilityAtomicStorage = 21, - CapabilityInt16 = 22, - CapabilityTessellationPointSize = 23, - CapabilityGeometryPointSize = 24, - CapabilityImageGatherExtended = 25, - CapabilityStorageImageMultisample = 27, - CapabilityUniformBufferArrayDynamicIndexing = 28, - CapabilitySampledImageArrayDynamicIndexing = 29, - CapabilityStorageBufferArrayDynamicIndexing = 30, - CapabilityStorageImageArrayDynamicIndexing = 31, - CapabilityClipDistance = 32, - CapabilityCullDistance = 33, - CapabilityImageCubeArray = 34, - CapabilitySampleRateShading = 35, - CapabilityImageRect = 36, - CapabilitySampledRect = 37, - CapabilityGenericPointer = 38, - CapabilityInt8 = 39, - CapabilityInputAttachment = 40, - CapabilitySparseResidency = 41, - CapabilityMinLod = 42, - CapabilitySampled1D = 43, - CapabilityImage1D = 44, - CapabilitySampledCubeArray = 45, - CapabilitySampledBuffer = 46, - CapabilityImageBuffer = 47, - CapabilityImageMSArray = 48, - CapabilityStorageImageExtendedFormats = 49, - CapabilityImageQuery = 50, - CapabilityDerivativeControl = 51, - CapabilityInterpolationFunction = 52, - CapabilityTransformFeedback = 53, - CapabilityGeometryStreams = 54, - CapabilityStorageImageReadWithoutFormat = 55, - CapabilityStorageImageWriteWithoutFormat = 56, - CapabilityMultiViewport = 57, - CapabilitySubgroupDispatch = 58, - CapabilityNamedBarrier = 59, - CapabilityPipeStorage = 60, - CapabilityGroupNonUniform = 61, - CapabilityGroupNonUniformVote = 62, - CapabilityGroupNonUniformArithmetic = 63, - CapabilityGroupNonUniformBallot = 64, - CapabilityGroupNonUniformShuffle = 65, - CapabilityGroupNonUniformShuffleRelative = 66, - CapabilityGroupNonUniformClustered = 67, - CapabilityGroupNonUniformQuad = 68, - CapabilityShaderLayer = 69, - CapabilityShaderViewportIndex = 70, - CapabilityUniformDecoration = 71, - CapabilityFragmentShadingRateKHR = 4422, - CapabilitySubgroupBallotKHR = 4423, - CapabilityDrawParameters = 4427, - CapabilityWorkgroupMemoryExplicitLayoutKHR = 4428, - CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR = 4429, - CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR = 4430, - CapabilitySubgroupVoteKHR = 4431, - CapabilityStorageBuffer16BitAccess = 4433, - CapabilityStorageUniformBufferBlock16 = 4433, - CapabilityStorageUniform16 = 4434, - CapabilityUniformAndStorageBuffer16BitAccess = 4434, - CapabilityStoragePushConstant16 = 4435, - CapabilityStorageInputOutput16 = 4436, - CapabilityDeviceGroup = 4437, - CapabilityMultiView = 4439, - CapabilityVariablePointersStorageBuffer = 4441, - CapabilityVariablePointers = 4442, - CapabilityAtomicStorageOps = 4445, - CapabilitySampleMaskPostDepthCoverage = 4447, - CapabilityStorageBuffer8BitAccess = 4448, - CapabilityUniformAndStorageBuffer8BitAccess = 4449, - CapabilityStoragePushConstant8 = 4450, - CapabilityDenormPreserve = 4464, - CapabilityDenormFlushToZero = 4465, - CapabilitySignedZeroInfNanPreserve = 4466, - CapabilityRoundingModeRTE = 4467, - CapabilityRoundingModeRTZ = 4468, - CapabilityRayQueryProvisionalKHR = 4471, - CapabilityRayQueryKHR = 4472, - CapabilityRayTraversalPrimitiveCullingKHR = 4478, - CapabilityRayTracingKHR = 4479, - CapabilityFloat16ImageAMD = 5008, - CapabilityImageGatherBiasLodAMD = 5009, - CapabilityFragmentMaskAMD = 5010, - CapabilityStencilExportEXT = 5013, - CapabilityImageReadWriteLodAMD = 5015, - CapabilityInt64ImageEXT = 5016, - CapabilityShaderClockKHR = 5055, - CapabilitySampleMaskOverrideCoverageNV = 5249, - CapabilityGeometryShaderPassthroughNV = 5251, - CapabilityShaderViewportIndexLayerEXT = 5254, - CapabilityShaderViewportIndexLayerNV = 5254, - CapabilityShaderViewportMaskNV = 5255, - CapabilityShaderStereoViewNV = 5259, - CapabilityPerViewAttributesNV = 5260, - CapabilityFragmentFullyCoveredEXT = 5265, - CapabilityMeshShadingNV = 5266, - CapabilityImageFootprintNV = 5282, - CapabilityMeshShadingEXT = 5283, - CapabilityFragmentBarycentricKHR = 5284, - CapabilityFragmentBarycentricNV = 5284, - CapabilityComputeDerivativeGroupQuadsNV = 5288, - CapabilityFragmentDensityEXT = 5291, - CapabilityShadingRateNV = 5291, - CapabilityGroupNonUniformPartitionedNV = 5297, - CapabilityShaderNonUniform = 5301, - CapabilityShaderNonUniformEXT = 5301, - CapabilityRuntimeDescriptorArray = 5302, - CapabilityRuntimeDescriptorArrayEXT = 5302, - CapabilityInputAttachmentArrayDynamicIndexing = 5303, - CapabilityInputAttachmentArrayDynamicIndexingEXT = 5303, - CapabilityUniformTexelBufferArrayDynamicIndexing = 5304, - CapabilityUniformTexelBufferArrayDynamicIndexingEXT = 5304, - CapabilityStorageTexelBufferArrayDynamicIndexing = 5305, - CapabilityStorageTexelBufferArrayDynamicIndexingEXT = 5305, - CapabilityUniformBufferArrayNonUniformIndexing = 5306, - CapabilityUniformBufferArrayNonUniformIndexingEXT = 5306, - CapabilitySampledImageArrayNonUniformIndexing = 5307, - CapabilitySampledImageArrayNonUniformIndexingEXT = 5307, - CapabilityStorageBufferArrayNonUniformIndexing = 5308, - CapabilityStorageBufferArrayNonUniformIndexingEXT = 5308, - CapabilityStorageImageArrayNonUniformIndexing = 5309, - CapabilityStorageImageArrayNonUniformIndexingEXT = 5309, - CapabilityInputAttachmentArrayNonUniformIndexing = 5310, - CapabilityInputAttachmentArrayNonUniformIndexingEXT = 5310, - CapabilityUniformTexelBufferArrayNonUniformIndexing = 5311, - CapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311, - CapabilityStorageTexelBufferArrayNonUniformIndexing = 5312, - CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312, - CapabilityRayTracingNV = 5340, - CapabilityRayTracingMotionBlurNV = 5341, - CapabilityVulkanMemoryModel = 5345, - CapabilityVulkanMemoryModelKHR = 5345, - CapabilityVulkanMemoryModelDeviceScope = 5346, - CapabilityVulkanMemoryModelDeviceScopeKHR = 5346, - CapabilityPhysicalStorageBufferAddresses = 5347, - CapabilityPhysicalStorageBufferAddressesEXT = 5347, - CapabilityComputeDerivativeGroupLinearNV = 5350, - CapabilityRayTracingProvisionalKHR = 5353, - CapabilityCooperativeMatrixNV = 5357, - CapabilityFragmentShaderSampleInterlockEXT = 5363, - CapabilityFragmentShaderShadingRateInterlockEXT = 5372, - CapabilityShaderSMBuiltinsNV = 5373, - CapabilityFragmentShaderPixelInterlockEXT = 5378, - CapabilityDemoteToHelperInvocation = 5379, - CapabilityDemoteToHelperInvocationEXT = 5379, - CapabilityBindlessTextureNV = 5390, - CapabilitySubgroupShuffleINTEL = 5568, - CapabilitySubgroupBufferBlockIOINTEL = 5569, - CapabilitySubgroupImageBlockIOINTEL = 5570, - CapabilitySubgroupImageMediaBlockIOINTEL = 5579, - CapabilityRoundToInfinityINTEL = 5582, - CapabilityFloatingPointModeINTEL = 5583, - CapabilityIntegerFunctions2INTEL = 5584, - CapabilityFunctionPointersINTEL = 5603, - CapabilityIndirectReferencesINTEL = 5604, - CapabilityAsmINTEL = 5606, - CapabilityAtomicFloat32MinMaxEXT = 5612, - CapabilityAtomicFloat64MinMaxEXT = 5613, - CapabilityAtomicFloat16MinMaxEXT = 5616, - CapabilityVectorComputeINTEL = 5617, - CapabilityVectorAnyINTEL = 5619, - CapabilityExpectAssumeKHR = 5629, - CapabilitySubgroupAvcMotionEstimationINTEL = 5696, - CapabilitySubgroupAvcMotionEstimationIntraINTEL = 5697, - CapabilitySubgroupAvcMotionEstimationChromaINTEL = 5698, - CapabilityVariableLengthArrayINTEL = 5817, - CapabilityFunctionFloatControlINTEL = 5821, - CapabilityFPGAMemoryAttributesINTEL = 5824, - CapabilityFPFastMathModeINTEL = 5837, - CapabilityArbitraryPrecisionIntegersINTEL = 5844, - CapabilityArbitraryPrecisionFloatingPointINTEL = 5845, - CapabilityUnstructuredLoopControlsINTEL = 5886, - CapabilityFPGALoopControlsINTEL = 5888, - CapabilityKernelAttributesINTEL = 5892, - CapabilityFPGAKernelAttributesINTEL = 5897, - CapabilityFPGAMemoryAccessesINTEL = 5898, - CapabilityFPGAClusterAttributesINTEL = 5904, - CapabilityLoopFuseINTEL = 5906, - CapabilityFPGABufferLocationINTEL = 5920, - CapabilityArbitraryPrecisionFixedPointINTEL = 5922, - CapabilityUSMStorageClassesINTEL = 5935, - CapabilityIOPipesINTEL = 5943, - CapabilityBlockingPipesINTEL = 5945, - CapabilityFPGARegINTEL = 5948, - CapabilityDotProductInputAll = 6016, - CapabilityDotProductInputAllKHR = 6016, - CapabilityDotProductInput4x8Bit = 6017, - CapabilityDotProductInput4x8BitKHR = 6017, - CapabilityDotProductInput4x8BitPacked = 6018, - CapabilityDotProductInput4x8BitPackedKHR = 6018, - CapabilityDotProduct = 6019, - CapabilityDotProductKHR = 6019, - CapabilityRayCullMaskKHR = 6020, - CapabilityBitInstructions = 6025, - CapabilityAtomicFloat32AddEXT = 6033, - CapabilityAtomicFloat64AddEXT = 6034, - CapabilityLongConstantCompositeINTEL = 6089, - CapabilityOptNoneINTEL = 6094, - CapabilityAtomicFloat16AddEXT = 6095, - CapabilityDebugInfoModuleINTEL = 6114, - CapabilityMax = 0x7fffffff, -}; - -enum RayFlagsShift { - RayFlagsOpaqueKHRShift = 0, - RayFlagsNoOpaqueKHRShift = 1, - RayFlagsTerminateOnFirstHitKHRShift = 2, - RayFlagsSkipClosestHitShaderKHRShift = 3, - RayFlagsCullBackFacingTrianglesKHRShift = 4, - RayFlagsCullFrontFacingTrianglesKHRShift = 5, - RayFlagsCullOpaqueKHRShift = 6, - RayFlagsCullNoOpaqueKHRShift = 7, - RayFlagsSkipTrianglesKHRShift = 8, - RayFlagsSkipAABBsKHRShift = 9, - RayFlagsMax = 0x7fffffff, -}; - -enum RayFlagsMask { - RayFlagsMaskNone = 0, - RayFlagsOpaqueKHRMask = 0x00000001, - RayFlagsNoOpaqueKHRMask = 0x00000002, - RayFlagsTerminateOnFirstHitKHRMask = 0x00000004, - RayFlagsSkipClosestHitShaderKHRMask = 0x00000008, - RayFlagsCullBackFacingTrianglesKHRMask = 0x00000010, - RayFlagsCullFrontFacingTrianglesKHRMask = 0x00000020, - RayFlagsCullOpaqueKHRMask = 0x00000040, - RayFlagsCullNoOpaqueKHRMask = 0x00000080, - RayFlagsSkipTrianglesKHRMask = 0x00000100, - RayFlagsSkipAABBsKHRMask = 0x00000200, -}; - -enum RayQueryIntersection { - RayQueryIntersectionRayQueryCandidateIntersectionKHR = 0, - RayQueryIntersectionRayQueryCommittedIntersectionKHR = 1, - RayQueryIntersectionMax = 0x7fffffff, -}; - -enum RayQueryCommittedIntersectionType { - RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionNoneKHR = 0, - RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionTriangleKHR = 1, - RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionGeneratedKHR = 2, - RayQueryCommittedIntersectionTypeMax = 0x7fffffff, -}; - -enum RayQueryCandidateIntersectionType { - RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionTriangleKHR = 0, - RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionAABBKHR = 1, - RayQueryCandidateIntersectionTypeMax = 0x7fffffff, -}; - -enum FragmentShadingRateShift { - FragmentShadingRateVertical2PixelsShift = 0, - FragmentShadingRateVertical4PixelsShift = 1, - FragmentShadingRateHorizontal2PixelsShift = 2, - FragmentShadingRateHorizontal4PixelsShift = 3, - FragmentShadingRateMax = 0x7fffffff, -}; - -enum FragmentShadingRateMask { - FragmentShadingRateMaskNone = 0, - FragmentShadingRateVertical2PixelsMask = 0x00000001, - FragmentShadingRateVertical4PixelsMask = 0x00000002, - FragmentShadingRateHorizontal2PixelsMask = 0x00000004, - FragmentShadingRateHorizontal4PixelsMask = 0x00000008, -}; - -enum FPDenormMode { - FPDenormModePreserve = 0, - FPDenormModeFlushToZero = 1, - FPDenormModeMax = 0x7fffffff, -}; - -enum FPOperationMode { - FPOperationModeIEEE = 0, - FPOperationModeALT = 1, - FPOperationModeMax = 0x7fffffff, -}; - -enum QuantizationModes { - QuantizationModesTRN = 0, - QuantizationModesTRN_ZERO = 1, - QuantizationModesRND = 2, - QuantizationModesRND_ZERO = 3, - QuantizationModesRND_INF = 4, - QuantizationModesRND_MIN_INF = 5, - QuantizationModesRND_CONV = 6, - QuantizationModesRND_CONV_ODD = 7, - QuantizationModesMax = 0x7fffffff, -}; - -enum OverflowModes { - OverflowModesWRAP = 0, - OverflowModesSAT = 1, - OverflowModesSAT_ZERO = 2, - OverflowModesSAT_SYM = 3, - OverflowModesMax = 0x7fffffff, -}; - -enum PackedVectorFormat { - PackedVectorFormatPackedVectorFormat4x8Bit = 0, - PackedVectorFormatPackedVectorFormat4x8BitKHR = 0, - PackedVectorFormatMax = 0x7fffffff, -}; - -enum Op { - OpNop = 0, - OpUndef = 1, - OpSourceContinued = 2, - OpSource = 3, - OpSourceExtension = 4, - OpName = 5, - OpMemberName = 6, - OpString = 7, - OpLine = 8, - OpExtension = 10, - OpExtInstImport = 11, - OpExtInst = 12, - OpMemoryModel = 14, - OpEntryPoint = 15, - OpExecutionMode = 16, - OpCapability = 17, - OpTypeVoid = 19, - OpTypeBool = 20, - OpTypeInt = 21, - OpTypeFloat = 22, - OpTypeVector = 23, - OpTypeMatrix = 24, - OpTypeImage = 25, - OpTypeSampler = 26, - OpTypeSampledImage = 27, - OpTypeArray = 28, - OpTypeRuntimeArray = 29, - OpTypeStruct = 30, - OpTypeOpaque = 31, - OpTypePointer = 32, - OpTypeFunction = 33, - OpTypeEvent = 34, - OpTypeDeviceEvent = 35, - OpTypeReserveId = 36, - OpTypeQueue = 37, - OpTypePipe = 38, - OpTypeForwardPointer = 39, - OpConstantTrue = 41, - OpConstantFalse = 42, - OpConstant = 43, - OpConstantComposite = 44, - OpConstantSampler = 45, - OpConstantNull = 46, - OpSpecConstantTrue = 48, - OpSpecConstantFalse = 49, - OpSpecConstant = 50, - OpSpecConstantComposite = 51, - OpSpecConstantOp = 52, - OpFunction = 54, - OpFunctionParameter = 55, - OpFunctionEnd = 56, - OpFunctionCall = 57, - OpVariable = 59, - OpImageTexelPointer = 60, - OpLoad = 61, - OpStore = 62, - OpCopyMemory = 63, - OpCopyMemorySized = 64, - OpAccessChain = 65, - OpInBoundsAccessChain = 66, - OpPtrAccessChain = 67, - OpArrayLength = 68, - OpGenericPtrMemSemantics = 69, - OpInBoundsPtrAccessChain = 70, - OpDecorate = 71, - OpMemberDecorate = 72, - OpDecorationGroup = 73, - OpGroupDecorate = 74, - OpGroupMemberDecorate = 75, - OpVectorExtractDynamic = 77, - OpVectorInsertDynamic = 78, - OpVectorShuffle = 79, - OpCompositeConstruct = 80, - OpCompositeExtract = 81, - OpCompositeInsert = 82, - OpCopyObject = 83, - OpTranspose = 84, - OpSampledImage = 86, - OpImageSampleImplicitLod = 87, - OpImageSampleExplicitLod = 88, - OpImageSampleDrefImplicitLod = 89, - OpImageSampleDrefExplicitLod = 90, - OpImageSampleProjImplicitLod = 91, - OpImageSampleProjExplicitLod = 92, - OpImageSampleProjDrefImplicitLod = 93, - OpImageSampleProjDrefExplicitLod = 94, - OpImageFetch = 95, - OpImageGather = 96, - OpImageDrefGather = 97, - OpImageRead = 98, - OpImageWrite = 99, - OpImage = 100, - OpImageQueryFormat = 101, - OpImageQueryOrder = 102, - OpImageQuerySizeLod = 103, - OpImageQuerySize = 104, - OpImageQueryLod = 105, - OpImageQueryLevels = 106, - OpImageQuerySamples = 107, - OpConvertFToU = 109, - OpConvertFToS = 110, - OpConvertSToF = 111, - OpConvertUToF = 112, - OpUConvert = 113, - OpSConvert = 114, - OpFConvert = 115, - OpQuantizeToF16 = 116, - OpConvertPtrToU = 117, - OpSatConvertSToU = 118, - OpSatConvertUToS = 119, - OpConvertUToPtr = 120, - OpPtrCastToGeneric = 121, - OpGenericCastToPtr = 122, - OpGenericCastToPtrExplicit = 123, - OpBitcast = 124, - OpSNegate = 126, - OpFNegate = 127, - OpIAdd = 128, - OpFAdd = 129, - OpISub = 130, - OpFSub = 131, - OpIMul = 132, - OpFMul = 133, - OpUDiv = 134, - OpSDiv = 135, - OpFDiv = 136, - OpUMod = 137, - OpSRem = 138, - OpSMod = 139, - OpFRem = 140, - OpFMod = 141, - OpVectorTimesScalar = 142, - OpMatrixTimesScalar = 143, - OpVectorTimesMatrix = 144, - OpMatrixTimesVector = 145, - OpMatrixTimesMatrix = 146, - OpOuterProduct = 147, - OpDot = 148, - OpIAddCarry = 149, - OpISubBorrow = 150, - OpUMulExtended = 151, - OpSMulExtended = 152, - OpAny = 154, - OpAll = 155, - OpIsNan = 156, - OpIsInf = 157, - OpIsFinite = 158, - OpIsNormal = 159, - OpSignBitSet = 160, - OpLessOrGreater = 161, - OpOrdered = 162, - OpUnordered = 163, - OpLogicalEqual = 164, - OpLogicalNotEqual = 165, - OpLogicalOr = 166, - OpLogicalAnd = 167, - OpLogicalNot = 168, - OpSelect = 169, - OpIEqual = 170, - OpINotEqual = 171, - OpUGreaterThan = 172, - OpSGreaterThan = 173, - OpUGreaterThanEqual = 174, - OpSGreaterThanEqual = 175, - OpULessThan = 176, - OpSLessThan = 177, - OpULessThanEqual = 178, - OpSLessThanEqual = 179, - OpFOrdEqual = 180, - OpFUnordEqual = 181, - OpFOrdNotEqual = 182, - OpFUnordNotEqual = 183, - OpFOrdLessThan = 184, - OpFUnordLessThan = 185, - OpFOrdGreaterThan = 186, - OpFUnordGreaterThan = 187, - OpFOrdLessThanEqual = 188, - OpFUnordLessThanEqual = 189, - OpFOrdGreaterThanEqual = 190, - OpFUnordGreaterThanEqual = 191, - OpShiftRightLogical = 194, - OpShiftRightArithmetic = 195, - OpShiftLeftLogical = 196, - OpBitwiseOr = 197, - OpBitwiseXor = 198, - OpBitwiseAnd = 199, - OpNot = 200, - OpBitFieldInsert = 201, - OpBitFieldSExtract = 202, - OpBitFieldUExtract = 203, - OpBitReverse = 204, - OpBitCount = 205, - OpDPdx = 207, - OpDPdy = 208, - OpFwidth = 209, - OpDPdxFine = 210, - OpDPdyFine = 211, - OpFwidthFine = 212, - OpDPdxCoarse = 213, - OpDPdyCoarse = 214, - OpFwidthCoarse = 215, - OpEmitVertex = 218, - OpEndPrimitive = 219, - OpEmitStreamVertex = 220, - OpEndStreamPrimitive = 221, - OpControlBarrier = 224, - OpMemoryBarrier = 225, - OpAtomicLoad = 227, - OpAtomicStore = 228, - OpAtomicExchange = 229, - OpAtomicCompareExchange = 230, - OpAtomicCompareExchangeWeak = 231, - OpAtomicIIncrement = 232, - OpAtomicIDecrement = 233, - OpAtomicIAdd = 234, - OpAtomicISub = 235, - OpAtomicSMin = 236, - OpAtomicUMin = 237, - OpAtomicSMax = 238, - OpAtomicUMax = 239, - OpAtomicAnd = 240, - OpAtomicOr = 241, - OpAtomicXor = 242, - OpPhi = 245, - OpLoopMerge = 246, - OpSelectionMerge = 247, - OpLabel = 248, - OpBranch = 249, - OpBranchConditional = 250, - OpSwitch = 251, - OpKill = 252, - OpReturn = 253, - OpReturnValue = 254, - OpUnreachable = 255, - OpLifetimeStart = 256, - OpLifetimeStop = 257, - OpGroupAsyncCopy = 259, - OpGroupWaitEvents = 260, - OpGroupAll = 261, - OpGroupAny = 262, - OpGroupBroadcast = 263, - OpGroupIAdd = 264, - OpGroupFAdd = 265, - OpGroupFMin = 266, - OpGroupUMin = 267, - OpGroupSMin = 268, - OpGroupFMax = 269, - OpGroupUMax = 270, - OpGroupSMax = 271, - OpReadPipe = 274, - OpWritePipe = 275, - OpReservedReadPipe = 276, - OpReservedWritePipe = 277, - OpReserveReadPipePackets = 278, - OpReserveWritePipePackets = 279, - OpCommitReadPipe = 280, - OpCommitWritePipe = 281, - OpIsValidReserveId = 282, - OpGetNumPipePackets = 283, - OpGetMaxPipePackets = 284, - OpGroupReserveReadPipePackets = 285, - OpGroupReserveWritePipePackets = 286, - OpGroupCommitReadPipe = 287, - OpGroupCommitWritePipe = 288, - OpEnqueueMarker = 291, - OpEnqueueKernel = 292, - OpGetKernelNDrangeSubGroupCount = 293, - OpGetKernelNDrangeMaxSubGroupSize = 294, - OpGetKernelWorkGroupSize = 295, - OpGetKernelPreferredWorkGroupSizeMultiple = 296, - OpRetainEvent = 297, - OpReleaseEvent = 298, - OpCreateUserEvent = 299, - OpIsValidEvent = 300, - OpSetUserEventStatus = 301, - OpCaptureEventProfilingInfo = 302, - OpGetDefaultQueue = 303, - OpBuildNDRange = 304, - OpImageSparseSampleImplicitLod = 305, - OpImageSparseSampleExplicitLod = 306, - OpImageSparseSampleDrefImplicitLod = 307, - OpImageSparseSampleDrefExplicitLod = 308, - OpImageSparseSampleProjImplicitLod = 309, - OpImageSparseSampleProjExplicitLod = 310, - OpImageSparseSampleProjDrefImplicitLod = 311, - OpImageSparseSampleProjDrefExplicitLod = 312, - OpImageSparseFetch = 313, - OpImageSparseGather = 314, - OpImageSparseDrefGather = 315, - OpImageSparseTexelsResident = 316, - OpNoLine = 317, - OpAtomicFlagTestAndSet = 318, - OpAtomicFlagClear = 319, - OpImageSparseRead = 320, - OpSizeOf = 321, - OpTypePipeStorage = 322, - OpConstantPipeStorage = 323, - OpCreatePipeFromPipeStorage = 324, - OpGetKernelLocalSizeForSubgroupCount = 325, - OpGetKernelMaxNumSubgroups = 326, - OpTypeNamedBarrier = 327, - OpNamedBarrierInitialize = 328, - OpMemoryNamedBarrier = 329, - OpModuleProcessed = 330, - OpExecutionModeId = 331, - OpDecorateId = 332, - OpGroupNonUniformElect = 333, - OpGroupNonUniformAll = 334, - OpGroupNonUniformAny = 335, - OpGroupNonUniformAllEqual = 336, - OpGroupNonUniformBroadcast = 337, - OpGroupNonUniformBroadcastFirst = 338, - OpGroupNonUniformBallot = 339, - OpGroupNonUniformInverseBallot = 340, - OpGroupNonUniformBallotBitExtract = 341, - OpGroupNonUniformBallotBitCount = 342, - OpGroupNonUniformBallotFindLSB = 343, - OpGroupNonUniformBallotFindMSB = 344, - OpGroupNonUniformShuffle = 345, - OpGroupNonUniformShuffleXor = 346, - OpGroupNonUniformShuffleUp = 347, - OpGroupNonUniformShuffleDown = 348, - OpGroupNonUniformIAdd = 349, - OpGroupNonUniformFAdd = 350, - OpGroupNonUniformIMul = 351, - OpGroupNonUniformFMul = 352, - OpGroupNonUniformSMin = 353, - OpGroupNonUniformUMin = 354, - OpGroupNonUniformFMin = 355, - OpGroupNonUniformSMax = 356, - OpGroupNonUniformUMax = 357, - OpGroupNonUniformFMax = 358, - OpGroupNonUniformBitwiseAnd = 359, - OpGroupNonUniformBitwiseOr = 360, - OpGroupNonUniformBitwiseXor = 361, - OpGroupNonUniformLogicalAnd = 362, - OpGroupNonUniformLogicalOr = 363, - OpGroupNonUniformLogicalXor = 364, - OpGroupNonUniformQuadBroadcast = 365, - OpGroupNonUniformQuadSwap = 366, - OpCopyLogical = 400, - OpPtrEqual = 401, - OpPtrNotEqual = 402, - OpPtrDiff = 403, - OpTerminateInvocation = 4416, - OpSubgroupBallotKHR = 4421, - OpSubgroupFirstInvocationKHR = 4422, - OpSubgroupAllKHR = 4428, - OpSubgroupAnyKHR = 4429, - OpSubgroupAllEqualKHR = 4430, - OpSubgroupReadInvocationKHR = 4432, - OpTraceRayKHR = 4445, - OpExecuteCallableKHR = 4446, - OpConvertUToAccelerationStructureKHR = 4447, - OpIgnoreIntersectionKHR = 4448, - OpTerminateRayKHR = 4449, - OpSDot = 4450, - OpSDotKHR = 4450, - OpUDot = 4451, - OpUDotKHR = 4451, - OpSUDot = 4452, - OpSUDotKHR = 4452, - OpSDotAccSat = 4453, - OpSDotAccSatKHR = 4453, - OpUDotAccSat = 4454, - OpUDotAccSatKHR = 4454, - OpSUDotAccSat = 4455, - OpSUDotAccSatKHR = 4455, - OpTypeRayQueryKHR = 4472, - OpRayQueryInitializeKHR = 4473, - OpRayQueryTerminateKHR = 4474, - OpRayQueryGenerateIntersectionKHR = 4475, - OpRayQueryConfirmIntersectionKHR = 4476, - OpRayQueryProceedKHR = 4477, - OpRayQueryGetIntersectionTypeKHR = 4479, - OpGroupIAddNonUniformAMD = 5000, - OpGroupFAddNonUniformAMD = 5001, - OpGroupFMinNonUniformAMD = 5002, - OpGroupUMinNonUniformAMD = 5003, - OpGroupSMinNonUniformAMD = 5004, - OpGroupFMaxNonUniformAMD = 5005, - OpGroupUMaxNonUniformAMD = 5006, - OpGroupSMaxNonUniformAMD = 5007, - OpFragmentMaskFetchAMD = 5011, - OpFragmentFetchAMD = 5012, - OpReadClockKHR = 5056, - OpImageSampleFootprintNV = 5283, - OpEmitMeshTasksEXT = 5294, - OpSetMeshOutputsEXT = 5295, - OpGroupNonUniformPartitionNV = 5296, - OpWritePackedPrimitiveIndices4x8NV = 5299, - OpReportIntersectionKHR = 5334, - OpReportIntersectionNV = 5334, - OpIgnoreIntersectionNV = 5335, - OpTerminateRayNV = 5336, - OpTraceNV = 5337, - OpTraceMotionNV = 5338, - OpTraceRayMotionNV = 5339, - OpTypeAccelerationStructureKHR = 5341, - OpTypeAccelerationStructureNV = 5341, - OpExecuteCallableNV = 5344, - OpTypeCooperativeMatrixNV = 5358, - OpCooperativeMatrixLoadNV = 5359, - OpCooperativeMatrixStoreNV = 5360, - OpCooperativeMatrixMulAddNV = 5361, - OpCooperativeMatrixLengthNV = 5362, - OpBeginInvocationInterlockEXT = 5364, - OpEndInvocationInterlockEXT = 5365, - OpDemoteToHelperInvocation = 5380, - OpDemoteToHelperInvocationEXT = 5380, - OpIsHelperInvocationEXT = 5381, - OpConvertUToImageNV = 5391, - OpConvertUToSamplerNV = 5392, - OpConvertImageToUNV = 5393, - OpConvertSamplerToUNV = 5394, - OpConvertUToSampledImageNV = 5395, - OpConvertSampledImageToUNV = 5396, - OpSamplerImageAddressingModeNV = 5397, - OpSubgroupShuffleINTEL = 5571, - OpSubgroupShuffleDownINTEL = 5572, - OpSubgroupShuffleUpINTEL = 5573, - OpSubgroupShuffleXorINTEL = 5574, - OpSubgroupBlockReadINTEL = 5575, - OpSubgroupBlockWriteINTEL = 5576, - OpSubgroupImageBlockReadINTEL = 5577, - OpSubgroupImageBlockWriteINTEL = 5578, - OpSubgroupImageMediaBlockReadINTEL = 5580, - OpSubgroupImageMediaBlockWriteINTEL = 5581, - OpUCountLeadingZerosINTEL = 5585, - OpUCountTrailingZerosINTEL = 5586, - OpAbsISubINTEL = 5587, - OpAbsUSubINTEL = 5588, - OpIAddSatINTEL = 5589, - OpUAddSatINTEL = 5590, - OpIAverageINTEL = 5591, - OpUAverageINTEL = 5592, - OpIAverageRoundedINTEL = 5593, - OpUAverageRoundedINTEL = 5594, - OpISubSatINTEL = 5595, - OpUSubSatINTEL = 5596, - OpIMul32x16INTEL = 5597, - OpUMul32x16INTEL = 5598, - OpConstantFunctionPointerINTEL = 5600, - OpFunctionPointerCallINTEL = 5601, - OpAsmTargetINTEL = 5609, - OpAsmINTEL = 5610, - OpAsmCallINTEL = 5611, - OpAtomicFMinEXT = 5614, - OpAtomicFMaxEXT = 5615, - OpAssumeTrueKHR = 5630, - OpExpectKHR = 5631, - OpDecorateString = 5632, - OpDecorateStringGOOGLE = 5632, - OpMemberDecorateString = 5633, - OpMemberDecorateStringGOOGLE = 5633, - OpVmeImageINTEL = 5699, - OpTypeVmeImageINTEL = 5700, - OpTypeAvcImePayloadINTEL = 5701, - OpTypeAvcRefPayloadINTEL = 5702, - OpTypeAvcSicPayloadINTEL = 5703, - OpTypeAvcMcePayloadINTEL = 5704, - OpTypeAvcMceResultINTEL = 5705, - OpTypeAvcImeResultINTEL = 5706, - OpTypeAvcImeResultSingleReferenceStreamoutINTEL = 5707, - OpTypeAvcImeResultDualReferenceStreamoutINTEL = 5708, - OpTypeAvcImeSingleReferenceStreaminINTEL = 5709, - OpTypeAvcImeDualReferenceStreaminINTEL = 5710, - OpTypeAvcRefResultINTEL = 5711, - OpTypeAvcSicResultINTEL = 5712, - OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL = 5713, - OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL = 5714, - OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL = 5715, - OpSubgroupAvcMceSetInterShapePenaltyINTEL = 5716, - OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL = 5717, - OpSubgroupAvcMceSetInterDirectionPenaltyINTEL = 5718, - OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL = 5719, - OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL = 5720, - OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL = 5721, - OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL = 5722, - OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL = 5723, - OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL = 5724, - OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL = 5725, - OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL = 5726, - OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL = 5727, - OpSubgroupAvcMceSetAcOnlyHaarINTEL = 5728, - OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL = 5729, - OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL = 5730, - OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL = 5731, - OpSubgroupAvcMceConvertToImePayloadINTEL = 5732, - OpSubgroupAvcMceConvertToImeResultINTEL = 5733, - OpSubgroupAvcMceConvertToRefPayloadINTEL = 5734, - OpSubgroupAvcMceConvertToRefResultINTEL = 5735, - OpSubgroupAvcMceConvertToSicPayloadINTEL = 5736, - OpSubgroupAvcMceConvertToSicResultINTEL = 5737, - OpSubgroupAvcMceGetMotionVectorsINTEL = 5738, - OpSubgroupAvcMceGetInterDistortionsINTEL = 5739, - OpSubgroupAvcMceGetBestInterDistortionsINTEL = 5740, - OpSubgroupAvcMceGetInterMajorShapeINTEL = 5741, - OpSubgroupAvcMceGetInterMinorShapeINTEL = 5742, - OpSubgroupAvcMceGetInterDirectionsINTEL = 5743, - OpSubgroupAvcMceGetInterMotionVectorCountINTEL = 5744, - OpSubgroupAvcMceGetInterReferenceIdsINTEL = 5745, - OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL = 5746, - OpSubgroupAvcImeInitializeINTEL = 5747, - OpSubgroupAvcImeSetSingleReferenceINTEL = 5748, - OpSubgroupAvcImeSetDualReferenceINTEL = 5749, - OpSubgroupAvcImeRefWindowSizeINTEL = 5750, - OpSubgroupAvcImeAdjustRefOffsetINTEL = 5751, - OpSubgroupAvcImeConvertToMcePayloadINTEL = 5752, - OpSubgroupAvcImeSetMaxMotionVectorCountINTEL = 5753, - OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL = 5754, - OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL = 5755, - OpSubgroupAvcImeSetWeightedSadINTEL = 5756, - OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL = 5757, - OpSubgroupAvcImeEvaluateWithDualReferenceINTEL = 5758, - OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL = 5759, - OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL = 5760, - OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL = 5761, - OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL = 5762, - OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL = 5763, - OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL = 5764, - OpSubgroupAvcImeConvertToMceResultINTEL = 5765, - OpSubgroupAvcImeGetSingleReferenceStreaminINTEL = 5766, - OpSubgroupAvcImeGetDualReferenceStreaminINTEL = 5767, - OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL = 5768, - OpSubgroupAvcImeStripDualReferenceStreamoutINTEL = 5769, - OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL = 5770, - OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL = 5771, - OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL = 5772, - OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL = 5773, - OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL = 5774, - OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL = 5775, - OpSubgroupAvcImeGetBorderReachedINTEL = 5776, - OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL = 5777, - OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL = 5778, - OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL = 5779, - OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL = 5780, - OpSubgroupAvcFmeInitializeINTEL = 5781, - OpSubgroupAvcBmeInitializeINTEL = 5782, - OpSubgroupAvcRefConvertToMcePayloadINTEL = 5783, - OpSubgroupAvcRefSetBidirectionalMixDisableINTEL = 5784, - OpSubgroupAvcRefSetBilinearFilterEnableINTEL = 5785, - OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL = 5786, - OpSubgroupAvcRefEvaluateWithDualReferenceINTEL = 5787, - OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL = 5788, - OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL = 5789, - OpSubgroupAvcRefConvertToMceResultINTEL = 5790, - OpSubgroupAvcSicInitializeINTEL = 5791, - OpSubgroupAvcSicConfigureSkcINTEL = 5792, - OpSubgroupAvcSicConfigureIpeLumaINTEL = 5793, - OpSubgroupAvcSicConfigureIpeLumaChromaINTEL = 5794, - OpSubgroupAvcSicGetMotionVectorMaskINTEL = 5795, - OpSubgroupAvcSicConvertToMcePayloadINTEL = 5796, - OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL = 5797, - OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL = 5798, - OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL = 5799, - OpSubgroupAvcSicSetBilinearFilterEnableINTEL = 5800, - OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL = 5801, - OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL = 5802, - OpSubgroupAvcSicEvaluateIpeINTEL = 5803, - OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL = 5804, - OpSubgroupAvcSicEvaluateWithDualReferenceINTEL = 5805, - OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL = 5806, - OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL = 5807, - OpSubgroupAvcSicConvertToMceResultINTEL = 5808, - OpSubgroupAvcSicGetIpeLumaShapeINTEL = 5809, - OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL = 5810, - OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL = 5811, - OpSubgroupAvcSicGetPackedIpeLumaModesINTEL = 5812, - OpSubgroupAvcSicGetIpeChromaModeINTEL = 5813, - OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814, - OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815, - OpSubgroupAvcSicGetInterRawSadsINTEL = 5816, - OpVariableLengthArrayINTEL = 5818, - OpSaveMemoryINTEL = 5819, - OpRestoreMemoryINTEL = 5820, - OpArbitraryFloatSinCosPiINTEL = 5840, - OpArbitraryFloatCastINTEL = 5841, - OpArbitraryFloatCastFromIntINTEL = 5842, - OpArbitraryFloatCastToIntINTEL = 5843, - OpArbitraryFloatAddINTEL = 5846, - OpArbitraryFloatSubINTEL = 5847, - OpArbitraryFloatMulINTEL = 5848, - OpArbitraryFloatDivINTEL = 5849, - OpArbitraryFloatGTINTEL = 5850, - OpArbitraryFloatGEINTEL = 5851, - OpArbitraryFloatLTINTEL = 5852, - OpArbitraryFloatLEINTEL = 5853, - OpArbitraryFloatEQINTEL = 5854, - OpArbitraryFloatRecipINTEL = 5855, - OpArbitraryFloatRSqrtINTEL = 5856, - OpArbitraryFloatCbrtINTEL = 5857, - OpArbitraryFloatHypotINTEL = 5858, - OpArbitraryFloatSqrtINTEL = 5859, - OpArbitraryFloatLogINTEL = 5860, - OpArbitraryFloatLog2INTEL = 5861, - OpArbitraryFloatLog10INTEL = 5862, - OpArbitraryFloatLog1pINTEL = 5863, - OpArbitraryFloatExpINTEL = 5864, - OpArbitraryFloatExp2INTEL = 5865, - OpArbitraryFloatExp10INTEL = 5866, - OpArbitraryFloatExpm1INTEL = 5867, - OpArbitraryFloatSinINTEL = 5868, - OpArbitraryFloatCosINTEL = 5869, - OpArbitraryFloatSinCosINTEL = 5870, - OpArbitraryFloatSinPiINTEL = 5871, - OpArbitraryFloatCosPiINTEL = 5872, - OpArbitraryFloatASinINTEL = 5873, - OpArbitraryFloatASinPiINTEL = 5874, - OpArbitraryFloatACosINTEL = 5875, - OpArbitraryFloatACosPiINTEL = 5876, - OpArbitraryFloatATanINTEL = 5877, - OpArbitraryFloatATanPiINTEL = 5878, - OpArbitraryFloatATan2INTEL = 5879, - OpArbitraryFloatPowINTEL = 5880, - OpArbitraryFloatPowRINTEL = 5881, - OpArbitraryFloatPowNINTEL = 5882, - OpLoopControlINTEL = 5887, - OpFixedSqrtINTEL = 5923, - OpFixedRecipINTEL = 5924, - OpFixedRsqrtINTEL = 5925, - OpFixedSinINTEL = 5926, - OpFixedCosINTEL = 5927, - OpFixedSinCosINTEL = 5928, - OpFixedSinPiINTEL = 5929, - OpFixedCosPiINTEL = 5930, - OpFixedSinCosPiINTEL = 5931, - OpFixedLogINTEL = 5932, - OpFixedExpINTEL = 5933, - OpPtrCastToCrossWorkgroupINTEL = 5934, - OpCrossWorkgroupCastToPtrINTEL = 5938, - OpReadPipeBlockingINTEL = 5946, - OpWritePipeBlockingINTEL = 5947, - OpFPGARegINTEL = 5949, - OpRayQueryGetRayTMinKHR = 6016, - OpRayQueryGetRayFlagsKHR = 6017, - OpRayQueryGetIntersectionTKHR = 6018, - OpRayQueryGetIntersectionInstanceCustomIndexKHR = 6019, - OpRayQueryGetIntersectionInstanceIdKHR = 6020, - OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR = 6021, - OpRayQueryGetIntersectionGeometryIndexKHR = 6022, - OpRayQueryGetIntersectionPrimitiveIndexKHR = 6023, - OpRayQueryGetIntersectionBarycentricsKHR = 6024, - OpRayQueryGetIntersectionFrontFaceKHR = 6025, - OpRayQueryGetIntersectionCandidateAABBOpaqueKHR = 6026, - OpRayQueryGetIntersectionObjectRayDirectionKHR = 6027, - OpRayQueryGetIntersectionObjectRayOriginKHR = 6028, - OpRayQueryGetWorldRayDirectionKHR = 6029, - OpRayQueryGetWorldRayOriginKHR = 6030, - OpRayQueryGetIntersectionObjectToWorldKHR = 6031, - OpRayQueryGetIntersectionWorldToObjectKHR = 6032, - OpAtomicFAddEXT = 6035, - OpTypeBufferSurfaceINTEL = 6086, - OpTypeStructContinuedINTEL = 6090, - OpConstantCompositeContinuedINTEL = 6091, - OpSpecConstantCompositeContinuedINTEL = 6092, - OpMax = 0x7fffffff, -}; - -#ifdef SPV_ENABLE_UTILITY_CODE -inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { - *hasResult = *hasResultType = false; - switch (opcode) { - default: /* unknown opcode */ break; - case OpNop: *hasResult = false; *hasResultType = false; break; - case OpUndef: *hasResult = true; *hasResultType = true; break; - case OpSourceContinued: *hasResult = false; *hasResultType = false; break; - case OpSource: *hasResult = false; *hasResultType = false; break; - case OpSourceExtension: *hasResult = false; *hasResultType = false; break; - case OpName: *hasResult = false; *hasResultType = false; break; - case OpMemberName: *hasResult = false; *hasResultType = false; break; - case OpString: *hasResult = true; *hasResultType = false; break; - case OpLine: *hasResult = false; *hasResultType = false; break; - case OpExtension: *hasResult = false; *hasResultType = false; break; - case OpExtInstImport: *hasResult = true; *hasResultType = false; break; - case OpExtInst: *hasResult = true; *hasResultType = true; break; - case OpMemoryModel: *hasResult = false; *hasResultType = false; break; - case OpEntryPoint: *hasResult = false; *hasResultType = false; break; - case OpExecutionMode: *hasResult = false; *hasResultType = false; break; - case OpCapability: *hasResult = false; *hasResultType = false; break; - case OpTypeVoid: *hasResult = true; *hasResultType = false; break; - case OpTypeBool: *hasResult = true; *hasResultType = false; break; - case OpTypeInt: *hasResult = true; *hasResultType = false; break; - case OpTypeFloat: *hasResult = true; *hasResultType = false; break; - case OpTypeVector: *hasResult = true; *hasResultType = false; break; - case OpTypeMatrix: *hasResult = true; *hasResultType = false; break; - case OpTypeImage: *hasResult = true; *hasResultType = false; break; - case OpTypeSampler: *hasResult = true; *hasResultType = false; break; - case OpTypeSampledImage: *hasResult = true; *hasResultType = false; break; - case OpTypeArray: *hasResult = true; *hasResultType = false; break; - case OpTypeRuntimeArray: *hasResult = true; *hasResultType = false; break; - case OpTypeStruct: *hasResult = true; *hasResultType = false; break; - case OpTypeOpaque: *hasResult = true; *hasResultType = false; break; - case OpTypePointer: *hasResult = true; *hasResultType = false; break; - case OpTypeFunction: *hasResult = true; *hasResultType = false; break; - case OpTypeEvent: *hasResult = true; *hasResultType = false; break; - case OpTypeDeviceEvent: *hasResult = true; *hasResultType = false; break; - case OpTypeReserveId: *hasResult = true; *hasResultType = false; break; - case OpTypeQueue: *hasResult = true; *hasResultType = false; break; - case OpTypePipe: *hasResult = true; *hasResultType = false; break; - case OpTypeForwardPointer: *hasResult = false; *hasResultType = false; break; - case OpConstantTrue: *hasResult = true; *hasResultType = true; break; - case OpConstantFalse: *hasResult = true; *hasResultType = true; break; - case OpConstant: *hasResult = true; *hasResultType = true; break; - case OpConstantComposite: *hasResult = true; *hasResultType = true; break; - case OpConstantSampler: *hasResult = true; *hasResultType = true; break; - case OpConstantNull: *hasResult = true; *hasResultType = true; break; - case OpSpecConstantTrue: *hasResult = true; *hasResultType = true; break; - case OpSpecConstantFalse: *hasResult = true; *hasResultType = true; break; - case OpSpecConstant: *hasResult = true; *hasResultType = true; break; - case OpSpecConstantComposite: *hasResult = true; *hasResultType = true; break; - case OpSpecConstantOp: *hasResult = true; *hasResultType = true; break; - case OpFunction: *hasResult = true; *hasResultType = true; break; - case OpFunctionParameter: *hasResult = true; *hasResultType = true; break; - case OpFunctionEnd: *hasResult = false; *hasResultType = false; break; - case OpFunctionCall: *hasResult = true; *hasResultType = true; break; - case OpVariable: *hasResult = true; *hasResultType = true; break; - case OpImageTexelPointer: *hasResult = true; *hasResultType = true; break; - case OpLoad: *hasResult = true; *hasResultType = true; break; - case OpStore: *hasResult = false; *hasResultType = false; break; - case OpCopyMemory: *hasResult = false; *hasResultType = false; break; - case OpCopyMemorySized: *hasResult = false; *hasResultType = false; break; - case OpAccessChain: *hasResult = true; *hasResultType = true; break; - case OpInBoundsAccessChain: *hasResult = true; *hasResultType = true; break; - case OpPtrAccessChain: *hasResult = true; *hasResultType = true; break; - case OpArrayLength: *hasResult = true; *hasResultType = true; break; - case OpGenericPtrMemSemantics: *hasResult = true; *hasResultType = true; break; - case OpInBoundsPtrAccessChain: *hasResult = true; *hasResultType = true; break; - case OpDecorate: *hasResult = false; *hasResultType = false; break; - case OpMemberDecorate: *hasResult = false; *hasResultType = false; break; - case OpDecorationGroup: *hasResult = true; *hasResultType = false; break; - case OpGroupDecorate: *hasResult = false; *hasResultType = false; break; - case OpGroupMemberDecorate: *hasResult = false; *hasResultType = false; break; - case OpVectorExtractDynamic: *hasResult = true; *hasResultType = true; break; - case OpVectorInsertDynamic: *hasResult = true; *hasResultType = true; break; - case OpVectorShuffle: *hasResult = true; *hasResultType = true; break; - case OpCompositeConstruct: *hasResult = true; *hasResultType = true; break; - case OpCompositeExtract: *hasResult = true; *hasResultType = true; break; - case OpCompositeInsert: *hasResult = true; *hasResultType = true; break; - case OpCopyObject: *hasResult = true; *hasResultType = true; break; - case OpTranspose: *hasResult = true; *hasResultType = true; break; - case OpSampledImage: *hasResult = true; *hasResultType = true; break; - case OpImageSampleImplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSampleExplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSampleDrefImplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSampleDrefExplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSampleProjImplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSampleProjExplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSampleProjDrefImplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSampleProjDrefExplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageFetch: *hasResult = true; *hasResultType = true; break; - case OpImageGather: *hasResult = true; *hasResultType = true; break; - case OpImageDrefGather: *hasResult = true; *hasResultType = true; break; - case OpImageRead: *hasResult = true; *hasResultType = true; break; - case OpImageWrite: *hasResult = false; *hasResultType = false; break; - case OpImage: *hasResult = true; *hasResultType = true; break; - case OpImageQueryFormat: *hasResult = true; *hasResultType = true; break; - case OpImageQueryOrder: *hasResult = true; *hasResultType = true; break; - case OpImageQuerySizeLod: *hasResult = true; *hasResultType = true; break; - case OpImageQuerySize: *hasResult = true; *hasResultType = true; break; - case OpImageQueryLod: *hasResult = true; *hasResultType = true; break; - case OpImageQueryLevels: *hasResult = true; *hasResultType = true; break; - case OpImageQuerySamples: *hasResult = true; *hasResultType = true; break; - case OpConvertFToU: *hasResult = true; *hasResultType = true; break; - case OpConvertFToS: *hasResult = true; *hasResultType = true; break; - case OpConvertSToF: *hasResult = true; *hasResultType = true; break; - case OpConvertUToF: *hasResult = true; *hasResultType = true; break; - case OpUConvert: *hasResult = true; *hasResultType = true; break; - case OpSConvert: *hasResult = true; *hasResultType = true; break; - case OpFConvert: *hasResult = true; *hasResultType = true; break; - case OpQuantizeToF16: *hasResult = true; *hasResultType = true; break; - case OpConvertPtrToU: *hasResult = true; *hasResultType = true; break; - case OpSatConvertSToU: *hasResult = true; *hasResultType = true; break; - case OpSatConvertUToS: *hasResult = true; *hasResultType = true; break; - case OpConvertUToPtr: *hasResult = true; *hasResultType = true; break; - case OpPtrCastToGeneric: *hasResult = true; *hasResultType = true; break; - case OpGenericCastToPtr: *hasResult = true; *hasResultType = true; break; - case OpGenericCastToPtrExplicit: *hasResult = true; *hasResultType = true; break; - case OpBitcast: *hasResult = true; *hasResultType = true; break; - case OpSNegate: *hasResult = true; *hasResultType = true; break; - case OpFNegate: *hasResult = true; *hasResultType = true; break; - case OpIAdd: *hasResult = true; *hasResultType = true; break; - case OpFAdd: *hasResult = true; *hasResultType = true; break; - case OpISub: *hasResult = true; *hasResultType = true; break; - case OpFSub: *hasResult = true; *hasResultType = true; break; - case OpIMul: *hasResult = true; *hasResultType = true; break; - case OpFMul: *hasResult = true; *hasResultType = true; break; - case OpUDiv: *hasResult = true; *hasResultType = true; break; - case OpSDiv: *hasResult = true; *hasResultType = true; break; - case OpFDiv: *hasResult = true; *hasResultType = true; break; - case OpUMod: *hasResult = true; *hasResultType = true; break; - case OpSRem: *hasResult = true; *hasResultType = true; break; - case OpSMod: *hasResult = true; *hasResultType = true; break; - case OpFRem: *hasResult = true; *hasResultType = true; break; - case OpFMod: *hasResult = true; *hasResultType = true; break; - case OpVectorTimesScalar: *hasResult = true; *hasResultType = true; break; - case OpMatrixTimesScalar: *hasResult = true; *hasResultType = true; break; - case OpVectorTimesMatrix: *hasResult = true; *hasResultType = true; break; - case OpMatrixTimesVector: *hasResult = true; *hasResultType = true; break; - case OpMatrixTimesMatrix: *hasResult = true; *hasResultType = true; break; - case OpOuterProduct: *hasResult = true; *hasResultType = true; break; - case OpDot: *hasResult = true; *hasResultType = true; break; - case OpIAddCarry: *hasResult = true; *hasResultType = true; break; - case OpISubBorrow: *hasResult = true; *hasResultType = true; break; - case OpUMulExtended: *hasResult = true; *hasResultType = true; break; - case OpSMulExtended: *hasResult = true; *hasResultType = true; break; - case OpAny: *hasResult = true; *hasResultType = true; break; - case OpAll: *hasResult = true; *hasResultType = true; break; - case OpIsNan: *hasResult = true; *hasResultType = true; break; - case OpIsInf: *hasResult = true; *hasResultType = true; break; - case OpIsFinite: *hasResult = true; *hasResultType = true; break; - case OpIsNormal: *hasResult = true; *hasResultType = true; break; - case OpSignBitSet: *hasResult = true; *hasResultType = true; break; - case OpLessOrGreater: *hasResult = true; *hasResultType = true; break; - case OpOrdered: *hasResult = true; *hasResultType = true; break; - case OpUnordered: *hasResult = true; *hasResultType = true; break; - case OpLogicalEqual: *hasResult = true; *hasResultType = true; break; - case OpLogicalNotEqual: *hasResult = true; *hasResultType = true; break; - case OpLogicalOr: *hasResult = true; *hasResultType = true; break; - case OpLogicalAnd: *hasResult = true; *hasResultType = true; break; - case OpLogicalNot: *hasResult = true; *hasResultType = true; break; - case OpSelect: *hasResult = true; *hasResultType = true; break; - case OpIEqual: *hasResult = true; *hasResultType = true; break; - case OpINotEqual: *hasResult = true; *hasResultType = true; break; - case OpUGreaterThan: *hasResult = true; *hasResultType = true; break; - case OpSGreaterThan: *hasResult = true; *hasResultType = true; break; - case OpUGreaterThanEqual: *hasResult = true; *hasResultType = true; break; - case OpSGreaterThanEqual: *hasResult = true; *hasResultType = true; break; - case OpULessThan: *hasResult = true; *hasResultType = true; break; - case OpSLessThan: *hasResult = true; *hasResultType = true; break; - case OpULessThanEqual: *hasResult = true; *hasResultType = true; break; - case OpSLessThanEqual: *hasResult = true; *hasResultType = true; break; - case OpFOrdEqual: *hasResult = true; *hasResultType = true; break; - case OpFUnordEqual: *hasResult = true; *hasResultType = true; break; - case OpFOrdNotEqual: *hasResult = true; *hasResultType = true; break; - case OpFUnordNotEqual: *hasResult = true; *hasResultType = true; break; - case OpFOrdLessThan: *hasResult = true; *hasResultType = true; break; - case OpFUnordLessThan: *hasResult = true; *hasResultType = true; break; - case OpFOrdGreaterThan: *hasResult = true; *hasResultType = true; break; - case OpFUnordGreaterThan: *hasResult = true; *hasResultType = true; break; - case OpFOrdLessThanEqual: *hasResult = true; *hasResultType = true; break; - case OpFUnordLessThanEqual: *hasResult = true; *hasResultType = true; break; - case OpFOrdGreaterThanEqual: *hasResult = true; *hasResultType = true; break; - case OpFUnordGreaterThanEqual: *hasResult = true; *hasResultType = true; break; - case OpShiftRightLogical: *hasResult = true; *hasResultType = true; break; - case OpShiftRightArithmetic: *hasResult = true; *hasResultType = true; break; - case OpShiftLeftLogical: *hasResult = true; *hasResultType = true; break; - case OpBitwiseOr: *hasResult = true; *hasResultType = true; break; - case OpBitwiseXor: *hasResult = true; *hasResultType = true; break; - case OpBitwiseAnd: *hasResult = true; *hasResultType = true; break; - case OpNot: *hasResult = true; *hasResultType = true; break; - case OpBitFieldInsert: *hasResult = true; *hasResultType = true; break; - case OpBitFieldSExtract: *hasResult = true; *hasResultType = true; break; - case OpBitFieldUExtract: *hasResult = true; *hasResultType = true; break; - case OpBitReverse: *hasResult = true; *hasResultType = true; break; - case OpBitCount: *hasResult = true; *hasResultType = true; break; - case OpDPdx: *hasResult = true; *hasResultType = true; break; - case OpDPdy: *hasResult = true; *hasResultType = true; break; - case OpFwidth: *hasResult = true; *hasResultType = true; break; - case OpDPdxFine: *hasResult = true; *hasResultType = true; break; - case OpDPdyFine: *hasResult = true; *hasResultType = true; break; - case OpFwidthFine: *hasResult = true; *hasResultType = true; break; - case OpDPdxCoarse: *hasResult = true; *hasResultType = true; break; - case OpDPdyCoarse: *hasResult = true; *hasResultType = true; break; - case OpFwidthCoarse: *hasResult = true; *hasResultType = true; break; - case OpEmitVertex: *hasResult = false; *hasResultType = false; break; - case OpEndPrimitive: *hasResult = false; *hasResultType = false; break; - case OpEmitStreamVertex: *hasResult = false; *hasResultType = false; break; - case OpEndStreamPrimitive: *hasResult = false; *hasResultType = false; break; - case OpControlBarrier: *hasResult = false; *hasResultType = false; break; - case OpMemoryBarrier: *hasResult = false; *hasResultType = false; break; - case OpAtomicLoad: *hasResult = true; *hasResultType = true; break; - case OpAtomicStore: *hasResult = false; *hasResultType = false; break; - case OpAtomicExchange: *hasResult = true; *hasResultType = true; break; - case OpAtomicCompareExchange: *hasResult = true; *hasResultType = true; break; - case OpAtomicCompareExchangeWeak: *hasResult = true; *hasResultType = true; break; - case OpAtomicIIncrement: *hasResult = true; *hasResultType = true; break; - case OpAtomicIDecrement: *hasResult = true; *hasResultType = true; break; - case OpAtomicIAdd: *hasResult = true; *hasResultType = true; break; - case OpAtomicISub: *hasResult = true; *hasResultType = true; break; - case OpAtomicSMin: *hasResult = true; *hasResultType = true; break; - case OpAtomicUMin: *hasResult = true; *hasResultType = true; break; - case OpAtomicSMax: *hasResult = true; *hasResultType = true; break; - case OpAtomicUMax: *hasResult = true; *hasResultType = true; break; - case OpAtomicAnd: *hasResult = true; *hasResultType = true; break; - case OpAtomicOr: *hasResult = true; *hasResultType = true; break; - case OpAtomicXor: *hasResult = true; *hasResultType = true; break; - case OpPhi: *hasResult = true; *hasResultType = true; break; - case OpLoopMerge: *hasResult = false; *hasResultType = false; break; - case OpSelectionMerge: *hasResult = false; *hasResultType = false; break; - case OpLabel: *hasResult = true; *hasResultType = false; break; - case OpBranch: *hasResult = false; *hasResultType = false; break; - case OpBranchConditional: *hasResult = false; *hasResultType = false; break; - case OpSwitch: *hasResult = false; *hasResultType = false; break; - case OpKill: *hasResult = false; *hasResultType = false; break; - case OpReturn: *hasResult = false; *hasResultType = false; break; - case OpReturnValue: *hasResult = false; *hasResultType = false; break; - case OpUnreachable: *hasResult = false; *hasResultType = false; break; - case OpLifetimeStart: *hasResult = false; *hasResultType = false; break; - case OpLifetimeStop: *hasResult = false; *hasResultType = false; break; - case OpGroupAsyncCopy: *hasResult = true; *hasResultType = true; break; - case OpGroupWaitEvents: *hasResult = false; *hasResultType = false; break; - case OpGroupAll: *hasResult = true; *hasResultType = true; break; - case OpGroupAny: *hasResult = true; *hasResultType = true; break; - case OpGroupBroadcast: *hasResult = true; *hasResultType = true; break; - case OpGroupIAdd: *hasResult = true; *hasResultType = true; break; - case OpGroupFAdd: *hasResult = true; *hasResultType = true; break; - case OpGroupFMin: *hasResult = true; *hasResultType = true; break; - case OpGroupUMin: *hasResult = true; *hasResultType = true; break; - case OpGroupSMin: *hasResult = true; *hasResultType = true; break; - case OpGroupFMax: *hasResult = true; *hasResultType = true; break; - case OpGroupUMax: *hasResult = true; *hasResultType = true; break; - case OpGroupSMax: *hasResult = true; *hasResultType = true; break; - case OpReadPipe: *hasResult = true; *hasResultType = true; break; - case OpWritePipe: *hasResult = true; *hasResultType = true; break; - case OpReservedReadPipe: *hasResult = true; *hasResultType = true; break; - case OpReservedWritePipe: *hasResult = true; *hasResultType = true; break; - case OpReserveReadPipePackets: *hasResult = true; *hasResultType = true; break; - case OpReserveWritePipePackets: *hasResult = true; *hasResultType = true; break; - case OpCommitReadPipe: *hasResult = false; *hasResultType = false; break; - case OpCommitWritePipe: *hasResult = false; *hasResultType = false; break; - case OpIsValidReserveId: *hasResult = true; *hasResultType = true; break; - case OpGetNumPipePackets: *hasResult = true; *hasResultType = true; break; - case OpGetMaxPipePackets: *hasResult = true; *hasResultType = true; break; - case OpGroupReserveReadPipePackets: *hasResult = true; *hasResultType = true; break; - case OpGroupReserveWritePipePackets: *hasResult = true; *hasResultType = true; break; - case OpGroupCommitReadPipe: *hasResult = false; *hasResultType = false; break; - case OpGroupCommitWritePipe: *hasResult = false; *hasResultType = false; break; - case OpEnqueueMarker: *hasResult = true; *hasResultType = true; break; - case OpEnqueueKernel: *hasResult = true; *hasResultType = true; break; - case OpGetKernelNDrangeSubGroupCount: *hasResult = true; *hasResultType = true; break; - case OpGetKernelNDrangeMaxSubGroupSize: *hasResult = true; *hasResultType = true; break; - case OpGetKernelWorkGroupSize: *hasResult = true; *hasResultType = true; break; - case OpGetKernelPreferredWorkGroupSizeMultiple: *hasResult = true; *hasResultType = true; break; - case OpRetainEvent: *hasResult = false; *hasResultType = false; break; - case OpReleaseEvent: *hasResult = false; *hasResultType = false; break; - case OpCreateUserEvent: *hasResult = true; *hasResultType = true; break; - case OpIsValidEvent: *hasResult = true; *hasResultType = true; break; - case OpSetUserEventStatus: *hasResult = false; *hasResultType = false; break; - case OpCaptureEventProfilingInfo: *hasResult = false; *hasResultType = false; break; - case OpGetDefaultQueue: *hasResult = true; *hasResultType = true; break; - case OpBuildNDRange: *hasResult = true; *hasResultType = true; break; - case OpImageSparseSampleImplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSparseSampleExplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSparseSampleDrefImplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSparseSampleDrefExplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSparseSampleProjImplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSparseSampleProjExplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSparseSampleProjDrefImplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSparseSampleProjDrefExplicitLod: *hasResult = true; *hasResultType = true; break; - case OpImageSparseFetch: *hasResult = true; *hasResultType = true; break; - case OpImageSparseGather: *hasResult = true; *hasResultType = true; break; - case OpImageSparseDrefGather: *hasResult = true; *hasResultType = true; break; - case OpImageSparseTexelsResident: *hasResult = true; *hasResultType = true; break; - case OpNoLine: *hasResult = false; *hasResultType = false; break; - case OpAtomicFlagTestAndSet: *hasResult = true; *hasResultType = true; break; - case OpAtomicFlagClear: *hasResult = false; *hasResultType = false; break; - case OpImageSparseRead: *hasResult = true; *hasResultType = true; break; - case OpSizeOf: *hasResult = true; *hasResultType = true; break; - case OpTypePipeStorage: *hasResult = true; *hasResultType = false; break; - case OpConstantPipeStorage: *hasResult = true; *hasResultType = true; break; - case OpCreatePipeFromPipeStorage: *hasResult = true; *hasResultType = true; break; - case OpGetKernelLocalSizeForSubgroupCount: *hasResult = true; *hasResultType = true; break; - case OpGetKernelMaxNumSubgroups: *hasResult = true; *hasResultType = true; break; - case OpTypeNamedBarrier: *hasResult = true; *hasResultType = false; break; - case OpNamedBarrierInitialize: *hasResult = true; *hasResultType = true; break; - case OpMemoryNamedBarrier: *hasResult = false; *hasResultType = false; break; - case OpModuleProcessed: *hasResult = false; *hasResultType = false; break; - case OpExecutionModeId: *hasResult = false; *hasResultType = false; break; - case OpDecorateId: *hasResult = false; *hasResultType = false; break; - case OpGroupNonUniformElect: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformAll: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformAny: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformAllEqual: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformBroadcast: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformBroadcastFirst: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformBallot: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformInverseBallot: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformBallotBitExtract: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformBallotBitCount: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformBallotFindLSB: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformBallotFindMSB: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformShuffle: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformShuffleXor: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformShuffleUp: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformShuffleDown: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformIAdd: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformFAdd: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformIMul: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformFMul: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformSMin: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformUMin: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformFMin: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformSMax: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformUMax: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformFMax: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformBitwiseAnd: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformBitwiseOr: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformBitwiseXor: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformLogicalAnd: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformLogicalOr: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformLogicalXor: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformQuadBroadcast: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformQuadSwap: *hasResult = true; *hasResultType = true; break; - case OpCopyLogical: *hasResult = true; *hasResultType = true; break; - case OpPtrEqual: *hasResult = true; *hasResultType = true; break; - case OpPtrNotEqual: *hasResult = true; *hasResultType = true; break; - case OpPtrDiff: *hasResult = true; *hasResultType = true; break; - case OpTerminateInvocation: *hasResult = false; *hasResultType = false; break; - case OpSubgroupBallotKHR: *hasResult = true; *hasResultType = true; break; - case OpSubgroupFirstInvocationKHR: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break; - case OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break; - case OpTraceRayKHR: *hasResult = false; *hasResultType = false; break; - case OpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break; - case OpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break; - case OpIgnoreIntersectionKHR: *hasResult = false; *hasResultType = false; break; - case OpTerminateRayKHR: *hasResult = false; *hasResultType = false; break; - case OpSDot: *hasResult = true; *hasResultType = true; break; - case OpUDot: *hasResult = true; *hasResultType = true; break; - case OpSUDot: *hasResult = true; *hasResultType = true; break; - case OpSDotAccSat: *hasResult = true; *hasResultType = true; break; - case OpUDotAccSat: *hasResult = true; *hasResultType = true; break; - case OpSUDotAccSat: *hasResult = true; *hasResultType = true; break; - case OpTypeRayQueryKHR: *hasResult = true; *hasResultType = false; break; - case OpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break; - case OpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break; - case OpRayQueryGenerateIntersectionKHR: *hasResult = false; *hasResultType = false; break; - case OpRayQueryConfirmIntersectionKHR: *hasResult = false; *hasResultType = false; break; - case OpRayQueryProceedKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionTypeKHR: *hasResult = true; *hasResultType = true; break; - case OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; - case OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; - case OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; - case OpGroupUMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; - case OpGroupSMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; - case OpGroupFMaxNonUniformAMD: *hasResult = true; *hasResultType = true; break; - case OpGroupUMaxNonUniformAMD: *hasResult = true; *hasResultType = true; break; - case OpGroupSMaxNonUniformAMD: *hasResult = true; *hasResultType = true; break; - case OpFragmentMaskFetchAMD: *hasResult = true; *hasResultType = true; break; - case OpFragmentFetchAMD: *hasResult = true; *hasResultType = true; break; - case OpReadClockKHR: *hasResult = true; *hasResultType = true; break; - case OpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break; - case OpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break; - case OpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break; - case OpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break; - case OpReportIntersectionNV: *hasResult = true; *hasResultType = true; break; - case OpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break; - case OpTerminateRayNV: *hasResult = false; *hasResultType = false; break; - case OpTraceNV: *hasResult = false; *hasResultType = false; break; - case OpTraceMotionNV: *hasResult = false; *hasResultType = false; break; - case OpTraceRayMotionNV: *hasResult = false; *hasResultType = false; break; - case OpTypeAccelerationStructureNV: *hasResult = true; *hasResultType = false; break; - case OpExecuteCallableNV: *hasResult = false; *hasResultType = false; break; - case OpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break; - case OpCooperativeMatrixLoadNV: *hasResult = true; *hasResultType = true; break; - case OpCooperativeMatrixStoreNV: *hasResult = false; *hasResultType = false; break; - case OpCooperativeMatrixMulAddNV: *hasResult = true; *hasResultType = true; break; - case OpCooperativeMatrixLengthNV: *hasResult = true; *hasResultType = true; break; - case OpBeginInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break; - case OpEndInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break; - case OpDemoteToHelperInvocation: *hasResult = false; *hasResultType = false; break; - case OpIsHelperInvocationEXT: *hasResult = true; *hasResultType = true; break; - case OpConvertUToImageNV: *hasResult = true; *hasResultType = true; break; - case OpConvertUToSamplerNV: *hasResult = true; *hasResultType = true; break; - case OpConvertImageToUNV: *hasResult = true; *hasResultType = true; break; - case OpConvertSamplerToUNV: *hasResult = true; *hasResultType = true; break; - case OpConvertUToSampledImageNV: *hasResult = true; *hasResultType = true; break; - case OpConvertSampledImageToUNV: *hasResult = true; *hasResultType = true; break; - case OpSamplerImageAddressingModeNV: *hasResult = false; *hasResultType = false; break; - case OpSubgroupShuffleINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupShuffleDownINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupShuffleUpINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupShuffleXorINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupBlockReadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; - case OpSubgroupImageBlockReadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupImageBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; - case OpSubgroupImageMediaBlockReadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupImageMediaBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; - case OpUCountLeadingZerosINTEL: *hasResult = true; *hasResultType = true; break; - case OpUCountTrailingZerosINTEL: *hasResult = true; *hasResultType = true; break; - case OpAbsISubINTEL: *hasResult = true; *hasResultType = true; break; - case OpAbsUSubINTEL: *hasResult = true; *hasResultType = true; break; - case OpIAddSatINTEL: *hasResult = true; *hasResultType = true; break; - case OpUAddSatINTEL: *hasResult = true; *hasResultType = true; break; - case OpIAverageINTEL: *hasResult = true; *hasResultType = true; break; - case OpUAverageINTEL: *hasResult = true; *hasResultType = true; break; - case OpIAverageRoundedINTEL: *hasResult = true; *hasResultType = true; break; - case OpUAverageRoundedINTEL: *hasResult = true; *hasResultType = true; break; - case OpISubSatINTEL: *hasResult = true; *hasResultType = true; break; - case OpUSubSatINTEL: *hasResult = true; *hasResultType = true; break; - case OpIMul32x16INTEL: *hasResult = true; *hasResultType = true; break; - case OpUMul32x16INTEL: *hasResult = true; *hasResultType = true; break; - case OpConstantFunctionPointerINTEL: *hasResult = true; *hasResultType = true; break; - case OpFunctionPointerCallINTEL: *hasResult = true; *hasResultType = true; break; - case OpAsmTargetINTEL: *hasResult = true; *hasResultType = true; break; - case OpAsmINTEL: *hasResult = true; *hasResultType = true; break; - case OpAsmCallINTEL: *hasResult = true; *hasResultType = true; break; - case OpAtomicFMinEXT: *hasResult = true; *hasResultType = true; break; - case OpAtomicFMaxEXT: *hasResult = true; *hasResultType = true; break; - case OpAssumeTrueKHR: *hasResult = false; *hasResultType = false; break; - case OpExpectKHR: *hasResult = true; *hasResultType = true; break; - case OpDecorateString: *hasResult = false; *hasResultType = false; break; - case OpMemberDecorateString: *hasResult = false; *hasResultType = false; break; - case OpVmeImageINTEL: *hasResult = true; *hasResultType = true; break; - case OpTypeVmeImageINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcImePayloadINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcRefPayloadINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcSicPayloadINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcMcePayloadINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcMceResultINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcImeResultINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcImeResultSingleReferenceStreamoutINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcImeResultDualReferenceStreamoutINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcImeSingleReferenceStreaminINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcImeDualReferenceStreaminINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcRefResultINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeAvcSicResultINTEL: *hasResult = true; *hasResultType = false; break; - case OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceSetInterShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceSetInterDirectionPenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceSetAcOnlyHaarINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceConvertToImePayloadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceConvertToImeResultINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceConvertToRefPayloadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceConvertToRefResultINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceConvertToSicPayloadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceConvertToSicResultINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetMotionVectorsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetInterDistortionsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetBestInterDistortionsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetInterMajorShapeINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetInterMinorShapeINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetInterDirectionsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetInterMotionVectorCountINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetInterReferenceIdsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeInitializeINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeSetSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeSetDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeRefWindowSizeINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeAdjustRefOffsetINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeConvertToMcePayloadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeSetMaxMotionVectorCountINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeSetWeightedSadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeEvaluateWithDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeConvertToMceResultINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetSingleReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetDualReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeStripDualReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetBorderReachedINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcFmeInitializeINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcBmeInitializeINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcRefConvertToMcePayloadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcRefSetBidirectionalMixDisableINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcRefSetBilinearFilterEnableINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcRefEvaluateWithDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcRefConvertToMceResultINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicInitializeINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicConfigureSkcINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicConfigureIpeLumaINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicConfigureIpeLumaChromaINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicGetMotionVectorMaskINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicConvertToMcePayloadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicSetBilinearFilterEnableINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicEvaluateIpeINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicEvaluateWithDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicConvertToMceResultINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicGetIpeLumaShapeINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicGetPackedIpeLumaModesINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicGetIpeChromaModeINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL: *hasResult = true; *hasResultType = true; break; - case OpSubgroupAvcSicGetInterRawSadsINTEL: *hasResult = true; *hasResultType = true; break; - case OpVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; - case OpSaveMemoryINTEL: *hasResult = true; *hasResultType = true; break; - case OpRestoreMemoryINTEL: *hasResult = false; *hasResultType = false; break; - case OpArbitraryFloatSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatCastINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatCastFromIntINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatCastToIntINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatAddINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatSubINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatMulINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatDivINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatGTINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatGEINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatLTINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatLEINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatEQINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatRecipINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatRSqrtINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatCbrtINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatHypotINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatSqrtINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatLogINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatLog2INTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatLog10INTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatLog1pINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatExpINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatExp2INTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatExp10INTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatExpm1INTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatSinINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatCosINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatSinCosINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatSinPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatASinINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatASinPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatACosINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatACosPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatATanINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatATanPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatATan2INTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatPowINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatPowRINTEL: *hasResult = true; *hasResultType = true; break; - case OpArbitraryFloatPowNINTEL: *hasResult = true; *hasResultType = true; break; - case OpLoopControlINTEL: *hasResult = false; *hasResultType = false; break; - case OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedSinINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedCosINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedSinCosINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedSinPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedLogINTEL: *hasResult = true; *hasResultType = true; break; - case OpFixedExpINTEL: *hasResult = true; *hasResultType = true; break; - case OpPtrCastToCrossWorkgroupINTEL: *hasResult = true; *hasResultType = true; break; - case OpCrossWorkgroupCastToPtrINTEL: *hasResult = true; *hasResultType = true; break; - case OpReadPipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; - case OpWritePipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; - case OpFPGARegINTEL: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetRayTMinKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetRayFlagsKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionTKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionInstanceCustomIndexKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionInstanceIdKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionGeometryIndexKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionPrimitiveIndexKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionBarycentricsKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionFrontFaceKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionCandidateAABBOpaqueKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionObjectRayDirectionKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionObjectRayOriginKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetWorldRayDirectionKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetWorldRayOriginKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionObjectToWorldKHR: *hasResult = true; *hasResultType = true; break; - case OpRayQueryGetIntersectionWorldToObjectKHR: *hasResult = true; *hasResultType = true; break; - case OpAtomicFAddEXT: *hasResult = true; *hasResultType = true; break; - case OpTypeBufferSurfaceINTEL: *hasResult = true; *hasResultType = false; break; - case OpTypeStructContinuedINTEL: *hasResult = false; *hasResultType = false; break; - case OpConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break; - case OpSpecConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break; - } -} -#endif /* SPV_ENABLE_UTILITY_CODE */ - -// Overload operator| for mask bit combining - -inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } -inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } -inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } -inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } -inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } -inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } -inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } -inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } -inline RayFlagsMask operator|(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) | unsigned(b)); } -inline FragmentShadingRateMask operator|(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) | unsigned(b)); } - -} // end namespace spv - -#endif // #ifndef spirv_HPP +// Copyright (c) 2014-2020 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. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python, C#, D, Beef +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// - C# will use enum classes in the Specification class located in the "Spv" namespace, +// e.g.: Spv.Specification.SourceLanguage.GLSL +// - D will have tokens under the "spv" module, e.g: spv.SourceLanguage.GLSL +// - Beef will use enum classes in the Specification class located in the "Spv" namespace, +// e.g.: Spv.Specification.SourceLanguage.GLSL +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10600 +#define SPV_REVISION 1 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010600; +static const unsigned int Revision = 1; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum SourceLanguage { + SourceLanguageUnknown = 0, + SourceLanguageESSL = 1, + SourceLanguageGLSL = 2, + SourceLanguageOpenCL_C = 3, + SourceLanguageOpenCL_CPP = 4, + SourceLanguageHLSL = 5, + SourceLanguageCPP_for_OpenCL = 6, + SourceLanguageSYCL = 7, + SourceLanguageMax = 0x7fffffff, +}; + +enum ExecutionModel { + ExecutionModelVertex = 0, + ExecutionModelTessellationControl = 1, + ExecutionModelTessellationEvaluation = 2, + ExecutionModelGeometry = 3, + ExecutionModelFragment = 4, + ExecutionModelGLCompute = 5, + ExecutionModelKernel = 6, + ExecutionModelTaskNV = 5267, + ExecutionModelMeshNV = 5268, + ExecutionModelRayGenerationKHR = 5313, + ExecutionModelRayGenerationNV = 5313, + ExecutionModelIntersectionKHR = 5314, + ExecutionModelIntersectionNV = 5314, + ExecutionModelAnyHitKHR = 5315, + ExecutionModelAnyHitNV = 5315, + ExecutionModelClosestHitKHR = 5316, + ExecutionModelClosestHitNV = 5316, + ExecutionModelMissKHR = 5317, + ExecutionModelMissNV = 5317, + ExecutionModelCallableKHR = 5318, + ExecutionModelCallableNV = 5318, + ExecutionModelTaskEXT = 5364, + ExecutionModelMeshEXT = 5365, + ExecutionModelMax = 0x7fffffff, +}; + +enum AddressingModel { + AddressingModelLogical = 0, + AddressingModelPhysical32 = 1, + AddressingModelPhysical64 = 2, + AddressingModelPhysicalStorageBuffer64 = 5348, + AddressingModelPhysicalStorageBuffer64EXT = 5348, + AddressingModelMax = 0x7fffffff, +}; + +enum MemoryModel { + MemoryModelSimple = 0, + MemoryModelGLSL450 = 1, + MemoryModelOpenCL = 2, + MemoryModelVulkan = 3, + MemoryModelVulkanKHR = 3, + MemoryModelMax = 0x7fffffff, +}; + +enum ExecutionMode { + ExecutionModeInvocations = 0, + ExecutionModeSpacingEqual = 1, + ExecutionModeSpacingFractionalEven = 2, + ExecutionModeSpacingFractionalOdd = 3, + ExecutionModeVertexOrderCw = 4, + ExecutionModeVertexOrderCcw = 5, + ExecutionModePixelCenterInteger = 6, + ExecutionModeOriginUpperLeft = 7, + ExecutionModeOriginLowerLeft = 8, + ExecutionModeEarlyFragmentTests = 9, + ExecutionModePointMode = 10, + ExecutionModeXfb = 11, + ExecutionModeDepthReplacing = 12, + ExecutionModeDepthGreater = 14, + ExecutionModeDepthLess = 15, + ExecutionModeDepthUnchanged = 16, + ExecutionModeLocalSize = 17, + ExecutionModeLocalSizeHint = 18, + ExecutionModeInputPoints = 19, + ExecutionModeInputLines = 20, + ExecutionModeInputLinesAdjacency = 21, + ExecutionModeTriangles = 22, + ExecutionModeInputTrianglesAdjacency = 23, + ExecutionModeQuads = 24, + ExecutionModeIsolines = 25, + ExecutionModeOutputVertices = 26, + ExecutionModeOutputPoints = 27, + ExecutionModeOutputLineStrip = 28, + ExecutionModeOutputTriangleStrip = 29, + ExecutionModeVecTypeHint = 30, + ExecutionModeContractionOff = 31, + ExecutionModeInitializer = 33, + ExecutionModeFinalizer = 34, + ExecutionModeSubgroupSize = 35, + ExecutionModeSubgroupsPerWorkgroup = 36, + ExecutionModeSubgroupsPerWorkgroupId = 37, + ExecutionModeLocalSizeId = 38, + ExecutionModeLocalSizeHintId = 39, + ExecutionModeNonCoherentColorAttachmentReadEXT = 4169, + ExecutionModeNonCoherentDepthAttachmentReadEXT = 4170, + ExecutionModeNonCoherentStencilAttachmentReadEXT = 4171, + ExecutionModeSubgroupUniformControlFlowKHR = 4421, + ExecutionModePostDepthCoverage = 4446, + ExecutionModeDenormPreserve = 4459, + ExecutionModeDenormFlushToZero = 4460, + ExecutionModeSignedZeroInfNanPreserve = 4461, + ExecutionModeRoundingModeRTE = 4462, + ExecutionModeRoundingModeRTZ = 4463, + ExecutionModeEarlyAndLateFragmentTestsAMD = 5017, + ExecutionModeStencilRefReplacingEXT = 5027, + ExecutionModeStencilRefUnchangedFrontAMD = 5079, + ExecutionModeStencilRefGreaterFrontAMD = 5080, + ExecutionModeStencilRefLessFrontAMD = 5081, + ExecutionModeStencilRefUnchangedBackAMD = 5082, + ExecutionModeStencilRefGreaterBackAMD = 5083, + ExecutionModeStencilRefLessBackAMD = 5084, + ExecutionModeOutputLinesEXT = 5269, + ExecutionModeOutputLinesNV = 5269, + ExecutionModeOutputPrimitivesEXT = 5270, + ExecutionModeOutputPrimitivesNV = 5270, + ExecutionModeDerivativeGroupQuadsNV = 5289, + ExecutionModeDerivativeGroupLinearNV = 5290, + ExecutionModeOutputTrianglesEXT = 5298, + ExecutionModeOutputTrianglesNV = 5298, + ExecutionModePixelInterlockOrderedEXT = 5366, + ExecutionModePixelInterlockUnorderedEXT = 5367, + ExecutionModeSampleInterlockOrderedEXT = 5368, + ExecutionModeSampleInterlockUnorderedEXT = 5369, + ExecutionModeShadingRateInterlockOrderedEXT = 5370, + ExecutionModeShadingRateInterlockUnorderedEXT = 5371, + ExecutionModeSharedLocalMemorySizeINTEL = 5618, + ExecutionModeRoundingModeRTPINTEL = 5620, + ExecutionModeRoundingModeRTNINTEL = 5621, + ExecutionModeFloatingPointModeALTINTEL = 5622, + ExecutionModeFloatingPointModeIEEEINTEL = 5623, + ExecutionModeMaxWorkgroupSizeINTEL = 5893, + ExecutionModeMaxWorkDimINTEL = 5894, + ExecutionModeNoGlobalOffsetINTEL = 5895, + ExecutionModeNumSIMDWorkitemsINTEL = 5896, + ExecutionModeSchedulerTargetFmaxMhzINTEL = 5903, + ExecutionModeStreamingInterfaceINTEL = 6154, + ExecutionModeNamedBarrierCountINTEL = 6417, + ExecutionModeMax = 0x7fffffff, +}; + +enum StorageClass { + StorageClassUniformConstant = 0, + StorageClassInput = 1, + StorageClassUniform = 2, + StorageClassOutput = 3, + StorageClassWorkgroup = 4, + StorageClassCrossWorkgroup = 5, + StorageClassPrivate = 6, + StorageClassFunction = 7, + StorageClassGeneric = 8, + StorageClassPushConstant = 9, + StorageClassAtomicCounter = 10, + StorageClassImage = 11, + StorageClassStorageBuffer = 12, + StorageClassTileImageEXT = 4172, + StorageClassCallableDataKHR = 5328, + StorageClassCallableDataNV = 5328, + StorageClassIncomingCallableDataKHR = 5329, + StorageClassIncomingCallableDataNV = 5329, + StorageClassRayPayloadKHR = 5338, + StorageClassRayPayloadNV = 5338, + StorageClassHitAttributeKHR = 5339, + StorageClassHitAttributeNV = 5339, + StorageClassIncomingRayPayloadKHR = 5342, + StorageClassIncomingRayPayloadNV = 5342, + StorageClassShaderRecordBufferKHR = 5343, + StorageClassShaderRecordBufferNV = 5343, + StorageClassPhysicalStorageBuffer = 5349, + StorageClassPhysicalStorageBufferEXT = 5349, + StorageClassHitObjectAttributeNV = 5385, + StorageClassTaskPayloadWorkgroupEXT = 5402, + StorageClassCodeSectionINTEL = 5605, + StorageClassDeviceOnlyINTEL = 5936, + StorageClassHostOnlyINTEL = 5937, + StorageClassMax = 0x7fffffff, +}; + +enum Dim { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + DimCube = 3, + DimRect = 4, + DimBuffer = 5, + DimSubpassData = 6, + DimTileImageDataEXT = 4173, + DimMax = 0x7fffffff, +}; + +enum SamplerAddressingMode { + SamplerAddressingModeNone = 0, + SamplerAddressingModeClampToEdge = 1, + SamplerAddressingModeClamp = 2, + SamplerAddressingModeRepeat = 3, + SamplerAddressingModeRepeatMirrored = 4, + SamplerAddressingModeMax = 0x7fffffff, +}; + +enum SamplerFilterMode { + SamplerFilterModeNearest = 0, + SamplerFilterModeLinear = 1, + SamplerFilterModeMax = 0x7fffffff, +}; + +enum ImageFormat { + ImageFormatUnknown = 0, + ImageFormatRgba32f = 1, + ImageFormatRgba16f = 2, + ImageFormatR32f = 3, + ImageFormatRgba8 = 4, + ImageFormatRgba8Snorm = 5, + ImageFormatRg32f = 6, + ImageFormatRg16f = 7, + ImageFormatR11fG11fB10f = 8, + ImageFormatR16f = 9, + ImageFormatRgba16 = 10, + ImageFormatRgb10A2 = 11, + ImageFormatRg16 = 12, + ImageFormatRg8 = 13, + ImageFormatR16 = 14, + ImageFormatR8 = 15, + ImageFormatRgba16Snorm = 16, + ImageFormatRg16Snorm = 17, + ImageFormatRg8Snorm = 18, + ImageFormatR16Snorm = 19, + ImageFormatR8Snorm = 20, + ImageFormatRgba32i = 21, + ImageFormatRgba16i = 22, + ImageFormatRgba8i = 23, + ImageFormatR32i = 24, + ImageFormatRg32i = 25, + ImageFormatRg16i = 26, + ImageFormatRg8i = 27, + ImageFormatR16i = 28, + ImageFormatR8i = 29, + ImageFormatRgba32ui = 30, + ImageFormatRgba16ui = 31, + ImageFormatRgba8ui = 32, + ImageFormatR32ui = 33, + ImageFormatRgb10a2ui = 34, + ImageFormatRg32ui = 35, + ImageFormatRg16ui = 36, + ImageFormatRg8ui = 37, + ImageFormatR16ui = 38, + ImageFormatR8ui = 39, + ImageFormatR64ui = 40, + ImageFormatR64i = 41, + ImageFormatMax = 0x7fffffff, +}; + +enum ImageChannelOrder { + ImageChannelOrderR = 0, + ImageChannelOrderA = 1, + ImageChannelOrderRG = 2, + ImageChannelOrderRA = 3, + ImageChannelOrderRGB = 4, + ImageChannelOrderRGBA = 5, + ImageChannelOrderBGRA = 6, + ImageChannelOrderARGB = 7, + ImageChannelOrderIntensity = 8, + ImageChannelOrderLuminance = 9, + ImageChannelOrderRx = 10, + ImageChannelOrderRGx = 11, + ImageChannelOrderRGBx = 12, + ImageChannelOrderDepth = 13, + ImageChannelOrderDepthStencil = 14, + ImageChannelOrdersRGB = 15, + ImageChannelOrdersRGBx = 16, + ImageChannelOrdersRGBA = 17, + ImageChannelOrdersBGRA = 18, + ImageChannelOrderABGR = 19, + ImageChannelOrderMax = 0x7fffffff, +}; + +enum ImageChannelDataType { + ImageChannelDataTypeSnormInt8 = 0, + ImageChannelDataTypeSnormInt16 = 1, + ImageChannelDataTypeUnormInt8 = 2, + ImageChannelDataTypeUnormInt16 = 3, + ImageChannelDataTypeUnormShort565 = 4, + ImageChannelDataTypeUnormShort555 = 5, + ImageChannelDataTypeUnormInt101010 = 6, + ImageChannelDataTypeSignedInt8 = 7, + ImageChannelDataTypeSignedInt16 = 8, + ImageChannelDataTypeSignedInt32 = 9, + ImageChannelDataTypeUnsignedInt8 = 10, + ImageChannelDataTypeUnsignedInt16 = 11, + ImageChannelDataTypeUnsignedInt32 = 12, + ImageChannelDataTypeHalfFloat = 13, + ImageChannelDataTypeFloat = 14, + ImageChannelDataTypeUnormInt24 = 15, + ImageChannelDataTypeUnormInt101010_2 = 16, + ImageChannelDataTypeMax = 0x7fffffff, +}; + +enum ImageOperandsShift { + ImageOperandsBiasShift = 0, + ImageOperandsLodShift = 1, + ImageOperandsGradShift = 2, + ImageOperandsConstOffsetShift = 3, + ImageOperandsOffsetShift = 4, + ImageOperandsConstOffsetsShift = 5, + ImageOperandsSampleShift = 6, + ImageOperandsMinLodShift = 7, + ImageOperandsMakeTexelAvailableShift = 8, + ImageOperandsMakeTexelAvailableKHRShift = 8, + ImageOperandsMakeTexelVisibleShift = 9, + ImageOperandsMakeTexelVisibleKHRShift = 9, + ImageOperandsNonPrivateTexelShift = 10, + ImageOperandsNonPrivateTexelKHRShift = 10, + ImageOperandsVolatileTexelShift = 11, + ImageOperandsVolatileTexelKHRShift = 11, + ImageOperandsSignExtendShift = 12, + ImageOperandsZeroExtendShift = 13, + ImageOperandsNontemporalShift = 14, + ImageOperandsOffsetsShift = 16, + ImageOperandsMax = 0x7fffffff, +}; + +enum ImageOperandsMask { + ImageOperandsMaskNone = 0, + ImageOperandsBiasMask = 0x00000001, + ImageOperandsLodMask = 0x00000002, + ImageOperandsGradMask = 0x00000004, + ImageOperandsConstOffsetMask = 0x00000008, + ImageOperandsOffsetMask = 0x00000010, + ImageOperandsConstOffsetsMask = 0x00000020, + ImageOperandsSampleMask = 0x00000040, + ImageOperandsMinLodMask = 0x00000080, + ImageOperandsMakeTexelAvailableMask = 0x00000100, + ImageOperandsMakeTexelAvailableKHRMask = 0x00000100, + ImageOperandsMakeTexelVisibleMask = 0x00000200, + ImageOperandsMakeTexelVisibleKHRMask = 0x00000200, + ImageOperandsNonPrivateTexelMask = 0x00000400, + ImageOperandsNonPrivateTexelKHRMask = 0x00000400, + ImageOperandsVolatileTexelMask = 0x00000800, + ImageOperandsVolatileTexelKHRMask = 0x00000800, + ImageOperandsSignExtendMask = 0x00001000, + ImageOperandsZeroExtendMask = 0x00002000, + ImageOperandsNontemporalMask = 0x00004000, + ImageOperandsOffsetsMask = 0x00010000, +}; + +enum FPFastMathModeShift { + FPFastMathModeNotNaNShift = 0, + FPFastMathModeNotInfShift = 1, + FPFastMathModeNSZShift = 2, + FPFastMathModeAllowRecipShift = 3, + FPFastMathModeFastShift = 4, + FPFastMathModeAllowContractFastINTELShift = 16, + FPFastMathModeAllowReassocINTELShift = 17, + FPFastMathModeMax = 0x7fffffff, +}; + +enum FPFastMathModeMask { + FPFastMathModeMaskNone = 0, + FPFastMathModeNotNaNMask = 0x00000001, + FPFastMathModeNotInfMask = 0x00000002, + FPFastMathModeNSZMask = 0x00000004, + FPFastMathModeAllowRecipMask = 0x00000008, + FPFastMathModeFastMask = 0x00000010, + FPFastMathModeAllowContractFastINTELMask = 0x00010000, + FPFastMathModeAllowReassocINTELMask = 0x00020000, +}; + +enum FPRoundingMode { + FPRoundingModeRTE = 0, + FPRoundingModeRTZ = 1, + FPRoundingModeRTP = 2, + FPRoundingModeRTN = 3, + FPRoundingModeMax = 0x7fffffff, +}; + +enum LinkageType { + LinkageTypeExport = 0, + LinkageTypeImport = 1, + LinkageTypeLinkOnceODR = 2, + LinkageTypeMax = 0x7fffffff, +}; + +enum AccessQualifier { + AccessQualifierReadOnly = 0, + AccessQualifierWriteOnly = 1, + AccessQualifierReadWrite = 2, + AccessQualifierMax = 0x7fffffff, +}; + +enum FunctionParameterAttribute { + FunctionParameterAttributeZext = 0, + FunctionParameterAttributeSext = 1, + FunctionParameterAttributeByVal = 2, + FunctionParameterAttributeSret = 3, + FunctionParameterAttributeNoAlias = 4, + FunctionParameterAttributeNoCapture = 5, + FunctionParameterAttributeNoWrite = 6, + FunctionParameterAttributeNoReadWrite = 7, + FunctionParameterAttributeRuntimeAlignedINTEL = 5940, + FunctionParameterAttributeMax = 0x7fffffff, +}; + +enum Decoration { + DecorationRelaxedPrecision = 0, + DecorationSpecId = 1, + DecorationBlock = 2, + DecorationBufferBlock = 3, + DecorationRowMajor = 4, + DecorationColMajor = 5, + DecorationArrayStride = 6, + DecorationMatrixStride = 7, + DecorationGLSLShared = 8, + DecorationGLSLPacked = 9, + DecorationCPacked = 10, + DecorationBuiltIn = 11, + DecorationNoPerspective = 13, + DecorationFlat = 14, + DecorationPatch = 15, + DecorationCentroid = 16, + DecorationSample = 17, + DecorationInvariant = 18, + DecorationRestrict = 19, + DecorationAliased = 20, + DecorationVolatile = 21, + DecorationConstant = 22, + DecorationCoherent = 23, + DecorationNonWritable = 24, + DecorationNonReadable = 25, + DecorationUniform = 26, + DecorationUniformId = 27, + DecorationSaturatedConversion = 28, + DecorationStream = 29, + DecorationLocation = 30, + DecorationComponent = 31, + DecorationIndex = 32, + DecorationBinding = 33, + DecorationDescriptorSet = 34, + DecorationOffset = 35, + DecorationXfbBuffer = 36, + DecorationXfbStride = 37, + DecorationFuncParamAttr = 38, + DecorationFPRoundingMode = 39, + DecorationFPFastMathMode = 40, + DecorationLinkageAttributes = 41, + DecorationNoContraction = 42, + DecorationInputAttachmentIndex = 43, + DecorationAlignment = 44, + DecorationMaxByteOffset = 45, + DecorationAlignmentId = 46, + DecorationMaxByteOffsetId = 47, + DecorationNoSignedWrap = 4469, + DecorationNoUnsignedWrap = 4470, + DecorationWeightTextureQCOM = 4487, + DecorationBlockMatchTextureQCOM = 4488, + DecorationExplicitInterpAMD = 4999, + DecorationOverrideCoverageNV = 5248, + DecorationPassthroughNV = 5250, + DecorationViewportRelativeNV = 5252, + DecorationSecondaryViewportRelativeNV = 5256, + DecorationPerPrimitiveEXT = 5271, + DecorationPerPrimitiveNV = 5271, + DecorationPerViewNV = 5272, + DecorationPerTaskNV = 5273, + DecorationPerVertexKHR = 5285, + DecorationPerVertexNV = 5285, + DecorationNonUniform = 5300, + DecorationNonUniformEXT = 5300, + DecorationRestrictPointer = 5355, + DecorationRestrictPointerEXT = 5355, + DecorationAliasedPointer = 5356, + DecorationAliasedPointerEXT = 5356, + DecorationHitObjectShaderRecordBufferNV = 5386, + DecorationBindlessSamplerNV = 5398, + DecorationBindlessImageNV = 5399, + DecorationBoundSamplerNV = 5400, + DecorationBoundImageNV = 5401, + DecorationSIMTCallINTEL = 5599, + DecorationReferencedIndirectlyINTEL = 5602, + DecorationClobberINTEL = 5607, + DecorationSideEffectsINTEL = 5608, + DecorationVectorComputeVariableINTEL = 5624, + DecorationFuncParamIOKindINTEL = 5625, + DecorationVectorComputeFunctionINTEL = 5626, + DecorationStackCallINTEL = 5627, + DecorationGlobalVariableOffsetINTEL = 5628, + DecorationCounterBuffer = 5634, + DecorationHlslCounterBufferGOOGLE = 5634, + DecorationHlslSemanticGOOGLE = 5635, + DecorationUserSemantic = 5635, + DecorationUserTypeGOOGLE = 5636, + DecorationFunctionRoundingModeINTEL = 5822, + DecorationFunctionDenormModeINTEL = 5823, + DecorationRegisterINTEL = 5825, + DecorationMemoryINTEL = 5826, + DecorationNumbanksINTEL = 5827, + DecorationBankwidthINTEL = 5828, + DecorationMaxPrivateCopiesINTEL = 5829, + DecorationSinglepumpINTEL = 5830, + DecorationDoublepumpINTEL = 5831, + DecorationMaxReplicatesINTEL = 5832, + DecorationSimpleDualPortINTEL = 5833, + DecorationMergeINTEL = 5834, + DecorationBankBitsINTEL = 5835, + DecorationForcePow2DepthINTEL = 5836, + DecorationBurstCoalesceINTEL = 5899, + DecorationCacheSizeINTEL = 5900, + DecorationDontStaticallyCoalesceINTEL = 5901, + DecorationPrefetchINTEL = 5902, + DecorationStallEnableINTEL = 5905, + DecorationFuseLoopsInFunctionINTEL = 5907, + DecorationMathOpDSPModeINTEL = 5909, + DecorationAliasScopeINTEL = 5914, + DecorationNoAliasINTEL = 5915, + DecorationInitiationIntervalINTEL = 5917, + DecorationMaxConcurrencyINTEL = 5918, + DecorationPipelineEnableINTEL = 5919, + DecorationBufferLocationINTEL = 5921, + DecorationIOPipeStorageINTEL = 5944, + DecorationFunctionFloatingPointModeINTEL = 6080, + DecorationSingleElementVectorINTEL = 6085, + DecorationVectorComputeCallableFunctionINTEL = 6087, + DecorationMediaBlockIOINTEL = 6140, + DecorationConduitKernelArgumentINTEL = 6175, + DecorationRegisterMapKernelArgumentINTEL = 6176, + DecorationMMHostInterfaceAddressWidthINTEL = 6177, + DecorationMMHostInterfaceDataWidthINTEL = 6178, + DecorationMMHostInterfaceLatencyINTEL = 6179, + DecorationMMHostInterfaceReadWriteModeINTEL = 6180, + DecorationMMHostInterfaceMaxBurstINTEL = 6181, + DecorationMMHostInterfaceWaitRequestINTEL = 6182, + DecorationStableKernelArgumentINTEL = 6183, + DecorationMax = 0x7fffffff, +}; + +enum BuiltIn { + BuiltInPosition = 0, + BuiltInPointSize = 1, + BuiltInClipDistance = 3, + BuiltInCullDistance = 4, + BuiltInVertexId = 5, + BuiltInInstanceId = 6, + BuiltInPrimitiveId = 7, + BuiltInInvocationId = 8, + BuiltInLayer = 9, + BuiltInViewportIndex = 10, + BuiltInTessLevelOuter = 11, + BuiltInTessLevelInner = 12, + BuiltInTessCoord = 13, + BuiltInPatchVertices = 14, + BuiltInFragCoord = 15, + BuiltInPointCoord = 16, + BuiltInFrontFacing = 17, + BuiltInSampleId = 18, + BuiltInSamplePosition = 19, + BuiltInSampleMask = 20, + BuiltInFragDepth = 22, + BuiltInHelperInvocation = 23, + BuiltInNumWorkgroups = 24, + BuiltInWorkgroupSize = 25, + BuiltInWorkgroupId = 26, + BuiltInLocalInvocationId = 27, + BuiltInGlobalInvocationId = 28, + BuiltInLocalInvocationIndex = 29, + BuiltInWorkDim = 30, + BuiltInGlobalSize = 31, + BuiltInEnqueuedWorkgroupSize = 32, + BuiltInGlobalOffset = 33, + BuiltInGlobalLinearId = 34, + BuiltInSubgroupSize = 36, + BuiltInSubgroupMaxSize = 37, + BuiltInNumSubgroups = 38, + BuiltInNumEnqueuedSubgroups = 39, + BuiltInSubgroupId = 40, + BuiltInSubgroupLocalInvocationId = 41, + BuiltInVertexIndex = 42, + BuiltInInstanceIndex = 43, + BuiltInCoreIDARM = 4160, + BuiltInCoreCountARM = 4161, + BuiltInCoreMaxIDARM = 4162, + BuiltInWarpIDARM = 4163, + BuiltInWarpMaxIDARM = 4164, + BuiltInSubgroupEqMask = 4416, + BuiltInSubgroupEqMaskKHR = 4416, + BuiltInSubgroupGeMask = 4417, + BuiltInSubgroupGeMaskKHR = 4417, + BuiltInSubgroupGtMask = 4418, + BuiltInSubgroupGtMaskKHR = 4418, + BuiltInSubgroupLeMask = 4419, + BuiltInSubgroupLeMaskKHR = 4419, + BuiltInSubgroupLtMask = 4420, + BuiltInSubgroupLtMaskKHR = 4420, + BuiltInBaseVertex = 4424, + BuiltInBaseInstance = 4425, + BuiltInDrawIndex = 4426, + BuiltInPrimitiveShadingRateKHR = 4432, + BuiltInDeviceIndex = 4438, + BuiltInViewIndex = 4440, + BuiltInShadingRateKHR = 4444, + BuiltInBaryCoordNoPerspAMD = 4992, + BuiltInBaryCoordNoPerspCentroidAMD = 4993, + BuiltInBaryCoordNoPerspSampleAMD = 4994, + BuiltInBaryCoordSmoothAMD = 4995, + BuiltInBaryCoordSmoothCentroidAMD = 4996, + BuiltInBaryCoordSmoothSampleAMD = 4997, + BuiltInBaryCoordPullModelAMD = 4998, + BuiltInFragStencilRefEXT = 5014, + BuiltInViewportMaskNV = 5253, + BuiltInSecondaryPositionNV = 5257, + BuiltInSecondaryViewportMaskNV = 5258, + BuiltInPositionPerViewNV = 5261, + BuiltInViewportMaskPerViewNV = 5262, + BuiltInFullyCoveredEXT = 5264, + BuiltInTaskCountNV = 5274, + BuiltInPrimitiveCountNV = 5275, + BuiltInPrimitiveIndicesNV = 5276, + BuiltInClipDistancePerViewNV = 5277, + BuiltInCullDistancePerViewNV = 5278, + BuiltInLayerPerViewNV = 5279, + BuiltInMeshViewCountNV = 5280, + BuiltInMeshViewIndicesNV = 5281, + BuiltInBaryCoordKHR = 5286, + BuiltInBaryCoordNV = 5286, + BuiltInBaryCoordNoPerspKHR = 5287, + BuiltInBaryCoordNoPerspNV = 5287, + BuiltInFragSizeEXT = 5292, + BuiltInFragmentSizeNV = 5292, + BuiltInFragInvocationCountEXT = 5293, + BuiltInInvocationsPerPixelNV = 5293, + BuiltInPrimitivePointIndicesEXT = 5294, + BuiltInPrimitiveLineIndicesEXT = 5295, + BuiltInPrimitiveTriangleIndicesEXT = 5296, + BuiltInCullPrimitiveEXT = 5299, + BuiltInLaunchIdKHR = 5319, + BuiltInLaunchIdNV = 5319, + BuiltInLaunchSizeKHR = 5320, + BuiltInLaunchSizeNV = 5320, + BuiltInWorldRayOriginKHR = 5321, + BuiltInWorldRayOriginNV = 5321, + BuiltInWorldRayDirectionKHR = 5322, + BuiltInWorldRayDirectionNV = 5322, + BuiltInObjectRayOriginKHR = 5323, + BuiltInObjectRayOriginNV = 5323, + BuiltInObjectRayDirectionKHR = 5324, + BuiltInObjectRayDirectionNV = 5324, + BuiltInRayTminKHR = 5325, + BuiltInRayTminNV = 5325, + BuiltInRayTmaxKHR = 5326, + BuiltInRayTmaxNV = 5326, + BuiltInInstanceCustomIndexKHR = 5327, + BuiltInInstanceCustomIndexNV = 5327, + BuiltInObjectToWorldKHR = 5330, + BuiltInObjectToWorldNV = 5330, + BuiltInWorldToObjectKHR = 5331, + BuiltInWorldToObjectNV = 5331, + BuiltInHitTNV = 5332, + BuiltInHitKindKHR = 5333, + BuiltInHitKindNV = 5333, + BuiltInCurrentRayTimeNV = 5334, + BuiltInHitTriangleVertexPositionsKHR = 5335, + BuiltInIncomingRayFlagsKHR = 5351, + BuiltInIncomingRayFlagsNV = 5351, + BuiltInRayGeometryIndexKHR = 5352, + BuiltInWarpsPerSMNV = 5374, + BuiltInSMCountNV = 5375, + BuiltInWarpIDNV = 5376, + BuiltInSMIDNV = 5377, + BuiltInCullMaskKHR = 6021, + BuiltInMax = 0x7fffffff, +}; + +enum SelectionControlShift { + SelectionControlFlattenShift = 0, + SelectionControlDontFlattenShift = 1, + SelectionControlMax = 0x7fffffff, +}; + +enum SelectionControlMask { + SelectionControlMaskNone = 0, + SelectionControlFlattenMask = 0x00000001, + SelectionControlDontFlattenMask = 0x00000002, +}; + +enum LoopControlShift { + LoopControlUnrollShift = 0, + LoopControlDontUnrollShift = 1, + LoopControlDependencyInfiniteShift = 2, + LoopControlDependencyLengthShift = 3, + LoopControlMinIterationsShift = 4, + LoopControlMaxIterationsShift = 5, + LoopControlIterationMultipleShift = 6, + LoopControlPeelCountShift = 7, + LoopControlPartialCountShift = 8, + LoopControlInitiationIntervalINTELShift = 16, + LoopControlMaxConcurrencyINTELShift = 17, + LoopControlDependencyArrayINTELShift = 18, + LoopControlPipelineEnableINTELShift = 19, + LoopControlLoopCoalesceINTELShift = 20, + LoopControlMaxInterleavingINTELShift = 21, + LoopControlSpeculatedIterationsINTELShift = 22, + LoopControlNoFusionINTELShift = 23, + LoopControlLoopCountINTELShift = 24, + LoopControlMaxReinvocationDelayINTELShift = 25, + LoopControlMax = 0x7fffffff, +}; + +enum LoopControlMask { + LoopControlMaskNone = 0, + LoopControlUnrollMask = 0x00000001, + LoopControlDontUnrollMask = 0x00000002, + LoopControlDependencyInfiniteMask = 0x00000004, + LoopControlDependencyLengthMask = 0x00000008, + LoopControlMinIterationsMask = 0x00000010, + LoopControlMaxIterationsMask = 0x00000020, + LoopControlIterationMultipleMask = 0x00000040, + LoopControlPeelCountMask = 0x00000080, + LoopControlPartialCountMask = 0x00000100, + LoopControlInitiationIntervalINTELMask = 0x00010000, + LoopControlMaxConcurrencyINTELMask = 0x00020000, + LoopControlDependencyArrayINTELMask = 0x00040000, + LoopControlPipelineEnableINTELMask = 0x00080000, + LoopControlLoopCoalesceINTELMask = 0x00100000, + LoopControlMaxInterleavingINTELMask = 0x00200000, + LoopControlSpeculatedIterationsINTELMask = 0x00400000, + LoopControlNoFusionINTELMask = 0x00800000, + LoopControlLoopCountINTELMask = 0x01000000, + LoopControlMaxReinvocationDelayINTELMask = 0x02000000, +}; + +enum FunctionControlShift { + FunctionControlInlineShift = 0, + FunctionControlDontInlineShift = 1, + FunctionControlPureShift = 2, + FunctionControlConstShift = 3, + FunctionControlOptNoneINTELShift = 16, + FunctionControlMax = 0x7fffffff, +}; + +enum FunctionControlMask { + FunctionControlMaskNone = 0, + FunctionControlInlineMask = 0x00000001, + FunctionControlDontInlineMask = 0x00000002, + FunctionControlPureMask = 0x00000004, + FunctionControlConstMask = 0x00000008, + FunctionControlOptNoneINTELMask = 0x00010000, +}; + +enum MemorySemanticsShift { + MemorySemanticsAcquireShift = 1, + MemorySemanticsReleaseShift = 2, + MemorySemanticsAcquireReleaseShift = 3, + MemorySemanticsSequentiallyConsistentShift = 4, + MemorySemanticsUniformMemoryShift = 6, + MemorySemanticsSubgroupMemoryShift = 7, + MemorySemanticsWorkgroupMemoryShift = 8, + MemorySemanticsCrossWorkgroupMemoryShift = 9, + MemorySemanticsAtomicCounterMemoryShift = 10, + MemorySemanticsImageMemoryShift = 11, + MemorySemanticsOutputMemoryShift = 12, + MemorySemanticsOutputMemoryKHRShift = 12, + MemorySemanticsMakeAvailableShift = 13, + MemorySemanticsMakeAvailableKHRShift = 13, + MemorySemanticsMakeVisibleShift = 14, + MemorySemanticsMakeVisibleKHRShift = 14, + MemorySemanticsVolatileShift = 15, + MemorySemanticsMax = 0x7fffffff, +}; + +enum MemorySemanticsMask { + MemorySemanticsMaskNone = 0, + MemorySemanticsAcquireMask = 0x00000002, + MemorySemanticsReleaseMask = 0x00000004, + MemorySemanticsAcquireReleaseMask = 0x00000008, + MemorySemanticsSequentiallyConsistentMask = 0x00000010, + MemorySemanticsUniformMemoryMask = 0x00000040, + MemorySemanticsSubgroupMemoryMask = 0x00000080, + MemorySemanticsWorkgroupMemoryMask = 0x00000100, + MemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, + MemorySemanticsAtomicCounterMemoryMask = 0x00000400, + MemorySemanticsImageMemoryMask = 0x00000800, + MemorySemanticsOutputMemoryMask = 0x00001000, + MemorySemanticsOutputMemoryKHRMask = 0x00001000, + MemorySemanticsMakeAvailableMask = 0x00002000, + MemorySemanticsMakeAvailableKHRMask = 0x00002000, + MemorySemanticsMakeVisibleMask = 0x00004000, + MemorySemanticsMakeVisibleKHRMask = 0x00004000, + MemorySemanticsVolatileMask = 0x00008000, +}; + +enum MemoryAccessShift { + MemoryAccessVolatileShift = 0, + MemoryAccessAlignedShift = 1, + MemoryAccessNontemporalShift = 2, + MemoryAccessMakePointerAvailableShift = 3, + MemoryAccessMakePointerAvailableKHRShift = 3, + MemoryAccessMakePointerVisibleShift = 4, + MemoryAccessMakePointerVisibleKHRShift = 4, + MemoryAccessNonPrivatePointerShift = 5, + MemoryAccessNonPrivatePointerKHRShift = 5, + MemoryAccessAliasScopeINTELMaskShift = 16, + MemoryAccessNoAliasINTELMaskShift = 17, + MemoryAccessMax = 0x7fffffff, +}; + +enum MemoryAccessMask { + MemoryAccessMaskNone = 0, + MemoryAccessVolatileMask = 0x00000001, + MemoryAccessAlignedMask = 0x00000002, + MemoryAccessNontemporalMask = 0x00000004, + MemoryAccessMakePointerAvailableMask = 0x00000008, + MemoryAccessMakePointerAvailableKHRMask = 0x00000008, + MemoryAccessMakePointerVisibleMask = 0x00000010, + MemoryAccessMakePointerVisibleKHRMask = 0x00000010, + MemoryAccessNonPrivatePointerMask = 0x00000020, + MemoryAccessNonPrivatePointerKHRMask = 0x00000020, + MemoryAccessAliasScopeINTELMaskMask = 0x00010000, + MemoryAccessNoAliasINTELMaskMask = 0x00020000, +}; + +enum Scope { + ScopeCrossDevice = 0, + ScopeDevice = 1, + ScopeWorkgroup = 2, + ScopeSubgroup = 3, + ScopeInvocation = 4, + ScopeQueueFamily = 5, + ScopeQueueFamilyKHR = 5, + ScopeShaderCallKHR = 6, + ScopeMax = 0x7fffffff, +}; + +enum GroupOperation { + GroupOperationReduce = 0, + GroupOperationInclusiveScan = 1, + GroupOperationExclusiveScan = 2, + GroupOperationClusteredReduce = 3, + GroupOperationPartitionedReduceNV = 6, + GroupOperationPartitionedInclusiveScanNV = 7, + GroupOperationPartitionedExclusiveScanNV = 8, + GroupOperationMax = 0x7fffffff, +}; + +enum KernelEnqueueFlags { + KernelEnqueueFlagsNoWait = 0, + KernelEnqueueFlagsWaitKernel = 1, + KernelEnqueueFlagsWaitWorkGroup = 2, + KernelEnqueueFlagsMax = 0x7fffffff, +}; + +enum KernelProfilingInfoShift { + KernelProfilingInfoCmdExecTimeShift = 0, + KernelProfilingInfoMax = 0x7fffffff, +}; + +enum KernelProfilingInfoMask { + KernelProfilingInfoMaskNone = 0, + KernelProfilingInfoCmdExecTimeMask = 0x00000001, +}; + +enum Capability { + CapabilityMatrix = 0, + CapabilityShader = 1, + CapabilityGeometry = 2, + CapabilityTessellation = 3, + CapabilityAddresses = 4, + CapabilityLinkage = 5, + CapabilityKernel = 6, + CapabilityVector16 = 7, + CapabilityFloat16Buffer = 8, + CapabilityFloat16 = 9, + CapabilityFloat64 = 10, + CapabilityInt64 = 11, + CapabilityInt64Atomics = 12, + CapabilityImageBasic = 13, + CapabilityImageReadWrite = 14, + CapabilityImageMipmap = 15, + CapabilityPipes = 17, + CapabilityGroups = 18, + CapabilityDeviceEnqueue = 19, + CapabilityLiteralSampler = 20, + CapabilityAtomicStorage = 21, + CapabilityInt16 = 22, + CapabilityTessellationPointSize = 23, + CapabilityGeometryPointSize = 24, + CapabilityImageGatherExtended = 25, + CapabilityStorageImageMultisample = 27, + CapabilityUniformBufferArrayDynamicIndexing = 28, + CapabilitySampledImageArrayDynamicIndexing = 29, + CapabilityStorageBufferArrayDynamicIndexing = 30, + CapabilityStorageImageArrayDynamicIndexing = 31, + CapabilityClipDistance = 32, + CapabilityCullDistance = 33, + CapabilityImageCubeArray = 34, + CapabilitySampleRateShading = 35, + CapabilityImageRect = 36, + CapabilitySampledRect = 37, + CapabilityGenericPointer = 38, + CapabilityInt8 = 39, + CapabilityInputAttachment = 40, + CapabilitySparseResidency = 41, + CapabilityMinLod = 42, + CapabilitySampled1D = 43, + CapabilityImage1D = 44, + CapabilitySampledCubeArray = 45, + CapabilitySampledBuffer = 46, + CapabilityImageBuffer = 47, + CapabilityImageMSArray = 48, + CapabilityStorageImageExtendedFormats = 49, + CapabilityImageQuery = 50, + CapabilityDerivativeControl = 51, + CapabilityInterpolationFunction = 52, + CapabilityTransformFeedback = 53, + CapabilityGeometryStreams = 54, + CapabilityStorageImageReadWithoutFormat = 55, + CapabilityStorageImageWriteWithoutFormat = 56, + CapabilityMultiViewport = 57, + CapabilitySubgroupDispatch = 58, + CapabilityNamedBarrier = 59, + CapabilityPipeStorage = 60, + CapabilityGroupNonUniform = 61, + CapabilityGroupNonUniformVote = 62, + CapabilityGroupNonUniformArithmetic = 63, + CapabilityGroupNonUniformBallot = 64, + CapabilityGroupNonUniformShuffle = 65, + CapabilityGroupNonUniformShuffleRelative = 66, + CapabilityGroupNonUniformClustered = 67, + CapabilityGroupNonUniformQuad = 68, + CapabilityShaderLayer = 69, + CapabilityShaderViewportIndex = 70, + CapabilityUniformDecoration = 71, + CapabilityCoreBuiltinsARM = 4165, + CapabilityTileImageColorReadAccessEXT = 4166, + CapabilityTileImageDepthReadAccessEXT = 4167, + CapabilityTileImageStencilReadAccessEXT = 4168, + CapabilityFragmentShadingRateKHR = 4422, + CapabilitySubgroupBallotKHR = 4423, + CapabilityDrawParameters = 4427, + CapabilityWorkgroupMemoryExplicitLayoutKHR = 4428, + CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR = 4429, + CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR = 4430, + CapabilitySubgroupVoteKHR = 4431, + CapabilityStorageBuffer16BitAccess = 4433, + CapabilityStorageUniformBufferBlock16 = 4433, + CapabilityStorageUniform16 = 4434, + CapabilityUniformAndStorageBuffer16BitAccess = 4434, + CapabilityStoragePushConstant16 = 4435, + CapabilityStorageInputOutput16 = 4436, + CapabilityDeviceGroup = 4437, + CapabilityMultiView = 4439, + CapabilityVariablePointersStorageBuffer = 4441, + CapabilityVariablePointers = 4442, + CapabilityAtomicStorageOps = 4445, + CapabilitySampleMaskPostDepthCoverage = 4447, + CapabilityStorageBuffer8BitAccess = 4448, + CapabilityUniformAndStorageBuffer8BitAccess = 4449, + CapabilityStoragePushConstant8 = 4450, + CapabilityDenormPreserve = 4464, + CapabilityDenormFlushToZero = 4465, + CapabilitySignedZeroInfNanPreserve = 4466, + CapabilityRoundingModeRTE = 4467, + CapabilityRoundingModeRTZ = 4468, + CapabilityRayQueryProvisionalKHR = 4471, + CapabilityRayQueryKHR = 4472, + CapabilityRayTraversalPrimitiveCullingKHR = 4478, + CapabilityRayTracingKHR = 4479, + CapabilityTextureSampleWeightedQCOM = 4484, + CapabilityTextureBoxFilterQCOM = 4485, + CapabilityTextureBlockMatchQCOM = 4486, + CapabilityFloat16ImageAMD = 5008, + CapabilityImageGatherBiasLodAMD = 5009, + CapabilityFragmentMaskAMD = 5010, + CapabilityStencilExportEXT = 5013, + CapabilityImageReadWriteLodAMD = 5015, + CapabilityInt64ImageEXT = 5016, + CapabilityShaderClockKHR = 5055, + CapabilitySampleMaskOverrideCoverageNV = 5249, + CapabilityGeometryShaderPassthroughNV = 5251, + CapabilityShaderViewportIndexLayerEXT = 5254, + CapabilityShaderViewportIndexLayerNV = 5254, + CapabilityShaderViewportMaskNV = 5255, + CapabilityShaderStereoViewNV = 5259, + CapabilityPerViewAttributesNV = 5260, + CapabilityFragmentFullyCoveredEXT = 5265, + CapabilityMeshShadingNV = 5266, + CapabilityImageFootprintNV = 5282, + CapabilityMeshShadingEXT = 5283, + CapabilityFragmentBarycentricKHR = 5284, + CapabilityFragmentBarycentricNV = 5284, + CapabilityComputeDerivativeGroupQuadsNV = 5288, + CapabilityFragmentDensityEXT = 5291, + CapabilityShadingRateNV = 5291, + CapabilityGroupNonUniformPartitionedNV = 5297, + CapabilityShaderNonUniform = 5301, + CapabilityShaderNonUniformEXT = 5301, + CapabilityRuntimeDescriptorArray = 5302, + CapabilityRuntimeDescriptorArrayEXT = 5302, + CapabilityInputAttachmentArrayDynamicIndexing = 5303, + CapabilityInputAttachmentArrayDynamicIndexingEXT = 5303, + CapabilityUniformTexelBufferArrayDynamicIndexing = 5304, + CapabilityUniformTexelBufferArrayDynamicIndexingEXT = 5304, + CapabilityStorageTexelBufferArrayDynamicIndexing = 5305, + CapabilityStorageTexelBufferArrayDynamicIndexingEXT = 5305, + CapabilityUniformBufferArrayNonUniformIndexing = 5306, + CapabilityUniformBufferArrayNonUniformIndexingEXT = 5306, + CapabilitySampledImageArrayNonUniformIndexing = 5307, + CapabilitySampledImageArrayNonUniformIndexingEXT = 5307, + CapabilityStorageBufferArrayNonUniformIndexing = 5308, + CapabilityStorageBufferArrayNonUniformIndexingEXT = 5308, + CapabilityStorageImageArrayNonUniformIndexing = 5309, + CapabilityStorageImageArrayNonUniformIndexingEXT = 5309, + CapabilityInputAttachmentArrayNonUniformIndexing = 5310, + CapabilityInputAttachmentArrayNonUniformIndexingEXT = 5310, + CapabilityUniformTexelBufferArrayNonUniformIndexing = 5311, + CapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311, + CapabilityStorageTexelBufferArrayNonUniformIndexing = 5312, + CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312, + CapabilityRayTracingPositionFetchKHR = 5336, + CapabilityRayTracingNV = 5340, + CapabilityRayTracingMotionBlurNV = 5341, + CapabilityVulkanMemoryModel = 5345, + CapabilityVulkanMemoryModelKHR = 5345, + CapabilityVulkanMemoryModelDeviceScope = 5346, + CapabilityVulkanMemoryModelDeviceScopeKHR = 5346, + CapabilityPhysicalStorageBufferAddresses = 5347, + CapabilityPhysicalStorageBufferAddressesEXT = 5347, + CapabilityComputeDerivativeGroupLinearNV = 5350, + CapabilityRayTracingProvisionalKHR = 5353, + CapabilityCooperativeMatrixNV = 5357, + CapabilityFragmentShaderSampleInterlockEXT = 5363, + CapabilityFragmentShaderShadingRateInterlockEXT = 5372, + CapabilityShaderSMBuiltinsNV = 5373, + CapabilityFragmentShaderPixelInterlockEXT = 5378, + CapabilityDemoteToHelperInvocation = 5379, + CapabilityDemoteToHelperInvocationEXT = 5379, + CapabilityRayTracingOpacityMicromapEXT = 5381, + CapabilityShaderInvocationReorderNV = 5383, + CapabilityBindlessTextureNV = 5390, + CapabilityRayQueryPositionFetchKHR = 5391, + CapabilitySubgroupShuffleINTEL = 5568, + CapabilitySubgroupBufferBlockIOINTEL = 5569, + CapabilitySubgroupImageBlockIOINTEL = 5570, + CapabilitySubgroupImageMediaBlockIOINTEL = 5579, + CapabilityRoundToInfinityINTEL = 5582, + CapabilityFloatingPointModeINTEL = 5583, + CapabilityIntegerFunctions2INTEL = 5584, + CapabilityFunctionPointersINTEL = 5603, + CapabilityIndirectReferencesINTEL = 5604, + CapabilityAsmINTEL = 5606, + CapabilityAtomicFloat32MinMaxEXT = 5612, + CapabilityAtomicFloat64MinMaxEXT = 5613, + CapabilityAtomicFloat16MinMaxEXT = 5616, + CapabilityVectorComputeINTEL = 5617, + CapabilityVectorAnyINTEL = 5619, + CapabilityExpectAssumeKHR = 5629, + CapabilitySubgroupAvcMotionEstimationINTEL = 5696, + CapabilitySubgroupAvcMotionEstimationIntraINTEL = 5697, + CapabilitySubgroupAvcMotionEstimationChromaINTEL = 5698, + CapabilityVariableLengthArrayINTEL = 5817, + CapabilityFunctionFloatControlINTEL = 5821, + CapabilityFPGAMemoryAttributesINTEL = 5824, + CapabilityFPFastMathModeINTEL = 5837, + CapabilityArbitraryPrecisionIntegersINTEL = 5844, + CapabilityArbitraryPrecisionFloatingPointINTEL = 5845, + CapabilityUnstructuredLoopControlsINTEL = 5886, + CapabilityFPGALoopControlsINTEL = 5888, + CapabilityKernelAttributesINTEL = 5892, + CapabilityFPGAKernelAttributesINTEL = 5897, + CapabilityFPGAMemoryAccessesINTEL = 5898, + CapabilityFPGAClusterAttributesINTEL = 5904, + CapabilityLoopFuseINTEL = 5906, + CapabilityFPGADSPControlINTEL = 5908, + CapabilityMemoryAccessAliasingINTEL = 5910, + CapabilityFPGAInvocationPipeliningAttributesINTEL = 5916, + CapabilityFPGABufferLocationINTEL = 5920, + CapabilityArbitraryPrecisionFixedPointINTEL = 5922, + CapabilityUSMStorageClassesINTEL = 5935, + CapabilityRuntimeAlignedAttributeINTEL = 5939, + CapabilityIOPipesINTEL = 5943, + CapabilityBlockingPipesINTEL = 5945, + CapabilityFPGARegINTEL = 5948, + CapabilityDotProductInputAll = 6016, + CapabilityDotProductInputAllKHR = 6016, + CapabilityDotProductInput4x8Bit = 6017, + CapabilityDotProductInput4x8BitKHR = 6017, + CapabilityDotProductInput4x8BitPacked = 6018, + CapabilityDotProductInput4x8BitPackedKHR = 6018, + CapabilityDotProduct = 6019, + CapabilityDotProductKHR = 6019, + CapabilityRayCullMaskKHR = 6020, + CapabilityCooperativeMatrixKHR = 6022, + CapabilityBitInstructions = 6025, + CapabilityGroupNonUniformRotateKHR = 6026, + CapabilityAtomicFloat32AddEXT = 6033, + CapabilityAtomicFloat64AddEXT = 6034, + CapabilityLongConstantCompositeINTEL = 6089, + CapabilityOptNoneINTEL = 6094, + CapabilityAtomicFloat16AddEXT = 6095, + CapabilityDebugInfoModuleINTEL = 6114, + CapabilitySplitBarrierINTEL = 6141, + CapabilityFPGAArgumentInterfacesINTEL = 6174, + CapabilityGroupUniformArithmeticKHR = 6400, + CapabilityMax = 0x7fffffff, +}; + +enum RayFlagsShift { + RayFlagsOpaqueKHRShift = 0, + RayFlagsNoOpaqueKHRShift = 1, + RayFlagsTerminateOnFirstHitKHRShift = 2, + RayFlagsSkipClosestHitShaderKHRShift = 3, + RayFlagsCullBackFacingTrianglesKHRShift = 4, + RayFlagsCullFrontFacingTrianglesKHRShift = 5, + RayFlagsCullOpaqueKHRShift = 6, + RayFlagsCullNoOpaqueKHRShift = 7, + RayFlagsSkipTrianglesKHRShift = 8, + RayFlagsSkipAABBsKHRShift = 9, + RayFlagsForceOpacityMicromap2StateEXTShift = 10, + RayFlagsMax = 0x7fffffff, +}; + +enum RayFlagsMask { + RayFlagsMaskNone = 0, + RayFlagsOpaqueKHRMask = 0x00000001, + RayFlagsNoOpaqueKHRMask = 0x00000002, + RayFlagsTerminateOnFirstHitKHRMask = 0x00000004, + RayFlagsSkipClosestHitShaderKHRMask = 0x00000008, + RayFlagsCullBackFacingTrianglesKHRMask = 0x00000010, + RayFlagsCullFrontFacingTrianglesKHRMask = 0x00000020, + RayFlagsCullOpaqueKHRMask = 0x00000040, + RayFlagsCullNoOpaqueKHRMask = 0x00000080, + RayFlagsSkipTrianglesKHRMask = 0x00000100, + RayFlagsSkipAABBsKHRMask = 0x00000200, + RayFlagsForceOpacityMicromap2StateEXTMask = 0x00000400, +}; + +enum RayQueryIntersection { + RayQueryIntersectionRayQueryCandidateIntersectionKHR = 0, + RayQueryIntersectionRayQueryCommittedIntersectionKHR = 1, + RayQueryIntersectionMax = 0x7fffffff, +}; + +enum RayQueryCommittedIntersectionType { + RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionNoneKHR = 0, + RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionTriangleKHR = 1, + RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionGeneratedKHR = 2, + RayQueryCommittedIntersectionTypeMax = 0x7fffffff, +}; + +enum RayQueryCandidateIntersectionType { + RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionTriangleKHR = 0, + RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionAABBKHR = 1, + RayQueryCandidateIntersectionTypeMax = 0x7fffffff, +}; + +enum FragmentShadingRateShift { + FragmentShadingRateVertical2PixelsShift = 0, + FragmentShadingRateVertical4PixelsShift = 1, + FragmentShadingRateHorizontal2PixelsShift = 2, + FragmentShadingRateHorizontal4PixelsShift = 3, + FragmentShadingRateMax = 0x7fffffff, +}; + +enum FragmentShadingRateMask { + FragmentShadingRateMaskNone = 0, + FragmentShadingRateVertical2PixelsMask = 0x00000001, + FragmentShadingRateVertical4PixelsMask = 0x00000002, + FragmentShadingRateHorizontal2PixelsMask = 0x00000004, + FragmentShadingRateHorizontal4PixelsMask = 0x00000008, +}; + +enum FPDenormMode { + FPDenormModePreserve = 0, + FPDenormModeFlushToZero = 1, + FPDenormModeMax = 0x7fffffff, +}; + +enum FPOperationMode { + FPOperationModeIEEE = 0, + FPOperationModeALT = 1, + FPOperationModeMax = 0x7fffffff, +}; + +enum QuantizationModes { + QuantizationModesTRN = 0, + QuantizationModesTRN_ZERO = 1, + QuantizationModesRND = 2, + QuantizationModesRND_ZERO = 3, + QuantizationModesRND_INF = 4, + QuantizationModesRND_MIN_INF = 5, + QuantizationModesRND_CONV = 6, + QuantizationModesRND_CONV_ODD = 7, + QuantizationModesMax = 0x7fffffff, +}; + +enum OverflowModes { + OverflowModesWRAP = 0, + OverflowModesSAT = 1, + OverflowModesSAT_ZERO = 2, + OverflowModesSAT_SYM = 3, + OverflowModesMax = 0x7fffffff, +}; + +enum PackedVectorFormat { + PackedVectorFormatPackedVectorFormat4x8Bit = 0, + PackedVectorFormatPackedVectorFormat4x8BitKHR = 0, + PackedVectorFormatMax = 0x7fffffff, +}; + +enum CooperativeMatrixOperandsShift { + CooperativeMatrixOperandsMatrixASignedComponentsShift = 0, + CooperativeMatrixOperandsMatrixBSignedComponentsShift = 1, + CooperativeMatrixOperandsMatrixCSignedComponentsShift = 2, + CooperativeMatrixOperandsMatrixResultSignedComponentsShift = 3, + CooperativeMatrixOperandsSaturatingAccumulationShift = 4, + CooperativeMatrixOperandsMax = 0x7fffffff, +}; + +enum CooperativeMatrixOperandsMask { + CooperativeMatrixOperandsMaskNone = 0, + CooperativeMatrixOperandsMatrixASignedComponentsMask = 0x00000001, + CooperativeMatrixOperandsMatrixBSignedComponentsMask = 0x00000002, + CooperativeMatrixOperandsMatrixCSignedComponentsMask = 0x00000004, + CooperativeMatrixOperandsMatrixResultSignedComponentsMask = 0x00000008, + CooperativeMatrixOperandsSaturatingAccumulationMask = 0x00000010, +}; + +enum CooperativeMatrixLayout { + CooperativeMatrixLayoutCooperativeMatrixRowMajorKHR = 0, + CooperativeMatrixLayoutCooperativeMatrixColumnMajorKHR = 1, + CooperativeMatrixLayoutMax = 0x7fffffff, +}; + +enum CooperativeMatrixUse { + CooperativeMatrixUseMatrixAKHR = 0, + CooperativeMatrixUseMatrixBKHR = 1, + CooperativeMatrixUseMatrixAccumulatorKHR = 2, + CooperativeMatrixUseMax = 0x7fffffff, +}; + +enum Op { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpExecutionModeId = 331, + OpDecorateId = 332, + OpGroupNonUniformElect = 333, + OpGroupNonUniformAll = 334, + OpGroupNonUniformAny = 335, + OpGroupNonUniformAllEqual = 336, + OpGroupNonUniformBroadcast = 337, + OpGroupNonUniformBroadcastFirst = 338, + OpGroupNonUniformBallot = 339, + OpGroupNonUniformInverseBallot = 340, + OpGroupNonUniformBallotBitExtract = 341, + OpGroupNonUniformBallotBitCount = 342, + OpGroupNonUniformBallotFindLSB = 343, + OpGroupNonUniformBallotFindMSB = 344, + OpGroupNonUniformShuffle = 345, + OpGroupNonUniformShuffleXor = 346, + OpGroupNonUniformShuffleUp = 347, + OpGroupNonUniformShuffleDown = 348, + OpGroupNonUniformIAdd = 349, + OpGroupNonUniformFAdd = 350, + OpGroupNonUniformIMul = 351, + OpGroupNonUniformFMul = 352, + OpGroupNonUniformSMin = 353, + OpGroupNonUniformUMin = 354, + OpGroupNonUniformFMin = 355, + OpGroupNonUniformSMax = 356, + OpGroupNonUniformUMax = 357, + OpGroupNonUniformFMax = 358, + OpGroupNonUniformBitwiseAnd = 359, + OpGroupNonUniformBitwiseOr = 360, + OpGroupNonUniformBitwiseXor = 361, + OpGroupNonUniformLogicalAnd = 362, + OpGroupNonUniformLogicalOr = 363, + OpGroupNonUniformLogicalXor = 364, + OpGroupNonUniformQuadBroadcast = 365, + OpGroupNonUniformQuadSwap = 366, + OpCopyLogical = 400, + OpPtrEqual = 401, + OpPtrNotEqual = 402, + OpPtrDiff = 403, + OpColorAttachmentReadEXT = 4160, + OpDepthAttachmentReadEXT = 4161, + OpStencilAttachmentReadEXT = 4162, + OpTerminateInvocation = 4416, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpGroupNonUniformRotateKHR = 4431, + OpSubgroupReadInvocationKHR = 4432, + OpTraceRayKHR = 4445, + OpExecuteCallableKHR = 4446, + OpConvertUToAccelerationStructureKHR = 4447, + OpIgnoreIntersectionKHR = 4448, + OpTerminateRayKHR = 4449, + OpSDot = 4450, + OpSDotKHR = 4450, + OpUDot = 4451, + OpUDotKHR = 4451, + OpSUDot = 4452, + OpSUDotKHR = 4452, + OpSDotAccSat = 4453, + OpSDotAccSatKHR = 4453, + OpUDotAccSat = 4454, + OpUDotAccSatKHR = 4454, + OpSUDotAccSat = 4455, + OpSUDotAccSatKHR = 4455, + OpTypeCooperativeMatrixKHR = 4456, + OpCooperativeMatrixLoadKHR = 4457, + OpCooperativeMatrixStoreKHR = 4458, + OpCooperativeMatrixMulAddKHR = 4459, + OpCooperativeMatrixLengthKHR = 4460, + OpTypeRayQueryKHR = 4472, + OpRayQueryInitializeKHR = 4473, + OpRayQueryTerminateKHR = 4474, + OpRayQueryGenerateIntersectionKHR = 4475, + OpRayQueryConfirmIntersectionKHR = 4476, + OpRayQueryProceedKHR = 4477, + OpRayQueryGetIntersectionTypeKHR = 4479, + OpImageSampleWeightedQCOM = 4480, + OpImageBoxFilterQCOM = 4481, + OpImageBlockMatchSSDQCOM = 4482, + OpImageBlockMatchSADQCOM = 4483, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpReadClockKHR = 5056, + OpHitObjectRecordHitMotionNV = 5249, + OpHitObjectRecordHitWithIndexMotionNV = 5250, + OpHitObjectRecordMissMotionNV = 5251, + OpHitObjectGetWorldToObjectNV = 5252, + OpHitObjectGetObjectToWorldNV = 5253, + OpHitObjectGetObjectRayDirectionNV = 5254, + OpHitObjectGetObjectRayOriginNV = 5255, + OpHitObjectTraceRayMotionNV = 5256, + OpHitObjectGetShaderRecordBufferHandleNV = 5257, + OpHitObjectGetShaderBindingTableRecordIndexNV = 5258, + OpHitObjectRecordEmptyNV = 5259, + OpHitObjectTraceRayNV = 5260, + OpHitObjectRecordHitNV = 5261, + OpHitObjectRecordHitWithIndexNV = 5262, + OpHitObjectRecordMissNV = 5263, + OpHitObjectExecuteShaderNV = 5264, + OpHitObjectGetCurrentTimeNV = 5265, + OpHitObjectGetAttributesNV = 5266, + OpHitObjectGetHitKindNV = 5267, + OpHitObjectGetPrimitiveIndexNV = 5268, + OpHitObjectGetGeometryIndexNV = 5269, + OpHitObjectGetInstanceIdNV = 5270, + OpHitObjectGetInstanceCustomIndexNV = 5271, + OpHitObjectGetWorldRayDirectionNV = 5272, + OpHitObjectGetWorldRayOriginNV = 5273, + OpHitObjectGetRayTMaxNV = 5274, + OpHitObjectGetRayTMinNV = 5275, + OpHitObjectIsEmptyNV = 5276, + OpHitObjectIsHitNV = 5277, + OpHitObjectIsMissNV = 5278, + OpReorderThreadWithHitObjectNV = 5279, + OpReorderThreadWithHintNV = 5280, + OpTypeHitObjectNV = 5281, + OpImageSampleFootprintNV = 5283, + OpEmitMeshTasksEXT = 5294, + OpSetMeshOutputsEXT = 5295, + OpGroupNonUniformPartitionNV = 5296, + OpWritePackedPrimitiveIndices4x8NV = 5299, + OpReportIntersectionKHR = 5334, + OpReportIntersectionNV = 5334, + OpIgnoreIntersectionNV = 5335, + OpTerminateRayNV = 5336, + OpTraceNV = 5337, + OpTraceMotionNV = 5338, + OpTraceRayMotionNV = 5339, + OpRayQueryGetIntersectionTriangleVertexPositionsKHR = 5340, + OpTypeAccelerationStructureKHR = 5341, + OpTypeAccelerationStructureNV = 5341, + OpExecuteCallableNV = 5344, + OpTypeCooperativeMatrixNV = 5358, + OpCooperativeMatrixLoadNV = 5359, + OpCooperativeMatrixStoreNV = 5360, + OpCooperativeMatrixMulAddNV = 5361, + OpCooperativeMatrixLengthNV = 5362, + OpBeginInvocationInterlockEXT = 5364, + OpEndInvocationInterlockEXT = 5365, + OpDemoteToHelperInvocation = 5380, + OpDemoteToHelperInvocationEXT = 5380, + OpIsHelperInvocationEXT = 5381, + OpConvertUToImageNV = 5391, + OpConvertUToSamplerNV = 5392, + OpConvertImageToUNV = 5393, + OpConvertSamplerToUNV = 5394, + OpConvertUToSampledImageNV = 5395, + OpConvertSampledImageToUNV = 5396, + OpSamplerImageAddressingModeNV = 5397, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpSubgroupImageMediaBlockReadINTEL = 5580, + OpSubgroupImageMediaBlockWriteINTEL = 5581, + OpUCountLeadingZerosINTEL = 5585, + OpUCountTrailingZerosINTEL = 5586, + OpAbsISubINTEL = 5587, + OpAbsUSubINTEL = 5588, + OpIAddSatINTEL = 5589, + OpUAddSatINTEL = 5590, + OpIAverageINTEL = 5591, + OpUAverageINTEL = 5592, + OpIAverageRoundedINTEL = 5593, + OpUAverageRoundedINTEL = 5594, + OpISubSatINTEL = 5595, + OpUSubSatINTEL = 5596, + OpIMul32x16INTEL = 5597, + OpUMul32x16INTEL = 5598, + OpConstantFunctionPointerINTEL = 5600, + OpFunctionPointerCallINTEL = 5601, + OpAsmTargetINTEL = 5609, + OpAsmINTEL = 5610, + OpAsmCallINTEL = 5611, + OpAtomicFMinEXT = 5614, + OpAtomicFMaxEXT = 5615, + OpAssumeTrueKHR = 5630, + OpExpectKHR = 5631, + OpDecorateString = 5632, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateString = 5633, + OpMemberDecorateStringGOOGLE = 5633, + OpVmeImageINTEL = 5699, + OpTypeVmeImageINTEL = 5700, + OpTypeAvcImePayloadINTEL = 5701, + OpTypeAvcRefPayloadINTEL = 5702, + OpTypeAvcSicPayloadINTEL = 5703, + OpTypeAvcMcePayloadINTEL = 5704, + OpTypeAvcMceResultINTEL = 5705, + OpTypeAvcImeResultINTEL = 5706, + OpTypeAvcImeResultSingleReferenceStreamoutINTEL = 5707, + OpTypeAvcImeResultDualReferenceStreamoutINTEL = 5708, + OpTypeAvcImeSingleReferenceStreaminINTEL = 5709, + OpTypeAvcImeDualReferenceStreaminINTEL = 5710, + OpTypeAvcRefResultINTEL = 5711, + OpTypeAvcSicResultINTEL = 5712, + OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL = 5713, + OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL = 5714, + OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL = 5715, + OpSubgroupAvcMceSetInterShapePenaltyINTEL = 5716, + OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL = 5717, + OpSubgroupAvcMceSetInterDirectionPenaltyINTEL = 5718, + OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL = 5719, + OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL = 5720, + OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL = 5721, + OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL = 5722, + OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL = 5723, + OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL = 5724, + OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL = 5725, + OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL = 5726, + OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL = 5727, + OpSubgroupAvcMceSetAcOnlyHaarINTEL = 5728, + OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL = 5729, + OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL = 5730, + OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL = 5731, + OpSubgroupAvcMceConvertToImePayloadINTEL = 5732, + OpSubgroupAvcMceConvertToImeResultINTEL = 5733, + OpSubgroupAvcMceConvertToRefPayloadINTEL = 5734, + OpSubgroupAvcMceConvertToRefResultINTEL = 5735, + OpSubgroupAvcMceConvertToSicPayloadINTEL = 5736, + OpSubgroupAvcMceConvertToSicResultINTEL = 5737, + OpSubgroupAvcMceGetMotionVectorsINTEL = 5738, + OpSubgroupAvcMceGetInterDistortionsINTEL = 5739, + OpSubgroupAvcMceGetBestInterDistortionsINTEL = 5740, + OpSubgroupAvcMceGetInterMajorShapeINTEL = 5741, + OpSubgroupAvcMceGetInterMinorShapeINTEL = 5742, + OpSubgroupAvcMceGetInterDirectionsINTEL = 5743, + OpSubgroupAvcMceGetInterMotionVectorCountINTEL = 5744, + OpSubgroupAvcMceGetInterReferenceIdsINTEL = 5745, + OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL = 5746, + OpSubgroupAvcImeInitializeINTEL = 5747, + OpSubgroupAvcImeSetSingleReferenceINTEL = 5748, + OpSubgroupAvcImeSetDualReferenceINTEL = 5749, + OpSubgroupAvcImeRefWindowSizeINTEL = 5750, + OpSubgroupAvcImeAdjustRefOffsetINTEL = 5751, + OpSubgroupAvcImeConvertToMcePayloadINTEL = 5752, + OpSubgroupAvcImeSetMaxMotionVectorCountINTEL = 5753, + OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL = 5754, + OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL = 5755, + OpSubgroupAvcImeSetWeightedSadINTEL = 5756, + OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL = 5757, + OpSubgroupAvcImeEvaluateWithDualReferenceINTEL = 5758, + OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL = 5759, + OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL = 5760, + OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL = 5761, + OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL = 5762, + OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL = 5763, + OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL = 5764, + OpSubgroupAvcImeConvertToMceResultINTEL = 5765, + OpSubgroupAvcImeGetSingleReferenceStreaminINTEL = 5766, + OpSubgroupAvcImeGetDualReferenceStreaminINTEL = 5767, + OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL = 5768, + OpSubgroupAvcImeStripDualReferenceStreamoutINTEL = 5769, + OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL = 5770, + OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL = 5771, + OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL = 5772, + OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL = 5773, + OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL = 5774, + OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL = 5775, + OpSubgroupAvcImeGetBorderReachedINTEL = 5776, + OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL = 5777, + OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL = 5778, + OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL = 5779, + OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL = 5780, + OpSubgroupAvcFmeInitializeINTEL = 5781, + OpSubgroupAvcBmeInitializeINTEL = 5782, + OpSubgroupAvcRefConvertToMcePayloadINTEL = 5783, + OpSubgroupAvcRefSetBidirectionalMixDisableINTEL = 5784, + OpSubgroupAvcRefSetBilinearFilterEnableINTEL = 5785, + OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL = 5786, + OpSubgroupAvcRefEvaluateWithDualReferenceINTEL = 5787, + OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL = 5788, + OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL = 5789, + OpSubgroupAvcRefConvertToMceResultINTEL = 5790, + OpSubgroupAvcSicInitializeINTEL = 5791, + OpSubgroupAvcSicConfigureSkcINTEL = 5792, + OpSubgroupAvcSicConfigureIpeLumaINTEL = 5793, + OpSubgroupAvcSicConfigureIpeLumaChromaINTEL = 5794, + OpSubgroupAvcSicGetMotionVectorMaskINTEL = 5795, + OpSubgroupAvcSicConvertToMcePayloadINTEL = 5796, + OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL = 5797, + OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL = 5798, + OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL = 5799, + OpSubgroupAvcSicSetBilinearFilterEnableINTEL = 5800, + OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL = 5801, + OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL = 5802, + OpSubgroupAvcSicEvaluateIpeINTEL = 5803, + OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL = 5804, + OpSubgroupAvcSicEvaluateWithDualReferenceINTEL = 5805, + OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL = 5806, + OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL = 5807, + OpSubgroupAvcSicConvertToMceResultINTEL = 5808, + OpSubgroupAvcSicGetIpeLumaShapeINTEL = 5809, + OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL = 5810, + OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL = 5811, + OpSubgroupAvcSicGetPackedIpeLumaModesINTEL = 5812, + OpSubgroupAvcSicGetIpeChromaModeINTEL = 5813, + OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814, + OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815, + OpSubgroupAvcSicGetInterRawSadsINTEL = 5816, + OpVariableLengthArrayINTEL = 5818, + OpSaveMemoryINTEL = 5819, + OpRestoreMemoryINTEL = 5820, + OpArbitraryFloatSinCosPiINTEL = 5840, + OpArbitraryFloatCastINTEL = 5841, + OpArbitraryFloatCastFromIntINTEL = 5842, + OpArbitraryFloatCastToIntINTEL = 5843, + OpArbitraryFloatAddINTEL = 5846, + OpArbitraryFloatSubINTEL = 5847, + OpArbitraryFloatMulINTEL = 5848, + OpArbitraryFloatDivINTEL = 5849, + OpArbitraryFloatGTINTEL = 5850, + OpArbitraryFloatGEINTEL = 5851, + OpArbitraryFloatLTINTEL = 5852, + OpArbitraryFloatLEINTEL = 5853, + OpArbitraryFloatEQINTEL = 5854, + OpArbitraryFloatRecipINTEL = 5855, + OpArbitraryFloatRSqrtINTEL = 5856, + OpArbitraryFloatCbrtINTEL = 5857, + OpArbitraryFloatHypotINTEL = 5858, + OpArbitraryFloatSqrtINTEL = 5859, + OpArbitraryFloatLogINTEL = 5860, + OpArbitraryFloatLog2INTEL = 5861, + OpArbitraryFloatLog10INTEL = 5862, + OpArbitraryFloatLog1pINTEL = 5863, + OpArbitraryFloatExpINTEL = 5864, + OpArbitraryFloatExp2INTEL = 5865, + OpArbitraryFloatExp10INTEL = 5866, + OpArbitraryFloatExpm1INTEL = 5867, + OpArbitraryFloatSinINTEL = 5868, + OpArbitraryFloatCosINTEL = 5869, + OpArbitraryFloatSinCosINTEL = 5870, + OpArbitraryFloatSinPiINTEL = 5871, + OpArbitraryFloatCosPiINTEL = 5872, + OpArbitraryFloatASinINTEL = 5873, + OpArbitraryFloatASinPiINTEL = 5874, + OpArbitraryFloatACosINTEL = 5875, + OpArbitraryFloatACosPiINTEL = 5876, + OpArbitraryFloatATanINTEL = 5877, + OpArbitraryFloatATanPiINTEL = 5878, + OpArbitraryFloatATan2INTEL = 5879, + OpArbitraryFloatPowINTEL = 5880, + OpArbitraryFloatPowRINTEL = 5881, + OpArbitraryFloatPowNINTEL = 5882, + OpLoopControlINTEL = 5887, + OpAliasDomainDeclINTEL = 5911, + OpAliasScopeDeclINTEL = 5912, + OpAliasScopeListDeclINTEL = 5913, + OpFixedSqrtINTEL = 5923, + OpFixedRecipINTEL = 5924, + OpFixedRsqrtINTEL = 5925, + OpFixedSinINTEL = 5926, + OpFixedCosINTEL = 5927, + OpFixedSinCosINTEL = 5928, + OpFixedSinPiINTEL = 5929, + OpFixedCosPiINTEL = 5930, + OpFixedSinCosPiINTEL = 5931, + OpFixedLogINTEL = 5932, + OpFixedExpINTEL = 5933, + OpPtrCastToCrossWorkgroupINTEL = 5934, + OpCrossWorkgroupCastToPtrINTEL = 5938, + OpReadPipeBlockingINTEL = 5946, + OpWritePipeBlockingINTEL = 5947, + OpFPGARegINTEL = 5949, + OpRayQueryGetRayTMinKHR = 6016, + OpRayQueryGetRayFlagsKHR = 6017, + OpRayQueryGetIntersectionTKHR = 6018, + OpRayQueryGetIntersectionInstanceCustomIndexKHR = 6019, + OpRayQueryGetIntersectionInstanceIdKHR = 6020, + OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR = 6021, + OpRayQueryGetIntersectionGeometryIndexKHR = 6022, + OpRayQueryGetIntersectionPrimitiveIndexKHR = 6023, + OpRayQueryGetIntersectionBarycentricsKHR = 6024, + OpRayQueryGetIntersectionFrontFaceKHR = 6025, + OpRayQueryGetIntersectionCandidateAABBOpaqueKHR = 6026, + OpRayQueryGetIntersectionObjectRayDirectionKHR = 6027, + OpRayQueryGetIntersectionObjectRayOriginKHR = 6028, + OpRayQueryGetWorldRayDirectionKHR = 6029, + OpRayQueryGetWorldRayOriginKHR = 6030, + OpRayQueryGetIntersectionObjectToWorldKHR = 6031, + OpRayQueryGetIntersectionWorldToObjectKHR = 6032, + OpAtomicFAddEXT = 6035, + OpTypeBufferSurfaceINTEL = 6086, + OpTypeStructContinuedINTEL = 6090, + OpConstantCompositeContinuedINTEL = 6091, + OpSpecConstantCompositeContinuedINTEL = 6092, + OpControlBarrierArriveINTEL = 6142, + OpControlBarrierWaitINTEL = 6143, + OpGroupIMulKHR = 6401, + OpGroupFMulKHR = 6402, + OpGroupBitwiseAndKHR = 6403, + OpGroupBitwiseOrKHR = 6404, + OpGroupBitwiseXorKHR = 6405, + OpGroupLogicalAndKHR = 6406, + OpGroupLogicalOrKHR = 6407, + OpGroupLogicalXorKHR = 6408, + OpMax = 0x7fffffff, +}; + +#ifdef SPV_ENABLE_UTILITY_CODE +#ifndef __cplusplus +#include +#endif +inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { + *hasResult = *hasResultType = false; + switch (opcode) { + default: /* unknown opcode */ break; + case OpNop: *hasResult = false; *hasResultType = false; break; + case OpUndef: *hasResult = true; *hasResultType = true; break; + case OpSourceContinued: *hasResult = false; *hasResultType = false; break; + case OpSource: *hasResult = false; *hasResultType = false; break; + case OpSourceExtension: *hasResult = false; *hasResultType = false; break; + case OpName: *hasResult = false; *hasResultType = false; break; + case OpMemberName: *hasResult = false; *hasResultType = false; break; + case OpString: *hasResult = true; *hasResultType = false; break; + case OpLine: *hasResult = false; *hasResultType = false; break; + case OpExtension: *hasResult = false; *hasResultType = false; break; + case OpExtInstImport: *hasResult = true; *hasResultType = false; break; + case OpExtInst: *hasResult = true; *hasResultType = true; break; + case OpMemoryModel: *hasResult = false; *hasResultType = false; break; + case OpEntryPoint: *hasResult = false; *hasResultType = false; break; + case OpExecutionMode: *hasResult = false; *hasResultType = false; break; + case OpCapability: *hasResult = false; *hasResultType = false; break; + case OpTypeVoid: *hasResult = true; *hasResultType = false; break; + case OpTypeBool: *hasResult = true; *hasResultType = false; break; + case OpTypeInt: *hasResult = true; *hasResultType = false; break; + case OpTypeFloat: *hasResult = true; *hasResultType = false; break; + case OpTypeVector: *hasResult = true; *hasResultType = false; break; + case OpTypeMatrix: *hasResult = true; *hasResultType = false; break; + case OpTypeImage: *hasResult = true; *hasResultType = false; break; + case OpTypeSampler: *hasResult = true; *hasResultType = false; break; + case OpTypeSampledImage: *hasResult = true; *hasResultType = false; break; + case OpTypeArray: *hasResult = true; *hasResultType = false; break; + case OpTypeRuntimeArray: *hasResult = true; *hasResultType = false; break; + case OpTypeStruct: *hasResult = true; *hasResultType = false; break; + case OpTypeOpaque: *hasResult = true; *hasResultType = false; break; + case OpTypePointer: *hasResult = true; *hasResultType = false; break; + case OpTypeFunction: *hasResult = true; *hasResultType = false; break; + case OpTypeEvent: *hasResult = true; *hasResultType = false; break; + case OpTypeDeviceEvent: *hasResult = true; *hasResultType = false; break; + case OpTypeReserveId: *hasResult = true; *hasResultType = false; break; + case OpTypeQueue: *hasResult = true; *hasResultType = false; break; + case OpTypePipe: *hasResult = true; *hasResultType = false; break; + case OpTypeForwardPointer: *hasResult = false; *hasResultType = false; break; + case OpConstantTrue: *hasResult = true; *hasResultType = true; break; + case OpConstantFalse: *hasResult = true; *hasResultType = true; break; + case OpConstant: *hasResult = true; *hasResultType = true; break; + case OpConstantComposite: *hasResult = true; *hasResultType = true; break; + case OpConstantSampler: *hasResult = true; *hasResultType = true; break; + case OpConstantNull: *hasResult = true; *hasResultType = true; break; + case OpSpecConstantTrue: *hasResult = true; *hasResultType = true; break; + case OpSpecConstantFalse: *hasResult = true; *hasResultType = true; break; + case OpSpecConstant: *hasResult = true; *hasResultType = true; break; + case OpSpecConstantComposite: *hasResult = true; *hasResultType = true; break; + case OpSpecConstantOp: *hasResult = true; *hasResultType = true; break; + case OpFunction: *hasResult = true; *hasResultType = true; break; + case OpFunctionParameter: *hasResult = true; *hasResultType = true; break; + case OpFunctionEnd: *hasResult = false; *hasResultType = false; break; + case OpFunctionCall: *hasResult = true; *hasResultType = true; break; + case OpVariable: *hasResult = true; *hasResultType = true; break; + case OpImageTexelPointer: *hasResult = true; *hasResultType = true; break; + case OpLoad: *hasResult = true; *hasResultType = true; break; + case OpStore: *hasResult = false; *hasResultType = false; break; + case OpCopyMemory: *hasResult = false; *hasResultType = false; break; + case OpCopyMemorySized: *hasResult = false; *hasResultType = false; break; + case OpAccessChain: *hasResult = true; *hasResultType = true; break; + case OpInBoundsAccessChain: *hasResult = true; *hasResultType = true; break; + case OpPtrAccessChain: *hasResult = true; *hasResultType = true; break; + case OpArrayLength: *hasResult = true; *hasResultType = true; break; + case OpGenericPtrMemSemantics: *hasResult = true; *hasResultType = true; break; + case OpInBoundsPtrAccessChain: *hasResult = true; *hasResultType = true; break; + case OpDecorate: *hasResult = false; *hasResultType = false; break; + case OpMemberDecorate: *hasResult = false; *hasResultType = false; break; + case OpDecorationGroup: *hasResult = true; *hasResultType = false; break; + case OpGroupDecorate: *hasResult = false; *hasResultType = false; break; + case OpGroupMemberDecorate: *hasResult = false; *hasResultType = false; break; + case OpVectorExtractDynamic: *hasResult = true; *hasResultType = true; break; + case OpVectorInsertDynamic: *hasResult = true; *hasResultType = true; break; + case OpVectorShuffle: *hasResult = true; *hasResultType = true; break; + case OpCompositeConstruct: *hasResult = true; *hasResultType = true; break; + case OpCompositeExtract: *hasResult = true; *hasResultType = true; break; + case OpCompositeInsert: *hasResult = true; *hasResultType = true; break; + case OpCopyObject: *hasResult = true; *hasResultType = true; break; + case OpTranspose: *hasResult = true; *hasResultType = true; break; + case OpSampledImage: *hasResult = true; *hasResultType = true; break; + case OpImageSampleImplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSampleExplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSampleDrefImplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSampleDrefExplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSampleProjImplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSampleProjExplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSampleProjDrefImplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSampleProjDrefExplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageFetch: *hasResult = true; *hasResultType = true; break; + case OpImageGather: *hasResult = true; *hasResultType = true; break; + case OpImageDrefGather: *hasResult = true; *hasResultType = true; break; + case OpImageRead: *hasResult = true; *hasResultType = true; break; + case OpImageWrite: *hasResult = false; *hasResultType = false; break; + case OpImage: *hasResult = true; *hasResultType = true; break; + case OpImageQueryFormat: *hasResult = true; *hasResultType = true; break; + case OpImageQueryOrder: *hasResult = true; *hasResultType = true; break; + case OpImageQuerySizeLod: *hasResult = true; *hasResultType = true; break; + case OpImageQuerySize: *hasResult = true; *hasResultType = true; break; + case OpImageQueryLod: *hasResult = true; *hasResultType = true; break; + case OpImageQueryLevels: *hasResult = true; *hasResultType = true; break; + case OpImageQuerySamples: *hasResult = true; *hasResultType = true; break; + case OpConvertFToU: *hasResult = true; *hasResultType = true; break; + case OpConvertFToS: *hasResult = true; *hasResultType = true; break; + case OpConvertSToF: *hasResult = true; *hasResultType = true; break; + case OpConvertUToF: *hasResult = true; *hasResultType = true; break; + case OpUConvert: *hasResult = true; *hasResultType = true; break; + case OpSConvert: *hasResult = true; *hasResultType = true; break; + case OpFConvert: *hasResult = true; *hasResultType = true; break; + case OpQuantizeToF16: *hasResult = true; *hasResultType = true; break; + case OpConvertPtrToU: *hasResult = true; *hasResultType = true; break; + case OpSatConvertSToU: *hasResult = true; *hasResultType = true; break; + case OpSatConvertUToS: *hasResult = true; *hasResultType = true; break; + case OpConvertUToPtr: *hasResult = true; *hasResultType = true; break; + case OpPtrCastToGeneric: *hasResult = true; *hasResultType = true; break; + case OpGenericCastToPtr: *hasResult = true; *hasResultType = true; break; + case OpGenericCastToPtrExplicit: *hasResult = true; *hasResultType = true; break; + case OpBitcast: *hasResult = true; *hasResultType = true; break; + case OpSNegate: *hasResult = true; *hasResultType = true; break; + case OpFNegate: *hasResult = true; *hasResultType = true; break; + case OpIAdd: *hasResult = true; *hasResultType = true; break; + case OpFAdd: *hasResult = true; *hasResultType = true; break; + case OpISub: *hasResult = true; *hasResultType = true; break; + case OpFSub: *hasResult = true; *hasResultType = true; break; + case OpIMul: *hasResult = true; *hasResultType = true; break; + case OpFMul: *hasResult = true; *hasResultType = true; break; + case OpUDiv: *hasResult = true; *hasResultType = true; break; + case OpSDiv: *hasResult = true; *hasResultType = true; break; + case OpFDiv: *hasResult = true; *hasResultType = true; break; + case OpUMod: *hasResult = true; *hasResultType = true; break; + case OpSRem: *hasResult = true; *hasResultType = true; break; + case OpSMod: *hasResult = true; *hasResultType = true; break; + case OpFRem: *hasResult = true; *hasResultType = true; break; + case OpFMod: *hasResult = true; *hasResultType = true; break; + case OpVectorTimesScalar: *hasResult = true; *hasResultType = true; break; + case OpMatrixTimesScalar: *hasResult = true; *hasResultType = true; break; + case OpVectorTimesMatrix: *hasResult = true; *hasResultType = true; break; + case OpMatrixTimesVector: *hasResult = true; *hasResultType = true; break; + case OpMatrixTimesMatrix: *hasResult = true; *hasResultType = true; break; + case OpOuterProduct: *hasResult = true; *hasResultType = true; break; + case OpDot: *hasResult = true; *hasResultType = true; break; + case OpIAddCarry: *hasResult = true; *hasResultType = true; break; + case OpISubBorrow: *hasResult = true; *hasResultType = true; break; + case OpUMulExtended: *hasResult = true; *hasResultType = true; break; + case OpSMulExtended: *hasResult = true; *hasResultType = true; break; + case OpAny: *hasResult = true; *hasResultType = true; break; + case OpAll: *hasResult = true; *hasResultType = true; break; + case OpIsNan: *hasResult = true; *hasResultType = true; break; + case OpIsInf: *hasResult = true; *hasResultType = true; break; + case OpIsFinite: *hasResult = true; *hasResultType = true; break; + case OpIsNormal: *hasResult = true; *hasResultType = true; break; + case OpSignBitSet: *hasResult = true; *hasResultType = true; break; + case OpLessOrGreater: *hasResult = true; *hasResultType = true; break; + case OpOrdered: *hasResult = true; *hasResultType = true; break; + case OpUnordered: *hasResult = true; *hasResultType = true; break; + case OpLogicalEqual: *hasResult = true; *hasResultType = true; break; + case OpLogicalNotEqual: *hasResult = true; *hasResultType = true; break; + case OpLogicalOr: *hasResult = true; *hasResultType = true; break; + case OpLogicalAnd: *hasResult = true; *hasResultType = true; break; + case OpLogicalNot: *hasResult = true; *hasResultType = true; break; + case OpSelect: *hasResult = true; *hasResultType = true; break; + case OpIEqual: *hasResult = true; *hasResultType = true; break; + case OpINotEqual: *hasResult = true; *hasResultType = true; break; + case OpUGreaterThan: *hasResult = true; *hasResultType = true; break; + case OpSGreaterThan: *hasResult = true; *hasResultType = true; break; + case OpUGreaterThanEqual: *hasResult = true; *hasResultType = true; break; + case OpSGreaterThanEqual: *hasResult = true; *hasResultType = true; break; + case OpULessThan: *hasResult = true; *hasResultType = true; break; + case OpSLessThan: *hasResult = true; *hasResultType = true; break; + case OpULessThanEqual: *hasResult = true; *hasResultType = true; break; + case OpSLessThanEqual: *hasResult = true; *hasResultType = true; break; + case OpFOrdEqual: *hasResult = true; *hasResultType = true; break; + case OpFUnordEqual: *hasResult = true; *hasResultType = true; break; + case OpFOrdNotEqual: *hasResult = true; *hasResultType = true; break; + case OpFUnordNotEqual: *hasResult = true; *hasResultType = true; break; + case OpFOrdLessThan: *hasResult = true; *hasResultType = true; break; + case OpFUnordLessThan: *hasResult = true; *hasResultType = true; break; + case OpFOrdGreaterThan: *hasResult = true; *hasResultType = true; break; + case OpFUnordGreaterThan: *hasResult = true; *hasResultType = true; break; + case OpFOrdLessThanEqual: *hasResult = true; *hasResultType = true; break; + case OpFUnordLessThanEqual: *hasResult = true; *hasResultType = true; break; + case OpFOrdGreaterThanEqual: *hasResult = true; *hasResultType = true; break; + case OpFUnordGreaterThanEqual: *hasResult = true; *hasResultType = true; break; + case OpShiftRightLogical: *hasResult = true; *hasResultType = true; break; + case OpShiftRightArithmetic: *hasResult = true; *hasResultType = true; break; + case OpShiftLeftLogical: *hasResult = true; *hasResultType = true; break; + case OpBitwiseOr: *hasResult = true; *hasResultType = true; break; + case OpBitwiseXor: *hasResult = true; *hasResultType = true; break; + case OpBitwiseAnd: *hasResult = true; *hasResultType = true; break; + case OpNot: *hasResult = true; *hasResultType = true; break; + case OpBitFieldInsert: *hasResult = true; *hasResultType = true; break; + case OpBitFieldSExtract: *hasResult = true; *hasResultType = true; break; + case OpBitFieldUExtract: *hasResult = true; *hasResultType = true; break; + case OpBitReverse: *hasResult = true; *hasResultType = true; break; + case OpBitCount: *hasResult = true; *hasResultType = true; break; + case OpDPdx: *hasResult = true; *hasResultType = true; break; + case OpDPdy: *hasResult = true; *hasResultType = true; break; + case OpFwidth: *hasResult = true; *hasResultType = true; break; + case OpDPdxFine: *hasResult = true; *hasResultType = true; break; + case OpDPdyFine: *hasResult = true; *hasResultType = true; break; + case OpFwidthFine: *hasResult = true; *hasResultType = true; break; + case OpDPdxCoarse: *hasResult = true; *hasResultType = true; break; + case OpDPdyCoarse: *hasResult = true; *hasResultType = true; break; + case OpFwidthCoarse: *hasResult = true; *hasResultType = true; break; + case OpEmitVertex: *hasResult = false; *hasResultType = false; break; + case OpEndPrimitive: *hasResult = false; *hasResultType = false; break; + case OpEmitStreamVertex: *hasResult = false; *hasResultType = false; break; + case OpEndStreamPrimitive: *hasResult = false; *hasResultType = false; break; + case OpControlBarrier: *hasResult = false; *hasResultType = false; break; + case OpMemoryBarrier: *hasResult = false; *hasResultType = false; break; + case OpAtomicLoad: *hasResult = true; *hasResultType = true; break; + case OpAtomicStore: *hasResult = false; *hasResultType = false; break; + case OpAtomicExchange: *hasResult = true; *hasResultType = true; break; + case OpAtomicCompareExchange: *hasResult = true; *hasResultType = true; break; + case OpAtomicCompareExchangeWeak: *hasResult = true; *hasResultType = true; break; + case OpAtomicIIncrement: *hasResult = true; *hasResultType = true; break; + case OpAtomicIDecrement: *hasResult = true; *hasResultType = true; break; + case OpAtomicIAdd: *hasResult = true; *hasResultType = true; break; + case OpAtomicISub: *hasResult = true; *hasResultType = true; break; + case OpAtomicSMin: *hasResult = true; *hasResultType = true; break; + case OpAtomicUMin: *hasResult = true; *hasResultType = true; break; + case OpAtomicSMax: *hasResult = true; *hasResultType = true; break; + case OpAtomicUMax: *hasResult = true; *hasResultType = true; break; + case OpAtomicAnd: *hasResult = true; *hasResultType = true; break; + case OpAtomicOr: *hasResult = true; *hasResultType = true; break; + case OpAtomicXor: *hasResult = true; *hasResultType = true; break; + case OpPhi: *hasResult = true; *hasResultType = true; break; + case OpLoopMerge: *hasResult = false; *hasResultType = false; break; + case OpSelectionMerge: *hasResult = false; *hasResultType = false; break; + case OpLabel: *hasResult = true; *hasResultType = false; break; + case OpBranch: *hasResult = false; *hasResultType = false; break; + case OpBranchConditional: *hasResult = false; *hasResultType = false; break; + case OpSwitch: *hasResult = false; *hasResultType = false; break; + case OpKill: *hasResult = false; *hasResultType = false; break; + case OpReturn: *hasResult = false; *hasResultType = false; break; + case OpReturnValue: *hasResult = false; *hasResultType = false; break; + case OpUnreachable: *hasResult = false; *hasResultType = false; break; + case OpLifetimeStart: *hasResult = false; *hasResultType = false; break; + case OpLifetimeStop: *hasResult = false; *hasResultType = false; break; + case OpGroupAsyncCopy: *hasResult = true; *hasResultType = true; break; + case OpGroupWaitEvents: *hasResult = false; *hasResultType = false; break; + case OpGroupAll: *hasResult = true; *hasResultType = true; break; + case OpGroupAny: *hasResult = true; *hasResultType = true; break; + case OpGroupBroadcast: *hasResult = true; *hasResultType = true; break; + case OpGroupIAdd: *hasResult = true; *hasResultType = true; break; + case OpGroupFAdd: *hasResult = true; *hasResultType = true; break; + case OpGroupFMin: *hasResult = true; *hasResultType = true; break; + case OpGroupUMin: *hasResult = true; *hasResultType = true; break; + case OpGroupSMin: *hasResult = true; *hasResultType = true; break; + case OpGroupFMax: *hasResult = true; *hasResultType = true; break; + case OpGroupUMax: *hasResult = true; *hasResultType = true; break; + case OpGroupSMax: *hasResult = true; *hasResultType = true; break; + case OpReadPipe: *hasResult = true; *hasResultType = true; break; + case OpWritePipe: *hasResult = true; *hasResultType = true; break; + case OpReservedReadPipe: *hasResult = true; *hasResultType = true; break; + case OpReservedWritePipe: *hasResult = true; *hasResultType = true; break; + case OpReserveReadPipePackets: *hasResult = true; *hasResultType = true; break; + case OpReserveWritePipePackets: *hasResult = true; *hasResultType = true; break; + case OpCommitReadPipe: *hasResult = false; *hasResultType = false; break; + case OpCommitWritePipe: *hasResult = false; *hasResultType = false; break; + case OpIsValidReserveId: *hasResult = true; *hasResultType = true; break; + case OpGetNumPipePackets: *hasResult = true; *hasResultType = true; break; + case OpGetMaxPipePackets: *hasResult = true; *hasResultType = true; break; + case OpGroupReserveReadPipePackets: *hasResult = true; *hasResultType = true; break; + case OpGroupReserveWritePipePackets: *hasResult = true; *hasResultType = true; break; + case OpGroupCommitReadPipe: *hasResult = false; *hasResultType = false; break; + case OpGroupCommitWritePipe: *hasResult = false; *hasResultType = false; break; + case OpEnqueueMarker: *hasResult = true; *hasResultType = true; break; + case OpEnqueueKernel: *hasResult = true; *hasResultType = true; break; + case OpGetKernelNDrangeSubGroupCount: *hasResult = true; *hasResultType = true; break; + case OpGetKernelNDrangeMaxSubGroupSize: *hasResult = true; *hasResultType = true; break; + case OpGetKernelWorkGroupSize: *hasResult = true; *hasResultType = true; break; + case OpGetKernelPreferredWorkGroupSizeMultiple: *hasResult = true; *hasResultType = true; break; + case OpRetainEvent: *hasResult = false; *hasResultType = false; break; + case OpReleaseEvent: *hasResult = false; *hasResultType = false; break; + case OpCreateUserEvent: *hasResult = true; *hasResultType = true; break; + case OpIsValidEvent: *hasResult = true; *hasResultType = true; break; + case OpSetUserEventStatus: *hasResult = false; *hasResultType = false; break; + case OpCaptureEventProfilingInfo: *hasResult = false; *hasResultType = false; break; + case OpGetDefaultQueue: *hasResult = true; *hasResultType = true; break; + case OpBuildNDRange: *hasResult = true; *hasResultType = true; break; + case OpImageSparseSampleImplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSparseSampleExplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSparseSampleDrefImplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSparseSampleDrefExplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSparseSampleProjImplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSparseSampleProjExplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSparseSampleProjDrefImplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSparseSampleProjDrefExplicitLod: *hasResult = true; *hasResultType = true; break; + case OpImageSparseFetch: *hasResult = true; *hasResultType = true; break; + case OpImageSparseGather: *hasResult = true; *hasResultType = true; break; + case OpImageSparseDrefGather: *hasResult = true; *hasResultType = true; break; + case OpImageSparseTexelsResident: *hasResult = true; *hasResultType = true; break; + case OpNoLine: *hasResult = false; *hasResultType = false; break; + case OpAtomicFlagTestAndSet: *hasResult = true; *hasResultType = true; break; + case OpAtomicFlagClear: *hasResult = false; *hasResultType = false; break; + case OpImageSparseRead: *hasResult = true; *hasResultType = true; break; + case OpSizeOf: *hasResult = true; *hasResultType = true; break; + case OpTypePipeStorage: *hasResult = true; *hasResultType = false; break; + case OpConstantPipeStorage: *hasResult = true; *hasResultType = true; break; + case OpCreatePipeFromPipeStorage: *hasResult = true; *hasResultType = true; break; + case OpGetKernelLocalSizeForSubgroupCount: *hasResult = true; *hasResultType = true; break; + case OpGetKernelMaxNumSubgroups: *hasResult = true; *hasResultType = true; break; + case OpTypeNamedBarrier: *hasResult = true; *hasResultType = false; break; + case OpNamedBarrierInitialize: *hasResult = true; *hasResultType = true; break; + case OpMemoryNamedBarrier: *hasResult = false; *hasResultType = false; break; + case OpModuleProcessed: *hasResult = false; *hasResultType = false; break; + case OpExecutionModeId: *hasResult = false; *hasResultType = false; break; + case OpDecorateId: *hasResult = false; *hasResultType = false; break; + case OpGroupNonUniformElect: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformAll: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformAny: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformAllEqual: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformBroadcast: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformBroadcastFirst: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformBallot: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformInverseBallot: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformBallotBitExtract: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformBallotBitCount: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformBallotFindLSB: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformBallotFindMSB: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformShuffle: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformShuffleXor: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformShuffleUp: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformShuffleDown: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformIAdd: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformFAdd: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformIMul: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformFMul: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformSMin: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformUMin: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformFMin: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformSMax: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformUMax: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformFMax: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformBitwiseAnd: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformBitwiseOr: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformBitwiseXor: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformLogicalAnd: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformLogicalOr: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformLogicalXor: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformQuadBroadcast: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformQuadSwap: *hasResult = true; *hasResultType = true; break; + case OpCopyLogical: *hasResult = true; *hasResultType = true; break; + case OpPtrEqual: *hasResult = true; *hasResultType = true; break; + case OpPtrNotEqual: *hasResult = true; *hasResultType = true; break; + case OpPtrDiff: *hasResult = true; *hasResultType = true; break; + case OpColorAttachmentReadEXT: *hasResult = true; *hasResultType = true; break; + case OpDepthAttachmentReadEXT: *hasResult = true; *hasResultType = true; break; + case OpStencilAttachmentReadEXT: *hasResult = true; *hasResultType = true; break; + case OpTerminateInvocation: *hasResult = false; *hasResultType = false; break; + case OpSubgroupBallotKHR: *hasResult = true; *hasResultType = true; break; + case OpSubgroupFirstInvocationKHR: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break; + case OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break; + case OpTraceRayKHR: *hasResult = false; *hasResultType = false; break; + case OpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break; + case OpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break; + case OpIgnoreIntersectionKHR: *hasResult = false; *hasResultType = false; break; + case OpTerminateRayKHR: *hasResult = false; *hasResultType = false; break; + case OpSDot: *hasResult = true; *hasResultType = true; break; + case OpUDot: *hasResult = true; *hasResultType = true; break; + case OpSUDot: *hasResult = true; *hasResultType = true; break; + case OpSDotAccSat: *hasResult = true; *hasResultType = true; break; + case OpUDotAccSat: *hasResult = true; *hasResultType = true; break; + case OpSUDotAccSat: *hasResult = true; *hasResultType = true; break; + case OpTypeCooperativeMatrixKHR: *hasResult = true; *hasResultType = false; break; + case OpCooperativeMatrixLoadKHR: *hasResult = true; *hasResultType = true; break; + case OpCooperativeMatrixStoreKHR: *hasResult = false; *hasResultType = false; break; + case OpCooperativeMatrixMulAddKHR: *hasResult = true; *hasResultType = true; break; + case OpCooperativeMatrixLengthKHR: *hasResult = true; *hasResultType = true; break; + case OpTypeRayQueryKHR: *hasResult = true; *hasResultType = false; break; + case OpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break; + case OpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break; + case OpRayQueryGenerateIntersectionKHR: *hasResult = false; *hasResultType = false; break; + case OpRayQueryConfirmIntersectionKHR: *hasResult = false; *hasResultType = false; break; + case OpRayQueryProceedKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionTypeKHR: *hasResult = true; *hasResultType = true; break; + case OpImageSampleWeightedQCOM: *hasResult = true; *hasResultType = true; break; + case OpImageBoxFilterQCOM: *hasResult = true; *hasResultType = true; break; + case OpImageBlockMatchSSDQCOM: *hasResult = true; *hasResultType = true; break; + case OpImageBlockMatchSADQCOM: *hasResult = true; *hasResultType = true; break; + case OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case OpGroupUMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case OpGroupSMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case OpGroupFMaxNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case OpGroupUMaxNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case OpGroupSMaxNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case OpFragmentMaskFetchAMD: *hasResult = true; *hasResultType = true; break; + case OpFragmentFetchAMD: *hasResult = true; *hasResultType = true; break; + case OpReadClockKHR: *hasResult = true; *hasResultType = true; break; + case OpHitObjectRecordHitMotionNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordHitWithIndexMotionNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordMissMotionNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetWorldToObjectNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetObjectToWorldNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetObjectRayDirectionNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetObjectRayOriginNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectTraceRayMotionNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetShaderRecordBufferHandleNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetShaderBindingTableRecordIndexNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectRecordEmptyNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectTraceRayNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordHitNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordHitWithIndexNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordMissNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectExecuteShaderNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetCurrentTimeNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetAttributesNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetHitKindNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetPrimitiveIndexNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetGeometryIndexNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetInstanceIdNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetInstanceCustomIndexNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetWorldRayDirectionNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetWorldRayOriginNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetRayTMaxNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetRayTMinNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectIsEmptyNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectIsHitNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectIsMissNV: *hasResult = true; *hasResultType = true; break; + case OpReorderThreadWithHitObjectNV: *hasResult = false; *hasResultType = false; break; + case OpReorderThreadWithHintNV: *hasResult = false; *hasResultType = false; break; + case OpTypeHitObjectNV: *hasResult = true; *hasResultType = false; break; + case OpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break; + case OpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break; + case OpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break; + case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break; + case OpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break; + case OpReportIntersectionNV: *hasResult = true; *hasResultType = true; break; + case OpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break; + case OpTerminateRayNV: *hasResult = false; *hasResultType = false; break; + case OpTraceNV: *hasResult = false; *hasResultType = false; break; + case OpTraceMotionNV: *hasResult = false; *hasResultType = false; break; + case OpTraceRayMotionNV: *hasResult = false; *hasResultType = false; break; + case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break; + case OpTypeAccelerationStructureNV: *hasResult = true; *hasResultType = false; break; + case OpExecuteCallableNV: *hasResult = false; *hasResultType = false; break; + case OpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break; + case OpCooperativeMatrixLoadNV: *hasResult = true; *hasResultType = true; break; + case OpCooperativeMatrixStoreNV: *hasResult = false; *hasResultType = false; break; + case OpCooperativeMatrixMulAddNV: *hasResult = true; *hasResultType = true; break; + case OpCooperativeMatrixLengthNV: *hasResult = true; *hasResultType = true; break; + case OpBeginInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break; + case OpEndInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break; + case OpDemoteToHelperInvocation: *hasResult = false; *hasResultType = false; break; + case OpIsHelperInvocationEXT: *hasResult = true; *hasResultType = true; break; + case OpConvertUToImageNV: *hasResult = true; *hasResultType = true; break; + case OpConvertUToSamplerNV: *hasResult = true; *hasResultType = true; break; + case OpConvertImageToUNV: *hasResult = true; *hasResultType = true; break; + case OpConvertSamplerToUNV: *hasResult = true; *hasResultType = true; break; + case OpConvertUToSampledImageNV: *hasResult = true; *hasResultType = true; break; + case OpConvertSampledImageToUNV: *hasResult = true; *hasResultType = true; break; + case OpSamplerImageAddressingModeNV: *hasResult = false; *hasResultType = false; break; + case OpSubgroupShuffleINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupShuffleDownINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupShuffleUpINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupShuffleXorINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupBlockReadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; + case OpSubgroupImageBlockReadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupImageBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; + case OpSubgroupImageMediaBlockReadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupImageMediaBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; + case OpUCountLeadingZerosINTEL: *hasResult = true; *hasResultType = true; break; + case OpUCountTrailingZerosINTEL: *hasResult = true; *hasResultType = true; break; + case OpAbsISubINTEL: *hasResult = true; *hasResultType = true; break; + case OpAbsUSubINTEL: *hasResult = true; *hasResultType = true; break; + case OpIAddSatINTEL: *hasResult = true; *hasResultType = true; break; + case OpUAddSatINTEL: *hasResult = true; *hasResultType = true; break; + case OpIAverageINTEL: *hasResult = true; *hasResultType = true; break; + case OpUAverageINTEL: *hasResult = true; *hasResultType = true; break; + case OpIAverageRoundedINTEL: *hasResult = true; *hasResultType = true; break; + case OpUAverageRoundedINTEL: *hasResult = true; *hasResultType = true; break; + case OpISubSatINTEL: *hasResult = true; *hasResultType = true; break; + case OpUSubSatINTEL: *hasResult = true; *hasResultType = true; break; + case OpIMul32x16INTEL: *hasResult = true; *hasResultType = true; break; + case OpUMul32x16INTEL: *hasResult = true; *hasResultType = true; break; + case OpConstantFunctionPointerINTEL: *hasResult = true; *hasResultType = true; break; + case OpFunctionPointerCallINTEL: *hasResult = true; *hasResultType = true; break; + case OpAsmTargetINTEL: *hasResult = true; *hasResultType = true; break; + case OpAsmINTEL: *hasResult = true; *hasResultType = true; break; + case OpAsmCallINTEL: *hasResult = true; *hasResultType = true; break; + case OpAtomicFMinEXT: *hasResult = true; *hasResultType = true; break; + case OpAtomicFMaxEXT: *hasResult = true; *hasResultType = true; break; + case OpAssumeTrueKHR: *hasResult = false; *hasResultType = false; break; + case OpExpectKHR: *hasResult = true; *hasResultType = true; break; + case OpDecorateString: *hasResult = false; *hasResultType = false; break; + case OpMemberDecorateString: *hasResult = false; *hasResultType = false; break; + case OpVmeImageINTEL: *hasResult = true; *hasResultType = true; break; + case OpTypeVmeImageINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcImePayloadINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcRefPayloadINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcSicPayloadINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcMcePayloadINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcMceResultINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcImeResultINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcImeResultSingleReferenceStreamoutINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcImeResultDualReferenceStreamoutINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcImeSingleReferenceStreaminINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcImeDualReferenceStreaminINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcRefResultINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeAvcSicResultINTEL: *hasResult = true; *hasResultType = false; break; + case OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceSetInterShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceSetInterDirectionPenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceSetAcOnlyHaarINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceConvertToImePayloadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceConvertToImeResultINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceConvertToRefPayloadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceConvertToRefResultINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceConvertToSicPayloadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceConvertToSicResultINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetMotionVectorsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetInterDistortionsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetBestInterDistortionsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetInterMajorShapeINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetInterMinorShapeINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetInterDirectionsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetInterMotionVectorCountINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetInterReferenceIdsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeInitializeINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeSetSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeSetDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeRefWindowSizeINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeAdjustRefOffsetINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeConvertToMcePayloadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeSetMaxMotionVectorCountINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeSetWeightedSadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeEvaluateWithDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeConvertToMceResultINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetSingleReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetDualReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeStripDualReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetBorderReachedINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcFmeInitializeINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcBmeInitializeINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcRefConvertToMcePayloadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcRefSetBidirectionalMixDisableINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcRefSetBilinearFilterEnableINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcRefEvaluateWithDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcRefConvertToMceResultINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicInitializeINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicConfigureSkcINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicConfigureIpeLumaINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicConfigureIpeLumaChromaINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicGetMotionVectorMaskINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicConvertToMcePayloadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicSetBilinearFilterEnableINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicEvaluateIpeINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicEvaluateWithDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicConvertToMceResultINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicGetIpeLumaShapeINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicGetPackedIpeLumaModesINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicGetIpeChromaModeINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL: *hasResult = true; *hasResultType = true; break; + case OpSubgroupAvcSicGetInterRawSadsINTEL: *hasResult = true; *hasResultType = true; break; + case OpVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; + case OpSaveMemoryINTEL: *hasResult = true; *hasResultType = true; break; + case OpRestoreMemoryINTEL: *hasResult = false; *hasResultType = false; break; + case OpArbitraryFloatSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatCastINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatCastFromIntINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatCastToIntINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatAddINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatSubINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatMulINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatDivINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatGTINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatGEINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatLTINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatLEINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatEQINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatRecipINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatRSqrtINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatCbrtINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatHypotINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatSqrtINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatLogINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatLog2INTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatLog10INTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatLog1pINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatExpINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatExp2INTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatExp10INTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatExpm1INTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatSinINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatCosINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatSinCosINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatSinPiINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatCosPiINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatASinINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatASinPiINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatACosINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatACosPiINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatATanINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatATanPiINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatATan2INTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatPowINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatPowRINTEL: *hasResult = true; *hasResultType = true; break; + case OpArbitraryFloatPowNINTEL: *hasResult = true; *hasResultType = true; break; + case OpLoopControlINTEL: *hasResult = false; *hasResultType = false; break; + case OpAliasDomainDeclINTEL: *hasResult = true; *hasResultType = false; break; + case OpAliasScopeDeclINTEL: *hasResult = true; *hasResultType = false; break; + case OpAliasScopeListDeclINTEL: *hasResult = true; *hasResultType = false; break; + case OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedSinINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedCosINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedSinCosINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedSinPiINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedCosPiINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedLogINTEL: *hasResult = true; *hasResultType = true; break; + case OpFixedExpINTEL: *hasResult = true; *hasResultType = true; break; + case OpPtrCastToCrossWorkgroupINTEL: *hasResult = true; *hasResultType = true; break; + case OpCrossWorkgroupCastToPtrINTEL: *hasResult = true; *hasResultType = true; break; + case OpReadPipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; + case OpWritePipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; + case OpFPGARegINTEL: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetRayTMinKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetRayFlagsKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionTKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionInstanceCustomIndexKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionInstanceIdKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionGeometryIndexKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionPrimitiveIndexKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionBarycentricsKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionFrontFaceKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionCandidateAABBOpaqueKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionObjectRayDirectionKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionObjectRayOriginKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetWorldRayDirectionKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetWorldRayOriginKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionObjectToWorldKHR: *hasResult = true; *hasResultType = true; break; + case OpRayQueryGetIntersectionWorldToObjectKHR: *hasResult = true; *hasResultType = true; break; + case OpAtomicFAddEXT: *hasResult = true; *hasResultType = true; break; + case OpTypeBufferSurfaceINTEL: *hasResult = true; *hasResultType = false; break; + case OpTypeStructContinuedINTEL: *hasResult = false; *hasResultType = false; break; + case OpConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break; + case OpSpecConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break; + case OpControlBarrierArriveINTEL: *hasResult = false; *hasResultType = false; break; + case OpControlBarrierWaitINTEL: *hasResult = false; *hasResultType = false; break; + case OpGroupIMulKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupFMulKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupBitwiseAndKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupBitwiseOrKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupBitwiseXorKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupLogicalAndKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupLogicalOrKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupLogicalXorKHR: *hasResult = true; *hasResultType = true; break; + } +} +#endif /* SPV_ENABLE_UTILITY_CODE */ + +// Overload bitwise operators for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline ImageOperandsMask operator&(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) & unsigned(b)); } +inline ImageOperandsMask operator^(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) ^ unsigned(b)); } +inline ImageOperandsMask operator~(ImageOperandsMask a) { return ImageOperandsMask(~unsigned(a)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator&(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) & unsigned(b)); } +inline FPFastMathModeMask operator^(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) ^ unsigned(b)); } +inline FPFastMathModeMask operator~(FPFastMathModeMask a) { return FPFastMathModeMask(~unsigned(a)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator&(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) & unsigned(b)); } +inline SelectionControlMask operator^(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) ^ unsigned(b)); } +inline SelectionControlMask operator~(SelectionControlMask a) { return SelectionControlMask(~unsigned(a)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator&(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) & unsigned(b)); } +inline LoopControlMask operator^(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) ^ unsigned(b)); } +inline LoopControlMask operator~(LoopControlMask a) { return LoopControlMask(~unsigned(a)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator&(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) & unsigned(b)); } +inline FunctionControlMask operator^(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) ^ unsigned(b)); } +inline FunctionControlMask operator~(FunctionControlMask a) { return FunctionControlMask(~unsigned(a)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator&(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) & unsigned(b)); } +inline MemorySemanticsMask operator^(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) ^ unsigned(b)); } +inline MemorySemanticsMask operator~(MemorySemanticsMask a) { return MemorySemanticsMask(~unsigned(a)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator&(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) & unsigned(b)); } +inline MemoryAccessMask operator^(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) ^ unsigned(b)); } +inline MemoryAccessMask operator~(MemoryAccessMask a) { return MemoryAccessMask(~unsigned(a)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator&(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) & unsigned(b)); } +inline KernelProfilingInfoMask operator^(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) ^ unsigned(b)); } +inline KernelProfilingInfoMask operator~(KernelProfilingInfoMask a) { return KernelProfilingInfoMask(~unsigned(a)); } +inline RayFlagsMask operator|(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) | unsigned(b)); } +inline RayFlagsMask operator&(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) & unsigned(b)); } +inline RayFlagsMask operator^(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) ^ unsigned(b)); } +inline RayFlagsMask operator~(RayFlagsMask a) { return RayFlagsMask(~unsigned(a)); } +inline FragmentShadingRateMask operator|(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) | unsigned(b)); } +inline FragmentShadingRateMask operator&(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) & unsigned(b)); } +inline FragmentShadingRateMask operator^(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) ^ unsigned(b)); } +inline FragmentShadingRateMask operator~(FragmentShadingRateMask a) { return FragmentShadingRateMask(~unsigned(a)); } +inline CooperativeMatrixOperandsMask operator|(CooperativeMatrixOperandsMask a, CooperativeMatrixOperandsMask b) { return CooperativeMatrixOperandsMask(unsigned(a) | unsigned(b)); } +inline CooperativeMatrixOperandsMask operator&(CooperativeMatrixOperandsMask a, CooperativeMatrixOperandsMask b) { return CooperativeMatrixOperandsMask(unsigned(a) & unsigned(b)); } +inline CooperativeMatrixOperandsMask operator^(CooperativeMatrixOperandsMask a, CooperativeMatrixOperandsMask b) { return CooperativeMatrixOperandsMask(unsigned(a) ^ unsigned(b)); } +inline CooperativeMatrixOperandsMask operator~(CooperativeMatrixOperandsMask a) { return CooperativeMatrixOperandsMask(~unsigned(a)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/bgfx/3rdparty/glslang/SPIRV/spvIR.h b/bgfx/3rdparty/glslang/SPIRV/spvIR.h index 09691273..5cbffec2 100644 --- a/bgfx/3rdparty/glslang/SPIRV/spvIR.h +++ b/bgfx/3rdparty/glslang/SPIRV/spvIR.h @@ -97,6 +97,8 @@ class Instruction { explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), block(nullptr) { } virtual ~Instruction() {} void addIdOperand(Id id) { + // ids can't be 0 + assert(id); operands.push_back(id); idOperand.push_back(true); } @@ -386,7 +388,7 @@ class Function { if (lineInstruction != nullptr) { lineInstruction->dump(out); } - + // OpFunction functionInstruction.dump(out); diff --git a/bgfx/3rdparty/glslang/StandAlone/StandAlone.cpp b/bgfx/3rdparty/glslang/StandAlone/StandAlone.cpp index edde81e2..d6ef5225 100644 --- a/bgfx/3rdparty/glslang/StandAlone/StandAlone.cpp +++ b/bgfx/3rdparty/glslang/StandAlone/StandAlone.cpp @@ -41,7 +41,7 @@ #define _CRT_SECURE_NO_WARNINGS #endif -#include "ResourceLimits.h" +#include "glslang/Public/ResourceLimits.h" #include "Worklist.h" #include "DirStackFileIncluder.h" #include "./../glslang/Include/ShHandle.h" @@ -149,7 +149,6 @@ bool LinkFailed = false; // array of unique places to leave the shader names and infologs for the asynchronous compiles std::vector> WorkItems; -TBuiltInResource Resources; std::string ConfigFile; // @@ -158,14 +157,12 @@ std::string ConfigFile; void ProcessConfigFile() { if (ConfigFile.size() == 0) - Resources = glslang::DefaultTBuiltInResource; -#ifndef GLSLANG_WEB + *GetResources() = *GetDefaultResources(); else { char* configString = ReadFileData(ConfigFile.c_str()); - glslang::DecodeResourceLimits(&Resources, configString); + DecodeResourceLimits(GetResources(), configString); FreeFileData(configString); } -#endif } int ReflectOptions = EShReflectionDefault; @@ -259,6 +256,17 @@ class TPreamble { text.append("\n"); } + void addText(std::string preambleText) + { + fixLine(preambleText); + + Processes.push_back("preamble-text"); + Processes.back().append(preambleText); + + text.append(preambleText); + text.append("\n"); + } + protected: void fixLine(std::string& line) { @@ -505,7 +513,7 @@ void ProcessGlobalBlockSettings(int& argc, char**& argv, std::string* name, unsi if (set) { errno = 0; - int setVal = ::strtol(argv[curArg], NULL, 10); + int setVal = ::strtol(argv[curArg], nullptr, 10); if (errno || setVal < 0) { printf("%s: invalid set\n", argv[curArg]); usage(); @@ -517,7 +525,7 @@ void ProcessGlobalBlockSettings(int& argc, char**& argv, std::string* name, unsi if (binding) { errno = 0; - int bindingVal = ::strtol(argv[curArg], NULL, 10); + int bindingVal = ::strtol(argv[curArg], nullptr, 10); if (errno || bindingVal < 0) { printf("%s: invalid binding\n", argv[curArg]); usage(); @@ -595,12 +603,12 @@ void ProcessArguments(std::vector>& workItem const auto getUniformOverride = [getStringOperand]() { const char *arg = getStringOperand("-u:"); const char *split = strchr(arg, ':'); - if (split == NULL) { + if (split == nullptr) { printf("%s: missing location\n", arg); exit(EFailUsage); } errno = 0; - int location = ::strtol(split + 1, NULL, 10); + int location = ::strtol(split + 1, nullptr, 10); if (errno) { printf("%s: invalid location\n", arg); exit(EFailUsage); @@ -627,7 +635,7 @@ void ProcessArguments(std::vector>& workItem } else if (lowerword == "uniform-base") { if (argc <= 1) Error("no provided", lowerword.c_str()); - uniformBase = ::strtol(argv[1], NULL, 10); + uniformBase = ::strtol(argv[1], nullptr, 10); bumpArg(); break; } else if (lowerword == "client") { @@ -715,7 +723,7 @@ void ProcessArguments(std::vector>& workItem HlslDxPositionW = true; } else if (lowerword == "enhanced-msgs") { EnhancedMsgs = true; - } else if (lowerword == "auto-sampled-textures") { + } else if (lowerword == "auto-sampled-textures") { autoSampledTextures = true; } else if (lowerword == "invert-y" || // synonyms lowerword == "iy") { @@ -728,6 +736,13 @@ void ProcessArguments(std::vector>& workItem } else if (lowerword == "no-storage-format" || // synonyms lowerword == "nsf") { Options |= EOptionNoStorageFormat; + } else if (lowerword == "preamble-text" || + lowerword == "p") { + if (argc > 1) + UserPreamble.addText(argv[1]); + else + Error("expects ", argv[0]); + bumpArg(); } else if (lowerword == "relaxed-errors") { Options |= EOptionRelaxedErrors; } else if (lowerword == "reflect-strict-array-suffix") { @@ -927,6 +942,9 @@ void ProcessArguments(std::vector>& workItem else Error("unknown -O option"); break; + case 'P': + UserPreamble.addText(getStringOperand("-P")); + break; case 'R': VulkanRulesRelaxed = true; break; @@ -1162,7 +1180,7 @@ void CompileShaders(glslang::TWorklist& worklist) } else { while (worklist.remove(workItem)) { ShHandle compiler = ShConstructCompiler(FindLanguage(workItem->name), Options); - if (compiler == 0) + if (compiler == nullptr) return; CompileFile(workItem->name.c_str(), compiler); @@ -1298,7 +1316,7 @@ void CompileAndLinkShaderUnits(std::vector compUnits) sources.push_back(compUnit.fileNameList[i]); } glslang::TShader* shader = new glslang::TShader(compUnit.stage); - shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count); + shader->setStringsWithLengthsAndNames(compUnit.text, nullptr, compUnit.fileNameList, compUnit.count); if (entryPointName) shader->setEntryPoint(entryPointName); if (sourceEntryPointName) { @@ -1322,7 +1340,6 @@ void CompileAndLinkShaderUnits(std::vector compUnits) shader->setPreamble(PreambleString.c_str()); shader->addProcesses(Processes); -#ifndef GLSLANG_WEB // Set IO mapper binding shift values for (int r = 0; r < glslang::EResCount; ++r) { const glslang::TResourceType res = glslang::TResourceType(r); @@ -1354,7 +1371,6 @@ void CompileAndLinkShaderUnits(std::vector compUnits) } shader->setUniformLocationBase(uniformBase); -#endif if (VulkanRulesRelaxed) { for (auto& storageOverride : blockStorageOverrides) { @@ -1414,10 +1430,9 @@ void CompileAndLinkShaderUnits(std::vector compUnits) const int defaultVersion = Options & EOptionDefaultDesktop ? 110 : 100; -#ifndef GLSLANG_WEB if (Options & EOptionOutputPreprocessed) { std::string str; - if (shader->preprocess(&Resources, defaultVersion, ENoProfile, false, false, messages, &str, includer)) { + if (shader->preprocess(GetResources(), defaultVersion, ENoProfile, false, false, messages, &str, includer)) { PutsIfNonEmpty(str.c_str()); } else { CompileFailed = true; @@ -1426,9 +1441,8 @@ void CompileAndLinkShaderUnits(std::vector compUnits) StderrIfNonEmpty(shader->getInfoDebugLog()); continue; } -#endif - if (! shader->parse(&Resources, defaultVersion, false, messages, includer)) + if (! shader->parse(GetResources(), defaultVersion, false, messages, includer)) CompileFailed = true; program.addShader(shader); @@ -1450,13 +1464,11 @@ void CompileAndLinkShaderUnits(std::vector compUnits) if (! (Options & EOptionOutputPreprocessed) && ! program.link(messages)) LinkFailed = true; -#ifndef GLSLANG_WEB // Map IO if (Options & EOptionSpv) { if (!program.mapIO()) LinkFailed = true; } -#endif // Report if (! (Options & EOptionSuppressInfolog) && @@ -1465,13 +1477,11 @@ void CompileAndLinkShaderUnits(std::vector compUnits) PutsIfNonEmpty(program.getInfoDebugLog()); } -#ifndef GLSLANG_WEB // Reflect if (Options & EOptionDumpReflection) { program.buildReflection(ReflectOptions); program.dumpReflection(); } -#endif std::vector outputFiles; @@ -1506,16 +1516,16 @@ void CompileAndLinkShaderUnits(std::vector compUnits) if (! (Options & EOptionMemoryLeakMode)) { printf("%s", logger.getAllMessages().c_str()); if (Options & EOptionOutputHexadecimal) { - glslang::OutputSpvHex(spirv, GetBinaryName((EShLanguage)stage), variableName); + if (!glslang::OutputSpvHex(spirv, GetBinaryName((EShLanguage)stage), variableName)) + exit(EFailUsage); } else { - glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage)); + if (!glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage))) + exit(EFailUsage); } outputFiles.push_back(GetBinaryName((EShLanguage)stage)); -#ifndef GLSLANG_WEB if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv)) spv::Disassemble(std::cout, spirv); -#endif } } } @@ -1610,13 +1620,11 @@ int singleMain() workList.add(item.get()); }); -#ifndef GLSLANG_WEB if (Options & EOptionDumpConfig) { - printf("%s", glslang::GetDefaultTBuiltInResourceString().c_str()); + printf("%s", GetDefaultTBuiltInResourceString().c_str()); if (workList.empty()) return ESuccess; } -#endif if (Options & EOptionDumpBareVersion) { printf("%d:%d.%d.%d%s\n", glslang::GetSpirvGeneratorVersion(), GLSLANG_VERSION_MAJOR, GLSLANG_VERSION_MINOR, @@ -1833,12 +1841,12 @@ void CompileFile(const char* fileName, ShHandle compiler) SetMessageOptions(messages); if (UserPreamble.isSet()) - Error("-D and -U options require -l (linking)\n"); + Error("-D, -U and -P options require -l (linking)\n"); for (int i = 0; i < ((Options & EOptionMemoryLeakMode) ? 100 : 1); ++i) { for (int j = 0; j < ((Options & EOptionMemoryLeakMode) ? 100 : 1); ++j) { // ret = ShCompile(compiler, shaderStrings, NumShaderStrings, lengths, EShOptNone, &Resources, Options, (Options & EOptionDefaultDesktop) ? 110 : 100, false, messages); - ret = ShCompile(compiler, &shaderString, 1, nullptr, EShOptNone, &Resources, Options, (Options & EOptionDefaultDesktop) ? 110 : 100, false, messages); + ret = ShCompile(compiler, &shaderString, 1, nullptr, EShOptNone, GetResources(), Options, (Options & EOptionDefaultDesktop) ? 110 : 100, false, messages); // const char* multi[12] = { "# ve", "rsion", " 300 e", "s", "\n#err", // "or should be l", "ine 1", "string 5\n", "float glo", "bal", // ";\n#error should be line 2\n void main() {", "global = 2.3;}" }; @@ -1862,7 +1870,7 @@ void CompileFile(const char* fileName, ShHandle compiler) // void usage() { - printf("Usage: glslangValidator [option]... [file]...\n" + printf("Usage: glslang [option]... [file]...\n" "\n" "'file' can end in . for auto-stage classification, where is:\n" " .conf to provide a config file that replaces the default configuration\n" @@ -1903,6 +1911,9 @@ void usage() " is searched first, followed by left-to-right order of -I\n" " -Od disables optimization; may cause illegal SPIR-V for HLSL\n" " -Os optimizes SPIR-V to minimize size\n" + " -P | --preamble-text | --P \n" + " inject custom preamble text, which is treated as if it\n" + " appeared immediately after the version declaration (if any).\n" " -R use relaxed verification rules for generating Vulkan SPIR-V,\n" " allowing the use of default uniforms, atomic_uints, and\n" " gl_VertexID and gl_InstanceID keywords.\n" @@ -1950,7 +1961,7 @@ void usage() " without explicit bindings\n" " --auto-map-locations | --aml automatically locate input/output lacking\n" " 'location' (fragile, not cross stage)\n" - " --auto-sampled-textures Removes sampler variables and converts\n" + " --auto-sampled-textures Removes sampler variables and converts\n" " existing textures to sampled textures\n" " --client {vulkan|opengl} see -V and -G\n" " --depfile writes depfile for build systems\n" @@ -2064,8 +2075,7 @@ void usage() " --variable-name \n" " --vn creates a C header file that contains a\n" " uint32_t array named \n" - " initialized with the shader binary code\n" - ); + " initialized with the shader binary code\n"); exit(EFailUsage); } diff --git a/bgfx/3rdparty/glslang/StandAlone/spirv-remap.cpp b/bgfx/3rdparty/glslang/StandAlone/spirv-remap.cpp index 15c3ac51..1bd4a2d6 100644 --- a/bgfx/3rdparty/glslang/StandAlone/spirv-remap.cpp +++ b/bgfx/3rdparty/glslang/StandAlone/spirv-remap.cpp @@ -37,7 +37,11 @@ #include #include #include +#include +// +// Include remapper +// #include "../SPIRV/SPVRemapper.h" namespace { @@ -157,7 +161,7 @@ namespace { } // Print helpful usage message to stdout, and exit - void usage(const char* const name, const char* const msg = 0) + void usage(const char* const name, const char* const msg = nullptr) { if (msg) std::cout << msg << std::endl << std::endl; @@ -172,7 +176,7 @@ namespace { << " [--strip-all | --strip all | -s]" << " [--strip-white-list]" << " [--do-everything]" - << " --input | -i file1 [file2...] --output|-o DESTDIR" + << " --input | -i file1 [file2...] --output|-o DESTDIR | destfile1 [destfile2...]" << std::endl; std::cout << " " << basename(name) << " [--version | -V]" << std::endl; @@ -182,32 +186,45 @@ namespace { } // grind through each SPIR in turn - void execute(const std::vector& inputFile, const std::string& outputDir, - const std::string& whiteListFile, int opts, int verbosity) + void execute(const std::vector& inputFiles, + const std::vector& outputDirOrFiles, + const bool isSingleOutputDir, + const std::string& whiteListFile, + int opts, + int verbosity) { std::vector whiteListStrings; - if(!whiteListFile.empty()) + if (!whiteListFile.empty()) read(whiteListStrings, whiteListFile, verbosity); - for (auto it = inputFile.cbegin(); it != inputFile.cend(); ++it) { - const std::string &filename = *it; + for (std::size_t ii=0; ii spv; - read(spv, filename, verbosity); + read(spv, inputFiles[ii], verbosity); + spv::spirvbin_t(verbosity).remap(spv, whiteListStrings, opts); - const std::string outfile = outputDir + path_sep_char() + basename(filename); - write(spv, outfile, verbosity); + + if (isSingleOutputDir) { + // write all outputs to same directory + const std::string outFile = outputDirOrFiles[0] + path_sep_char() + basename(inputFiles[ii]); + write(spv, outFile, verbosity); + } else { + // write each input to its associated output + write(spv, outputDirOrFiles[ii], verbosity); + } } if (verbosity > 0) - std::cout << "Done: " << inputFile.size() << " file(s) processed" << std::endl; + std::cout << "Done: " << inputFiles.size() << " file(s) processed" << std::endl; } // Parse command line options - void parseCmdLine(int argc, char** argv, std::vector& inputFile, - std::string& outputDir, - std::string& stripWhiteListFile, - int& options, - int& verbosity) + void parseCmdLine(int argc, + char** argv, + std::vector& inputFiles, + std::vector& outputDirOrFiles, + std::string& stripWhiteListFile, + int& options, + int& verbosity) { if (argc < 2) usage(argv[0]); @@ -222,18 +239,19 @@ namespace { const std::string arg = argv[a]; if (arg == "--output" || arg == "-o") { - // Output directory - if (++a >= argc) - usage(argv[0], "--output requires an argument"); - if (!outputDir.empty()) - usage(argv[0], "--output can be provided only once"); - - outputDir = argv[a++]; + // Collect output dirs or files + for (++a; a < argc && argv[a][0] != '-'; ++a) + outputDirOrFiles.push_back(argv[a]); - // Remove trailing directory separator characters - while (!outputDir.empty() && outputDir.back() == path_sep_char()) - outputDir.pop_back(); + if (outputDirOrFiles.size() == 0) + usage(argv[0], "--output requires an argument"); + // Remove trailing directory separator characters from all paths + for (std::size_t ii=0; ii inputFile; - std::string outputDir; + std::vector inputFiles; + std::vector outputDirOrFiles; std::string whiteListFile; int opts; int verbosity; -#ifdef use_cpp11 // handle errors by exiting spv::spirvbin_t::registerErrorHandler(errHandler); // Log messages to std::cout spv::spirvbin_t::registerLogHandler(logHandler); -#endif if (argc < 2) usage(argv[0]); - parseCmdLine(argc, argv, inputFile, outputDir, whiteListFile, opts, verbosity); + parseCmdLine(argc, argv, inputFiles, outputDirOrFiles, whiteListFile, opts, verbosity); + + if (outputDirOrFiles.empty()) + usage(argv[0], "Output directory or file(s) required."); + + const bool isMultiInput = inputFiles.size() > 1; + const bool isMultiOutput = outputDirOrFiles.size() > 1; + const bool isSingleOutputDir = !isMultiOutput && std::filesystem::is_directory(outputDirOrFiles[0]); + + if (isMultiInput && !isMultiOutput && !isSingleOutputDir) + usage(argv[0], "Output is not a directory."); + - if (outputDir.empty()) - usage(argv[0], "Output directory required"); + if (isMultiInput && isMultiOutput && (outputDirOrFiles.size() != inputFiles.size())) + usage(argv[0], "Output must be either a single directory or one output file per input."); // Main operations: read, remap, and write. - execute(inputFile, outputDir, whiteListFile, opts, verbosity); + execute(inputFiles, outputDirOrFiles, isSingleOutputDir, whiteListFile, opts, verbosity); // If we get here, everything went OK! Nothing more to be done. } diff --git a/bgfx/3rdparty/glslang/build_info.h b/bgfx/3rdparty/glslang/build_info.h index 82dfaeb2..7a54a7dc 100644 --- a/bgfx/3rdparty/glslang/build_info.h +++ b/bgfx/3rdparty/glslang/build_info.h @@ -34,8 +34,8 @@ #ifndef GLSLANG_BUILD_INFO #define GLSLANG_BUILD_INFO -#define GLSLANG_VERSION_MAJOR 11 -#define GLSLANG_VERSION_MINOR 11 +#define GLSLANG_VERSION_MAJOR 13 +#define GLSLANG_VERSION_MINOR 0 #define GLSLANG_VERSION_PATCH 0 #define GLSLANG_VERSION_FLAVOR "" diff --git a/bgfx/3rdparty/glslang/glslang/CInterface/glslang_c_interface.cpp b/bgfx/3rdparty/glslang/glslang/CInterface/glslang_c_interface.cpp index ead005c3..870698f2 100644 --- a/bgfx/3rdparty/glslang/glslang/CInterface/glslang_c_interface.cpp +++ b/bgfx/3rdparty/glslang/glslang/CInterface/glslang_c_interface.cpp @@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "glslang/Include/glslang_c_interface.h" #include "StandAlone/DirStackFileIncluder.h" -#include "StandAlone/ResourceLimits.h" +#include "glslang/Public/ResourceLimits.h" #include "glslang/Include/ShHandle.h" #include "glslang/Include/ResourceLimits.h" @@ -80,25 +80,6 @@ typedef struct glslang_program_s { (CallbackIncluder::callbacks::free_include_result) */ class CallbackIncluder : public glslang::TShader::Includer { -public: - /* Wrapper of IncludeResult which stores a glsl_include_result object internally */ - class CallbackIncludeResult : public glslang::TShader::Includer::IncludeResult { - public: - CallbackIncludeResult(const std::string& headerName, const char* const headerData, const size_t headerLength, - void* userData, glsl_include_result_t* includeResult) - : glslang::TShader::Includer::IncludeResult(headerName, headerData, headerLength, userData), - includeResult(includeResult) - { - } - - virtual ~CallbackIncludeResult() {} - - protected: - friend class CallbackIncluder; - - glsl_include_result_t* includeResult; - }; - public: CallbackIncluder(glsl_include_callbacks_t _callbacks, void* _context) : callbacks(_callbacks), context(_context) {} @@ -110,9 +91,7 @@ class CallbackIncluder : public glslang::TShader::Includer { if (this->callbacks.include_system) { glsl_include_result_t* result = this->callbacks.include_system(this->context, headerName, includerName, inclusionDepth); - - return new CallbackIncludeResult(std::string(headerName), result->header_data, result->header_length, - nullptr, result); + return makeIncludeResult(result); } return glslang::TShader::Includer::includeSystem(headerName, includerName, inclusionDepth); @@ -124,9 +103,7 @@ class CallbackIncluder : public glslang::TShader::Includer { if (this->callbacks.include_local) { glsl_include_result_t* result = this->callbacks.include_local(this->context, headerName, includerName, inclusionDepth); - - return new CallbackIncludeResult(std::string(headerName), result->header_data, result->header_length, - nullptr, result); + return makeIncludeResult(result); } return glslang::TShader::Includer::includeLocal(headerName, includerName, inclusionDepth); @@ -139,22 +116,25 @@ class CallbackIncluder : public glslang::TShader::Includer { if (result == nullptr) return; - if (this->callbacks.free_include_result && (result->userData == nullptr)) { - CallbackIncludeResult* innerResult = static_cast(result); - /* use internal free() function */ - this->callbacks.free_include_result(this->context, innerResult->includeResult); - /* ignore internal fields of TShader::Includer::IncludeResult */ - delete result; - return; + if (this->callbacks.free_include_result) { + this->callbacks.free_include_result(this->context, static_cast(result->userData)); } - delete[] static_cast(result->userData); delete result; } private: CallbackIncluder() {} + IncludeResult* makeIncludeResult(glsl_include_result_t* result) { + if (!result) { + return nullptr; + } + + return new glslang::TShader::Includer::IncludeResult( + std::string(result->header_name), result->header_data, result->header_length, result); + } + /* C callback pointers */ glsl_include_callbacks_t callbacks; /* User-defined context */ @@ -351,6 +331,10 @@ GLSLANG_EXPORT glslang_shader_t* glslang_shader_create(const glslang_input_t* in return shader; } +GLSLANG_EXPORT void glslang_shader_set_preamble(glslang_shader_t* shader, const char* s) { + shader->shader->setPreamble(s); +} + GLSLANG_EXPORT void glslang_shader_shift_binding(glslang_shader_t* shader, glslang_resource_type_t res, unsigned int base) { const glslang::TResourceType res_type = glslang::TResourceType(res); @@ -390,8 +374,11 @@ GLSLANG_EXPORT const char* glslang_shader_get_preprocessed_code(glslang_shader_t GLSLANG_EXPORT int glslang_shader_preprocess(glslang_shader_t* shader, const glslang_input_t* input) { - DirStackFileIncluder Includer; - /* TODO: use custom callbacks if they are available in 'i->callbacks' */ + DirStackFileIncluder dirStackFileIncluder; + CallbackIncluder callbackIncluder(input->callbacks, input->callbacks_ctx); + glslang::TShader::Includer& Includer = (input->callbacks.include_local||input->callbacks.include_system) + ? static_cast(callbackIncluder) + : static_cast(dirStackFileIncluder); return shader->shader->preprocess( reinterpret_cast(input->resource), input->default_version, diff --git a/bgfx/3rdparty/glslang/glslang/GenericCodeGen/Link.cpp b/bgfx/3rdparty/glslang/glslang/GenericCodeGen/Link.cpp index c38db0f6..5e28405f 100644 --- a/bgfx/3rdparty/glslang/glslang/GenericCodeGen/Link.cpp +++ b/bgfx/3rdparty/glslang/glslang/GenericCodeGen/Link.cpp @@ -82,7 +82,7 @@ void DeleteUniformMap(TUniformMap* map) TShHandleBase* ConstructBindings() { - return 0; + return nullptr; } void DeleteBindingList(TShHandleBase* bindingList) diff --git a/bgfx/3rdparty/glslang/glslang/HLSL/hlslAttributes.h b/bgfx/3rdparty/glslang/glslang/HLSL/hlslAttributes.h index 62faa5b8..f25269a8 100644 --- a/bgfx/3rdparty/glslang/glslang/HLSL/hlslAttributes.h +++ b/bgfx/3rdparty/glslang/glslang/HLSL/hlslAttributes.h @@ -36,6 +36,7 @@ #ifndef HLSLATTRIBUTES_H_ #define HLSLATTRIBUTES_H_ +#include #include #include diff --git a/bgfx/3rdparty/glslang/glslang/HLSL/hlslGrammar.cpp b/bgfx/3rdparty/glslang/glslang/HLSL/hlslGrammar.cpp index a01f2403..11c0e45e 100644 --- a/bgfx/3rdparty/glslang/glslang/HLSL/hlslGrammar.cpp +++ b/bgfx/3rdparty/glslang/glslang/HLSL/hlslGrammar.cpp @@ -1,6 +1,7 @@ // // Copyright (C) 2016-2018 Google, Inc. // Copyright (C) 2016 LunarG, Inc. +// Copyright (C) 2023 Mobica Limited. // // All rights reserved. // @@ -594,6 +595,7 @@ bool HlslGrammar::acceptControlDeclaration(TIntermNode*& node) // fully_specified_type // : type_specifier // | type_qualifier type_specifier +// | type_specifier type_qualifier // bool HlslGrammar::acceptFullySpecifiedType(TType& type, const TAttributes& attributes) { @@ -605,7 +607,7 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList, // type_qualifier TQualifier qualifier; qualifier.clear(); - if (! acceptQualifier(qualifier)) + if (! acceptPreQualifier(qualifier)) return false; TSourceLoc loc = token.loc; @@ -620,6 +622,10 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList, return false; } + // type_qualifier + if (! acceptPostQualifier(qualifier)) + return false; + if (type.getBasicType() == EbtBlock) { // the type was a block, which set some parts of the qualifier parseContext.mergeQualifiers(type.getQualifier(), qualifier); @@ -634,7 +640,7 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList, parseContext.declareBlock(loc, type); } else { // Some qualifiers are set when parsing the type. Merge those with - // whatever comes from acceptQualifier. + // whatever comes from acceptPreQualifier and acceptPostQualifier. assert(qualifier.layoutFormat == ElfNone); qualifier.layoutFormat = type.getQualifier().layoutFormat; @@ -660,7 +666,7 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList, // // Zero or more of these, so this can't return false. // -bool HlslGrammar::acceptQualifier(TQualifier& qualifier) +bool HlslGrammar::acceptPreQualifier(TQualifier& qualifier) { do { switch (peek()) { @@ -766,6 +772,25 @@ bool HlslGrammar::acceptQualifier(TQualifier& qualifier) } while (true); } +// type_qualifier +// : qualifier qualifier ... +// +// Zero or more of these, so this can't return false. +// +bool HlslGrammar::acceptPostQualifier(TQualifier& qualifier) +{ + do { + switch (peek()) { + case EHTokConst: + qualifier.storage = EvqConst; + break; + default: + return true; + } + advanceToken(); + } while (true); +} + // layout_qualifier_list // : LAYOUT LEFT_PAREN layout_qualifier COMMA layout_qualifier ... RIGHT_PAREN // @@ -823,8 +848,10 @@ bool HlslGrammar::acceptLayoutQualifierList(TQualifier& qualifier) // | UINT // | BOOL // -bool HlslGrammar::acceptTemplateVecMatBasicType(TBasicType& basicType) +bool HlslGrammar::acceptTemplateVecMatBasicType(TBasicType& basicType, + TPrecisionQualifier& precision) { + precision = EpqNone; switch (peek()) { case EHTokFloat: basicType = EbtFloat; @@ -842,6 +869,23 @@ bool HlslGrammar::acceptTemplateVecMatBasicType(TBasicType& basicType) case EHTokBool: basicType = EbtBool; break; + case EHTokHalf: + basicType = parseContext.hlslEnable16BitTypes() ? EbtFloat16 : EbtFloat; + break; + case EHTokMin16float: + case EHTokMin10float: + basicType = parseContext.hlslEnable16BitTypes() ? EbtFloat16 : EbtFloat; + precision = EpqMedium; + break; + case EHTokMin16int: + case EHTokMin12int: + basicType = parseContext.hlslEnable16BitTypes() ? EbtInt16 : EbtInt; + precision = EpqMedium; + break; + case EHTokMin16uint: + basicType = parseContext.hlslEnable16BitTypes() ? EbtUint16 : EbtUint; + precision = EpqMedium; + break; default: return false; } @@ -867,7 +911,8 @@ bool HlslGrammar::acceptVectorTemplateType(TType& type) } TBasicType basicType; - if (! acceptTemplateVecMatBasicType(basicType)) { + TPrecisionQualifier precision; + if (! acceptTemplateVecMatBasicType(basicType, precision)) { expected("scalar type"); return false; } @@ -890,7 +935,7 @@ bool HlslGrammar::acceptVectorTemplateType(TType& type) const int vecSizeI = vecSize->getAsConstantUnion()->getConstArray()[0].getIConst(); - new(&type) TType(basicType, EvqTemporary, vecSizeI); + new(&type) TType(basicType, EvqTemporary, precision, vecSizeI); if (vecSizeI == 1) type.makeVector(); @@ -919,7 +964,8 @@ bool HlslGrammar::acceptMatrixTemplateType(TType& type) } TBasicType basicType; - if (! acceptTemplateVecMatBasicType(basicType)) { + TPrecisionQualifier precision; + if (! acceptTemplateVecMatBasicType(basicType, precision)) { expected("scalar type"); return false; } @@ -956,7 +1002,7 @@ bool HlslGrammar::acceptMatrixTemplateType(TType& type) if (! acceptLiteral(cols)) return false; - new(&type) TType(basicType, EvqTemporary, 0, + new(&type) TType(basicType, EvqTemporary, precision, 0, rows->getAsConstantUnion()->getConstArray()[0].getIConst(), cols->getAsConstantUnion()->getConstArray()[0].getIConst()); @@ -2064,6 +2110,251 @@ bool HlslGrammar::acceptType(TType& type, TIntermNode*& nodeList) new(&type) TType(EbtDouble, EvqTemporary, 0, 4, 4); break; + case EHTokMin16float1x1: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 1, 1); + break; + case EHTokMin16float1x2: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 1, 2); + break; + case EHTokMin16float1x3: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 1, 3); + break; + case EHTokMin16float1x4: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 1, 4); + break; + case EHTokMin16float2x1: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 2, 1); + break; + case EHTokMin16float2x2: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 2, 2); + break; + case EHTokMin16float2x3: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 2, 3); + break; + case EHTokMin16float2x4: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 2, 4); + break; + case EHTokMin16float3x1: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 3, 1); + break; + case EHTokMin16float3x2: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 3, 2); + break; + case EHTokMin16float3x3: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 3, 3); + break; + case EHTokMin16float3x4: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 3, 4); + break; + case EHTokMin16float4x1: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 4, 1); + break; + case EHTokMin16float4x2: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 4, 2); + break; + case EHTokMin16float4x3: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 4, 3); + break; + case EHTokMin16float4x4: + new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 0, 4, 4); + break; + + case EHTokMin10float1x1: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 1, 1); + break; + case EHTokMin10float1x2: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 1, 2); + break; + case EHTokMin10float1x3: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 1, 3); + break; + case EHTokMin10float1x4: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 1, 4); + break; + case EHTokMin10float2x1: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 2, 1); + break; + case EHTokMin10float2x2: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 2, 2); + break; + case EHTokMin10float2x3: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 2, 3); + break; + case EHTokMin10float2x4: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 2, 4); + break; + case EHTokMin10float3x1: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 3, 1); + break; + case EHTokMin10float3x2: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 3, 2); + break; + case EHTokMin10float3x3: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 3, 3); + break; + case EHTokMin10float3x4: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 3, 4); + break; + case EHTokMin10float4x1: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 4, 1); + break; + case EHTokMin10float4x2: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 4, 2); + break; + case EHTokMin10float4x3: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 4, 3); + break; + case EHTokMin10float4x4: + new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 0, 4, 4); + break; + + case EHTokMin16int1x1: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 1, 1); + break; + case EHTokMin16int1x2: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 1, 2); + break; + case EHTokMin16int1x3: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 1, 3); + break; + case EHTokMin16int1x4: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 1, 4); + break; + case EHTokMin16int2x1: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 2, 1); + break; + case EHTokMin16int2x2: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 2, 2); + break; + case EHTokMin16int2x3: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 2, 3); + break; + case EHTokMin16int2x4: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 2, 4); + break; + case EHTokMin16int3x1: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 3, 1); + break; + case EHTokMin16int3x2: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 3, 2); + break; + case EHTokMin16int3x3: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 3, 3); + break; + case EHTokMin16int3x4: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 3, 4); + break; + case EHTokMin16int4x1: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 4, 1); + break; + case EHTokMin16int4x2: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 4, 2); + break; + case EHTokMin16int4x3: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 4, 3); + break; + case EHTokMin16int4x4: + new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 0, 4, 4); + break; + + case EHTokMin12int1x1: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 1, 1); + break; + case EHTokMin12int1x2: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 1, 2); + break; + case EHTokMin12int1x3: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 1, 3); + break; + case EHTokMin12int1x4: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 1, 4); + break; + case EHTokMin12int2x1: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 2, 1); + break; + case EHTokMin12int2x2: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 2, 2); + break; + case EHTokMin12int2x3: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 2, 3); + break; + case EHTokMin12int2x4: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 2, 4); + break; + case EHTokMin12int3x1: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 3, 1); + break; + case EHTokMin12int3x2: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 3, 2); + break; + case EHTokMin12int3x3: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 3, 3); + break; + case EHTokMin12int3x4: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 3, 4); + break; + case EHTokMin12int4x1: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 4, 1); + break; + case EHTokMin12int4x2: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 4, 2); + break; + case EHTokMin12int4x3: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 4, 3); + break; + case EHTokMin12int4x4: + new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 0, 4, 4); + break; + + case EHTokMin16uint1x1: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 1, 1); + break; + case EHTokMin16uint1x2: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 1, 2); + break; + case EHTokMin16uint1x3: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 1, 3); + break; + case EHTokMin16uint1x4: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 1, 4); + break; + case EHTokMin16uint2x1: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 2, 1); + break; + case EHTokMin16uint2x2: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 2, 2); + break; + case EHTokMin16uint2x3: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 2, 3); + break; + case EHTokMin16uint2x4: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 2, 4); + break; + case EHTokMin16uint3x1: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 3, 1); + break; + case EHTokMin16uint3x2: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 3, 2); + break; + case EHTokMin16uint3x3: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 3, 3); + break; + case EHTokMin16uint3x4: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 3, 4); + break; + case EHTokMin16uint4x1: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 4, 1); + break; + case EHTokMin16uint4x2: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 4, 2); + break; + case EHTokMin16uint4x3: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 4, 3); + break; + case EHTokMin16uint4x4: + new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium, 0, 4, 4); + break; + default: return false; } @@ -3794,7 +4085,7 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttri parseContext.unnestLooping(); --parseContext.controlFlowNestingLevel; - loopNode = intermediate.addLoop(statement, condition, 0, false, loc); + loopNode = intermediate.addLoop(statement, condition, nullptr, false, loc); statement = loopNode; break; diff --git a/bgfx/3rdparty/glslang/glslang/HLSL/hlslGrammar.h b/bgfx/3rdparty/glslang/glslang/HLSL/hlslGrammar.h index 27706b2b..cfe294bc 100644 --- a/bgfx/3rdparty/glslang/glslang/HLSL/hlslGrammar.h +++ b/bgfx/3rdparty/glslang/glslang/HLSL/hlslGrammar.h @@ -1,6 +1,7 @@ // // Copyright (C) 2016-2018 Google, Inc. // Copyright (C) 2016 LunarG, Inc. +// Copyright (C) 2023 Mobica Limited. // // All rights reserved. // @@ -72,11 +73,12 @@ namespace glslang { bool acceptSamplerState(); bool acceptFullySpecifiedType(TType&, const TAttributes&); bool acceptFullySpecifiedType(TType&, TIntermNode*& nodeList, const TAttributes&, bool forbidDeclarators = false); - bool acceptQualifier(TQualifier&); + bool acceptPreQualifier(TQualifier&); + bool acceptPostQualifier(TQualifier&); bool acceptLayoutQualifierList(TQualifier&); bool acceptType(TType&); bool acceptType(TType&, TIntermNode*& nodeList); - bool acceptTemplateVecMatBasicType(TBasicType&); + bool acceptTemplateVecMatBasicType(TBasicType&, TPrecisionQualifier&); bool acceptVectorTemplateType(TType&); bool acceptMatrixTemplateType(TType&); bool acceptTessellationDeclType(TBuiltInVariable&); diff --git a/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseHelper.cpp b/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseHelper.cpp index 62e46a09..ac0dee50 100644 --- a/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseHelper.cpp +++ b/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseHelper.cpp @@ -1177,10 +1177,13 @@ void HlslParseContext::flatten(const TVariable& variable, bool linkage, bool arr if (type.isBuiltIn() && !type.isStruct()) return; + auto entry = flattenMap.insert(std::make_pair(variable.getUniqueId(), TFlattenData(type.getQualifier().layoutBinding, type.getQualifier().layoutLocation))); + if (type.isStruct() && type.getStruct()->size()==0) + return; // if flattening arrayed io struct, array each member of dereferenced type if (arrayed) { const TType dereferencedType(type, 0); @@ -1596,7 +1599,7 @@ void HlslParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunction // bool builtIn; TSymbol* symbol = symbolTable.find(function.getMangledName(), &builtIn); - const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0; + const TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr; if (prototype) { // All built-in functions are defined, even though they don't have a body. @@ -2472,7 +2475,7 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT void HlslParseContext::handleFunctionArgument(TFunction* function, TIntermTyped*& arguments, TIntermTyped* newArg) { - TParameter param = { 0, new TType, nullptr }; + TParameter param = { nullptr, new TType, nullptr }; param.type->shallowCopy(newArg->getType()); function->addParameter(param); @@ -7565,7 +7568,6 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction candidateList[0]->getBuiltInOp() == EOpMethodRestartStrip || candidateList[0]->getBuiltInOp() == EOpMethodIncrementCounter || candidateList[0]->getBuiltInOp() == EOpMethodDecrementCounter || - candidateList[0]->getBuiltInOp() == EOpMethodAppend || candidateList[0]->getBuiltInOp() == EOpMethodConsume)) { return candidateList[0]; } @@ -7790,18 +7792,18 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction // Handle aggregates: put all args into the new function call for (int arg = 0; arg < int(args->getAsAggregate()->getSequence().size()); ++arg) { // TODO: But for constness, we could avoid the new & shallowCopy, and use the pointer directly. - TParameter param = { 0, new TType, nullptr }; + TParameter param = { nullptr, new TType, nullptr }; param.type->shallowCopy(args->getAsAggregate()->getSequence()[arg]->getAsTyped()->getType()); convertedCall.addParameter(param); } } else if (args->getAsUnaryNode()) { // Handle unaries: put all args into the new function call - TParameter param = { 0, new TType, nullptr }; + TParameter param = { nullptr, new TType, nullptr }; param.type->shallowCopy(args->getAsUnaryNode()->getOperand()->getAsTyped()->getType()); convertedCall.addParameter(param); } else if (args->getAsTyped()) { // Handle bare e.g, floats, not in an aggregate. - TParameter param = { 0, new TType, nullptr }; + TParameter param = { nullptr, new TType, nullptr }; param.type->shallowCopy(args->getAsTyped()->getType()); convertedCall.addParameter(param); } else { @@ -9046,7 +9048,8 @@ void HlslParseContext::fixBlockUniformOffsets(const TQualifier& qualifier, TType // "The specified offset must be a multiple // of the base alignment of the type of the block member it qualifies, or a compile-time error results." if (! IsMultipleOfPow2(memberQualifier.layoutOffset, memberAlignment)) - error(memberLoc, "must be a multiple of the member's alignment", "offset", ""); + error(memberLoc, "must be a multiple of the member's alignment", "offset", + "(layout offset = %d | member alignment = %d)", memberQualifier.layoutOffset, memberAlignment); // "The offset qualifier forces the qualified member to start at or after the specified // integral-constant expression, which will be its byte offset from the beginning of the buffer. diff --git a/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseHelper.h b/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseHelper.h index 96d85f43..97c52d45 100644 --- a/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseHelper.h +++ b/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseHelper.h @@ -147,14 +147,14 @@ class HlslParseContext : public TParseContextBase { void declareTypedef(const TSourceLoc&, const TString& identifier, const TType&); void declareStruct(const TSourceLoc&, TString& structName, TType&); TSymbol* lookupUserType(const TString&, TType&); - TIntermNode* declareVariable(const TSourceLoc&, const TString& identifier, TType&, TIntermTyped* initializer = 0); + TIntermNode* declareVariable(const TSourceLoc&, const TString& identifier, TType&, TIntermTyped* initializer = nullptr); void lengthenList(const TSourceLoc&, TIntermSequence& list, int size, TIntermTyped* scalarInit); TIntermTyped* handleConstructor(const TSourceLoc&, TIntermTyped*, const TType&); TIntermTyped* addConstructor(const TSourceLoc&, TIntermTyped*, const TType&); TIntermTyped* convertArray(TIntermTyped*, const TType&); TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset); - void declareBlock(const TSourceLoc&, TType&, const TString* instanceName = 0); + void declareBlock(const TSourceLoc&, TType&, const TString* instanceName = nullptr); void declareStructBufferCounter(const TSourceLoc& loc, const TType& bufferType, const TString& name); void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation); void fixXfbOffsets(TQualifier&, TTypeList&); @@ -171,10 +171,10 @@ class HlslParseContext : public TParseContextBase { void unnestAnnotations() { --annotationNestingLevel; } int getAnnotationNestingLevel() { return annotationNestingLevel; } void pushScope() { symbolTable.push(); } - void popScope() { symbolTable.pop(0); } + void popScope() { symbolTable.pop(nullptr); } void pushThisScope(const TType&, const TVector&); - void popThisScope() { symbolTable.pop(0); } + void popThisScope() { symbolTable.pop(nullptr); } void pushImplicitThis(TVariable* thisParameter) { implicitThisStack.push_back(thisParameter); } void popImplicitThis() { implicitThisStack.pop_back(); } diff --git a/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseables.cpp b/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseables.cpp index 15918dc3..8fb1d290 100644 --- a/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseables.cpp +++ b/bgfx/3rdparty/glslang/glslang/HLSL/hlslParseables.cpp @@ -564,8 +564,8 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c { "GetRenderTargetSamplePosition", "V2", "F", "V1", "I", EShLangAll, false }, { "GroupMemoryBarrier", nullptr, nullptr, "-", "-", EShLangCS, false }, { "GroupMemoryBarrierWithGroupSync", nullptr, nullptr, "-", "-", EShLangCS, false }, - { "InterlockedAdd", "-", "-", "SVM,,>", "UI,,", EShLangPSCS, false }, - { "InterlockedAdd", "-", "-", "SVM,", "UI,", EShLangPSCS, false }, + { "InterlockedAdd", "-", "-", "SVM,,>", "FUI,,", EShLangPSCS, false }, + { "InterlockedAdd", "-", "-", "SVM,", "FUI,", EShLangPSCS, false }, { "InterlockedAnd", "-", "-", "SVM,,>", "UI,,", EShLangPSCS, false }, { "InterlockedAnd", "-", "-", "SVM,", "UI,", EShLangPSCS, false }, { "InterlockedCompareExchange", "-", "-", "SVM,,,>", "UI,,,", EShLangPSCS, false }, diff --git a/bgfx/3rdparty/glslang/glslang/HLSL/hlslScanContext.cpp b/bgfx/3rdparty/glslang/glslang/HLSL/hlslScanContext.cpp index fc62672f..823b17aa 100644 --- a/bgfx/3rdparty/glslang/glslang/HLSL/hlslScanContext.cpp +++ b/bgfx/3rdparty/glslang/glslang/HLSL/hlslScanContext.cpp @@ -312,6 +312,86 @@ void HlslScanContext::fillInKeywordMap() (*KeywordMap)["double4x2"] = EHTokDouble4x2; (*KeywordMap)["double4x3"] = EHTokDouble4x3; (*KeywordMap)["double4x4"] = EHTokDouble4x4; + (*KeywordMap)["min16float1x1"] = EHTokMin16float1x1; + (*KeywordMap)["min16float1x2"] = EHTokMin16float1x2; + (*KeywordMap)["min16float1x3"] = EHTokMin16float1x3; + (*KeywordMap)["min16float1x4"] = EHTokMin16float1x4; + (*KeywordMap)["min16float2x1"] = EHTokMin16float2x1; + (*KeywordMap)["min16float2x2"] = EHTokMin16float2x2; + (*KeywordMap)["min16float2x3"] = EHTokMin16float2x3; + (*KeywordMap)["min16float2x4"] = EHTokMin16float2x4; + (*KeywordMap)["min16float3x1"] = EHTokMin16float3x1; + (*KeywordMap)["min16float3x2"] = EHTokMin16float3x2; + (*KeywordMap)["min16float3x3"] = EHTokMin16float3x3; + (*KeywordMap)["min16float3x4"] = EHTokMin16float3x4; + (*KeywordMap)["min16float4x1"] = EHTokMin16float4x1; + (*KeywordMap)["min16float4x2"] = EHTokMin16float4x2; + (*KeywordMap)["min16float4x3"] = EHTokMin16float4x3; + (*KeywordMap)["min16float4x4"] = EHTokMin16float4x4; + (*KeywordMap)["min10float1x1"] = EHTokMin10float1x1; + (*KeywordMap)["min10float1x2"] = EHTokMin10float1x2; + (*KeywordMap)["min10float1x3"] = EHTokMin10float1x3; + (*KeywordMap)["min10float1x4"] = EHTokMin10float1x4; + (*KeywordMap)["min10float2x1"] = EHTokMin10float2x1; + (*KeywordMap)["min10float2x2"] = EHTokMin10float2x2; + (*KeywordMap)["min10float2x3"] = EHTokMin10float2x3; + (*KeywordMap)["min10float2x4"] = EHTokMin10float2x4; + (*KeywordMap)["min10float3x1"] = EHTokMin10float3x1; + (*KeywordMap)["min10float3x2"] = EHTokMin10float3x2; + (*KeywordMap)["min10float3x3"] = EHTokMin10float3x3; + (*KeywordMap)["min10float3x4"] = EHTokMin10float3x4; + (*KeywordMap)["min10float4x1"] = EHTokMin10float4x1; + (*KeywordMap)["min10float4x2"] = EHTokMin10float4x2; + (*KeywordMap)["min10float4x3"] = EHTokMin10float4x3; + (*KeywordMap)["min10float4x4"] = EHTokMin10float4x4; + (*KeywordMap)["min16int1x1"] = EHTokMin16int1x1; + (*KeywordMap)["min16int1x2"] = EHTokMin16int1x2; + (*KeywordMap)["min16int1x3"] = EHTokMin16int1x3; + (*KeywordMap)["min16int1x4"] = EHTokMin16int1x4; + (*KeywordMap)["min16int2x1"] = EHTokMin16int2x1; + (*KeywordMap)["min16int2x2"] = EHTokMin16int2x2; + (*KeywordMap)["min16int2x3"] = EHTokMin16int2x3; + (*KeywordMap)["min16int2x4"] = EHTokMin16int2x4; + (*KeywordMap)["min16int3x1"] = EHTokMin16int3x1; + (*KeywordMap)["min16int3x2"] = EHTokMin16int3x2; + (*KeywordMap)["min16int3x3"] = EHTokMin16int3x3; + (*KeywordMap)["min16int3x4"] = EHTokMin16int3x4; + (*KeywordMap)["min16int4x1"] = EHTokMin16int4x1; + (*KeywordMap)["min16int4x2"] = EHTokMin16int4x2; + (*KeywordMap)["min16int4x3"] = EHTokMin16int4x3; + (*KeywordMap)["min16int4x4"] = EHTokMin16int4x4; + (*KeywordMap)["min12int1x1"] = EHTokMin12int1x1; + (*KeywordMap)["min12int1x2"] = EHTokMin12int1x2; + (*KeywordMap)["min12int1x3"] = EHTokMin12int1x3; + (*KeywordMap)["min12int1x4"] = EHTokMin12int1x4; + (*KeywordMap)["min12int2x1"] = EHTokMin12int2x1; + (*KeywordMap)["min12int2x2"] = EHTokMin12int2x2; + (*KeywordMap)["min12int2x3"] = EHTokMin12int2x3; + (*KeywordMap)["min12int2x4"] = EHTokMin12int2x4; + (*KeywordMap)["min12int3x1"] = EHTokMin12int3x1; + (*KeywordMap)["min12int3x2"] = EHTokMin12int3x2; + (*KeywordMap)["min12int3x3"] = EHTokMin12int3x3; + (*KeywordMap)["min12int3x4"] = EHTokMin12int3x4; + (*KeywordMap)["min12int4x1"] = EHTokMin12int4x1; + (*KeywordMap)["min12int4x2"] = EHTokMin12int4x2; + (*KeywordMap)["min12int4x3"] = EHTokMin12int4x3; + (*KeywordMap)["min12int4x4"] = EHTokMin12int4x4; + (*KeywordMap)["min16uint1x1"] = EHTokMin16uint1x1; + (*KeywordMap)["min16uint1x2"] = EHTokMin16uint1x2; + (*KeywordMap)["min16uint1x3"] = EHTokMin16uint1x3; + (*KeywordMap)["min16uint1x4"] = EHTokMin16uint1x4; + (*KeywordMap)["min16uint2x1"] = EHTokMin16uint2x1; + (*KeywordMap)["min16uint2x2"] = EHTokMin16uint2x2; + (*KeywordMap)["min16uint2x3"] = EHTokMin16uint2x3; + (*KeywordMap)["min16uint2x4"] = EHTokMin16uint2x4; + (*KeywordMap)["min16uint3x1"] = EHTokMin16uint3x1; + (*KeywordMap)["min16uint3x2"] = EHTokMin16uint3x2; + (*KeywordMap)["min16uint3x3"] = EHTokMin16uint3x3; + (*KeywordMap)["min16uint3x4"] = EHTokMin16uint3x4; + (*KeywordMap)["min16uint4x1"] = EHTokMin16uint4x1; + (*KeywordMap)["min16uint4x2"] = EHTokMin16uint4x2; + (*KeywordMap)["min16uint4x3"] = EHTokMin16uint4x3; + (*KeywordMap)["min16uint4x4"] = EHTokMin16uint4x4; (*KeywordMap)["sampler"] = EHTokSampler; (*KeywordMap)["sampler1D"] = EHTokSampler1d; @@ -806,6 +886,86 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier() case EHTokDouble4x2: case EHTokDouble4x3: case EHTokDouble4x4: + case EHTokMin16float1x1: + case EHTokMin16float1x2: + case EHTokMin16float1x3: + case EHTokMin16float1x4: + case EHTokMin16float2x1: + case EHTokMin16float2x2: + case EHTokMin16float2x3: + case EHTokMin16float2x4: + case EHTokMin16float3x1: + case EHTokMin16float3x2: + case EHTokMin16float3x3: + case EHTokMin16float3x4: + case EHTokMin16float4x1: + case EHTokMin16float4x2: + case EHTokMin16float4x3: + case EHTokMin16float4x4: + case EHTokMin10float1x1: + case EHTokMin10float1x2: + case EHTokMin10float1x3: + case EHTokMin10float1x4: + case EHTokMin10float2x1: + case EHTokMin10float2x2: + case EHTokMin10float2x3: + case EHTokMin10float2x4: + case EHTokMin10float3x1: + case EHTokMin10float3x2: + case EHTokMin10float3x3: + case EHTokMin10float3x4: + case EHTokMin10float4x1: + case EHTokMin10float4x2: + case EHTokMin10float4x3: + case EHTokMin10float4x4: + case EHTokMin16int1x1: + case EHTokMin16int1x2: + case EHTokMin16int1x3: + case EHTokMin16int1x4: + case EHTokMin16int2x1: + case EHTokMin16int2x2: + case EHTokMin16int2x3: + case EHTokMin16int2x4: + case EHTokMin16int3x1: + case EHTokMin16int3x2: + case EHTokMin16int3x3: + case EHTokMin16int3x4: + case EHTokMin16int4x1: + case EHTokMin16int4x2: + case EHTokMin16int4x3: + case EHTokMin16int4x4: + case EHTokMin12int1x1: + case EHTokMin12int1x2: + case EHTokMin12int1x3: + case EHTokMin12int1x4: + case EHTokMin12int2x1: + case EHTokMin12int2x2: + case EHTokMin12int2x3: + case EHTokMin12int2x4: + case EHTokMin12int3x1: + case EHTokMin12int3x2: + case EHTokMin12int3x3: + case EHTokMin12int3x4: + case EHTokMin12int4x1: + case EHTokMin12int4x2: + case EHTokMin12int4x3: + case EHTokMin12int4x4: + case EHTokMin16uint1x1: + case EHTokMin16uint1x2: + case EHTokMin16uint1x3: + case EHTokMin16uint1x4: + case EHTokMin16uint2x1: + case EHTokMin16uint2x2: + case EHTokMin16uint2x3: + case EHTokMin16uint2x4: + case EHTokMin16uint3x1: + case EHTokMin16uint3x2: + case EHTokMin16uint3x3: + case EHTokMin16uint3x4: + case EHTokMin16uint4x1: + case EHTokMin16uint4x2: + case EHTokMin16uint4x3: + case EHTokMin16uint4x4: return keyword; // texturing types diff --git a/bgfx/3rdparty/glslang/glslang/HLSL/hlslTokens.h b/bgfx/3rdparty/glslang/glslang/HLSL/hlslTokens.h index 4426bcce..a7c12990 100644 --- a/bgfx/3rdparty/glslang/glslang/HLSL/hlslTokens.h +++ b/bgfx/3rdparty/glslang/glslang/HLSL/hlslTokens.h @@ -249,6 +249,86 @@ enum EHlslTokenClass { EHTokDouble4x2, EHTokDouble4x3, EHTokDouble4x4, + EHTokMin16float1x1, + EHTokMin16float1x2, + EHTokMin16float1x3, + EHTokMin16float1x4, + EHTokMin16float2x1, + EHTokMin16float2x2, + EHTokMin16float2x3, + EHTokMin16float2x4, + EHTokMin16float3x1, + EHTokMin16float3x2, + EHTokMin16float3x3, + EHTokMin16float3x4, + EHTokMin16float4x1, + EHTokMin16float4x2, + EHTokMin16float4x3, + EHTokMin16float4x4, + EHTokMin10float1x1, + EHTokMin10float1x2, + EHTokMin10float1x3, + EHTokMin10float1x4, + EHTokMin10float2x1, + EHTokMin10float2x2, + EHTokMin10float2x3, + EHTokMin10float2x4, + EHTokMin10float3x1, + EHTokMin10float3x2, + EHTokMin10float3x3, + EHTokMin10float3x4, + EHTokMin10float4x1, + EHTokMin10float4x2, + EHTokMin10float4x3, + EHTokMin10float4x4, + EHTokMin16int1x1, + EHTokMin16int1x2, + EHTokMin16int1x3, + EHTokMin16int1x4, + EHTokMin16int2x1, + EHTokMin16int2x2, + EHTokMin16int2x3, + EHTokMin16int2x4, + EHTokMin16int3x1, + EHTokMin16int3x2, + EHTokMin16int3x3, + EHTokMin16int3x4, + EHTokMin16int4x1, + EHTokMin16int4x2, + EHTokMin16int4x3, + EHTokMin16int4x4, + EHTokMin12int1x1, + EHTokMin12int1x2, + EHTokMin12int1x3, + EHTokMin12int1x4, + EHTokMin12int2x1, + EHTokMin12int2x2, + EHTokMin12int2x3, + EHTokMin12int2x4, + EHTokMin12int3x1, + EHTokMin12int3x2, + EHTokMin12int3x3, + EHTokMin12int3x4, + EHTokMin12int4x1, + EHTokMin12int4x2, + EHTokMin12int4x3, + EHTokMin12int4x4, + EHTokMin16uint1x1, + EHTokMin16uint1x2, + EHTokMin16uint1x3, + EHTokMin16uint1x4, + EHTokMin16uint2x1, + EHTokMin16uint2x2, + EHTokMin16uint2x3, + EHTokMin16uint2x4, + EHTokMin16uint3x1, + EHTokMin16uint3x2, + EHTokMin16uint3x3, + EHTokMin16uint3x4, + EHTokMin16uint4x1, + EHTokMin16uint4x2, + EHTokMin16uint4x3, + EHTokMin16uint4x4, // texturing types EHTokSampler, diff --git a/bgfx/3rdparty/glslang/glslang/Include/BaseTypes.h b/bgfx/3rdparty/glslang/glslang/Include/BaseTypes.h old mode 100644 new mode 100755 index 156d98b9..ae49a936 --- a/bgfx/3rdparty/glslang/glslang/Include/BaseTypes.h +++ b/bgfx/3rdparty/glslang/glslang/Include/BaseTypes.h @@ -65,10 +65,10 @@ enum TBasicType { EbtAccStruct, EbtReference, EbtRayQuery, -#ifndef GLSLANG_WEB + EbtHitObjectNV, + EbtCoopmat, // SPIR-V type defined by spirv_type EbtSpirvType, -#endif // HLSL types that live only temporarily. EbtString, @@ -95,15 +95,14 @@ enum TStorageQualifier { EvqUniform, // read only, shared with app EvqBuffer, // read/write, shared with app EvqShared, // compute shader's read/write 'shared' qualifier -#ifndef GLSLANG_WEB EvqSpirvStorageClass, // spirv_storage_class -#endif EvqPayload, EvqPayloadIn, EvqHitAttr, EvqCallableData, EvqCallableDataIn, + EvqHitObjectAttrNV, EvqtaskPayloadSharedEXT, @@ -132,6 +131,8 @@ enum TStorageQualifier { EvqFragDepth, EvqFragStencil, + EvqTileImageEXT, + // end of list EvqLast }; @@ -316,6 +317,15 @@ enum TBuiltInVariable { EbvByteAddressBuffer, EbvRWByteAddressBuffer, + // ARM specific core builtins + EbvCoreCountARM, + EbvCoreIDARM, + EbvCoreMaxIDARM, + EbvWarpIDARM, + EbvWarpMaxIDARM, + + EbvPositionFetch, + EbvLast }; @@ -328,10 +338,6 @@ enum TPrecisionQualifier { EpqHigh }; -#ifdef GLSLANG_WEB -__inline const char* GetStorageQualifierString(TStorageQualifier q) { return ""; } -__inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) { return ""; } -#else // These will show up in error messages __inline const char* GetStorageQualifierString(TStorageQualifier q) { @@ -340,9 +346,7 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q) case EvqGlobal: return "global"; break; case EvqConst: return "const"; break; case EvqConstReadOnly: return "const (read only)"; break; -#ifndef GLSLANG_WEB case EvqSpirvStorageClass: return "spirv_storage_class"; break; -#endif case EvqVaryingIn: return "in"; break; case EvqVaryingOut: return "out"; break; case EvqUniform: return "uniform"; break; @@ -368,6 +372,7 @@ __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; default: return "unknown qualifier"; } } @@ -532,7 +537,6 @@ __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) default: return "unknown precision qualifier"; } } -#endif __inline bool isTypeSignedInt(TBasicType type) { diff --git a/bgfx/3rdparty/glslang/glslang/Include/Common.h b/bgfx/3rdparty/glslang/glslang/Include/Common.h index 7dbe4559..abfe8446 100644 --- a/bgfx/3rdparty/glslang/glslang/Include/Common.h +++ b/bgfx/3rdparty/glslang/glslang/Include/Common.h @@ -45,6 +45,7 @@ #else #include #endif +#include #include #include #include @@ -56,6 +57,7 @@ #include #if defined(__ANDROID__) || (defined(_MSC_VER) && _MSC_VER < 1700) +#include namespace std { template @@ -67,7 +69,7 @@ std::string to_string(const T& val) { } #endif -#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || (defined(MINGW_HAS_SECURE_API) && MINGW_HAS_SECURE_API) +#if defined(MINGW_HAS_SECURE_API) && MINGW_HAS_SECURE_API #include #ifndef snprintf #define snprintf sprintf_s @@ -83,22 +85,6 @@ std::string to_string(const T& val) { #define UINT_PTR uintptr_t #endif -#if defined(_MSC_VER) && _MSC_VER < 1800 - #include - inline long long int strtoll (const char* str, char** endptr, int base) - { - return _strtoi64(str, endptr, base); - } - inline unsigned long long int strtoull (const char* str, char** endptr, int base) - { - return _strtoui64(str, endptr, base); - } - inline long long int atoll (const char* str) - { - return strtoll(str, NULL, 10); - } -#endif - #if defined(_MSC_VER) #define strdup _strdup #endif diff --git a/bgfx/3rdparty/glslang/glslang/Include/ConstantUnion.h b/bgfx/3rdparty/glslang/glslang/Include/ConstantUnion.h index c4ffb857..1f39fc59 100644 --- a/bgfx/3rdparty/glslang/glslang/Include/ConstantUnion.h +++ b/bgfx/3rdparty/glslang/glslang/Include/ConstantUnion.h @@ -234,7 +234,6 @@ class TConstUnion { break; -#ifndef GLSLANG_WEB case EbtInt16: if (constant.i16Const == i16Const) return true; @@ -265,7 +264,6 @@ class TConstUnion { return true; break; -#endif default: assert(false && "Default missing"); } @@ -347,7 +345,6 @@ class TConstUnion { return true; return false; -#ifndef GLSLANG_WEB case EbtInt8: if (i8Const > constant.i8Const) return true; @@ -378,7 +375,6 @@ class TConstUnion { return true; return false; -#endif default: assert(false && "Default missing"); return false; @@ -389,7 +385,6 @@ class TConstUnion { { assert(type == constant.type); switch (type) { -#ifndef GLSLANG_WEB case EbtInt8: if (i8Const < constant.i8Const) return true; @@ -419,7 +414,6 @@ class TConstUnion { return true; return false; -#endif case EbtDouble: if (dConst < constant.dConst) return true; @@ -449,14 +443,12 @@ class TConstUnion { case EbtInt: returnValue.setIConst(iConst + constant.iConst); break; case EbtUint: returnValue.setUConst(uConst + constant.uConst); break; case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const + constant.i8Const); break; case EbtInt16: returnValue.setI16Const(i16Const + constant.i16Const); break; case EbtInt64: returnValue.setI64Const(i64Const + constant.i64Const); break; case EbtUint8: returnValue.setU8Const(u8Const + constant.u8Const); break; case EbtUint16: returnValue.setU16Const(u16Const + constant.u16Const); break; case EbtUint64: returnValue.setU64Const(u64Const + constant.u64Const); break; -#endif default: assert(false && "Default missing"); } @@ -471,14 +463,12 @@ class TConstUnion { case EbtInt: returnValue.setIConst(iConst - constant.iConst); break; case EbtUint: returnValue.setUConst(uConst - constant.uConst); break; case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const - constant.i8Const); break; case EbtInt16: returnValue.setI16Const(i16Const - constant.i16Const); break; case EbtInt64: returnValue.setI64Const(i64Const - constant.i64Const); break; case EbtUint8: returnValue.setU8Const(u8Const - constant.u8Const); break; case EbtUint16: returnValue.setU16Const(u16Const - constant.u16Const); break; case EbtUint64: returnValue.setU64Const(u64Const - constant.u64Const); break; -#endif default: assert(false && "Default missing"); } @@ -493,14 +483,12 @@ class TConstUnion { case EbtInt: returnValue.setIConst(iConst * constant.iConst); break; case EbtUint: returnValue.setUConst(uConst * constant.uConst); break; case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const * constant.i8Const); break; case EbtInt16: returnValue.setI16Const(i16Const * constant.i16Const); break; case EbtInt64: returnValue.setI64Const(i64Const * constant.i64Const); break; case EbtUint8: returnValue.setU8Const(u8Const * constant.u8Const); break; case EbtUint16: returnValue.setU16Const(u16Const * constant.u16Const); break; case EbtUint64: returnValue.setU64Const(u64Const * constant.u64Const); break; -#endif default: assert(false && "Default missing"); } @@ -514,14 +502,12 @@ class TConstUnion { switch (type) { case EbtInt: returnValue.setIConst(iConst % constant.iConst); break; case EbtUint: returnValue.setUConst(uConst % constant.uConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const % constant.i8Const); break; case EbtInt16: returnValue.setI8Const(i8Const % constant.i16Const); break; case EbtInt64: returnValue.setI64Const(i64Const % constant.i64Const); break; case EbtUint8: returnValue.setU8Const(u8Const % constant.u8Const); break; case EbtUint16: returnValue.setU16Const(u16Const % constant.u16Const); break; case EbtUint64: returnValue.setU64Const(u64Const % constant.u64Const); break; -#endif default: assert(false && "Default missing"); } @@ -532,7 +518,6 @@ class TConstUnion { { TConstUnion returnValue; switch (type) { -#ifndef GLSLANG_WEB case EbtInt8: switch (constant.type) { case EbtInt8: returnValue.setI8Const(i8Const >> constant.i8Const); break; @@ -585,19 +570,16 @@ class TConstUnion { default: assert(false && "Default missing"); } break; -#endif case EbtInt: switch (constant.type) { case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break; case EbtUint: returnValue.setIConst(iConst >> constant.uConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setIConst(iConst >> constant.i8Const); break; case EbtUint8: returnValue.setIConst(iConst >> constant.u8Const); break; case EbtInt16: returnValue.setIConst(iConst >> constant.i16Const); break; case EbtUint16: returnValue.setIConst(iConst >> constant.u16Const); break; case EbtInt64: returnValue.setIConst(iConst >> constant.i64Const); break; case EbtUint64: returnValue.setIConst(iConst >> constant.u64Const); break; -#endif default: assert(false && "Default missing"); } break; @@ -605,18 +587,15 @@ class TConstUnion { switch (constant.type) { case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break; case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setUConst(uConst >> constant.i8Const); break; case EbtUint8: returnValue.setUConst(uConst >> constant.u8Const); break; case EbtInt16: returnValue.setUConst(uConst >> constant.i16Const); break; case EbtUint16: returnValue.setUConst(uConst >> constant.u16Const); break; case EbtInt64: returnValue.setUConst(uConst >> constant.i64Const); break; case EbtUint64: returnValue.setUConst(uConst >> constant.u64Const); break; -#endif default: assert(false && "Default missing"); } break; -#ifndef GLSLANG_WEB case EbtInt64: switch (constant.type) { case EbtInt8: returnValue.setI64Const(i64Const >> constant.i8Const); break; @@ -643,7 +622,6 @@ class TConstUnion { default: assert(false && "Default missing"); } break; -#endif default: assert(false && "Default missing"); } @@ -654,7 +632,6 @@ class TConstUnion { { TConstUnion returnValue; switch (type) { -#ifndef GLSLANG_WEB case EbtInt8: switch (constant.type) { case EbtInt8: returnValue.setI8Const(i8Const << constant.i8Const); break; @@ -733,19 +710,16 @@ class TConstUnion { default: assert(false && "Default missing"); } break; -#endif case EbtInt: switch (constant.type) { case EbtInt: returnValue.setIConst(iConst << constant.iConst); break; case EbtUint: returnValue.setIConst(iConst << constant.uConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setIConst(iConst << constant.i8Const); break; case EbtUint8: returnValue.setIConst(iConst << constant.u8Const); break; case EbtInt16: returnValue.setIConst(iConst << constant.i16Const); break; case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break; case EbtInt64: returnValue.setIConst(iConst << constant.i64Const); break; case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break; -#endif default: assert(false && "Default missing"); } break; @@ -753,14 +727,12 @@ class TConstUnion { switch (constant.type) { case EbtInt: returnValue.setUConst(uConst << constant.iConst); break; case EbtUint: returnValue.setUConst(uConst << constant.uConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setUConst(uConst << constant.i8Const); break; case EbtUint8: returnValue.setUConst(uConst << constant.u8Const); break; case EbtInt16: returnValue.setUConst(uConst << constant.i16Const); break; case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break; case EbtInt64: returnValue.setUConst(uConst << constant.i64Const); break; case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break; -#endif default: assert(false && "Default missing"); } break; @@ -777,14 +749,12 @@ class TConstUnion { switch (type) { case EbtInt: returnValue.setIConst(iConst & constant.iConst); break; case EbtUint: returnValue.setUConst(uConst & constant.uConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const & constant.i8Const); break; case EbtUint8: returnValue.setU8Const(u8Const & constant.u8Const); break; case EbtInt16: returnValue.setI16Const(i16Const & constant.i16Const); break; case EbtUint16: returnValue.setU16Const(u16Const & constant.u16Const); break; case EbtInt64: returnValue.setI64Const(i64Const & constant.i64Const); break; case EbtUint64: returnValue.setU64Const(u64Const & constant.u64Const); break; -#endif default: assert(false && "Default missing"); } @@ -798,14 +768,12 @@ class TConstUnion { switch (type) { case EbtInt: returnValue.setIConst(iConst | constant.iConst); break; case EbtUint: returnValue.setUConst(uConst | constant.uConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const | constant.i8Const); break; case EbtUint8: returnValue.setU8Const(u8Const | constant.u8Const); break; case EbtInt16: returnValue.setI16Const(i16Const | constant.i16Const); break; case EbtUint16: returnValue.setU16Const(u16Const | constant.u16Const); break; case EbtInt64: returnValue.setI64Const(i64Const | constant.i64Const); break; case EbtUint64: returnValue.setU64Const(u64Const | constant.u64Const); break; -#endif default: assert(false && "Default missing"); } @@ -819,14 +787,12 @@ class TConstUnion { switch (type) { case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break; case EbtUint: returnValue.setUConst(uConst ^ constant.uConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const ^ constant.i8Const); break; case EbtUint8: returnValue.setU8Const(u8Const ^ constant.u8Const); break; case EbtInt16: returnValue.setI16Const(i16Const ^ constant.i16Const); break; case EbtUint16: returnValue.setU16Const(u16Const ^ constant.u16Const); break; case EbtInt64: returnValue.setI64Const(i64Const ^ constant.i64Const); break; case EbtUint64: returnValue.setU64Const(u64Const ^ constant.u64Const); break; -#endif default: assert(false && "Default missing"); } @@ -839,14 +805,12 @@ class TConstUnion { switch (type) { case EbtInt: returnValue.setIConst(~iConst); break; case EbtUint: returnValue.setUConst(~uConst); break; -#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(~i8Const); break; case EbtUint8: returnValue.setU8Const(~u8Const); break; case EbtInt16: returnValue.setI16Const(~i16Const); break; case EbtUint16: returnValue.setU16Const(~u16Const); break; case EbtInt64: returnValue.setI64Const(~i64Const); break; case EbtUint64: returnValue.setU64Const(~u64Const); break; -#endif default: assert(false && "Default missing"); } diff --git a/bgfx/3rdparty/glslang/glslang/Include/InitializeGlobals.h b/bgfx/3rdparty/glslang/glslang/Include/InitializeGlobals.h index 95d0a40e..b7fdd7aa 100644 --- a/bgfx/3rdparty/glslang/glslang/Include/InitializeGlobals.h +++ b/bgfx/3rdparty/glslang/glslang/Include/InitializeGlobals.h @@ -37,7 +37,7 @@ namespace glslang { -bool InitializePoolIndex(); +inline bool InitializePoolIndex() { return true; } // DEPRECATED: No need to call } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/glslang/Include/PoolAlloc.h b/bgfx/3rdparty/glslang/glslang/Include/PoolAlloc.h index 1f5cac76..e84ac52c 100644 --- a/bgfx/3rdparty/glslang/glslang/Include/PoolAlloc.h +++ b/bgfx/3rdparty/glslang/glslang/Include/PoolAlloc.h @@ -37,7 +37,7 @@ #ifndef _POOLALLOC_INCLUDED_ #define _POOLALLOC_INCLUDED_ -#ifdef _DEBUG +#ifndef NDEBUG # define GUARD_BLOCKS // define to enable guard block sanity checking #endif @@ -74,7 +74,7 @@ namespace glslang { class TAllocation { public: - TAllocation(size_t size, unsigned char* mem, TAllocation* prev = 0) : + TAllocation(size_t size, unsigned char* mem, TAllocation* prev = nullptr) : size(size), mem(mem), prevAlloc(prev) { // Allocations are bracketed: // [allocationHeader][initialGuardBlock][userData][finalGuardBlock] @@ -118,11 +118,16 @@ class TAllocation { unsigned char* mem; // beginning of our allocation (pts to header) TAllocation* prevAlloc; // prior allocation in the chain - const static unsigned char guardBlockBeginVal; - const static unsigned char guardBlockEndVal; - const static unsigned char userDataFill; + static inline constexpr unsigned char guardBlockBeginVal = 0xfb; + static inline constexpr unsigned char guardBlockEndVal = 0xfe; + static inline constexpr unsigned char userDataFill = 0xcd; + +# ifdef GUARD_BLOCKS + static inline constexpr size_t guardBlockSize = 16; +# else + static inline constexpr size_t guardBlockSize = 0; +# endif - const static size_t guardBlockSize; # ifdef GUARD_BLOCKS inline static size_t headerSize() { return sizeof(TAllocation); } # else @@ -171,7 +176,7 @@ class TPoolAllocator { void popAll(); // - // Call allocate() to actually acquire memory. Returns 0 if no memory + // Call allocate() to actually acquire memory. Returns nullptr if no memory // available, otherwise a properly aligned pointer to 'numBytes' of memory. // void* allocate(size_t numBytes); @@ -189,7 +194,7 @@ class TPoolAllocator { struct tHeader { tHeader(tHeader* nextPage, size_t pageCount) : #ifdef GUARD_BLOCKS - lastAllocation(0), + lastAllocation(nullptr), #endif nextPage(nextPage), pageCount(pageCount) { } diff --git a/bgfx/3rdparty/glslang/glslang/Include/ShHandle.h b/bgfx/3rdparty/glslang/glslang/Include/ShHandle.h index df07bd8e..dee47c0d 100644 --- a/bgfx/3rdparty/glslang/glslang/Include/ShHandle.h +++ b/bgfx/3rdparty/glslang/glslang/Include/ShHandle.h @@ -58,9 +58,9 @@ class TShHandleBase { public: TShHandleBase() { pool = new glslang::TPoolAllocator; } virtual ~TShHandleBase() { delete pool; } - virtual TCompiler* getAsCompiler() { return 0; } - virtual TLinker* getAsLinker() { return 0; } - virtual TUniformMap* getAsUniformMap() { return 0; } + virtual TCompiler* getAsCompiler() { return nullptr; } + virtual TLinker* getAsLinker() { return nullptr; } + virtual TUniformMap* getAsUniformMap() { return nullptr; } virtual glslang::TPoolAllocator* getPool() const { return pool; } private: glslang::TPoolAllocator* pool; @@ -123,11 +123,11 @@ class TLinker : public TShHandleBase { infoSink(iSink), executable(e), haveReturnableObjectCode(false), - appAttributeBindings(0), - fixedAttributeBindings(0), - excludedAttributes(0), + appAttributeBindings(nullptr), + fixedAttributeBindings(nullptr), + excludedAttributes(nullptr), excludedCount(0), - uniformBindings(0) { } + uniformBindings(nullptr) { } virtual TLinker* getAsLinker() { return this; } virtual ~TLinker() { } virtual bool link(TCompilerList&, TUniformMap*) = 0; @@ -137,7 +137,7 @@ class TLinker : public TShHandleBase { virtual void getAttributeBindings(ShBindingTable const **t) const = 0; virtual void setExcludedAttributes(const int* attributes, int count) { excludedAttributes = attributes; excludedCount = count; } virtual ShBindingTable* getUniformBindings() const { return uniformBindings; } - virtual const void* getObjectCode() const { return 0; } // a real compiler would be returning object code here + virtual const void* getObjectCode() const { return nullptr; } // a real compiler would be returning object code here virtual TInfoSink& getInfoSink() { return infoSink; } TInfoSink& infoSink; protected: diff --git a/bgfx/3rdparty/glslang/glslang/Include/SpirvIntrinsics.h b/bgfx/3rdparty/glslang/glslang/Include/SpirvIntrinsics.h index 3c7d72ce..bfb551e4 100644 --- a/bgfx/3rdparty/glslang/glslang/Include/SpirvIntrinsics.h +++ b/bgfx/3rdparty/glslang/glslang/Include/SpirvIntrinsics.h @@ -35,8 +35,6 @@ #pragma once -#ifndef GLSLANG_WEB - // // GL_EXT_spirv_intrinsics // @@ -98,12 +96,23 @@ struct TSpirvInstruction { struct TSpirvTypeParameter { POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - TSpirvTypeParameter(const TIntermConstantUnion* arg) { constant = arg; } + TSpirvTypeParameter(const TIntermConstantUnion* arg) + { + constant = arg; + type = nullptr; + } - bool operator==(const TSpirvTypeParameter& rhs) const { return constant == rhs.constant; } + TSpirvTypeParameter(const TType *arg) + { + constant = nullptr; + type = arg; + } + + bool operator==(const TSpirvTypeParameter& rhs) const; bool operator!=(const TSpirvTypeParameter& rhs) const { return !operator==(rhs); } - const TIntermConstantUnion* constant; + const TIntermConstantUnion* constant; // Constant expression + const TType* type; // Type specifier }; typedef TVector TSpirvTypeParameters; @@ -124,5 +133,3 @@ struct TSpirvType { }; } // end namespace glslang - -#endif // GLSLANG_WEB diff --git a/bgfx/3rdparty/glslang/glslang/Include/Types.h b/bgfx/3rdparty/glslang/glslang/Include/Types.h index a6f47e84..26aba9bb 100644 --- a/bgfx/3rdparty/glslang/glslang/Include/Types.h +++ b/bgfx/3rdparty/glslang/glslang/Include/Types.h @@ -72,6 +72,7 @@ enum TSamplerDim { EsdRect, EsdBuffer, EsdSubpass, // goes only with non-sampled image (image is true) + EsdAttachmentEXT, EsdNumDims }; @@ -85,19 +86,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler, bool combined : 1; // true means texture is combined with a sampler, false means texture with no sampler bool sampler : 1; // true means a pure sampler, other fields should be clear() -#ifdef GLSLANG_WEB - bool is1D() const { return false; } - bool isBuffer() const { return false; } - bool isRect() const { return false; } - bool isSubpass() const { return false; } - bool isCombined() const { return true; } - bool isImage() const { return false; } - bool isImageClass() const { return false; } - bool isMultiSample() const { return false; } - bool isExternal() const { return false; } - void setExternal(bool e) { } - bool isYuv() const { return false; } -#else unsigned int vectorSize : 3; // vector return type size. // Some languages support structures as sample results. Storing the whole structure in the // TSampler is too large, so there is an index to a separate table. @@ -122,14 +110,14 @@ struct TSampler { // misnomer now; includes images, textures without sampler, bool isBuffer() const { return dim == EsdBuffer; } bool isRect() const { return dim == EsdRect; } bool isSubpass() const { return dim == EsdSubpass; } + bool isAttachmentEXT() const { return dim == EsdAttachmentEXT; } bool isCombined() const { return combined; } - bool isImage() const { return image && !isSubpass(); } + bool isImage() const { return image && !isSubpass() && !isAttachmentEXT();} bool isImageClass() const { return image; } bool isMultiSample() const { return ms; } bool isExternal() const { return external; } void setExternal(bool e) { external = e; } bool isYuv() const { return yuv; } -#endif bool isTexture() const { return !sampler && !image; } bool isPureSampler() const { return sampler; } @@ -149,10 +137,8 @@ struct TSampler { // misnomer now; includes images, textures without sampler, image = false; combined = false; sampler = false; -#ifndef GLSLANG_WEB external = false; yuv = false; -#endif #ifdef ENABLE_HLSL clearReturnStruct(); @@ -204,7 +190,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler, shadow = s; } -#ifndef GLSLANG_WEB // make a subpass input attachment void setSubpass(TBasicType t, bool m = false) { @@ -214,7 +199,15 @@ struct TSampler { // misnomer now; includes images, textures without sampler, dim = EsdSubpass; ms = m; } -#endif + + // make an AttachmentEXT + void setAttachmentEXT(TBasicType t) + { + clear(); + type = t; + image = true; + dim = EsdAttachmentEXT; + } bool operator==(const TSampler& right) const { @@ -252,7 +245,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler, switch (type) { case EbtInt: s.append("i"); break; case EbtUint: s.append("u"); break; -#ifndef GLSLANG_WEB case EbtFloat16: s.append("f16"); break; case EbtInt8: s.append("i8"); break; case EbtUint16: s.append("u8"); break; @@ -260,11 +252,12 @@ struct TSampler { // misnomer now; includes images, textures without sampler, case EbtUint8: s.append("u16"); break; case EbtInt64: s.append("i64"); break; case EbtUint64: s.append("u64"); break; -#endif default: break; } if (isImageClass()) { - if (isSubpass()) + if (isAttachmentEXT()) + s.append("attachmentEXT"); + else if (isSubpass()) s.append("subpass"); else s.append("image"); @@ -284,12 +277,11 @@ struct TSampler { // misnomer now; includes images, textures without sampler, case Esd2D: s.append("2D"); break; case Esd3D: s.append("3D"); break; case EsdCube: s.append("Cube"); break; -#ifndef GLSLANG_WEB - case Esd1D: s.append("1D"); break; - case EsdRect: s.append("2DRect"); break; - case EsdBuffer: s.append("Buffer"); break; - case EsdSubpass: s.append("Input"); break; -#endif + case Esd1D: s.append("1D"); break; + case EsdRect: s.append("2DRect"); break; + case EsdBuffer: s.append("Buffer"); break; + case EsdSubpass: s.append("Input"); break; + case EsdAttachmentEXT: s.append(""); break; default: break; // some compilers want this } if (isMultiSample()) @@ -429,6 +421,12 @@ enum TLayoutFormat { ElfR16ui, ElfR8ui, ElfR64ui, + ElfExtSizeGuard, // to help with comparisons + ElfSize1x8, + ElfSize1x16, + ElfSize1x32, + ElfSize2x32, + ElfSize4x32, ElfCount }; @@ -512,12 +510,10 @@ class TQualifier { invariant = false; makeTemporary(); declaredBuiltIn = EbvNone; -#ifndef GLSLANG_WEB noContraction = false; nullInit = false; spirvByReference = false; spirvLiteral = false; -#endif defaultBlock = false; } @@ -534,21 +530,17 @@ class TQualifier { nullInit = false; defaultBlock = false; clearLayout(); -#ifndef GLSLANG_WEB spirvStorageClass = -1; spirvDecorate = nullptr; spirvByReference = false; spirvLiteral = false; -#endif } void clearInterstage() { clearInterpolation(); -#ifndef GLSLANG_WEB patch = false; sample = false; -#endif } void clearInterpolation() @@ -556,20 +548,17 @@ class TQualifier { centroid = false; smooth = false; flat = false; -#ifndef GLSLANG_WEB nopersp = false; explicitInterp = false; pervertexNV = false; perPrimitiveNV = false; perViewNV = false; perTaskNV = false; -#endif pervertexEXT = false; } void clearMemory() { -#ifndef GLSLANG_WEB coherent = false; devicecoherent = false; queuefamilycoherent = false; @@ -581,7 +570,6 @@ class TQualifier { restrict = false; readonly = false; writeonly = false; -#endif } const char* semanticName; @@ -600,31 +588,6 @@ class TQualifier { bool explicitOffset : 1; bool defaultBlock : 1; // default blocks with matching names have structures merged when linking -#ifdef GLSLANG_WEB - bool isWriteOnly() const { return false; } - bool isReadOnly() const { return false; } - bool isRestrict() const { return false; } - bool isCoherent() const { return false; } - bool isVolatile() const { return false; } - bool isSample() const { return false; } - bool isMemory() const { return false; } - bool isMemoryQualifierImageAndSSBOOnly() const { return false; } - bool bufferReferenceNeedsVulkanMemoryModel() const { return false; } - bool isInterpolation() const { return flat || smooth; } - bool isExplicitInterpolation() const { return false; } - bool isAuxiliary() const { return centroid; } - bool isPatch() const { return false; } - bool isNoContraction() const { return false; } - void setNoContraction() { } - bool isPervertexNV() const { return false; } - bool isPervertexEXT() const { return pervertexEXT; } - void setNullInit() {} - bool isNullInit() const { return false; } - void setSpirvByReference() { } - bool isSpirvByReference() { return false; } - void setSpirvLiteral() { } - bool isSpirvLiteral() { return false; } -#else bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects bool nopersp : 1; bool explicitInterp : 1; @@ -691,7 +654,6 @@ class TQualifier { bool isSpirvByReference() const { return spirvByReference; } void setSpirvLiteral() { spirvLiteral = true; } bool isSpirvLiteral() const { return spirvLiteral; } -#endif bool isPipeInput() const { @@ -822,9 +784,7 @@ class TQualifier { } void setBlockStorage(TBlockStorageClass newBacking) { -#ifndef GLSLANG_WEB layoutPushConstant = (newBacking == EbsPushConstant); -#endif switch (newBacking) { case EbsUniform : if (layoutPacking == ElpStd430) { @@ -836,23 +796,16 @@ class TQualifier { case EbsStorageBuffer : storage = EvqBuffer; break; -#ifndef GLSLANG_WEB case EbsPushConstant : storage = EvqUniform; layoutSet = TQualifier::layoutSetEnd; layoutBinding = TQualifier::layoutBindingEnd; break; -#endif default: break; } } -#ifdef GLSLANG_WEB - bool isPerView() const { return false; } - bool isTaskMemory() const { return false; } - bool isArrayedIo(EShLanguage language) const { return false; } -#else bool isPerPrimitive() const { return perPrimitiveNV; } bool isPerView() const { return perViewNV; } bool isTaskMemory() const { return perTaskNV; } @@ -863,6 +816,9 @@ class TQualifier { bool isAnyCallable() const { return storage == EvqCallableData || storage == EvqCallableDataIn; } + bool isHitObjectAttrNV() const { + return storage == EvqHitObjectAttrNV; + } // True if this type of IO is supposed to be arrayed with extra level for per-vertex data bool isArrayedIo(EShLanguage language) const @@ -883,14 +839,12 @@ class TQualifier { return false; } } -#endif // Implementing an embedded layout-qualifier class here, since C++ can't have a real class bitfield void clearLayout() // all layout { clearUniformLayout(); -#ifndef GLSLANG_WEB layoutPushConstant = false; layoutBufferReference = false; layoutPassthrough = false; @@ -898,9 +852,11 @@ class TQualifier { // -2048 as the default value indicating layoutSecondaryViewportRelative is not set layoutSecondaryViewportRelativeOffset = -2048; layoutShaderRecord = false; + layoutHitObjectShaderRecordNV = false; + layoutBindlessSampler = false; + layoutBindlessImage = false; layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd; layoutFormat = ElfNone; -#endif clearInterstageLayout(); @@ -910,14 +866,11 @@ class TQualifier { { layoutLocation = layoutLocationEnd; layoutComponent = layoutComponentEnd; -#ifndef GLSLANG_WEB layoutIndex = layoutIndexEnd; clearStreamLayout(); clearXfbLayout(); -#endif } -#ifndef GLSLANG_WEB void clearStreamLayout() { layoutStream = layoutStreamEnd; @@ -928,7 +881,6 @@ class TQualifier { layoutXfbStride = layoutXfbStrideEnd; layoutXfbOffset = layoutXfbOffsetEnd; } -#endif bool hasNonXfbLayout() const { @@ -984,7 +936,6 @@ class TQualifier { unsigned int layoutSpecConstantId : 11; static const unsigned int layoutSpecConstantIdEnd = 0x7FF; -#ifndef GLSLANG_WEB // stored as log2 of the actual alignment value unsigned int layoutBufferReferenceAlign : 6; static const unsigned int layoutBufferReferenceAlignEnd = 0x3F; @@ -997,11 +948,14 @@ class TQualifier { bool layoutViewportRelative; int layoutSecondaryViewportRelativeOffset; bool layoutShaderRecord; + bool layoutHitObjectShaderRecordNV; // GL_EXT_spirv_intrinsics int spirvStorageClass; TSpirvDecorate* spirvDecorate; -#endif + + bool layoutBindlessSampler; + bool layoutBindlessImage; bool hasUniformLayout() const { @@ -1021,9 +975,7 @@ class TQualifier { layoutSet = layoutSetEnd; layoutBinding = layoutBindingEnd; -#ifndef GLSLANG_WEB layoutAttachment = layoutAttachmentEnd; -#endif } bool hasMatrix() const @@ -1056,26 +1008,6 @@ class TQualifier { { return layoutBinding != layoutBindingEnd; } -#ifdef GLSLANG_WEB - bool hasOffset() const { return false; } - bool isNonPerspective() const { return false; } - bool hasIndex() const { return false; } - unsigned getIndex() const { return 0; } - bool hasComponent() const { return false; } - bool hasStream() const { return false; } - bool hasFormat() const { return false; } - bool hasXfb() const { return false; } - bool hasXfbBuffer() const { return false; } - bool hasXfbStride() const { return false; } - bool hasXfbOffset() const { return false; } - bool hasAttachment() const { return false; } - TLayoutFormat getFormat() const { return ElfNone; } - bool isPushConstant() const { return false; } - bool isShaderRecord() const { return false; } - bool hasBufferReference() const { return false; } - bool hasBufferReferenceAlign() const { return false; } - bool isNonUniform() const { return false; } -#else bool hasOffset() const { return layoutOffset != layoutNotSet; @@ -1123,6 +1055,7 @@ class TQualifier { TLayoutFormat getFormat() const { return layoutFormat; } bool isPushConstant() const { return layoutPushConstant; } bool isShaderRecord() const { return layoutShaderRecord; } + bool hasHitObjectShaderRecordNV() const { return layoutHitObjectShaderRecordNV; } bool hasBufferReference() const { return layoutBufferReference; } bool hasBufferReferenceAlign() const { @@ -1132,6 +1065,14 @@ class TQualifier { { return nonUniform; } + bool isBindlessSampler() const + { + return layoutBindlessSampler; + } + bool isBindlessImage() const + { + return layoutBindlessImage; + } // GL_EXT_spirv_intrinsics bool hasSprivDecorate() const { return spirvDecorate != nullptr; } @@ -1141,7 +1082,7 @@ class TQualifier { const TSpirvDecorate& getSpirvDecorate() const { assert(spirvDecorate); return *spirvDecorate; } TSpirvDecorate& getSpirvDecorate() { assert(spirvDecorate); return *spirvDecorate; } TString getSpirvDecorateQualifierString() const; -#endif + bool hasSpecConstantId() const { // Not the same thing as being a specialization constant, this @@ -1175,12 +1116,10 @@ class TQualifier { { switch (packing) { case ElpStd140: return "std140"; -#ifndef GLSLANG_WEB case ElpPacked: return "packed"; case ElpShared: return "shared"; case ElpStd430: return "std430"; case ElpScalar: return "scalar"; -#endif default: return "none"; } } @@ -1192,9 +1131,6 @@ class TQualifier { default: return "none"; } } -#ifdef GLSLANG_WEB - static const char* getLayoutFormatString(TLayoutFormat f) { return "none"; } -#else static const char* getLayoutFormatString(TLayoutFormat f) { switch (f) { @@ -1241,6 +1177,11 @@ class TQualifier { case ElfR8ui: return "r8ui"; case ElfR64ui: return "r64ui"; case ElfR64i: return "r64i"; + case ElfSize1x8: return "size1x8"; + case ElfSize1x16: return "size1x16"; + case ElfSize1x32: return "size1x32"; + case ElfSize2x32: return "size2x32"; + case ElfSize4x32: return "size4x32"; default: return "none"; } } @@ -1343,7 +1284,6 @@ class TQualifier { default: return "none"; } } -#endif }; // Qualifiers that don't need to be keep per object. They have shader scope, not object scope. @@ -1360,10 +1300,12 @@ struct TShaderQualifiers { int localSize[3]; // compute shader bool localSizeNotDefault[3]; // compute shader int localSizeSpecId[3]; // compute shader specialization id for gl_WorkGroupSize -#ifndef GLSLANG_WEB bool earlyFragmentTests; // fragment input bool postDepthCoverage; // fragment input bool earlyAndLateFragmentTestsAMD; //fragment input + bool nonCoherentColorAttachmentReadEXT; // fragment input + bool nonCoherentDepthAttachmentReadEXT; // fragment input + bool nonCoherentStencilAttachmentReadEXT; // fragment input TLayoutDepth layoutDepth; TLayoutStencil layoutStencil; bool blendEquation; // true if any blend equation was specified @@ -1376,9 +1318,6 @@ struct TShaderQualifiers { bool layoutPrimitiveCulling; // true if layout primitive_culling set TLayoutDepth getDepth() const { return layoutDepth; } TLayoutStencil getStencil() const { return layoutStencil; } -#else - TLayoutDepth getDepth() const { return EldNone; } -#endif void init() { @@ -1399,10 +1338,12 @@ struct TShaderQualifiers { localSizeSpecId[0] = TQualifier::layoutNotSet; localSizeSpecId[1] = TQualifier::layoutNotSet; localSizeSpecId[2] = TQualifier::layoutNotSet; -#ifndef GLSLANG_WEB earlyFragmentTests = false; earlyAndLateFragmentTestsAMD = false; postDepthCoverage = false; + nonCoherentColorAttachmentReadEXT = false; + nonCoherentDepthAttachmentReadEXT = false; + nonCoherentStencilAttachmentReadEXT = false; layoutDepth = EldNone; layoutStencil = ElsNone; blendEquation = false; @@ -1413,14 +1354,9 @@ struct TShaderQualifiers { layoutPrimitiveCulling = false; primitives = TQualifier::layoutNotSet; interlockOrdering = EioNone; -#endif } -#ifdef GLSLANG_WEB - bool hasBlendEquation() const { return false; } -#else bool hasBlendEquation() const { return blendEquation; } -#endif // Merge in characteristics from the 'src' qualifier. They can override when // set, but never erase when not set. @@ -1453,13 +1389,18 @@ struct TShaderQualifiers { if (src.localSizeSpecId[i] != TQualifier::layoutNotSet) localSizeSpecId[i] = src.localSizeSpecId[i]; } -#ifndef GLSLANG_WEB if (src.earlyFragmentTests) earlyFragmentTests = true; if (src.earlyAndLateFragmentTestsAMD) earlyAndLateFragmentTestsAMD = true; if (src.postDepthCoverage) postDepthCoverage = true; + if (src.nonCoherentColorAttachmentReadEXT) + nonCoherentColorAttachmentReadEXT = true; + if (src.nonCoherentDepthAttachmentReadEXT) + nonCoherentDepthAttachmentReadEXT = true; + if (src.nonCoherentStencilAttachmentReadEXT) + nonCoherentStencilAttachmentReadEXT = true; if (src.layoutDepth) layoutDepth = src.layoutDepth; if (src.layoutStencil) @@ -1480,10 +1421,22 @@ struct TShaderQualifiers { interlockOrdering = src.interlockOrdering; if (src.layoutPrimitiveCulling) layoutPrimitiveCulling = src.layoutPrimitiveCulling; -#endif } }; +class TTypeParameters { +public: + POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) + + TTypeParameters() : basicType(EbtVoid), arraySizes(nullptr) {} + + TBasicType basicType; + TArraySizes *arraySizes; + + bool operator==(const TTypeParameters& rhs) const { return basicType == rhs.basicType && *arraySizes == *rhs.arraySizes; } + bool operator!=(const TTypeParameters& rhs) const { return basicType != rhs.basicType || *arraySizes != *rhs.arraySizes; } +}; + // // TPublicType is just temporarily used while parsing and not quite the same // information kept per node in TType. Due to the bison stack, it can't have @@ -1498,24 +1451,21 @@ class TPublicType { TSampler sampler; TQualifier qualifier; TShaderQualifiers shaderQualifiers; - int vectorSize : 4; - int matrixCols : 4; - int matrixRows : 4; - bool coopmat : 1; + int vectorSize : 4; + int matrixCols : 4; + int matrixRows : 4; + bool coopmatNV : 1; + bool coopmatKHR : 1; TArraySizes* arraySizes; const TType* userDef; TSourceLoc loc; - TArraySizes* typeParameters; -#ifndef GLSLANG_WEB + TTypeParameters* typeParameters; // SPIR-V type defined by spirv_type directive TSpirvType* spirvType; -#endif -#ifdef GLSLANG_WEB - bool isCoopmat() const { return false; } -#else - bool isCoopmat() const { return coopmat; } -#endif + bool isCoopmat() const { return coopmatNV || coopmatKHR; } + bool isCoopmatNV() const { return coopmatNV; } + bool isCoopmatKHR() const { return coopmatKHR; } void initType(const TSourceLoc& l) { @@ -1527,10 +1477,9 @@ class TPublicType { userDef = nullptr; loc = l; typeParameters = nullptr; - coopmat = false; -#ifndef GLSLANG_WEB + coopmatNV = false; + coopmatKHR = false; spirvType = nullptr; -#endif } void initQualifiers(bool global = false) @@ -1567,14 +1516,13 @@ class TPublicType { return matrixCols == 0 && vectorSize == 1 && arraySizes == nullptr && userDef == nullptr; } -#ifndef GLSLANG_WEB // GL_EXT_spirv_intrinsics void setSpirvType(const TSpirvInstruction& spirvInst, const TSpirvTypeParameters* typeParams = nullptr); -#endif // "Image" is a superset of "Subpass" - bool isImage() const { return basicType == EbtSampler && sampler.isImage(); } - bool isSubpass() const { return basicType == EbtSampler && sampler.isSubpass(); } + bool isImage() const { return basicType == EbtSampler && sampler.isImage(); } + bool isSubpass() const { return basicType == EbtSampler && sampler.isSubpass(); } + bool isAttachmentEXT() const { return basicType == EbtSampler && sampler.isAttachmentEXT(); } }; // @@ -1587,11 +1535,9 @@ class TType { // 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(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), coopmat(false), - arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif + basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), + arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr), + spirvType(nullptr) { sampler.clear(); qualifier.clear(); @@ -1601,11 +1547,9 @@ class TType { // 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(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), coopmat(false), - arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif + basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), + arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr), + spirvType(nullptr) { sampler.clear(); qualifier.clear(); @@ -1617,11 +1561,9 @@ class TType { // 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), coopmat(p.coopmat), - arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(p.typeParameters) -#ifndef GLSLANG_WEB - , spirvType(p.spirvType) -#endif + vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), coopmatNV(p.coopmatNV), coopmatKHR(p.coopmatKHR), coopmatKHRuse(-1), + arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(p.typeParameters), + spirvType(p.spirvType) { if (basicType == EbtSampler) sampler = p.sampler; @@ -1637,28 +1579,39 @@ class TType { } typeName = NewPoolTString(p.userDef->getTypeName().c_str()); } - if (p.isCoopmat() && p.typeParameters && p.typeParameters->getNumDims() > 0) { - int numBits = p.typeParameters->getDimSize(0); + if (p.isCoopmatNV() && p.typeParameters && p.typeParameters->arraySizes->getNumDims() > 0) { + int numBits = p.typeParameters->arraySizes->getDimSize(0); if (p.basicType == EbtFloat && numBits == 16) { basicType = EbtFloat16; qualifier.precision = EpqNone; } else if (p.basicType == EbtUint && numBits == 8) { basicType = EbtUint8; qualifier.precision = EpqNone; + } else if (p.basicType == EbtUint && numBits == 16) { + basicType = EbtUint16; + qualifier.precision = EpqNone; } else if (p.basicType == EbtInt && numBits == 8) { basicType = EbtInt8; qualifier.precision = EpqNone; + } else if (p.basicType == EbtInt && numBits == 16) { + basicType = EbtInt16; + qualifier.precision = EpqNone; + } + } + if (p.isCoopmatKHR() && p.typeParameters && p.typeParameters->arraySizes->getNumDims() > 0) { + basicType = p.typeParameters->basicType; + + if (p.typeParameters->arraySizes->getNumDims() == 4) { + coopmatKHRuse = p.typeParameters->arraySizes->getDimSize(3); + p.typeParameters->arraySizes->removeLastSize(); } } } // for construction of sampler types TType(const TSampler& sampler, TStorageQualifier q = EvqUniform, TArraySizes* as = nullptr) : - basicType(EbtSampler), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmat(false), + basicType(EbtSampler), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr), - sampler(sampler), typeParameters(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif + sampler(sampler), typeParameters(nullptr), spirvType(nullptr) { qualifier.clear(); qualifier.storage = q; @@ -1700,18 +1653,18 @@ class TType { vectorSize = 1; vector1 = false; } else if (isCoopMat()) { - coopmat = false; + coopmatNV = false; + coopmatKHR = false; + coopmatKHRuse = -1; typeParameters = nullptr; } } } // for making structures, ... TType(TTypeList* userDef, const TString& n) : - basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmat(false), - arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif + basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), + arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr), + spirvType(nullptr) { sampler.clear(); qualifier.clear(); @@ -1719,25 +1672,22 @@ class TType { } // For interface blocks TType(TTypeList* userDef, const TString& n, const TQualifier& q) : - basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmat(false), - qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif + basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), + qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr), + spirvType(nullptr) { sampler.clear(); typeName = NewPoolTString(n.c_str()); } // 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), - arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif + basicType(t), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), + arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr), + spirvType(nullptr) { assert(t == EbtReference); typeName = NewPoolTString(n.c_str()); + sampler.clear(); qualifier.clear(); qualifier.storage = p.qualifier.storage; referentType = p.clone(); @@ -1765,10 +1715,10 @@ class TType { referentType = copyOf.referentType; } typeParameters = copyOf.typeParameters; -#ifndef GLSLANG_WEB spirvType = copyOf.spirvType; -#endif - coopmat = copyOf.isCoopMat(); + coopmatNV = copyOf.isCoopMatNV(); + coopmatKHR = copyOf.isCoopMatKHR(); + coopmatKHRuse = copyOf.coopmatKHRuse; } // Make complete copy of the whole type graph rooted at 'copyOf'. @@ -1844,17 +1794,13 @@ class TType { virtual int getOuterArraySize() const { return arraySizes->getOuterSize(); } virtual TIntermTyped* getOuterArrayNode() const { return arraySizes->getOuterNode(); } virtual int getCumulativeArraySize() const { return arraySizes->getCumulativeSize(); } -#ifdef GLSLANG_WEB - bool isArrayOfArrays() const { return false; } -#else bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; } -#endif virtual int getImplicitArraySize() const { return arraySizes->getImplicitSize(); } virtual const TArraySizes* getArraySizes() const { return arraySizes; } virtual TArraySizes* getArraySizes() { return arraySizes; } virtual TType* getReferentType() const { return referentType; } - virtual const TArraySizes* getTypeParameters() const { return typeParameters; } - virtual TArraySizes* getTypeParameters() { return typeParameters; } + virtual const TTypeParameters* getTypeParameters() const { return typeParameters; } + virtual TTypeParameters* getTypeParameters() { return typeParameters; } virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray(); } virtual bool isScalarOrVec1() const { return isScalar() || vector1; } @@ -1864,9 +1810,11 @@ class TType { virtual bool isArray() const { return arraySizes != nullptr; } virtual bool isSizedArray() const { return isArray() && arraySizes->isSized(); } virtual bool isUnsizedArray() const { return isArray() && !arraySizes->isSized(); } + virtual bool isImplicitlySizedArray() const { return isArray() && arraySizes->isImplicitlySized(); } virtual bool isArrayVariablyIndexed() const { assert(isArray()); return arraySizes->isVariablyIndexed(); } virtual void setArrayVariablyIndexed() { assert(isArray()); arraySizes->setVariablyIndexed(); } virtual void updateImplicitArraySize(int size) { assert(isArray()); arraySizes->updateImplicitSize(size); } + virtual void setImplicitlySized(bool isImplicitSized) { arraySizes->setImplicitlySized(isImplicitSized); } virtual bool isStruct() const { return basicType == EbtStruct || basicType == EbtBlock; } virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble || basicType == EbtFloat16; } virtual bool isIntegerDomain() const @@ -1888,30 +1836,26 @@ class TType { return false; } virtual bool isOpaque() const { return basicType == EbtSampler -#ifndef GLSLANG_WEB || basicType == EbtAtomicUint || basicType == EbtAccStruct || basicType == EbtRayQuery -#endif - ; } + || basicType == EbtHitObjectNV; } virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; } - // "Image" is a superset of "Subpass" - virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); } + virtual bool isAttachmentEXT() const { return basicType == EbtSampler && getSampler().isAttachmentEXT(); } + virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); } virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); } virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); } + virtual bool isBindlessImage() const { return isImage() && qualifier.layoutBindlessImage; } + virtual bool isBindlessTexture() const { return isTexture() && qualifier.layoutBindlessSampler; } // Check the block-name convention of creating a block without populating it's members: virtual bool isUnusableName() const { return isStruct() && structure == nullptr; } virtual bool isParameterized() const { return typeParameters != nullptr; } -#ifdef GLSLANG_WEB - bool isAtomic() const { return false; } - bool isCoopMat() const { return false; } - bool isReference() const { return false; } - bool isSpirvType() const { return false; } -#else bool isAtomic() const { return basicType == EbtAtomicUint; } - bool isCoopMat() const { return coopmat; } + bool isCoopMat() const { return coopmatNV || coopmatKHR; } + bool isCoopMatNV() const { return coopmatNV; } + bool isCoopMatKHR() const { return coopmatKHR; } bool isReference() const { return getBasicType() == EbtReference; } bool isSpirvType() const { return getBasicType() == EbtSpirvType; } -#endif + int getCoopMatKHRuse() const { return coopmatKHRuse; } // return true if this type contains any subtype which satisfies the given predicate. template @@ -1954,6 +1898,11 @@ class TType { return contains([](const TType* t) { return t->isOpaque(); } ); } + virtual bool containsSampler() const + { + return contains([](const TType* t) { return t->isTexture() || t->isImage(); }); + } + // Recursively checks if the type contains a built-in variable virtual bool containsBuiltIn() const { @@ -1992,15 +1941,6 @@ class TType { return contains([](const TType* t) { return t->isArray() && t->arraySizes->isOuterSpecialization(); } ); } -#ifdef GLSLANG_WEB - bool containsDouble() const { return false; } - bool contains16BitFloat() const { return false; } - bool contains64BitInt() const { return false; } - bool contains16BitInt() const { return false; } - bool contains8BitInt() const { return false; } - bool containsCoopMat() const { return false; } - bool containsReference() const { return false; } -#else bool containsDouble() const { return containsBasicType(EbtDouble); @@ -2023,13 +1963,12 @@ class TType { } bool containsCoopMat() const { - return contains([](const TType* t) { return t->coopmat; } ); + return contains([](const TType* t) { return t->coopmatNV || t->coopmatKHR; } ); } bool containsReference() const { return containsBasicType(EbtReference); } -#endif // Array editing methods. Array descriptors can be shared across // type instances. This allows all uses of the same array @@ -2087,8 +2026,12 @@ class TType { // an explicit array. void adoptImplicitArraySizes(bool skipNonvariablyIndexed) { - if (isUnsizedArray() && !(skipNonvariablyIndexed || isArrayVariablyIndexed())) + if (isUnsizedArray() && + (qualifier.builtIn == EbvSampleMask || + !(skipNonvariablyIndexed || isArrayVariablyIndexed()))) { changeOuterArraySize(getImplicitArraySize()); + setImplicitlySized(true); + } // For multi-dim per-view arrays, set unsized inner dimension size to 1 if (qualifier.isPerView() && arraySizes && arraySizes->isInnerUnsized()) arraySizes->clearInnerUnsized(); @@ -2101,43 +2044,12 @@ class TType { } } - - void updateTypeParameters(const TType& type) - { - // For when we may already be sharing existing array descriptors, - // keeping the pointers the same, just updating the contents. - assert(typeParameters != nullptr); - assert(type.typeParameters != nullptr); - *typeParameters = *type.typeParameters; - } - void copyTypeParameters(const TArraySizes& s) + void copyTypeParameters(const TTypeParameters& s) { // For setting a fresh new set of type parameters, not yet worrying about sharing. - typeParameters = new TArraySizes; + typeParameters = new TTypeParameters; *typeParameters = s; } - void transferTypeParameters(TArraySizes* s) - { - // For setting an already allocated set of sizes that this type can use - // (no copy made). - typeParameters = s; - } - void clearTypeParameters() - { - typeParameters = nullptr; - } - - // Add inner array sizes, to any existing sizes, via copy; the - // sizes passed in can still be reused for other purposes. - void copyTypeParametersInnerSizes(const TArraySizes* s) - { - if (s != nullptr) { - if (typeParameters == nullptr) - copyTypeParameters(*s); - else - typeParameters->addInnerSizes(*s); - } - } const char* getBasicString() const { @@ -2151,7 +2063,6 @@ class TType { case EbtInt: return "int"; case EbtUint: return "uint"; case EbtSampler: return "sampler/image"; -#ifndef GLSLANG_WEB case EbtVoid: return "void"; case EbtDouble: return "double"; case EbtFloat16: return "float16_t"; @@ -2170,18 +2081,11 @@ class TType { case EbtReference: return "reference"; case EbtString: return "string"; case EbtSpirvType: return "spirv_type"; -#endif + case EbtCoopmat: return "coopmat"; default: return "unknown type"; } } -#ifdef GLSLANG_WEB - TString getCompleteString() const { return ""; } - const char* getStorageQualifierString() const { return ""; } - const char* getBuiltInVariableString() const { return ""; } - const char* getPrecisionQualifierString() const { return ""; } - TString getBasicTypeString() const { return ""; } -#else TString getCompleteString(bool syntactic = false, bool getQualifiers = true, bool getPrecision = true, bool getType = true, TString name = "", TString structName = "") const { @@ -2283,8 +2187,16 @@ class TType { appendStr(" layoutSecondaryViewportRelativeOffset="); appendInt(qualifier.layoutSecondaryViewportRelativeOffset); } + if (qualifier.layoutShaderRecord) appendStr(" shaderRecordNV"); + if (qualifier.layoutHitObjectShaderRecordNV) + appendStr(" hitobjectshaderrecordnv"); + + if (qualifier.layoutBindlessSampler) + appendStr(" layoutBindlessSampler"); + if (qualifier.layoutBindlessImage) + appendStr(" layoutBindlessImage"); appendStr(")"); } @@ -2472,12 +2384,21 @@ class TType { } } if (isParameterized()) { + if (isCoopMatKHR()) { + appendStr(" "); + appendStr("coopmat"); + } + appendStr("<"); - for (int i = 0; i < (int)typeParameters->getNumDims(); ++i) { - appendInt(typeParameters->getDimSize(i)); - if (i != (int)typeParameters->getNumDims() - 1) + for (int i = 0; i < (int)typeParameters->arraySizes->getNumDims(); ++i) { + appendInt(typeParameters->arraySizes->getDimSize(i)); + if (i != (int)typeParameters->arraySizes->getNumDims() - 1) appendStr(", "); } + if (coopmatKHRuse != -1) { + appendStr(", "); + appendInt(coopmatKHRuse); + } appendStr(">"); } if (getPrecision && qualifier.precision != EpqNone) { @@ -2538,12 +2459,12 @@ class TType { const char* getStorageQualifierString() const { return GetStorageQualifierString(qualifier.storage); } const char* getBuiltInVariableString() const { return GetBuiltInVariableString(qualifier.builtIn); } const char* getPrecisionQualifierString() const { return GetPrecisionQualifierString(qualifier.precision); } -#endif const TTypeList* getStruct() const { assert(isStruct()); return structure; } void setStruct(TTypeList* s) { assert(isStruct()); structure = s; } TTypeList* getWritableStruct() const { assert(isStruct()); return structure; } // This should only be used when known to not be sharing with other threads void setBasicType(const TBasicType& t) { basicType = t; } + void setVectorSize(int s) { vectorSize = s; } int computeNumComponents() const { @@ -2711,7 +2632,10 @@ class TType { bool sameArrayness(const TType& right) const { return ((arraySizes == nullptr && right.arraySizes == nullptr) || - (arraySizes != nullptr && right.arraySizes != nullptr && *arraySizes == *right.arraySizes)); + (arraySizes != nullptr && right.arraySizes != nullptr && + (*arraySizes == *right.arraySizes || + (arraySizes->isImplicitlySized() && right.arraySizes->isDefaultImplicitlySized()) || + (right.arraySizes->isImplicitlySized() && arraySizes->isDefaultImplicitlySized())))); } // See if two type's arrayness match in everything except their outer dimension @@ -2728,14 +2652,12 @@ class TType { (typeParameters != nullptr && right.typeParameters != nullptr && *typeParameters == *right.typeParameters)); } -#ifndef GLSLANG_WEB // See if two type's SPIR-V type contents match bool sameSpirvType(const TType& right) const { return ((spirvType == nullptr && right.spirvType == nullptr) || (spirvType != nullptr && right.spirvType != nullptr && *spirvType == *right.spirvType)); } -#endif // See if two type's elements match in all ways except basic type // If mismatch in structure members, return member indices in lpidx and rpidx. @@ -2750,7 +2672,8 @@ class TType { matrixCols == right.matrixCols && matrixRows == right.matrixRows && vector1 == right.vector1 && - isCoopMat() == right.isCoopMat() && + isCoopMatNV() == right.isCoopMatNV() && + isCoopMatKHR() == right.isCoopMatKHR() && sameStructType(right, lpidx, rpidx) && sameReferenceType(right); } @@ -2759,32 +2682,69 @@ class TType { // an OK function parameter bool coopMatParameterOK(const TType& right) const { - return isCoopMat() && right.isCoopMat() && (getBasicType() == right.getBasicType()) && - typeParameters == nullptr && right.typeParameters != nullptr; + if (isCoopMatNV()) { + return right.isCoopMatNV() && (getBasicType() == right.getBasicType()) && typeParameters == nullptr && + right.typeParameters != nullptr; + } + if (isCoopMatKHR() && right.isCoopMatKHR()) { + return ((getBasicType() == right.getBasicType()) || (getBasicType() == EbtCoopmat) || + (right.getBasicType() == EbtCoopmat)) && + typeParameters == nullptr && right.typeParameters != nullptr; + } + return false; } bool sameCoopMatBaseType(const TType &right) const { - bool rv = coopmat && right.coopmat; - if (getBasicType() == EbtFloat || getBasicType() == EbtFloat16) - rv = right.getBasicType() == EbtFloat || right.getBasicType() == EbtFloat16; - else if (getBasicType() == EbtUint || getBasicType() == EbtUint8) - rv = right.getBasicType() == EbtUint || right.getBasicType() == EbtUint8; - else if (getBasicType() == EbtInt || getBasicType() == EbtInt8) - rv = right.getBasicType() == EbtInt || right.getBasicType() == EbtInt8; - else - rv = false; + bool rv = false; + + if (isCoopMatNV()) { + rv = isCoopMatNV() && right.isCoopMatNV(); + if (getBasicType() == EbtFloat || getBasicType() == EbtFloat16) + rv = right.getBasicType() == EbtFloat || right.getBasicType() == EbtFloat16; + else if (getBasicType() == EbtUint || getBasicType() == EbtUint8 || getBasicType() == EbtUint16) + rv = right.getBasicType() == EbtUint || right.getBasicType() == EbtUint8 || right.getBasicType() == EbtUint16; + else if (getBasicType() == EbtInt || getBasicType() == EbtInt8 || getBasicType() == EbtInt16) + rv = right.getBasicType() == EbtInt || right.getBasicType() == EbtInt8 || right.getBasicType() == EbtInt16; + else + rv = false; + } else if (isCoopMatKHR() && right.isCoopMatKHR()) { + if (getBasicType() == EbtFloat || getBasicType() == EbtFloat16) + rv = right.getBasicType() == EbtFloat || right.getBasicType() == EbtFloat16 || right.getBasicType() == EbtCoopmat; + else if (getBasicType() == EbtUint || getBasicType() == EbtUint8 || getBasicType() == EbtUint16) + rv = right.getBasicType() == EbtUint || right.getBasicType() == EbtUint8 || right.getBasicType() == EbtUint16 || right.getBasicType() == EbtCoopmat; + else if (getBasicType() == EbtInt || getBasicType() == EbtInt8 || getBasicType() == EbtInt16) + rv = right.getBasicType() == EbtInt || right.getBasicType() == EbtInt8 || right.getBasicType() == EbtInt16 || right.getBasicType() == EbtCoopmat; + else + rv = false; + } return rv; } + bool sameCoopMatUse(const TType &right) const { + return coopmatKHRuse == right.coopmatKHRuse; + } + + bool sameCoopMatShapeAndUse(const TType &right) const + { + if (!isCoopMat() || !right.isCoopMat() || isCoopMatKHR() != right.isCoopMatKHR()) + return false; + + if (coopmatKHRuse != right.coopmatKHRuse) + return false; + + // Skip bit width type parameter (first array size) for coopmatNV + int firstArrayDimToCompare = isCoopMatNV() ? 1 : 0; + for (int i = firstArrayDimToCompare; i < typeParameters->arraySizes->getNumDims(); ++i) { + if (typeParameters->arraySizes->getDimSize(i) != right.typeParameters->arraySizes->getDimSize(i)) + return false; + } + return true; + } // See if two types match in all ways (just the actual type, not qualification) bool operator==(const TType& right) const { -#ifndef GLSLANG_WEB - return sameElementType(right) && sameArrayness(right) && sameTypeParameters(right) && sameSpirvType(right); -#else - return sameElementType(right) && sameArrayness(right) && sameTypeParameters(right); -#endif + return sameElementType(right) && sameArrayness(right) && sameTypeParameters(right) && sameCoopMatUse(right) && sameSpirvType(right); } bool operator!=(const TType& right) const @@ -2794,18 +2754,14 @@ class TType { unsigned int getBufferReferenceAlignment() const { -#ifndef GLSLANG_WEB if (getBasicType() == glslang::EbtReference) { return getReferentType()->getQualifier().hasBufferReferenceAlign() ? (1u << getReferentType()->getQualifier().layoutBufferReferenceAlign) : 16u; } -#endif return 0; } -#ifndef GLSLANG_WEB const TSpirvType& getSpirvType() const { assert(spirvType); return *spirvType; } -#endif protected: // Require consumer to pick between deep copy and shallow copy. @@ -2819,7 +2775,6 @@ class TType { { shallowCopy(copyOf); -#ifndef GLSLANG_WEB // GL_EXT_spirv_intrinsics if (copyOf.qualifier.spirvDecorate) { qualifier.spirvDecorate = new TSpirvDecorate; @@ -2830,7 +2785,6 @@ class TType { spirvType = new TSpirvType; *spirvType = *copyOf.spirvType; } -#endif if (copyOf.arraySizes) { arraySizes = new TArraySizes; @@ -2838,8 +2792,10 @@ class TType { } if (copyOf.typeParameters) { - typeParameters = new TArraySizes; - *typeParameters = *copyOf.typeParameters; + typeParameters = new TTypeParameters; + typeParameters->arraySizes = new TArraySizes; + *typeParameters->arraySizes = *copyOf.typeParameters->arraySizes; + typeParameters->basicType = copyOf.basicType; } if (copyOf.isStruct() && copyOf.structure) { @@ -2877,7 +2833,9 @@ class TType { // functionality is added. // HLSL does have a 1-component vectors, so this will be true to disambiguate // from a scalar. - bool coopmat : 1; + bool coopmatNV : 1; + bool coopmatKHR : 1; + int coopmatKHRuse : 4; // Accepts one of three values: 0, 1, 2 (gl_MatrixUseA, gl_MatrixUseB, gl_MatrixUseAccumulator) TQualifier qualifier; TArraySizes* arraySizes; // nullptr unless an array; can be shared across types @@ -2890,10 +2848,8 @@ class TType { TString *fieldName; // for structure field names TString *typeName; // for structure type name TSampler sampler; - TArraySizes* typeParameters;// nullptr unless a parameterized type; can be shared across types -#ifndef GLSLANG_WEB + TTypeParameters *typeParameters;// nullptr unless a parameterized type; can be shared across types TSpirvType* spirvType; // SPIR-V type defined by spirv_type directive -#endif }; } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/glslang/Include/arrays.h b/bgfx/3rdparty/glslang/glslang/Include/arrays.h index 7f047d9f..91e19083 100644 --- a/bgfx/3rdparty/glslang/glslang/Include/arrays.h +++ b/bgfx/3rdparty/glslang/glslang/Include/arrays.h @@ -147,6 +147,15 @@ struct TSmallArrayVector { sizes->erase(sizes->begin()); } + void pop_back() + { + assert(sizes != nullptr && sizes->size() > 0); + if (sizes->size() == 1) + dealloc(); + else + sizes->resize(sizes->size() - 1); + } + // 'this' should currently not be holding anything, and copyNonFront // will make it hold a copy of all but the first element of rhs. // (This would be useful for making a type that is dereferenced by @@ -222,7 +231,7 @@ struct TSmallArrayVector { struct TArraySizes { POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - TArraySizes() : implicitArraySize(1), variablyIndexed(false) { } + TArraySizes() : implicitArraySize(0), implicitlySized(true), variablyIndexed(false){ } // For breaking into two non-shared copies, independently modifiable. TArraySizes& operator=(const TArraySizes& from) @@ -230,6 +239,7 @@ struct TArraySizes { implicitArraySize = from.implicitArraySize; variablyIndexed = from.variablyIndexed; sizes = from.sizes; + implicitlySized = from.implicitlySized; return *this; } @@ -256,11 +266,17 @@ struct TArraySizes { void addInnerSize(int s, TIntermTyped* n) { sizes.push_back((unsigned)s, n); } void addInnerSize(TArraySize pair) { sizes.push_back(pair.size, pair.node); + implicitlySized = false; } void addInnerSizes(const TArraySizes& s) { sizes.push_back(s.sizes); } - void changeOuterSize(int s) { sizes.changeFront((unsigned)s); } - int getImplicitSize() const { return implicitArraySize; } - void updateImplicitSize(int s) { implicitArraySize = std::max(implicitArraySize, s); } + void changeOuterSize(int s) { + sizes.changeFront((unsigned)s); + implicitlySized = false; + } + int getImplicitSize() const { return implicitArraySize > 0 ? implicitArraySize : 1; } + void updateImplicitSize(int s) { + implicitArraySize = (std::max)(implicitArraySize, s); + } bool isInnerUnsized() const { for (int d = 1; d < sizes.size(); ++d) { @@ -295,7 +311,11 @@ struct TArraySizes { bool hasUnsized() const { return getOuterSize() == UnsizedArraySize || isInnerUnsized(); } bool isSized() const { return getOuterSize() != UnsizedArraySize; } + bool isImplicitlySized() const { return implicitlySized; } + bool isDefaultImplicitlySized() const { return implicitlySized && implicitArraySize == 0; } + void setImplicitlySized(bool isImplicitSizing) { implicitlySized = isImplicitSizing; } void dereference() { sizes.pop_front(); } + void removeLastSize() { sizes.pop_back(); } void copyDereferenced(const TArraySizes& rhs) { assert(sizes.size() == 0); @@ -333,6 +353,7 @@ struct TArraySizes { // the implicit size of the array, if not variably indexed and // otherwise legal. int implicitArraySize; + bool implicitlySized; bool variablyIndexed; // true if array is indexed with a non compile-time constant }; diff --git a/bgfx/3rdparty/glslang/glslang/Include/glslang_c_interface.h b/bgfx/3rdparty/glslang/glslang/Include/glslang_c_interface.h index 9e5608c5..fd636cf5 100644 --- a/bgfx/3rdparty/glslang/glslang/Include/glslang_c_interface.h +++ b/bgfx/3rdparty/glslang/glslang/Include/glslang_c_interface.h @@ -157,28 +157,17 @@ typedef struct glslang_resource_s { int max_task_work_group_size_y_ext; int max_task_work_group_size_z_ext; int max_mesh_view_count_ext; - int maxDualSourceDrawBuffersEXT; + union + { + int max_dual_source_draw_buffers_ext; + + /* Incorrectly capitalized name retained for backward compatibility */ + int maxDualSourceDrawBuffersEXT; + }; glslang_limits_t limits; } glslang_resource_t; -typedef struct glslang_input_s { - glslang_source_t language; - glslang_stage_t stage; - glslang_client_t client; - glslang_target_client_version_t client_version; - glslang_target_language_t target_language; - glslang_target_language_version_t target_language_version; - /** Shader source code */ - const char* code; - int default_version; - glslang_profile_t default_profile; - int force_default_version_and_profile; - int forward_compatible; - glslang_messages_t messages; - const glslang_resource_t* resource; -} glslang_input_t; - /* Inclusion result structure allocated by C include_local/include_system callbacks */ typedef struct glsl_include_result_s { /* Header file name or NULL if inclusion failed */ @@ -208,6 +197,25 @@ typedef struct glsl_include_callbacks_s { glsl_free_include_result_func free_include_result; } glsl_include_callbacks_t; +typedef struct glslang_input_s { + glslang_source_t language; + glslang_stage_t stage; + glslang_client_t client; + glslang_target_client_version_t client_version; + glslang_target_language_t target_language; + glslang_target_language_version_t target_language_version; + /** Shader source code */ + const char* code; + int default_version; + glslang_profile_t default_profile; + int force_default_version_and_profile; + int forward_compatible; + glslang_messages_t messages; + const glslang_resource_t* resource; + glsl_include_callbacks_t callbacks; + void* callbacks_ctx; +} glslang_input_t; + /* SpvOptions counterpart */ typedef struct glslang_spv_options_s { bool generate_debug_info; @@ -240,11 +248,12 @@ extern "C" { #define GLSLANG_EXPORT #endif -GLSLANG_EXPORT int glslang_initialize_process(); -GLSLANG_EXPORT void glslang_finalize_process(); +GLSLANG_EXPORT int glslang_initialize_process(void); +GLSLANG_EXPORT void glslang_finalize_process(void); GLSLANG_EXPORT glslang_shader_t* glslang_shader_create(const glslang_input_t* input); GLSLANG_EXPORT void glslang_shader_delete(glslang_shader_t* shader); +GLSLANG_EXPORT void glslang_shader_set_preamble(glslang_shader_t* shader, const char* s); GLSLANG_EXPORT void glslang_shader_shift_binding(glslang_shader_t* shader, glslang_resource_type_t res, unsigned int base); GLSLANG_EXPORT void glslang_shader_shift_binding_for_set(glslang_shader_t* shader, glslang_resource_type_t res, unsigned int base, unsigned int set); GLSLANG_EXPORT void glslang_shader_set_options(glslang_shader_t* shader, int options); // glslang_shader_options_t @@ -255,7 +264,7 @@ GLSLANG_EXPORT const char* glslang_shader_get_preprocessed_code(glslang_shader_t GLSLANG_EXPORT const char* glslang_shader_get_info_log(glslang_shader_t* shader); GLSLANG_EXPORT const char* glslang_shader_get_info_debug_log(glslang_shader_t* shader); -GLSLANG_EXPORT glslang_program_t* glslang_program_create(); +GLSLANG_EXPORT glslang_program_t* glslang_program_create(void); GLSLANG_EXPORT void glslang_program_delete(glslang_program_t* program); GLSLANG_EXPORT void glslang_program_add_shader(glslang_program_t* program, glslang_shader_t* shader); GLSLANG_EXPORT int glslang_program_link(glslang_program_t* program, int messages); // glslang_messages_t diff --git a/bgfx/3rdparty/glslang/glslang/Include/intermediate.h b/bgfx/3rdparty/glslang/glslang/Include/intermediate.h index a0240028..604f08b6 100644 --- a/bgfx/3rdparty/glslang/glslang/Include/intermediate.h +++ b/bgfx/3rdparty/glslang/glslang/Include/intermediate.h @@ -72,9 +72,7 @@ enum TOperator { EOpFunctionCall, EOpFunction, // For function definition EOpParameters, // an aggregate listing the parameters to a function -#ifndef GLSLANG_WEB EOpSpirvInst, -#endif // // Unary operators @@ -629,6 +627,9 @@ enum TOperator { EOpCooperativeMatrixLoad, EOpCooperativeMatrixStore, EOpCooperativeMatrixMulAdd, + EOpCooperativeMatrixLoadNV, + EOpCooperativeMatrixStoreNV, + EOpCooperativeMatrixMulAddNV, EOpBeginInvocationInterlock, // Fragment only EOpEndInvocationInterlock, // Fragment only @@ -766,7 +767,8 @@ enum TOperator { EOpConstructTextureSampler, EOpConstructNonuniform, // expected to be transformed away, not present in final AST EOpConstructReference, - EOpConstructCooperativeMatrix, + EOpConstructCooperativeMatrixNV, + EOpConstructCooperativeMatrixKHR, EOpConstructAccStruct, EOpConstructGuardEnd, @@ -827,6 +829,7 @@ enum TOperator { EOpSubpassLoadMS, EOpSparseImageLoad, EOpSparseImageLoadLod, + EOpColorAttachmentReadEXT, // Fragment only EOpImageGuardEnd, @@ -968,7 +971,42 @@ enum TOperator { EOpRayQueryGetIntersectionObjectToWorld, EOpRayQueryGetIntersectionWorldToObject, + // + // GL_NV_shader_invocation_reorder // + + EOpHitObjectTraceRayNV, + EOpHitObjectTraceRayMotionNV, + EOpHitObjectRecordHitNV, + EOpHitObjectRecordHitMotionNV, + EOpHitObjectRecordHitWithIndexNV, + EOpHitObjectRecordHitWithIndexMotionNV, + EOpHitObjectRecordMissNV, + EOpHitObjectRecordMissMotionNV, + EOpHitObjectRecordEmptyNV, + EOpHitObjectExecuteShaderNV, + EOpHitObjectIsEmptyNV, + EOpHitObjectIsMissNV, + EOpHitObjectIsHitNV, + EOpHitObjectGetRayTMinNV, + EOpHitObjectGetRayTMaxNV, + EOpHitObjectGetObjectRayOriginNV, + EOpHitObjectGetObjectRayDirectionNV, + EOpHitObjectGetWorldRayOriginNV, + EOpHitObjectGetWorldRayDirectionNV, + EOpHitObjectGetWorldToObjectNV, + EOpHitObjectGetObjectToWorldNV, + EOpHitObjectGetInstanceCustomIndexNV, + EOpHitObjectGetInstanceIdNV, + EOpHitObjectGetGeometryIndexNV, + EOpHitObjectGetPrimitiveIndexNV, + EOpHitObjectGetHitKindNV, + EOpHitObjectGetShaderBindingTableRecordIndexNV, + EOpHitObjectGetShaderRecordBufferHandleNV, + EOpHitObjectGetAttributesNV, + EOpHitObjectGetCurrentTimeNV, + EOpReorderThreadNV, + // HLSL operations // @@ -1055,6 +1093,19 @@ enum TOperator { // Shader Clock Ops EOpReadClockSubgroupKHR, EOpReadClockDeviceKHR, + + // GL_EXT_ray_tracing_position_fetch + EOpRayQueryGetIntersectionTriangleVertexPositionsEXT, + + // Shader tile image ops + EOpStencilAttachmentReadEXT, // Fragment only + EOpDepthAttachmentReadEXT, // Fragment only + + // Image processing + EOpImageSampleWeightedQCOM, + EOpImageBoxFilterQCOM, + EOpImageBlockMatchSADQCOM, + EOpImageBlockMatchSSDQCOM, }; class TIntermTraverser; @@ -1086,31 +1137,31 @@ class TIntermNode { 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::TIntermTyped* getAsTyped() { return 0; } - virtual glslang::TIntermOperator* getAsOperator() { return 0; } - virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return 0; } - virtual glslang::TIntermAggregate* getAsAggregate() { return 0; } - virtual glslang::TIntermUnary* getAsUnaryNode() { return 0; } - virtual glslang::TIntermBinary* getAsBinaryNode() { return 0; } - virtual glslang::TIntermSelection* getAsSelectionNode() { return 0; } - virtual glslang::TIntermSwitch* getAsSwitchNode() { return 0; } - virtual glslang::TIntermMethod* getAsMethodNode() { return 0; } - virtual glslang::TIntermSymbol* getAsSymbolNode() { return 0; } - virtual glslang::TIntermBranch* getAsBranchNode() { return 0; } - virtual glslang::TIntermLoop* getAsLoopNode() { return 0; } - - virtual const glslang::TIntermTyped* getAsTyped() const { return 0; } - virtual const glslang::TIntermOperator* getAsOperator() const { return 0; } - virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return 0; } - virtual const glslang::TIntermAggregate* getAsAggregate() const { return 0; } - virtual const glslang::TIntermUnary* getAsUnaryNode() const { return 0; } - virtual const glslang::TIntermBinary* getAsBinaryNode() const { return 0; } - virtual const glslang::TIntermSelection* getAsSelectionNode() const { return 0; } - virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return 0; } - virtual const glslang::TIntermMethod* getAsMethodNode() const { return 0; } - virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return 0; } - virtual const glslang::TIntermBranch* getAsBranchNode() const { return 0; } - virtual const glslang::TIntermLoop* getAsLoopNode() const { return 0; } + virtual glslang::TIntermTyped* getAsTyped() { return nullptr; } + virtual glslang::TIntermOperator* getAsOperator() { return nullptr; } + virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return nullptr; } + virtual glslang::TIntermAggregate* getAsAggregate() { return nullptr; } + virtual glslang::TIntermUnary* getAsUnaryNode() { return nullptr; } + virtual glslang::TIntermBinary* getAsBinaryNode() { return nullptr; } + virtual glslang::TIntermSelection* getAsSelectionNode() { return nullptr; } + virtual glslang::TIntermSwitch* getAsSwitchNode() { return nullptr; } + virtual glslang::TIntermMethod* getAsMethodNode() { return nullptr; } + virtual glslang::TIntermSymbol* getAsSymbolNode() { return nullptr; } + virtual glslang::TIntermBranch* getAsBranchNode() { return nullptr; } + virtual glslang::TIntermLoop* getAsLoopNode() { 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; } + virtual const glslang::TIntermAggregate* getAsAggregate() const { return nullptr; } + virtual const glslang::TIntermUnary* getAsUnaryNode() const { return nullptr; } + virtual const glslang::TIntermBinary* getAsBinaryNode() const { return nullptr; } + virtual const glslang::TIntermSelection* getAsSelectionNode() const { return nullptr; } + virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return nullptr; } + virtual const glslang::TIntermMethod* getAsMethodNode() const { return nullptr; } + virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return nullptr; } + virtual const glslang::TIntermBranch* getAsBranchNode() const { return nullptr; } + virtual const glslang::TIntermLoop* getAsLoopNode() const { return nullptr; } virtual ~TIntermNode() { } protected: @@ -1288,12 +1339,7 @@ class TIntermSymbol : public TIntermTyped { // per process threadPoolAllocator, then it causes increased memory usage per compile // it is essential to use "symbol = sym" to assign to symbol TIntermSymbol(long long i, const TString& n, const TType& t) - : TIntermTyped(t), id(i), -#ifndef GLSLANG_WEB - flattenSubset(-1), -#endif - constSubtree(nullptr) - { name = n; } + : TIntermTyped(t), id(i), flattenSubset(-1), constSubtree(nullptr) { name = n; } virtual long long getId() const { return id; } virtual void changeId(long long i) { id = i; } virtual const TString& getName() const { return name; } @@ -1304,12 +1350,10 @@ class TIntermSymbol : public TIntermTyped { const TConstUnionArray& getConstArray() const { return constArray; } void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; } TIntermTyped* getConstSubtree() const { return constSubtree; } -#ifndef GLSLANG_WEB void setFlattenSubset(int subset) { flattenSubset = subset; } virtual const TString& getAccessName() const; int getFlattenSubset() const { return flattenSubset; } // -1 means full object -#endif // This is meant for cases where a node has already been constructed, and // later on, it becomes necessary to switch to a different symbol. @@ -1317,9 +1361,7 @@ class TIntermSymbol : public TIntermTyped { protected: long long id; // the unique id of the symbol this node represents -#ifndef GLSLANG_WEB int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced -#endif TString name; // the name of the symbol this node represents TConstUnionArray constArray; // if the symbol is a front-end compile-time constant, this is its value TIntermTyped* constSubtree; @@ -1358,6 +1400,7 @@ struct TCrackedTextureOp { bool subpass; bool lodClamp; bool fragMask; + bool attachmentEXT; }; // @@ -1373,19 +1416,11 @@ class TIntermOperator : public TIntermTyped { bool isConstructor() const; bool isTexture() const { return op > EOpTextureGuardBegin && op < EOpTextureGuardEnd; } bool isSampling() const { return op > EOpSamplingGuardBegin && op < EOpSamplingGuardEnd; } -#ifdef GLSLANG_WEB - bool isImage() const { return false; } - bool isSparseTexture() const { return false; } - bool isImageFootprint() const { return false; } - bool isSparseImage() const { return false; } - bool isSubgroup() const { return false; } -#else bool isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; } bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; } bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; } bool isSparseImage() const { return op == EOpSparseImageLoad; } bool isSubgroup() const { return op > EOpSubgroupGuardStart && op < EOpSubgroupGuardStop; } -#endif void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; } TPrecisionQualifier getOperationPrecision() const { return operationPrecision != EpqNone ? @@ -1414,6 +1449,7 @@ class TIntermOperator : public TIntermTyped { cracked.gather = false; cracked.grad = false; cracked.subpass = false; + cracked.attachmentEXT = false; cracked.lodClamp = false; cracked.fragMask = false; @@ -1490,7 +1526,6 @@ class TIntermOperator : public TIntermTyped { cracked.offset = true; cracked.proj = true; break; -#ifndef GLSLANG_WEB case EOpTextureClamp: case EOpSparseTextureClamp: cracked.lodClamp = true; @@ -1574,7 +1609,9 @@ class TIntermOperator : public TIntermTyped { case EOpSubpassLoadMS: cracked.subpass = true; break; -#endif + case EOpColorAttachmentReadEXT: + cracked.attachmentEXT = true; + break; default: break; } @@ -1616,8 +1653,8 @@ class TIntermBinary : public TIntermOperator { // class TIntermUnary : public TIntermOperator { public: - TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {} - TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {} + TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(nullptr) {} + TIntermUnary(TOperator o) : TIntermOperator(o), operand(nullptr) {} virtual void traverse(TIntermTraverser*); virtual void setOperand(TIntermTyped* o) { operand = o; } virtual TIntermTyped* getOperand() { return operand; } @@ -1625,15 +1662,11 @@ class TIntermUnary : public TIntermOperator { virtual TIntermUnary* getAsUnaryNode() { return this; } virtual const TIntermUnary* getAsUnaryNode() const { return this; } virtual void updatePrecision(); -#ifndef GLSLANG_WEB void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; } const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; } -#endif protected: TIntermTyped* operand; -#ifndef GLSLANG_WEB TSpirvInstruction spirvInst; -#endif }; typedef TVector TIntermSequence; @@ -1665,10 +1698,8 @@ class TIntermAggregate : public TIntermOperator { bool getDebug() const { return debug; } void setPragmaTable(const TPragmaTable& pTable); const TPragmaTable& getPragmaTable() const { return *pragmaTable; } -#ifndef GLSLANG_WEB void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; } const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; } -#endif protected: TIntermAggregate(const TIntermAggregate&); // disallow copy constructor TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator @@ -1679,9 +1710,7 @@ class TIntermAggregate : public TIntermOperator { bool optimize; bool debug; TPragmaTable* pragmaTable; -#ifndef GLSLANG_WEB TSpirvInstruction spirvInst; -#endif }; // @@ -1819,7 +1848,7 @@ class TIntermTraverser { TIntermNode *getParentNode() { - return path.size() == 0 ? NULL : path.back(); + return path.size() == 0 ? nullptr : path.back(); } const bool preVisit; diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp index 5fc61dbb..8acf9e55 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp @@ -177,7 +177,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); break; -#ifndef GLSLANG_WEB case EbtInt8: if (rightUnionArray[i] == (signed char)0) newConstArray[i].setI8Const((signed char)0x7F); @@ -212,9 +211,9 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right case EbtInt64: if (rightUnionArray[i] == 0ll) - newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll); - else if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == (long long)-0x8000000000000000ll) - newConstArray[i].setI64Const((long long)-0x8000000000000000ll); + newConstArray[i].setI64Const(LLONG_MAX); + else if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == LLONG_MIN) + newConstArray[i].setI64Const(LLONG_MIN); else newConstArray[i].setI64Const(leftUnionArray[i].getI64Const() / rightUnionArray[i].getI64Const()); break; @@ -226,8 +225,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right newConstArray[i].setU64Const(leftUnionArray[i].getU64Const() / rightUnionArray[i].getU64Const()); break; default: - return 0; -#endif + return nullptr; } } break; @@ -266,7 +264,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right newConstArray[i].setIConst(0); break; } else goto modulo_default; -#ifndef GLSLANG_WEB case EbtInt64: if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == LLONG_MIN) { newConstArray[i].setI64Const(0); @@ -277,7 +274,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right newConstArray[i].setIConst(0); break; } else goto modulo_default; -#endif default: modulo_default: newConstArray[i] = leftUnionArray[i] % rightUnionArray[i]; @@ -354,7 +350,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right break; default: - return 0; + return nullptr; } TIntermConstantUnion *newNode = new TIntermConstantUnion(newConstArray, returnType); @@ -507,14 +503,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) : -unionArray[i].getIConst()); break; case EbtUint: newConstArray[i].setUConst(static_cast(-static_cast(unionArray[i].getUConst()))); break; -#ifndef GLSLANG_WEB case EbtInt8: newConstArray[i].setI8Const(-unionArray[i].getI8Const()); break; case EbtUint8: newConstArray[i].setU8Const(static_cast(-static_cast(unionArray[i].getU8Const()))); break; case EbtInt16: newConstArray[i].setI16Const(-unionArray[i].getI16Const()); break; case EbtUint16:newConstArray[i].setU16Const(static_cast(-static_cast(unionArray[i].getU16Const()))); break; case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break; case EbtUint64: newConstArray[i].setU64Const(static_cast(-static_cast(unionArray[i].getU64Const()))); break; -#endif default: return nullptr; } @@ -684,7 +678,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) case EOpConvDoubleToInt: newConstArray[i].setIConst(static_cast(unionArray[i].getDConst())); break; -#ifndef GLSLANG_WEB case EOpConvInt8ToBool: newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break; case EOpConvUint8ToBool: @@ -919,7 +912,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) case EOpConvUint64ToPtr: case EOpConstructReference: newConstArray[i].setU64Const(unionArray[i].getU64Const()); break; -#endif // TODO: 3.0 Functionality: unary constant folding: the rest of the ops have to be fleshed out @@ -1066,7 +1058,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) case EbtUint: newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); break; -#ifndef GLSLANG_WEB case EbtInt8: newConstArray[comp].setI8Const(std::min(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const())); break; @@ -1085,7 +1076,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) case EbtUint64: newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); break; -#endif default: assert(false && "Default missing"); } break; @@ -1102,7 +1092,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) case EbtUint: newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); break; -#ifndef GLSLANG_WEB case EbtInt8: newConstArray[comp].setI8Const(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const())); break; @@ -1121,7 +1110,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) case EbtUint64: newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); break; -#endif default: assert(false && "Default missing"); } break; @@ -1137,7 +1125,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), childConstUnions[2][arg2comp].getUConst())); break; -#ifndef GLSLANG_WEB case EbtInt8: newConstArray[comp].setI8Const(std::min(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()), childConstUnions[2][arg2comp].getI8Const())); @@ -1166,7 +1153,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()), childConstUnions[2][arg2comp].getU64Const())); break; -#endif default: assert(false && "Default missing"); } break; @@ -1345,7 +1331,7 @@ TIntermTyped* TIntermediate::foldDereference(TIntermTyped* node, int index, cons { TType dereferencedType(node->getType(), index); dereferencedType.getQualifier().storage = EvqConst; - TIntermTyped* result = 0; + TIntermTyped* result = nullptr; int size = dereferencedType.computeNumComponents(); // arrays, vectors, matrices, all use simple multiplicative math @@ -1365,7 +1351,7 @@ TIntermTyped* TIntermediate::foldDereference(TIntermTyped* node, int index, cons result = addConstantUnion(TConstUnionArray(node->getAsConstantUnion()->getConstArray(), start, size), node->getType(), loc); - if (result == 0) + if (result == nullptr) result = node; else result->setType(dereferencedType); @@ -1387,7 +1373,7 @@ TIntermTyped* TIntermediate::foldSwizzle(TIntermTyped* node, TSwizzleSelectorsgetType(), loc); - if (result == 0) + if (result == nullptr) result = node; else result->setType(TType(node->getBasicType(), EvqConst, selectors.size())); diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp old mode 100644 new mode 100755 index 31b448ad..2f8ce295 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp @@ -61,10 +61,6 @@ const bool ARBCompatibility = true; const bool ForwardCompatibility = false; -// change this back to false if depending on textual spellings of texturing calls when consuming the AST -// Using PureOperatorBuiltins=false is deprecated. -bool PureOperatorBuiltins = true; - namespace { // @@ -144,14 +140,6 @@ struct Versioning { EProfile EDesktopProfile = static_cast(ENoProfile | ECoreProfile | ECompatibilityProfile); // Declare pointers to put into the table for versioning. -#ifdef GLSLANG_WEB - const Versioning* Es300Desktop130 = nullptr; - const Versioning* Es310Desktop420 = nullptr; -#elif defined(GLSLANG_ANGLE) - const Versioning* Es300Desktop130 = nullptr; - const Versioning* Es310Desktop420 = nullptr; - const Versioning* Es310Desktop450 = nullptr; -#else const Versioning Es300Desktop130Version[] = { { EEsProfile, 0, 300, 0, nullptr }, { EDesktopProfile, 0, 130, 0, nullptr }, { EBadProfile } }; @@ -166,7 +154,6 @@ EProfile EDesktopProfile = static_cast(ENoProfile | ECoreProfile | ECo { EDesktopProfile, 0, 450, 0, nullptr }, { EBadProfile } }; const Versioning* Es310Desktop450 = &Es310Desktop450Version[0]; -#endif // The main descriptor of what a set of function prototypes can look like, and // a pointer to extra versioning information, when needed. @@ -268,10 +255,8 @@ const BuiltInFunction BaseFunctions[] = { { EOpAtomicXor, "atomicXor", 2, TypeIU, ClassV1FIOCV, Es310Desktop420 }, { EOpAtomicExchange, "atomicExchange", 2, TypeIU, ClassV1FIOCV, Es310Desktop420 }, { EOpAtomicCompSwap, "atomicCompSwap", 3, TypeIU, ClassV1FIOCV, Es310Desktop420 }, -#ifndef GLSLANG_WEB { EOpMix, "mix", 3, TypeB, ClassRegular, Es310Desktop450 }, { EOpMix, "mix", 3, TypeIU, ClassLB, Es310Desktop450 }, -#endif { EOpNull } }; @@ -390,10 +375,8 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function) if (arg == function.numArguments - 1 && (function.classes & ClassLO)) decls.append("out "); if (arg == 0) { -#ifndef GLSLANG_WEB if (function.classes & ClassCV) decls.append("coherent volatile "); -#endif if (function.classes & ClassFIO) decls.append("inout "); if (function.classes & ClassFO) @@ -420,11 +403,6 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function) // See if the tabled versioning information allows the current version. bool ValidVersion(const BuiltInFunction& function, int version, EProfile profile, const SpvVersion& /* spVersion */) { -#if defined(GLSLANG_WEB) || defined(GLSLANG_ANGLE) - // all entries in table are valid - return true; -#endif - // nullptr means always valid if (function.versioning == nullptr) return true; @@ -505,7 +483,6 @@ TBuiltIns::TBuiltIns() prefixes[EbtFloat] = ""; prefixes[EbtInt] = "i"; prefixes[EbtUint] = "u"; -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) prefixes[EbtFloat16] = "f16"; prefixes[EbtInt8] = "i8"; prefixes[EbtUint8] = "u8"; @@ -513,7 +490,6 @@ TBuiltIns::TBuiltIns() prefixes[EbtUint16] = "u16"; prefixes[EbtInt64] = "i64"; prefixes[EbtUint64] = "u64"; -#endif postfixes[2] = "2"; postfixes[3] = "3"; @@ -523,14 +499,11 @@ TBuiltIns::TBuiltIns() dimMap[Esd2D] = 2; dimMap[Esd3D] = 3; dimMap[EsdCube] = 3; -#ifndef GLSLANG_WEB -#ifndef GLSLANG_ANGLE dimMap[Esd1D] = 1; -#endif dimMap[EsdRect] = 2; dimMap[EsdBuffer] = 1; dimMap[EsdSubpass] = 2; // potentially unused for now -#endif + dimMap[EsdAttachmentEXT] = 2; // potentially unused for now } TBuiltIns::~TBuiltIns() @@ -548,13 +521,6 @@ TBuiltIns::~TBuiltIns() // void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion) { -#ifdef GLSLANG_WEB - version = 310; - profile = EEsProfile; -#elif defined(GLSLANG_ANGLE) - version = 450; - profile = ECoreProfile; -#endif addTabledBuiltins(version, profile, spvVersion); //============================================================================ @@ -563,7 +529,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV // //============================================================================ -#ifndef GLSLANG_WEB // // Derivatives Functions. // @@ -599,7 +564,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "vec4 fwidthCoarse(vec4 p);" ); -#ifndef GLSLANG_ANGLE TString derivativesAndControl16bits ( "float16_t dFdx(float16_t);" "f16vec2 dFdx(f16vec2);" @@ -1393,7 +1357,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n" ); } -#endif // !GLSLANG_ANGLE if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 430)) { @@ -1431,7 +1394,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifndef GLSLANG_ANGLE if (profile != EEsProfile && version >= 440) { commonBuiltins.append( "uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t);" @@ -1511,8 +1473,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void atomicStore(coherent volatile out double, double, int, int, int);" "\n"); } -#endif // !GLSLANG_ANGLE -#endif // !GLSLANG_WEB if ((profile == EEsProfile && version >= 300) || (profile != EEsProfile && version >= 150)) { // GL_ARB_shader_bit_encoding @@ -1540,7 +1500,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifndef GLSLANG_WEB if ((profile != EEsProfile && version >= 400) || (profile == EEsProfile && version >= 310)) { // GL_OES_gpu_shader5 @@ -1552,7 +1511,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifndef GLSLANG_ANGLE if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp64 commonBuiltins.append( "double fma(double, double, double);" @@ -1570,7 +1528,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f64vec4 fma(f64vec4, f64vec4, f64vec4 );" "\n"); } -#endif if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 400)) { @@ -1588,7 +1545,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifndef GLSLANG_ANGLE if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp64 commonBuiltins.append( "double frexp(double, out int);" @@ -1621,8 +1577,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#endif -#endif if ((profile == EEsProfile && version >= 300) || (profile != EEsProfile && version >= 150)) { @@ -1651,7 +1605,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifndef GLSLANG_WEB if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 150)) { commonBuiltins.append( @@ -1671,7 +1624,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "vec4 unpackUnorm4x8(highp uint);" "\n"); } -#endif // // Matrix Functions. @@ -1730,8 +1682,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV } } -#ifndef GLSLANG_WEB -#ifndef GLSLANG_ANGLE // // Original-style texture functions existing in all stages. // (Per-stage functions below.) @@ -1926,7 +1876,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } } -#endif // !GLSLANG_ANGLE // Bitfield if ((profile == EEsProfile && version >= 310) || @@ -2069,7 +2018,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifndef GLSLANG_ANGLE // GL_ARB_shader_ballot if (profile != EEsProfile && version >= 450) { commonBuiltins.append( @@ -3390,7 +3338,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "bool textureFootprintGradClampNV(sampler2D, vec2, vec2, vec2, float, int, bool, out gl_TextureFootprint2DNV);" "\n"); } -#endif // !GLSLANG_ANGLE if ((profile == EEsProfile && version >= 300 && version < 310) || (profile != EEsProfile && version >= 150 && version < 450)) { // GL_EXT_shader_integer_mix @@ -3410,7 +3357,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifndef GLSLANG_ANGLE // GL_AMD_gpu_shader_half_float/Explicit types if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) { commonBuiltins.append( @@ -4184,7 +4130,18 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#endif // !GLSLANG_ANGLE + + // QCOM_image_processing + if ((profile == EEsProfile && version >= 310) || + (profile != EEsProfile && version >= 140)) { + commonBuiltins.append( + "vec4 textureWeightedQCOM(sampler2D, vec2, sampler2DArray);" + "vec4 textureWeightedQCOM(sampler2D, vec2, sampler1DArray);" + "vec4 textureBoxFilterQCOM(sampler2D, vec2, vec2);" + "vec4 textureBlockMatchSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);" + "vec4 textureBlockMatchSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);" + "\n"); + } //============================================================================ // @@ -4200,7 +4157,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV if (spvVersion.vulkan == 0 && IncludeLegacy(version, profile, spvVersion)) stageBuiltins[EShLangVertex].append("vec4 ftransform();"); -#ifndef GLSLANG_ANGLE // // Original-style texture Functions with lod. // @@ -4260,7 +4216,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } } -#endif // !GLSLANG_ANGLE if ((profile != EEsProfile && version >= 150) || (profile == EEsProfile && version >= 310)) { @@ -4281,7 +4236,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void EndPrimitive();" "\n"); } -#endif // !GLSLANG_WEB //============================================================================ // @@ -4318,7 +4272,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void groupMemoryBarrier();" ); } -#ifndef GLSLANG_WEB if ((profile != EEsProfile && version >= 420) || esBarrier) { if (spvVersion.vulkan == 0 || spvVersion.vulkanRelaxed) { commonBuiltins.append("void memoryBarrierAtomicCounter();"); @@ -4341,7 +4294,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV commonBuiltins.append("void debugPrintfEXT();\n"); -#ifndef GLSLANG_ANGLE if (profile != EEsProfile && version >= 450) { // coopMatStoreNV perhaps ought to have "out" on the buf parameter, but // adding it introduces undesirable tempArgs on the stack. What we want @@ -4422,6 +4374,94 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "icoopmatNV coopMatMulAddNV(icoopmatNV A, icoopmatNV B, icoopmatNV C);\n" "ucoopmatNV coopMatMulAddNV(ucoopmatNV A, ucoopmatNV B, ucoopmatNV C);\n" ); + + std::string cooperativeMatrixFuncs = + "void coopMatLoad(out coopmat m, volatile coherent int8_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent int16_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent int32_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent int64_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent uint8_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent uint16_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent uint32_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent uint64_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent float16_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent float[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent float64_t[] buf, uint element, uint stride, int matrixLayout);\n" + + "void coopMatLoad(out coopmat m, volatile coherent i8vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent i16vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent i32vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent i64vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent u8vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent u16vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent u32vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent u64vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent f16vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent f32vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent f64vec2[] buf, uint element, uint stride, int matrixLayout);\n" + + "void coopMatLoad(out coopmat m, volatile coherent i8vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent i16vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent i32vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent i64vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent u8vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent u16vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent u32vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent u64vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent f16vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent f32vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatLoad(out coopmat m, volatile coherent f64vec4[] buf, uint element, uint stride, int matrixLayout);\n" + + "void coopMatStore(coopmat m, volatile coherent int8_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent int16_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent int32_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent int64_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent uint8_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent uint16_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent uint32_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent uint64_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent float16_t[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent float[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent float64_t[] buf, uint element, uint stride, int matrixLayout);\n" + + "void coopMatStore(coopmat m, volatile coherent i8vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent i16vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent i32vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent i64vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent u8vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent u16vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent u32vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent u64vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent f16vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent f32vec2[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent f64vec2[] buf, uint element, uint stride, int matrixLayout);\n" + + "void coopMatStore(coopmat m, volatile coherent i8vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent i16vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent i32vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent i64vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent u8vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent u16vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent u32vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent u64vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent f16vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent f32vec4[] buf, uint element, uint stride, int matrixLayout);\n" + "void coopMatStore(coopmat m, volatile coherent f64vec4[] buf, uint element, uint stride, int matrixLayout);\n" + + "coopmat coopMatMulAdd(coopmat A, coopmat B, coopmat C);\n" + "coopmat coopMatMulAdd(coopmat A, coopmat B, coopmat C, int matrixOperands);\n"; + + commonBuiltins.append(cooperativeMatrixFuncs.c_str()); + + commonBuiltins.append( + "const int gl_MatrixUseA = 0;\n" + "const int gl_MatrixUseB = 1;\n" + "const int gl_MatrixUseAccumulator = 2;\n" + "const int gl_MatrixOperandsSaturatingAccumulation = 0x10;\n" + "const int gl_CooperativeMatrixLayoutRowMajor = 0;\n" + "const int gl_CooperativeMatrixLayoutColumnMajor = 1;\n" + "\n" + ); } //============================================================================ @@ -4465,7 +4505,24 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#endif // !GLSLANG_ANGLE + + // GL_EXT_shader_tile_image + if (spvVersion.vulkan > 0) { + stageBuiltins[EShLangFragment].append( + "lowp uint stencilAttachmentReadEXT();" + "lowp uint stencilAttachmentReadEXT(int);" + "highp float depthAttachmentReadEXT();" + "highp float depthAttachmentReadEXT(int);" + "\n"); + stageBuiltins[EShLangFragment].append( + "vec4 colorAttachmentReadEXT(attachmentEXT);" + "vec4 colorAttachmentReadEXT(attachmentEXT, int);" + "ivec4 colorAttachmentReadEXT(iattachmentEXT);" + "ivec4 colorAttachmentReadEXT(iattachmentEXT, int);" + "uvec4 colorAttachmentReadEXT(uattachmentEXT);" + "uvec4 colorAttachmentReadEXT(uattachmentEXT, int);" + "\n"); + } // GL_ARB_derivative_control if (profile != EEsProfile && version >= 400) { @@ -4503,7 +4560,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "bool helperInvocationEXT();" "\n"); -#ifndef GLSLANG_ANGLE // GL_AMD_shader_explicit_vertex_parameter if (profile != EEsProfile && version >= 450) { stageBuiltins[EShLangFragment].append( @@ -4576,9 +4632,10 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "uvec4 fragmentFetchAMD(usubpassInputMS, uint);" "\n"); - } + } - // Builtins for GL_NV_ray_tracing/GL_NV_ray_tracing_motion_blur/GL_EXT_ray_tracing/GL_EXT_ray_query + // Builtins for GL_NV_ray_tracing/GL_NV_ray_tracing_motion_blur/GL_EXT_ray_tracing/GL_EXT_ray_query/ + // GL_NV_shader_invocation_reorder/GL_KHR_ray_tracing_position_Fetch if (profile != EEsProfile && version >= 460) { commonBuiltins.append("void rayQueryInitializeEXT(rayQueryEXT, accelerationStructureEXT, uint, uint, vec3, float, vec3, float);" "void rayQueryTerminateEXT(rayQueryEXT);" @@ -4603,6 +4660,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "vec3 rayQueryGetIntersectionObjectRayOriginEXT(rayQueryEXT, bool);" "mat4x3 rayQueryGetIntersectionObjectToWorldEXT(rayQueryEXT, bool);" "mat4x3 rayQueryGetIntersectionWorldToObjectEXT(rayQueryEXT, bool);" + "void rayQueryGetIntersectionTriangleVertexPositionsEXT(rayQueryEXT, bool, out vec3[3]);" "\n"); stageBuiltins[EShLangRayGen].append( @@ -4611,6 +4669,39 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" "void executeCallableNV(uint, int);" "void executeCallableEXT(uint, int);" + "void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordHitWithIndexNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordMissNV(hitObjectNV,uint,vec3,float,vec3,float);" + "void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);" + "void hitObjectRecordEmptyNV(hitObjectNV);" + "void hitObjectExecuteShaderNV(hitObjectNV,int);" + "bool hitObjectIsEmptyNV(hitObjectNV);" + "bool hitObjectIsMissNV(hitObjectNV);" + "bool hitObjectIsHitNV(hitObjectNV);" + "float hitObjectGetRayTMinNV(hitObjectNV);" + "float hitObjectGetRayTMaxNV(hitObjectNV);" + "vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);" + "vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);" + "vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);" + "vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);" + "mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);" + "mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);" + "int hitObjectGetInstanceCustomIndexNV(hitObjectNV);" + "int hitObjectGetInstanceIdNV(hitObjectNV);" + "int hitObjectGetGeometryIndexNV(hitObjectNV);" + "int hitObjectGetPrimitiveIndexNV(hitObjectNV);" + "uint hitObjectGetHitKindNV(hitObjectNV);" + "void hitObjectGetAttributesNV(hitObjectNV,int);" + "float hitObjectGetCurrentTimeNV(hitObjectNV);" + "uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);" + "uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);" + "void reorderThreadNV(uint, uint);" + "void reorderThreadNV(hitObjectNV);" + "void reorderThreadNV(hitObjectNV, uint, uint);" "\n"); stageBuiltins[EShLangIntersect].append( "bool reportIntersectionNV(float, uint);" @@ -4626,6 +4717,36 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" "void executeCallableNV(uint, int);" "void executeCallableEXT(uint, int);" + "void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordHitWithIndexNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordMissNV(hitObjectNV, uint, vec3, float, vec3, float);" + "void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);" + "void hitObjectRecordEmptyNV(hitObjectNV);" + "void hitObjectExecuteShaderNV(hitObjectNV, int);" + "bool hitObjectIsEmptyNV(hitObjectNV);" + "bool hitObjectIsMissNV(hitObjectNV);" + "bool hitObjectIsHitNV(hitObjectNV);" + "float hitObjectGetRayTMinNV(hitObjectNV);" + "float hitObjectGetRayTMaxNV(hitObjectNV);" + "vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);" + "vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);" + "vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);" + "vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);" + "mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);" + "mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);" + "int hitObjectGetInstanceCustomIndexNV(hitObjectNV);" + "int hitObjectGetInstanceIdNV(hitObjectNV);" + "int hitObjectGetGeometryIndexNV(hitObjectNV);" + "int hitObjectGetPrimitiveIndexNV(hitObjectNV);" + "uint hitObjectGetHitKindNV(hitObjectNV);" + "void hitObjectGetAttributesNV(hitObjectNV,int);" + "float hitObjectGetCurrentTimeNV(hitObjectNV);" + "uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);" + "uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);" "\n"); stageBuiltins[EShLangMiss].append( "void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" @@ -4633,20 +4754,48 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" "void executeCallableNV(uint, int);" "void executeCallableEXT(uint, int);" + "void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordHitWithIndexNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);" + "void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);" + "void hitObjectRecordMissNV(hitObjectNV, uint, vec3, float, vec3, float);" + "void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);" + "void hitObjectRecordEmptyNV(hitObjectNV);" + "void hitObjectExecuteShaderNV(hitObjectNV, int);" + "bool hitObjectIsEmptyNV(hitObjectNV);" + "bool hitObjectIsMissNV(hitObjectNV);" + "bool hitObjectIsHitNV(hitObjectNV);" + "float hitObjectGetRayTMinNV(hitObjectNV);" + "float hitObjectGetRayTMaxNV(hitObjectNV);" + "vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);" + "vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);" + "vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);" + "vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);" + "mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);" + "mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);" + "int hitObjectGetInstanceCustomIndexNV(hitObjectNV);" + "int hitObjectGetInstanceIdNV(hitObjectNV);" + "int hitObjectGetGeometryIndexNV(hitObjectNV);" + "int hitObjectGetPrimitiveIndexNV(hitObjectNV);" + "uint hitObjectGetHitKindNV(hitObjectNV);" + "void hitObjectGetAttributesNV(hitObjectNV,int);" + "float hitObjectGetCurrentTimeNV(hitObjectNV);" + "uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);" + "uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);" "\n"); stageBuiltins[EShLangCallable].append( "void executeCallableNV(uint, int);" "void executeCallableEXT(uint, int);" "\n"); } -#endif // !GLSLANG_ANGLE //E_SPV_NV_compute_shader_derivatives if ((profile == EEsProfile && version >= 320) || (profile != EEsProfile && version >= 450)) { stageBuiltins[EShLangCompute].append(derivativeControls); stageBuiltins[EShLangCompute].append("\n"); } -#ifndef GLSLANG_ANGLE if (profile != EEsProfile && version >= 450) { stageBuiltins[EShLangCompute].append(derivativesAndControl16bits); stageBuiltins[EShLangCompute].append(derivativesAndControl64bits); @@ -4670,8 +4819,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void SetMeshOutputsEXT(uint, uint);" "\n"); } -#endif // !GLSLANG_ANGLE -#endif // !GLSLANG_WEB //============================================================================ // @@ -4693,13 +4840,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "highp float diff;" // f - n ); } else { -#ifndef GLSLANG_WEB commonBuiltins.append( "float near;" // n "float far;" // f "float diff;" // f - n ); -#endif } commonBuiltins.append( @@ -4708,7 +4853,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) { // // Matrix state. p. 31, 32, 37, 39, 40. @@ -4826,7 +4970,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#endif // !GLSLANG_WEB && !GLSLANG_ANGLE //============================================================================ // @@ -4856,8 +4999,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifndef GLSLANG_WEB -#ifndef GLSLANG_ANGLE //============================================================================ // // Define the interface to the mesh/task shader. @@ -4974,7 +5115,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } } -#endif // !GLSLANG_ANGLE //============================================================================ // @@ -5141,19 +5281,15 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in highp int gl_InstanceID;" // needs qualifier fixed later ); if (spvVersion.vulkan > 0) -#endif stageBuiltins[EShLangVertex].append( "in highp int gl_VertexIndex;" "in highp int gl_InstanceIndex;" ); -#ifndef GLSLANG_WEB if (version < 310) -#endif stageBuiltins[EShLangVertex].append( "highp vec4 gl_Position;" // needs qualifier fixed later "highp float gl_PointSize;" // needs qualifier fixed later ); -#ifndef GLSLANG_WEB else stageBuiltins[EShLangVertex].append( "out gl_PerVertex {" @@ -5631,7 +5767,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "mediump vec2 gl_PointCoord;" // needs qualifier fixed later ); } -#endif if (version >= 300) { stageBuiltins[EShLangFragment].append( "highp vec4 gl_FragCoord;" // needs qualifier fixed later @@ -5640,7 +5775,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "highp float gl_FragDepth;" // needs qualifier fixed later ); } -#ifndef GLSLANG_WEB if (version >= 310) { stageBuiltins[EShLangFragment].append( "bool gl_HelperInvocation;" // needs qualifier fixed later @@ -5685,15 +5819,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "flat in highp int gl_ShadingRateEXT;" // GL_EXT_fragment_shading_rate ); } -#endif stageBuiltins[EShLangFragment].append("\n"); if (version >= 130) add2ndGenerationSamplingImaging(version, profile, spvVersion); -#ifndef GLSLANG_WEB - if ((profile != EEsProfile && version >= 140) || (profile == EEsProfile && version >= 310)) { stageBuiltins[EShLangFragment].append( @@ -5708,7 +5839,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifndef GLSLANG_ANGLE // GL_ARB_shader_ballot if (profile != EEsProfile && version >= 450) { const char* ballotDecls = @@ -5771,6 +5901,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in highp uint gl_SMCountNV;" "in highp uint gl_WarpIDNV;" "in highp uint gl_SMIDNV;" + // GL_ARM_shader_core_builtins + "in highp uint gl_CoreIDARM;" + "in highp uint gl_CoreCountARM;" + "in highp uint gl_CoreMaxIDARM;" + "in highp uint gl_WarpIDARM;" + "in highp uint gl_WarpMaxIDARM;" "\n"; const char* fragmentSubgroupDecls = "flat in mediump uint gl_SubgroupSize;" @@ -5785,6 +5921,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "flat in highp uint gl_SMCountNV;" "flat in highp uint gl_WarpIDNV;" "flat in highp uint gl_SMIDNV;" + // GL_ARM_shader_core_builtins + "flat in highp uint gl_CoreIDARM;" + "flat in highp uint gl_CoreCountARM;" + "flat in highp uint gl_CoreMaxIDARM;" + "flat in highp uint gl_WarpIDARM;" + "flat in highp uint gl_WarpMaxIDARM;" "\n"; const char* computeSubgroupDecls = "in highp uint gl_NumSubgroups;" @@ -5804,6 +5946,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in highp uint gl_SMCountNV;" "in highp volatile uint gl_WarpIDNV;" "in highp volatile uint gl_SMIDNV;" + // GL_ARM_shader_core_builtins + "in highp uint gl_CoreIDARM;" + "in highp uint gl_CoreCountARM;" + "in highp uint gl_CoreMaxIDARM;" + "in highp uint gl_WarpIDARM;" + "in highp uint gl_WarpMaxIDARM;" "\n"; stageBuiltins[EShLangVertex] .append(subgroupDecls); @@ -5850,6 +5998,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "const uint gl_RayFlagsCullNoOpaqueEXT = 128U;" "const uint gl_RayFlagsSkipTrianglesEXT = 256U;" "const uint gl_RayFlagsSkipAABBEXT = 512U;" + "const uint gl_RayFlagsForceOpacityMicromap2StateEXT = 1024U;" "const uint gl_HitKindFrontFacingTriangleEXT = 254U;" "const uint gl_HitKindBackFacingTriangleEXT = 255U;" "\n"; @@ -5939,6 +6088,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in uint gl_IncomingRayFlagsEXT;" "in float gl_CurrentRayTimeNV;" "in uint gl_CullMaskEXT;" + "in vec3 gl_HitTriangleVertexPositionsEXT[3];" "\n"; const char *missDecls = "in uvec3 gl_LaunchIDNV;" @@ -6066,9 +6216,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV } } } -#endif // !GLSLANG_ANGLE - -#endif // !GLSLANG_WEB // printf("%s\n", commonBuiltins.c_str()); // printf("%s\n", stageBuiltins[EShLangFragment].c_str()); @@ -6087,26 +6234,14 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c // enumerate all the types const TBasicType bTypes[] = { EbtFloat, EbtInt, EbtUint, -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - EbtFloat16 -#endif + EbtFloat16 }; -#ifdef GLSLANG_WEB - bool skipBuffer = true; - bool skipCubeArrayed = true; - const int image = 0; -#else bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140); bool skipCubeArrayed = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 130); for (int image = 0; image <= 1; ++image) // loop over "bool" image vs sampler -#endif { for (int shadow = 0; shadow <= 1; ++shadow) { // loop over "bool" shadow or not -#ifdef GLSLANG_WEB - const int ms = 0; -#else for (int ms = 0; ms <= 1; ++ms) // loop over "bool" multisample or not -#endif { if ((ms || image) && shadow) continue; @@ -6118,14 +6253,9 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c continue; for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not -#ifdef GLSLANG_WEB - for (int dim = Esd2D; dim <= EsdCube; ++dim) { // 2D, 3D, and Cube -#else -#if defined(GLSLANG_ANGLE) - for (int dim = Esd2D; dim < EsdNumDims; ++dim) { // 2D, ..., buffer, subpass -#else for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, ..., buffer, subpass -#endif + if (dim == EsdAttachmentEXT) + continue; if (dim == EsdSubpass && spvVersion.vulkan == 0) continue; if (dim == EsdSubpass && (image || shadow || arrayed)) @@ -6146,7 +6276,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c continue; if (ms && arrayed && profile == EEsProfile && version < 310) continue; -#endif if (dim == Esd3D && shadow) continue; if (dim == EsdCube && arrayed && skipCubeArrayed) @@ -6156,23 +6285,21 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c // Loop over the bTypes for (size_t bType = 0; bType < sizeof(bTypes)/sizeof(TBasicType); ++bType) { -#ifndef GLSLANG_WEB if (bTypes[bType] == EbtFloat16 && (profile == EEsProfile || version < 450)) continue; if (dim == EsdRect && version < 140 && bType > 0) continue; -#endif if (shadow && (bTypes[bType] == EbtInt || bTypes[bType] == EbtUint)) continue; // // Now, make all the function prototypes for the type we just built... // TSampler sampler; -#ifndef GLSLANG_WEB if (dim == EsdSubpass) { sampler.setSubpass(bTypes[bType], ms ? true : false); + } else if (dim == EsdAttachmentEXT) { + sampler.setAttachmentEXT(bTypes[bType]); } else -#endif if (image) { sampler.setImage(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false, shadow ? true : false, @@ -6185,12 +6312,10 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c TString typeName = sampler.getString(); -#ifndef GLSLANG_WEB if (dim == EsdSubpass) { addSubpassSampling(sampler, typeName, version, profile); continue; } -#endif addQueryFunctions(sampler, typeName, version, profile); @@ -6198,7 +6323,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c addImageFunctions(sampler, typeName, version, profile); else { addSamplingFunctions(sampler, typeName, version, profile); -#ifndef GLSLANG_WEB addGatherFunctions(sampler, typeName, version, profile); if (spvVersion.vulkan > 0 && sampler.isCombined() && !sampler.shadow) { // Base Vulkan allows texelFetch() for @@ -6214,7 +6338,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c addSamplingFunctions(sampler, textureTypeName, version, profile); addQueryFunctions(sampler, textureTypeName, version, profile); } -#endif } } } @@ -6245,16 +6368,6 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int int sizeDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0) - (sampler.dim == EsdCube ? 1 : 0); -#ifdef GLSLANG_WEB - commonBuiltins.append("highp "); - commonBuiltins.append("ivec"); - commonBuiltins.append(postfixes[sizeDims]); - commonBuiltins.append(" textureSize("); - commonBuiltins.append(typeName); - commonBuiltins.append(",int);\n"); - return; -#endif - if (sampler.isImage() && ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 420))) return; @@ -6574,14 +6687,6 @@ void TBuiltIns::addSubpassSampling(TSampler sampler, const TString& typeName, in // void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) { -#ifdef GLSLANG_WEB - profile = EEsProfile; - version = 310; -#elif defined(GLSLANG_ANGLE) - profile = ECoreProfile; - version = 450; -#endif - // // texturing // @@ -6656,11 +6761,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, continue; // loop over 16-bit floating-point texel addressing -#if defined(GLSLANG_WEB) || defined(GLSLANG_ANGLE) - const int f16TexAddr = 0; -#else for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) -#endif { if (f16TexAddr && sampler.type != EbtFloat16) continue; @@ -6669,11 +6770,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, totalDims--; } // loop over "bool" lod clamp -#if defined(GLSLANG_WEB) || defined(GLSLANG_ANGLE) - const int lodClamp = 0; -#else for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp) -#endif { if (lodClamp && (profile == EEsProfile || version < 450)) continue; @@ -6681,11 +6778,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, continue; // loop over "bool" sparse or not -#if defined(GLSLANG_WEB) || defined(GLSLANG_ANGLE) - const int sparse = 0; -#else for (int sparse = 0; sparse <= 1; ++sparse) -#endif { if (sparse && (profile == EEsProfile || version < 450)) continue; @@ -6862,14 +6955,6 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, // void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) { -#ifdef GLSLANG_WEB - profile = EEsProfile; - version = 310; -#elif defined(GLSLANG_ANGLE) - profile = ECoreProfile; - version = 450; -#endif - switch (sampler.dim) { case Esd2D: case EsdRect: @@ -7108,14 +7193,6 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in // void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language) { -#ifdef GLSLANG_WEB - version = 310; - profile = EEsProfile; -#elif defined(GLSLANG_ANGLE) - version = 450; - profile = ECoreProfile; -#endif - // // Initialize the context-dependent (resource-dependent) built-in strings for parsing. // @@ -7173,7 +7250,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append(builtInConstant); } -#ifndef GLSLANG_WEB if (version >= 310) { // geometry @@ -7496,7 +7572,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents); s.append(builtInConstant); } -#endif } // compute @@ -7518,7 +7593,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append("\n"); } -#ifndef GLSLANG_WEB // images (some in compute below) if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 130)) { @@ -7546,7 +7620,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append("\n"); } -#ifndef GLSLANG_ANGLE // atomic counters (some in compute below) if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) { @@ -7583,7 +7656,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append("\n"); } -#endif // !GLSLANG_ANGLE // GL_ARB_cull_distance if (profile != EEsProfile && version >= 450) { @@ -7600,7 +7672,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append(builtInConstant); } -#ifndef GLSLANG_ANGLE // SPV_NV_mesh_shader if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputVerticesNV = %d;", resources.maxMeshOutputVerticesNV); @@ -7623,8 +7694,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append("\n"); } -#endif -#endif s.append("\n"); } @@ -7727,14 +7796,6 @@ static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVar // void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable) { -#ifdef GLSLANG_WEB - version = 310; - profile = EEsProfile; -#elif defined(GLSLANG_ANGLE) - version = 450; - profile = ECoreProfile; -#endif - // // Tag built-in variables and functions with additional qualifier and extension information // that cannot be declared with the text strings. @@ -7754,7 +7815,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable); } -#ifndef GLSLANG_WEB if (spvVersion.vulkan == 0) { SpecialQualifier("gl_VertexID", EvqVertexId, EbvVertexId, symbolTable); SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable); @@ -7928,7 +7988,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion case EShLangTessEvaluation: case EShLangGeometry: -#endif // !GLSLANG_WEB SpecialQualifier("gl_Position", EvqPosition, EbvPosition, symbolTable); SpecialQualifier("gl_PointSize", EvqPointSize, EbvPointSize, symbolTable); @@ -7938,7 +7997,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_out", "gl_Position", EbvPosition, symbolTable); BuiltInVariable("gl_out", "gl_PointSize", EbvPointSize, symbolTable); -#ifndef GLSLANG_WEB SpecialQualifier("gl_ClipVertex", EvqClipVertex, EbvClipVertex, symbolTable); BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable); @@ -8045,7 +8103,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); } - if (profile != EEsProfile) { + if (profile != EEsProfile) { BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable); BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable); BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable); @@ -8091,6 +8149,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); + + // GL_ARM_shader_core_builtins + symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + + BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable); + BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable); + BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable); + BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable); + BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable); } if (language == EShLangGeometry || language == EShLangVertex) { @@ -8105,8 +8176,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate); } } - -#endif // !GLSLANG_WEB break; case EShLangFragment: @@ -8123,7 +8192,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } } SpecialQualifier("gl_FragDepth", EvqFragDepth, EbvFragDepth, symbolTable); -#ifndef GLSLANG_WEB SpecialQualifier("gl_FragDepthEXT", EvqFragDepth, EbvFragDepth, symbolTable); SpecialQualifier("gl_FragStencilRefARB", EvqFragStencil, EbvFragStencilRef, symbolTable); SpecialQualifier("gl_HelperInvocation", EvqVaryingIn, EbvHelperInvocation, symbolTable); @@ -8165,8 +8233,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("rayQueryGetIntersectionWorldToObjectEXT", 1, &E_GL_EXT_ray_query); symbolTable.setFunctionExtensions("rayQueryGetWorldRayOriginEXT", 1, &E_GL_EXT_ray_query); symbolTable.setFunctionExtensions("rayQueryGetWorldRayDirectionEXT", 1, &E_GL_EXT_ray_query); + symbolTable.setFunctionExtensions("rayQueryGetIntersectionTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch); symbolTable.setVariableExtensions("gl_RayFlagsSkipAABBEXT", 1, &E_GL_EXT_ray_flags_primitive_culling); symbolTable.setVariableExtensions("gl_RayFlagsSkipTrianglesEXT", 1, &E_GL_EXT_ray_flags_primitive_culling); + symbolTable.setVariableExtensions("gl_RayFlagsForceOpacityMicromap2StateEXT", 1, &E_GL_EXT_opacity_micromap); } if ((profile != EEsProfile && version >= 130) || @@ -8605,6 +8675,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); + + // GL_ARM_shader_core_builtins + symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + + BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable); + BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable); + BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable); + BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable); + BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable); } if (profile == EEsProfile) { @@ -8645,7 +8728,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate); symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate); } -#endif // !GLSLANG_WEB + + // GL_EXT_shader_tile_image + symbolTable.setFunctionExtensions("stencilAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image); + symbolTable.setFunctionExtensions("depthAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image); + symbolTable.setFunctionExtensions("colorAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image); + + if ((profile == EEsProfile && version >= 310) || + (profile != EEsProfile && version >= 140)) { + symbolTable.setFunctionExtensions("textureWeightedQCOM", 1, &E_GL_QCOM_image_processing); + symbolTable.setFunctionExtensions("textureBoxFilterQCOM", 1, &E_GL_QCOM_image_processing); + symbolTable.setFunctionExtensions("textureBlockMatchSADQCOM", 1, &E_GL_QCOM_image_processing); + symbolTable.setFunctionExtensions("textureBlockMatchSSDQCOM", 1, &E_GL_QCOM_image_processing); + } break; case EShLangCompute: @@ -8658,7 +8753,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); -#ifndef GLSLANG_WEB if ((profile != EEsProfile && version >= 140) || (profile == EEsProfile && version >= 310)) { symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); @@ -8748,6 +8842,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); + + // GL_ARM_shader_core_builtins + symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + + BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable); + BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable); + BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable); + BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable); + BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable); } // GL_KHR_shader_subgroup @@ -8769,6 +8876,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("coopMatMulAddNV", 2, coopExt); } + { + symbolTable.setFunctionExtensions("coopMatLoad", 1, &E_GL_KHR_cooperative_matrix); + symbolTable.setFunctionExtensions("coopMatStore", 1, &E_GL_KHR_cooperative_matrix); + symbolTable.setFunctionExtensions("coopMatMulAdd", 1, &E_GL_KHR_cooperative_matrix); + } + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_NV_compute_shader_derivatives); symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_NV_compute_shader_derivatives); @@ -8788,10 +8901,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate); symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate); } -#endif // !GLSLANG_WEB break; -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) case EShLangRayGen: case EShLangIntersect: case EShLangAnyHit: @@ -8835,6 +8946,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_IncomingRayFlagsNV", 1, &E_GL_NV_ray_tracing); symbolTable.setVariableExtensions("gl_IncomingRayFlagsEXT", 1, &E_GL_EXT_ray_tracing); symbolTable.setVariableExtensions("gl_CurrentRayTimeNV", 1, &E_GL_NV_ray_tracing_motion_blur); + symbolTable.setVariableExtensions("gl_HitTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch); symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); @@ -8849,6 +8961,38 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("executeCallableNV", 1, &E_GL_NV_ray_tracing); symbolTable.setFunctionExtensions("executeCallableEXT", 1, &E_GL_EXT_ray_tracing); + symbolTable.setFunctionExtensions("hitObjectTraceRayNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectTraceRayMotionNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordHitNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordHitMotionNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordHitWithIndexNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordHitWithIndexMotionNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordMissNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordMissMotionNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectRecordEmptyNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectExecuteShaderNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectIsEmptyNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectIsMissNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectIsHitNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetRayTMinNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetRayTMaxNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetObjectRayOriginNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetObjectRayDirectionNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetWorldRayOriginNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetWorldRayDirectionNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetWorldToObjectNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetbjectToWorldNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetInstanceCustomIndexNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetInstanceIdNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetGeometryIndexNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetPrimitiveIndexNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetHitKindNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetAttributesNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetCurrentTimeNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetShaderBindingTableRecordIndexNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("hitObjectGetShaderRecordBufferHandleNV", 1, &E_GL_NV_shader_invocation_reorder); + symbolTable.setFunctionExtensions("reorderThreadNV", 1, &E_GL_NV_shader_invocation_reorder); + BuiltInVariable("gl_LaunchIDNV", EbvLaunchId, symbolTable); BuiltInVariable("gl_LaunchIDEXT", EbvLaunchId, symbolTable); @@ -8886,6 +9030,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_IncomingRayFlagsEXT", EbvIncomingRayFlags, symbolTable); BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); BuiltInVariable("gl_CurrentRayTimeNV", EbvCurrentRayTimeNV, symbolTable); + BuiltInVariable("gl_HitTriangleVertexPositionsEXT", EbvPositionFetch, symbolTable); // GL_ARB_shader_ballot symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot); @@ -8942,6 +9087,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); + + // GL_ARM_shader_core_builtins + symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + + BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable); + BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable); + BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable); + BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable); + BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable); } if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 450)) { @@ -9064,7 +9222,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_Layer", 1, &E_GL_EXT_mesh_shader); symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_ViewportIndex", 1, &E_GL_EXT_mesh_shader); symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_CullPrimitiveEXT", 1, &E_GL_EXT_mesh_shader); - symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_PrimitiveShadingRateEXT", 1, &E_GL_EXT_mesh_shader); + + // note: technically this member requires both GL_EXT_mesh_shader and GL_EXT_fragment_shading_rate + // since setVariableExtensions only needs *one of* the extensions to validate, it's more useful to specify EXT_fragment_shading_rate + // GL_EXT_mesh_shader will be required in practice by use of other fields of gl_MeshPrimitivesEXT + symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_PrimitiveShadingRateEXT", 1, &E_GL_EXT_fragment_shading_rate); BuiltInVariable("gl_MeshPrimitivesEXT", "gl_PrimitiveID", EbvPrimitiveId, symbolTable); BuiltInVariable("gl_MeshPrimitivesEXT", "gl_Layer", EbvLayer, symbolTable); @@ -9148,6 +9310,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); + + // GL_ARM_shader_core_builtins + symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + + BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable); + BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable); + BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable); + BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable); + BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable); } if ((profile == EEsProfile && version >= 310) || @@ -9278,6 +9453,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); + + // GL_ARM_shader_core_builtins + symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins); + symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins); + + BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable); + BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable); + BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable); + BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable); + BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable); } if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 450)) { @@ -9287,7 +9475,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate); } break; -#endif default: assert(false && "Language not supported"); @@ -9303,7 +9490,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion relateTabledBuiltins(version, profile, spvVersion, language, symbolTable); -#ifndef GLSLANG_WEB symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64); symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64); symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble); @@ -9720,6 +9906,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("shadow2DEXT", EOpTexture); symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj); } + + if ((profile == EEsProfile && version >= 310) || + (profile != EEsProfile && version >= 140)) { + symbolTable.relateToOperator("textureWeightedQCOM", EOpImageSampleWeightedQCOM); + symbolTable.relateToOperator("textureBoxFilterQCOM", EOpImageBoxFilterQCOM); + symbolTable.relateToOperator("textureBlockMatchSADQCOM", EOpImageBlockMatchSADQCOM); + symbolTable.relateToOperator("textureBlockMatchSSDQCOM", EOpImageBlockMatchSSDQCOM); + } } switch(language) { @@ -9771,6 +9965,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("rayQueryGetWorldRayOriginEXT", EOpRayQueryGetWorldRayOrigin); symbolTable.relateToOperator("rayQueryGetIntersectionObjectToWorldEXT", EOpRayQueryGetIntersectionObjectToWorld); symbolTable.relateToOperator("rayQueryGetIntersectionWorldToObjectEXT", EOpRayQueryGetIntersectionWorldToObject); + symbolTable.relateToOperator("rayQueryGetIntersectionTriangleVertexPositionsEXT", EOpRayQueryGetIntersectionTriangleVertexPositionsEXT); } symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid); @@ -9783,6 +9978,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("beginInvocationInterlockARB", EOpBeginInvocationInterlock); symbolTable.relateToOperator("endInvocationInterlockARB", EOpEndInvocationInterlock); + symbolTable.relateToOperator("stencilAttachmentReadEXT", EOpStencilAttachmentReadEXT); + symbolTable.relateToOperator("depthAttachmentReadEXT", EOpDepthAttachmentReadEXT); + symbolTable.relateToOperator("colorAttachmentReadEXT", EOpColorAttachmentReadEXT); + break; case EShLangCompute: @@ -9799,9 +9998,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse); symbolTable.relateToOperator("fwidthCoarse",EOpFwidthCoarse); } - symbolTable.relateToOperator("coopMatLoadNV", EOpCooperativeMatrixLoad); - symbolTable.relateToOperator("coopMatStoreNV", EOpCooperativeMatrixStore); - symbolTable.relateToOperator("coopMatMulAddNV", EOpCooperativeMatrixMulAdd); + symbolTable.relateToOperator("coopMatLoadNV", EOpCooperativeMatrixLoadNV); + symbolTable.relateToOperator("coopMatStoreNV", EOpCooperativeMatrixStoreNV); + symbolTable.relateToOperator("coopMatMulAddNV", EOpCooperativeMatrixMulAddNV); + + symbolTable.relateToOperator("coopMatLoad", EOpCooperativeMatrixLoad); + symbolTable.relateToOperator("coopMatStore", EOpCooperativeMatrixStore); + symbolTable.relateToOperator("coopMatMulAdd", EOpCooperativeMatrixMulAdd); break; case EShLangRayGen: @@ -9813,13 +10016,45 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("traceRayEXT", EOpTraceKHR); symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallableNV); symbolTable.relateToOperator("executeCallableEXT", EOpExecuteCallableKHR); + + symbolTable.relateToOperator("hitObjectTraceRayNV", EOpHitObjectTraceRayNV); + symbolTable.relateToOperator("hitObjectTraceRayMotionNV", EOpHitObjectTraceRayMotionNV); + symbolTable.relateToOperator("hitObjectRecordHitNV", EOpHitObjectRecordHitNV); + symbolTable.relateToOperator("hitObjectRecordHitMotionNV", EOpHitObjectRecordHitMotionNV); + symbolTable.relateToOperator("hitObjectRecordHitWithIndexNV", EOpHitObjectRecordHitWithIndexNV); + symbolTable.relateToOperator("hitObjectRecordHitWithIndexMotionNV", EOpHitObjectRecordHitWithIndexMotionNV); + symbolTable.relateToOperator("hitObjectRecordMissNV", EOpHitObjectRecordMissNV); + symbolTable.relateToOperator("hitObjectRecordMissMotionNV", EOpHitObjectRecordMissMotionNV); + symbolTable.relateToOperator("hitObjectRecordEmptyNV", EOpHitObjectRecordEmptyNV); + symbolTable.relateToOperator("hitObjectExecuteShaderNV", EOpHitObjectExecuteShaderNV); + symbolTable.relateToOperator("hitObjectIsEmptyNV", EOpHitObjectIsEmptyNV); + symbolTable.relateToOperator("hitObjectIsMissNV", EOpHitObjectIsMissNV); + symbolTable.relateToOperator("hitObjectIsHitNV", EOpHitObjectIsHitNV); + symbolTable.relateToOperator("hitObjectGetRayTMinNV", EOpHitObjectGetRayTMinNV); + symbolTable.relateToOperator("hitObjectGetRayTMaxNV", EOpHitObjectGetRayTMaxNV); + symbolTable.relateToOperator("hitObjectGetObjectRayOriginNV", EOpHitObjectGetObjectRayOriginNV); + symbolTable.relateToOperator("hitObjectGetObjectRayDirectionNV", EOpHitObjectGetObjectRayDirectionNV); + symbolTable.relateToOperator("hitObjectGetWorldRayOriginNV", EOpHitObjectGetWorldRayOriginNV); + symbolTable.relateToOperator("hitObjectGetWorldRayDirectionNV", EOpHitObjectGetWorldRayDirectionNV); + symbolTable.relateToOperator("hitObjectGetWorldToObjectNV", EOpHitObjectGetWorldToObjectNV); + symbolTable.relateToOperator("hitObjectGetObjectToWorldNV", EOpHitObjectGetObjectToWorldNV); + symbolTable.relateToOperator("hitObjectGetInstanceCustomIndexNV", EOpHitObjectGetInstanceCustomIndexNV); + symbolTable.relateToOperator("hitObjectGetInstanceIdNV", EOpHitObjectGetInstanceIdNV); + symbolTable.relateToOperator("hitObjectGetGeometryIndexNV", EOpHitObjectGetGeometryIndexNV); + symbolTable.relateToOperator("hitObjectGetPrimitiveIndexNV", EOpHitObjectGetPrimitiveIndexNV); + symbolTable.relateToOperator("hitObjectGetHitKindNV", EOpHitObjectGetHitKindNV); + symbolTable.relateToOperator("hitObjectGetAttributesNV", EOpHitObjectGetAttributesNV); + symbolTable.relateToOperator("hitObjectGetCurrentTimeNV", EOpHitObjectGetCurrentTimeNV); + symbolTable.relateToOperator("hitObjectGetShaderBindingTableRecordIndexNV", EOpHitObjectGetShaderBindingTableRecordIndexNV); + symbolTable.relateToOperator("hitObjectGetShaderRecordBufferHandleNV", EOpHitObjectGetShaderRecordBufferHandleNV); + symbolTable.relateToOperator("reorderThreadNV", EOpReorderThreadNV); } break; case EShLangIntersect: if (profile != EEsProfile && version >= 460) { symbolTable.relateToOperator("reportIntersectionNV", EOpReportIntersection); symbolTable.relateToOperator("reportIntersectionEXT", EOpReportIntersection); - } + } break; case EShLangAnyHit: if (profile != EEsProfile && version >= 460) { @@ -9859,7 +10094,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion default: assert(false && "Language not supported"); } -#endif // !GLSLANG_WEB } // @@ -9873,11 +10107,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion // void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) { -#ifndef GLSLANG_WEB -#if defined(GLSLANG_ANGLE) - profile = ECoreProfile; - version = 450; -#endif if (profile != EEsProfile && version >= 430 && version < 440) { symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &E_GL_ARB_enhanced_layouts); symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &E_GL_ARB_enhanced_layouts); @@ -9949,7 +10178,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion default: break; } -#endif } } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.h b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.h index ac8ec33e..42c32ddb 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.h +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.h @@ -107,6 +107,9 @@ class TBuiltIns : public TBuiltInParseables { int dimMap[EsdNumDims]; }; +// 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; } // end namespace glslang #endif // _INITIALIZE_INCLUDED_ diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp index 6a43ef3e..a8e3b38b 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp @@ -352,7 +352,7 @@ TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermT TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, const TSourceLoc& loc) { - if (child == 0) + if (child == nullptr) return nullptr; if (child->getType().getBasicType() == EbtBlock) @@ -388,7 +388,6 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, case EOpConstructFloat: newType = EbtFloat; break; case EOpConstructInt: newType = EbtInt; break; case EOpConstructUint: newType = EbtUint; break; -#ifndef GLSLANG_WEB case EOpConstructInt8: newType = EbtInt8; break; case EOpConstructUint8: newType = EbtUint8; break; case EOpConstructInt16: newType = EbtInt16; break; @@ -397,7 +396,6 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, case EOpConstructUint64: newType = EbtUint64; break; case EOpConstructDouble: newType = EbtDouble; break; case EOpConstructFloat16: newType = EbtFloat16; break; -#endif default: break; // some compilers want this } @@ -569,7 +567,6 @@ bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& newOp) const { switch (dst) { -#ifndef GLSLANG_WEB case EbtDouble: switch (src) { case EbtUint: newOp = EOpConvUintToDouble; break; @@ -587,13 +584,11 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne return false; } break; -#endif case EbtFloat: switch (src) { case EbtInt: newOp = EOpConvIntToFloat; break; case EbtUint: newOp = EOpConvUintToFloat; break; case EbtBool: newOp = EOpConvBoolToFloat; break; -#ifndef GLSLANG_WEB case EbtDouble: newOp = EOpConvDoubleToFloat; break; case EbtInt8: newOp = EOpConvInt8ToFloat; break; case EbtUint8: newOp = EOpConvUint8ToFloat; break; @@ -602,12 +597,10 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne case EbtFloat16: newOp = EOpConvFloat16ToFloat; break; case EbtInt64: newOp = EOpConvInt64ToFloat; break; case EbtUint64: newOp = EOpConvUint64ToFloat; break; -#endif default: return false; } break; -#ifndef GLSLANG_WEB case EbtFloat16: switch (src) { case EbtInt8: newOp = EOpConvInt8ToFloat16; break; @@ -625,13 +618,11 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne return false; } break; -#endif case EbtBool: switch (src) { case EbtInt: newOp = EOpConvIntToBool; break; case EbtUint: newOp = EOpConvUintToBool; break; case EbtFloat: newOp = EOpConvFloatToBool; break; -#ifndef GLSLANG_WEB case EbtDouble: newOp = EOpConvDoubleToBool; break; case EbtInt8: newOp = EOpConvInt8ToBool; break; case EbtUint8: newOp = EOpConvUint8ToBool; break; @@ -640,12 +631,10 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne case EbtFloat16: newOp = EOpConvFloat16ToBool; break; case EbtInt64: newOp = EOpConvInt64ToBool; break; case EbtUint64: newOp = EOpConvUint64ToBool; break; -#endif default: return false; } break; -#ifndef GLSLANG_WEB case EbtInt8: switch (src) { case EbtUint8: newOp = EOpConvUint8ToInt8; break; @@ -715,14 +704,12 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne return false; } break; -#endif case EbtInt: switch (src) { case EbtUint: newOp = EOpConvUintToInt; break; case EbtBool: newOp = EOpConvBoolToInt; break; case EbtFloat: newOp = EOpConvFloatToInt; break; -#ifndef GLSLANG_WEB case EbtInt8: newOp = EOpConvInt8ToInt; break; case EbtUint8: newOp = EOpConvUint8ToInt; break; case EbtInt16: newOp = EOpConvInt16ToInt; break; @@ -731,7 +718,6 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne case EbtFloat16: newOp = EOpConvFloat16ToInt; break; case EbtInt64: newOp = EOpConvInt64ToInt; break; case EbtUint64: newOp = EOpConvUint64ToInt; break; -#endif default: return false; } @@ -741,7 +727,6 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne case EbtInt: newOp = EOpConvIntToUint; break; case EbtBool: newOp = EOpConvBoolToUint; break; case EbtFloat: newOp = EOpConvFloatToUint; break; -#ifndef GLSLANG_WEB case EbtInt8: newOp = EOpConvInt8ToUint; break; case EbtUint8: newOp = EOpConvUint8ToUint; break; case EbtInt16: newOp = EOpConvInt16ToUint; break; @@ -750,12 +735,15 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne case EbtFloat16: newOp = EOpConvFloat16ToUint; break; case EbtInt64: newOp = EOpConvInt64ToUint; break; case EbtUint64: newOp = EOpConvUint64ToUint; break; -#endif + // For bindless texture type conversion, add a dummy convert op, just + // to generate a new TIntermTyped + // uvec2(any sampler type) + // uvec2(any image type) + case EbtSampler: newOp = EOpConvIntToUint; break; default: return false; } break; -#ifndef GLSLANG_WEB case EbtInt64: switch (src) { case EbtInt8: newOp = EOpConvInt8ToInt64; break; @@ -790,7 +778,6 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne return false; } break; -#endif default: return false; } @@ -806,7 +793,6 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped // Add a new newNode for the conversion. // -#ifndef GLSLANG_WEB bool convertToIntTypes = (convertTo == EbtInt8 || convertTo == EbtUint8 || convertTo == EbtInt16 || convertTo == EbtUint16 || convertTo == EbtInt || convertTo == EbtUint || @@ -843,7 +829,6 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped return nullptr; } } -#endif TIntermUnary* newNode = nullptr; TOperator newOp = EOpNull; @@ -855,13 +840,11 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped newNode = addUnaryNode(newOp, node, node->getLoc(), newType); if (node->getAsConstantUnion()) { -#ifndef GLSLANG_WEB // 8/16-bit storage extensions don't support 8/16-bit constants, so don't fold conversions // to those types if ((getArithemeticInt8Enabled() || !(convertTo == EbtInt8 || convertTo == EbtUint8)) && (getArithemeticInt16Enabled() || !(convertTo == EbtInt16 || convertTo == EbtUint16)) && (getArithemeticFloat16Enabled() || !(convertTo == EbtFloat16))) -#endif { TIntermTyped* folded = node->getAsConstantUnion()->fold(newOp, newType); if (folded) @@ -1044,6 +1027,12 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt if (type.isArray() || node->getType().isArray()) return nullptr; + // Reject implicit conversions to cooperative matrix types + if (node->getType().isCoopMat() && + op != EOpConstructCooperativeMatrixNV && + op != EOpConstructCooperativeMatrixKHR) + return nullptr; + // Note: callers are responsible for other aspects of shape, // like vector and matrix sizes. @@ -1055,7 +1044,6 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpConstructFloat: case EOpConstructInt: case EOpConstructUint: -#ifndef GLSLANG_WEB case EOpConstructDouble: case EOpConstructFloat16: case EOpConstructInt8: @@ -1066,8 +1054,6 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpConstructUint64: break; -#endif - // // Implicit conversions // @@ -1112,7 +1098,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpSequence: case EOpConstructStruct: - case EOpConstructCooperativeMatrix: + case EOpConstructCooperativeMatrixNV: + case EOpConstructCooperativeMatrixKHR: if (type.isReference() || node->getType().isReference()) { // types must match to assign a reference @@ -1154,7 +1141,6 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt } bool canPromoteConstant = true; -#ifndef GLSLANG_WEB // GL_EXT_shader_16bit_storage can't do OpConstantComposite with // 16-bit types, so disable promotion for those types. // Many issues with this, from JohnK: @@ -1182,7 +1168,6 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt default: break; } -#endif if (canPromoteConstant && node->getAsConstantUnion()) return promoteConstantUnion(type.getBasicType(), node->getAsConstantUnion()); @@ -1479,10 +1464,6 @@ bool TIntermediate::isFPPromotion(TBasicType from, TBasicType to) const bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const { -#ifdef GLSLANG_WEB - return false; -#endif - switch (from) { case EbtInt: switch(to) { @@ -1563,10 +1544,6 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const { -#ifdef GLSLANG_WEB - return false; -#endif - if (to == EbtFloat && from == EbtFloat16) { return true; } else { @@ -1587,7 +1564,6 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const break; } break; -#ifndef GLSLANG_WEB case EbtInt8: case EbtUint8: case EbtInt16: @@ -1607,7 +1583,6 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const return true; } break; -#endif default: break; } @@ -1809,10 +1784,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBasicType uintType) { -#ifdef GLSLANG_WEB - return false; -#endif - switch(sintType) { case EbtInt8: switch(uintType) { @@ -1873,11 +1844,6 @@ static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBas static TBasicType getCorrespondingUnsignedType(TBasicType type) { -#ifdef GLSLANG_WEB - assert(type == EbtInt); - return EbtUint; -#endif - switch(type) { case EbtInt8: return EbtUint8; @@ -2003,8 +1969,11 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const if (type.getQualifier().isNonUniform()) return EOpConstructNonuniform; - if (type.isCoopMat()) - return EOpConstructCooperativeMatrix; + if (type.isCoopMatNV()) + return EOpConstructCooperativeMatrixNV; + + if (type.isCoopMatKHR()) + return EOpConstructCooperativeMatrixKHR; switch (type.getBasicType()) { case EbtStruct: @@ -2167,7 +2136,6 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const } } break; -#ifndef GLSLANG_WEB case EbtDouble: if (type.getMatrixCols()) { switch (type.getMatrixCols()) { @@ -2306,7 +2274,6 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const case EbtAccStruct: op = EOpConstructAccStruct; break; -#endif default: break; } @@ -2787,7 +2754,6 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/) if (aggRoot && aggRoot->getOp() == EOpNull) aggRoot->setOperator(EOpSequence); -#ifndef GLSLANG_WEB // Propagate 'noContraction' label in backward from 'precise' variables. glslang::PropagateNoContraction(*this); @@ -2801,7 +2767,6 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/) assert(0); break; } -#endif return true; } @@ -3521,20 +3486,28 @@ bool TIntermediate::promoteBinary(TIntermBinary& node) } if (left->getType().isCoopMat() || right->getType().isCoopMat()) { + // Operations on two cooperative matrices must have identical types if (left->getType().isCoopMat() && right->getType().isCoopMat() && - *left->getType().getTypeParameters() != *right->getType().getTypeParameters()) { + left->getType() != right->getType()) { return false; } switch (op) { case EOpMul: case EOpMulAssign: - if (left->getType().isCoopMat() && right->getType().isCoopMat()) { + // Mul not supported in NV_cooperative_matrix + if (left->getType().isCoopMatNV() && right->getType().isCoopMatNV()) { return false; } - if (op == EOpMulAssign && right->getType().isCoopMat()) { + // NV_cooperative_matrix supports MulAssign is for mat*=scalar only. + // KHR_cooperative_matrix supports it for mat*=mat as well. + if (op == EOpMulAssign && right->getType().isCoopMatNV()) { return false; } - node.setOp(op == EOpMulAssign ? EOpMatrixTimesScalarAssign : EOpMatrixTimesScalar); + // Use MatrixTimesScalar if either operand is not a matrix. Otherwise use Mul. + if (!left->getType().isCoopMat() || !right->getType().isCoopMat()) { + node.setOp(op == EOpMulAssign ? EOpMatrixTimesScalarAssign : EOpMatrixTimesScalar); + } + // In case of scalar*matrix, take the result type from the matrix. if (right->getType().isCoopMat()) { node.setType(right->getType()); } @@ -3887,16 +3860,6 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC #define PROMOTE(Set, CType, Get) leftUnionArray[i].Set(static_cast(rightUnionArray[i].Get())) #define PROMOTE_TO_BOOL(Get) leftUnionArray[i].setBConst(rightUnionArray[i].Get() != 0) -#ifdef GLSLANG_WEB -#define TO_ALL(Get) \ - switch (promoteTo) { \ - case EbtFloat: PROMOTE(setDConst, double, Get); break; \ - case EbtInt: PROMOTE(setIConst, int, Get); break; \ - case EbtUint: PROMOTE(setUConst, unsigned int, Get); break; \ - case EbtBool: PROMOTE_TO_BOOL(Get); break; \ - default: return node; \ - } -#else #define TO_ALL(Get) \ switch (promoteTo) { \ case EbtFloat16: PROMOTE(setDConst, double, Get); break; \ @@ -3913,14 +3876,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC case EbtBool: PROMOTE_TO_BOOL(Get); break; \ default: return node; \ } -#endif switch (node->getType().getBasicType()) { case EbtFloat: TO_ALL(getDConst); break; case EbtInt: TO_ALL(getIConst); break; case EbtUint: TO_ALL(getUConst); break; case EbtBool: TO_ALL(getBConst); break; -#ifndef GLSLANG_WEB case EbtFloat16: TO_ALL(getDConst); break; case EbtDouble: TO_ALL(getDConst); break; case EbtInt8: TO_ALL(getI8Const); break; @@ -3929,7 +3890,6 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC case EbtUint8: TO_ALL(getU8Const); break; case EbtUint16: TO_ALL(getU16Const); break; case EbtUint64: TO_ALL(getU64Const); break; -#endif default: return node; } } diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp index 616580f9..d73f403b 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp @@ -67,8 +67,6 @@ void TParseContextBase::outputMessage(const TSourceLoc& loc, const char* szReaso } } -#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL) - void C_DECL TParseContextBase::error(const TSourceLoc& loc, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...) { @@ -118,8 +116,6 @@ void C_DECL TParseContextBase::ppWarn(const TSourceLoc& loc, const char* szReaso va_end(args); } -#endif - // // Both test and if necessary, spit out an error, to see if the node is really // an l-value that can be operated on this way. @@ -140,7 +136,6 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, case EvqConst: message = "can't modify a const"; break; case EvqConstReadOnly: message = "can't modify a const"; break; case EvqUniform: message = "can't modify a uniform"; break; -#ifndef GLSLANG_WEB case EvqBuffer: if (node->getQualifier().isReadOnly()) message = "can't modify a readonly buffer"; @@ -151,7 +146,6 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, if (language != EShLangIntersect) message = "cannot modify hitAttributeNV in this stage"; break; -#endif default: // @@ -159,12 +153,12 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, // switch (node->getBasicType()) { case EbtSampler: - message = "can't modify a sampler"; + if (extensionTurnedOn(E_GL_ARB_bindless_texture) == false) + message = "can't modify a sampler"; break; case EbtVoid: message = "can't modify void"; break; -#ifndef GLSLANG_WEB case EbtAtomicUint: message = "can't modify an atomic_uint"; break; @@ -174,7 +168,9 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, case EbtRayQuery: message = "can't modify rayQueryEXT"; break; -#endif + case EbtHitObjectNV: + message = "can't modify hitObjectNV"; + break; default: break; } @@ -231,12 +227,12 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, // Test for and give an error if the node can't be read from. void TParseContextBase::rValueErrorCheck(const TSourceLoc& loc, const char* op, TIntermTyped* node) { - TIntermBinary* binaryNode = node->getAsBinaryNode(); - const TIntermSymbol* symNode = node->getAsSymbolNode(); - if (! node) return; + TIntermBinary* binaryNode = node->getAsBinaryNode(); + const TIntermSymbol* symNode = node->getAsSymbolNode(); + if (node->getQualifier().isWriteOnly()) { const TIntermTyped* leftMostTypeNode = TIntermediate::findLValueBase(node, true); diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp index e2ac43ca..806983a1 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -38,6 +38,7 @@ // #include "ParseHelper.h" +#include "Initialize.h" #include "Scan.h" #include "../OSDependent/osinclude.h" @@ -57,11 +58,8 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b infoSink, forwardCompatible, messages, entryPoint), inMain(false), blockName(nullptr), - limits(resources.limits) -#ifndef GLSLANG_WEB - , + limits(resources.limits), atomicUintOffsets(nullptr), anyIndexLimits(false) -#endif { // decide whether precision qualifiers should be ignored or respected if (isEsProfile() || spvVersion.vulkan > 0) { @@ -80,10 +78,6 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b globalBufferDefaults.layoutMatrix = ElmColumnMajor; globalBufferDefaults.layoutPacking = spvVersion.spv != 0 ? ElpStd430 : ElpShared; - // use storage buffer on SPIR-V 1.3 and up - if (spvVersion.spv >= EShTargetSpv_1_3) - intermediate.setUseStorageBuffer(); - globalInputDefaults.clear(); globalOutputDefaults.clear(); @@ -91,7 +85,6 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b globalSharedDefaults.layoutMatrix = ElmColumnMajor; globalSharedDefaults.layoutPacking = ElpStd430; -#ifndef GLSLANG_WEB // "Shaders in the transform // feedback capturing mode have an initial global default of // layout(xfb_buffer = 0) out;" @@ -103,7 +96,6 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b if (language == EShLangGeometry) globalOutputDefaults.layoutStream = 0; -#endif if (entryPoint != nullptr && entryPoint->size() > 0 && *entryPoint != "main") infoSink.info.message(EPrefixError, "Source entry point must be \"main\""); @@ -111,9 +103,7 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b TParseContext::~TParseContext() { -#ifndef GLSLANG_WEB delete [] atomicUintOffsets; -#endif } // Set up all default precisions as needed by the current environment. @@ -177,7 +167,6 @@ void TParseContext::setLimits(const TBuiltInResource& r) resources = r; intermediate.setLimits(r); -#ifndef GLSLANG_WEB anyIndexLimits = ! limits.generalAttributeMatrixVectorIndexing || ! limits.generalConstantMatrixVectorIndexing || ! limits.generalSamplerIndexing || @@ -192,7 +181,6 @@ void TParseContext::setLimits(const TBuiltInResource& r) atomicUintOffsets = new int[resources.maxAtomicCounterBindings]; for (int b = 0; b < resources.maxAtomicCounterBindings; ++b) atomicUintOffsets[b] = 0; -#endif } // @@ -339,7 +327,6 @@ void TParseContext::setInvariant(const TSourceLoc& loc, const char* builtin) { void TParseContext::handlePragma(const TSourceLoc& loc, const TVector& tokens) { -#ifndef GLSLANG_WEB if (pragmaCallback) pragmaCallback(loc.line, tokens); @@ -441,7 +428,6 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector& setInvariant(loc, "gl_FragColor"); setInvariant(loc, "gl_FragData"); } -#endif } // @@ -455,7 +441,6 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb if (symbol && symbol->getNumExtensions()) requireExtensions(loc, symbol->getNumExtensions(), symbol->getExtensions(), symbol->getName().c_str()); -#ifndef GLSLANG_WEB if (symbol && symbol->isReadOnly()) { // All shared things containing an unsized array must be copied up // on first use, so that all future references will share its array structure, @@ -475,7 +460,6 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb makeEditable(symbol); } } -#endif const TVariable* variable; const TAnonMember* anon = symbol ? symbol->getAsAnonMember() : nullptr; @@ -580,7 +564,6 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn // at least one of base and index is not a front-end constant variable... TIntermTyped* result = nullptr; -#ifndef GLSLANG_WEB if (base->isReference() && ! base->isArray()) { requireExtensions(loc, 1, &E_GL_EXT_buffer_reference2, "buffer reference indexing"); if (base->getType().getReferentType()->containsUnsizedArray()) { @@ -599,15 +582,22 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn } if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) handleIoResizeArrayAccess(loc, base); -#endif if (index->getQualifier().isFrontEndConstant()) checkIndex(loc, base->getType(), indexValue); if (index->getQualifier().isFrontEndConstant()) { -#ifndef GLSLANG_WEB if (base->getType().isUnsizedArray()) { base->getWritableType().updateImplicitArraySize(indexValue + 1); + base->getWritableType().setImplicitlySized(true); + if (base->getQualifier().builtIn == EbvClipDistance && + indexValue >= resources.maxClipDistances) { + error(loc, "gl_ClipDistance", "[", "array index out of range '%d'", indexValue); + } + else if (base->getQualifier().builtIn == EbvCullDistance && + indexValue >= resources.maxCullDistances) { + error(loc, "gl_CullDistance", "[", "array index out of range '%d'", indexValue); + } // For 2D per-view builtin arrays, update the inner dimension size in parent type if (base->getQualifier().isPerView() && base->getQualifier().builtIn != EbvNone) { TIntermBinary* binaryNode = base->getAsBinaryNode(); @@ -619,11 +609,9 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn } } } else -#endif checkIndex(loc, base->getType(), indexValue); result = intermediate.addIndex(EOpIndexDirect, base, index, loc); } else { -#ifndef GLSLANG_WEB if (base->getType().isUnsizedArray()) { // we have a variable index into an unsized array, which is okay, // depending on the situation @@ -635,7 +623,6 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn } base->getWritableType().setArrayVariablyIndexed(); } -#endif if (base->getBasicType() == EbtBlock) { if (base->getQualifier().storage == EvqBuffer) requireProfile(base->getLoc(), ~EEsProfile, "variable indexing buffer block array"); @@ -671,7 +658,6 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn } result->setType(newType); -#ifndef GLSLANG_WEB inheritMemoryQualifiers(base->getQualifier(), result->getWritableType().getQualifier()); // Propagate nonuniform @@ -680,13 +666,10 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn if (anyIndexLimits) handleIndexLimits(loc, base, index); -#endif return result; } -#ifndef GLSLANG_WEB - // for ES 2.0 (version 100) limitations for almost all index operations except vertex-shader uniforms void TParseContext::handleIndexLimits(const TSourceLoc& /*loc*/, TIntermTyped* base, TIntermTyped* index) { @@ -836,12 +819,16 @@ int TParseContext::getIoArrayImplicitSize(const TQualifier &qualifier, TString * } else if (language == EShLangMesh) { unsigned int maxPrimitives = intermediate.getPrimitives() != TQualifier::layoutNotSet ? intermediate.getPrimitives() : 0; - if (qualifier.builtIn == EbvPrimitiveIndicesNV || qualifier.builtIn == EbvPrimitiveTriangleIndicesEXT || - qualifier.builtIn == EbvPrimitiveLineIndicesEXT || qualifier.builtIn == EbvPrimitivePointIndicesEXT) { + if (qualifier.builtIn == EbvPrimitiveIndicesNV) { expectedSize = maxPrimitives * TQualifier::mapGeometryToSize(intermediate.getOutputPrimitive()); str = "max_primitives*"; str += TQualifier::getGeometryString(intermediate.getOutputPrimitive()); } + else if (qualifier.builtIn == EbvPrimitiveTriangleIndicesEXT || qualifier.builtIn == EbvPrimitiveLineIndicesEXT || + qualifier.builtIn == EbvPrimitivePointIndicesEXT) { + expectedSize = maxPrimitives; + str = "max_primitives"; + } else if (qualifier.isPerPrimitive()) { expectedSize = maxPrimitives; str = "max_primitives"; @@ -876,8 +863,6 @@ void TParseContext::checkIoArrayConsistency(const TSourceLoc& loc, int requiredS } } -#endif // GLSLANG_WEB - // Handle seeing a binary node with a math operation. // Returns nullptr if not semantically allowed. TIntermTyped* TParseContext::handleBinaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right) @@ -1022,14 +1007,22 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm inheritMemoryQualifiers(base->getQualifier(), result->getWritableType().getQualifier()); } else { auto baseSymbol = base; - while (baseSymbol->getAsSymbolNode() == nullptr) - baseSymbol = baseSymbol->getAsBinaryNode()->getLeft(); - TString structName; - structName.append("\'").append(baseSymbol->getAsSymbolNode()->getName().c_str()).append( "\'"); - error(loc, "no such field in structure", field.c_str(), structName.c_str()); + while (baseSymbol->getAsSymbolNode() == nullptr) { + auto binaryNode = baseSymbol->getAsBinaryNode(); + if (binaryNode == nullptr) break; + baseSymbol = binaryNode->getLeft(); + } + if (baseSymbol->getAsSymbolNode() != nullptr) { + TString structName; + structName.append("\'").append(baseSymbol->getAsSymbolNode()->getName().c_str()).append("\'"); + error(loc, "no such field in structure", field.c_str(), structName.c_str()); + } else { + error(loc, "no such field in structure", field.c_str(), ""); + } } } else - error(loc, "does not apply to this type:", field.c_str(), base->getType().getCompleteString(intermediate.getEnhancedMsgs()).c_str()); + error(loc, "does not apply to this type:", field.c_str(), + base->getType().getCompleteString(intermediate.getEnhancedMsgs()).c_str()); // Propagate noContraction up the dereference chain if (base->getQualifier().isNoContraction()) @@ -1148,7 +1141,6 @@ TFunction* TParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunct TSymbol* symbol = symbolTable.find(function.getMangledName(), &builtIn); if (symbol && symbol->getAsFunction() && builtIn) requireProfile(loc, ~EEsProfile, "redefinition of built-in function"); -#ifndef GLSLANG_WEB // Check the validity of using spirv_literal qualifier for (int i = 0; i < function.getParamCount(); ++i) { if (function[i].type->getQualifier().isSpirvLiteral() && function.getBuiltInOp() != EOpSpirvInst) @@ -1160,19 +1152,16 @@ TFunction* TParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunct // respect this redeclared one. if (symbol && builtIn && function.getBuiltInOp() == EOpSpirvInst) symbol = nullptr; -#endif - const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0; + const TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr; if (prevDec) { if (prevDec->isPrototyped() && prototype) profileRequires(loc, EEsProfile, 300, nullptr, "multiple prototypes for same function"); if (prevDec->getType() != function.getType()) error(loc, "overloaded functions must have the same return type", function.getName().c_str(), ""); -#ifndef GLSLANG_WEB if (prevDec->getSpirvInstruction() != function.getSpirvInstruction()) { error(loc, "overloaded functions must have the same qualifiers", function.getName().c_str(), "spirv_instruction"); } -#endif for (int i = 0; i < prevDec->getParamCount(); ++i) { if ((*prevDec)[i].type->getQualifier().storage != function[i].type->getQualifier().storage) error(loc, "overloaded functions must have the same parameter storage qualifiers for argument", function[i].type->getStorageQualifierString(), "%d", i+1); @@ -1374,7 +1363,6 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction if (lValueErrorCheck(arguments->getLoc(), "assign", arg->getAsTyped())) error(arguments->getLoc(), "Non-L-value cannot be passed for 'out' or 'inout' parameters.", "out", ""); } -#ifndef GLSLANG_WEB if (formalQualifier.isSpirvLiteral()) { if (!arg->getAsTyped()->getQualifier().isFrontEndConstant()) { error(arguments->getLoc(), @@ -1382,12 +1370,11 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction "spirv_literal", ""); } } -#endif const TType& argType = arg->getAsTyped()->getType(); const TQualifier& argQualifier = argType.getQualifier(); - if (argQualifier.isMemory() && (argType.containsOpaque() || argType.isReference())) { + bool containsBindlessSampler = intermediate.getBindlessMode() && argType.containsSampler(); + if (argQualifier.isMemory() && !containsBindlessSampler && (argType.containsOpaque() || argType.isReference())) { const char* message = "argument cannot drop memory qualifier when passed to formal parameter"; -#ifndef GLSLANG_WEB if (argQualifier.volatil && ! formalQualifier.volatil) error(arguments->getLoc(), message, "volatile", ""); if (argQualifier.coherent && ! (formalQualifier.devicecoherent || formalQualifier.coherent)) @@ -1407,7 +1394,6 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction // Don't check 'restrict', it is different than the rest: // "...but only restrict can be taken away from a calling argument, by a formal parameter that // lacks the restrict qualifier..." -#endif } if (!builtIn && argQualifier.getFormat() != formalQualifier.getFormat()) { // we have mismatched formats, which should only be allowed if writeonly @@ -1437,11 +1423,9 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction if (builtIn && fnCandidate->getBuiltInOp() != EOpNull) { // A function call mapped to a built-in operation. result = handleBuiltInFunctionCall(loc, arguments, *fnCandidate); -#ifndef GLSLANG_WEB } else if (fnCandidate->getBuiltInOp() == EOpSpirvInst) { // When SPIR-V instruction qualifier is specified, the function call is still mapped to a built-in operation. result = handleBuiltInFunctionCall(loc, arguments, *fnCandidate); -#endif } else { // This is a function call not mapped to built-in operator. // It could still be a built-in function, but only if PureOperatorBuiltins == false. @@ -1461,11 +1445,9 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName()); } -#ifndef GLSLANG_WEB if (builtIn) nonOpBuiltInCheck(loc, *fnCandidate, *call); else -#endif userFunctionCallCheck(loc, *call); } @@ -1483,7 +1465,8 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction if (result->getAsTyped()->getType().isCoopMat() && !result->getAsTyped()->getType().isParameterized()) { - assert(fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAdd); + assert(fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAdd || + fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAddNV); result->setType(result->getAsAggregate()->getSequence()[2]->getAsTyped()->getType()); } @@ -1519,7 +1502,6 @@ TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNo } else if (result->getAsOperator()) builtInOpCheck(loc, function, *result->getAsOperator()); -#ifndef GLSLANG_WEB // Special handling for function call with SPIR-V instruction qualifier specified if (function.getBuiltInOp() == EOpSpirvInst) { if (auto agg = result->getAsAggregate()) { @@ -1546,7 +1528,6 @@ TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNo } else assert(0); } -#endif return result; } @@ -1649,9 +1630,7 @@ void TParseContext::computeBuiltinPrecisions(TIntermTyped& node, const TFunction TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermTyped* value) { -#ifndef GLSLANG_WEB storage16BitAssignmentCheck(loc, value->getType(), "return"); -#endif functionReturnsValue = true; TIntermBranch* branch = nullptr; @@ -1671,9 +1650,13 @@ TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermType error(loc, "type does not match, or is not convertible to, the function's return type", "return", ""); branch = intermediate.addBranch(EOpReturn, value, loc); } - } else + } else { + if (value->getType().isTexture() || value->getType().isImage()) { + if (!extensionTurnedOn(E_GL_ARB_bindless_texture)) + error(loc, "sampler or image can be used as return type only when the extension GL_ARB_bindless_texture enabled", "return", ""); + } branch = intermediate.addBranch(EOpReturn, value, loc); - + } branch->updatePrecision(currentFunctionType->getQualifier().precision); return branch; } @@ -1681,7 +1664,6 @@ TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermType // See if the operation is being done in an illegal location. void TParseContext::checkLocation(const TSourceLoc& loc, TOperator op) { -#ifndef GLSLANG_WEB switch (op) { case EOpBarrier: if (language == EShLangTessControl) { @@ -1734,7 +1716,6 @@ void TParseContext::checkLocation(const TSourceLoc& loc, TOperator op) default: break; } -#endif } // Finish processing object.length(). This started earlier in handleDotDereference(), where @@ -1752,7 +1733,6 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction const TType& type = intermNode->getAsTyped()->getType(); if (type.isArray()) { if (type.isUnsizedArray()) { -#ifndef GLSLANG_WEB if (intermNode->getAsSymbolNode() && isIoResizeArray(type)) { // We could be between a layout declaration that gives a built-in io array implicit size and // a user redeclaration of that array, meaning we have to substitute its implicit size here @@ -1764,16 +1744,13 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction length = getIoArrayImplicitSize(type.getQualifier()); } } -#endif if (length == 0) { -#ifndef GLSLANG_WEB if (intermNode->getAsSymbolNode() && isIoResizeArray(type)) error(loc, "", function->getName().c_str(), "array must first be sized by a redeclaration or layout qualifier"); else if (isRuntimeLength(*intermNode->getAsTyped())) { // Create a unary op and let the back end handle it return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, TType(EbtInt)); } else -#endif error(loc, "", function->getName().c_str(), "array must be declared with a size before using this method"); } } else if (type.getOuterArrayNode()) { @@ -1806,7 +1783,6 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction // void TParseContext::addInputArgumentConversions(const TFunction& function, TIntermNode*& arguments) const { -#ifndef GLSLANG_WEB TIntermAggregate* aggregate = arguments->getAsAggregate(); // Process each argument's conversion @@ -1834,7 +1810,6 @@ void TParseContext::addInputArgumentConversions(const TFunction& function, TInte } } } -#endif } // @@ -1846,9 +1821,6 @@ void TParseContext::addInputArgumentConversions(const TFunction& function, TInte // TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& function, TIntermAggregate& intermNode) const { -#ifdef GLSLANG_WEB - return &intermNode; -#else TIntermSequence& arguments = intermNode.getSequence(); // Will there be any output conversions? @@ -1916,7 +1888,6 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct conversionTree = intermediate.setAggregateOperator(conversionTree, EOpComma, intermNode.getType(), intermNode.getLoc()); return conversionTree; -#endif } TIntermTyped* TParseContext::addAssign(const TSourceLoc& loc, TOperator op, TIntermTyped* left, TIntermTyped* right) @@ -1924,6 +1895,9 @@ TIntermTyped* TParseContext::addAssign(const TSourceLoc& loc, TOperator op, TInt if ((op == EOpAddAssign || op == EOpSubAssign) && left->isReference()) requireExtensions(loc, 1, &E_GL_EXT_buffer_reference2, "+= and -= on a buffer reference"); + if (op == EOpAssign && left->getBasicType() == EbtSampler && right->getBasicType() == EbtSampler) + requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "sampler assignment for bindless texture"); + return intermediate.addAssign(op, left, right, loc); } @@ -2123,7 +2097,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan TString featureString; const char* feature = nullptr; switch (callNode.getOp()) { -#ifndef GLSLANG_WEB case EOpTextureGather: case EOpTextureGatherOffset: case EOpTextureGatherOffsets: @@ -2264,7 +2237,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan break; } -#endif case EOpTextureOffset: case EOpTextureFetchOffset: @@ -2292,12 +2264,10 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan if (arg > 0) { -#ifndef GLSLANG_WEB bool f16ShadowCompare = (*argp)[1]->getAsTyped()->getBasicType() == EbtFloat16 && arg0->getType().getSampler().shadow; if (f16ShadowCompare) ++arg; -#endif if (! (*argp)[arg]->getAsTyped()->getQualifier().isConstant()) error(loc, "argument must be compile-time constant", "texel offset", ""); else if ((*argp)[arg]->getAsConstantUnion()) { @@ -2324,7 +2294,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan break; } -#ifndef GLSLANG_WEB case EOpTraceNV: if (!(*argp)[10]->getAsConstantUnion()) error(loc, "argument must be compile-time constant", "payload number", "a"); @@ -2356,6 +2325,79 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan } break; + case EOpHitObjectTraceRayNV: + if (!(*argp)[11]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "payload number", ""); + else { + unsigned int location = (*argp)[11]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); + if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0) + error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location); + } + break; + case EOpHitObjectTraceRayMotionNV: + if (!(*argp)[12]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "payload number", ""); + else { + unsigned int location = (*argp)[12]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); + if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0) + error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location); + } + break; + case EOpHitObjectExecuteShaderNV: + if (!(*argp)[1]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "payload number", ""); + else { + unsigned int location = (*argp)[1]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); + if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0) + error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location); + } + break; + case EOpHitObjectRecordHitNV: + if (!(*argp)[12]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "hitobjectattribute number", ""); + else { + unsigned int location = (*argp)[12]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); + if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0) + error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location); + } + break; + case EOpHitObjectRecordHitMotionNV: + if (!(*argp)[13]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "hitobjectattribute number", ""); + else { + unsigned int location = (*argp)[13]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); + if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0) + error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location); + } + break; + case EOpHitObjectRecordHitWithIndexNV: + if (!(*argp)[11]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "hitobjectattribute number", ""); + else { + unsigned int location = (*argp)[11]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); + if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0) + error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location); + } + break; + case EOpHitObjectRecordHitWithIndexMotionNV: + if (!(*argp)[12]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "hitobjectattribute number", ""); + else { + unsigned int location = (*argp)[12]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); + if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0) + error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location); + } + break; + case EOpHitObjectGetAttributesNV: + if (!(*argp)[1]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "hitobjectattribute number", ""); + else { + unsigned int location = (*argp)[1]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst(); + if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0) + error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location); + } + break; + case EOpRayQueryGetIntersectionType: case EOpRayQueryGetIntersectionT: case EOpRayQueryGetIntersectionInstanceCustomIndex: @@ -2369,6 +2411,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan case EOpRayQueryGetIntersectionObjectRayOrigin: case EOpRayQueryGetIntersectionObjectToWorld: case EOpRayQueryGetIntersectionWorldToObject: + case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: if (!(*argp)[1]->getAsConstantUnion()) error(loc, "argument must be compile-time constant", "committed", ""); break; @@ -2581,7 +2624,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan } break; -#endif default: break; @@ -2644,9 +2686,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan } } -#ifndef GLSLANG_WEB - -extern bool PureOperatorBuiltins; // Deprecated! Use PureOperatorBuiltins == true instead, in which case this // functionality is handled in builtInOpCheck() instead of here. @@ -2772,8 +2811,6 @@ void TParseContext::nonOpBuiltInCheck(const TSourceLoc& loc, const TFunction& fn } } -#endif - // // Do any extra checking for a user function call. // @@ -2807,6 +2844,14 @@ TFunction* TParseContext::handleConstructorCall(const TSourceLoc& loc, const TPu profileRequires(loc, EEsProfile, 300, nullptr, "arrayed constructor"); } + // Reuse EOpConstructTextureSampler for bindless image constructor + // uvec2 imgHandle; + // imageLoad(image1D(imgHandle), 0); + if (type.isImage() && extensionTurnedOn(E_GL_ARB_bindless_texture)) + { + intermediate.setBindlessImageMode(currentCaller, AstRefTypeFunc); + } + TOperator op = intermediate.mapTypeToConstructorOp(type); if (op == EOpNull) { @@ -2924,7 +2969,6 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt bool errorReturn = false; switch(binaryNode->getOp()) { -#ifndef GLSLANG_WEB case EOpIndexDirect: case EOpIndexIndirect: // ... tessellation control shader ... @@ -2941,7 +2985,6 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt } } break; // left node is checked by base class -#endif case EOpVectorSwizzle: errorReturn = lValueErrorCheck(loc, op, binaryNode->getLeft()); if (!errorReturn) { @@ -3136,7 +3179,7 @@ void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* iden ppWarn(loc, "\"defined\" is (un)defined:", op, identifier); else ppError(loc, "\"defined\" can't be (un)defined:", op, identifier); - else if (strstr(identifier, "__") != 0 && !extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) { + else if (strstr(identifier, "__") != nullptr && !extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) { // The extension GL_EXT_spirv_intrinsics allows us to declare macros prefixed with "__". if (isEsProfile() && version >= 300 && (strcmp(identifier, "__LINE__") == 0 || @@ -3159,10 +3202,6 @@ void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* iden // bool TParseContext::lineContinuationCheck(const TSourceLoc& loc, bool endOfComment) { -#ifdef GLSLANG_WEB - return true; -#endif - const char* message = "line continuation"; bool lineContinuationAllowed = (isEsProfile() && version >= 300) || @@ -3219,7 +3258,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T // it, in which case the type comes from the argument instead of from the // constructor function. switch (op) { -#ifndef GLSLANG_WEB case EOpConstructNonuniform: if (node != nullptr && node->getAsTyped() != nullptr) { type.shallowCopy(node->getAsTyped()->getType()); @@ -3227,7 +3265,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T type.getQualifier().nonUniform = true; } break; -#endif default: type.shallowCopy(function.getType()); break; @@ -3253,7 +3290,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructMat4x2: case EOpConstructMat4x3: case EOpConstructMat4x4: -#ifndef GLSLANG_WEB case EOpConstructDMat2x2: case EOpConstructDMat2x3: case EOpConstructDMat2x4: @@ -3272,7 +3308,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructF16Mat4x2: case EOpConstructF16Mat4x3: case EOpConstructF16Mat4x4: -#endif constructingMatrix = true; break; default: @@ -3339,7 +3374,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T if (op == EOpConstructNonuniform) constType = false; -#ifndef GLSLANG_WEB switch (op) { case EOpConstructFloat16: case EOpConstructF16Vec2: @@ -3379,7 +3413,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T default: break; } -#endif // inherit constness from children if (constType) { @@ -3400,7 +3433,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructUVec2: case EOpConstructUVec3: case EOpConstructUVec4: -#ifndef GLSLANG_WEB case EOpConstructUint8: case EOpConstructInt16: case EOpConstructUint16: @@ -3424,7 +3456,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructU64Vec2: case EOpConstructU64Vec3: case EOpConstructU64Vec4: -#endif // This was the list of valid ones, if they aren't converting from float // and aren't making an array. makeSpecConst = ! floatArgument && ! type.isArray(); @@ -3535,13 +3566,24 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T } TIntermTyped* typed = node->getAsTyped(); + if (type.isCoopMat() && typed->getType().isCoopMat() && + !type.sameCoopMatShapeAndUse(typed->getType())) { + error(loc, "Cooperative matrix type parameters mismatch", constructorString.c_str(), ""); + return true; + } + if (typed == nullptr) { error(loc, "constructor argument does not have a type", constructorString.c_str(), ""); return true; } if (op != EOpConstructStruct && op != EOpConstructNonuniform && typed->getBasicType() == EbtSampler) { - error(loc, "cannot convert a sampler", constructorString.c_str(), ""); - return true; + if (op == EOpConstructUVec2 && extensionTurnedOn(E_GL_ARB_bindless_texture)) { + intermediate.setBindlessTextureMode(currentCaller, AstRefTypeFunc); + } + else { + error(loc, "cannot convert a sampler", constructorString.c_str(), ""); + return true; + } } if (op != EOpConstructStruct && typed->isAtomic()) { error(loc, "cannot convert an atomic_uint", constructorString.c_str(), ""); @@ -3561,6 +3603,26 @@ bool TParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const { TString constructorName = function.getType().getBasicTypeString(); // TODO: performance: should not be making copy; interface needs to change const char* token = constructorName.c_str(); + // verify the constructor for bindless texture, the input must be ivec2 or uvec2 + if (function.getParamCount() == 1) { + TType* pType = function[0].type; + TBasicType basicType = pType->getBasicType(); + bool isIntegerVec2 = ((basicType == EbtUint || basicType == EbtInt) && pType->getVectorSize() == 2); + bool bindlessMode = extensionTurnedOn(E_GL_ARB_bindless_texture); + if (isIntegerVec2 && bindlessMode) { + if (pType->getSampler().isImage()) + intermediate.setBindlessImageMode(currentCaller, AstRefTypeFunc); + else + intermediate.setBindlessTextureMode(currentCaller, AstRefTypeFunc); + return false; + } else { + if (!bindlessMode) + error(loc, "sampler-constructor requires the extension GL_ARB_bindless_texture enabled", token, ""); + else + error(loc, "sampler-constructor requires the input to be ivec2 or uvec2", token, ""); + return true; + } + } // exactly two arguments needed if (function.getParamCount() != 2) { @@ -3656,18 +3718,38 @@ void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const if (type.getQualifier().storage == EvqUniform) return; - if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtSampler)) - error(loc, "non-uniform struct contains a sampler or image:", type.getBasicTypeString().c_str(), identifier.c_str()); + if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtSampler)) { + // For bindless texture, sampler can be declared as an struct member + if (extensionTurnedOn(E_GL_ARB_bindless_texture)) { + if (type.getSampler().isImage()) + intermediate.setBindlessImageMode(currentCaller, AstRefTypeVar); + else + intermediate.setBindlessTextureMode(currentCaller, AstRefTypeVar); + } + else { + error(loc, "non-uniform struct contains a sampler or image:", type.getBasicTypeString().c_str(), identifier.c_str()); + } + } else if (type.getBasicType() == EbtSampler && type.getQualifier().storage != EvqUniform) { - // non-uniform sampler - // not yet: okay if it has an initializer - // if (! initializer) - error(loc, "sampler/image types can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str()); + // For bindless texture, sampler can be declared as an input/output/block member + if (extensionTurnedOn(E_GL_ARB_bindless_texture)) { + if (type.getSampler().isImage()) + intermediate.setBindlessImageMode(currentCaller, AstRefTypeVar); + else + intermediate.setBindlessTextureMode(currentCaller, AstRefTypeVar); + } + else { + // non-uniform sampler + // not yet: okay if it has an initializer + // if (! initializer) + if (type.getSampler().isAttachmentEXT() && type.getQualifier().storage != EvqTileImageEXT) + error(loc, "can only be used in tileImageEXT variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str()); + else if (type.getQualifier().storage != EvqTileImageEXT) + error(loc, "sampler/image types can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str()); + } } } -#ifndef GLSLANG_WEB - void TParseContext::atomicUintCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) { if (type.getQualifier().storage == EvqUniform) @@ -3692,8 +3774,6 @@ void TParseContext::accStructCheck(const TSourceLoc& loc, const TType& type, con } -#endif // GLSLANG_WEB - void TParseContext::transparentOpaqueCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) { if (parsingBuiltins) @@ -3728,7 +3808,7 @@ void TParseContext::memberQualifierCheck(glslang::TPublicType& publicType) // // Check/fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level. // -void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& qualifier, bool isMemberCheck) +void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& qualifier, bool isMemberCheck, const TPublicType* publicType) { bool nonuniformOkay = false; @@ -3764,6 +3844,11 @@ void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& q { requireExtensions(loc, 1, &E_GL_EXT_scalar_block_layout, "default std430 layout for uniform"); } + + if (publicType != nullptr && publicType->isImage() && + (qualifier.layoutFormat > ElfExtSizeGuard && qualifier.layoutFormat < ElfCount)) + qualifier.layoutFormat = mapLegacyLayoutFormat(qualifier.layoutFormat, publicType->sampler.getBasicType()); + break; default: break; @@ -3772,13 +3857,11 @@ void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& q if (!nonuniformOkay && qualifier.isNonUniform()) error(loc, "for non-parameter, can only apply to 'in' or no storage qualifier", "nonuniformEXT", ""); -#ifndef GLSLANG_WEB if (qualifier.isSpirvByReference()) error(loc, "can only apply to parameter", "spirv_by_reference", ""); if (qualifier.isSpirvLiteral()) error(loc, "can only apply to parameter", "spirv_literal", ""); -#endif // Storage qualifier isn't ready for memberQualifierCheck, we should skip invariantCheck for it. if (!isMemberCheck || structNestingLevel > 0) @@ -3824,8 +3907,10 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali return; } - if (isTypeInt(publicType.basicType) || publicType.basicType == EbtDouble) - profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output"); + if (isTypeInt(publicType.basicType) || publicType.basicType == EbtDouble) { + profileRequires(loc, EEsProfile, 300, nullptr, "non-float shader input/output"); + profileRequires(loc, ~EEsProfile, 130, nullptr, "non-float shader input/output"); + } if (!qualifier.flat && !qualifier.isExplicitInterpolation() && !qualifier.isPervertexNV() && !qualifier.isPervertexEXT()) { if (isTypeInt(publicType.basicType) || @@ -3856,7 +3941,7 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali switch (language) { case EShLangVertex: if (publicType.basicType == EbtStruct) { - error(loc, "cannot be a structure or array", GetStorageQualifierString(qualifier.storage), ""); + error(loc, "cannot be a structure", GetStorageQualifierString(qualifier.storage), ""); return; } if (publicType.arraySizes) { @@ -3882,12 +3967,10 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali if (! symbolTable.atBuiltInLevel()) error(loc, "global storage input qualifier cannot be used in a compute shader", "in", ""); break; -#ifndef GLSLANG_WEB case EShLangTessControl: if (qualifier.patch) error(loc, "can only use on output in tessellation-control shader", "patch", ""); break; -#endif default: break; } @@ -3926,12 +4009,10 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali case EShLangCompute: error(loc, "global storage output qualifier cannot be used in a compute shader", "out", ""); break; -#ifndef GLSLANG_WEB case EShLangTessEvaluation: if (qualifier.patch) error(loc, "can only use on input in tessellation-evaluation shader", "patch", ""); break; -#endif default: break; } @@ -3999,7 +4080,6 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons if (dst.precision == EpqNone || (force && src.precision != EpqNone)) dst.precision = src.precision; -#ifndef GLSLANG_WEB if (!force && ((src.coherent && (dst.devicecoherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent || dst.shadercallcoherent)) || (src.devicecoherent && (dst.coherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent || dst.shadercallcoherent)) || (src.queuefamilycoherent && (dst.coherent || dst.devicecoherent || dst.workgroupcoherent || dst.subgroupcoherent || dst.shadercallcoherent)) || @@ -4009,7 +4089,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons error(loc, "only one coherent/devicecoherent/queuefamilycoherent/workgroupcoherent/subgroupcoherent/shadercallcoherent qualifier allowed", GetPrecisionQualifierString(src.precision), ""); } -#endif + // Layout qualifiers mergeObjectLayoutQualifiers(dst, src, false); @@ -4021,7 +4101,6 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons MERGE_SINGLETON(smooth); MERGE_SINGLETON(flat); MERGE_SINGLETON(specConstant); -#ifndef GLSLANG_WEB MERGE_SINGLETON(noContraction); MERGE_SINGLETON(nopersp); MERGE_SINGLETON(explicitInterp); @@ -4042,9 +4121,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons MERGE_SINGLETON(readonly); MERGE_SINGLETON(writeonly); MERGE_SINGLETON(nonUniform); -#endif -#ifndef GLSLANG_WEB // SPIR-V storage class qualifier (GL_EXT_spirv_intrinsics) dst.spirvStorageClass = src.spirvStorageClass; @@ -4071,13 +4148,12 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons if (dstSpirvDecorate.decorates.find(decorateString.first) != dstSpirvDecorate.decorates.end()) error(loc, "too many SPIR-V decorate qualifiers", "spirv_decorate_string", "(decoration=%u)", decorateString.first); else - dstSpirvDecorate.decorates.insert(decorateString); + dstSpirvDecorate.decorateStrings.insert(decorateString); } } else { dst.spirvDecorate = src.spirvDecorate; } } -#endif if (repeated) error(loc, "replicated qualifiers", "", ""); @@ -4141,17 +4217,18 @@ TPrecisionQualifier TParseContext::getDefaultPrecision(TPublicType& publicType) return defaultPrecision[publicType.basicType]; } -void TParseContext::precisionQualifierCheck(const TSourceLoc& loc, TBasicType baseType, TQualifier& qualifier) +void TParseContext::precisionQualifierCheck(const TSourceLoc& loc, TBasicType baseType, TQualifier& qualifier, bool isCoopMat) { // Built-in symbols are allowed some ambiguous precisions, to be pinned down // later by context. if (! obeyPrecisionQualifiers() || parsingBuiltins) return; -#ifndef GLSLANG_WEB if (baseType == EbtAtomicUint && qualifier.precision != EpqNone && qualifier.precision != EpqHigh) error(loc, "atomic counters can only be highp", "atomic_uint", ""); -#endif + + if (isCoopMat) + return; if (baseType == EbtFloat || baseType == EbtUint || baseType == EbtInt || baseType == EbtSampler || baseType == EbtAtomicUint) { if (qualifier.precision == EpqNone) { @@ -4168,7 +4245,7 @@ void TParseContext::precisionQualifierCheck(const TSourceLoc& loc, TBasicType ba void TParseContext::parameterTypeCheck(const TSourceLoc& loc, TStorageQualifier qualifier, const TType& type) { - if ((qualifier == EvqOut || qualifier == EvqInOut) && type.isOpaque()) + if ((qualifier == EvqOut || qualifier == EvqInOut) && type.isOpaque() && !intermediate.getBindlessMode()) error(loc, "samplers and atomic_uints cannot be output parameters", type.getBasicTypeString().c_str(), ""); if (!parsingBuiltins && type.contains16BitFloat()) requireFloat16Arithmetic(loc, type.getBasicTypeString().c_str(), "float16 types can only be in uniform block or buffer storage"); @@ -4197,7 +4274,8 @@ bool TParseContext::containsFieldWithBasicType(const TType& type, TBasicType bas // // Do size checking for an array type's size. // -void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TArraySize& sizePair, const char *sizeType) +void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TArraySize& sizePair, + const char* sizeType, const bool allowZero) { bool isConst = false; sizePair.node = nullptr; @@ -4217,9 +4295,8 @@ void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TA TIntermSymbol* symbol = expr->getAsSymbolNode(); if (symbol && symbol->getConstArray().size() > 0) size = symbol->getConstArray()[0].getIConst(); - } else if (expr->getAsUnaryNode() && - expr->getAsUnaryNode()->getOp() == glslang::EOpArrayLength && - expr->getAsUnaryNode()->getOperand()->getType().isCoopMat()) { + } else if (expr->getAsUnaryNode() && expr->getAsUnaryNode()->getOp() == glslang::EOpArrayLength && + expr->getAsUnaryNode()->getOperand()->getType().isCoopMatNV()) { isConst = true; size = 1; sizePair.node = expr->getAsUnaryNode(); @@ -4233,9 +4310,16 @@ void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TA return; } - if (size <= 0) { - error(loc, sizeType, "", "must be a positive integer"); - return; + if (allowZero) { + if (size < 0) { + error(loc, sizeType, "", "must be a non-negative integer"); + return; + } + } else { + if (size <= 0) { + error(loc, sizeType, "", "must be a positive integer"); + return; + } } } @@ -4333,8 +4417,6 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua (qualifier.storage != EvqTemporary && qualifier.storage != EvqGlobal && qualifier.storage != EvqShared && qualifier.storage != EvqConst)) error(loc, "only outermost dimension of an array of arrays can be a specialization constant", "[]", ""); -#ifndef GLSLANG_WEB - // desktop always allows outer-dimension-unsized variable arrays, if (!isEsProfile()) return; @@ -4374,8 +4456,6 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua break; } -#endif - // last member of ssbo block exception: if (qualifier.storage == EvqBuffer && lastMember) return; @@ -4420,7 +4500,6 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie if (symbolTable.atGlobalLevel()) trackLinkage(*symbol); -#ifndef GLSLANG_WEB if (! symbolTable.atBuiltInLevel()) { if (isIoResizeArray(type)) { ioArraySymbolResizeList.push_back(symbol); @@ -4428,7 +4507,6 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie } else fixIoArraySize(loc, symbol->getWritableType()); } -#endif return; } @@ -4466,7 +4544,6 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie return; } -#ifndef GLSLANG_WEB if (existingType.isSizedArray()) { // be more leniant for input arrays to geometry shaders and tessellation control outputs, where the redeclaration is the same size if (! (isIoResizeArray(type) && existingType.getOuterArraySize() == type.getOuterArraySize())) @@ -4480,11 +4557,8 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie if (isIoResizeArray(type)) checkIoArraysConsistency(loc); -#endif } -#ifndef GLSLANG_WEB - // Policy and error check for needing a runtime sized array. void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermTyped& base) { @@ -4512,7 +4586,7 @@ void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermType // check for additional things allowed by GL_EXT_nonuniform_qualifier if (base.getBasicType() == EbtSampler || base.getBasicType() == EbtAccStruct || base.getBasicType() == EbtRayQuery || - (base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer())) + base.getBasicType() == EbtHitObjectNV || (base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer())) requireExtensions(loc, 1, &E_GL_EXT_nonuniform_qualifier, "variable index"); else error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable"); @@ -4567,8 +4641,6 @@ void TParseContext::checkAndResizeMeshViewDim(const TSourceLoc& loc, TType& type } } -#endif // GLSLANG_WEB - // Returns true if the first argument to the #line directive is the line number for the next line. // // Desktop, pre-version 3.30: "After processing this directive @@ -4611,7 +4683,6 @@ void TParseContext::nonInitConstCheck(const TSourceLoc& loc, TString& identifier TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TString& identifier, const TQualifier& qualifier, const TShaderQualifiers& publicType) { -#ifndef GLSLANG_WEB if (! builtInName(identifier) || symbolTable.atBuiltInLevel() || ! symbolTable.atGlobalLevel()) return nullptr; @@ -4774,7 +4845,6 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS return symbol; } -#endif return nullptr; } @@ -4786,7 +4856,6 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes) { -#ifndef GLSLANG_WEB const char* feature = "built-in block redeclaration"; profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature); @@ -5002,7 +5071,6 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT // Save it in the AST for linker use. trackLinkage(*block); -#endif // GLSLANG_WEB } void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQualifier& qualifier, TType& type) @@ -5015,6 +5083,7 @@ void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQu case EvqIn: case EvqOut: case EvqInOut: + case EvqTileImageEXT: type.getQualifier().storage = qualifier; break; case EvqGlobal: @@ -5030,7 +5099,6 @@ void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQu void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& qualifier, TType& type) { -#ifndef GLSLANG_WEB if (qualifier.isMemory()) { type.getQualifier().volatil = qualifier.volatil; type.getQualifier().coherent = qualifier.coherent; @@ -5044,7 +5112,6 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali type.getQualifier().writeonly = qualifier.writeonly; type.getQualifier().restrict = qualifier.restrict; } -#endif if (qualifier.isAuxiliary() || qualifier.isInterpolation()) @@ -5061,7 +5128,6 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali } if (qualifier.isNonUniform()) type.getQualifier().nonUniform = qualifier.nonUniform; -#ifndef GLSLANG_WEB if (qualifier.isSpirvByReference()) type.getQualifier().setSpirvByReference(); if (qualifier.isSpirvLiteral()) { @@ -5070,7 +5136,6 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali type.getQualifier().setSpirvLiteral(); else error(loc, "cannot use spirv_literal qualifier", type.getBasicTypeString().c_str(), ""); -#endif } paramCheckFixStorage(loc, qualifier.storage, type); @@ -5101,21 +5166,18 @@ void TParseContext::arrayObjectCheck(const TSourceLoc& loc, const TType& type, c void TParseContext::opaqueCheck(const TSourceLoc& loc, const TType& type, const char* op) { - if (containsFieldWithBasicType(type, EbtSampler)) + if (containsFieldWithBasicType(type, EbtSampler) && !extensionTurnedOn(E_GL_ARB_bindless_texture)) error(loc, "can't use with samplers or structs containing samplers", op, ""); } void TParseContext::referenceCheck(const TSourceLoc& loc, const TType& type, const char* op) { -#ifndef GLSLANG_WEB if (containsFieldWithBasicType(type, EbtReference)) error(loc, "can't use with reference types", op, ""); -#endif } void TParseContext::storage16BitAssignmentCheck(const TSourceLoc& loc, const TType& type, const char* op) { -#ifndef GLSLANG_WEB if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtFloat16)) requireFloat16Arithmetic(loc, op, "can't use with structs containing float16"); @@ -5145,7 +5207,6 @@ void TParseContext::storage16BitAssignmentCheck(const TSourceLoc& loc, const TTy if (type.isArray() && type.getBasicType() == EbtUint8) requireInt8Arithmetic(loc, op, "can't use with arrays containing uint8"); -#endif } void TParseContext::specializationCheck(const TSourceLoc& loc, const TType& type, const char* op) @@ -5197,12 +5258,11 @@ void TParseContext::structTypeCheck(const TSourceLoc& /*loc*/, TPublicType& publ // void TParseContext::inductiveLoopCheck(const TSourceLoc& loc, TIntermNode* init, TIntermLoop* loop) { -#ifndef GLSLANG_WEB // loop index init must exist and be a declaration, which shows up in the AST as an aggregate of size 1 of the declaration bool badInit = false; if (! init || ! init->getAsAggregate() || init->getAsAggregate()->getSequence().size() != 1) badInit = true; - TIntermBinary* binaryInit = 0; + TIntermBinary* binaryInit = nullptr; if (! badInit) { // get the declaration assignment binaryInit = init->getAsAggregate()->getSequence()[0]->getAsBinaryNode(); @@ -5293,10 +5353,8 @@ void TParseContext::inductiveLoopCheck(const TSourceLoc& loc, TIntermNode* init, // the body inductiveLoopBodyCheck(loop->getBody(), loopIndex, symbolTable); -#endif } -#ifndef GLSLANG_WEB // Do limit checks for built-in arrays. void TParseContext::arrayLimitCheck(const TSourceLoc& loc, const TString& identifier, int size) { @@ -5311,7 +5369,6 @@ void TParseContext::arrayLimitCheck(const TSourceLoc& loc, const TString& identi else if (identifier.compare("gl_CullDistancePerViewNV") == 0) limitCheck(loc, size, "gl_MaxCullDistances", "gl_CullDistancePerViewNV array size"); } -#endif // GLSLANG_WEB // See if the provided value is less than or equal to the symbol indicated by limit, // which should be a constant in the symbol table. @@ -5325,8 +5382,6 @@ void TParseContext::limitCheck(const TSourceLoc& loc, int value, const char* lim error(loc, "must be less than or equal to", feature, "%s (%d)", limit, constArray[0].getIConst()); } -#ifndef GLSLANG_WEB - // // Do any additional error checking, etc., once we know the parsing is done. // @@ -5392,7 +5447,6 @@ void TParseContext::finish() } } } -#endif // GLSLANG_WEB // // Layout qualifier stuff. @@ -5436,7 +5490,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi publicType.qualifier.layoutPacking = ElpStd140; return; } -#ifndef GLSLANG_WEB if (id == TQualifier::getLayoutPackingString(ElpStd430)) { requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "std430"); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_shader_storage_buffer_object, "std430"); @@ -5476,6 +5529,28 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi intermediate.setUsePhysicalStorageBuffer(); return; } + if (id == "bindless_sampler") { + requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "bindless_sampler"); + publicType.qualifier.layoutBindlessSampler = true; + intermediate.setBindlessTextureMode(currentCaller, AstRefTypeLayout); + return; + } + if (id == "bindless_image") { + requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "bindless_image"); + publicType.qualifier.layoutBindlessImage = true; + intermediate.setBindlessImageMode(currentCaller, AstRefTypeLayout); + return; + } + if (id == "bound_sampler") { + requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "bound_sampler"); + publicType.qualifier.layoutBindlessSampler = false; + return; + } + if (id == "bound_image") { + requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "bound_image"); + publicType.qualifier.layoutBindlessImage = false; + return; + } if (language == EShLangGeometry || language == EShLangTessEvaluation || language == EShLangMesh) { if (id == TQualifier::getGeometryString(ElgTriangles)) { publicType.shaderQualifiers.geometry = ElgTriangles; @@ -5600,6 +5675,22 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi publicType.shaderQualifiers.postDepthCoverage = true; return; } + /* id is transformed into lower case in the beginning of this function. */ + if (id == "non_coherent_color_attachment_readext") { + requireExtensions(loc, 1, &E_GL_EXT_shader_tile_image, "non_coherent_color_attachment_readEXT"); + publicType.shaderQualifiers.nonCoherentColorAttachmentReadEXT = true; + return; + } + if (id == "non_coherent_depth_attachment_readext") { + requireExtensions(loc, 1, &E_GL_EXT_shader_tile_image, "non_coherent_depth_attachment_readEXT"); + publicType.shaderQualifiers.nonCoherentDepthAttachmentReadEXT = true; + return; + } + if (id == "non_coherent_stencil_attachment_readext") { + requireExtensions(loc, 1, &E_GL_EXT_shader_tile_image, "non_coherent_stencil_attachment_readEXT"); + publicType.shaderQualifiers.nonCoherentStencilAttachmentReadEXT = true; + return; + } for (TLayoutDepth depth = (TLayoutDepth)(EldNone + 1); depth < EldCount; depth = (TLayoutDepth)(depth+1)) { if (id == TQualifier::getLayoutDepthString(depth)) { requireProfile(loc, ECoreProfile | ECompatibilityProfile, "depth layout qualifier"); @@ -5670,6 +5761,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi } publicType.qualifier.layoutShaderRecord = true; return; + } else if (id == "hitobjectshaderrecordnv") { + requireExtensions(loc, 1, &E_GL_NV_shader_invocation_reorder, "hitobject shader record NV"); + publicType.qualifier.layoutHitObjectShaderRecordNV = true; + return; } } @@ -5692,7 +5787,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi publicType.shaderQualifiers.layoutPrimitiveCulling = true; return; } -#endif error(loc, "unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4)", id.c_str(), ""); } @@ -5780,10 +5874,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi error(loc, "needs a literal integer", "set", ""); return; } else if (id == "binding") { -#ifndef GLSLANG_WEB profileRequires(loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, "binding"); profileRequires(loc, EEsProfile, 310, nullptr, "binding"); -#endif if ((unsigned int)value >= TQualifier::layoutBindingEnd) error(loc, "binding is too large", id.c_str(), ""); else @@ -5806,7 +5898,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi error(loc, "needs a literal integer", "constant_id", ""); return; } -#ifndef GLSLANG_WEB if (id == "component") { requireProfile(loc, ECoreProfile | ECompatibilityProfile, "component"); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, "component"); @@ -5904,10 +5995,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi error(loc, "needs a literal integer", "buffer_reference_align", ""); return; } -#endif switch (language) { -#ifndef GLSLANG_WEB case EShLangTessControl: if (id == "vertices") { if (value == 0) @@ -5973,8 +6062,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi if (id == "max_vertices") { requireExtensions(loc, Num_AEP_mesh_shader, AEP_mesh_shader, "max_vertices"); publicType.shaderQualifiers.vertices = value; - if (value > resources.maxMeshOutputVerticesNV) - error(loc, "too large, must be less than gl_MaxMeshOutputVerticesNV", "max_vertices", ""); + int max = extensionTurnedOn(E_GL_EXT_mesh_shader) ? resources.maxMeshOutputVerticesEXT + : resources.maxMeshOutputVerticesNV; + if (value > max) { + TString maxsErrtring = "too large, must be less than "; + maxsErrtring.append(extensionTurnedOn(E_GL_EXT_mesh_shader) ? "gl_MaxMeshOutputVerticesEXT" + : "gl_MaxMeshOutputVerticesNV"); + error(loc, maxsErrtring.c_str(), "max_vertices", ""); + } if (nonLiteral) error(loc, "needs a literal integer", "max_vertices", ""); return; @@ -5982,8 +6077,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi if (id == "max_primitives") { requireExtensions(loc, Num_AEP_mesh_shader, AEP_mesh_shader, "max_primitives"); publicType.shaderQualifiers.primitives = value; - if (value > resources.maxMeshOutputPrimitivesNV) - error(loc, "too large, must be less than gl_MaxMeshOutputPrimitivesNV", "max_primitives", ""); + int max = extensionTurnedOn(E_GL_EXT_mesh_shader) ? resources.maxMeshOutputPrimitivesEXT + : resources.maxMeshOutputPrimitivesNV; + if (value > max) { + TString maxsErrtring = "too large, must be less than "; + maxsErrtring.append(extensionTurnedOn(E_GL_EXT_mesh_shader) ? "gl_MaxMeshOutputPrimitivesEXT" + : "gl_MaxMeshOutputPrimitivesNV"); + error(loc, maxsErrtring.c_str(), "max_primitives", ""); + } if (nonLiteral) error(loc, "needs a literal integer", "max_primitives", ""); return; @@ -5992,17 +6093,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi case EShLangTask: // Fall through -#endif case EShLangCompute: if (id.compare(0, 11, "local_size_") == 0) { -#ifndef GLSLANG_WEB if (language == EShLangMesh || language == EShLangTask) { requireExtensions(loc, Num_AEP_mesh_shader, AEP_mesh_shader, "gl_WorkGroupSize"); } else { - profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize"); + profileRequires(loc, EEsProfile, 310, nullptr, "gl_WorkGroupSize"); profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize"); } -#endif if (nonLiteral) error(loc, "needs a literal integer", "local_size", ""); if (id.size() == 12 && value == 0) { @@ -6069,7 +6167,6 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie if (src.hasPacking()) dst.layoutPacking = src.layoutPacking; -#ifndef GLSLANG_WEB if (src.hasStream()) dst.layoutStream = src.layoutStream; if (src.hasFormat()) @@ -6078,7 +6175,6 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie dst.layoutXfbBuffer = src.layoutXfbBuffer; if (src.hasBufferReferenceAlign()) dst.layoutBufferReferenceAlign = src.layoutBufferReferenceAlign; -#endif if (src.hasAlign()) dst.layoutAlign = src.layoutAlign; @@ -6096,7 +6192,6 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie if (src.hasSpecConstantId()) dst.layoutSpecConstantId = src.layoutSpecConstantId; -#ifndef GLSLANG_WEB if (src.hasComponent()) dst.layoutComponent = src.layoutComponent; if (src.hasIndex()) @@ -6121,11 +6216,16 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie dst.layoutSecondaryViewportRelativeOffset = src.layoutSecondaryViewportRelativeOffset; if (src.layoutShaderRecord) dst.layoutShaderRecord = true; + if (src.layoutBindlessSampler) + dst.layoutBindlessSampler = true; + if (src.layoutBindlessImage) + dst.layoutBindlessImage = true; if (src.pervertexNV) dst.pervertexNV = true; if (src.pervertexEXT) dst.pervertexEXT = true; -#endif + if (src.layoutHitObjectShaderRecordNV) + dst.layoutHitObjectShaderRecordNV = true; } } @@ -6162,9 +6262,7 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb case EvqVaryingIn: case EvqVaryingOut: if (!type.getQualifier().isTaskMemory() && -#ifndef GLSLANG_WEB !type.getQualifier().hasSprivDecorate() && -#endif (type.getBasicType() != EbtBlock || (!(*type.getStruct())[0].type->getQualifier().hasLocation() && (*type.getStruct())[0].type->getQualifier().builtIn == EbvNone))) @@ -6226,11 +6324,6 @@ void TParseContext::layoutMemberLocationArrayCheck(const TSourceLoc& loc, bool m // Do layout error checking with respect to a type. void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) { -#ifndef GLSLANG_WEB - if (extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) - return; // Skip any check if GL_EXT_spirv_intrinsics is turned on -#endif - const TQualifier& qualifier = type.getQualifier(); // first, intra-layout qualifier-only error checking @@ -6272,18 +6365,22 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) case EvqBuffer: if (type.getBasicType() == EbtBlock) error(loc, "cannot apply to uniform or buffer block", "location", ""); + else if (type.getBasicType() == EbtSampler && type.getSampler().isAttachmentEXT()) + error(loc, "only applies to", "location", "%s with storage tileImageEXT", type.getBasicTypeString().c_str()); break; case EvqtaskPayloadSharedEXT: error(loc, "cannot apply to taskPayloadSharedEXT", "location", ""); break; -#ifndef GLSLANG_WEB case EvqPayload: case EvqPayloadIn: case EvqHitAttr: case EvqCallableData: case EvqCallableDataIn: + case EvqHitObjectAttrNV: + case EvqSpirvStorageClass: + break; + case EvqTileImageEXT: break; -#endif default: error(loc, "can only apply to uniform, buffer, in, or out storage qualifiers", "location", ""); break; @@ -6293,13 +6390,12 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) int repeated = intermediate.addUsedLocation(qualifier, type, typeCollision); if (repeated >= 0 && ! typeCollision) error(loc, "overlapping use of location", "location", "%d", repeated); - // "fragment-shader outputs ... if two variables are placed within the same + // "fragment-shader outputs/tileImageEXT ... if two variables are placed within the same // location, they must have the same underlying type (floating-point or integer)" - if (typeCollision && language == EShLangFragment && qualifier.isPipeOutput()) - error(loc, "fragment outputs sharing the same location must be the same basic type", "location", "%d", repeated); + if (typeCollision && language == EShLangFragment && (qualifier.isPipeOutput() || qualifier.storage == EvqTileImageEXT)) + error(loc, "fragment outputs or tileImageEXTs sharing the same location", "location", "%d must be the same basic type", repeated); } -#ifndef GLSLANG_WEB if (qualifier.hasXfbOffset() && qualifier.hasXfbBuffer()) { if (type.isUnsizedArray()) { error(loc, "unsized array", "xfb_offset", "in buffer %d", qualifier.layoutXfbBuffer); @@ -6328,7 +6424,6 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) if (! intermediate.setXfbBufferStride(qualifier.layoutXfbBuffer, qualifier.layoutXfbStride)) error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d", qualifier.layoutXfbBuffer); } -#endif if (qualifier.hasBinding()) { // Binding checking, from the spec: @@ -6339,7 +6434,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) // an array of size N, all elements of the array from binding through binding + N - 1 must be within this // range." // - if (! type.isOpaque() && type.getBasicType() != EbtBlock) + if (!type.isOpaque() && type.getBasicType() != EbtBlock && type.getBasicType() != EbtSpirvType) error(loc, "requires block, or sampler/image, or atomic-counter type", "binding", ""); if (type.getBasicType() == EbtSampler) { int lastBinding = qualifier.layoutBinding; @@ -6348,16 +6443,12 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) if (type.isSizedArray()) lastBinding += (type.getCumulativeArraySize() - 1); else { -#ifndef GLSLANG_WEB warn(loc, "assuming binding count of one for compile-time checking of binding numbers for unsized array", "[]", ""); -#endif } } } -#ifndef GLSLANG_WEB if (spvVersion.vulkan == 0 && lastBinding >= resources.maxCombinedTextureImageUnits) error(loc, "sampler binding not less than gl_MaxCombinedTextureImageUnits", "binding", type.isArray() ? "(using array)" : ""); -#endif } if (type.isAtomic() && !spvVersion.vulkanRelaxed) { if (qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) { @@ -6380,7 +6471,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) !qualifier.hasAttachment() && !qualifier.hasBufferReference()) error(loc, "uniform/buffer blocks require layout(binding=X)", "binding", ""); - else if (spvVersion.vulkan > 0 && type.getBasicType() == EbtSampler) + else if (spvVersion.vulkan > 0 && type.getBasicType() == EbtSampler && !type.getSampler().isAttachmentEXT()) error(loc, "sampler/texture/image requires layout(binding=X)", "binding", ""); } } @@ -6402,7 +6493,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) // Image format if (qualifier.hasFormat()) { - if (! type.isImage()) + if (! type.isImage() && !intermediate.getBindlessImageMode()) error(loc, "only apply to images", TQualifier::getLayoutFormatString(qualifier.getFormat()), ""); else { if (type.getSampler().type == EbtFloat && qualifier.getFormat() > ElfFloatGuard) @@ -6421,7 +6512,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) } } } - } else if (type.isImage() && ! qualifier.isWriteOnly()) { + } else if (type.isImage() && ! qualifier.isWriteOnly() && !intermediate.getBindlessImageMode()) { const char *explanation = "image variables not declared 'writeonly' and without a format layout qualifier"; requireProfile(loc, ECoreProfile | ECompatibilityProfile, explanation); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 0, E_GL_EXT_shader_image_load_formatted, explanation); @@ -6442,6 +6533,8 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) // input attachment if (type.isSubpass()) { + if (extensionTurnedOn(E_GL_EXT_shader_tile_image)) + error(loc, "can not be used with GL_EXT_shader_tile_image enabled", type.getSampler().getString().c_str(), ""); if (! qualifier.hasAttachment()) error(loc, "requires an input_attachment_index layout qualifier", "subpass", ""); } else { @@ -6511,7 +6604,6 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier // output block declarations, and output block member declarations." switch (qualifier.storage) { -#ifndef GLSLANG_WEB case EvqVaryingIn: { const char* feature = "location qualifier on input"; @@ -6546,7 +6638,6 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier } break; } -#endif case EvqUniform: case EvqBuffer: { @@ -6609,6 +6700,14 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier error(loc, "cannot be used with shaderRecordNV", "set", ""); } + + if (qualifier.storage == EvqTileImageEXT) { + if (qualifier.hasSet()) + error(loc, "cannot be used with tileImageEXT", "set", ""); + if (!qualifier.hasLocation()) + error(loc, "can only be used with an explicit location", "tileImageEXT", ""); + } + if (qualifier.storage == EvqHitAttr && qualifier.hasLayout()) { error(loc, "cannot apply layout qualifiers to hitAttributeNV variable", "hitAttributeNV", ""); } @@ -6617,7 +6716,6 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier // For places that can't have shader-level layout qualifiers void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQualifiers& shaderQualifiers) { -#ifndef GLSLANG_WEB const char* message = "can only apply to a standalone qualifier"; if (shaderQualifiers.geometry != ElgNone) @@ -6648,6 +6746,12 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua error(loc, message, "early_fragment_tests", ""); if (shaderQualifiers.postDepthCoverage) error(loc, message, "post_depth_coverage", ""); + if (shaderQualifiers.nonCoherentColorAttachmentReadEXT) + error(loc, message, "non_coherent_color_attachment_readEXT", ""); + if (shaderQualifiers.nonCoherentDepthAttachmentReadEXT) + error(loc, message, "non_coherent_depth_attachment_readEXT", ""); + if (shaderQualifiers.nonCoherentStencilAttachmentReadEXT) + error(loc, message, "non_coherent_stencil_attachment_readEXT", ""); if (shaderQualifiers.primitives != TQualifier::layoutNotSet) { if (language == EShLangMesh) error(loc, message, "max_primitives", ""); @@ -6662,14 +6766,12 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua error(loc, message, TQualifier::getInterlockOrderingString(shaderQualifiers.interlockOrdering), ""); if (shaderQualifiers.layoutPrimitiveCulling) error(loc, "can only be applied as standalone", "primitive_culling", ""); -#endif } // Correct and/or advance an object's offset layout qualifier. void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) { const TQualifier& qualifier = symbol.getType().getQualifier(); -#ifndef GLSLANG_WEB if (symbol.getType().isAtomic()) { if (qualifier.hasBinding() && (int)qualifier.layoutBinding < resources.maxAtomicCounterBindings) { @@ -6703,7 +6805,6 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) atomicUintOffsets[qualifier.layoutBinding] = offset + numOffsets; } } -#endif } // @@ -6718,10 +6819,6 @@ const TFunction* TParseContext::findFunction(const TSourceLoc& loc, const TFunct return nullptr; } -#ifdef GLSLANG_WEB - return findFunctionExact(loc, call, builtIn); -#endif - const TFunction* function = nullptr; // debugPrintfEXT has var args and is in the symbol table as "debugPrintfEXT()", @@ -7048,7 +7145,6 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T { TIntermTyped* result = nullptr; -#ifndef GLSLANG_WEB if (function->getBuiltInOp() != EOpNull) { return nullptr; } @@ -7066,7 +7162,7 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T realFunc.addParameter(TParameter().copyParam((*function)[i])); } - TParameter tmpP = { 0, &uintType }; + TParameter tmpP = { nullptr, &uintType }; realFunc.addParameter(TParameter().copyParam(tmpP)); arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(1, loc, true)); @@ -7083,7 +7179,7 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T realFunc.addParameter(TParameter().copyParam((*function)[i])); } - TParameter tmpP = { 0, &uintType }; + TParameter tmpP = { nullptr, &uintType }; realFunc.addParameter(TParameter().copyParam(tmpP)); arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(-1, loc, true)); @@ -7099,7 +7195,6 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T result = arguments->getAsTyped(); } } -#endif return result; } @@ -7108,7 +7203,6 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T // to establish defaults. void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType& publicType) { -#ifndef GLSLANG_WEB if (publicType.basicType == EbtAtomicUint && publicType.qualifier.hasBinding()) { if (publicType.qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) { error(loc, "atomic_uint binding is too large", "binding", ""); @@ -7125,7 +7219,41 @@ void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType if (publicType.qualifier.hasLayout() && !publicType.qualifier.hasBufferReference()) warn(loc, "useless application of layout qualifier", "layout", ""); -#endif +} + +void TParseContext::coopMatTypeParametersCheck(const TSourceLoc& loc, const TPublicType& publicType) +{ + if (parsingBuiltins) + return; + if (publicType.isCoopmatKHR()) { + if (publicType.typeParameters == nullptr) { + error(loc, "coopmat missing type parameters", "", ""); + return; + } + switch (publicType.typeParameters->basicType) { + case EbtFloat: + case EbtFloat16: + case EbtInt: + case EbtInt8: + case EbtInt16: + case EbtUint: + case EbtUint8: + case EbtUint16: + break; + default: + error(loc, "coopmat invalid basic type", TType::getBasicString(publicType.typeParameters->basicType), ""); + break; + } + if (publicType.typeParameters->arraySizes->getNumDims() != 4) { + error(loc, "coopmat incorrect number of type parameters", "", ""); + return; + } + int use = publicType.typeParameters->arraySizes->getDimSize(3); + if (use < 0 || use > 2) { + error(loc, "coopmat invalid matrix Use", "", ""); + return; + } + } } bool TParseContext::vkRelaxedRemapUniformVariable(const TSourceLoc& loc, TString& identifier, const TPublicType&, @@ -7133,11 +7261,7 @@ bool TParseContext::vkRelaxedRemapUniformVariable(const TSourceLoc& loc, TString { if (parsingBuiltins || symbolTable.atBuiltInLevel() || !symbolTable.atGlobalLevel() || type.getQualifier().storage != EvqUniform || - !(type.containsNonOpaque() -#ifndef GLSLANG_WEB - || type.getBasicType() == EbtAtomicUint -#endif - )) { + !(type.containsNonOpaque()|| type.getBasicType() == EbtAtomicUint)) { return false; } @@ -7166,7 +7290,6 @@ bool TParseContext::vkRelaxedRemapUniformVariable(const TSourceLoc& loc, TString int bufferBinding = TQualifier::layoutBindingEnd; TVariable* updatedBlock = nullptr; -#ifndef GLSLANG_WEB // Convert atomic_uint into members of a buffer block if (type.isAtomic()) { type.setBasicType(EbtUint); @@ -7182,7 +7305,6 @@ bool TParseContext::vkRelaxedRemapUniformVariable(const TSourceLoc& loc, TString growAtomicCounterBlock(bufferBinding, loc, type, identifier, nullptr); updatedBlock = atomicCounterBuffers[bufferBinding]; } -#endif if (!updatedBlock) { growGlobalUniformBlock(loc, type, identifier, nullptr); @@ -7237,32 +7359,49 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden if (initializer) { if (type.getBasicType() == EbtRayQuery) { error(loc, "ray queries can only be initialized by using the rayQueryInitializeEXT intrinsic:", "=", identifier.c_str()); + } else if (type.getBasicType() == EbtHitObjectNV) { + error(loc, "hit objects cannot be initialized using initializers", "=", identifier.c_str()); } + } - if (type.isCoopMat()) { + if (type.isCoopMatKHR()) { intermediate.setUseVulkanMemoryModel(); intermediate.setUseStorageBuffer(); - if (!publicType.typeParameters || publicType.typeParameters->getNumDims() != 4) { + if (!publicType.typeParameters || !publicType.typeParameters->arraySizes || + publicType.typeParameters->arraySizes->getNumDims() != 3) { + error(loc, "unexpected number type parameters", identifier.c_str(), ""); + } + if (publicType.typeParameters) { + if (!isTypeFloat(publicType.typeParameters->basicType) && !isTypeInt(publicType.typeParameters->basicType)) { + error(loc, "expected 8, 16, 32, or 64 bit signed or unsigned integer or 16, 32, or 64 bit float type", identifier.c_str(), ""); + } + } + } + else if (type.isCoopMatNV()) { + intermediate.setUseVulkanMemoryModel(); + intermediate.setUseStorageBuffer(); + + if (!publicType.typeParameters || publicType.typeParameters->arraySizes->getNumDims() != 4) { error(loc, "expected four type parameters", identifier.c_str(), ""); } if (publicType.typeParameters) { if (isTypeFloat(publicType.basicType) && - publicType.typeParameters->getDimSize(0) != 16 && - publicType.typeParameters->getDimSize(0) != 32 && - publicType.typeParameters->getDimSize(0) != 64) { + publicType.typeParameters->arraySizes->getDimSize(0) != 16 && + publicType.typeParameters->arraySizes->getDimSize(0) != 32 && + publicType.typeParameters->arraySizes->getDimSize(0) != 64) { error(loc, "expected 16, 32, or 64 bits for first type parameter", identifier.c_str(), ""); } if (isTypeInt(publicType.basicType) && - publicType.typeParameters->getDimSize(0) != 8 && - publicType.typeParameters->getDimSize(0) != 32) { - error(loc, "expected 8 or 32 bits for first type parameter", identifier.c_str(), ""); + publicType.typeParameters->arraySizes->getDimSize(0) != 8 && + publicType.typeParameters->arraySizes->getDimSize(0) != 16 && + publicType.typeParameters->arraySizes->getDimSize(0) != 32) { + error(loc, "expected 8, 16, or 32 bits for first type parameter", identifier.c_str(), ""); } } - } else { - if (publicType.typeParameters && publicType.typeParameters->getNumDims() != 0) { + if (publicType.typeParameters && publicType.typeParameters->arraySizes->getNumDims() != 0) { error(loc, "unexpected type parameters", identifier.c_str(), ""); } } @@ -7277,11 +7416,9 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden samplerCheck(loc, type, identifier, initializer); transparentOpaqueCheck(loc, type, identifier); -#ifndef GLSLANG_WEB atomicUintCheck(loc, type, identifier); accStructCheck(loc, type, identifier); checkAndResizeMeshViewDim(loc, type, /*isBlockMember*/ false); -#endif if (type.getQualifier().storage == EvqConst && type.containsReference()) { error(loc, "variables with reference type can't have qualifier 'const'", "qualifier", ""); } @@ -7384,14 +7521,12 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden // Pick up global defaults from the provide global defaults into dst. void TParseContext::inheritGlobalDefaults(TQualifier& dst) const { -#ifndef GLSLANG_WEB if (dst.storage == EvqVaryingOut) { if (! dst.hasStream() && language == EShLangGeometry) dst.layoutStream = globalOutputDefaults.layoutStream; if (! dst.hasXfbBuffer()) dst.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer; } -#endif } // @@ -7420,9 +7555,7 @@ TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, const TString& // make a new variable TVariable* variable = new TVariable(&identifier, type); -#ifndef GLSLANG_WEB ioArrayCheck(loc, type, identifier); -#endif // add variable to symbol table if (symbolTable.insert(*variable)) { @@ -7499,9 +7632,7 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp TType skeletalType; skeletalType.shallowCopy(variable->getType()); skeletalType.getQualifier().makeTemporary(); -#ifndef GLSLANG_WEB initializer = convertInitializerList(loc, skeletalType, initializer); -#endif if (! initializer) { // error recovery; don't leave const without constant values if (qualifier == EvqConst) @@ -7729,12 +7860,14 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode* // Combined texture-sampler constructors are completely semantic checked // in constructorTextureSamplerError() if (op == EOpConstructTextureSampler) { - if (aggrNode->getSequence()[1]->getAsTyped()->getType().getSampler().shadow) { - // Transfer depth into the texture (SPIR-V image) type, as a hint - // for tools to know this texture/image is a depth image. - aggrNode->getSequence()[0]->getAsTyped()->getWritableType().getSampler().shadow = true; + if (aggrNode != nullptr) { + if (aggrNode->getSequence()[1]->getAsTyped()->getType().getSampler().shadow) { + // Transfer depth into the texture (SPIR-V image) type, as a hint + // for tools to know this texture/image is a depth image. + aggrNode->getSequence()[0]->getAsTyped()->getWritableType().getSampler().shadow = true; + } + return intermediate.setAggregateOperator(aggrNode, op, type, loc); } - return intermediate.setAggregateOperator(aggrNode, op, type, loc); } TTypeList::const_iterator memberTypes; @@ -7869,6 +8002,16 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUvec2, true, node, type); return newNode; + } else if (node->getType().getBasicType() == EbtSampler) { + requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "sampler conversion to uvec2"); + // force the basic type of the constructor param to uvec2, otherwise spv builder will + // report some errors + TIntermTyped* newSrcNode = intermediate.createConversion(EbtUint, node); + newSrcNode->getAsTyped()->getWritableType().setVectorSize(2); + + TIntermTyped* newNode = + intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConstructUVec2, false, newSrcNode, type); + return newNode; } case EOpConstructUVec3: case EOpConstructUVec4: @@ -7882,9 +8025,15 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EOpConstructBool: basicOp = EOpConstructBool; break; - -#ifndef GLSLANG_WEB - + case EOpConstructTextureSampler: + if ((node->getType().getBasicType() == EbtUint || node->getType().getBasicType() == EbtInt) && + node->getType().getVectorSize() == 2) { + requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "ivec2/uvec2 convert to texture handle"); + // No matter ivec2 or uvec2, Set EOpPackUint2x32 just to generate an opBitcast op code + TIntermTyped* newNode = + intermediate.addBuiltInFunctionCall(node->getLoc(), EOpPackUint2x32, true, node, type); + return newNode; + } case EOpConstructDVec2: case EOpConstructDVec3: case EOpConstructDVec4: @@ -8070,14 +8219,18 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T return nullptr; } - case EOpConstructCooperativeMatrix: + case EOpConstructCooperativeMatrixNV: + case EOpConstructCooperativeMatrixKHR: + if (node->getType() == type) { + return node; + } if (!node->getType().isCoopMat()) { if (type.getBasicType() != node->getType().getBasicType()) { node = intermediate.addConversion(type.getBasicType(), node); if (node == nullptr) return nullptr; } - node = intermediate.setAggregateOperator(node, EOpConstructCooperativeMatrix, type, node->getLoc()); + node = intermediate.setAggregateOperator(node, op, type, node->getLoc()); } else { TOperator op = EOpNull; switch (type.getBasicType()) { @@ -8090,6 +8243,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EbtFloat16: op = EOpConvFloat16ToInt; break; case EbtUint8: op = EOpConvUint8ToInt; break; case EbtInt8: op = EOpConvInt8ToInt; break; + case EbtUint16: op = EOpConvUint16ToInt; break; + case EbtInt16: op = EOpConvInt16ToInt; break; case EbtUint: op = EOpConvUintToInt; break; default: assert(0); } @@ -8100,8 +8255,33 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EbtFloat16: op = EOpConvFloat16ToUint; break; case EbtUint8: op = EOpConvUint8ToUint; break; case EbtInt8: op = EOpConvInt8ToUint; break; + case EbtUint16: op = EOpConvUint16ToUint; break; + case EbtInt16: op = EOpConvInt16ToUint; break; case EbtInt: op = EOpConvIntToUint; break; - case EbtUint: op = EOpConvUintToInt8; break; + default: assert(0); + } + break; + case EbtInt16: + switch (node->getType().getBasicType()) { + case EbtFloat: op = EOpConvFloatToInt16; break; + case EbtFloat16: op = EOpConvFloat16ToInt16; break; + case EbtUint8: op = EOpConvUint8ToInt16; break; + case EbtInt8: op = EOpConvInt8ToInt16; break; + case EbtUint16: op = EOpConvUint16ToInt16; break; + case EbtInt: op = EOpConvIntToInt16; break; + case EbtUint: op = EOpConvUintToInt16; break; + default: assert(0); + } + break; + case EbtUint16: + switch (node->getType().getBasicType()) { + case EbtFloat: op = EOpConvFloatToUint16; break; + case EbtFloat16: op = EOpConvFloat16ToUint16; break; + case EbtUint8: op = EOpConvUint8ToUint16; break; + case EbtInt8: op = EOpConvInt8ToUint16; break; + case EbtInt16: op = EOpConvInt16ToUint16; break; + case EbtInt: op = EOpConvIntToUint16; break; + case EbtUint: op = EOpConvUintToUint16; break; default: assert(0); } break; @@ -8110,6 +8290,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EbtFloat: op = EOpConvFloatToInt8; break; case EbtFloat16: op = EOpConvFloat16ToInt8; break; case EbtUint8: op = EOpConvUint8ToInt8; break; + case EbtInt16: op = EOpConvInt16ToInt8; break; + case EbtUint16: op = EOpConvUint16ToInt8; break; case EbtInt: op = EOpConvIntToInt8; break; case EbtUint: op = EOpConvUintToInt8; break; default: assert(0); @@ -8120,6 +8302,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EbtFloat: op = EOpConvFloatToUint8; break; case EbtFloat16: op = EOpConvFloat16ToUint8; break; case EbtInt8: op = EOpConvInt8ToUint8; break; + case EbtInt16: op = EOpConvInt16ToUint8; break; + case EbtUint16: op = EOpConvUint16ToUint8; break; case EbtInt: op = EOpConvIntToUint8; break; case EbtUint: op = EOpConvUintToUint8; break; default: assert(0); @@ -8130,6 +8314,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EbtFloat16: op = EOpConvFloat16ToFloat; break; case EbtInt8: op = EOpConvInt8ToFloat; break; case EbtUint8: op = EOpConvUint8ToFloat; break; + case EbtInt16: op = EOpConvInt16ToFloat; break; + case EbtUint16: op = EOpConvUint16ToFloat; break; case EbtInt: op = EOpConvIntToFloat; break; case EbtUint: op = EOpConvUintToFloat; break; default: assert(0); @@ -8140,6 +8326,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EbtFloat: op = EOpConvFloatToFloat16; break; case EbtInt8: op = EOpConvInt8ToFloat16; break; case EbtUint8: op = EOpConvUint8ToFloat16; break; + case EbtInt16: op = EOpConvInt16ToFloat16; break; + case EbtUint16: op = EOpConvUint16ToFloat16; break; case EbtInt: op = EOpConvIntToFloat16; break; case EbtUint: op = EOpConvUintToFloat16; break; default: assert(0); @@ -8168,7 +8356,6 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T type); } else return nullptr; -#endif // GLSLANG_WEB default: error(loc, "unsupported construction", "", ""); @@ -8215,7 +8402,6 @@ TIntermTyped* TParseContext::constructAggregate(TIntermNode* node, const TType& // If a memory qualifier is present in 'to', also make it present in 'from'. void TParseContext::inheritMemoryQualifiers(const TQualifier& from, TQualifier& to) { -#ifndef GLSLANG_WEB if (from.isReadOnly()) to.readonly = from.readonly; if (from.isWriteOnly()) @@ -8226,7 +8412,30 @@ void TParseContext::inheritMemoryQualifiers(const TQualifier& from, TQualifier& to.volatil = from.volatil; if (from.restrict) to.restrict = from.restrict; -#endif +} + +// +// Update qualifier layoutBindlessImage & layoutBindlessSampler on block member +// +void TParseContext::updateBindlessQualifier(TType& memberType) +{ + if (memberType.containsSampler()) { + if (memberType.isStruct()) { + TTypeList* typeList = memberType.getWritableStruct(); + for (unsigned int member = 0; member < typeList->size(); ++member) { + TType* subMemberType = (*typeList)[member].type; + updateBindlessQualifier(*subMemberType); + } + } + else if (memberType.getSampler().isImage()) { + intermediate.setBindlessImageMode(currentCaller, AstRefTypeLayout); + memberType.getQualifier().layoutBindlessImage = true; + } + else { + intermediate.setBindlessTextureMode(currentCaller, AstRefTypeLayout); + memberType.getQualifier().layoutBindlessSampler = true; + } + } } // @@ -8255,7 +8464,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con error(memberLoc, "member storage qualifier cannot contradict block storage qualifier", memberType.getFieldName().c_str(), ""); memberQualifier.storage = currentBlockQualifier.storage; globalQualifierFixCheck(memberLoc, memberQualifier); -#ifndef GLSLANG_WEB inheritMemoryQualifiers(currentBlockQualifier, memberQualifier); if (currentBlockQualifier.perPrimitiveNV) memberQualifier.perPrimitiveNV = currentBlockQualifier.perPrimitiveNV; @@ -8269,7 +8477,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con error(memberLoc, "member cannot have a spirv_storage_class qualifier", memberType.getFieldName().c_str(), ""); if (memberQualifier.hasSprivDecorate() && !memberQualifier.getSpirvDecorate().decorateIds.empty()) error(memberLoc, "member cannot have a spirv_decorate_id qualifier", memberType.getFieldName().c_str(), ""); -#endif if ((currentBlockQualifier.storage == EvqUniform || currentBlockQualifier.storage == EvqBuffer) && (memberQualifier.isInterpolation() || memberQualifier.isAuxiliary())) error(memberLoc, "member of uniform or buffer block cannot have an auxiliary or interpolation qualifier", memberType.getFieldName().c_str(), ""); if (memberType.isArray()) @@ -8281,8 +8488,13 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con } } - if (memberType.containsOpaque()) - error(memberLoc, "member of block cannot be or contain a sampler, image, or atomic_uint type", typeList[member].type->getFieldName().c_str(), ""); + // For bindless texture, sampler can be declared as uniform/storage block member, + if (memberType.containsOpaque()) { + if (memberType.containsSampler() && extensionTurnedOn(E_GL_ARB_bindless_texture)) + updateBindlessQualifier(memberType); + else + error(memberLoc, "member of block cannot be or contain a sampler, image, or atomic_uint type", typeList[member].type->getFieldName().c_str(), ""); + } if (memberType.containsCoopMat()) error(memberLoc, "member of block cannot be or contain a cooperative matrix type", typeList[member].type->getFieldName().c_str(), ""); @@ -8344,7 +8556,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con for (unsigned int member = 0; member < typeList.size(); ++member) { TQualifier& memberQualifier = typeList[member].type->getQualifier(); const TSourceLoc& memberLoc = typeList[member].loc; -#ifndef GLSLANG_WEB if (memberQualifier.hasStream()) { if (defaultQualification.layoutStream != memberQualifier.layoutStream) error(memberLoc, "member cannot contradict block", "stream", ""); @@ -8358,14 +8569,12 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con if (defaultQualification.layoutXfbBuffer != memberQualifier.layoutXfbBuffer) error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_buffer", ""); } -#endif if (memberQualifier.hasPacking()) error(memberLoc, "member of block cannot have a packing layout qualifier", typeList[member].type->getFieldName().c_str(), ""); if (memberQualifier.hasLocation()) { const char* feature = "location on block member"; switch (currentBlockQualifier.storage) { -#ifndef GLSLANG_WEB case EvqVaryingIn: case EvqVaryingOut: requireProfile(memberLoc, ECoreProfile | ECompatibilityProfile | EEsProfile, feature); @@ -8373,7 +8582,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con profileRequires(memberLoc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); memberWithLocation = true; break; -#endif default: error(memberLoc, "can only use in an in/out block", feature, ""); break; @@ -8401,7 +8609,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con layoutMemberLocationArrayCheck(loc, memberWithLocation, arraySizes); -#ifndef GLSLANG_WEB // Ensure that the block has an XfbBuffer assigned. This is needed // because if the block has a XfbOffset assigned, then it is // assumed that it has implicitly assigned the current global @@ -8411,7 +8618,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con if (!currentBlockQualifier.hasXfbBuffer() && currentBlockQualifier.hasXfbOffset()) currentBlockQualifier.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer; } -#endif // Process the members fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation); @@ -8422,13 +8628,11 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con for (unsigned int member = 0; member < typeList.size(); ++member) layoutTypeCheck(typeList[member].loc, *typeList[member].type); -#ifndef GLSLANG_WEB if (memberWithPerViewQualifier) { for (unsigned int member = 0; member < typeList.size(); ++member) { checkAndResizeMeshViewDim(typeList[member].loc, *typeList[member].type, /*isBlockMember*/ true); } } -#endif // reverse merge, so that currentBlockQualifier now has all layout information // (can't use defaultQualification directly, it's missing other non-layout-default-class qualifiers) @@ -8442,7 +8646,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con if (arraySizes != nullptr) blockType.transferArraySizes(arraySizes); -#ifndef GLSLANG_WEB if (arraySizes == nullptr) ioArrayCheck(loc, blockType, instanceName ? *instanceName : *blockName); if (currentBlockQualifier.hasBufferReference()) { @@ -8469,9 +8672,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con if (!instanceName) { return; } - } else -#endif - { + } else { // // Don't make a user-defined type out of block name; that will cause an error // if the same block name gets reused in a different interface. @@ -8519,14 +8720,12 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con // Check for general layout qualifier errors layoutObjectCheck(loc, variable); -#ifndef GLSLANG_WEB // fix up if (isIoResizeArray(blockType)) { ioArraySymbolResizeList.push_back(&variable); checkIoArraysConsistency(loc, true); } else fixIoArraySize(loc, variable.getWritableType()); -#endif // Save it in the AST for linker use. trackLinkage(variable); @@ -8591,7 +8790,6 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q } profileRequires(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, 0, E_GL_EXT_shared_memory_block, "shared block"); break; -#ifndef GLSLANG_WEB case EvqPayload: profileRequires(loc, ~EEsProfile, 460, 2, extsrt, "rayPayloadNV block"); requireStage(loc, (EShLanguageMask)(EShLangRayGenMask | EShLangAnyHitMask | EShLangClosestHitMask | EShLangMissMask), @@ -8615,7 +8813,10 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q profileRequires(loc, ~EEsProfile, 460, 2, extsrt, "callableDataInNV block"); requireStage(loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInNV block"); break; -#endif + case EvqHitObjectAttrNV: + profileRequires(loc, ~EEsProfile, 460, E_GL_NV_shader_invocation_reorder, "hitObjectAttributeNV block"); + requireStage(loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | EShLangMissMask), "hitObjectAttributeNV block"); + break; default: error(loc, "only uniform, buffer, in, or out blocks are supported", blockName->c_str(), ""); break; @@ -8704,7 +8905,6 @@ void TParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qualifi void TParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList) { -#ifndef GLSLANG_WEB // "If a block is qualified with xfb_offset, all its // members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any // members of that block not qualified with an xfb_offset will not be assigned transform feedback buffer @@ -8738,7 +8938,6 @@ void TParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList) // The above gave all block members an offset, so we can take it off the block now, // which will avoid double counting the offset usage. qualifier.layoutXfbOffset = TQualifier::layoutXfbOffsetEnd; -#endif } // Calculate and save the offset of each block member, using the recursively @@ -8771,7 +8970,8 @@ void TParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typ // "The specified offset must be a multiple // of the base alignment of the type of the block member it qualifies, or a compile-time error results." if (! IsMultipleOfPow2(memberQualifier.layoutOffset, memberAlignment)) - error(memberLoc, "must be a multiple of the member's alignment", "offset", ""); + error(memberLoc, "must be a multiple of the member's alignment", "offset", + "(layout offset = %d | member alignment = %d)", memberQualifier.layoutOffset, memberAlignment); // GLSL: "It is a compile-time error to specify an offset that is smaller than the offset of the previous // member in the block or that lies within the previous member of the block" @@ -8914,7 +9114,7 @@ void TParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qua // TParseContext::declareBlock. if (!symbol && qualifier.hasBufferReference()) { TTypeList typeList; - TType blockType(&typeList, identifier, qualifier);; + TType blockType(&typeList, identifier, qualifier); TType blockNameType(EbtReference, blockType, identifier); TVariable* blockNameVar = new TVariable(&identifier, blockNameType, true); if (! symbolTable.insert(*blockNameVar)) { @@ -8993,7 +9193,6 @@ void TParseContext::invariantCheck(const TSourceLoc& loc, const TQualifier& qual // void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, const TPublicType& publicType) { -#ifndef GLSLANG_WEB if (publicType.shaderQualifiers.vertices != TQualifier::layoutNotSet) { assert(language == EShLangTessControl || language == EShLangGeometry || language == EShLangMesh); const char* id = (language == EShLangTessControl) ? "vertices" : "max_vertices"; @@ -9085,7 +9284,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con else error(loc, "can only apply to 'in'", "point_mode", ""); } -#endif + for (int i = 0; i < 3; ++i) { if (publicType.shaderQualifiers.localSizeNotDefault[i]) { if (publicType.qualifier.storage == EvqVaryingIn) { @@ -9102,9 +9301,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con } if (intermediate.getLocalSize(i) > (unsigned int)max) error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", ""); - } -#ifndef GLSLANG_WEB - else if (language == EShLangMesh) { + } else if (language == EShLangMesh) { switch (i) { case 0: max = extensionTurnedOn(E_GL_EXT_mesh_shader) ? @@ -9154,9 +9351,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con "gl_MaxTaskWorkGroupSizeEXT" : "gl_MaxTaskWorkGroupSizeNV"); error(loc, maxsErrtring.c_str(), "local_size", ""); } - } -#endif - else { + } else { assert(0); } @@ -9181,7 +9376,6 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con } } -#ifndef GLSLANG_WEB if (publicType.shaderQualifiers.earlyFragmentTests) { if (publicType.qualifier.storage == EvqVaryingIn) intermediate.setEarlyFragmentTests(); @@ -9200,6 +9394,24 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con else error(loc, "can only apply to 'in'", "post_coverage_coverage", ""); } + if (publicType.shaderQualifiers.nonCoherentColorAttachmentReadEXT) { + if (publicType.qualifier.storage == EvqVaryingIn) + intermediate.setNonCoherentColorAttachmentReadEXT(); + else + error(loc, "can only apply to 'in'", "non_coherent_color_attachment_readEXT", ""); + } + if (publicType.shaderQualifiers.nonCoherentDepthAttachmentReadEXT) { + if (publicType.qualifier.storage == EvqVaryingIn) + intermediate.setNonCoherentDepthAttachmentReadEXT(); + else + error(loc, "can only apply to 'in'", "non_coherent_depth_attachment_readEXT", ""); + } + if (publicType.shaderQualifiers.nonCoherentStencilAttachmentReadEXT) { + if (publicType.qualifier.storage == EvqVaryingIn) + intermediate.setNonCoherentStencilAttachmentReadEXT(); + else + error(loc, "can only apply to 'in'", "non_coherent_stencil_attachment_readEXT", ""); + } if (publicType.shaderQualifiers.hasBlendEquation()) { if (publicType.qualifier.storage != EvqVaryingOut) error(loc, "can only apply to 'out'", "blend equation", ""); @@ -9259,7 +9471,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con // Exit early as further checks are not valid return; } -#endif + const TQualifier& qualifier = publicType.qualifier; if (qualifier.isAuxiliary() || @@ -9292,7 +9504,6 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con case EvqVaryingIn: break; case EvqVaryingOut: -#ifndef GLSLANG_WEB if (qualifier.hasStream()) globalOutputDefaults.layoutStream = qualifier.layoutStream; if (qualifier.hasXfbBuffer()) @@ -9301,7 +9512,6 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con if (! intermediate.setXfbBufferStride(globalOutputDefaults.layoutXfbBuffer, qualifier.layoutXfbStride)) error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d", qualifier.layoutXfbBuffer); } -#endif break; case EvqShared: if (qualifier.hasMatrix()) @@ -9456,4 +9666,38 @@ const TTypeList* TParseContext::recordStructCopy(TStructRecord& record, const TT return originStruct; } +TLayoutFormat TParseContext::mapLegacyLayoutFormat(TLayoutFormat legacyLayoutFormat, TBasicType imageType) +{ + TLayoutFormat layoutFormat = ElfNone; + if (imageType == EbtFloat) { + switch (legacyLayoutFormat) { + case ElfSize1x16: layoutFormat = ElfR16f; break; + case ElfSize1x32: layoutFormat = ElfR32f; break; + case ElfSize2x32: layoutFormat = ElfRg32f; break; + case ElfSize4x32: layoutFormat = ElfRgba32f; break; + default: break; + } + } else if (imageType == EbtUint) { + switch (legacyLayoutFormat) { + case ElfSize1x8: layoutFormat = ElfR8ui; break; + case ElfSize1x16: layoutFormat = ElfR16ui; break; + case ElfSize1x32: layoutFormat = ElfR32ui; break; + case ElfSize2x32: layoutFormat = ElfRg32ui; break; + case ElfSize4x32: layoutFormat = ElfRgba32ui; break; + default: break; + } + } else if (imageType == EbtInt) { + switch (legacyLayoutFormat) { + case ElfSize1x8: layoutFormat = ElfR8i; break; + case ElfSize1x16: layoutFormat = ElfR16i; break; + case ElfSize1x32: layoutFormat = ElfR32i; break; + case ElfSize2x32: layoutFormat = ElfRg32i; break; + case ElfSize4x32: layoutFormat = ElfRgba32i; break; + default: break; + } + } + + return layoutFormat; +} + } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h b/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h index 885fd908..d7466293 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h @@ -95,12 +95,15 @@ class TParseContextBase : public TParseVersions { globalUniformSet(TQualifier::layoutSetEnd), atomicCounterBlockSet(TQualifier::layoutSetEnd) { + // use storage buffer on SPIR-V 1.3 and up + if (spvVersion.spv >= EShTargetSpv_1_3) + intermediate.setUseStorageBuffer(); + if (entryPoint != nullptr) sourceEntryPointName = *entryPoint; } virtual ~TParseContextBase() { } -#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL) virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...); virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, @@ -109,7 +112,6 @@ class TParseContextBase : public TParseVersions { const char* szExtraInfoFormat, ...); virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...); -#endif virtual void setLimits(const TBuiltInResource&) = 0; @@ -327,10 +329,8 @@ class TParseContext : public TParseContextBase { TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); void handleIndexLimits(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); -#ifndef GLSLANG_WEB void makeEditable(TSymbol*&) override; void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier); -#endif bool isIoResizeArray(const TType&) const; void fixIoArraySize(const TSourceLoc&, TType&); void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base); @@ -378,7 +378,7 @@ class TParseContext : public TParseContextBase { void globalCheck(const TSourceLoc&, const char* token); bool constructorError(const TSourceLoc&, TIntermNode*, TFunction&, TOperator, TType&); bool constructorTextureSamplerError(const TSourceLoc&, const TFunction&); - void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, TArraySize&, const char *sizeType); + void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, TArraySize&, const char *sizeType, const bool allowZero = false); bool arrayQualifierError(const TSourceLoc&, const TQualifier&); bool arrayError(const TSourceLoc&, const TType&); void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&); @@ -393,14 +393,14 @@ class TParseContext : public TParseContextBase { void accStructCheck(const TSourceLoc & loc, const TType & type, const TString & identifier); void transparentOpaqueCheck(const TSourceLoc&, const TType&, const TString& identifier); void memberQualifierCheck(glslang::TPublicType&); - void globalQualifierFixCheck(const TSourceLoc&, TQualifier&, bool isMemberCheck = false); + void globalQualifierFixCheck(const TSourceLoc&, TQualifier&, bool isMemberCheck = false, const TPublicType* publicType = nullptr); void globalQualifierTypeCheck(const TSourceLoc&, const TQualifier&, const TPublicType&); bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType); void mergeQualifiers(const TSourceLoc&, TQualifier& dst, const TQualifier& src, bool force); void setDefaultPrecision(const TSourceLoc&, TPublicType&, TPrecisionQualifier); int computeSamplerTypeIndex(TSampler&); TPrecisionQualifier getDefaultPrecision(TPublicType&); - void precisionQualifierCheck(const TSourceLoc&, TBasicType, TQualifier&); + void precisionQualifierCheck(const TSourceLoc&, TBasicType, TQualifier&, bool isCoopMat); 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&); @@ -418,6 +418,7 @@ class TParseContext : public TParseContextBase { void inductiveLoopCheck(const TSourceLoc&, TIntermNode* init, TIntermLoop* loop); void arrayLimitCheck(const TSourceLoc&, const TString&, int size); void limitCheck(const TSourceLoc&, int value, const char* limit, const char* feature); + void coopMatTypeParametersCheck(const TSourceLoc&, const TPublicType&); void inductiveLoopBodyCheck(TIntermNode*, long long loopIndexId, TSymbolTable&); void constantIndexExpressionCheck(TIntermNode*); @@ -438,12 +439,12 @@ class TParseContext : public TParseContextBase { const TFunction* findFunction400(const TSourceLoc& loc, const TFunction& call, bool& builtIn); const TFunction* findFunctionExplicitTypes(const TSourceLoc& loc, const TFunction& call, bool& builtIn); void declareTypeDefaults(const TSourceLoc&, const TPublicType&); - TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, const TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0); + TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, const TPublicType&, TArraySizes* typeArray = nullptr, TIntermTyped* initializer = nullptr); 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 inheritMemoryQualifiers(const TQualifier& from, TQualifier& to); - void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0); + void 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); @@ -456,11 +457,12 @@ class TParseContext : public TParseContextBase { void addQualifierToExisting(const TSourceLoc&, TQualifier, TIdentifierList&); void invariantCheck(const TSourceLoc&, const TQualifier&); void updateStandaloneQualifierDefaults(const TSourceLoc&, const TPublicType&); + void updateBindlessQualifier(TType& memberType); void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode); TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body); const TTypeList* recordStructCopy(TStructRecord&, const TType*, const TType*); + TLayoutFormat mapLegacyLayoutFormat(TLayoutFormat legacyLayoutFormat, TBasicType imageType); -#ifndef GLSLANG_WEB TAttributeType attributeFromName(const TString& name) const; TAttributes* makeAttributes(const TString& identifier) const; TAttributes* makeAttributes(const TString& identifier, TIntermNode* node) const; @@ -480,14 +482,13 @@ class TParseContext : public TParseContextBase { TSpirvRequirement* mergeSpirvRequirements(const TSourceLoc& loc, TSpirvRequirement* spirvReq1, TSpirvRequirement* spirvReq2); TSpirvTypeParameters* makeSpirvTypeParameters(const TSourceLoc& loc, const TIntermConstantUnion* constant); + TSpirvTypeParameters* makeSpirvTypeParameters(const TSourceLoc& loc, const TPublicType& type); TSpirvTypeParameters* mergeSpirvTypeParameters(TSpirvTypeParameters* spirvTypeParams1, TSpirvTypeParameters* spirvTypeParams2); TSpirvInstruction* makeSpirvInstruction(const TSourceLoc& loc, const TString& name, const TString& value); TSpirvInstruction* makeSpirvInstruction(const TSourceLoc& loc, const TString& name, int value); TSpirvInstruction* mergeSpirvInstruction(const TSourceLoc& loc, TSpirvInstruction* spirvInst1, TSpirvInstruction* spirvInst2); -#endif - void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember); protected: @@ -500,9 +501,7 @@ class TParseContext : public TParseContextBase { bool isRuntimeLength(const TIntermTyped&) const; TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); -#ifndef GLSLANG_WEB void finish() override; -#endif virtual const char* getGlobalUniformBlockName() const override; virtual void finalizeGlobalUniformBlockLayout(TVariable&) override; @@ -539,7 +538,6 @@ class TParseContext : public TParseContextBase { TQualifier globalOutputDefaults; TQualifier globalSharedDefaults; TString currentCaller; // name of last function body entered (not valid when at global scope) -#ifndef GLSLANG_WEB int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point bool anyIndexLimits; TIdSetType inductiveLoopIds; @@ -580,7 +578,6 @@ class TParseContext : public TParseContextBase { // array-sizing declarations // TVector ioArraySymbolResizeList; -#endif }; } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/PoolAlloc.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/PoolAlloc.cpp index 84c40f4e..5d7173c9 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/PoolAlloc.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/PoolAlloc.cpp @@ -35,34 +35,28 @@ #include "../Include/Common.h" #include "../Include/PoolAlloc.h" -#include "../Include/InitializeGlobals.h" -#include "../OSDependent/osinclude.h" - namespace glslang { -// Process-wide TLS index -OS_TLSIndex PoolIndex; +namespace { +thread_local TPoolAllocator* threadPoolAllocator = nullptr; + +TPoolAllocator* GetDefaultThreadPoolAllocator() +{ + thread_local TPoolAllocator defaultAllocator; + return &defaultAllocator; +} +} // anonymous namespace // Return the thread-specific current pool. TPoolAllocator& GetThreadPoolAllocator() { - return *static_cast(OS_GetTLSValue(PoolIndex)); + return *(threadPoolAllocator ? threadPoolAllocator : GetDefaultThreadPoolAllocator()); } // Set the thread-specific current pool. void SetThreadPoolAllocator(TPoolAllocator* poolAllocator) { - OS_SetTLSValue(PoolIndex, poolAllocator); -} - -// Process-wide set up of the TLS pool storage. -bool InitializePoolIndex() -{ - // Allocate a TLS index. - if ((PoolIndex = OS_AllocTLSIndex()) == OS_INVALID_TLS_INDEX) - return false; - - return true; + threadPoolAllocator = poolAllocator; } // @@ -137,16 +131,6 @@ TPoolAllocator::~TPoolAllocator() } } -const unsigned char TAllocation::guardBlockBeginVal = 0xfb; -const unsigned char TAllocation::guardBlockEndVal = 0xfe; -const unsigned char TAllocation::userDataFill = 0xcd; - -# ifdef GUARD_BLOCKS - const size_t TAllocation::guardBlockSize = 16; -# else - const size_t TAllocation::guardBlockSize = 0; -# endif - // // Check a single guard block for damage // @@ -267,8 +251,8 @@ void* TPoolAllocator::allocate(size_t numBytes) // size_t numBytesToAlloc = allocationSize + headerSkip; tHeader* memory = reinterpret_cast(::new char[numBytesToAlloc]); - if (memory == 0) - return 0; + if (memory == nullptr) + return nullptr; // Use placement-new to initialize header new(memory) tHeader(inUseList, (numBytesToAlloc + pageSize - 1) / pageSize); @@ -289,8 +273,8 @@ void* TPoolAllocator::allocate(size_t numBytes) freeList = freeList->nextPage; } else { memory = reinterpret_cast(::new char[pageSize]); - if (memory == 0) - return 0; + if (memory == nullptr) + return nullptr; } // Use placement-new to initialize header @@ -308,7 +292,7 @@ void* TPoolAllocator::allocate(size_t numBytes) // void TAllocation::checkAllocList() const { - for (const TAllocation* alloc = this; alloc != 0; alloc = alloc->prevAlloc) + for (const TAllocation* alloc = this; alloc != nullptr; alloc = alloc->prevAlloc) alloc->check(); } diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp index 7f51173e..99c9ecbb 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp @@ -324,11 +324,9 @@ struct str_hash // A single global usable by all threads, by all versions, by all languages. // After a single process-level initialization, this is read only and thread safe std::unordered_map* KeywordMap = nullptr; -#ifndef GLSLANG_WEB std::unordered_set* ReservedSet = nullptr; -#endif -}; +} namespace glslang { @@ -343,6 +341,7 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["const"] = CONST; (*KeywordMap)["uniform"] = UNIFORM; + (*KeywordMap)["tileImageEXT"] = TILEIMAGEEXT; (*KeywordMap)["buffer"] = BUFFER; (*KeywordMap)["in"] = IN; (*KeywordMap)["out"] = OUT; @@ -408,7 +407,6 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["uvec3"] = UVEC3; (*KeywordMap)["uvec4"] = UVEC4; -#ifndef GLSLANG_WEB (*KeywordMap)["nonuniformEXT"] = NONUNIFORM; (*KeywordMap)["demote"] = DEMOTE; (*KeywordMap)["attribute"] = ATTRIBUTE; @@ -598,7 +596,6 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["spirv_storage_class"] = SPIRV_STORAGE_CLASS; (*KeywordMap)["spirv_by_reference"] = SPIRV_BY_REFERENCE; (*KeywordMap)["spirv_literal"] = SPIRV_LITERAL; -#endif (*KeywordMap)["sampler2D"] = SAMPLER2D; (*KeywordMap)["samplerCube"] = SAMPLERCUBE; @@ -632,7 +629,6 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["sampler"] = SAMPLER; (*KeywordMap)["samplerShadow"] = SAMPLERSHADOW; -#ifndef GLSLANG_WEB (*KeywordMap)["textureCubeArray"] = TEXTURECUBEARRAY; (*KeywordMap)["itextureCubeArray"] = ITEXTURECUBEARRAY; (*KeywordMap)["utextureCubeArray"] = UTEXTURECUBEARRAY; @@ -685,6 +681,10 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["texture2DRect"] = TEXTURE2DRECT; (*KeywordMap)["texture1DArray"] = TEXTURE1DARRAY; + (*KeywordMap)["attachmentEXT"] = ATTACHMENTEXT; + (*KeywordMap)["iattachmentEXT"] = IATTACHMENTEXT; + (*KeywordMap)["uattachmentEXT"] = UATTACHMENTEXT; + (*KeywordMap)["subpassInput"] = SUBPASSINPUT; (*KeywordMap)["subpassInputMS"] = SUBPASSINPUTMS; (*KeywordMap)["isubpassInput"] = ISUBPASSINPUT; @@ -765,6 +765,11 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["icoopmatNV"] = ICOOPMATNV; (*KeywordMap)["ucoopmatNV"] = UCOOPMATNV; + (*KeywordMap)["coopmat"] = COOPMAT; + + (*KeywordMap)["hitObjectNV"] = HITOBJECTNV; + (*KeywordMap)["hitObjectAttributeNV"] = HITOBJECTATTRNV; + ReservedSet = new std::unordered_set; ReservedSet->insert("common"); @@ -804,17 +809,14 @@ void TScanContext::fillInKeywordMap() ReservedSet->insert("cast"); ReservedSet->insert("namespace"); ReservedSet->insert("using"); -#endif } void TScanContext::deleteKeywordMap() { delete KeywordMap; KeywordMap = nullptr; -#ifndef GLSLANG_WEB delete ReservedSet; ReservedSet = nullptr; -#endif } // Called by yylex to get the next token. @@ -895,14 +897,12 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT; case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT; case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT; -#ifndef GLSLANG_WEB case PpAtomConstInt16: parserToken->sType.lex.i = ppToken.ival; return INT16CONSTANT; case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT; case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT; case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT; case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT; case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT; -#endif case PpAtomIdentifier: { int token = tokenizeIdentifier(); @@ -924,10 +924,8 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) int TScanContext::tokenizeIdentifier() { -#ifndef GLSLANG_WEB if (ReservedSet->find(tokenText) != ReservedSet->end()) return reservedWord(); -#endif auto it = KeywordMap->find(tokenText); if (it == KeywordMap->end()) { @@ -939,6 +937,7 @@ int TScanContext::tokenizeIdentifier() switch (keyword) { case CONST: case UNIFORM: + case TILEIMAGEEXT: case IN: case OUT: case INOUT: @@ -1049,7 +1048,6 @@ int TScanContext::tokenizeIdentifier() return identifierOrReserved(reserved); } -#ifndef GLSLANG_WEB case NOPERSPECTIVE: if (parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation)) return keyword; @@ -1136,7 +1134,7 @@ int TScanContext::tokenizeIdentifier() case SUBROUTINE: return es30ReservedFromGLSL(400); -#endif + case SHARED: if ((parseContext.isEsProfile() && parseContext.version < 300) || (!parseContext.isEsProfile() && parseContext.version < 140)) @@ -1171,7 +1169,6 @@ int TScanContext::tokenizeIdentifier() case MAT4X4: return matNxM(); -#ifndef GLSLANG_WEB case DMAT2: case DMAT3: case DMAT4: @@ -1476,7 +1473,6 @@ int TScanContext::tokenizeIdentifier() return keyword; else return identifierOrType(); -#endif case UINT: case UVEC2: @@ -1531,7 +1527,6 @@ int TScanContext::tokenizeIdentifier() else return identifierOrType(); -#ifndef GLSLANG_WEB case ISAMPLER1D: case ISAMPLER1DARRAY: case SAMPLER1DARRAYSHADOW: @@ -1655,6 +1650,9 @@ int TScanContext::tokenizeIdentifier() case ISUBPASSINPUTMS: case USUBPASSINPUT: case USUBPASSINPUTMS: + case ATTACHMENTEXT: + case IATTACHMENTEXT: + case UATTACHMENTEXT: if (parseContext.spvVersion.vulkan > 0) return keyword; else @@ -1769,6 +1767,13 @@ int TScanContext::tokenizeIdentifier() return keyword; return identifierOrType(); + case COOPMAT: + afterType = true; + if (parseContext.symbolTable.atBuiltInLevel() || + parseContext.extensionTurnedOn(E_GL_KHR_cooperative_matrix)) + return keyword; + return identifierOrType(); + case DEMOTE: if (parseContext.extensionTurnedOn(E_GL_EXT_demote_to_helper_invocation)) return keyword; @@ -1789,7 +1794,20 @@ int TScanContext::tokenizeIdentifier() parseContext.extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) return keyword; return identifierOrType(); -#endif + + case HITOBJECTNV: + if (parseContext.symbolTable.atBuiltInLevel() || + (!parseContext.isEsProfile() && parseContext.version >= 460 + && parseContext.extensionTurnedOn(E_GL_NV_shader_invocation_reorder))) + return keyword; + return identifierOrType(); + + case HITOBJECTATTRNV: + if (parseContext.symbolTable.atBuiltInLevel() || + (!parseContext.isEsProfile() && parseContext.version >= 460 + && parseContext.extensionTurnedOn(E_GL_NV_shader_invocation_reorder))) + return keyword; + return identifierOrType(); default: parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc); diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp index 57e3423a..51c524bb 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include "SymbolTable.h" #include "ParseHelper.h" #include "Scan.h" @@ -81,6 +82,9 @@ namespace { // anonymous namespace for file-local functions and symbols // Shared global; access should be protected by a global mutex/critical section. int NumberOfClients = 0; +// global initialization lock +std::mutex init_lock; + using namespace glslang; // Create a language specific version of parseables. @@ -295,14 +299,6 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi EShLanguage language, EShSource source, TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables) { -#ifdef GLSLANG_WEB - profile = EEsProfile; - version = 310; -#elif defined(GLSLANG_ANGLE) - profile = ECoreProfile; - version = 450; -#endif - (*symbolTables[language]).adoptLevels(*commonTable[CommonIndex(profile, language)]); InitializeSymbolTable(builtInParseables.getStageString(language), version, profile, spvVersion, language, source, infoSink, *symbolTables[language]); @@ -319,14 +315,6 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi // bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, const SpvVersion& spvVersion, EShSource source) { -#ifdef GLSLANG_WEB - profile = EEsProfile; - version = 310; -#elif defined(GLSLANG_ANGLE) - profile = ECoreProfile; - version = 450; -#endif - std::unique_ptr builtInParseables(CreateBuiltInParseables(infoSink, source)); if (builtInParseables == nullptr) @@ -349,7 +337,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangFragment, source, infoSink, commonTable, symbolTables); -#ifndef GLSLANG_WEB // check for tessellation if ((profile != EEsProfile && version >= 150) || (profile == EEsProfile && version >= 310)) { @@ -371,7 +358,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source, infoSink, commonTable, symbolTables); -#ifndef GLSLANG_ANGLE // check for ray tracing stages if (profile != EEsProfile && version >= 450) { InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangRayGen, source, @@ -399,8 +385,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS (profile == EEsProfile && version >= 320)) InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTask, source, infoSink, commonTable, symbolTables); -#endif // !GLSLANG_ANGLE -#endif // !GLSLANG_WEB return true; } @@ -437,18 +421,15 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp TInfoSink infoSink; // Make sure only one thread tries to do this at a time - glslang::GetGlobalLock(); + const std::lock_guard lock(init_lock); // See if it's already been done for this version/profile combination int versionIndex = MapVersionToIndex(version); int spvVersionIndex = MapSpvVersionToIndex(spvVersion); int profileIndex = MapProfileToIndex(profile); int sourceIndex = MapSourceToIndex(source); - if (CommonSymbolTable[versionIndex][spvVersionIndex][profileIndex][sourceIndex][EPcGeneral]) { - glslang::ReleaseGlobalLock(); - + if (CommonSymbolTable[versionIndex][spvVersionIndex][profileIndex][sourceIndex][EPcGeneral]) return; - } // Switch to a new pool TPoolAllocator& previousAllocator = GetThreadPoolAllocator(); @@ -495,20 +476,16 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp delete builtInPoolAllocator; SetThreadPoolAllocator(&previousAllocator); - - glslang::ReleaseGlobalLock(); } // Function to Print all builtins void DumpBuiltinSymbolTable(TInfoSink& infoSink, const TSymbolTable& symbolTable) { -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) infoSink.debug << "BuiltinSymbolTable {\n"; symbolTable.dump(infoSink, true); infoSink.debug << "}\n"; -#endif } // Return true if the shader was correctly specified for version/profile/stage. @@ -606,7 +583,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo break; } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) // Correct for stage type... switch (stage) { case EShLangGeometry: @@ -694,7 +670,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo break; } } -#endif return correct; } @@ -884,7 +859,6 @@ bool ProcessDeferred( : userInput.scanVersion(version, profile, versionNotFirstToken); bool versionNotFound = version == 0; if (forceDefaultVersionAndProfile && source == EShSourceGlsl) { -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) if (! (messages & EShMsgSuppressWarnings) && ! versionNotFound && (version != defaultVersion || profile != defaultProfile)) { compiler->infoSink.info << "Warning, (version, profile) forced to be (" @@ -892,7 +866,7 @@ bool ProcessDeferred( << "), while in source code it is (" << version << ", " << ProfileName(profile) << ")\n"; } -#endif + if (versionNotFound) { versionNotFirstToken = false; versionNotFirst = false; @@ -907,16 +881,7 @@ bool ProcessDeferred( bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage, versionNotFirst, defaultVersion, source, version, profile, spvVersion); -#ifdef GLSLANG_WEB - profile = EEsProfile; - version = 310; -#elif defined(GLSLANG_ANGLE) - profile = ECoreProfile; - version = 450; -#endif - bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst)); -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) bool warnVersionNotFirst = false; if (! versionWillBeError && versionNotFirstToken) { if (messages & EShMsgRelaxedErrors) @@ -924,7 +889,6 @@ bool ProcessDeferred( else versionWillBeError = true; } -#endif intermediate.setSource(source); intermediate.setVersion(version); @@ -989,13 +953,11 @@ bool ProcessDeferred( parseContext->setLimits(*resources); if (! goodVersion) parseContext->addError(); -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) if (warnVersionNotFirst) { TSourceLoc loc; loc.init(); parseContext->warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", ""); } -#endif parseContext->initializeExtensionBehavior(); @@ -1027,8 +989,6 @@ bool ProcessDeferred( return success; } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - // Responsible for keeping track of the most recent source string and line in // the preprocessor and outputting newlines appropriately if the source string // or line changes. @@ -1225,8 +1185,6 @@ struct DoPreprocessing { std::string* outputString; }; -#endif - // DoFullParse is a valid ProcessingConext template argument for fully // parsing the shader. It populates the "intermediate" with the AST. struct DoFullParse{ @@ -1250,16 +1208,13 @@ struct DoFullParse{ parseContext.infoSink.info << parseContext.getNumErrors() << " compilation errors. No code generated.\n\n"; } -#ifndef GLSLANG_ANGLE if (messages & EShMsgAST) intermediate.output(parseContext.infoSink, true); -#endif return success; } }; -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) // Take a single compilation unit, and run the preprocessor on it. // Return: True if there were no issues found in preprocessing, // False if during preprocessing any unknown version, pragmas or @@ -1294,7 +1249,6 @@ bool PreprocessDeferred( forwardCompatible, messages, intermediate, parser, false, includer, "", environment); } -#endif // // do a partial compile on the given strings for a single compilation unit @@ -1342,12 +1296,10 @@ bool CompileDeferred( // int ShInitialize() { - glslang::InitGlobalLock(); - if (! InitProcess()) return 0; - glslang::GetGlobalLock(); + const std::lock_guard lock(init_lock); ++NumberOfClients; if (PerProcessGPA == nullptr) @@ -1358,7 +1310,6 @@ int ShInitialize() glslang::HlslScanContext::fillInKeywordMap(); #endif - glslang::ReleaseGlobalLock(); return 1; } @@ -1370,7 +1321,7 @@ int ShInitialize() ShHandle ShConstructCompiler(const EShLanguage language, int debugOptions) { if (!InitThread()) - return 0; + return nullptr; TShHandleBase* base = static_cast(ConstructCompiler(language, debugOptions)); @@ -1380,7 +1331,7 @@ ShHandle ShConstructCompiler(const EShLanguage language, int debugOptions) ShHandle ShConstructLinker(const EShExecutable executable, int debugOptions) { if (!InitThread()) - return 0; + return nullptr; TShHandleBase* base = static_cast(ConstructLinker(executable, debugOptions)); @@ -1390,7 +1341,7 @@ ShHandle ShConstructLinker(const EShExecutable executable, int debugOptions) ShHandle ShConstructUniformMap() { if (!InitThread()) - return 0; + return nullptr; TShHandleBase* base = static_cast(ConstructUniformMap()); @@ -1399,7 +1350,7 @@ ShHandle ShConstructUniformMap() void ShDestruct(ShHandle handle) { - if (handle == 0) + if (handle == nullptr) return; TShHandleBase* base = static_cast(handle); @@ -1417,14 +1368,11 @@ void ShDestruct(ShHandle handle) // int ShFinalize() { - glslang::GetGlobalLock(); + const std::lock_guard lock(init_lock); --NumberOfClients; assert(NumberOfClients >= 0); - bool finalize = NumberOfClients == 0; - if (! finalize) { - glslang::ReleaseGlobalLock(); + if (NumberOfClients > 0) return 1; - } for (int version = 0; version < VersionCount; ++version) { for (int spvVersion = 0; spvVersion < SpvVersionCount; ++spvVersion) { @@ -1432,7 +1380,7 @@ int ShFinalize() for (int source = 0; source < SourceCount; ++source) { for (int stage = 0; stage < EShLangCount; ++stage) { delete SharedSymbolTables[version][spvVersion][p][source][stage]; - SharedSymbolTables[version][spvVersion][p][source][stage] = 0; + SharedSymbolTables[version][spvVersion][p][source][stage] = nullptr; } } } @@ -1445,7 +1393,7 @@ int ShFinalize() for (int source = 0; source < SourceCount; ++source) { for (int pc = 0; pc < EPcCount; ++pc) { delete CommonSymbolTable[version][spvVersion][p][source][pc]; - CommonSymbolTable[version][spvVersion][p][source][pc] = 0; + CommonSymbolTable[version][spvVersion][p][source][pc] = nullptr; } } } @@ -1462,7 +1410,6 @@ int ShFinalize() glslang::HlslScanContext::deleteKeywordMap(); #endif - glslang::ReleaseGlobalLock(); return 1; } @@ -1488,12 +1435,12 @@ int ShCompile( ) { // Map the generic handle to the C++ object - if (handle == 0) + if (handle == nullptr) return 0; TShHandleBase* base = reinterpret_cast(handle); TCompiler* compiler = base->getAsCompiler(); - if (compiler == 0) + if (compiler == nullptr) return 0; SetThreadPoolAllocator(compiler->getPool()); @@ -1533,13 +1480,13 @@ int ShLinkExt( const ShHandle compHandles[], const int numHandles) { - if (linkHandle == 0 || numHandles == 0) + if (linkHandle == nullptr || numHandles == 0) return 0; THandleList cObjects; for (int i = 0; i < numHandles; ++i) { - if (compHandles[i] == 0) + if (compHandles[i] == nullptr) return 0; TShHandleBase* base = reinterpret_cast(compHandles[i]); if (base->getAsLinker()) { @@ -1548,18 +1495,17 @@ int ShLinkExt( if (base->getAsCompiler()) cObjects.push_back(base->getAsCompiler()); - if (cObjects[i] == 0) + if (cObjects[i] == nullptr) return 0; } TShHandleBase* base = reinterpret_cast(linkHandle); TLinker* linker = static_cast(base->getAsLinker()); - SetThreadPoolAllocator(linker->getPool()); - - if (linker == 0) + if (linker == nullptr) return 0; - + + SetThreadPoolAllocator(linker->getPool()); linker->infoSink.info.erase(); for (int i = 0; i < numHandles; ++i) { @@ -1582,7 +1528,7 @@ int ShLinkExt( // void ShSetEncryptionMethod(ShHandle handle) { - if (handle == 0) + if (handle == nullptr) return; } @@ -1591,8 +1537,8 @@ void ShSetEncryptionMethod(ShHandle handle) // const char* ShGetInfoLog(const ShHandle handle) { - if (handle == 0) - return 0; + if (handle == nullptr) + return nullptr; TShHandleBase* base = static_cast(handle); TInfoSink* infoSink; @@ -1602,7 +1548,7 @@ const char* ShGetInfoLog(const ShHandle handle) else if (base->getAsLinker()) infoSink = &(base->getAsLinker()->getInfoSink()); else - return 0; + return nullptr; infoSink->info << infoSink->debug.c_str(); return infoSink->info.c_str(); @@ -1614,14 +1560,14 @@ const char* ShGetInfoLog(const ShHandle handle) // const void* ShGetExecutable(const ShHandle handle) { - if (handle == 0) - return 0; + if (handle == nullptr) + return nullptr; TShHandleBase* base = reinterpret_cast(handle); TLinker* linker = static_cast(base->getAsLinker()); - if (linker == 0) - return 0; + if (linker == nullptr) + return nullptr; return linker->getObjectCode(); } @@ -1636,13 +1582,13 @@ const void* ShGetExecutable(const ShHandle handle) // int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* table) { - if (handle == 0) + if (handle == nullptr) return 0; TShHandleBase* base = reinterpret_cast(handle); TLinker* linker = static_cast(base->getAsLinker()); - if (linker == 0) + if (linker == nullptr) return 0; linker->setAppAttributeBindings(table); @@ -1655,13 +1601,13 @@ int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* t // int ShSetFixedAttributeBindings(const ShHandle handle, const ShBindingTable* table) { - if (handle == 0) + if (handle == nullptr) return 0; TShHandleBase* base = reinterpret_cast(handle); TLinker* linker = static_cast(base->getAsLinker()); - if (linker == 0) + if (linker == nullptr) return 0; linker->setFixedAttributeBindings(table); @@ -1673,12 +1619,12 @@ int ShSetFixedAttributeBindings(const ShHandle handle, const ShBindingTable* tab // int ShExcludeAttributes(const ShHandle handle, int *attributes, int count) { - if (handle == 0) + if (handle == nullptr) return 0; TShHandleBase* base = reinterpret_cast(handle); TLinker* linker = static_cast(base->getAsLinker()); - if (linker == 0) + if (linker == nullptr) return 0; linker->setExcludedAttributes(attributes, count); @@ -1694,12 +1640,12 @@ int ShExcludeAttributes(const ShHandle handle, int *attributes, int count) // int ShGetUniformLocation(const ShHandle handle, const char* name) { - if (handle == 0) + if (handle == nullptr) return -1; TShHandleBase* base = reinterpret_cast(handle); TUniformMap* uniformMap= base->getAsUniformMap(); - if (uniformMap == 0) + if (uniformMap == nullptr) return -1; return uniformMap->getLocation(name); @@ -1845,8 +1791,6 @@ void TShader::setDxPositionW(bool invert) { intermediate->setDxPos void TShader::setEnhancedMsgs() { intermediate->setEnhancedMsgs(); } void TShader::setNanMinMaxClamp(bool useNonNan) { intermediate->setNanMinMaxClamp(useNonNan); } -#ifndef GLSLANG_WEB - // Set binding base for given resource type void TShader::setShiftBinding(TResourceType res, unsigned int base) { intermediate->setShiftBinding(res, base); @@ -1888,7 +1832,6 @@ void TShader::setUniformLocationBase(int base) void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); } void TShader::setResourceSetBinding(const std::vector& base) { intermediate->setResourceSetBinding(base); } void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); } -#endif void TShader::addBlockStorageOverride(const char* nameStr, TBlockStorageClass backing) { intermediate->addBlockStorageOverride(nameStr, backing); } @@ -1927,7 +1870,6 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion &environment); } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) // Fill in a string with the result of preprocessing ShaderStrings // Returns true if all extensions, pragmas and version strings were valid. // @@ -1953,7 +1895,6 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources, forwardCompatible, message, includer, *intermediate, output_string, &environment); } -#endif const char* TShader::getInfoLog() { @@ -1965,16 +1906,12 @@ const char* TShader::getInfoDebugLog() return infoSink->debug.c_str(); } -TProgram::TProgram() : -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - reflection(0), -#endif - linked(false) +TProgram::TProgram() : reflection(nullptr), linked(false) { pool = new TPoolAllocator; infoSink = new TInfoSink; for (int s = 0; s < EShLangCount; ++s) { - intermediate[s] = 0; + intermediate[s] = nullptr; newedIntermediate[s] = false; } } @@ -1982,9 +1919,7 @@ TProgram::TProgram() : TProgram::~TProgram() { delete infoSink; -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) delete reflection; -#endif for (int s = 0; s < EShLangCount; ++s) if (newedIntermediate[s]) @@ -2032,7 +1967,6 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) if (stages[stage].size() == 0) return true; -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) int numEsShaders = 0, numNonEsShaders = 0; for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it) { if ((*it)->intermediate->getProfile() == EEsProfile) { @@ -2083,15 +2017,10 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) for (it = stages[stage].begin(); it != stages[stage].end(); ++it) intermediate[stage]->merge(*infoSink, *(*it)->intermediate); } -#else - intermediate[stage] = stages[stage].front()->intermediate; -#endif intermediate[stage]->finalCheck(*infoSink, (messages & EShMsgKeepUncalled) != 0); -#ifndef GLSLANG_ANGLE if (messages & EShMsgAST) intermediate[stage]->output(*infoSink, true); -#endif return intermediate[stage]->getNumErrors() == 0; } @@ -2169,8 +2098,6 @@ const char* TProgram::getInfoDebugLog() return infoSink->debug.c_str(); } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - // // Reflection implementation. // @@ -2251,6 +2178,4 @@ bool TProgram::mapIO(TIoMapResolver* pResolver, TIoMapper* pIoMapper) return ioMapper->doMap(pResolver, *infoSink); } -#endif // !GLSLANG_WEB && !GLSLANG_ANGLE - } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/SpirvIntrinsics.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/SpirvIntrinsics.cpp index 6650f7d9..4e130c31 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/SpirvIntrinsics.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/SpirvIntrinsics.cpp @@ -33,8 +33,6 @@ // POSSIBILITY OF SUCH DAMAGE. // -#ifndef GLSLANG_WEB - // // GL_EXT_spirv_intrinsics // @@ -45,6 +43,15 @@ namespace glslang { +bool TSpirvTypeParameter::operator==(const TSpirvTypeParameter& rhs) const +{ + if (constant != nullptr) + return constant->getConstArray() == rhs.constant->getConstArray(); + + assert(type != nullptr); + return *type == *rhs.type; +} + // // Handle SPIR-V requirements // @@ -67,7 +74,7 @@ TSpirvRequirement* TParseContext::makeSpirvRequirement(const TSourceLoc& loc, co spirvReq->capabilities.insert(capability->getAsConstantUnion()->getConstArray()[0].getIConst()); } } else - error(loc, "unknow SPIR-V requirement", name.c_str(), ""); + error(loc, "unknown SPIR-V requirement", name.c_str(), ""); return spirvReq; } @@ -168,7 +175,7 @@ void TQualifier::setSpirvDecorateId(int decoration, const TIntermAggregate* args TVector extraOperands; for (auto arg : args->getSequence()) { auto extraOperand = arg->getAsTyped(); - assert(extraOperand != nullptr && extraOperand->getQualifier().isConstant()); + assert(extraOperand != nullptr); extraOperands.push_back(extraOperand); } spirvDecorate->decorateIds[decoration] = extraOperands; @@ -202,30 +209,29 @@ TString TQualifier::getSpirvDecorateQualifierString() const const auto appendStr = [&](const char* s) { qualifierString.append(s); }; const auto appendDecorate = [&](const TIntermTyped* constant) { - auto& constArray = constant->getAsConstantUnion() != nullptr ? constant->getAsConstantUnion()->getConstArray() - : constant->getAsSymbolNode()->getConstArray(); - if (constant->getBasicType() == EbtFloat) { - float value = static_cast(constArray[0].getDConst()); - appendFloat(value); - } - else if (constant->getBasicType() == EbtInt) { - int value = constArray[0].getIConst(); - appendInt(value); - } - else if (constant->getBasicType() == EbtUint) { - unsigned value = constArray[0].getUConst(); - appendUint(value); - } - else if (constant->getBasicType() == EbtBool) { - bool value = constArray[0].getBConst(); - appendBool(value); + if (constant->getAsConstantUnion()) { + auto& constArray = constant->getAsConstantUnion()->getConstArray(); + if (constant->getBasicType() == EbtFloat) { + float value = static_cast(constArray[0].getDConst()); + appendFloat(value); + } else if (constant->getBasicType() == EbtInt) { + int value = constArray[0].getIConst(); + appendInt(value); + } else if (constant->getBasicType() == EbtUint) { + unsigned value = constArray[0].getUConst(); + appendUint(value); + } else if (constant->getBasicType() == EbtBool) { + bool value = constArray[0].getBConst(); + appendBool(value); + } else if (constant->getBasicType() == EbtString) { + const TString* value = constArray[0].getSConst(); + appendStr(value->c_str()); + } else + assert(0); + } else { + assert(constant->getAsSymbolNode()); + appendStr(constant->getAsSymbolNode()->getName().c_str()); } - else if (constant->getBasicType() == EbtString) { - const TString* value = constArray[0].getSConst(); - appendStr(value->c_str()); - } - else - assert(0); }; for (auto& decorate : spirvDecorate->decorates) { @@ -284,14 +290,20 @@ TSpirvTypeParameters* TParseContext::makeSpirvTypeParameters(const TSourceLoc& l constant->getBasicType() != EbtBool && constant->getBasicType() != EbtString) error(loc, "this type not allowed", constant->getType().getBasicString(), ""); - else { - assert(constant); + else spirvTypeParams->push_back(TSpirvTypeParameter(constant)); - } return spirvTypeParams; } +TSpirvTypeParameters* TParseContext::makeSpirvTypeParameters(const TSourceLoc& /* loc */, + const TPublicType& type) +{ + TSpirvTypeParameters* spirvTypeParams = new TSpirvTypeParameters; + spirvTypeParams->push_back(TSpirvTypeParameter(new TType(type))); + return spirvTypeParams; +} + TSpirvTypeParameters* TParseContext::mergeSpirvTypeParameters(TSpirvTypeParameters* spirvTypeParams1, TSpirvTypeParameters* spirvTypeParams2) { // Merge SPIR-V type parameters of the second one to the first one @@ -346,5 +358,3 @@ TSpirvInstruction* TParseContext::mergeSpirvInstruction(const TSourceLoc& loc, T } } // end namespace glslang - -#endif // GLSLANG_WEB diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp index 2f1b5ac3..1e007a71 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp @@ -65,7 +65,6 @@ void TType::buildMangledName(TString& mangledName) const case EbtInt: mangledName += 'i'; break; case EbtUint: mangledName += 'u'; break; case EbtBool: mangledName += 'b'; break; -#ifndef GLSLANG_WEB case EbtDouble: mangledName += 'd'; break; case EbtFloat16: mangledName += "f16"; break; case EbtInt8: mangledName += "i8"; break; @@ -78,12 +77,10 @@ void TType::buildMangledName(TString& mangledName) const case EbtAccStruct: mangledName += "as"; break; case EbtRayQuery: mangledName += "rq"; break; case EbtSpirvType: mangledName += "spv-t"; break; -#endif + case EbtHitObjectNV: mangledName += "ho"; break; case EbtSampler: switch (sampler.type) { -#ifndef GLSLANG_WEB case EbtFloat16: mangledName += "f16"; break; -#endif case EbtInt: mangledName += "i"; break; case EbtUint: mangledName += "u"; break; case EbtInt64: mangledName += "i64"; break; @@ -110,12 +107,10 @@ void TType::buildMangledName(TString& mangledName) const case Esd2D: mangledName += "2"; break; case Esd3D: mangledName += "3"; break; case EsdCube: mangledName += "C"; break; -#ifndef GLSLANG_WEB case Esd1D: mangledName += "1"; break; case EsdRect: mangledName += "R2"; break; case EsdBuffer: mangledName += "B"; break; case EsdSubpass: mangledName += "P"; break; -#endif default: break; // some compilers want this } @@ -183,8 +178,6 @@ void TType::buildMangledName(TString& mangledName) const } } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - // // Dump functions. // @@ -263,8 +256,6 @@ void TSymbolTable::dump(TInfoSink& infoSink, bool complete) const } } -#endif - // // Functions have buried pointers to delete. // @@ -381,7 +372,7 @@ TVariable* TVariable::clone() const TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf) { for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) { - TParameter param; + TParameter param{}; parameters.push_back(param); (void)parameters.back().copyParam(copyOf.parameters[i]); } @@ -397,9 +388,7 @@ TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf) implicitThis = copyOf.implicitThis; illegalImplicitThis = copyOf.illegalImplicitThis; defaultParamCount = copyOf.defaultParamCount; -#ifndef GLSLANG_WEB spirvInst = copyOf.spirvInst; -#endif } TFunction* TFunction::clone() const @@ -416,7 +405,7 @@ TAnonMember* TAnonMember::clone() const // copy of the original container. assert(0); - return 0; + return nullptr; } TSymbolTableLevel* TSymbolTableLevel::clone() const diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h b/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h index 2e570bb3..fc86ad62 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h @@ -84,7 +84,7 @@ typedef TVector TExtensionList; class TSymbol { public: POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(0), writable(true) { } + explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(nullptr), writable(true) { } virtual TSymbol* clone() const = 0; virtual ~TSymbol() { } // rely on all symbol owned memory coming from the pool @@ -97,18 +97,18 @@ class TSymbol { changeName(NewPoolTString(newName.c_str())); } virtual const TString& getMangledName() const { return getName(); } - virtual TFunction* getAsFunction() { return 0; } - virtual const TFunction* getAsFunction() const { return 0; } - virtual TVariable* getAsVariable() { return 0; } - virtual const TVariable* getAsVariable() const { return 0; } - virtual const TAnonMember* getAsAnonMember() const { return 0; } + virtual TFunction* getAsFunction() { return nullptr; } + virtual const TFunction* getAsFunction() const { return nullptr; } + virtual TVariable* getAsVariable() { return nullptr; } + virtual const TVariable* getAsVariable() const { return nullptr; } + virtual const TAnonMember* getAsAnonMember() const { return nullptr; } virtual const TType& getType() const = 0; virtual TType& getWritableType() = 0; virtual void setUniqueId(long long id) { uniqueId = id; } virtual long long getUniqueId() const { return uniqueId; } virtual void setExtensions(int numExts, const char* const exts[]) { - assert(extensions == 0); + assert(extensions == nullptr); assert(numExts > 0); extensions = NewPoolObject(extensions); for (int e = 0; e < numExts; ++e) @@ -117,10 +117,8 @@ class TSymbol { virtual int getNumExtensions() const { return extensions == nullptr ? 0 : (int)extensions->size(); } virtual const char** getExtensions() const { return extensions->data(); } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) virtual void dump(TInfoSink& infoSink, bool complete = false) const = 0; void dumpExtensions(TInfoSink& infoSink) const; -#endif virtual bool isReadOnly() const { return ! writable; } virtual void makeReadOnly() { writable = false; } @@ -196,9 +194,7 @@ class TVariable : public TSymbol { } virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) virtual void dump(TInfoSink& infoSink, bool complete = false) const; -#endif protected: explicit TVariable(const TVariable&); @@ -229,7 +225,7 @@ struct TParameter { if (param.name) name = NewPoolTString(param.name->c_str()); else - name = 0; + name = nullptr; type = param.type->clone(); defaultValue = param.defaultValue; return *this; @@ -243,7 +239,7 @@ struct TParameter { class TFunction : public TSymbol { public: explicit TFunction(TOperator o) : - TSymbol(0), + TSymbol(nullptr), op(o), defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0) { } TFunction(const TString *name, const TType& retType, TOperator tOp = EOpNull) : @@ -319,19 +315,16 @@ class TFunction : public TSymbol { virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; } virtual const TParameter& operator[](int i) const { return parameters[i]; } + const TQualifier& getQualifier() const { return returnType.getQualifier(); } -#ifndef GLSLANG_WEB virtual void setSpirvInstruction(const TSpirvInstruction& inst) { relateToOperator(EOpSpirvInst); spirvInst = inst; } virtual const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; } -#endif -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) virtual void dump(TInfoSink& infoSink, bool complete = false) const override; -#endif protected: explicit TFunction(const TFunction&); @@ -353,9 +346,7 @@ class TFunction : public TSymbol { // but is not allowed to use them, or see hidden symbols instead. int defaultParamCount; -#ifndef GLSLANG_WEB TSpirvInstruction spirvInst; // SPIR-V instruction qualifiers -#endif }; // @@ -395,9 +386,7 @@ class TAnonMember : public TSymbol { virtual const char** getExtensions() const override { return anonContainer.getMemberExtensions(memberNumber); } virtual int getAnonId() const { return anonId; } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) virtual void dump(TInfoSink& infoSink, bool complete = false) const override; -#endif protected: explicit TAnonMember(const TAnonMember&); @@ -411,7 +400,7 @@ class TAnonMember : public TSymbol { class TSymbolTableLevel { public: POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - TSymbolTableLevel() : defaultPrecision(0), anonId(0), thisLevel(false) { } + TSymbolTableLevel() : defaultPrecision(nullptr), anonId(0), thisLevel(false) { } ~TSymbolTableLevel(); bool insert(const TString& name, TSymbol* symbol) { @@ -493,7 +482,7 @@ class TSymbolTableLevel { { tLevel::const_iterator it = level.find(name); if (it == level.end()) - return 0; + return nullptr; else return (*it).second; } @@ -561,7 +550,7 @@ class TSymbolTableLevel { { // can call multiple times at one scope, will only latch on first call, // as we're tracking the previous scope's values, not the current values - if (defaultPrecision != 0) + if (defaultPrecision != nullptr) return; defaultPrecision = new TPrecisionQualifier[EbtNumTypes]; @@ -573,7 +562,7 @@ class TSymbolTableLevel { { // can be called for table level pops that didn't set the // defaults - if (defaultPrecision == 0 || p == 0) + if (defaultPrecision == nullptr || p == nullptr) return; for (int t = 0; t < EbtNumTypes; ++t) @@ -582,9 +571,7 @@ class TSymbolTableLevel { void relateToOperator(const char* name, TOperator op); void setFunctionExtensions(const char* name, int num, const char* const extensions[]); -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) void dump(TInfoSink& infoSink, bool complete = false) const; -#endif TSymbolTableLevel* clone() const; void readOnly(); @@ -622,7 +609,7 @@ class TSymbolTable { // don't deallocate levels passed in from elsewhere while (table.size() > adoptedLevels) - pop(0); + pop(nullptr); } void adoptLevels(TSymbolTable& symTable) @@ -783,7 +770,7 @@ class TSymbolTable { // Normal find of a symbol, that can optionally say whether the symbol was found // at a built-in level or the current top-scope level. - TSymbol* find(const TString& name, bool* builtIn = 0, bool* currentScope = 0, int* thisDepthP = 0) + TSymbol* find(const TString& name, bool* builtIn = nullptr, bool* currentScope = nullptr, int* thisDepthP = nullptr) { int level = currentLevel(); TSymbol* symbol; @@ -827,7 +814,7 @@ class TSymbolTable { ++thisDepth; symbol = table[level]->find(name); --level; - } while (symbol == 0 && level >= 0); + } while (symbol == nullptr && level >= 0); if (! table[level + 1]->isThisLevel()) thisDepth = 0; @@ -912,9 +899,7 @@ class TSymbolTable { } long long getMaxSymbolId() { return uniqueId; } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) void dump(TInfoSink& infoSink, bool complete = false) const; -#endif void copyTable(const TSymbolTable& copyOf); void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); } diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp index 226e9467..38cbf3e1 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp @@ -151,8 +151,6 @@ namespace glslang { -#ifndef GLSLANG_WEB - // // Initialize all extensions, almost always to 'disable', as once their features // are incorporated into a core version, their features are supported through allowing that @@ -227,6 +225,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_texture_query_lod] = EBhDisable; extensionBehavior[E_GL_ARB_vertex_attrib_64bit] = EBhDisable; extensionBehavior[E_GL_ARB_draw_instanced] = EBhDisable; + extensionBehavior[E_GL_ARB_bindless_texture] = EBhDisable; extensionBehavior[E_GL_ARB_fragment_coord_conventions] = EBhDisable; @@ -262,6 +261,8 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_fragment_shader_barycentric] = EBhDisable; + extensionBehavior[E_GL_KHR_cooperative_matrix] = EBhDisable; + // #line and #include extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable; extensionBehavior[E_GL_GOOGLE_include_directive] = EBhDisable; @@ -301,6 +302,14 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_NV_shader_sm_builtins] = EBhDisable; extensionBehavior[E_GL_NV_integer_cooperative_matrix] = EBhDisable; + extensionBehavior[E_GL_NV_shader_invocation_reorder] = EBhDisable; + + // ARM + extensionBehavior[E_GL_ARM_shader_core_builtins] = EBhDisable; + + // QCOM + extensionBehavior[E_GL_QCOM_image_processing] = EBhDisable; + // AEP extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisable; extensionBehavior[E_GL_KHR_blend_equation_advanced] = EBhDisable; @@ -342,11 +351,14 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_blend_func_extended] = EBhDisable; extensionBehavior[E_GL_EXT_shader_implicit_conversions] = EBhDisable; extensionBehavior[E_GL_EXT_fragment_shading_rate] = EBhDisable; - extensionBehavior[E_GL_EXT_shader_image_int64] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_image_int64] = EBhDisable; extensionBehavior[E_GL_EXT_terminate_invocation] = EBhDisable; extensionBehavior[E_GL_EXT_shared_memory_block] = EBhDisable; extensionBehavior[E_GL_EXT_spirv_intrinsics] = EBhDisable; extensionBehavior[E_GL_EXT_mesh_shader] = EBhDisable; + extensionBehavior[E_GL_EXT_opacity_micromap] = EBhDisable; + extensionBehavior[E_GL_EXT_ray_tracing_position_fetch] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_tile_image] = EBhDisable; // OVR extensions extensionBehavior[E_GL_OVR_multiview] = EBhDisable; @@ -369,9 +381,10 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_float16] = EBhDisable; extensionBehavior[E_GL_EXT_shader_atomic_float] = EBhDisable; extensionBehavior[E_GL_EXT_shader_atomic_float2] = EBhDisable; -} -#endif // GLSLANG_WEB + // Record extensions not for spv. + spvUnsupportedExt.push_back(E_GL_ARB_bindless_texture); +} // Get code that is not part of a shared symbol table, is specific to this shader, // or needed by the preprocessor (which does not use a shared symbol table). @@ -381,9 +394,6 @@ void TParseVersions::getPreamble(std::string& preamble) preamble = "#define GL_ES 1\n" "#define GL_FRAGMENT_PRECISION_HIGH 1\n" -#ifdef GLSLANG_WEB - ; -#else "#define GL_OES_texture_3D 1\n" "#define GL_OES_standard_derivatives 1\n" "#define GL_EXT_frag_depth 1\n" @@ -424,6 +434,8 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_OES_texture_buffer 1\n" "#define GL_OES_texture_cube_map_array 1\n" "#define GL_EXT_shader_non_constant_global_initializers 1\n" + + "#define GL_QCOM_image_processing 1\n" ; if (version >= 300) { @@ -436,7 +448,6 @@ void TParseVersions::getPreamble(std::string& preamble) } else { // !isEsProfile() preamble = - "#define GL_FRAGMENT_PRECISION_HIGH 1\n" "#define GL_ARB_texture_rectangle 1\n" "#define GL_ARB_shading_language_420pack 1\n" "#define GL_ARB_texture_gather 1\n" @@ -476,6 +487,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_ARB_vertex_attrib_64bit 1\n" "#define GL_ARB_draw_instanced 1\n" "#define GL_ARB_fragment_coord_conventions 1\n" + "#define GL_ARB_bindless_texture 1\n" "#define GL_EXT_shader_non_constant_global_initializers 1\n" "#define GL_EXT_shader_image_load_formatted 1\n" "#define GL_EXT_post_depth_coverage 1\n" @@ -505,6 +517,8 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_KHR_shader_subgroup_clustered 1\n" "#define GL_KHR_shader_subgroup_quad 1\n" + "#define GL_KHR_cooperative_matrix 1\n" + "#define GL_EXT_shader_image_int64 1\n" "#define GL_EXT_shader_atomic_int64 1\n" "#define GL_EXT_shader_realtime_clock 1\n" @@ -512,6 +526,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_EXT_ray_query 1\n" "#define GL_EXT_ray_flags_primitive_culling 1\n" "#define GL_EXT_ray_cull_mask 1\n" + "#define GL_EXT_ray_tracing_position_fetch 1\n" "#define GL_EXT_spirv_intrinsics 1\n" "#define GL_EXT_mesh_shader 1\n" @@ -543,6 +558,9 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_NV_mesh_shader 1\n" "#define GL_NV_cooperative_matrix 1\n" "#define GL_NV_integer_cooperative_matrix 1\n" + "#define GL_NV_shader_invocation_reorder 1\n" + + "#define GL_QCOM_image_processing 1\n" "#define GL_EXT_shader_explicit_arithmetic_types 1\n" "#define GL_EXT_shader_explicit_arithmetic_types_int8 1\n" @@ -575,10 +593,11 @@ void TParseVersions::getPreamble(std::string& preamble) preamble += "#define GL_EXT_null_initializer 1\n"; preamble += "#define GL_EXT_subgroup_uniform_control_flow 1\n"; } -#endif // GLSLANG_WEB + if (version >= 130) { + preamble +="#define GL_FRAGMENT_PRECISION_HIGH 1\n"; + } } -#ifndef GLSLANG_WEB if ((!isEsProfile() && version >= 140) || (isEsProfile() && version >= 310)) { preamble += @@ -606,7 +625,6 @@ void TParseVersions::getPreamble(std::string& preamble) preamble += "#define GL_EXT_terminate_invocation 1\n" ; -#endif // #define VULKAN XXXX const int numberBufSize = 12; @@ -618,7 +636,6 @@ void TParseVersions::getPreamble(std::string& preamble) preamble += "\n"; } -#ifndef GLSLANG_WEB // #define GL_SPIRV XXXX if (spvVersion.openGl > 0) { preamble += "#define GL_SPIRV "; @@ -626,9 +643,7 @@ void TParseVersions::getPreamble(std::string& preamble) preamble += numberBuf; preamble += "\n"; } -#endif -#ifndef GLSLANG_WEB // GL_EXT_spirv_intrinsics if (!isEsProfile()) { switch (language) { @@ -649,7 +664,6 @@ void TParseVersions::getPreamble(std::string& preamble) default: break; } } -#endif } // @@ -661,7 +675,6 @@ const char* StageName(EShLanguage stage) case EShLangVertex: return "vertex"; case EShLangFragment: return "fragment"; case EShLangCompute: return "compute"; -#ifndef GLSLANG_WEB case EShLangTessControl: return "tessellation control"; case EShLangTessEvaluation: return "tessellation evaluation"; case EShLangGeometry: return "geometry"; @@ -673,7 +686,6 @@ const char* StageName(EShLanguage stage) case EShLangCallable: return "callable"; case EShLangMesh: return "mesh"; case EShLangTask: return "task"; -#endif default: return "unknown stage"; } } @@ -698,7 +710,6 @@ void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguage stage, cons requireStage(loc, static_cast(1 << stage), featureDesc); } -#ifndef GLSLANG_WEB // // When to use requireProfile(): // @@ -736,7 +747,6 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int { if (profile & profileMask) { bool okay = minVersion > 0 && version >= minVersion; -#ifndef GLSLANG_WEB for (int i = 0; i < numExtensions; ++i) { switch (getExtensionBehavior(extensions[i])) { case EBhWarn: @@ -749,7 +759,6 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int default: break; // some compilers want this } } -#endif if (! okay) error(loc, "not supported for this version or the enabled extensions", featureDesc, ""); } @@ -1065,8 +1074,8 @@ void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * con if (strcmp(extension, "GL_NV_mesh_shader") == 0) { requireStage(loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask | EShLangFragmentMask), "#extension GL_NV_mesh_shader"); - profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_NV_mesh_shader"); - profileRequires(loc, EEsProfile, 320, 0, "#extension GL_NV_mesh_shader"); + profileRequires(loc, ECoreProfile, 450, nullptr, "#extension GL_NV_mesh_shader"); + profileRequires(loc, EEsProfile, 320, nullptr, "#extension GL_NV_mesh_shader"); if (extensionTurnedOn(E_GL_EXT_mesh_shader)) { error(loc, "GL_EXT_mesh_shader is already turned on, and not allowed with", "#extension", extension); } @@ -1074,8 +1083,8 @@ void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * con else if (strcmp(extension, "GL_EXT_mesh_shader") == 0) { requireStage(loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask | EShLangFragmentMask), "#extension GL_EXT_mesh_shader"); - profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_EXT_mesh_shader"); - profileRequires(loc, EEsProfile, 320, 0, "#extension GL_EXT_mesh_shader"); + profileRequires(loc, ECoreProfile, 450, nullptr, "#extension GL_EXT_mesh_shader"); + profileRequires(loc, EEsProfile, 320, nullptr, "#extension GL_EXT_mesh_shader"); if (extensionTurnedOn(E_GL_NV_mesh_shader)) { error(loc, "GL_NV_mesh_shader is already turned on, and not allowed with", "#extension", extension); } @@ -1098,6 +1107,13 @@ void TParseVersions::extensionRequires(const TSourceLoc &loc, const char * const minSpvVersion = iter->second; requireSpv(loc, extension, minSpvVersion); } + + if (spvVersion.spv != 0){ + for (auto ext : spvUnsupportedExt){ + if (strcmp(extension, ext.c_str()) == 0) + error(loc, "not allowed when using generating SPIR-V codes", extension, ""); + } + } } // Call for any operation needing full GLSL integer data-type support. @@ -1310,7 +1326,7 @@ void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool buil } } -void TParseVersions::fcoopmatCheck(const TSourceLoc& loc, const char* op, bool builtIn) +void TParseVersions::fcoopmatCheckNV(const TSourceLoc& loc, const char* op, bool builtIn) { if (!builtIn) { const char* const extensions[] = {E_GL_NV_cooperative_matrix}; @@ -1318,14 +1334,22 @@ void TParseVersions::fcoopmatCheck(const TSourceLoc& loc, const char* op, bool b } } -void TParseVersions::intcoopmatCheck(const TSourceLoc& loc, const char* op, bool builtIn) +void TParseVersions::intcoopmatCheckNV(const TSourceLoc& loc, const char* op, bool builtIn) { if (!builtIn) { const char* const extensions[] = {E_GL_NV_integer_cooperative_matrix}; requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); } } -#endif // GLSLANG_WEB + +void TParseVersions::coopmatCheck(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); + } +} + // Call for any operation removed because SPIR-V is in use. void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op) { @@ -1343,26 +1367,20 @@ void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op) // Call for any operation that requires Vulkan. void TParseVersions::requireVulkan(const TSourceLoc& loc, const char* op) { -#ifndef GLSLANG_WEB if (spvVersion.vulkan == 0) error(loc, "only allowed when using GLSL for Vulkan", op, ""); -#endif } // Call for any operation that requires SPIR-V. void TParseVersions::requireSpv(const TSourceLoc& loc, const char* op) { -#ifndef GLSLANG_WEB if (spvVersion.spv == 0) error(loc, "only allowed when generating SPIR-V", op, ""); -#endif } void TParseVersions::requireSpv(const TSourceLoc& loc, const char *op, unsigned int version) { -#ifndef GLSLANG_WEB if (spvVersion.spv < version) error(loc, "not supported for current targeted SPIR-V version", op, ""); -#endif } } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.h b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.h old mode 100644 new mode 100755 index 6ab37880..564995b2 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.h +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.h @@ -163,6 +163,7 @@ const char* const E_GL_ARB_texture_query_lod = "GL_ARB_texture_query_ const char* const E_GL_ARB_vertex_attrib_64bit = "GL_ARB_vertex_attrib_64bit"; 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_KHR_shader_subgroup_basic = "GL_KHR_shader_subgroup_basic"; const char* const E_GL_KHR_shader_subgroup_vote = "GL_KHR_shader_subgroup_vote"; @@ -173,6 +174,7 @@ const char* const E_GL_KHR_shader_subgroup_shuffle_relative = "GL_KHR_shader_sub const char* const E_GL_KHR_shader_subgroup_clustered = "GL_KHR_shader_subgroup_clustered"; const char* const E_GL_KHR_shader_subgroup_quad = "GL_KHR_shader_subgroup_quad"; const char* const E_GL_KHR_memory_scope_semantics = "GL_KHR_memory_scope_semantics"; +const char* const E_GL_KHR_cooperative_matrix = "GL_KHR_cooperative_matrix"; const char* const E_GL_EXT_shader_atomic_int64 = "GL_EXT_shader_atomic_int64"; @@ -212,6 +214,7 @@ const char* const E_GL_EXT_subgroup_uniform_control_flow = "GL_EXT_subgroup_u const char* const E_GL_EXT_spirv_intrinsics = "GL_EXT_spirv_intrinsics"; const char* const E_GL_EXT_fragment_shader_barycentric = "GL_EXT_fragment_shader_barycentric"; const char* const E_GL_EXT_mesh_shader = "GL_EXT_mesh_shader"; +const char* const E_GL_EXT_opacity_micromap = "GL_EXT_opacity_micromap"; // Arrays of extensions for the above viewportEXTs duplications @@ -263,6 +266,10 @@ const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragmen 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"; +const char* const E_GL_EXT_ray_tracing_position_fetch = "GL_EXT_ray_tracing_position_fetch"; + +// ARM +const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins"; // Arrays of extensions for the above viewportEXTs duplications @@ -272,6 +279,9 @@ const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]); const char* const E_GL_NV_cooperative_matrix = "GL_NV_cooperative_matrix"; const char* const E_GL_NV_shader_sm_builtins = "GL_NV_shader_sm_builtins"; const char* const E_GL_NV_integer_cooperative_matrix = "GL_NV_integer_cooperative_matrix"; +const char* const E_GL_NV_shader_invocation_reorder = "GL_NV_shader_invocation_reorder"; + +const char* const E_GL_QCOM_image_processing = "GL_QCOM_image_processing"; // AEP const char* const E_GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a"; @@ -321,6 +331,8 @@ const char* const E_GL_EXT_terminate_invocation = "GL_EXT_terminate_invocation"; const char* const E_GL_EXT_shader_atomic_float = "GL_EXT_shader_atomic_float"; const char* const E_GL_EXT_shader_atomic_float2 = "GL_EXT_shader_atomic_float2"; +const char* const E_GL_EXT_shader_tile_image = "GL_EXT_shader_tile_image"; + // Arrays of extensions for the above AEP duplications const char* const AEP_geometry_shader[] = { E_GL_EXT_geometry_shader, E_GL_OES_geometry_shader }; diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/attribute.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/attribute.cpp index df7fdc2a..21ef7368 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/attribute.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/attribute.cpp @@ -34,8 +34,6 @@ // POSSIBILITY OF SUCH DAMAGE. // -#ifndef GLSLANG_WEB - #include "attribute.h" #include "../Include/intermediate.h" #include "ParseHelper.h" @@ -367,5 +365,3 @@ void TParseContext::handleFunctionAttributes(const TSourceLoc& loc, const TAttri } } // end namespace glslang - -#endif // GLSLANG_WEB diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.m4 b/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.m4 deleted file mode 100644 index a59da443..00000000 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.m4 +++ /dev/null @@ -1,4422 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// Copyright (C) 2017 ARM Limited. -// Copyright (C) 2015-2019 Google, Inc. -// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. -// -// 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. -// - -// -// Do not edit the .y file, only edit the .m4 file. -// The .y bison file is not a source file, it is a derivative of the .m4 file. -// The m4 file needs to be processed by m4 to generate the .y bison file. -// -// Code sandwiched between a pair: -// -// GLSLANG_WEB_EXCLUDE_ON -// ... -// ... -// ... -// GLSLANG_WEB_EXCLUDE_OFF -// -// Will be excluded from the grammar when m4 is executed as: -// -// m4 -P -DGLSLANG_WEB -// -// It will be included when m4 is executed as: -// -// m4 -P -// - -m4_define(`GLSLANG_WEB_EXCLUDE_ON', `m4_ifdef(`GLSLANG_WEB', `m4_divert(`-1')')') -m4_define(`GLSLANG_WEB_EXCLUDE_OFF', `m4_ifdef(`GLSLANG_WEB', `m4_divert')') - -/** - * This is bison grammar and productions for parsing all versions of the - * GLSL shading languages. - */ -%{ - -/* Based on: -ANSI C Yacc grammar - -In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a -matching Lex specification) for the April 30, 1985 draft version of the -ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that -original, as mentioned in the answer to question 17.25 of the comp.lang.c -FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z. - -I intend to keep this version as close to the current C Standard grammar as -possible; please let me know if you discover discrepancies. - -Jutta Degener, 1995 -*/ - -#include "SymbolTable.h" -#include "ParseHelper.h" -#include "../Public/ShaderLang.h" -#include "attribute.h" - -using namespace glslang; - -%} - -%define parse.error verbose - -%union { - struct { - glslang::TSourceLoc loc; - union { - glslang::TString *string; - int i; - unsigned int u; - long long i64; - unsigned long long u64; - bool b; - double d; - }; - glslang::TSymbol* symbol; - } lex; - struct { - glslang::TSourceLoc loc; - glslang::TOperator op; - union { - TIntermNode* intermNode; - glslang::TIntermNodePair nodePair; - glslang::TIntermTyped* intermTypedNode; - glslang::TAttributes* attributes; - glslang::TSpirvRequirement* spirvReq; - glslang::TSpirvInstruction* spirvInst; - glslang::TSpirvTypeParameters* spirvTypeParams; - }; - union { - glslang::TPublicType type; - glslang::TFunction* function; - glslang::TParameter param; - glslang::TTypeLoc typeLine; - glslang::TTypeList* typeList; - glslang::TArraySizes* arraySizes; - glslang::TIdentifierList* identifierList; - }; - glslang::TArraySizes* typeParameters; - } interm; -} - -%{ - -/* windows only pragma */ -#ifdef _MSC_VER - #pragma warning(disable : 4065) - #pragma warning(disable : 4127) - #pragma warning(disable : 4244) -#endif - -#define parseContext (*pParseContext) -#define yyerror(context, msg) context->parserError(msg) - -extern int yylex(YYSTYPE*, TParseContext&); - -%} - -%parse-param {glslang::TParseContext* pParseContext} -%lex-param {parseContext} -%pure-parser // enable thread safety -%expect 1 // One shift reduce conflict because of if | else - -%token CONST BOOL INT UINT FLOAT -%token BVEC2 BVEC3 BVEC4 -%token IVEC2 IVEC3 IVEC4 -%token UVEC2 UVEC3 UVEC4 -%token VEC2 VEC3 VEC4 -%token MAT2 MAT3 MAT4 -%token MAT2X2 MAT2X3 MAT2X4 -%token MAT3X2 MAT3X3 MAT3X4 -%token MAT4X2 MAT4X3 MAT4X4 - -// combined image/sampler -%token SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER2DSHADOW -%token SAMPLERCUBESHADOW SAMPLER2DARRAY -%token SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE -%token ISAMPLER2DARRAY USAMPLER2D USAMPLER3D -%token USAMPLERCUBE USAMPLER2DARRAY - -// separate image/sampler -%token SAMPLER SAMPLERSHADOW -%token TEXTURE2D TEXTURE3D TEXTURECUBE TEXTURE2DARRAY -%token ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY -%token UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY - -GLSLANG_WEB_EXCLUDE_ON - -%token ATTRIBUTE VARYING -%token FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T -%token INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T -%token I64VEC2 I64VEC3 I64VEC4 -%token U64VEC2 U64VEC3 U64VEC4 -%token I32VEC2 I32VEC3 I32VEC4 -%token U32VEC2 U32VEC3 U32VEC4 -%token I16VEC2 I16VEC3 I16VEC4 -%token U16VEC2 U16VEC3 U16VEC4 -%token I8VEC2 I8VEC3 I8VEC4 -%token U8VEC2 U8VEC3 U8VEC4 -%token DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4 -%token F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4 -%token F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4 -%token F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4 -%token DMAT2X2 DMAT2X3 DMAT2X4 -%token DMAT3X2 DMAT3X3 DMAT3X4 -%token DMAT4X2 DMAT4X3 DMAT4X4 -%token F16MAT2X2 F16MAT2X3 F16MAT2X4 -%token F16MAT3X2 F16MAT3X3 F16MAT3X4 -%token F16MAT4X2 F16MAT4X3 F16MAT4X4 -%token F32MAT2X2 F32MAT2X3 F32MAT2X4 -%token F32MAT3X2 F32MAT3X3 F32MAT3X4 -%token F32MAT4X2 F32MAT4X3 F32MAT4X4 -%token F64MAT2X2 F64MAT2X3 F64MAT2X4 -%token F64MAT3X2 F64MAT3X3 F64MAT3X4 -%token F64MAT4X2 F64MAT4X3 F64MAT4X4 -%token ATOMIC_UINT -%token ACCSTRUCTNV -%token ACCSTRUCTEXT -%token RAYQUERYEXT -%token FCOOPMATNV ICOOPMATNV UCOOPMATNV - -// combined image/sampler -%token SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW -%token ISAMPLERCUBEARRAY USAMPLERCUBEARRAY -%token SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW -%token SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT -%token SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER -%token SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS -%token SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY -%token SAMPLEREXTERNALOES -%token SAMPLEREXTERNAL2DY2YEXT -%token ISAMPLER1DARRAY USAMPLER1D USAMPLER1DARRAY -%token F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE -%token F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY -%token F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY -%token F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW -%token F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW - -// images -%token IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D -%token UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D -%token IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT -%token IMAGECUBE IIMAGECUBE UIMAGECUBE -%token IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER -%token IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY -%token IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY -%token IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY -%token IMAGE2DMS IIMAGE2DMS UIMAGE2DMS -%token IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY - -%token F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT -%token F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY -%token F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY - -%token I64IMAGE1D U64IMAGE1D -%token I64IMAGE2D U64IMAGE2D -%token I64IMAGE3D U64IMAGE3D -%token I64IMAGE2DRECT U64IMAGE2DRECT -%token I64IMAGECUBE U64IMAGECUBE -%token I64IMAGEBUFFER U64IMAGEBUFFER -%token I64IMAGE1DARRAY U64IMAGE1DARRAY -%token I64IMAGE2DARRAY U64IMAGE2DARRAY -%token I64IMAGECUBEARRAY U64IMAGECUBEARRAY -%token I64IMAGE2DMS U64IMAGE2DMS -%token I64IMAGE2DMSARRAY U64IMAGE2DMSARRAY - -// texture without sampler -%token TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY -%token TEXTURE1D ITEXTURE1D UTEXTURE1D -%token TEXTURE1DARRAY ITEXTURE1DARRAY UTEXTURE1DARRAY -%token TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT -%token TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER -%token TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS -%token TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY - -%token F16TEXTURE1D F16TEXTURE2D F16TEXTURE3D F16TEXTURE2DRECT F16TEXTURECUBE -%token F16TEXTURE1DARRAY F16TEXTURE2DARRAY F16TEXTURECUBEARRAY -%token F16TEXTUREBUFFER F16TEXTURE2DMS F16TEXTURE2DMSARRAY - -// input attachments -%token SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS -%token F16SUBPASSINPUT F16SUBPASSINPUTMS - -// spirv intrinsics -%token SPIRV_INSTRUCTION SPIRV_EXECUTION_MODE SPIRV_EXECUTION_MODE_ID -%token SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING -%token SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL - -GLSLANG_WEB_EXCLUDE_OFF - -%token LEFT_OP RIGHT_OP -%token INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP -%token AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN -%token MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN -%token SUB_ASSIGN -%token STRING_LITERAL - -%token LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT -%token COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT -%token LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION - -%token INVARIANT -%token HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION -%token PACKED RESOURCE SUPERP - -%token FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT -%token IDENTIFIER TYPE_NAME -%token CENTROID IN OUT INOUT -%token STRUCT VOID WHILE -%token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT -%token TERMINATE_INVOCATION -%token TERMINATE_RAY IGNORE_INTERSECTION -%token UNIFORM SHARED BUFFER -%token FLAT SMOOTH LAYOUT - -GLSLANG_WEB_EXCLUDE_ON -%token DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT -%token INT64CONSTANT UINT64CONSTANT -%token SUBROUTINE DEMOTE -%token PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV -%token PAYLOADEXT PAYLOADINEXT HITATTREXT CALLDATAEXT CALLDATAINEXT -%token PATCH SAMPLE NONUNIFORM -%token COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT -%token SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT -%token NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV PERPRIMITIVEEXT TASKPAYLOADWORKGROUPEXT -%token PRECISE -GLSLANG_WEB_EXCLUDE_OFF - -%type assignment_operator unary_operator -%type variable_identifier primary_expression postfix_expression -%type expression integer_expression assignment_expression -%type unary_expression multiplicative_expression additive_expression -%type relational_expression equality_expression -%type conditional_expression constant_expression -%type logical_or_expression logical_xor_expression logical_and_expression -%type shift_expression and_expression exclusive_or_expression inclusive_or_expression -%type function_call initializer condition conditionopt - -%type translation_unit function_definition -%type statement simple_statement -%type statement_list switch_statement_list compound_statement -%type declaration_statement selection_statement selection_statement_nonattributed expression_statement -%type switch_statement switch_statement_nonattributed case_label -%type declaration external_declaration -%type for_init_statement compound_statement_no_new_scope -%type selection_rest_statement for_rest_statement -%type iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped -%type single_declaration init_declarator_list - -%type parameter_declaration parameter_declarator parameter_type_specifier - -%type array_specifier -%type invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier -%type layout_qualifier layout_qualifier_id_list layout_qualifier_id - -%type type_parameter_specifier -%type type_parameter_specifier_opt -%type type_parameter_specifier_list - -%type type_qualifier fully_specified_type type_specifier -%type single_type_qualifier -%type type_specifier_nonarray -%type struct_specifier -%type struct_declarator -%type struct_declarator_list struct_declaration struct_declaration_list -%type block_structure -%type function_header function_declarator -%type function_header_with_parameters -%type function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype -%type function_call_or_method function_identifier function_call_header - -%type identifier_list - -GLSLANG_WEB_EXCLUDE_ON -%type precise_qualifier non_uniform_qualifier -%type type_name_list -%type attribute attribute_list single_attribute -%type demote_statement -%type initializer_list -%type spirv_requirements_list spirv_requirements_parameter -%type spirv_extension_list spirv_capability_list -%type spirv_execution_mode_qualifier -%type spirv_execution_mode_parameter_list spirv_execution_mode_parameter spirv_execution_mode_id_parameter_list -%type spirv_storage_class_qualifier -%type spirv_decorate_qualifier -%type spirv_decorate_parameter_list spirv_decorate_parameter -%type spirv_decorate_id_parameter_list -%type spirv_decorate_string_parameter_list -%type spirv_type_specifier -%type spirv_type_parameter_list spirv_type_parameter -%type spirv_instruction_qualifier -%type spirv_instruction_qualifier_list spirv_instruction_qualifier_id -GLSLANG_WEB_EXCLUDE_OFF - -%start translation_unit -%% - -variable_identifier - : IDENTIFIER { - $$ = parseContext.handleVariable($1.loc, $1.symbol, $1.string); - } - ; - -primary_expression - : variable_identifier { - $$ = $1; - } - | LEFT_PAREN expression RIGHT_PAREN { - $$ = $2; - if ($$->getAsConstantUnion()) - $$->getAsConstantUnion()->setExpression(); - } - | FLOATCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true); - } - | INTCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); - } - | UINTCONSTANT { - parseContext.fullIntegerCheck($1.loc, "unsigned literal"); - $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); - } - | BOOLCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); - } -GLSLANG_WEB_EXCLUDE_ON - | STRING_LITERAL { - $$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true); - } - | INT32CONSTANT { - parseContext.explicitInt32Check($1.loc, "32-bit signed literal"); - $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); - } - | UINT32CONSTANT { - parseContext.explicitInt32Check($1.loc, "32-bit signed literal"); - $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); - } - | INT64CONSTANT { - parseContext.int64Check($1.loc, "64-bit integer literal"); - $$ = parseContext.intermediate.addConstantUnion($1.i64, $1.loc, true); - } - | UINT64CONSTANT { - parseContext.int64Check($1.loc, "64-bit unsigned integer literal"); - $$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true); - } - | INT16CONSTANT { - parseContext.explicitInt16Check($1.loc, "16-bit integer literal"); - $$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true); - } - | UINT16CONSTANT { - parseContext.explicitInt16Check($1.loc, "16-bit unsigned integer literal"); - $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true); - } - | DOUBLECONSTANT { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double literal"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double literal"); - $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true); - } - | FLOAT16CONSTANT { - parseContext.float16Check($1.loc, "half float literal"); - $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true); - } -GLSLANG_WEB_EXCLUDE_OFF - ; - -postfix_expression - : primary_expression { - $$ = $1; - } - | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET { - $$ = parseContext.handleBracketDereference($2.loc, $1, $3); - } - | function_call { - $$ = $1; - } - | postfix_expression DOT IDENTIFIER { - $$ = parseContext.handleDotDereference($3.loc, $1, *$3.string); - } - | postfix_expression INC_OP { - parseContext.variableCheck($1); - parseContext.lValueErrorCheck($2.loc, "++", $1); - $$ = parseContext.handleUnaryMath($2.loc, "++", EOpPostIncrement, $1); - } - | postfix_expression DEC_OP { - parseContext.variableCheck($1); - parseContext.lValueErrorCheck($2.loc, "--", $1); - $$ = parseContext.handleUnaryMath($2.loc, "--", EOpPostDecrement, $1); - } - ; - -integer_expression - : expression { - parseContext.integerCheck($1, "[]"); - $$ = $1; - } - ; - -function_call - : function_call_or_method { - $$ = parseContext.handleFunctionCall($1.loc, $1.function, $1.intermNode); - delete $1.function; - } - ; - -function_call_or_method - : function_call_generic { - $$ = $1; - } - ; - -function_call_generic - : function_call_header_with_parameters RIGHT_PAREN { - $$ = $1; - $$.loc = $2.loc; - } - | function_call_header_no_parameters RIGHT_PAREN { - $$ = $1; - $$.loc = $2.loc; - } - ; - -function_call_header_no_parameters - : function_call_header VOID { - $$ = $1; - } - | function_call_header { - $$ = $1; - } - ; - -function_call_header_with_parameters - : function_call_header assignment_expression { - TParameter param = { 0, new TType }; - param.type->shallowCopy($2->getType()); - $1.function->addParameter(param); - $$.function = $1.function; - $$.intermNode = $2; - } - | function_call_header_with_parameters COMMA assignment_expression { - TParameter param = { 0, new TType }; - param.type->shallowCopy($3->getType()); - $1.function->addParameter(param); - $$.function = $1.function; - $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.loc); - } - ; - -function_call_header - : function_identifier LEFT_PAREN { - $$ = $1; - } - ; - -// Grammar Note: Constructors look like functions, but are recognized as types. - -function_identifier - : type_specifier { - // Constructor - $$.intermNode = 0; - $$.function = parseContext.handleConstructorCall($1.loc, $1); - } - | postfix_expression { - // - // Should be a method or subroutine call, but we haven't recognized the arguments yet. - // - $$.function = 0; - $$.intermNode = 0; - - TIntermMethod* method = $1->getAsMethodNode(); - if (method) { - $$.function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength); - $$.intermNode = method->getObject(); - } else { - TIntermSymbol* symbol = $1->getAsSymbolNode(); - if (symbol) { - parseContext.reservedErrorCheck(symbol->getLoc(), symbol->getName()); - TFunction *function = new TFunction(&symbol->getName(), TType(EbtVoid)); - $$.function = function; - } else - parseContext.error($1->getLoc(), "function call, method, or subroutine call expected", "", ""); - } - - if ($$.function == 0) { - // error recover - TString* empty = NewPoolTString(""); - $$.function = new TFunction(empty, TType(EbtVoid), EOpNull); - } - } -GLSLANG_WEB_EXCLUDE_ON - | non_uniform_qualifier { - // Constructor - $$.intermNode = 0; - $$.function = parseContext.handleConstructorCall($1.loc, $1); - } -GLSLANG_WEB_EXCLUDE_OFF - ; - -unary_expression - : postfix_expression { - parseContext.variableCheck($1); - $$ = $1; - if (TIntermMethod* method = $1->getAsMethodNode()) - parseContext.error($1->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), ""); - } - | INC_OP unary_expression { - parseContext.lValueErrorCheck($1.loc, "++", $2); - $$ = parseContext.handleUnaryMath($1.loc, "++", EOpPreIncrement, $2); - } - | DEC_OP unary_expression { - parseContext.lValueErrorCheck($1.loc, "--", $2); - $$ = parseContext.handleUnaryMath($1.loc, "--", EOpPreDecrement, $2); - } - | unary_operator unary_expression { - if ($1.op != EOpNull) { - char errorOp[2] = {0, 0}; - switch($1.op) { - case EOpNegative: errorOp[0] = '-'; break; - case EOpLogicalNot: errorOp[0] = '!'; break; - case EOpBitwiseNot: errorOp[0] = '~'; break; - default: break; // some compilers want this - } - $$ = parseContext.handleUnaryMath($1.loc, errorOp, $1.op, $2); - } else { - $$ = $2; - if ($$->getAsConstantUnion()) - $$->getAsConstantUnion()->setExpression(); - } - } - ; -// Grammar Note: No traditional style type casts. - -unary_operator - : PLUS { $$.loc = $1.loc; $$.op = EOpNull; } - | DASH { $$.loc = $1.loc; $$.op = EOpNegative; } - | BANG { $$.loc = $1.loc; $$.op = EOpLogicalNot; } - | TILDE { $$.loc = $1.loc; $$.op = EOpBitwiseNot; - parseContext.fullIntegerCheck($1.loc, "bitwise not"); } - ; -// Grammar Note: No '*' or '&' unary ops. Pointers are not supported. - -multiplicative_expression - : unary_expression { $$ = $1; } - | multiplicative_expression STAR unary_expression { - $$ = parseContext.handleBinaryMath($2.loc, "*", EOpMul, $1, $3); - if ($$ == 0) - $$ = $1; - } - | multiplicative_expression SLASH unary_expression { - $$ = parseContext.handleBinaryMath($2.loc, "/", EOpDiv, $1, $3); - if ($$ == 0) - $$ = $1; - } - | multiplicative_expression PERCENT unary_expression { - parseContext.fullIntegerCheck($2.loc, "%"); - $$ = parseContext.handleBinaryMath($2.loc, "%", EOpMod, $1, $3); - if ($$ == 0) - $$ = $1; - } - ; - -additive_expression - : multiplicative_expression { $$ = $1; } - | additive_expression PLUS multiplicative_expression { - $$ = parseContext.handleBinaryMath($2.loc, "+", EOpAdd, $1, $3); - if ($$ == 0) - $$ = $1; - } - | additive_expression DASH multiplicative_expression { - $$ = parseContext.handleBinaryMath($2.loc, "-", EOpSub, $1, $3); - if ($$ == 0) - $$ = $1; - } - ; - -shift_expression - : additive_expression { $$ = $1; } - | shift_expression LEFT_OP additive_expression { - parseContext.fullIntegerCheck($2.loc, "bit shift left"); - $$ = parseContext.handleBinaryMath($2.loc, "<<", EOpLeftShift, $1, $3); - if ($$ == 0) - $$ = $1; - } - | shift_expression RIGHT_OP additive_expression { - parseContext.fullIntegerCheck($2.loc, "bit shift right"); - $$ = parseContext.handleBinaryMath($2.loc, ">>", EOpRightShift, $1, $3); - if ($$ == 0) - $$ = $1; - } - ; - -relational_expression - : shift_expression { $$ = $1; } - | relational_expression LEFT_ANGLE shift_expression { - $$ = parseContext.handleBinaryMath($2.loc, "<", EOpLessThan, $1, $3); - if ($$ == 0) - $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); - } - | relational_expression RIGHT_ANGLE shift_expression { - $$ = parseContext.handleBinaryMath($2.loc, ">", EOpGreaterThan, $1, $3); - if ($$ == 0) - $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); - } - | relational_expression LE_OP shift_expression { - $$ = parseContext.handleBinaryMath($2.loc, "<=", EOpLessThanEqual, $1, $3); - if ($$ == 0) - $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); - } - | relational_expression GE_OP shift_expression { - $$ = parseContext.handleBinaryMath($2.loc, ">=", EOpGreaterThanEqual, $1, $3); - if ($$ == 0) - $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); - } - ; - -equality_expression - : relational_expression { $$ = $1; } - | equality_expression EQ_OP relational_expression { - parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison"); - parseContext.opaqueCheck($2.loc, $1->getType(), "=="); - parseContext.specializationCheck($2.loc, $1->getType(), "=="); - parseContext.referenceCheck($2.loc, $1->getType(), "=="); - $$ = parseContext.handleBinaryMath($2.loc, "==", EOpEqual, $1, $3); - if ($$ == 0) - $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); - } - | equality_expression NE_OP relational_expression { - parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison"); - parseContext.opaqueCheck($2.loc, $1->getType(), "!="); - parseContext.specializationCheck($2.loc, $1->getType(), "!="); - parseContext.referenceCheck($2.loc, $1->getType(), "!="); - $$ = parseContext.handleBinaryMath($2.loc, "!=", EOpNotEqual, $1, $3); - if ($$ == 0) - $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); - } - ; - -and_expression - : equality_expression { $$ = $1; } - | and_expression AMPERSAND equality_expression { - parseContext.fullIntegerCheck($2.loc, "bitwise and"); - $$ = parseContext.handleBinaryMath($2.loc, "&", EOpAnd, $1, $3); - if ($$ == 0) - $$ = $1; - } - ; - -exclusive_or_expression - : and_expression { $$ = $1; } - | exclusive_or_expression CARET and_expression { - parseContext.fullIntegerCheck($2.loc, "bitwise exclusive or"); - $$ = parseContext.handleBinaryMath($2.loc, "^", EOpExclusiveOr, $1, $3); - if ($$ == 0) - $$ = $1; - } - ; - -inclusive_or_expression - : exclusive_or_expression { $$ = $1; } - | inclusive_or_expression VERTICAL_BAR exclusive_or_expression { - parseContext.fullIntegerCheck($2.loc, "bitwise inclusive or"); - $$ = parseContext.handleBinaryMath($2.loc, "|", EOpInclusiveOr, $1, $3); - if ($$ == 0) - $$ = $1; - } - ; - -logical_and_expression - : inclusive_or_expression { $$ = $1; } - | logical_and_expression AND_OP inclusive_or_expression { - $$ = parseContext.handleBinaryMath($2.loc, "&&", EOpLogicalAnd, $1, $3); - if ($$ == 0) - $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); - } - ; - -logical_xor_expression - : logical_and_expression { $$ = $1; } - | logical_xor_expression XOR_OP logical_and_expression { - $$ = parseContext.handleBinaryMath($2.loc, "^^", EOpLogicalXor, $1, $3); - if ($$ == 0) - $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); - } - ; - -logical_or_expression - : logical_xor_expression { $$ = $1; } - | logical_or_expression OR_OP logical_xor_expression { - $$ = parseContext.handleBinaryMath($2.loc, "||", EOpLogicalOr, $1, $3); - if ($$ == 0) - $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); - } - ; - -conditional_expression - : logical_or_expression { $$ = $1; } - | logical_or_expression QUESTION { - ++parseContext.controlFlowNestingLevel; - } - expression COLON assignment_expression { - --parseContext.controlFlowNestingLevel; - parseContext.boolCheck($2.loc, $1); - parseContext.rValueErrorCheck($2.loc, "?", $1); - parseContext.rValueErrorCheck($5.loc, ":", $4); - parseContext.rValueErrorCheck($5.loc, ":", $6); - $$ = parseContext.intermediate.addSelection($1, $4, $6, $2.loc); - if ($$ == 0) { - parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), $6->getCompleteString(parseContext.intermediate.getEnhancedMsgs())); - $$ = $6; - } - } - ; - -assignment_expression - : conditional_expression { $$ = $1; } - | unary_expression assignment_operator assignment_expression { - parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment"); - parseContext.opaqueCheck($2.loc, $1->getType(), "="); - parseContext.storage16BitAssignmentCheck($2.loc, $1->getType(), "="); - parseContext.specializationCheck($2.loc, $1->getType(), "="); - parseContext.lValueErrorCheck($2.loc, "assign", $1); - parseContext.rValueErrorCheck($2.loc, "assign", $3); - $$ = parseContext.addAssign($2.loc, $2.op, $1, $3); - if ($$ == 0) { - parseContext.assignError($2.loc, "assign", $1->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), $3->getCompleteString(parseContext.intermediate.getEnhancedMsgs())); - $$ = $1; - } - } - ; - -assignment_operator - : EQUAL { - $$.loc = $1.loc; - $$.op = EOpAssign; - } - | MUL_ASSIGN { - $$.loc = $1.loc; - $$.op = EOpMulAssign; - } - | DIV_ASSIGN { - $$.loc = $1.loc; - $$.op = EOpDivAssign; - } - | MOD_ASSIGN { - parseContext.fullIntegerCheck($1.loc, "%="); - $$.loc = $1.loc; - $$.op = EOpModAssign; - } - | ADD_ASSIGN { - $$.loc = $1.loc; - $$.op = EOpAddAssign; - } - | SUB_ASSIGN { - $$.loc = $1.loc; - $$.op = EOpSubAssign; - } - | LEFT_ASSIGN { - parseContext.fullIntegerCheck($1.loc, "bit-shift left assign"); - $$.loc = $1.loc; $$.op = EOpLeftShiftAssign; - } - | RIGHT_ASSIGN { - parseContext.fullIntegerCheck($1.loc, "bit-shift right assign"); - $$.loc = $1.loc; $$.op = EOpRightShiftAssign; - } - | AND_ASSIGN { - parseContext.fullIntegerCheck($1.loc, "bitwise-and assign"); - $$.loc = $1.loc; $$.op = EOpAndAssign; - } - | XOR_ASSIGN { - parseContext.fullIntegerCheck($1.loc, "bitwise-xor assign"); - $$.loc = $1.loc; $$.op = EOpExclusiveOrAssign; - } - | OR_ASSIGN { - parseContext.fullIntegerCheck($1.loc, "bitwise-or assign"); - $$.loc = $1.loc; $$.op = EOpInclusiveOrAssign; - } - ; - -expression - : assignment_expression { - $$ = $1; - } - | expression COMMA assignment_expression { - parseContext.samplerConstructorLocationCheck($2.loc, ",", $3); - $$ = parseContext.intermediate.addComma($1, $3, $2.loc); - if ($$ == 0) { - parseContext.binaryOpError($2.loc, ",", $1->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), $3->getCompleteString(parseContext.intermediate.getEnhancedMsgs())); - $$ = $3; - } - } - ; - -constant_expression - : conditional_expression { - parseContext.constantValueCheck($1, ""); - $$ = $1; - } - ; - -declaration - : function_prototype SEMICOLON { - parseContext.handleFunctionDeclarator($1.loc, *$1.function, true /* prototype */); - $$ = 0; - // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature - } -GLSLANG_WEB_EXCLUDE_ON - | spirv_instruction_qualifier function_prototype SEMICOLON { - parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier"); - $2.function->setSpirvInstruction(*$1); // Attach SPIR-V intruction qualifier - parseContext.handleFunctionDeclarator($2.loc, *$2.function, true /* prototype */); - $$ = 0; - // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature - } - | spirv_execution_mode_qualifier SEMICOLON { - parseContext.globalCheck($2.loc, "SPIR-V execution mode qualifier"); - parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier"); - $$ = 0; - } -GLSLANG_WEB_EXCLUDE_OFF - | init_declarator_list SEMICOLON { - if ($1.intermNode && $1.intermNode->getAsAggregate()) - $1.intermNode->getAsAggregate()->setOperator(EOpSequence); - $$ = $1.intermNode; - } - | PRECISION precision_qualifier type_specifier SEMICOLON { - parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "precision statement"); - // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope - parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]); - parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision); - $$ = 0; - } - | block_structure SEMICOLON { - parseContext.declareBlock($1.loc, *$1.typeList); - $$ = 0; - } - | block_structure IDENTIFIER SEMICOLON { - parseContext.declareBlock($1.loc, *$1.typeList, $2.string); - $$ = 0; - } - | block_structure IDENTIFIER array_specifier SEMICOLON { - parseContext.declareBlock($1.loc, *$1.typeList, $2.string, $3.arraySizes); - $$ = 0; - } - | type_qualifier SEMICOLON { - parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); - parseContext.updateStandaloneQualifierDefaults($1.loc, $1); - $$ = 0; - } - | type_qualifier IDENTIFIER SEMICOLON { - parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); - parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$2.string); - $$ = 0; - } - | type_qualifier IDENTIFIER identifier_list SEMICOLON { - parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); - $3->push_back($2.string); - parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$3); - $$ = 0; - } - ; - -block_structure - : type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_list RIGHT_BRACE { - --parseContext.blockNestingLevel; - parseContext.blockName = $2.string; - parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); - parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); - parseContext.currentBlockQualifier = $1.qualifier; - $$.loc = $1.loc; - $$.typeList = $5; - } - -identifier_list - : COMMA IDENTIFIER { - $$ = new TIdentifierList; - $$->push_back($2.string); - } - | identifier_list COMMA IDENTIFIER { - $$ = $1; - $$->push_back($3.string); - } - ; - -function_prototype - : function_declarator RIGHT_PAREN { - $$.function = $1; - $$.loc = $2.loc; - } - | function_declarator RIGHT_PAREN attribute { - $$.function = $1; - $$.loc = $2.loc; - parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); - parseContext.handleFunctionAttributes($2.loc, *$3); - } - | attribute function_declarator RIGHT_PAREN { - $$.function = $2; - $$.loc = $3.loc; - parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); - parseContext.handleFunctionAttributes($3.loc, *$1); - } - | attribute function_declarator RIGHT_PAREN attribute { - $$.function = $2; - $$.loc = $3.loc; - parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); - parseContext.handleFunctionAttributes($3.loc, *$1); - parseContext.handleFunctionAttributes($3.loc, *$4); - } - ; - -function_declarator - : function_header { - $$ = $1; - } - | function_header_with_parameters { - $$ = $1; - } - ; - - -function_header_with_parameters - : function_header parameter_declaration { - // Add the parameter - $$ = $1; - if ($2.param.type->getBasicType() != EbtVoid) - $1->addParameter($2.param); - else - delete $2.param.type; - } - | function_header_with_parameters COMMA parameter_declaration { - // - // Only first parameter of one-parameter functions can be void - // The check for named parameters not being void is done in parameter_declarator - // - if ($3.param.type->getBasicType() == EbtVoid) { - // - // This parameter > first is void - // - parseContext.error($2.loc, "cannot be an argument type except for '(void)'", "void", ""); - delete $3.param.type; - } else { - // Add the parameter - $$ = $1; - $1->addParameter($3.param); - } - } - ; - -function_header - : fully_specified_type IDENTIFIER LEFT_PAREN { - if ($1.qualifier.storage != EvqGlobal && $1.qualifier.storage != EvqTemporary) { - parseContext.error($2.loc, "no qualifiers allowed for function return", - GetStorageQualifierString($1.qualifier.storage), ""); - } - if ($1.arraySizes) - parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); - - // Add the function as a prototype after parsing it (we do not support recursion) - TFunction *function; - TType type($1); - - // Potentially rename shader entry point function. No-op most of the time. - parseContext.renameShaderFunction($2.string); - - // Make the function - function = new TFunction($2.string, type); - $$ = function; - } - ; - -parameter_declarator - // Type + name - : type_specifier IDENTIFIER { - if ($1.arraySizes) { - parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); - parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); - } - if ($1.basicType == EbtVoid) { - parseContext.error($2.loc, "illegal use of type 'void'", $2.string->c_str(), ""); - } - parseContext.reservedErrorCheck($2.loc, *$2.string); - - TParameter param = {$2.string, new TType($1)}; - $$.loc = $2.loc; - $$.param = param; - } - | type_specifier IDENTIFIER array_specifier { - if ($1.arraySizes) { - parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); - parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); - } - TType* type = new TType($1); - type->transferArraySizes($3.arraySizes); - type->copyArrayInnerSizes($1.arraySizes); - - parseContext.arrayOfArrayVersionCheck($2.loc, type->getArraySizes()); - parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes); - parseContext.reservedErrorCheck($2.loc, *$2.string); - - TParameter param = { $2.string, type }; - - $$.loc = $2.loc; - $$.param = param; - } - ; - -parameter_declaration - // - // With name - // - : type_qualifier parameter_declarator { - $$ = $2; - if ($1.qualifier.precision != EpqNone) - $$.param.type->getQualifier().precision = $1.qualifier.precision; - parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); - - parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); - parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type); - parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type); - - } - | parameter_declarator { - $$ = $1; - - parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type); - parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type); - parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); - } - // - // Without name - // - | type_qualifier parameter_type_specifier { - $$ = $2; - if ($1.qualifier.precision != EpqNone) - $$.param.type->getQualifier().precision = $1.qualifier.precision; - parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); - - parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); - parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type); - parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type); - } - | parameter_type_specifier { - $$ = $1; - - parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type); - parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type); - parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); - } - ; - -parameter_type_specifier - : type_specifier { - TParameter param = { 0, new TType($1) }; - $$.param = param; - if ($1.arraySizes) - parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); - } - ; - -init_declarator_list - : single_declaration { - $$ = $1; - } - | init_declarator_list COMMA IDENTIFIER { - $$ = $1; - parseContext.declareVariable($3.loc, *$3.string, $1.type); - } - | init_declarator_list COMMA IDENTIFIER array_specifier { - $$ = $1; - parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes); - } - | init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer { - $$.type = $1.type; - TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6); - $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $5.loc); - } - | init_declarator_list COMMA IDENTIFIER EQUAL initializer { - $$.type = $1.type; - TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5); - $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $4.loc); - } - ; - -single_declaration - : fully_specified_type { - $$.type = $1; - $$.intermNode = 0; -GLSLANG_WEB_EXCLUDE_ON - parseContext.declareTypeDefaults($$.loc, $$.type); -GLSLANG_WEB_EXCLUDE_OFF - } - | fully_specified_type IDENTIFIER { - $$.type = $1; - $$.intermNode = 0; - parseContext.declareVariable($2.loc, *$2.string, $1); - } - | fully_specified_type IDENTIFIER array_specifier { - $$.type = $1; - $$.intermNode = 0; - parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes); - } - | fully_specified_type IDENTIFIER array_specifier EQUAL initializer { - $$.type = $1; - TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5); - $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $4.loc); - } - | fully_specified_type IDENTIFIER EQUAL initializer { - $$.type = $1; - TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); - $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $3.loc); - } - -// Grammar Note: No 'enum', or 'typedef'. - -fully_specified_type - : type_specifier { - $$ = $1; - - parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $$); - if ($1.arraySizes) { - parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); - } - parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier); - } - | type_qualifier type_specifier { - parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); - parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2); - - if ($2.arraySizes) { - parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type"); - } - - if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier)) - $2.arraySizes = nullptr; - - parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers); - $2.shaderQualifiers.merge($1.shaderQualifiers); - parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); - parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier); - - $$ = $2; - - if (! $$.qualifier.isInterpolation() && - ((parseContext.language == EShLangVertex && $$.qualifier.storage == EvqVaryingOut) || - (parseContext.language == EShLangFragment && $$.qualifier.storage == EvqVaryingIn))) - $$.qualifier.smooth = true; - } - ; - -invariant_qualifier - : INVARIANT { - parseContext.globalCheck($1.loc, "invariant"); - parseContext.profileRequires($$.loc, ENoProfile, 120, 0, "invariant"); - $$.init($1.loc); - $$.qualifier.invariant = true; - } - ; - -interpolation_qualifier - : SMOOTH { - parseContext.globalCheck($1.loc, "smooth"); - parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "smooth"); - parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "smooth"); - $$.init($1.loc); - $$.qualifier.smooth = true; - } - | FLAT { - parseContext.globalCheck($1.loc, "flat"); - parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "flat"); - parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "flat"); - $$.init($1.loc); - $$.qualifier.flat = true; - } -GLSLANG_WEB_EXCLUDE_ON - | NOPERSPECTIVE { - parseContext.globalCheck($1.loc, "noperspective"); - parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); - parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective"); - $$.init($1.loc); - $$.qualifier.nopersp = true; - } - | EXPLICITINTERPAMD { - parseContext.globalCheck($1.loc, "__explicitInterpAMD"); - parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); - parseContext.profileRequires($1.loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); - $$.init($1.loc); - $$.qualifier.explicitInterp = true; - } - | PERVERTEXNV { - parseContext.globalCheck($1.loc, "pervertexNV"); - parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); - parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); - parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); - $$.init($1.loc); - $$.qualifier.pervertexNV = true; - } - | PERVERTEXEXT { - parseContext.globalCheck($1.loc, "pervertexEXT"); - parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric"); - parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric"); - parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric"); - $$.init($1.loc); - $$.qualifier.pervertexEXT = true; - } - | PERPRIMITIVENV { - // No need for profile version or extension check. Shader stage already checks both. - parseContext.globalCheck($1.loc, "perprimitiveNV"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshMask), "perprimitiveNV"); - // Fragment shader stage doesn't check for extension. So we explicitly add below extension check. - if (parseContext.language == EShLangFragment) - parseContext.requireExtensions($1.loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV"); - $$.init($1.loc); - $$.qualifier.perPrimitiveNV = true; - } - | PERPRIMITIVEEXT { - // No need for profile version or extension check. Shader stage already checks both. - parseContext.globalCheck($1.loc, "perprimitiveEXT"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshMask), "perprimitiveEXT"); - // Fragment shader stage doesn't check for extension. So we explicitly add below extension check. - if (parseContext.language == EShLangFragment) - parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_mesh_shader, "perprimitiveEXT"); - $$.init($1.loc); - $$.qualifier.perPrimitiveNV = true; - } - | PERVIEWNV { - // No need for profile version or extension check. Shader stage already checks both. - parseContext.globalCheck($1.loc, "perviewNV"); - parseContext.requireStage($1.loc, EShLangMesh, "perviewNV"); - $$.init($1.loc); - $$.qualifier.perViewNV = true; - } - | PERTASKNV { - // No need for profile version or extension check. Shader stage already checks both. - parseContext.globalCheck($1.loc, "taskNV"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask), "taskNV"); - $$.init($1.loc); - $$.qualifier.perTaskNV = true; - } -GLSLANG_WEB_EXCLUDE_OFF - ; - -layout_qualifier - : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN { - $$ = $3; - } - ; - -layout_qualifier_id_list - : layout_qualifier_id { - $$ = $1; - } - | layout_qualifier_id_list COMMA layout_qualifier_id { - $$ = $1; - $$.shaderQualifiers.merge($3.shaderQualifiers); - parseContext.mergeObjectLayoutQualifiers($$.qualifier, $3.qualifier, false); - } - -layout_qualifier_id - : IDENTIFIER { - $$.init($1.loc); - parseContext.setLayoutQualifier($1.loc, $$, *$1.string); - } - | IDENTIFIER EQUAL constant_expression { - $$.init($1.loc); - parseContext.setLayoutQualifier($1.loc, $$, *$1.string, $3); - } - | SHARED { // because "shared" is both an identifier and a keyword - $$.init($1.loc); - TString strShared("shared"); - parseContext.setLayoutQualifier($1.loc, $$, strShared); - } - ; - -GLSLANG_WEB_EXCLUDE_ON -precise_qualifier - : PRECISE { - parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); - parseContext.profileRequires($1.loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise"); - $$.init($1.loc); - $$.qualifier.noContraction = true; - } - ; -GLSLANG_WEB_EXCLUDE_OFF - -type_qualifier - : single_type_qualifier { - $$ = $1; - } - | type_qualifier single_type_qualifier { - $$ = $1; - if ($$.basicType == EbtVoid) - $$.basicType = $2.basicType; - - $$.shaderQualifiers.merge($2.shaderQualifiers); - parseContext.mergeQualifiers($$.loc, $$.qualifier, $2.qualifier, false); - } - ; - -single_type_qualifier - : storage_qualifier { - $$ = $1; - } - | layout_qualifier { - $$ = $1; - } - | precision_qualifier { - parseContext.checkPrecisionQualifier($1.loc, $1.qualifier.precision); - $$ = $1; - } - | interpolation_qualifier { - // allow inheritance of storage qualifier from block declaration - $$ = $1; - } - | invariant_qualifier { - // allow inheritance of storage qualifier from block declaration - $$ = $1; - } -GLSLANG_WEB_EXCLUDE_ON - | precise_qualifier { - // allow inheritance of storage qualifier from block declaration - $$ = $1; - } - | non_uniform_qualifier { - $$ = $1; - } - | spirv_storage_class_qualifier { - parseContext.globalCheck($1.loc, "spirv_storage_class"); - parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V storage class qualifier"); - $$ = $1; - } - | spirv_decorate_qualifier { - parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V decorate qualifier"); - $$ = $1; - } - | SPIRV_BY_REFERENCE { - parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_reference"); - $$.init($1.loc); - $$.qualifier.setSpirvByReference(); - } - | SPIRV_LITERAL { - parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_literal"); - $$.init($1.loc); - $$.qualifier.setSpirvLiteral(); - } -GLSLANG_WEB_EXCLUDE_OFF - ; - -storage_qualifier - : CONST { - $$.init($1.loc); - $$.qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant - } - | INOUT { - parseContext.globalCheck($1.loc, "inout"); - $$.init($1.loc); - $$.qualifier.storage = EvqInOut; - } - | IN { - parseContext.globalCheck($1.loc, "in"); - $$.init($1.loc); - // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later - $$.qualifier.storage = EvqIn; - } - | OUT { - parseContext.globalCheck($1.loc, "out"); - $$.init($1.loc); - // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later - $$.qualifier.storage = EvqOut; - } - | CENTROID { - parseContext.profileRequires($1.loc, ENoProfile, 120, 0, "centroid"); - parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "centroid"); - parseContext.globalCheck($1.loc, "centroid"); - $$.init($1.loc); - $$.qualifier.centroid = true; - } - | UNIFORM { - parseContext.globalCheck($1.loc, "uniform"); - $$.init($1.loc); - $$.qualifier.storage = EvqUniform; - } - | SHARED { - parseContext.globalCheck($1.loc, "shared"); - parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); - parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshMask | EShLangTaskMask), "shared"); - $$.init($1.loc); - $$.qualifier.storage = EvqShared; - } - | BUFFER { - parseContext.globalCheck($1.loc, "buffer"); - $$.init($1.loc); - $$.qualifier.storage = EvqBuffer; - } -GLSLANG_WEB_EXCLUDE_ON - | ATTRIBUTE { - parseContext.requireStage($1.loc, EShLangVertex, "attribute"); - parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute"); - parseContext.checkDeprecated($1.loc, ENoProfile, 130, "attribute"); - parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "attribute"); - parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "attribute"); - - parseContext.globalCheck($1.loc, "attribute"); - - $$.init($1.loc); - $$.qualifier.storage = EvqVaryingIn; - } - | VARYING { - parseContext.checkDeprecated($1.loc, ENoProfile, 130, "varying"); - parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "varying"); - parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "varying"); - parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "varying"); - - parseContext.globalCheck($1.loc, "varying"); - - $$.init($1.loc); - if (parseContext.language == EShLangVertex) - $$.qualifier.storage = EvqVaryingOut; - else - $$.qualifier.storage = EvqVaryingIn; - } - | PATCH { - parseContext.globalCheck($1.loc, "patch"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); - $$.init($1.loc); - $$.qualifier.patch = true; - } - | SAMPLE { - parseContext.globalCheck($1.loc, "sample"); - $$.init($1.loc); - $$.qualifier.sample = true; - } - | HITATTRNV { - parseContext.globalCheck($1.loc, "hitAttributeNV"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask - | EShLangAnyHitMask), "hitAttributeNV"); - parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV"); - $$.init($1.loc); - $$.qualifier.storage = EvqHitAttr; - } - | HITATTREXT { - parseContext.globalCheck($1.loc, "hitAttributeEXT"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask - | EShLangAnyHitMask), "hitAttributeEXT"); - parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "hitAttributeNV"); - $$.init($1.loc); - $$.qualifier.storage = EvqHitAttr; - } - | PAYLOADNV { - parseContext.globalCheck($1.loc, "rayPayloadNV"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | - EShLangAnyHitMask | EShLangMissMask), "rayPayloadNV"); - parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV"); - $$.init($1.loc); - $$.qualifier.storage = EvqPayload; - } - | PAYLOADEXT { - parseContext.globalCheck($1.loc, "rayPayloadEXT"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | - EShLangAnyHitMask | EShLangMissMask), "rayPayloadEXT"); - parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "rayPayloadEXT"); - $$.init($1.loc); - $$.qualifier.storage = EvqPayload; - } - | PAYLOADINNV { - parseContext.globalCheck($1.loc, "rayPayloadInNV"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitMask | - EShLangAnyHitMask | EShLangMissMask), "rayPayloadInNV"); - parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV"); - $$.init($1.loc); - $$.qualifier.storage = EvqPayloadIn; - } - | PAYLOADINEXT { - parseContext.globalCheck($1.loc, "rayPayloadInEXT"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitMask | - EShLangAnyHitMask | EShLangMissMask), "rayPayloadInEXT"); - parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "rayPayloadInEXT"); - $$.init($1.loc); - $$.qualifier.storage = EvqPayloadIn; - } - | CALLDATANV { - parseContext.globalCheck($1.loc, "callableDataNV"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | - EShLangClosestHitMask | EShLangMissMask | EShLangCallableMask), "callableDataNV"); - parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataNV"); - $$.init($1.loc); - $$.qualifier.storage = EvqCallableData; - } - | CALLDATAEXT { - parseContext.globalCheck($1.loc, "callableDataEXT"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | - EShLangClosestHitMask | EShLangMissMask | EShLangCallableMask), "callableDataEXT"); - parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "callableDataEXT"); - $$.init($1.loc); - $$.qualifier.storage = EvqCallableData; - } - | CALLDATAINNV { - parseContext.globalCheck($1.loc, "callableDataInNV"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInNV"); - parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV"); - $$.init($1.loc); - $$.qualifier.storage = EvqCallableDataIn; - } - | CALLDATAINEXT { - parseContext.globalCheck($1.loc, "callableDataInEXT"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInEXT"); - parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "callableDataInEXT"); - $$.init($1.loc); - $$.qualifier.storage = EvqCallableDataIn; - } - | COHERENT { - $$.init($1.loc); - $$.qualifier.coherent = true; - } - | DEVICECOHERENT { - $$.init($1.loc); - parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent"); - $$.qualifier.devicecoherent = true; - } - | QUEUEFAMILYCOHERENT { - $$.init($1.loc); - parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent"); - $$.qualifier.queuefamilycoherent = true; - } - | WORKGROUPCOHERENT { - $$.init($1.loc); - parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent"); - $$.qualifier.workgroupcoherent = true; - } - | SUBGROUPCOHERENT { - $$.init($1.loc); - parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent"); - $$.qualifier.subgroupcoherent = true; - } - | NONPRIVATE { - $$.init($1.loc); - parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate"); - $$.qualifier.nonprivate = true; - } - | SHADERCALLCOHERENT { - $$.init($1.loc); - parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_ray_tracing, "shadercallcoherent"); - $$.qualifier.shadercallcoherent = true; - } - | VOLATILE { - $$.init($1.loc); - $$.qualifier.volatil = true; - } - | RESTRICT { - $$.init($1.loc); - $$.qualifier.restrict = true; - } - | READONLY { - $$.init($1.loc); - $$.qualifier.readonly = true; - } - | WRITEONLY { - $$.init($1.loc); - $$.qualifier.writeonly = true; - } - | SUBROUTINE { - parseContext.spvRemoved($1.loc, "subroutine"); - parseContext.globalCheck($1.loc, "subroutine"); - parseContext.unimplemented($1.loc, "subroutine"); - $$.init($1.loc); - } - | SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN { - parseContext.spvRemoved($1.loc, "subroutine"); - parseContext.globalCheck($1.loc, "subroutine"); - parseContext.unimplemented($1.loc, "subroutine"); - $$.init($1.loc); - } - | TASKPAYLOADWORKGROUPEXT { - // No need for profile version or extension check. Shader stage already checks both. - parseContext.globalCheck($1.loc, "taskPayloadSharedEXT"); - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask), "taskPayloadSharedEXT "); - $$.init($1.loc); - $$.qualifier.storage = EvqtaskPayloadSharedEXT; - } -GLSLANG_WEB_EXCLUDE_OFF - ; - -GLSLANG_WEB_EXCLUDE_ON -non_uniform_qualifier - : NONUNIFORM { - $$.init($1.loc); - $$.qualifier.nonUniform = true; - } - ; - -type_name_list - : IDENTIFIER { - // TODO - } - | type_name_list COMMA IDENTIFIER { - // TODO: 4.0 semantics: subroutines - // 1) make sure each identifier is a type declared earlier with SUBROUTINE - // 2) save all of the identifiers for future comparison with the declared function - } - ; -GLSLANG_WEB_EXCLUDE_OFF - -type_specifier - : type_specifier_nonarray type_parameter_specifier_opt { - $$ = $1; - $$.qualifier.precision = parseContext.getDefaultPrecision($$); - $$.typeParameters = $2; - } - | type_specifier_nonarray type_parameter_specifier_opt array_specifier { - parseContext.arrayOfArrayVersionCheck($3.loc, $3.arraySizes); - $$ = $1; - $$.qualifier.precision = parseContext.getDefaultPrecision($$); - $$.typeParameters = $2; - $$.arraySizes = $3.arraySizes; - } - ; - -array_specifier - : LEFT_BRACKET RIGHT_BRACKET { - $$.loc = $1.loc; - $$.arraySizes = new TArraySizes; - $$.arraySizes->addInnerSize(); - } - | LEFT_BRACKET conditional_expression RIGHT_BRACKET { - $$.loc = $1.loc; - $$.arraySizes = new TArraySizes; - - TArraySize size; - parseContext.arraySizeCheck($2->getLoc(), $2, size, "array size"); - $$.arraySizes->addInnerSize(size); - } - | array_specifier LEFT_BRACKET RIGHT_BRACKET { - $$ = $1; - $$.arraySizes->addInnerSize(); - } - | array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET { - $$ = $1; - - TArraySize size; - parseContext.arraySizeCheck($3->getLoc(), $3, size, "array size"); - $$.arraySizes->addInnerSize(size); - } - ; - -type_parameter_specifier_opt - : type_parameter_specifier { - $$ = $1; - } - | /* May be null */ { - $$ = 0; - } - ; - -type_parameter_specifier - : LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE { - $$ = $2; - } - ; - -type_parameter_specifier_list - : unary_expression { - $$ = new TArraySizes; - - TArraySize size; - parseContext.arraySizeCheck($1->getLoc(), $1, size, "type parameter"); - $$->addInnerSize(size); - } - | type_parameter_specifier_list COMMA unary_expression { - $$ = $1; - - TArraySize size; - parseContext.arraySizeCheck($3->getLoc(), $3, size, "type parameter"); - $$->addInnerSize(size); - } - ; - -type_specifier_nonarray - : VOID { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtVoid; - } - | FLOAT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - } - | INT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - } - | UINT { - parseContext.fullIntegerCheck($1.loc, "unsigned integer"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - } - | BOOL { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtBool; - } - | VEC2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setVector(2); - } - | VEC3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setVector(3); - } - | VEC4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setVector(4); - } - | BVEC2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtBool; - $$.setVector(2); - } - | BVEC3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtBool; - $$.setVector(3); - } - | BVEC4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtBool; - $$.setVector(4); - } - | IVEC2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - $$.setVector(2); - } - | IVEC3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - $$.setVector(3); - } - | IVEC4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - $$.setVector(4); - } - | UVEC2 { - parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - $$.setVector(2); - } - | UVEC3 { - parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - $$.setVector(3); - } - | UVEC4 { - parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - $$.setVector(4); - } - | MAT2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 2); - } - | MAT3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 3); - } - | MAT4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 4); - } - | MAT2X2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 2); - } - | MAT2X3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 3); - } - | MAT2X4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 4); - } - | MAT3X2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 2); - } - | MAT3X3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 3); - } - | MAT3X4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 4); - } - | MAT4X2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 2); - } - | MAT4X3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 3); - } - | MAT4X4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 4); - } -GLSLANG_WEB_EXCLUDE_ON - | DOUBLE { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - } - | FLOAT16_T { - parseContext.float16ScalarVectorCheck($1.loc, "float16_t", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - } - | FLOAT32_T { - parseContext.explicitFloat32Check($1.loc, "float32_t", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - } - | FLOAT64_T { - parseContext.explicitFloat64Check($1.loc, "float64_t", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - } - | INT8_T { - parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt8; - } - | UINT8_T { - parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint8; - } - | INT16_T { - parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt16; - } - | UINT16_T { - parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint16; - } - | INT32_T { - parseContext.explicitInt32Check($1.loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - } - | UINT32_T { - parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - } - | INT64_T { - parseContext.int64Check($1.loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt64; - } - | UINT64_T { - parseContext.int64Check($1.loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint64; - } - | DVEC2 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double vector"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setVector(2); - } - | DVEC3 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double vector"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setVector(3); - } - | DVEC4 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double vector"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setVector(4); - } - | F16VEC2 { - parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setVector(2); - } - | F16VEC3 { - parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setVector(3); - } - | F16VEC4 { - parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setVector(4); - } - | F32VEC2 { - parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setVector(2); - } - | F32VEC3 { - parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setVector(3); - } - | F32VEC4 { - parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setVector(4); - } - | F64VEC2 { - parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setVector(2); - } - | F64VEC3 { - parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setVector(3); - } - | F64VEC4 { - parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setVector(4); - } - | I8VEC2 { - parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt8; - $$.setVector(2); - } - | I8VEC3 { - parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt8; - $$.setVector(3); - } - | I8VEC4 { - parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt8; - $$.setVector(4); - } - | I16VEC2 { - parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt16; - $$.setVector(2); - } - | I16VEC3 { - parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt16; - $$.setVector(3); - } - | I16VEC4 { - parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt16; - $$.setVector(4); - } - | I32VEC2 { - parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - $$.setVector(2); - } - | I32VEC3 { - parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - $$.setVector(3); - } - | I32VEC4 { - parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - $$.setVector(4); - } - | I64VEC2 { - parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt64; - $$.setVector(2); - } - | I64VEC3 { - parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt64; - $$.setVector(3); - } - | I64VEC4 { - parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt64; - $$.setVector(4); - } - | U8VEC2 { - parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint8; - $$.setVector(2); - } - | U8VEC3 { - parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint8; - $$.setVector(3); - } - | U8VEC4 { - parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint8; - $$.setVector(4); - } - | U16VEC2 { - parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint16; - $$.setVector(2); - } - | U16VEC3 { - parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint16; - $$.setVector(3); - } - | U16VEC4 { - parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint16; - $$.setVector(4); - } - | U32VEC2 { - parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - $$.setVector(2); - } - | U32VEC3 { - parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - $$.setVector(3); - } - | U32VEC4 { - parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - $$.setVector(4); - } - | U64VEC2 { - parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint64; - $$.setVector(2); - } - | U64VEC3 { - parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint64; - $$.setVector(3); - } - | U64VEC4 { - parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint64; - $$.setVector(4); - } - | DMAT2 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(2, 2); - } - | DMAT3 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(3, 3); - } - | DMAT4 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(4, 4); - } - | DMAT2X2 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(2, 2); - } - | DMAT2X3 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(2, 3); - } - | DMAT2X4 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(2, 4); - } - | DMAT3X2 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(3, 2); - } - | DMAT3X3 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(3, 3); - } - | DMAT3X4 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(3, 4); - } - | DMAT4X2 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(4, 2); - } - | DMAT4X3 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(4, 3); - } - | DMAT4X4 { - parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); - if (! parseContext.symbolTable.atBuiltInLevel()) - parseContext.doubleCheck($1.loc, "double matrix"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(4, 4); - } - | F16MAT2 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(2, 2); - } - | F16MAT3 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(3, 3); - } - | F16MAT4 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(4, 4); - } - | F16MAT2X2 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(2, 2); - } - | F16MAT2X3 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(2, 3); - } - | F16MAT2X4 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(2, 4); - } - | F16MAT3X2 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(3, 2); - } - | F16MAT3X3 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(3, 3); - } - | F16MAT3X4 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(3, 4); - } - | F16MAT4X2 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(4, 2); - } - | F16MAT4X3 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(4, 3); - } - | F16MAT4X4 { - parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat16; - $$.setMatrix(4, 4); - } - | F32MAT2 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 2); - } - | F32MAT3 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 3); - } - | F32MAT4 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 4); - } - | F32MAT2X2 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 2); - } - | F32MAT2X3 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 3); - } - | F32MAT2X4 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 4); - } - | F32MAT3X2 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 2); - } - | F32MAT3X3 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 3); - } - | F32MAT3X4 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 4); - } - | F32MAT4X2 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 2); - } - | F32MAT4X3 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 3); - } - | F32MAT4X4 { - parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 4); - } - | F64MAT2 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(2, 2); - } - | F64MAT3 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(3, 3); - } - | F64MAT4 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(4, 4); - } - | F64MAT2X2 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(2, 2); - } - | F64MAT2X3 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(2, 3); - } - | F64MAT2X4 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(2, 4); - } - | F64MAT3X2 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(3, 2); - } - | F64MAT3X3 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(3, 3); - } - | F64MAT3X4 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(3, 4); - } - | F64MAT4X2 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(4, 2); - } - | F64MAT4X3 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(4, 3); - } - | F64MAT4X4 { - parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtDouble; - $$.setMatrix(4, 4); - } - | ACCSTRUCTNV { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtAccStruct; - } - | ACCSTRUCTEXT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtAccStruct; - } - | RAYQUERYEXT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtRayQuery; - } - | ATOMIC_UINT { - parseContext.vulkanRemoved($1.loc, "atomic counter types"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtAtomicUint; - } - | SAMPLER1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd1D); - } -GLSLANG_WEB_EXCLUDE_OFF - | SAMPLER2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D); - } - | SAMPLER3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd3D); - } - | SAMPLERCUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, EsdCube); - } - | SAMPLER2DSHADOW { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D, false, true); - } - | SAMPLERCUBESHADOW { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, EsdCube, false, true); - } - | SAMPLER2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D, true); - } - | SAMPLER2DARRAYSHADOW { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D, true, true); - } -GLSLANG_WEB_EXCLUDE_ON - | SAMPLER1DSHADOW { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd1D, false, true); - } - | SAMPLER1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd1D, true); - } - | SAMPLER1DARRAYSHADOW { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd1D, true, true); - } - | SAMPLERCUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, EsdCube, true); - } - | SAMPLERCUBEARRAYSHADOW { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, EsdCube, true, true); - } - | F16SAMPLER1D { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd1D); - } - | F16SAMPLER2D { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd2D); - } - | F16SAMPLER3D { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd3D); - } - | F16SAMPLERCUBE { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, EsdCube); - } - | F16SAMPLER1DSHADOW { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd1D, false, true); - } - | F16SAMPLER2DSHADOW { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd2D, false, true); - } - | F16SAMPLERCUBESHADOW { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, EsdCube, false, true); - } - | F16SAMPLER1DARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd1D, true); - } - | F16SAMPLER2DARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd2D, true); - } - | F16SAMPLER1DARRAYSHADOW { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd1D, true, true); - } - | F16SAMPLER2DARRAYSHADOW { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd2D, true, true); - } - | F16SAMPLERCUBEARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, EsdCube, true); - } - | F16SAMPLERCUBEARRAYSHADOW { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, EsdCube, true, true); - } - | ISAMPLER1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, Esd1D); - } -GLSLANG_WEB_EXCLUDE_OFF - | ISAMPLER2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, Esd2D); - } - | ISAMPLER3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, Esd3D); - } - | ISAMPLERCUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, EsdCube); - } - | ISAMPLER2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, Esd2D, true); - } - | USAMPLER2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, Esd2D); - } - | USAMPLER3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, Esd3D); - } - | USAMPLERCUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, EsdCube); - } -GLSLANG_WEB_EXCLUDE_ON - | ISAMPLER1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, Esd1D, true); - } - | ISAMPLERCUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, EsdCube, true); - } - | USAMPLER1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, Esd1D); - } - | USAMPLER1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, Esd1D, true); - } - | USAMPLERCUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, EsdCube, true); - } - | TEXTURECUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, EsdCube, true); - } - | ITEXTURECUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, EsdCube, true); - } - | UTEXTURECUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, EsdCube, true); - } -GLSLANG_WEB_EXCLUDE_OFF - | USAMPLER2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, Esd2D, true); - } - | TEXTURE2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, Esd2D); - } - | TEXTURE3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, Esd3D); - } - | TEXTURE2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, Esd2D, true); - } - | TEXTURECUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, EsdCube); - } - | ITEXTURE2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, Esd2D); - } - | ITEXTURE3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, Esd3D); - } - | ITEXTURECUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, EsdCube); - } - | ITEXTURE2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, Esd2D, true); - } - | UTEXTURE2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, Esd2D); - } - | UTEXTURE3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, Esd3D); - } - | UTEXTURECUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, EsdCube); - } - | UTEXTURE2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, Esd2D, true); - } - | SAMPLER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setPureSampler(false); - } - | SAMPLERSHADOW { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setPureSampler(true); - } -GLSLANG_WEB_EXCLUDE_ON - | SAMPLER2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, EsdRect); - } - | SAMPLER2DRECTSHADOW { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, EsdRect, false, true); - } - | F16SAMPLER2DRECT { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, EsdRect); - } - | F16SAMPLER2DRECTSHADOW { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, EsdRect, false, true); - } - | ISAMPLER2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, EsdRect); - } - | USAMPLER2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, EsdRect); - } - | SAMPLERBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, EsdBuffer); - } - | F16SAMPLERBUFFER { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, EsdBuffer); - } - | ISAMPLERBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, EsdBuffer); - } - | USAMPLERBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, EsdBuffer); - } - | SAMPLER2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D, false, false, true); - } - | F16SAMPLER2DMS { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd2D, false, false, true); - } - | ISAMPLER2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, Esd2D, false, false, true); - } - | USAMPLER2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, Esd2D, false, false, true); - } - | SAMPLER2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D, true, false, true); - } - | F16SAMPLER2DMSARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat16, Esd2D, true, false, true); - } - | ISAMPLER2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, Esd2D, true, false, true); - } - | USAMPLER2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, Esd2D, true, false, true); - } - | TEXTURE1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, Esd1D); - } - | F16TEXTURE1D { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, Esd1D); - } - | F16TEXTURE2D { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, Esd2D); - } - | F16TEXTURE3D { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, Esd3D); - } - | F16TEXTURECUBE { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, EsdCube); - } - | TEXTURE1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, Esd1D, true); - } - | F16TEXTURE1DARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, Esd1D, true); - } - | F16TEXTURE2DARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, Esd2D, true); - } - | F16TEXTURECUBEARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, EsdCube, true); - } - | ITEXTURE1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, Esd1D); - } - | ITEXTURE1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, Esd1D, true); - } - | UTEXTURE1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, Esd1D); - } - | UTEXTURE1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, Esd1D, true); - } - | TEXTURE2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, EsdRect); - } - | F16TEXTURE2DRECT { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, EsdRect); - } - | ITEXTURE2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, EsdRect); - } - | UTEXTURE2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, EsdRect); - } - | TEXTUREBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, EsdBuffer); - } - | F16TEXTUREBUFFER { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, EsdBuffer); - } - | ITEXTUREBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, EsdBuffer); - } - | UTEXTUREBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, EsdBuffer); - } - | TEXTURE2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, Esd2D, false, false, true); - } - | F16TEXTURE2DMS { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, Esd2D, false, false, true); - } - | ITEXTURE2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, Esd2D, false, false, true); - } - | UTEXTURE2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, Esd2D, false, false, true); - } - | TEXTURE2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat, Esd2D, true, false, true); - } - | F16TEXTURE2DMSARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtFloat16, Esd2D, true, false, true); - } - | ITEXTURE2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, Esd2D, true, false, true); - } - | UTEXTURE2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, Esd2D, true, false, true); - } - | IMAGE1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, Esd1D); - } - | F16IMAGE1D { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, Esd1D); - } - | IIMAGE1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, Esd1D); - } - | UIMAGE1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, Esd1D); - } - | IMAGE2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, Esd2D); - } - | F16IMAGE2D { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, Esd2D); - } - | IIMAGE2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, Esd2D); - } - | UIMAGE2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, Esd2D); - } - | IMAGE3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, Esd3D); - } - | F16IMAGE3D { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, Esd3D); - } - | IIMAGE3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, Esd3D); - } - | UIMAGE3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, Esd3D); - } - | IMAGE2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, EsdRect); - } - | F16IMAGE2DRECT { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, EsdRect); - } - | IIMAGE2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, EsdRect); - } - | UIMAGE2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, EsdRect); - } - | IMAGECUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, EsdCube); - } - | F16IMAGECUBE { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, EsdCube); - } - | IIMAGECUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, EsdCube); - } - | UIMAGECUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, EsdCube); - } - | IMAGEBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, EsdBuffer); - } - | F16IMAGEBUFFER { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, EsdBuffer); - } - | IIMAGEBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, EsdBuffer); - } - | UIMAGEBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, EsdBuffer); - } - | IMAGE1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, Esd1D, true); - } - | F16IMAGE1DARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, Esd1D, true); - } - | IIMAGE1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, Esd1D, true); - } - | UIMAGE1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, Esd1D, true); - } - | IMAGE2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, Esd2D, true); - } - | F16IMAGE2DARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, Esd2D, true); - } - | IIMAGE2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, Esd2D, true); - } - | UIMAGE2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, Esd2D, true); - } - | IMAGECUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, EsdCube, true); - } - | F16IMAGECUBEARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, EsdCube, true); - } - | IIMAGECUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, EsdCube, true); - } - | UIMAGECUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, EsdCube, true); - } - | IMAGE2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, Esd2D, false, false, true); - } - | F16IMAGE2DMS { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, Esd2D, false, false, true); - } - | IIMAGE2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, Esd2D, false, false, true); - } - | UIMAGE2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, Esd2D, false, false, true); - } - | IMAGE2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat, Esd2D, true, false, true); - } - | F16IMAGE2DMSARRAY { - parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtFloat16, Esd2D, true, false, true); - } - | IIMAGE2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt, Esd2D, true, false, true); - } - | UIMAGE2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint, Esd2D, true, false, true); - } - | I64IMAGE1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, Esd1D); - } - | U64IMAGE1D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, Esd1D); - } - | I64IMAGE2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, Esd2D); - } - | U64IMAGE2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, Esd2D); - } - | I64IMAGE3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, Esd3D); - } - | U64IMAGE3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, Esd3D); - } - | I64IMAGE2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, EsdRect); - } - | U64IMAGE2DRECT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, EsdRect); - } - | I64IMAGECUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, EsdCube); - } - | U64IMAGECUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, EsdCube); - } - | I64IMAGEBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, EsdBuffer); - } - | U64IMAGEBUFFER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, EsdBuffer); - } - | I64IMAGE1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, Esd1D, true); - } - | U64IMAGE1DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, Esd1D, true); - } - | I64IMAGE2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, Esd2D, true); - } - | U64IMAGE2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, Esd2D, true); - } - | I64IMAGECUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, EsdCube, true); - } - | U64IMAGECUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, EsdCube, true); - } - | I64IMAGE2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, Esd2D, false, false, true); - } - | U64IMAGE2DMS { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, Esd2D, false, false, true); - } - | I64IMAGE2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtInt64, Esd2D, true, false, true); - } - | U64IMAGE2DMSARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setImage(EbtUint64, Esd2D, true, false, true); - } - | SAMPLEREXTERNALOES { // GL_OES_EGL_image_external - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D); - $$.sampler.external = true; - } - | SAMPLEREXTERNAL2DY2YEXT { // GL_EXT_YUV_target - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D); - $$.sampler.yuv = true; - } - | SUBPASSINPUT { - parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setSubpass(EbtFloat); - } - | SUBPASSINPUTMS { - parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setSubpass(EbtFloat, true); - } - | F16SUBPASSINPUT { - parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); - parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setSubpass(EbtFloat16); - } - | F16SUBPASSINPUTMS { - parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); - parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setSubpass(EbtFloat16, true); - } - | ISUBPASSINPUT { - parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setSubpass(EbtInt); - } - | ISUBPASSINPUTMS { - parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setSubpass(EbtInt, true); - } - | USUBPASSINPUT { - parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setSubpass(EbtUint); - } - | USUBPASSINPUTMS { - parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setSubpass(EbtUint, true); - } - | FCOOPMATNV { - parseContext.fcoopmatCheck($1.loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.coopmat = true; - } - | ICOOPMATNV { - parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - $$.coopmat = true; - } - | UCOOPMATNV { - parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - $$.coopmat = true; - } - | spirv_type_specifier { - parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier"); - $$ = $1; - } -GLSLANG_WEB_EXCLUDE_OFF - | struct_specifier { - $$ = $1; - $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; - parseContext.structTypeCheck($$.loc, $$); - } - | TYPE_NAME { - // - // This is for user defined type names. The lexical phase looked up the - // type. - // - if (const TVariable* variable = ($1.symbol)->getAsVariable()) { - const TType& structure = variable->getType(); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtStruct; - $$.userDef = &structure; - } else - parseContext.error($1.loc, "expected type name", $1.string->c_str(), ""); - } - ; - -precision_qualifier - : HIGH_PRECISION { - parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "highp precision qualifier"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqHigh); - } - | MEDIUM_PRECISION { - parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "mediump precision qualifier"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqMedium); - } - | LOW_PRECISION { - parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "lowp precision qualifier"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqLow); - } - ; - -struct_specifier - : STRUCT IDENTIFIER LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE { - TType* structure = new TType($5, *$2.string); - parseContext.structArrayCheck($2.loc, *structure); - TVariable* userTypeDef = new TVariable($2.string, *structure, true); - if (! parseContext.symbolTable.insert(*userTypeDef)) - parseContext.error($2.loc, "redefinition", $2.string->c_str(), "struct"); - $$.init($1.loc); - $$.basicType = EbtStruct; - $$.userDef = structure; - --parseContext.structNestingLevel; - } - | STRUCT LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE { - TType* structure = new TType($4, TString("")); - $$.init($1.loc); - $$.basicType = EbtStruct; - $$.userDef = structure; - --parseContext.structNestingLevel; - } - ; - -struct_declaration_list - : struct_declaration { - $$ = $1; - } - | struct_declaration_list struct_declaration { - $$ = $1; - for (unsigned int i = 0; i < $2->size(); ++i) { - for (unsigned int j = 0; j < $$->size(); ++j) { - if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName()) - parseContext.error((*$2)[i].loc, "duplicate member name:", "", (*$2)[i].type->getFieldName().c_str()); - } - $$->push_back((*$2)[i]); - } - } - ; - -struct_declaration - : type_specifier struct_declarator_list SEMICOLON { - if ($1.arraySizes) { - parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); - if (parseContext.isEsProfile()) - parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); - } - - $$ = $2; - - parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType); - parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier); - - for (unsigned int i = 0; i < $$->size(); ++i) { - TType type($1); - type.setFieldName((*$$)[i].type->getFieldName()); - type.transferArraySizes((*$$)[i].type->getArraySizes()); - type.copyArrayInnerSizes($1.arraySizes); - parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes()); - (*$$)[i].type->shallowCopy(type); - } - } - | type_qualifier type_specifier struct_declarator_list SEMICOLON { - if ($2.arraySizes) { - parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type"); - if (parseContext.isEsProfile()) - parseContext.arraySizeRequiredCheck($2.loc, *$2.arraySizes); - } - - $$ = $3; - - parseContext.memberQualifierCheck($1); - parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType); - parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); - parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier); - - for (unsigned int i = 0; i < $$->size(); ++i) { - TType type($2); - type.setFieldName((*$$)[i].type->getFieldName()); - type.transferArraySizes((*$$)[i].type->getArraySizes()); - type.copyArrayInnerSizes($2.arraySizes); - parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes()); - (*$$)[i].type->shallowCopy(type); - } - } - ; - -struct_declarator_list - : struct_declarator { - $$ = new TTypeList; - $$->push_back($1); - } - | struct_declarator_list COMMA struct_declarator { - $$->push_back($3); - } - ; - -struct_declarator - : IDENTIFIER { - $$.type = new TType(EbtVoid); - $$.loc = $1.loc; - $$.type->setFieldName(*$1.string); - } - | IDENTIFIER array_specifier { - parseContext.arrayOfArrayVersionCheck($1.loc, $2.arraySizes); - - $$.type = new TType(EbtVoid); - $$.loc = $1.loc; - $$.type->setFieldName(*$1.string); - $$.type->transferArraySizes($2.arraySizes); - } - ; - -initializer - : assignment_expression { - $$ = $1; - } -GLSLANG_WEB_EXCLUDE_ON - | LEFT_BRACE initializer_list RIGHT_BRACE { - const char* initFeature = "{ } style initializers"; - parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); - parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); - $$ = $2; - } - | LEFT_BRACE initializer_list COMMA RIGHT_BRACE { - const char* initFeature = "{ } style initializers"; - parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); - parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); - $$ = $2; - } - | LEFT_BRACE RIGHT_BRACE { - const char* initFeature = "empty { } initializer"; - parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); - parseContext.profileRequires($1.loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); - $$ = parseContext.intermediate.makeAggregate($1.loc); - } -GLSLANG_WEB_EXCLUDE_OFF - ; - -GLSLANG_WEB_EXCLUDE_ON -initializer_list - : initializer { - $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc()); - } - | initializer_list COMMA initializer { - $$ = parseContext.intermediate.growAggregate($1, $3); - } - ; -GLSLANG_WEB_EXCLUDE_OFF - -declaration_statement - : declaration { $$ = $1; } - ; - -statement - : compound_statement { $$ = $1; } - | simple_statement { $$ = $1; } - ; - -// Grammar Note: labeled statements for switch statements only; 'goto' is not supported. - -simple_statement - : declaration_statement { $$ = $1; } - | expression_statement { $$ = $1; } - | selection_statement { $$ = $1; } - | switch_statement { $$ = $1; } - | case_label { $$ = $1; } - | iteration_statement { $$ = $1; } - | jump_statement { $$ = $1; } -GLSLANG_WEB_EXCLUDE_ON - | demote_statement { $$ = $1; } -GLSLANG_WEB_EXCLUDE_OFF - ; - -GLSLANG_WEB_EXCLUDE_ON -demote_statement - : DEMOTE SEMICOLON { - parseContext.requireStage($1.loc, EShLangFragment, "demote"); - parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_demote_to_helper_invocation, "demote"); - $$ = parseContext.intermediate.addBranch(EOpDemote, $1.loc); - } - ; -GLSLANG_WEB_EXCLUDE_OFF - -compound_statement - : LEFT_BRACE RIGHT_BRACE { $$ = 0; } - | LEFT_BRACE { - parseContext.symbolTable.push(); - ++parseContext.statementNestingLevel; - } - statement_list { - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - --parseContext.statementNestingLevel; - } - RIGHT_BRACE { - if ($3 && $3->getAsAggregate()) - $3->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence); - $$ = $3; - } - ; - -statement_no_new_scope - : compound_statement_no_new_scope { $$ = $1; } - | simple_statement { $$ = $1; } - ; - -statement_scoped - : { - ++parseContext.controlFlowNestingLevel; - } - compound_statement { - --parseContext.controlFlowNestingLevel; - $$ = $2; - } - | { - parseContext.symbolTable.push(); - ++parseContext.statementNestingLevel; - ++parseContext.controlFlowNestingLevel; - } - simple_statement { - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - --parseContext.statementNestingLevel; - --parseContext.controlFlowNestingLevel; - $$ = $2; - } - -compound_statement_no_new_scope - // Statement that doesn't create a new scope, for selection_statement, iteration_statement - : LEFT_BRACE RIGHT_BRACE { - $$ = 0; - } - | LEFT_BRACE statement_list RIGHT_BRACE { - if ($2 && $2->getAsAggregate()) - $2->getAsAggregate()->setOperator(EOpSequence); - $$ = $2; - } - ; - -statement_list - : statement { - $$ = parseContext.intermediate.makeAggregate($1); - if ($1 && $1->getAsBranchNode() && ($1->getAsBranchNode()->getFlowOp() == EOpCase || - $1->getAsBranchNode()->getFlowOp() == EOpDefault)) { - parseContext.wrapupSwitchSubsequence(0, $1); - $$ = 0; // start a fresh subsequence for what's after this case - } - } - | statement_list statement { - if ($2 && $2->getAsBranchNode() && ($2->getAsBranchNode()->getFlowOp() == EOpCase || - $2->getAsBranchNode()->getFlowOp() == EOpDefault)) { - parseContext.wrapupSwitchSubsequence($1 ? $1->getAsAggregate() : 0, $2); - $$ = 0; // start a fresh subsequence for what's after this case - } else - $$ = parseContext.intermediate.growAggregate($1, $2); - } - ; - -expression_statement - : SEMICOLON { $$ = 0; } - | expression SEMICOLON { $$ = static_cast($1); } - ; - -selection_statement - : selection_statement_nonattributed { - $$ = $1; - } -GLSLANG_WEB_EXCLUDE_ON - | attribute selection_statement_nonattributed { - parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); - parseContext.handleSelectionAttributes(*$1, $2); - $$ = $2; - } -GLSLANG_WEB_EXCLUDE_OFF - -selection_statement_nonattributed - : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement { - parseContext.boolCheck($1.loc, $3); - $$ = parseContext.intermediate.addSelection($3, $5, $1.loc); - } - ; - -selection_rest_statement - : statement_scoped ELSE statement_scoped { - $$.node1 = $1; - $$.node2 = $3; - } - | statement_scoped { - $$.node1 = $1; - $$.node2 = 0; - } - ; - -condition - // In 1996 c++ draft, conditions can include single declarations - : expression { - $$ = $1; - parseContext.boolCheck($1->getLoc(), $1); - } - | fully_specified_type IDENTIFIER EQUAL initializer { - parseContext.boolCheck($2.loc, $1); - - TType type($1); - TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); - if (initNode) - $$ = initNode->getAsTyped(); - else - $$ = 0; - } - ; - -switch_statement - : switch_statement_nonattributed { - $$ = $1; - } -GLSLANG_WEB_EXCLUDE_ON - | attribute switch_statement_nonattributed { - parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); - parseContext.handleSwitchAttributes(*$1, $2); - $$ = $2; - } -GLSLANG_WEB_EXCLUDE_OFF - -switch_statement_nonattributed - : SWITCH LEFT_PAREN expression RIGHT_PAREN { - // start new switch sequence on the switch stack - ++parseContext.controlFlowNestingLevel; - ++parseContext.statementNestingLevel; - parseContext.switchSequenceStack.push_back(new TIntermSequence); - parseContext.switchLevel.push_back(parseContext.statementNestingLevel); - parseContext.symbolTable.push(); - } - LEFT_BRACE switch_statement_list RIGHT_BRACE { - $$ = parseContext.addSwitch($1.loc, $3, $7 ? $7->getAsAggregate() : 0); - delete parseContext.switchSequenceStack.back(); - parseContext.switchSequenceStack.pop_back(); - parseContext.switchLevel.pop_back(); - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - --parseContext.statementNestingLevel; - --parseContext.controlFlowNestingLevel; - } - ; - -switch_statement_list - : /* nothing */ { - $$ = 0; - } - | statement_list { - $$ = $1; - } - ; - -case_label - : CASE expression COLON { - $$ = 0; - if (parseContext.switchLevel.size() == 0) - parseContext.error($1.loc, "cannot appear outside switch statement", "case", ""); - else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) - parseContext.error($1.loc, "cannot be nested inside control flow", "case", ""); - else { - parseContext.constantValueCheck($2, "case"); - parseContext.integerCheck($2, "case"); - $$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc); - } - } - | DEFAULT COLON { - $$ = 0; - if (parseContext.switchLevel.size() == 0) - parseContext.error($1.loc, "cannot appear outside switch statement", "default", ""); - else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) - parseContext.error($1.loc, "cannot be nested inside control flow", "default", ""); - else - $$ = parseContext.intermediate.addBranch(EOpDefault, $1.loc); - } - ; - -iteration_statement - : iteration_statement_nonattributed { - $$ = $1; - } -GLSLANG_WEB_EXCLUDE_ON - | attribute iteration_statement_nonattributed { - parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); - parseContext.handleLoopAttributes(*$1, $2); - $$ = $2; - } -GLSLANG_WEB_EXCLUDE_OFF - -iteration_statement_nonattributed - : WHILE LEFT_PAREN { - if (! parseContext.limits.whileLoops) - parseContext.error($1.loc, "while loops not available", "limitation", ""); - parseContext.symbolTable.push(); - ++parseContext.loopNestingLevel; - ++parseContext.statementNestingLevel; - ++parseContext.controlFlowNestingLevel; - } - condition RIGHT_PAREN statement_no_new_scope { - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - $$ = parseContext.intermediate.addLoop($6, $4, 0, true, $1.loc); - --parseContext.loopNestingLevel; - --parseContext.statementNestingLevel; - --parseContext.controlFlowNestingLevel; - } - | DO { - parseContext.symbolTable.push(); - ++parseContext.loopNestingLevel; - ++parseContext.statementNestingLevel; - ++parseContext.controlFlowNestingLevel; - } - statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON { - if (! parseContext.limits.whileLoops) - parseContext.error($1.loc, "do-while loops not available", "limitation", ""); - - parseContext.boolCheck($8.loc, $6); - - $$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc); - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - --parseContext.loopNestingLevel; - --parseContext.statementNestingLevel; - --parseContext.controlFlowNestingLevel; - } - | FOR LEFT_PAREN { - parseContext.symbolTable.push(); - ++parseContext.loopNestingLevel; - ++parseContext.statementNestingLevel; - ++parseContext.controlFlowNestingLevel; - } - for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope { - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - $$ = parseContext.intermediate.makeAggregate($4, $2.loc); - TIntermLoop* forLoop = parseContext.intermediate.addLoop($7, reinterpret_cast($5.node1), reinterpret_cast($5.node2), true, $1.loc); - if (! parseContext.limits.nonInductiveForLoops) - parseContext.inductiveLoopCheck($1.loc, $4, forLoop); - $$ = parseContext.intermediate.growAggregate($$, forLoop, $1.loc); - $$->getAsAggregate()->setOperator(EOpSequence); - --parseContext.loopNestingLevel; - --parseContext.statementNestingLevel; - --parseContext.controlFlowNestingLevel; - } - ; - -for_init_statement - : expression_statement { - $$ = $1; - } - | declaration_statement { - $$ = $1; - } - ; - -conditionopt - : condition { - $$ = $1; - } - | /* May be null */ { - $$ = 0; - } - ; - -for_rest_statement - : conditionopt SEMICOLON { - $$.node1 = $1; - $$.node2 = 0; - } - | conditionopt SEMICOLON expression { - $$.node1 = $1; - $$.node2 = $3; - } - ; - -jump_statement - : CONTINUE SEMICOLON { - if (parseContext.loopNestingLevel <= 0) - parseContext.error($1.loc, "continue statement only allowed in loops", "", ""); - $$ = parseContext.intermediate.addBranch(EOpContinue, $1.loc); - } - | BREAK SEMICOLON { - if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0) - parseContext.error($1.loc, "break statement only allowed in switch and loops", "", ""); - $$ = parseContext.intermediate.addBranch(EOpBreak, $1.loc); - } - | RETURN SEMICOLON { - $$ = parseContext.intermediate.addBranch(EOpReturn, $1.loc); - if (parseContext.currentFunctionType->getBasicType() != EbtVoid) - parseContext.error($1.loc, "non-void function must return a value", "return", ""); - if (parseContext.inMain) - parseContext.postEntryPointReturn = true; - } - | RETURN expression SEMICOLON { - $$ = parseContext.handleReturnValue($1.loc, $2); - } - | DISCARD SEMICOLON { - parseContext.requireStage($1.loc, EShLangFragment, "discard"); - $$ = parseContext.intermediate.addBranch(EOpKill, $1.loc); - } - | TERMINATE_INVOCATION SEMICOLON { - parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation"); - $$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc); - } -GLSLANG_WEB_EXCLUDE_ON - | TERMINATE_RAY SEMICOLON { - parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT"); - $$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc); - } - | IGNORE_INTERSECTION SEMICOLON { - parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT"); - $$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc); - } -GLSLANG_WEB_EXCLUDE_OFF - ; - -// Grammar Note: No 'goto'. Gotos are not supported. - -translation_unit - : external_declaration { - $$ = $1; - parseContext.intermediate.setTreeRoot($$); - } - | translation_unit external_declaration { - if ($2 != nullptr) { - $$ = parseContext.intermediate.growAggregate($1, $2); - parseContext.intermediate.setTreeRoot($$); - } - } - ; - -external_declaration - : function_definition { - $$ = $1; - } - | declaration { - $$ = $1; - } -GLSLANG_WEB_EXCLUDE_ON - | SEMICOLON { - parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon"); - parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); - $$ = nullptr; - } -GLSLANG_WEB_EXCLUDE_OFF - ; - -function_definition - : function_prototype { - $1.function = parseContext.handleFunctionDeclarator($1.loc, *$1.function, false /* not prototype */); - $1.intermNode = parseContext.handleFunctionDefinition($1.loc, *$1.function); - - // For ES 100 only, according to ES shading language 100 spec: A function - // body has a scope nested inside the function's definition. - if (parseContext.profile == EEsProfile && parseContext.version == 100) - { - parseContext.symbolTable.push(); - ++parseContext.statementNestingLevel; - } - } - compound_statement_no_new_scope { - // May be best done as post process phase on intermediate code - if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) - parseContext.error($1.loc, "function does not return a value:", "", $1.function->getName().c_str()); - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - $$ = parseContext.intermediate.growAggregate($1.intermNode, $3); - parseContext.intermediate.setAggregateOperator($$, EOpFunction, $1.function->getType(), $1.loc); - $$->getAsAggregate()->setName($1.function->getMangledName().c_str()); - - // store the pragma information for debug and optimize and other vendor specific - // information. This information can be queried from the parse tree - $$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize); - $$->getAsAggregate()->setDebug(parseContext.contextPragma.debug); - $$->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable); - - // Set currentFunctionType to empty pointer when goes outside of the function - parseContext.currentFunctionType = nullptr; - - // For ES 100 only, according to ES shading language 100 spec: A function - // body has a scope nested inside the function's definition. - if (parseContext.profile == EEsProfile && parseContext.version == 100) - { - parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - --parseContext.statementNestingLevel; - } - } - ; - -GLSLANG_WEB_EXCLUDE_ON -attribute - : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET { - $$ = $3; - } - -attribute_list - : single_attribute { - $$ = $1; - } - | attribute_list COMMA single_attribute { - $$ = parseContext.mergeAttributes($1, $3); - } - -single_attribute - : IDENTIFIER { - $$ = parseContext.makeAttributes(*$1.string); - } - | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN { - $$ = parseContext.makeAttributes(*$1.string, $3); - } -GLSLANG_WEB_EXCLUDE_OFF - -GLSLANG_WEB_EXCLUDE_ON -spirv_requirements_list - : spirv_requirements_parameter { - $$ = $1; - } - | spirv_requirements_list COMMA spirv_requirements_parameter { - $$ = parseContext.mergeSpirvRequirements($2.loc, $1, $3); - } - -spirv_requirements_parameter - : IDENTIFIER EQUAL LEFT_BRACKET spirv_extension_list RIGHT_BRACKET { - $$ = parseContext.makeSpirvRequirement($2.loc, *$1.string, $4->getAsAggregate(), nullptr); - } - | IDENTIFIER EQUAL LEFT_BRACKET spirv_capability_list RIGHT_BRACKET { - $$ = parseContext.makeSpirvRequirement($2.loc, *$1.string, nullptr, $4->getAsAggregate()); - } - -spirv_extension_list - : STRING_LITERAL { - $$ = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion($1.string, $1.loc, true)); - } - | spirv_extension_list COMMA STRING_LITERAL { - $$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.string, $3.loc, true)); - } - -spirv_capability_list - : INTCONSTANT { - $$ = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion($1.i, $1.loc, true)); - } - | spirv_capability_list COMMA INTCONSTANT { - $$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.i, $3.loc, true)); - } - -spirv_execution_mode_qualifier - : SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT RIGHT_PAREN { - parseContext.intermediate.insertSpirvExecutionMode($3.i); - $$ = 0; - } - | SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN { - parseContext.intermediate.insertSpirvRequirement($3); - parseContext.intermediate.insertSpirvExecutionMode($5.i); - $$ = 0; - } - | SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN { - parseContext.intermediate.insertSpirvExecutionMode($3.i, $5->getAsAggregate()); - $$ = 0; - } - | SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN { - parseContext.intermediate.insertSpirvRequirement($3); - parseContext.intermediate.insertSpirvExecutionMode($5.i, $7->getAsAggregate()); - $$ = 0; - } - | SPIRV_EXECUTION_MODE_ID LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN { - parseContext.intermediate.insertSpirvExecutionModeId($3.i, $5->getAsAggregate()); - $$ = 0; - } - | SPIRV_EXECUTION_MODE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN { - parseContext.intermediate.insertSpirvRequirement($3); - parseContext.intermediate.insertSpirvExecutionModeId($5.i, $7->getAsAggregate()); - $$ = 0; - } - -spirv_execution_mode_parameter_list - : spirv_execution_mode_parameter { - $$ = parseContext.intermediate.makeAggregate($1); - } - | spirv_execution_mode_parameter_list COMMA spirv_execution_mode_parameter { - $$ = parseContext.intermediate.growAggregate($1, $3); - } - -spirv_execution_mode_parameter - : FLOATCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true); - } - | INTCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); - } - | UINTCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); - } - | BOOLCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); - } - | STRING_LITERAL { - $$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true); - } - -spirv_execution_mode_id_parameter_list - : constant_expression { - if ($1->getBasicType() != EbtFloat && - $1->getBasicType() != EbtInt && - $1->getBasicType() != EbtUint && - $1->getBasicType() != EbtBool && - $1->getBasicType() != EbtString) - parseContext.error($1->getLoc(), "this type not allowed", $1->getType().getBasicString(), ""); - $$ = parseContext.intermediate.makeAggregate($1); - } - | spirv_execution_mode_id_parameter_list COMMA constant_expression { - if ($3->getBasicType() != EbtFloat && - $3->getBasicType() != EbtInt && - $3->getBasicType() != EbtUint && - $3->getBasicType() != EbtBool && - $3->getBasicType() != EbtString) - parseContext.error($3->getLoc(), "this type not allowed", $3->getType().getBasicString(), ""); - $$ = parseContext.intermediate.growAggregate($1, $3); - } - -spirv_storage_class_qualifier - : SPIRV_STORAGE_CLASS LEFT_PAREN INTCONSTANT RIGHT_PAREN { - $$.init($1.loc); - $$.qualifier.storage = EvqSpirvStorageClass; - $$.qualifier.spirvStorageClass = $3.i; - } - | SPIRV_STORAGE_CLASS LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN { - $$.init($1.loc); - parseContext.intermediate.insertSpirvRequirement($3); - $$.qualifier.storage = EvqSpirvStorageClass; - $$.qualifier.spirvStorageClass = $5.i; - } - -spirv_decorate_qualifier - : SPIRV_DECORATE LEFT_PAREN INTCONSTANT RIGHT_PAREN{ - $$.init($1.loc); - $$.qualifier.setSpirvDecorate($3.i); - } - | SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN{ - $$.init($1.loc); - parseContext.intermediate.insertSpirvRequirement($3); - $$.qualifier.setSpirvDecorate($5.i); - } - | SPIRV_DECORATE LEFT_PAREN INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN { - $$.init($1.loc); - $$.qualifier.setSpirvDecorate($3.i, $5->getAsAggregate()); - } - | SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN { - $$.init($1.loc); - parseContext.intermediate.insertSpirvRequirement($3); - $$.qualifier.setSpirvDecorate($5.i, $7->getAsAggregate()); - } - | SPIRV_DECORATE_ID LEFT_PAREN INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN { - $$.init($1.loc); - $$.qualifier.setSpirvDecorateId($3.i, $5->getAsAggregate()); - } - | SPIRV_DECORATE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN { - $$.init($1.loc); - parseContext.intermediate.insertSpirvRequirement($3); - $$.qualifier.setSpirvDecorateId($5.i, $7->getAsAggregate()); - } - | SPIRV_DECORATE_STRING LEFT_PAREN INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN { - $$.init($1.loc); - $$.qualifier.setSpirvDecorateString($3.i, $5->getAsAggregate()); - } - | SPIRV_DECORATE_STRING LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN { - $$.init($1.loc); - parseContext.intermediate.insertSpirvRequirement($3); - $$.qualifier.setSpirvDecorateString($5.i, $7->getAsAggregate()); - } - -spirv_decorate_parameter_list - : spirv_decorate_parameter { - $$ = parseContext.intermediate.makeAggregate($1); - } - | spirv_decorate_parameter_list COMMA spirv_decorate_parameter { - $$ = parseContext.intermediate.growAggregate($1, $3); - } - -spirv_decorate_parameter - : FLOATCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true); - } - | INTCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); - } - | UINTCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); - } - | BOOLCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); - } - -spirv_decorate_id_parameter_list - : constant_expression { - if ($1->getBasicType() != EbtFloat && - $1->getBasicType() != EbtInt && - $1->getBasicType() != EbtUint && - $1->getBasicType() != EbtBool) - parseContext.error($1->getLoc(), "this type not allowed", $1->getType().getBasicString(), ""); - $$ = parseContext.intermediate.makeAggregate($1); - } - | spirv_decorate_id_parameter_list COMMA constant_expression { - if ($3->getBasicType() != EbtFloat && - $3->getBasicType() != EbtInt && - $3->getBasicType() != EbtUint && - $3->getBasicType() != EbtBool) - parseContext.error($3->getLoc(), "this type not allowed", $3->getType().getBasicString(), ""); - $$ = parseContext.intermediate.growAggregate($1, $3); - } - -spirv_decorate_string_parameter_list - : STRING_LITERAL { - $$ = parseContext.intermediate.makeAggregate( - parseContext.intermediate.addConstantUnion($1.string, $1.loc, true)); - } - | spirv_decorate_string_parameter_list COMMA STRING_LITERAL { - $$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.string, $3.loc, true)); - } - -spirv_type_specifier - : SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.setSpirvType(*$3, $5); - } - | SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - parseContext.intermediate.insertSpirvRequirement($3); - $$.setSpirvType(*$5, $7); - } - | SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.setSpirvType(*$3); - } - | SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - parseContext.intermediate.insertSpirvRequirement($3); - $$.setSpirvType(*$5); - } - -spirv_type_parameter_list - : spirv_type_parameter { - $$ = $1; - } - | spirv_type_parameter_list COMMA spirv_type_parameter { - $$ = parseContext.mergeSpirvTypeParameters($1, $3); - } - -spirv_type_parameter - : constant_expression { - $$ = parseContext.makeSpirvTypeParameters($1->getLoc(), $1->getAsConstantUnion()); - } - -spirv_instruction_qualifier - : SPIRV_INSTRUCTION LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN { - $$ = $3; - } - | SPIRV_INSTRUCTION LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN { - parseContext.intermediate.insertSpirvRequirement($3); - $$ = $5; - } - -spirv_instruction_qualifier_list - : spirv_instruction_qualifier_id { - $$ = $1; - } - | spirv_instruction_qualifier_list COMMA spirv_instruction_qualifier_id { - $$ = parseContext.mergeSpirvInstruction($2.loc, $1, $3); - } - -spirv_instruction_qualifier_id - : IDENTIFIER EQUAL STRING_LITERAL { - $$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, *$3.string); - } - | IDENTIFIER EQUAL INTCONSTANT { - $$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, $3.i); - } -GLSLANG_WEB_EXCLUDE_OFF - -%% diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.y b/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.y index 35242f21..d47f2925 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.y +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.y @@ -37,31 +37,6 @@ // POSSIBILITY OF SUCH DAMAGE. // -// -// Do not edit the .y file, only edit the .m4 file. -// The .y bison file is not a source file, it is a derivative of the .m4 file. -// The m4 file needs to be processed by m4 to generate the .y bison file. -// -// Code sandwiched between a pair: -// -// GLSLANG_WEB_EXCLUDE_ON -// ... -// ... -// ... -// GLSLANG_WEB_EXCLUDE_OFF -// -// Will be excluded from the grammar when m4 is executed as: -// -// m4 -P -DGLSLANG_WEB -// -// It will be included when m4 is executed as: -// -// m4 -P -// - - - - /** * This is bison grammar and productions for parsing all versions of the * GLSL shading languages. @@ -129,7 +104,7 @@ using namespace glslang; glslang::TArraySizes* arraySizes; glslang::TIdentifierList* identifierList; }; - glslang::TArraySizes* typeParameters; + glslang::TTypeParameters* typeParameters; } interm; } @@ -151,7 +126,7 @@ extern int yylex(YYSTYPE*, TParseContext&); %parse-param {glslang::TParseContext* pParseContext} %lex-param {parseContext} -%define api.pure // enable thread safety +%pure-parser // enable thread safety %expect 1 // One shift reduce conflict because of if | else %token CONST BOOL INT UINT FLOAT @@ -177,8 +152,6 @@ extern int yylex(YYSTYPE*, TParseContext&); %token ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY %token UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY - - %token ATTRIBUTE VARYING %token FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T %token INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T @@ -211,6 +184,8 @@ extern int yylex(YYSTYPE*, TParseContext&); %token ACCSTRUCTEXT %token RAYQUERYEXT %token FCOOPMATNV ICOOPMATNV UCOOPMATNV +%token COOPMAT +%token HITOBJECTNV HITOBJECTATTRNV // combined image/sampler %token SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW @@ -278,8 +253,7 @@ extern int yylex(YYSTYPE*, TParseContext&); %token SPIRV_INSTRUCTION SPIRV_EXECUTION_MODE SPIRV_EXECUTION_MODE_ID %token SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING %token SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL - - +%token ATTACHMENTEXT IATTACHMENTEXT UATTACHMENTEXT %token LEFT_OP RIGHT_OP %token INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP @@ -303,14 +277,13 @@ extern int yylex(YYSTYPE*, TParseContext&); %token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT %token TERMINATE_INVOCATION %token TERMINATE_RAY IGNORE_INTERSECTION -%token UNIFORM SHARED BUFFER +%token UNIFORM SHARED BUFFER TILEIMAGEEXT %token FLAT SMOOTH LAYOUT - %token DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT %token INT64CONSTANT UINT64CONSTANT %token SUBROUTINE DEMOTE -%token PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV +%token PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV %token PAYLOADEXT PAYLOADINEXT HITATTREXT CALLDATAEXT CALLDATAINEXT %token PATCH SAMPLE NONUNIFORM %token COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT @@ -318,7 +291,6 @@ extern int yylex(YYSTYPE*, TParseContext&); %token NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV PERPRIMITIVEEXT TASKPAYLOADWORKGROUPEXT %token PRECISE - %type assignment_operator unary_operator %type variable_identifier primary_expression postfix_expression %type expression integer_expression assignment_expression @@ -364,7 +336,6 @@ extern int yylex(YYSTYPE*, TParseContext&); %type identifier_list - %type precise_qualifier non_uniform_qualifier %type type_name_list %type attribute attribute_list single_attribute @@ -377,14 +348,13 @@ extern int yylex(YYSTYPE*, TParseContext&); %type spirv_storage_class_qualifier %type spirv_decorate_qualifier %type spirv_decorate_parameter_list spirv_decorate_parameter -%type spirv_decorate_id_parameter_list +%type spirv_decorate_id_parameter_list spirv_decorate_id_parameter %type spirv_decorate_string_parameter_list %type spirv_type_specifier %type spirv_type_parameter_list spirv_type_parameter %type spirv_instruction_qualifier %type spirv_instruction_qualifier_list spirv_instruction_qualifier_id - %start translation_unit %% @@ -416,7 +386,6 @@ primary_expression | BOOLCONSTANT { $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); } - | STRING_LITERAL { $$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true); } @@ -454,7 +423,6 @@ primary_expression parseContext.float16Check($1.loc, "half float literal"); $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true); } - ; postfix_expression @@ -580,13 +548,11 @@ function_identifier $$.function = new TFunction(empty, TType(EbtVoid), EOpNull); } } - | non_uniform_qualifier { // Constructor $$.intermNode = 0; $$.function = parseContext.handleConstructorCall($1.loc, $1); } - ; unary_expression @@ -896,7 +862,6 @@ declaration $$ = 0; // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature } - | spirv_instruction_qualifier function_prototype SEMICOLON { parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier"); $2.function->setSpirvInstruction(*$1); // Attach SPIR-V intruction qualifier @@ -909,7 +874,6 @@ declaration parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier"); $$ = 0; } - | init_declarator_list SEMICOLON { if ($1.intermNode && $1.intermNode->getAsAggregate()) $1.intermNode->getAsAggregate()->setOperator(EOpSequence); @@ -1106,7 +1070,7 @@ parameter_declaration $$ = $2; if ($1.qualifier.precision != EpqNone) $$.param.type->getQualifier().precision = $1.qualifier.precision; - parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); + parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMat()); parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type); @@ -1118,7 +1082,7 @@ parameter_declaration parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type); parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type); - parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); + parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMat()); } // // Without name @@ -1127,7 +1091,7 @@ parameter_declaration $$ = $2; if ($1.qualifier.precision != EpqNone) $$.param.type->getQualifier().precision = $1.qualifier.precision; - parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); + parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMat()); parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type); @@ -1138,7 +1102,7 @@ parameter_declaration parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type); parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type); - parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); + parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier(), $$.param.type->isCoopMat()); } ; @@ -1179,9 +1143,7 @@ single_declaration : fully_specified_type { $$.type = $1; $$.intermNode = 0; - parseContext.declareTypeDefaults($$.loc, $$.type); - } | fully_specified_type IDENTIFIER { $$.type = $1; @@ -1215,10 +1177,10 @@ fully_specified_type parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); } - parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier); + parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier, $$.isCoopmat()); } | type_qualifier type_specifier { - parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); + parseContext.globalQualifierFixCheck($1.loc, $1.qualifier, false, &$2); parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2); if ($2.arraySizes) { @@ -1232,7 +1194,7 @@ fully_specified_type parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers); $2.shaderQualifiers.merge($1.shaderQualifiers); parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); - parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier); + parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier, $2.isCoopmat()); $$ = $2; @@ -1267,7 +1229,6 @@ interpolation_qualifier $$.init($1.loc); $$.qualifier.flat = true; } - | NOPERSPECTIVE { parseContext.globalCheck($1.loc, "noperspective"); parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); @@ -1332,7 +1293,6 @@ interpolation_qualifier $$.init($1.loc); $$.qualifier.perTaskNV = true; } - ; layout_qualifier @@ -1367,7 +1327,6 @@ layout_qualifier_id } ; - precise_qualifier : PRECISE { parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); @@ -1377,7 +1336,6 @@ precise_qualifier } ; - type_qualifier : single_type_qualifier { $$ = $1; @@ -1411,7 +1369,6 @@ single_type_qualifier // allow inheritance of storage qualifier from block declaration $$ = $1; } - | precise_qualifier { // allow inheritance of storage qualifier from block declaration $$ = $1; @@ -1438,7 +1395,6 @@ single_type_qualifier $$.init($1.loc); $$.qualifier.setSpirvLiteral(); } - ; storage_qualifier @@ -1475,6 +1431,11 @@ storage_qualifier $$.init($1.loc); $$.qualifier.storage = EvqUniform; } + | TILEIMAGEEXT { + parseContext.globalCheck($1.loc, "tileImageEXT"); + $$.init($1.loc); + $$.qualifier.storage = EvqTileImageEXT; + } | SHARED { parseContext.globalCheck($1.loc, "shared"); parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); @@ -1488,7 +1449,6 @@ storage_qualifier $$.init($1.loc); $$.qualifier.storage = EvqBuffer; } - | ATTRIBUTE { parseContext.requireStage($1.loc, EShLangVertex, "attribute"); parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute"); @@ -1534,6 +1494,14 @@ storage_qualifier $$.init($1.loc); $$.qualifier.storage = EvqHitAttr; } + | HITOBJECTATTRNV { + parseContext.globalCheck($1.loc, "hitAttributeNV"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask + | EShLangMissMask), "hitObjectAttributeNV"); + parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_shader_invocation_reorder, "hitObjectAttributeNV"); + $$.init($1.loc); + $$.qualifier.storage = EvqHitObjectAttrNV; + } | HITATTREXT { parseContext.globalCheck($1.loc, "hitAttributeEXT"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask @@ -1673,10 +1641,8 @@ storage_qualifier $$.init($1.loc); $$.qualifier.storage = EvqtaskPayloadSharedEXT; } - ; - non_uniform_qualifier : NONUNIFORM { $$.init($1.loc); @@ -1695,12 +1661,13 @@ type_name_list } ; - type_specifier : type_specifier_nonarray type_parameter_specifier_opt { $$ = $1; $$.qualifier.precision = parseContext.getDefaultPrecision($$); $$.typeParameters = $2; + parseContext.coopMatTypeParametersCheck($1.loc, $$); + } | type_specifier_nonarray type_parameter_specifier_opt array_specifier { parseContext.arrayOfArrayVersionCheck($3.loc, $3.arraySizes); @@ -1708,6 +1675,7 @@ type_specifier $$.qualifier.precision = parseContext.getDefaultPrecision($$); $$.typeParameters = $2; $$.arraySizes = $3.arraySizes; + parseContext.coopMatTypeParametersCheck($1.loc, $$); } ; @@ -1754,19 +1722,25 @@ type_parameter_specifier ; type_parameter_specifier_list - : unary_expression { - $$ = new TArraySizes; + : type_specifier { + $$ = new TTypeParameters; + $$->arraySizes = new TArraySizes; + $$->basicType = $1.basicType; + } + | unary_expression { + $$ = new TTypeParameters; + $$->arraySizes = new TArraySizes; TArraySize size; - parseContext.arraySizeCheck($1->getLoc(), $1, size, "type parameter"); - $$->addInnerSize(size); + parseContext.arraySizeCheck($1->getLoc(), $1, size, "type parameter", true); + $$->arraySizes->addInnerSize(size); } | type_parameter_specifier_list COMMA unary_expression { $$ = $1; TArraySize size; - parseContext.arraySizeCheck($3->getLoc(), $3, size, "type parameter"); - $$->addInnerSize(size); + parseContext.arraySizeCheck($3->getLoc(), $3, size, "type parameter", true); + $$->arraySizes->addInnerSize(size); } ; @@ -1915,7 +1889,6 @@ type_specifier_nonarray $$.basicType = EbtFloat; $$.setMatrix(4, 4); } - | DOUBLE { parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -2534,7 +2507,6 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, Esd1D); } - | SAMPLER2D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2570,7 +2542,6 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, Esd2D, true, true); } - | SAMPLER1DSHADOW { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2679,7 +2650,6 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtInt, Esd1D); } - | ISAMPLER2D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2715,7 +2685,6 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtUint, EsdCube); } - | ISAMPLER1DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2756,7 +2725,6 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setTexture(EbtUint, EsdCube, true); } - | USAMPLER2DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2832,7 +2800,6 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setPureSampler(true); } - | SAMPLER2DRECT { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -3437,6 +3404,24 @@ type_specifier_nonarray $$.sampler.set(EbtFloat, Esd2D); $$.sampler.yuv = true; } + | ATTACHMENTEXT { + parseContext.requireStage($1.loc, EShLangFragment, "attachmentEXT input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setAttachmentEXT(EbtFloat); + } + | IATTACHMENTEXT { + parseContext.requireStage($1.loc, EShLangFragment, "attachmentEXT input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setAttachmentEXT(EbtInt); + } + | UATTACHMENTEXT { + parseContext.requireStage($1.loc, EShLangFragment, "attachmentEXT input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setAttachmentEXT(EbtUint); + } | SUBPASSINPUT { parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -3488,28 +3473,41 @@ type_specifier_nonarray $$.sampler.setSubpass(EbtUint, true); } | FCOOPMATNV { - parseContext.fcoopmatCheck($1.loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + parseContext.fcoopmatCheckNV($1.loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat; - $$.coopmat = true; + $$.coopmatNV = true; + $$.coopmatKHR = false; } | ICOOPMATNV { - parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + parseContext.intcoopmatCheckNV($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtInt; - $$.coopmat = true; + $$.coopmatNV = true; + $$.coopmatKHR = false; } | UCOOPMATNV { - parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + parseContext.intcoopmatCheckNV($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtUint; - $$.coopmat = true; + $$.coopmatNV = true; + $$.coopmatKHR = false; + } + | COOPMAT { + parseContext.coopmatCheck($1.loc, "coopmat", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtCoopmat; + $$.coopmatNV = false; + $$.coopmatKHR = true; } | spirv_type_specifier { parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier"); $$ = $1; } - + | HITOBJECTNV { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtHitObjectNV; + } | struct_specifier { $$ = $1; $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; @@ -3597,7 +3595,7 @@ struct_declaration $$ = $2; parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType); - parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier); + parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier, $1.isCoopmat()); for (unsigned int i = 0; i < $$->size(); ++i) { TType type($1); @@ -3621,7 +3619,7 @@ struct_declaration parseContext.memberQualifierCheck($1); parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType); parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); - parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier); + parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier, $2.isCoopmat()); for (unsigned int i = 0; i < $$->size(); ++i) { TType type($2); @@ -3664,7 +3662,6 @@ initializer : assignment_expression { $$ = $1; } - | LEFT_BRACE initializer_list RIGHT_BRACE { const char* initFeature = "{ } style initializers"; parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); @@ -3683,10 +3680,8 @@ initializer parseContext.profileRequires($1.loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); $$ = parseContext.intermediate.makeAggregate($1.loc); } - ; - initializer_list : initializer { $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc()); @@ -3696,7 +3691,6 @@ initializer_list } ; - declaration_statement : declaration { $$ = $1; } ; @@ -3716,12 +3710,9 @@ simple_statement | case_label { $$ = $1; } | iteration_statement { $$ = $1; } | jump_statement { $$ = $1; } - | demote_statement { $$ = $1; } - ; - demote_statement : DEMOTE SEMICOLON { parseContext.requireStage($1.loc, EShLangFragment, "demote"); @@ -3730,7 +3721,6 @@ demote_statement } ; - compound_statement : LEFT_BRACE RIGHT_BRACE { $$ = 0; } | LEFT_BRACE { @@ -3813,14 +3803,12 @@ selection_statement : selection_statement_nonattributed { $$ = $1; } - | attribute selection_statement_nonattributed { parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.handleSelectionAttributes(*$1, $2); $$ = $2; } - selection_statement_nonattributed : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement { parseContext.boolCheck($1.loc, $3); @@ -3861,14 +3849,12 @@ switch_statement : switch_statement_nonattributed { $$ = $1; } - | attribute switch_statement_nonattributed { parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.handleSwitchAttributes(*$1, $2); $$ = $2; } - switch_statement_nonattributed : SWITCH LEFT_PAREN expression RIGHT_PAREN { // start new switch sequence on the switch stack @@ -3926,14 +3912,12 @@ iteration_statement : iteration_statement_nonattributed { $$ = $1; } - | attribute iteration_statement_nonattributed { parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.handleLoopAttributes(*$1, $2); $$ = $2; } - iteration_statement_nonattributed : WHILE LEFT_PAREN { if (! parseContext.limits.whileLoops) @@ -4046,7 +4030,6 @@ jump_statement parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation"); $$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc); } - | TERMINATE_RAY SEMICOLON { parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT"); $$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc); @@ -4055,7 +4038,6 @@ jump_statement parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT"); $$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc); } - ; // Grammar Note: No 'goto'. Gotos are not supported. @@ -4080,13 +4062,11 @@ external_declaration | declaration { $$ = $1; } - | SEMICOLON { parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon"); parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); $$ = nullptr; } - ; function_definition @@ -4130,7 +4110,6 @@ function_definition } ; - attribute : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET { $$ = $3; @@ -4152,8 +4131,6 @@ single_attribute $$ = parseContext.makeAttributes(*$1.string, $3); } - - spirv_requirements_list : spirv_requirements_parameter { $$ = $1; @@ -4334,23 +4311,33 @@ spirv_decorate_parameter } spirv_decorate_id_parameter_list - : constant_expression { - if ($1->getBasicType() != EbtFloat && - $1->getBasicType() != EbtInt && - $1->getBasicType() != EbtUint && - $1->getBasicType() != EbtBool) - parseContext.error($1->getLoc(), "this type not allowed", $1->getType().getBasicString(), ""); + : spirv_decorate_id_parameter { $$ = parseContext.intermediate.makeAggregate($1); } - | spirv_decorate_id_parameter_list COMMA constant_expression { - if ($3->getBasicType() != EbtFloat && - $3->getBasicType() != EbtInt && - $3->getBasicType() != EbtUint && - $3->getBasicType() != EbtBool) - parseContext.error($3->getLoc(), "this type not allowed", $3->getType().getBasicString(), ""); + | spirv_decorate_id_parameter_list COMMA spirv_decorate_id_parameter { $$ = parseContext.intermediate.growAggregate($1, $3); } +spirv_decorate_id_parameter + : variable_identifier { + if ($1->getAsConstantUnion() || $1->getAsSymbolNode()) + $$ = $1; + else + parseContext.error($1->getLoc(), "only allow constants or variables which are not elements of a composite", "", ""); + } + | FLOATCONSTANT { + $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true); + } + | INTCONSTANT { + $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); + } + | UINTCONSTANT { + $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); + } + | BOOLCONSTANT { + $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); + } + spirv_decorate_string_parameter_list : STRING_LITERAL { $$ = parseContext.intermediate.makeAggregate( @@ -4392,6 +4379,9 @@ spirv_type_parameter : constant_expression { $$ = parseContext.makeSpirvTypeParameters($1->getLoc(), $1->getAsConstantUnion()); } + | type_specifier_nonarray { + $$ = parseContext.makeSpirvTypeParameters($1.loc, $1); + } spirv_instruction_qualifier : SPIRV_INSTRUCTION LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN { @@ -4418,5 +4408,4 @@ spirv_instruction_qualifier_id $$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, $3.i); } - %% diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp index 7ca3e711..a265abc8 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.7.4. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -46,10 +46,10 @@ USER NAME SPACE" below. */ /* Identify Bison output, and Bison version. */ -#define YYBISON 30704 +#define YYBISON 30802 /* Bison version string. */ -#define YYBISON_VERSION "3.7.4" +#define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -287,429 +287,437 @@ enum yysymbol_kind_t YYSYMBOL_FCOOPMATNV = 163, /* FCOOPMATNV */ YYSYMBOL_ICOOPMATNV = 164, /* ICOOPMATNV */ YYSYMBOL_UCOOPMATNV = 165, /* UCOOPMATNV */ - YYSYMBOL_SAMPLERCUBEARRAY = 166, /* SAMPLERCUBEARRAY */ - YYSYMBOL_SAMPLERCUBEARRAYSHADOW = 167, /* SAMPLERCUBEARRAYSHADOW */ - YYSYMBOL_ISAMPLERCUBEARRAY = 168, /* ISAMPLERCUBEARRAY */ - YYSYMBOL_USAMPLERCUBEARRAY = 169, /* USAMPLERCUBEARRAY */ - YYSYMBOL_SAMPLER1D = 170, /* SAMPLER1D */ - YYSYMBOL_SAMPLER1DARRAY = 171, /* SAMPLER1DARRAY */ - YYSYMBOL_SAMPLER1DARRAYSHADOW = 172, /* SAMPLER1DARRAYSHADOW */ - YYSYMBOL_ISAMPLER1D = 173, /* ISAMPLER1D */ - YYSYMBOL_SAMPLER1DSHADOW = 174, /* SAMPLER1DSHADOW */ - YYSYMBOL_SAMPLER2DRECT = 175, /* SAMPLER2DRECT */ - YYSYMBOL_SAMPLER2DRECTSHADOW = 176, /* SAMPLER2DRECTSHADOW */ - YYSYMBOL_ISAMPLER2DRECT = 177, /* ISAMPLER2DRECT */ - YYSYMBOL_USAMPLER2DRECT = 178, /* USAMPLER2DRECT */ - YYSYMBOL_SAMPLERBUFFER = 179, /* SAMPLERBUFFER */ - YYSYMBOL_ISAMPLERBUFFER = 180, /* ISAMPLERBUFFER */ - YYSYMBOL_USAMPLERBUFFER = 181, /* USAMPLERBUFFER */ - YYSYMBOL_SAMPLER2DMS = 182, /* SAMPLER2DMS */ - YYSYMBOL_ISAMPLER2DMS = 183, /* ISAMPLER2DMS */ - YYSYMBOL_USAMPLER2DMS = 184, /* USAMPLER2DMS */ - YYSYMBOL_SAMPLER2DMSARRAY = 185, /* SAMPLER2DMSARRAY */ - YYSYMBOL_ISAMPLER2DMSARRAY = 186, /* ISAMPLER2DMSARRAY */ - YYSYMBOL_USAMPLER2DMSARRAY = 187, /* USAMPLER2DMSARRAY */ - YYSYMBOL_SAMPLEREXTERNALOES = 188, /* SAMPLEREXTERNALOES */ - YYSYMBOL_SAMPLEREXTERNAL2DY2YEXT = 189, /* SAMPLEREXTERNAL2DY2YEXT */ - YYSYMBOL_ISAMPLER1DARRAY = 190, /* ISAMPLER1DARRAY */ - YYSYMBOL_USAMPLER1D = 191, /* USAMPLER1D */ - YYSYMBOL_USAMPLER1DARRAY = 192, /* USAMPLER1DARRAY */ - YYSYMBOL_F16SAMPLER1D = 193, /* F16SAMPLER1D */ - YYSYMBOL_F16SAMPLER2D = 194, /* F16SAMPLER2D */ - YYSYMBOL_F16SAMPLER3D = 195, /* F16SAMPLER3D */ - YYSYMBOL_F16SAMPLER2DRECT = 196, /* F16SAMPLER2DRECT */ - YYSYMBOL_F16SAMPLERCUBE = 197, /* F16SAMPLERCUBE */ - YYSYMBOL_F16SAMPLER1DARRAY = 198, /* F16SAMPLER1DARRAY */ - YYSYMBOL_F16SAMPLER2DARRAY = 199, /* F16SAMPLER2DARRAY */ - YYSYMBOL_F16SAMPLERCUBEARRAY = 200, /* F16SAMPLERCUBEARRAY */ - YYSYMBOL_F16SAMPLERBUFFER = 201, /* F16SAMPLERBUFFER */ - YYSYMBOL_F16SAMPLER2DMS = 202, /* F16SAMPLER2DMS */ - YYSYMBOL_F16SAMPLER2DMSARRAY = 203, /* F16SAMPLER2DMSARRAY */ - YYSYMBOL_F16SAMPLER1DSHADOW = 204, /* F16SAMPLER1DSHADOW */ - YYSYMBOL_F16SAMPLER2DSHADOW = 205, /* F16SAMPLER2DSHADOW */ - YYSYMBOL_F16SAMPLER1DARRAYSHADOW = 206, /* F16SAMPLER1DARRAYSHADOW */ - YYSYMBOL_F16SAMPLER2DARRAYSHADOW = 207, /* F16SAMPLER2DARRAYSHADOW */ - YYSYMBOL_F16SAMPLER2DRECTSHADOW = 208, /* F16SAMPLER2DRECTSHADOW */ - YYSYMBOL_F16SAMPLERCUBESHADOW = 209, /* F16SAMPLERCUBESHADOW */ - YYSYMBOL_F16SAMPLERCUBEARRAYSHADOW = 210, /* F16SAMPLERCUBEARRAYSHADOW */ - YYSYMBOL_IMAGE1D = 211, /* IMAGE1D */ - YYSYMBOL_IIMAGE1D = 212, /* IIMAGE1D */ - YYSYMBOL_UIMAGE1D = 213, /* UIMAGE1D */ - YYSYMBOL_IMAGE2D = 214, /* IMAGE2D */ - YYSYMBOL_IIMAGE2D = 215, /* IIMAGE2D */ - YYSYMBOL_UIMAGE2D = 216, /* UIMAGE2D */ - YYSYMBOL_IMAGE3D = 217, /* IMAGE3D */ - YYSYMBOL_IIMAGE3D = 218, /* IIMAGE3D */ - YYSYMBOL_UIMAGE3D = 219, /* UIMAGE3D */ - YYSYMBOL_IMAGE2DRECT = 220, /* IMAGE2DRECT */ - YYSYMBOL_IIMAGE2DRECT = 221, /* IIMAGE2DRECT */ - YYSYMBOL_UIMAGE2DRECT = 222, /* UIMAGE2DRECT */ - YYSYMBOL_IMAGECUBE = 223, /* IMAGECUBE */ - YYSYMBOL_IIMAGECUBE = 224, /* IIMAGECUBE */ - YYSYMBOL_UIMAGECUBE = 225, /* UIMAGECUBE */ - YYSYMBOL_IMAGEBUFFER = 226, /* IMAGEBUFFER */ - YYSYMBOL_IIMAGEBUFFER = 227, /* IIMAGEBUFFER */ - YYSYMBOL_UIMAGEBUFFER = 228, /* UIMAGEBUFFER */ - YYSYMBOL_IMAGE1DARRAY = 229, /* IMAGE1DARRAY */ - YYSYMBOL_IIMAGE1DARRAY = 230, /* IIMAGE1DARRAY */ - YYSYMBOL_UIMAGE1DARRAY = 231, /* UIMAGE1DARRAY */ - YYSYMBOL_IMAGE2DARRAY = 232, /* IMAGE2DARRAY */ - YYSYMBOL_IIMAGE2DARRAY = 233, /* IIMAGE2DARRAY */ - YYSYMBOL_UIMAGE2DARRAY = 234, /* UIMAGE2DARRAY */ - YYSYMBOL_IMAGECUBEARRAY = 235, /* IMAGECUBEARRAY */ - YYSYMBOL_IIMAGECUBEARRAY = 236, /* IIMAGECUBEARRAY */ - YYSYMBOL_UIMAGECUBEARRAY = 237, /* UIMAGECUBEARRAY */ - YYSYMBOL_IMAGE2DMS = 238, /* IMAGE2DMS */ - YYSYMBOL_IIMAGE2DMS = 239, /* IIMAGE2DMS */ - YYSYMBOL_UIMAGE2DMS = 240, /* UIMAGE2DMS */ - YYSYMBOL_IMAGE2DMSARRAY = 241, /* IMAGE2DMSARRAY */ - YYSYMBOL_IIMAGE2DMSARRAY = 242, /* IIMAGE2DMSARRAY */ - YYSYMBOL_UIMAGE2DMSARRAY = 243, /* UIMAGE2DMSARRAY */ - YYSYMBOL_F16IMAGE1D = 244, /* F16IMAGE1D */ - YYSYMBOL_F16IMAGE2D = 245, /* F16IMAGE2D */ - YYSYMBOL_F16IMAGE3D = 246, /* F16IMAGE3D */ - YYSYMBOL_F16IMAGE2DRECT = 247, /* F16IMAGE2DRECT */ - YYSYMBOL_F16IMAGECUBE = 248, /* F16IMAGECUBE */ - YYSYMBOL_F16IMAGE1DARRAY = 249, /* F16IMAGE1DARRAY */ - YYSYMBOL_F16IMAGE2DARRAY = 250, /* F16IMAGE2DARRAY */ - YYSYMBOL_F16IMAGECUBEARRAY = 251, /* F16IMAGECUBEARRAY */ - YYSYMBOL_F16IMAGEBUFFER = 252, /* F16IMAGEBUFFER */ - YYSYMBOL_F16IMAGE2DMS = 253, /* F16IMAGE2DMS */ - YYSYMBOL_F16IMAGE2DMSARRAY = 254, /* F16IMAGE2DMSARRAY */ - YYSYMBOL_I64IMAGE1D = 255, /* I64IMAGE1D */ - YYSYMBOL_U64IMAGE1D = 256, /* U64IMAGE1D */ - YYSYMBOL_I64IMAGE2D = 257, /* I64IMAGE2D */ - YYSYMBOL_U64IMAGE2D = 258, /* U64IMAGE2D */ - YYSYMBOL_I64IMAGE3D = 259, /* I64IMAGE3D */ - YYSYMBOL_U64IMAGE3D = 260, /* U64IMAGE3D */ - YYSYMBOL_I64IMAGE2DRECT = 261, /* I64IMAGE2DRECT */ - YYSYMBOL_U64IMAGE2DRECT = 262, /* U64IMAGE2DRECT */ - YYSYMBOL_I64IMAGECUBE = 263, /* I64IMAGECUBE */ - YYSYMBOL_U64IMAGECUBE = 264, /* U64IMAGECUBE */ - YYSYMBOL_I64IMAGEBUFFER = 265, /* I64IMAGEBUFFER */ - YYSYMBOL_U64IMAGEBUFFER = 266, /* U64IMAGEBUFFER */ - YYSYMBOL_I64IMAGE1DARRAY = 267, /* I64IMAGE1DARRAY */ - YYSYMBOL_U64IMAGE1DARRAY = 268, /* U64IMAGE1DARRAY */ - YYSYMBOL_I64IMAGE2DARRAY = 269, /* I64IMAGE2DARRAY */ - YYSYMBOL_U64IMAGE2DARRAY = 270, /* U64IMAGE2DARRAY */ - YYSYMBOL_I64IMAGECUBEARRAY = 271, /* I64IMAGECUBEARRAY */ - YYSYMBOL_U64IMAGECUBEARRAY = 272, /* U64IMAGECUBEARRAY */ - YYSYMBOL_I64IMAGE2DMS = 273, /* I64IMAGE2DMS */ - YYSYMBOL_U64IMAGE2DMS = 274, /* U64IMAGE2DMS */ - YYSYMBOL_I64IMAGE2DMSARRAY = 275, /* I64IMAGE2DMSARRAY */ - YYSYMBOL_U64IMAGE2DMSARRAY = 276, /* U64IMAGE2DMSARRAY */ - YYSYMBOL_TEXTURECUBEARRAY = 277, /* TEXTURECUBEARRAY */ - YYSYMBOL_ITEXTURECUBEARRAY = 278, /* ITEXTURECUBEARRAY */ - YYSYMBOL_UTEXTURECUBEARRAY = 279, /* UTEXTURECUBEARRAY */ - YYSYMBOL_TEXTURE1D = 280, /* TEXTURE1D */ - YYSYMBOL_ITEXTURE1D = 281, /* ITEXTURE1D */ - YYSYMBOL_UTEXTURE1D = 282, /* UTEXTURE1D */ - YYSYMBOL_TEXTURE1DARRAY = 283, /* TEXTURE1DARRAY */ - YYSYMBOL_ITEXTURE1DARRAY = 284, /* ITEXTURE1DARRAY */ - YYSYMBOL_UTEXTURE1DARRAY = 285, /* UTEXTURE1DARRAY */ - YYSYMBOL_TEXTURE2DRECT = 286, /* TEXTURE2DRECT */ - YYSYMBOL_ITEXTURE2DRECT = 287, /* ITEXTURE2DRECT */ - YYSYMBOL_UTEXTURE2DRECT = 288, /* UTEXTURE2DRECT */ - YYSYMBOL_TEXTUREBUFFER = 289, /* TEXTUREBUFFER */ - YYSYMBOL_ITEXTUREBUFFER = 290, /* ITEXTUREBUFFER */ - YYSYMBOL_UTEXTUREBUFFER = 291, /* UTEXTUREBUFFER */ - YYSYMBOL_TEXTURE2DMS = 292, /* TEXTURE2DMS */ - YYSYMBOL_ITEXTURE2DMS = 293, /* ITEXTURE2DMS */ - YYSYMBOL_UTEXTURE2DMS = 294, /* UTEXTURE2DMS */ - YYSYMBOL_TEXTURE2DMSARRAY = 295, /* TEXTURE2DMSARRAY */ - YYSYMBOL_ITEXTURE2DMSARRAY = 296, /* ITEXTURE2DMSARRAY */ - YYSYMBOL_UTEXTURE2DMSARRAY = 297, /* UTEXTURE2DMSARRAY */ - YYSYMBOL_F16TEXTURE1D = 298, /* F16TEXTURE1D */ - YYSYMBOL_F16TEXTURE2D = 299, /* F16TEXTURE2D */ - YYSYMBOL_F16TEXTURE3D = 300, /* F16TEXTURE3D */ - YYSYMBOL_F16TEXTURE2DRECT = 301, /* F16TEXTURE2DRECT */ - YYSYMBOL_F16TEXTURECUBE = 302, /* F16TEXTURECUBE */ - YYSYMBOL_F16TEXTURE1DARRAY = 303, /* F16TEXTURE1DARRAY */ - YYSYMBOL_F16TEXTURE2DARRAY = 304, /* F16TEXTURE2DARRAY */ - YYSYMBOL_F16TEXTURECUBEARRAY = 305, /* F16TEXTURECUBEARRAY */ - YYSYMBOL_F16TEXTUREBUFFER = 306, /* F16TEXTUREBUFFER */ - YYSYMBOL_F16TEXTURE2DMS = 307, /* F16TEXTURE2DMS */ - YYSYMBOL_F16TEXTURE2DMSARRAY = 308, /* F16TEXTURE2DMSARRAY */ - YYSYMBOL_SUBPASSINPUT = 309, /* SUBPASSINPUT */ - YYSYMBOL_SUBPASSINPUTMS = 310, /* SUBPASSINPUTMS */ - YYSYMBOL_ISUBPASSINPUT = 311, /* ISUBPASSINPUT */ - YYSYMBOL_ISUBPASSINPUTMS = 312, /* ISUBPASSINPUTMS */ - YYSYMBOL_USUBPASSINPUT = 313, /* USUBPASSINPUT */ - YYSYMBOL_USUBPASSINPUTMS = 314, /* USUBPASSINPUTMS */ - YYSYMBOL_F16SUBPASSINPUT = 315, /* F16SUBPASSINPUT */ - YYSYMBOL_F16SUBPASSINPUTMS = 316, /* F16SUBPASSINPUTMS */ - YYSYMBOL_SPIRV_INSTRUCTION = 317, /* SPIRV_INSTRUCTION */ - YYSYMBOL_SPIRV_EXECUTION_MODE = 318, /* SPIRV_EXECUTION_MODE */ - YYSYMBOL_SPIRV_EXECUTION_MODE_ID = 319, /* SPIRV_EXECUTION_MODE_ID */ - YYSYMBOL_SPIRV_DECORATE = 320, /* SPIRV_DECORATE */ - YYSYMBOL_SPIRV_DECORATE_ID = 321, /* SPIRV_DECORATE_ID */ - YYSYMBOL_SPIRV_DECORATE_STRING = 322, /* SPIRV_DECORATE_STRING */ - YYSYMBOL_SPIRV_TYPE = 323, /* SPIRV_TYPE */ - YYSYMBOL_SPIRV_STORAGE_CLASS = 324, /* SPIRV_STORAGE_CLASS */ - YYSYMBOL_SPIRV_BY_REFERENCE = 325, /* SPIRV_BY_REFERENCE */ - YYSYMBOL_SPIRV_LITERAL = 326, /* SPIRV_LITERAL */ - YYSYMBOL_LEFT_OP = 327, /* LEFT_OP */ - YYSYMBOL_RIGHT_OP = 328, /* RIGHT_OP */ - YYSYMBOL_INC_OP = 329, /* INC_OP */ - YYSYMBOL_DEC_OP = 330, /* DEC_OP */ - YYSYMBOL_LE_OP = 331, /* LE_OP */ - YYSYMBOL_GE_OP = 332, /* GE_OP */ - YYSYMBOL_EQ_OP = 333, /* EQ_OP */ - YYSYMBOL_NE_OP = 334, /* NE_OP */ - YYSYMBOL_AND_OP = 335, /* AND_OP */ - YYSYMBOL_OR_OP = 336, /* OR_OP */ - YYSYMBOL_XOR_OP = 337, /* XOR_OP */ - YYSYMBOL_MUL_ASSIGN = 338, /* MUL_ASSIGN */ - YYSYMBOL_DIV_ASSIGN = 339, /* DIV_ASSIGN */ - YYSYMBOL_ADD_ASSIGN = 340, /* ADD_ASSIGN */ - YYSYMBOL_MOD_ASSIGN = 341, /* MOD_ASSIGN */ - YYSYMBOL_LEFT_ASSIGN = 342, /* LEFT_ASSIGN */ - YYSYMBOL_RIGHT_ASSIGN = 343, /* RIGHT_ASSIGN */ - YYSYMBOL_AND_ASSIGN = 344, /* AND_ASSIGN */ - YYSYMBOL_XOR_ASSIGN = 345, /* XOR_ASSIGN */ - YYSYMBOL_OR_ASSIGN = 346, /* OR_ASSIGN */ - YYSYMBOL_SUB_ASSIGN = 347, /* SUB_ASSIGN */ - YYSYMBOL_STRING_LITERAL = 348, /* STRING_LITERAL */ - YYSYMBOL_LEFT_PAREN = 349, /* LEFT_PAREN */ - YYSYMBOL_RIGHT_PAREN = 350, /* RIGHT_PAREN */ - YYSYMBOL_LEFT_BRACKET = 351, /* LEFT_BRACKET */ - YYSYMBOL_RIGHT_BRACKET = 352, /* RIGHT_BRACKET */ - YYSYMBOL_LEFT_BRACE = 353, /* LEFT_BRACE */ - YYSYMBOL_RIGHT_BRACE = 354, /* RIGHT_BRACE */ - YYSYMBOL_DOT = 355, /* DOT */ - YYSYMBOL_COMMA = 356, /* COMMA */ - YYSYMBOL_COLON = 357, /* COLON */ - YYSYMBOL_EQUAL = 358, /* EQUAL */ - YYSYMBOL_SEMICOLON = 359, /* SEMICOLON */ - YYSYMBOL_BANG = 360, /* BANG */ - YYSYMBOL_DASH = 361, /* DASH */ - YYSYMBOL_TILDE = 362, /* TILDE */ - YYSYMBOL_PLUS = 363, /* PLUS */ - YYSYMBOL_STAR = 364, /* STAR */ - YYSYMBOL_SLASH = 365, /* SLASH */ - YYSYMBOL_PERCENT = 366, /* PERCENT */ - YYSYMBOL_LEFT_ANGLE = 367, /* LEFT_ANGLE */ - YYSYMBOL_RIGHT_ANGLE = 368, /* RIGHT_ANGLE */ - YYSYMBOL_VERTICAL_BAR = 369, /* VERTICAL_BAR */ - YYSYMBOL_CARET = 370, /* CARET */ - YYSYMBOL_AMPERSAND = 371, /* AMPERSAND */ - YYSYMBOL_QUESTION = 372, /* QUESTION */ - YYSYMBOL_INVARIANT = 373, /* INVARIANT */ - YYSYMBOL_HIGH_PRECISION = 374, /* HIGH_PRECISION */ - YYSYMBOL_MEDIUM_PRECISION = 375, /* MEDIUM_PRECISION */ - YYSYMBOL_LOW_PRECISION = 376, /* LOW_PRECISION */ - YYSYMBOL_PRECISION = 377, /* PRECISION */ - YYSYMBOL_PACKED = 378, /* PACKED */ - YYSYMBOL_RESOURCE = 379, /* RESOURCE */ - YYSYMBOL_SUPERP = 380, /* SUPERP */ - YYSYMBOL_FLOATCONSTANT = 381, /* FLOATCONSTANT */ - YYSYMBOL_INTCONSTANT = 382, /* INTCONSTANT */ - YYSYMBOL_UINTCONSTANT = 383, /* UINTCONSTANT */ - YYSYMBOL_BOOLCONSTANT = 384, /* BOOLCONSTANT */ - YYSYMBOL_IDENTIFIER = 385, /* IDENTIFIER */ - YYSYMBOL_TYPE_NAME = 386, /* TYPE_NAME */ - YYSYMBOL_CENTROID = 387, /* CENTROID */ - YYSYMBOL_IN = 388, /* IN */ - YYSYMBOL_OUT = 389, /* OUT */ - YYSYMBOL_INOUT = 390, /* INOUT */ - YYSYMBOL_STRUCT = 391, /* STRUCT */ - YYSYMBOL_VOID = 392, /* VOID */ - YYSYMBOL_WHILE = 393, /* WHILE */ - YYSYMBOL_BREAK = 394, /* BREAK */ - YYSYMBOL_CONTINUE = 395, /* CONTINUE */ - YYSYMBOL_DO = 396, /* DO */ - YYSYMBOL_ELSE = 397, /* ELSE */ - YYSYMBOL_FOR = 398, /* FOR */ - YYSYMBOL_IF = 399, /* IF */ - YYSYMBOL_DISCARD = 400, /* DISCARD */ - YYSYMBOL_RETURN = 401, /* RETURN */ - YYSYMBOL_SWITCH = 402, /* SWITCH */ - YYSYMBOL_CASE = 403, /* CASE */ - YYSYMBOL_DEFAULT = 404, /* DEFAULT */ - YYSYMBOL_TERMINATE_INVOCATION = 405, /* TERMINATE_INVOCATION */ - YYSYMBOL_TERMINATE_RAY = 406, /* TERMINATE_RAY */ - YYSYMBOL_IGNORE_INTERSECTION = 407, /* IGNORE_INTERSECTION */ - YYSYMBOL_UNIFORM = 408, /* UNIFORM */ - YYSYMBOL_SHARED = 409, /* SHARED */ - YYSYMBOL_BUFFER = 410, /* BUFFER */ - YYSYMBOL_FLAT = 411, /* FLAT */ - YYSYMBOL_SMOOTH = 412, /* SMOOTH */ - YYSYMBOL_LAYOUT = 413, /* LAYOUT */ - YYSYMBOL_DOUBLECONSTANT = 414, /* DOUBLECONSTANT */ - YYSYMBOL_INT16CONSTANT = 415, /* INT16CONSTANT */ - YYSYMBOL_UINT16CONSTANT = 416, /* UINT16CONSTANT */ - YYSYMBOL_FLOAT16CONSTANT = 417, /* FLOAT16CONSTANT */ - YYSYMBOL_INT32CONSTANT = 418, /* INT32CONSTANT */ - YYSYMBOL_UINT32CONSTANT = 419, /* UINT32CONSTANT */ - YYSYMBOL_INT64CONSTANT = 420, /* INT64CONSTANT */ - YYSYMBOL_UINT64CONSTANT = 421, /* UINT64CONSTANT */ - YYSYMBOL_SUBROUTINE = 422, /* SUBROUTINE */ - YYSYMBOL_DEMOTE = 423, /* DEMOTE */ - YYSYMBOL_PAYLOADNV = 424, /* PAYLOADNV */ - YYSYMBOL_PAYLOADINNV = 425, /* PAYLOADINNV */ - YYSYMBOL_HITATTRNV = 426, /* HITATTRNV */ - YYSYMBOL_CALLDATANV = 427, /* CALLDATANV */ - YYSYMBOL_CALLDATAINNV = 428, /* CALLDATAINNV */ - YYSYMBOL_PAYLOADEXT = 429, /* PAYLOADEXT */ - YYSYMBOL_PAYLOADINEXT = 430, /* PAYLOADINEXT */ - YYSYMBOL_HITATTREXT = 431, /* HITATTREXT */ - YYSYMBOL_CALLDATAEXT = 432, /* CALLDATAEXT */ - YYSYMBOL_CALLDATAINEXT = 433, /* CALLDATAINEXT */ - YYSYMBOL_PATCH = 434, /* PATCH */ - YYSYMBOL_SAMPLE = 435, /* SAMPLE */ - YYSYMBOL_NONUNIFORM = 436, /* NONUNIFORM */ - YYSYMBOL_COHERENT = 437, /* COHERENT */ - YYSYMBOL_VOLATILE = 438, /* VOLATILE */ - YYSYMBOL_RESTRICT = 439, /* RESTRICT */ - YYSYMBOL_READONLY = 440, /* READONLY */ - YYSYMBOL_WRITEONLY = 441, /* WRITEONLY */ - YYSYMBOL_DEVICECOHERENT = 442, /* DEVICECOHERENT */ - YYSYMBOL_QUEUEFAMILYCOHERENT = 443, /* QUEUEFAMILYCOHERENT */ - YYSYMBOL_WORKGROUPCOHERENT = 444, /* WORKGROUPCOHERENT */ - YYSYMBOL_SUBGROUPCOHERENT = 445, /* SUBGROUPCOHERENT */ - YYSYMBOL_NONPRIVATE = 446, /* NONPRIVATE */ - YYSYMBOL_SHADERCALLCOHERENT = 447, /* SHADERCALLCOHERENT */ - YYSYMBOL_NOPERSPECTIVE = 448, /* NOPERSPECTIVE */ - YYSYMBOL_EXPLICITINTERPAMD = 449, /* EXPLICITINTERPAMD */ - YYSYMBOL_PERVERTEXEXT = 450, /* PERVERTEXEXT */ - YYSYMBOL_PERVERTEXNV = 451, /* PERVERTEXNV */ - YYSYMBOL_PERPRIMITIVENV = 452, /* PERPRIMITIVENV */ - YYSYMBOL_PERVIEWNV = 453, /* PERVIEWNV */ - YYSYMBOL_PERTASKNV = 454, /* PERTASKNV */ - YYSYMBOL_PERPRIMITIVEEXT = 455, /* PERPRIMITIVEEXT */ - YYSYMBOL_TASKPAYLOADWORKGROUPEXT = 456, /* TASKPAYLOADWORKGROUPEXT */ - YYSYMBOL_PRECISE = 457, /* PRECISE */ - YYSYMBOL_YYACCEPT = 458, /* $accept */ - YYSYMBOL_variable_identifier = 459, /* variable_identifier */ - YYSYMBOL_primary_expression = 460, /* primary_expression */ - YYSYMBOL_postfix_expression = 461, /* postfix_expression */ - YYSYMBOL_integer_expression = 462, /* integer_expression */ - YYSYMBOL_function_call = 463, /* function_call */ - YYSYMBOL_function_call_or_method = 464, /* function_call_or_method */ - YYSYMBOL_function_call_generic = 465, /* function_call_generic */ - YYSYMBOL_function_call_header_no_parameters = 466, /* function_call_header_no_parameters */ - YYSYMBOL_function_call_header_with_parameters = 467, /* function_call_header_with_parameters */ - YYSYMBOL_function_call_header = 468, /* function_call_header */ - YYSYMBOL_function_identifier = 469, /* function_identifier */ - YYSYMBOL_unary_expression = 470, /* unary_expression */ - YYSYMBOL_unary_operator = 471, /* unary_operator */ - YYSYMBOL_multiplicative_expression = 472, /* multiplicative_expression */ - YYSYMBOL_additive_expression = 473, /* additive_expression */ - YYSYMBOL_shift_expression = 474, /* shift_expression */ - YYSYMBOL_relational_expression = 475, /* relational_expression */ - YYSYMBOL_equality_expression = 476, /* equality_expression */ - YYSYMBOL_and_expression = 477, /* and_expression */ - YYSYMBOL_exclusive_or_expression = 478, /* exclusive_or_expression */ - YYSYMBOL_inclusive_or_expression = 479, /* inclusive_or_expression */ - YYSYMBOL_logical_and_expression = 480, /* logical_and_expression */ - YYSYMBOL_logical_xor_expression = 481, /* logical_xor_expression */ - YYSYMBOL_logical_or_expression = 482, /* logical_or_expression */ - YYSYMBOL_conditional_expression = 483, /* conditional_expression */ - YYSYMBOL_484_1 = 484, /* $@1 */ - YYSYMBOL_assignment_expression = 485, /* assignment_expression */ - YYSYMBOL_assignment_operator = 486, /* assignment_operator */ - YYSYMBOL_expression = 487, /* expression */ - YYSYMBOL_constant_expression = 488, /* constant_expression */ - YYSYMBOL_declaration = 489, /* declaration */ - YYSYMBOL_block_structure = 490, /* block_structure */ - YYSYMBOL_491_2 = 491, /* $@2 */ - YYSYMBOL_identifier_list = 492, /* identifier_list */ - YYSYMBOL_function_prototype = 493, /* function_prototype */ - YYSYMBOL_function_declarator = 494, /* function_declarator */ - YYSYMBOL_function_header_with_parameters = 495, /* function_header_with_parameters */ - YYSYMBOL_function_header = 496, /* function_header */ - YYSYMBOL_parameter_declarator = 497, /* parameter_declarator */ - YYSYMBOL_parameter_declaration = 498, /* parameter_declaration */ - YYSYMBOL_parameter_type_specifier = 499, /* parameter_type_specifier */ - YYSYMBOL_init_declarator_list = 500, /* init_declarator_list */ - YYSYMBOL_single_declaration = 501, /* single_declaration */ - YYSYMBOL_fully_specified_type = 502, /* fully_specified_type */ - YYSYMBOL_invariant_qualifier = 503, /* invariant_qualifier */ - YYSYMBOL_interpolation_qualifier = 504, /* interpolation_qualifier */ - YYSYMBOL_layout_qualifier = 505, /* layout_qualifier */ - YYSYMBOL_layout_qualifier_id_list = 506, /* layout_qualifier_id_list */ - YYSYMBOL_layout_qualifier_id = 507, /* layout_qualifier_id */ - YYSYMBOL_precise_qualifier = 508, /* precise_qualifier */ - YYSYMBOL_type_qualifier = 509, /* type_qualifier */ - YYSYMBOL_single_type_qualifier = 510, /* single_type_qualifier */ - YYSYMBOL_storage_qualifier = 511, /* storage_qualifier */ - YYSYMBOL_non_uniform_qualifier = 512, /* non_uniform_qualifier */ - YYSYMBOL_type_name_list = 513, /* type_name_list */ - YYSYMBOL_type_specifier = 514, /* type_specifier */ - YYSYMBOL_array_specifier = 515, /* array_specifier */ - YYSYMBOL_type_parameter_specifier_opt = 516, /* type_parameter_specifier_opt */ - YYSYMBOL_type_parameter_specifier = 517, /* type_parameter_specifier */ - YYSYMBOL_type_parameter_specifier_list = 518, /* type_parameter_specifier_list */ - YYSYMBOL_type_specifier_nonarray = 519, /* type_specifier_nonarray */ - YYSYMBOL_precision_qualifier = 520, /* precision_qualifier */ - YYSYMBOL_struct_specifier = 521, /* struct_specifier */ - YYSYMBOL_522_3 = 522, /* $@3 */ - YYSYMBOL_523_4 = 523, /* $@4 */ - YYSYMBOL_struct_declaration_list = 524, /* struct_declaration_list */ - YYSYMBOL_struct_declaration = 525, /* struct_declaration */ - YYSYMBOL_struct_declarator_list = 526, /* struct_declarator_list */ - YYSYMBOL_struct_declarator = 527, /* struct_declarator */ - YYSYMBOL_initializer = 528, /* initializer */ - YYSYMBOL_initializer_list = 529, /* initializer_list */ - YYSYMBOL_declaration_statement = 530, /* declaration_statement */ - YYSYMBOL_statement = 531, /* statement */ - YYSYMBOL_simple_statement = 532, /* simple_statement */ - YYSYMBOL_demote_statement = 533, /* demote_statement */ - YYSYMBOL_compound_statement = 534, /* compound_statement */ - YYSYMBOL_535_5 = 535, /* $@5 */ - YYSYMBOL_536_6 = 536, /* $@6 */ - YYSYMBOL_statement_no_new_scope = 537, /* statement_no_new_scope */ - YYSYMBOL_statement_scoped = 538, /* statement_scoped */ - YYSYMBOL_539_7 = 539, /* $@7 */ - YYSYMBOL_540_8 = 540, /* $@8 */ - YYSYMBOL_compound_statement_no_new_scope = 541, /* compound_statement_no_new_scope */ - YYSYMBOL_statement_list = 542, /* statement_list */ - YYSYMBOL_expression_statement = 543, /* expression_statement */ - YYSYMBOL_selection_statement = 544, /* selection_statement */ - YYSYMBOL_selection_statement_nonattributed = 545, /* selection_statement_nonattributed */ - YYSYMBOL_selection_rest_statement = 546, /* selection_rest_statement */ - YYSYMBOL_condition = 547, /* condition */ - YYSYMBOL_switch_statement = 548, /* switch_statement */ - YYSYMBOL_switch_statement_nonattributed = 549, /* switch_statement_nonattributed */ - YYSYMBOL_550_9 = 550, /* $@9 */ - YYSYMBOL_switch_statement_list = 551, /* switch_statement_list */ - YYSYMBOL_case_label = 552, /* case_label */ - YYSYMBOL_iteration_statement = 553, /* iteration_statement */ - YYSYMBOL_iteration_statement_nonattributed = 554, /* iteration_statement_nonattributed */ - YYSYMBOL_555_10 = 555, /* $@10 */ - YYSYMBOL_556_11 = 556, /* $@11 */ - YYSYMBOL_557_12 = 557, /* $@12 */ - YYSYMBOL_for_init_statement = 558, /* for_init_statement */ - YYSYMBOL_conditionopt = 559, /* conditionopt */ - YYSYMBOL_for_rest_statement = 560, /* for_rest_statement */ - YYSYMBOL_jump_statement = 561, /* jump_statement */ - YYSYMBOL_translation_unit = 562, /* translation_unit */ - YYSYMBOL_external_declaration = 563, /* external_declaration */ - YYSYMBOL_function_definition = 564, /* function_definition */ - YYSYMBOL_565_13 = 565, /* $@13 */ - YYSYMBOL_attribute = 566, /* attribute */ - YYSYMBOL_attribute_list = 567, /* attribute_list */ - YYSYMBOL_single_attribute = 568, /* single_attribute */ - YYSYMBOL_spirv_requirements_list = 569, /* spirv_requirements_list */ - YYSYMBOL_spirv_requirements_parameter = 570, /* spirv_requirements_parameter */ - YYSYMBOL_spirv_extension_list = 571, /* spirv_extension_list */ - YYSYMBOL_spirv_capability_list = 572, /* spirv_capability_list */ - YYSYMBOL_spirv_execution_mode_qualifier = 573, /* spirv_execution_mode_qualifier */ - YYSYMBOL_spirv_execution_mode_parameter_list = 574, /* spirv_execution_mode_parameter_list */ - YYSYMBOL_spirv_execution_mode_parameter = 575, /* spirv_execution_mode_parameter */ - YYSYMBOL_spirv_execution_mode_id_parameter_list = 576, /* spirv_execution_mode_id_parameter_list */ - YYSYMBOL_spirv_storage_class_qualifier = 577, /* spirv_storage_class_qualifier */ - YYSYMBOL_spirv_decorate_qualifier = 578, /* spirv_decorate_qualifier */ - YYSYMBOL_spirv_decorate_parameter_list = 579, /* spirv_decorate_parameter_list */ - YYSYMBOL_spirv_decorate_parameter = 580, /* spirv_decorate_parameter */ - YYSYMBOL_spirv_decorate_id_parameter_list = 581, /* spirv_decorate_id_parameter_list */ - YYSYMBOL_spirv_decorate_string_parameter_list = 582, /* spirv_decorate_string_parameter_list */ - YYSYMBOL_spirv_type_specifier = 583, /* spirv_type_specifier */ - YYSYMBOL_spirv_type_parameter_list = 584, /* spirv_type_parameter_list */ - YYSYMBOL_spirv_type_parameter = 585, /* spirv_type_parameter */ - YYSYMBOL_spirv_instruction_qualifier = 586, /* spirv_instruction_qualifier */ - YYSYMBOL_spirv_instruction_qualifier_list = 587, /* spirv_instruction_qualifier_list */ - YYSYMBOL_spirv_instruction_qualifier_id = 588 /* spirv_instruction_qualifier_id */ + YYSYMBOL_COOPMAT = 166, /* COOPMAT */ + YYSYMBOL_HITOBJECTNV = 167, /* HITOBJECTNV */ + YYSYMBOL_HITOBJECTATTRNV = 168, /* HITOBJECTATTRNV */ + YYSYMBOL_SAMPLERCUBEARRAY = 169, /* SAMPLERCUBEARRAY */ + YYSYMBOL_SAMPLERCUBEARRAYSHADOW = 170, /* SAMPLERCUBEARRAYSHADOW */ + YYSYMBOL_ISAMPLERCUBEARRAY = 171, /* ISAMPLERCUBEARRAY */ + YYSYMBOL_USAMPLERCUBEARRAY = 172, /* USAMPLERCUBEARRAY */ + YYSYMBOL_SAMPLER1D = 173, /* SAMPLER1D */ + YYSYMBOL_SAMPLER1DARRAY = 174, /* SAMPLER1DARRAY */ + YYSYMBOL_SAMPLER1DARRAYSHADOW = 175, /* SAMPLER1DARRAYSHADOW */ + YYSYMBOL_ISAMPLER1D = 176, /* ISAMPLER1D */ + YYSYMBOL_SAMPLER1DSHADOW = 177, /* SAMPLER1DSHADOW */ + YYSYMBOL_SAMPLER2DRECT = 178, /* SAMPLER2DRECT */ + YYSYMBOL_SAMPLER2DRECTSHADOW = 179, /* SAMPLER2DRECTSHADOW */ + YYSYMBOL_ISAMPLER2DRECT = 180, /* ISAMPLER2DRECT */ + YYSYMBOL_USAMPLER2DRECT = 181, /* USAMPLER2DRECT */ + YYSYMBOL_SAMPLERBUFFER = 182, /* SAMPLERBUFFER */ + YYSYMBOL_ISAMPLERBUFFER = 183, /* ISAMPLERBUFFER */ + YYSYMBOL_USAMPLERBUFFER = 184, /* USAMPLERBUFFER */ + YYSYMBOL_SAMPLER2DMS = 185, /* SAMPLER2DMS */ + YYSYMBOL_ISAMPLER2DMS = 186, /* ISAMPLER2DMS */ + YYSYMBOL_USAMPLER2DMS = 187, /* USAMPLER2DMS */ + YYSYMBOL_SAMPLER2DMSARRAY = 188, /* SAMPLER2DMSARRAY */ + YYSYMBOL_ISAMPLER2DMSARRAY = 189, /* ISAMPLER2DMSARRAY */ + YYSYMBOL_USAMPLER2DMSARRAY = 190, /* USAMPLER2DMSARRAY */ + YYSYMBOL_SAMPLEREXTERNALOES = 191, /* SAMPLEREXTERNALOES */ + YYSYMBOL_SAMPLEREXTERNAL2DY2YEXT = 192, /* SAMPLEREXTERNAL2DY2YEXT */ + YYSYMBOL_ISAMPLER1DARRAY = 193, /* ISAMPLER1DARRAY */ + YYSYMBOL_USAMPLER1D = 194, /* USAMPLER1D */ + YYSYMBOL_USAMPLER1DARRAY = 195, /* USAMPLER1DARRAY */ + YYSYMBOL_F16SAMPLER1D = 196, /* F16SAMPLER1D */ + YYSYMBOL_F16SAMPLER2D = 197, /* F16SAMPLER2D */ + YYSYMBOL_F16SAMPLER3D = 198, /* F16SAMPLER3D */ + YYSYMBOL_F16SAMPLER2DRECT = 199, /* F16SAMPLER2DRECT */ + YYSYMBOL_F16SAMPLERCUBE = 200, /* F16SAMPLERCUBE */ + YYSYMBOL_F16SAMPLER1DARRAY = 201, /* F16SAMPLER1DARRAY */ + YYSYMBOL_F16SAMPLER2DARRAY = 202, /* F16SAMPLER2DARRAY */ + YYSYMBOL_F16SAMPLERCUBEARRAY = 203, /* F16SAMPLERCUBEARRAY */ + YYSYMBOL_F16SAMPLERBUFFER = 204, /* F16SAMPLERBUFFER */ + YYSYMBOL_F16SAMPLER2DMS = 205, /* F16SAMPLER2DMS */ + YYSYMBOL_F16SAMPLER2DMSARRAY = 206, /* F16SAMPLER2DMSARRAY */ + YYSYMBOL_F16SAMPLER1DSHADOW = 207, /* F16SAMPLER1DSHADOW */ + YYSYMBOL_F16SAMPLER2DSHADOW = 208, /* F16SAMPLER2DSHADOW */ + YYSYMBOL_F16SAMPLER1DARRAYSHADOW = 209, /* F16SAMPLER1DARRAYSHADOW */ + YYSYMBOL_F16SAMPLER2DARRAYSHADOW = 210, /* F16SAMPLER2DARRAYSHADOW */ + YYSYMBOL_F16SAMPLER2DRECTSHADOW = 211, /* F16SAMPLER2DRECTSHADOW */ + YYSYMBOL_F16SAMPLERCUBESHADOW = 212, /* F16SAMPLERCUBESHADOW */ + YYSYMBOL_F16SAMPLERCUBEARRAYSHADOW = 213, /* F16SAMPLERCUBEARRAYSHADOW */ + YYSYMBOL_IMAGE1D = 214, /* IMAGE1D */ + YYSYMBOL_IIMAGE1D = 215, /* IIMAGE1D */ + YYSYMBOL_UIMAGE1D = 216, /* UIMAGE1D */ + YYSYMBOL_IMAGE2D = 217, /* IMAGE2D */ + YYSYMBOL_IIMAGE2D = 218, /* IIMAGE2D */ + YYSYMBOL_UIMAGE2D = 219, /* UIMAGE2D */ + YYSYMBOL_IMAGE3D = 220, /* IMAGE3D */ + YYSYMBOL_IIMAGE3D = 221, /* IIMAGE3D */ + YYSYMBOL_UIMAGE3D = 222, /* UIMAGE3D */ + YYSYMBOL_IMAGE2DRECT = 223, /* IMAGE2DRECT */ + YYSYMBOL_IIMAGE2DRECT = 224, /* IIMAGE2DRECT */ + YYSYMBOL_UIMAGE2DRECT = 225, /* UIMAGE2DRECT */ + YYSYMBOL_IMAGECUBE = 226, /* IMAGECUBE */ + YYSYMBOL_IIMAGECUBE = 227, /* IIMAGECUBE */ + YYSYMBOL_UIMAGECUBE = 228, /* UIMAGECUBE */ + YYSYMBOL_IMAGEBUFFER = 229, /* IMAGEBUFFER */ + YYSYMBOL_IIMAGEBUFFER = 230, /* IIMAGEBUFFER */ + YYSYMBOL_UIMAGEBUFFER = 231, /* UIMAGEBUFFER */ + YYSYMBOL_IMAGE1DARRAY = 232, /* IMAGE1DARRAY */ + YYSYMBOL_IIMAGE1DARRAY = 233, /* IIMAGE1DARRAY */ + YYSYMBOL_UIMAGE1DARRAY = 234, /* UIMAGE1DARRAY */ + YYSYMBOL_IMAGE2DARRAY = 235, /* IMAGE2DARRAY */ + YYSYMBOL_IIMAGE2DARRAY = 236, /* IIMAGE2DARRAY */ + YYSYMBOL_UIMAGE2DARRAY = 237, /* UIMAGE2DARRAY */ + YYSYMBOL_IMAGECUBEARRAY = 238, /* IMAGECUBEARRAY */ + YYSYMBOL_IIMAGECUBEARRAY = 239, /* IIMAGECUBEARRAY */ + YYSYMBOL_UIMAGECUBEARRAY = 240, /* UIMAGECUBEARRAY */ + YYSYMBOL_IMAGE2DMS = 241, /* IMAGE2DMS */ + YYSYMBOL_IIMAGE2DMS = 242, /* IIMAGE2DMS */ + YYSYMBOL_UIMAGE2DMS = 243, /* UIMAGE2DMS */ + YYSYMBOL_IMAGE2DMSARRAY = 244, /* IMAGE2DMSARRAY */ + YYSYMBOL_IIMAGE2DMSARRAY = 245, /* IIMAGE2DMSARRAY */ + YYSYMBOL_UIMAGE2DMSARRAY = 246, /* UIMAGE2DMSARRAY */ + YYSYMBOL_F16IMAGE1D = 247, /* F16IMAGE1D */ + YYSYMBOL_F16IMAGE2D = 248, /* F16IMAGE2D */ + YYSYMBOL_F16IMAGE3D = 249, /* F16IMAGE3D */ + YYSYMBOL_F16IMAGE2DRECT = 250, /* F16IMAGE2DRECT */ + YYSYMBOL_F16IMAGECUBE = 251, /* F16IMAGECUBE */ + YYSYMBOL_F16IMAGE1DARRAY = 252, /* F16IMAGE1DARRAY */ + YYSYMBOL_F16IMAGE2DARRAY = 253, /* F16IMAGE2DARRAY */ + YYSYMBOL_F16IMAGECUBEARRAY = 254, /* F16IMAGECUBEARRAY */ + YYSYMBOL_F16IMAGEBUFFER = 255, /* F16IMAGEBUFFER */ + YYSYMBOL_F16IMAGE2DMS = 256, /* F16IMAGE2DMS */ + YYSYMBOL_F16IMAGE2DMSARRAY = 257, /* F16IMAGE2DMSARRAY */ + YYSYMBOL_I64IMAGE1D = 258, /* I64IMAGE1D */ + YYSYMBOL_U64IMAGE1D = 259, /* U64IMAGE1D */ + YYSYMBOL_I64IMAGE2D = 260, /* I64IMAGE2D */ + YYSYMBOL_U64IMAGE2D = 261, /* U64IMAGE2D */ + YYSYMBOL_I64IMAGE3D = 262, /* I64IMAGE3D */ + YYSYMBOL_U64IMAGE3D = 263, /* U64IMAGE3D */ + YYSYMBOL_I64IMAGE2DRECT = 264, /* I64IMAGE2DRECT */ + YYSYMBOL_U64IMAGE2DRECT = 265, /* U64IMAGE2DRECT */ + YYSYMBOL_I64IMAGECUBE = 266, /* I64IMAGECUBE */ + YYSYMBOL_U64IMAGECUBE = 267, /* U64IMAGECUBE */ + YYSYMBOL_I64IMAGEBUFFER = 268, /* I64IMAGEBUFFER */ + YYSYMBOL_U64IMAGEBUFFER = 269, /* U64IMAGEBUFFER */ + YYSYMBOL_I64IMAGE1DARRAY = 270, /* I64IMAGE1DARRAY */ + YYSYMBOL_U64IMAGE1DARRAY = 271, /* U64IMAGE1DARRAY */ + YYSYMBOL_I64IMAGE2DARRAY = 272, /* I64IMAGE2DARRAY */ + YYSYMBOL_U64IMAGE2DARRAY = 273, /* U64IMAGE2DARRAY */ + YYSYMBOL_I64IMAGECUBEARRAY = 274, /* I64IMAGECUBEARRAY */ + YYSYMBOL_U64IMAGECUBEARRAY = 275, /* U64IMAGECUBEARRAY */ + YYSYMBOL_I64IMAGE2DMS = 276, /* I64IMAGE2DMS */ + YYSYMBOL_U64IMAGE2DMS = 277, /* U64IMAGE2DMS */ + YYSYMBOL_I64IMAGE2DMSARRAY = 278, /* I64IMAGE2DMSARRAY */ + YYSYMBOL_U64IMAGE2DMSARRAY = 279, /* U64IMAGE2DMSARRAY */ + YYSYMBOL_TEXTURECUBEARRAY = 280, /* TEXTURECUBEARRAY */ + YYSYMBOL_ITEXTURECUBEARRAY = 281, /* ITEXTURECUBEARRAY */ + YYSYMBOL_UTEXTURECUBEARRAY = 282, /* UTEXTURECUBEARRAY */ + YYSYMBOL_TEXTURE1D = 283, /* TEXTURE1D */ + YYSYMBOL_ITEXTURE1D = 284, /* ITEXTURE1D */ + YYSYMBOL_UTEXTURE1D = 285, /* UTEXTURE1D */ + YYSYMBOL_TEXTURE1DARRAY = 286, /* TEXTURE1DARRAY */ + YYSYMBOL_ITEXTURE1DARRAY = 287, /* ITEXTURE1DARRAY */ + YYSYMBOL_UTEXTURE1DARRAY = 288, /* UTEXTURE1DARRAY */ + YYSYMBOL_TEXTURE2DRECT = 289, /* TEXTURE2DRECT */ + YYSYMBOL_ITEXTURE2DRECT = 290, /* ITEXTURE2DRECT */ + YYSYMBOL_UTEXTURE2DRECT = 291, /* UTEXTURE2DRECT */ + YYSYMBOL_TEXTUREBUFFER = 292, /* TEXTUREBUFFER */ + YYSYMBOL_ITEXTUREBUFFER = 293, /* ITEXTUREBUFFER */ + YYSYMBOL_UTEXTUREBUFFER = 294, /* UTEXTUREBUFFER */ + YYSYMBOL_TEXTURE2DMS = 295, /* TEXTURE2DMS */ + YYSYMBOL_ITEXTURE2DMS = 296, /* ITEXTURE2DMS */ + YYSYMBOL_UTEXTURE2DMS = 297, /* UTEXTURE2DMS */ + YYSYMBOL_TEXTURE2DMSARRAY = 298, /* TEXTURE2DMSARRAY */ + YYSYMBOL_ITEXTURE2DMSARRAY = 299, /* ITEXTURE2DMSARRAY */ + YYSYMBOL_UTEXTURE2DMSARRAY = 300, /* UTEXTURE2DMSARRAY */ + YYSYMBOL_F16TEXTURE1D = 301, /* F16TEXTURE1D */ + YYSYMBOL_F16TEXTURE2D = 302, /* F16TEXTURE2D */ + YYSYMBOL_F16TEXTURE3D = 303, /* F16TEXTURE3D */ + YYSYMBOL_F16TEXTURE2DRECT = 304, /* F16TEXTURE2DRECT */ + YYSYMBOL_F16TEXTURECUBE = 305, /* F16TEXTURECUBE */ + YYSYMBOL_F16TEXTURE1DARRAY = 306, /* F16TEXTURE1DARRAY */ + YYSYMBOL_F16TEXTURE2DARRAY = 307, /* F16TEXTURE2DARRAY */ + YYSYMBOL_F16TEXTURECUBEARRAY = 308, /* F16TEXTURECUBEARRAY */ + YYSYMBOL_F16TEXTUREBUFFER = 309, /* F16TEXTUREBUFFER */ + YYSYMBOL_F16TEXTURE2DMS = 310, /* F16TEXTURE2DMS */ + YYSYMBOL_F16TEXTURE2DMSARRAY = 311, /* F16TEXTURE2DMSARRAY */ + YYSYMBOL_SUBPASSINPUT = 312, /* SUBPASSINPUT */ + YYSYMBOL_SUBPASSINPUTMS = 313, /* SUBPASSINPUTMS */ + YYSYMBOL_ISUBPASSINPUT = 314, /* ISUBPASSINPUT */ + YYSYMBOL_ISUBPASSINPUTMS = 315, /* ISUBPASSINPUTMS */ + YYSYMBOL_USUBPASSINPUT = 316, /* USUBPASSINPUT */ + YYSYMBOL_USUBPASSINPUTMS = 317, /* USUBPASSINPUTMS */ + YYSYMBOL_F16SUBPASSINPUT = 318, /* F16SUBPASSINPUT */ + YYSYMBOL_F16SUBPASSINPUTMS = 319, /* F16SUBPASSINPUTMS */ + YYSYMBOL_SPIRV_INSTRUCTION = 320, /* SPIRV_INSTRUCTION */ + YYSYMBOL_SPIRV_EXECUTION_MODE = 321, /* SPIRV_EXECUTION_MODE */ + YYSYMBOL_SPIRV_EXECUTION_MODE_ID = 322, /* SPIRV_EXECUTION_MODE_ID */ + YYSYMBOL_SPIRV_DECORATE = 323, /* SPIRV_DECORATE */ + YYSYMBOL_SPIRV_DECORATE_ID = 324, /* SPIRV_DECORATE_ID */ + YYSYMBOL_SPIRV_DECORATE_STRING = 325, /* SPIRV_DECORATE_STRING */ + YYSYMBOL_SPIRV_TYPE = 326, /* SPIRV_TYPE */ + YYSYMBOL_SPIRV_STORAGE_CLASS = 327, /* SPIRV_STORAGE_CLASS */ + YYSYMBOL_SPIRV_BY_REFERENCE = 328, /* SPIRV_BY_REFERENCE */ + YYSYMBOL_SPIRV_LITERAL = 329, /* SPIRV_LITERAL */ + YYSYMBOL_ATTACHMENTEXT = 330, /* ATTACHMENTEXT */ + YYSYMBOL_IATTACHMENTEXT = 331, /* IATTACHMENTEXT */ + YYSYMBOL_UATTACHMENTEXT = 332, /* UATTACHMENTEXT */ + YYSYMBOL_LEFT_OP = 333, /* LEFT_OP */ + YYSYMBOL_RIGHT_OP = 334, /* RIGHT_OP */ + YYSYMBOL_INC_OP = 335, /* INC_OP */ + YYSYMBOL_DEC_OP = 336, /* DEC_OP */ + YYSYMBOL_LE_OP = 337, /* LE_OP */ + YYSYMBOL_GE_OP = 338, /* GE_OP */ + YYSYMBOL_EQ_OP = 339, /* EQ_OP */ + YYSYMBOL_NE_OP = 340, /* NE_OP */ + YYSYMBOL_AND_OP = 341, /* AND_OP */ + YYSYMBOL_OR_OP = 342, /* OR_OP */ + YYSYMBOL_XOR_OP = 343, /* XOR_OP */ + YYSYMBOL_MUL_ASSIGN = 344, /* MUL_ASSIGN */ + YYSYMBOL_DIV_ASSIGN = 345, /* DIV_ASSIGN */ + YYSYMBOL_ADD_ASSIGN = 346, /* ADD_ASSIGN */ + YYSYMBOL_MOD_ASSIGN = 347, /* MOD_ASSIGN */ + YYSYMBOL_LEFT_ASSIGN = 348, /* LEFT_ASSIGN */ + YYSYMBOL_RIGHT_ASSIGN = 349, /* RIGHT_ASSIGN */ + YYSYMBOL_AND_ASSIGN = 350, /* AND_ASSIGN */ + YYSYMBOL_XOR_ASSIGN = 351, /* XOR_ASSIGN */ + YYSYMBOL_OR_ASSIGN = 352, /* OR_ASSIGN */ + YYSYMBOL_SUB_ASSIGN = 353, /* SUB_ASSIGN */ + YYSYMBOL_STRING_LITERAL = 354, /* STRING_LITERAL */ + YYSYMBOL_LEFT_PAREN = 355, /* LEFT_PAREN */ + YYSYMBOL_RIGHT_PAREN = 356, /* RIGHT_PAREN */ + YYSYMBOL_LEFT_BRACKET = 357, /* LEFT_BRACKET */ + YYSYMBOL_RIGHT_BRACKET = 358, /* RIGHT_BRACKET */ + YYSYMBOL_LEFT_BRACE = 359, /* LEFT_BRACE */ + YYSYMBOL_RIGHT_BRACE = 360, /* RIGHT_BRACE */ + YYSYMBOL_DOT = 361, /* DOT */ + YYSYMBOL_COMMA = 362, /* COMMA */ + YYSYMBOL_COLON = 363, /* COLON */ + YYSYMBOL_EQUAL = 364, /* EQUAL */ + YYSYMBOL_SEMICOLON = 365, /* SEMICOLON */ + YYSYMBOL_BANG = 366, /* BANG */ + YYSYMBOL_DASH = 367, /* DASH */ + YYSYMBOL_TILDE = 368, /* TILDE */ + YYSYMBOL_PLUS = 369, /* PLUS */ + YYSYMBOL_STAR = 370, /* STAR */ + YYSYMBOL_SLASH = 371, /* SLASH */ + YYSYMBOL_PERCENT = 372, /* PERCENT */ + YYSYMBOL_LEFT_ANGLE = 373, /* LEFT_ANGLE */ + YYSYMBOL_RIGHT_ANGLE = 374, /* RIGHT_ANGLE */ + YYSYMBOL_VERTICAL_BAR = 375, /* VERTICAL_BAR */ + YYSYMBOL_CARET = 376, /* CARET */ + YYSYMBOL_AMPERSAND = 377, /* AMPERSAND */ + YYSYMBOL_QUESTION = 378, /* QUESTION */ + YYSYMBOL_INVARIANT = 379, /* INVARIANT */ + YYSYMBOL_HIGH_PRECISION = 380, /* HIGH_PRECISION */ + YYSYMBOL_MEDIUM_PRECISION = 381, /* MEDIUM_PRECISION */ + YYSYMBOL_LOW_PRECISION = 382, /* LOW_PRECISION */ + YYSYMBOL_PRECISION = 383, /* PRECISION */ + YYSYMBOL_PACKED = 384, /* PACKED */ + YYSYMBOL_RESOURCE = 385, /* RESOURCE */ + YYSYMBOL_SUPERP = 386, /* SUPERP */ + YYSYMBOL_FLOATCONSTANT = 387, /* FLOATCONSTANT */ + YYSYMBOL_INTCONSTANT = 388, /* INTCONSTANT */ + YYSYMBOL_UINTCONSTANT = 389, /* UINTCONSTANT */ + YYSYMBOL_BOOLCONSTANT = 390, /* BOOLCONSTANT */ + YYSYMBOL_IDENTIFIER = 391, /* IDENTIFIER */ + YYSYMBOL_TYPE_NAME = 392, /* TYPE_NAME */ + YYSYMBOL_CENTROID = 393, /* CENTROID */ + YYSYMBOL_IN = 394, /* IN */ + YYSYMBOL_OUT = 395, /* OUT */ + YYSYMBOL_INOUT = 396, /* INOUT */ + YYSYMBOL_STRUCT = 397, /* STRUCT */ + YYSYMBOL_VOID = 398, /* VOID */ + YYSYMBOL_WHILE = 399, /* WHILE */ + YYSYMBOL_BREAK = 400, /* BREAK */ + YYSYMBOL_CONTINUE = 401, /* CONTINUE */ + YYSYMBOL_DO = 402, /* DO */ + YYSYMBOL_ELSE = 403, /* ELSE */ + YYSYMBOL_FOR = 404, /* FOR */ + YYSYMBOL_IF = 405, /* IF */ + YYSYMBOL_DISCARD = 406, /* DISCARD */ + YYSYMBOL_RETURN = 407, /* RETURN */ + YYSYMBOL_SWITCH = 408, /* SWITCH */ + YYSYMBOL_CASE = 409, /* CASE */ + YYSYMBOL_DEFAULT = 410, /* DEFAULT */ + YYSYMBOL_TERMINATE_INVOCATION = 411, /* TERMINATE_INVOCATION */ + YYSYMBOL_TERMINATE_RAY = 412, /* TERMINATE_RAY */ + YYSYMBOL_IGNORE_INTERSECTION = 413, /* IGNORE_INTERSECTION */ + YYSYMBOL_UNIFORM = 414, /* UNIFORM */ + YYSYMBOL_SHARED = 415, /* SHARED */ + YYSYMBOL_BUFFER = 416, /* BUFFER */ + YYSYMBOL_TILEIMAGEEXT = 417, /* TILEIMAGEEXT */ + YYSYMBOL_FLAT = 418, /* FLAT */ + YYSYMBOL_SMOOTH = 419, /* SMOOTH */ + YYSYMBOL_LAYOUT = 420, /* LAYOUT */ + YYSYMBOL_DOUBLECONSTANT = 421, /* DOUBLECONSTANT */ + YYSYMBOL_INT16CONSTANT = 422, /* INT16CONSTANT */ + YYSYMBOL_UINT16CONSTANT = 423, /* UINT16CONSTANT */ + YYSYMBOL_FLOAT16CONSTANT = 424, /* FLOAT16CONSTANT */ + YYSYMBOL_INT32CONSTANT = 425, /* INT32CONSTANT */ + YYSYMBOL_UINT32CONSTANT = 426, /* UINT32CONSTANT */ + YYSYMBOL_INT64CONSTANT = 427, /* INT64CONSTANT */ + YYSYMBOL_UINT64CONSTANT = 428, /* UINT64CONSTANT */ + YYSYMBOL_SUBROUTINE = 429, /* SUBROUTINE */ + YYSYMBOL_DEMOTE = 430, /* DEMOTE */ + YYSYMBOL_PAYLOADNV = 431, /* PAYLOADNV */ + YYSYMBOL_PAYLOADINNV = 432, /* PAYLOADINNV */ + YYSYMBOL_HITATTRNV = 433, /* HITATTRNV */ + YYSYMBOL_CALLDATANV = 434, /* CALLDATANV */ + YYSYMBOL_CALLDATAINNV = 435, /* CALLDATAINNV */ + YYSYMBOL_PAYLOADEXT = 436, /* PAYLOADEXT */ + YYSYMBOL_PAYLOADINEXT = 437, /* PAYLOADINEXT */ + YYSYMBOL_HITATTREXT = 438, /* HITATTREXT */ + YYSYMBOL_CALLDATAEXT = 439, /* CALLDATAEXT */ + YYSYMBOL_CALLDATAINEXT = 440, /* CALLDATAINEXT */ + YYSYMBOL_PATCH = 441, /* PATCH */ + YYSYMBOL_SAMPLE = 442, /* SAMPLE */ + YYSYMBOL_NONUNIFORM = 443, /* NONUNIFORM */ + YYSYMBOL_COHERENT = 444, /* COHERENT */ + YYSYMBOL_VOLATILE = 445, /* VOLATILE */ + YYSYMBOL_RESTRICT = 446, /* RESTRICT */ + YYSYMBOL_READONLY = 447, /* READONLY */ + YYSYMBOL_WRITEONLY = 448, /* WRITEONLY */ + YYSYMBOL_DEVICECOHERENT = 449, /* DEVICECOHERENT */ + YYSYMBOL_QUEUEFAMILYCOHERENT = 450, /* QUEUEFAMILYCOHERENT */ + YYSYMBOL_WORKGROUPCOHERENT = 451, /* WORKGROUPCOHERENT */ + YYSYMBOL_SUBGROUPCOHERENT = 452, /* SUBGROUPCOHERENT */ + YYSYMBOL_NONPRIVATE = 453, /* NONPRIVATE */ + YYSYMBOL_SHADERCALLCOHERENT = 454, /* SHADERCALLCOHERENT */ + YYSYMBOL_NOPERSPECTIVE = 455, /* NOPERSPECTIVE */ + YYSYMBOL_EXPLICITINTERPAMD = 456, /* EXPLICITINTERPAMD */ + YYSYMBOL_PERVERTEXEXT = 457, /* PERVERTEXEXT */ + YYSYMBOL_PERVERTEXNV = 458, /* PERVERTEXNV */ + YYSYMBOL_PERPRIMITIVENV = 459, /* PERPRIMITIVENV */ + YYSYMBOL_PERVIEWNV = 460, /* PERVIEWNV */ + YYSYMBOL_PERTASKNV = 461, /* PERTASKNV */ + YYSYMBOL_PERPRIMITIVEEXT = 462, /* PERPRIMITIVEEXT */ + YYSYMBOL_TASKPAYLOADWORKGROUPEXT = 463, /* TASKPAYLOADWORKGROUPEXT */ + YYSYMBOL_PRECISE = 464, /* PRECISE */ + YYSYMBOL_YYACCEPT = 465, /* $accept */ + YYSYMBOL_variable_identifier = 466, /* variable_identifier */ + YYSYMBOL_primary_expression = 467, /* primary_expression */ + YYSYMBOL_postfix_expression = 468, /* postfix_expression */ + YYSYMBOL_integer_expression = 469, /* integer_expression */ + YYSYMBOL_function_call = 470, /* function_call */ + YYSYMBOL_function_call_or_method = 471, /* function_call_or_method */ + YYSYMBOL_function_call_generic = 472, /* function_call_generic */ + YYSYMBOL_function_call_header_no_parameters = 473, /* function_call_header_no_parameters */ + YYSYMBOL_function_call_header_with_parameters = 474, /* function_call_header_with_parameters */ + YYSYMBOL_function_call_header = 475, /* function_call_header */ + YYSYMBOL_function_identifier = 476, /* function_identifier */ + YYSYMBOL_unary_expression = 477, /* unary_expression */ + YYSYMBOL_unary_operator = 478, /* unary_operator */ + YYSYMBOL_multiplicative_expression = 479, /* multiplicative_expression */ + YYSYMBOL_additive_expression = 480, /* additive_expression */ + YYSYMBOL_shift_expression = 481, /* shift_expression */ + YYSYMBOL_relational_expression = 482, /* relational_expression */ + YYSYMBOL_equality_expression = 483, /* equality_expression */ + YYSYMBOL_and_expression = 484, /* and_expression */ + YYSYMBOL_exclusive_or_expression = 485, /* exclusive_or_expression */ + YYSYMBOL_inclusive_or_expression = 486, /* inclusive_or_expression */ + YYSYMBOL_logical_and_expression = 487, /* logical_and_expression */ + YYSYMBOL_logical_xor_expression = 488, /* logical_xor_expression */ + YYSYMBOL_logical_or_expression = 489, /* logical_or_expression */ + YYSYMBOL_conditional_expression = 490, /* conditional_expression */ + YYSYMBOL_491_1 = 491, /* $@1 */ + YYSYMBOL_assignment_expression = 492, /* assignment_expression */ + YYSYMBOL_assignment_operator = 493, /* assignment_operator */ + YYSYMBOL_expression = 494, /* expression */ + YYSYMBOL_constant_expression = 495, /* constant_expression */ + YYSYMBOL_declaration = 496, /* declaration */ + YYSYMBOL_block_structure = 497, /* block_structure */ + YYSYMBOL_498_2 = 498, /* $@2 */ + YYSYMBOL_identifier_list = 499, /* identifier_list */ + YYSYMBOL_function_prototype = 500, /* function_prototype */ + YYSYMBOL_function_declarator = 501, /* function_declarator */ + YYSYMBOL_function_header_with_parameters = 502, /* function_header_with_parameters */ + YYSYMBOL_function_header = 503, /* function_header */ + YYSYMBOL_parameter_declarator = 504, /* parameter_declarator */ + YYSYMBOL_parameter_declaration = 505, /* parameter_declaration */ + YYSYMBOL_parameter_type_specifier = 506, /* parameter_type_specifier */ + YYSYMBOL_init_declarator_list = 507, /* init_declarator_list */ + YYSYMBOL_single_declaration = 508, /* single_declaration */ + YYSYMBOL_fully_specified_type = 509, /* fully_specified_type */ + YYSYMBOL_invariant_qualifier = 510, /* invariant_qualifier */ + YYSYMBOL_interpolation_qualifier = 511, /* interpolation_qualifier */ + YYSYMBOL_layout_qualifier = 512, /* layout_qualifier */ + YYSYMBOL_layout_qualifier_id_list = 513, /* layout_qualifier_id_list */ + YYSYMBOL_layout_qualifier_id = 514, /* layout_qualifier_id */ + YYSYMBOL_precise_qualifier = 515, /* precise_qualifier */ + YYSYMBOL_type_qualifier = 516, /* type_qualifier */ + YYSYMBOL_single_type_qualifier = 517, /* single_type_qualifier */ + YYSYMBOL_storage_qualifier = 518, /* storage_qualifier */ + YYSYMBOL_non_uniform_qualifier = 519, /* non_uniform_qualifier */ + YYSYMBOL_type_name_list = 520, /* type_name_list */ + YYSYMBOL_type_specifier = 521, /* type_specifier */ + YYSYMBOL_array_specifier = 522, /* array_specifier */ + YYSYMBOL_type_parameter_specifier_opt = 523, /* type_parameter_specifier_opt */ + YYSYMBOL_type_parameter_specifier = 524, /* type_parameter_specifier */ + YYSYMBOL_type_parameter_specifier_list = 525, /* type_parameter_specifier_list */ + YYSYMBOL_type_specifier_nonarray = 526, /* type_specifier_nonarray */ + YYSYMBOL_precision_qualifier = 527, /* precision_qualifier */ + YYSYMBOL_struct_specifier = 528, /* struct_specifier */ + YYSYMBOL_529_3 = 529, /* $@3 */ + YYSYMBOL_530_4 = 530, /* $@4 */ + YYSYMBOL_struct_declaration_list = 531, /* struct_declaration_list */ + YYSYMBOL_struct_declaration = 532, /* struct_declaration */ + YYSYMBOL_struct_declarator_list = 533, /* struct_declarator_list */ + YYSYMBOL_struct_declarator = 534, /* struct_declarator */ + YYSYMBOL_initializer = 535, /* initializer */ + YYSYMBOL_initializer_list = 536, /* initializer_list */ + YYSYMBOL_declaration_statement = 537, /* declaration_statement */ + YYSYMBOL_statement = 538, /* statement */ + YYSYMBOL_simple_statement = 539, /* simple_statement */ + YYSYMBOL_demote_statement = 540, /* demote_statement */ + YYSYMBOL_compound_statement = 541, /* compound_statement */ + YYSYMBOL_542_5 = 542, /* $@5 */ + YYSYMBOL_543_6 = 543, /* $@6 */ + YYSYMBOL_statement_no_new_scope = 544, /* statement_no_new_scope */ + YYSYMBOL_statement_scoped = 545, /* statement_scoped */ + YYSYMBOL_546_7 = 546, /* $@7 */ + YYSYMBOL_547_8 = 547, /* $@8 */ + YYSYMBOL_compound_statement_no_new_scope = 548, /* compound_statement_no_new_scope */ + YYSYMBOL_statement_list = 549, /* statement_list */ + YYSYMBOL_expression_statement = 550, /* expression_statement */ + YYSYMBOL_selection_statement = 551, /* selection_statement */ + YYSYMBOL_selection_statement_nonattributed = 552, /* selection_statement_nonattributed */ + YYSYMBOL_selection_rest_statement = 553, /* selection_rest_statement */ + YYSYMBOL_condition = 554, /* condition */ + YYSYMBOL_switch_statement = 555, /* switch_statement */ + YYSYMBOL_switch_statement_nonattributed = 556, /* switch_statement_nonattributed */ + YYSYMBOL_557_9 = 557, /* $@9 */ + YYSYMBOL_switch_statement_list = 558, /* switch_statement_list */ + YYSYMBOL_case_label = 559, /* case_label */ + YYSYMBOL_iteration_statement = 560, /* iteration_statement */ + YYSYMBOL_iteration_statement_nonattributed = 561, /* iteration_statement_nonattributed */ + YYSYMBOL_562_10 = 562, /* $@10 */ + YYSYMBOL_563_11 = 563, /* $@11 */ + YYSYMBOL_564_12 = 564, /* $@12 */ + YYSYMBOL_for_init_statement = 565, /* for_init_statement */ + YYSYMBOL_conditionopt = 566, /* conditionopt */ + YYSYMBOL_for_rest_statement = 567, /* for_rest_statement */ + YYSYMBOL_jump_statement = 568, /* jump_statement */ + YYSYMBOL_translation_unit = 569, /* translation_unit */ + YYSYMBOL_external_declaration = 570, /* external_declaration */ + YYSYMBOL_function_definition = 571, /* function_definition */ + YYSYMBOL_572_13 = 572, /* $@13 */ + YYSYMBOL_attribute = 573, /* attribute */ + YYSYMBOL_attribute_list = 574, /* attribute_list */ + YYSYMBOL_single_attribute = 575, /* single_attribute */ + YYSYMBOL_spirv_requirements_list = 576, /* spirv_requirements_list */ + YYSYMBOL_spirv_requirements_parameter = 577, /* spirv_requirements_parameter */ + YYSYMBOL_spirv_extension_list = 578, /* spirv_extension_list */ + YYSYMBOL_spirv_capability_list = 579, /* spirv_capability_list */ + YYSYMBOL_spirv_execution_mode_qualifier = 580, /* spirv_execution_mode_qualifier */ + YYSYMBOL_spirv_execution_mode_parameter_list = 581, /* spirv_execution_mode_parameter_list */ + YYSYMBOL_spirv_execution_mode_parameter = 582, /* spirv_execution_mode_parameter */ + YYSYMBOL_spirv_execution_mode_id_parameter_list = 583, /* spirv_execution_mode_id_parameter_list */ + YYSYMBOL_spirv_storage_class_qualifier = 584, /* spirv_storage_class_qualifier */ + YYSYMBOL_spirv_decorate_qualifier = 585, /* spirv_decorate_qualifier */ + YYSYMBOL_spirv_decorate_parameter_list = 586, /* spirv_decorate_parameter_list */ + YYSYMBOL_spirv_decorate_parameter = 587, /* spirv_decorate_parameter */ + YYSYMBOL_spirv_decorate_id_parameter_list = 588, /* spirv_decorate_id_parameter_list */ + YYSYMBOL_spirv_decorate_id_parameter = 589, /* spirv_decorate_id_parameter */ + YYSYMBOL_spirv_decorate_string_parameter_list = 590, /* spirv_decorate_string_parameter_list */ + YYSYMBOL_spirv_type_specifier = 591, /* spirv_type_specifier */ + YYSYMBOL_spirv_type_parameter_list = 592, /* spirv_type_parameter_list */ + YYSYMBOL_spirv_type_parameter = 593, /* spirv_type_parameter */ + YYSYMBOL_spirv_instruction_qualifier = 594, /* spirv_instruction_qualifier */ + YYSYMBOL_spirv_instruction_qualifier_list = 595, /* spirv_instruction_qualifier_list */ + YYSYMBOL_spirv_instruction_qualifier_id = 596 /* spirv_instruction_qualifier_id */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; @@ -731,7 +739,7 @@ typedef enum yysymbol_kind_t yysymbol_kind_t; extern int yylex(YYSTYPE*, TParseContext&); -#line 735 "MachineIndependent/glslang_tab.cpp" +#line 743 "MachineIndependent/glslang_tab.cpp" #ifdef short @@ -771,6 +779,18 @@ typedef int_least16_t yytype_int16; typedef short yytype_int16; #endif +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 +#endif + #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ @@ -868,17 +888,23 @@ typedef int yy_state_fast_t; /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# endif # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else @@ -1035,21 +1061,21 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 445 +#define YYFINAL 452 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 12503 +#define YYLAST 12701 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 458 +#define YYNTOKENS 465 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 131 +#define YYNNTS 132 /* YYNRULES -- Number of rules. */ -#define YYNRULES 686 +#define YYNRULES 700 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 932 +#define YYNSTATES 946 /* YYMAXUTOK -- Last valid token kind. */ -#define YYMAXUTOK 712 +#define YYMAXUTOK 719 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM @@ -1134,82 +1160,84 @@ static const yytype_int16 yytranslate[] = 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457 + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464 }; #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { - 0, 392, 392, 398, 401, 406, 409, 412, 416, 420, - 423, 427, 431, 435, 439, 443, 447, 453, 461, 464, - 467, 470, 473, 478, 486, 493, 500, 506, 510, 517, - 520, 526, 533, 543, 551, 556, 584, 593, 599, 603, - 607, 627, 628, 629, 630, 636, 637, 642, 647, 656, - 657, 662, 670, 671, 677, 686, 687, 692, 697, 702, - 710, 711, 720, 732, 733, 742, 743, 752, 753, 762, - 763, 771, 772, 780, 781, 789, 790, 790, 808, 809, - 825, 829, 833, 837, 842, 846, 850, 854, 858, 862, - 866, 873, 876, 887, 894, 900, 907, 913, 918, 925, - 929, 933, 937, 942, 947, 956, 956, 967, 971, 978, - 982, 988, 994, 1004, 1007, 1014, 1022, 1042, 1065, 1080, - 1105, 1116, 1126, 1136, 1146, 1155, 1158, 1162, 1166, 1171, - 1179, 1186, 1191, 1196, 1201, 1210, 1220, 1247, 1256, 1263, - 1271, 1278, 1285, 1293, 1301, 1311, 1321, 1328, 1339, 1345, - 1348, 1355, 1359, 1363, 1372, 1382, 1385, 1396, 1399, 1402, - 1406, 1410, 1415, 1419, 1422, 1427, 1431, 1436, 1445, 1449, - 1454, 1460, 1466, 1473, 1478, 1486, 1492, 1504, 1518, 1524, - 1529, 1537, 1545, 1553, 1561, 1569, 1577, 1585, 1593, 1600, - 1607, 1611, 1616, 1621, 1626, 1631, 1636, 1641, 1645, 1649, - 1653, 1657, 1663, 1669, 1681, 1688, 1691, 1700, 1705, 1715, - 1720, 1728, 1732, 1742, 1745, 1751, 1757, 1764, 1774, 1778, - 1782, 1786, 1791, 1795, 1800, 1805, 1810, 1815, 1820, 1825, - 1830, 1835, 1840, 1846, 1852, 1858, 1863, 1868, 1873, 1878, - 1883, 1888, 1893, 1898, 1903, 1908, 1913, 1919, 1926, 1931, - 1936, 1941, 1946, 1951, 1956, 1961, 1966, 1971, 1976, 1981, - 1989, 1997, 2005, 2011, 2017, 2023, 2029, 2035, 2041, 2047, - 2053, 2059, 2065, 2071, 2077, 2083, 2089, 2095, 2101, 2107, - 2113, 2119, 2125, 2131, 2137, 2143, 2149, 2155, 2161, 2167, - 2173, 2179, 2185, 2191, 2197, 2203, 2211, 2219, 2227, 2235, - 2243, 2251, 2259, 2267, 2275, 2283, 2291, 2299, 2305, 2311, - 2317, 2323, 2329, 2335, 2341, 2347, 2353, 2359, 2365, 2371, - 2377, 2383, 2389, 2395, 2401, 2407, 2413, 2419, 2425, 2431, - 2437, 2443, 2449, 2455, 2461, 2467, 2473, 2479, 2485, 2491, - 2497, 2503, 2509, 2515, 2519, 2523, 2527, 2532, 2538, 2543, - 2548, 2553, 2558, 2563, 2568, 2574, 2579, 2584, 2589, 2594, - 2599, 2605, 2611, 2617, 2623, 2629, 2635, 2641, 2647, 2653, - 2659, 2665, 2671, 2677, 2683, 2688, 2693, 2698, 2703, 2708, - 2713, 2719, 2724, 2729, 2734, 2739, 2744, 2749, 2754, 2760, - 2765, 2770, 2775, 2780, 2785, 2790, 2795, 2800, 2805, 2810, - 2815, 2820, 2825, 2830, 2836, 2841, 2846, 2852, 2858, 2863, - 2868, 2873, 2879, 2884, 2889, 2894, 2900, 2905, 2910, 2915, - 2921, 2926, 2931, 2936, 2942, 2948, 2954, 2960, 2965, 2971, - 2977, 2983, 2988, 2993, 2998, 3003, 3008, 3014, 3019, 3024, - 3029, 3035, 3040, 3045, 3050, 3056, 3061, 3066, 3071, 3077, - 3082, 3087, 3092, 3098, 3103, 3108, 3113, 3119, 3124, 3129, - 3134, 3140, 3145, 3150, 3155, 3161, 3166, 3171, 3176, 3182, - 3187, 3192, 3197, 3203, 3208, 3213, 3218, 3224, 3229, 3234, - 3239, 3245, 3250, 3255, 3260, 3266, 3271, 3276, 3281, 3287, - 3292, 3297, 3302, 3308, 3313, 3318, 3323, 3328, 3333, 3338, - 3343, 3348, 3353, 3358, 3363, 3368, 3373, 3378, 3383, 3388, - 3393, 3398, 3403, 3408, 3413, 3418, 3423, 3428, 3434, 3440, - 3446, 3452, 3459, 3466, 3472, 3478, 3484, 3490, 3496, 3502, - 3508, 3513, 3518, 3534, 3539, 3544, 3552, 3552, 3563, 3563, - 3573, 3576, 3589, 3611, 3638, 3642, 3648, 3653, 3664, 3668, - 3674, 3680, 3691, 3694, 3701, 3705, 3706, 3712, 3713, 3714, - 3715, 3716, 3717, 3718, 3720, 3726, 3735, 3736, 3740, 3736, - 3752, 3753, 3757, 3757, 3764, 3764, 3778, 3781, 3789, 3797, - 3808, 3809, 3813, 3817, 3825, 3832, 3836, 3844, 3848, 3861, - 3865, 3873, 3873, 3893, 3896, 3902, 3914, 3926, 3930, 3938, - 3938, 3953, 3953, 3971, 3971, 3992, 3995, 4001, 4004, 4010, - 4014, 4021, 4026, 4031, 4038, 4041, 4045, 4050, 4054, 4064, - 4068, 4077, 4080, 4084, 4093, 4093, 4135, 4140, 4143, 4148, - 4151, 4158, 4161, 4166, 4169, 4174, 4177, 4182, 4185, 4190, - 4194, 4199, 4203, 4208, 4212, 4219, 4222, 4227, 4230, 4233, - 4236, 4239, 4244, 4253, 4264, 4269, 4277, 4281, 4286, 4290, - 4295, 4299, 4304, 4308, 4315, 4318, 4323, 4326, 4329, 4332, - 4337, 4345, 4355, 4359, 4364, 4368, 4373, 4377, 4384, 4387, - 4392, 4397, 4400, 4406, 4409, 4414, 4417 + 0, 395, 395, 401, 404, 409, 412, 415, 419, 423, + 426, 430, 434, 438, 442, 446, 450, 456, 464, 467, + 470, 473, 476, 481, 489, 496, 503, 509, 513, 520, + 523, 529, 536, 546, 554, 559, 587, 596, 602, 606, + 610, 630, 631, 632, 633, 639, 640, 645, 650, 659, + 660, 665, 673, 674, 680, 689, 690, 695, 700, 705, + 713, 714, 723, 735, 736, 745, 746, 755, 756, 765, + 766, 774, 775, 783, 784, 792, 793, 793, 811, 812, + 828, 832, 836, 840, 845, 849, 853, 857, 861, 865, + 869, 876, 879, 890, 897, 903, 910, 916, 921, 928, + 932, 936, 940, 945, 950, 959, 959, 970, 974, 981, + 985, 991, 997, 1007, 1010, 1017, 1025, 1045, 1068, 1083, + 1108, 1119, 1129, 1139, 1149, 1158, 1161, 1165, 1169, 1174, + 1182, 1189, 1194, 1199, 1204, 1213, 1223, 1250, 1259, 1266, + 1274, 1281, 1288, 1296, 1304, 1314, 1324, 1331, 1342, 1348, + 1351, 1358, 1362, 1366, 1375, 1385, 1388, 1399, 1402, 1405, + 1409, 1413, 1418, 1422, 1425, 1430, 1434, 1439, 1448, 1452, + 1457, 1463, 1469, 1476, 1481, 1486, 1494, 1500, 1512, 1526, + 1532, 1537, 1545, 1553, 1561, 1569, 1577, 1585, 1593, 1601, + 1609, 1616, 1623, 1627, 1632, 1637, 1642, 1647, 1652, 1657, + 1661, 1665, 1669, 1673, 1679, 1685, 1697, 1704, 1707, 1716, + 1723, 1734, 1739, 1747, 1751, 1761, 1764, 1770, 1776, 1781, + 1789, 1799, 1803, 1807, 1811, 1816, 1820, 1825, 1830, 1835, + 1840, 1845, 1850, 1855, 1860, 1865, 1871, 1877, 1883, 1888, + 1893, 1898, 1903, 1908, 1913, 1918, 1923, 1928, 1933, 1938, + 1944, 1951, 1956, 1961, 1966, 1971, 1976, 1981, 1986, 1991, + 1996, 2001, 2006, 2014, 2022, 2030, 2036, 2042, 2048, 2054, + 2060, 2066, 2072, 2078, 2084, 2090, 2096, 2102, 2108, 2114, + 2120, 2126, 2132, 2138, 2144, 2150, 2156, 2162, 2168, 2174, + 2180, 2186, 2192, 2198, 2204, 2210, 2216, 2222, 2228, 2236, + 2244, 2252, 2260, 2268, 2276, 2284, 2292, 2300, 2308, 2316, + 2324, 2330, 2336, 2342, 2348, 2354, 2360, 2366, 2372, 2378, + 2384, 2390, 2396, 2402, 2408, 2414, 2420, 2426, 2432, 2438, + 2444, 2450, 2456, 2462, 2468, 2474, 2480, 2486, 2492, 2498, + 2504, 2510, 2516, 2522, 2528, 2534, 2540, 2544, 2548, 2552, + 2557, 2563, 2568, 2573, 2578, 2583, 2588, 2593, 2599, 2604, + 2609, 2614, 2619, 2624, 2630, 2636, 2642, 2648, 2654, 2660, + 2666, 2672, 2678, 2684, 2690, 2696, 2702, 2708, 2713, 2718, + 2723, 2728, 2733, 2738, 2744, 2749, 2754, 2759, 2764, 2769, + 2774, 2779, 2785, 2790, 2795, 2800, 2805, 2810, 2815, 2820, + 2825, 2830, 2835, 2840, 2845, 2850, 2855, 2861, 2866, 2871, + 2877, 2883, 2888, 2893, 2898, 2904, 2909, 2914, 2919, 2925, + 2930, 2935, 2940, 2946, 2951, 2956, 2961, 2967, 2973, 2979, + 2985, 2990, 2996, 3002, 3008, 3013, 3018, 3023, 3028, 3033, + 3039, 3044, 3049, 3054, 3060, 3065, 3070, 3075, 3081, 3086, + 3091, 3096, 3102, 3107, 3112, 3117, 3123, 3128, 3133, 3138, + 3144, 3149, 3154, 3159, 3165, 3170, 3175, 3180, 3186, 3191, + 3196, 3201, 3207, 3212, 3217, 3222, 3228, 3233, 3238, 3243, + 3249, 3254, 3259, 3264, 3270, 3275, 3280, 3285, 3291, 3296, + 3301, 3306, 3312, 3317, 3322, 3327, 3333, 3338, 3343, 3348, + 3353, 3358, 3363, 3368, 3373, 3378, 3383, 3388, 3393, 3398, + 3403, 3408, 3413, 3418, 3423, 3428, 3433, 3438, 3443, 3448, + 3453, 3459, 3465, 3471, 3477, 3483, 3489, 3495, 3502, 3509, + 3515, 3521, 3527, 3533, 3540, 3547, 3554, 3561, 3565, 3570, + 3575, 3591, 3596, 3601, 3609, 3609, 3620, 3620, 3630, 3633, + 3646, 3668, 3695, 3699, 3705, 3710, 3721, 3725, 3731, 3737, + 3748, 3751, 3758, 3762, 3763, 3769, 3770, 3771, 3772, 3773, + 3774, 3775, 3777, 3783, 3792, 3793, 3797, 3793, 3809, 3810, + 3814, 3814, 3821, 3821, 3835, 3838, 3846, 3854, 3865, 3866, + 3870, 3874, 3882, 3889, 3893, 3901, 3905, 3918, 3922, 3930, + 3930, 3950, 3953, 3959, 3971, 3983, 3987, 3995, 3995, 4010, + 4010, 4028, 4028, 4049, 4052, 4058, 4061, 4067, 4071, 4078, + 4083, 4088, 4095, 4098, 4102, 4107, 4111, 4121, 4125, 4134, + 4137, 4141, 4150, 4150, 4192, 4197, 4200, 4205, 4208, 4215, + 4218, 4223, 4226, 4231, 4234, 4239, 4242, 4247, 4251, 4256, + 4260, 4265, 4269, 4276, 4279, 4284, 4287, 4290, 4293, 4296, + 4301, 4310, 4321, 4326, 4334, 4338, 4343, 4347, 4352, 4356, + 4361, 4365, 4372, 4375, 4380, 4383, 4386, 4389, 4394, 4397, + 4402, 4408, 4411, 4414, 4417, 4422, 4426, 4431, 4435, 4440, + 4444, 4451, 4454, 4459, 4462, 4467, 4470, 4476, 4479, 4484, + 4487 }; #endif @@ -1254,16 +1282,17 @@ static const char *const yytname[] = "F32MAT4X2", "F32MAT4X3", "F32MAT4X4", "F64MAT2X2", "F64MAT2X3", "F64MAT2X4", "F64MAT3X2", "F64MAT3X3", "F64MAT3X4", "F64MAT4X2", "F64MAT4X3", "F64MAT4X4", "ATOMIC_UINT", "ACCSTRUCTNV", "ACCSTRUCTEXT", - "RAYQUERYEXT", "FCOOPMATNV", "ICOOPMATNV", "UCOOPMATNV", - "SAMPLERCUBEARRAY", "SAMPLERCUBEARRAYSHADOW", "ISAMPLERCUBEARRAY", - "USAMPLERCUBEARRAY", "SAMPLER1D", "SAMPLER1DARRAY", - "SAMPLER1DARRAYSHADOW", "ISAMPLER1D", "SAMPLER1DSHADOW", "SAMPLER2DRECT", - "SAMPLER2DRECTSHADOW", "ISAMPLER2DRECT", "USAMPLER2DRECT", - "SAMPLERBUFFER", "ISAMPLERBUFFER", "USAMPLERBUFFER", "SAMPLER2DMS", - "ISAMPLER2DMS", "USAMPLER2DMS", "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY", - "USAMPLER2DMSARRAY", "SAMPLEREXTERNALOES", "SAMPLEREXTERNAL2DY2YEXT", - "ISAMPLER1DARRAY", "USAMPLER1D", "USAMPLER1DARRAY", "F16SAMPLER1D", - "F16SAMPLER2D", "F16SAMPLER3D", "F16SAMPLER2DRECT", "F16SAMPLERCUBE", + "RAYQUERYEXT", "FCOOPMATNV", "ICOOPMATNV", "UCOOPMATNV", "COOPMAT", + "HITOBJECTNV", "HITOBJECTATTRNV", "SAMPLERCUBEARRAY", + "SAMPLERCUBEARRAYSHADOW", "ISAMPLERCUBEARRAY", "USAMPLERCUBEARRAY", + "SAMPLER1D", "SAMPLER1DARRAY", "SAMPLER1DARRAYSHADOW", "ISAMPLER1D", + "SAMPLER1DSHADOW", "SAMPLER2DRECT", "SAMPLER2DRECTSHADOW", + "ISAMPLER2DRECT", "USAMPLER2DRECT", "SAMPLERBUFFER", "ISAMPLERBUFFER", + "USAMPLERBUFFER", "SAMPLER2DMS", "ISAMPLER2DMS", "USAMPLER2DMS", + "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY", "USAMPLER2DMSARRAY", + "SAMPLEREXTERNALOES", "SAMPLEREXTERNAL2DY2YEXT", "ISAMPLER1DARRAY", + "USAMPLER1D", "USAMPLER1DARRAY", "F16SAMPLER1D", "F16SAMPLER2D", + "F16SAMPLER3D", "F16SAMPLER2DRECT", "F16SAMPLERCUBE", "F16SAMPLER1DARRAY", "F16SAMPLER2DARRAY", "F16SAMPLERCUBEARRAY", "F16SAMPLERBUFFER", "F16SAMPLER2DMS", "F16SAMPLER2DMSARRAY", "F16SAMPLER1DSHADOW", "F16SAMPLER2DSHADOW", "F16SAMPLER1DARRAYSHADOW", @@ -1299,33 +1328,34 @@ static const char *const yytname[] = "F16SUBPASSINPUTMS", "SPIRV_INSTRUCTION", "SPIRV_EXECUTION_MODE", "SPIRV_EXECUTION_MODE_ID", "SPIRV_DECORATE", "SPIRV_DECORATE_ID", "SPIRV_DECORATE_STRING", "SPIRV_TYPE", "SPIRV_STORAGE_CLASS", - "SPIRV_BY_REFERENCE", "SPIRV_LITERAL", "LEFT_OP", "RIGHT_OP", "INC_OP", - "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", - "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", - "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", - "SUB_ASSIGN", "STRING_LITERAL", "LEFT_PAREN", "RIGHT_PAREN", - "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", - "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", - "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", - "CARET", "AMPERSAND", "QUESTION", "INVARIANT", "HIGH_PRECISION", - "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "PACKED", "RESOURCE", - "SUPERP", "FLOATCONSTANT", "INTCONSTANT", "UINTCONSTANT", "BOOLCONSTANT", + "SPIRV_BY_REFERENCE", "SPIRV_LITERAL", "ATTACHMENTEXT", "IATTACHMENTEXT", + "UATTACHMENTEXT", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", + "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", + "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", + "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "STRING_LITERAL", + "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET", "RIGHT_BRACKET", + "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON", "EQUAL", + "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH", "PERCENT", + "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET", "AMPERSAND", + "QUESTION", "INVARIANT", "HIGH_PRECISION", "MEDIUM_PRECISION", + "LOW_PRECISION", "PRECISION", "PACKED", "RESOURCE", "SUPERP", + "FLOATCONSTANT", "INTCONSTANT", "UINTCONSTANT", "BOOLCONSTANT", "IDENTIFIER", "TYPE_NAME", "CENTROID", "IN", "OUT", "INOUT", "STRUCT", "VOID", "WHILE", "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT", "TERMINATE_INVOCATION", "TERMINATE_RAY", "IGNORE_INTERSECTION", "UNIFORM", "SHARED", "BUFFER", - "FLAT", "SMOOTH", "LAYOUT", "DOUBLECONSTANT", "INT16CONSTANT", - "UINT16CONSTANT", "FLOAT16CONSTANT", "INT32CONSTANT", "UINT32CONSTANT", - "INT64CONSTANT", "UINT64CONSTANT", "SUBROUTINE", "DEMOTE", "PAYLOADNV", - "PAYLOADINNV", "HITATTRNV", "CALLDATANV", "CALLDATAINNV", "PAYLOADEXT", - "PAYLOADINEXT", "HITATTREXT", "CALLDATAEXT", "CALLDATAINEXT", "PATCH", - "SAMPLE", "NONUNIFORM", "COHERENT", "VOLATILE", "RESTRICT", "READONLY", - "WRITEONLY", "DEVICECOHERENT", "QUEUEFAMILYCOHERENT", - "WORKGROUPCOHERENT", "SUBGROUPCOHERENT", "NONPRIVATE", - "SHADERCALLCOHERENT", "NOPERSPECTIVE", "EXPLICITINTERPAMD", - "PERVERTEXEXT", "PERVERTEXNV", "PERPRIMITIVENV", "PERVIEWNV", - "PERTASKNV", "PERPRIMITIVEEXT", "TASKPAYLOADWORKGROUPEXT", "PRECISE", - "$accept", "variable_identifier", "primary_expression", + "TILEIMAGEEXT", "FLAT", "SMOOTH", "LAYOUT", "DOUBLECONSTANT", + "INT16CONSTANT", "UINT16CONSTANT", "FLOAT16CONSTANT", "INT32CONSTANT", + "UINT32CONSTANT", "INT64CONSTANT", "UINT64CONSTANT", "SUBROUTINE", + "DEMOTE", "PAYLOADNV", "PAYLOADINNV", "HITATTRNV", "CALLDATANV", + "CALLDATAINNV", "PAYLOADEXT", "PAYLOADINEXT", "HITATTREXT", + "CALLDATAEXT", "CALLDATAINEXT", "PATCH", "SAMPLE", "NONUNIFORM", + "COHERENT", "VOLATILE", "RESTRICT", "READONLY", "WRITEONLY", + "DEVICECOHERENT", "QUEUEFAMILYCOHERENT", "WORKGROUPCOHERENT", + "SUBGROUPCOHERENT", "NONPRIVATE", "SHADERCALLCOHERENT", "NOPERSPECTIVE", + "EXPLICITINTERPAMD", "PERVERTEXEXT", "PERVERTEXNV", "PERPRIMITIVENV", + "PERVIEWNV", "PERTASKNV", "PERPRIMITIVEEXT", "TASKPAYLOADWORKGROUPEXT", + "PRECISE", "$accept", "variable_identifier", "primary_expression", "postfix_expression", "integer_expression", "function_call", "function_call_or_method", "function_call_generic", "function_call_header_no_parameters", @@ -1370,7 +1400,7 @@ static const char *const yytname[] = "spirv_execution_mode_id_parameter_list", "spirv_storage_class_qualifier", "spirv_decorate_qualifier", "spirv_decorate_parameter_list", "spirv_decorate_parameter", - "spirv_decorate_id_parameter_list", + "spirv_decorate_id_parameter_list", "spirv_decorate_id_parameter", "spirv_decorate_string_parameter_list", "spirv_type_specifier", "spirv_type_parameter_list", "spirv_type_parameter", "spirv_instruction_qualifier", "spirv_instruction_qualifier_list", @@ -1384,636 +1414,543 @@ yysymbol_name (yysymbol_kind_t yysymbol) } #endif -#ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_int16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, - 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, - 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, - 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, - 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, - 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, - 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, - 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, - 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, - 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, - 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, - 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, - 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, - 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, - 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, - 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, - 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, - 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, - 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, - 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, - 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, - 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, - 705, 706, 707, 708, 709, 710, 711, 712 -}; -#endif - -#define YYPACT_NINF (-813) +#define YYPACT_NINF (-872) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF (-573) +#define YYTABLE_NINF (-695) #define yytable_value_is_error(Yyn) \ 0 - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { - 4575, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -300, -272, -219, -123, -120, - -118, -105, -87, -813, -813, -317, -813, -813, -813, -813, - -813, -62, -813, -813, -813, -813, -813, -324, -813, -813, - -813, -813, -813, -813, -76, -64, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -319, -260, -133, -174, 7760, -191, -813, -166, -813, - -813, -813, -813, 5485, -813, -813, -813, -813, -61, -813, - -813, 935, -813, -813, 7760, -39, -813, -813, -813, 5940, - -50, -335, -267, -162, -152, -139, -50, -137, -46, 12111, - -813, -29, -339, -43, -813, -268, -813, -27, -6, 7760, - -813, -813, -813, 7760, -37, -36, -813, -298, -813, -237, - -813, -813, 10812, -5, -813, -813, -813, 1, -33, 7760, - -813, -4, -2, -3, -813, -236, -813, -227, -1, 3, - 4, 5, -225, 6, 10, 12, 13, 14, 17, -223, - 8, 18, 16, -304, -813, 21, 7760, -813, 19, -813, - -222, -813, -813, -207, 9080, -813, -247, 1390, -813, -813, - -813, -813, -813, -5, -270, -813, 9513, -250, -813, -22, - -813, -132, 10812, 10812, -813, 10812, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -265, -813, -813, -813, 25, - -204, 11245, 27, -813, 10812, -813, -813, -314, 30, -6, - 33, -813, -315, -50, -813, 15, -813, -325, 32, -130, - 10812, -129, -813, -146, -125, 10812, -124, 39, -119, -50, - -813, 11678, -813, -115, 10812, 36, -46, -813, 7760, 20, - 6395, -813, 7760, 10812, -813, -339, -813, 29, -813, -813, - -47, -83, -59, -288, -18, -17, 22, 26, 54, 59, - -309, 46, 9946, -813, 37, -813, -813, 50, 56, 58, - -813, 72, 74, 65, 10379, 76, 10812, 69, 68, 73, - 75, 77, -168, -813, -813, -82, -813, -260, 79, 82, - -813, -813, -813, -813, -813, 1845, -813, -813, -813, -813, - -813, -813, -813, -813, -813, 5030, 30, 9513, -241, 8214, - -813, -813, 9513, 7760, -813, 52, -813, -813, -813, -202, - -813, -813, 10812, 55, -813, -813, 10812, 85, -813, -813, - -813, 10812, -813, -813, -813, -310, -813, -813, -197, 81, - -813, -813, -813, -813, -813, -813, -195, -813, -194, -813, - -813, -190, 87, -813, -813, -813, -813, -169, -813, -167, - -813, -165, 89, -813, -158, 90, -157, 81, -813, -156, - -813, 91, 97, -813, -813, 20, -5, -77, -813, -813, - -813, 6850, -813, -813, -813, 10812, 10812, 10812, 10812, 10812, - 10812, 10812, 10812, 10812, 10812, 10812, 10812, 10812, 10812, 10812, - 10812, 10812, 10812, 10812, -813, -813, -813, 96, -813, 2300, - -813, -813, -813, 2300, -813, 10812, -813, -813, -49, 10812, - -26, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, 10812, 10812, -813, - -813, -813, -813, -813, -813, -813, 9513, -813, -813, -31, - -813, 7305, -813, -813, 98, 95, -813, -813, -813, -813, - -813, -172, -134, -813, -307, -813, -325, -813, -325, -813, - 10812, 10812, -813, -146, -813, -146, -813, 10812, 10812, -813, - 104, 39, -813, 11678, -813, 10812, -813, -813, -48, 30, - 20, -813, -813, -813, -813, -813, -47, -47, -83, -83, - -59, -59, -59, -59, -288, -288, -18, -17, 22, 26, - 54, 59, 10812, -813, 2300, 4120, 60, 3665, -155, -813, - -154, -813, -813, -813, -813, -813, 8647, -813, -813, -813, - 106, -813, -15, -813, -147, -813, -145, -813, -144, -813, - -143, -813, -142, -140, -813, -813, -813, -24, 101, 95, - 71, 107, 110, -813, -813, 4120, 109, -813, -813, -813, - -813, -813, -813, -813, -813, -813, -813, -813, 10812, -813, - 102, 2755, 10812, -813, 105, 113, 70, 112, 3210, -813, - 115, -813, 9513, -813, -813, -813, -135, 10812, 2755, 109, - -813, -813, 2300, -813, 111, 95, -813, -813, 2300, 117, - -813, -813 + 4648, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -305, -301, + -289, -276, -246, -238, -227, -182, -872, -872, -872, -872, + -872, -168, -872, -872, -872, -872, -872, -55, -872, -872, + -872, -872, -872, -319, -872, -872, -872, -872, -872, -872, + -872, -135, -120, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -327, -114, + -81, -124, 7882, -313, -872, -101, -872, -872, -872, -872, + 5572, -872, -872, -872, -872, -94, -872, -872, 952, -872, + -872, 7882, -73, -872, -872, -872, 6034, -78, -252, -250, + -216, -197, -136, -78, -127, -49, 12303, -872, -13, -346, + -39, -872, -309, -872, -10, -9, 7882, -872, -872, -872, + 7882, -38, -37, -872, -267, -872, -236, -872, -872, 10983, + -2, -872, -872, -872, 3, -35, 7882, -872, -8, -6, + -1, -872, -256, -872, -255, -4, 4, 7, 8, -237, + 10, 11, 13, 14, 15, 18, -232, 9, 19, 27, + -188, -872, -3, 7882, -872, 20, -872, -229, -872, -872, + -219, 9223, -872, -272, 1414, -872, -872, -872, -872, -872, + -2, -277, -872, 9663, -265, -872, -23, -872, -112, 10983, + 10983, -872, 10983, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -253, -872, -872, -872, 29, -204, 11423, 28, + -872, 10983, -872, 31, -321, 17, -9, 32, -872, -325, + -78, -872, 5, -872, -330, 33, -125, 10983, -123, -872, + -130, -119, -146, -118, 34, -103, -78, -872, 11863, -872, + -74, 10983, 36, -49, -872, 7882, 24, 6496, -872, 7882, + 10983, -872, -346, -872, 30, -872, -872, -33, -133, -105, + -303, -11, -14, 21, 23, 48, 52, -316, 41, -872, + 10103, -872, 42, -872, -872, 46, 38, 40, -872, 64, + 67, 60, 10543, 74, 10983, 68, 65, 69, 70, 73, + -167, -872, -872, -47, -872, -114, 77, 31, -872, -872, + -872, -872, -872, 1876, -872, -872, -872, -872, -872, -872, + -872, -872, -872, 5110, 17, 9663, -261, 8343, -872, -872, + 9663, 7882, -872, 50, -872, -872, -872, -203, -872, -872, + 10983, 51, -872, -872, 10983, 87, -872, -872, -872, 10983, + -872, -872, -872, -312, -872, -872, -200, 80, -872, -872, + -872, -872, -872, -872, -199, -872, -196, -872, -872, -195, + 71, -872, -872, -872, -872, -169, -872, -164, -872, -872, + -872, -872, -872, -161, -872, 83, -872, -160, 84, -153, + 80, -872, -278, -152, -872, 91, 94, -872, -872, 24, + -2, -43, -872, -872, -872, 6958, -872, -872, -872, 10983, + 10983, 10983, 10983, 10983, 10983, 10983, 10983, 10983, 10983, 10983, + 10983, 10983, 10983, 10983, 10983, 10983, 10983, 10983, -872, -872, + -872, 93, -872, 2338, -872, -872, -872, 2338, -872, 10983, + -872, -872, -42, 10983, -32, -872, -872, -872, -872, -872, + -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, 10983, 10983, -872, -872, -872, -872, -872, -872, -872, + 9663, -872, -872, -76, -872, 7420, -872, -872, 96, 95, + -872, -872, -872, -872, -872, -132, -131, -872, -311, -872, + -330, -872, -330, -872, 10983, 10983, -872, -130, -872, -130, + -872, -146, -146, -872, 101, 34, -872, 11863, -872, 10983, + -872, -872, -41, 17, 24, -872, -872, -872, -872, -872, + -33, -33, -133, -133, -105, -105, -105, -105, -303, -303, + -11, -14, 21, 23, 48, 52, 10983, -872, 2338, 4186, + 59, 3724, -151, -872, -150, -872, -872, -872, -872, -872, + 8783, -872, -872, -872, 105, -872, 72, -872, -149, -872, + -148, -872, -141, -872, -140, -872, -139, -138, -872, -872, + -872, -28, 102, 95, 75, 107, 106, -872, -872, 4186, + 108, -872, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, 10983, -872, 100, 2800, 10983, -872, 104, 109, + 76, 112, 3262, -872, 113, -872, 9663, -872, -872, -872, + -137, 10983, 2800, 108, -872, -872, 2338, -872, 110, 95, + -872, -872, 2338, 114, -872, -872 }; - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ +/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const yytype_int16 yydefact[] = { - 0, 168, 222, 220, 221, 219, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 223, 224, 225, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 348, 349, 350, 351, 352, 353, 354, 374, 375, 376, - 377, 378, 379, 380, 389, 402, 403, 390, 391, 393, - 392, 394, 395, 396, 397, 398, 399, 400, 401, 176, - 177, 248, 249, 247, 250, 257, 258, 255, 256, 253, - 254, 251, 252, 280, 281, 282, 292, 293, 294, 277, - 278, 279, 289, 290, 291, 274, 275, 276, 286, 287, - 288, 271, 272, 273, 283, 284, 285, 259, 260, 261, - 295, 296, 297, 262, 263, 264, 307, 308, 309, 265, - 266, 267, 319, 320, 321, 268, 269, 270, 331, 332, - 333, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 334, 335, - 336, 337, 338, 339, 340, 341, 342, 346, 343, 344, - 345, 527, 528, 529, 358, 359, 382, 385, 347, 356, - 357, 373, 355, 404, 405, 408, 409, 410, 412, 413, - 414, 416, 417, 418, 420, 421, 517, 518, 381, 383, - 384, 360, 361, 362, 406, 363, 367, 368, 371, 411, - 415, 419, 364, 365, 369, 370, 407, 366, 372, 451, - 453, 454, 455, 457, 458, 459, 461, 462, 463, 465, - 466, 467, 469, 470, 471, 473, 474, 475, 477, 478, - 479, 481, 482, 483, 485, 486, 487, 489, 490, 491, - 493, 494, 452, 456, 460, 464, 468, 476, 480, 484, - 472, 488, 492, 495, 496, 497, 498, 499, 500, 501, + 0, 168, 225, 223, 224, 222, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 226, 227, 228, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 351, 352, 353, 354, 355, 356, 357, 377, 378, 379, + 380, 381, 382, 383, 392, 405, 406, 393, 394, 396, + 395, 397, 398, 399, 400, 401, 402, 403, 404, 177, + 178, 251, 252, 250, 253, 260, 261, 258, 259, 256, + 257, 254, 255, 283, 284, 285, 295, 296, 297, 280, + 281, 282, 292, 293, 294, 277, 278, 279, 289, 290, + 291, 274, 275, 276, 286, 287, 288, 262, 263, 264, + 298, 299, 300, 265, 266, 267, 310, 311, 312, 268, + 269, 270, 322, 323, 324, 271, 272, 273, 334, 335, + 336, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 325, + 326, 327, 328, 329, 330, 331, 332, 333, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 349, 346, 347, + 348, 533, 534, 535, 536, 538, 182, 361, 362, 385, + 388, 350, 359, 360, 376, 358, 407, 408, 411, 412, + 413, 415, 416, 417, 419, 420, 421, 423, 424, 520, + 521, 384, 386, 387, 363, 364, 365, 409, 366, 370, + 371, 374, 414, 418, 422, 367, 368, 372, 373, 410, + 369, 375, 454, 456, 457, 458, 460, 461, 462, 464, + 465, 466, 468, 469, 470, 472, 473, 474, 476, 477, + 478, 480, 481, 482, 484, 485, 486, 488, 489, 490, + 492, 493, 494, 496, 497, 455, 459, 463, 467, 471, + 479, 483, 487, 475, 491, 495, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, - 512, 513, 514, 515, 516, 386, 387, 388, 422, 431, - 433, 427, 432, 434, 435, 437, 438, 439, 441, 442, - 443, 445, 446, 447, 449, 450, 423, 424, 425, 436, - 426, 428, 429, 430, 440, 444, 448, 519, 520, 523, - 524, 525, 526, 521, 522, 0, 0, 0, 0, 0, - 0, 0, 0, 166, 167, 0, 623, 137, 533, 534, - 535, 0, 532, 172, 170, 171, 169, 0, 218, 173, - 174, 175, 139, 138, 0, 201, 182, 184, 180, 186, - 188, 183, 185, 181, 187, 189, 178, 179, 204, 190, - 197, 198, 199, 200, 191, 192, 193, 194, 195, 196, - 140, 141, 143, 142, 144, 146, 147, 145, 203, 154, - 622, 0, 624, 0, 114, 113, 0, 125, 130, 161, - 160, 158, 162, 0, 155, 157, 163, 135, 214, 159, - 531, 0, 619, 621, 0, 0, 164, 165, 530, 0, + 512, 513, 514, 515, 516, 517, 518, 519, 389, 390, + 391, 425, 434, 436, 430, 435, 437, 438, 440, 441, + 442, 444, 445, 446, 448, 449, 450, 452, 453, 426, + 427, 428, 439, 429, 431, 432, 433, 443, 447, 451, + 525, 526, 529, 530, 531, 532, 527, 528, 0, 0, + 0, 0, 0, 0, 0, 0, 166, 167, 522, 523, + 524, 0, 631, 137, 541, 542, 543, 0, 540, 172, + 170, 171, 169, 0, 221, 173, 175, 176, 174, 139, + 138, 0, 203, 184, 186, 181, 188, 190, 185, 187, + 183, 189, 191, 179, 180, 206, 192, 199, 200, 201, + 202, 193, 194, 195, 196, 197, 198, 140, 141, 143, + 142, 144, 146, 147, 145, 205, 154, 630, 0, 632, + 0, 114, 113, 0, 125, 130, 161, 160, 158, 162, + 0, 155, 157, 163, 135, 216, 159, 539, 0, 627, + 629, 0, 0, 164, 165, 537, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 546, 0, 0, + 0, 99, 0, 94, 0, 109, 0, 121, 115, 123, + 0, 124, 0, 97, 131, 102, 0, 156, 136, 0, + 209, 215, 1, 628, 0, 0, 0, 96, 0, 0, + 0, 639, 0, 697, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 637, + 0, 635, 0, 0, 544, 151, 153, 0, 149, 207, + 0, 0, 100, 0, 0, 633, 110, 116, 120, 122, + 118, 126, 117, 0, 132, 105, 0, 103, 0, 0, + 0, 9, 0, 43, 42, 44, 41, 5, 6, 7, + 8, 2, 16, 14, 15, 17, 10, 11, 12, 13, + 3, 18, 37, 20, 25, 26, 0, 0, 30, 0, + 219, 0, 36, 218, 0, 210, 111, 0, 95, 0, + 0, 695, 0, 647, 0, 0, 0, 0, 0, 664, + 0, 0, 0, 0, 0, 0, 0, 689, 0, 662, + 0, 0, 0, 0, 98, 0, 0, 0, 548, 0, + 0, 148, 0, 204, 0, 211, 45, 49, 52, 55, + 60, 63, 65, 67, 69, 71, 73, 75, 0, 34, + 0, 101, 575, 584, 588, 0, 0, 0, 609, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 538, 0, 0, 0, 99, 0, 94, 0, 109, 0, - 121, 115, 123, 0, 124, 0, 97, 131, 102, 0, - 156, 136, 0, 207, 213, 1, 620, 0, 0, 0, - 96, 0, 0, 0, 631, 0, 683, 0, 0, 0, + 45, 78, 91, 0, 562, 0, 163, 135, 565, 586, + 564, 572, 563, 0, 566, 567, 590, 568, 597, 569, + 570, 605, 571, 0, 119, 0, 127, 0, 556, 134, + 0, 0, 107, 0, 104, 38, 39, 0, 22, 23, + 0, 0, 28, 27, 0, 221, 31, 33, 40, 0, + 217, 112, 699, 0, 700, 640, 0, 0, 698, 659, + 655, 656, 657, 658, 0, 653, 0, 93, 660, 0, + 0, 674, 675, 676, 677, 0, 672, 0, 681, 682, + 683, 684, 680, 0, 678, 0, 685, 0, 0, 0, + 2, 693, 216, 0, 691, 0, 0, 634, 636, 0, + 554, 0, 552, 547, 549, 0, 152, 150, 208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 629, 0, 627, 0, 0, 536, 151, 153, - 0, 149, 205, 0, 0, 100, 0, 0, 625, 110, - 116, 120, 122, 118, 126, 117, 0, 132, 105, 0, - 103, 0, 0, 0, 9, 0, 43, 42, 44, 41, - 5, 6, 7, 8, 2, 16, 14, 15, 17, 10, - 11, 12, 13, 3, 18, 37, 20, 25, 26, 0, - 0, 30, 0, 216, 0, 36, 34, 0, 208, 111, - 0, 95, 0, 0, 681, 0, 639, 0, 0, 0, - 0, 0, 656, 0, 0, 0, 0, 0, 0, 0, - 676, 0, 654, 0, 0, 0, 0, 98, 0, 0, - 0, 540, 0, 0, 148, 0, 202, 0, 209, 45, - 49, 52, 55, 60, 63, 65, 67, 69, 71, 73, - 75, 0, 0, 101, 567, 576, 580, 0, 0, 0, - 601, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 45, 78, 91, 0, 554, 0, 163, 135, - 557, 578, 556, 564, 555, 0, 558, 559, 582, 560, - 589, 561, 562, 597, 563, 0, 119, 0, 127, 0, - 548, 134, 0, 0, 107, 0, 104, 38, 39, 0, - 22, 23, 0, 0, 28, 27, 0, 218, 31, 33, - 40, 0, 215, 112, 685, 0, 686, 632, 0, 0, - 684, 651, 647, 648, 649, 650, 0, 645, 0, 93, - 652, 0, 0, 666, 667, 668, 669, 0, 664, 0, - 670, 0, 0, 672, 0, 0, 0, 2, 680, 0, - 678, 0, 0, 626, 628, 0, 546, 0, 544, 539, - 541, 0, 152, 150, 206, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 76, 210, 211, 0, 566, 0, - 599, 612, 611, 0, 603, 0, 615, 613, 0, 0, - 0, 596, 616, 617, 618, 565, 81, 82, 84, 83, - 86, 87, 88, 89, 90, 85, 80, 0, 0, 581, - 577, 579, 583, 590, 598, 129, 0, 551, 552, 0, - 133, 0, 108, 4, 0, 24, 21, 32, 217, 635, - 637, 0, 0, 682, 0, 641, 0, 640, 0, 643, - 0, 0, 658, 0, 657, 0, 660, 0, 0, 662, - 0, 0, 677, 0, 674, 0, 655, 630, 0, 547, - 0, 542, 537, 46, 47, 48, 51, 50, 53, 54, - 58, 59, 56, 57, 61, 62, 64, 66, 68, 70, - 72, 74, 0, 212, 568, 0, 0, 0, 0, 614, - 0, 595, 79, 92, 128, 549, 0, 106, 19, 633, - 0, 634, 0, 646, 0, 653, 0, 665, 0, 671, - 0, 673, 0, 0, 679, 543, 545, 0, 0, 587, - 0, 0, 0, 606, 605, 608, 574, 591, 550, 553, - 636, 638, 642, 644, 659, 661, 663, 675, 0, 569, - 0, 0, 0, 607, 0, 0, 586, 0, 0, 584, - 0, 77, 0, 571, 600, 570, 0, 609, 0, 574, - 573, 575, 593, 588, 0, 610, 604, 585, 594, 0, - 602, 592 + 0, 0, 0, 0, 0, 0, 0, 0, 76, 212, + 213, 0, 574, 0, 607, 620, 619, 0, 611, 0, + 623, 621, 0, 0, 0, 604, 624, 625, 626, 573, + 81, 82, 84, 83, 86, 87, 88, 89, 90, 85, + 80, 0, 0, 589, 585, 587, 591, 598, 606, 129, + 0, 559, 560, 0, 133, 0, 108, 4, 0, 24, + 21, 32, 220, 643, 645, 0, 0, 696, 0, 649, + 0, 648, 0, 651, 0, 0, 666, 0, 665, 0, + 668, 0, 0, 670, 0, 0, 690, 0, 687, 0, + 663, 638, 0, 555, 0, 550, 545, 46, 47, 48, + 51, 50, 53, 54, 58, 59, 56, 57, 61, 62, + 64, 66, 68, 70, 72, 74, 0, 214, 576, 0, + 0, 0, 0, 622, 0, 603, 79, 92, 128, 557, + 0, 106, 19, 641, 0, 642, 0, 654, 0, 661, + 0, 673, 0, 679, 0, 686, 0, 0, 692, 551, + 553, 0, 0, 595, 0, 0, 0, 614, 613, 616, + 582, 599, 558, 561, 644, 646, 650, 652, 667, 669, + 671, 688, 0, 577, 0, 0, 0, 615, 0, 0, + 594, 0, 0, 592, 0, 77, 0, 579, 608, 578, + 0, 617, 0, 582, 581, 583, 601, 596, 0, 618, + 612, 593, 602, 0, 610, 600 }; - /* YYPGOTO[NTERM-NUM]. */ +/* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, - -813, -813, -429, -813, -381, -380, -483, -383, -262, -257, - -261, -258, -255, -259, -813, -479, -813, -492, -813, -495, - -536, 11, -813, -813, -813, 7, -388, -813, -813, 42, - 49, 47, -813, -813, -401, -813, -813, -813, -813, -96, - -813, -384, -371, -813, 9, -813, 0, -425, -813, -813, - -813, -813, 150, -813, -813, -813, -546, -553, -217, -338, - -607, -813, -364, -619, -812, -813, -421, -813, -813, -428, - -430, -813, -813, 64, -718, -355, -813, -141, -813, -390, - -813, -138, -813, -813, -813, -813, -136, -813, -813, -813, - -813, -813, -813, -813, -813, 92, -813, -813, 2, -813, - -68, -275, -456, -813, -813, -813, -296, -293, -301, -813, - -813, -299, -295, -303, -302, -813, -306, -311, -813, -392, - -530 + -872, -544, -872, -872, -872, -872, -872, -872, -872, -872, + -872, -872, -436, -872, -392, -391, -490, -390, -269, -266, + -268, -264, -262, -260, -872, -482, -872, -499, -872, -492, + -534, 6, -872, -872, -872, 1, -403, -872, -872, 45, + 44, 49, -872, -872, -406, -872, -872, -872, -872, -104, + -872, -389, -375, -872, 12, -872, 0, -433, -872, -872, + -872, -553, 145, -872, -872, -872, -560, -556, -233, -344, + -614, -872, -373, -626, -871, -872, -430, -872, -872, -440, + -437, -872, -872, 63, -737, -363, -872, -144, -872, -399, + -872, -142, -872, -872, -872, -872, -134, -872, -872, -872, + -872, -872, -872, -872, -872, 97, -872, -872, 2, -872, + -71, -308, -416, -872, -872, -872, -304, -307, -302, -872, + -872, -315, -310, -306, -300, -314, -872, -299, -317, -872, + -395, -538 }; - /* YYDEFGOTO[NTERM-NUM]. */ +/* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 523, 524, 525, 784, 526, 527, 528, 529, 530, - 531, 532, 612, 534, 580, 581, 582, 583, 584, 585, - 586, 587, 588, 589, 590, 613, 842, 614, 767, 615, - 698, 616, 381, 643, 501, 617, 383, 384, 385, 430, - 431, 432, 386, 387, 388, 389, 390, 391, 480, 481, - 392, 393, 394, 395, 535, 483, 536, 486, 443, 444, - 537, 398, 399, 400, 572, 476, 570, 571, 707, 708, - 641, 779, 620, 621, 622, 623, 624, 739, 878, 914, - 906, 907, 908, 915, 625, 626, 627, 628, 909, 881, - 629, 630, 910, 929, 631, 632, 633, 845, 743, 847, - 885, 904, 905, 634, 401, 402, 403, 427, 635, 473, - 474, 453, 454, 791, 792, 405, 676, 677, 681, 406, - 407, 687, 688, 691, 694, 408, 699, 700, 409, 455, - 456 + 0, 530, 531, 532, 798, 533, 534, 535, 536, 537, + 538, 539, 620, 541, 587, 588, 589, 590, 591, 592, + 593, 594, 595, 596, 597, 621, 856, 622, 781, 623, + 711, 624, 388, 651, 508, 625, 390, 391, 392, 437, + 438, 439, 393, 394, 395, 396, 397, 398, 487, 488, + 399, 400, 401, 402, 542, 490, 599, 493, 450, 451, + 544, 405, 406, 407, 579, 483, 577, 578, 721, 722, + 649, 793, 628, 629, 630, 631, 632, 753, 892, 928, + 920, 921, 922, 929, 633, 634, 635, 636, 923, 895, + 637, 638, 924, 943, 639, 640, 641, 859, 757, 861, + 899, 918, 919, 642, 408, 409, 410, 434, 643, 480, + 481, 460, 461, 805, 806, 412, 684, 685, 689, 413, + 414, 695, 696, 703, 704, 707, 415, 713, 714, 416, + 462, 463 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ +/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 397, 433, 404, 448, 640, 591, 771, 382, 448, 396, - 649, 380, 497, 533, 680, 670, 447, 710, 538, 690, - 449, 844, 440, 671, 469, 449, 711, 733, 702, 420, - 775, 670, 778, 664, 418, 780, 665, 712, 789, 658, - 424, 664, 661, 722, 723, 433, 478, 457, 565, 410, - 458, 495, 566, 484, 662, 579, 672, 673, 674, 675, - 496, 421, 440, 734, 650, 651, 425, 666, 636, 638, - 479, 679, 790, 647, 648, 666, 679, 411, 440, 724, - 725, 484, 679, 484, -35, 679, 652, 667, 637, 913, - 653, 485, 568, 667, 679, 667, 921, 781, 667, 426, - 667, 592, 667, 667, 592, 660, 913, 667, 642, 748, - 592, 750, 593, 737, 544, 460, 498, 776, 458, 499, - 545, 579, 500, 546, 846, 552, 579, 560, 574, 547, - 412, 553, 579, 561, 575, 579, 459, 461, 463, 465, - 467, 468, 471, 576, 579, 640, 655, 640, 783, 577, - 640, 668, 656, 793, 768, 795, 797, 785, 710, 545, - 799, 796, 798, 579, 787, 435, 800, 696, 436, 854, - 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, - 859, 802, 429, 804, 860, 806, 568, 803, 568, 805, - 766, 807, 809, 812, 814, 886, 887, 440, 810, 813, - 815, 768, 768, 892, 928, 893, 894, 895, 896, 796, - 897, 800, 803, 807, 810, 924, 815, 428, 861, 437, - 462, 768, 862, 458, 645, 771, 413, 646, 710, 414, - 464, 415, 788, 458, 448, 683, 684, 685, 686, 830, - 831, 832, 833, 466, 416, 470, 458, 447, 458, 889, - 848, 449, 678, 682, 850, 458, 458, 689, 692, 568, - 458, 458, 417, 695, 865, 680, 458, 701, 720, 721, - 458, 869, 690, 422, 768, 852, 853, 769, 718, 820, - 719, 819, 821, 670, 640, 423, 823, 824, 825, 579, - 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, - 579, 579, 579, 579, 579, 923, 442, 768, 820, 771, - 849, 875, 328, 329, 330, 726, 727, 715, 716, 717, - 450, 679, 679, 855, 477, 856, 487, 568, 679, 679, - 768, 851, 768, 898, 679, 452, 679, 826, 827, 472, - 828, 829, 482, 834, 835, 325, 484, 877, 493, 494, - 879, 539, 540, 543, 728, 541, 542, 548, 562, 549, - 550, 551, 554, 644, 640, 564, 555, 891, 556, 557, - 558, 579, 579, 559, 563, 654, 659, 573, 579, 579, - 567, 592, 495, 665, 579, 434, 579, 693, 703, 731, - 879, 738, 729, 441, 396, 730, 732, 568, 735, 740, - 669, 397, 396, 404, 397, 706, 911, 916, 382, 397, - 396, 404, 380, 396, 714, 741, 451, 742, 396, 475, - 640, 744, 925, 745, 746, 749, 751, 752, -36, 434, - 489, -34, 753, 434, 754, -29, 755, 782, 396, 794, - 786, 816, 396, 801, 880, 808, 811, 817, 843, 441, - 858, 768, 871, 882, 890, 899, 900, 901, 396, 902, - 912, 449, -572, 918, 917, 594, 836, 919, 922, 838, - 930, 931, 837, 839, 841, 491, 569, 840, 490, 713, - 492, 419, 876, 883, 880, 396, 920, 619, 818, 927, - 926, 488, 884, 446, 772, 903, 618, 773, 704, 774, - 866, 449, 864, 863, 874, 870, 868, 873, 867, 872, + 404, 389, 411, 440, 648, 455, 387, 785, 454, 598, + 455, 504, 403, 540, 678, 712, 858, 545, 702, 725, + 657, 724, 456, 688, 679, 447, 747, 456, 476, 672, + 678, 789, 673, 792, 736, 737, 794, 716, 431, 666, + 427, 669, 803, 672, 927, 485, 726, 440, 491, 442, + 417, 935, 443, 670, 418, 586, 492, 680, 681, 682, + 683, 927, 748, 674, 432, 447, 419, 644, 646, 486, + 738, 739, 428, 655, 656, 687, 804, 674, -694, 420, + 491, 447, 658, 659, -694, 600, 687, 645, 502, 687, + 491, 795, 600, 601, 575, 449, 600, 503, 687, 650, + 551, 553, -35, 790, 660, 668, 552, 554, 661, 421, + 466, 468, 470, 472, 474, 475, 478, 422, 751, 559, + 762, 586, 764, 505, 567, 560, 506, 581, 423, 507, + 568, 860, 586, 582, 675, 586, 464, 583, 467, 465, + 675, 465, 675, 584, 586, 675, 648, 675, 648, 675, + 675, 648, 663, 797, 675, 676, 807, 809, 664, 782, + 811, 813, 552, 810, 586, 801, 812, 814, 799, 724, + 572, 709, 469, 424, 573, 465, 868, 770, 771, 772, + 773, 774, 775, 776, 777, 778, 779, 816, 575, 425, + 575, 471, 818, 817, 465, 820, 823, 780, 819, 942, + 447, 821, 824, 826, 828, 900, 901, 906, 907, 827, + 829, 782, 782, 810, 814, 908, 909, 910, 911, 938, + 429, 817, 821, 824, 829, 782, 873, 875, 734, 735, + 874, 876, 785, 802, 732, 430, 733, 455, 436, 724, + 454, 698, 699, 700, 701, 521, 844, 845, 846, 847, + 653, 433, 473, 654, 456, 465, 903, 691, 692, 693, + 694, 477, 575, 686, 465, 690, 465, 862, 465, 697, + 705, 864, 465, 465, 712, 435, 712, 702, 702, 449, + 879, 688, 866, 867, 869, 708, 870, 833, 465, 678, + 444, 648, 457, 837, 838, 839, 586, 586, 586, 586, + 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, + 586, 586, 937, 459, 715, 782, 785, 465, 783, 834, + 782, 834, 835, 863, 889, 334, 335, 336, 740, 741, + 782, 865, 687, 687, 782, 912, 575, 729, 730, 731, + 840, 841, 479, 842, 843, 687, 484, 687, 331, 494, + 848, 849, 489, 500, 501, 491, 547, 548, 549, 546, + 555, 550, 574, 742, 891, 569, 556, 893, 652, 557, + 558, 648, 561, 562, 600, 563, 564, 565, 586, 586, + 566, 570, 571, 667, 580, 662, -34, 502, 706, 745, + 673, 586, 441, 586, 717, 746, 677, 743, 744, 749, + 448, 754, 752, 755, 403, 756, 575, 893, 404, 389, + 411, 404, 403, 925, 387, 720, 404, 458, 411, 758, + 403, 728, 759, 403, 930, 760, 482, 648, 403, 763, + 766, 765, -36, 815, 767, 768, 441, 496, 769, 939, + 441, 796, 800, -29, 808, 822, 825, 830, 403, 543, + 831, 857, 403, 894, 872, 885, 448, 782, 896, 904, + 905, 916, 913, 915, 926, 932, 914, -580, 403, 931, + 456, 602, 936, 850, 945, 944, 852, 851, 727, 933, + 497, 853, 426, 576, 854, 498, 832, 855, 897, 499, + 890, 934, 940, 894, 627, 403, 941, 495, 898, 786, + 917, 787, 718, 877, 882, 453, 626, 881, 878, 788, + 456, 886, 888, 880, 0, 0, 884, 0, 0, 0, + 0, 883, 0, 0, 0, 0, 0, 0, 887, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 671, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 663, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 719, 0, 576, 0, 576, + 0, 0, 0, 0, 0, 0, 0, 403, 0, 403, + 0, 403, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 705, 0, - 569, 0, 569, 0, 0, 0, 0, 396, 0, 396, - 0, 396, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 627, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 404, 0, 626, 0, 0, 0, 0, + 0, 576, 0, 0, 0, 403, 0, 0, 0, 0, + 0, 0, 0, 403, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 619, 0, 0, 0, 0, - 0, 0, 0, 0, 618, 397, 0, 0, 0, 0, - 0, 0, 0, 569, 396, 0, 0, 0, 0, 0, - 0, 0, 396, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 576, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 403, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 569, 0, 0, 0, 0, 0, 0, 0, 0, - 396, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 619, - 0, 0, 0, 619, 0, 0, 0, 0, 618, 0, - 0, 0, 618, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 627, 0, 0, 0, 627, 0, 0, + 0, 0, 0, 0, 0, 626, 0, 0, 0, 626, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 569, 0, 0, 0, 0, 0, 0, 0, 0, - 396, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 576, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 403, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 619, 619, 0, 619, 0, 404, - 0, 0, 0, 618, 618, 0, 618, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 627, 627, + 0, 627, 0, 411, 0, 0, 0, 0, 0, 0, + 626, 626, 0, 626, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 627, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 619, 0, 0, 0, 0, - 0, 0, 0, 0, 618, 0, 0, 0, 0, 0, - 0, 619, 0, 0, 0, 0, 0, 0, 619, 0, - 618, 0, 0, 0, 0, 0, 0, 618, 619, 0, - 0, 0, 619, 0, 0, 0, 0, 618, 619, 0, - 0, 618, 0, 0, 0, 445, 0, 618, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 626, 0, 0, 0, 627, 0, 0, 0, 0, + 0, 0, 627, 0, 0, 0, 0, 626, 0, 0, + 0, 0, 627, 0, 626, 0, 627, 0, 0, 0, + 0, 0, 627, 0, 626, 0, 0, 0, 626, 0, + 0, 0, 452, 0, 626, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 325, 0, 0, 0, - 0, 0, 0, 0, 326, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 327, 328, - 329, 330, 331, 0, 0, 0, 0, 0, 0, 0, - 0, 332, 333, 334, 335, 336, 337, 338, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 331, + 0, 0, 0, 0, 0, 0, 0, 332, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 339, 340, 341, 342, 343, 344, 0, - 0, 0, 0, 0, 0, 0, 0, 345, 0, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 0, 0, 502, - 503, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 504, 505, - 0, 325, 0, 594, 595, 0, 0, 0, 0, 596, - 506, 507, 508, 509, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 327, 328, 329, 330, 331, 0, 0, - 0, 510, 511, 512, 513, 514, 332, 333, 334, 335, - 336, 337, 338, 597, 598, 599, 600, 0, 601, 602, - 603, 604, 605, 606, 607, 608, 609, 610, 339, 340, - 341, 342, 343, 344, 515, 516, 517, 518, 519, 520, - 521, 522, 345, 611, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 0, 502, 503, 0, 0, 0, 0, + 0, 333, 334, 335, 336, 337, 0, 0, 0, 0, + 0, 0, 0, 0, 338, 339, 340, 341, 342, 343, + 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 345, 346, 347, 348, + 349, 350, 351, 0, 0, 0, 0, 0, 0, 0, + 0, 352, 0, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 382, 383, 384, 385, 386, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 0, 0, 509, + 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 511, 512, + 0, 331, 0, 602, 603, 0, 0, 0, 0, 604, + 513, 514, 515, 516, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 333, 334, 335, 336, 337, 0, 0, + 0, 517, 518, 519, 520, 521, 338, 339, 340, 341, + 342, 343, 344, 605, 606, 607, 608, 0, 609, 610, + 611, 612, 613, 614, 615, 616, 617, 618, 345, 346, + 347, 348, 349, 350, 351, 522, 523, 524, 525, 526, + 527, 528, 529, 352, 619, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, 384, 385, 386, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 0, + 0, 509, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 504, 505, 0, 325, 0, 594, 770, - 0, 0, 0, 0, 596, 506, 507, 508, 509, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 327, 328, - 329, 330, 331, 0, 0, 0, 510, 511, 512, 513, - 514, 332, 333, 334, 335, 336, 337, 338, 597, 598, - 599, 600, 0, 601, 602, 603, 604, 605, 606, 607, - 608, 609, 610, 339, 340, 341, 342, 343, 344, 515, - 516, 517, 518, 519, 520, 521, 522, 345, 611, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 0, 0, 502, - 503, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 504, 505, - 0, 325, 0, 594, 0, 0, 0, 0, 0, 596, - 506, 507, 508, 509, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 327, 328, 329, 330, 331, 0, 0, - 0, 510, 511, 512, 513, 514, 332, 333, 334, 335, - 336, 337, 338, 597, 598, 599, 600, 0, 601, 602, - 603, 604, 605, 606, 607, 608, 609, 610, 339, 340, - 341, 342, 343, 344, 515, 516, 517, 518, 519, 520, - 521, 522, 345, 611, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 0, 502, 503, 0, 0, 0, 0, + 511, 512, 0, 331, 0, 602, 784, 0, 0, 0, + 0, 604, 513, 514, 515, 516, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 333, 334, 335, 336, 337, + 0, 0, 0, 517, 518, 519, 520, 521, 338, 339, + 340, 341, 342, 343, 344, 605, 606, 607, 608, 0, + 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, + 345, 346, 347, 348, 349, 350, 351, 522, 523, 524, + 525, 526, 527, 528, 529, 352, 619, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 0, 0, 509, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 504, 505, 0, 325, 0, 487, 0, - 0, 0, 0, 0, 596, 506, 507, 508, 509, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 327, 328, - 329, 330, 331, 0, 0, 0, 510, 511, 512, 513, - 514, 332, 333, 334, 335, 336, 337, 338, 597, 598, - 599, 600, 0, 601, 602, 603, 604, 605, 606, 607, - 608, 609, 610, 339, 340, 341, 342, 343, 344, 515, - 516, 517, 518, 519, 520, 521, 522, 345, 611, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 1, 2, 3, 4, 5, 6, 7, + 0, 0, 511, 512, 0, 331, 0, 602, 0, 0, + 0, 0, 0, 604, 513, 514, 515, 516, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 333, 334, 335, + 336, 337, 0, 0, 0, 517, 518, 519, 520, 521, + 338, 339, 340, 341, 342, 343, 344, 605, 606, 607, + 608, 0, 609, 610, 611, 612, 613, 614, 615, 616, + 617, 618, 345, 346, 347, 348, 349, 350, 351, 522, + 523, 524, 525, 526, 527, 528, 529, 352, 619, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + 384, 385, 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, @@ -2045,339 +1982,206 @@ static const yytype_int16 yytable[] = 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 0, 0, 502, - 503, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 504, 505, - 0, 325, 0, 0, 0, 0, 0, 0, 0, 596, - 506, 507, 508, 509, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 327, 328, 329, 330, 331, 0, 0, - 0, 510, 511, 512, 513, 514, 332, 333, 334, 335, - 336, 337, 338, 597, 598, 599, 600, 0, 601, 602, - 603, 604, 605, 606, 607, 608, 609, 610, 339, 340, - 341, 342, 343, 344, 515, 516, 517, 518, 519, 520, - 521, 522, 345, 611, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 0, 502, 503, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 504, 505, 0, 325, 0, 0, 0, - 0, 0, 0, 0, 596, 506, 507, 508, 509, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 327, 328, - 329, 330, 331, 0, 0, 0, 510, 511, 512, 513, - 514, 332, 333, 334, 335, 336, 337, 338, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 339, 340, 341, 342, 343, 344, 515, - 516, 517, 518, 519, 520, 521, 522, 345, 0, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 0, 0, 0, - 318, 319, 320, 321, 322, 323, 324, 0, 0, 502, - 503, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 504, 505, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 0, 0, 509, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 506, 507, 508, 509, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 327, 328, 329, 330, 0, 0, 0, - 0, 510, 511, 512, 513, 514, 332, 333, 334, 335, - 336, 337, 338, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 339, 340, - 341, 342, 343, 344, 515, 516, 517, 518, 519, 520, - 521, 522, 345, 0, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 0, 0, 0, 0, 511, 512, 0, 331, 0, 494, + 0, 0, 0, 0, 0, 604, 513, 514, 515, 516, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 333, + 334, 335, 336, 337, 0, 0, 0, 517, 518, 519, + 520, 521, 338, 339, 340, 341, 342, 343, 344, 605, + 606, 607, 608, 0, 609, 610, 611, 612, 613, 614, + 615, 616, 617, 618, 345, 346, 347, 348, 349, 350, + 351, 522, 523, 524, 525, 526, 527, 528, 529, 352, + 619, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 325, 0, 0, 0, - 0, 0, 0, 0, 326, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 327, 328, - 329, 330, 331, 0, 0, 0, 0, 0, 0, 0, - 0, 332, 333, 334, 335, 336, 337, 338, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 339, 340, 341, 342, 343, 344, 0, - 0, 0, 0, 0, 0, 0, 0, 345, 0, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 0, 0, 0, - 318, 319, 320, 321, 322, 323, 324, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 327, 328, 329, 330, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 332, 333, 334, 335, - 336, 337, 338, 597, 0, 0, 600, 0, 601, 602, - 0, 0, 605, 0, 0, 0, 0, 0, 339, 340, - 341, 342, 343, 344, 0, 0, 0, 0, 0, 0, - 0, 0, 345, 0, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 0, 0, 0, 318, 319, 320, 321, 322, - 323, 324, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 438, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 327, 328, - 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, - 439, 332, 333, 334, 335, 336, 337, 338, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 339, 340, 341, 342, 343, 344, 0, - 0, 0, 0, 0, 0, 0, 0, 345, 0, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 0, 0, 0, - 318, 319, 320, 321, 322, 323, 324, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 382, 383, 384, 385, 386, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 0, 0, 509, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 325, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 511, 512, 0, 331, + 0, 0, 0, 0, 0, 0, 0, 604, 513, 514, + 515, 516, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 333, 334, 335, 336, 337, 0, 0, 0, 517, + 518, 519, 520, 521, 338, 339, 340, 341, 342, 343, + 344, 605, 606, 607, 608, 0, 609, 610, 611, 612, + 613, 614, 615, 616, 617, 618, 345, 346, 347, 348, + 349, 350, 351, 522, 523, 524, 525, 526, 527, 528, + 529, 352, 619, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 382, 383, 384, 385, 386, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 0, 0, 509, + 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 511, 512, + 0, 331, 0, 0, 0, 0, 0, 0, 0, 604, + 513, 514, 515, 516, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 333, 334, 335, 336, 337, 0, 0, + 0, 517, 518, 519, 520, 521, 338, 339, 340, 341, + 342, 343, 344, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 345, 346, + 347, 348, 349, 350, 351, 522, 523, 524, 525, 526, + 527, 528, 529, 352, 0, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, 384, 385, 386, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 0, 0, 0, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 0, + 0, 509, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 327, 328, 329, 330, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 332, 333, 334, 335, - 336, 337, 338, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 339, 340, - 341, 342, 343, 344, 0, 0, 0, 0, 0, 0, - 0, 0, 345, 0, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 0, 0, 0, 318, 319, 320, 321, 322, - 323, 324, 0, 0, 0, 0, 0, 0, 0, 0, + 511, 512, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 513, 514, 515, 516, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 333, 334, 335, 336, 0, + 0, 0, 0, 517, 518, 519, 520, 521, 338, 339, + 340, 341, 342, 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 709, + 345, 346, 347, 348, 349, 350, 351, 522, 523, 524, + 525, 526, 527, 528, 529, 352, 0, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 327, 328, - 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 332, 333, 334, 335, 336, 337, 338, 0, 0, + 0, 0, 0, 0, 0, 331, 0, 0, 0, 0, + 0, 0, 0, 332, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 333, 334, 335, + 336, 337, 0, 0, 0, 0, 0, 0, 0, 0, + 338, 339, 340, 341, 342, 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 339, 340, 341, 342, 343, 344, 0, - 0, 0, 0, 0, 0, 0, 0, 345, 0, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 1, 2, 3, 4, 5, 6, 7, + 0, 0, 345, 346, 347, 348, 349, 350, 351, 0, + 0, 0, 0, 0, 0, 0, 0, 352, 0, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + 384, 385, 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, @@ -2408,118 +2212,74 @@ static const yytype_int16 yytable[] = 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 0, 0, 0, - 318, 319, 320, 321, 322, 323, 324, 0, 0, 0, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 0, 0, 0, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 822, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 327, 328, 329, 330, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 332, 333, 334, 335, - 336, 337, 338, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 339, 340, - 341, 342, 343, 344, 0, 0, 0, 0, 0, 0, - 0, 0, 345, 0, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 333, + 334, 335, 336, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 338, 339, 340, 341, 342, 343, 344, 605, + 0, 0, 608, 0, 609, 610, 0, 0, 613, 0, + 0, 0, 0, 0, 345, 346, 347, 348, 349, 350, + 351, 0, 0, 0, 0, 0, 0, 0, 0, 352, + 0, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 0, 0, 0, 318, 319, 320, 321, 322, - 323, 324, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 857, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 327, 328, - 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 332, 333, 334, 335, 336, 337, 338, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 339, 340, 341, 342, 343, 344, 0, - 0, 0, 0, 0, 0, 0, 0, 345, 0, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 0, 0, 0, - 318, 319, 320, 321, 322, 323, 324, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 382, 383, 384, 385, 386, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 0, 0, 0, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 445, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 327, 328, 329, 330, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 332, 333, 334, 335, - 336, 337, 338, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 339, 340, - 341, 342, 343, 344, 0, 0, 0, 0, 0, 0, - 0, 0, 345, 0, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 2, 3, + 0, 333, 334, 335, 336, 0, 0, 0, 0, 0, + 0, 0, 0, 446, 338, 339, 340, 341, 342, 343, + 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 345, 346, 347, 348, + 349, 350, 351, 0, 0, 0, 0, 0, 0, 0, + 0, 352, 0, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 382, 383, 384, 385, 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 0, 0, 61, 62, 63, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, @@ -2545,154 +2305,27 @@ static const yytype_int16 yytable[] = 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, - 314, 0, 0, 0, 0, 0, 0, 321, 0, 0, - 0, 0, 0, 502, 503, 0, 0, 0, 0, 0, + 314, 315, 316, 317, 0, 0, 0, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 504, 505, 0, 0, 0, 639, 777, 0, - 0, 0, 0, 0, 506, 507, 508, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 510, 511, 512, 513, 514, - 332, 0, 0, 0, 0, 337, 338, 0, 0, 0, + 0, 331, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 515, 516, - 517, 518, 519, 520, 521, 522, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 358, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 0, 0, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, - 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 0, 0, 0, 0, 0, 0, - 321, 0, 0, 0, 0, 0, 502, 503, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 504, 505, 0, 0, 0, - 639, 888, 0, 0, 0, 0, 0, 506, 507, 508, - 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 510, 511, - 512, 513, 514, 332, 0, 0, 0, 0, 337, 338, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 515, 516, 517, 518, 519, 520, 521, 522, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 358, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 0, 0, 0, - 0, 0, 0, 321, 0, 0, 0, 0, 0, 502, - 503, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 504, 505, - 0, 0, 578, 0, 0, 0, 0, 0, 0, 0, - 506, 507, 508, 509, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 510, 511, 512, 513, 514, 332, 0, 0, 0, - 0, 337, 338, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 515, 516, 517, 518, 519, 520, - 521, 522, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 358, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 0, 0, 0, 0, 0, 0, 321, 0, 0, 0, - 0, 0, 502, 503, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 504, 505, 0, 0, 0, 639, 0, 0, 0, - 0, 0, 0, 506, 507, 508, 509, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 510, 511, 512, 513, 514, 332, - 0, 0, 0, 0, 337, 338, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 515, 516, 517, - 518, 519, 520, 521, 522, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 358, + 0, 0, 0, 333, 334, 335, 336, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 338, 339, 340, 341, + 342, 343, 344, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 345, 346, + 347, 348, 349, 350, 351, 0, 0, 0, 0, 0, + 0, 0, 0, 352, 0, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, 384, 385, 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 0, 0, 61, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, @@ -2718,68 +2351,120 @@ static const yytype_int16 yytable[] = 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 0, 0, 0, 0, 0, 0, 321, - 0, 0, 0, 0, 0, 502, 503, 0, 0, 0, + 312, 313, 314, 315, 316, 317, 0, 0, 0, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 504, 505, 0, 0, 736, 0, - 0, 0, 0, 0, 0, 0, 506, 507, 508, 509, + 0, 0, 0, 0, 0, 0, 723, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 510, 511, 512, - 513, 514, 332, 0, 0, 0, 0, 337, 338, 0, + 0, 0, 0, 0, 0, 333, 334, 335, 336, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 338, 339, + 340, 341, 342, 343, 344, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 345, 346, 347, 348, 349, 350, 351, 0, 0, 0, + 0, 0, 0, 0, 0, 352, 0, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 0, 0, + 0, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 836, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 515, 516, 517, 518, 519, 520, 521, 522, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 333, 334, 335, + 336, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 338, 339, 340, 341, 342, 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 358, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 0, 0, 0, 0, - 0, 0, 321, 0, 0, 0, 0, 0, 502, 503, + 0, 0, 345, 346, 347, 348, 349, 350, 351, 0, + 0, 0, 0, 0, 0, 0, 0, 352, 0, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + 384, 385, 386, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 0, 0, 0, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 504, 505, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 747, 506, - 507, 508, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 510, 511, 512, 513, 514, 332, 0, 0, 0, 0, - 337, 338, 0, 0, 0, 0, 0, 0, 0, 0, + 871, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 333, + 334, 335, 336, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 338, 339, 340, 341, 342, 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 515, 516, 517, 518, 519, 520, 521, - 522, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 358, 2, 3, 4, 5, + 0, 0, 0, 0, 345, 346, 347, 348, 349, 350, + 351, 0, 0, 0, 0, 0, 0, 0, 0, 352, + 0, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 382, 383, 384, 385, 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 0, 0, 61, 62, 63, 64, 65, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, @@ -2804,249 +2489,28 @@ static const yytype_int16 yytable[] = 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - 306, 307, 308, 309, 310, 311, 312, 313, 314, 0, - 0, 0, 0, 0, 0, 321, 0, 0, 0, 0, - 0, 502, 503, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 504, 505, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 506, 507, 508, 509, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 510, 511, 512, 513, 514, 332, 0, - 0, 0, 0, 337, 338, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 515, 516, 517, 518, - 519, 520, 521, 522, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 358, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 0, 0, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 0, 0, 0, 0, 0, 0, 321, 0, - 0, 0, 0, 0, 502, 503, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 504, 505, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 506, 507, 508, 509, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 510, 511, 512, 513, - 514, 332, 0, 0, 0, 0, 337, 657, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 515, - 516, 517, 518, 519, 520, 521, 522, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 358, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 0, - 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 0, 0, 0, 0, 0, - 0, 321, 0, 0, 0, 0, 0, 502, 503, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 504, 505, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 506, 507, - 508, 509, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 510, - 511, 512, 513, 697, 332, 0, 0, 0, 0, 337, - 338, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 515, 516, 517, 518, 519, 520, 521, 522, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 358, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, 0, 0, - 0, 0, 0, 0, 321, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 0, 0, 0, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 332, 0, 0, - 0, 0, 337, 338 -}; - -static const yytype_int16 yycheck[] = -{ - 0, 385, 0, 404, 496, 484, 625, 0, 409, 0, - 505, 0, 437, 442, 550, 545, 404, 570, 443, 555, - 404, 739, 393, 348, 416, 409, 572, 336, 564, 353, - 637, 561, 639, 348, 351, 642, 351, 573, 348, 531, - 359, 348, 356, 331, 332, 429, 385, 382, 352, 349, - 385, 349, 356, 351, 368, 484, 381, 382, 383, 384, - 358, 385, 433, 372, 329, 330, 385, 382, 493, 494, - 409, 550, 382, 502, 503, 382, 555, 349, 449, 367, - 368, 351, 561, 351, 349, 564, 351, 543, 358, 901, - 355, 359, 476, 549, 573, 551, 908, 643, 554, 359, - 556, 351, 558, 559, 351, 534, 918, 563, 358, 604, - 351, 606, 359, 592, 350, 382, 353, 358, 385, 356, - 356, 550, 359, 350, 743, 350, 555, 350, 350, 356, - 349, 356, 561, 356, 356, 564, 411, 412, 413, 414, - 415, 416, 417, 350, 573, 637, 350, 639, 350, 356, - 642, 543, 356, 350, 356, 350, 350, 652, 711, 356, - 350, 356, 356, 592, 656, 356, 356, 559, 359, 776, - 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, - 352, 350, 356, 350, 356, 350, 570, 356, 572, 356, - 358, 356, 350, 350, 350, 350, 350, 568, 356, 356, - 356, 356, 356, 350, 922, 350, 350, 350, 350, 356, - 350, 356, 356, 356, 356, 350, 356, 350, 352, 385, - 382, 356, 356, 385, 356, 844, 349, 359, 781, 349, - 382, 349, 661, 385, 635, 381, 382, 383, 384, 722, - 723, 724, 725, 382, 349, 382, 385, 635, 385, 856, - 745, 635, 382, 382, 749, 385, 385, 382, 382, 643, - 385, 385, 349, 382, 800, 801, 385, 382, 327, 328, - 385, 807, 808, 349, 356, 767, 768, 359, 361, 356, - 363, 706, 359, 813, 776, 349, 715, 716, 717, 718, - 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, - 729, 730, 731, 732, 733, 912, 367, 356, 356, 928, - 359, 359, 374, 375, 376, 333, 334, 364, 365, 366, - 359, 800, 801, 354, 353, 356, 353, 711, 807, 808, - 356, 357, 356, 357, 813, 385, 815, 718, 719, 385, - 720, 721, 385, 726, 727, 351, 351, 842, 385, 385, - 845, 350, 385, 356, 371, 359, 358, 358, 350, 356, - 356, 356, 356, 385, 856, 349, 356, 382, 356, 356, - 356, 800, 801, 356, 356, 350, 349, 358, 807, 808, - 359, 351, 349, 351, 813, 385, 815, 348, 352, 335, - 885, 354, 370, 393, 385, 369, 337, 781, 352, 349, - 385, 401, 393, 401, 404, 385, 898, 902, 401, 409, - 401, 409, 401, 404, 385, 359, 409, 359, 409, 419, - 912, 349, 917, 349, 359, 349, 357, 359, 349, 429, - 428, 349, 359, 433, 359, 350, 359, 385, 429, 358, - 385, 350, 433, 356, 845, 356, 356, 350, 352, 449, - 352, 356, 348, 393, 348, 354, 385, 350, 449, 349, - 358, 845, 353, 350, 359, 353, 728, 397, 353, 730, - 359, 354, 729, 731, 733, 433, 476, 732, 429, 575, - 433, 331, 820, 847, 885, 476, 907, 487, 705, 919, - 918, 427, 847, 401, 635, 885, 487, 635, 566, 635, - 801, 885, 798, 796, 815, 808, 805, 813, 803, 811, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 539, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 568, -1, - 570, -1, 572, -1, -1, -1, -1, 568, -1, 570, - -1, 572, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 625, -1, -1, -1, -1, - -1, -1, -1, -1, 625, 635, -1, -1, -1, -1, - -1, -1, -1, 643, 635, -1, -1, -1, -1, -1, - -1, -1, 643, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 711, -1, -1, -1, -1, -1, -1, -1, -1, - 711, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 739, - -1, -1, -1, 743, -1, -1, -1, -1, 739, -1, - -1, -1, 743, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 781, -1, -1, -1, -1, -1, -1, -1, -1, - 781, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 844, 845, -1, 847, -1, 847, - -1, -1, -1, 844, 845, -1, 847, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 885, -1, -1, -1, -1, - -1, -1, -1, -1, 885, -1, -1, -1, -1, -1, - -1, 901, -1, -1, -1, -1, -1, -1, 908, -1, - 901, -1, -1, -1, -1, -1, -1, 908, 918, -1, - -1, -1, 922, -1, -1, -1, -1, 918, 928, -1, - -1, 922, -1, -1, -1, 0, -1, 928, 3, 4, + 0, 333, 334, 335, 336, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 338, 339, 340, 341, 342, 343, + 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 345, 346, 347, 348, + 349, 350, 351, 0, 0, 0, 0, 0, 0, 0, + 0, 352, 0, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 382, 383, 384, 385, 386, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, @@ -3057,7 +2521,7 @@ static const yytype_int16 yycheck[] = 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 165, 0, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, @@ -3072,72 +2536,25 @@ static const yytype_int16 yycheck[] = 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 351, -1, -1, -1, - -1, -1, -1, -1, 359, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, 374, - 375, 376, 377, -1, -1, -1, -1, -1, -1, -1, - -1, 386, 387, 388, 389, 390, 391, 392, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, -1, - -1, -1, -1, -1, -1, -1, -1, 422, -1, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 326, -1, -1, 329, - 330, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 348, 349, - -1, 351, -1, 353, 354, -1, -1, -1, -1, 359, - 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 373, 374, 375, 376, 377, -1, -1, - -1, 381, 382, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, -1, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, - 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 3, 4, + 315, 316, 317, 0, 0, 0, 0, 0, 0, 324, + 0, 0, 0, 328, 329, 330, 0, 0, 509, 510, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 511, 512, 0, + 0, 0, 647, 791, 0, 0, 0, 0, 0, 513, + 514, 515, 516, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 517, 518, 519, 520, 521, 338, 0, 0, 0, 0, + 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 522, 523, 524, 525, 526, 527, + 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 365, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, @@ -3148,7 +2565,7 @@ static const yytype_int16 yycheck[] = 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 165, 0, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, @@ -3163,72 +2580,25 @@ static const yytype_int16 yycheck[] = 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, -1, -1, 329, 330, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 348, 349, -1, 351, -1, 353, 354, - -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, 374, - 375, 376, 377, -1, -1, -1, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, -1, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 326, -1, -1, 329, - 330, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 348, 349, - -1, 351, -1, 353, -1, -1, -1, -1, -1, 359, - 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 373, 374, 375, 376, 377, -1, -1, - -1, 381, 382, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, -1, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, - 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 3, 4, + 315, 316, 317, 0, 0, 0, 0, 0, 0, 324, + 0, 0, 0, 328, 329, 330, 0, 0, 509, 510, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 511, 512, 0, + 0, 0, 647, 902, 0, 0, 0, 0, 0, 513, + 514, 515, 516, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 517, 518, 519, 520, 521, 338, 0, 0, 0, 0, + 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 522, 523, 524, 525, 526, 527, + 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 365, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, @@ -3239,7 +2609,7 @@ static const yytype_int16 yycheck[] = 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 165, 0, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, @@ -3254,72 +2624,25 @@ static const yytype_int16 yycheck[] = 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, -1, -1, 329, 330, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 348, 349, -1, 351, -1, 353, -1, - -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, 374, - 375, 376, 377, -1, -1, -1, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, -1, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 326, -1, -1, 329, - 330, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 348, 349, - -1, 351, -1, -1, -1, -1, -1, -1, -1, 359, - 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 373, 374, 375, 376, 377, -1, -1, - -1, 381, 382, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, -1, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, - 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 3, 4, + 315, 316, 317, 0, 0, 0, 0, 0, 0, 324, + 0, 0, 0, 328, 329, 330, 0, 0, 509, 510, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 511, 512, 0, + 0, 585, 0, 0, 0, 0, 0, 0, 0, 513, + 514, 515, 516, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 517, 518, 519, 520, 521, 338, 0, 0, 0, 0, + 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 522, 523, 524, 525, 526, 527, + 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 365, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, @@ -3330,7 +2653,7 @@ static const yytype_int16 yycheck[] = 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 165, 0, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, @@ -3345,72 +2668,25 @@ static const yytype_int16 yycheck[] = 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, -1, -1, 329, 330, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 348, 349, -1, 351, -1, -1, -1, - -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, 374, - 375, 376, 377, -1, -1, -1, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, -1, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, -1, -1, -1, - 320, 321, 322, 323, 324, 325, 326, -1, -1, 329, - 330, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 348, 349, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 373, 374, 375, 376, -1, -1, -1, - -1, 381, 382, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 408, 409, - 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, - 420, 421, 422, -1, 424, 425, 426, 427, 428, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, - 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 3, 4, + 315, 316, 317, 0, 0, 0, 0, 0, 0, 324, + 0, 0, 0, 328, 329, 330, 0, 0, 509, 510, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 511, 512, 0, + 0, 0, 647, 0, 0, 0, 0, 0, 0, 513, + 514, 515, 516, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 517, 518, 519, 520, 521, 338, 0, 0, 0, 0, + 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 522, 523, 524, 525, 526, 527, + 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 365, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, @@ -3421,7 +2697,7 @@ static const yytype_int16 yycheck[] = 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 165, 0, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, @@ -3436,72 +2712,25 @@ static const yytype_int16 yycheck[] = 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 351, -1, -1, -1, - -1, -1, -1, -1, 359, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, 374, - 375, 376, 377, -1, -1, -1, -1, -1, -1, -1, - -1, 386, 387, 388, 389, 390, 391, 392, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, -1, - -1, -1, -1, -1, -1, -1, -1, 422, -1, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, -1, -1, -1, - 320, 321, 322, 323, 324, 325, 326, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 373, 374, 375, 376, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 386, 387, 388, 389, - 390, 391, 392, 393, -1, -1, 396, -1, 398, 399, - -1, -1, 402, -1, -1, -1, -1, -1, 408, 409, - 410, 411, 412, 413, -1, -1, -1, -1, -1, -1, - -1, -1, 422, -1, 424, 425, 426, 427, 428, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, - 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 3, 4, + 315, 316, 317, 0, 0, 0, 0, 0, 0, 324, + 0, 0, 0, 328, 329, 330, 0, 0, 509, 510, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 511, 512, 0, + 0, 750, 0, 0, 0, 0, 0, 0, 0, 513, + 514, 515, 516, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 517, 518, 519, 520, 521, 338, 0, 0, 0, 0, + 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 522, 523, 524, 525, 526, 527, + 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 365, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, @@ -3512,7 +2741,7 @@ static const yytype_int16 yycheck[] = 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 165, 0, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, @@ -3527,72 +2756,25 @@ static const yytype_int16 yycheck[] = 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, -1, -1, -1, 320, 321, 322, 323, 324, - 325, 326, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 359, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, 374, - 375, 376, -1, -1, -1, -1, -1, -1, -1, -1, - 385, 386, 387, 388, 389, 390, 391, 392, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, -1, - -1, -1, -1, -1, -1, -1, -1, 422, -1, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, -1, -1, -1, - 320, 321, 322, 323, 324, 325, 326, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 351, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 373, 374, 375, 376, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 386, 387, 388, 389, - 390, 391, 392, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 408, 409, - 410, 411, 412, 413, -1, -1, -1, -1, -1, -1, - -1, -1, 422, -1, 424, 425, 426, 427, 428, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, - 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 315, 316, 317, 0, 0, 0, 0, 0, 0, 324, + 0, 0, 0, 328, 329, 330, 0, 0, 509, 510, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 511, 512, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 761, 513, + 514, 515, 516, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 517, 518, 519, 520, 521, 338, 0, 0, 0, 0, + 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 522, 523, 524, 525, 526, 527, + 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 365, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, @@ -3603,7 +2785,7 @@ static const yytype_int16 yycheck[] = 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 165, 0, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, @@ -3618,72 +2800,25 @@ static const yytype_int16 yycheck[] = 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, -1, -1, -1, 320, 321, 322, 323, 324, - 325, 326, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 354, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, 374, - 375, 376, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 386, 387, 388, 389, 390, 391, 392, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, -1, - -1, -1, -1, -1, -1, -1, -1, 422, -1, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, -1, -1, -1, - 320, 321, 322, 323, 324, 325, 326, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 354, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 373, 374, 375, 376, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 386, 387, 388, 389, - 390, 391, 392, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 408, 409, - 410, 411, 412, 413, -1, -1, -1, -1, -1, -1, - -1, -1, 422, -1, 424, 425, 426, 427, 428, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, - 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 3, 4, + 315, 316, 317, 0, 0, 0, 0, 0, 0, 324, + 0, 0, 0, 328, 329, 330, 0, 0, 509, 510, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 511, 512, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 513, + 514, 515, 516, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 517, 518, 519, 520, 521, 338, 0, 0, 0, 0, + 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 522, 523, 524, 525, 526, 527, + 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 365, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, @@ -3694,7 +2829,95 @@ static const yytype_int16 yycheck[] = 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 165, 0, 167, 168, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 0, 0, 0, 0, 0, 0, 324, + 0, 0, 0, 328, 329, 330, 0, 0, 509, 510, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 511, 512, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 513, + 514, 515, 516, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 517, 518, 519, 520, 521, 338, 0, 0, 0, 0, + 343, 665, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 522, 523, 524, 525, 526, 527, + 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 365, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 0, 167, 168, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 0, 0, 0, 0, 0, 0, 324, + 0, 0, 0, 328, 329, 330, 0, 0, 509, 510, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 511, 512, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 513, + 514, 515, 516, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 517, 518, 519, 520, 710, 338, 0, 0, 0, 0, + 343, 344, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 522, 523, 524, 525, 526, 527, + 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 365, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 0, 0, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 0, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, @@ -3709,72 +2932,167 @@ static const yytype_int16 yycheck[] = 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, -1, -1, -1, 320, 321, 322, 323, 324, - 325, 326, -1, -1, -1, -1, -1, -1, -1, -1, + 315, 316, 317, 0, 0, 0, 0, 0, 0, 324, + 0, 0, 0, 328, 329, 330, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 338, 0, 0, 0, 0, + 343, 344 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 0, 0, 392, 503, 411, 0, 633, 411, 491, + 416, 444, 0, 449, 552, 568, 753, 450, 562, 579, + 512, 577, 411, 557, 354, 400, 342, 416, 423, 354, + 568, 645, 357, 647, 337, 338, 650, 571, 365, 538, + 359, 362, 354, 354, 915, 391, 580, 436, 357, 362, + 355, 922, 365, 374, 355, 491, 365, 387, 388, 389, + 390, 932, 378, 388, 391, 440, 355, 500, 501, 415, + 373, 374, 391, 509, 510, 557, 388, 388, 356, 355, + 357, 456, 335, 336, 362, 357, 568, 364, 355, 571, + 357, 651, 357, 365, 483, 373, 357, 364, 580, 364, + 356, 356, 355, 364, 357, 541, 362, 362, 361, 355, + 418, 419, 420, 421, 422, 423, 424, 355, 600, 356, + 612, 557, 614, 359, 356, 362, 362, 356, 355, 365, + 362, 757, 568, 362, 550, 571, 388, 356, 388, 391, + 556, 391, 558, 362, 580, 561, 645, 563, 647, 565, + 566, 650, 356, 356, 570, 550, 356, 356, 362, 362, + 356, 356, 362, 362, 600, 664, 362, 362, 660, 725, + 358, 566, 388, 355, 362, 391, 790, 344, 345, 346, + 347, 348, 349, 350, 351, 352, 353, 356, 577, 357, + 579, 388, 356, 362, 391, 356, 356, 364, 362, 936, + 575, 362, 362, 356, 356, 356, 356, 356, 356, 362, + 362, 362, 362, 362, 362, 356, 356, 356, 356, 356, + 355, 362, 362, 362, 362, 362, 358, 358, 333, 334, + 362, 362, 858, 669, 367, 355, 369, 643, 362, 795, + 643, 387, 388, 389, 390, 391, 736, 737, 738, 739, + 362, 365, 388, 365, 643, 391, 870, 387, 388, 389, + 390, 388, 651, 388, 391, 388, 391, 759, 391, 388, + 388, 763, 391, 391, 827, 356, 829, 821, 822, 373, + 814, 815, 781, 782, 360, 388, 362, 720, 391, 827, + 391, 790, 365, 729, 730, 731, 732, 733, 734, 735, + 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, + 746, 747, 926, 391, 388, 362, 942, 391, 365, 362, + 362, 362, 365, 365, 365, 380, 381, 382, 339, 340, + 362, 363, 814, 815, 362, 363, 725, 370, 371, 372, + 732, 733, 391, 734, 735, 827, 359, 829, 357, 359, + 740, 741, 391, 391, 391, 357, 391, 365, 364, 356, + 364, 362, 365, 377, 856, 356, 362, 859, 391, 362, + 362, 870, 362, 362, 357, 362, 362, 362, 814, 815, + 362, 362, 355, 355, 364, 356, 355, 355, 354, 341, + 357, 827, 392, 829, 358, 343, 391, 376, 375, 358, + 400, 355, 360, 365, 392, 365, 795, 899, 408, 408, + 408, 411, 400, 912, 408, 391, 416, 416, 416, 355, + 408, 391, 355, 411, 916, 365, 426, 926, 416, 355, + 365, 363, 355, 362, 365, 365, 436, 435, 365, 931, + 440, 391, 391, 356, 364, 362, 362, 356, 436, 449, + 356, 358, 440, 859, 358, 354, 456, 362, 399, 354, + 388, 355, 360, 356, 364, 356, 391, 359, 456, 365, + 859, 359, 359, 742, 360, 365, 744, 743, 582, 403, + 436, 745, 337, 483, 746, 440, 719, 747, 861, 440, + 834, 921, 932, 899, 494, 483, 933, 434, 861, 643, + 899, 643, 573, 810, 819, 408, 494, 817, 812, 643, + 899, 825, 829, 815, -1, -1, 822, -1, -1, -1, + -1, 821, -1, -1, -1, -1, -1, -1, 827, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 354, + -1, -1, -1, -1, -1, -1, -1, -1, 546, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 373, 374, - 375, 376, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 386, 387, 388, 389, 390, 391, 392, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 408, 409, 410, 411, 412, 413, -1, - -1, -1, -1, -1, -1, -1, -1, 422, -1, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, -1, -1, -1, - 320, 321, 322, 323, 324, 325, 326, -1, -1, -1, + -1, -1, -1, -1, -1, 575, -1, 577, -1, 579, + -1, -1, -1, -1, -1, -1, -1, 575, -1, 577, + -1, 579, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 633, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 643, -1, 633, -1, -1, -1, -1, + -1, 651, -1, -1, -1, 643, -1, -1, -1, -1, + -1, -1, -1, 651, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 373, 374, 375, 376, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 386, 387, 388, 389, - 390, 391, 392, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 408, 409, - 410, 411, 412, 413, -1, -1, -1, -1, -1, -1, - -1, -1, 422, -1, 424, 425, 426, 427, 428, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, - 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 4, 5, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 725, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 725, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 753, -1, -1, -1, 757, -1, -1, + -1, -1, -1, -1, -1, 753, -1, -1, -1, 757, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 795, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 795, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 858, 859, + -1, 861, -1, 861, -1, -1, -1, -1, -1, -1, + 858, 859, -1, 861, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 899, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 899, -1, -1, -1, 915, -1, -1, -1, -1, + -1, -1, 922, -1, -1, -1, -1, 915, -1, -1, + -1, -1, 932, -1, 922, -1, 936, -1, -1, -1, + -1, -1, 942, -1, 932, -1, -1, -1, 936, -1, + -1, -1, 0, -1, 942, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 357, + -1, -1, -1, -1, -1, -1, -1, 365, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 379, 380, 381, 382, 383, -1, -1, -1, -1, + -1, -1, -1, -1, 392, 393, 394, 395, 396, 397, + 398, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 414, 415, 416, 417, + 418, 419, 420, -1, -1, -1, -1, -1, -1, -1, + -1, 429, -1, 431, 432, 433, 434, 435, 436, 437, + 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, + 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 458, 459, 460, 461, 462, 463, 464, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, -1, -1, 63, 64, 65, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, @@ -3800,68 +3118,120 @@ static const yytype_int16 yycheck[] = 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, - 316, -1, -1, -1, -1, -1, -1, 323, -1, -1, - -1, -1, -1, 329, 330, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 348, 349, -1, -1, -1, 353, 354, -1, - -1, -1, -1, -1, 360, 361, 362, 363, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 381, 382, 383, 384, 385, - 386, -1, -1, -1, -1, 391, 392, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 414, 415, - 416, 417, 418, 419, 420, 421, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 436, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, -1, -1, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, -1, -1, -1, -1, -1, -1, - 323, -1, -1, -1, -1, -1, 329, 330, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 348, 349, -1, -1, -1, - 353, 354, -1, -1, -1, -1, -1, 360, 361, 362, - 363, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 381, 382, - 383, 384, 385, 386, -1, -1, -1, -1, 391, 392, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 414, 415, 416, 417, 418, 419, 420, 421, -1, + 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 332, -1, -1, 335, + 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 354, 355, + -1, 357, -1, 359, 360, -1, -1, -1, -1, 365, + 366, 367, 368, 369, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 379, 380, 381, 382, 383, -1, -1, + -1, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, -1, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, + 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, + 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, + 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, + 456, 457, 458, 459, 460, 461, 462, 463, 464, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, -1, + -1, 335, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 436, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, + 354, 355, -1, 357, -1, 359, 360, -1, -1, -1, + -1, 365, 366, 367, 368, 369, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 379, 380, 381, 382, 383, + -1, -1, -1, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, 400, 401, 402, -1, + 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, + 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, + 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, -1, -1, 335, 336, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 354, 355, -1, 357, -1, 359, -1, -1, + -1, -1, -1, 365, 366, 367, 368, 369, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 379, 380, 381, + 382, 383, -1, -1, -1, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, + 402, -1, 404, 405, 406, 407, 408, 409, 410, 411, + 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, + 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, + 462, 463, 464, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, @@ -3886,68 +3256,120 @@ static const yytype_int16 yycheck[] = 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, -1, -1, -1, - -1, -1, -1, 323, -1, -1, -1, -1, -1, 329, - 330, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 348, 349, - -1, -1, 352, -1, -1, -1, -1, -1, -1, -1, - 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 381, 382, 383, 384, 385, 386, -1, -1, -1, - -1, 391, 392, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 414, 415, 416, 417, 418, 419, - 420, 421, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 436, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - -1, -1, -1, -1, -1, -1, 323, -1, -1, -1, - -1, -1, 329, 330, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 348, 349, -1, -1, -1, 353, -1, -1, -1, - -1, -1, -1, 360, 361, 362, 363, -1, -1, -1, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, -1, -1, 335, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 381, 382, 383, 384, 385, 386, - -1, -1, -1, -1, 391, 392, -1, -1, -1, -1, + -1, -1, -1, -1, 354, 355, -1, 357, -1, 359, + -1, -1, -1, -1, -1, 365, 366, 367, 368, 369, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 379, + 380, 381, 382, 383, -1, -1, -1, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + 400, 401, 402, -1, 404, 405, 406, 407, 408, 409, + 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, + 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, + 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, + 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, -1, -1, 335, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 414, 415, 416, - 417, 418, 419, 420, 421, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 436, + -1, -1, -1, -1, -1, -1, 354, 355, -1, 357, + -1, -1, -1, -1, -1, -1, -1, 365, 366, 367, + 368, 369, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 379, 380, 381, 382, 383, -1, -1, -1, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, 400, 401, 402, -1, 404, 405, 406, 407, + 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, + 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, + 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, + 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 458, 459, 460, 461, 462, 463, 464, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 332, -1, -1, 335, + 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 354, 355, + -1, 357, -1, -1, -1, -1, -1, -1, -1, 365, + 366, 367, 368, 369, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 379, 380, 381, 382, 383, -1, -1, + -1, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 414, 415, + 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 429, -1, 431, 432, 433, 434, 435, + 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, + 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, + 456, 457, 458, 459, 460, 461, 462, 463, 464, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, -1, -1, 63, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, @@ -3973,68 +3395,120 @@ static const yytype_int16 yycheck[] = 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, - 314, 315, 316, -1, -1, -1, -1, -1, -1, 323, - -1, -1, -1, -1, -1, 329, 330, -1, -1, -1, + 314, 315, 316, 317, 318, 319, -1, -1, -1, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, -1, + -1, 335, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 348, 349, -1, -1, 352, -1, - -1, -1, -1, -1, -1, -1, 360, 361, 362, 363, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 381, 382, 383, - 384, 385, 386, -1, -1, -1, -1, 391, 392, -1, + 354, 355, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 366, 367, 368, 369, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 379, 380, 381, 382, -1, + -1, -1, -1, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 429, -1, 431, 432, 433, + 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 414, 415, 416, 417, 418, 419, 420, 421, -1, -1, + -1, -1, -1, -1, -1, 357, -1, -1, -1, -1, + -1, -1, -1, 365, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 379, 380, 381, + 382, 383, -1, -1, -1, -1, -1, -1, -1, -1, + 392, 393, 394, 395, 396, 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 436, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - -1, -1, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, - 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, -1, -1, -1, -1, - -1, -1, 323, -1, -1, -1, -1, -1, 329, 330, + -1, -1, 414, 415, 416, 417, 418, 419, 420, -1, + -1, -1, -1, -1, -1, -1, -1, 429, -1, 431, + 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, + 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, + 462, 463, 464, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + -1, -1, -1, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 348, 349, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, - 361, 362, 363, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 381, 382, 383, 384, 385, 386, -1, -1, -1, -1, - 391, 392, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 414, 415, 416, 417, 418, 419, 420, - 421, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 436, 4, 5, 6, 7, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 379, + 380, 381, 382, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 392, 393, 394, 395, 396, 397, 398, 399, + -1, -1, 402, -1, 404, 405, -1, -1, 408, -1, + -1, -1, -1, -1, 414, 415, 416, 417, 418, 419, + 420, -1, -1, -1, -1, -1, -1, -1, -1, 429, + -1, 431, 432, 433, 434, 435, 436, 437, 438, 439, + 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, + 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, -1, -1, 63, 64, 65, 66, 67, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, @@ -4059,78 +3533,130 @@ static const yytype_int16 yycheck[] = 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, -1, - -1, -1, -1, -1, -1, 323, -1, -1, -1, -1, - -1, 329, 330, -1, -1, -1, -1, -1, -1, -1, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, -1, -1, -1, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 348, 349, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 381, 382, 383, 384, 385, 386, -1, - -1, -1, -1, 391, 392, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 365, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 379, 380, 381, 382, -1, -1, -1, -1, -1, + -1, -1, -1, 391, 392, 393, 394, 395, 396, 397, + 398, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 414, 415, 416, 417, - 418, 419, 420, 421, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 436, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, -1, -1, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, -1, -1, -1, -1, -1, -1, 323, -1, - -1, -1, -1, -1, 329, 330, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 348, 349, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 360, 361, 362, 363, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 381, 382, 383, 384, - 385, 386, -1, -1, -1, -1, 391, 392, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 414, - 415, 416, 417, 418, 419, 420, 421, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 436, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, -1, - -1, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 418, 419, 420, -1, -1, -1, -1, -1, -1, -1, + -1, 429, -1, 431, 432, 433, 434, 435, 436, 437, + 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, + 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 458, 459, 460, 461, 462, 463, 464, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, -1, -1, -1, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 332, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 357, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 379, 380, 381, 382, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 392, 393, 394, 395, + 396, 397, 398, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 414, 415, + 416, 417, 418, 419, 420, -1, -1, -1, -1, -1, + -1, -1, -1, 429, -1, 431, 432, 433, 434, 435, + 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, + 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, + 456, 457, 458, 459, 460, 461, 462, 463, 464, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, -1, -1, -1, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 360, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 379, 380, 381, 382, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 392, 393, + 394, 395, 396, 397, 398, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 414, 415, 416, 417, 418, 419, 420, -1, -1, -1, + -1, -1, -1, -1, -1, 429, -1, 431, 432, 433, + 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, @@ -4146,62 +3672,554 @@ static const yytype_int16 yycheck[] = 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, -1, -1, -1, -1, -1, - -1, 323, -1, -1, -1, -1, -1, 329, 330, -1, + 312, 313, 314, 315, 316, 317, 318, 319, -1, -1, + -1, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 360, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 379, 380, 381, + 382, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 392, 393, 394, 395, 396, 397, 398, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 414, 415, 416, 417, 418, 419, 420, -1, + -1, -1, -1, -1, -1, -1, -1, 429, -1, 431, + 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, + 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, + 462, 463, 464, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + -1, -1, -1, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 360, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 379, + 380, 381, 382, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 392, 393, 394, 395, 396, 397, 398, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 414, 415, 416, 417, 418, 419, + 420, -1, -1, -1, -1, -1, -1, -1, -1, 429, + -1, 431, 432, 433, 434, 435, 436, 437, 438, 439, + 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, + 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, -1, -1, -1, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 379, 380, 381, 382, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 392, 393, 394, 395, 396, 397, + 398, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 414, 415, 416, 417, + 418, 419, 420, -1, -1, -1, -1, -1, -1, -1, + -1, 429, -1, 431, 432, 433, 434, 435, 436, 437, + 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, + 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 458, 459, 460, 461, 462, 463, 464, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, -1, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, -1, -1, -1, -1, -1, -1, 326, + -1, -1, -1, 330, 331, 332, -1, -1, 335, 336, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 354, 355, -1, + -1, -1, 359, 360, -1, -1, -1, -1, -1, 366, + 367, 368, 369, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 387, 388, 389, 390, 391, 392, -1, -1, -1, -1, + 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 421, 422, 423, 424, 425, 426, + 427, 428, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 443, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, -1, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, -1, -1, -1, -1, -1, -1, 326, + -1, -1, -1, 330, 331, 332, -1, -1, 335, 336, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 354, 355, -1, + -1, -1, 359, 360, -1, -1, -1, -1, -1, 366, + 367, 368, 369, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 387, 388, 389, 390, 391, 392, -1, -1, -1, -1, + 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 421, 422, 423, 424, 425, 426, + 427, 428, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 443, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, -1, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, -1, -1, -1, -1, -1, -1, 326, + -1, -1, -1, 330, 331, 332, -1, -1, 335, 336, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 354, 355, -1, + -1, 358, -1, -1, -1, -1, -1, -1, -1, 366, + 367, 368, 369, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 387, 388, 389, 390, 391, 392, -1, -1, -1, -1, + 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 421, 422, 423, 424, 425, 426, + 427, 428, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 443, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, -1, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, -1, -1, -1, -1, -1, -1, 326, + -1, -1, -1, 330, 331, 332, -1, -1, 335, 336, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 354, 355, -1, + -1, -1, 359, -1, -1, -1, -1, -1, -1, 366, + 367, 368, 369, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 387, 388, 389, 390, 391, 392, -1, -1, -1, -1, + 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 421, 422, 423, 424, 425, 426, + 427, 428, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 443, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, -1, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, -1, -1, -1, -1, -1, -1, 326, + -1, -1, -1, 330, 331, 332, -1, -1, 335, 336, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 354, 355, -1, + -1, 358, -1, -1, -1, -1, -1, -1, -1, 366, + 367, 368, 369, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 387, 388, 389, 390, 391, 392, -1, -1, -1, -1, + 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 421, 422, 423, 424, 425, 426, + 427, 428, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 443, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, -1, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, -1, -1, -1, -1, -1, -1, 326, + -1, -1, -1, 330, 331, 332, -1, -1, 335, 336, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 354, 355, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 365, 366, + 367, 368, 369, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 387, 388, 389, 390, 391, 392, -1, -1, -1, -1, + 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 421, 422, 423, 424, 425, 426, + 427, 428, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 443, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, -1, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, -1, -1, -1, -1, -1, -1, 326, + -1, -1, -1, 330, 331, 332, -1, -1, 335, 336, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 354, 355, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 366, + 367, 368, 369, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 387, 388, 389, 390, 391, 392, -1, -1, -1, -1, + 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 421, 422, 423, 424, 425, 426, + 427, 428, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 443, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, -1, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, -1, -1, -1, -1, -1, -1, 326, + -1, -1, -1, 330, 331, 332, -1, -1, 335, 336, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 354, 355, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 366, + 367, 368, 369, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 387, 388, 389, 390, 391, 392, -1, -1, -1, -1, + 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 421, 422, 423, 424, 425, 426, + 427, 428, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 443, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, -1, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, -1, -1, -1, -1, -1, -1, 326, + -1, -1, -1, 330, 331, 332, -1, -1, 335, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 348, 349, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 360, 361, - 362, 363, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 381, - 382, 383, 384, 385, 386, -1, -1, -1, -1, 391, - 392, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 354, 355, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 366, + 367, 368, 369, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 414, 415, 416, 417, 418, 419, 420, 421, + 387, 388, 389, 390, 391, 392, -1, -1, -1, -1, + 397, 398, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 436, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, -1, -1, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, -1, -1, - -1, -1, -1, -1, 323, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 421, 422, 423, 424, 425, 426, + 427, 428, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 443, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, -1, -1, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, -1, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, -1, -1, -1, -1, -1, -1, 326, + -1, -1, -1, 330, 331, 332, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 386, -1, -1, - -1, -1, 391, 392 + -1, -1, -1, -1, -1, 392, -1, -1, -1, -1, + 397, 398 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ +/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + state STATE-NUM. */ static const yytype_int16 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, @@ -4236,145 +4254,148 @@ static const yytype_int16 yystos[] = 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 325, 326, 351, 359, 373, 374, 375, - 376, 377, 386, 387, 388, 389, 390, 391, 392, 408, - 409, 410, 411, 412, 413, 422, 424, 425, 426, 427, - 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 357, 365, 379, 380, 381, 382, 383, 392, 393, + 394, 395, 396, 397, 398, 414, 415, 416, 417, 418, + 419, 420, 429, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, - 489, 490, 493, 494, 495, 496, 500, 501, 502, 503, - 504, 505, 508, 509, 510, 511, 512, 514, 519, 520, - 521, 562, 563, 564, 566, 573, 577, 578, 583, 586, - 349, 349, 349, 349, 349, 349, 349, 349, 351, 520, - 353, 385, 349, 349, 359, 385, 359, 565, 350, 356, - 497, 498, 499, 509, 514, 356, 359, 385, 359, 385, - 510, 514, 367, 516, 517, 0, 563, 494, 502, 509, - 359, 493, 385, 569, 570, 587, 588, 382, 385, 569, - 382, 569, 382, 569, 382, 569, 382, 569, 569, 587, - 382, 569, 385, 567, 568, 514, 523, 353, 385, 409, - 506, 507, 385, 513, 351, 359, 515, 353, 541, 566, - 498, 497, 499, 385, 385, 349, 358, 515, 353, 356, - 359, 492, 329, 330, 348, 349, 360, 361, 362, 363, - 381, 382, 383, 384, 385, 414, 415, 416, 417, 418, - 419, 420, 421, 459, 460, 461, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 512, 514, 518, 515, 350, - 385, 359, 358, 356, 350, 356, 350, 356, 358, 356, - 356, 356, 350, 356, 356, 356, 356, 356, 356, 356, - 350, 356, 350, 356, 349, 352, 356, 359, 509, 514, - 524, 525, 522, 358, 350, 356, 350, 356, 352, 470, - 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, - 482, 483, 351, 359, 353, 354, 359, 393, 394, 395, - 396, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 423, 470, 483, 485, 487, 489, 493, 512, 514, - 530, 531, 532, 533, 534, 542, 543, 544, 545, 548, - 549, 552, 553, 554, 561, 566, 515, 358, 515, 353, - 485, 528, 358, 491, 385, 356, 359, 470, 470, 487, - 329, 330, 351, 355, 350, 350, 356, 392, 485, 349, - 470, 356, 368, 566, 348, 351, 382, 570, 587, 385, - 588, 348, 381, 382, 383, 384, 574, 575, 382, 483, - 488, 576, 382, 381, 382, 383, 384, 579, 580, 382, - 488, 581, 382, 348, 582, 382, 587, 385, 488, 584, - 585, 382, 488, 352, 568, 514, 385, 526, 527, 354, - 525, 524, 488, 507, 385, 364, 365, 366, 361, 363, - 327, 328, 331, 332, 367, 368, 333, 334, 371, 370, - 369, 335, 337, 336, 372, 352, 352, 483, 354, 535, - 349, 359, 359, 556, 349, 349, 359, 359, 487, 349, - 487, 357, 359, 359, 359, 359, 338, 339, 340, 341, - 342, 343, 344, 345, 346, 347, 358, 486, 356, 359, - 354, 531, 545, 549, 554, 528, 358, 354, 528, 529, - 528, 524, 385, 350, 462, 487, 385, 485, 470, 348, - 382, 571, 572, 350, 358, 350, 356, 350, 356, 350, - 356, 356, 350, 356, 350, 356, 350, 356, 356, 350, - 356, 356, 350, 356, 350, 356, 350, 350, 526, 515, - 356, 359, 354, 470, 470, 470, 472, 472, 473, 473, - 474, 474, 474, 474, 475, 475, 476, 477, 478, 479, - 480, 481, 484, 352, 542, 555, 531, 557, 487, 359, - 487, 357, 485, 485, 528, 354, 356, 354, 352, 352, - 356, 352, 356, 575, 574, 488, 576, 580, 579, 488, - 581, 348, 582, 584, 585, 359, 527, 487, 536, 487, - 502, 547, 393, 530, 543, 558, 350, 350, 354, 528, - 348, 382, 350, 350, 350, 350, 350, 350, 357, 354, - 385, 350, 349, 547, 559, 560, 538, 539, 540, 546, - 550, 485, 358, 532, 537, 541, 487, 359, 350, 397, - 534, 532, 353, 528, 350, 487, 537, 538, 542, 551, - 359, 354 + 458, 459, 460, 461, 462, 463, 464, 496, 497, 500, + 501, 502, 503, 507, 508, 509, 510, 511, 512, 515, + 516, 517, 518, 519, 521, 526, 527, 528, 569, 570, + 571, 573, 580, 584, 585, 591, 594, 355, 355, 355, + 355, 355, 355, 355, 355, 357, 527, 359, 391, 355, + 355, 365, 391, 365, 572, 356, 362, 504, 505, 506, + 516, 521, 362, 365, 391, 365, 391, 517, 521, 373, + 523, 524, 0, 570, 501, 509, 516, 365, 500, 391, + 576, 577, 595, 596, 388, 391, 576, 388, 576, 388, + 576, 388, 576, 388, 576, 576, 595, 388, 576, 391, + 574, 575, 521, 530, 359, 391, 415, 513, 514, 391, + 520, 357, 365, 522, 359, 548, 573, 505, 504, 506, + 391, 391, 355, 364, 522, 359, 362, 365, 499, 335, + 336, 354, 355, 366, 367, 368, 369, 387, 388, 389, + 390, 391, 421, 422, 423, 424, 425, 426, 427, 428, + 466, 467, 468, 470, 471, 472, 473, 474, 475, 476, + 477, 478, 519, 521, 525, 522, 356, 391, 365, 364, + 362, 356, 362, 356, 362, 364, 362, 362, 362, 356, + 362, 362, 362, 362, 362, 362, 362, 356, 362, 356, + 362, 355, 358, 362, 365, 516, 521, 531, 532, 529, + 364, 356, 362, 356, 362, 358, 477, 479, 480, 481, + 482, 483, 484, 485, 486, 487, 488, 489, 490, 521, + 357, 365, 359, 360, 365, 399, 400, 401, 402, 404, + 405, 406, 407, 408, 409, 410, 411, 412, 413, 430, + 477, 490, 492, 494, 496, 500, 519, 521, 537, 538, + 539, 540, 541, 549, 550, 551, 552, 555, 556, 559, + 560, 561, 568, 573, 522, 364, 522, 359, 492, 535, + 364, 498, 391, 362, 365, 477, 477, 494, 335, 336, + 357, 361, 356, 356, 362, 398, 492, 355, 477, 362, + 374, 573, 354, 357, 388, 577, 595, 391, 596, 354, + 387, 388, 389, 390, 581, 582, 388, 490, 495, 583, + 388, 387, 388, 389, 390, 586, 587, 388, 387, 388, + 389, 390, 466, 588, 589, 388, 354, 590, 388, 595, + 391, 495, 526, 592, 593, 388, 495, 358, 575, 521, + 391, 533, 534, 360, 532, 531, 495, 514, 391, 370, + 371, 372, 367, 369, 333, 334, 337, 338, 373, 374, + 339, 340, 377, 376, 375, 341, 343, 342, 378, 358, + 358, 490, 360, 542, 355, 365, 365, 563, 355, 355, + 365, 365, 494, 355, 494, 363, 365, 365, 365, 365, + 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, + 364, 493, 362, 365, 360, 538, 552, 556, 561, 535, + 364, 360, 535, 536, 535, 531, 391, 356, 469, 494, + 391, 492, 477, 354, 388, 578, 579, 356, 364, 356, + 362, 356, 362, 356, 362, 362, 356, 362, 356, 362, + 356, 362, 362, 356, 362, 362, 356, 362, 356, 362, + 356, 356, 533, 522, 362, 365, 360, 477, 477, 477, + 479, 479, 480, 480, 481, 481, 481, 481, 482, 482, + 483, 484, 485, 486, 487, 488, 491, 358, 549, 562, + 538, 564, 494, 365, 494, 363, 492, 492, 535, 360, + 362, 360, 358, 358, 362, 358, 362, 582, 581, 495, + 583, 587, 586, 589, 588, 354, 590, 592, 593, 365, + 534, 494, 543, 494, 509, 554, 399, 537, 550, 565, + 356, 356, 360, 535, 354, 388, 356, 356, 356, 356, + 356, 356, 363, 360, 391, 356, 355, 554, 566, 567, + 545, 546, 547, 553, 557, 492, 364, 539, 544, 548, + 494, 365, 356, 403, 541, 539, 359, 535, 356, 494, + 544, 545, 549, 558, 365, 360 }; - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_int16 yyr1[] = { - 0, 458, 459, 460, 460, 460, 460, 460, 460, 460, - 460, 460, 460, 460, 460, 460, 460, 460, 461, 461, - 461, 461, 461, 461, 462, 463, 464, 465, 465, 466, - 466, 467, 467, 468, 469, 469, 469, 470, 470, 470, - 470, 471, 471, 471, 471, 472, 472, 472, 472, 473, - 473, 473, 474, 474, 474, 475, 475, 475, 475, 475, - 476, 476, 476, 477, 477, 478, 478, 479, 479, 480, - 480, 481, 481, 482, 482, 483, 484, 483, 485, 485, - 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, - 486, 487, 487, 488, 489, 489, 489, 489, 489, 489, - 489, 489, 489, 489, 489, 491, 490, 492, 492, 493, - 493, 493, 493, 494, 494, 495, 495, 496, 497, 497, - 498, 498, 498, 498, 499, 500, 500, 500, 500, 500, - 501, 501, 501, 501, 501, 502, 502, 503, 504, 504, - 504, 504, 504, 504, 504, 504, 504, 504, 505, 506, - 506, 507, 507, 507, 508, 509, 509, 510, 510, 510, - 510, 510, 510, 510, 510, 510, 510, 510, 511, 511, - 511, 511, 511, 511, 511, 511, 511, 511, 511, 511, - 511, 511, 511, 511, 511, 511, 511, 511, 511, 511, - 511, 511, 511, 511, 511, 511, 511, 511, 511, 511, - 511, 511, 511, 511, 512, 513, 513, 514, 514, 515, - 515, 515, 515, 516, 516, 517, 518, 518, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 520, 520, 520, 522, 521, 523, 521, - 524, 524, 525, 525, 526, 526, 527, 527, 528, 528, - 528, 528, 529, 529, 530, 531, 531, 532, 532, 532, - 532, 532, 532, 532, 532, 533, 534, 535, 536, 534, - 537, 537, 539, 538, 540, 538, 541, 541, 542, 542, - 543, 543, 544, 544, 545, 546, 546, 547, 547, 548, - 548, 550, 549, 551, 551, 552, 552, 553, 553, 555, - 554, 556, 554, 557, 554, 558, 558, 559, 559, 560, - 560, 561, 561, 561, 561, 561, 561, 561, 561, 562, - 562, 563, 563, 563, 565, 564, 566, 567, 567, 568, - 568, 569, 569, 570, 570, 571, 571, 572, 572, 573, - 573, 573, 573, 573, 573, 574, 574, 575, 575, 575, - 575, 575, 576, 576, 577, 577, 578, 578, 578, 578, - 578, 578, 578, 578, 579, 579, 580, 580, 580, 580, - 581, 581, 582, 582, 583, 583, 583, 583, 584, 584, - 585, 586, 586, 587, 587, 588, 588 + 0, 465, 466, 467, 467, 467, 467, 467, 467, 467, + 467, 467, 467, 467, 467, 467, 467, 467, 468, 468, + 468, 468, 468, 468, 469, 470, 471, 472, 472, 473, + 473, 474, 474, 475, 476, 476, 476, 477, 477, 477, + 477, 478, 478, 478, 478, 479, 479, 479, 479, 480, + 480, 480, 481, 481, 481, 482, 482, 482, 482, 482, + 483, 483, 483, 484, 484, 485, 485, 486, 486, 487, + 487, 488, 488, 489, 489, 490, 491, 490, 492, 492, + 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, + 493, 494, 494, 495, 496, 496, 496, 496, 496, 496, + 496, 496, 496, 496, 496, 498, 497, 499, 499, 500, + 500, 500, 500, 501, 501, 502, 502, 503, 504, 504, + 505, 505, 505, 505, 506, 507, 507, 507, 507, 507, + 508, 508, 508, 508, 508, 509, 509, 510, 511, 511, + 511, 511, 511, 511, 511, 511, 511, 511, 512, 513, + 513, 514, 514, 514, 515, 516, 516, 517, 517, 517, + 517, 517, 517, 517, 517, 517, 517, 517, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 519, 520, 520, 521, + 521, 522, 522, 522, 522, 523, 523, 524, 525, 525, + 525, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 527, 527, 527, 529, 528, 530, 528, 531, 531, + 532, 532, 533, 533, 534, 534, 535, 535, 535, 535, + 536, 536, 537, 538, 538, 539, 539, 539, 539, 539, + 539, 539, 539, 540, 541, 542, 543, 541, 544, 544, + 546, 545, 547, 545, 548, 548, 549, 549, 550, 550, + 551, 551, 552, 553, 553, 554, 554, 555, 555, 557, + 556, 558, 558, 559, 559, 560, 560, 562, 561, 563, + 561, 564, 561, 565, 565, 566, 566, 567, 567, 568, + 568, 568, 568, 568, 568, 568, 568, 569, 569, 570, + 570, 570, 572, 571, 573, 574, 574, 575, 575, 576, + 576, 577, 577, 578, 578, 579, 579, 580, 580, 580, + 580, 580, 580, 581, 581, 582, 582, 582, 582, 582, + 583, 583, 584, 584, 585, 585, 585, 585, 585, 585, + 585, 585, 586, 586, 587, 587, 587, 587, 588, 588, + 589, 589, 589, 589, 589, 590, 590, 591, 591, 591, + 591, 592, 592, 593, 593, 594, 594, 595, 595, 596, + 596 }; - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ static const yytype_int8 yyr2[] = { 0, 2, 1, 1, 3, 1, 1, 1, 1, 1, @@ -4397,8 +4418,9 @@ static const yytype_int8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 1, 1, 1, 3, 2, 3, 2, - 3, 3, 4, 1, 0, 3, 1, 3, 1, 1, + 1, 1, 1, 1, 4, 1, 1, 1, 3, 2, + 3, 2, 3, 3, 4, 1, 0, 3, 1, 1, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -4430,22 +4452,23 @@ static const yytype_int8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 6, 0, 5, - 1, 2, 3, 4, 1, 3, 1, 2, 1, 3, - 4, 2, 1, 3, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 2, 0, 0, 5, - 1, 1, 0, 2, 0, 2, 2, 3, 1, 2, - 1, 2, 1, 2, 5, 3, 1, 1, 4, 1, - 2, 0, 8, 0, 1, 3, 2, 1, 2, 0, - 6, 0, 8, 0, 7, 1, 1, 1, 0, 2, - 3, 2, 2, 2, 3, 2, 2, 2, 2, 1, - 2, 1, 1, 1, 0, 3, 5, 1, 3, 1, - 4, 1, 3, 5, 5, 1, 3, 1, 3, 4, - 6, 6, 8, 6, 8, 1, 3, 1, 1, 1, - 1, 1, 1, 3, 4, 6, 4, 6, 6, 8, - 6, 8, 6, 8, 1, 3, 1, 1, 1, 1, - 1, 3, 1, 3, 6, 8, 4, 6, 1, 3, - 1, 4, 6, 1, 3, 3, 3 + 1, 1, 1, 1, 0, 6, 0, 5, 1, 2, + 3, 4, 1, 3, 1, 2, 1, 3, 4, 2, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 2, 2, 0, 0, 5, 1, 1, + 0, 2, 0, 2, 2, 3, 1, 2, 1, 2, + 1, 2, 5, 3, 1, 1, 4, 1, 2, 0, + 8, 0, 1, 3, 2, 1, 2, 0, 6, 0, + 8, 0, 7, 1, 1, 1, 0, 2, 3, 2, + 2, 2, 3, 2, 2, 2, 2, 1, 2, 1, + 1, 1, 0, 3, 5, 1, 3, 1, 4, 1, + 3, 5, 5, 1, 3, 1, 3, 4, 6, 6, + 8, 6, 8, 1, 3, 1, 1, 1, 1, 1, + 1, 3, 4, 6, 4, 6, 6, 8, 6, 8, + 6, 8, 1, 3, 1, 1, 1, 1, 1, 3, + 1, 1, 1, 1, 1, 1, 3, 6, 8, 4, + 6, 1, 3, 1, 1, 4, 6, 1, 3, 3, + 3 }; @@ -4457,6 +4480,7 @@ enum { YYENOMEM = -2 }; #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) @@ -4497,10 +4521,7 @@ do { \ YYFPRINTF Args; \ } while (0) -/* This macro is provided for backward compatibility. */ -# ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif + # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ @@ -4524,16 +4545,12 @@ yy_symbol_value_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, glslang::TParseContext* pParseContext) { FILE *yyoutput = yyo; - YYUSE (yyoutput); - YYUSE (pParseContext); + YY_USE (yyoutput); + YY_USE (pParseContext); if (!yyvaluep) return; -# ifdef YYPRINT - if (yykind < YYNTOKENS) - YYPRINT (yyo, yytoknum[yykind], *yyvaluep); -# endif YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yykind); + YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -4914,14 +4931,14 @@ static void yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, glslang::TParseContext* pParseContext) { - YYUSE (yyvaluep); - YYUSE (pParseContext); + YY_USE (yyvaluep); + YY_USE (pParseContext); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yykind); + YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -4993,6 +5010,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); YYDPRINTF ((stderr, "Starting parse\n")); yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; @@ -5018,7 +5036,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; + YYNOMEM; #else { /* Get the current used size of the three stacks, in elements. */ @@ -5046,7 +5064,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + YYNOMEM; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; @@ -5057,7 +5075,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) - goto yyexhaustedlab; + YYNOMEM; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE @@ -5079,6 +5097,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + if (yystate == YYFINAL) YYACCEPT; @@ -5191,260 +5210,260 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); switch (yyn) { case 2: /* variable_identifier: IDENTIFIER */ -#line 392 "MachineIndependent/glslang.y" +#line 395 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleVariable((yyvsp[0].lex).loc, (yyvsp[0].lex).symbol, (yyvsp[0].lex).string); } -#line 5199 "MachineIndependent/glslang_tab.cpp" +#line 5218 "MachineIndependent/glslang_tab.cpp" break; case 3: /* primary_expression: variable_identifier */ -#line 398 "MachineIndependent/glslang.y" +#line 401 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5207 "MachineIndependent/glslang_tab.cpp" +#line 5226 "MachineIndependent/glslang_tab.cpp" break; case 4: /* primary_expression: LEFT_PAREN expression RIGHT_PAREN */ -#line 401 "MachineIndependent/glslang.y" +#line 404 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } -#line 5217 "MachineIndependent/glslang_tab.cpp" +#line 5236 "MachineIndependent/glslang_tab.cpp" break; case 5: /* primary_expression: FLOATCONSTANT */ -#line 406 "MachineIndependent/glslang.y" +#line 409 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); } -#line 5225 "MachineIndependent/glslang_tab.cpp" +#line 5244 "MachineIndependent/glslang_tab.cpp" break; case 6: /* primary_expression: INTCONSTANT */ -#line 409 "MachineIndependent/glslang.y" +#line 412 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 5233 "MachineIndependent/glslang_tab.cpp" +#line 5252 "MachineIndependent/glslang_tab.cpp" break; case 7: /* primary_expression: UINTCONSTANT */ -#line 412 "MachineIndependent/glslang.y" +#line 415 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 5242 "MachineIndependent/glslang_tab.cpp" +#line 5261 "MachineIndependent/glslang_tab.cpp" break; case 8: /* primary_expression: BOOLCONSTANT */ -#line 416 "MachineIndependent/glslang.y" +#line 419 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); } -#line 5250 "MachineIndependent/glslang_tab.cpp" +#line 5269 "MachineIndependent/glslang_tab.cpp" break; case 9: /* primary_expression: STRING_LITERAL */ -#line 420 "MachineIndependent/glslang.y" +#line 423 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true); } -#line 5258 "MachineIndependent/glslang_tab.cpp" +#line 5277 "MachineIndependent/glslang_tab.cpp" break; case 10: /* primary_expression: INT32CONSTANT */ -#line 423 "MachineIndependent/glslang.y" +#line 426 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 5267 "MachineIndependent/glslang_tab.cpp" +#line 5286 "MachineIndependent/glslang_tab.cpp" break; case 11: /* primary_expression: UINT32CONSTANT */ -#line 427 "MachineIndependent/glslang.y" +#line 430 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 5276 "MachineIndependent/glslang_tab.cpp" +#line 5295 "MachineIndependent/glslang_tab.cpp" break; case 12: /* primary_expression: INT64CONSTANT */ -#line 431 "MachineIndependent/glslang.y" +#line 434 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i64, (yyvsp[0].lex).loc, true); } -#line 5285 "MachineIndependent/glslang_tab.cpp" +#line 5304 "MachineIndependent/glslang_tab.cpp" break; case 13: /* primary_expression: UINT64CONSTANT */ -#line 435 "MachineIndependent/glslang.y" +#line 438 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u64, (yyvsp[0].lex).loc, true); } -#line 5294 "MachineIndependent/glslang_tab.cpp" +#line 5313 "MachineIndependent/glslang_tab.cpp" break; case 14: /* primary_expression: INT16CONSTANT */ -#line 439 "MachineIndependent/glslang.y" +#line 442 "MachineIndependent/glslang.y" { parseContext.explicitInt16Check((yyvsp[0].lex).loc, "16-bit integer literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((short)(yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 5303 "MachineIndependent/glslang_tab.cpp" +#line 5322 "MachineIndependent/glslang_tab.cpp" break; case 15: /* primary_expression: UINT16CONSTANT */ -#line 443 "MachineIndependent/glslang.y" +#line 446 "MachineIndependent/glslang.y" { parseContext.explicitInt16Check((yyvsp[0].lex).loc, "16-bit unsigned integer literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((unsigned short)(yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 5312 "MachineIndependent/glslang_tab.cpp" +#line 5331 "MachineIndependent/glslang_tab.cpp" break; case 16: /* primary_expression: DOUBLECONSTANT */ -#line 447 "MachineIndependent/glslang.y" +#line 450 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double literal"); if (! parseContext.symbolTable.atBuiltInLevel()) parseContext.doubleCheck((yyvsp[0].lex).loc, "double literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtDouble, (yyvsp[0].lex).loc, true); } -#line 5323 "MachineIndependent/glslang_tab.cpp" +#line 5342 "MachineIndependent/glslang_tab.cpp" break; case 17: /* primary_expression: FLOAT16CONSTANT */ -#line 453 "MachineIndependent/glslang.y" +#line 456 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat16, (yyvsp[0].lex).loc, true); } -#line 5332 "MachineIndependent/glslang_tab.cpp" +#line 5351 "MachineIndependent/glslang_tab.cpp" break; case 18: /* postfix_expression: primary_expression */ -#line 461 "MachineIndependent/glslang.y" +#line 464 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5340 "MachineIndependent/glslang_tab.cpp" +#line 5359 "MachineIndependent/glslang_tab.cpp" break; case 19: /* postfix_expression: postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET */ -#line 464 "MachineIndependent/glslang.y" +#line 467 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBracketDereference((yyvsp[-2].lex).loc, (yyvsp[-3].interm.intermTypedNode), (yyvsp[-1].interm.intermTypedNode)); } -#line 5348 "MachineIndependent/glslang_tab.cpp" +#line 5367 "MachineIndependent/glslang_tab.cpp" break; case 20: /* postfix_expression: function_call */ -#line 467 "MachineIndependent/glslang.y" +#line 470 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5356 "MachineIndependent/glslang_tab.cpp" +#line 5375 "MachineIndependent/glslang_tab.cpp" break; case 21: /* postfix_expression: postfix_expression DOT IDENTIFIER */ -#line 470 "MachineIndependent/glslang.y" +#line 473 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleDotDereference((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode), *(yyvsp[0].lex).string); } -#line 5364 "MachineIndependent/glslang_tab.cpp" +#line 5383 "MachineIndependent/glslang_tab.cpp" break; case 22: /* postfix_expression: postfix_expression INC_OP */ -#line 473 "MachineIndependent/glslang.y" +#line 476 "MachineIndependent/glslang.y" { parseContext.variableCheck((yyvsp[-1].interm.intermTypedNode)); parseContext.lValueErrorCheck((yyvsp[0].lex).loc, "++", (yyvsp[-1].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[0].lex).loc, "++", EOpPostIncrement, (yyvsp[-1].interm.intermTypedNode)); } -#line 5374 "MachineIndependent/glslang_tab.cpp" +#line 5393 "MachineIndependent/glslang_tab.cpp" break; case 23: /* postfix_expression: postfix_expression DEC_OP */ -#line 478 "MachineIndependent/glslang.y" +#line 481 "MachineIndependent/glslang.y" { parseContext.variableCheck((yyvsp[-1].interm.intermTypedNode)); parseContext.lValueErrorCheck((yyvsp[0].lex).loc, "--", (yyvsp[-1].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[0].lex).loc, "--", EOpPostDecrement, (yyvsp[-1].interm.intermTypedNode)); } -#line 5384 "MachineIndependent/glslang_tab.cpp" +#line 5403 "MachineIndependent/glslang_tab.cpp" break; case 24: /* integer_expression: expression */ -#line 486 "MachineIndependent/glslang.y" +#line 489 "MachineIndependent/glslang.y" { parseContext.integerCheck((yyvsp[0].interm.intermTypedNode), "[]"); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5393 "MachineIndependent/glslang_tab.cpp" +#line 5412 "MachineIndependent/glslang_tab.cpp" break; case 25: /* function_call: function_call_or_method */ -#line 493 "MachineIndependent/glslang.y" +#line 496 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleFunctionCall((yyvsp[0].interm).loc, (yyvsp[0].interm).function, (yyvsp[0].interm).intermNode); delete (yyvsp[0].interm).function; } -#line 5402 "MachineIndependent/glslang_tab.cpp" +#line 5421 "MachineIndependent/glslang_tab.cpp" break; case 26: /* function_call_or_method: function_call_generic */ -#line 500 "MachineIndependent/glslang.y" +#line 503 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); } -#line 5410 "MachineIndependent/glslang_tab.cpp" +#line 5429 "MachineIndependent/glslang_tab.cpp" break; case 27: /* function_call_generic: function_call_header_with_parameters RIGHT_PAREN */ -#line 506 "MachineIndependent/glslang.y" +#line 509 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-1].interm); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 5419 "MachineIndependent/glslang_tab.cpp" +#line 5438 "MachineIndependent/glslang_tab.cpp" break; case 28: /* function_call_generic: function_call_header_no_parameters RIGHT_PAREN */ -#line 510 "MachineIndependent/glslang.y" +#line 513 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-1].interm); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 5428 "MachineIndependent/glslang_tab.cpp" +#line 5447 "MachineIndependent/glslang_tab.cpp" break; case 29: /* function_call_header_no_parameters: function_call_header VOID */ -#line 517 "MachineIndependent/glslang.y" +#line 520 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-1].interm); } -#line 5436 "MachineIndependent/glslang_tab.cpp" +#line 5455 "MachineIndependent/glslang_tab.cpp" break; case 30: /* function_call_header_no_parameters: function_call_header */ -#line 520 "MachineIndependent/glslang.y" +#line 523 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); } -#line 5444 "MachineIndependent/glslang_tab.cpp" +#line 5463 "MachineIndependent/glslang_tab.cpp" break; case 31: /* function_call_header_with_parameters: function_call_header assignment_expression */ -#line 526 "MachineIndependent/glslang.y" +#line 529 "MachineIndependent/glslang.y" { TParameter param = { 0, new TType }; param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); @@ -5452,11 +5471,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm).function = (yyvsp[-1].interm).function; (yyval.interm).intermNode = (yyvsp[0].interm.intermTypedNode); } -#line 5456 "MachineIndependent/glslang_tab.cpp" +#line 5475 "MachineIndependent/glslang_tab.cpp" break; case 32: /* function_call_header_with_parameters: function_call_header_with_parameters COMMA assignment_expression */ -#line 533 "MachineIndependent/glslang.y" +#line 536 "MachineIndependent/glslang.y" { TParameter param = { 0, new TType }; param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); @@ -5464,29 +5483,29 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm).function = (yyvsp[-2].interm).function; (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-2].interm).intermNode, (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); } -#line 5468 "MachineIndependent/glslang_tab.cpp" +#line 5487 "MachineIndependent/glslang_tab.cpp" break; case 33: /* function_call_header: function_identifier LEFT_PAREN */ -#line 543 "MachineIndependent/glslang.y" +#line 546 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-1].interm); } -#line 5476 "MachineIndependent/glslang_tab.cpp" +#line 5495 "MachineIndependent/glslang_tab.cpp" break; case 34: /* function_identifier: type_specifier */ -#line 551 "MachineIndependent/glslang.y" +#line 554 "MachineIndependent/glslang.y" { // Constructor (yyval.interm).intermNode = 0; (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } -#line 5486 "MachineIndependent/glslang_tab.cpp" +#line 5505 "MachineIndependent/glslang_tab.cpp" break; case 35: /* function_identifier: postfix_expression */ -#line 556 "MachineIndependent/glslang.y" +#line 559 "MachineIndependent/glslang.y" { // // Should be a method or subroutine call, but we haven't recognized the arguments yet. @@ -5514,50 +5533,50 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm).function = new TFunction(empty, TType(EbtVoid), EOpNull); } } -#line 5518 "MachineIndependent/glslang_tab.cpp" +#line 5537 "MachineIndependent/glslang_tab.cpp" break; case 36: /* function_identifier: non_uniform_qualifier */ -#line 584 "MachineIndependent/glslang.y" +#line 587 "MachineIndependent/glslang.y" { // Constructor (yyval.interm).intermNode = 0; (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } -#line 5528 "MachineIndependent/glslang_tab.cpp" +#line 5547 "MachineIndependent/glslang_tab.cpp" break; case 37: /* unary_expression: postfix_expression */ -#line 593 "MachineIndependent/glslang.y" +#line 596 "MachineIndependent/glslang.y" { parseContext.variableCheck((yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); if (TIntermMethod* method = (yyvsp[0].interm.intermTypedNode)->getAsMethodNode()) parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), ""); } -#line 5539 "MachineIndependent/glslang_tab.cpp" +#line 5558 "MachineIndependent/glslang_tab.cpp" break; case 38: /* unary_expression: INC_OP unary_expression */ -#line 599 "MachineIndependent/glslang.y" +#line 602 "MachineIndependent/glslang.y" { parseContext.lValueErrorCheck((yyvsp[-1].lex).loc, "++", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].lex).loc, "++", EOpPreIncrement, (yyvsp[0].interm.intermTypedNode)); } -#line 5548 "MachineIndependent/glslang_tab.cpp" +#line 5567 "MachineIndependent/glslang_tab.cpp" break; case 39: /* unary_expression: DEC_OP unary_expression */ -#line 603 "MachineIndependent/glslang.y" +#line 606 "MachineIndependent/glslang.y" { parseContext.lValueErrorCheck((yyvsp[-1].lex).loc, "--", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].lex).loc, "--", EOpPreDecrement, (yyvsp[0].interm.intermTypedNode)); } -#line 5557 "MachineIndependent/glslang_tab.cpp" +#line 5576 "MachineIndependent/glslang_tab.cpp" break; case 40: /* unary_expression: unary_operator unary_expression */ -#line 607 "MachineIndependent/glslang.y" +#line 610 "MachineIndependent/glslang.y" { if ((yyvsp[-1].interm).op != EOpNull) { char errorOp[2] = {0, 0}; @@ -5574,179 +5593,179 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } } -#line 5578 "MachineIndependent/glslang_tab.cpp" +#line 5597 "MachineIndependent/glslang_tab.cpp" break; case 41: /* unary_operator: PLUS */ -#line 627 "MachineIndependent/glslang.y" +#line 630 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNull; } -#line 5584 "MachineIndependent/glslang_tab.cpp" +#line 5603 "MachineIndependent/glslang_tab.cpp" break; case 42: /* unary_operator: DASH */ -#line 628 "MachineIndependent/glslang.y" +#line 631 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNegative; } -#line 5590 "MachineIndependent/glslang_tab.cpp" +#line 5609 "MachineIndependent/glslang_tab.cpp" break; case 43: /* unary_operator: BANG */ -#line 629 "MachineIndependent/glslang.y" +#line 632 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLogicalNot; } -#line 5596 "MachineIndependent/glslang_tab.cpp" +#line 5615 "MachineIndependent/glslang_tab.cpp" break; case 44: /* unary_operator: TILDE */ -#line 630 "MachineIndependent/glslang.y" +#line 633 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpBitwiseNot; parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise not"); } -#line 5603 "MachineIndependent/glslang_tab.cpp" +#line 5622 "MachineIndependent/glslang_tab.cpp" break; case 45: /* multiplicative_expression: unary_expression */ -#line 636 "MachineIndependent/glslang.y" +#line 639 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5609 "MachineIndependent/glslang_tab.cpp" +#line 5628 "MachineIndependent/glslang_tab.cpp" break; case 46: /* multiplicative_expression: multiplicative_expression STAR unary_expression */ -#line 637 "MachineIndependent/glslang.y" +#line 640 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "*", EOpMul, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5619 "MachineIndependent/glslang_tab.cpp" +#line 5638 "MachineIndependent/glslang_tab.cpp" break; case 47: /* multiplicative_expression: multiplicative_expression SLASH unary_expression */ -#line 642 "MachineIndependent/glslang.y" +#line 645 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "/", EOpDiv, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5629 "MachineIndependent/glslang_tab.cpp" +#line 5648 "MachineIndependent/glslang_tab.cpp" break; case 48: /* multiplicative_expression: multiplicative_expression PERCENT unary_expression */ -#line 647 "MachineIndependent/glslang.y" +#line 650 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "%"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "%", EOpMod, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5640 "MachineIndependent/glslang_tab.cpp" +#line 5659 "MachineIndependent/glslang_tab.cpp" break; case 49: /* additive_expression: multiplicative_expression */ -#line 656 "MachineIndependent/glslang.y" +#line 659 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5646 "MachineIndependent/glslang_tab.cpp" +#line 5665 "MachineIndependent/glslang_tab.cpp" break; case 50: /* additive_expression: additive_expression PLUS multiplicative_expression */ -#line 657 "MachineIndependent/glslang.y" +#line 660 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "+", EOpAdd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5656 "MachineIndependent/glslang_tab.cpp" +#line 5675 "MachineIndependent/glslang_tab.cpp" break; case 51: /* additive_expression: additive_expression DASH multiplicative_expression */ -#line 662 "MachineIndependent/glslang.y" +#line 665 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "-", EOpSub, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5666 "MachineIndependent/glslang_tab.cpp" +#line 5685 "MachineIndependent/glslang_tab.cpp" break; case 52: /* shift_expression: additive_expression */ -#line 670 "MachineIndependent/glslang.y" +#line 673 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5672 "MachineIndependent/glslang_tab.cpp" +#line 5691 "MachineIndependent/glslang_tab.cpp" break; case 53: /* shift_expression: shift_expression LEFT_OP additive_expression */ -#line 671 "MachineIndependent/glslang.y" +#line 674 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift left"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<<", EOpLeftShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5683 "MachineIndependent/glslang_tab.cpp" +#line 5702 "MachineIndependent/glslang_tab.cpp" break; case 54: /* shift_expression: shift_expression RIGHT_OP additive_expression */ -#line 677 "MachineIndependent/glslang.y" +#line 680 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift right"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">>", EOpRightShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5694 "MachineIndependent/glslang_tab.cpp" +#line 5713 "MachineIndependent/glslang_tab.cpp" break; case 55: /* relational_expression: shift_expression */ -#line 686 "MachineIndependent/glslang.y" +#line 689 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5700 "MachineIndependent/glslang_tab.cpp" +#line 5719 "MachineIndependent/glslang_tab.cpp" break; case 56: /* relational_expression: relational_expression LEFT_ANGLE shift_expression */ -#line 687 "MachineIndependent/glslang.y" +#line 690 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<", EOpLessThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5710 "MachineIndependent/glslang_tab.cpp" +#line 5729 "MachineIndependent/glslang_tab.cpp" break; case 57: /* relational_expression: relational_expression RIGHT_ANGLE shift_expression */ -#line 692 "MachineIndependent/glslang.y" +#line 695 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">", EOpGreaterThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5720 "MachineIndependent/glslang_tab.cpp" +#line 5739 "MachineIndependent/glslang_tab.cpp" break; case 58: /* relational_expression: relational_expression LE_OP shift_expression */ -#line 697 "MachineIndependent/glslang.y" +#line 700 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<=", EOpLessThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5730 "MachineIndependent/glslang_tab.cpp" +#line 5749 "MachineIndependent/glslang_tab.cpp" break; case 59: /* relational_expression: relational_expression GE_OP shift_expression */ -#line 702 "MachineIndependent/glslang.y" +#line 705 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">=", EOpGreaterThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5740 "MachineIndependent/glslang_tab.cpp" +#line 5759 "MachineIndependent/glslang_tab.cpp" break; case 60: /* equality_expression: relational_expression */ -#line 710 "MachineIndependent/glslang.y" +#line 713 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5746 "MachineIndependent/glslang_tab.cpp" +#line 5765 "MachineIndependent/glslang_tab.cpp" break; case 61: /* equality_expression: equality_expression EQ_OP relational_expression */ -#line 711 "MachineIndependent/glslang.y" +#line 714 "MachineIndependent/glslang.y" { parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "=="); @@ -5756,11 +5775,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5760 "MachineIndependent/glslang_tab.cpp" +#line 5779 "MachineIndependent/glslang_tab.cpp" break; case 62: /* equality_expression: equality_expression NE_OP relational_expression */ -#line 720 "MachineIndependent/glslang.y" +#line 723 "MachineIndependent/glslang.y" { parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "!="); @@ -5770,124 +5789,124 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5774 "MachineIndependent/glslang_tab.cpp" +#line 5793 "MachineIndependent/glslang_tab.cpp" break; case 63: /* and_expression: equality_expression */ -#line 732 "MachineIndependent/glslang.y" +#line 735 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5780 "MachineIndependent/glslang_tab.cpp" +#line 5799 "MachineIndependent/glslang_tab.cpp" break; case 64: /* and_expression: and_expression AMPERSAND equality_expression */ -#line 733 "MachineIndependent/glslang.y" +#line 736 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise and"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&", EOpAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5791 "MachineIndependent/glslang_tab.cpp" +#line 5810 "MachineIndependent/glslang_tab.cpp" break; case 65: /* exclusive_or_expression: and_expression */ -#line 742 "MachineIndependent/glslang.y" +#line 745 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5797 "MachineIndependent/glslang_tab.cpp" +#line 5816 "MachineIndependent/glslang_tab.cpp" break; case 66: /* exclusive_or_expression: exclusive_or_expression CARET and_expression */ -#line 743 "MachineIndependent/glslang.y" +#line 746 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise exclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^", EOpExclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5808 "MachineIndependent/glslang_tab.cpp" +#line 5827 "MachineIndependent/glslang_tab.cpp" break; case 67: /* inclusive_or_expression: exclusive_or_expression */ -#line 752 "MachineIndependent/glslang.y" +#line 755 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5814 "MachineIndependent/glslang_tab.cpp" +#line 5833 "MachineIndependent/glslang_tab.cpp" break; case 68: /* inclusive_or_expression: inclusive_or_expression VERTICAL_BAR exclusive_or_expression */ -#line 753 "MachineIndependent/glslang.y" +#line 756 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise inclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "|", EOpInclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 5825 "MachineIndependent/glslang_tab.cpp" +#line 5844 "MachineIndependent/glslang_tab.cpp" break; case 69: /* logical_and_expression: inclusive_or_expression */ -#line 762 "MachineIndependent/glslang.y" +#line 765 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5831 "MachineIndependent/glslang_tab.cpp" +#line 5850 "MachineIndependent/glslang_tab.cpp" break; case 70: /* logical_and_expression: logical_and_expression AND_OP inclusive_or_expression */ -#line 763 "MachineIndependent/glslang.y" +#line 766 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&&", EOpLogicalAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5841 "MachineIndependent/glslang_tab.cpp" +#line 5860 "MachineIndependent/glslang_tab.cpp" break; case 71: /* logical_xor_expression: logical_and_expression */ -#line 771 "MachineIndependent/glslang.y" +#line 774 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5847 "MachineIndependent/glslang_tab.cpp" +#line 5866 "MachineIndependent/glslang_tab.cpp" break; case 72: /* logical_xor_expression: logical_xor_expression XOR_OP logical_and_expression */ -#line 772 "MachineIndependent/glslang.y" +#line 775 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^^", EOpLogicalXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5857 "MachineIndependent/glslang_tab.cpp" +#line 5876 "MachineIndependent/glslang_tab.cpp" break; case 73: /* logical_or_expression: logical_xor_expression */ -#line 780 "MachineIndependent/glslang.y" +#line 783 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5863 "MachineIndependent/glslang_tab.cpp" +#line 5882 "MachineIndependent/glslang_tab.cpp" break; case 74: /* logical_or_expression: logical_or_expression OR_OP logical_xor_expression */ -#line 781 "MachineIndependent/glslang.y" +#line 784 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "||", EOpLogicalOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 5873 "MachineIndependent/glslang_tab.cpp" +#line 5892 "MachineIndependent/glslang_tab.cpp" break; case 75: /* conditional_expression: logical_or_expression */ -#line 789 "MachineIndependent/glslang.y" +#line 792 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5879 "MachineIndependent/glslang_tab.cpp" +#line 5898 "MachineIndependent/glslang_tab.cpp" break; case 76: /* $@1: %empty */ -#line 790 "MachineIndependent/glslang.y" +#line 793 "MachineIndependent/glslang.y" { ++parseContext.controlFlowNestingLevel; } -#line 5887 "MachineIndependent/glslang_tab.cpp" +#line 5906 "MachineIndependent/glslang_tab.cpp" break; case 77: /* conditional_expression: logical_or_expression QUESTION $@1 expression COLON assignment_expression */ -#line 793 "MachineIndependent/glslang.y" +#line 796 "MachineIndependent/glslang.y" { --parseContext.controlFlowNestingLevel; parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-5].interm.intermTypedNode)); @@ -5900,17 +5919,17 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } -#line 5904 "MachineIndependent/glslang_tab.cpp" +#line 5923 "MachineIndependent/glslang_tab.cpp" break; case 78: /* assignment_expression: conditional_expression */ -#line 808 "MachineIndependent/glslang.y" +#line 811 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5910 "MachineIndependent/glslang_tab.cpp" +#line 5929 "MachineIndependent/glslang_tab.cpp" break; case 79: /* assignment_expression: unary_expression assignment_operator assignment_expression */ -#line 809 "MachineIndependent/glslang.y" +#line 812 "MachineIndependent/glslang.y" { parseContext.arrayObjectCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array assignment"); parseContext.opaqueCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "="); @@ -5924,119 +5943,119 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } } -#line 5928 "MachineIndependent/glslang_tab.cpp" +#line 5947 "MachineIndependent/glslang_tab.cpp" break; case 80: /* assignment_operator: EQUAL */ -#line 825 "MachineIndependent/glslang.y" +#line 828 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAssign; } -#line 5937 "MachineIndependent/glslang_tab.cpp" +#line 5956 "MachineIndependent/glslang_tab.cpp" break; case 81: /* assignment_operator: MUL_ASSIGN */ -#line 829 "MachineIndependent/glslang.y" +#line 832 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpMulAssign; } -#line 5946 "MachineIndependent/glslang_tab.cpp" +#line 5965 "MachineIndependent/glslang_tab.cpp" break; case 82: /* assignment_operator: DIV_ASSIGN */ -#line 833 "MachineIndependent/glslang.y" +#line 836 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpDivAssign; } -#line 5955 "MachineIndependent/glslang_tab.cpp" +#line 5974 "MachineIndependent/glslang_tab.cpp" break; case 83: /* assignment_operator: MOD_ASSIGN */ -#line 837 "MachineIndependent/glslang.y" +#line 840 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "%="); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpModAssign; } -#line 5965 "MachineIndependent/glslang_tab.cpp" +#line 5984 "MachineIndependent/glslang_tab.cpp" break; case 84: /* assignment_operator: ADD_ASSIGN */ -#line 842 "MachineIndependent/glslang.y" +#line 845 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAddAssign; } -#line 5974 "MachineIndependent/glslang_tab.cpp" +#line 5993 "MachineIndependent/glslang_tab.cpp" break; case 85: /* assignment_operator: SUB_ASSIGN */ -#line 846 "MachineIndependent/glslang.y" +#line 849 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpSubAssign; } -#line 5983 "MachineIndependent/glslang_tab.cpp" +#line 6002 "MachineIndependent/glslang_tab.cpp" break; case 86: /* assignment_operator: LEFT_ASSIGN */ -#line 850 "MachineIndependent/glslang.y" +#line 853 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift left assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLeftShiftAssign; } -#line 5992 "MachineIndependent/glslang_tab.cpp" +#line 6011 "MachineIndependent/glslang_tab.cpp" break; case 87: /* assignment_operator: RIGHT_ASSIGN */ -#line 854 "MachineIndependent/glslang.y" +#line 857 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift right assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpRightShiftAssign; } -#line 6001 "MachineIndependent/glslang_tab.cpp" +#line 6020 "MachineIndependent/glslang_tab.cpp" break; case 88: /* assignment_operator: AND_ASSIGN */ -#line 858 "MachineIndependent/glslang.y" +#line 861 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-and assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAndAssign; } -#line 6010 "MachineIndependent/glslang_tab.cpp" +#line 6029 "MachineIndependent/glslang_tab.cpp" break; case 89: /* assignment_operator: XOR_ASSIGN */ -#line 862 "MachineIndependent/glslang.y" +#line 865 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-xor assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpExclusiveOrAssign; } -#line 6019 "MachineIndependent/glslang_tab.cpp" +#line 6038 "MachineIndependent/glslang_tab.cpp" break; case 90: /* assignment_operator: OR_ASSIGN */ -#line 866 "MachineIndependent/glslang.y" +#line 869 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-or assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpInclusiveOrAssign; } -#line 6028 "MachineIndependent/glslang_tab.cpp" +#line 6047 "MachineIndependent/glslang_tab.cpp" break; case 91: /* expression: assignment_expression */ -#line 873 "MachineIndependent/glslang.y" +#line 876 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6036 "MachineIndependent/glslang_tab.cpp" +#line 6055 "MachineIndependent/glslang_tab.cpp" break; case 92: /* expression: expression COMMA assignment_expression */ -#line 876 "MachineIndependent/glslang.y" +#line 879 "MachineIndependent/glslang.y" { parseContext.samplerConstructorLocationCheck((yyvsp[-1].lex).loc, ",", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.intermediate.addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); @@ -6045,30 +6064,30 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } -#line 6049 "MachineIndependent/glslang_tab.cpp" +#line 6068 "MachineIndependent/glslang_tab.cpp" break; case 93: /* constant_expression: conditional_expression */ -#line 887 "MachineIndependent/glslang.y" +#line 890 "MachineIndependent/glslang.y" { parseContext.constantValueCheck((yyvsp[0].interm.intermTypedNode), ""); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6058 "MachineIndependent/glslang_tab.cpp" +#line 6077 "MachineIndependent/glslang_tab.cpp" break; case 94: /* declaration: function_prototype SEMICOLON */ -#line 894 "MachineIndependent/glslang.y" +#line 897 "MachineIndependent/glslang.y" { parseContext.handleFunctionDeclarator((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).function, true /* prototype */); (yyval.interm.intermNode) = 0; // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature } -#line 6068 "MachineIndependent/glslang_tab.cpp" +#line 6087 "MachineIndependent/glslang_tab.cpp" break; case 95: /* declaration: spirv_instruction_qualifier function_prototype SEMICOLON */ -#line 900 "MachineIndependent/glslang.y" +#line 903 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[-1].interm).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier"); (yyvsp[-1].interm).function->setSpirvInstruction(*(yyvsp[-2].interm.spirvInst)); // Attach SPIR-V intruction qualifier @@ -6076,31 +6095,31 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.intermNode) = 0; // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature } -#line 6080 "MachineIndependent/glslang_tab.cpp" +#line 6099 "MachineIndependent/glslang_tab.cpp" break; case 96: /* declaration: spirv_execution_mode_qualifier SEMICOLON */ -#line 907 "MachineIndependent/glslang.y" +#line 910 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "SPIR-V execution mode qualifier"); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier"); (yyval.interm.intermNode) = 0; } -#line 6090 "MachineIndependent/glslang_tab.cpp" +#line 6109 "MachineIndependent/glslang_tab.cpp" break; case 97: /* declaration: init_declarator_list SEMICOLON */ -#line 913 "MachineIndependent/glslang.y" +#line 916 "MachineIndependent/glslang.y" { if ((yyvsp[-1].interm).intermNode && (yyvsp[-1].interm).intermNode->getAsAggregate()) (yyvsp[-1].interm).intermNode->getAsAggregate()->setOperator(EOpSequence); (yyval.interm.intermNode) = (yyvsp[-1].interm).intermNode; } -#line 6100 "MachineIndependent/glslang_tab.cpp" +#line 6119 "MachineIndependent/glslang_tab.cpp" break; case 98: /* declaration: PRECISION precision_qualifier type_specifier SEMICOLON */ -#line 918 "MachineIndependent/glslang.y" +#line 921 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyvsp[-3].lex).loc, ENoProfile, 130, 0, "precision statement"); // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope @@ -6108,75 +6127,75 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.setDefaultPrecision((yyvsp[-3].lex).loc, (yyvsp[-1].interm.type), (yyvsp[-2].interm.type).qualifier.precision); (yyval.interm.intermNode) = 0; } -#line 6112 "MachineIndependent/glslang_tab.cpp" +#line 6131 "MachineIndependent/glslang_tab.cpp" break; case 99: /* declaration: block_structure SEMICOLON */ -#line 925 "MachineIndependent/glslang.y" +#line 928 "MachineIndependent/glslang.y" { parseContext.declareBlock((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).typeList); (yyval.interm.intermNode) = 0; } -#line 6121 "MachineIndependent/glslang_tab.cpp" +#line 6140 "MachineIndependent/glslang_tab.cpp" break; case 100: /* declaration: block_structure IDENTIFIER SEMICOLON */ -#line 929 "MachineIndependent/glslang.y" +#line 932 "MachineIndependent/glslang.y" { parseContext.declareBlock((yyvsp[-2].interm).loc, *(yyvsp[-2].interm).typeList, (yyvsp[-1].lex).string); (yyval.interm.intermNode) = 0; } -#line 6130 "MachineIndependent/glslang_tab.cpp" +#line 6149 "MachineIndependent/glslang_tab.cpp" break; case 101: /* declaration: block_structure IDENTIFIER array_specifier SEMICOLON */ -#line 933 "MachineIndependent/glslang.y" +#line 936 "MachineIndependent/glslang.y" { parseContext.declareBlock((yyvsp[-3].interm).loc, *(yyvsp[-3].interm).typeList, (yyvsp[-2].lex).string, (yyvsp[-1].interm).arraySizes); (yyval.interm.intermNode) = 0; } -#line 6139 "MachineIndependent/glslang_tab.cpp" +#line 6158 "MachineIndependent/glslang_tab.cpp" break; case 102: /* declaration: type_qualifier SEMICOLON */ -#line 937 "MachineIndependent/glslang.y" +#line 940 "MachineIndependent/glslang.y" { parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); parseContext.updateStandaloneQualifierDefaults((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type)); (yyval.interm.intermNode) = 0; } -#line 6149 "MachineIndependent/glslang_tab.cpp" +#line 6168 "MachineIndependent/glslang_tab.cpp" break; case 103: /* declaration: type_qualifier IDENTIFIER SEMICOLON */ -#line 942 "MachineIndependent/glslang.y" +#line 945 "MachineIndependent/glslang.y" { parseContext.checkNoShaderLayouts((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).shaderQualifiers); parseContext.addQualifierToExisting((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, *(yyvsp[-1].lex).string); (yyval.interm.intermNode) = 0; } -#line 6159 "MachineIndependent/glslang_tab.cpp" +#line 6178 "MachineIndependent/glslang_tab.cpp" break; case 104: /* declaration: type_qualifier IDENTIFIER identifier_list SEMICOLON */ -#line 947 "MachineIndependent/glslang.y" +#line 950 "MachineIndependent/glslang.y" { parseContext.checkNoShaderLayouts((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).shaderQualifiers); (yyvsp[-1].interm.identifierList)->push_back((yyvsp[-2].lex).string); parseContext.addQualifierToExisting((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier, *(yyvsp[-1].interm.identifierList)); (yyval.interm.intermNode) = 0; } -#line 6170 "MachineIndependent/glslang_tab.cpp" +#line 6189 "MachineIndependent/glslang_tab.cpp" break; case 105: /* $@2: %empty */ -#line 956 "MachineIndependent/glslang.y" +#line 959 "MachineIndependent/glslang.y" { parseContext.nestedBlockCheck((yyvsp[-2].interm.type).loc); } -#line 6176 "MachineIndependent/glslang_tab.cpp" +#line 6195 "MachineIndependent/glslang_tab.cpp" break; case 106: /* block_structure: type_qualifier IDENTIFIER LEFT_BRACE $@2 struct_declaration_list RIGHT_BRACE */ -#line 956 "MachineIndependent/glslang.y" +#line 959 "MachineIndependent/glslang.y" { --parseContext.blockNestingLevel; parseContext.blockName = (yyvsp[-4].lex).string; @@ -6186,60 +6205,60 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm).loc = (yyvsp[-5].interm.type).loc; (yyval.interm).typeList = (yyvsp[-1].interm.typeList); } -#line 6190 "MachineIndependent/glslang_tab.cpp" +#line 6209 "MachineIndependent/glslang_tab.cpp" break; case 107: /* identifier_list: COMMA IDENTIFIER */ -#line 967 "MachineIndependent/glslang.y" +#line 970 "MachineIndependent/glslang.y" { (yyval.interm.identifierList) = new TIdentifierList; (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); } -#line 6199 "MachineIndependent/glslang_tab.cpp" +#line 6218 "MachineIndependent/glslang_tab.cpp" break; case 108: /* identifier_list: identifier_list COMMA IDENTIFIER */ -#line 971 "MachineIndependent/glslang.y" +#line 974 "MachineIndependent/glslang.y" { (yyval.interm.identifierList) = (yyvsp[-2].interm.identifierList); (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); } -#line 6208 "MachineIndependent/glslang_tab.cpp" +#line 6227 "MachineIndependent/glslang_tab.cpp" break; case 109: /* function_prototype: function_declarator RIGHT_PAREN */ -#line 978 "MachineIndependent/glslang.y" +#line 981 "MachineIndependent/glslang.y" { (yyval.interm).function = (yyvsp[-1].interm.function); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 6217 "MachineIndependent/glslang_tab.cpp" +#line 6236 "MachineIndependent/glslang_tab.cpp" break; case 110: /* function_prototype: function_declarator RIGHT_PAREN attribute */ -#line 982 "MachineIndependent/glslang.y" +#line 985 "MachineIndependent/glslang.y" { (yyval.interm).function = (yyvsp[-2].interm.function); (yyval.interm).loc = (yyvsp[-1].lex).loc; parseContext.requireExtensions((yyvsp[-1].lex).loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[0].interm.attributes)); } -#line 6228 "MachineIndependent/glslang_tab.cpp" +#line 6247 "MachineIndependent/glslang_tab.cpp" break; case 111: /* function_prototype: attribute function_declarator RIGHT_PAREN */ -#line 988 "MachineIndependent/glslang.y" +#line 991 "MachineIndependent/glslang.y" { (yyval.interm).function = (yyvsp[-1].interm.function); (yyval.interm).loc = (yyvsp[0].lex).loc; parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.handleFunctionAttributes((yyvsp[0].lex).loc, *(yyvsp[-2].interm.attributes)); } -#line 6239 "MachineIndependent/glslang_tab.cpp" +#line 6258 "MachineIndependent/glslang_tab.cpp" break; case 112: /* function_prototype: attribute function_declarator RIGHT_PAREN attribute */ -#line 994 "MachineIndependent/glslang.y" +#line 997 "MachineIndependent/glslang.y" { (yyval.interm).function = (yyvsp[-2].interm.function); (yyval.interm).loc = (yyvsp[-1].lex).loc; @@ -6247,27 +6266,27 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[-3].interm.attributes)); parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[0].interm.attributes)); } -#line 6251 "MachineIndependent/glslang_tab.cpp" +#line 6270 "MachineIndependent/glslang_tab.cpp" break; case 113: /* function_declarator: function_header */ -#line 1004 "MachineIndependent/glslang.y" +#line 1007 "MachineIndependent/glslang.y" { (yyval.interm.function) = (yyvsp[0].interm.function); } -#line 6259 "MachineIndependent/glslang_tab.cpp" +#line 6278 "MachineIndependent/glslang_tab.cpp" break; case 114: /* function_declarator: function_header_with_parameters */ -#line 1007 "MachineIndependent/glslang.y" +#line 1010 "MachineIndependent/glslang.y" { (yyval.interm.function) = (yyvsp[0].interm.function); } -#line 6267 "MachineIndependent/glslang_tab.cpp" +#line 6286 "MachineIndependent/glslang_tab.cpp" break; case 115: /* function_header_with_parameters: function_header parameter_declaration */ -#line 1014 "MachineIndependent/glslang.y" +#line 1017 "MachineIndependent/glslang.y" { // Add the parameter (yyval.interm.function) = (yyvsp[-1].interm.function); @@ -6276,11 +6295,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); else delete (yyvsp[0].interm).param.type; } -#line 6280 "MachineIndependent/glslang_tab.cpp" +#line 6299 "MachineIndependent/glslang_tab.cpp" break; case 116: /* function_header_with_parameters: function_header_with_parameters COMMA parameter_declaration */ -#line 1022 "MachineIndependent/glslang.y" +#line 1025 "MachineIndependent/glslang.y" { // // Only first parameter of one-parameter functions can be void @@ -6298,11 +6317,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyvsp[-2].interm.function)->addParameter((yyvsp[0].interm).param); } } -#line 6302 "MachineIndependent/glslang_tab.cpp" +#line 6321 "MachineIndependent/glslang_tab.cpp" break; case 117: /* function_header: fully_specified_type IDENTIFIER LEFT_PAREN */ -#line 1042 "MachineIndependent/glslang.y" +#line 1045 "MachineIndependent/glslang.y" { if ((yyvsp[-2].interm.type).qualifier.storage != EvqGlobal && (yyvsp[-2].interm.type).qualifier.storage != EvqTemporary) { parseContext.error((yyvsp[-1].lex).loc, "no qualifiers allowed for function return", @@ -6322,11 +6341,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); function = new TFunction((yyvsp[-1].lex).string, type); (yyval.interm.function) = function; } -#line 6326 "MachineIndependent/glslang_tab.cpp" +#line 6345 "MachineIndependent/glslang_tab.cpp" break; case 118: /* parameter_declarator: type_specifier IDENTIFIER */ -#line 1065 "MachineIndependent/glslang.y" +#line 1068 "MachineIndependent/glslang.y" { if ((yyvsp[-1].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-1].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -6342,11 +6361,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).param = param; } -#line 6346 "MachineIndependent/glslang_tab.cpp" +#line 6365 "MachineIndependent/glslang_tab.cpp" break; case 119: /* parameter_declarator: type_specifier IDENTIFIER array_specifier */ -#line 1080 "MachineIndependent/glslang.y" +#line 1083 "MachineIndependent/glslang.y" { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -6366,123 +6385,123 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).param = param; } -#line 6370 "MachineIndependent/glslang_tab.cpp" +#line 6389 "MachineIndependent/glslang_tab.cpp" break; case 120: /* parameter_declaration: type_qualifier parameter_declarator */ -#line 1105 "MachineIndependent/glslang.y" +#line 1108 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) (yyval.interm).param.type->getQualifier().precision = (yyvsp[-1].interm.type).qualifier.precision; - parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); + parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier(), (yyval.interm).param.type->isCoopMat()); parseContext.checkNoShaderLayouts((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers); parseContext.parameterTypeCheck((yyvsp[0].interm).loc, (yyvsp[-1].interm.type).qualifier.storage, *(yyval.interm).param.type); parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); } -#line 6386 "MachineIndependent/glslang_tab.cpp" +#line 6405 "MachineIndependent/glslang_tab.cpp" break; case 121: /* parameter_declaration: parameter_declarator */ -#line 1116 "MachineIndependent/glslang.y" +#line 1119 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); parseContext.parameterTypeCheck((yyvsp[0].interm).loc, EvqIn, *(yyvsp[0].interm).param.type); parseContext.paramCheckFixStorage((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); - parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); + parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier(), (yyval.interm).param.type->isCoopMat()); } -#line 6398 "MachineIndependent/glslang_tab.cpp" +#line 6417 "MachineIndependent/glslang_tab.cpp" break; case 122: /* parameter_declaration: type_qualifier parameter_type_specifier */ -#line 1126 "MachineIndependent/glslang.y" +#line 1129 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) (yyval.interm).param.type->getQualifier().precision = (yyvsp[-1].interm.type).qualifier.precision; - parseContext.precisionQualifierCheck((yyvsp[-1].interm.type).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); + parseContext.precisionQualifierCheck((yyvsp[-1].interm.type).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier(), (yyval.interm).param.type->isCoopMat()); parseContext.checkNoShaderLayouts((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers); parseContext.parameterTypeCheck((yyvsp[0].interm).loc, (yyvsp[-1].interm.type).qualifier.storage, *(yyval.interm).param.type); parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); } -#line 6413 "MachineIndependent/glslang_tab.cpp" +#line 6432 "MachineIndependent/glslang_tab.cpp" break; case 123: /* parameter_declaration: parameter_type_specifier */ -#line 1136 "MachineIndependent/glslang.y" +#line 1139 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); parseContext.parameterTypeCheck((yyvsp[0].interm).loc, EvqIn, *(yyvsp[0].interm).param.type); parseContext.paramCheckFixStorage((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); - parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); + parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier(), (yyval.interm).param.type->isCoopMat()); } -#line 6425 "MachineIndependent/glslang_tab.cpp" +#line 6444 "MachineIndependent/glslang_tab.cpp" break; case 124: /* parameter_type_specifier: type_specifier */ -#line 1146 "MachineIndependent/glslang.y" +#line 1149 "MachineIndependent/glslang.y" { TParameter param = { 0, new TType((yyvsp[0].interm.type)) }; (yyval.interm).param = param; if ((yyvsp[0].interm.type).arraySizes) parseContext.arraySizeRequiredCheck((yyvsp[0].interm.type).loc, *(yyvsp[0].interm.type).arraySizes); } -#line 6436 "MachineIndependent/glslang_tab.cpp" +#line 6455 "MachineIndependent/glslang_tab.cpp" break; case 125: /* init_declarator_list: single_declaration */ -#line 1155 "MachineIndependent/glslang.y" +#line 1158 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[0].interm); } -#line 6444 "MachineIndependent/glslang_tab.cpp" +#line 6463 "MachineIndependent/glslang_tab.cpp" break; case 126: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER */ -#line 1158 "MachineIndependent/glslang.y" +#line 1161 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-2].interm); parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-2].interm).type); } -#line 6453 "MachineIndependent/glslang_tab.cpp" +#line 6472 "MachineIndependent/glslang_tab.cpp" break; case 127: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER array_specifier */ -#line 1162 "MachineIndependent/glslang.y" +#line 1165 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-3].interm); parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-3].interm).type, (yyvsp[0].interm).arraySizes); } -#line 6462 "MachineIndependent/glslang_tab.cpp" +#line 6481 "MachineIndependent/glslang_tab.cpp" break; case 128: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer */ -#line 1166 "MachineIndependent/glslang.y" +#line 1169 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-5].interm).type; TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-5].interm).type, (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-5].interm).intermNode, initNode, (yyvsp[-1].lex).loc); } -#line 6472 "MachineIndependent/glslang_tab.cpp" +#line 6491 "MachineIndependent/glslang_tab.cpp" break; case 129: /* init_declarator_list: init_declarator_list COMMA IDENTIFIER EQUAL initializer */ -#line 1171 "MachineIndependent/glslang.y" +#line 1174 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-4].interm).type; TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, 0, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-4].interm).intermNode, initNode, (yyvsp[-1].lex).loc); } -#line 6482 "MachineIndependent/glslang_tab.cpp" +#line 6501 "MachineIndependent/glslang_tab.cpp" break; case 130: /* single_declaration: fully_specified_type */ -#line 1179 "MachineIndependent/glslang.y" +#line 1182 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[0].interm.type); (yyval.interm).intermNode = 0; @@ -6490,51 +6509,51 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.declareTypeDefaults((yyval.interm).loc, (yyval.interm).type); } -#line 6494 "MachineIndependent/glslang_tab.cpp" +#line 6513 "MachineIndependent/glslang_tab.cpp" break; case 131: /* single_declaration: fully_specified_type IDENTIFIER */ -#line 1186 "MachineIndependent/glslang.y" +#line 1189 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-1].interm.type); (yyval.interm).intermNode = 0; parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-1].interm.type)); } -#line 6504 "MachineIndependent/glslang_tab.cpp" +#line 6523 "MachineIndependent/glslang_tab.cpp" break; case 132: /* single_declaration: fully_specified_type IDENTIFIER array_specifier */ -#line 1191 "MachineIndependent/glslang.y" +#line 1194 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-2].interm.type); (yyval.interm).intermNode = 0; parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-2].interm.type), (yyvsp[0].interm).arraySizes); } -#line 6514 "MachineIndependent/glslang_tab.cpp" +#line 6533 "MachineIndependent/glslang_tab.cpp" break; case 133: /* single_declaration: fully_specified_type IDENTIFIER array_specifier EQUAL initializer */ -#line 1196 "MachineIndependent/glslang.y" +#line 1199 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-4].interm.type); TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-4].interm.type), (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); } -#line 6524 "MachineIndependent/glslang_tab.cpp" +#line 6543 "MachineIndependent/glslang_tab.cpp" break; case 134: /* single_declaration: fully_specified_type IDENTIFIER EQUAL initializer */ -#line 1201 "MachineIndependent/glslang.y" +#line 1204 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-3].interm.type); TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); } -#line 6534 "MachineIndependent/glslang_tab.cpp" +#line 6553 "MachineIndependent/glslang_tab.cpp" break; case 135: /* fully_specified_type: type_specifier */ -#line 1210 "MachineIndependent/glslang.y" +#line 1213 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); @@ -6543,15 +6562,15 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.profileRequires((yyvsp[0].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires((yyvsp[0].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); } - parseContext.precisionQualifierCheck((yyval.interm.type).loc, (yyval.interm.type).basicType, (yyval.interm.type).qualifier); + parseContext.precisionQualifierCheck((yyval.interm.type).loc, (yyval.interm.type).basicType, (yyval.interm.type).qualifier, (yyval.interm.type).isCoopmat()); } -#line 6549 "MachineIndependent/glslang_tab.cpp" +#line 6568 "MachineIndependent/glslang_tab.cpp" break; case 136: /* fully_specified_type: type_qualifier type_specifier */ -#line 1220 "MachineIndependent/glslang.y" +#line 1223 "MachineIndependent/glslang.y" { - parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); + parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, false, &(yyvsp[0].interm.type)); parseContext.globalQualifierTypeCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, (yyvsp[0].interm.type)); if ((yyvsp[0].interm.type).arraySizes) { @@ -6565,7 +6584,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.checkNoShaderLayouts((yyvsp[0].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers); (yyvsp[0].interm.type).shaderQualifiers.merge((yyvsp[-1].interm.type).shaderQualifiers); parseContext.mergeQualifiers((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier, (yyvsp[-1].interm.type).qualifier, true); - parseContext.precisionQualifierCheck((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).basicType, (yyvsp[0].interm.type).qualifier); + parseContext.precisionQualifierCheck((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).basicType, (yyvsp[0].interm.type).qualifier, (yyvsp[0].interm.type).isCoopmat()); (yyval.interm.type) = (yyvsp[0].interm.type); @@ -6574,22 +6593,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (parseContext.language == EShLangFragment && (yyval.interm.type).qualifier.storage == EvqVaryingIn))) (yyval.interm.type).qualifier.smooth = true; } -#line 6578 "MachineIndependent/glslang_tab.cpp" +#line 6597 "MachineIndependent/glslang_tab.cpp" break; case 137: /* invariant_qualifier: INVARIANT */ -#line 1247 "MachineIndependent/glslang.y" +#line 1250 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "invariant"); parseContext.profileRequires((yyval.interm.type).loc, ENoProfile, 120, 0, "invariant"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.invariant = true; } -#line 6589 "MachineIndependent/glslang_tab.cpp" +#line 6608 "MachineIndependent/glslang_tab.cpp" break; case 138: /* interpolation_qualifier: SMOOTH */ -#line 1256 "MachineIndependent/glslang.y" +#line 1259 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "smooth"); parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "smooth"); @@ -6597,11 +6616,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.smooth = true; } -#line 6601 "MachineIndependent/glslang_tab.cpp" +#line 6620 "MachineIndependent/glslang_tab.cpp" break; case 139: /* interpolation_qualifier: FLAT */ -#line 1263 "MachineIndependent/glslang.y" +#line 1266 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "flat"); parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "flat"); @@ -6609,11 +6628,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.flat = true; } -#line 6613 "MachineIndependent/glslang_tab.cpp" +#line 6632 "MachineIndependent/glslang_tab.cpp" break; case 140: /* interpolation_qualifier: NOPERSPECTIVE */ -#line 1271 "MachineIndependent/glslang.y" +#line 1274 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "noperspective"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); @@ -6621,11 +6640,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.nopersp = true; } -#line 6625 "MachineIndependent/glslang_tab.cpp" +#line 6644 "MachineIndependent/glslang_tab.cpp" break; case 141: /* interpolation_qualifier: EXPLICITINTERPAMD */ -#line 1278 "MachineIndependent/glslang.y" +#line 1281 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "__explicitInterpAMD"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); @@ -6633,11 +6652,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.explicitInterp = true; } -#line 6637 "MachineIndependent/glslang_tab.cpp" +#line 6656 "MachineIndependent/glslang_tab.cpp" break; case 142: /* interpolation_qualifier: PERVERTEXNV */ -#line 1285 "MachineIndependent/glslang.y" +#line 1288 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "pervertexNV"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); @@ -6646,11 +6665,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.pervertexNV = true; } -#line 6650 "MachineIndependent/glslang_tab.cpp" +#line 6669 "MachineIndependent/glslang_tab.cpp" break; case 143: /* interpolation_qualifier: PERVERTEXEXT */ -#line 1293 "MachineIndependent/glslang.y" +#line 1296 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "pervertexEXT"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric"); @@ -6659,11 +6678,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.pervertexEXT = true; } -#line 6663 "MachineIndependent/glslang_tab.cpp" +#line 6682 "MachineIndependent/glslang_tab.cpp" break; case 144: /* interpolation_qualifier: PERPRIMITIVENV */ -#line 1301 "MachineIndependent/glslang.y" +#line 1304 "MachineIndependent/glslang.y" { // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "perprimitiveNV"); @@ -6674,11 +6693,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perPrimitiveNV = true; } -#line 6678 "MachineIndependent/glslang_tab.cpp" +#line 6697 "MachineIndependent/glslang_tab.cpp" break; case 145: /* interpolation_qualifier: PERPRIMITIVEEXT */ -#line 1311 "MachineIndependent/glslang.y" +#line 1314 "MachineIndependent/glslang.y" { // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "perprimitiveEXT"); @@ -6689,11 +6708,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perPrimitiveNV = true; } -#line 6693 "MachineIndependent/glslang_tab.cpp" +#line 6712 "MachineIndependent/glslang_tab.cpp" break; case 146: /* interpolation_qualifier: PERVIEWNV */ -#line 1321 "MachineIndependent/glslang.y" +#line 1324 "MachineIndependent/glslang.y" { // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "perviewNV"); @@ -6701,11 +6720,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perViewNV = true; } -#line 6705 "MachineIndependent/glslang_tab.cpp" +#line 6724 "MachineIndependent/glslang_tab.cpp" break; case 147: /* interpolation_qualifier: PERTASKNV */ -#line 1328 "MachineIndependent/glslang.y" +#line 1331 "MachineIndependent/glslang.y" { // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "taskNV"); @@ -6713,84 +6732,84 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perTaskNV = true; } -#line 6717 "MachineIndependent/glslang_tab.cpp" +#line 6736 "MachineIndependent/glslang_tab.cpp" break; case 148: /* layout_qualifier: LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN */ -#line 1339 "MachineIndependent/glslang.y" +#line 1342 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[-1].interm.type); } -#line 6725 "MachineIndependent/glslang_tab.cpp" +#line 6744 "MachineIndependent/glslang_tab.cpp" break; case 149: /* layout_qualifier_id_list: layout_qualifier_id */ -#line 1345 "MachineIndependent/glslang.y" +#line 1348 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6733 "MachineIndependent/glslang_tab.cpp" +#line 6752 "MachineIndependent/glslang_tab.cpp" break; case 150: /* layout_qualifier_id_list: layout_qualifier_id_list COMMA layout_qualifier_id */ -#line 1348 "MachineIndependent/glslang.y" +#line 1351 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[-2].interm.type); (yyval.interm.type).shaderQualifiers.merge((yyvsp[0].interm.type).shaderQualifiers); parseContext.mergeObjectLayoutQualifiers((yyval.interm.type).qualifier, (yyvsp[0].interm.type).qualifier, false); } -#line 6743 "MachineIndependent/glslang_tab.cpp" +#line 6762 "MachineIndependent/glslang_tab.cpp" break; case 151: /* layout_qualifier_id: IDENTIFIER */ -#line 1355 "MachineIndependent/glslang.y" +#line 1358 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), *(yyvsp[0].lex).string); } -#line 6752 "MachineIndependent/glslang_tab.cpp" +#line 6771 "MachineIndependent/glslang_tab.cpp" break; case 152: /* layout_qualifier_id: IDENTIFIER EQUAL constant_expression */ -#line 1359 "MachineIndependent/glslang.y" +#line 1362 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-2].lex).loc); parseContext.setLayoutQualifier((yyvsp[-2].lex).loc, (yyval.interm.type), *(yyvsp[-2].lex).string, (yyvsp[0].interm.intermTypedNode)); } -#line 6761 "MachineIndependent/glslang_tab.cpp" +#line 6780 "MachineIndependent/glslang_tab.cpp" break; case 153: /* layout_qualifier_id: SHARED */ -#line 1363 "MachineIndependent/glslang.y" +#line 1366 "MachineIndependent/glslang.y" { // because "shared" is both an identifier and a keyword (yyval.interm.type).init((yyvsp[0].lex).loc); TString strShared("shared"); parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), strShared); } -#line 6771 "MachineIndependent/glslang_tab.cpp" +#line 6790 "MachineIndependent/glslang_tab.cpp" break; case 154: /* precise_qualifier: PRECISE */ -#line 1372 "MachineIndependent/glslang.y" +#line 1375 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyval.interm.type).loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.noContraction = true; } -#line 6782 "MachineIndependent/glslang_tab.cpp" +#line 6801 "MachineIndependent/glslang_tab.cpp" break; case 155: /* type_qualifier: single_type_qualifier */ -#line 1382 "MachineIndependent/glslang.y" +#line 1385 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6790 "MachineIndependent/glslang_tab.cpp" +#line 6809 "MachineIndependent/glslang_tab.cpp" break; case 156: /* type_qualifier: type_qualifier single_type_qualifier */ -#line 1385 "MachineIndependent/glslang.y" +#line 1388 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[-1].interm.type); if ((yyval.interm.type).basicType == EbtVoid) @@ -6799,151 +6818,151 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).shaderQualifiers.merge((yyvsp[0].interm.type).shaderQualifiers); parseContext.mergeQualifiers((yyval.interm.type).loc, (yyval.interm.type).qualifier, (yyvsp[0].interm.type).qualifier, false); } -#line 6803 "MachineIndependent/glslang_tab.cpp" +#line 6822 "MachineIndependent/glslang_tab.cpp" break; case 157: /* single_type_qualifier: storage_qualifier */ -#line 1396 "MachineIndependent/glslang.y" +#line 1399 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6811 "MachineIndependent/glslang_tab.cpp" +#line 6830 "MachineIndependent/glslang_tab.cpp" break; case 158: /* single_type_qualifier: layout_qualifier */ -#line 1399 "MachineIndependent/glslang.y" +#line 1402 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6819 "MachineIndependent/glslang_tab.cpp" +#line 6838 "MachineIndependent/glslang_tab.cpp" break; case 159: /* single_type_qualifier: precision_qualifier */ -#line 1402 "MachineIndependent/glslang.y" +#line 1405 "MachineIndependent/glslang.y" { parseContext.checkPrecisionQualifier((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier.precision); (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6828 "MachineIndependent/glslang_tab.cpp" +#line 6847 "MachineIndependent/glslang_tab.cpp" break; case 160: /* single_type_qualifier: interpolation_qualifier */ -#line 1406 "MachineIndependent/glslang.y" +#line 1409 "MachineIndependent/glslang.y" { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6837 "MachineIndependent/glslang_tab.cpp" +#line 6856 "MachineIndependent/glslang_tab.cpp" break; case 161: /* single_type_qualifier: invariant_qualifier */ -#line 1410 "MachineIndependent/glslang.y" +#line 1413 "MachineIndependent/glslang.y" { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6846 "MachineIndependent/glslang_tab.cpp" +#line 6865 "MachineIndependent/glslang_tab.cpp" break; case 162: /* single_type_qualifier: precise_qualifier */ -#line 1415 "MachineIndependent/glslang.y" +#line 1418 "MachineIndependent/glslang.y" { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6855 "MachineIndependent/glslang_tab.cpp" +#line 6874 "MachineIndependent/glslang_tab.cpp" break; case 163: /* single_type_qualifier: non_uniform_qualifier */ -#line 1419 "MachineIndependent/glslang.y" +#line 1422 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6863 "MachineIndependent/glslang_tab.cpp" +#line 6882 "MachineIndependent/glslang_tab.cpp" break; case 164: /* single_type_qualifier: spirv_storage_class_qualifier */ -#line 1422 "MachineIndependent/glslang.y" +#line 1425 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].interm.type).loc, "spirv_storage_class"); parseContext.requireExtensions((yyvsp[0].interm.type).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V storage class qualifier"); (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6873 "MachineIndependent/glslang_tab.cpp" +#line 6892 "MachineIndependent/glslang_tab.cpp" break; case 165: /* single_type_qualifier: spirv_decorate_qualifier */ -#line 1427 "MachineIndependent/glslang.y" +#line 1430 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].interm.type).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V decorate qualifier"); (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 6882 "MachineIndependent/glslang_tab.cpp" +#line 6901 "MachineIndependent/glslang_tab.cpp" break; case 166: /* single_type_qualifier: SPIRV_BY_REFERENCE */ -#line 1431 "MachineIndependent/glslang.y" +#line 1434 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_reference"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.setSpirvByReference(); } -#line 6892 "MachineIndependent/glslang_tab.cpp" +#line 6911 "MachineIndependent/glslang_tab.cpp" break; case 167: /* single_type_qualifier: SPIRV_LITERAL */ -#line 1436 "MachineIndependent/glslang.y" +#line 1439 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_literal"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.setSpirvLiteral(); } -#line 6902 "MachineIndependent/glslang_tab.cpp" +#line 6921 "MachineIndependent/glslang_tab.cpp" break; case 168: /* storage_qualifier: CONST */ -#line 1445 "MachineIndependent/glslang.y" +#line 1448 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant } -#line 6911 "MachineIndependent/glslang_tab.cpp" +#line 6930 "MachineIndependent/glslang_tab.cpp" break; case 169: /* storage_qualifier: INOUT */ -#line 1449 "MachineIndependent/glslang.y" +#line 1452 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "inout"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqInOut; } -#line 6921 "MachineIndependent/glslang_tab.cpp" +#line 6940 "MachineIndependent/glslang_tab.cpp" break; case 170: /* storage_qualifier: IN */ -#line 1454 "MachineIndependent/glslang.y" +#line 1457 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "in"); (yyval.interm.type).init((yyvsp[0].lex).loc); // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later (yyval.interm.type).qualifier.storage = EvqIn; } -#line 6932 "MachineIndependent/glslang_tab.cpp" +#line 6951 "MachineIndependent/glslang_tab.cpp" break; case 171: /* storage_qualifier: OUT */ -#line 1460 "MachineIndependent/glslang.y" +#line 1463 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "out"); (yyval.interm.type).init((yyvsp[0].lex).loc); // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later (yyval.interm.type).qualifier.storage = EvqOut; } -#line 6943 "MachineIndependent/glslang_tab.cpp" +#line 6962 "MachineIndependent/glslang_tab.cpp" break; case 172: /* storage_qualifier: CENTROID */ -#line 1466 "MachineIndependent/glslang.y" +#line 1469 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 120, 0, "centroid"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "centroid"); @@ -6951,21 +6970,31 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.centroid = true; } -#line 6955 "MachineIndependent/glslang_tab.cpp" +#line 6974 "MachineIndependent/glslang_tab.cpp" break; case 173: /* storage_qualifier: UNIFORM */ -#line 1473 "MachineIndependent/glslang.y" +#line 1476 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "uniform"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqUniform; } -#line 6965 "MachineIndependent/glslang_tab.cpp" +#line 6984 "MachineIndependent/glslang_tab.cpp" + break; + + case 174: /* storage_qualifier: TILEIMAGEEXT */ +#line 1481 "MachineIndependent/glslang.y" + { + parseContext.globalCheck((yyvsp[0].lex).loc, "tileImageEXT"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqTileImageEXT; + } +#line 6994 "MachineIndependent/glslang_tab.cpp" break; - case 174: /* storage_qualifier: SHARED */ -#line 1478 "MachineIndependent/glslang.y" + case 175: /* storage_qualifier: SHARED */ +#line 1486 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "shared"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); @@ -6974,21 +7003,21 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqShared; } -#line 6978 "MachineIndependent/glslang_tab.cpp" +#line 7007 "MachineIndependent/glslang_tab.cpp" break; - case 175: /* storage_qualifier: BUFFER */ -#line 1486 "MachineIndependent/glslang.y" + case 176: /* storage_qualifier: BUFFER */ +#line 1494 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "buffer"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqBuffer; } -#line 6988 "MachineIndependent/glslang_tab.cpp" +#line 7017 "MachineIndependent/glslang_tab.cpp" break; - case 176: /* storage_qualifier: ATTRIBUTE */ -#line 1492 "MachineIndependent/glslang.y" + case 177: /* storage_qualifier: ATTRIBUTE */ +#line 1500 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangVertex, "attribute"); parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "attribute"); @@ -7001,11 +7030,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 7005 "MachineIndependent/glslang_tab.cpp" +#line 7034 "MachineIndependent/glslang_tab.cpp" break; - case 177: /* storage_qualifier: VARYING */ -#line 1504 "MachineIndependent/glslang.y" + case 178: /* storage_qualifier: VARYING */ +#line 1512 "MachineIndependent/glslang.y" { parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "varying"); parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "varying"); @@ -7020,32 +7049,32 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); else (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 7024 "MachineIndependent/glslang_tab.cpp" +#line 7053 "MachineIndependent/glslang_tab.cpp" break; - case 178: /* storage_qualifier: PATCH */ -#line 1518 "MachineIndependent/glslang.y" + case 179: /* storage_qualifier: PATCH */ +#line 1526 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "patch"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.patch = true; } -#line 7035 "MachineIndependent/glslang_tab.cpp" +#line 7064 "MachineIndependent/glslang_tab.cpp" break; - case 179: /* storage_qualifier: SAMPLE */ -#line 1524 "MachineIndependent/glslang.y" + case 180: /* storage_qualifier: SAMPLE */ +#line 1532 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "sample"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.sample = true; } -#line 7045 "MachineIndependent/glslang_tab.cpp" +#line 7074 "MachineIndependent/glslang_tab.cpp" break; - case 180: /* storage_qualifier: HITATTRNV */ -#line 1529 "MachineIndependent/glslang.y" + case 181: /* storage_qualifier: HITATTRNV */ +#line 1537 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "hitAttributeNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask @@ -7054,11 +7083,24 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqHitAttr; } -#line 7058 "MachineIndependent/glslang_tab.cpp" +#line 7087 "MachineIndependent/glslang_tab.cpp" break; - case 181: /* storage_qualifier: HITATTREXT */ -#line 1537 "MachineIndependent/glslang.y" + case 182: /* storage_qualifier: HITOBJECTATTRNV */ +#line 1545 "MachineIndependent/glslang.y" + { + parseContext.globalCheck((yyvsp[0].lex).loc, "hitAttributeNV"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask + | EShLangMissMask), "hitObjectAttributeNV"); + parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_shader_invocation_reorder, "hitObjectAttributeNV"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqHitObjectAttrNV; + } +#line 7100 "MachineIndependent/glslang_tab.cpp" + break; + + case 183: /* storage_qualifier: HITATTREXT */ +#line 1553 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "hitAttributeEXT"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask @@ -7067,11 +7109,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqHitAttr; } -#line 7071 "MachineIndependent/glslang_tab.cpp" +#line 7113 "MachineIndependent/glslang_tab.cpp" break; - case 182: /* storage_qualifier: PAYLOADNV */ -#line 1545 "MachineIndependent/glslang.y" + case 184: /* storage_qualifier: PAYLOADNV */ +#line 1561 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | @@ -7080,11 +7122,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqPayload; } -#line 7084 "MachineIndependent/glslang_tab.cpp" +#line 7126 "MachineIndependent/glslang_tab.cpp" break; - case 183: /* storage_qualifier: PAYLOADEXT */ -#line 1553 "MachineIndependent/glslang.y" + case 185: /* storage_qualifier: PAYLOADEXT */ +#line 1569 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadEXT"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | @@ -7093,11 +7135,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqPayload; } -#line 7097 "MachineIndependent/glslang_tab.cpp" +#line 7139 "MachineIndependent/glslang_tab.cpp" break; - case 184: /* storage_qualifier: PAYLOADINNV */ -#line 1561 "MachineIndependent/glslang.y" + case 186: /* storage_qualifier: PAYLOADINNV */ +#line 1577 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadInNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangClosestHitMask | @@ -7106,11 +7148,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqPayloadIn; } -#line 7110 "MachineIndependent/glslang_tab.cpp" +#line 7152 "MachineIndependent/glslang_tab.cpp" break; - case 185: /* storage_qualifier: PAYLOADINEXT */ -#line 1569 "MachineIndependent/glslang.y" + case 187: /* storage_qualifier: PAYLOADINEXT */ +#line 1585 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadInEXT"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangClosestHitMask | @@ -7119,11 +7161,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqPayloadIn; } -#line 7123 "MachineIndependent/glslang_tab.cpp" +#line 7165 "MachineIndependent/glslang_tab.cpp" break; - case 186: /* storage_qualifier: CALLDATANV */ -#line 1577 "MachineIndependent/glslang.y" + case 188: /* storage_qualifier: CALLDATANV */ +#line 1593 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | @@ -7132,11 +7174,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqCallableData; } -#line 7136 "MachineIndependent/glslang_tab.cpp" +#line 7178 "MachineIndependent/glslang_tab.cpp" break; - case 187: /* storage_qualifier: CALLDATAEXT */ -#line 1585 "MachineIndependent/glslang.y" + case 189: /* storage_qualifier: CALLDATAEXT */ +#line 1601 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataEXT"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenMask | @@ -7145,11 +7187,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqCallableData; } -#line 7149 "MachineIndependent/glslang_tab.cpp" +#line 7191 "MachineIndependent/glslang_tab.cpp" break; - case 188: /* storage_qualifier: CALLDATAINNV */ -#line 1593 "MachineIndependent/glslang.y" + case 190: /* storage_qualifier: CALLDATAINNV */ +#line 1609 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataInNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInNV"); @@ -7157,11 +7199,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqCallableDataIn; } -#line 7161 "MachineIndependent/glslang_tab.cpp" +#line 7203 "MachineIndependent/glslang_tab.cpp" break; - case 189: /* storage_qualifier: CALLDATAINEXT */ -#line 1600 "MachineIndependent/glslang.y" + case 191: /* storage_qualifier: CALLDATAINEXT */ +#line 1616 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataInEXT"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInEXT"); @@ -7169,138 +7211,138 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqCallableDataIn; } -#line 7173 "MachineIndependent/glslang_tab.cpp" +#line 7215 "MachineIndependent/glslang_tab.cpp" break; - case 190: /* storage_qualifier: COHERENT */ -#line 1607 "MachineIndependent/glslang.y" + case 192: /* storage_qualifier: COHERENT */ +#line 1623 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.coherent = true; } -#line 7182 "MachineIndependent/glslang_tab.cpp" +#line 7224 "MachineIndependent/glslang_tab.cpp" break; - case 191: /* storage_qualifier: DEVICECOHERENT */ -#line 1611 "MachineIndependent/glslang.y" + case 193: /* storage_qualifier: DEVICECOHERENT */ +#line 1627 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent"); (yyval.interm.type).qualifier.devicecoherent = true; } -#line 7192 "MachineIndependent/glslang_tab.cpp" +#line 7234 "MachineIndependent/glslang_tab.cpp" break; - case 192: /* storage_qualifier: QUEUEFAMILYCOHERENT */ -#line 1616 "MachineIndependent/glslang.y" + case 194: /* storage_qualifier: QUEUEFAMILYCOHERENT */ +#line 1632 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent"); (yyval.interm.type).qualifier.queuefamilycoherent = true; } -#line 7202 "MachineIndependent/glslang_tab.cpp" +#line 7244 "MachineIndependent/glslang_tab.cpp" break; - case 193: /* storage_qualifier: WORKGROUPCOHERENT */ -#line 1621 "MachineIndependent/glslang.y" + case 195: /* storage_qualifier: WORKGROUPCOHERENT */ +#line 1637 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent"); (yyval.interm.type).qualifier.workgroupcoherent = true; } -#line 7212 "MachineIndependent/glslang_tab.cpp" +#line 7254 "MachineIndependent/glslang_tab.cpp" break; - case 194: /* storage_qualifier: SUBGROUPCOHERENT */ -#line 1626 "MachineIndependent/glslang.y" + case 196: /* storage_qualifier: SUBGROUPCOHERENT */ +#line 1642 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent"); (yyval.interm.type).qualifier.subgroupcoherent = true; } -#line 7222 "MachineIndependent/glslang_tab.cpp" +#line 7264 "MachineIndependent/glslang_tab.cpp" break; - case 195: /* storage_qualifier: NONPRIVATE */ -#line 1631 "MachineIndependent/glslang.y" + case 197: /* storage_qualifier: NONPRIVATE */ +#line 1647 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate"); (yyval.interm.type).qualifier.nonprivate = true; } -#line 7232 "MachineIndependent/glslang_tab.cpp" +#line 7274 "MachineIndependent/glslang_tab.cpp" break; - case 196: /* storage_qualifier: SHADERCALLCOHERENT */ -#line 1636 "MachineIndependent/glslang.y" + case 198: /* storage_qualifier: SHADERCALLCOHERENT */ +#line 1652 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_ray_tracing, "shadercallcoherent"); (yyval.interm.type).qualifier.shadercallcoherent = true; } -#line 7242 "MachineIndependent/glslang_tab.cpp" +#line 7284 "MachineIndependent/glslang_tab.cpp" break; - case 197: /* storage_qualifier: VOLATILE */ -#line 1641 "MachineIndependent/glslang.y" + case 199: /* storage_qualifier: VOLATILE */ +#line 1657 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.volatil = true; } -#line 7251 "MachineIndependent/glslang_tab.cpp" +#line 7293 "MachineIndependent/glslang_tab.cpp" break; - case 198: /* storage_qualifier: RESTRICT */ -#line 1645 "MachineIndependent/glslang.y" + case 200: /* storage_qualifier: RESTRICT */ +#line 1661 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.restrict = true; } -#line 7260 "MachineIndependent/glslang_tab.cpp" +#line 7302 "MachineIndependent/glslang_tab.cpp" break; - case 199: /* storage_qualifier: READONLY */ -#line 1649 "MachineIndependent/glslang.y" + case 201: /* storage_qualifier: READONLY */ +#line 1665 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.readonly = true; } -#line 7269 "MachineIndependent/glslang_tab.cpp" +#line 7311 "MachineIndependent/glslang_tab.cpp" break; - case 200: /* storage_qualifier: WRITEONLY */ -#line 1653 "MachineIndependent/glslang.y" + case 202: /* storage_qualifier: WRITEONLY */ +#line 1669 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.writeonly = true; } -#line 7278 "MachineIndependent/glslang_tab.cpp" +#line 7320 "MachineIndependent/glslang_tab.cpp" break; - case 201: /* storage_qualifier: SUBROUTINE */ -#line 1657 "MachineIndependent/glslang.y" + case 203: /* storage_qualifier: SUBROUTINE */ +#line 1673 "MachineIndependent/glslang.y" { parseContext.spvRemoved((yyvsp[0].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[0].lex).loc, "subroutine"); parseContext.unimplemented((yyvsp[0].lex).loc, "subroutine"); (yyval.interm.type).init((yyvsp[0].lex).loc); } -#line 7289 "MachineIndependent/glslang_tab.cpp" +#line 7331 "MachineIndependent/glslang_tab.cpp" break; - case 202: /* storage_qualifier: SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN */ -#line 1663 "MachineIndependent/glslang.y" + case 204: /* storage_qualifier: SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN */ +#line 1679 "MachineIndependent/glslang.y" { parseContext.spvRemoved((yyvsp[-3].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[-3].lex).loc, "subroutine"); parseContext.unimplemented((yyvsp[-3].lex).loc, "subroutine"); (yyval.interm.type).init((yyvsp[-3].lex).loc); } -#line 7300 "MachineIndependent/glslang_tab.cpp" +#line 7342 "MachineIndependent/glslang_tab.cpp" break; - case 203: /* storage_qualifier: TASKPAYLOADWORKGROUPEXT */ -#line 1669 "MachineIndependent/glslang.y" + case 205: /* storage_qualifier: TASKPAYLOADWORKGROUPEXT */ +#line 1685 "MachineIndependent/glslang.y" { // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "taskPayloadSharedEXT"); @@ -7308,70 +7350,73 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqtaskPayloadSharedEXT; } -#line 7312 "MachineIndependent/glslang_tab.cpp" +#line 7354 "MachineIndependent/glslang_tab.cpp" break; - case 204: /* non_uniform_qualifier: NONUNIFORM */ -#line 1681 "MachineIndependent/glslang.y" + case 206: /* non_uniform_qualifier: NONUNIFORM */ +#line 1697 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.nonUniform = true; } -#line 7321 "MachineIndependent/glslang_tab.cpp" +#line 7363 "MachineIndependent/glslang_tab.cpp" break; - case 205: /* type_name_list: IDENTIFIER */ -#line 1688 "MachineIndependent/glslang.y" + case 207: /* type_name_list: IDENTIFIER */ +#line 1704 "MachineIndependent/glslang.y" { // TODO } -#line 7329 "MachineIndependent/glslang_tab.cpp" +#line 7371 "MachineIndependent/glslang_tab.cpp" break; - case 206: /* type_name_list: type_name_list COMMA IDENTIFIER */ -#line 1691 "MachineIndependent/glslang.y" + case 208: /* type_name_list: type_name_list COMMA IDENTIFIER */ +#line 1707 "MachineIndependent/glslang.y" { // TODO: 4.0 semantics: subroutines // 1) make sure each identifier is a type declared earlier with SUBROUTINE // 2) save all of the identifiers for future comparison with the declared function } -#line 7339 "MachineIndependent/glslang_tab.cpp" +#line 7381 "MachineIndependent/glslang_tab.cpp" break; - case 207: /* type_specifier: type_specifier_nonarray type_parameter_specifier_opt */ -#line 1700 "MachineIndependent/glslang.y" + case 209: /* type_specifier: type_specifier_nonarray type_parameter_specifier_opt */ +#line 1716 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[-1].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); (yyval.interm.type).typeParameters = (yyvsp[0].interm.typeParameters); + parseContext.coopMatTypeParametersCheck((yyvsp[-1].interm.type).loc, (yyval.interm.type)); + } -#line 7349 "MachineIndependent/glslang_tab.cpp" +#line 7393 "MachineIndependent/glslang_tab.cpp" break; - case 208: /* type_specifier: type_specifier_nonarray type_parameter_specifier_opt array_specifier */ -#line 1705 "MachineIndependent/glslang.y" + case 210: /* type_specifier: type_specifier_nonarray type_parameter_specifier_opt array_specifier */ +#line 1723 "MachineIndependent/glslang.y" { parseContext.arrayOfArrayVersionCheck((yyvsp[0].interm).loc, (yyvsp[0].interm).arraySizes); (yyval.interm.type) = (yyvsp[-2].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); (yyval.interm.type).typeParameters = (yyvsp[-1].interm.typeParameters); (yyval.interm.type).arraySizes = (yyvsp[0].interm).arraySizes; + parseContext.coopMatTypeParametersCheck((yyvsp[-2].interm.type).loc, (yyval.interm.type)); } -#line 7361 "MachineIndependent/glslang_tab.cpp" +#line 7406 "MachineIndependent/glslang_tab.cpp" break; - case 209: /* array_specifier: LEFT_BRACKET RIGHT_BRACKET */ -#line 1715 "MachineIndependent/glslang.y" + case 211: /* array_specifier: LEFT_BRACKET RIGHT_BRACKET */ +#line 1734 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).arraySizes = new TArraySizes; (yyval.interm).arraySizes->addInnerSize(); } -#line 7371 "MachineIndependent/glslang_tab.cpp" +#line 7416 "MachineIndependent/glslang_tab.cpp" break; - case 210: /* array_specifier: LEFT_BRACKET conditional_expression RIGHT_BRACKET */ -#line 1720 "MachineIndependent/glslang.y" + case 212: /* array_specifier: LEFT_BRACKET conditional_expression RIGHT_BRACKET */ +#line 1739 "MachineIndependent/glslang.y" { (yyval.interm).loc = (yyvsp[-2].lex).loc; (yyval.interm).arraySizes = new TArraySizes; @@ -7380,20 +7425,20 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size, "array size"); (yyval.interm).arraySizes->addInnerSize(size); } -#line 7384 "MachineIndependent/glslang_tab.cpp" +#line 7429 "MachineIndependent/glslang_tab.cpp" break; - case 211: /* array_specifier: array_specifier LEFT_BRACKET RIGHT_BRACKET */ -#line 1728 "MachineIndependent/glslang.y" + case 213: /* array_specifier: array_specifier LEFT_BRACKET RIGHT_BRACKET */ +#line 1747 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-2].interm); (yyval.interm).arraySizes->addInnerSize(); } -#line 7393 "MachineIndependent/glslang_tab.cpp" +#line 7438 "MachineIndependent/glslang_tab.cpp" break; - case 212: /* array_specifier: array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET */ -#line 1732 "MachineIndependent/glslang.y" + case 214: /* array_specifier: array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET */ +#line 1751 "MachineIndependent/glslang.y" { (yyval.interm) = (yyvsp[-3].interm); @@ -7401,348 +7446,359 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size, "array size"); (yyval.interm).arraySizes->addInnerSize(size); } -#line 7405 "MachineIndependent/glslang_tab.cpp" +#line 7450 "MachineIndependent/glslang_tab.cpp" break; - case 213: /* type_parameter_specifier_opt: type_parameter_specifier */ -#line 1742 "MachineIndependent/glslang.y" + case 215: /* type_parameter_specifier_opt: type_parameter_specifier */ +#line 1761 "MachineIndependent/glslang.y" { (yyval.interm.typeParameters) = (yyvsp[0].interm.typeParameters); } -#line 7413 "MachineIndependent/glslang_tab.cpp" +#line 7458 "MachineIndependent/glslang_tab.cpp" break; - case 214: /* type_parameter_specifier_opt: %empty */ -#line 1745 "MachineIndependent/glslang.y" + case 216: /* type_parameter_specifier_opt: %empty */ +#line 1764 "MachineIndependent/glslang.y" { (yyval.interm.typeParameters) = 0; } -#line 7421 "MachineIndependent/glslang_tab.cpp" +#line 7466 "MachineIndependent/glslang_tab.cpp" break; - case 215: /* type_parameter_specifier: LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE */ -#line 1751 "MachineIndependent/glslang.y" + case 217: /* type_parameter_specifier: LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE */ +#line 1770 "MachineIndependent/glslang.y" { (yyval.interm.typeParameters) = (yyvsp[-1].interm.typeParameters); } -#line 7429 "MachineIndependent/glslang_tab.cpp" +#line 7474 "MachineIndependent/glslang_tab.cpp" + break; + + case 218: /* type_parameter_specifier_list: type_specifier */ +#line 1776 "MachineIndependent/glslang.y" + { + (yyval.interm.typeParameters) = new TTypeParameters; + (yyval.interm.typeParameters)->arraySizes = new TArraySizes; + (yyval.interm.typeParameters)->basicType = (yyvsp[0].interm.type).basicType; + } +#line 7484 "MachineIndependent/glslang_tab.cpp" break; - case 216: /* type_parameter_specifier_list: unary_expression */ -#line 1757 "MachineIndependent/glslang.y" + case 219: /* type_parameter_specifier_list: unary_expression */ +#line 1781 "MachineIndependent/glslang.y" { - (yyval.interm.typeParameters) = new TArraySizes; + (yyval.interm.typeParameters) = new TTypeParameters; + (yyval.interm.typeParameters)->arraySizes = new TArraySizes; TArraySize size; - parseContext.arraySizeCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode), size, "type parameter"); - (yyval.interm.typeParameters)->addInnerSize(size); + parseContext.arraySizeCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode), size, "type parameter", true); + (yyval.interm.typeParameters)->arraySizes->addInnerSize(size); } -#line 7441 "MachineIndependent/glslang_tab.cpp" +#line 7497 "MachineIndependent/glslang_tab.cpp" break; - case 217: /* type_parameter_specifier_list: type_parameter_specifier_list COMMA unary_expression */ -#line 1764 "MachineIndependent/glslang.y" + case 220: /* type_parameter_specifier_list: type_parameter_specifier_list COMMA unary_expression */ +#line 1789 "MachineIndependent/glslang.y" { (yyval.interm.typeParameters) = (yyvsp[-2].interm.typeParameters); TArraySize size; - parseContext.arraySizeCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode), size, "type parameter"); - (yyval.interm.typeParameters)->addInnerSize(size); + parseContext.arraySizeCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode), size, "type parameter", true); + (yyval.interm.typeParameters)->arraySizes->addInnerSize(size); } -#line 7453 "MachineIndependent/glslang_tab.cpp" +#line 7509 "MachineIndependent/glslang_tab.cpp" break; - case 218: /* type_specifier_nonarray: VOID */ -#line 1774 "MachineIndependent/glslang.y" + case 221: /* type_specifier_nonarray: VOID */ +#line 1799 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtVoid; } -#line 7462 "MachineIndependent/glslang_tab.cpp" +#line 7518 "MachineIndependent/glslang_tab.cpp" break; - case 219: /* type_specifier_nonarray: FLOAT */ -#line 1778 "MachineIndependent/glslang.y" + case 222: /* type_specifier_nonarray: FLOAT */ +#line 1803 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; } -#line 7471 "MachineIndependent/glslang_tab.cpp" +#line 7527 "MachineIndependent/glslang_tab.cpp" break; - case 220: /* type_specifier_nonarray: INT */ -#line 1782 "MachineIndependent/glslang.y" + case 223: /* type_specifier_nonarray: INT */ +#line 1807 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; } -#line 7480 "MachineIndependent/glslang_tab.cpp" +#line 7536 "MachineIndependent/glslang_tab.cpp" break; - case 221: /* type_specifier_nonarray: UINT */ -#line 1786 "MachineIndependent/glslang.y" + case 224: /* type_specifier_nonarray: UINT */ +#line 1811 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; } -#line 7490 "MachineIndependent/glslang_tab.cpp" +#line 7546 "MachineIndependent/glslang_tab.cpp" break; - case 222: /* type_specifier_nonarray: BOOL */ -#line 1791 "MachineIndependent/glslang.y" + case 225: /* type_specifier_nonarray: BOOL */ +#line 1816 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; } -#line 7499 "MachineIndependent/glslang_tab.cpp" +#line 7555 "MachineIndependent/glslang_tab.cpp" break; - case 223: /* type_specifier_nonarray: VEC2 */ -#line 1795 "MachineIndependent/glslang.y" + case 226: /* type_specifier_nonarray: VEC2 */ +#line 1820 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(2); } -#line 7509 "MachineIndependent/glslang_tab.cpp" +#line 7565 "MachineIndependent/glslang_tab.cpp" break; - case 224: /* type_specifier_nonarray: VEC3 */ -#line 1800 "MachineIndependent/glslang.y" + case 227: /* type_specifier_nonarray: VEC3 */ +#line 1825 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(3); } -#line 7519 "MachineIndependent/glslang_tab.cpp" +#line 7575 "MachineIndependent/glslang_tab.cpp" break; - case 225: /* type_specifier_nonarray: VEC4 */ -#line 1805 "MachineIndependent/glslang.y" + case 228: /* type_specifier_nonarray: VEC4 */ +#line 1830 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(4); } -#line 7529 "MachineIndependent/glslang_tab.cpp" +#line 7585 "MachineIndependent/glslang_tab.cpp" break; - case 226: /* type_specifier_nonarray: BVEC2 */ -#line 1810 "MachineIndependent/glslang.y" + case 229: /* type_specifier_nonarray: BVEC2 */ +#line 1835 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; (yyval.interm.type).setVector(2); } -#line 7539 "MachineIndependent/glslang_tab.cpp" +#line 7595 "MachineIndependent/glslang_tab.cpp" break; - case 227: /* type_specifier_nonarray: BVEC3 */ -#line 1815 "MachineIndependent/glslang.y" + case 230: /* type_specifier_nonarray: BVEC3 */ +#line 1840 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; (yyval.interm.type).setVector(3); } -#line 7549 "MachineIndependent/glslang_tab.cpp" +#line 7605 "MachineIndependent/glslang_tab.cpp" break; - case 228: /* type_specifier_nonarray: BVEC4 */ -#line 1820 "MachineIndependent/glslang.y" + case 231: /* type_specifier_nonarray: BVEC4 */ +#line 1845 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; (yyval.interm.type).setVector(4); } -#line 7559 "MachineIndependent/glslang_tab.cpp" +#line 7615 "MachineIndependent/glslang_tab.cpp" break; - case 229: /* type_specifier_nonarray: IVEC2 */ -#line 1825 "MachineIndependent/glslang.y" + case 232: /* type_specifier_nonarray: IVEC2 */ +#line 1850 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(2); } -#line 7569 "MachineIndependent/glslang_tab.cpp" +#line 7625 "MachineIndependent/glslang_tab.cpp" break; - case 230: /* type_specifier_nonarray: IVEC3 */ -#line 1830 "MachineIndependent/glslang.y" + case 233: /* type_specifier_nonarray: IVEC3 */ +#line 1855 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(3); } -#line 7579 "MachineIndependent/glslang_tab.cpp" +#line 7635 "MachineIndependent/glslang_tab.cpp" break; - case 231: /* type_specifier_nonarray: IVEC4 */ -#line 1835 "MachineIndependent/glslang.y" + case 234: /* type_specifier_nonarray: IVEC4 */ +#line 1860 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(4); } -#line 7589 "MachineIndependent/glslang_tab.cpp" +#line 7645 "MachineIndependent/glslang_tab.cpp" break; - case 232: /* type_specifier_nonarray: UVEC2 */ -#line 1840 "MachineIndependent/glslang.y" + case 235: /* type_specifier_nonarray: UVEC2 */ +#line 1865 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; (yyval.interm.type).setVector(2); } -#line 7600 "MachineIndependent/glslang_tab.cpp" +#line 7656 "MachineIndependent/glslang_tab.cpp" break; - case 233: /* type_specifier_nonarray: UVEC3 */ -#line 1846 "MachineIndependent/glslang.y" + case 236: /* type_specifier_nonarray: UVEC3 */ +#line 1871 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; (yyval.interm.type).setVector(3); } -#line 7611 "MachineIndependent/glslang_tab.cpp" +#line 7667 "MachineIndependent/glslang_tab.cpp" break; - case 234: /* type_specifier_nonarray: UVEC4 */ -#line 1852 "MachineIndependent/glslang.y" + case 237: /* type_specifier_nonarray: UVEC4 */ +#line 1877 "MachineIndependent/glslang.y" { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; (yyval.interm.type).setVector(4); } -#line 7622 "MachineIndependent/glslang_tab.cpp" +#line 7678 "MachineIndependent/glslang_tab.cpp" break; - case 235: /* type_specifier_nonarray: MAT2 */ -#line 1858 "MachineIndependent/glslang.y" + case 238: /* type_specifier_nonarray: MAT2 */ +#line 1883 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 7632 "MachineIndependent/glslang_tab.cpp" +#line 7688 "MachineIndependent/glslang_tab.cpp" break; - case 236: /* type_specifier_nonarray: MAT3 */ -#line 1863 "MachineIndependent/glslang.y" + case 239: /* type_specifier_nonarray: MAT3 */ +#line 1888 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 7642 "MachineIndependent/glslang_tab.cpp" +#line 7698 "MachineIndependent/glslang_tab.cpp" break; - case 237: /* type_specifier_nonarray: MAT4 */ -#line 1868 "MachineIndependent/glslang.y" + case 240: /* type_specifier_nonarray: MAT4 */ +#line 1893 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 7652 "MachineIndependent/glslang_tab.cpp" +#line 7708 "MachineIndependent/glslang_tab.cpp" break; - case 238: /* type_specifier_nonarray: MAT2X2 */ -#line 1873 "MachineIndependent/glslang.y" + case 241: /* type_specifier_nonarray: MAT2X2 */ +#line 1898 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 7662 "MachineIndependent/glslang_tab.cpp" +#line 7718 "MachineIndependent/glslang_tab.cpp" break; - case 239: /* type_specifier_nonarray: MAT2X3 */ -#line 1878 "MachineIndependent/glslang.y" + case 242: /* type_specifier_nonarray: MAT2X3 */ +#line 1903 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 3); } -#line 7672 "MachineIndependent/glslang_tab.cpp" +#line 7728 "MachineIndependent/glslang_tab.cpp" break; - case 240: /* type_specifier_nonarray: MAT2X4 */ -#line 1883 "MachineIndependent/glslang.y" + case 243: /* type_specifier_nonarray: MAT2X4 */ +#line 1908 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 4); } -#line 7682 "MachineIndependent/glslang_tab.cpp" +#line 7738 "MachineIndependent/glslang_tab.cpp" break; - case 241: /* type_specifier_nonarray: MAT3X2 */ -#line 1888 "MachineIndependent/glslang.y" + case 244: /* type_specifier_nonarray: MAT3X2 */ +#line 1913 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 2); } -#line 7692 "MachineIndependent/glslang_tab.cpp" +#line 7748 "MachineIndependent/glslang_tab.cpp" break; - case 242: /* type_specifier_nonarray: MAT3X3 */ -#line 1893 "MachineIndependent/glslang.y" + case 245: /* type_specifier_nonarray: MAT3X3 */ +#line 1918 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 7702 "MachineIndependent/glslang_tab.cpp" +#line 7758 "MachineIndependent/glslang_tab.cpp" break; - case 243: /* type_specifier_nonarray: MAT3X4 */ -#line 1898 "MachineIndependent/glslang.y" + case 246: /* type_specifier_nonarray: MAT3X4 */ +#line 1923 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 4); } -#line 7712 "MachineIndependent/glslang_tab.cpp" +#line 7768 "MachineIndependent/glslang_tab.cpp" break; - case 244: /* type_specifier_nonarray: MAT4X2 */ -#line 1903 "MachineIndependent/glslang.y" + case 247: /* type_specifier_nonarray: MAT4X2 */ +#line 1928 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 2); } -#line 7722 "MachineIndependent/glslang_tab.cpp" +#line 7778 "MachineIndependent/glslang_tab.cpp" break; - case 245: /* type_specifier_nonarray: MAT4X3 */ -#line 1908 "MachineIndependent/glslang.y" + case 248: /* type_specifier_nonarray: MAT4X3 */ +#line 1933 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 3); } -#line 7732 "MachineIndependent/glslang_tab.cpp" +#line 7788 "MachineIndependent/glslang_tab.cpp" break; - case 246: /* type_specifier_nonarray: MAT4X4 */ -#line 1913 "MachineIndependent/glslang.y" + case 249: /* type_specifier_nonarray: MAT4X4 */ +#line 1938 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 7742 "MachineIndependent/glslang_tab.cpp" +#line 7798 "MachineIndependent/glslang_tab.cpp" break; - case 247: /* type_specifier_nonarray: DOUBLE */ -#line 1919 "MachineIndependent/glslang.y" + case 250: /* type_specifier_nonarray: DOUBLE */ +#line 1944 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -7750,121 +7806,121 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; } -#line 7754 "MachineIndependent/glslang_tab.cpp" +#line 7810 "MachineIndependent/glslang_tab.cpp" break; - case 248: /* type_specifier_nonarray: FLOAT16_T */ -#line 1926 "MachineIndependent/glslang.y" + case 251: /* type_specifier_nonarray: FLOAT16_T */ +#line 1951 "MachineIndependent/glslang.y" { parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "float16_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; } -#line 7764 "MachineIndependent/glslang_tab.cpp" +#line 7820 "MachineIndependent/glslang_tab.cpp" break; - case 249: /* type_specifier_nonarray: FLOAT32_T */ -#line 1931 "MachineIndependent/glslang.y" + case 252: /* type_specifier_nonarray: FLOAT32_T */ +#line 1956 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; } -#line 7774 "MachineIndependent/glslang_tab.cpp" +#line 7830 "MachineIndependent/glslang_tab.cpp" break; - case 250: /* type_specifier_nonarray: FLOAT64_T */ -#line 1936 "MachineIndependent/glslang.y" + case 253: /* type_specifier_nonarray: FLOAT64_T */ +#line 1961 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; } -#line 7784 "MachineIndependent/glslang_tab.cpp" +#line 7840 "MachineIndependent/glslang_tab.cpp" break; - case 251: /* type_specifier_nonarray: INT8_T */ -#line 1941 "MachineIndependent/glslang.y" + case 254: /* type_specifier_nonarray: INT8_T */ +#line 1966 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt8; } -#line 7794 "MachineIndependent/glslang_tab.cpp" +#line 7850 "MachineIndependent/glslang_tab.cpp" break; - case 252: /* type_specifier_nonarray: UINT8_T */ -#line 1946 "MachineIndependent/glslang.y" + case 255: /* type_specifier_nonarray: UINT8_T */ +#line 1971 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint8; } -#line 7804 "MachineIndependent/glslang_tab.cpp" +#line 7860 "MachineIndependent/glslang_tab.cpp" break; - case 253: /* type_specifier_nonarray: INT16_T */ -#line 1951 "MachineIndependent/glslang.y" + case 256: /* type_specifier_nonarray: INT16_T */ +#line 1976 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt16; } -#line 7814 "MachineIndependent/glslang_tab.cpp" +#line 7870 "MachineIndependent/glslang_tab.cpp" break; - case 254: /* type_specifier_nonarray: UINT16_T */ -#line 1956 "MachineIndependent/glslang.y" + case 257: /* type_specifier_nonarray: UINT16_T */ +#line 1981 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint16; } -#line 7824 "MachineIndependent/glslang_tab.cpp" +#line 7880 "MachineIndependent/glslang_tab.cpp" break; - case 255: /* type_specifier_nonarray: INT32_T */ -#line 1961 "MachineIndependent/glslang.y" + case 258: /* type_specifier_nonarray: INT32_T */ +#line 1986 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; } -#line 7834 "MachineIndependent/glslang_tab.cpp" +#line 7890 "MachineIndependent/glslang_tab.cpp" break; - case 256: /* type_specifier_nonarray: UINT32_T */ -#line 1966 "MachineIndependent/glslang.y" + case 259: /* type_specifier_nonarray: UINT32_T */ +#line 1991 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; } -#line 7844 "MachineIndependent/glslang_tab.cpp" +#line 7900 "MachineIndependent/glslang_tab.cpp" break; - case 257: /* type_specifier_nonarray: INT64_T */ -#line 1971 "MachineIndependent/glslang.y" + case 260: /* type_specifier_nonarray: INT64_T */ +#line 1996 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt64; } -#line 7854 "MachineIndependent/glslang_tab.cpp" +#line 7910 "MachineIndependent/glslang_tab.cpp" break; - case 258: /* type_specifier_nonarray: UINT64_T */ -#line 1976 "MachineIndependent/glslang.y" + case 261: /* type_specifier_nonarray: UINT64_T */ +#line 2001 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint64; } -#line 7864 "MachineIndependent/glslang_tab.cpp" +#line 7920 "MachineIndependent/glslang_tab.cpp" break; - case 259: /* type_specifier_nonarray: DVEC2 */ -#line 1981 "MachineIndependent/glslang.y" + case 262: /* type_specifier_nonarray: DVEC2 */ +#line 2006 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -7873,11 +7929,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(2); } -#line 7877 "MachineIndependent/glslang_tab.cpp" +#line 7933 "MachineIndependent/glslang_tab.cpp" break; - case 260: /* type_specifier_nonarray: DVEC3 */ -#line 1989 "MachineIndependent/glslang.y" + case 263: /* type_specifier_nonarray: DVEC3 */ +#line 2014 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -7886,11 +7942,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(3); } -#line 7890 "MachineIndependent/glslang_tab.cpp" +#line 7946 "MachineIndependent/glslang_tab.cpp" break; - case 261: /* type_specifier_nonarray: DVEC4 */ -#line 1997 "MachineIndependent/glslang.y" + case 264: /* type_specifier_nonarray: DVEC4 */ +#line 2022 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -7899,374 +7955,374 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(4); } -#line 7903 "MachineIndependent/glslang_tab.cpp" +#line 7959 "MachineIndependent/glslang_tab.cpp" break; - case 262: /* type_specifier_nonarray: F16VEC2 */ -#line 2005 "MachineIndependent/glslang.y" + case 265: /* type_specifier_nonarray: F16VEC2 */ +#line 2030 "MachineIndependent/glslang.y" { parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setVector(2); } -#line 7914 "MachineIndependent/glslang_tab.cpp" +#line 7970 "MachineIndependent/glslang_tab.cpp" break; - case 263: /* type_specifier_nonarray: F16VEC3 */ -#line 2011 "MachineIndependent/glslang.y" + case 266: /* type_specifier_nonarray: F16VEC3 */ +#line 2036 "MachineIndependent/glslang.y" { parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setVector(3); } -#line 7925 "MachineIndependent/glslang_tab.cpp" +#line 7981 "MachineIndependent/glslang_tab.cpp" break; - case 264: /* type_specifier_nonarray: F16VEC4 */ -#line 2017 "MachineIndependent/glslang.y" + case 267: /* type_specifier_nonarray: F16VEC4 */ +#line 2042 "MachineIndependent/glslang.y" { parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setVector(4); } -#line 7936 "MachineIndependent/glslang_tab.cpp" +#line 7992 "MachineIndependent/glslang_tab.cpp" break; - case 265: /* type_specifier_nonarray: F32VEC2 */ -#line 2023 "MachineIndependent/glslang.y" + case 268: /* type_specifier_nonarray: F32VEC2 */ +#line 2048 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(2); } -#line 7947 "MachineIndependent/glslang_tab.cpp" +#line 8003 "MachineIndependent/glslang_tab.cpp" break; - case 266: /* type_specifier_nonarray: F32VEC3 */ -#line 2029 "MachineIndependent/glslang.y" + case 269: /* type_specifier_nonarray: F32VEC3 */ +#line 2054 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(3); } -#line 7958 "MachineIndependent/glslang_tab.cpp" +#line 8014 "MachineIndependent/glslang_tab.cpp" break; - case 267: /* type_specifier_nonarray: F32VEC4 */ -#line 2035 "MachineIndependent/glslang.y" + case 270: /* type_specifier_nonarray: F32VEC4 */ +#line 2060 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(4); } -#line 7969 "MachineIndependent/glslang_tab.cpp" +#line 8025 "MachineIndependent/glslang_tab.cpp" break; - case 268: /* type_specifier_nonarray: F64VEC2 */ -#line 2041 "MachineIndependent/glslang.y" + case 271: /* type_specifier_nonarray: F64VEC2 */ +#line 2066 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(2); } -#line 7980 "MachineIndependent/glslang_tab.cpp" +#line 8036 "MachineIndependent/glslang_tab.cpp" break; - case 269: /* type_specifier_nonarray: F64VEC3 */ -#line 2047 "MachineIndependent/glslang.y" + case 272: /* type_specifier_nonarray: F64VEC3 */ +#line 2072 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(3); } -#line 7991 "MachineIndependent/glslang_tab.cpp" +#line 8047 "MachineIndependent/glslang_tab.cpp" break; - case 270: /* type_specifier_nonarray: F64VEC4 */ -#line 2053 "MachineIndependent/glslang.y" + case 273: /* type_specifier_nonarray: F64VEC4 */ +#line 2078 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(4); } -#line 8002 "MachineIndependent/glslang_tab.cpp" +#line 8058 "MachineIndependent/glslang_tab.cpp" break; - case 271: /* type_specifier_nonarray: I8VEC2 */ -#line 2059 "MachineIndependent/glslang.y" + case 274: /* type_specifier_nonarray: I8VEC2 */ +#line 2084 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt8; (yyval.interm.type).setVector(2); } -#line 8013 "MachineIndependent/glslang_tab.cpp" +#line 8069 "MachineIndependent/glslang_tab.cpp" break; - case 272: /* type_specifier_nonarray: I8VEC3 */ -#line 2065 "MachineIndependent/glslang.y" + case 275: /* type_specifier_nonarray: I8VEC3 */ +#line 2090 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt8; (yyval.interm.type).setVector(3); } -#line 8024 "MachineIndependent/glslang_tab.cpp" +#line 8080 "MachineIndependent/glslang_tab.cpp" break; - case 273: /* type_specifier_nonarray: I8VEC4 */ -#line 2071 "MachineIndependent/glslang.y" + case 276: /* type_specifier_nonarray: I8VEC4 */ +#line 2096 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt8; (yyval.interm.type).setVector(4); } -#line 8035 "MachineIndependent/glslang_tab.cpp" +#line 8091 "MachineIndependent/glslang_tab.cpp" break; - case 274: /* type_specifier_nonarray: I16VEC2 */ -#line 2077 "MachineIndependent/glslang.y" + case 277: /* type_specifier_nonarray: I16VEC2 */ +#line 2102 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt16; (yyval.interm.type).setVector(2); } -#line 8046 "MachineIndependent/glslang_tab.cpp" +#line 8102 "MachineIndependent/glslang_tab.cpp" break; - case 275: /* type_specifier_nonarray: I16VEC3 */ -#line 2083 "MachineIndependent/glslang.y" + case 278: /* type_specifier_nonarray: I16VEC3 */ +#line 2108 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt16; (yyval.interm.type).setVector(3); } -#line 8057 "MachineIndependent/glslang_tab.cpp" +#line 8113 "MachineIndependent/glslang_tab.cpp" break; - case 276: /* type_specifier_nonarray: I16VEC4 */ -#line 2089 "MachineIndependent/glslang.y" + case 279: /* type_specifier_nonarray: I16VEC4 */ +#line 2114 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt16; (yyval.interm.type).setVector(4); } -#line 8068 "MachineIndependent/glslang_tab.cpp" +#line 8124 "MachineIndependent/glslang_tab.cpp" break; - case 277: /* type_specifier_nonarray: I32VEC2 */ -#line 2095 "MachineIndependent/glslang.y" + case 280: /* type_specifier_nonarray: I32VEC2 */ +#line 2120 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(2); } -#line 8079 "MachineIndependent/glslang_tab.cpp" +#line 8135 "MachineIndependent/glslang_tab.cpp" break; - case 278: /* type_specifier_nonarray: I32VEC3 */ -#line 2101 "MachineIndependent/glslang.y" + case 281: /* type_specifier_nonarray: I32VEC3 */ +#line 2126 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(3); } -#line 8090 "MachineIndependent/glslang_tab.cpp" +#line 8146 "MachineIndependent/glslang_tab.cpp" break; - case 279: /* type_specifier_nonarray: I32VEC4 */ -#line 2107 "MachineIndependent/glslang.y" + case 282: /* type_specifier_nonarray: I32VEC4 */ +#line 2132 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(4); } -#line 8101 "MachineIndependent/glslang_tab.cpp" +#line 8157 "MachineIndependent/glslang_tab.cpp" break; - case 280: /* type_specifier_nonarray: I64VEC2 */ -#line 2113 "MachineIndependent/glslang.y" + case 283: /* type_specifier_nonarray: I64VEC2 */ +#line 2138 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt64; (yyval.interm.type).setVector(2); } -#line 8112 "MachineIndependent/glslang_tab.cpp" +#line 8168 "MachineIndependent/glslang_tab.cpp" break; - case 281: /* type_specifier_nonarray: I64VEC3 */ -#line 2119 "MachineIndependent/glslang.y" + case 284: /* type_specifier_nonarray: I64VEC3 */ +#line 2144 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt64; (yyval.interm.type).setVector(3); } -#line 8123 "MachineIndependent/glslang_tab.cpp" +#line 8179 "MachineIndependent/glslang_tab.cpp" break; - case 282: /* type_specifier_nonarray: I64VEC4 */ -#line 2125 "MachineIndependent/glslang.y" + case 285: /* type_specifier_nonarray: I64VEC4 */ +#line 2150 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt64; (yyval.interm.type).setVector(4); } -#line 8134 "MachineIndependent/glslang_tab.cpp" +#line 8190 "MachineIndependent/glslang_tab.cpp" break; - case 283: /* type_specifier_nonarray: U8VEC2 */ -#line 2131 "MachineIndependent/glslang.y" + case 286: /* type_specifier_nonarray: U8VEC2 */ +#line 2156 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint8; (yyval.interm.type).setVector(2); } -#line 8145 "MachineIndependent/glslang_tab.cpp" +#line 8201 "MachineIndependent/glslang_tab.cpp" break; - case 284: /* type_specifier_nonarray: U8VEC3 */ -#line 2137 "MachineIndependent/glslang.y" + case 287: /* type_specifier_nonarray: U8VEC3 */ +#line 2162 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint8; (yyval.interm.type).setVector(3); } -#line 8156 "MachineIndependent/glslang_tab.cpp" +#line 8212 "MachineIndependent/glslang_tab.cpp" break; - case 285: /* type_specifier_nonarray: U8VEC4 */ -#line 2143 "MachineIndependent/glslang.y" + case 288: /* type_specifier_nonarray: U8VEC4 */ +#line 2168 "MachineIndependent/glslang.y" { parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint8; (yyval.interm.type).setVector(4); } -#line 8167 "MachineIndependent/glslang_tab.cpp" +#line 8223 "MachineIndependent/glslang_tab.cpp" break; - case 286: /* type_specifier_nonarray: U16VEC2 */ -#line 2149 "MachineIndependent/glslang.y" + case 289: /* type_specifier_nonarray: U16VEC2 */ +#line 2174 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint16; (yyval.interm.type).setVector(2); } -#line 8178 "MachineIndependent/glslang_tab.cpp" +#line 8234 "MachineIndependent/glslang_tab.cpp" break; - case 287: /* type_specifier_nonarray: U16VEC3 */ -#line 2155 "MachineIndependent/glslang.y" + case 290: /* type_specifier_nonarray: U16VEC3 */ +#line 2180 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint16; (yyval.interm.type).setVector(3); } -#line 8189 "MachineIndependent/glslang_tab.cpp" +#line 8245 "MachineIndependent/glslang_tab.cpp" break; - case 288: /* type_specifier_nonarray: U16VEC4 */ -#line 2161 "MachineIndependent/glslang.y" + case 291: /* type_specifier_nonarray: U16VEC4 */ +#line 2186 "MachineIndependent/glslang.y" { parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint16; (yyval.interm.type).setVector(4); } -#line 8200 "MachineIndependent/glslang_tab.cpp" +#line 8256 "MachineIndependent/glslang_tab.cpp" break; - case 289: /* type_specifier_nonarray: U32VEC2 */ -#line 2167 "MachineIndependent/glslang.y" + case 292: /* type_specifier_nonarray: U32VEC2 */ +#line 2192 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; (yyval.interm.type).setVector(2); } -#line 8211 "MachineIndependent/glslang_tab.cpp" +#line 8267 "MachineIndependent/glslang_tab.cpp" break; - case 290: /* type_specifier_nonarray: U32VEC3 */ -#line 2173 "MachineIndependent/glslang.y" + case 293: /* type_specifier_nonarray: U32VEC3 */ +#line 2198 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; (yyval.interm.type).setVector(3); } -#line 8222 "MachineIndependent/glslang_tab.cpp" +#line 8278 "MachineIndependent/glslang_tab.cpp" break; - case 291: /* type_specifier_nonarray: U32VEC4 */ -#line 2179 "MachineIndependent/glslang.y" + case 294: /* type_specifier_nonarray: U32VEC4 */ +#line 2204 "MachineIndependent/glslang.y" { parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; (yyval.interm.type).setVector(4); } -#line 8233 "MachineIndependent/glslang_tab.cpp" +#line 8289 "MachineIndependent/glslang_tab.cpp" break; - case 292: /* type_specifier_nonarray: U64VEC2 */ -#line 2185 "MachineIndependent/glslang.y" + case 295: /* type_specifier_nonarray: U64VEC2 */ +#line 2210 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint64; (yyval.interm.type).setVector(2); } -#line 8244 "MachineIndependent/glslang_tab.cpp" +#line 8300 "MachineIndependent/glslang_tab.cpp" break; - case 293: /* type_specifier_nonarray: U64VEC3 */ -#line 2191 "MachineIndependent/glslang.y" + case 296: /* type_specifier_nonarray: U64VEC3 */ +#line 2216 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint64; (yyval.interm.type).setVector(3); } -#line 8255 "MachineIndependent/glslang_tab.cpp" +#line 8311 "MachineIndependent/glslang_tab.cpp" break; - case 294: /* type_specifier_nonarray: U64VEC4 */ -#line 2197 "MachineIndependent/glslang.y" + case 297: /* type_specifier_nonarray: U64VEC4 */ +#line 2222 "MachineIndependent/glslang.y" { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint64; (yyval.interm.type).setVector(4); } -#line 8266 "MachineIndependent/glslang_tab.cpp" +#line 8322 "MachineIndependent/glslang_tab.cpp" break; - case 295: /* type_specifier_nonarray: DMAT2 */ -#line 2203 "MachineIndependent/glslang.y" + case 298: /* type_specifier_nonarray: DMAT2 */ +#line 2228 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8275,11 +8331,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 8279 "MachineIndependent/glslang_tab.cpp" +#line 8335 "MachineIndependent/glslang_tab.cpp" break; - case 296: /* type_specifier_nonarray: DMAT3 */ -#line 2211 "MachineIndependent/glslang.y" + case 299: /* type_specifier_nonarray: DMAT3 */ +#line 2236 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8288,11 +8344,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 8292 "MachineIndependent/glslang_tab.cpp" +#line 8348 "MachineIndependent/glslang_tab.cpp" break; - case 297: /* type_specifier_nonarray: DMAT4 */ -#line 2219 "MachineIndependent/glslang.y" + case 300: /* type_specifier_nonarray: DMAT4 */ +#line 2244 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8301,11 +8357,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 8305 "MachineIndependent/glslang_tab.cpp" +#line 8361 "MachineIndependent/glslang_tab.cpp" break; - case 298: /* type_specifier_nonarray: DMAT2X2 */ -#line 2227 "MachineIndependent/glslang.y" + case 301: /* type_specifier_nonarray: DMAT2X2 */ +#line 2252 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8314,11 +8370,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 8318 "MachineIndependent/glslang_tab.cpp" +#line 8374 "MachineIndependent/glslang_tab.cpp" break; - case 299: /* type_specifier_nonarray: DMAT2X3 */ -#line 2235 "MachineIndependent/glslang.y" + case 302: /* type_specifier_nonarray: DMAT2X3 */ +#line 2260 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8327,11 +8383,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 3); } -#line 8331 "MachineIndependent/glslang_tab.cpp" +#line 8387 "MachineIndependent/glslang_tab.cpp" break; - case 300: /* type_specifier_nonarray: DMAT2X4 */ -#line 2243 "MachineIndependent/glslang.y" + case 303: /* type_specifier_nonarray: DMAT2X4 */ +#line 2268 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8340,11 +8396,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 4); } -#line 8344 "MachineIndependent/glslang_tab.cpp" +#line 8400 "MachineIndependent/glslang_tab.cpp" break; - case 301: /* type_specifier_nonarray: DMAT3X2 */ -#line 2251 "MachineIndependent/glslang.y" + case 304: /* type_specifier_nonarray: DMAT3X2 */ +#line 2276 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8353,11 +8409,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 2); } -#line 8357 "MachineIndependent/glslang_tab.cpp" +#line 8413 "MachineIndependent/glslang_tab.cpp" break; - case 302: /* type_specifier_nonarray: DMAT3X3 */ -#line 2259 "MachineIndependent/glslang.y" + case 305: /* type_specifier_nonarray: DMAT3X3 */ +#line 2284 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8366,11 +8422,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 8370 "MachineIndependent/glslang_tab.cpp" +#line 8426 "MachineIndependent/glslang_tab.cpp" break; - case 303: /* type_specifier_nonarray: DMAT3X4 */ -#line 2267 "MachineIndependent/glslang.y" + case 306: /* type_specifier_nonarray: DMAT3X4 */ +#line 2292 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8379,11 +8435,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 4); } -#line 8383 "MachineIndependent/glslang_tab.cpp" +#line 8439 "MachineIndependent/glslang_tab.cpp" break; - case 304: /* type_specifier_nonarray: DMAT4X2 */ -#line 2275 "MachineIndependent/glslang.y" + case 307: /* type_specifier_nonarray: DMAT4X2 */ +#line 2300 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8392,11 +8448,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 2); } -#line 8396 "MachineIndependent/glslang_tab.cpp" +#line 8452 "MachineIndependent/glslang_tab.cpp" break; - case 305: /* type_specifier_nonarray: DMAT4X3 */ -#line 2283 "MachineIndependent/glslang.y" + case 308: /* type_specifier_nonarray: DMAT4X3 */ +#line 2308 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8405,11 +8461,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 3); } -#line 8409 "MachineIndependent/glslang_tab.cpp" +#line 8465 "MachineIndependent/glslang_tab.cpp" break; - case 306: /* type_specifier_nonarray: DMAT4X4 */ -#line 2291 "MachineIndependent/glslang.y" + case 309: /* type_specifier_nonarray: DMAT4X4 */ +#line 2316 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); if (! parseContext.symbolTable.atBuiltInLevel()) @@ -8418,2228 +8474,2261 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 8422 "MachineIndependent/glslang_tab.cpp" +#line 8478 "MachineIndependent/glslang_tab.cpp" break; - case 307: /* type_specifier_nonarray: F16MAT2 */ -#line 2299 "MachineIndependent/glslang.y" + case 310: /* type_specifier_nonarray: F16MAT2 */ +#line 2324 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 2); } -#line 8433 "MachineIndependent/glslang_tab.cpp" +#line 8489 "MachineIndependent/glslang_tab.cpp" break; - case 308: /* type_specifier_nonarray: F16MAT3 */ -#line 2305 "MachineIndependent/glslang.y" + case 311: /* type_specifier_nonarray: F16MAT3 */ +#line 2330 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 3); } -#line 8444 "MachineIndependent/glslang_tab.cpp" +#line 8500 "MachineIndependent/glslang_tab.cpp" break; - case 309: /* type_specifier_nonarray: F16MAT4 */ -#line 2311 "MachineIndependent/glslang.y" + case 312: /* type_specifier_nonarray: F16MAT4 */ +#line 2336 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 4); } -#line 8455 "MachineIndependent/glslang_tab.cpp" +#line 8511 "MachineIndependent/glslang_tab.cpp" break; - case 310: /* type_specifier_nonarray: F16MAT2X2 */ -#line 2317 "MachineIndependent/glslang.y" + case 313: /* type_specifier_nonarray: F16MAT2X2 */ +#line 2342 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 2); } -#line 8466 "MachineIndependent/glslang_tab.cpp" +#line 8522 "MachineIndependent/glslang_tab.cpp" break; - case 311: /* type_specifier_nonarray: F16MAT2X3 */ -#line 2323 "MachineIndependent/glslang.y" + case 314: /* type_specifier_nonarray: F16MAT2X3 */ +#line 2348 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 3); } -#line 8477 "MachineIndependent/glslang_tab.cpp" +#line 8533 "MachineIndependent/glslang_tab.cpp" break; - case 312: /* type_specifier_nonarray: F16MAT2X4 */ -#line 2329 "MachineIndependent/glslang.y" + case 315: /* type_specifier_nonarray: F16MAT2X4 */ +#line 2354 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 4); } -#line 8488 "MachineIndependent/glslang_tab.cpp" +#line 8544 "MachineIndependent/glslang_tab.cpp" break; - case 313: /* type_specifier_nonarray: F16MAT3X2 */ -#line 2335 "MachineIndependent/glslang.y" + case 316: /* type_specifier_nonarray: F16MAT3X2 */ +#line 2360 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 2); } -#line 8499 "MachineIndependent/glslang_tab.cpp" +#line 8555 "MachineIndependent/glslang_tab.cpp" break; - case 314: /* type_specifier_nonarray: F16MAT3X3 */ -#line 2341 "MachineIndependent/glslang.y" + case 317: /* type_specifier_nonarray: F16MAT3X3 */ +#line 2366 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 3); } -#line 8510 "MachineIndependent/glslang_tab.cpp" +#line 8566 "MachineIndependent/glslang_tab.cpp" break; - case 315: /* type_specifier_nonarray: F16MAT3X4 */ -#line 2347 "MachineIndependent/glslang.y" + case 318: /* type_specifier_nonarray: F16MAT3X4 */ +#line 2372 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 4); } -#line 8521 "MachineIndependent/glslang_tab.cpp" +#line 8577 "MachineIndependent/glslang_tab.cpp" break; - case 316: /* type_specifier_nonarray: F16MAT4X2 */ -#line 2353 "MachineIndependent/glslang.y" + case 319: /* type_specifier_nonarray: F16MAT4X2 */ +#line 2378 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 2); } -#line 8532 "MachineIndependent/glslang_tab.cpp" +#line 8588 "MachineIndependent/glslang_tab.cpp" break; - case 317: /* type_specifier_nonarray: F16MAT4X3 */ -#line 2359 "MachineIndependent/glslang.y" + case 320: /* type_specifier_nonarray: F16MAT4X3 */ +#line 2384 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 3); } -#line 8543 "MachineIndependent/glslang_tab.cpp" +#line 8599 "MachineIndependent/glslang_tab.cpp" break; - case 318: /* type_specifier_nonarray: F16MAT4X4 */ -#line 2365 "MachineIndependent/glslang.y" + case 321: /* type_specifier_nonarray: F16MAT4X4 */ +#line 2390 "MachineIndependent/glslang.y" { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 4); } -#line 8554 "MachineIndependent/glslang_tab.cpp" +#line 8610 "MachineIndependent/glslang_tab.cpp" break; - case 319: /* type_specifier_nonarray: F32MAT2 */ -#line 2371 "MachineIndependent/glslang.y" + case 322: /* type_specifier_nonarray: F32MAT2 */ +#line 2396 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 8565 "MachineIndependent/glslang_tab.cpp" +#line 8621 "MachineIndependent/glslang_tab.cpp" break; - case 320: /* type_specifier_nonarray: F32MAT3 */ -#line 2377 "MachineIndependent/glslang.y" + case 323: /* type_specifier_nonarray: F32MAT3 */ +#line 2402 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 8576 "MachineIndependent/glslang_tab.cpp" +#line 8632 "MachineIndependent/glslang_tab.cpp" break; - case 321: /* type_specifier_nonarray: F32MAT4 */ -#line 2383 "MachineIndependent/glslang.y" + case 324: /* type_specifier_nonarray: F32MAT4 */ +#line 2408 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 8587 "MachineIndependent/glslang_tab.cpp" +#line 8643 "MachineIndependent/glslang_tab.cpp" break; - case 322: /* type_specifier_nonarray: F32MAT2X2 */ -#line 2389 "MachineIndependent/glslang.y" + case 325: /* type_specifier_nonarray: F32MAT2X2 */ +#line 2414 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 8598 "MachineIndependent/glslang_tab.cpp" +#line 8654 "MachineIndependent/glslang_tab.cpp" break; - case 323: /* type_specifier_nonarray: F32MAT2X3 */ -#line 2395 "MachineIndependent/glslang.y" + case 326: /* type_specifier_nonarray: F32MAT2X3 */ +#line 2420 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 3); } -#line 8609 "MachineIndependent/glslang_tab.cpp" +#line 8665 "MachineIndependent/glslang_tab.cpp" break; - case 324: /* type_specifier_nonarray: F32MAT2X4 */ -#line 2401 "MachineIndependent/glslang.y" + case 327: /* type_specifier_nonarray: F32MAT2X4 */ +#line 2426 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 4); } -#line 8620 "MachineIndependent/glslang_tab.cpp" +#line 8676 "MachineIndependent/glslang_tab.cpp" break; - case 325: /* type_specifier_nonarray: F32MAT3X2 */ -#line 2407 "MachineIndependent/glslang.y" + case 328: /* type_specifier_nonarray: F32MAT3X2 */ +#line 2432 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 2); } -#line 8631 "MachineIndependent/glslang_tab.cpp" +#line 8687 "MachineIndependent/glslang_tab.cpp" break; - case 326: /* type_specifier_nonarray: F32MAT3X3 */ -#line 2413 "MachineIndependent/glslang.y" + case 329: /* type_specifier_nonarray: F32MAT3X3 */ +#line 2438 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 8642 "MachineIndependent/glslang_tab.cpp" +#line 8698 "MachineIndependent/glslang_tab.cpp" break; - case 327: /* type_specifier_nonarray: F32MAT3X4 */ -#line 2419 "MachineIndependent/glslang.y" + case 330: /* type_specifier_nonarray: F32MAT3X4 */ +#line 2444 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 4); } -#line 8653 "MachineIndependent/glslang_tab.cpp" +#line 8709 "MachineIndependent/glslang_tab.cpp" break; - case 328: /* type_specifier_nonarray: F32MAT4X2 */ -#line 2425 "MachineIndependent/glslang.y" + case 331: /* type_specifier_nonarray: F32MAT4X2 */ +#line 2450 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 2); } -#line 8664 "MachineIndependent/glslang_tab.cpp" +#line 8720 "MachineIndependent/glslang_tab.cpp" break; - case 329: /* type_specifier_nonarray: F32MAT4X3 */ -#line 2431 "MachineIndependent/glslang.y" + case 332: /* type_specifier_nonarray: F32MAT4X3 */ +#line 2456 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 3); } -#line 8675 "MachineIndependent/glslang_tab.cpp" +#line 8731 "MachineIndependent/glslang_tab.cpp" break; - case 330: /* type_specifier_nonarray: F32MAT4X4 */ -#line 2437 "MachineIndependent/glslang.y" + case 333: /* type_specifier_nonarray: F32MAT4X4 */ +#line 2462 "MachineIndependent/glslang.y" { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 8686 "MachineIndependent/glslang_tab.cpp" +#line 8742 "MachineIndependent/glslang_tab.cpp" break; - case 331: /* type_specifier_nonarray: F64MAT2 */ -#line 2443 "MachineIndependent/glslang.y" + case 334: /* type_specifier_nonarray: F64MAT2 */ +#line 2468 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 8697 "MachineIndependent/glslang_tab.cpp" +#line 8753 "MachineIndependent/glslang_tab.cpp" break; - case 332: /* type_specifier_nonarray: F64MAT3 */ -#line 2449 "MachineIndependent/glslang.y" + case 335: /* type_specifier_nonarray: F64MAT3 */ +#line 2474 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 8708 "MachineIndependent/glslang_tab.cpp" +#line 8764 "MachineIndependent/glslang_tab.cpp" break; - case 333: /* type_specifier_nonarray: F64MAT4 */ -#line 2455 "MachineIndependent/glslang.y" + case 336: /* type_specifier_nonarray: F64MAT4 */ +#line 2480 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 8719 "MachineIndependent/glslang_tab.cpp" +#line 8775 "MachineIndependent/glslang_tab.cpp" break; - case 334: /* type_specifier_nonarray: F64MAT2X2 */ -#line 2461 "MachineIndependent/glslang.y" + case 337: /* type_specifier_nonarray: F64MAT2X2 */ +#line 2486 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 8730 "MachineIndependent/glslang_tab.cpp" +#line 8786 "MachineIndependent/glslang_tab.cpp" break; - case 335: /* type_specifier_nonarray: F64MAT2X3 */ -#line 2467 "MachineIndependent/glslang.y" + case 338: /* type_specifier_nonarray: F64MAT2X3 */ +#line 2492 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 3); } -#line 8741 "MachineIndependent/glslang_tab.cpp" +#line 8797 "MachineIndependent/glslang_tab.cpp" break; - case 336: /* type_specifier_nonarray: F64MAT2X4 */ -#line 2473 "MachineIndependent/glslang.y" + case 339: /* type_specifier_nonarray: F64MAT2X4 */ +#line 2498 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 4); } -#line 8752 "MachineIndependent/glslang_tab.cpp" +#line 8808 "MachineIndependent/glslang_tab.cpp" break; - case 337: /* type_specifier_nonarray: F64MAT3X2 */ -#line 2479 "MachineIndependent/glslang.y" + case 340: /* type_specifier_nonarray: F64MAT3X2 */ +#line 2504 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 2); } -#line 8763 "MachineIndependent/glslang_tab.cpp" +#line 8819 "MachineIndependent/glslang_tab.cpp" break; - case 338: /* type_specifier_nonarray: F64MAT3X3 */ -#line 2485 "MachineIndependent/glslang.y" + case 341: /* type_specifier_nonarray: F64MAT3X3 */ +#line 2510 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 8774 "MachineIndependent/glslang_tab.cpp" +#line 8830 "MachineIndependent/glslang_tab.cpp" break; - case 339: /* type_specifier_nonarray: F64MAT3X4 */ -#line 2491 "MachineIndependent/glslang.y" + case 342: /* type_specifier_nonarray: F64MAT3X4 */ +#line 2516 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 4); } -#line 8785 "MachineIndependent/glslang_tab.cpp" +#line 8841 "MachineIndependent/glslang_tab.cpp" break; - case 340: /* type_specifier_nonarray: F64MAT4X2 */ -#line 2497 "MachineIndependent/glslang.y" + case 343: /* type_specifier_nonarray: F64MAT4X2 */ +#line 2522 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 2); } -#line 8796 "MachineIndependent/glslang_tab.cpp" +#line 8852 "MachineIndependent/glslang_tab.cpp" break; - case 341: /* type_specifier_nonarray: F64MAT4X3 */ -#line 2503 "MachineIndependent/glslang.y" + case 344: /* type_specifier_nonarray: F64MAT4X3 */ +#line 2528 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 3); } -#line 8807 "MachineIndependent/glslang_tab.cpp" +#line 8863 "MachineIndependent/glslang_tab.cpp" break; - case 342: /* type_specifier_nonarray: F64MAT4X4 */ -#line 2509 "MachineIndependent/glslang.y" + case 345: /* type_specifier_nonarray: F64MAT4X4 */ +#line 2534 "MachineIndependent/glslang.y" { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 8818 "MachineIndependent/glslang_tab.cpp" +#line 8874 "MachineIndependent/glslang_tab.cpp" break; - case 343: /* type_specifier_nonarray: ACCSTRUCTNV */ -#line 2515 "MachineIndependent/glslang.y" + case 346: /* type_specifier_nonarray: ACCSTRUCTNV */ +#line 2540 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtAccStruct; } -#line 8827 "MachineIndependent/glslang_tab.cpp" +#line 8883 "MachineIndependent/glslang_tab.cpp" break; - case 344: /* type_specifier_nonarray: ACCSTRUCTEXT */ -#line 2519 "MachineIndependent/glslang.y" + case 347: /* type_specifier_nonarray: ACCSTRUCTEXT */ +#line 2544 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtAccStruct; } -#line 8836 "MachineIndependent/glslang_tab.cpp" +#line 8892 "MachineIndependent/glslang_tab.cpp" break; - case 345: /* type_specifier_nonarray: RAYQUERYEXT */ -#line 2523 "MachineIndependent/glslang.y" + case 348: /* type_specifier_nonarray: RAYQUERYEXT */ +#line 2548 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtRayQuery; } -#line 8845 "MachineIndependent/glslang_tab.cpp" +#line 8901 "MachineIndependent/glslang_tab.cpp" break; - case 346: /* type_specifier_nonarray: ATOMIC_UINT */ -#line 2527 "MachineIndependent/glslang.y" + case 349: /* type_specifier_nonarray: ATOMIC_UINT */ +#line 2552 "MachineIndependent/glslang.y" { parseContext.vulkanRemoved((yyvsp[0].lex).loc, "atomic counter types"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtAtomicUint; } -#line 8855 "MachineIndependent/glslang_tab.cpp" +#line 8911 "MachineIndependent/glslang_tab.cpp" break; - case 347: /* type_specifier_nonarray: SAMPLER1D */ -#line 2532 "MachineIndependent/glslang.y" + case 350: /* type_specifier_nonarray: SAMPLER1D */ +#line 2557 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D); } -#line 8865 "MachineIndependent/glslang_tab.cpp" +#line 8921 "MachineIndependent/glslang_tab.cpp" break; - case 348: /* type_specifier_nonarray: SAMPLER2D */ -#line 2538 "MachineIndependent/glslang.y" + case 351: /* type_specifier_nonarray: SAMPLER2D */ +#line 2563 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); } -#line 8875 "MachineIndependent/glslang_tab.cpp" +#line 8931 "MachineIndependent/glslang_tab.cpp" break; - case 349: /* type_specifier_nonarray: SAMPLER3D */ -#line 2543 "MachineIndependent/glslang.y" + case 352: /* type_specifier_nonarray: SAMPLER3D */ +#line 2568 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd3D); } -#line 8885 "MachineIndependent/glslang_tab.cpp" +#line 8941 "MachineIndependent/glslang_tab.cpp" break; - case 350: /* type_specifier_nonarray: SAMPLERCUBE */ -#line 2548 "MachineIndependent/glslang.y" + case 353: /* type_specifier_nonarray: SAMPLERCUBE */ +#line 2573 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube); } -#line 8895 "MachineIndependent/glslang_tab.cpp" +#line 8951 "MachineIndependent/glslang_tab.cpp" break; - case 351: /* type_specifier_nonarray: SAMPLER2DSHADOW */ -#line 2553 "MachineIndependent/glslang.y" + case 354: /* type_specifier_nonarray: SAMPLER2DSHADOW */ +#line 2578 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, true); } -#line 8905 "MachineIndependent/glslang_tab.cpp" +#line 8961 "MachineIndependent/glslang_tab.cpp" break; - case 352: /* type_specifier_nonarray: SAMPLERCUBESHADOW */ -#line 2558 "MachineIndependent/glslang.y" + case 355: /* type_specifier_nonarray: SAMPLERCUBESHADOW */ +#line 2583 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, false, true); } -#line 8915 "MachineIndependent/glslang_tab.cpp" +#line 8971 "MachineIndependent/glslang_tab.cpp" break; - case 353: /* type_specifier_nonarray: SAMPLER2DARRAY */ -#line 2563 "MachineIndependent/glslang.y" + case 356: /* type_specifier_nonarray: SAMPLER2DARRAY */ +#line 2588 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true); } -#line 8925 "MachineIndependent/glslang_tab.cpp" +#line 8981 "MachineIndependent/glslang_tab.cpp" break; - case 354: /* type_specifier_nonarray: SAMPLER2DARRAYSHADOW */ -#line 2568 "MachineIndependent/glslang.y" + case 357: /* type_specifier_nonarray: SAMPLER2DARRAYSHADOW */ +#line 2593 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, true); } -#line 8935 "MachineIndependent/glslang_tab.cpp" +#line 8991 "MachineIndependent/glslang_tab.cpp" break; - case 355: /* type_specifier_nonarray: SAMPLER1DSHADOW */ -#line 2574 "MachineIndependent/glslang.y" + case 358: /* type_specifier_nonarray: SAMPLER1DSHADOW */ +#line 2599 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D, false, true); } -#line 8945 "MachineIndependent/glslang_tab.cpp" +#line 9001 "MachineIndependent/glslang_tab.cpp" break; - case 356: /* type_specifier_nonarray: SAMPLER1DARRAY */ -#line 2579 "MachineIndependent/glslang.y" + case 359: /* type_specifier_nonarray: SAMPLER1DARRAY */ +#line 2604 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true); } -#line 8955 "MachineIndependent/glslang_tab.cpp" +#line 9011 "MachineIndependent/glslang_tab.cpp" break; - case 357: /* type_specifier_nonarray: SAMPLER1DARRAYSHADOW */ -#line 2584 "MachineIndependent/glslang.y" + case 360: /* type_specifier_nonarray: SAMPLER1DARRAYSHADOW */ +#line 2609 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true, true); } -#line 8965 "MachineIndependent/glslang_tab.cpp" +#line 9021 "MachineIndependent/glslang_tab.cpp" break; - case 358: /* type_specifier_nonarray: SAMPLERCUBEARRAY */ -#line 2589 "MachineIndependent/glslang.y" + case 361: /* type_specifier_nonarray: SAMPLERCUBEARRAY */ +#line 2614 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, true); } -#line 8975 "MachineIndependent/glslang_tab.cpp" +#line 9031 "MachineIndependent/glslang_tab.cpp" break; - case 359: /* type_specifier_nonarray: SAMPLERCUBEARRAYSHADOW */ -#line 2594 "MachineIndependent/glslang.y" + case 362: /* type_specifier_nonarray: SAMPLERCUBEARRAYSHADOW */ +#line 2619 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, true, true); } -#line 8985 "MachineIndependent/glslang_tab.cpp" +#line 9041 "MachineIndependent/glslang_tab.cpp" break; - case 360: /* type_specifier_nonarray: F16SAMPLER1D */ -#line 2599 "MachineIndependent/glslang.y" + case 363: /* type_specifier_nonarray: F16SAMPLER1D */ +#line 2624 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D); } -#line 8996 "MachineIndependent/glslang_tab.cpp" +#line 9052 "MachineIndependent/glslang_tab.cpp" break; - case 361: /* type_specifier_nonarray: F16SAMPLER2D */ -#line 2605 "MachineIndependent/glslang.y" + case 364: /* type_specifier_nonarray: F16SAMPLER2D */ +#line 2630 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D); } -#line 9007 "MachineIndependent/glslang_tab.cpp" +#line 9063 "MachineIndependent/glslang_tab.cpp" break; - case 362: /* type_specifier_nonarray: F16SAMPLER3D */ -#line 2611 "MachineIndependent/glslang.y" + case 365: /* type_specifier_nonarray: F16SAMPLER3D */ +#line 2636 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd3D); } -#line 9018 "MachineIndependent/glslang_tab.cpp" +#line 9074 "MachineIndependent/glslang_tab.cpp" break; - case 363: /* type_specifier_nonarray: F16SAMPLERCUBE */ -#line 2617 "MachineIndependent/glslang.y" + case 366: /* type_specifier_nonarray: F16SAMPLERCUBE */ +#line 2642 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube); } -#line 9029 "MachineIndependent/glslang_tab.cpp" +#line 9085 "MachineIndependent/glslang_tab.cpp" break; - case 364: /* type_specifier_nonarray: F16SAMPLER1DSHADOW */ -#line 2623 "MachineIndependent/glslang.y" + case 367: /* type_specifier_nonarray: F16SAMPLER1DSHADOW */ +#line 2648 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, false, true); } -#line 9040 "MachineIndependent/glslang_tab.cpp" +#line 9096 "MachineIndependent/glslang_tab.cpp" break; - case 365: /* type_specifier_nonarray: F16SAMPLER2DSHADOW */ -#line 2629 "MachineIndependent/glslang.y" + case 368: /* type_specifier_nonarray: F16SAMPLER2DSHADOW */ +#line 2654 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, false, true); } -#line 9051 "MachineIndependent/glslang_tab.cpp" +#line 9107 "MachineIndependent/glslang_tab.cpp" break; - case 366: /* type_specifier_nonarray: F16SAMPLERCUBESHADOW */ -#line 2635 "MachineIndependent/glslang.y" + case 369: /* type_specifier_nonarray: F16SAMPLERCUBESHADOW */ +#line 2660 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, false, true); } -#line 9062 "MachineIndependent/glslang_tab.cpp" +#line 9118 "MachineIndependent/glslang_tab.cpp" break; - case 367: /* type_specifier_nonarray: F16SAMPLER1DARRAY */ -#line 2641 "MachineIndependent/glslang.y" + case 370: /* type_specifier_nonarray: F16SAMPLER1DARRAY */ +#line 2666 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, true); } -#line 9073 "MachineIndependent/glslang_tab.cpp" +#line 9129 "MachineIndependent/glslang_tab.cpp" break; - case 368: /* type_specifier_nonarray: F16SAMPLER2DARRAY */ -#line 2647 "MachineIndependent/glslang.y" + case 371: /* type_specifier_nonarray: F16SAMPLER2DARRAY */ +#line 2672 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true); } -#line 9084 "MachineIndependent/glslang_tab.cpp" +#line 9140 "MachineIndependent/glslang_tab.cpp" break; - case 369: /* type_specifier_nonarray: F16SAMPLER1DARRAYSHADOW */ -#line 2653 "MachineIndependent/glslang.y" + case 372: /* type_specifier_nonarray: F16SAMPLER1DARRAYSHADOW */ +#line 2678 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, true, true); } -#line 9095 "MachineIndependent/glslang_tab.cpp" +#line 9151 "MachineIndependent/glslang_tab.cpp" break; - case 370: /* type_specifier_nonarray: F16SAMPLER2DARRAYSHADOW */ -#line 2659 "MachineIndependent/glslang.y" + case 373: /* type_specifier_nonarray: F16SAMPLER2DARRAYSHADOW */ +#line 2684 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true, true); } -#line 9106 "MachineIndependent/glslang_tab.cpp" +#line 9162 "MachineIndependent/glslang_tab.cpp" break; - case 371: /* type_specifier_nonarray: F16SAMPLERCUBEARRAY */ -#line 2665 "MachineIndependent/glslang.y" + case 374: /* type_specifier_nonarray: F16SAMPLERCUBEARRAY */ +#line 2690 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, true); } -#line 9117 "MachineIndependent/glslang_tab.cpp" +#line 9173 "MachineIndependent/glslang_tab.cpp" break; - case 372: /* type_specifier_nonarray: F16SAMPLERCUBEARRAYSHADOW */ -#line 2671 "MachineIndependent/glslang.y" + case 375: /* type_specifier_nonarray: F16SAMPLERCUBEARRAYSHADOW */ +#line 2696 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, true, true); } -#line 9128 "MachineIndependent/glslang_tab.cpp" +#line 9184 "MachineIndependent/glslang_tab.cpp" break; - case 373: /* type_specifier_nonarray: ISAMPLER1D */ -#line 2677 "MachineIndependent/glslang.y" + case 376: /* type_specifier_nonarray: ISAMPLER1D */ +#line 2702 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd1D); } -#line 9138 "MachineIndependent/glslang_tab.cpp" +#line 9194 "MachineIndependent/glslang_tab.cpp" break; - case 374: /* type_specifier_nonarray: ISAMPLER2D */ -#line 2683 "MachineIndependent/glslang.y" + case 377: /* type_specifier_nonarray: ISAMPLER2D */ +#line 2708 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D); } -#line 9148 "MachineIndependent/glslang_tab.cpp" +#line 9204 "MachineIndependent/glslang_tab.cpp" break; - case 375: /* type_specifier_nonarray: ISAMPLER3D */ -#line 2688 "MachineIndependent/glslang.y" + case 378: /* type_specifier_nonarray: ISAMPLER3D */ +#line 2713 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd3D); } -#line 9158 "MachineIndependent/glslang_tab.cpp" +#line 9214 "MachineIndependent/glslang_tab.cpp" break; - case 376: /* type_specifier_nonarray: ISAMPLERCUBE */ -#line 2693 "MachineIndependent/glslang.y" + case 379: /* type_specifier_nonarray: ISAMPLERCUBE */ +#line 2718 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdCube); } -#line 9168 "MachineIndependent/glslang_tab.cpp" +#line 9224 "MachineIndependent/glslang_tab.cpp" break; - case 377: /* type_specifier_nonarray: ISAMPLER2DARRAY */ -#line 2698 "MachineIndependent/glslang.y" + case 380: /* type_specifier_nonarray: ISAMPLER2DARRAY */ +#line 2723 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D, true); } -#line 9178 "MachineIndependent/glslang_tab.cpp" +#line 9234 "MachineIndependent/glslang_tab.cpp" break; - case 378: /* type_specifier_nonarray: USAMPLER2D */ -#line 2703 "MachineIndependent/glslang.y" + case 381: /* type_specifier_nonarray: USAMPLER2D */ +#line 2728 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D); } -#line 9188 "MachineIndependent/glslang_tab.cpp" +#line 9244 "MachineIndependent/glslang_tab.cpp" break; - case 379: /* type_specifier_nonarray: USAMPLER3D */ -#line 2708 "MachineIndependent/glslang.y" + case 382: /* type_specifier_nonarray: USAMPLER3D */ +#line 2733 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd3D); } -#line 9198 "MachineIndependent/glslang_tab.cpp" +#line 9254 "MachineIndependent/glslang_tab.cpp" break; - case 380: /* type_specifier_nonarray: USAMPLERCUBE */ -#line 2713 "MachineIndependent/glslang.y" + case 383: /* type_specifier_nonarray: USAMPLERCUBE */ +#line 2738 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdCube); } -#line 9208 "MachineIndependent/glslang_tab.cpp" +#line 9264 "MachineIndependent/glslang_tab.cpp" break; - case 381: /* type_specifier_nonarray: ISAMPLER1DARRAY */ -#line 2719 "MachineIndependent/glslang.y" + case 384: /* type_specifier_nonarray: ISAMPLER1DARRAY */ +#line 2744 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd1D, true); } -#line 9218 "MachineIndependent/glslang_tab.cpp" +#line 9274 "MachineIndependent/glslang_tab.cpp" break; - case 382: /* type_specifier_nonarray: ISAMPLERCUBEARRAY */ -#line 2724 "MachineIndependent/glslang.y" + case 385: /* type_specifier_nonarray: ISAMPLERCUBEARRAY */ +#line 2749 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdCube, true); } -#line 9228 "MachineIndependent/glslang_tab.cpp" +#line 9284 "MachineIndependent/glslang_tab.cpp" break; - case 383: /* type_specifier_nonarray: USAMPLER1D */ -#line 2729 "MachineIndependent/glslang.y" + case 386: /* type_specifier_nonarray: USAMPLER1D */ +#line 2754 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd1D); } -#line 9238 "MachineIndependent/glslang_tab.cpp" +#line 9294 "MachineIndependent/glslang_tab.cpp" break; - case 384: /* type_specifier_nonarray: USAMPLER1DARRAY */ -#line 2734 "MachineIndependent/glslang.y" + case 387: /* type_specifier_nonarray: USAMPLER1DARRAY */ +#line 2759 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd1D, true); } -#line 9248 "MachineIndependent/glslang_tab.cpp" +#line 9304 "MachineIndependent/glslang_tab.cpp" break; - case 385: /* type_specifier_nonarray: USAMPLERCUBEARRAY */ -#line 2739 "MachineIndependent/glslang.y" + case 388: /* type_specifier_nonarray: USAMPLERCUBEARRAY */ +#line 2764 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdCube, true); } -#line 9258 "MachineIndependent/glslang_tab.cpp" +#line 9314 "MachineIndependent/glslang_tab.cpp" break; - case 386: /* type_specifier_nonarray: TEXTURECUBEARRAY */ -#line 2744 "MachineIndependent/glslang.y" + case 389: /* type_specifier_nonarray: TEXTURECUBEARRAY */ +#line 2769 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube, true); } -#line 9268 "MachineIndependent/glslang_tab.cpp" +#line 9324 "MachineIndependent/glslang_tab.cpp" break; - case 387: /* type_specifier_nonarray: ITEXTURECUBEARRAY */ -#line 2749 "MachineIndependent/glslang.y" + case 390: /* type_specifier_nonarray: ITEXTURECUBEARRAY */ +#line 2774 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube, true); } -#line 9278 "MachineIndependent/glslang_tab.cpp" +#line 9334 "MachineIndependent/glslang_tab.cpp" break; - case 388: /* type_specifier_nonarray: UTEXTURECUBEARRAY */ -#line 2754 "MachineIndependent/glslang.y" + case 391: /* type_specifier_nonarray: UTEXTURECUBEARRAY */ +#line 2779 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube, true); } -#line 9288 "MachineIndependent/glslang_tab.cpp" +#line 9344 "MachineIndependent/glslang_tab.cpp" break; - case 389: /* type_specifier_nonarray: USAMPLER2DARRAY */ -#line 2760 "MachineIndependent/glslang.y" + case 392: /* type_specifier_nonarray: USAMPLER2DARRAY */ +#line 2785 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D, true); } -#line 9298 "MachineIndependent/glslang_tab.cpp" +#line 9354 "MachineIndependent/glslang_tab.cpp" break; - case 390: /* type_specifier_nonarray: TEXTURE2D */ -#line 2765 "MachineIndependent/glslang.y" + case 393: /* type_specifier_nonarray: TEXTURE2D */ +#line 2790 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D); } -#line 9308 "MachineIndependent/glslang_tab.cpp" +#line 9364 "MachineIndependent/glslang_tab.cpp" break; - case 391: /* type_specifier_nonarray: TEXTURE3D */ -#line 2770 "MachineIndependent/glslang.y" + case 394: /* type_specifier_nonarray: TEXTURE3D */ +#line 2795 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd3D); } -#line 9318 "MachineIndependent/glslang_tab.cpp" +#line 9374 "MachineIndependent/glslang_tab.cpp" break; - case 392: /* type_specifier_nonarray: TEXTURE2DARRAY */ -#line 2775 "MachineIndependent/glslang.y" + case 395: /* type_specifier_nonarray: TEXTURE2DARRAY */ +#line 2800 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true); } -#line 9328 "MachineIndependent/glslang_tab.cpp" +#line 9384 "MachineIndependent/glslang_tab.cpp" break; - case 393: /* type_specifier_nonarray: TEXTURECUBE */ -#line 2780 "MachineIndependent/glslang.y" + case 396: /* type_specifier_nonarray: TEXTURECUBE */ +#line 2805 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube); } -#line 9338 "MachineIndependent/glslang_tab.cpp" +#line 9394 "MachineIndependent/glslang_tab.cpp" break; - case 394: /* type_specifier_nonarray: ITEXTURE2D */ -#line 2785 "MachineIndependent/glslang.y" + case 397: /* type_specifier_nonarray: ITEXTURE2D */ +#line 2810 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D); } -#line 9348 "MachineIndependent/glslang_tab.cpp" +#line 9404 "MachineIndependent/glslang_tab.cpp" break; - case 395: /* type_specifier_nonarray: ITEXTURE3D */ -#line 2790 "MachineIndependent/glslang.y" + case 398: /* type_specifier_nonarray: ITEXTURE3D */ +#line 2815 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd3D); } -#line 9358 "MachineIndependent/glslang_tab.cpp" +#line 9414 "MachineIndependent/glslang_tab.cpp" break; - case 396: /* type_specifier_nonarray: ITEXTURECUBE */ -#line 2795 "MachineIndependent/glslang.y" + case 399: /* type_specifier_nonarray: ITEXTURECUBE */ +#line 2820 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube); } -#line 9368 "MachineIndependent/glslang_tab.cpp" +#line 9424 "MachineIndependent/glslang_tab.cpp" break; - case 397: /* type_specifier_nonarray: ITEXTURE2DARRAY */ -#line 2800 "MachineIndependent/glslang.y" + case 400: /* type_specifier_nonarray: ITEXTURE2DARRAY */ +#line 2825 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true); } -#line 9378 "MachineIndependent/glslang_tab.cpp" +#line 9434 "MachineIndependent/glslang_tab.cpp" break; - case 398: /* type_specifier_nonarray: UTEXTURE2D */ -#line 2805 "MachineIndependent/glslang.y" + case 401: /* type_specifier_nonarray: UTEXTURE2D */ +#line 2830 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D); } -#line 9388 "MachineIndependent/glslang_tab.cpp" +#line 9444 "MachineIndependent/glslang_tab.cpp" break; - case 399: /* type_specifier_nonarray: UTEXTURE3D */ -#line 2810 "MachineIndependent/glslang.y" + case 402: /* type_specifier_nonarray: UTEXTURE3D */ +#line 2835 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd3D); } -#line 9398 "MachineIndependent/glslang_tab.cpp" +#line 9454 "MachineIndependent/glslang_tab.cpp" break; - case 400: /* type_specifier_nonarray: UTEXTURECUBE */ -#line 2815 "MachineIndependent/glslang.y" + case 403: /* type_specifier_nonarray: UTEXTURECUBE */ +#line 2840 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube); } -#line 9408 "MachineIndependent/glslang_tab.cpp" +#line 9464 "MachineIndependent/glslang_tab.cpp" break; - case 401: /* type_specifier_nonarray: UTEXTURE2DARRAY */ -#line 2820 "MachineIndependent/glslang.y" + case 404: /* type_specifier_nonarray: UTEXTURE2DARRAY */ +#line 2845 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true); } -#line 9418 "MachineIndependent/glslang_tab.cpp" +#line 9474 "MachineIndependent/glslang_tab.cpp" break; - case 402: /* type_specifier_nonarray: SAMPLER */ -#line 2825 "MachineIndependent/glslang.y" + case 405: /* type_specifier_nonarray: SAMPLER */ +#line 2850 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setPureSampler(false); } -#line 9428 "MachineIndependent/glslang_tab.cpp" +#line 9484 "MachineIndependent/glslang_tab.cpp" break; - case 403: /* type_specifier_nonarray: SAMPLERSHADOW */ -#line 2830 "MachineIndependent/glslang.y" + case 406: /* type_specifier_nonarray: SAMPLERSHADOW */ +#line 2855 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setPureSampler(true); } -#line 9438 "MachineIndependent/glslang_tab.cpp" +#line 9494 "MachineIndependent/glslang_tab.cpp" break; - case 404: /* type_specifier_nonarray: SAMPLER2DRECT */ -#line 2836 "MachineIndependent/glslang.y" + case 407: /* type_specifier_nonarray: SAMPLER2DRECT */ +#line 2861 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdRect); } -#line 9448 "MachineIndependent/glslang_tab.cpp" +#line 9504 "MachineIndependent/glslang_tab.cpp" break; - case 405: /* type_specifier_nonarray: SAMPLER2DRECTSHADOW */ -#line 2841 "MachineIndependent/glslang.y" + case 408: /* type_specifier_nonarray: SAMPLER2DRECTSHADOW */ +#line 2866 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdRect, false, true); } -#line 9458 "MachineIndependent/glslang_tab.cpp" +#line 9514 "MachineIndependent/glslang_tab.cpp" break; - case 406: /* type_specifier_nonarray: F16SAMPLER2DRECT */ -#line 2846 "MachineIndependent/glslang.y" + case 409: /* type_specifier_nonarray: F16SAMPLER2DRECT */ +#line 2871 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdRect); } -#line 9469 "MachineIndependent/glslang_tab.cpp" +#line 9525 "MachineIndependent/glslang_tab.cpp" break; - case 407: /* type_specifier_nonarray: F16SAMPLER2DRECTSHADOW */ -#line 2852 "MachineIndependent/glslang.y" + case 410: /* type_specifier_nonarray: F16SAMPLER2DRECTSHADOW */ +#line 2877 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdRect, false, true); } -#line 9480 "MachineIndependent/glslang_tab.cpp" +#line 9536 "MachineIndependent/glslang_tab.cpp" break; - case 408: /* type_specifier_nonarray: ISAMPLER2DRECT */ -#line 2858 "MachineIndependent/glslang.y" + case 411: /* type_specifier_nonarray: ISAMPLER2DRECT */ +#line 2883 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdRect); } -#line 9490 "MachineIndependent/glslang_tab.cpp" +#line 9546 "MachineIndependent/glslang_tab.cpp" break; - case 409: /* type_specifier_nonarray: USAMPLER2DRECT */ -#line 2863 "MachineIndependent/glslang.y" + case 412: /* type_specifier_nonarray: USAMPLER2DRECT */ +#line 2888 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdRect); } -#line 9500 "MachineIndependent/glslang_tab.cpp" +#line 9556 "MachineIndependent/glslang_tab.cpp" break; - case 410: /* type_specifier_nonarray: SAMPLERBUFFER */ -#line 2868 "MachineIndependent/glslang.y" + case 413: /* type_specifier_nonarray: SAMPLERBUFFER */ +#line 2893 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdBuffer); } -#line 9510 "MachineIndependent/glslang_tab.cpp" +#line 9566 "MachineIndependent/glslang_tab.cpp" break; - case 411: /* type_specifier_nonarray: F16SAMPLERBUFFER */ -#line 2873 "MachineIndependent/glslang.y" + case 414: /* type_specifier_nonarray: F16SAMPLERBUFFER */ +#line 2898 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdBuffer); } -#line 9521 "MachineIndependent/glslang_tab.cpp" +#line 9577 "MachineIndependent/glslang_tab.cpp" break; - case 412: /* type_specifier_nonarray: ISAMPLERBUFFER */ -#line 2879 "MachineIndependent/glslang.y" + case 415: /* type_specifier_nonarray: ISAMPLERBUFFER */ +#line 2904 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdBuffer); } -#line 9531 "MachineIndependent/glslang_tab.cpp" +#line 9587 "MachineIndependent/glslang_tab.cpp" break; - case 413: /* type_specifier_nonarray: USAMPLERBUFFER */ -#line 2884 "MachineIndependent/glslang.y" + case 416: /* type_specifier_nonarray: USAMPLERBUFFER */ +#line 2909 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdBuffer); } -#line 9541 "MachineIndependent/glslang_tab.cpp" +#line 9597 "MachineIndependent/glslang_tab.cpp" break; - case 414: /* type_specifier_nonarray: SAMPLER2DMS */ -#line 2889 "MachineIndependent/glslang.y" + case 417: /* type_specifier_nonarray: SAMPLER2DMS */ +#line 2914 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, false, true); } -#line 9551 "MachineIndependent/glslang_tab.cpp" +#line 9607 "MachineIndependent/glslang_tab.cpp" break; - case 415: /* type_specifier_nonarray: F16SAMPLER2DMS */ -#line 2894 "MachineIndependent/glslang.y" + case 418: /* type_specifier_nonarray: F16SAMPLER2DMS */ +#line 2919 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, false, false, true); } -#line 9562 "MachineIndependent/glslang_tab.cpp" +#line 9618 "MachineIndependent/glslang_tab.cpp" break; - case 416: /* type_specifier_nonarray: ISAMPLER2DMS */ -#line 2900 "MachineIndependent/glslang.y" + case 419: /* type_specifier_nonarray: ISAMPLER2DMS */ +#line 2925 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D, false, false, true); } -#line 9572 "MachineIndependent/glslang_tab.cpp" +#line 9628 "MachineIndependent/glslang_tab.cpp" break; - case 417: /* type_specifier_nonarray: USAMPLER2DMS */ -#line 2905 "MachineIndependent/glslang.y" + case 420: /* type_specifier_nonarray: USAMPLER2DMS */ +#line 2930 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D, false, false, true); } -#line 9582 "MachineIndependent/glslang_tab.cpp" +#line 9638 "MachineIndependent/glslang_tab.cpp" break; - case 418: /* type_specifier_nonarray: SAMPLER2DMSARRAY */ -#line 2910 "MachineIndependent/glslang.y" + case 421: /* type_specifier_nonarray: SAMPLER2DMSARRAY */ +#line 2935 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, false, true); } -#line 9592 "MachineIndependent/glslang_tab.cpp" +#line 9648 "MachineIndependent/glslang_tab.cpp" break; - case 419: /* type_specifier_nonarray: F16SAMPLER2DMSARRAY */ -#line 2915 "MachineIndependent/glslang.y" + case 422: /* type_specifier_nonarray: F16SAMPLER2DMSARRAY */ +#line 2940 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true, false, true); } -#line 9603 "MachineIndependent/glslang_tab.cpp" +#line 9659 "MachineIndependent/glslang_tab.cpp" break; - case 420: /* type_specifier_nonarray: ISAMPLER2DMSARRAY */ -#line 2921 "MachineIndependent/glslang.y" + case 423: /* type_specifier_nonarray: ISAMPLER2DMSARRAY */ +#line 2946 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D, true, false, true); } -#line 9613 "MachineIndependent/glslang_tab.cpp" +#line 9669 "MachineIndependent/glslang_tab.cpp" break; - case 421: /* type_specifier_nonarray: USAMPLER2DMSARRAY */ -#line 2926 "MachineIndependent/glslang.y" + case 424: /* type_specifier_nonarray: USAMPLER2DMSARRAY */ +#line 2951 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D, true, false, true); } -#line 9623 "MachineIndependent/glslang_tab.cpp" +#line 9679 "MachineIndependent/glslang_tab.cpp" break; - case 422: /* type_specifier_nonarray: TEXTURE1D */ -#line 2931 "MachineIndependent/glslang.y" + case 425: /* type_specifier_nonarray: TEXTURE1D */ +#line 2956 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D); } -#line 9633 "MachineIndependent/glslang_tab.cpp" +#line 9689 "MachineIndependent/glslang_tab.cpp" break; - case 423: /* type_specifier_nonarray: F16TEXTURE1D */ -#line 2936 "MachineIndependent/glslang.y" + case 426: /* type_specifier_nonarray: F16TEXTURE1D */ +#line 2961 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd1D); } -#line 9644 "MachineIndependent/glslang_tab.cpp" +#line 9700 "MachineIndependent/glslang_tab.cpp" break; - case 424: /* type_specifier_nonarray: F16TEXTURE2D */ -#line 2942 "MachineIndependent/glslang.y" + case 427: /* type_specifier_nonarray: F16TEXTURE2D */ +#line 2967 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D); } -#line 9655 "MachineIndependent/glslang_tab.cpp" +#line 9711 "MachineIndependent/glslang_tab.cpp" break; - case 425: /* type_specifier_nonarray: F16TEXTURE3D */ -#line 2948 "MachineIndependent/glslang.y" + case 428: /* type_specifier_nonarray: F16TEXTURE3D */ +#line 2973 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd3D); } -#line 9666 "MachineIndependent/glslang_tab.cpp" +#line 9722 "MachineIndependent/glslang_tab.cpp" break; - case 426: /* type_specifier_nonarray: F16TEXTURECUBE */ -#line 2954 "MachineIndependent/glslang.y" + case 429: /* type_specifier_nonarray: F16TEXTURECUBE */ +#line 2979 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdCube); } -#line 9677 "MachineIndependent/glslang_tab.cpp" +#line 9733 "MachineIndependent/glslang_tab.cpp" break; - case 427: /* type_specifier_nonarray: TEXTURE1DARRAY */ -#line 2960 "MachineIndependent/glslang.y" + case 430: /* type_specifier_nonarray: TEXTURE1DARRAY */ +#line 2985 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D, true); } -#line 9687 "MachineIndependent/glslang_tab.cpp" +#line 9743 "MachineIndependent/glslang_tab.cpp" break; - case 428: /* type_specifier_nonarray: F16TEXTURE1DARRAY */ -#line 2965 "MachineIndependent/glslang.y" + case 431: /* type_specifier_nonarray: F16TEXTURE1DARRAY */ +#line 2990 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd1D, true); } -#line 9698 "MachineIndependent/glslang_tab.cpp" +#line 9754 "MachineIndependent/glslang_tab.cpp" break; - case 429: /* type_specifier_nonarray: F16TEXTURE2DARRAY */ -#line 2971 "MachineIndependent/glslang.y" + case 432: /* type_specifier_nonarray: F16TEXTURE2DARRAY */ +#line 2996 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, true); } -#line 9709 "MachineIndependent/glslang_tab.cpp" +#line 9765 "MachineIndependent/glslang_tab.cpp" break; - case 430: /* type_specifier_nonarray: F16TEXTURECUBEARRAY */ -#line 2977 "MachineIndependent/glslang.y" + case 433: /* type_specifier_nonarray: F16TEXTURECUBEARRAY */ +#line 3002 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdCube, true); } -#line 9720 "MachineIndependent/glslang_tab.cpp" +#line 9776 "MachineIndependent/glslang_tab.cpp" break; - case 431: /* type_specifier_nonarray: ITEXTURE1D */ -#line 2983 "MachineIndependent/glslang.y" + case 434: /* type_specifier_nonarray: ITEXTURE1D */ +#line 3008 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D); } -#line 9730 "MachineIndependent/glslang_tab.cpp" +#line 9786 "MachineIndependent/glslang_tab.cpp" break; - case 432: /* type_specifier_nonarray: ITEXTURE1DARRAY */ -#line 2988 "MachineIndependent/glslang.y" + case 435: /* type_specifier_nonarray: ITEXTURE1DARRAY */ +#line 3013 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D, true); } -#line 9740 "MachineIndependent/glslang_tab.cpp" +#line 9796 "MachineIndependent/glslang_tab.cpp" break; - case 433: /* type_specifier_nonarray: UTEXTURE1D */ -#line 2993 "MachineIndependent/glslang.y" + case 436: /* type_specifier_nonarray: UTEXTURE1D */ +#line 3018 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D); } -#line 9750 "MachineIndependent/glslang_tab.cpp" +#line 9806 "MachineIndependent/glslang_tab.cpp" break; - case 434: /* type_specifier_nonarray: UTEXTURE1DARRAY */ -#line 2998 "MachineIndependent/glslang.y" + case 437: /* type_specifier_nonarray: UTEXTURE1DARRAY */ +#line 3023 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D, true); } -#line 9760 "MachineIndependent/glslang_tab.cpp" +#line 9816 "MachineIndependent/glslang_tab.cpp" break; - case 435: /* type_specifier_nonarray: TEXTURE2DRECT */ -#line 3003 "MachineIndependent/glslang.y" + case 438: /* type_specifier_nonarray: TEXTURE2DRECT */ +#line 3028 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdRect); } -#line 9770 "MachineIndependent/glslang_tab.cpp" +#line 9826 "MachineIndependent/glslang_tab.cpp" break; - case 436: /* type_specifier_nonarray: F16TEXTURE2DRECT */ -#line 3008 "MachineIndependent/glslang.y" + case 439: /* type_specifier_nonarray: F16TEXTURE2DRECT */ +#line 3033 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdRect); } -#line 9781 "MachineIndependent/glslang_tab.cpp" +#line 9837 "MachineIndependent/glslang_tab.cpp" break; - case 437: /* type_specifier_nonarray: ITEXTURE2DRECT */ -#line 3014 "MachineIndependent/glslang.y" + case 440: /* type_specifier_nonarray: ITEXTURE2DRECT */ +#line 3039 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdRect); } -#line 9791 "MachineIndependent/glslang_tab.cpp" +#line 9847 "MachineIndependent/glslang_tab.cpp" break; - case 438: /* type_specifier_nonarray: UTEXTURE2DRECT */ -#line 3019 "MachineIndependent/glslang.y" + case 441: /* type_specifier_nonarray: UTEXTURE2DRECT */ +#line 3044 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdRect); } -#line 9801 "MachineIndependent/glslang_tab.cpp" +#line 9857 "MachineIndependent/glslang_tab.cpp" break; - case 439: /* type_specifier_nonarray: TEXTUREBUFFER */ -#line 3024 "MachineIndependent/glslang.y" + case 442: /* type_specifier_nonarray: TEXTUREBUFFER */ +#line 3049 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdBuffer); } -#line 9811 "MachineIndependent/glslang_tab.cpp" +#line 9867 "MachineIndependent/glslang_tab.cpp" break; - case 440: /* type_specifier_nonarray: F16TEXTUREBUFFER */ -#line 3029 "MachineIndependent/glslang.y" + case 443: /* type_specifier_nonarray: F16TEXTUREBUFFER */ +#line 3054 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdBuffer); } -#line 9822 "MachineIndependent/glslang_tab.cpp" +#line 9878 "MachineIndependent/glslang_tab.cpp" break; - case 441: /* type_specifier_nonarray: ITEXTUREBUFFER */ -#line 3035 "MachineIndependent/glslang.y" + case 444: /* type_specifier_nonarray: ITEXTUREBUFFER */ +#line 3060 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdBuffer); } -#line 9832 "MachineIndependent/glslang_tab.cpp" +#line 9888 "MachineIndependent/glslang_tab.cpp" break; - case 442: /* type_specifier_nonarray: UTEXTUREBUFFER */ -#line 3040 "MachineIndependent/glslang.y" + case 445: /* type_specifier_nonarray: UTEXTUREBUFFER */ +#line 3065 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdBuffer); } -#line 9842 "MachineIndependent/glslang_tab.cpp" +#line 9898 "MachineIndependent/glslang_tab.cpp" break; - case 443: /* type_specifier_nonarray: TEXTURE2DMS */ -#line 3045 "MachineIndependent/glslang.y" + case 446: /* type_specifier_nonarray: TEXTURE2DMS */ +#line 3070 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, false, false, true); } -#line 9852 "MachineIndependent/glslang_tab.cpp" +#line 9908 "MachineIndependent/glslang_tab.cpp" break; - case 444: /* type_specifier_nonarray: F16TEXTURE2DMS */ -#line 3050 "MachineIndependent/glslang.y" + case 447: /* type_specifier_nonarray: F16TEXTURE2DMS */ +#line 3075 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, false, false, true); } -#line 9863 "MachineIndependent/glslang_tab.cpp" +#line 9919 "MachineIndependent/glslang_tab.cpp" break; - case 445: /* type_specifier_nonarray: ITEXTURE2DMS */ -#line 3056 "MachineIndependent/glslang.y" + case 448: /* type_specifier_nonarray: ITEXTURE2DMS */ +#line 3081 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, false, false, true); } -#line 9873 "MachineIndependent/glslang_tab.cpp" +#line 9929 "MachineIndependent/glslang_tab.cpp" break; - case 446: /* type_specifier_nonarray: UTEXTURE2DMS */ -#line 3061 "MachineIndependent/glslang.y" + case 449: /* type_specifier_nonarray: UTEXTURE2DMS */ +#line 3086 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, false, false, true); } -#line 9883 "MachineIndependent/glslang_tab.cpp" +#line 9939 "MachineIndependent/glslang_tab.cpp" break; - case 447: /* type_specifier_nonarray: TEXTURE2DMSARRAY */ -#line 3066 "MachineIndependent/glslang.y" + case 450: /* type_specifier_nonarray: TEXTURE2DMSARRAY */ +#line 3091 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true, false, true); } -#line 9893 "MachineIndependent/glslang_tab.cpp" +#line 9949 "MachineIndependent/glslang_tab.cpp" break; - case 448: /* type_specifier_nonarray: F16TEXTURE2DMSARRAY */ -#line 3071 "MachineIndependent/glslang.y" + case 451: /* type_specifier_nonarray: F16TEXTURE2DMSARRAY */ +#line 3096 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, true, false, true); } -#line 9904 "MachineIndependent/glslang_tab.cpp" +#line 9960 "MachineIndependent/glslang_tab.cpp" break; - case 449: /* type_specifier_nonarray: ITEXTURE2DMSARRAY */ -#line 3077 "MachineIndependent/glslang.y" + case 452: /* type_specifier_nonarray: ITEXTURE2DMSARRAY */ +#line 3102 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true, false, true); } -#line 9914 "MachineIndependent/glslang_tab.cpp" +#line 9970 "MachineIndependent/glslang_tab.cpp" break; - case 450: /* type_specifier_nonarray: UTEXTURE2DMSARRAY */ -#line 3082 "MachineIndependent/glslang.y" + case 453: /* type_specifier_nonarray: UTEXTURE2DMSARRAY */ +#line 3107 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true, false, true); } -#line 9924 "MachineIndependent/glslang_tab.cpp" +#line 9980 "MachineIndependent/glslang_tab.cpp" break; - case 451: /* type_specifier_nonarray: IMAGE1D */ -#line 3087 "MachineIndependent/glslang.y" + case 454: /* type_specifier_nonarray: IMAGE1D */ +#line 3112 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D); } -#line 9934 "MachineIndependent/glslang_tab.cpp" +#line 9990 "MachineIndependent/glslang_tab.cpp" break; - case 452: /* type_specifier_nonarray: F16IMAGE1D */ -#line 3092 "MachineIndependent/glslang.y" + case 455: /* type_specifier_nonarray: F16IMAGE1D */ +#line 3117 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd1D); } -#line 9945 "MachineIndependent/glslang_tab.cpp" +#line 10001 "MachineIndependent/glslang_tab.cpp" break; - case 453: /* type_specifier_nonarray: IIMAGE1D */ -#line 3098 "MachineIndependent/glslang.y" + case 456: /* type_specifier_nonarray: IIMAGE1D */ +#line 3123 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd1D); } -#line 9955 "MachineIndependent/glslang_tab.cpp" +#line 10011 "MachineIndependent/glslang_tab.cpp" break; - case 454: /* type_specifier_nonarray: UIMAGE1D */ -#line 3103 "MachineIndependent/glslang.y" + case 457: /* type_specifier_nonarray: UIMAGE1D */ +#line 3128 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd1D); } -#line 9965 "MachineIndependent/glslang_tab.cpp" +#line 10021 "MachineIndependent/glslang_tab.cpp" break; - case 455: /* type_specifier_nonarray: IMAGE2D */ -#line 3108 "MachineIndependent/glslang.y" + case 458: /* type_specifier_nonarray: IMAGE2D */ +#line 3133 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D); } -#line 9975 "MachineIndependent/glslang_tab.cpp" +#line 10031 "MachineIndependent/glslang_tab.cpp" break; - case 456: /* type_specifier_nonarray: F16IMAGE2D */ -#line 3113 "MachineIndependent/glslang.y" + case 459: /* type_specifier_nonarray: F16IMAGE2D */ +#line 3138 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D); } -#line 9986 "MachineIndependent/glslang_tab.cpp" +#line 10042 "MachineIndependent/glslang_tab.cpp" break; - case 457: /* type_specifier_nonarray: IIMAGE2D */ -#line 3119 "MachineIndependent/glslang.y" + case 460: /* type_specifier_nonarray: IIMAGE2D */ +#line 3144 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D); } -#line 9996 "MachineIndependent/glslang_tab.cpp" +#line 10052 "MachineIndependent/glslang_tab.cpp" break; - case 458: /* type_specifier_nonarray: UIMAGE2D */ -#line 3124 "MachineIndependent/glslang.y" + case 461: /* type_specifier_nonarray: UIMAGE2D */ +#line 3149 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D); } -#line 10006 "MachineIndependent/glslang_tab.cpp" +#line 10062 "MachineIndependent/glslang_tab.cpp" break; - case 459: /* type_specifier_nonarray: IMAGE3D */ -#line 3129 "MachineIndependent/glslang.y" + case 462: /* type_specifier_nonarray: IMAGE3D */ +#line 3154 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd3D); } -#line 10016 "MachineIndependent/glslang_tab.cpp" +#line 10072 "MachineIndependent/glslang_tab.cpp" break; - case 460: /* type_specifier_nonarray: F16IMAGE3D */ -#line 3134 "MachineIndependent/glslang.y" + case 463: /* type_specifier_nonarray: F16IMAGE3D */ +#line 3159 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd3D); } -#line 10027 "MachineIndependent/glslang_tab.cpp" +#line 10083 "MachineIndependent/glslang_tab.cpp" break; - case 461: /* type_specifier_nonarray: IIMAGE3D */ -#line 3140 "MachineIndependent/glslang.y" + case 464: /* type_specifier_nonarray: IIMAGE3D */ +#line 3165 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd3D); } -#line 10037 "MachineIndependent/glslang_tab.cpp" +#line 10093 "MachineIndependent/glslang_tab.cpp" break; - case 462: /* type_specifier_nonarray: UIMAGE3D */ -#line 3145 "MachineIndependent/glslang.y" + case 465: /* type_specifier_nonarray: UIMAGE3D */ +#line 3170 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd3D); } -#line 10047 "MachineIndependent/glslang_tab.cpp" +#line 10103 "MachineIndependent/glslang_tab.cpp" break; - case 463: /* type_specifier_nonarray: IMAGE2DRECT */ -#line 3150 "MachineIndependent/glslang.y" + case 466: /* type_specifier_nonarray: IMAGE2DRECT */ +#line 3175 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdRect); } -#line 10057 "MachineIndependent/glslang_tab.cpp" +#line 10113 "MachineIndependent/glslang_tab.cpp" break; - case 464: /* type_specifier_nonarray: F16IMAGE2DRECT */ -#line 3155 "MachineIndependent/glslang.y" + case 467: /* type_specifier_nonarray: F16IMAGE2DRECT */ +#line 3180 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdRect); } -#line 10068 "MachineIndependent/glslang_tab.cpp" +#line 10124 "MachineIndependent/glslang_tab.cpp" break; - case 465: /* type_specifier_nonarray: IIMAGE2DRECT */ -#line 3161 "MachineIndependent/glslang.y" + case 468: /* type_specifier_nonarray: IIMAGE2DRECT */ +#line 3186 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdRect); } -#line 10078 "MachineIndependent/glslang_tab.cpp" +#line 10134 "MachineIndependent/glslang_tab.cpp" break; - case 466: /* type_specifier_nonarray: UIMAGE2DRECT */ -#line 3166 "MachineIndependent/glslang.y" + case 469: /* type_specifier_nonarray: UIMAGE2DRECT */ +#line 3191 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdRect); } -#line 10088 "MachineIndependent/glslang_tab.cpp" +#line 10144 "MachineIndependent/glslang_tab.cpp" break; - case 467: /* type_specifier_nonarray: IMAGECUBE */ -#line 3171 "MachineIndependent/glslang.y" + case 470: /* type_specifier_nonarray: IMAGECUBE */ +#line 3196 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube); } -#line 10098 "MachineIndependent/glslang_tab.cpp" +#line 10154 "MachineIndependent/glslang_tab.cpp" break; - case 468: /* type_specifier_nonarray: F16IMAGECUBE */ -#line 3176 "MachineIndependent/glslang.y" + case 471: /* type_specifier_nonarray: F16IMAGECUBE */ +#line 3201 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdCube); } -#line 10109 "MachineIndependent/glslang_tab.cpp" +#line 10165 "MachineIndependent/glslang_tab.cpp" break; - case 469: /* type_specifier_nonarray: IIMAGECUBE */ -#line 3182 "MachineIndependent/glslang.y" + case 472: /* type_specifier_nonarray: IIMAGECUBE */ +#line 3207 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdCube); } -#line 10119 "MachineIndependent/glslang_tab.cpp" +#line 10175 "MachineIndependent/glslang_tab.cpp" break; - case 470: /* type_specifier_nonarray: UIMAGECUBE */ -#line 3187 "MachineIndependent/glslang.y" + case 473: /* type_specifier_nonarray: UIMAGECUBE */ +#line 3212 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdCube); } -#line 10129 "MachineIndependent/glslang_tab.cpp" +#line 10185 "MachineIndependent/glslang_tab.cpp" break; - case 471: /* type_specifier_nonarray: IMAGEBUFFER */ -#line 3192 "MachineIndependent/glslang.y" + case 474: /* type_specifier_nonarray: IMAGEBUFFER */ +#line 3217 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdBuffer); } -#line 10139 "MachineIndependent/glslang_tab.cpp" +#line 10195 "MachineIndependent/glslang_tab.cpp" break; - case 472: /* type_specifier_nonarray: F16IMAGEBUFFER */ -#line 3197 "MachineIndependent/glslang.y" + case 475: /* type_specifier_nonarray: F16IMAGEBUFFER */ +#line 3222 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdBuffer); } -#line 10150 "MachineIndependent/glslang_tab.cpp" +#line 10206 "MachineIndependent/glslang_tab.cpp" break; - case 473: /* type_specifier_nonarray: IIMAGEBUFFER */ -#line 3203 "MachineIndependent/glslang.y" + case 476: /* type_specifier_nonarray: IIMAGEBUFFER */ +#line 3228 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdBuffer); } -#line 10160 "MachineIndependent/glslang_tab.cpp" +#line 10216 "MachineIndependent/glslang_tab.cpp" break; - case 474: /* type_specifier_nonarray: UIMAGEBUFFER */ -#line 3208 "MachineIndependent/glslang.y" + case 477: /* type_specifier_nonarray: UIMAGEBUFFER */ +#line 3233 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdBuffer); } -#line 10170 "MachineIndependent/glslang_tab.cpp" +#line 10226 "MachineIndependent/glslang_tab.cpp" break; - case 475: /* type_specifier_nonarray: IMAGE1DARRAY */ -#line 3213 "MachineIndependent/glslang.y" + case 478: /* type_specifier_nonarray: IMAGE1DARRAY */ +#line 3238 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D, true); } -#line 10180 "MachineIndependent/glslang_tab.cpp" +#line 10236 "MachineIndependent/glslang_tab.cpp" break; - case 476: /* type_specifier_nonarray: F16IMAGE1DARRAY */ -#line 3218 "MachineIndependent/glslang.y" + case 479: /* type_specifier_nonarray: F16IMAGE1DARRAY */ +#line 3243 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd1D, true); } -#line 10191 "MachineIndependent/glslang_tab.cpp" +#line 10247 "MachineIndependent/glslang_tab.cpp" break; - case 477: /* type_specifier_nonarray: IIMAGE1DARRAY */ -#line 3224 "MachineIndependent/glslang.y" + case 480: /* type_specifier_nonarray: IIMAGE1DARRAY */ +#line 3249 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd1D, true); } -#line 10201 "MachineIndependent/glslang_tab.cpp" +#line 10257 "MachineIndependent/glslang_tab.cpp" break; - case 478: /* type_specifier_nonarray: UIMAGE1DARRAY */ -#line 3229 "MachineIndependent/glslang.y" + case 481: /* type_specifier_nonarray: UIMAGE1DARRAY */ +#line 3254 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd1D, true); } -#line 10211 "MachineIndependent/glslang_tab.cpp" +#line 10267 "MachineIndependent/glslang_tab.cpp" break; - case 479: /* type_specifier_nonarray: IMAGE2DARRAY */ -#line 3234 "MachineIndependent/glslang.y" + case 482: /* type_specifier_nonarray: IMAGE2DARRAY */ +#line 3259 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, true); } -#line 10221 "MachineIndependent/glslang_tab.cpp" +#line 10277 "MachineIndependent/glslang_tab.cpp" break; - case 480: /* type_specifier_nonarray: F16IMAGE2DARRAY */ -#line 3239 "MachineIndependent/glslang.y" + case 483: /* type_specifier_nonarray: F16IMAGE2DARRAY */ +#line 3264 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, true); } -#line 10232 "MachineIndependent/glslang_tab.cpp" +#line 10288 "MachineIndependent/glslang_tab.cpp" break; - case 481: /* type_specifier_nonarray: IIMAGE2DARRAY */ -#line 3245 "MachineIndependent/glslang.y" + case 484: /* type_specifier_nonarray: IIMAGE2DARRAY */ +#line 3270 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, true); } -#line 10242 "MachineIndependent/glslang_tab.cpp" +#line 10298 "MachineIndependent/glslang_tab.cpp" break; - case 482: /* type_specifier_nonarray: UIMAGE2DARRAY */ -#line 3250 "MachineIndependent/glslang.y" + case 485: /* type_specifier_nonarray: UIMAGE2DARRAY */ +#line 3275 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, true); } -#line 10252 "MachineIndependent/glslang_tab.cpp" +#line 10308 "MachineIndependent/glslang_tab.cpp" break; - case 483: /* type_specifier_nonarray: IMAGECUBEARRAY */ -#line 3255 "MachineIndependent/glslang.y" + case 486: /* type_specifier_nonarray: IMAGECUBEARRAY */ +#line 3280 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube, true); } -#line 10262 "MachineIndependent/glslang_tab.cpp" +#line 10318 "MachineIndependent/glslang_tab.cpp" break; - case 484: /* type_specifier_nonarray: F16IMAGECUBEARRAY */ -#line 3260 "MachineIndependent/glslang.y" + case 487: /* type_specifier_nonarray: F16IMAGECUBEARRAY */ +#line 3285 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdCube, true); } -#line 10273 "MachineIndependent/glslang_tab.cpp" +#line 10329 "MachineIndependent/glslang_tab.cpp" break; - case 485: /* type_specifier_nonarray: IIMAGECUBEARRAY */ -#line 3266 "MachineIndependent/glslang.y" + case 488: /* type_specifier_nonarray: IIMAGECUBEARRAY */ +#line 3291 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdCube, true); } -#line 10283 "MachineIndependent/glslang_tab.cpp" +#line 10339 "MachineIndependent/glslang_tab.cpp" break; - case 486: /* type_specifier_nonarray: UIMAGECUBEARRAY */ -#line 3271 "MachineIndependent/glslang.y" + case 489: /* type_specifier_nonarray: UIMAGECUBEARRAY */ +#line 3296 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdCube, true); } -#line 10293 "MachineIndependent/glslang_tab.cpp" +#line 10349 "MachineIndependent/glslang_tab.cpp" break; - case 487: /* type_specifier_nonarray: IMAGE2DMS */ -#line 3276 "MachineIndependent/glslang.y" + case 490: /* type_specifier_nonarray: IMAGE2DMS */ +#line 3301 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, false, false, true); } -#line 10303 "MachineIndependent/glslang_tab.cpp" +#line 10359 "MachineIndependent/glslang_tab.cpp" break; - case 488: /* type_specifier_nonarray: F16IMAGE2DMS */ -#line 3281 "MachineIndependent/glslang.y" + case 491: /* type_specifier_nonarray: F16IMAGE2DMS */ +#line 3306 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, false, false, true); } -#line 10314 "MachineIndependent/glslang_tab.cpp" +#line 10370 "MachineIndependent/glslang_tab.cpp" break; - case 489: /* type_specifier_nonarray: IIMAGE2DMS */ -#line 3287 "MachineIndependent/glslang.y" + case 492: /* type_specifier_nonarray: IIMAGE2DMS */ +#line 3312 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, false, false, true); } -#line 10324 "MachineIndependent/glslang_tab.cpp" +#line 10380 "MachineIndependent/glslang_tab.cpp" break; - case 490: /* type_specifier_nonarray: UIMAGE2DMS */ -#line 3292 "MachineIndependent/glslang.y" + case 493: /* type_specifier_nonarray: UIMAGE2DMS */ +#line 3317 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, false, false, true); } -#line 10334 "MachineIndependent/glslang_tab.cpp" +#line 10390 "MachineIndependent/glslang_tab.cpp" break; - case 491: /* type_specifier_nonarray: IMAGE2DMSARRAY */ -#line 3297 "MachineIndependent/glslang.y" + case 494: /* type_specifier_nonarray: IMAGE2DMSARRAY */ +#line 3322 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, true, false, true); } -#line 10344 "MachineIndependent/glslang_tab.cpp" +#line 10400 "MachineIndependent/glslang_tab.cpp" break; - case 492: /* type_specifier_nonarray: F16IMAGE2DMSARRAY */ -#line 3302 "MachineIndependent/glslang.y" + case 495: /* type_specifier_nonarray: F16IMAGE2DMSARRAY */ +#line 3327 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, true, false, true); } -#line 10355 "MachineIndependent/glslang_tab.cpp" +#line 10411 "MachineIndependent/glslang_tab.cpp" break; - case 493: /* type_specifier_nonarray: IIMAGE2DMSARRAY */ -#line 3308 "MachineIndependent/glslang.y" + case 496: /* type_specifier_nonarray: IIMAGE2DMSARRAY */ +#line 3333 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, true, false, true); } -#line 10365 "MachineIndependent/glslang_tab.cpp" +#line 10421 "MachineIndependent/glslang_tab.cpp" break; - case 494: /* type_specifier_nonarray: UIMAGE2DMSARRAY */ -#line 3313 "MachineIndependent/glslang.y" + case 497: /* type_specifier_nonarray: UIMAGE2DMSARRAY */ +#line 3338 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, true, false, true); } -#line 10375 "MachineIndependent/glslang_tab.cpp" +#line 10431 "MachineIndependent/glslang_tab.cpp" break; - case 495: /* type_specifier_nonarray: I64IMAGE1D */ -#line 3318 "MachineIndependent/glslang.y" + case 498: /* type_specifier_nonarray: I64IMAGE1D */ +#line 3343 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd1D); } -#line 10385 "MachineIndependent/glslang_tab.cpp" +#line 10441 "MachineIndependent/glslang_tab.cpp" break; - case 496: /* type_specifier_nonarray: U64IMAGE1D */ -#line 3323 "MachineIndependent/glslang.y" + case 499: /* type_specifier_nonarray: U64IMAGE1D */ +#line 3348 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd1D); } -#line 10395 "MachineIndependent/glslang_tab.cpp" +#line 10451 "MachineIndependent/glslang_tab.cpp" break; - case 497: /* type_specifier_nonarray: I64IMAGE2D */ -#line 3328 "MachineIndependent/glslang.y" + case 500: /* type_specifier_nonarray: I64IMAGE2D */ +#line 3353 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd2D); } -#line 10405 "MachineIndependent/glslang_tab.cpp" +#line 10461 "MachineIndependent/glslang_tab.cpp" break; - case 498: /* type_specifier_nonarray: U64IMAGE2D */ -#line 3333 "MachineIndependent/glslang.y" + case 501: /* type_specifier_nonarray: U64IMAGE2D */ +#line 3358 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd2D); } -#line 10415 "MachineIndependent/glslang_tab.cpp" +#line 10471 "MachineIndependent/glslang_tab.cpp" break; - case 499: /* type_specifier_nonarray: I64IMAGE3D */ -#line 3338 "MachineIndependent/glslang.y" + case 502: /* type_specifier_nonarray: I64IMAGE3D */ +#line 3363 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd3D); } -#line 10425 "MachineIndependent/glslang_tab.cpp" +#line 10481 "MachineIndependent/glslang_tab.cpp" break; - case 500: /* type_specifier_nonarray: U64IMAGE3D */ -#line 3343 "MachineIndependent/glslang.y" + case 503: /* type_specifier_nonarray: U64IMAGE3D */ +#line 3368 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd3D); } -#line 10435 "MachineIndependent/glslang_tab.cpp" +#line 10491 "MachineIndependent/glslang_tab.cpp" break; - case 501: /* type_specifier_nonarray: I64IMAGE2DRECT */ -#line 3348 "MachineIndependent/glslang.y" + case 504: /* type_specifier_nonarray: I64IMAGE2DRECT */ +#line 3373 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, EsdRect); } -#line 10445 "MachineIndependent/glslang_tab.cpp" +#line 10501 "MachineIndependent/glslang_tab.cpp" break; - case 502: /* type_specifier_nonarray: U64IMAGE2DRECT */ -#line 3353 "MachineIndependent/glslang.y" + case 505: /* type_specifier_nonarray: U64IMAGE2DRECT */ +#line 3378 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, EsdRect); } -#line 10455 "MachineIndependent/glslang_tab.cpp" +#line 10511 "MachineIndependent/glslang_tab.cpp" break; - case 503: /* type_specifier_nonarray: I64IMAGECUBE */ -#line 3358 "MachineIndependent/glslang.y" + case 506: /* type_specifier_nonarray: I64IMAGECUBE */ +#line 3383 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, EsdCube); } -#line 10465 "MachineIndependent/glslang_tab.cpp" +#line 10521 "MachineIndependent/glslang_tab.cpp" break; - case 504: /* type_specifier_nonarray: U64IMAGECUBE */ -#line 3363 "MachineIndependent/glslang.y" + case 507: /* type_specifier_nonarray: U64IMAGECUBE */ +#line 3388 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, EsdCube); } -#line 10475 "MachineIndependent/glslang_tab.cpp" +#line 10531 "MachineIndependent/glslang_tab.cpp" break; - case 505: /* type_specifier_nonarray: I64IMAGEBUFFER */ -#line 3368 "MachineIndependent/glslang.y" + case 508: /* type_specifier_nonarray: I64IMAGEBUFFER */ +#line 3393 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, EsdBuffer); } -#line 10485 "MachineIndependent/glslang_tab.cpp" +#line 10541 "MachineIndependent/glslang_tab.cpp" break; - case 506: /* type_specifier_nonarray: U64IMAGEBUFFER */ -#line 3373 "MachineIndependent/glslang.y" + case 509: /* type_specifier_nonarray: U64IMAGEBUFFER */ +#line 3398 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, EsdBuffer); } -#line 10495 "MachineIndependent/glslang_tab.cpp" +#line 10551 "MachineIndependent/glslang_tab.cpp" break; - case 507: /* type_specifier_nonarray: I64IMAGE1DARRAY */ -#line 3378 "MachineIndependent/glslang.y" + case 510: /* type_specifier_nonarray: I64IMAGE1DARRAY */ +#line 3403 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd1D, true); } -#line 10505 "MachineIndependent/glslang_tab.cpp" +#line 10561 "MachineIndependent/glslang_tab.cpp" break; - case 508: /* type_specifier_nonarray: U64IMAGE1DARRAY */ -#line 3383 "MachineIndependent/glslang.y" + case 511: /* type_specifier_nonarray: U64IMAGE1DARRAY */ +#line 3408 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd1D, true); } -#line 10515 "MachineIndependent/glslang_tab.cpp" +#line 10571 "MachineIndependent/glslang_tab.cpp" break; - case 509: /* type_specifier_nonarray: I64IMAGE2DARRAY */ -#line 3388 "MachineIndependent/glslang.y" + case 512: /* type_specifier_nonarray: I64IMAGE2DARRAY */ +#line 3413 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd2D, true); } -#line 10525 "MachineIndependent/glslang_tab.cpp" +#line 10581 "MachineIndependent/glslang_tab.cpp" break; - case 510: /* type_specifier_nonarray: U64IMAGE2DARRAY */ -#line 3393 "MachineIndependent/glslang.y" + case 513: /* type_specifier_nonarray: U64IMAGE2DARRAY */ +#line 3418 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd2D, true); } -#line 10535 "MachineIndependent/glslang_tab.cpp" +#line 10591 "MachineIndependent/glslang_tab.cpp" break; - case 511: /* type_specifier_nonarray: I64IMAGECUBEARRAY */ -#line 3398 "MachineIndependent/glslang.y" + case 514: /* type_specifier_nonarray: I64IMAGECUBEARRAY */ +#line 3423 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, EsdCube, true); } -#line 10545 "MachineIndependent/glslang_tab.cpp" +#line 10601 "MachineIndependent/glslang_tab.cpp" break; - case 512: /* type_specifier_nonarray: U64IMAGECUBEARRAY */ -#line 3403 "MachineIndependent/glslang.y" + case 515: /* type_specifier_nonarray: U64IMAGECUBEARRAY */ +#line 3428 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, EsdCube, true); } -#line 10555 "MachineIndependent/glslang_tab.cpp" +#line 10611 "MachineIndependent/glslang_tab.cpp" break; - case 513: /* type_specifier_nonarray: I64IMAGE2DMS */ -#line 3408 "MachineIndependent/glslang.y" + case 516: /* type_specifier_nonarray: I64IMAGE2DMS */ +#line 3433 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd2D, false, false, true); } -#line 10565 "MachineIndependent/glslang_tab.cpp" +#line 10621 "MachineIndependent/glslang_tab.cpp" break; - case 514: /* type_specifier_nonarray: U64IMAGE2DMS */ -#line 3413 "MachineIndependent/glslang.y" + case 517: /* type_specifier_nonarray: U64IMAGE2DMS */ +#line 3438 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd2D, false, false, true); } -#line 10575 "MachineIndependent/glslang_tab.cpp" +#line 10631 "MachineIndependent/glslang_tab.cpp" break; - case 515: /* type_specifier_nonarray: I64IMAGE2DMSARRAY */ -#line 3418 "MachineIndependent/glslang.y" + case 518: /* type_specifier_nonarray: I64IMAGE2DMSARRAY */ +#line 3443 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt64, Esd2D, true, false, true); } -#line 10585 "MachineIndependent/glslang_tab.cpp" +#line 10641 "MachineIndependent/glslang_tab.cpp" break; - case 516: /* type_specifier_nonarray: U64IMAGE2DMSARRAY */ -#line 3423 "MachineIndependent/glslang.y" + case 519: /* type_specifier_nonarray: U64IMAGE2DMSARRAY */ +#line 3448 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint64, Esd2D, true, false, true); } -#line 10595 "MachineIndependent/glslang_tab.cpp" +#line 10651 "MachineIndependent/glslang_tab.cpp" break; - case 517: /* type_specifier_nonarray: SAMPLEREXTERNALOES */ -#line 3428 "MachineIndependent/glslang.y" + case 520: /* type_specifier_nonarray: SAMPLEREXTERNALOES */ +#line 3453 "MachineIndependent/glslang.y" { // GL_OES_EGL_image_external (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); (yyval.interm.type).sampler.external = true; } -#line 10606 "MachineIndependent/glslang_tab.cpp" +#line 10662 "MachineIndependent/glslang_tab.cpp" break; - case 518: /* type_specifier_nonarray: SAMPLEREXTERNAL2DY2YEXT */ -#line 3434 "MachineIndependent/glslang.y" + case 521: /* type_specifier_nonarray: SAMPLEREXTERNAL2DY2YEXT */ +#line 3459 "MachineIndependent/glslang.y" { // GL_EXT_YUV_target (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); (yyval.interm.type).sampler.yuv = true; } -#line 10617 "MachineIndependent/glslang_tab.cpp" +#line 10673 "MachineIndependent/glslang_tab.cpp" + break; + + case 522: /* type_specifier_nonarray: ATTACHMENTEXT */ +#line 3465 "MachineIndependent/glslang.y" + { + parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "attachmentEXT input"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setAttachmentEXT(EbtFloat); + } +#line 10684 "MachineIndependent/glslang_tab.cpp" + break; + + case 523: /* type_specifier_nonarray: IATTACHMENTEXT */ +#line 3471 "MachineIndependent/glslang.y" + { + parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "attachmentEXT input"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setAttachmentEXT(EbtInt); + } +#line 10695 "MachineIndependent/glslang_tab.cpp" break; - case 519: /* type_specifier_nonarray: SUBPASSINPUT */ -#line 3440 "MachineIndependent/glslang.y" + case 524: /* type_specifier_nonarray: UATTACHMENTEXT */ +#line 3477 "MachineIndependent/glslang.y" + { + parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "attachmentEXT input"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setAttachmentEXT(EbtUint); + } +#line 10706 "MachineIndependent/glslang_tab.cpp" + break; + + case 525: /* type_specifier_nonarray: SUBPASSINPUT */ +#line 3483 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat); } -#line 10628 "MachineIndependent/glslang_tab.cpp" +#line 10717 "MachineIndependent/glslang_tab.cpp" break; - case 520: /* type_specifier_nonarray: SUBPASSINPUTMS */ -#line 3446 "MachineIndependent/glslang.y" + case 526: /* type_specifier_nonarray: SUBPASSINPUTMS */ +#line 3489 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat, true); } -#line 10639 "MachineIndependent/glslang_tab.cpp" +#line 10728 "MachineIndependent/glslang_tab.cpp" break; - case 521: /* type_specifier_nonarray: F16SUBPASSINPUT */ -#line 3452 "MachineIndependent/glslang.y" + case 527: /* type_specifier_nonarray: F16SUBPASSINPUT */ +#line 3495 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); @@ -10647,11 +10736,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat16); } -#line 10651 "MachineIndependent/glslang_tab.cpp" +#line 10740 "MachineIndependent/glslang_tab.cpp" break; - case 522: /* type_specifier_nonarray: F16SUBPASSINPUTMS */ -#line 3459 "MachineIndependent/glslang.y" + case 528: /* type_specifier_nonarray: F16SUBPASSINPUTMS */ +#line 3502 "MachineIndependent/glslang.y" { parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); @@ -10659,107 +10748,131 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat16, true); } -#line 10663 "MachineIndependent/glslang_tab.cpp" +#line 10752 "MachineIndependent/glslang_tab.cpp" break; - case 523: /* type_specifier_nonarray: ISUBPASSINPUT */ -#line 3466 "MachineIndependent/glslang.y" + case 529: /* type_specifier_nonarray: ISUBPASSINPUT */ +#line 3509 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtInt); } -#line 10674 "MachineIndependent/glslang_tab.cpp" +#line 10763 "MachineIndependent/glslang_tab.cpp" break; - case 524: /* type_specifier_nonarray: ISUBPASSINPUTMS */ -#line 3472 "MachineIndependent/glslang.y" + case 530: /* type_specifier_nonarray: ISUBPASSINPUTMS */ +#line 3515 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtInt, true); } -#line 10685 "MachineIndependent/glslang_tab.cpp" +#line 10774 "MachineIndependent/glslang_tab.cpp" break; - case 525: /* type_specifier_nonarray: USUBPASSINPUT */ -#line 3478 "MachineIndependent/glslang.y" + case 531: /* type_specifier_nonarray: USUBPASSINPUT */ +#line 3521 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtUint); } -#line 10696 "MachineIndependent/glslang_tab.cpp" +#line 10785 "MachineIndependent/glslang_tab.cpp" break; - case 526: /* type_specifier_nonarray: USUBPASSINPUTMS */ -#line 3484 "MachineIndependent/glslang.y" + case 532: /* type_specifier_nonarray: USUBPASSINPUTMS */ +#line 3527 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtUint, true); } -#line 10707 "MachineIndependent/glslang_tab.cpp" +#line 10796 "MachineIndependent/glslang_tab.cpp" break; - case 527: /* type_specifier_nonarray: FCOOPMATNV */ -#line 3490 "MachineIndependent/glslang.y" + case 533: /* type_specifier_nonarray: FCOOPMATNV */ +#line 3533 "MachineIndependent/glslang.y" { - parseContext.fcoopmatCheck((yyvsp[0].lex).loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + parseContext.fcoopmatCheckNV((yyvsp[0].lex).loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).coopmat = true; + (yyval.interm.type).coopmatNV = true; + (yyval.interm.type).coopmatKHR = false; } -#line 10718 "MachineIndependent/glslang_tab.cpp" +#line 10808 "MachineIndependent/glslang_tab.cpp" break; - case 528: /* type_specifier_nonarray: ICOOPMATNV */ -#line 3496 "MachineIndependent/glslang.y" + case 534: /* type_specifier_nonarray: ICOOPMATNV */ +#line 3540 "MachineIndependent/glslang.y" { - parseContext.intcoopmatCheck((yyvsp[0].lex).loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + parseContext.intcoopmatCheckNV((yyvsp[0].lex).loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).coopmat = true; + (yyval.interm.type).coopmatNV = true; + (yyval.interm.type).coopmatKHR = false; } -#line 10729 "MachineIndependent/glslang_tab.cpp" +#line 10820 "MachineIndependent/glslang_tab.cpp" break; - case 529: /* type_specifier_nonarray: UCOOPMATNV */ -#line 3502 "MachineIndependent/glslang.y" + case 535: /* type_specifier_nonarray: UCOOPMATNV */ +#line 3547 "MachineIndependent/glslang.y" { - parseContext.intcoopmatCheck((yyvsp[0].lex).loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + parseContext.intcoopmatCheckNV((yyvsp[0].lex).loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).coopmat = true; + (yyval.interm.type).coopmatNV = true; + (yyval.interm.type).coopmatKHR = false; } -#line 10740 "MachineIndependent/glslang_tab.cpp" +#line 10832 "MachineIndependent/glslang_tab.cpp" + break; + + case 536: /* type_specifier_nonarray: COOPMAT */ +#line 3554 "MachineIndependent/glslang.y" + { + parseContext.coopmatCheck((yyvsp[0].lex).loc, "coopmat", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtCoopmat; + (yyval.interm.type).coopmatNV = false; + (yyval.interm.type).coopmatKHR = true; + } +#line 10844 "MachineIndependent/glslang_tab.cpp" break; - case 530: /* type_specifier_nonarray: spirv_type_specifier */ -#line 3508 "MachineIndependent/glslang.y" + case 537: /* type_specifier_nonarray: spirv_type_specifier */ +#line 3561 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].interm.type).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier"); (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 10749 "MachineIndependent/glslang_tab.cpp" +#line 10853 "MachineIndependent/glslang_tab.cpp" + break; + + case 538: /* type_specifier_nonarray: HITOBJECTNV */ +#line 3565 "MachineIndependent/glslang.y" + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtHitObjectNV; + } +#line 10862 "MachineIndependent/glslang_tab.cpp" break; - case 531: /* type_specifier_nonarray: struct_specifier */ -#line 3513 "MachineIndependent/glslang.y" + case 539: /* type_specifier_nonarray: struct_specifier */ +#line 3570 "MachineIndependent/glslang.y" { (yyval.interm.type) = (yyvsp[0].interm.type); (yyval.interm.type).qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; parseContext.structTypeCheck((yyval.interm.type).loc, (yyval.interm.type)); } -#line 10759 "MachineIndependent/glslang_tab.cpp" +#line 10872 "MachineIndependent/glslang_tab.cpp" break; - case 532: /* type_specifier_nonarray: TYPE_NAME */ -#line 3518 "MachineIndependent/glslang.y" + case 540: /* type_specifier_nonarray: TYPE_NAME */ +#line 3575 "MachineIndependent/glslang.y" { // // This is for user defined type names. The lexical phase looked up the @@ -10773,47 +10886,47 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } else parseContext.error((yyvsp[0].lex).loc, "expected type name", (yyvsp[0].lex).string->c_str(), ""); } -#line 10777 "MachineIndependent/glslang_tab.cpp" +#line 10890 "MachineIndependent/glslang_tab.cpp" break; - case 533: /* precision_qualifier: HIGH_PRECISION */ -#line 3534 "MachineIndependent/glslang.y" + case 541: /* precision_qualifier: HIGH_PRECISION */ +#line 3591 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "highp precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqHigh); } -#line 10787 "MachineIndependent/glslang_tab.cpp" +#line 10900 "MachineIndependent/glslang_tab.cpp" break; - case 534: /* precision_qualifier: MEDIUM_PRECISION */ -#line 3539 "MachineIndependent/glslang.y" + case 542: /* precision_qualifier: MEDIUM_PRECISION */ +#line 3596 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "mediump precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqMedium); } -#line 10797 "MachineIndependent/glslang_tab.cpp" +#line 10910 "MachineIndependent/glslang_tab.cpp" break; - case 535: /* precision_qualifier: LOW_PRECISION */ -#line 3544 "MachineIndependent/glslang.y" + case 543: /* precision_qualifier: LOW_PRECISION */ +#line 3601 "MachineIndependent/glslang.y" { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "lowp precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqLow); } -#line 10807 "MachineIndependent/glslang_tab.cpp" +#line 10920 "MachineIndependent/glslang_tab.cpp" break; - case 536: /* $@3: %empty */ -#line 3552 "MachineIndependent/glslang.y" + case 544: /* $@3: %empty */ +#line 3609 "MachineIndependent/glslang.y" { parseContext.nestedStructCheck((yyvsp[-2].lex).loc); } -#line 10813 "MachineIndependent/glslang_tab.cpp" +#line 10926 "MachineIndependent/glslang_tab.cpp" break; - case 537: /* struct_specifier: STRUCT IDENTIFIER LEFT_BRACE $@3 struct_declaration_list RIGHT_BRACE */ -#line 3552 "MachineIndependent/glslang.y" + case 545: /* struct_specifier: STRUCT IDENTIFIER LEFT_BRACE $@3 struct_declaration_list RIGHT_BRACE */ +#line 3609 "MachineIndependent/glslang.y" { TType* structure = new TType((yyvsp[-1].interm.typeList), *(yyvsp[-4].lex).string); parseContext.structArrayCheck((yyvsp[-4].lex).loc, *structure); @@ -10825,17 +10938,17 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 10829 "MachineIndependent/glslang_tab.cpp" +#line 10942 "MachineIndependent/glslang_tab.cpp" break; - case 538: /* $@4: %empty */ -#line 3563 "MachineIndependent/glslang.y" + case 546: /* $@4: %empty */ +#line 3620 "MachineIndependent/glslang.y" { parseContext.nestedStructCheck((yyvsp[-1].lex).loc); } -#line 10835 "MachineIndependent/glslang_tab.cpp" +#line 10948 "MachineIndependent/glslang_tab.cpp" break; - case 539: /* struct_specifier: STRUCT LEFT_BRACE $@4 struct_declaration_list RIGHT_BRACE */ -#line 3563 "MachineIndependent/glslang.y" + case 547: /* struct_specifier: STRUCT LEFT_BRACE $@4 struct_declaration_list RIGHT_BRACE */ +#line 3620 "MachineIndependent/glslang.y" { TType* structure = new TType((yyvsp[-1].interm.typeList), TString("")); (yyval.interm.type).init((yyvsp[-4].lex).loc); @@ -10843,19 +10956,19 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 10847 "MachineIndependent/glslang_tab.cpp" +#line 10960 "MachineIndependent/glslang_tab.cpp" break; - case 540: /* struct_declaration_list: struct_declaration */ -#line 3573 "MachineIndependent/glslang.y" + case 548: /* struct_declaration_list: struct_declaration */ +#line 3630 "MachineIndependent/glslang.y" { (yyval.interm.typeList) = (yyvsp[0].interm.typeList); } -#line 10855 "MachineIndependent/glslang_tab.cpp" +#line 10968 "MachineIndependent/glslang_tab.cpp" break; - case 541: /* struct_declaration_list: struct_declaration_list struct_declaration */ -#line 3576 "MachineIndependent/glslang.y" + case 549: /* struct_declaration_list: struct_declaration_list struct_declaration */ +#line 3633 "MachineIndependent/glslang.y" { (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); for (unsigned int i = 0; i < (yyvsp[0].interm.typeList)->size(); ++i) { @@ -10866,11 +10979,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.typeList)->push_back((*(yyvsp[0].interm.typeList))[i]); } } -#line 10870 "MachineIndependent/glslang_tab.cpp" +#line 10983 "MachineIndependent/glslang_tab.cpp" break; - case 542: /* struct_declaration: type_specifier struct_declarator_list SEMICOLON */ -#line 3589 "MachineIndependent/glslang.y" + case 550: /* struct_declaration: type_specifier struct_declarator_list SEMICOLON */ +#line 3646 "MachineIndependent/glslang.y" { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -10882,7 +10995,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); parseContext.voidErrorCheck((yyvsp[-2].interm.type).loc, (*(yyvsp[-1].interm.typeList))[0].type->getFieldName(), (yyvsp[-2].interm.type).basicType); - parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier); + parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier, (yyvsp[-2].interm.type).isCoopmat()); for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { TType type((yyvsp[-2].interm.type)); @@ -10893,11 +11006,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (*(yyval.interm.typeList))[i].type->shallowCopy(type); } } -#line 10897 "MachineIndependent/glslang_tab.cpp" +#line 11010 "MachineIndependent/glslang_tab.cpp" break; - case 543: /* struct_declaration: type_qualifier type_specifier struct_declarator_list SEMICOLON */ -#line 3611 "MachineIndependent/glslang.y" + case 551: /* struct_declaration: type_qualifier type_specifier struct_declarator_list SEMICOLON */ +#line 3668 "MachineIndependent/glslang.y" { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -10911,7 +11024,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.memberQualifierCheck((yyvsp[-3].interm.type)); parseContext.voidErrorCheck((yyvsp[-2].interm.type).loc, (*(yyvsp[-1].interm.typeList))[0].type->getFieldName(), (yyvsp[-2].interm.type).basicType); parseContext.mergeQualifiers((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, (yyvsp[-3].interm.type).qualifier, true); - parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier); + parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier, (yyvsp[-2].interm.type).isCoopmat()); for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { TType type((yyvsp[-2].interm.type)); @@ -10922,38 +11035,38 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (*(yyval.interm.typeList))[i].type->shallowCopy(type); } } -#line 10926 "MachineIndependent/glslang_tab.cpp" +#line 11039 "MachineIndependent/glslang_tab.cpp" break; - case 544: /* struct_declarator_list: struct_declarator */ -#line 3638 "MachineIndependent/glslang.y" + case 552: /* struct_declarator_list: struct_declarator */ +#line 3695 "MachineIndependent/glslang.y" { (yyval.interm.typeList) = new TTypeList; (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 10935 "MachineIndependent/glslang_tab.cpp" +#line 11048 "MachineIndependent/glslang_tab.cpp" break; - case 545: /* struct_declarator_list: struct_declarator_list COMMA struct_declarator */ -#line 3642 "MachineIndependent/glslang.y" + case 553: /* struct_declarator_list: struct_declarator_list COMMA struct_declarator */ +#line 3699 "MachineIndependent/glslang.y" { (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 10943 "MachineIndependent/glslang_tab.cpp" +#line 11056 "MachineIndependent/glslang_tab.cpp" break; - case 546: /* struct_declarator: IDENTIFIER */ -#line 3648 "MachineIndependent/glslang.y" + case 554: /* struct_declarator: IDENTIFIER */ +#line 3705 "MachineIndependent/glslang.y" { (yyval.interm.typeLine).type = new TType(EbtVoid); (yyval.interm.typeLine).loc = (yyvsp[0].lex).loc; (yyval.interm.typeLine).type->setFieldName(*(yyvsp[0].lex).string); } -#line 10953 "MachineIndependent/glslang_tab.cpp" +#line 11066 "MachineIndependent/glslang_tab.cpp" break; - case 547: /* struct_declarator: IDENTIFIER array_specifier */ -#line 3653 "MachineIndependent/glslang.y" + case 555: /* struct_declarator: IDENTIFIER array_specifier */ +#line 3710 "MachineIndependent/glslang.y" { parseContext.arrayOfArrayVersionCheck((yyvsp[-1].lex).loc, (yyvsp[0].interm).arraySizes); @@ -10962,246 +11075,246 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.typeLine).type->setFieldName(*(yyvsp[-1].lex).string); (yyval.interm.typeLine).type->transferArraySizes((yyvsp[0].interm).arraySizes); } -#line 10966 "MachineIndependent/glslang_tab.cpp" +#line 11079 "MachineIndependent/glslang_tab.cpp" break; - case 548: /* initializer: assignment_expression */ -#line 3664 "MachineIndependent/glslang.y" + case 556: /* initializer: assignment_expression */ +#line 3721 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 10974 "MachineIndependent/glslang_tab.cpp" +#line 11087 "MachineIndependent/glslang_tab.cpp" break; - case 549: /* initializer: LEFT_BRACE initializer_list RIGHT_BRACE */ -#line 3668 "MachineIndependent/glslang.y" + case 557: /* initializer: LEFT_BRACE initializer_list RIGHT_BRACE */ +#line 3725 "MachineIndependent/glslang.y" { const char* initFeature = "{ } style initializers"; parseContext.requireProfile((yyvsp[-2].lex).loc, ~EEsProfile, initFeature); parseContext.profileRequires((yyvsp[-2].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); } -#line 10985 "MachineIndependent/glslang_tab.cpp" +#line 11098 "MachineIndependent/glslang_tab.cpp" break; - case 550: /* initializer: LEFT_BRACE initializer_list COMMA RIGHT_BRACE */ -#line 3674 "MachineIndependent/glslang.y" + case 558: /* initializer: LEFT_BRACE initializer_list COMMA RIGHT_BRACE */ +#line 3731 "MachineIndependent/glslang.y" { const char* initFeature = "{ } style initializers"; parseContext.requireProfile((yyvsp[-3].lex).loc, ~EEsProfile, initFeature); parseContext.profileRequires((yyvsp[-3].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 10996 "MachineIndependent/glslang_tab.cpp" +#line 11109 "MachineIndependent/glslang_tab.cpp" break; - case 551: /* initializer: LEFT_BRACE RIGHT_BRACE */ -#line 3680 "MachineIndependent/glslang.y" + case 559: /* initializer: LEFT_BRACE RIGHT_BRACE */ +#line 3737 "MachineIndependent/glslang.y" { const char* initFeature = "empty { } initializer"; parseContext.profileRequires((yyvsp[-1].lex).loc, EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); parseContext.profileRequires((yyvsp[-1].lex).loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); (yyval.interm.intermTypedNode) = parseContext.intermediate.makeAggregate((yyvsp[-1].lex).loc); } -#line 11007 "MachineIndependent/glslang_tab.cpp" +#line 11120 "MachineIndependent/glslang_tab.cpp" break; - case 552: /* initializer_list: initializer */ -#line 3691 "MachineIndependent/glslang.y" + case 560: /* initializer_list: initializer */ +#line 3748 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); } -#line 11015 "MachineIndependent/glslang_tab.cpp" +#line 11128 "MachineIndependent/glslang_tab.cpp" break; - case 553: /* initializer_list: initializer_list COMMA initializer */ -#line 3694 "MachineIndependent/glslang.y" + case 561: /* initializer_list: initializer_list COMMA initializer */ +#line 3751 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); } -#line 11023 "MachineIndependent/glslang_tab.cpp" +#line 11136 "MachineIndependent/glslang_tab.cpp" break; - case 554: /* declaration_statement: declaration */ -#line 3701 "MachineIndependent/glslang.y" + case 562: /* declaration_statement: declaration */ +#line 3758 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11029 "MachineIndependent/glslang_tab.cpp" +#line 11142 "MachineIndependent/glslang_tab.cpp" break; - case 555: /* statement: compound_statement */ -#line 3705 "MachineIndependent/glslang.y" + case 563: /* statement: compound_statement */ +#line 3762 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11035 "MachineIndependent/glslang_tab.cpp" +#line 11148 "MachineIndependent/glslang_tab.cpp" break; - case 556: /* statement: simple_statement */ -#line 3706 "MachineIndependent/glslang.y" + case 564: /* statement: simple_statement */ +#line 3763 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11041 "MachineIndependent/glslang_tab.cpp" +#line 11154 "MachineIndependent/glslang_tab.cpp" break; - case 557: /* simple_statement: declaration_statement */ -#line 3712 "MachineIndependent/glslang.y" + case 565: /* simple_statement: declaration_statement */ +#line 3769 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11047 "MachineIndependent/glslang_tab.cpp" +#line 11160 "MachineIndependent/glslang_tab.cpp" break; - case 558: /* simple_statement: expression_statement */ -#line 3713 "MachineIndependent/glslang.y" + case 566: /* simple_statement: expression_statement */ +#line 3770 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11053 "MachineIndependent/glslang_tab.cpp" +#line 11166 "MachineIndependent/glslang_tab.cpp" break; - case 559: /* simple_statement: selection_statement */ -#line 3714 "MachineIndependent/glslang.y" + case 567: /* simple_statement: selection_statement */ +#line 3771 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11059 "MachineIndependent/glslang_tab.cpp" +#line 11172 "MachineIndependent/glslang_tab.cpp" break; - case 560: /* simple_statement: switch_statement */ -#line 3715 "MachineIndependent/glslang.y" + case 568: /* simple_statement: switch_statement */ +#line 3772 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11065 "MachineIndependent/glslang_tab.cpp" +#line 11178 "MachineIndependent/glslang_tab.cpp" break; - case 561: /* simple_statement: case_label */ -#line 3716 "MachineIndependent/glslang.y" + case 569: /* simple_statement: case_label */ +#line 3773 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11071 "MachineIndependent/glslang_tab.cpp" +#line 11184 "MachineIndependent/glslang_tab.cpp" break; - case 562: /* simple_statement: iteration_statement */ -#line 3717 "MachineIndependent/glslang.y" + case 570: /* simple_statement: iteration_statement */ +#line 3774 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11077 "MachineIndependent/glslang_tab.cpp" +#line 11190 "MachineIndependent/glslang_tab.cpp" break; - case 563: /* simple_statement: jump_statement */ -#line 3718 "MachineIndependent/glslang.y" + case 571: /* simple_statement: jump_statement */ +#line 3775 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11083 "MachineIndependent/glslang_tab.cpp" +#line 11196 "MachineIndependent/glslang_tab.cpp" break; - case 564: /* simple_statement: demote_statement */ -#line 3720 "MachineIndependent/glslang.y" + case 572: /* simple_statement: demote_statement */ +#line 3777 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11089 "MachineIndependent/glslang_tab.cpp" +#line 11202 "MachineIndependent/glslang_tab.cpp" break; - case 565: /* demote_statement: DEMOTE SEMICOLON */ -#line 3726 "MachineIndependent/glslang.y" + case 573: /* demote_statement: DEMOTE SEMICOLON */ +#line 3783 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "demote"); parseContext.requireExtensions((yyvsp[-1].lex).loc, 1, &E_GL_EXT_demote_to_helper_invocation, "demote"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDemote, (yyvsp[-1].lex).loc); } -#line 11099 "MachineIndependent/glslang_tab.cpp" +#line 11212 "MachineIndependent/glslang_tab.cpp" break; - case 566: /* compound_statement: LEFT_BRACE RIGHT_BRACE */ -#line 3735 "MachineIndependent/glslang.y" + case 574: /* compound_statement: LEFT_BRACE RIGHT_BRACE */ +#line 3792 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; } -#line 11105 "MachineIndependent/glslang_tab.cpp" +#line 11218 "MachineIndependent/glslang_tab.cpp" break; - case 567: /* $@5: %empty */ -#line 3736 "MachineIndependent/glslang.y" + case 575: /* $@5: %empty */ +#line 3793 "MachineIndependent/glslang.y" { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; } -#line 11114 "MachineIndependent/glslang_tab.cpp" +#line 11227 "MachineIndependent/glslang_tab.cpp" break; - case 568: /* $@6: %empty */ -#line 3740 "MachineIndependent/glslang.y" + case 576: /* $@6: %empty */ +#line 3797 "MachineIndependent/glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; } -#line 11123 "MachineIndependent/glslang_tab.cpp" +#line 11236 "MachineIndependent/glslang_tab.cpp" break; - case 569: /* compound_statement: LEFT_BRACE $@5 statement_list $@6 RIGHT_BRACE */ -#line 3744 "MachineIndependent/glslang.y" + case 577: /* compound_statement: LEFT_BRACE $@5 statement_list $@6 RIGHT_BRACE */ +#line 3801 "MachineIndependent/glslang.y" { if ((yyvsp[-2].interm.intermNode) && (yyvsp[-2].interm.intermNode)->getAsAggregate()) (yyvsp[-2].interm.intermNode)->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence); (yyval.interm.intermNode) = (yyvsp[-2].interm.intermNode); } -#line 11133 "MachineIndependent/glslang_tab.cpp" +#line 11246 "MachineIndependent/glslang_tab.cpp" break; - case 570: /* statement_no_new_scope: compound_statement_no_new_scope */ -#line 3752 "MachineIndependent/glslang.y" + case 578: /* statement_no_new_scope: compound_statement_no_new_scope */ +#line 3809 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11139 "MachineIndependent/glslang_tab.cpp" +#line 11252 "MachineIndependent/glslang_tab.cpp" break; - case 571: /* statement_no_new_scope: simple_statement */ -#line 3753 "MachineIndependent/glslang.y" + case 579: /* statement_no_new_scope: simple_statement */ +#line 3810 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11145 "MachineIndependent/glslang_tab.cpp" +#line 11258 "MachineIndependent/glslang_tab.cpp" break; - case 572: /* $@7: %empty */ -#line 3757 "MachineIndependent/glslang.y" + case 580: /* $@7: %empty */ +#line 3814 "MachineIndependent/glslang.y" { ++parseContext.controlFlowNestingLevel; } -#line 11153 "MachineIndependent/glslang_tab.cpp" +#line 11266 "MachineIndependent/glslang_tab.cpp" break; - case 573: /* statement_scoped: $@7 compound_statement */ -#line 3760 "MachineIndependent/glslang.y" + case 581: /* statement_scoped: $@7 compound_statement */ +#line 3817 "MachineIndependent/glslang.y" { --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11162 "MachineIndependent/glslang_tab.cpp" +#line 11275 "MachineIndependent/glslang_tab.cpp" break; - case 574: /* $@8: %empty */ -#line 3764 "MachineIndependent/glslang.y" + case 582: /* $@8: %empty */ +#line 3821 "MachineIndependent/glslang.y" { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 11172 "MachineIndependent/glslang_tab.cpp" +#line 11285 "MachineIndependent/glslang_tab.cpp" break; - case 575: /* statement_scoped: $@8 simple_statement */ -#line 3769 "MachineIndependent/glslang.y" + case 583: /* statement_scoped: $@8 simple_statement */ +#line 3826 "MachineIndependent/glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11183 "MachineIndependent/glslang_tab.cpp" +#line 11296 "MachineIndependent/glslang_tab.cpp" break; - case 576: /* compound_statement_no_new_scope: LEFT_BRACE RIGHT_BRACE */ -#line 3778 "MachineIndependent/glslang.y" + case 584: /* compound_statement_no_new_scope: LEFT_BRACE RIGHT_BRACE */ +#line 3835 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; } -#line 11191 "MachineIndependent/glslang_tab.cpp" +#line 11304 "MachineIndependent/glslang_tab.cpp" break; - case 577: /* compound_statement_no_new_scope: LEFT_BRACE statement_list RIGHT_BRACE */ -#line 3781 "MachineIndependent/glslang.y" + case 585: /* compound_statement_no_new_scope: LEFT_BRACE statement_list RIGHT_BRACE */ +#line 3838 "MachineIndependent/glslang.y" { if ((yyvsp[-1].interm.intermNode) && (yyvsp[-1].interm.intermNode)->getAsAggregate()) (yyvsp[-1].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); (yyval.interm.intermNode) = (yyvsp[-1].interm.intermNode); } -#line 11201 "MachineIndependent/glslang_tab.cpp" +#line 11314 "MachineIndependent/glslang_tab.cpp" break; - case 578: /* statement_list: statement */ -#line 3789 "MachineIndependent/glslang.y" + case 586: /* statement_list: statement */ +#line 3846 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || @@ -11210,11 +11323,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case } } -#line 11214 "MachineIndependent/glslang_tab.cpp" +#line 11327 "MachineIndependent/glslang_tab.cpp" break; - case 579: /* statement_list: statement_list statement */ -#line 3797 "MachineIndependent/glslang.y" + case 587: /* statement_list: statement_list statement */ +#line 3854 "MachineIndependent/glslang.y" { if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || (yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { @@ -11223,77 +11336,77 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } else (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 11227 "MachineIndependent/glslang_tab.cpp" +#line 11340 "MachineIndependent/glslang_tab.cpp" break; - case 580: /* expression_statement: SEMICOLON */ -#line 3808 "MachineIndependent/glslang.y" + case 588: /* expression_statement: SEMICOLON */ +#line 3865 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; } -#line 11233 "MachineIndependent/glslang_tab.cpp" +#line 11346 "MachineIndependent/glslang_tab.cpp" break; - case 581: /* expression_statement: expression SEMICOLON */ -#line 3809 "MachineIndependent/glslang.y" + case 589: /* expression_statement: expression SEMICOLON */ +#line 3866 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = static_cast((yyvsp[-1].interm.intermTypedNode)); } -#line 11239 "MachineIndependent/glslang_tab.cpp" +#line 11352 "MachineIndependent/glslang_tab.cpp" break; - case 582: /* selection_statement: selection_statement_nonattributed */ -#line 3813 "MachineIndependent/glslang.y" + case 590: /* selection_statement: selection_statement_nonattributed */ +#line 3870 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11247 "MachineIndependent/glslang_tab.cpp" +#line 11360 "MachineIndependent/glslang_tab.cpp" break; - case 583: /* selection_statement: attribute selection_statement_nonattributed */ -#line 3817 "MachineIndependent/glslang.y" + case 591: /* selection_statement: attribute selection_statement_nonattributed */ +#line 3874 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].interm.intermNode)->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.handleSelectionAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11257 "MachineIndependent/glslang_tab.cpp" +#line 11370 "MachineIndependent/glslang_tab.cpp" break; - case 584: /* selection_statement_nonattributed: IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement */ -#line 3825 "MachineIndependent/glslang.y" + case 592: /* selection_statement_nonattributed: IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement */ +#line 3882 "MachineIndependent/glslang.y" { parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-2].interm.intermTypedNode)); (yyval.interm.intermNode) = parseContext.intermediate.addSelection((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yyvsp[-4].lex).loc); } -#line 11266 "MachineIndependent/glslang_tab.cpp" +#line 11379 "MachineIndependent/glslang_tab.cpp" break; - case 585: /* selection_rest_statement: statement_scoped ELSE statement_scoped */ -#line 3832 "MachineIndependent/glslang.y" + case 593: /* selection_rest_statement: statement_scoped ELSE statement_scoped */ +#line 3889 "MachineIndependent/glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode); } -#line 11275 "MachineIndependent/glslang_tab.cpp" +#line 11388 "MachineIndependent/glslang_tab.cpp" break; - case 586: /* selection_rest_statement: statement_scoped */ -#line 3836 "MachineIndependent/glslang.y" + case 594: /* selection_rest_statement: statement_scoped */ +#line 3893 "MachineIndependent/glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode); (yyval.interm.nodePair).node2 = 0; } -#line 11284 "MachineIndependent/glslang_tab.cpp" +#line 11397 "MachineIndependent/glslang_tab.cpp" break; - case 587: /* condition: expression */ -#line 3844 "MachineIndependent/glslang.y" + case 595: /* condition: expression */ +#line 3901 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); parseContext.boolCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode)); } -#line 11293 "MachineIndependent/glslang_tab.cpp" +#line 11406 "MachineIndependent/glslang_tab.cpp" break; - case 588: /* condition: fully_specified_type IDENTIFIER EQUAL initializer */ -#line 3848 "MachineIndependent/glslang.y" + case 596: /* condition: fully_specified_type IDENTIFIER EQUAL initializer */ +#line 3905 "MachineIndependent/glslang.y" { parseContext.boolCheck((yyvsp[-2].lex).loc, (yyvsp[-3].interm.type)); @@ -11304,29 +11417,29 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); else (yyval.interm.intermTypedNode) = 0; } -#line 11308 "MachineIndependent/glslang_tab.cpp" +#line 11421 "MachineIndependent/glslang_tab.cpp" break; - case 589: /* switch_statement: switch_statement_nonattributed */ -#line 3861 "MachineIndependent/glslang.y" + case 597: /* switch_statement: switch_statement_nonattributed */ +#line 3918 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11316 "MachineIndependent/glslang_tab.cpp" +#line 11429 "MachineIndependent/glslang_tab.cpp" break; - case 590: /* switch_statement: attribute switch_statement_nonattributed */ -#line 3865 "MachineIndependent/glslang.y" + case 598: /* switch_statement: attribute switch_statement_nonattributed */ +#line 3922 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].interm.intermNode)->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.handleSwitchAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11326 "MachineIndependent/glslang_tab.cpp" +#line 11439 "MachineIndependent/glslang_tab.cpp" break; - case 591: /* $@9: %empty */ -#line 3873 "MachineIndependent/glslang.y" + case 599: /* $@9: %empty */ +#line 3930 "MachineIndependent/glslang.y" { // start new switch sequence on the switch stack ++parseContext.controlFlowNestingLevel; @@ -11335,11 +11448,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.switchLevel.push_back(parseContext.statementNestingLevel); parseContext.symbolTable.push(); } -#line 11339 "MachineIndependent/glslang_tab.cpp" +#line 11452 "MachineIndependent/glslang_tab.cpp" break; - case 592: /* switch_statement_nonattributed: SWITCH LEFT_PAREN expression RIGHT_PAREN $@9 LEFT_BRACE switch_statement_list RIGHT_BRACE */ -#line 3881 "MachineIndependent/glslang.y" + case 600: /* switch_statement_nonattributed: SWITCH LEFT_PAREN expression RIGHT_PAREN $@9 LEFT_BRACE switch_statement_list RIGHT_BRACE */ +#line 3938 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.addSwitch((yyvsp[-7].lex).loc, (yyvsp[-5].interm.intermTypedNode), (yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : 0); delete parseContext.switchSequenceStack.back(); @@ -11349,27 +11462,27 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 11353 "MachineIndependent/glslang_tab.cpp" +#line 11466 "MachineIndependent/glslang_tab.cpp" break; - case 593: /* switch_statement_list: %empty */ -#line 3893 "MachineIndependent/glslang.y" + case 601: /* switch_statement_list: %empty */ +#line 3950 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; } -#line 11361 "MachineIndependent/glslang_tab.cpp" +#line 11474 "MachineIndependent/glslang_tab.cpp" break; - case 594: /* switch_statement_list: statement_list */ -#line 3896 "MachineIndependent/glslang.y" + case 602: /* switch_statement_list: statement_list */ +#line 3953 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11369 "MachineIndependent/glslang_tab.cpp" +#line 11482 "MachineIndependent/glslang_tab.cpp" break; - case 595: /* case_label: CASE expression COLON */ -#line 3902 "MachineIndependent/glslang.y" + case 603: /* case_label: CASE expression COLON */ +#line 3959 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -11382,11 +11495,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpCase, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); } } -#line 11386 "MachineIndependent/glslang_tab.cpp" +#line 11499 "MachineIndependent/glslang_tab.cpp" break; - case 596: /* case_label: DEFAULT COLON */ -#line 3914 "MachineIndependent/glslang.y" + case 604: /* case_label: DEFAULT COLON */ +#line 3971 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -11396,29 +11509,29 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); else (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDefault, (yyvsp[-1].lex).loc); } -#line 11400 "MachineIndependent/glslang_tab.cpp" +#line 11513 "MachineIndependent/glslang_tab.cpp" break; - case 597: /* iteration_statement: iteration_statement_nonattributed */ -#line 3926 "MachineIndependent/glslang.y" + case 605: /* iteration_statement: iteration_statement_nonattributed */ +#line 3983 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11408 "MachineIndependent/glslang_tab.cpp" +#line 11521 "MachineIndependent/glslang_tab.cpp" break; - case 598: /* iteration_statement: attribute iteration_statement_nonattributed */ -#line 3930 "MachineIndependent/glslang.y" + case 606: /* iteration_statement: attribute iteration_statement_nonattributed */ +#line 3987 "MachineIndependent/glslang.y" { parseContext.requireExtensions((yyvsp[0].interm.intermNode)->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.handleLoopAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11418 "MachineIndependent/glslang_tab.cpp" +#line 11531 "MachineIndependent/glslang_tab.cpp" break; - case 599: /* $@10: %empty */ -#line 3938 "MachineIndependent/glslang.y" + case 607: /* $@10: %empty */ +#line 3995 "MachineIndependent/glslang.y" { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-1].lex).loc, "while loops not available", "limitation", ""); @@ -11427,11 +11540,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 11431 "MachineIndependent/glslang_tab.cpp" +#line 11544 "MachineIndependent/glslang_tab.cpp" break; - case 600: /* iteration_statement_nonattributed: WHILE LEFT_PAREN $@10 condition RIGHT_PAREN statement_no_new_scope */ -#line 3946 "MachineIndependent/glslang.y" + case 608: /* iteration_statement_nonattributed: WHILE LEFT_PAREN $@10 condition RIGHT_PAREN statement_no_new_scope */ +#line 4003 "MachineIndependent/glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, true, (yyvsp[-5].lex).loc); @@ -11439,22 +11552,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 11443 "MachineIndependent/glslang_tab.cpp" +#line 11556 "MachineIndependent/glslang_tab.cpp" break; - case 601: /* $@11: %empty */ -#line 3953 "MachineIndependent/glslang.y" + case 609: /* $@11: %empty */ +#line 4010 "MachineIndependent/glslang.y" { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 11454 "MachineIndependent/glslang_tab.cpp" +#line 11567 "MachineIndependent/glslang_tab.cpp" break; - case 602: /* iteration_statement_nonattributed: DO $@11 statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON */ -#line 3959 "MachineIndependent/glslang.y" + case 610: /* iteration_statement_nonattributed: DO $@11 statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON */ +#line 4016 "MachineIndependent/glslang.y" { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-7].lex).loc, "do-while loops not available", "limitation", ""); @@ -11467,22 +11580,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 11471 "MachineIndependent/glslang_tab.cpp" +#line 11584 "MachineIndependent/glslang_tab.cpp" break; - case 603: /* $@12: %empty */ -#line 3971 "MachineIndependent/glslang.y" + case 611: /* $@12: %empty */ +#line 4028 "MachineIndependent/glslang.y" { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 11482 "MachineIndependent/glslang_tab.cpp" +#line 11595 "MachineIndependent/glslang_tab.cpp" break; - case 604: /* iteration_statement_nonattributed: FOR LEFT_PAREN $@12 for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope */ -#line 3977 "MachineIndependent/glslang.y" + case 612: /* iteration_statement_nonattributed: FOR LEFT_PAREN $@12 for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope */ +#line 4034 "MachineIndependent/glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[-3].interm.intermNode), (yyvsp[-5].lex).loc); @@ -11495,81 +11608,81 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 11499 "MachineIndependent/glslang_tab.cpp" +#line 11612 "MachineIndependent/glslang_tab.cpp" break; - case 605: /* for_init_statement: expression_statement */ -#line 3992 "MachineIndependent/glslang.y" + case 613: /* for_init_statement: expression_statement */ +#line 4049 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11507 "MachineIndependent/glslang_tab.cpp" +#line 11620 "MachineIndependent/glslang_tab.cpp" break; - case 606: /* for_init_statement: declaration_statement */ -#line 3995 "MachineIndependent/glslang.y" + case 614: /* for_init_statement: declaration_statement */ +#line 4052 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11515 "MachineIndependent/glslang_tab.cpp" +#line 11628 "MachineIndependent/glslang_tab.cpp" break; - case 607: /* conditionopt: condition */ -#line 4001 "MachineIndependent/glslang.y" + case 615: /* conditionopt: condition */ +#line 4058 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 11523 "MachineIndependent/glslang_tab.cpp" +#line 11636 "MachineIndependent/glslang_tab.cpp" break; - case 608: /* conditionopt: %empty */ -#line 4004 "MachineIndependent/glslang.y" + case 616: /* conditionopt: %empty */ +#line 4061 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = 0; } -#line 11531 "MachineIndependent/glslang_tab.cpp" +#line 11644 "MachineIndependent/glslang_tab.cpp" break; - case 609: /* for_rest_statement: conditionopt SEMICOLON */ -#line 4010 "MachineIndependent/glslang.y" + case 617: /* for_rest_statement: conditionopt SEMICOLON */ +#line 4067 "MachineIndependent/glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode); (yyval.interm.nodePair).node2 = 0; } -#line 11540 "MachineIndependent/glslang_tab.cpp" +#line 11653 "MachineIndependent/glslang_tab.cpp" break; - case 610: /* for_rest_statement: conditionopt SEMICOLON expression */ -#line 4014 "MachineIndependent/glslang.y" + case 618: /* for_rest_statement: conditionopt SEMICOLON expression */ +#line 4071 "MachineIndependent/glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode); } -#line 11549 "MachineIndependent/glslang_tab.cpp" +#line 11662 "MachineIndependent/glslang_tab.cpp" break; - case 611: /* jump_statement: CONTINUE SEMICOLON */ -#line 4021 "MachineIndependent/glslang.y" + case 619: /* jump_statement: CONTINUE SEMICOLON */ +#line 4078 "MachineIndependent/glslang.y" { if (parseContext.loopNestingLevel <= 0) parseContext.error((yyvsp[-1].lex).loc, "continue statement only allowed in loops", "", ""); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpContinue, (yyvsp[-1].lex).loc); } -#line 11559 "MachineIndependent/glslang_tab.cpp" +#line 11672 "MachineIndependent/glslang_tab.cpp" break; - case 612: /* jump_statement: BREAK SEMICOLON */ -#line 4026 "MachineIndependent/glslang.y" + case 620: /* jump_statement: BREAK SEMICOLON */ +#line 4083 "MachineIndependent/glslang.y" { if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0) parseContext.error((yyvsp[-1].lex).loc, "break statement only allowed in switch and loops", "", ""); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpBreak, (yyvsp[-1].lex).loc); } -#line 11569 "MachineIndependent/glslang_tab.cpp" +#line 11682 "MachineIndependent/glslang_tab.cpp" break; - case 613: /* jump_statement: RETURN SEMICOLON */ -#line 4031 "MachineIndependent/glslang.y" + case 621: /* jump_statement: RETURN SEMICOLON */ +#line 4088 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].lex).loc); if (parseContext.currentFunctionType->getBasicType() != EbtVoid) @@ -11577,101 +11690,101 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); if (parseContext.inMain) parseContext.postEntryPointReturn = true; } -#line 11581 "MachineIndependent/glslang_tab.cpp" +#line 11694 "MachineIndependent/glslang_tab.cpp" break; - case 614: /* jump_statement: RETURN expression SEMICOLON */ -#line 4038 "MachineIndependent/glslang.y" + case 622: /* jump_statement: RETURN expression SEMICOLON */ +#line 4095 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.handleReturnValue((yyvsp[-2].lex).loc, (yyvsp[-1].interm.intermTypedNode)); } -#line 11589 "MachineIndependent/glslang_tab.cpp" +#line 11702 "MachineIndependent/glslang_tab.cpp" break; - case 615: /* jump_statement: DISCARD SEMICOLON */ -#line 4041 "MachineIndependent/glslang.y" + case 623: /* jump_statement: DISCARD SEMICOLON */ +#line 4098 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "discard"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpKill, (yyvsp[-1].lex).loc); } -#line 11598 "MachineIndependent/glslang_tab.cpp" +#line 11711 "MachineIndependent/glslang_tab.cpp" break; - case 616: /* jump_statement: TERMINATE_INVOCATION SEMICOLON */ -#line 4045 "MachineIndependent/glslang.y" + case 624: /* jump_statement: TERMINATE_INVOCATION SEMICOLON */ +#line 4102 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "terminateInvocation"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpTerminateInvocation, (yyvsp[-1].lex).loc); } -#line 11607 "MachineIndependent/glslang_tab.cpp" +#line 11720 "MachineIndependent/glslang_tab.cpp" break; - case 617: /* jump_statement: TERMINATE_RAY SEMICOLON */ -#line 4050 "MachineIndependent/glslang.y" + case 625: /* jump_statement: TERMINATE_RAY SEMICOLON */ +#line 4107 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangAnyHit, "terminateRayEXT"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpTerminateRayKHR, (yyvsp[-1].lex).loc); } -#line 11616 "MachineIndependent/glslang_tab.cpp" +#line 11729 "MachineIndependent/glslang_tab.cpp" break; - case 618: /* jump_statement: IGNORE_INTERSECTION SEMICOLON */ -#line 4054 "MachineIndependent/glslang.y" + case 626: /* jump_statement: IGNORE_INTERSECTION SEMICOLON */ +#line 4111 "MachineIndependent/glslang.y" { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangAnyHit, "ignoreIntersectionEXT"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, (yyvsp[-1].lex).loc); } -#line 11625 "MachineIndependent/glslang_tab.cpp" +#line 11738 "MachineIndependent/glslang_tab.cpp" break; - case 619: /* translation_unit: external_declaration */ -#line 4064 "MachineIndependent/glslang.y" + case 627: /* translation_unit: external_declaration */ +#line 4121 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } -#line 11634 "MachineIndependent/glslang_tab.cpp" +#line 11747 "MachineIndependent/glslang_tab.cpp" break; - case 620: /* translation_unit: translation_unit external_declaration */ -#line 4068 "MachineIndependent/glslang.y" + case 628: /* translation_unit: translation_unit external_declaration */ +#line 4125 "MachineIndependent/glslang.y" { if ((yyvsp[0].interm.intermNode) != nullptr) { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } } -#line 11645 "MachineIndependent/glslang_tab.cpp" +#line 11758 "MachineIndependent/glslang_tab.cpp" break; - case 621: /* external_declaration: function_definition */ -#line 4077 "MachineIndependent/glslang.y" + case 629: /* external_declaration: function_definition */ +#line 4134 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11653 "MachineIndependent/glslang_tab.cpp" +#line 11766 "MachineIndependent/glslang_tab.cpp" break; - case 622: /* external_declaration: declaration */ -#line 4080 "MachineIndependent/glslang.y" + case 630: /* external_declaration: declaration */ +#line 4137 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 11661 "MachineIndependent/glslang_tab.cpp" +#line 11774 "MachineIndependent/glslang_tab.cpp" break; - case 623: /* external_declaration: SEMICOLON */ -#line 4084 "MachineIndependent/glslang.y" + case 631: /* external_declaration: SEMICOLON */ +#line 4141 "MachineIndependent/glslang.y" { parseContext.requireProfile((yyvsp[0].lex).loc, ~EEsProfile, "extraneous semicolon"); parseContext.profileRequires((yyvsp[0].lex).loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); (yyval.interm.intermNode) = nullptr; } -#line 11671 "MachineIndependent/glslang_tab.cpp" +#line 11784 "MachineIndependent/glslang_tab.cpp" break; - case 624: /* $@13: %empty */ -#line 4093 "MachineIndependent/glslang.y" + case 632: /* $@13: %empty */ +#line 4150 "MachineIndependent/glslang.y" { (yyvsp[0].interm).function = parseContext.handleFunctionDeclarator((yyvsp[0].interm).loc, *(yyvsp[0].interm).function, false /* not prototype */); (yyvsp[0].interm).intermNode = parseContext.handleFunctionDefinition((yyvsp[0].interm).loc, *(yyvsp[0].interm).function); @@ -11684,11 +11797,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); ++parseContext.statementNestingLevel; } } -#line 11688 "MachineIndependent/glslang_tab.cpp" +#line 11801 "MachineIndependent/glslang_tab.cpp" break; - case 625: /* function_definition: function_prototype $@13 compound_statement_no_new_scope */ -#line 4105 "MachineIndependent/glslang.y" + case 633: /* function_definition: function_prototype $@13 compound_statement_no_new_scope */ +#line 4162 "MachineIndependent/glslang.y" { // May be best done as post process phase on intermediate code if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) @@ -11715,228 +11828,228 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); --parseContext.statementNestingLevel; } } -#line 11719 "MachineIndependent/glslang_tab.cpp" +#line 11832 "MachineIndependent/glslang_tab.cpp" break; - case 626: /* attribute: LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET */ -#line 4135 "MachineIndependent/glslang.y" + case 634: /* attribute: LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET */ +#line 4192 "MachineIndependent/glslang.y" { (yyval.interm.attributes) = (yyvsp[-2].interm.attributes); } -#line 11727 "MachineIndependent/glslang_tab.cpp" +#line 11840 "MachineIndependent/glslang_tab.cpp" break; - case 627: /* attribute_list: single_attribute */ -#line 4140 "MachineIndependent/glslang.y" + case 635: /* attribute_list: single_attribute */ +#line 4197 "MachineIndependent/glslang.y" { (yyval.interm.attributes) = (yyvsp[0].interm.attributes); } -#line 11735 "MachineIndependent/glslang_tab.cpp" +#line 11848 "MachineIndependent/glslang_tab.cpp" break; - case 628: /* attribute_list: attribute_list COMMA single_attribute */ -#line 4143 "MachineIndependent/glslang.y" + case 636: /* attribute_list: attribute_list COMMA single_attribute */ +#line 4200 "MachineIndependent/glslang.y" { (yyval.interm.attributes) = parseContext.mergeAttributes((yyvsp[-2].interm.attributes), (yyvsp[0].interm.attributes)); } -#line 11743 "MachineIndependent/glslang_tab.cpp" +#line 11856 "MachineIndependent/glslang_tab.cpp" break; - case 629: /* single_attribute: IDENTIFIER */ -#line 4148 "MachineIndependent/glslang.y" + case 637: /* single_attribute: IDENTIFIER */ +#line 4205 "MachineIndependent/glslang.y" { (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[0].lex).string); } -#line 11751 "MachineIndependent/glslang_tab.cpp" +#line 11864 "MachineIndependent/glslang_tab.cpp" break; - case 630: /* single_attribute: IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN */ -#line 4151 "MachineIndependent/glslang.y" + case 638: /* single_attribute: IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN */ +#line 4208 "MachineIndependent/glslang.y" { (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[-3].lex).string, (yyvsp[-1].interm.intermTypedNode)); } -#line 11759 "MachineIndependent/glslang_tab.cpp" +#line 11872 "MachineIndependent/glslang_tab.cpp" break; - case 631: /* spirv_requirements_list: spirv_requirements_parameter */ -#line 4158 "MachineIndependent/glslang.y" + case 639: /* spirv_requirements_list: spirv_requirements_parameter */ +#line 4215 "MachineIndependent/glslang.y" { (yyval.interm.spirvReq) = (yyvsp[0].interm.spirvReq); } -#line 11767 "MachineIndependent/glslang_tab.cpp" +#line 11880 "MachineIndependent/glslang_tab.cpp" break; - case 632: /* spirv_requirements_list: spirv_requirements_list COMMA spirv_requirements_parameter */ -#line 4161 "MachineIndependent/glslang.y" + case 640: /* spirv_requirements_list: spirv_requirements_list COMMA spirv_requirements_parameter */ +#line 4218 "MachineIndependent/glslang.y" { (yyval.interm.spirvReq) = parseContext.mergeSpirvRequirements((yyvsp[-1].lex).loc, (yyvsp[-2].interm.spirvReq), (yyvsp[0].interm.spirvReq)); } -#line 11775 "MachineIndependent/glslang_tab.cpp" +#line 11888 "MachineIndependent/glslang_tab.cpp" break; - case 633: /* spirv_requirements_parameter: IDENTIFIER EQUAL LEFT_BRACKET spirv_extension_list RIGHT_BRACKET */ -#line 4166 "MachineIndependent/glslang.y" + case 641: /* spirv_requirements_parameter: IDENTIFIER EQUAL LEFT_BRACKET spirv_extension_list RIGHT_BRACKET */ +#line 4223 "MachineIndependent/glslang.y" { (yyval.interm.spirvReq) = parseContext.makeSpirvRequirement((yyvsp[-3].lex).loc, *(yyvsp[-4].lex).string, (yyvsp[-1].interm.intermNode)->getAsAggregate(), nullptr); } -#line 11783 "MachineIndependent/glslang_tab.cpp" +#line 11896 "MachineIndependent/glslang_tab.cpp" break; - case 634: /* spirv_requirements_parameter: IDENTIFIER EQUAL LEFT_BRACKET spirv_capability_list RIGHT_BRACKET */ -#line 4169 "MachineIndependent/glslang.y" + case 642: /* spirv_requirements_parameter: IDENTIFIER EQUAL LEFT_BRACKET spirv_capability_list RIGHT_BRACKET */ +#line 4226 "MachineIndependent/glslang.y" { (yyval.interm.spirvReq) = parseContext.makeSpirvRequirement((yyvsp[-3].lex).loc, *(yyvsp[-4].lex).string, nullptr, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 11791 "MachineIndependent/glslang_tab.cpp" +#line 11904 "MachineIndependent/glslang_tab.cpp" break; - case 635: /* spirv_extension_list: STRING_LITERAL */ -#line 4174 "MachineIndependent/glslang.y" + case 643: /* spirv_extension_list: STRING_LITERAL */ +#line 4231 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true)); } -#line 11799 "MachineIndependent/glslang_tab.cpp" +#line 11912 "MachineIndependent/glslang_tab.cpp" break; - case 636: /* spirv_extension_list: spirv_extension_list COMMA STRING_LITERAL */ -#line 4177 "MachineIndependent/glslang.y" + case 644: /* spirv_extension_list: spirv_extension_list COMMA STRING_LITERAL */ +#line 4234 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true)); } -#line 11807 "MachineIndependent/glslang_tab.cpp" +#line 11920 "MachineIndependent/glslang_tab.cpp" break; - case 637: /* spirv_capability_list: INTCONSTANT */ -#line 4182 "MachineIndependent/glslang.y" + case 645: /* spirv_capability_list: INTCONSTANT */ +#line 4239 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true)); } -#line 11815 "MachineIndependent/glslang_tab.cpp" +#line 11928 "MachineIndependent/glslang_tab.cpp" break; - case 638: /* spirv_capability_list: spirv_capability_list COMMA INTCONSTANT */ -#line 4185 "MachineIndependent/glslang.y" + case 646: /* spirv_capability_list: spirv_capability_list COMMA INTCONSTANT */ +#line 4242 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true)); } -#line 11823 "MachineIndependent/glslang_tab.cpp" +#line 11936 "MachineIndependent/glslang_tab.cpp" break; - case 639: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT RIGHT_PAREN */ -#line 4190 "MachineIndependent/glslang.y" + case 647: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT RIGHT_PAREN */ +#line 4247 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-1].lex).i); (yyval.interm.intermNode) = 0; } -#line 11832 "MachineIndependent/glslang_tab.cpp" +#line 11945 "MachineIndependent/glslang_tab.cpp" break; - case 640: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ -#line 4194 "MachineIndependent/glslang.y" + case 648: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ +#line 4251 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-1].lex).i); (yyval.interm.intermNode) = 0; } -#line 11842 "MachineIndependent/glslang_tab.cpp" +#line 11955 "MachineIndependent/glslang_tab.cpp" break; - case 641: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN */ -#line 4199 "MachineIndependent/glslang.y" + case 649: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN */ +#line 4256 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); (yyval.interm.intermNode) = 0; } -#line 11851 "MachineIndependent/glslang_tab.cpp" +#line 11964 "MachineIndependent/glslang_tab.cpp" break; - case 642: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN */ -#line 4203 "MachineIndependent/glslang.y" + case 650: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN */ +#line 4260 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); (yyval.interm.intermNode) = 0; } -#line 11861 "MachineIndependent/glslang_tab.cpp" +#line 11974 "MachineIndependent/glslang_tab.cpp" break; - case 643: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE_ID LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN */ -#line 4208 "MachineIndependent/glslang.y" + case 651: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE_ID LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN */ +#line 4265 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvExecutionModeId((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); (yyval.interm.intermNode) = 0; } -#line 11870 "MachineIndependent/glslang_tab.cpp" +#line 11983 "MachineIndependent/glslang_tab.cpp" break; - case 644: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN */ -#line 4212 "MachineIndependent/glslang.y" + case 652: /* spirv_execution_mode_qualifier: SPIRV_EXECUTION_MODE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN */ +#line 4269 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); parseContext.intermediate.insertSpirvExecutionModeId((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); (yyval.interm.intermNode) = 0; } -#line 11880 "MachineIndependent/glslang_tab.cpp" +#line 11993 "MachineIndependent/glslang_tab.cpp" break; - case 645: /* spirv_execution_mode_parameter_list: spirv_execution_mode_parameter */ -#line 4219 "MachineIndependent/glslang.y" + case 653: /* spirv_execution_mode_parameter_list: spirv_execution_mode_parameter */ +#line 4276 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); } -#line 11888 "MachineIndependent/glslang_tab.cpp" +#line 12001 "MachineIndependent/glslang_tab.cpp" break; - case 646: /* spirv_execution_mode_parameter_list: spirv_execution_mode_parameter_list COMMA spirv_execution_mode_parameter */ -#line 4222 "MachineIndependent/glslang.y" + case 654: /* spirv_execution_mode_parameter_list: spirv_execution_mode_parameter_list COMMA spirv_execution_mode_parameter */ +#line 4279 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 11896 "MachineIndependent/glslang_tab.cpp" +#line 12009 "MachineIndependent/glslang_tab.cpp" break; - case 647: /* spirv_execution_mode_parameter: FLOATCONSTANT */ -#line 4227 "MachineIndependent/glslang.y" + case 655: /* spirv_execution_mode_parameter: FLOATCONSTANT */ +#line 4284 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); } -#line 11904 "MachineIndependent/glslang_tab.cpp" +#line 12017 "MachineIndependent/glslang_tab.cpp" break; - case 648: /* spirv_execution_mode_parameter: INTCONSTANT */ -#line 4230 "MachineIndependent/glslang.y" + case 656: /* spirv_execution_mode_parameter: INTCONSTANT */ +#line 4287 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 11912 "MachineIndependent/glslang_tab.cpp" +#line 12025 "MachineIndependent/glslang_tab.cpp" break; - case 649: /* spirv_execution_mode_parameter: UINTCONSTANT */ -#line 4233 "MachineIndependent/glslang.y" + case 657: /* spirv_execution_mode_parameter: UINTCONSTANT */ +#line 4290 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 11920 "MachineIndependent/glslang_tab.cpp" +#line 12033 "MachineIndependent/glslang_tab.cpp" break; - case 650: /* spirv_execution_mode_parameter: BOOLCONSTANT */ -#line 4236 "MachineIndependent/glslang.y" + case 658: /* spirv_execution_mode_parameter: BOOLCONSTANT */ +#line 4293 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); } -#line 11928 "MachineIndependent/glslang_tab.cpp" +#line 12041 "MachineIndependent/glslang_tab.cpp" break; - case 651: /* spirv_execution_mode_parameter: STRING_LITERAL */ -#line 4239 "MachineIndependent/glslang.y" + case 659: /* spirv_execution_mode_parameter: STRING_LITERAL */ +#line 4296 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true); } -#line 11936 "MachineIndependent/glslang_tab.cpp" +#line 12049 "MachineIndependent/glslang_tab.cpp" break; - case 652: /* spirv_execution_mode_id_parameter_list: constant_expression */ -#line 4244 "MachineIndependent/glslang.y" + case 660: /* spirv_execution_mode_id_parameter_list: constant_expression */ +#line 4301 "MachineIndependent/glslang.y" { if ((yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtFloat && (yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtInt && @@ -11946,11 +12059,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "this type not allowed", (yyvsp[0].interm.intermTypedNode)->getType().getBasicString(), ""); (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermTypedNode)); } -#line 11950 "MachineIndependent/glslang_tab.cpp" +#line 12063 "MachineIndependent/glslang_tab.cpp" break; - case 653: /* spirv_execution_mode_id_parameter_list: spirv_execution_mode_id_parameter_list COMMA constant_expression */ -#line 4253 "MachineIndependent/glslang.y" + case 661: /* spirv_execution_mode_id_parameter_list: spirv_execution_mode_id_parameter_list COMMA constant_expression */ +#line 4310 "MachineIndependent/glslang.y" { if ((yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtFloat && (yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtInt && @@ -11960,310 +12073,351 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "this type not allowed", (yyvsp[0].interm.intermTypedNode)->getType().getBasicString(), ""); (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), (yyvsp[0].interm.intermTypedNode)); } -#line 11964 "MachineIndependent/glslang_tab.cpp" +#line 12077 "MachineIndependent/glslang_tab.cpp" break; - case 654: /* spirv_storage_class_qualifier: SPIRV_STORAGE_CLASS LEFT_PAREN INTCONSTANT RIGHT_PAREN */ -#line 4264 "MachineIndependent/glslang.y" + case 662: /* spirv_storage_class_qualifier: SPIRV_STORAGE_CLASS LEFT_PAREN INTCONSTANT RIGHT_PAREN */ +#line 4321 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-3].lex).loc); (yyval.interm.type).qualifier.storage = EvqSpirvStorageClass; (yyval.interm.type).qualifier.spirvStorageClass = (yyvsp[-1].lex).i; } -#line 11974 "MachineIndependent/glslang_tab.cpp" +#line 12087 "MachineIndependent/glslang_tab.cpp" break; - case 655: /* spirv_storage_class_qualifier: SPIRV_STORAGE_CLASS LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ -#line 4269 "MachineIndependent/glslang.y" + case 663: /* spirv_storage_class_qualifier: SPIRV_STORAGE_CLASS LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ +#line 4326 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc); parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); (yyval.interm.type).qualifier.storage = EvqSpirvStorageClass; (yyval.interm.type).qualifier.spirvStorageClass = (yyvsp[-1].lex).i; } -#line 11985 "MachineIndependent/glslang_tab.cpp" +#line 12098 "MachineIndependent/glslang_tab.cpp" break; - case 656: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN INTCONSTANT RIGHT_PAREN */ -#line 4277 "MachineIndependent/glslang.y" + case 664: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN INTCONSTANT RIGHT_PAREN */ +#line 4334 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-3].lex).loc); (yyval.interm.type).qualifier.setSpirvDecorate((yyvsp[-1].lex).i); } -#line 11994 "MachineIndependent/glslang_tab.cpp" +#line 12107 "MachineIndependent/glslang_tab.cpp" break; - case 657: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ -#line 4281 "MachineIndependent/glslang.y" + case 665: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN */ +#line 4338 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc); parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); (yyval.interm.type).qualifier.setSpirvDecorate((yyvsp[-1].lex).i); } -#line 12004 "MachineIndependent/glslang_tab.cpp" +#line 12117 "MachineIndependent/glslang_tab.cpp" break; - case 658: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN */ -#line 4286 "MachineIndependent/glslang.y" + case 666: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN */ +#line 4343 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc); (yyval.interm.type).qualifier.setSpirvDecorate((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12013 "MachineIndependent/glslang_tab.cpp" +#line 12126 "MachineIndependent/glslang_tab.cpp" break; - case 659: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN */ -#line 4290 "MachineIndependent/glslang.y" + case 667: /* spirv_decorate_qualifier: SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN */ +#line 4347 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-7].lex).loc); parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); (yyval.interm.type).qualifier.setSpirvDecorate((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12023 "MachineIndependent/glslang_tab.cpp" +#line 12136 "MachineIndependent/glslang_tab.cpp" break; - case 660: /* spirv_decorate_qualifier: SPIRV_DECORATE_ID LEFT_PAREN INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN */ -#line 4295 "MachineIndependent/glslang.y" + case 668: /* spirv_decorate_qualifier: SPIRV_DECORATE_ID LEFT_PAREN INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN */ +#line 4352 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc); (yyval.interm.type).qualifier.setSpirvDecorateId((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12032 "MachineIndependent/glslang_tab.cpp" +#line 12145 "MachineIndependent/glslang_tab.cpp" break; - case 661: /* spirv_decorate_qualifier: SPIRV_DECORATE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN */ -#line 4299 "MachineIndependent/glslang.y" + case 669: /* spirv_decorate_qualifier: SPIRV_DECORATE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN */ +#line 4356 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-7].lex).loc); parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); (yyval.interm.type).qualifier.setSpirvDecorateId((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12042 "MachineIndependent/glslang_tab.cpp" +#line 12155 "MachineIndependent/glslang_tab.cpp" break; - case 662: /* spirv_decorate_qualifier: SPIRV_DECORATE_STRING LEFT_PAREN INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN */ -#line 4304 "MachineIndependent/glslang.y" + case 670: /* spirv_decorate_qualifier: SPIRV_DECORATE_STRING LEFT_PAREN INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN */ +#line 4361 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc); (yyval.interm.type).qualifier.setSpirvDecorateString((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12051 "MachineIndependent/glslang_tab.cpp" +#line 12164 "MachineIndependent/glslang_tab.cpp" break; - case 663: /* spirv_decorate_qualifier: SPIRV_DECORATE_STRING LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN */ -#line 4308 "MachineIndependent/glslang.y" + case 671: /* spirv_decorate_qualifier: SPIRV_DECORATE_STRING LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN */ +#line 4365 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-7].lex).loc); parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); (yyval.interm.type).qualifier.setSpirvDecorateString((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); } -#line 12061 "MachineIndependent/glslang_tab.cpp" +#line 12174 "MachineIndependent/glslang_tab.cpp" break; - case 664: /* spirv_decorate_parameter_list: spirv_decorate_parameter */ -#line 4315 "MachineIndependent/glslang.y" + case 672: /* spirv_decorate_parameter_list: spirv_decorate_parameter */ +#line 4372 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); } -#line 12069 "MachineIndependent/glslang_tab.cpp" +#line 12182 "MachineIndependent/glslang_tab.cpp" break; - case 665: /* spirv_decorate_parameter_list: spirv_decorate_parameter_list COMMA spirv_decorate_parameter */ -#line 4318 "MachineIndependent/glslang.y" + case 673: /* spirv_decorate_parameter_list: spirv_decorate_parameter_list COMMA spirv_decorate_parameter */ +#line 4375 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 12077 "MachineIndependent/glslang_tab.cpp" +#line 12190 "MachineIndependent/glslang_tab.cpp" break; - case 666: /* spirv_decorate_parameter: FLOATCONSTANT */ -#line 4323 "MachineIndependent/glslang.y" + case 674: /* spirv_decorate_parameter: FLOATCONSTANT */ +#line 4380 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); } -#line 12085 "MachineIndependent/glslang_tab.cpp" +#line 12198 "MachineIndependent/glslang_tab.cpp" break; - case 667: /* spirv_decorate_parameter: INTCONSTANT */ -#line 4326 "MachineIndependent/glslang.y" + case 675: /* spirv_decorate_parameter: INTCONSTANT */ +#line 4383 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 12093 "MachineIndependent/glslang_tab.cpp" +#line 12206 "MachineIndependent/glslang_tab.cpp" break; - case 668: /* spirv_decorate_parameter: UINTCONSTANT */ -#line 4329 "MachineIndependent/glslang.y" + case 676: /* spirv_decorate_parameter: UINTCONSTANT */ +#line 4386 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 12101 "MachineIndependent/glslang_tab.cpp" +#line 12214 "MachineIndependent/glslang_tab.cpp" break; - case 669: /* spirv_decorate_parameter: BOOLCONSTANT */ -#line 4332 "MachineIndependent/glslang.y" + case 677: /* spirv_decorate_parameter: BOOLCONSTANT */ +#line 4389 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); } -#line 12109 "MachineIndependent/glslang_tab.cpp" +#line 12222 "MachineIndependent/glslang_tab.cpp" + break; + + case 678: /* spirv_decorate_id_parameter_list: spirv_decorate_id_parameter */ +#line 4394 "MachineIndependent/glslang.y" + { + (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); + } +#line 12230 "MachineIndependent/glslang_tab.cpp" + break; + + case 679: /* spirv_decorate_id_parameter_list: spirv_decorate_id_parameter_list COMMA spirv_decorate_id_parameter */ +#line 4397 "MachineIndependent/glslang.y" + { + (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), (yyvsp[0].interm.intermNode)); + } +#line 12238 "MachineIndependent/glslang_tab.cpp" break; - case 670: /* spirv_decorate_id_parameter_list: constant_expression */ -#line 4337 "MachineIndependent/glslang.y" + case 680: /* spirv_decorate_id_parameter: variable_identifier */ +#line 4402 "MachineIndependent/glslang.y" { - if ((yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtFloat && - (yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtInt && - (yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtUint && - (yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtBool) - parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "this type not allowed", (yyvsp[0].interm.intermTypedNode)->getType().getBasicString(), ""); - (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermTypedNode)); + if ((yyvsp[0].interm.intermTypedNode)->getAsConstantUnion() || (yyvsp[0].interm.intermTypedNode)->getAsSymbolNode()) + (yyval.interm.intermNode) = (yyvsp[0].interm.intermTypedNode); + else + parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "only allow constants or variables which are not elements of a composite", "", ""); } -#line 12122 "MachineIndependent/glslang_tab.cpp" +#line 12249 "MachineIndependent/glslang_tab.cpp" break; - case 671: /* spirv_decorate_id_parameter_list: spirv_decorate_id_parameter_list COMMA constant_expression */ -#line 4345 "MachineIndependent/glslang.y" - { - if ((yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtFloat && - (yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtInt && - (yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtUint && - (yyvsp[0].interm.intermTypedNode)->getBasicType() != EbtBool) - parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "this type not allowed", (yyvsp[0].interm.intermTypedNode)->getType().getBasicString(), ""); - (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), (yyvsp[0].interm.intermTypedNode)); + case 681: /* spirv_decorate_id_parameter: FLOATCONSTANT */ +#line 4408 "MachineIndependent/glslang.y" + { + (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); + } +#line 12257 "MachineIndependent/glslang_tab.cpp" + break; + + case 682: /* spirv_decorate_id_parameter: INTCONSTANT */ +#line 4411 "MachineIndependent/glslang.y" + { + (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); + } +#line 12265 "MachineIndependent/glslang_tab.cpp" + break; + + case 683: /* spirv_decorate_id_parameter: UINTCONSTANT */ +#line 4414 "MachineIndependent/glslang.y" + { + (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 12135 "MachineIndependent/glslang_tab.cpp" +#line 12273 "MachineIndependent/glslang_tab.cpp" break; - case 672: /* spirv_decorate_string_parameter_list: STRING_LITERAL */ -#line 4355 "MachineIndependent/glslang.y" + case 684: /* spirv_decorate_id_parameter: BOOLCONSTANT */ +#line 4417 "MachineIndependent/glslang.y" + { + (yyval.interm.intermNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); + } +#line 12281 "MachineIndependent/glslang_tab.cpp" + break; + + case 685: /* spirv_decorate_string_parameter_list: STRING_LITERAL */ +#line 4422 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate( parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true)); } -#line 12144 "MachineIndependent/glslang_tab.cpp" +#line 12290 "MachineIndependent/glslang_tab.cpp" break; - case 673: /* spirv_decorate_string_parameter_list: spirv_decorate_string_parameter_list COMMA STRING_LITERAL */ -#line 4359 "MachineIndependent/glslang.y" + case 686: /* spirv_decorate_string_parameter_list: spirv_decorate_string_parameter_list COMMA STRING_LITERAL */ +#line 4426 "MachineIndependent/glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermNode), parseContext.intermediate.addConstantUnion((yyvsp[0].lex).string, (yyvsp[0].lex).loc, true)); } -#line 12152 "MachineIndependent/glslang_tab.cpp" +#line 12298 "MachineIndependent/glslang_tab.cpp" break; - case 674: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN */ -#line 4364 "MachineIndependent/glslang.y" + case 687: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN */ +#line 4431 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).setSpirvType(*(yyvsp[-3].interm.spirvInst), (yyvsp[-1].interm.spirvTypeParams)); } -#line 12161 "MachineIndependent/glslang_tab.cpp" +#line 12307 "MachineIndependent/glslang_tab.cpp" break; - case 675: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN */ -#line 4368 "MachineIndependent/glslang.y" + case 688: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN */ +#line 4435 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-7].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); (yyval.interm.type).setSpirvType(*(yyvsp[-3].interm.spirvInst), (yyvsp[-1].interm.spirvTypeParams)); } -#line 12171 "MachineIndependent/glslang_tab.cpp" +#line 12317 "MachineIndependent/glslang_tab.cpp" break; - case 676: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN */ -#line 4373 "MachineIndependent/glslang.y" + case 689: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN */ +#line 4440 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-3].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).setSpirvType(*(yyvsp[-1].interm.spirvInst)); } -#line 12180 "MachineIndependent/glslang_tab.cpp" +#line 12326 "MachineIndependent/glslang_tab.cpp" break; - case 677: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN */ -#line 4377 "MachineIndependent/glslang.y" + case 690: /* spirv_type_specifier: SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN */ +#line 4444 "MachineIndependent/glslang.y" { (yyval.interm.type).init((yyvsp[-5].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); (yyval.interm.type).setSpirvType(*(yyvsp[-1].interm.spirvInst)); } -#line 12190 "MachineIndependent/glslang_tab.cpp" +#line 12336 "MachineIndependent/glslang_tab.cpp" break; - case 678: /* spirv_type_parameter_list: spirv_type_parameter */ -#line 4384 "MachineIndependent/glslang.y" + case 691: /* spirv_type_parameter_list: spirv_type_parameter */ +#line 4451 "MachineIndependent/glslang.y" { (yyval.interm.spirvTypeParams) = (yyvsp[0].interm.spirvTypeParams); } -#line 12198 "MachineIndependent/glslang_tab.cpp" +#line 12344 "MachineIndependent/glslang_tab.cpp" break; - case 679: /* spirv_type_parameter_list: spirv_type_parameter_list COMMA spirv_type_parameter */ -#line 4387 "MachineIndependent/glslang.y" + case 692: /* spirv_type_parameter_list: spirv_type_parameter_list COMMA spirv_type_parameter */ +#line 4454 "MachineIndependent/glslang.y" { (yyval.interm.spirvTypeParams) = parseContext.mergeSpirvTypeParameters((yyvsp[-2].interm.spirvTypeParams), (yyvsp[0].interm.spirvTypeParams)); } -#line 12206 "MachineIndependent/glslang_tab.cpp" +#line 12352 "MachineIndependent/glslang_tab.cpp" break; - case 680: /* spirv_type_parameter: constant_expression */ -#line 4392 "MachineIndependent/glslang.y" + case 693: /* spirv_type_parameter: constant_expression */ +#line 4459 "MachineIndependent/glslang.y" { (yyval.interm.spirvTypeParams) = parseContext.makeSpirvTypeParameters((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode)->getAsConstantUnion()); } -#line 12214 "MachineIndependent/glslang_tab.cpp" +#line 12360 "MachineIndependent/glslang_tab.cpp" break; - case 681: /* spirv_instruction_qualifier: SPIRV_INSTRUCTION LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN */ -#line 4397 "MachineIndependent/glslang.y" + case 694: /* spirv_type_parameter: type_specifier_nonarray */ +#line 4462 "MachineIndependent/glslang.y" + { + (yyval.interm.spirvTypeParams) = parseContext.makeSpirvTypeParameters((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); + } +#line 12368 "MachineIndependent/glslang_tab.cpp" + break; + + case 695: /* spirv_instruction_qualifier: SPIRV_INSTRUCTION LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN */ +#line 4467 "MachineIndependent/glslang.y" { (yyval.interm.spirvInst) = (yyvsp[-1].interm.spirvInst); } -#line 12222 "MachineIndependent/glslang_tab.cpp" +#line 12376 "MachineIndependent/glslang_tab.cpp" break; - case 682: /* spirv_instruction_qualifier: SPIRV_INSTRUCTION LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN */ -#line 4400 "MachineIndependent/glslang.y" + case 696: /* spirv_instruction_qualifier: SPIRV_INSTRUCTION LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN */ +#line 4470 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); (yyval.interm.spirvInst) = (yyvsp[-1].interm.spirvInst); } -#line 12231 "MachineIndependent/glslang_tab.cpp" +#line 12385 "MachineIndependent/glslang_tab.cpp" break; - case 683: /* spirv_instruction_qualifier_list: spirv_instruction_qualifier_id */ -#line 4406 "MachineIndependent/glslang.y" + case 697: /* spirv_instruction_qualifier_list: spirv_instruction_qualifier_id */ +#line 4476 "MachineIndependent/glslang.y" { (yyval.interm.spirvInst) = (yyvsp[0].interm.spirvInst); } -#line 12239 "MachineIndependent/glslang_tab.cpp" +#line 12393 "MachineIndependent/glslang_tab.cpp" break; - case 684: /* spirv_instruction_qualifier_list: spirv_instruction_qualifier_list COMMA spirv_instruction_qualifier_id */ -#line 4409 "MachineIndependent/glslang.y" + case 698: /* spirv_instruction_qualifier_list: spirv_instruction_qualifier_list COMMA spirv_instruction_qualifier_id */ +#line 4479 "MachineIndependent/glslang.y" { (yyval.interm.spirvInst) = parseContext.mergeSpirvInstruction((yyvsp[-1].lex).loc, (yyvsp[-2].interm.spirvInst), (yyvsp[0].interm.spirvInst)); } -#line 12247 "MachineIndependent/glslang_tab.cpp" +#line 12401 "MachineIndependent/glslang_tab.cpp" break; - case 685: /* spirv_instruction_qualifier_id: IDENTIFIER EQUAL STRING_LITERAL */ -#line 4414 "MachineIndependent/glslang.y" + case 699: /* spirv_instruction_qualifier_id: IDENTIFIER EQUAL STRING_LITERAL */ +#line 4484 "MachineIndependent/glslang.y" { (yyval.interm.spirvInst) = parseContext.makeSpirvInstruction((yyvsp[-1].lex).loc, *(yyvsp[-2].lex).string, *(yyvsp[0].lex).string); } -#line 12255 "MachineIndependent/glslang_tab.cpp" +#line 12409 "MachineIndependent/glslang_tab.cpp" break; - case 686: /* spirv_instruction_qualifier_id: IDENTIFIER EQUAL INTCONSTANT */ -#line 4417 "MachineIndependent/glslang.y" + case 700: /* spirv_instruction_qualifier_id: IDENTIFIER EQUAL INTCONSTANT */ +#line 4487 "MachineIndependent/glslang.y" { (yyval.interm.spirvInst) = parseContext.makeSpirvInstruction((yyvsp[-1].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[0].lex).i); } -#line 12263 "MachineIndependent/glslang_tab.cpp" +#line 12417 "MachineIndependent/glslang_tab.cpp" break; -#line 12267 "MachineIndependent/glslang_tab.cpp" +#line 12421 "MachineIndependent/glslang_tab.cpp" default: break; } @@ -12339,7 +12493,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } yyerror (pParseContext, yymsgp); if (yysyntax_error_status == YYENOMEM) - goto yyexhaustedlab; + YYNOMEM; } } @@ -12375,6 +12529,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; + ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -12435,7 +12590,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); `-------------------------------------*/ yyacceptlab: yyresult = 0; - goto yyreturn; + goto yyreturnlab; /*-----------------------------------. @@ -12443,24 +12598,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); `-----------------------------------*/ yyabortlab: yyresult = 1; - goto yyreturn; + goto yyreturnlab; -#if 1 -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ +/*-----------------------------------------------------------. +| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ yyexhaustedlab: yyerror (pParseContext, YY_("memory exhausted")); yyresult = 2; - goto yyreturn; -#endif + goto yyreturnlab; -/*-------------------------------------------------------. -| yyreturn -- parsing is finished, clean up and return. | -`-------------------------------------------------------*/ -yyreturn: +/*----------------------------------------------------------. +| yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +yyreturnlab: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at @@ -12488,5 +12641,5 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); return yyresult; } -#line 4422 "MachineIndependent/glslang.y" +#line 4492 "MachineIndependent/glslang.y" diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h b/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h index 18cef468..39455f27 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.7.4. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -217,298 +217,305 @@ extern int yydebug; FCOOPMATNV = 418, /* FCOOPMATNV */ ICOOPMATNV = 419, /* ICOOPMATNV */ UCOOPMATNV = 420, /* UCOOPMATNV */ - SAMPLERCUBEARRAY = 421, /* SAMPLERCUBEARRAY */ - SAMPLERCUBEARRAYSHADOW = 422, /* SAMPLERCUBEARRAYSHADOW */ - ISAMPLERCUBEARRAY = 423, /* ISAMPLERCUBEARRAY */ - USAMPLERCUBEARRAY = 424, /* USAMPLERCUBEARRAY */ - SAMPLER1D = 425, /* SAMPLER1D */ - SAMPLER1DARRAY = 426, /* SAMPLER1DARRAY */ - SAMPLER1DARRAYSHADOW = 427, /* SAMPLER1DARRAYSHADOW */ - ISAMPLER1D = 428, /* ISAMPLER1D */ - SAMPLER1DSHADOW = 429, /* SAMPLER1DSHADOW */ - SAMPLER2DRECT = 430, /* SAMPLER2DRECT */ - SAMPLER2DRECTSHADOW = 431, /* SAMPLER2DRECTSHADOW */ - ISAMPLER2DRECT = 432, /* ISAMPLER2DRECT */ - USAMPLER2DRECT = 433, /* USAMPLER2DRECT */ - SAMPLERBUFFER = 434, /* SAMPLERBUFFER */ - ISAMPLERBUFFER = 435, /* ISAMPLERBUFFER */ - USAMPLERBUFFER = 436, /* USAMPLERBUFFER */ - SAMPLER2DMS = 437, /* SAMPLER2DMS */ - ISAMPLER2DMS = 438, /* ISAMPLER2DMS */ - USAMPLER2DMS = 439, /* USAMPLER2DMS */ - SAMPLER2DMSARRAY = 440, /* SAMPLER2DMSARRAY */ - ISAMPLER2DMSARRAY = 441, /* ISAMPLER2DMSARRAY */ - USAMPLER2DMSARRAY = 442, /* USAMPLER2DMSARRAY */ - SAMPLEREXTERNALOES = 443, /* SAMPLEREXTERNALOES */ - SAMPLEREXTERNAL2DY2YEXT = 444, /* SAMPLEREXTERNAL2DY2YEXT */ - ISAMPLER1DARRAY = 445, /* ISAMPLER1DARRAY */ - USAMPLER1D = 446, /* USAMPLER1D */ - USAMPLER1DARRAY = 447, /* USAMPLER1DARRAY */ - F16SAMPLER1D = 448, /* F16SAMPLER1D */ - F16SAMPLER2D = 449, /* F16SAMPLER2D */ - F16SAMPLER3D = 450, /* F16SAMPLER3D */ - F16SAMPLER2DRECT = 451, /* F16SAMPLER2DRECT */ - F16SAMPLERCUBE = 452, /* F16SAMPLERCUBE */ - F16SAMPLER1DARRAY = 453, /* F16SAMPLER1DARRAY */ - F16SAMPLER2DARRAY = 454, /* F16SAMPLER2DARRAY */ - F16SAMPLERCUBEARRAY = 455, /* F16SAMPLERCUBEARRAY */ - F16SAMPLERBUFFER = 456, /* F16SAMPLERBUFFER */ - F16SAMPLER2DMS = 457, /* F16SAMPLER2DMS */ - F16SAMPLER2DMSARRAY = 458, /* F16SAMPLER2DMSARRAY */ - F16SAMPLER1DSHADOW = 459, /* F16SAMPLER1DSHADOW */ - F16SAMPLER2DSHADOW = 460, /* F16SAMPLER2DSHADOW */ - F16SAMPLER1DARRAYSHADOW = 461, /* F16SAMPLER1DARRAYSHADOW */ - F16SAMPLER2DARRAYSHADOW = 462, /* F16SAMPLER2DARRAYSHADOW */ - F16SAMPLER2DRECTSHADOW = 463, /* F16SAMPLER2DRECTSHADOW */ - F16SAMPLERCUBESHADOW = 464, /* F16SAMPLERCUBESHADOW */ - F16SAMPLERCUBEARRAYSHADOW = 465, /* F16SAMPLERCUBEARRAYSHADOW */ - IMAGE1D = 466, /* IMAGE1D */ - IIMAGE1D = 467, /* IIMAGE1D */ - UIMAGE1D = 468, /* UIMAGE1D */ - IMAGE2D = 469, /* IMAGE2D */ - IIMAGE2D = 470, /* IIMAGE2D */ - UIMAGE2D = 471, /* UIMAGE2D */ - IMAGE3D = 472, /* IMAGE3D */ - IIMAGE3D = 473, /* IIMAGE3D */ - UIMAGE3D = 474, /* UIMAGE3D */ - IMAGE2DRECT = 475, /* IMAGE2DRECT */ - IIMAGE2DRECT = 476, /* IIMAGE2DRECT */ - UIMAGE2DRECT = 477, /* UIMAGE2DRECT */ - IMAGECUBE = 478, /* IMAGECUBE */ - IIMAGECUBE = 479, /* IIMAGECUBE */ - UIMAGECUBE = 480, /* UIMAGECUBE */ - IMAGEBUFFER = 481, /* IMAGEBUFFER */ - IIMAGEBUFFER = 482, /* IIMAGEBUFFER */ - UIMAGEBUFFER = 483, /* UIMAGEBUFFER */ - IMAGE1DARRAY = 484, /* IMAGE1DARRAY */ - IIMAGE1DARRAY = 485, /* IIMAGE1DARRAY */ - UIMAGE1DARRAY = 486, /* UIMAGE1DARRAY */ - IMAGE2DARRAY = 487, /* IMAGE2DARRAY */ - IIMAGE2DARRAY = 488, /* IIMAGE2DARRAY */ - UIMAGE2DARRAY = 489, /* UIMAGE2DARRAY */ - IMAGECUBEARRAY = 490, /* IMAGECUBEARRAY */ - IIMAGECUBEARRAY = 491, /* IIMAGECUBEARRAY */ - UIMAGECUBEARRAY = 492, /* UIMAGECUBEARRAY */ - IMAGE2DMS = 493, /* IMAGE2DMS */ - IIMAGE2DMS = 494, /* IIMAGE2DMS */ - UIMAGE2DMS = 495, /* UIMAGE2DMS */ - IMAGE2DMSARRAY = 496, /* IMAGE2DMSARRAY */ - IIMAGE2DMSARRAY = 497, /* IIMAGE2DMSARRAY */ - UIMAGE2DMSARRAY = 498, /* UIMAGE2DMSARRAY */ - F16IMAGE1D = 499, /* F16IMAGE1D */ - F16IMAGE2D = 500, /* F16IMAGE2D */ - F16IMAGE3D = 501, /* F16IMAGE3D */ - F16IMAGE2DRECT = 502, /* F16IMAGE2DRECT */ - F16IMAGECUBE = 503, /* F16IMAGECUBE */ - F16IMAGE1DARRAY = 504, /* F16IMAGE1DARRAY */ - F16IMAGE2DARRAY = 505, /* F16IMAGE2DARRAY */ - F16IMAGECUBEARRAY = 506, /* F16IMAGECUBEARRAY */ - F16IMAGEBUFFER = 507, /* F16IMAGEBUFFER */ - F16IMAGE2DMS = 508, /* F16IMAGE2DMS */ - F16IMAGE2DMSARRAY = 509, /* F16IMAGE2DMSARRAY */ - I64IMAGE1D = 510, /* I64IMAGE1D */ - U64IMAGE1D = 511, /* U64IMAGE1D */ - I64IMAGE2D = 512, /* I64IMAGE2D */ - U64IMAGE2D = 513, /* U64IMAGE2D */ - I64IMAGE3D = 514, /* I64IMAGE3D */ - U64IMAGE3D = 515, /* U64IMAGE3D */ - I64IMAGE2DRECT = 516, /* I64IMAGE2DRECT */ - U64IMAGE2DRECT = 517, /* U64IMAGE2DRECT */ - I64IMAGECUBE = 518, /* I64IMAGECUBE */ - U64IMAGECUBE = 519, /* U64IMAGECUBE */ - I64IMAGEBUFFER = 520, /* I64IMAGEBUFFER */ - U64IMAGEBUFFER = 521, /* U64IMAGEBUFFER */ - I64IMAGE1DARRAY = 522, /* I64IMAGE1DARRAY */ - U64IMAGE1DARRAY = 523, /* U64IMAGE1DARRAY */ - I64IMAGE2DARRAY = 524, /* I64IMAGE2DARRAY */ - U64IMAGE2DARRAY = 525, /* U64IMAGE2DARRAY */ - I64IMAGECUBEARRAY = 526, /* I64IMAGECUBEARRAY */ - U64IMAGECUBEARRAY = 527, /* U64IMAGECUBEARRAY */ - I64IMAGE2DMS = 528, /* I64IMAGE2DMS */ - U64IMAGE2DMS = 529, /* U64IMAGE2DMS */ - I64IMAGE2DMSARRAY = 530, /* I64IMAGE2DMSARRAY */ - U64IMAGE2DMSARRAY = 531, /* U64IMAGE2DMSARRAY */ - TEXTURECUBEARRAY = 532, /* TEXTURECUBEARRAY */ - ITEXTURECUBEARRAY = 533, /* ITEXTURECUBEARRAY */ - UTEXTURECUBEARRAY = 534, /* UTEXTURECUBEARRAY */ - TEXTURE1D = 535, /* TEXTURE1D */ - ITEXTURE1D = 536, /* ITEXTURE1D */ - UTEXTURE1D = 537, /* UTEXTURE1D */ - TEXTURE1DARRAY = 538, /* TEXTURE1DARRAY */ - ITEXTURE1DARRAY = 539, /* ITEXTURE1DARRAY */ - UTEXTURE1DARRAY = 540, /* UTEXTURE1DARRAY */ - TEXTURE2DRECT = 541, /* TEXTURE2DRECT */ - ITEXTURE2DRECT = 542, /* ITEXTURE2DRECT */ - UTEXTURE2DRECT = 543, /* UTEXTURE2DRECT */ - TEXTUREBUFFER = 544, /* TEXTUREBUFFER */ - ITEXTUREBUFFER = 545, /* ITEXTUREBUFFER */ - UTEXTUREBUFFER = 546, /* UTEXTUREBUFFER */ - TEXTURE2DMS = 547, /* TEXTURE2DMS */ - ITEXTURE2DMS = 548, /* ITEXTURE2DMS */ - UTEXTURE2DMS = 549, /* UTEXTURE2DMS */ - TEXTURE2DMSARRAY = 550, /* TEXTURE2DMSARRAY */ - ITEXTURE2DMSARRAY = 551, /* ITEXTURE2DMSARRAY */ - UTEXTURE2DMSARRAY = 552, /* UTEXTURE2DMSARRAY */ - F16TEXTURE1D = 553, /* F16TEXTURE1D */ - F16TEXTURE2D = 554, /* F16TEXTURE2D */ - F16TEXTURE3D = 555, /* F16TEXTURE3D */ - F16TEXTURE2DRECT = 556, /* F16TEXTURE2DRECT */ - F16TEXTURECUBE = 557, /* F16TEXTURECUBE */ - F16TEXTURE1DARRAY = 558, /* F16TEXTURE1DARRAY */ - F16TEXTURE2DARRAY = 559, /* F16TEXTURE2DARRAY */ - F16TEXTURECUBEARRAY = 560, /* F16TEXTURECUBEARRAY */ - F16TEXTUREBUFFER = 561, /* F16TEXTUREBUFFER */ - F16TEXTURE2DMS = 562, /* F16TEXTURE2DMS */ - F16TEXTURE2DMSARRAY = 563, /* F16TEXTURE2DMSARRAY */ - SUBPASSINPUT = 564, /* SUBPASSINPUT */ - SUBPASSINPUTMS = 565, /* SUBPASSINPUTMS */ - ISUBPASSINPUT = 566, /* ISUBPASSINPUT */ - ISUBPASSINPUTMS = 567, /* ISUBPASSINPUTMS */ - USUBPASSINPUT = 568, /* USUBPASSINPUT */ - USUBPASSINPUTMS = 569, /* USUBPASSINPUTMS */ - F16SUBPASSINPUT = 570, /* F16SUBPASSINPUT */ - F16SUBPASSINPUTMS = 571, /* F16SUBPASSINPUTMS */ - SPIRV_INSTRUCTION = 572, /* SPIRV_INSTRUCTION */ - SPIRV_EXECUTION_MODE = 573, /* SPIRV_EXECUTION_MODE */ - SPIRV_EXECUTION_MODE_ID = 574, /* SPIRV_EXECUTION_MODE_ID */ - SPIRV_DECORATE = 575, /* SPIRV_DECORATE */ - SPIRV_DECORATE_ID = 576, /* SPIRV_DECORATE_ID */ - SPIRV_DECORATE_STRING = 577, /* SPIRV_DECORATE_STRING */ - SPIRV_TYPE = 578, /* SPIRV_TYPE */ - SPIRV_STORAGE_CLASS = 579, /* SPIRV_STORAGE_CLASS */ - SPIRV_BY_REFERENCE = 580, /* SPIRV_BY_REFERENCE */ - SPIRV_LITERAL = 581, /* SPIRV_LITERAL */ - LEFT_OP = 582, /* LEFT_OP */ - RIGHT_OP = 583, /* RIGHT_OP */ - INC_OP = 584, /* INC_OP */ - DEC_OP = 585, /* DEC_OP */ - LE_OP = 586, /* LE_OP */ - GE_OP = 587, /* GE_OP */ - EQ_OP = 588, /* EQ_OP */ - NE_OP = 589, /* NE_OP */ - AND_OP = 590, /* AND_OP */ - OR_OP = 591, /* OR_OP */ - XOR_OP = 592, /* XOR_OP */ - MUL_ASSIGN = 593, /* MUL_ASSIGN */ - DIV_ASSIGN = 594, /* DIV_ASSIGN */ - ADD_ASSIGN = 595, /* ADD_ASSIGN */ - MOD_ASSIGN = 596, /* MOD_ASSIGN */ - LEFT_ASSIGN = 597, /* LEFT_ASSIGN */ - RIGHT_ASSIGN = 598, /* RIGHT_ASSIGN */ - AND_ASSIGN = 599, /* AND_ASSIGN */ - XOR_ASSIGN = 600, /* XOR_ASSIGN */ - OR_ASSIGN = 601, /* OR_ASSIGN */ - SUB_ASSIGN = 602, /* SUB_ASSIGN */ - STRING_LITERAL = 603, /* STRING_LITERAL */ - LEFT_PAREN = 604, /* LEFT_PAREN */ - RIGHT_PAREN = 605, /* RIGHT_PAREN */ - LEFT_BRACKET = 606, /* LEFT_BRACKET */ - RIGHT_BRACKET = 607, /* RIGHT_BRACKET */ - LEFT_BRACE = 608, /* LEFT_BRACE */ - RIGHT_BRACE = 609, /* RIGHT_BRACE */ - DOT = 610, /* DOT */ - COMMA = 611, /* COMMA */ - COLON = 612, /* COLON */ - EQUAL = 613, /* EQUAL */ - SEMICOLON = 614, /* SEMICOLON */ - BANG = 615, /* BANG */ - DASH = 616, /* DASH */ - TILDE = 617, /* TILDE */ - PLUS = 618, /* PLUS */ - STAR = 619, /* STAR */ - SLASH = 620, /* SLASH */ - PERCENT = 621, /* PERCENT */ - LEFT_ANGLE = 622, /* LEFT_ANGLE */ - RIGHT_ANGLE = 623, /* RIGHT_ANGLE */ - VERTICAL_BAR = 624, /* VERTICAL_BAR */ - CARET = 625, /* CARET */ - AMPERSAND = 626, /* AMPERSAND */ - QUESTION = 627, /* QUESTION */ - INVARIANT = 628, /* INVARIANT */ - HIGH_PRECISION = 629, /* HIGH_PRECISION */ - MEDIUM_PRECISION = 630, /* MEDIUM_PRECISION */ - LOW_PRECISION = 631, /* LOW_PRECISION */ - PRECISION = 632, /* PRECISION */ - PACKED = 633, /* PACKED */ - RESOURCE = 634, /* RESOURCE */ - SUPERP = 635, /* SUPERP */ - FLOATCONSTANT = 636, /* FLOATCONSTANT */ - INTCONSTANT = 637, /* INTCONSTANT */ - UINTCONSTANT = 638, /* UINTCONSTANT */ - BOOLCONSTANT = 639, /* BOOLCONSTANT */ - IDENTIFIER = 640, /* IDENTIFIER */ - TYPE_NAME = 641, /* TYPE_NAME */ - CENTROID = 642, /* CENTROID */ - IN = 643, /* IN */ - OUT = 644, /* OUT */ - INOUT = 645, /* INOUT */ - STRUCT = 646, /* STRUCT */ - VOID = 647, /* VOID */ - WHILE = 648, /* WHILE */ - BREAK = 649, /* BREAK */ - CONTINUE = 650, /* CONTINUE */ - DO = 651, /* DO */ - ELSE = 652, /* ELSE */ - FOR = 653, /* FOR */ - IF = 654, /* IF */ - DISCARD = 655, /* DISCARD */ - RETURN = 656, /* RETURN */ - SWITCH = 657, /* SWITCH */ - CASE = 658, /* CASE */ - DEFAULT = 659, /* DEFAULT */ - TERMINATE_INVOCATION = 660, /* TERMINATE_INVOCATION */ - TERMINATE_RAY = 661, /* TERMINATE_RAY */ - IGNORE_INTERSECTION = 662, /* IGNORE_INTERSECTION */ - UNIFORM = 663, /* UNIFORM */ - SHARED = 664, /* SHARED */ - BUFFER = 665, /* BUFFER */ - FLAT = 666, /* FLAT */ - SMOOTH = 667, /* SMOOTH */ - LAYOUT = 668, /* LAYOUT */ - DOUBLECONSTANT = 669, /* DOUBLECONSTANT */ - INT16CONSTANT = 670, /* INT16CONSTANT */ - UINT16CONSTANT = 671, /* UINT16CONSTANT */ - FLOAT16CONSTANT = 672, /* FLOAT16CONSTANT */ - INT32CONSTANT = 673, /* INT32CONSTANT */ - UINT32CONSTANT = 674, /* UINT32CONSTANT */ - INT64CONSTANT = 675, /* INT64CONSTANT */ - UINT64CONSTANT = 676, /* UINT64CONSTANT */ - SUBROUTINE = 677, /* SUBROUTINE */ - DEMOTE = 678, /* DEMOTE */ - PAYLOADNV = 679, /* PAYLOADNV */ - PAYLOADINNV = 680, /* PAYLOADINNV */ - HITATTRNV = 681, /* HITATTRNV */ - CALLDATANV = 682, /* CALLDATANV */ - CALLDATAINNV = 683, /* CALLDATAINNV */ - PAYLOADEXT = 684, /* PAYLOADEXT */ - PAYLOADINEXT = 685, /* PAYLOADINEXT */ - HITATTREXT = 686, /* HITATTREXT */ - CALLDATAEXT = 687, /* CALLDATAEXT */ - CALLDATAINEXT = 688, /* CALLDATAINEXT */ - PATCH = 689, /* PATCH */ - SAMPLE = 690, /* SAMPLE */ - NONUNIFORM = 691, /* NONUNIFORM */ - COHERENT = 692, /* COHERENT */ - VOLATILE = 693, /* VOLATILE */ - RESTRICT = 694, /* RESTRICT */ - READONLY = 695, /* READONLY */ - WRITEONLY = 696, /* WRITEONLY */ - DEVICECOHERENT = 697, /* DEVICECOHERENT */ - QUEUEFAMILYCOHERENT = 698, /* QUEUEFAMILYCOHERENT */ - WORKGROUPCOHERENT = 699, /* WORKGROUPCOHERENT */ - SUBGROUPCOHERENT = 700, /* SUBGROUPCOHERENT */ - NONPRIVATE = 701, /* NONPRIVATE */ - SHADERCALLCOHERENT = 702, /* SHADERCALLCOHERENT */ - NOPERSPECTIVE = 703, /* NOPERSPECTIVE */ - EXPLICITINTERPAMD = 704, /* EXPLICITINTERPAMD */ - PERVERTEXEXT = 705, /* PERVERTEXEXT */ - PERVERTEXNV = 706, /* PERVERTEXNV */ - PERPRIMITIVENV = 707, /* PERPRIMITIVENV */ - PERVIEWNV = 708, /* PERVIEWNV */ - PERTASKNV = 709, /* PERTASKNV */ - PERPRIMITIVEEXT = 710, /* PERPRIMITIVEEXT */ - TASKPAYLOADWORKGROUPEXT = 711, /* TASKPAYLOADWORKGROUPEXT */ - PRECISE = 712 /* PRECISE */ + COOPMAT = 421, /* COOPMAT */ + HITOBJECTNV = 422, /* HITOBJECTNV */ + HITOBJECTATTRNV = 423, /* HITOBJECTATTRNV */ + SAMPLERCUBEARRAY = 424, /* SAMPLERCUBEARRAY */ + SAMPLERCUBEARRAYSHADOW = 425, /* SAMPLERCUBEARRAYSHADOW */ + ISAMPLERCUBEARRAY = 426, /* ISAMPLERCUBEARRAY */ + USAMPLERCUBEARRAY = 427, /* USAMPLERCUBEARRAY */ + SAMPLER1D = 428, /* SAMPLER1D */ + SAMPLER1DARRAY = 429, /* SAMPLER1DARRAY */ + SAMPLER1DARRAYSHADOW = 430, /* SAMPLER1DARRAYSHADOW */ + ISAMPLER1D = 431, /* ISAMPLER1D */ + SAMPLER1DSHADOW = 432, /* SAMPLER1DSHADOW */ + SAMPLER2DRECT = 433, /* SAMPLER2DRECT */ + SAMPLER2DRECTSHADOW = 434, /* SAMPLER2DRECTSHADOW */ + ISAMPLER2DRECT = 435, /* ISAMPLER2DRECT */ + USAMPLER2DRECT = 436, /* USAMPLER2DRECT */ + SAMPLERBUFFER = 437, /* SAMPLERBUFFER */ + ISAMPLERBUFFER = 438, /* ISAMPLERBUFFER */ + USAMPLERBUFFER = 439, /* USAMPLERBUFFER */ + SAMPLER2DMS = 440, /* SAMPLER2DMS */ + ISAMPLER2DMS = 441, /* ISAMPLER2DMS */ + USAMPLER2DMS = 442, /* USAMPLER2DMS */ + SAMPLER2DMSARRAY = 443, /* SAMPLER2DMSARRAY */ + ISAMPLER2DMSARRAY = 444, /* ISAMPLER2DMSARRAY */ + USAMPLER2DMSARRAY = 445, /* USAMPLER2DMSARRAY */ + SAMPLEREXTERNALOES = 446, /* SAMPLEREXTERNALOES */ + SAMPLEREXTERNAL2DY2YEXT = 447, /* SAMPLEREXTERNAL2DY2YEXT */ + ISAMPLER1DARRAY = 448, /* ISAMPLER1DARRAY */ + USAMPLER1D = 449, /* USAMPLER1D */ + USAMPLER1DARRAY = 450, /* USAMPLER1DARRAY */ + F16SAMPLER1D = 451, /* F16SAMPLER1D */ + F16SAMPLER2D = 452, /* F16SAMPLER2D */ + F16SAMPLER3D = 453, /* F16SAMPLER3D */ + F16SAMPLER2DRECT = 454, /* F16SAMPLER2DRECT */ + F16SAMPLERCUBE = 455, /* F16SAMPLERCUBE */ + F16SAMPLER1DARRAY = 456, /* F16SAMPLER1DARRAY */ + F16SAMPLER2DARRAY = 457, /* F16SAMPLER2DARRAY */ + F16SAMPLERCUBEARRAY = 458, /* F16SAMPLERCUBEARRAY */ + F16SAMPLERBUFFER = 459, /* F16SAMPLERBUFFER */ + F16SAMPLER2DMS = 460, /* F16SAMPLER2DMS */ + F16SAMPLER2DMSARRAY = 461, /* F16SAMPLER2DMSARRAY */ + F16SAMPLER1DSHADOW = 462, /* F16SAMPLER1DSHADOW */ + F16SAMPLER2DSHADOW = 463, /* F16SAMPLER2DSHADOW */ + F16SAMPLER1DARRAYSHADOW = 464, /* F16SAMPLER1DARRAYSHADOW */ + F16SAMPLER2DARRAYSHADOW = 465, /* F16SAMPLER2DARRAYSHADOW */ + F16SAMPLER2DRECTSHADOW = 466, /* F16SAMPLER2DRECTSHADOW */ + F16SAMPLERCUBESHADOW = 467, /* F16SAMPLERCUBESHADOW */ + F16SAMPLERCUBEARRAYSHADOW = 468, /* F16SAMPLERCUBEARRAYSHADOW */ + IMAGE1D = 469, /* IMAGE1D */ + IIMAGE1D = 470, /* IIMAGE1D */ + UIMAGE1D = 471, /* UIMAGE1D */ + IMAGE2D = 472, /* IMAGE2D */ + IIMAGE2D = 473, /* IIMAGE2D */ + UIMAGE2D = 474, /* UIMAGE2D */ + IMAGE3D = 475, /* IMAGE3D */ + IIMAGE3D = 476, /* IIMAGE3D */ + UIMAGE3D = 477, /* UIMAGE3D */ + IMAGE2DRECT = 478, /* IMAGE2DRECT */ + IIMAGE2DRECT = 479, /* IIMAGE2DRECT */ + UIMAGE2DRECT = 480, /* UIMAGE2DRECT */ + IMAGECUBE = 481, /* IMAGECUBE */ + IIMAGECUBE = 482, /* IIMAGECUBE */ + UIMAGECUBE = 483, /* UIMAGECUBE */ + IMAGEBUFFER = 484, /* IMAGEBUFFER */ + IIMAGEBUFFER = 485, /* IIMAGEBUFFER */ + UIMAGEBUFFER = 486, /* UIMAGEBUFFER */ + IMAGE1DARRAY = 487, /* IMAGE1DARRAY */ + IIMAGE1DARRAY = 488, /* IIMAGE1DARRAY */ + UIMAGE1DARRAY = 489, /* UIMAGE1DARRAY */ + IMAGE2DARRAY = 490, /* IMAGE2DARRAY */ + IIMAGE2DARRAY = 491, /* IIMAGE2DARRAY */ + UIMAGE2DARRAY = 492, /* UIMAGE2DARRAY */ + IMAGECUBEARRAY = 493, /* IMAGECUBEARRAY */ + IIMAGECUBEARRAY = 494, /* IIMAGECUBEARRAY */ + UIMAGECUBEARRAY = 495, /* UIMAGECUBEARRAY */ + IMAGE2DMS = 496, /* IMAGE2DMS */ + IIMAGE2DMS = 497, /* IIMAGE2DMS */ + UIMAGE2DMS = 498, /* UIMAGE2DMS */ + IMAGE2DMSARRAY = 499, /* IMAGE2DMSARRAY */ + IIMAGE2DMSARRAY = 500, /* IIMAGE2DMSARRAY */ + UIMAGE2DMSARRAY = 501, /* UIMAGE2DMSARRAY */ + F16IMAGE1D = 502, /* F16IMAGE1D */ + F16IMAGE2D = 503, /* F16IMAGE2D */ + F16IMAGE3D = 504, /* F16IMAGE3D */ + F16IMAGE2DRECT = 505, /* F16IMAGE2DRECT */ + F16IMAGECUBE = 506, /* F16IMAGECUBE */ + F16IMAGE1DARRAY = 507, /* F16IMAGE1DARRAY */ + F16IMAGE2DARRAY = 508, /* F16IMAGE2DARRAY */ + F16IMAGECUBEARRAY = 509, /* F16IMAGECUBEARRAY */ + F16IMAGEBUFFER = 510, /* F16IMAGEBUFFER */ + F16IMAGE2DMS = 511, /* F16IMAGE2DMS */ + F16IMAGE2DMSARRAY = 512, /* F16IMAGE2DMSARRAY */ + I64IMAGE1D = 513, /* I64IMAGE1D */ + U64IMAGE1D = 514, /* U64IMAGE1D */ + I64IMAGE2D = 515, /* I64IMAGE2D */ + U64IMAGE2D = 516, /* U64IMAGE2D */ + I64IMAGE3D = 517, /* I64IMAGE3D */ + U64IMAGE3D = 518, /* U64IMAGE3D */ + I64IMAGE2DRECT = 519, /* I64IMAGE2DRECT */ + U64IMAGE2DRECT = 520, /* U64IMAGE2DRECT */ + I64IMAGECUBE = 521, /* I64IMAGECUBE */ + U64IMAGECUBE = 522, /* U64IMAGECUBE */ + I64IMAGEBUFFER = 523, /* I64IMAGEBUFFER */ + U64IMAGEBUFFER = 524, /* U64IMAGEBUFFER */ + I64IMAGE1DARRAY = 525, /* I64IMAGE1DARRAY */ + U64IMAGE1DARRAY = 526, /* U64IMAGE1DARRAY */ + I64IMAGE2DARRAY = 527, /* I64IMAGE2DARRAY */ + U64IMAGE2DARRAY = 528, /* U64IMAGE2DARRAY */ + I64IMAGECUBEARRAY = 529, /* I64IMAGECUBEARRAY */ + U64IMAGECUBEARRAY = 530, /* U64IMAGECUBEARRAY */ + I64IMAGE2DMS = 531, /* I64IMAGE2DMS */ + U64IMAGE2DMS = 532, /* U64IMAGE2DMS */ + I64IMAGE2DMSARRAY = 533, /* I64IMAGE2DMSARRAY */ + U64IMAGE2DMSARRAY = 534, /* U64IMAGE2DMSARRAY */ + TEXTURECUBEARRAY = 535, /* TEXTURECUBEARRAY */ + ITEXTURECUBEARRAY = 536, /* ITEXTURECUBEARRAY */ + UTEXTURECUBEARRAY = 537, /* UTEXTURECUBEARRAY */ + TEXTURE1D = 538, /* TEXTURE1D */ + ITEXTURE1D = 539, /* ITEXTURE1D */ + UTEXTURE1D = 540, /* UTEXTURE1D */ + TEXTURE1DARRAY = 541, /* TEXTURE1DARRAY */ + ITEXTURE1DARRAY = 542, /* ITEXTURE1DARRAY */ + UTEXTURE1DARRAY = 543, /* UTEXTURE1DARRAY */ + TEXTURE2DRECT = 544, /* TEXTURE2DRECT */ + ITEXTURE2DRECT = 545, /* ITEXTURE2DRECT */ + UTEXTURE2DRECT = 546, /* UTEXTURE2DRECT */ + TEXTUREBUFFER = 547, /* TEXTUREBUFFER */ + ITEXTUREBUFFER = 548, /* ITEXTUREBUFFER */ + UTEXTUREBUFFER = 549, /* UTEXTUREBUFFER */ + TEXTURE2DMS = 550, /* TEXTURE2DMS */ + ITEXTURE2DMS = 551, /* ITEXTURE2DMS */ + UTEXTURE2DMS = 552, /* UTEXTURE2DMS */ + TEXTURE2DMSARRAY = 553, /* TEXTURE2DMSARRAY */ + ITEXTURE2DMSARRAY = 554, /* ITEXTURE2DMSARRAY */ + UTEXTURE2DMSARRAY = 555, /* UTEXTURE2DMSARRAY */ + F16TEXTURE1D = 556, /* F16TEXTURE1D */ + F16TEXTURE2D = 557, /* F16TEXTURE2D */ + F16TEXTURE3D = 558, /* F16TEXTURE3D */ + F16TEXTURE2DRECT = 559, /* F16TEXTURE2DRECT */ + F16TEXTURECUBE = 560, /* F16TEXTURECUBE */ + F16TEXTURE1DARRAY = 561, /* F16TEXTURE1DARRAY */ + F16TEXTURE2DARRAY = 562, /* F16TEXTURE2DARRAY */ + F16TEXTURECUBEARRAY = 563, /* F16TEXTURECUBEARRAY */ + F16TEXTUREBUFFER = 564, /* F16TEXTUREBUFFER */ + F16TEXTURE2DMS = 565, /* F16TEXTURE2DMS */ + F16TEXTURE2DMSARRAY = 566, /* F16TEXTURE2DMSARRAY */ + SUBPASSINPUT = 567, /* SUBPASSINPUT */ + SUBPASSINPUTMS = 568, /* SUBPASSINPUTMS */ + ISUBPASSINPUT = 569, /* ISUBPASSINPUT */ + ISUBPASSINPUTMS = 570, /* ISUBPASSINPUTMS */ + USUBPASSINPUT = 571, /* USUBPASSINPUT */ + USUBPASSINPUTMS = 572, /* USUBPASSINPUTMS */ + F16SUBPASSINPUT = 573, /* F16SUBPASSINPUT */ + F16SUBPASSINPUTMS = 574, /* F16SUBPASSINPUTMS */ + SPIRV_INSTRUCTION = 575, /* SPIRV_INSTRUCTION */ + SPIRV_EXECUTION_MODE = 576, /* SPIRV_EXECUTION_MODE */ + SPIRV_EXECUTION_MODE_ID = 577, /* SPIRV_EXECUTION_MODE_ID */ + SPIRV_DECORATE = 578, /* SPIRV_DECORATE */ + SPIRV_DECORATE_ID = 579, /* SPIRV_DECORATE_ID */ + SPIRV_DECORATE_STRING = 580, /* SPIRV_DECORATE_STRING */ + SPIRV_TYPE = 581, /* SPIRV_TYPE */ + SPIRV_STORAGE_CLASS = 582, /* SPIRV_STORAGE_CLASS */ + SPIRV_BY_REFERENCE = 583, /* SPIRV_BY_REFERENCE */ + SPIRV_LITERAL = 584, /* SPIRV_LITERAL */ + ATTACHMENTEXT = 585, /* ATTACHMENTEXT */ + IATTACHMENTEXT = 586, /* IATTACHMENTEXT */ + UATTACHMENTEXT = 587, /* UATTACHMENTEXT */ + LEFT_OP = 588, /* LEFT_OP */ + RIGHT_OP = 589, /* RIGHT_OP */ + INC_OP = 590, /* INC_OP */ + DEC_OP = 591, /* DEC_OP */ + LE_OP = 592, /* LE_OP */ + GE_OP = 593, /* GE_OP */ + EQ_OP = 594, /* EQ_OP */ + NE_OP = 595, /* NE_OP */ + AND_OP = 596, /* AND_OP */ + OR_OP = 597, /* OR_OP */ + XOR_OP = 598, /* XOR_OP */ + MUL_ASSIGN = 599, /* MUL_ASSIGN */ + DIV_ASSIGN = 600, /* DIV_ASSIGN */ + ADD_ASSIGN = 601, /* ADD_ASSIGN */ + MOD_ASSIGN = 602, /* MOD_ASSIGN */ + LEFT_ASSIGN = 603, /* LEFT_ASSIGN */ + RIGHT_ASSIGN = 604, /* RIGHT_ASSIGN */ + AND_ASSIGN = 605, /* AND_ASSIGN */ + XOR_ASSIGN = 606, /* XOR_ASSIGN */ + OR_ASSIGN = 607, /* OR_ASSIGN */ + SUB_ASSIGN = 608, /* SUB_ASSIGN */ + STRING_LITERAL = 609, /* STRING_LITERAL */ + LEFT_PAREN = 610, /* LEFT_PAREN */ + RIGHT_PAREN = 611, /* RIGHT_PAREN */ + LEFT_BRACKET = 612, /* LEFT_BRACKET */ + RIGHT_BRACKET = 613, /* RIGHT_BRACKET */ + LEFT_BRACE = 614, /* LEFT_BRACE */ + RIGHT_BRACE = 615, /* RIGHT_BRACE */ + DOT = 616, /* DOT */ + COMMA = 617, /* COMMA */ + COLON = 618, /* COLON */ + EQUAL = 619, /* EQUAL */ + SEMICOLON = 620, /* SEMICOLON */ + BANG = 621, /* BANG */ + DASH = 622, /* DASH */ + TILDE = 623, /* TILDE */ + PLUS = 624, /* PLUS */ + STAR = 625, /* STAR */ + SLASH = 626, /* SLASH */ + PERCENT = 627, /* PERCENT */ + LEFT_ANGLE = 628, /* LEFT_ANGLE */ + RIGHT_ANGLE = 629, /* RIGHT_ANGLE */ + VERTICAL_BAR = 630, /* VERTICAL_BAR */ + CARET = 631, /* CARET */ + AMPERSAND = 632, /* AMPERSAND */ + QUESTION = 633, /* QUESTION */ + INVARIANT = 634, /* INVARIANT */ + HIGH_PRECISION = 635, /* HIGH_PRECISION */ + MEDIUM_PRECISION = 636, /* MEDIUM_PRECISION */ + LOW_PRECISION = 637, /* LOW_PRECISION */ + PRECISION = 638, /* PRECISION */ + PACKED = 639, /* PACKED */ + RESOURCE = 640, /* RESOURCE */ + SUPERP = 641, /* SUPERP */ + FLOATCONSTANT = 642, /* FLOATCONSTANT */ + INTCONSTANT = 643, /* INTCONSTANT */ + UINTCONSTANT = 644, /* UINTCONSTANT */ + BOOLCONSTANT = 645, /* BOOLCONSTANT */ + IDENTIFIER = 646, /* IDENTIFIER */ + TYPE_NAME = 647, /* TYPE_NAME */ + CENTROID = 648, /* CENTROID */ + IN = 649, /* IN */ + OUT = 650, /* OUT */ + INOUT = 651, /* INOUT */ + STRUCT = 652, /* STRUCT */ + VOID = 653, /* VOID */ + WHILE = 654, /* WHILE */ + BREAK = 655, /* BREAK */ + CONTINUE = 656, /* CONTINUE */ + DO = 657, /* DO */ + ELSE = 658, /* ELSE */ + FOR = 659, /* FOR */ + IF = 660, /* IF */ + DISCARD = 661, /* DISCARD */ + RETURN = 662, /* RETURN */ + SWITCH = 663, /* SWITCH */ + CASE = 664, /* CASE */ + DEFAULT = 665, /* DEFAULT */ + TERMINATE_INVOCATION = 666, /* TERMINATE_INVOCATION */ + TERMINATE_RAY = 667, /* TERMINATE_RAY */ + IGNORE_INTERSECTION = 668, /* IGNORE_INTERSECTION */ + UNIFORM = 669, /* UNIFORM */ + SHARED = 670, /* SHARED */ + BUFFER = 671, /* BUFFER */ + TILEIMAGEEXT = 672, /* TILEIMAGEEXT */ + FLAT = 673, /* FLAT */ + SMOOTH = 674, /* SMOOTH */ + LAYOUT = 675, /* LAYOUT */ + DOUBLECONSTANT = 676, /* DOUBLECONSTANT */ + INT16CONSTANT = 677, /* INT16CONSTANT */ + UINT16CONSTANT = 678, /* UINT16CONSTANT */ + FLOAT16CONSTANT = 679, /* FLOAT16CONSTANT */ + INT32CONSTANT = 680, /* INT32CONSTANT */ + UINT32CONSTANT = 681, /* UINT32CONSTANT */ + INT64CONSTANT = 682, /* INT64CONSTANT */ + UINT64CONSTANT = 683, /* UINT64CONSTANT */ + SUBROUTINE = 684, /* SUBROUTINE */ + DEMOTE = 685, /* DEMOTE */ + PAYLOADNV = 686, /* PAYLOADNV */ + PAYLOADINNV = 687, /* PAYLOADINNV */ + HITATTRNV = 688, /* HITATTRNV */ + CALLDATANV = 689, /* CALLDATANV */ + CALLDATAINNV = 690, /* CALLDATAINNV */ + PAYLOADEXT = 691, /* PAYLOADEXT */ + PAYLOADINEXT = 692, /* PAYLOADINEXT */ + HITATTREXT = 693, /* HITATTREXT */ + CALLDATAEXT = 694, /* CALLDATAEXT */ + CALLDATAINEXT = 695, /* CALLDATAINEXT */ + PATCH = 696, /* PATCH */ + SAMPLE = 697, /* SAMPLE */ + NONUNIFORM = 698, /* NONUNIFORM */ + COHERENT = 699, /* COHERENT */ + VOLATILE = 700, /* VOLATILE */ + RESTRICT = 701, /* RESTRICT */ + READONLY = 702, /* READONLY */ + WRITEONLY = 703, /* WRITEONLY */ + DEVICECOHERENT = 704, /* DEVICECOHERENT */ + QUEUEFAMILYCOHERENT = 705, /* QUEUEFAMILYCOHERENT */ + WORKGROUPCOHERENT = 706, /* WORKGROUPCOHERENT */ + SUBGROUPCOHERENT = 707, /* SUBGROUPCOHERENT */ + NONPRIVATE = 708, /* NONPRIVATE */ + SHADERCALLCOHERENT = 709, /* SHADERCALLCOHERENT */ + NOPERSPECTIVE = 710, /* NOPERSPECTIVE */ + EXPLICITINTERPAMD = 711, /* EXPLICITINTERPAMD */ + PERVERTEXEXT = 712, /* PERVERTEXEXT */ + PERVERTEXNV = 713, /* PERVERTEXNV */ + PERPRIMITIVENV = 714, /* PERPRIMITIVENV */ + PERVIEWNV = 715, /* PERVIEWNV */ + PERTASKNV = 716, /* PERTASKNV */ + PERPRIMITIVEEXT = 717, /* PERPRIMITIVEEXT */ + TASKPAYLOADWORKGROUPEXT = 718, /* TASKPAYLOADWORKGROUPEXT */ + PRECISE = 719 /* PRECISE */ }; typedef enum yytokentype yytoken_kind_t; #endif @@ -553,10 +560,10 @@ union YYSTYPE glslang::TArraySizes* arraySizes; glslang::TIdentifierList* identifierList; }; - glslang::TArraySizes* typeParameters; + glslang::TTypeParameters* typeParameters; } interm; -#line 560 "MachineIndependent/glslang_tab.cpp.h" +#line 567 "MachineIndependent/glslang_tab.cpp.h" }; typedef union YYSTYPE YYSTYPE; @@ -566,6 +573,8 @@ typedef union YYSTYPE YYSTYPE; + int yyparse (glslang::TParseContext* pParseContext); + #endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp index 98755612..d5fc26bb 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp @@ -36,8 +36,6 @@ // POSSIBILITY OF SUCH DAMAGE. // -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - #include "localintermediate.h" #include "../Include/InfoSink.h" @@ -663,13 +661,13 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpSubpassLoad: out.debug << "subpassLoad"; break; case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; + case EOpColorAttachmentReadEXT: out.debug << "colorAttachmentReadEXT"; break; + case EOpConstructReference: out.debug << "Construct reference type"; break; case EOpDeclare: out.debug << "Declare"; break; -#ifndef GLSLANG_WEB case EOpSpirvInst: out.debug << "spirv_instruction"; break; -#endif default: out.debug.message(EPrefixError, "Bad unary op"); } @@ -807,7 +805,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpConstructStruct: out.debug << "Construct structure"; break; case EOpConstructTextureSampler: out.debug << "Construct combined texture-sampler"; break; case EOpConstructReference: out.debug << "Construct reference"; break; - case EOpConstructCooperativeMatrix: out.debug << "Construct cooperative matrix"; break; + case EOpConstructCooperativeMatrixNV: out.debug << "Construct cooperative matrix NV"; break; + case EOpConstructCooperativeMatrixKHR: out.debug << "Construct cooperative matrix KHR"; break; case EOpConstructAccStruct: out.debug << "Construct acceleration structure"; break; case EOpLessThan: out.debug << "Compare Less Than"; break; @@ -1060,6 +1059,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpSubpassLoad: out.debug << "subpassLoad"; break; case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; + case EOpColorAttachmentReadEXT: out.debug << "colorAttachmentReadEXT"; break; + case EOpTraceNV: out.debug << "traceNV"; break; case EOpTraceRayMotionNV: out.debug << "traceRayMotionNV"; break; case EOpTraceKHR: out.debug << "traceRayKHR"; break; @@ -1097,17 +1098,53 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpRayQueryGetWorldRayOrigin: out.debug << "rayQueryGetWorldRayOriginEXT"; break; case EOpRayQueryGetIntersectionObjectToWorld: out.debug << "rayQueryGetIntersectionObjectToWorldEXT"; break; case EOpRayQueryGetIntersectionWorldToObject: out.debug << "rayQueryGetIntersectionWorldToObjectEXT"; break; + case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: out.debug << "rayQueryGetIntersectionTriangleVertexPositionsEXT"; break; - case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix"; break; - case EOpCooperativeMatrixStore: out.debug << "Store cooperative matrix"; break; - case EOpCooperativeMatrixMulAdd: out.debug << "MulAdd cooperative matrices"; break; + case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix KHR"; break; + case EOpCooperativeMatrixStore: out.debug << "Store cooperative matrix KHR"; break; + case EOpCooperativeMatrixMulAdd: out.debug << "MulAdd cooperative matrices KHR"; break; + case EOpCooperativeMatrixLoadNV: out.debug << "Load cooperative matrix NV"; break; + case EOpCooperativeMatrixStoreNV: out.debug << "Store cooperative matrix NV"; break; + case EOpCooperativeMatrixMulAddNV: out.debug << "MulAdd cooperative matrices NV"; break; case EOpIsHelperInvocation: out.debug << "IsHelperInvocation"; break; case EOpDebugPrintf: out.debug << "Debug printf"; break; -#ifndef GLSLANG_WEB + case EOpHitObjectTraceRayNV: out.debug << "HitObjectTraceRayNV"; break; + case EOpHitObjectTraceRayMotionNV: out.debug << "HitObjectTraceRayMotionNV"; break; + case EOpHitObjectRecordHitNV: out.debug << "HitObjectRecordHitNV"; break; + case EOpHitObjectRecordHitMotionNV: out.debug << "HitObjectRecordHitMotionNV"; break; + case EOpHitObjectRecordHitWithIndexNV: out.debug << "HitObjectRecordHitWithIndexNV"; break; + case EOpHitObjectRecordHitWithIndexMotionNV: out.debug << "HitObjectRecordHitWithIndexMotionNV"; break; + case EOpHitObjectRecordMissNV: out.debug << "HitObjectRecordMissNV"; break; + case EOpHitObjectRecordMissMotionNV: out.debug << "HitObjectRecordMissMotionNV"; break; + case EOpHitObjectRecordEmptyNV: out.debug << "HitObjectRecordEmptyNV"; break; + case EOpHitObjectExecuteShaderNV: out.debug << "HitObjectExecuteShaderNV"; break; + case EOpHitObjectIsEmptyNV: out.debug << "HitObjectIsEmptyNV"; break; + case EOpHitObjectIsMissNV: out.debug << "HitObjectIsMissNV"; break; + case EOpHitObjectIsHitNV: out.debug << "HitObjectIsHitNV"; break; + case EOpHitObjectGetRayTMinNV: out.debug << "HitObjectGetRayTMinNV"; break; + case EOpHitObjectGetRayTMaxNV: out.debug << "HitObjectGetRayTMaxNV"; break; + case EOpHitObjectGetObjectRayOriginNV: out.debug << "HitObjectGetObjectRayOriginNV"; break; + case EOpHitObjectGetObjectRayDirectionNV: out.debug << "HitObjectGetObjectRayDirectionNV"; break; + case EOpHitObjectGetWorldRayOriginNV: out.debug << "HitObjectGetWorldRayOriginNV"; break; + case EOpHitObjectGetWorldRayDirectionNV: out.debug << "HitObjectGetWorldRayDirectionNV"; break; + case EOpHitObjectGetObjectToWorldNV: out.debug << "HitObjectGetObjectToWorldNV"; break; + case EOpHitObjectGetWorldToObjectNV: out.debug << "HitObjectGetWorldToObjectNV"; break; + case EOpHitObjectGetInstanceCustomIndexNV: out.debug<< "HitObjectGetInstanceCustomIndexNV"; break; + case EOpHitObjectGetInstanceIdNV: out.debug << "HitObjectGetInstaneIdNV"; break; + case EOpHitObjectGetGeometryIndexNV: out.debug << "HitObjectGetGeometryIndexNV"; break; + case EOpHitObjectGetPrimitiveIndexNV: out.debug << "HitObjectGetPrimitiveIndexNV"; break; + case EOpHitObjectGetHitKindNV: out.debug << "HitObjectGetHitKindNV"; break; + case EOpHitObjectGetAttributesNV: out.debug << "HitObjectGetAttributesNV"; break; + case EOpHitObjectGetCurrentTimeNV: out.debug << "HitObjectGetCurrentTimeNV"; break; + case EOpHitObjectGetShaderBindingTableRecordIndexNV: out.debug << "HitObjectGetShaderBindingTableRecordIndexNV"; break; + case EOpHitObjectGetShaderRecordBufferHandleNV: out.debug << "HitObjectReadShaderRecordBufferHandleNV"; break; + case EOpReorderThreadNV: out.debug << "ReorderThreadNV"; break; + case EOpSpirvInst: out.debug << "spirv_instruction"; break; -#endif + case EOpStencilAttachmentReadEXT: out.debug << "stencilAttachmentReadEXT"; break; + case EOpDepthAttachmentReadEXT: out.debug << "depthAttachmentReadEXT"; break; default: out.debug.message(EPrefixError, "Bad aggregation op"); } @@ -1512,6 +1549,12 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree) infoSink.debug << "using early_fragment_tests\n"; if (postDepthCoverage) infoSink.debug << "using post_depth_coverage\n"; + if (nonCoherentColorAttachmentReadEXT) + infoSink.debug << "using non_coherent_color_attachment_readEXT\n"; + if (nonCoherentDepthAttachmentReadEXT) + infoSink.debug << "using non_coherent_depth_attachment_readEXT\n"; + if (nonCoherentStencilAttachmentReadEXT) + infoSink.debug << "using non_coherent_stencil_attachment_readEXT\n"; if (depthLayout != EldNone) infoSink.debug << "using " << TQualifier::getLayoutDepthString(depthLayout) << "\n"; if (blendEquations != 0) { @@ -1552,7 +1595,7 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree) break; } - if (treeRoot == 0 || ! tree) + if (treeRoot == nullptr || ! tree) return; TOutputTraverser it(infoSink); @@ -1562,5 +1605,3 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree) } } // end namespace glslang - -#endif // !GLSLANG_WEB && !GLSLANG_ANGLE diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp index 4250e92d..63dedf76 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp @@ -33,8 +33,6 @@ // POSSIBILITY OF SUCH DAMAGE. // -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - #include "../Include/Common.h" #include "../Include/InfoSink.h" #include "../Include/Types.h" @@ -145,6 +143,8 @@ class TVarSetTraverser : public TLiveTraverser base->getWritableType().getQualifier().layoutComponent = at->second.newComponent; if (at->second.newIndex != -1) base->getWritableType().getQualifier().layoutIndex = at->second.newIndex; + if (at->second.upgradedToPushConstant) + base->getWritableType().getQualifier().layoutPushConstant = true; } private: @@ -1670,31 +1670,34 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) { } } } - // If it's been upgraded to push_constant, then remove it from the uniformVector + // If it's been upgraded to push_constant, then set the flag so when its traversed + // in the next for loop, all references to this symbol will get their flag changed. // so it doesn't get a set/binding assigned to it. if (upgraded) { - while (1) { - auto at = std::find_if(uniformVector.begin(), uniformVector.end(), - [this](const TVarLivePair& p) { return p.first == autoPushConstantBlockName; }); - if (at != uniformVector.end()) - uniformVector.erase(at); - else - break; - } + std::for_each(uniformVector.begin(), uniformVector.end(), + [this](TVarLivePair& p) { + if (p.first == autoPushConstantBlockName) { + p.second.upgradedToPushConstant = true; + } + }); } } for (size_t stage = 0; stage < EShLangCount; stage++) { if (intermediates[stage] != nullptr) { // traverse each stage, set new location to each input/output and unifom symbol, set new binding to - // ubo, ssbo and opaque symbols + // ubo, ssbo and opaque symbols. Assign push_constant upgrades as well. TVarLiveMap** pUniformVarMap = uniformResolve.uniformVarMap; std::for_each(uniformVector.begin(), uniformVector.end(), [pUniformVarMap, stage](TVarLivePair p) { auto at = pUniformVarMap[stage]->find(p.second.symbol->getAccessName()); if (at != pUniformVarMap[stage]->end() && at->second.id == p.second.id){ - int resolvedBinding = at->second.newBinding; - at->second = p.second; - if (resolvedBinding > 0) - at->second.newBinding = resolvedBinding; + if (p.second.upgradedToPushConstant) { + at->second.upgradedToPushConstant = true; + } else { + int resolvedBinding = at->second.newBinding; + at->second = p.second; + if (resolvedBinding > 0) + at->second.newBinding = resolvedBinding; + } } }); TVarSetTraverser iter_iomap(*intermediates[stage], *inVarMaps[stage], *outVarMaps[stage], @@ -1709,5 +1712,3 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) { } } // end namespace glslang - -#endif // !GLSLANG_WEB && !GLSLANG_ANGLE diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.h b/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.h index ba7bc3bb..35babbce 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.h +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.h @@ -33,8 +33,6 @@ // POSSIBILITY OF SUCH DAMAGE. // -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - #ifndef _IOMAPPER_INCLUDED #define _IOMAPPER_INCLUDED @@ -55,6 +53,7 @@ struct TVarEntryInfo { long long id; TIntermSymbol* symbol; bool live; + bool upgradedToPushConstant; int newBinding; int newSet; int newLocation; @@ -63,6 +62,7 @@ struct TVarEntryInfo { EShLanguage stage; void clearNewAssignments() { + upgradedToPushConstant = false; newBinding = -1; newSet = -1; newLocation = -1; @@ -357,5 +357,3 @@ class TGlslIoMapper : public TIoMapper { } // end namespace glslang #endif // _IOMAPPER_INCLUDED - -#endif // !GLSLANG_WEB && !GLSLANG_ANGLE diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/limits.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/limits.cpp index 39157057..4404beca 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/limits.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/limits.cpp @@ -187,14 +187,12 @@ bool TIndexTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node) // void TParseContext::constantIndexExpressionCheck(TIntermNode* index) { -#ifndef GLSLANG_WEB TIndexTraverser it(inductiveLoopIds); index->traverse(&it); if (it.bad) error(it.badLoc, "Non-constant-index-expression", "limitations", ""); -#endif } } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp index acc512fd..d69300b8 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp @@ -57,13 +57,11 @@ namespace glslang { // void TIntermediate::error(TInfoSink& infoSink, const char* message, EShLanguage unitStage) { -#ifndef GLSLANG_WEB infoSink.info.prefix(EPrefixError); if (unitStage < EShLangCount) infoSink.info << "Linking " << StageName(getStage()) << " and " << StageName(unitStage) << " stages: " << message << "\n"; else infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n"; -#endif ++numErrors; } @@ -71,13 +69,11 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message, EShLanguage // Link-time warning. void TIntermediate::warn(TInfoSink& infoSink, const char* message, EShLanguage unitStage) { -#ifndef GLSLANG_WEB infoSink.info.prefix(EPrefixWarning); if (unitStage < EShLangCount) infoSink.info << "Linking " << StageName(language) << " and " << StageName(unitStage) << " stages: " << message << "\n"; else infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n"; -#endif } // TODO: 4.4 offset/align: "Two blocks linked together in the same program with the same block @@ -89,11 +85,9 @@ void TIntermediate::warn(TInfoSink& infoSink, const char* message, EShLanguage u // void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) { -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) mergeCallGraphs(infoSink, unit); mergeModes(infoSink, unit); mergeTrees(infoSink, unit); -#endif } // @@ -161,8 +155,6 @@ void TIntermediate::mergeCallGraphs(TInfoSink& infoSink, TIntermediate& unit) callGraph.insert(callGraph.end(), unit.callGraph.begin(), unit.callGraph.end()); } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - #define MERGE_MAX(member) member = std::max(member, unit.member) #define MERGE_TRUE(member) if (unit.member) member = unit.member; @@ -271,6 +263,9 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) MERGE_TRUE(earlyFragmentTests); MERGE_TRUE(postDepthCoverage); + MERGE_TRUE(nonCoherentColorAttachmentReadEXT); + MERGE_TRUE(nonCoherentDepthAttachmentReadEXT); + MERGE_TRUE(nonCoherentStencilAttachmentReadEXT); if (depthLayout == EldNone) depthLayout = unit.depthLayout; @@ -378,8 +373,6 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit) ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end()); } -#endif - static const TString& getNameForIdMap(TIntermSymbol* symbol) { TShaderInterface si = symbol->getType().getShaderInterface(); @@ -749,6 +742,21 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin symbol->getQualifier().layoutLocation = unitSymbol->getQualifier().layoutLocation; } + // Update implicit array sizes + if (symbol->getWritableType().isImplicitlySizedArray() && unitSymbol->getType().isImplicitlySizedArray()) { + if (unitSymbol->getType().getImplicitArraySize() > symbol->getType().getImplicitArraySize()){ + symbol->getWritableType().updateImplicitArraySize(unitSymbol->getType().getImplicitArraySize()); + } + } + else if (symbol->getWritableType().isImplicitlySizedArray() && unitSymbol->getType().isSizedArray()) { + if (symbol->getWritableType().getImplicitArraySize() > unitSymbol->getType().getOuterArraySize()) + error(infoSink, "Implicit size of unsized array doesn't match same symbol among multiple shaders."); + } + else if (unitSymbol->getType().isImplicitlySizedArray() && symbol->getWritableType().isSizedArray()) { + if (unitSymbol->getType().getImplicitArraySize() > symbol->getWritableType().getOuterArraySize()) + error(infoSink, "Implicit size of unsized array doesn't match same symbol among multiple shaders."); + } + // Update implicit array sizes mergeImplicitArraySizes(symbol->getWritableType(), unitSymbol->getType()); @@ -759,6 +767,19 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin else if (symbol->getQualifier().isPushConstant() && unitSymbol->getQualifier().isPushConstant() && getStage() == unitStage) error(infoSink, "Only one push_constant block is allowed per stage"); } + + // Check conflicts between preset primitives and sizes of I/O variables among multiple geometry shaders + if (language == EShLangGeometry && unitStage == EShLangGeometry) + { + TIntermSymbol* unitSymbol = unitLinkerObjects[unitLinkObj]->getAsSymbolNode(); + if (unitSymbol->isArray() && unitSymbol->getQualifier().storage == EvqVaryingIn && unitSymbol->getQualifier().builtIn == EbvNone) + if ((unitSymbol->getArraySizes()->isImplicitlySized() && + unitSymbol->getArraySizes()->getImplicitSize() != TQualifier::mapGeometryToSize(getInputPrimitive())) || + (! unitSymbol->getArraySizes()->isImplicitlySized() && + unitSymbol->getArraySizes()->getDimSize(0) != TQualifier::mapGeometryToSize(getInputPrimitive()))) + error(infoSink, "Not all array sizes match across all geometry shaders in the program"); + } + if (merge) { linkerObjects.push_back(unitLinkerObjects[unitLinkObj]); @@ -828,7 +849,6 @@ void TIntermediate::mergeImplicitArraySizes(TType& type, const TType& unitType) // void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& symbol, const TIntermSymbol& unitSymbol, EShLanguage unitStage) { -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) bool crossStage = getStage() != unitStage; bool writeTypeComparison = false; bool errorReported = false; @@ -863,7 +883,8 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy else { arraysMatch = symbol.getType().sameArrayness(unitSymbol.getType()) || (symbol.getType().isArray() && unitSymbol.getType().isArray() && - (symbol.getType().isUnsizedArray() || unitSymbol.getType().isUnsizedArray())); + (symbol.getType().isImplicitlySizedArray() || unitSymbol.getType().isImplicitlySizedArray() || + symbol.getType().isUnsizedArray() || unitSymbol.getType().isUnsizedArray())); } int lpidx = -1; @@ -1155,7 +1176,6 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy } } } -#endif } void TIntermediate::sharedBlockCheck(TInfoSink& infoSink) @@ -1202,7 +1222,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) // overlap/alias/missing I/O, etc. inOutLocationCheck(infoSink); -#ifndef GLSLANG_WEB if (getNumPushConstants() > 1) error(infoSink, "Only one push_constant block is allowed per stage"); @@ -1360,7 +1379,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) } finalLinkTraverser; treeRoot->traverse(&finalLinkTraverser); -#endif } // @@ -1383,7 +1401,7 @@ void TIntermediate::checkCallGraphCycles(TInfoSink& infoSink) TCall* newRoot; do { // See if we have unvisited parts of the graph. - newRoot = 0; + newRoot = nullptr; for (TGraph::iterator call = callGraph.begin(); call != callGraph.end(); ++call) { if (! call->visited) { newRoot = &(*call); @@ -1517,7 +1535,10 @@ void TIntermediate::checkCallGraphBodies(TInfoSink& infoSink, bool keepUncalled) if (! keepUncalled) { for (int f = 0; f < (int)functionSequence.size(); ++f) { if (! reachable[f]) + { + resetTopLevelUncalledStatus(functionSequence[f]->getAsAggregate()->getName()); functionSequence[f] = nullptr; + } } functionSequence.erase(std::remove(functionSequence.begin(), functionSequence.end(), nullptr), functionSequence.end()); } @@ -1585,7 +1606,7 @@ bool TIntermediate::userOutputUsed() const return found; } -// Accumulate locations used for inputs, outputs, and uniforms, payload and callable data +// Accumulate locations used for inputs, outputs, and uniforms, payload, callable data, and tileImageEXT // and check for collisions as the accumulation is done. // // Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value. @@ -1598,7 +1619,6 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ typeCollision = false; int set; - int setRT; if (qualifier.isPipeInput()) set = 0; else if (qualifier.isPipeOutput()) @@ -1607,10 +1627,14 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ set = 2; else if (qualifier.storage == EvqBuffer) set = 3; + else if (qualifier.storage == EvqTileImageEXT) + set = 4; else if (qualifier.isAnyPayload()) - setRT = 0; + set = 0; else if (qualifier.isAnyCallable()) - setRT = 1; + set = 1; + else if (qualifier.isHitObjectAttrNV()) + set = 2; else return -1; @@ -1649,13 +1673,14 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ // For raytracing IO (payloads and callabledata) each declaration occupies a single // slot irrespective of type. int collision = -1; // no collision -#ifndef GLSLANG_WEB - if (qualifier.isAnyPayload() || qualifier.isAnyCallable()) { + if (qualifier.isAnyPayload() || qualifier.isAnyCallable() || qualifier.isHitObjectAttrNV()) { TRange range(qualifier.layoutLocation, qualifier.layoutLocation); - collision = checkLocationRT(setRT, qualifier.layoutLocation); + collision = checkLocationRT(set, qualifier.layoutLocation); if (collision < 0) - usedIoRT[setRT].push_back(range); - } else if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 && + usedIoRT[set].push_back(range); + return collision; + } + if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 && (qualifier.isPipeInput() || qualifier.isPipeOutput())) { // Dealing with dvec3 in/out split across two locations. // Need two io-ranges. @@ -1681,31 +1706,33 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ if (collision < 0) usedIo[set].push_back(range2); } - } else -#endif - { - // Not a dvec3 in/out split across two locations, generic path. - // Need a single IO-range block. + return collision; + } - TRange locationRange(qualifier.layoutLocation, qualifier.layoutLocation + size - 1); - TRange componentRange(0, 3); - if (qualifier.hasComponent() || type.getVectorSize() > 0) { - int consumedComponents = type.getVectorSize() * (type.getBasicType() == EbtDouble ? 2 : 1); - if (qualifier.hasComponent()) - componentRange.start = qualifier.layoutComponent; - componentRange.last = componentRange.start + consumedComponents - 1; - } + // Not a dvec3 in/out split across two locations, generic path. + // Need a single IO-range block. - // combine location and component ranges - TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.getIndex() : 0); + TRange locationRange(qualifier.layoutLocation, qualifier.layoutLocation + size - 1); + TRange componentRange(0, 3); + if (qualifier.hasComponent() || type.getVectorSize() > 0) { + int consumedComponents = type.getVectorSize() * (type.getBasicType() == EbtDouble ? 2 : 1); + if (qualifier.hasComponent()) + componentRange.start = qualifier.layoutComponent; + componentRange.last = componentRange.start + consumedComponents - 1; + } - // check for collisions, except for vertex inputs on desktop targeting OpenGL - if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0) - collision = checkLocationRange(set, range, type, typeCollision); + // combine location and component ranges + TBasicType basicTy = type.getBasicType(); + if (basicTy == EbtSampler && type.getSampler().isAttachmentEXT()) + basicTy = type.getSampler().type; + TIoRange range(locationRange, componentRange, basicTy, qualifier.hasIndex() ? qualifier.getIndex() : 0); - if (collision < 0) - usedIo[set].push_back(range); - } + // check for collisions, except for vertex inputs on desktop targeting OpenGL + if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0) + collision = checkLocationRange(set, range, type, typeCollision); + + if (collision < 0) + usedIo[set].push_back(range); return collision; } @@ -1728,6 +1755,19 @@ int TIntermediate::checkLocationRange(int set, const TIoRange& range, const TTyp } } + // check typeCollision between tileImageEXT and out + if (set == 4 || set == 1) { + // if the set is "tileImageEXT", check against "out" and vice versa + int againstSet = (set == 4) ? 1 : 4; + for (size_t r = 0; r < usedIo[againstSet].size(); ++r) { + if (range.location.overlap(usedIo[againstSet][r].location) && type.getBasicType() != usedIo[againstSet][r].basicType) { + // aliased-type mismatch + typeCollision = true; + return std::max(range.location.start, usedIo[againstSet][r].location.start); + } + } + } + return -1; // no collision } @@ -1791,10 +1831,8 @@ int TIntermediate::computeTypeLocationSize(const TType& type, EShLanguage stage) if (type.isSizedArray() && !type.getQualifier().isPerView()) return type.getOuterArraySize() * computeTypeLocationSize(elementType, stage); else { -#ifndef GLSLANG_WEB // unset perViewNV attributes for arrayed per-view outputs: "perviewNV vec4 v[MAX_VIEWS][3];" elementType.getQualifier().perViewNV = false; -#endif return computeTypeLocationSize(elementType, stage); } } @@ -1870,8 +1908,6 @@ int TIntermediate::computeTypeUniformLocationSize(const TType& type) return 1; } -#ifndef GLSLANG_WEB - // Accumulate xfb buffer ranges and check for collisions as the accumulation is done. // // Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value. @@ -1989,8 +2025,6 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains } } -#endif - const int baseAlignmentVec4Std140 = 16; // Return the size and alignment of a component of the given type. @@ -1998,10 +2032,6 @@ const int baseAlignmentVec4Std140 = 16; // Return value is the alignment.. int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size) { -#ifdef GLSLANG_WEB - size = 4; return 4; -#endif - switch (type.getBasicType()) { case EbtInt64: case EbtUint64: @@ -2012,6 +2042,15 @@ int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size) case EbtInt16: case EbtUint16: size = 2; return 2; case EbtReference: size = 8; return 8; + case EbtSampler: + { + if (type.isBindlessImage() || type.isBindlessTexture()) { + size = 8; return 8; + } + else { + size = 4; return 4; + } + } default: size = 4; return 4; } } @@ -2332,7 +2371,6 @@ int TIntermediate::computeBufferReferenceTypeSize(const TType& type) return size; } -#ifndef GLSLANG_WEB bool TIntermediate::isIoResizeArray(const TType& type, EShLanguage language) { return type.isArray() && ((language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn) || @@ -2344,6 +2382,5 @@ bool TIntermediate::isIoResizeArray(const TType& type, EShLanguage language) { (language == EShLangMesh && type.getQualifier().storage == EvqVaryingOut && !type.getQualifier().perTaskNV)); } -#endif // not GLSLANG_WEB } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h b/bgfx/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h index e7a171cd..2f0e65ce 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h @@ -147,7 +147,6 @@ struct TOffsetRange { TRange offset; }; -#ifndef GLSLANG_WEB // Things that need to be tracked per xfb buffer. struct TXfbBuffer { TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false), @@ -159,7 +158,6 @@ struct TXfbBuffer { bool contains32BitType; bool contains16BitType; }; -#endif // Track a set of strings describing how the module was processed. // This includes command line options, transforms, etc., ideally inclusive enough @@ -225,6 +223,16 @@ enum ComputeDerivativeMode { LayoutDerivativeGroupLinear, // derivative_group_linearNV }; +// +// Status type on AST level. Some uncalled status or functions would be reset in call graph. +// Currently we will keep status set by explicitly declared layout or variable decl. +// +enum AstRefType { + AstRefTypeVar, // Status set by variable decl + AstRefTypeFunc, // Status set by function decl + AstRefTypeLayout, // Status set by layout decl +}; + class TIdMaps { public: TMap& operator[](long long i) { return maps[i]; } @@ -283,10 +291,8 @@ class TIntermediate { public: explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : language(l), -#ifndef GLSLANG_ANGLE profile(p), version(v), -#endif - treeRoot(0), + treeRoot(nullptr), resources(TBuiltInResource{}), numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false), invertY(false), @@ -303,9 +309,7 @@ class TIntermediate { atomicCounterBlockName(""), globalUniformBlockSet(TQualifier::layoutSetEnd), globalUniformBlockBinding(TQualifier::layoutBindingEnd), - atomicCounterBlockSet(TQualifier::layoutSetEnd) -#ifndef GLSLANG_WEB - , + atomicCounterBlockSet(TQualifier::layoutSetEnd), implicitThisName("@this"), implicitCounterName("@count"), source(EShSourceNone), useVulkanMemoryModel(false), @@ -313,7 +317,12 @@ class TIntermediate { inputPrimitive(ElgNone), outputPrimitive(ElgNone), pixelCenterInteger(false), originUpperLeft(false),texCoordBuiltinRedeclared(false), vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false), - postDepthCoverage(false), earlyAndLateFragmentTestsAMD(false), depthLayout(EldNone), stencilLayout(ElsNone), + postDepthCoverage(false), earlyAndLateFragmentTestsAMD(false), + nonCoherentColorAttachmentReadEXT(false), + nonCoherentDepthAttachmentReadEXT(false), + nonCoherentStencilAttachmentReadEXT(false), + depthLayout(EldNone), + stencilLayout(ElsNone), hlslFunctionality1(false), blendEquations(0), xfbMode(false), multiStream(false), layoutOverrideCoverage(false), @@ -339,7 +348,6 @@ class TIntermediate { spirvRequirement(nullptr), spirvExecutionMode(nullptr), uniformLocationBase(0) -#endif { localSize[0] = 1; localSize[1] = 1; @@ -350,23 +358,17 @@ class TIntermediate { localSizeSpecId[0] = TQualifier::layoutNotSet; localSizeSpecId[1] = TQualifier::layoutNotSet; localSizeSpecId[2] = TQualifier::layoutNotSet; -#ifndef GLSLANG_WEB xfbBuffers.resize(TQualifier::layoutXfbBufferEnd); shiftBinding.fill(0); -#endif } void setVersion(int v) { -#ifndef GLSLANG_ANGLE version = v; -#endif } void setProfile(EProfile p) { -#ifndef GLSLANG_ANGLE profile = p; -#endif } int getVersion() const { return version; } @@ -627,35 +629,6 @@ class TIntermediate { localSizeSpecId[1] != TQualifier::layoutNotSet || localSizeSpecId[2] != TQualifier::layoutNotSet; } -#ifdef GLSLANG_WEB - void output(TInfoSink&, bool tree) { } - - bool isEsProfile() const { return false; } - bool getXfbMode() const { return false; } - bool isMultiStream() const { return false; } - TLayoutGeometry getOutputPrimitive() const { return ElgNone; } - bool getPostDepthCoverage() const { return false; } - bool getEarlyFragmentTests() const { return false; } - TLayoutDepth getDepth() const { return EldNone; } - bool getPixelCenterInteger() const { return false; } - void setOriginUpperLeft() { } - bool getOriginUpperLeft() const { return true; } - TInterlockOrdering getInterlockOrdering() const { return EioNone; } - - bool getAutoMapBindings() const { return false; } - bool getAutoMapLocations() const { return false; } - int getNumPushConstants() const { return 0; } - void addShaderRecordCount() { } - void addTaskNVCount() { } - void addTaskPayloadEXTCount() { } - void setUseVulkanMemoryModel() { } - bool usingVulkanMemoryModel() const { return false; } - bool usingPhysicalStorageBuffer() const { return false; } - bool usingVariablePointers() const { return false; } - unsigned getXfbStride(int buffer) const { return 0; } - bool hasLayoutDerivativeModeNone() const { return false; } - ComputeDerivativeMode getLayoutDerivativeModeNone() const { return LayoutDerivativeNone; } -#else void output(TInfoSink&, bool tree); bool isEsProfile() const { return profile == EEsProfile; } @@ -750,6 +723,65 @@ class TIntermediate { useVariablePointers = true; processes.addProcess("use-variable-pointers"); } + // Set the global flag for bindless texture + void setBindlessTextureMode(const TString& currentCaller, AstRefType type) + { + // When type is not func, currentCaller should be "" (empty string) + bindlessTextureModeCaller[currentCaller] = type; + } + + // Get the global flag for bindless texture + bool getBindlessTextureMode() const + { + return (bindlessTextureModeCaller.size() > 0); + } + + // Set the global flag for bindless image + void setBindlessImageMode(const TString& currentCaller, AstRefType type) + { + // When type is not func, currentCaller should be "" (empty string) + bindlessImageModeCaller[currentCaller] = type; + } + + // Get the global flag for bindless image + bool getBindlessImageMode() const + { + return (bindlessImageModeCaller.size() > 0); + } + + // Get the global flag for bindless texture + bool resetTopLevelUncalledStatus(const TString& deadCaller) + { + // For reflection collection purpose, currently uniform layout setting and some + // flags introduced by variables (IO, global, etc,.) won't be reset here. + // Remove each global status (AST top level) introduced by uncalled functions. + // If a status is set by several functions, keep those which in call graph. + bool result = false; + + // For two types of bindless mode flag, we would only reset which is set by an uncalled function. + // If one status flag's key in caller vec is empty, it should be come from a non-function setting. + if (!bindlessTextureModeCaller.empty()) { + auto caller = bindlessTextureModeCaller.find(deadCaller); + if (caller != bindlessTextureModeCaller.end() && bindlessTextureModeCaller[deadCaller] == AstRefTypeFunc) { + bindlessTextureModeCaller.erase(caller); + result = true; + } + } + if (!bindlessImageModeCaller.empty()) { + auto caller = bindlessImageModeCaller.find(deadCaller); + if (caller != bindlessImageModeCaller.end() && bindlessImageModeCaller[deadCaller] == AstRefTypeFunc) { + bindlessImageModeCaller.erase(caller); + result = true; + } + } + return result; + } + + bool getBindlessMode() const + { + return getBindlessTextureMode() || getBindlessImageMode(); + } + bool usingVariablePointers() const { return useVariablePointers; } #ifdef ENABLE_HLSL @@ -831,6 +863,12 @@ class TIntermediate { return true; } TLayoutGeometry getOutputPrimitive() const { return outputPrimitive; } + void setNonCoherentColorAttachmentReadEXT() { nonCoherentColorAttachmentReadEXT = true; } + bool getNonCoherentColorAttachmentReadEXT() const { return nonCoherentColorAttachmentReadEXT; } + void setNonCoherentDepthAttachmentReadEXT() { nonCoherentDepthAttachmentReadEXT = true; } + bool getNonCoherentDepthAttachmentReadEXT() const { return nonCoherentDepthAttachmentReadEXT; } + void setNonCoherentStencilAttachmentReadEXT() { nonCoherentStencilAttachmentReadEXT = true; } + bool getNonCoherentStencilAttachmentReadEXT() const { return nonCoherentStencilAttachmentReadEXT; } void setPostDepthCoverage() { postDepthCoverage = true; } bool getPostDepthCoverage() const { return postDepthCoverage; } void setEarlyFragmentTests() { earlyFragmentTests = true; } @@ -929,7 +967,6 @@ class TIntermediate { void insertSpirvExecutionModeId(int executionMode, const TIntermAggregate* args); bool hasSpirvExecutionMode() const { return spirvExecutionMode != nullptr; } const TSpirvExecutionMode& getSpirvExecutionMode() const { return *spirvExecutionMode; } -#endif // GLSLANG_WEB void addBlockStorageOverride(const char* nameStr, TBlockStorageClass backing) { @@ -1036,12 +1073,6 @@ class TIntermediate { void setUniqueId(unsigned long long id) { uniqueId = id; } // Certain explicit conversions are allowed conditionally -#ifdef GLSLANG_WEB - bool getArithemeticInt8Enabled() const { return false; } - bool getArithemeticInt16Enabled() const { return false; } - bool getArithemeticFloat16Enabled() const { return false; } - void updateNumericFeature(TNumericFeatures::feature f, bool on) { } -#else bool getArithemeticInt8Enabled() const { return numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) || numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int8); @@ -1059,7 +1090,6 @@ class TIntermediate { } void updateNumericFeature(TNumericFeatures::feature f, bool on) { on ? numericFeatures.insert(f) : numericFeatures.erase(f); } -#endif protected: TIntermSymbol* addSymbol(long long Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&); @@ -1101,13 +1131,8 @@ class TIntermediate { typedef std::list TGraph; TGraph callGraph; -#ifdef GLSLANG_ANGLE - const EProfile profile = ECoreProfile; - const int version = 450; -#else EProfile profile; // source profile int version; // source version -#endif SpvVersion spvVersion; TIntermNode* treeRoot; std::set requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them @@ -1136,7 +1161,6 @@ class TIntermediate { unsigned int globalUniformBlockBinding; unsigned int atomicCounterBlockSet; -#ifndef GLSLANG_WEB public: const char* const implicitThisName; const char* const implicitCounterName; @@ -1157,6 +1181,9 @@ class TIntermediate { bool earlyFragmentTests; bool postDepthCoverage; bool earlyAndLateFragmentTestsAMD; + bool nonCoherentColorAttachmentReadEXT; + bool nonCoherentDepthAttachmentReadEXT; + bool nonCoherentStencilAttachmentReadEXT; TLayoutDepth depthLayout; TLayoutStencil stencilLayout; bool hlslFunctionality1; @@ -1199,18 +1226,19 @@ class TIntermediate { TSpirvRequirement* spirvRequirement; TSpirvExecutionMode* spirvExecutionMode; - + std::map bindlessTextureModeCaller; + std::map bindlessImageModeCaller; std::unordered_map uniformLocationOverrides; int uniformLocationBase; TNumericFeatures numericFeatures; -#endif std::unordered_map blockBackingOverrides; std::unordered_set usedConstantId; // specialization constant ids used std::vector usedAtomics; // sets of bindings used by atomic counters std::vector usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers - std::vector usedIoRT[2]; // sets of used location, one for rayPayload/rayPayloadIN and other - // for callableData/callableDataIn + std::vector usedIoRT[4]; // sets of used location, one for rayPayload/rayPayloadIN, + // one for callableData/callableDataIn, one for hitObjectAttributeNV and + // one for shaderrecordhitobjectNV // set of names of statically read/written I/O that might need extra checking std::set ioAccessed; diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseConst.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseConst.cpp index 6c182991..83509723 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseConst.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseConst.cpp @@ -198,7 +198,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node) bool TIntermediate::parseConstTree(TIntermNode* root, TConstUnionArray unionArray, TOperator constructorType, const TType& t, bool singleConstantParam) { - if (root == 0) + if (root == nullptr) return false; TConstTraverser it(unionArray, singleConstantParam, constructorType, t); diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseVersions.h b/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseVersions.h index 7248354e..63841c40 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseVersions.h +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseVersions.h @@ -58,72 +58,18 @@ class TParseVersions { const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink, bool forwardCompatible, EShMessages messages) : -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) forwardCompatible(forwardCompatible), profile(profile), -#endif infoSink(infoSink), version(version), language(language), spvVersion(spvVersion), - intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { } + intermediate(interm), messages(messages), numErrors(0), currentScanner(nullptr) { } virtual ~TParseVersions() { } void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc); void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc); -#ifdef GLSLANG_WEB - const EProfile profile = EEsProfile; - bool isEsProfile() const { return true; } - void requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc) - { - if (! (EEsProfile & profileMask)) - error(loc, "not supported with this profile:", featureDesc, ProfileName(profile)); - } - void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, - const char* const extensions[], const char* featureDesc) - { - if ((EEsProfile & profileMask) && (minVersion == 0 || version < minVersion)) - error(loc, "not supported for this version or the enabled extensions", featureDesc, ""); - } - void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, - const char* featureDesc) - { - profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc); - } - void initializeExtensionBehavior() { } - void checkDeprecated(const TSourceLoc&, int queryProfiles, int depVersion, const char* featureDesc) { } - void requireNotRemoved(const TSourceLoc&, int queryProfiles, int removedVersion, const char* featureDesc) { } - void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], - const char* featureDesc) { } - void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], - const char* featureDesc) { } - TExtensionBehavior getExtensionBehavior(const char*) { return EBhMissing; } - bool extensionTurnedOn(const char* const extension) { return false; } - bool extensionsTurnedOn(int numExtensions, const char* const extensions[]) { return false; } - void updateExtensionBehavior(int line, const char* const extension, const char* behavior) { } - void updateExtensionBehavior(const char* const extension, TExtensionBehavior) { } - void checkExtensionStage(const TSourceLoc&, const char* const extension) { } - void extensionRequires(const TSourceLoc&, const char* const extension, const char* behavior) { } - void fullIntegerCheck(const TSourceLoc&, const char* op) { } - void doubleCheck(const TSourceLoc&, const char* op) { } - bool float16Arithmetic() { return false; } - void requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { } - bool int16Arithmetic() { return false; } - void requireInt16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { } - bool int8Arithmetic() { return false; } - void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { } - void int64Check(const TSourceLoc&, const char* op, bool builtIn = false) { } - void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false) { } - void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false) { } - bool relaxedErrors() const { return false; } - bool suppressWarnings() const { return true; } - bool isForwardCompatible() const { return false; } -#else -#ifdef GLSLANG_ANGLE - const bool forwardCompatible = true; - const EProfile profile = ECoreProfile; -#else + bool forwardCompatible; // true if errors are to be given for use of deprecated features EProfile profile; // the declared profile in the shader (core by default) -#endif bool isEsProfile() const { return profile == EEsProfile; } void requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc); void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, @@ -167,29 +113,19 @@ class TParseVersions { virtual void explicitInt32Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void fcoopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void intcoopmatCheck(const TSourceLoc&, const char *op, bool builtIn = false); + 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); bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; } bool isForwardCompatible() const { return forwardCompatible; } -#endif // GLSLANG_WEB + virtual void spvRemoved(const TSourceLoc&, const char* op); virtual void vulkanRemoved(const TSourceLoc&, const char* op); virtual void requireVulkan(const TSourceLoc&, const char* op); virtual void requireSpv(const TSourceLoc&, const char* op); virtual void requireSpv(const TSourceLoc&, const char *op, unsigned int version); - -#if defined(GLSLANG_WEB) && !defined(GLSLANG_WEB_DEVEL) - void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) { addError(); } - void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) { } - void C_DECL ppError(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) { addError(); } - void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) { } -#else virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...) = 0; virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, @@ -198,7 +134,6 @@ class TParseVersions { const char* szExtraInfoFormat, ...) = 0; virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...) = 0; -#endif void addError() { ++numErrors; } int getNumErrors() const { return numErrors; } @@ -231,6 +166,7 @@ class TParseVersions { protected: TMap extensionBehavior; // for each extension string, what its current behavior is TMap extensionMinSpv; // for each extension string, store minimum spirv required + TVector spvUnsupportedExt; // for extensions reserved for spv usage. EShMessages messages; // errors/warnings/rule-sets int numErrors; // number of compile-time errors encountered TInputScanner* currentScanner; diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp index aa1e0d74..16b9d243 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp @@ -378,8 +378,6 @@ namespace { int op_cmpl(int a) { return ~a; } int op_not(int a) { return !a; } -}; - struct TBinop { int token, precedence, (*op)(int, int); } binop[] = { @@ -412,6 +410,8 @@ struct TUnop { { '!', op_not }, }; +} // anonymous namespace + #define NUM_ELEMENTS(A) (sizeof(A) / sizeof(A[0])) int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, bool& err, TPpToken* ppToken) @@ -736,7 +736,6 @@ int TPpContext::CPPline(TPpToken* ppToken) parseContext.setCurrentLine(lineRes); if (token != '\n') { -#ifndef GLSLANG_WEB if (token == PpAtomConstString) { parseContext.ppRequireExtensions(directiveLoc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based #line"); // We need to save a copy of the string instead of pointing @@ -746,9 +745,7 @@ int TPpContext::CPPline(TPpToken* ppToken) parseContext.setCurrentSourceName(sourceName); hasFile = true; token = scanToken(ppToken); - } else -#endif - { + } else { token = eval(token, MIN_PRECEDENCE, false, fileRes, fileErr, ppToken); if (! fileErr) { parseContext.setCurrentString(fileRes); @@ -974,7 +971,6 @@ int TPpContext::readCPPline(TPpToken* ppToken) case PpAtomLine: token = CPPline(ppToken); break; -#ifndef GLSLANG_WEB case PpAtomInclude: if(!parseContext.isReadingHLSL()) { parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_include_directive, "#include"); @@ -984,7 +980,6 @@ int TPpContext::readCPPline(TPpToken* ppToken) case PpAtomPragma: token = CPPpragma(ppToken); break; -#endif case PpAtomUndef: token = CPPundef(ppToken); break; @@ -1126,9 +1121,6 @@ int TPpContext::tMacroInput::scan(TPpToken* ppToken) pasting = true; } - // HLSL does expand macros before concatenation - if (pasting && pp->parseContext.isReadingHLSL()) - pasting = false; // TODO: preprocessor: properly handle whitespace (or lack of it) between tokens when expanding if (token == PpAtomIdentifier) { @@ -1138,9 +1130,12 @@ int TPpContext::tMacroInput::scan(TPpToken* ppToken) break; if (i >= 0) { TokenStream* arg = expandedArgs[i]; - if (arg == nullptr || pasting) + bool expanded = !!arg && !pasting; + // HLSL does expand macros before concatenation + if (arg == nullptr || (pasting && !pp->parseContext.isReadingHLSL()) ) { arg = args[i]; - pp->pushTokenStreamInput(*arg, prepaste); + } + pp->pushTokenStreamInput(*arg, prepaste, expanded); return pp->scanToken(ppToken); } @@ -1183,6 +1178,9 @@ MacroExpandResult TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, b { ppToken->space = false; int macroAtom = atomStrings.getAtom(ppToken->name); + if (ppToken->fullyExpanded) + return MacroExpandNotStarted; + switch (macroAtom) { case PpAtomLineMacro: // Arguments which are macro have been replaced in the first stage. @@ -1214,8 +1212,10 @@ MacroExpandResult TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, b MacroSymbol* macro = macroAtom == 0 ? nullptr : lookupMacroDef(macroAtom); // no recursive expansions - if (macro != nullptr && macro->busy) + if (macro != nullptr && macro->busy) { + ppToken->fullyExpanded = true; return MacroExpandNotStarted; + } // not expanding undefined macros if ((macro == nullptr || macro->undef) && ! expandUndef) diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp index 1363ce2b..70f51197 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp @@ -85,7 +85,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace glslang { TPpContext::TPpContext(TParseContextBase& pc, const std::string& rootFileName, TShader::Includer& inclr) : - preamble(0), strings(0), previous_token('\n'), parseContext(pc), includer(inclr), inComment(false), + preamble(nullptr), strings(nullptr), previous_token('\n'), parseContext(pc), includer(inclr), inComment(false), rootFileName(rootFileName), currentSourceFile(rootFileName), disableEscapeSequences(false) diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h b/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h index 714b5ead..590eab6b 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h @@ -102,6 +102,7 @@ class TPpToken { i64val = 0; loc.init(); name[0] = 0; + fullyExpanded = false; } // Used for comparing macro definitions, so checks what is relevant for that. @@ -117,6 +118,8 @@ class TPpToken { // True if a space (for white space or a removed comment) should also be // recognized, in front of the token returned: bool space; + + bool fullyExpanded; // Numeric value of the token: union { int ival; @@ -475,16 +478,27 @@ class TPpContext { // // From PpTokens.cpp // - void pushTokenStreamInput(TokenStream&, bool pasting = false); + void pushTokenStreamInput(TokenStream&, bool pasting = false, bool expanded = false); void UngetToken(int token, TPpToken*); class tTokenInput : public tInput { public: - tTokenInput(TPpContext* pp, TokenStream* t, bool prepasting) : + tTokenInput(TPpContext* pp, TokenStream* t, bool prepasting, bool expanded) : tInput(pp), tokens(t), - lastTokenPastes(prepasting) { } - virtual int scan(TPpToken *ppToken) override { return tokens->getToken(pp->parseContext, ppToken); } + lastTokenPastes(prepasting), + preExpanded(expanded) { } + virtual int scan(TPpToken *ppToken) override { + int token = tokens->getToken(pp->parseContext, ppToken); + ppToken->fullyExpanded = preExpanded; + if (tokens->atEnd() && token == PpAtomIdentifier) { + int macroAtom = pp->atomStrings.getAtom(ppToken->name); + MacroSymbol* macro = macroAtom == 0 ? nullptr : pp->lookupMacroDef(macroAtom); + if (macro && macro->functionLike) + ppToken->fullyExpanded = false; + } + return token; + } virtual int getch() override { assert(0); return EndOfInput; } virtual void ungetch() override { assert(0); } virtual bool peekPasting() override { return tokens->peekTokenizedPasting(lastTokenPastes); } @@ -492,6 +506,7 @@ class TPpContext { protected: TokenStream* tokens; bool lastTokenPastes; // true if the last token in the input is to be pasted, rather than consumed as a token + bool preExpanded; }; class tUngotTokenInput : public tInput { diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp index ad117920..34dec207 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -3,6 +3,7 @@ // Copyright (C) 2013 LunarG, Inc. // Copyright (C) 2017 ARM Limited. // Copyright (C) 2015-2018 Google, Inc. +// Copyright (c) 2023, Mobica Limited // // All rights reserved. // @@ -259,7 +260,6 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) // Suffix: bool isDouble = false; bool isFloat16 = false; -#ifndef GLSLANG_WEB if (ch == 'l' || ch == 'L') { if (ifdepth == 0 && parseContext.intermediate.getSource() == EShSourceGlsl) parseContext.doubleCheck(ppToken->loc, "double floating-point suffix"); @@ -299,14 +299,11 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) isFloat16 = true; } } else -#endif if (ch == 'f' || ch == 'F') { -#ifndef GLSLANG_WEB if (ifdepth == 0) parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix"); if (ifdepth == 0 && !parseContext.relaxedErrors()) parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix"); -#endif if (ifdepth == 0 && !hasDecimalOrExponent) parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); saveName(ch); @@ -480,9 +477,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) E_GL_EXT_shader_explicit_arithmetic_types_int16 }; static const int Num_Int16_Extensions = sizeof(Int16_Extensions) / sizeof(Int16_Extensions[0]); - ppToken->ival = 0; - ppToken->i64val = 0; - ppToken->space = false; + ppToken->clear(); ch = getch(); for (;;) { while (ch == ' ' || ch == '\t') { @@ -551,7 +546,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ival = 0; do { - if (len < MaxTokenLength && ival <= 0x0fffffffffffffffull) { + if (len < MaxTokenLength && ival <= 0x7fffffffffffffffull) { ppToken->name[len++] = (char)ch; if (ch >= '0' && ch <= '9') { ii = ch - '0'; @@ -584,7 +579,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ppToken->name[len++] = (char)ch; isUnsigned = true; -#ifndef GLSLANG_WEB int nextCh = getch(); if (nextCh == 'l' || nextCh == 'L') { if (len < MaxTokenLength) @@ -610,7 +604,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt16 = true; -#endif } else ungetch(); ppToken->name[len] = '\0'; @@ -641,6 +634,108 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ppToken->ival = (int)ival; return isUnsigned ? PpAtomConstUint : PpAtomConstInt; } + } else if ((ch == 'b' || ch == 'B') && pp->parseContext.intermediate.getSource() == EShSourceHlsl) { + // must be binary + bool isUnsigned = false; + bool isInt64 = false; + bool isInt16 = false; + ppToken->name[len++] = (char)ch; + ch = getch(); + + // Check value + if ((ch == '0' || ch == '1')) + { + ival = 0; + do { + if (len < MaxTokenLength && ival <= 0x7fffffffffffffffull) { + ppToken->name[len++] = (char)ch; + if (ch == '0' || ch == '1') { + ii = ch - '0'; + } else { + pp->parseContext.ppError(ppToken->loc, "bad digit in binary literal", "", ""); + } + ival = (ival << 1) | ii; + } + else + { + if (! AlreadyComplained) { + if(len < MaxTokenLength) + pp->parseContext.ppError(ppToken->loc, "binary literal too big", "", ""); + else + pp->parseContext.ppError(ppToken->loc, "binary literal too long", "", ""); + AlreadyComplained = 1; + } + ival = 0xffffffffffffffffull; + } + ch = getch(); + } while (ch == '0' || ch == '1'); + } + else + { + pp->parseContext.ppError(ppToken->loc, "bad digit in binary literal", "", ""); + } + + // check type + if (ch == 'u' || ch == 'U') { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)ch; + isUnsigned = true; + + int nextCh = getch(); + if (nextCh == 'l' || nextCh == 'L') { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt64 = true; + } else + ungetch(); + + nextCh = getch(); + if ((nextCh == 's' || nextCh == 'S') && + pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt16 = true; + } else + ungetch(); + } else if (ch == 'l' || ch == 'L') { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)ch; + isInt64 = true; + } else if ((ch == 's' || ch == 'S') && + pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)ch; + isInt16 = true; + } else { + ungetch(); + } + ppToken->name[len] = '\0'; + + // Assign value + if (isInt64 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + if (pp->ifdepth == 0) { + pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile, + "64-bit binary literal"); + pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0, + Num_Int64_Extensions, Int64_Extensions, "64-bit binary literal"); + } + ppToken->i64val = ival; + return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64; + } else if (isInt16) { + if (pp->ifdepth == 0) { + if (pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile, + "16-bit binary literal"); + pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0, + Num_Int16_Extensions, Int16_Extensions, "16-bit binary literal"); + } + } + ppToken->ival = (int)ival; + return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16; + } else { + ppToken->ival = (int)ival; + return isUnsigned ? PpAtomConstUint : PpAtomConstInt; + } } else { // could be octal integer or floating point, speculative pursue octal until it must be floating point @@ -692,7 +787,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ppToken->name[len++] = (char)ch; isUnsigned = true; -#ifndef GLSLANG_WEB int nextCh = getch(); if (nextCh == 'l' || nextCh == 'L') { if (len < MaxTokenLength) @@ -718,7 +812,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt16 = true; -#endif } else ungetch(); ppToken->name[len] = '\0'; @@ -781,7 +874,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ppToken->name[len++] = (char)ch; isUnsigned = true; -#ifndef GLSLANG_WEB int nextCh = getch(); if (nextCh == 'l' || nextCh == 'L') { if (len < MaxTokenLength) @@ -807,7 +899,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt16 = true; -#endif } else ungetch(); diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp index 7ed58703..e6ee64cf 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp @@ -85,9 +85,6 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS #endif -#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) -#define snprintf sprintf_s -#endif #include #include @@ -116,17 +113,15 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken int atom = stream[currentPos++].get(*ppToken); ppToken->loc = parseContext.getCurrentLoc(); -#ifndef GLSLANG_WEB // 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, 0, "token pasting (##)"); + parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, nullptr, "token pasting (##)"); currentPos++; atom = PpAtomPaste; } } -#endif return atom; } @@ -195,9 +190,9 @@ bool TPpContext::TokenStream::peekUntokenizedPasting() return pasting; } -void TPpContext::pushTokenStreamInput(TokenStream& ts, bool prepasting) +void TPpContext::pushTokenStreamInput(TokenStream& ts, bool prepasting, bool expanded) { - pushInput(new tTokenInput(this, &ts, prepasting)); + pushInput(new tTokenInput(this, &ts, prepasting, expanded)); ts.reset(); } diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp index 9def592b..7b5cd03f 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp @@ -37,8 +37,6 @@ // propagate the 'noContraction' qualifier. // -#ifndef GLSLANG_WEB - #include "propagateNoContraction.h" #include @@ -423,7 +421,7 @@ getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& in ReturnBranchNodeSet()); TIntermNode* root = intermediate.getTreeRoot(); - if (root == 0) + if (root == nullptr) return result_tuple; NodeMapping& symbol_definition_mapping = std::get<0>(result_tuple); @@ -865,6 +863,4 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate) precise_object_accesschains.erase(precise_object_accesschain); } } -}; - -#endif // GLSLANG_WEB +} diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp b/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp index 9ea48c45..6c7d3a2c 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp @@ -33,8 +33,6 @@ // POSSIBILITY OF SUCH DAMAGE. // -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - #include "../Include/Common.h" #include "reflection.h" #include "LiveTraverser.h" @@ -682,7 +680,7 @@ class TReflectionTraverser : public TIntermTraverser { } // For a binary operation indexing into an aggregate, chase down the base of the aggregate. - // Return 0 if the topology does not fit this situation. + // Return nullptr if the topology does not fit this situation. TIntermSymbol* findBase(const TIntermBinary* node) { TIntermSymbol *base = node->getLeft()->getAsSymbolNode(); @@ -1270,5 +1268,3 @@ void TReflection::dump() } } // end namespace glslang - -#endif // !GLSLANG_WEB && !GLSLANG_ANGLE diff --git a/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.h b/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.h index 5af4467c..221d93f8 100644 --- a/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.h +++ b/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.h @@ -33,8 +33,6 @@ // POSSIBILITY OF SUCH DAMAGE. // -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - #ifndef _REFLECTION_INCLUDED #define _REFLECTION_INCLUDED @@ -219,5 +217,3 @@ class TReflection { } // end namespace glslang #endif // _REFLECTION_INCLUDED - -#endif // !GLSLANG_WEB && !GLSLANG_ANGLE diff --git a/bgfx/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp b/bgfx/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp index b98df934..fbb51f7b 100644 --- a/bgfx/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp +++ b/bgfx/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp @@ -36,15 +36,8 @@ // This file contains the Linux-specific functions // #include "../osinclude.h" -#include "../../../OGLCompilersDLL/InitializeDll.h" -#include -#include -#include -#include -#include #include -#include #if !defined(__Fuchsia__) #include @@ -52,104 +45,6 @@ namespace glslang { -// -// Thread cleanup -// - -// -// Thread Local Storage Operations -// -inline OS_TLSIndex PthreadKeyToTLSIndex(pthread_key_t key) -{ - return (OS_TLSIndex)((uintptr_t)key + 1); -} - -inline pthread_key_t TLSIndexToPthreadKey(OS_TLSIndex nIndex) -{ - return (pthread_key_t)((uintptr_t)nIndex - 1); -} - -OS_TLSIndex OS_AllocTLSIndex() -{ - pthread_key_t pPoolIndex; - - // - // Create global pool key. - // - if ((pthread_key_create(&pPoolIndex, NULL)) != 0) { - assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage"); - return OS_INVALID_TLS_INDEX; - } - else - return PthreadKeyToTLSIndex(pPoolIndex); -} - -bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue) -{ - if (nIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); - return false; - } - - if (pthread_setspecific(TLSIndexToPthreadKey(nIndex), lpvValue) == 0) - return true; - else - return false; -} - -void* OS_GetTLSValue(OS_TLSIndex nIndex) -{ - // - // This function should return 0 if nIndex is invalid. - // - assert(nIndex != OS_INVALID_TLS_INDEX); - return pthread_getspecific(TLSIndexToPthreadKey(nIndex)); -} - -bool OS_FreeTLSIndex(OS_TLSIndex nIndex) -{ - if (nIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); - return false; - } - - // - // Delete the global pool key. - // - if (pthread_key_delete(TLSIndexToPthreadKey(nIndex)) == 0) - return true; - else - return false; -} - -namespace { - pthread_mutex_t gMutex; -} - -static void InitMutex(void) -{ - pthread_mutexattr_t mutexattr; - pthread_mutexattr_init(&mutexattr); - pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&gMutex, &mutexattr); -} - -void InitGlobalLock() -{ - static pthread_once_t once = PTHREAD_ONCE_INIT; - pthread_once(&once, InitMutex); -} - -void GetGlobalLock() -{ - pthread_mutex_lock(&gMutex); -} - -void ReleaseGlobalLock() -{ - pthread_mutex_unlock(&gMutex); -} - // #define DUMP_COUNTERS void OS_DumpMemoryCounters() diff --git a/bgfx/3rdparty/glslang/glslang/OSDependent/Windows/ossource.cpp b/bgfx/3rdparty/glslang/glslang/OSDependent/Windows/ossource.cpp index 870840c5..d7f89f71 100644 --- a/bgfx/3rdparty/glslang/glslang/OSDependent/Windows/ossource.cpp +++ b/bgfx/3rdparty/glslang/glslang/OSDependent/Windows/ossource.cpp @@ -37,11 +37,9 @@ #define STRICT #define VC_EXTRALEAN 1 #include -#include #include #include #include -#include // // This file contains the Window-OS-specific functions @@ -53,84 +51,6 @@ namespace glslang { -inline OS_TLSIndex ToGenericTLSIndex (DWORD handle) -{ - return (OS_TLSIndex)((uintptr_t)handle + 1); -} - -inline DWORD ToNativeTLSIndex (OS_TLSIndex nIndex) -{ - return (DWORD)((uintptr_t)nIndex - 1); -} - -// -// Thread Local Storage Operations -// -OS_TLSIndex OS_AllocTLSIndex() -{ - DWORD dwIndex = TlsAlloc(); - if (dwIndex == TLS_OUT_OF_INDEXES) { - assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage"); - return OS_INVALID_TLS_INDEX; - } - - return ToGenericTLSIndex(dwIndex); -} - -bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue) -{ - if (nIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); - return false; - } - - if (TlsSetValue(ToNativeTLSIndex(nIndex), lpvValue)) - return true; - else - return false; -} - -void* OS_GetTLSValue(OS_TLSIndex nIndex) -{ - assert(nIndex != OS_INVALID_TLS_INDEX); - return TlsGetValue(ToNativeTLSIndex(nIndex)); -} - -bool OS_FreeTLSIndex(OS_TLSIndex nIndex) -{ - if (nIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "OS_SetTLSValue(): Invalid TLS Index"); - return false; - } - - if (TlsFree(ToNativeTLSIndex(nIndex))) - return true; - else - return false; -} - -HANDLE GlobalLock; - -void InitGlobalLock() -{ - GlobalLock = CreateMutex(0, false, 0); -} - -void GetGlobalLock() -{ - WaitForSingleObject(GlobalLock, INFINITE); -} - -void ReleaseGlobalLock() -{ - ReleaseMutex(GlobalLock); -} - -unsigned int __stdcall EnterGenericThread (void* entry) -{ - return ((TThreadEntrypoint)entry)(0); -} - //#define DUMP_COUNTERS void OS_DumpMemoryCounters() diff --git a/bgfx/3rdparty/glslang/glslang/OSDependent/osinclude.h b/bgfx/3rdparty/glslang/glslang/OSDependent/osinclude.h index fcfeff2c..0d677e4a 100644 --- a/bgfx/3rdparty/glslang/glslang/OSDependent/osinclude.h +++ b/bgfx/3rdparty/glslang/glslang/OSDependent/osinclude.h @@ -37,23 +37,6 @@ namespace glslang { -// -// Thread Local Storage Operations -// -typedef void* OS_TLSIndex; -#define OS_INVALID_TLS_INDEX ((void*)0) - -OS_TLSIndex OS_AllocTLSIndex(); -bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue); -bool OS_FreeTLSIndex(OS_TLSIndex nIndex); -void* OS_GetTLSValue(OS_TLSIndex nIndex); - -void InitGlobalLock(); -void GetGlobalLock(); -void ReleaseGlobalLock(); - -typedef unsigned int (*TThreadEntrypoint)(void*); - void OS_DumpMemoryCounters(); } // end namespace glslang diff --git a/bgfx/3rdparty/glslang/StandAlone/ResourceLimits.h b/bgfx/3rdparty/glslang/glslang/Public/ResourceLimits.h similarity index 90% rename from bgfx/3rdparty/glslang/StandAlone/ResourceLimits.h rename to bgfx/3rdparty/glslang/glslang/Public/ResourceLimits.h index 736248eb..f70be817 100644 --- a/bgfx/3rdparty/glslang/StandAlone/ResourceLimits.h +++ b/bgfx/3rdparty/glslang/glslang/Public/ResourceLimits.h @@ -37,14 +37,16 @@ #include -#include "../glslang/Include/ResourceLimits.h" +#include "../Include/ResourceLimits.h" -namespace glslang { +// Return pointer to user-writable Resource to pass through API in +// future-proof way. +extern TBuiltInResource* GetResources(); // These are the default resources for TBuiltInResources, used for both // - parsing this string for the case where the user didn't supply one, // - dumping out a template for user construction of a config file. -extern const TBuiltInResource DefaultTBuiltInResource; +extern const TBuiltInResource* GetDefaultResources(); // Returns the DefaultTBuiltInResource as a human-readable string. std::string GetDefaultTBuiltInResourceString(); @@ -52,6 +54,4 @@ std::string GetDefaultTBuiltInResourceString(); // Decodes the resource limits from |config| to |resources|. void DecodeResourceLimits(TBuiltInResource* resources, char* config); -} // end namespace glslang - #endif // _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ diff --git a/bgfx/3rdparty/glslang/glslang/Public/ShaderLang.h b/bgfx/3rdparty/glslang/glslang/Public/ShaderLang.h index 78dd323a..e037e63f 100644 --- a/bgfx/3rdparty/glslang/glslang/Public/ShaderLang.h +++ b/bgfx/3rdparty/glslang/glslang/Public/ShaderLang.h @@ -728,8 +728,6 @@ class TShader { TShader& operator=(TShader&); }; -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - // // A reflection database and its interface, consistent with the OpenGL API reflection queries. // @@ -846,8 +844,6 @@ class TIoMapResolver virtual void addStage(EShLanguage stage, TIntermediate& stageIntermediate) = 0; }; -#endif // !GLSLANG_WEB && !GLSLANG_ANGLE - // Make one TProgram per set of shaders that will get linked together. Add all // the shaders that are to be linked together. After calling shader.parse() // for all shaders, call link(). @@ -867,8 +863,6 @@ class TProgram { TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; } -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) - // Reflection Interface // call first, to do liveness analysis, index mapping, etc.; returns false on failure @@ -961,7 +955,6 @@ class TProgram { // 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); -#endif // !GLSLANG_WEB && !GLSLANG_ANGLE protected: GLSLANG_EXPORT bool linkStage(EShLanguage, EShMessages); @@ -972,9 +965,7 @@ class TProgram { TIntermediate* intermediate[EShLangCount]; bool newedIntermediate[EShLangCount]; // track which intermediate were "new" versus reusing a singleton unit in a stage TInfoSink* infoSink; -#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE) TReflection* reflection; -#endif bool linked; private: diff --git a/bgfx/3rdparty/glslang/StandAlone/resource_limits_c.h b/bgfx/3rdparty/glslang/glslang/Public/resource_limits_c.h similarity index 93% rename from bgfx/3rdparty/glslang/StandAlone/resource_limits_c.h rename to bgfx/3rdparty/glslang/glslang/Public/resource_limits_c.h index 108fd5e2..05aa8eb0 100644 --- a/bgfx/3rdparty/glslang/StandAlone/resource_limits_c.h +++ b/bgfx/3rdparty/glslang/glslang/Public/resource_limits_c.h @@ -29,12 +29,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_ #define _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_ -#include "../glslang/Include/glslang_c_interface.h" +#include "../Include/glslang_c_interface.h" #ifdef __cplusplus extern "C" { #endif +// Returns a struct that can be use to create custom resource values. +glslang_resource_t* glslang_resource(void); + // These are the default resources for TBuiltInResources, used for both // - parsing this string for the case where the user didn't supply one, // - dumping out a template for user construction of a config file. diff --git a/bgfx/3rdparty/glslang/StandAlone/ResourceLimits.cpp b/bgfx/3rdparty/glslang/glslang/ResourceLimits/ResourceLimits.cpp similarity index 99% rename from bgfx/3rdparty/glslang/StandAlone/ResourceLimits.cpp rename to bgfx/3rdparty/glslang/glslang/ResourceLimits/ResourceLimits.cpp index 1a76bf62..0e9d1b54 100644 --- a/bgfx/3rdparty/glslang/StandAlone/ResourceLimits.cpp +++ b/bgfx/3rdparty/glslang/glslang/ResourceLimits/ResourceLimits.cpp @@ -37,9 +37,9 @@ #include #include -#include "ResourceLimits.h" +#include "glslang/Public/ResourceLimits.h" -namespace glslang { +TBuiltInResource Resources; const TBuiltInResource DefaultTBuiltInResource = { /* .MaxLights = */ 32, @@ -505,6 +505,8 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config) resources->maxTaskWorkGroupSizeZ_EXT = value; else if (tokenStr == "MaxMeshViewCountEXT") resources->maxMeshViewCountEXT = value; + else if (tokenStr == "MaxDualSourceDrawBuffersEXT") + resources->maxDualSourceDrawBuffersEXT = value; else if (tokenStr == "nonInductiveForLoops") resources->limits.nonInductiveForLoops = (value != 0); else if (tokenStr == "whileLoops") @@ -529,4 +531,12 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config) } } -} // end namespace glslang +TBuiltInResource* GetResources() +{ + return &Resources; +} + +const TBuiltInResource* GetDefaultResources() +{ + return &DefaultTBuiltInResource; +} diff --git a/bgfx/3rdparty/glslang/StandAlone/resource_limits_c.cpp b/bgfx/3rdparty/glslang/glslang/ResourceLimits/resource_limits_c.cpp similarity index 82% rename from bgfx/3rdparty/glslang/StandAlone/resource_limits_c.cpp rename to bgfx/3rdparty/glslang/glslang/ResourceLimits/resource_limits_c.cpp index a1f681c7..0eeac23a 100644 --- a/bgfx/3rdparty/glslang/StandAlone/resource_limits_c.cpp +++ b/bgfx/3rdparty/glslang/glslang/ResourceLimits/resource_limits_c.cpp @@ -26,15 +26,20 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **/ -#include "resource_limits_c.h" -#include "ResourceLimits.h" +#include "glslang/Public/resource_limits_c.h" +#include "glslang/Public/ResourceLimits.h" #include #include #include +glslang_resource_t* glslang_resource(void) +{ + return reinterpret_cast(GetResources()); +} + const glslang_resource_t* glslang_default_resource(void) { - return reinterpret_cast(&glslang::DefaultTBuiltInResource); + return reinterpret_cast(GetDefaultResources()); } #if defined(__clang__) || defined(__GNUC__) @@ -47,7 +52,7 @@ const glslang_resource_t* glslang_default_resource(void) const char* glslang_default_resource_string() { - std::string cpp_str = glslang::GetDefaultTBuiltInResourceString(); + std::string cpp_str = GetDefaultTBuiltInResourceString(); char* c_str = (char*)malloc(cpp_str.length() + 1); strcpy(c_str, cpp_str.c_str()); return c_str; @@ -61,5 +66,5 @@ const char* glslang_default_resource_string() void glslang_decode_resource_limits(glslang_resource_t* resources, char* config) { - glslang::DecodeResourceLimits(reinterpret_cast(resources), config); + DecodeResourceLimits(reinterpret_cast(resources), config); } diff --git a/bgfx/3rdparty/glslang/glslang/updateGrammar b/bgfx/3rdparty/glslang/glslang/updateGrammar index 9209493f..a15dc24b 100755 --- a/bgfx/3rdparty/glslang/glslang/updateGrammar +++ b/bgfx/3rdparty/glslang/glslang/updateGrammar @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Copyright (C) 2020 The Khronos Group Inc. # @@ -33,17 +33,4 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -if [ "$1" = 'web' ] -then - m4 -P -DGLSLANG_WEB MachineIndependent/glslang.m4 > MachineIndependent/glslang.y -elif [ "$#" -eq 0 ] -then - m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y -else - echo usage: - echo $0 web - echo $0 - exit -fi - bison --defines=MachineIndependent/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o MachineIndependent/glslang_tab.cpp diff --git a/bgfx/3rdparty/glslang/hlsl/stub.cpp b/bgfx/3rdparty/glslang/hlsl/stub.cpp deleted file mode 100644 index f1d39c15..00000000 --- a/bgfx/3rdparty/glslang/hlsl/stub.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright (C) 2020 Google, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of Google, Inc., nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// - -// The HLSL source is directly embedded into the glslang target when ENABLE_HLSL -// is set. -// This source now lives at: glslang/HLSL/ -// The HLSL target is now just a stub that exists for backwards compatibility -// for projects that referenced this target. As a target requires at least one -// source file to build, this file acts as that stub. diff --git a/bgfx/3rdparty/khronos/EGL/egl.h b/bgfx/3rdparty/khronos/EGL/egl.h index 3e2f7e76..97d0878c 100644 --- a/bgfx/3rdparty/khronos/EGL/egl.h +++ b/bgfx/3rdparty/khronos/EGL/egl.h @@ -6,39 +6,24 @@ extern "C" { #endif /* -** Copyright (c) 2013-2017 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: Apache-2.0 ** -** 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. -** -** 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. -*/ -/* ** This header is generated from the Khronos EGL XML API Registry. ** The current version of the Registry, generator scripts ** used to make the header, and the header can be found at ** http://www.khronos.org/registry/egl ** -** Khronos $Git commit SHA1: 726475c203 $ on $Git commit date: 2018-10-03 23:51:49 -0700 $ +** Khronos $Git commit SHA1: 6fb1daea15 $ on $Git commit date: 2022-05-25 09:41:13 -0600 $ */ #include -/* Generated on date 20181204 */ +#ifndef EGL_EGL_PROTOTYPES +#define EGL_EGL_PROTOTYPES 1 +#endif + +/* Generated on date 20220525 */ /* Generated C header for: * API: egl @@ -118,6 +103,31 @@ typedef void (*__eglMustCastToProperFunctionPointerType)(void); #define EGL_VERSION 0x3054 #define EGL_WIDTH 0x3057 #define EGL_WINDOW_BIT 0x0004 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSECONFIGPROC) (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); +typedef EGLContext (EGLAPIENTRYP PFNEGLCREATECONTEXTPROC) (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERSURFACEPROC) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGATTRIBPROC) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGSPROC) (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETCURRENTDISPLAYPROC) (void); +typedef EGLSurface (EGLAPIENTRYP PFNEGLGETCURRENTSURFACEPROC) (EGLint readdraw); +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDISPLAYPROC) (EGLNativeDisplayType display_id); +typedef EGLint (EGLAPIENTRYP PFNEGLGETERRORPROC) (void); +typedef __eglMustCastToProperFunctionPointerType (EGLAPIENTRYP PFNEGLGETPROCADDRESSPROC) (const char *procname); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLINITIALIZEPROC) (EGLDisplay dpy, EGLint *major, EGLint *minor); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLMAKECURRENTPROC) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGPROC) (EGLDisplay dpy, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLTERMINATEPROC) (EGLDisplay dpy); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITGLPROC) (void); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITNATIVEPROC) (EGLint engine); +#if EGL_EGL_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); @@ -142,6 +152,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy); EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void); EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); +#endif #endif /* EGL_VERSION_1_0 */ #ifndef EGL_VERSION_1_1 @@ -160,10 +171,16 @@ EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); #define EGL_TEXTURE_RGB 0x305D #define EGL_TEXTURE_RGBA 0x305E #define EGL_TEXTURE_TARGET 0x3081 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDTEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASETEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSURFACEATTRIBPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPINTERVALPROC) (EGLDisplay dpy, EGLint interval); +#if EGL_EGL_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval); +#endif #endif /* EGL_VERSION_1_1 */ #ifndef EGL_VERSION_1_2 @@ -199,11 +216,18 @@ typedef void *EGLClientBuffer; #define EGL_SWAP_BEHAVIOR 0x3093 #define EGL_UNKNOWN EGL_CAST(EGLint,-1) #define EGL_VERTICAL_RESOLUTION 0x3091 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDAPIPROC) (EGLenum api); +typedef EGLenum (EGLAPIENTRYP PFNEGLQUERYAPIPROC) (void); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC) (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASETHREADPROC) (void); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITCLIENTPROC) (void); +#if EGL_EGL_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api); EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void); EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void); EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); +#endif #endif /* EGL_VERSION_1_2 */ #ifndef EGL_VERSION_1_3 @@ -232,7 +256,10 @@ EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); #define EGL_OPENGL_API 0x30A2 #define EGL_OPENGL_BIT 0x0008 #define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 +typedef EGLContext (EGLAPIENTRYP PFNEGLGETCURRENTCONTEXTPROC) (void); +#if EGL_EGL_PROTOTYPES EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); +#endif #endif /* EGL_VERSION_1_4 */ #ifndef EGL_VERSION_1_5 @@ -284,6 +311,17 @@ typedef void *EGLImage; #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 #define EGL_IMAGE_PRESERVED 0x30D2 #define EGL_NO_IMAGE EGL_CAST(EGLImage,0) +typedef EGLSync (EGLAPIENTRYP PFNEGLCREATESYNCPROC) (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCPROC) (EGLDisplay dpy, EGLSync sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBPROC) (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); +typedef EGLImage (EGLAPIENTRYP PFNEGLCREATEIMAGEPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEPROC) (EGLDisplay dpy, EGLImage image); +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYPROC) (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags); +#if EGL_EGL_PROTOTYPES EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync); EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); @@ -294,6 +332,7 @@ EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *nat EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); +#endif #endif /* EGL_VERSION_1_5 */ #ifdef __cplusplus diff --git a/bgfx/3rdparty/khronos/EGL/eglext.h b/bgfx/3rdparty/khronos/EGL/eglext.h index 82d01868..d58da70e 100644 --- a/bgfx/3rdparty/khronos/EGL/eglext.h +++ b/bgfx/3rdparty/khronos/EGL/eglext.h @@ -6,39 +6,20 @@ extern "C" { #endif /* -** Copyright (c) 2013-2017 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: Apache-2.0 ** -** 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. -** -** 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. -*/ -/* ** This header is generated from the Khronos EGL XML API Registry. ** The current version of the Registry, generator scripts ** used to make the header, and the header can be found at ** http://www.khronos.org/registry/egl ** -** Khronos $Git commit SHA1: 7866a17153 $ on $Git commit date: 2019-01-25 23:06:48 -0800 $ +** Khronos $Git commit SHA1: 6fb1daea15 $ on $Git commit date: 2022-05-25 09:41:13 -0600 $ */ #include -#define EGL_EGLEXT_VERSION 20190125 +#define EGL_EGLEXT_VERSION 20220525 /* Generated C header for: * API: egl @@ -443,9 +424,9 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, #ifndef EGL_KHR_swap_buffers_with_damage #define EGL_KHR_swap_buffers_with_damage 1 -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *rects, EGLint n_rects); #ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *rects, EGLint n_rects); #endif #endif /* EGL_KHR_swap_buffers_with_damage */ @@ -462,6 +443,10 @@ EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLin #endif #endif /* EGL_KHR_wait_sync */ +#ifndef EGL_ANDROID_GLES_layers +#define EGL_ANDROID_GLES_layers 1 +#endif /* EGL_ANDROID_GLES_layers */ + #ifndef EGL_ANDROID_blob_cache #define EGL_ANDROID_blob_cache 1 typedef khronos_ssize_t EGLsizeiANDROID; @@ -589,11 +574,25 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu #define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 #endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */ +#ifndef EGL_ANGLE_sync_control_rate +#define EGL_ANGLE_sync_control_rate 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETMSCRATEANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *numerator, EGLint *denominator); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglGetMscRateANGLE (EGLDisplay dpy, EGLSurface surface, EGLint *numerator, EGLint *denominator); +#endif +#endif /* EGL_ANGLE_sync_control_rate */ + #ifndef EGL_ANGLE_window_fixed_size #define EGL_ANGLE_window_fixed_size 1 #define EGL_FIXED_SIZE_ANGLE 0x3201 #endif /* EGL_ANGLE_window_fixed_size */ +#ifndef EGL_ARM_image_format +#define EGL_ARM_image_format 1 +#define EGL_COLOR_COMPONENT_TYPE_UNSIGNED_INTEGER_ARM 0x3287 +#define EGL_COLOR_COMPONENT_TYPE_INTEGER_ARM 0x3288 +#endif /* EGL_ARM_image_format */ + #ifndef EGL_ARM_implicit_external_sync #define EGL_ARM_implicit_external_sync 1 #define EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM 0x328A @@ -652,6 +651,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSwapPolicyEXT (EGLint external_win_id #endif #endif /* EGL_EXT_compositor */ +#ifndef EGL_EXT_config_select_group +#define EGL_EXT_config_select_group 1 +#define EGL_CONFIG_SELECT_GROUP_EXT 0x34C0 +#endif /* EGL_EXT_config_select_group */ + #ifndef EGL_EXT_create_context_robustness #define EGL_EXT_create_context_robustness 1 #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF @@ -684,6 +688,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint a #define EGL_DRM_MASTER_FD_EXT 0x333C #endif /* EGL_EXT_device_drm */ +#ifndef EGL_EXT_device_drm_render_node +#define EGL_EXT_device_drm_render_node 1 +#define EGL_DRM_RENDER_NODE_FILE_EXT 0x3377 +#endif /* EGL_EXT_device_drm_render_node */ + #ifndef EGL_EXT_device_enumeration #define EGL_EXT_device_enumeration 1 #endif /* EGL_EXT_device_enumeration */ @@ -691,12 +700,33 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint a #ifndef EGL_EXT_device_openwf #define EGL_EXT_device_openwf 1 #define EGL_OPENWF_DEVICE_ID_EXT 0x3237 +#define EGL_OPENWF_DEVICE_EXT 0x333D #endif /* EGL_EXT_device_openwf */ +#ifndef EGL_EXT_device_persistent_id +#define EGL_EXT_device_persistent_id 1 +#define EGL_DEVICE_UUID_EXT 0x335C +#define EGL_DRIVER_UUID_EXT 0x335D +#define EGL_DRIVER_NAME_EXT 0x335E +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEBINARYEXTPROC) (EGLDeviceEXT device, EGLint name, EGLint max_size, void *value, EGLint *size); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceBinaryEXT (EGLDeviceEXT device, EGLint name, EGLint max_size, void *value, EGLint *size); +#endif +#endif /* EGL_EXT_device_persistent_id */ + #ifndef EGL_EXT_device_query #define EGL_EXT_device_query 1 #endif /* EGL_EXT_device_query */ +#ifndef EGL_EXT_device_query_name +#define EGL_EXT_device_query_name 1 +#define EGL_RENDERER_EXT 0x335F +#endif /* EGL_EXT_device_query_name */ + +#ifndef EGL_EXT_explicit_device +#define EGL_EXT_explicit_device 1 +#endif /* EGL_EXT_explicit_device */ + #ifndef EGL_EXT_gl_colorspace_bt2020_linear #define EGL_EXT_gl_colorspace_bt2020_linear 1 #define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F @@ -873,6 +903,17 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, #define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6 #endif /* EGL_EXT_platform_x11 */ +#ifndef EGL_EXT_platform_xcb +#define EGL_EXT_platform_xcb 1 +#define EGL_PLATFORM_XCB_EXT 0x31DC +#define EGL_PLATFORM_XCB_SCREEN_EXT 0x31DE +#endif /* EGL_EXT_platform_xcb */ + +#ifndef EGL_EXT_present_opaque +#define EGL_EXT_present_opaque 1 +#define EGL_PRESENT_OPAQUE_EXT 0x31DF +#endif /* EGL_EXT_present_opaque */ + #ifndef EGL_EXT_protected_content #define EGL_EXT_protected_content 1 #define EGL_PROTECTED_CONTENT_EXT 0x32C0 @@ -911,11 +952,36 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStr #define EGL_METADATA_SCALING_EXT 50000 #endif /* EGL_EXT_surface_SMPTE2086_metadata */ +#ifndef EGL_EXT_surface_compression +#define EGL_EXT_surface_compression 1 +#define EGL_SURFACE_COMPRESSION_EXT 0x34B0 +#define EGL_SURFACE_COMPRESSION_PLANE1_EXT 0x328E +#define EGL_SURFACE_COMPRESSION_PLANE2_EXT 0x328F +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_NONE_EXT 0x34B1 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_DEFAULT_EXT 0x34B2 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_1BPC_EXT 0x34B4 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_2BPC_EXT 0x34B5 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_3BPC_EXT 0x34B6 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_4BPC_EXT 0x34B7 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_5BPC_EXT 0x34B8 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_6BPC_EXT 0x34B9 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_7BPC_EXT 0x34BA +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_8BPC_EXT 0x34BB +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_9BPC_EXT 0x34BC +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_10BPC_EXT 0x34BD +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_11BPC_EXT 0x34BE +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_12BPC_EXT 0x34BF +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSUPPORTEDCOMPRESSIONRATESEXTPROC) (EGLDisplay dpy, EGLConfig config, const EGLAttrib *attrib_list, EGLint *rates, EGLint rate_size, EGLint *num_rates); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySupportedCompressionRatesEXT (EGLDisplay dpy, EGLConfig config, const EGLAttrib *attrib_list, EGLint *rates, EGLint rate_size, EGLint *num_rates); +#endif +#endif /* EGL_EXT_surface_compression */ + #ifndef EGL_EXT_swap_buffers_with_damage #define EGL_EXT_swap_buffers_with_damage 1 -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *rects, EGLint n_rects); #ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, const EGLint *rects, EGLint n_rects); #endif #endif /* EGL_EXT_swap_buffers_with_damage */ @@ -1129,11 +1195,34 @@ EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface sur #endif #endif /* EGL_NV_post_sub_buffer */ +#ifndef EGL_NV_quadruple_buffer +#define EGL_NV_quadruple_buffer 1 +#define EGL_QUADRUPLE_BUFFER_NV 0x3231 +#endif /* EGL_NV_quadruple_buffer */ + #ifndef EGL_NV_robustness_video_memory_purge #define EGL_NV_robustness_video_memory_purge 1 #define EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C #endif /* EGL_NV_robustness_video_memory_purge */ +#ifndef EGL_NV_stream_consumer_eglimage +#define EGL_NV_stream_consumer_eglimage 1 +#define EGL_STREAM_CONSUMER_IMAGE_NV 0x3373 +#define EGL_STREAM_IMAGE_ADD_NV 0x3374 +#define EGL_STREAM_IMAGE_REMOVE_NV 0x3375 +#define EGL_STREAM_IMAGE_AVAILABLE_NV 0x3376 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMIMAGECONSUMERCONNECTNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint num_modifiers, const EGLuint64KHR *modifiers, const EGLAttrib *attrib_list); +typedef EGLint (EGLAPIENTRYP PFNEGLQUERYSTREAMCONSUMEREVENTNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLTime timeout, EGLenum *event, EGLAttrib *aux); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMACQUIREIMAGENVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLImage *pImage, EGLSync sync); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMRELEASEIMAGENVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLImage image, EGLSync sync); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamImageConsumerConnectNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint num_modifiers, const EGLuint64KHR *modifiers, const EGLAttrib *attrib_list); +EGLAPI EGLint EGLAPIENTRY eglQueryStreamConsumerEventNV (EGLDisplay dpy, EGLStreamKHR stream, EGLTime timeout, EGLenum *event, EGLAttrib *aux); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamAcquireImageNV (EGLDisplay dpy, EGLStreamKHR stream, EGLImage *pImage, EGLSync sync); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamReleaseImageNV (EGLDisplay dpy, EGLStreamKHR stream, EGLImage image, EGLSync sync); +#endif +#endif /* EGL_NV_stream_consumer_eglimage */ + #ifndef EGL_NV_stream_consumer_gltexture_yuv #define EGL_NV_stream_consumer_gltexture_yuv 1 #define EGL_YUV_PLANE0_TEXTURE_UNIT_NV 0x332C @@ -1170,6 +1259,12 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV (EGLDi #define EGL_STREAM_CROSS_SYSTEM_NV 0x334F #endif /* EGL_NV_stream_cross_system */ +#ifndef EGL_NV_stream_dma +#define EGL_NV_stream_dma 1 +#define EGL_STREAM_DMA_NV 0x3371 +#define EGL_STREAM_DMA_SERVER_NV 0x3372 +#endif /* EGL_NV_stream_dma */ + #ifndef EGL_NV_stream_fifo_next #define EGL_NV_stream_fifo_next 1 #define EGL_PENDING_FRAME_NV 0x3329 @@ -1221,6 +1316,21 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamMetadataNV (EGLDisplay dpy, EGLStrea #endif #endif /* EGL_NV_stream_metadata */ +#ifndef EGL_NV_stream_origin +#define EGL_NV_stream_origin 1 +#define EGL_STREAM_FRAME_ORIGIN_X_NV 0x3366 +#define EGL_STREAM_FRAME_ORIGIN_Y_NV 0x3367 +#define EGL_STREAM_FRAME_MAJOR_AXIS_NV 0x3368 +#define EGL_CONSUMER_AUTO_ORIENTATION_NV 0x3369 +#define EGL_PRODUCER_AUTO_ORIENTATION_NV 0x336A +#define EGL_LEFT_NV 0x336B +#define EGL_RIGHT_NV 0x336C +#define EGL_TOP_NV 0x336D +#define EGL_BOTTOM_NV 0x336E +#define EGL_X_AXIS_NV 0x336F +#define EGL_Y_AXIS_NV 0x3370 +#endif /* EGL_NV_stream_origin */ + #ifndef EGL_NV_stream_remote #define EGL_NV_stream_remote 1 #define EGL_STREAM_STATE_INITIALIZING_NV 0x3240 @@ -1317,6 +1427,11 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_NV_system_time */ +#ifndef EGL_NV_triple_buffer +#define EGL_NV_triple_buffer 1 +#define EGL_TRIPLE_BUFFER_NV 0x3230 +#endif /* EGL_NV_triple_buffer */ + #ifndef EGL_TIZEN_image_native_buffer #define EGL_TIZEN_image_native_buffer 1 #define EGL_NATIVE_BUFFER_TIZEN 0x32A0 @@ -1327,6 +1442,40 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); #define EGL_NATIVE_SURFACE_TIZEN 0x32A1 #endif /* EGL_TIZEN_image_native_surface */ +#ifndef EGL_WL_bind_wayland_display +#define EGL_WL_bind_wayland_display 1 +#define PFNEGLBINDWAYLANDDISPLAYWL PFNEGLBINDWAYLANDDISPLAYWLPROC +#define PFNEGLUNBINDWAYLANDDISPLAYWL PFNEGLUNBINDWAYLANDDISPLAYWLPROC +#define PFNEGLQUERYWAYLANDBUFFERWL PFNEGLQUERYWAYLANDBUFFERWLPROC +struct wl_display; +struct wl_resource; +#define EGL_WAYLAND_BUFFER_WL 0x31D5 +#define EGL_WAYLAND_PLANE_WL 0x31D6 +#define EGL_TEXTURE_Y_U_V_WL 0x31D7 +#define EGL_TEXTURE_Y_UV_WL 0x31D8 +#define EGL_TEXTURE_Y_XUXV_WL 0x31D9 +#define EGL_TEXTURE_EXTERNAL_WL 0x31DA +#define EGL_WAYLAND_Y_INVERTED_WL 0x31DB +typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWLPROC) (EGLDisplay dpy, struct wl_display *display); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWLPROC) (EGLDisplay dpy, struct wl_display *display); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWLPROC) (EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglBindWaylandDisplayWL (EGLDisplay dpy, struct wl_display *display); +EGLAPI EGLBoolean EGLAPIENTRY eglUnbindWaylandDisplayWL (EGLDisplay dpy, struct wl_display *display); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryWaylandBufferWL (EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value); +#endif +#endif /* EGL_WL_bind_wayland_display */ + +#ifndef EGL_WL_create_wayland_buffer_from_image +#define EGL_WL_create_wayland_buffer_from_image 1 +#define PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC +struct wl_buffer; +typedef struct wl_buffer *(EGLAPIENTRYP PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC) (EGLDisplay dpy, EGLImageKHR image); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI struct wl_buffer *EGLAPIENTRY eglCreateWaylandBufferFromImageWL (EGLDisplay dpy, EGLImageKHR image); +#endif +#endif /* EGL_WL_create_wayland_buffer_from_image */ + #ifdef __cplusplus } #endif diff --git a/bgfx/3rdparty/khronos/EGL/eglplatform.h b/bgfx/3rdparty/khronos/EGL/eglplatform.h index 6d0d8db2..99362a23 100644 --- a/bgfx/3rdparty/khronos/EGL/eglplatform.h +++ b/bgfx/3rdparty/khronos/EGL/eglplatform.h @@ -2,36 +2,17 @@ #define __eglplatform_h_ /* -** Copyright (c) 2007-2016 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. -** -** 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. +** Copyright 2007-2020 The Khronos Group Inc. +** SPDX-License-Identifier: Apache-2.0 */ /* Platform-specific types and definitions for egl.h - * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $ * * Adopters may modify khrplatform.h and this file to suit their platform. * You are encouraged to submit all modifications to the Khronos group so that * they can be included in future versions of this file. Please submit changes - * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) - * by filing a bug against product "EGL" component "Registry". + * by filing an issue or pull request on the public Khronos EGL Registry, at + * https://www.github.com/KhronosGroup/EGL-Registry/ */ #include @@ -67,7 +48,13 @@ * implementations. */ -#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ +#if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES) + +typedef void *EGLNativeDisplayType; +typedef void *EGLNativePixmapType; +typedef void *EGLNativeWindowType; + +#elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif @@ -77,6 +64,12 @@ typedef HDC EGLNativeDisplayType; typedef HBITMAP EGLNativePixmapType; typedef HWND EGLNativeWindowType; +#elif defined(__EMSCRIPTEN__) + +typedef int EGLNativeDisplayType; +typedef int EGLNativePixmapType; +typedef int EGLNativeWindowType; + #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ typedef int EGLNativeDisplayType; @@ -110,7 +103,7 @@ typedef intptr_t EGLNativeDisplayType; typedef intptr_t EGLNativePixmapType; typedef intptr_t EGLNativeWindowType; -#elif defined(__unix__) || defined(USE_X11) +#elif defined(USE_X11) /* X11 (tentative) */ #include @@ -120,6 +113,12 @@ typedef Display *EGLNativeDisplayType; typedef Pixmap EGLNativePixmapType; typedef Window EGLNativeWindowType; +#elif defined(__unix__) + +typedef void *EGLNativeDisplayType; +typedef khronos_uintptr_t EGLNativePixmapType; +typedef khronos_uintptr_t EGLNativeWindowType; + #elif defined(__APPLE__) typedef int EGLNativeDisplayType; @@ -134,6 +133,12 @@ typedef void *EGLNativeDisplayType; typedef khronos_uintptr_t EGLNativePixmapType; typedef khronos_uintptr_t EGLNativeWindowType; +#elif defined(__Fuchsia__) + +typedef void *EGLNativeDisplayType; +typedef khronos_uintptr_t EGLNativePixmapType; +typedef khronos_uintptr_t EGLNativeWindowType; + #else #error "Platform not recognized" #endif diff --git a/bgfx/3rdparty/khronos/GLES2/gl2.h b/bgfx/3rdparty/khronos/GLES2/gl2.h index a48067d7..af244a70 100644 --- a/bgfx/3rdparty/khronos/GLES2/gl2.h +++ b/bgfx/3rdparty/khronos/GLES2/gl2.h @@ -6,28 +6,9 @@ extern "C" { #endif /* -** Copyright (c) 2013-2018 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT ** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** 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. -*/ -/* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at @@ -44,7 +25,7 @@ extern "C" { #define GL_GLES_PROTOTYPES 1 #endif -/* Generated on date 20190228 */ +/* Generated on date 20220530 */ /* Generated C header for: * API: gles2 @@ -477,7 +458,7 @@ typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask); typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); @@ -620,7 +601,7 @@ GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); diff --git a/bgfx/3rdparty/khronos/GLES2/gl2ext.h b/bgfx/3rdparty/khronos/GLES2/gl2ext.h index 00f116b1..9448ce09 100644 --- a/bgfx/3rdparty/khronos/GLES2/gl2ext.h +++ b/bgfx/3rdparty/khronos/GLES2/gl2ext.h @@ -6,28 +6,9 @@ extern "C" { #endif /* -** Copyright (c) 2013-2018 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT ** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** 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. -*/ -/* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at @@ -38,7 +19,7 @@ extern "C" { #define GL_APIENTRYP GL_APIENTRY* #endif -/* Generated on date 20190228 */ +/* Generated on date 20220530 */ /* Generated C header for: * API: gles2 @@ -197,6 +178,22 @@ GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, #endif #endif /* GL_KHR_robustness */ +#ifndef GL_KHR_shader_subgroup +#define GL_KHR_shader_subgroup 1 +#define GL_SUBGROUP_SIZE_KHR 0x9532 +#define GL_SUBGROUP_SUPPORTED_STAGES_KHR 0x9533 +#define GL_SUBGROUP_SUPPORTED_FEATURES_KHR 0x9534 +#define GL_SUBGROUP_QUAD_ALL_STAGES_KHR 0x9535 +#define GL_SUBGROUP_FEATURE_BASIC_BIT_KHR 0x00000001 +#define GL_SUBGROUP_FEATURE_VOTE_BIT_KHR 0x00000002 +#define GL_SUBGROUP_FEATURE_ARITHMETIC_BIT_KHR 0x00000004 +#define GL_SUBGROUP_FEATURE_BALLOT_BIT_KHR 0x00000008 +#define GL_SUBGROUP_FEATURE_SHUFFLE_BIT_KHR 0x00000010 +#define GL_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT_KHR 0x00000020 +#define GL_SUBGROUP_FEATURE_CLUSTERED_BIT_KHR 0x00000040 +#define GL_SUBGROUP_FEATURE_QUAD_BIT_KHR 0x00000080 +#endif /* GL_KHR_shader_subgroup */ + #ifndef GL_KHR_texture_compression_astc_hdr #define GL_KHR_texture_compression_astc_hdr 1 #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 @@ -334,12 +331,12 @@ GL_APICALL GLboolean GL_APIENTRY glIsEnablediOES (GLenum target, GLuint index); typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); -typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexOES (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); -GL_APICALL void GL_APIENTRY glMultiDrawElementsBaseVertexEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex); +GL_APICALL void GL_APIENTRY glMultiDrawElementsBaseVertexEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); #endif #endif /* GL_OES_draw_elements_base_vertex */ @@ -930,9 +927,9 @@ GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint div #ifndef GL_ANGLE_translated_shader_source #define GL_ANGLE_translated_shader_source 1 #define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 -typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); #endif #endif /* GL_ANGLE_translated_shader_source */ @@ -1010,7 +1007,7 @@ typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); -typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); @@ -1018,7 +1015,7 @@ GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); -GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); #endif #endif /* GL_APPLE_sync */ @@ -1065,6 +1062,11 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei #define GL_ARM_shader_framebuffer_fetch_depth_stencil 1 #endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */ +#ifndef GL_ARM_texture_unnormalized_coordinates +#define GL_ARM_texture_unnormalized_coordinates 1 +#define GL_TEXTURE_UNNORMALIZED_COORDINATES_ARM 0x8F6A +#endif /* GL_ARM_texture_unnormalized_coordinates */ + #ifndef GL_DMP_program_binary #define GL_DMP_program_binary 1 #define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251 @@ -1091,6 +1093,13 @@ GL_APICALL void GL_APIENTRY glEGLImageTargetTextureStorageEXT (GLuint texture, G #endif #endif /* GL_EXT_EGL_image_storage */ +#ifndef GL_EXT_EGL_image_storage_compression +#define GL_EXT_EGL_image_storage_compression 1 +#define GL_SURFACE_COMPRESSION_EXT 0x96C0 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_NONE_EXT 0x96C1 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_DEFAULT_EXT 0x96C2 +#endif /* GL_EXT_EGL_image_storage_compression */ + #ifndef GL_EXT_YUV_target #define GL_EXT_YUV_target 1 #define GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7 @@ -1282,6 +1291,7 @@ typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pnam typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); +typedef void (GL_APIENTRYP PFNGLGETINTEGER64VEXTPROC) (GLenum pname, GLint64 *data); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); @@ -1294,6 +1304,7 @@ GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLin GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params); GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params); +GL_APICALL void GL_APIENTRY glGetInteger64vEXT (GLenum pname, GLint64 *data); #endif #endif /* GL_EXT_disjoint_timer_query */ @@ -1408,6 +1419,46 @@ GL_APICALL void GL_APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLin #define GL_EXT_float_blend 1 #endif /* GL_EXT_float_blend */ +#ifndef GL_EXT_fragment_shading_rate +#define GL_EXT_fragment_shading_rate 1 +#define GL_SHADING_RATE_1X1_PIXELS_EXT 0x96A6 +#define GL_SHADING_RATE_1X2_PIXELS_EXT 0x96A7 +#define GL_SHADING_RATE_2X1_PIXELS_EXT 0x96A8 +#define GL_SHADING_RATE_2X2_PIXELS_EXT 0x96A9 +#define GL_SHADING_RATE_1X4_PIXELS_EXT 0x96AA +#define GL_SHADING_RATE_4X1_PIXELS_EXT 0x96AB +#define GL_SHADING_RATE_4X2_PIXELS_EXT 0x96AC +#define GL_SHADING_RATE_2X4_PIXELS_EXT 0x96AD +#define GL_SHADING_RATE_4X4_PIXELS_EXT 0x96AE +#define GL_SHADING_RATE_EXT 0x96D0 +#define GL_SHADING_RATE_ATTACHMENT_EXT 0x96D1 +#define GL_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_EXT 0x96D2 +#define GL_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_EXT 0x96D3 +#define GL_FRAGMENT_SHADING_RATE_COMBINER_OP_MIN_EXT 0x96D4 +#define GL_FRAGMENT_SHADING_RATE_COMBINER_OP_MAX_EXT 0x96D5 +#define GL_FRAGMENT_SHADING_RATE_COMBINER_OP_MUL_EXT 0x96D6 +#define GL_MIN_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_WIDTH_EXT 0x96D7 +#define GL_MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_WIDTH_EXT 0x96D8 +#define GL_MIN_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_HEIGHT_EXT 0x96D9 +#define GL_MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_HEIGHT_EXT 0x96DA +#define GL_MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_ASPECT_RATIO_EXT 0x96DB +#define GL_MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_LAYERS_EXT 0x96DC +#define GL_FRAGMENT_SHADING_RATE_WITH_SHADER_DEPTH_STENCIL_WRITES_SUPPORTED_EXT 0x96DD +#define GL_FRAGMENT_SHADING_RATE_WITH_SAMPLE_MASK_SUPPORTED_EXT 0x96DE +#define GL_FRAGMENT_SHADING_RATE_ATTACHMENT_WITH_DEFAULT_FRAMEBUFFER_SUPPORTED_EXT 0x96DF +#define GL_FRAGMENT_SHADING_RATE_NON_TRIVIAL_COMBINERS_SUPPORTED_EXT 0x8F6F +typedef void (GL_APIENTRYP PFNGLGETFRAGMENTSHADINGRATESEXTPROC) (GLsizei samples, GLsizei maxCount, GLsizei *count, GLenum *shadingRates); +typedef void (GL_APIENTRYP PFNGLSHADINGRATEEXTPROC) (GLenum rate); +typedef void (GL_APIENTRYP PFNGLSHADINGRATECOMBINEROPSEXTPROC) (GLenum combinerOp0, GLenum combinerOp1); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERSHADINGRATEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint baseLayer, GLsizei numLayers, GLsizei texelWidth, GLsizei texelHeight); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetFragmentShadingRatesEXT (GLsizei samples, GLsizei maxCount, GLsizei *count, GLenum *shadingRates); +GL_APICALL void GL_APIENTRY glShadingRateEXT (GLenum rate); +GL_APICALL void GL_APIENTRY glShadingRateCombinerOpsEXT (GLenum combinerOp0, GLenum combinerOp1); +GL_APICALL void GL_APIENTRY glFramebufferShadingRateEXT (GLenum target, GLenum attachment, GLuint texture, GLint baseLayer, GLsizei numLayers, GLsizei texelWidth, GLsizei texelHeight); +#endif +#endif /* GL_EXT_fragment_shading_rate */ + #ifndef GL_EXT_geometry_point_size #define GL_EXT_geometry_point_size 1 #endif /* GL_EXT_geometry_point_size */ @@ -1601,6 +1652,10 @@ GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, #endif #endif /* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture2 +#define GL_EXT_multisampled_render_to_texture2 1 +#endif /* GL_EXT_multisampled_render_to_texture2 */ + #ifndef GL_EXT_multiview_draw_buffers #define GL_EXT_multiview_draw_buffers 1 #define GL_COLOR_ATTACHMENT_EXT 0x90F0 @@ -1618,6 +1673,18 @@ GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLi #endif #endif /* GL_EXT_multiview_draw_buffers */ +#ifndef GL_EXT_multiview_tessellation_geometry_shader +#define GL_EXT_multiview_tessellation_geometry_shader 1 +#endif /* GL_EXT_multiview_tessellation_geometry_shader */ + +#ifndef GL_EXT_multiview_texture_multisample +#define GL_EXT_multiview_texture_multisample 1 +#endif /* GL_EXT_multiview_texture_multisample */ + +#ifndef GL_EXT_multiview_timer_query +#define GL_EXT_multiview_timer_query 1 +#endif /* GL_EXT_multiview_timer_query */ + #ifndef GL_EXT_occlusion_query_boolean #define GL_EXT_occlusion_query_boolean 1 #define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F @@ -1775,6 +1842,10 @@ GL_APICALL void GL_APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLe #endif #endif /* GL_EXT_semaphore_win32 */ +#ifndef GL_EXT_separate_depth_stencil +#define GL_EXT_separate_depth_stencil 1 +#endif /* GL_EXT_separate_depth_stencil */ + #ifndef GL_EXT_separate_shader_objects #define GL_EXT_separate_shader_objects 1 #define GL_ACTIVE_PROGRAM_EXT 0x8259 @@ -1930,6 +2001,10 @@ GL_APICALL void GL_APIENTRY glClearPixelLocalStorageuiEXT (GLsizei offset, GLsiz #endif #endif /* GL_EXT_shader_pixel_local_storage2 */ +#ifndef GL_EXT_shader_samples_identical +#define GL_EXT_shader_samples_identical 1 +#endif /* GL_EXT_shader_samples_identical */ + #ifndef GL_EXT_shader_texture_lod #define GL_EXT_shader_texture_lod 1 #endif /* GL_EXT_shader_texture_lod */ @@ -2188,6 +2263,10 @@ GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalf #define GL_SKIP_DECODE_EXT 0x8A4A #endif /* GL_EXT_texture_sRGB_decode */ +#ifndef GL_EXT_texture_shadow_lod +#define GL_EXT_texture_shadow_lod 1 +#endif /* GL_EXT_texture_shadow_lod */ + #ifndef GL_EXT_texture_storage #define GL_EXT_texture_storage 1 #define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F @@ -2220,6 +2299,29 @@ GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target #endif #endif /* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage_compression +#define GL_EXT_texture_storage_compression 1 +#define GL_NUM_SURFACE_COMPRESSION_FIXED_RATES_EXT 0x8F6E +#define GL_SURFACE_COMPRESSION_FIXED_RATE_1BPC_EXT 0x96C4 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_2BPC_EXT 0x96C5 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_3BPC_EXT 0x96C6 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_4BPC_EXT 0x96C7 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_5BPC_EXT 0x96C8 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_6BPC_EXT 0x96C9 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_7BPC_EXT 0x96CA +#define GL_SURFACE_COMPRESSION_FIXED_RATE_8BPC_EXT 0x96CB +#define GL_SURFACE_COMPRESSION_FIXED_RATE_9BPC_EXT 0x96CC +#define GL_SURFACE_COMPRESSION_FIXED_RATE_10BPC_EXT 0x96CD +#define GL_SURFACE_COMPRESSION_FIXED_RATE_11BPC_EXT 0x96CE +#define GL_SURFACE_COMPRESSION_FIXED_RATE_12BPC_EXT 0x96CF +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEATTRIBS2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, const GLint* attrib_list); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEATTRIBS3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, const GLint* attrib_list); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorageAttribs2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, const GLint* attrib_list); +GL_APICALL void GL_APIENTRY glTexStorageAttribs3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, const GLint* attrib_list); +#endif +#endif /* GL_EXT_texture_storage_compression */ + #ifndef GL_EXT_texture_type_2_10_10_10_REV #define GL_EXT_texture_type_2_10_10_10_REV 1 #define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 @@ -2420,11 +2522,32 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint quer #endif #endif /* GL_INTEL_performance_query */ +#ifndef GL_MESA_bgra +#define GL_MESA_bgra 1 +#define GL_BGR_EXT 0x80E0 +#endif /* GL_MESA_bgra */ + +#ifndef GL_MESA_framebuffer_flip_x +#define GL_MESA_framebuffer_flip_x 1 +#define GL_FRAMEBUFFER_FLIP_X_MESA 0x8BBC +#endif /* GL_MESA_framebuffer_flip_x */ + #ifndef GL_MESA_framebuffer_flip_y #define GL_MESA_framebuffer_flip_y 1 #define GL_FRAMEBUFFER_FLIP_Y_MESA 0x8BBB +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPARAMETERIMESAPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVMESAPROC) (GLenum target, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferParameteriMESA (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glGetFramebufferParameterivMESA (GLenum target, GLenum pname, GLint *params); +#endif #endif /* GL_MESA_framebuffer_flip_y */ +#ifndef GL_MESA_framebuffer_swap_xy +#define GL_MESA_framebuffer_swap_xy 1 +#define GL_FRAMEBUFFER_SWAP_XY_MESA 0x8BBD +#endif /* GL_MESA_framebuffer_swap_xy */ + #ifndef GL_MESA_program_binary_formats #define GL_MESA_program_binary_formats 1 #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F @@ -2746,6 +2869,10 @@ GL_APICALL void GL_APIENTRY glFragmentCoverageColorNV (GLuint color); #endif #endif /* GL_NV_fragment_coverage_to_color */ +#ifndef GL_NV_fragment_shader_barycentric +#define GL_NV_fragment_shader_barycentric 1 +#endif /* GL_NV_fragment_shader_barycentric */ + #ifndef GL_NV_fragment_shader_interlock #define GL_NV_fragment_shader_interlock 1 #endif /* GL_NV_fragment_shader_interlock */ @@ -2773,11 +2900,11 @@ GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint #define GL_COVERAGE_MODULATION_NV 0x9332 #define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); -typedef void (GL_APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v); +typedef void (GL_APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufSize, GLfloat *v); typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); -GL_APICALL void GL_APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v); +GL_APICALL void GL_APIENTRY glGetCoverageModulationTableNV (GLsizei bufSize, GLfloat *v); GL_APICALL void GL_APIENTRY glCoverageModulationNV (GLenum components); #endif #endif /* GL_NV_framebuffer_mixed_samples */ @@ -2925,9 +3052,9 @@ GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint diviso #define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 #define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 #define GL_CONFORMANT_NV 0x9374 -typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei count, GLint *params); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +GL_APICALL void GL_APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei count, GLint *params); #endif #endif /* GL_NV_internalformat_sample_query */ @@ -2959,6 +3086,82 @@ GL_APICALL void GL_APIENTRY glNamedBufferAttachMemoryNV (GLuint buffer, GLuint m #endif #endif /* GL_NV_memory_attachment */ +#ifndef GL_NV_memory_object_sparse +#define GL_NV_memory_object_sparse 1 +typedef void (GL_APIENTRYP PFNGLBUFFERPAGECOMMITMENTMEMNVPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +typedef void (GL_APIENTRYP PFNGLTEXPAGECOMMITMENTMEMNVPROC) (GLenum target, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTMEMNVPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +typedef void (GL_APIENTRYP PFNGLTEXTUREPAGECOMMITMENTMEMNVPROC) (GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBufferPageCommitmentMemNV (GLenum target, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +GL_APICALL void GL_APIENTRY glTexPageCommitmentMemNV (GLenum target, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +GL_APICALL void GL_APIENTRY glNamedBufferPageCommitmentMemNV (GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +GL_APICALL void GL_APIENTRY glTexturePageCommitmentMemNV (GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +#endif +#endif /* GL_NV_memory_object_sparse */ + +#ifndef GL_NV_mesh_shader +#define GL_NV_mesh_shader 1 +#define GL_MESH_SHADER_NV 0x9559 +#define GL_TASK_SHADER_NV 0x955A +#define GL_MAX_MESH_UNIFORM_BLOCKS_NV 0x8E60 +#define GL_MAX_MESH_TEXTURE_IMAGE_UNITS_NV 0x8E61 +#define GL_MAX_MESH_IMAGE_UNIFORMS_NV 0x8E62 +#define GL_MAX_MESH_UNIFORM_COMPONENTS_NV 0x8E63 +#define GL_MAX_MESH_ATOMIC_COUNTER_BUFFERS_NV 0x8E64 +#define GL_MAX_MESH_ATOMIC_COUNTERS_NV 0x8E65 +#define GL_MAX_MESH_SHADER_STORAGE_BLOCKS_NV 0x8E66 +#define GL_MAX_COMBINED_MESH_UNIFORM_COMPONENTS_NV 0x8E67 +#define GL_MAX_TASK_UNIFORM_BLOCKS_NV 0x8E68 +#define GL_MAX_TASK_TEXTURE_IMAGE_UNITS_NV 0x8E69 +#define GL_MAX_TASK_IMAGE_UNIFORMS_NV 0x8E6A +#define GL_MAX_TASK_UNIFORM_COMPONENTS_NV 0x8E6B +#define GL_MAX_TASK_ATOMIC_COUNTER_BUFFERS_NV 0x8E6C +#define GL_MAX_TASK_ATOMIC_COUNTERS_NV 0x8E6D +#define GL_MAX_TASK_SHADER_STORAGE_BLOCKS_NV 0x8E6E +#define GL_MAX_COMBINED_TASK_UNIFORM_COMPONENTS_NV 0x8E6F +#define GL_MAX_MESH_WORK_GROUP_INVOCATIONS_NV 0x95A2 +#define GL_MAX_TASK_WORK_GROUP_INVOCATIONS_NV 0x95A3 +#define GL_MAX_MESH_TOTAL_MEMORY_SIZE_NV 0x9536 +#define GL_MAX_TASK_TOTAL_MEMORY_SIZE_NV 0x9537 +#define GL_MAX_MESH_OUTPUT_VERTICES_NV 0x9538 +#define GL_MAX_MESH_OUTPUT_PRIMITIVES_NV 0x9539 +#define GL_MAX_TASK_OUTPUT_COUNT_NV 0x953A +#define GL_MAX_DRAW_MESH_TASKS_COUNT_NV 0x953D +#define GL_MAX_MESH_VIEWS_NV 0x9557 +#define GL_MESH_OUTPUT_PER_VERTEX_GRANULARITY_NV 0x92DF +#define GL_MESH_OUTPUT_PER_PRIMITIVE_GRANULARITY_NV 0x9543 +#define GL_MAX_MESH_WORK_GROUP_SIZE_NV 0x953B +#define GL_MAX_TASK_WORK_GROUP_SIZE_NV 0x953C +#define GL_MESH_WORK_GROUP_SIZE_NV 0x953E +#define GL_TASK_WORK_GROUP_SIZE_NV 0x953F +#define GL_MESH_VERTICES_OUT_NV 0x9579 +#define GL_MESH_PRIMITIVES_OUT_NV 0x957A +#define GL_MESH_OUTPUT_TYPE_NV 0x957B +#define GL_UNIFORM_BLOCK_REFERENCED_BY_MESH_SHADER_NV 0x959C +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV 0x959D +#define GL_REFERENCED_BY_MESH_SHADER_NV 0x95A0 +#define GL_REFERENCED_BY_TASK_SHADER_NV 0x95A1 +#define GL_MESH_SHADER_BIT_NV 0x00000040 +#define GL_TASK_SHADER_BIT_NV 0x00000080 +#define GL_MESH_SUBROUTINE_NV 0x957C +#define GL_TASK_SUBROUTINE_NV 0x957D +#define GL_MESH_SUBROUTINE_UNIFORM_NV 0x957E +#define GL_TASK_SUBROUTINE_UNIFORM_NV 0x957F +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV 0x959E +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV 0x959F +typedef void (GL_APIENTRYP PFNGLDRAWMESHTASKSNVPROC) (GLuint first, GLuint count); +typedef void (GL_APIENTRYP PFNGLDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect, GLsizei drawcount, GLsizei stride); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWMESHTASKSINDIRECTCOUNTNVPROC) (GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawMeshTasksNV (GLuint first, GLuint count); +GL_APICALL void GL_APIENTRY glDrawMeshTasksIndirectNV (GLintptr indirect); +GL_APICALL void GL_APIENTRY glMultiDrawMeshTasksIndirectNV (GLintptr indirect, GLsizei drawcount, GLsizei stride); +GL_APICALL void GL_APIENTRY glMultiDrawMeshTasksIndirectCountNV (GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#endif +#endif /* GL_NV_mesh_shader */ + #ifndef GL_NV_non_square_matrices #define GL_NV_non_square_matrices 1 #define GL_FLOAT_MAT2x3_NV 0x8B65 @@ -3191,11 +3394,11 @@ typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GL typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount); typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); typedef GLenum (GL_APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); typedef void (GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLfloat *params); typedef void (GL_APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); typedef void (GL_APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode); typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); @@ -3268,11 +3471,11 @@ GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fi GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount); GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); GL_APICALL GLenum GL_APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); -GL_APICALL void GL_APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLfloat *params); GL_APICALL void GL_APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); GL_APICALL void GL_APIENTRY glMatrixLoadIdentityEXT (GLenum mode); GL_APICALL void GL_APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m); @@ -3322,6 +3525,12 @@ GL_APICALL void GL_APIENTRY glPolygonModeNV (GLenum face, GLenum mode); #endif #endif /* GL_NV_polygon_mode */ +#ifndef GL_NV_primitive_shading_rate +#define GL_NV_primitive_shading_rate 1 +#define GL_SHADING_RATE_IMAGE_PER_PRIMITIVE_NV 0x95B1 +#define GL_SHADING_RATE_IMAGE_PALETTE_COUNT_NV 0x95B2 +#endif /* GL_NV_primitive_shading_rate */ + #ifndef GL_NV_read_buffer #define GL_NV_read_buffer 1 #define GL_READ_BUFFER_NV 0x0C02 @@ -3347,6 +3556,11 @@ GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); #define GL_NV_read_stencil 1 #endif /* GL_NV_read_stencil */ +#ifndef GL_NV_representative_fragment_test +#define GL_NV_representative_fragment_test 1 +#define GL_REPRESENTATIVE_FRAGMENT_TEST_NV 0x937F +#endif /* GL_NV_representative_fragment_test */ + #ifndef GL_NV_sRGB_formats #define GL_NV_sRGB_formats 1 #define GL_SLUMINANCE_NV 0x8C46 @@ -3405,6 +3619,56 @@ GL_APICALL void GL_APIENTRY glScissorExclusiveArrayvNV (GLuint first, GLsizei co #define GL_NV_shader_noperspective_interpolation 1 #endif /* GL_NV_shader_noperspective_interpolation */ +#ifndef GL_NV_shader_subgroup_partitioned +#define GL_NV_shader_subgroup_partitioned 1 +#define GL_SUBGROUP_FEATURE_PARTITIONED_BIT_NV 0x00000100 +#endif /* GL_NV_shader_subgroup_partitioned */ + +#ifndef GL_NV_shader_texture_footprint +#define GL_NV_shader_texture_footprint 1 +#endif /* GL_NV_shader_texture_footprint */ + +#ifndef GL_NV_shading_rate_image +#define GL_NV_shading_rate_image 1 +#define GL_SHADING_RATE_IMAGE_NV 0x9563 +#define GL_SHADING_RATE_NO_INVOCATIONS_NV 0x9564 +#define GL_SHADING_RATE_1_INVOCATION_PER_PIXEL_NV 0x9565 +#define GL_SHADING_RATE_1_INVOCATION_PER_1X2_PIXELS_NV 0x9566 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X1_PIXELS_NV 0x9567 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X2_PIXELS_NV 0x9568 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X4_PIXELS_NV 0x9569 +#define GL_SHADING_RATE_1_INVOCATION_PER_4X2_PIXELS_NV 0x956A +#define GL_SHADING_RATE_1_INVOCATION_PER_4X4_PIXELS_NV 0x956B +#define GL_SHADING_RATE_2_INVOCATIONS_PER_PIXEL_NV 0x956C +#define GL_SHADING_RATE_4_INVOCATIONS_PER_PIXEL_NV 0x956D +#define GL_SHADING_RATE_8_INVOCATIONS_PER_PIXEL_NV 0x956E +#define GL_SHADING_RATE_16_INVOCATIONS_PER_PIXEL_NV 0x956F +#define GL_SHADING_RATE_IMAGE_BINDING_NV 0x955B +#define GL_SHADING_RATE_IMAGE_TEXEL_WIDTH_NV 0x955C +#define GL_SHADING_RATE_IMAGE_TEXEL_HEIGHT_NV 0x955D +#define GL_SHADING_RATE_IMAGE_PALETTE_SIZE_NV 0x955E +#define GL_MAX_COARSE_FRAGMENT_SAMPLES_NV 0x955F +#define GL_SHADING_RATE_SAMPLE_ORDER_DEFAULT_NV 0x95AE +#define GL_SHADING_RATE_SAMPLE_ORDER_PIXEL_MAJOR_NV 0x95AF +#define GL_SHADING_RATE_SAMPLE_ORDER_SAMPLE_MAJOR_NV 0x95B0 +typedef void (GL_APIENTRYP PFNGLBINDSHADINGRATEIMAGENVPROC) (GLuint texture); +typedef void (GL_APIENTRYP PFNGLGETSHADINGRATEIMAGEPALETTENVPROC) (GLuint viewport, GLuint entry, GLenum *rate); +typedef void (GL_APIENTRYP PFNGLGETSHADINGRATESAMPLELOCATIONIVNVPROC) (GLenum rate, GLuint samples, GLuint index, GLint *location); +typedef void (GL_APIENTRYP PFNGLSHADINGRATEIMAGEBARRIERNVPROC) (GLboolean synchronize); +typedef void (GL_APIENTRYP PFNGLSHADINGRATEIMAGEPALETTENVPROC) (GLuint viewport, GLuint first, GLsizei count, const GLenum *rates); +typedef void (GL_APIENTRYP PFNGLSHADINGRATESAMPLEORDERNVPROC) (GLenum order); +typedef void (GL_APIENTRYP PFNGLSHADINGRATESAMPLEORDERCUSTOMNVPROC) (GLenum rate, GLuint samples, const GLint *locations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindShadingRateImageNV (GLuint texture); +GL_APICALL void GL_APIENTRY glGetShadingRateImagePaletteNV (GLuint viewport, GLuint entry, GLenum *rate); +GL_APICALL void GL_APIENTRY glGetShadingRateSampleLocationivNV (GLenum rate, GLuint samples, GLuint index, GLint *location); +GL_APICALL void GL_APIENTRY glShadingRateImageBarrierNV (GLboolean synchronize); +GL_APICALL void GL_APIENTRY glShadingRateImagePaletteNV (GLuint viewport, GLuint first, GLsizei count, const GLenum *rates); +GL_APICALL void GL_APIENTRY glShadingRateSampleOrderNV (GLenum order); +GL_APICALL void GL_APIENTRY glShadingRateSampleOrderCustomNV (GLenum rate, GLuint samples, const GLint *locations); +#endif +#endif /* GL_NV_shading_rate_image */ + #ifndef GL_NV_shadow_samplers_array #define GL_NV_shadow_samplers_array 1 #define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 @@ -3433,6 +3697,23 @@ GL_APICALL void GL_APIENTRY glScissorExclusiveArrayvNV (GLuint first, GLsizei co #define GL_NV_texture_npot_2D_mipmap 1 #endif /* GL_NV_texture_npot_2D_mipmap */ +#ifndef GL_NV_timeline_semaphore +#define GL_NV_timeline_semaphore 1 +#define GL_TIMELINE_SEMAPHORE_VALUE_NV 0x9595 +#define GL_SEMAPHORE_TYPE_NV 0x95B3 +#define GL_SEMAPHORE_TYPE_BINARY_NV 0x95B4 +#define GL_SEMAPHORE_TYPE_TIMELINE_NV 0x95B5 +#define GL_MAX_TIMELINE_SEMAPHORE_VALUE_DIFFERENCE_NV 0x95B6 +typedef void (GL_APIENTRYP PFNGLCREATESEMAPHORESNVPROC) (GLsizei n, GLuint *semaphores); +typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERIVNVPROC) (GLuint semaphore, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERIVNVPROC) (GLuint semaphore, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCreateSemaphoresNV (GLsizei n, GLuint *semaphores); +GL_APICALL void GL_APIENTRY glSemaphoreParameterivNV (GLuint semaphore, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glGetSemaphoreParameterivNV (GLuint semaphore, GLenum pname, GLint *params); +#endif +#endif /* GL_NV_timeline_semaphore */ + #ifndef GL_NV_viewport_array #define GL_NV_viewport_array 1 #define GL_MAX_VIEWPORTS_NV 0x825B @@ -3599,6 +3880,14 @@ GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLe #endif #endif /* GL_QCOM_extended_get2 */ +#ifndef GL_QCOM_frame_extrapolation +#define GL_QCOM_frame_extrapolation 1 +typedef void (GL_APIENTRYP PFNGLEXTRAPOLATETEX2DQCOMPROC) (GLuint src1, GLuint src2, GLuint output, GLfloat scaleFactor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtrapolateTex2DQCOM (GLuint src1, GLuint src2, GLuint output, GLfloat scaleFactor); +#endif +#endif /* GL_QCOM_frame_extrapolation */ + #ifndef GL_QCOM_framebuffer_foveated #define GL_QCOM_framebuffer_foveated 1 #define GL_FOVEATION_ENABLE_BIT_QCOM 0x00000001 @@ -3611,11 +3900,27 @@ GL_APICALL void GL_APIENTRY glFramebufferFoveationParametersQCOM (GLuint framebu #endif #endif /* GL_QCOM_framebuffer_foveated */ +#ifndef GL_QCOM_motion_estimation +#define GL_QCOM_motion_estimation 1 +#define GL_MOTION_ESTIMATION_SEARCH_BLOCK_X_QCOM 0x8C90 +#define GL_MOTION_ESTIMATION_SEARCH_BLOCK_Y_QCOM 0x8C91 +typedef void (GL_APIENTRYP PFNGLTEXESTIMATEMOTIONQCOMPROC) (GLuint ref, GLuint target, GLuint output); +typedef void (GL_APIENTRYP PFNGLTEXESTIMATEMOTIONREGIONSQCOMPROC) (GLuint ref, GLuint target, GLuint output, GLuint mask); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexEstimateMotionQCOM (GLuint ref, GLuint target, GLuint output); +GL_APICALL void GL_APIENTRY glTexEstimateMotionRegionsQCOM (GLuint ref, GLuint target, GLuint output, GLuint mask); +#endif +#endif /* GL_QCOM_motion_estimation */ + #ifndef GL_QCOM_perfmon_global_mode #define GL_QCOM_perfmon_global_mode 1 #define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 #endif /* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_render_shared_exponent +#define GL_QCOM_render_shared_exponent 1 +#endif /* GL_QCOM_render_shared_exponent */ + #ifndef GL_QCOM_shader_framebuffer_fetch_noncoherent #define GL_QCOM_shader_framebuffer_fetch_noncoherent 1 #define GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM 0x96A2 @@ -3629,6 +3934,22 @@ GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierQCOM (void); #define GL_QCOM_shader_framebuffer_fetch_rate 1 #endif /* GL_QCOM_shader_framebuffer_fetch_rate */ +#ifndef GL_QCOM_shading_rate +#define GL_QCOM_shading_rate 1 +#define GL_SHADING_RATE_QCOM 0x96A4 +#define GL_SHADING_RATE_PRESERVE_ASPECT_RATIO_QCOM 0x96A5 +#define GL_SHADING_RATE_1X1_PIXELS_QCOM 0x96A6 +#define GL_SHADING_RATE_1X2_PIXELS_QCOM 0x96A7 +#define GL_SHADING_RATE_2X1_PIXELS_QCOM 0x96A8 +#define GL_SHADING_RATE_2X2_PIXELS_QCOM 0x96A9 +#define GL_SHADING_RATE_4X2_PIXELS_QCOM 0x96AC +#define GL_SHADING_RATE_4X4_PIXELS_QCOM 0x96AE +typedef void (GL_APIENTRYP PFNGLSHADINGRATEQCOMPROC) (GLenum rate); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glShadingRateQCOM (GLenum rate); +#endif +#endif /* GL_QCOM_shading_rate */ + #ifndef GL_QCOM_texture_foveated #define GL_QCOM_texture_foveated 1 #define GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM 0x8BFB @@ -3642,6 +3963,11 @@ GL_APICALL void GL_APIENTRY glTextureFoveationParametersQCOM (GLuint texture, GL #endif #endif /* GL_QCOM_texture_foveated */ +#ifndef GL_QCOM_texture_foveated2 +#define GL_QCOM_texture_foveated2 1 +#define GL_TEXTURE_FOVEATED_CUTOFF_DENSITY_QCOM 0x96A0 +#endif /* GL_QCOM_texture_foveated2 */ + #ifndef GL_QCOM_texture_foveated_subsampled_layout #define GL_QCOM_texture_foveated_subsampled_layout 1 #define GL_FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM 0x00000004 diff --git a/bgfx/3rdparty/khronos/GLES2/gl2platform.h b/bgfx/3rdparty/khronos/GLES2/gl2platform.h index eb318dc3..5bcce6d8 100644 --- a/bgfx/3rdparty/khronos/GLES2/gl2platform.h +++ b/bgfx/3rdparty/khronos/GLES2/gl2platform.h @@ -2,19 +2,8 @@ #define __gl2platform_h_ /* -** Copyright (c) 2017 The Khronos Group Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. +** Copyright 2017-2020 The Khronos Group Inc. +** SPDX-License-Identifier: Apache-2.0 */ /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h diff --git a/bgfx/3rdparty/khronos/GLES3/gl3.h b/bgfx/3rdparty/khronos/GLES3/gl3.h index b84acdc2..eaf5efdf 100644 --- a/bgfx/3rdparty/khronos/GLES3/gl3.h +++ b/bgfx/3rdparty/khronos/GLES3/gl3.h @@ -6,28 +6,9 @@ extern "C" { #endif /* -** Copyright (c) 2013-2018 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT ** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** 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. -*/ -/* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at @@ -44,7 +25,7 @@ extern "C" { #define GL_GLES_PROTOTYPES 1 #endif -/* Generated on date 20190228 */ +/* Generated on date 20220530 */ /* Generated C header for: * API: gles2 @@ -477,7 +458,7 @@ typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask); typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); @@ -620,7 +601,7 @@ GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); @@ -1068,7 +1049,7 @@ typedef void (GL_APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (GL_APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (GL_APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); -typedef void (GL_APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (GL_APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); typedef void (GL_APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); @@ -1095,7 +1076,7 @@ typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsiz typedef void (GL_APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params); #if GL_GLES_PROTOTYPES GL_APICALL void GL_APIENTRY glReadBuffer (GLenum src); GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); @@ -1173,7 +1154,7 @@ GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync); GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); -GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); @@ -1200,7 +1181,7 @@ GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numA GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params); #endif #endif /* GL_ES_VERSION_3_0 */ diff --git a/bgfx/3rdparty/khronos/GLES3/gl31.h b/bgfx/3rdparty/khronos/GLES3/gl31.h index 4806181e..502d6fee 100644 --- a/bgfx/3rdparty/khronos/GLES3/gl31.h +++ b/bgfx/3rdparty/khronos/GLES3/gl31.h @@ -1,39 +1,18 @@ -#ifndef __gl31_h_ -#define __gl31_h_ 1 +#ifndef __gles2_gl31_h_ +#define __gles2_gl31_h_ 1 #ifdef __cplusplus extern "C" { #endif /* -** Copyright (c) 2013-2016 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT ** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** 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. -*/ -/* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision$ on $Date$ +** https://github.com/KhronosGroup/OpenGL-Registry */ #include @@ -46,7 +25,7 @@ extern "C" { #define GL_GLES_PROTOTYPES 1 #endif -/* Generated on date 20161024 */ +/* Generated on date 20191013 */ /* Generated C header for: * API: gles2 @@ -64,8 +43,8 @@ extern "C" { typedef khronos_int8_t GLbyte; typedef khronos_float_t GLclampf; typedef khronos_int32_t GLfixed; -typedef short GLshort; -typedef unsigned short GLushort; +typedef khronos_int16_t GLshort; +typedef khronos_uint16_t GLushort; typedef void GLvoid; typedef struct __GLsync *GLsync; typedef khronos_int64_t GLint64; @@ -672,7 +651,7 @@ GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei #ifndef GL_ES_VERSION_3_0 #define GL_ES_VERSION_3_0 1 -typedef unsigned short GLhalf; +typedef khronos_uint16_t GLhalf; #define GL_READ_BUFFER 0x0C02 #define GL_UNPACK_ROW_LENGTH 0x0CF2 #define GL_UNPACK_SKIP_ROWS 0x0CF3 diff --git a/bgfx/3rdparty/khronos/GLES3/gl32.h b/bgfx/3rdparty/khronos/GLES3/gl32.h index a1af7c69..ae56b0e9 100644 --- a/bgfx/3rdparty/khronos/GLES3/gl32.h +++ b/bgfx/3rdparty/khronos/GLES3/gl32.h @@ -1,39 +1,18 @@ -#ifndef __gl32_h_ -#define __gl32_h_ 1 +#ifndef __gles2_gl32_h_ +#define __gles2_gl32_h_ 1 #ifdef __cplusplus extern "C" { #endif /* -** Copyright (c) 2013-2016 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT ** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** 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. -*/ -/* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision$ on $Date$ +** https://github.com/KhronosGroup/OpenGL-Registry */ #include @@ -46,7 +25,7 @@ extern "C" { #define GL_GLES_PROTOTYPES 1 #endif -/* Generated on date 20161024 */ +/* Generated on date 20191013 */ /* Generated C header for: * API: gles2 @@ -64,8 +43,8 @@ extern "C" { typedef khronos_int8_t GLbyte; typedef khronos_float_t GLclampf; typedef khronos_int32_t GLfixed; -typedef short GLshort; -typedef unsigned short GLushort; +typedef khronos_int16_t GLshort; +typedef khronos_uint16_t GLushort; typedef void GLvoid; typedef struct __GLsync *GLsync; typedef khronos_int64_t GLint64; @@ -672,7 +651,7 @@ GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei #ifndef GL_ES_VERSION_3_0 #define GL_ES_VERSION_3_0 1 -typedef unsigned short GLhalf; +typedef khronos_uint16_t GLhalf; #define GL_READ_BUFFER 0x0C02 #define GL_UNPACK_ROW_LENGTH 0x0CF2 #define GL_UNPACK_SKIP_ROWS 0x0CF3 diff --git a/bgfx/3rdparty/khronos/GLES3/gl3ext.h b/bgfx/3rdparty/khronos/GLES3/gl3ext.h deleted file mode 100644 index 4d4ea96c..00000000 --- a/bgfx/3rdparty/khronos/GLES3/gl3ext.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __gl3ext_h_ -#define __gl3ext_h_ - -/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */ - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/* OpenGL ES 3 Extensions - * - * After an OES extension's interactions with OpenGl ES 3.0 have been documented, - * its tokens and function definitions should be added to this file in a manner - * that does not conflict with gl2ext.h or gl3.h. - * - * Tokens and function definitions for extensions that have become standard - * features in OpenGL ES 3.0 will not be added to this file. - * - * Applications using OpenGL-ES-2-only extensions should include gl2ext.h - */ - -#endif /* __gl3ext_h_ */ - diff --git a/bgfx/3rdparty/khronos/GLES3/gl3platform.h b/bgfx/3rdparty/khronos/GLES3/gl3platform.h index ca9d7a6d..8699212d 100644 --- a/bgfx/3rdparty/khronos/GLES3/gl3platform.h +++ b/bgfx/3rdparty/khronos/GLES3/gl3platform.h @@ -2,19 +2,8 @@ #define __gl3platform_h_ /* -** Copyright (c) 2017 The Khronos Group Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. +** Copyright 2017-2020 The Khronos Group Inc. +** SPDX-License-Identifier: Apache-2.0 */ /* Platform-specific types and definitions for OpenGL ES 3.X gl3.h diff --git a/bgfx/3rdparty/khronos/KHR/khrplatform.h b/bgfx/3rdparty/khronos/KHR/khrplatform.h index 975bbffe..01646449 100644 --- a/bgfx/3rdparty/khronos/KHR/khrplatform.h +++ b/bgfx/3rdparty/khronos/KHR/khrplatform.h @@ -90,12 +90,20 @@ * int arg2) KHRONOS_APIATTRIBUTES; */ +#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC) +# define KHRONOS_STATIC 1 +#endif + /*------------------------------------------------------------------------- * Definition of KHRONOS_APICALL *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +#if defined(KHRONOS_STATIC) + /* If the preprocessor constant KHRONOS_STATIC is defined, make the + * header compatible with static linking. */ +# define KHRONOS_APICALL +#elif defined(_WIN32) # define KHRONOS_APICALL __declspec(dllimport) #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C @@ -145,6 +153,20 @@ typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 +/* + * To support platform where unsigned long cannot be used interchangeably with + * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t. + * Ideally, we could just use (u)intptr_t everywhere, but this could result in + * ABI breakage if khronos_uintptr_t is changed from unsigned long to + * unsigned long long or similar (this results in different C++ name mangling). + * To avoid changes for existing platforms, we restrict usage of intptr_t to + * platforms where the size of a pointer is larger than the size of long. + */ +#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__) +#if __SIZEOF_POINTER__ > __SIZEOF_LONG__ +#define KHRONOS_USE_INTPTR_T +#endif +#endif #elif defined(__VMS ) || defined(__sgi) @@ -227,14 +249,21 @@ typedef unsigned short int khronos_uint16_t; * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * to be the only LLP64 architecture in current use. */ -#ifdef _WIN64 +#ifdef KHRONOS_USE_INTPTR_T +typedef intptr_t khronos_intptr_t; +typedef uintptr_t khronos_uintptr_t; +#elif defined(_WIN64) typedef signed long long int khronos_intptr_t; typedef unsigned long long int khronos_uintptr_t; -typedef signed long long int khronos_ssize_t; -typedef unsigned long long int khronos_usize_t; #else typedef signed long int khronos_intptr_t; typedef unsigned long int khronos_uintptr_t; +#endif + +#if defined(_WIN64) +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else typedef signed long int khronos_ssize_t; typedef unsigned long int khronos_usize_t; #endif diff --git a/bgfx/3rdparty/khronos/gl/GRemedyGLExtensions.h b/bgfx/3rdparty/khronos/gl/GRemedyGLExtensions.h deleted file mode 100644 index 9777b0c8..00000000 --- a/bgfx/3rdparty/khronos/gl/GRemedyGLExtensions.h +++ /dev/null @@ -1,67 +0,0 @@ -// ------------------------------ GRemdeyGLExtensions.h ------------------------------ - -// ----------------------------------------------------------------- -// © 2004 - 2012 Advanced Micro Devices, Inc. All rights reserved. -// ----------------------------------------------------------------- - -#ifndef __GREMDEYGLEXTENSIONS -#define __GREMDEYGLEXTENSIONS - - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#define WIN32_LEAN_AND_MEAN 1 -#include -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif - -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif - -#ifndef GLAPI -#define GLAPI extern -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif - - /* ----------------------- GL_GREMEDY_string_marker ----------------------- */ - -#ifndef GL_GREMEDY_string_marker -#define GL_GREMEDY_string_marker 1 - -#ifdef GL_GLEXT_PROTOTYPES - GLAPI void APIENTRY glStringMarkerGREMEDY(GLsizei len, const GLvoid *string); -#endif /* GL_GLEXT_PROTOTYPES */ - - typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC)(GLsizei len, const GLvoid *string); - -#endif /* GL_GREMEDY_string_marker */ - - - - /* ----------------------- GL_GREMEDY_frame_terminator ----------------------- */ - -#ifndef GL_GREMEDY_frame_terminator -#define GL_GREMEDY_frame_terminator 1 - -#ifdef GL_GLEXT_PROTOTYPES - GLAPI void APIENTRY glFrameTerminatorGREMEDY(void); -#endif /* GL_GLEXT_PROTOTYPES */ - - typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC)(void); - -#endif /* GL_GREMEDY_frame_terminator */ - - -#ifdef __cplusplus -} -#endif - - -#endif /* __GREMDEYGLEXTENSIONS */ diff --git a/bgfx/3rdparty/khronos/gl/glcorearb.h b/bgfx/3rdparty/khronos/gl/glcorearb.h index a95bbb80..07517e7e 100644 --- a/bgfx/3rdparty/khronos/gl/glcorearb.h +++ b/bgfx/3rdparty/khronos/gl/glcorearb.h @@ -6,28 +6,9 @@ extern "C" { #endif /* -** Copyright (c) 2013-2018 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT ** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** 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. -*/ -/* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at @@ -1573,7 +1554,7 @@ typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); -typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); @@ -1593,7 +1574,7 @@ GLAPI void APIENTRY glDeleteSync (GLsync sync); GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); -GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); @@ -1789,8 +1770,8 @@ typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); @@ -1836,8 +1817,8 @@ GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *pa GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); @@ -1895,7 +1876,7 @@ GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pna #define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F #define GL_UNDEFINED_VERTEX 0x8260 typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); -typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); @@ -1984,7 +1965,7 @@ typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfl typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glReleaseShaderCompiler (void); -GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); GLAPI void APIENTRY glClearDepthf (GLfloat d); @@ -2191,7 +2172,7 @@ GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data) typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params); typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); @@ -2204,7 +2185,7 @@ typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum m GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params); GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); @@ -2484,7 +2465,7 @@ typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params); typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); @@ -2496,7 +2477,7 @@ typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params); typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); @@ -2528,7 +2509,7 @@ GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params); GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); @@ -2540,7 +2521,7 @@ GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params); GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); @@ -3838,6 +3819,12 @@ GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint #ifndef GL_ARB_viewport_array #define GL_ARB_viewport_array 1 +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYDVNVPROC) (GLuint first, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDDNVPROC) (GLuint index, GLdouble n, GLdouble f); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthRangeArraydvNV (GLuint first, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glDepthRangeIndexeddNV (GLuint index, GLdouble n, GLdouble f); +#endif #endif /* GL_ARB_viewport_array */ #ifndef GL_KHR_blend_equation_advanced @@ -3900,6 +3887,22 @@ GLAPI void APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count); #define GL_CONTEXT_ROBUST_ACCESS 0x90F3 #endif /* GL_KHR_robustness */ +#ifndef GL_KHR_shader_subgroup +#define GL_KHR_shader_subgroup 1 +#define GL_SUBGROUP_SIZE_KHR 0x9532 +#define GL_SUBGROUP_SUPPORTED_STAGES_KHR 0x9533 +#define GL_SUBGROUP_SUPPORTED_FEATURES_KHR 0x9534 +#define GL_SUBGROUP_QUAD_ALL_STAGES_KHR 0x9535 +#define GL_SUBGROUP_FEATURE_BASIC_BIT_KHR 0x00000001 +#define GL_SUBGROUP_FEATURE_VOTE_BIT_KHR 0x00000002 +#define GL_SUBGROUP_FEATURE_ARITHMETIC_BIT_KHR 0x00000004 +#define GL_SUBGROUP_FEATURE_BALLOT_BIT_KHR 0x00000008 +#define GL_SUBGROUP_FEATURE_SHUFFLE_BIT_KHR 0x00000010 +#define GL_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT_KHR 0x00000020 +#define GL_SUBGROUP_FEATURE_CLUSTERED_BIT_KHR 0x00000040 +#define GL_SUBGROUP_FEATURE_QUAD_BIT_KHR 0x00000080 +#endif /* GL_KHR_shader_subgroup */ + #ifndef GL_KHR_texture_compression_astc_hdr #define GL_KHR_texture_compression_astc_hdr 1 #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 @@ -4010,6 +4013,10 @@ GLAPI void APIENTRY glEGLImageTargetTextureStorageEXT (GLuint texture, GLeglImag #endif #endif /* GL_EXT_EGL_image_storage */ +#ifndef GL_EXT_EGL_sync +#define GL_EXT_EGL_sync 1 +#endif /* GL_EXT_EGL_sync */ + #ifndef GL_EXT_debug_label #define GL_EXT_debug_label 1 #define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F @@ -4567,6 +4574,18 @@ GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLen #endif #endif /* GL_EXT_draw_instanced */ +#ifndef GL_EXT_multiview_tessellation_geometry_shader +#define GL_EXT_multiview_tessellation_geometry_shader 1 +#endif /* GL_EXT_multiview_tessellation_geometry_shader */ + +#ifndef GL_EXT_multiview_texture_multisample +#define GL_EXT_multiview_texture_multisample 1 +#endif /* GL_EXT_multiview_texture_multisample */ + +#ifndef GL_EXT_multiview_timer_query +#define GL_EXT_multiview_timer_query 1 +#endif /* GL_EXT_multiview_timer_query */ + #ifndef GL_EXT_polygon_offset_clamp #define GL_EXT_polygon_offset_clamp 1 #define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B @@ -4643,6 +4662,11 @@ GLAPI void APIENTRY glFramebufferFetchBarrierEXT (void); #define GL_SR8_EXT 0x8FBD #endif /* GL_EXT_texture_sRGB_R8 */ +#ifndef GL_EXT_texture_sRGB_RG8 +#define GL_EXT_texture_sRGB_RG8 1 +#define GL_SRG8_EXT 0x8FBE +#endif /* GL_EXT_texture_sRGB_RG8 */ + #ifndef GL_EXT_texture_sRGB_decode #define GL_EXT_texture_sRGB_decode 1 #define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 @@ -4650,6 +4674,45 @@ GLAPI void APIENTRY glFramebufferFetchBarrierEXT (void); #define GL_SKIP_DECODE_EXT 0x8A4A #endif /* GL_EXT_texture_sRGB_decode */ +#ifndef GL_EXT_texture_shadow_lod +#define GL_EXT_texture_shadow_lod 1 +#endif /* GL_EXT_texture_shadow_lod */ + +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_EXT 0x8052 +#define GL_BGRA8_EXT 0x93A1 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#define GL_R32F_EXT 0x822E +#define GL_RG32F_EXT 0x8230 +#define GL_R16F_EXT 0x822D +#define GL_RG16F_EXT 0x822F +typedef void (APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* GL_EXT_texture_storage */ + #ifndef GL_EXT_window_rectangles #define GL_EXT_window_rectangles 1 #define GL_INCLUSIVE_EXT 0x8F10 @@ -4728,6 +4791,27 @@ GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLen #endif #endif /* GL_INTEL_performance_query */ +#ifndef GL_MESA_framebuffer_flip_x +#define GL_MESA_framebuffer_flip_x 1 +#define GL_FRAMEBUFFER_FLIP_X_MESA 0x8BBC +#endif /* GL_MESA_framebuffer_flip_x */ + +#ifndef GL_MESA_framebuffer_flip_y +#define GL_MESA_framebuffer_flip_y 1 +#define GL_FRAMEBUFFER_FLIP_Y_MESA 0x8BBB +typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIMESAPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVMESAPROC) (GLenum target, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferParameteriMESA (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glGetFramebufferParameterivMESA (GLenum target, GLenum pname, GLint *params); +#endif +#endif /* GL_MESA_framebuffer_flip_y */ + +#ifndef GL_MESA_framebuffer_swap_xy +#define GL_MESA_framebuffer_swap_xy 1 +#define GL_FRAMEBUFFER_SWAP_XY_MESA 0x8BBD +#endif /* GL_MESA_framebuffer_swap_xy */ + #ifndef GL_NV_bindless_multi_draw_indirect #define GL_NV_bindless_multi_draw_indirect 1 typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); @@ -4981,6 +5065,22 @@ GLAPI void APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param) #define GL_NV_conservative_raster_underestimation 1 #endif /* GL_NV_conservative_raster_underestimation */ +#ifndef GL_NV_depth_buffer_float +#define GL_NV_depth_buffer_float 1 +#define GL_DEPTH_COMPONENT32F_NV 0x8DAB +#define GL_DEPTH32F_STENCIL8_NV 0x8DAC +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD +#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF +typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); +typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY glClearDepthdNV (GLdouble depth); +GLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax); +#endif +#endif /* GL_NV_depth_buffer_float */ + #ifndef GL_NV_draw_vulkan_image #define GL_NV_draw_vulkan_image 1 typedef void (APIENTRY *GLVULKANPROCNV)(void); @@ -5032,11 +5132,11 @@ GLAPI void APIENTRY glFragmentCoverageColorNV (GLuint color); #define GL_COVERAGE_MODULATION_NV 0x9332 #define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); -typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v); +typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufSize, GLfloat *v); typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); -GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v); +GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufSize, GLfloat *v); GLAPI void APIENTRY glCoverageModulationNV (GLenum components); #endif #endif /* GL_NV_framebuffer_mixed_samples */ @@ -5164,9 +5264,9 @@ GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GL #define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 #define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 #define GL_CONFORMANT_NV 0x9374 -typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei count, GLint *params); #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei count, GLint *params); #endif #endif /* GL_NV_internalformat_sample_query */ @@ -5198,6 +5298,20 @@ GLAPI void APIENTRY glNamedBufferAttachMemoryNV (GLuint buffer, GLuint memory, G #endif #endif /* GL_NV_memory_attachment */ +#ifndef GL_NV_memory_object_sparse +#define GL_NV_memory_object_sparse 1 +typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTMEMNVPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTMEMNVPROC) (GLenum target, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTMEMNVPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTMEMNVPROC) (GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferPageCommitmentMemNV (GLenum target, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +GLAPI void APIENTRY glTexPageCommitmentMemNV (GLenum target, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentMemNV (GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +GLAPI void APIENTRY glTexturePageCommitmentMemNV (GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +#endif +#endif /* GL_NV_memory_object_sparse */ + #ifndef GL_NV_mesh_shader #define GL_NV_mesh_shader 1 #define GL_MESH_SHADER_NV 0x9559 @@ -5238,16 +5352,16 @@ GLAPI void APIENTRY glNamedBufferAttachMemoryNV (GLuint buffer, GLuint memory, G #define GL_MESH_OUTPUT_TYPE_NV 0x957B #define GL_UNIFORM_BLOCK_REFERENCED_BY_MESH_SHADER_NV 0x959C #define GL_UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV 0x959D -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV 0x959E -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV 0x959F #define GL_REFERENCED_BY_MESH_SHADER_NV 0x95A0 #define GL_REFERENCED_BY_TASK_SHADER_NV 0x95A1 +#define GL_MESH_SHADER_BIT_NV 0x00000040 +#define GL_TASK_SHADER_BIT_NV 0x00000080 #define GL_MESH_SUBROUTINE_NV 0x957C #define GL_TASK_SUBROUTINE_NV 0x957D #define GL_MESH_SUBROUTINE_UNIFORM_NV 0x957E #define GL_TASK_SUBROUTINE_UNIFORM_NV 0x957F -#define GL_MESH_SHADER_BIT_NV 0x00000040 -#define GL_TASK_SHADER_BIT_NV 0x00000080 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV 0x959E +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV 0x959F typedef void (APIENTRYP PFNGLDRAWMESHTASKSNVPROC) (GLuint first, GLuint count); typedef void (APIENTRYP PFNGLDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect); typedef void (APIENTRYP PFNGLMULTIDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect, GLsizei drawcount, GLsizei stride); @@ -5467,11 +5581,11 @@ typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenu typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount); typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLfloat *params); #ifdef GL_GLEXT_PROTOTYPES GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range); GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range); @@ -5525,11 +5639,11 @@ GLAPI void APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLAPI void APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); GLAPI void APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); GLAPI void APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount); GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); -GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLfloat *params); #endif #endif /* GL_NV_path_rendering */ @@ -5538,6 +5652,12 @@ GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInte #define GL_SHARED_EDGE_NV 0xC0 #endif /* GL_NV_path_rendering_shared_edge */ +#ifndef GL_NV_primitive_shading_rate +#define GL_NV_primitive_shading_rate 1 +#define GL_SHADING_RATE_IMAGE_PER_PRIMITIVE_NV 0x95B1 +#define GL_SHADING_RATE_IMAGE_PALETTE_COUNT_NV 0x95B2 +#endif /* GL_NV_primitive_shading_rate */ + #ifndef GL_NV_representative_fragment_test #define GL_NV_representative_fragment_test 1 #define GL_REPRESENTATIVE_FRAGMENT_TEST_NV 0x937F @@ -5641,6 +5761,11 @@ GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLs #define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010 #endif /* GL_NV_shader_buffer_store */ +#ifndef GL_NV_shader_subgroup_partitioned +#define GL_NV_shader_subgroup_partitioned 1 +#define GL_SUBGROUP_FEATURE_PARTITIONED_BIT_NV 0x00000100 +#endif /* GL_NV_shader_subgroup_partitioned */ + #ifndef GL_NV_shader_texture_footprint #define GL_NV_shader_texture_footprint 1 #endif /* GL_NV_shader_texture_footprint */ diff --git a/bgfx/3rdparty/khronos/gl/glext.h b/bgfx/3rdparty/khronos/gl/glext.h index 6be78f98..61ff1b07 100644 --- a/bgfx/3rdparty/khronos/gl/glext.h +++ b/bgfx/3rdparty/khronos/gl/glext.h @@ -6,28 +6,9 @@ extern "C" { #endif /* -** Copyright (c) 2013-2018 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT ** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** 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. -*/ -/* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at @@ -51,7 +32,7 @@ extern "C" { #define GLAPI extern #endif -#define GL_GLEXT_VERSION 20190228 +#define GL_GLEXT_VERSION 20220530 #include @@ -1461,7 +1442,7 @@ typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); -typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); @@ -1481,7 +1462,7 @@ GLAPI void APIENTRY glDeleteSync (GLsync sync); GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); -GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); @@ -1737,8 +1718,8 @@ typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); @@ -1784,8 +1765,8 @@ GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *pa GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); @@ -1843,7 +1824,7 @@ GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pna #define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F #define GL_UNDEFINED_VERTEX 0x8260 typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); -typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); @@ -1932,7 +1913,7 @@ typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfl typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glReleaseShaderCompiler (void); -GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); GLAPI void APIENTRY glClearDepthf (GLfloat d); @@ -2139,7 +2120,7 @@ GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data) typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params); typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); @@ -2152,7 +2133,7 @@ typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum m GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params); GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); @@ -2433,7 +2414,7 @@ typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params); typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); @@ -2445,7 +2426,7 @@ typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params); typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); @@ -2477,7 +2458,7 @@ GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params); GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); @@ -2489,7 +2470,7 @@ GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params); GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); @@ -2581,6 +2562,18 @@ GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLui #define GL_LOSE_CONTEXT_ON_RESET 0x8252 #define GL_NO_RESET_NOTIFICATION 0x8261 #define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_MINMAX 0x802E #define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB #define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth); @@ -3470,9 +3463,6 @@ typedef khronos_uint16_t GLhalfARB; #ifndef GL_ARB_imaging #define GL_ARB_imaging 1 -#define GL_CONVOLUTION_1D 0x8010 -#define GL_CONVOLUTION_2D 0x8011 -#define GL_SEPARABLE_2D 0x8012 #define GL_CONVOLUTION_BORDER_MODE 0x8013 #define GL_CONVOLUTION_FILTER_SCALE 0x8014 #define GL_CONVOLUTION_FILTER_BIAS 0x8015 @@ -3490,8 +3480,6 @@ typedef khronos_uint16_t GLhalfARB; #define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 #define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 #define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 -#define GL_HISTOGRAM 0x8024 -#define GL_PROXY_HISTOGRAM 0x8025 #define GL_HISTOGRAM_WIDTH 0x8026 #define GL_HISTOGRAM_FORMAT 0x8027 #define GL_HISTOGRAM_RED_SIZE 0x8028 @@ -3500,7 +3488,6 @@ typedef khronos_uint16_t GLhalfARB; #define GL_HISTOGRAM_ALPHA_SIZE 0x802B #define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C #define GL_HISTOGRAM_SINK 0x802D -#define GL_MINMAX 0x802E #define GL_MINMAX_FORMAT 0x802F #define GL_MINMAX_SINK 0x8030 #define GL_TABLE_TOO_LARGE 0x8031 @@ -3515,12 +3502,6 @@ typedef khronos_uint16_t GLhalfARB; #define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 #define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA #define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB -#define GL_COLOR_TABLE 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 -#define GL_PROXY_COLOR_TABLE 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 #define GL_COLOR_TABLE_SCALE 0x80D6 #define GL_COLOR_TABLE_BIAS 0x80D7 #define GL_COLOR_TABLE_FORMAT 0x80D8 @@ -4892,6 +4873,12 @@ GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcha #ifndef GL_ARB_viewport_array #define GL_ARB_viewport_array 1 +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYDVNVPROC) (GLuint first, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDDNVPROC) (GLuint index, GLdouble n, GLdouble f); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthRangeArraydvNV (GLuint first, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glDepthRangeIndexeddNV (GLuint index, GLdouble n, GLdouble f); +#endif #endif /* GL_ARB_viewport_array */ #ifndef GL_ARB_window_pos @@ -4992,6 +4979,22 @@ GLAPI void APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count); #define GL_CONTEXT_ROBUST_ACCESS 0x90F3 #endif /* GL_KHR_robustness */ +#ifndef GL_KHR_shader_subgroup +#define GL_KHR_shader_subgroup 1 +#define GL_SUBGROUP_SIZE_KHR 0x9532 +#define GL_SUBGROUP_SUPPORTED_STAGES_KHR 0x9533 +#define GL_SUBGROUP_SUPPORTED_FEATURES_KHR 0x9534 +#define GL_SUBGROUP_QUAD_ALL_STAGES_KHR 0x9535 +#define GL_SUBGROUP_FEATURE_BASIC_BIT_KHR 0x00000001 +#define GL_SUBGROUP_FEATURE_VOTE_BIT_KHR 0x00000002 +#define GL_SUBGROUP_FEATURE_ARITHMETIC_BIT_KHR 0x00000004 +#define GL_SUBGROUP_FEATURE_BALLOT_BIT_KHR 0x00000008 +#define GL_SUBGROUP_FEATURE_SHUFFLE_BIT_KHR 0x00000010 +#define GL_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT_KHR 0x00000020 +#define GL_SUBGROUP_FEATURE_CLUSTERED_BIT_KHR 0x00000040 +#define GL_SUBGROUP_FEATURE_QUAD_BIT_KHR 0x00000080 +#endif /* GL_KHR_shader_subgroup */ + #ifndef GL_KHR_texture_compression_astc_hdr #define GL_KHR_texture_compression_astc_hdr 1 #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 @@ -5394,12 +5397,12 @@ typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severi typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void *userParam); -typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufSize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, void *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufSize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); #endif #endif /* GL_AMD_debug_output */ @@ -6465,6 +6468,10 @@ GLAPI void APIENTRY glEGLImageTargetTextureStorageEXT (GLuint texture, GLeglImag #endif #endif /* GL_EXT_EGL_image_storage */ +#ifndef GL_EXT_EGL_sync +#define GL_EXT_EGL_sync 1 +#endif /* GL_EXT_EGL_sync */ + #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #define GL_ABGR_EXT 0x8000 @@ -7517,7 +7524,6 @@ GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, #ifndef GL_EXT_gpu_shader4 #define GL_EXT_gpu_shader4 1 -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD #define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 #define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 #define GL_SAMPLER_BUFFER_EXT 0x8DC2 @@ -7545,6 +7551,7 @@ GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, #define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 #define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904 #define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905 +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); @@ -7556,6 +7563,29 @@ typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params); GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); @@ -7568,6 +7598,29 @@ GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuin GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value); GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value); GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x); +GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x); +GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params); #endif #endif /* GL_EXT_gpu_shader4 */ @@ -7794,6 +7847,18 @@ GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern); #endif #endif /* GL_EXT_multisample */ +#ifndef GL_EXT_multiview_tessellation_geometry_shader +#define GL_EXT_multiview_tessellation_geometry_shader 1 +#endif /* GL_EXT_multiview_tessellation_geometry_shader */ + +#ifndef GL_EXT_multiview_texture_multisample +#define GL_EXT_multiview_texture_multisample 1 +#endif /* GL_EXT_multiview_texture_multisample */ + +#ifndef GL_EXT_multiview_timer_query +#define GL_EXT_multiview_timer_query 1 +#endif /* GL_EXT_multiview_timer_query */ + #ifndef GL_EXT_packed_depth_stencil #define GL_EXT_packed_depth_stencil 1 #define GL_DEPTH_STENCIL_EXT 0x84F9 @@ -8149,6 +8214,10 @@ GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); #define GL_EXT_shader_integer_mix 1 #endif /* GL_EXT_shader_integer_mix */ +#ifndef GL_EXT_shader_samples_identical +#define GL_EXT_shader_samples_identical 1 +#endif /* GL_EXT_shader_samples_identical */ + #ifndef GL_EXT_shadow_funcs #define GL_EXT_shadow_funcs 1 #endif /* GL_EXT_shadow_funcs */ @@ -8517,6 +8586,11 @@ GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); #define GL_SR8_EXT 0x8FBD #endif /* GL_EXT_texture_sRGB_R8 */ +#ifndef GL_EXT_texture_sRGB_RG8 +#define GL_EXT_texture_sRGB_RG8 1 +#define GL_SRG8_EXT 0x8FBE +#endif /* GL_EXT_texture_sRGB_RG8 */ + #ifndef GL_EXT_texture_sRGB_decode #define GL_EXT_texture_sRGB_decode 1 #define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 @@ -8524,6 +8598,10 @@ GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); #define GL_SKIP_DECODE_EXT 0x8A4A #endif /* GL_EXT_texture_sRGB_decode */ +#ifndef GL_EXT_texture_shadow_lod +#define GL_EXT_texture_shadow_lod 1 +#endif /* GL_EXT_texture_shadow_lod */ + #ifndef GL_EXT_texture_shared_exponent #define GL_EXT_texture_shared_exponent 1 #define GL_RGB9_E5_EXT 0x8C3D @@ -8551,6 +8629,36 @@ GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); #define GL_RGBA_SNORM 0x8F93 #endif /* GL_EXT_texture_snorm */ +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_BGRA8_EXT 0x93A1 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#define GL_R32F_EXT 0x822E +#define GL_RG32F_EXT 0x8230 +#define GL_R16F_EXT 0x822D +#define GL_RG16F_EXT 0x822F +typedef void (APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* GL_EXT_texture_storage */ + #ifndef GL_EXT_texture_swizzle #define GL_EXT_texture_swizzle 1 #define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 @@ -9243,6 +9351,27 @@ GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLen #define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E #endif /* GL_MESAX_texture_stack */ +#ifndef GL_MESA_framebuffer_flip_x +#define GL_MESA_framebuffer_flip_x 1 +#define GL_FRAMEBUFFER_FLIP_X_MESA 0x8BBC +#endif /* GL_MESA_framebuffer_flip_x */ + +#ifndef GL_MESA_framebuffer_flip_y +#define GL_MESA_framebuffer_flip_y 1 +#define GL_FRAMEBUFFER_FLIP_Y_MESA 0x8BBB +typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIMESAPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVMESAPROC) (GLenum target, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferParameteriMESA (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glGetFramebufferParameterivMESA (GLenum target, GLenum pname, GLint *params); +#endif +#endif /* GL_MESA_framebuffer_flip_y */ + +#ifndef GL_MESA_framebuffer_swap_xy +#define GL_MESA_framebuffer_swap_xy 1 +#define GL_FRAMEBUFFER_SWAP_XY_MESA 0x8BBD +#endif /* GL_MESA_framebuffer_swap_xy */ + #ifndef GL_MESA_pack_invert #define GL_MESA_pack_invert 1 #define GL_PACK_INVERT_MESA 0x8758 @@ -9356,6 +9485,25 @@ GLAPI void APIENTRY glEndConditionalRenderNVX (void); #define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B #endif /* GL_NVX_gpu_memory_info */ +#ifndef GL_NVX_gpu_multicast2 +#define GL_NVX_gpu_multicast2 1 +#define GL_UPLOAD_GPU_MASK_NVX 0x954A +typedef void (APIENTRYP PFNGLUPLOADGPUMASKNVXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTPOSITIONWSCALENVXPROC) (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff); +typedef void (APIENTRYP PFNGLMULTICASTSCISSORARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLint *v); +typedef GLuint (APIENTRYP PFNGLASYNCCOPYBUFFERSUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); +typedef GLuint (APIENTRYP PFNGLASYNCCOPYIMAGESUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUploadGpuMaskNVX (GLbitfield mask); +GLAPI void APIENTRY glMulticastViewportArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glMulticastViewportPositionWScaleNVX (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff); +GLAPI void APIENTRY glMulticastScissorArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLint *v); +GLAPI GLuint APIENTRY glAsyncCopyBufferSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); +GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); +#endif +#endif /* GL_NVX_gpu_multicast2 */ + #ifndef GL_NVX_linked_gpu_multicast #define GL_NVX_linked_gpu_multicast 1 #define GL_LGPU_SEPARATE_STORAGE_BIT_NVX 0x0800 @@ -9370,6 +9518,20 @@ GLAPI void APIENTRY glLGPUInterlockNVX (void); #endif #endif /* GL_NVX_linked_gpu_multicast */ +#ifndef GL_NVX_progress_fence +#define GL_NVX_progress_fence 1 +typedef GLuint (APIENTRYP PFNGLCREATEPROGRESSFENCENVXPROC) (void); +typedef void (APIENTRYP PFNGLSIGNALSEMAPHOREUI64NVXPROC) (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +typedef void (APIENTRYP PFNGLWAITSEMAPHOREUI64NVXPROC) (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +typedef void (APIENTRYP PFNGLCLIENTWAITSEMAPHOREUI64NVXPROC) (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glCreateProgressFenceNVX (void); +GLAPI void APIENTRY glSignalSemaphoreui64NVX (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +GLAPI void APIENTRY glWaitSemaphoreui64NVX (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +GLAPI void APIENTRY glClientWaitSemaphoreui64NVX (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +#endif +#endif /* GL_NVX_progress_fence */ + #ifndef GL_NV_alpha_to_coverage_dither_control #define GL_NV_alpha_to_coverage_dither_control 1 #define GL_ALPHA_TO_COVERAGE_DITHER_DEFAULT_NV 0x934D @@ -9903,11 +10065,11 @@ GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, cons #define GL_COVERAGE_MODULATION_NV 0x9332 #define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); -typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v); +typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufSize, GLfloat *v); typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); -GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v); +GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufSize, GLfloat *v); GLAPI void APIENTRY glCoverageModulationNV (GLenum components); #endif #endif /* GL_NV_framebuffer_mixed_samples */ @@ -10160,9 +10322,9 @@ GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfN #define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 #define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 #define GL_CONFORMANT_NV 0x9374 -typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei count, GLint *params); #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei count, GLint *params); #endif #endif /* GL_NV_internalformat_sample_query */ @@ -10200,6 +10362,20 @@ GLAPI void APIENTRY glNamedBufferAttachMemoryNV (GLuint buffer, GLuint memory, G #endif #endif /* GL_NV_memory_attachment */ +#ifndef GL_NV_memory_object_sparse +#define GL_NV_memory_object_sparse 1 +typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTMEMNVPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTMEMNVPROC) (GLenum target, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTMEMNVPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTMEMNVPROC) (GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferPageCommitmentMemNV (GLenum target, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +GLAPI void APIENTRY glTexPageCommitmentMemNV (GLenum target, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentMemNV (GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +GLAPI void APIENTRY glTexturePageCommitmentMemNV (GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +#endif +#endif /* GL_NV_memory_object_sparse */ + #ifndef GL_NV_mesh_shader #define GL_NV_mesh_shader 1 #define GL_MESH_SHADER_NV 0x9559 @@ -10240,16 +10416,16 @@ GLAPI void APIENTRY glNamedBufferAttachMemoryNV (GLuint buffer, GLuint memory, G #define GL_MESH_OUTPUT_TYPE_NV 0x957B #define GL_UNIFORM_BLOCK_REFERENCED_BY_MESH_SHADER_NV 0x959C #define GL_UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV 0x959D -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV 0x959E -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV 0x959F #define GL_REFERENCED_BY_MESH_SHADER_NV 0x95A0 #define GL_REFERENCED_BY_TASK_SHADER_NV 0x95A1 +#define GL_MESH_SHADER_BIT_NV 0x00000040 +#define GL_TASK_SHADER_BIT_NV 0x00000080 #define GL_MESH_SUBROUTINE_NV 0x957C #define GL_TASK_SUBROUTINE_NV 0x957D #define GL_MESH_SUBROUTINE_UNIFORM_NV 0x957E #define GL_TASK_SUBROUTINE_UNIFORM_NV 0x957F -#define GL_MESH_SHADER_BIT_NV 0x00000040 -#define GL_TASK_SHADER_BIT_NV 0x00000080 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV 0x959E +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV 0x959F typedef void (APIENTRYP PFNGLDRAWMESHTASKSNVPROC) (GLuint first, GLuint count); typedef void (APIENTRYP PFNGLDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect); typedef void (APIENTRYP PFNGLMULTIDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect, GLsizei drawcount, GLsizei stride); @@ -10539,11 +10715,11 @@ typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenu typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount); typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLfloat *params); typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); @@ -10604,11 +10780,11 @@ GLAPI void APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLAPI void APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); GLAPI void APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); GLAPI void APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); -GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount); GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); -GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLfloat *params); GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); @@ -10689,6 +10865,12 @@ GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index); #endif #endif /* GL_NV_primitive_restart */ +#ifndef GL_NV_primitive_shading_rate +#define GL_NV_primitive_shading_rate 1 +#define GL_SHADING_RATE_IMAGE_PER_PRIMITIVE_NV 0x95B1 +#define GL_SHADING_RATE_IMAGE_PALETTE_COUNT_NV 0x95B2 +#endif /* GL_NV_primitive_shading_rate */ + #ifndef GL_NV_query_resource #define GL_NV_query_resource 1 #define GL_QUERY_RESOURCE_TYPE_VIDMEM_ALLOC_NV 0x9540 @@ -10697,9 +10879,9 @@ GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index); #define GL_QUERY_RESOURCE_TEXTURE_NV 0x9545 #define GL_QUERY_RESOURCE_RENDERBUFFER_NV 0x9546 #define GL_QUERY_RESOURCE_BUFFEROBJECT_NV 0x9547 -typedef GLint (APIENTRYP PFNGLQUERYRESOURCENVPROC) (GLenum queryType, GLint tagId, GLuint bufSize, GLint *buffer); +typedef GLint (APIENTRYP PFNGLQUERYRESOURCENVPROC) (GLenum queryType, GLint tagId, GLuint count, GLint *buffer); #ifdef GL_GLEXT_PROTOTYPES -GLAPI GLint APIENTRY glQueryResourceNV (GLenum queryType, GLint tagId, GLuint bufSize, GLint *buffer); +GLAPI GLint APIENTRY glQueryResourceNV (GLenum queryType, GLint tagId, GLuint count, GLint *buffer); #endif #endif /* GL_NV_query_resource */ @@ -10917,6 +11099,11 @@ GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLs #define GL_NV_shader_storage_buffer_object 1 #endif /* GL_NV_shader_storage_buffer_object */ +#ifndef GL_NV_shader_subgroup_partitioned +#define GL_NV_shader_subgroup_partitioned 1 +#define GL_SUBGROUP_FEATURE_PARTITIONED_BIT_NV 0x00000100 +#endif /* GL_NV_shader_subgroup_partitioned */ + #ifndef GL_NV_shader_texture_footprint #define GL_NV_shader_texture_footprint 1 #endif /* GL_NV_shader_texture_footprint */ @@ -11160,6 +11347,23 @@ GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenu #define GL_FORCE_BLUE_TO_ONE_NV 0x8860 #endif /* GL_NV_texture_shader3 */ +#ifndef GL_NV_timeline_semaphore +#define GL_NV_timeline_semaphore 1 +#define GL_TIMELINE_SEMAPHORE_VALUE_NV 0x9595 +#define GL_SEMAPHORE_TYPE_NV 0x95B3 +#define GL_SEMAPHORE_TYPE_BINARY_NV 0x95B4 +#define GL_SEMAPHORE_TYPE_TIMELINE_NV 0x95B5 +#define GL_MAX_TIMELINE_SEMAPHORE_VALUE_DIFFERENCE_NV 0x95B6 +typedef void (APIENTRYP PFNGLCREATESEMAPHORESNVPROC) (GLsizei n, GLuint *semaphores); +typedef void (APIENTRYP PFNGLSEMAPHOREPARAMETERIVNVPROC) (GLuint semaphore, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETSEMAPHOREPARAMETERIVNVPROC) (GLuint semaphore, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCreateSemaphoresNV (GLsizei n, GLuint *semaphores); +GLAPI void APIENTRY glSemaphoreParameterivNV (GLuint semaphore, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetSemaphoreParameterivNV (GLuint semaphore, GLenum pname, GLint *params); +#endif +#endif /* GL_NV_timeline_semaphore */ + #ifndef GL_NV_transform_feedback #define GL_NV_transform_feedback 1 #define GL_BACK_PRIMARY_COLOR_NV 0x8C77 @@ -11265,7 +11469,7 @@ typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); typedef GLboolean (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); -typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei count, GLsizei *length, GLint *values); typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); @@ -11276,7 +11480,7 @@ GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const void *vdpSu GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); GLAPI GLboolean APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); -GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei count, GLsizei *length, GLint *values); GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access); GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); @@ -11646,54 +11850,6 @@ GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GL #ifndef GL_NV_vertex_program4 #define GL_NV_vertex_program4 1 #define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x); -GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y); -GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z); -GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x); -GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y); -GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z); -GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params); -#endif #endif /* GL_NV_vertex_program4 */ #ifndef GL_NV_video_capture diff --git a/bgfx/3rdparty/khronos/glx/glxext.h b/bgfx/3rdparty/khronos/glx/glxext.h index c81ab4d5..b918317f 100644 --- a/bgfx/3rdparty/khronos/glx/glxext.h +++ b/bgfx/3rdparty/khronos/glx/glxext.h @@ -1,42 +1,21 @@ -#ifndef __glxext_h_ -#define __glxext_h_ 1 +#ifndef __glx_glxext_h_ +#define __glx_glxext_h_ 1 #ifdef __cplusplus extern "C" { #endif /* -** Copyright (c) 2013 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT ** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** 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. -*/ -/* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 23730 $ on $Date: 2013-10-28 15:16:34 -0700 (Mon, 28 Oct 2013) $ +** https://github.com/KhronosGroup/OpenGL-Registry */ -#define GLX_GLXEXT_VERSION 20131028 +#define GLX_GLXEXT_VERSION 20220530 /* Generated C header for: * API: glx @@ -49,6 +28,7 @@ extern "C" { #ifndef GLX_VERSION_1_3 #define GLX_VERSION_1_3 1 +typedef XID GLXContextID; typedef struct __GLXFBConfigRec *GLXFBConfig; typedef XID GLXWindow; typedef XID GLXPbuffer; @@ -157,6 +137,13 @@ __GLXextFuncPtr glXGetProcAddress (const GLubyte *procName); #endif #endif /* GLX_VERSION_1_4 */ +#ifndef GLX_ARB_context_flush_control +#define GLX_ARB_context_flush_control 1 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#endif /* GLX_ARB_context_flush_control */ + #ifndef GLX_ARB_create_context #define GLX_ARB_create_context 1 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 @@ -170,6 +157,11 @@ GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXCont #endif #endif /* GLX_ARB_create_context */ +#ifndef GLX_ARB_create_context_no_error +#define GLX_ARB_create_context_no_error 1 +#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 +#endif /* GLX_ARB_create_context_no_error */ + #ifndef GLX_ARB_create_context_profile #define GLX_ARB_create_context_profile 1 #define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 @@ -242,6 +234,26 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName); #define GLX_GPU_NUM_SIMD_AMD 0x21A6 #define GLX_GPU_NUM_RB_AMD 0x21A7 #define GLX_GPU_NUM_SPI_AMD 0x21A8 +typedef unsigned int ( *PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int *ids); +typedef int ( *PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void *data); +typedef unsigned int ( *PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx); +typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list); +typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int *attribList); +typedef Bool ( *PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx); +typedef Bool ( *PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx); +typedef GLXContext ( *PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); +typedef void ( *PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GLX_GLXEXT_PROTOTYPES +unsigned int glXGetGPUIDsAMD (unsigned int maxCount, unsigned int *ids); +int glXGetGPUInfoAMD (unsigned int id, int property, GLenum dataType, unsigned int size, void *data); +unsigned int glXGetContextGPUIDAMD (GLXContext ctx); +GLXContext glXCreateAssociatedContextAMD (unsigned int id, GLXContext share_list); +GLXContext glXCreateAssociatedContextAttribsAMD (unsigned int id, GLXContext share_context, const int *attribList); +Bool glXDeleteAssociatedContextAMD (GLXContext ctx); +Bool glXMakeAssociatedContextCurrentAMD (GLXContext ctx); +GLXContext glXGetCurrentAssociatedContextAMD (void); +void glXBlitContextFramebufferAMD (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif #endif /* GLX_AMD_gpu_association */ #ifndef GLX_EXT_buffer_age @@ -249,6 +261,14 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName); #define GLX_BACK_BUFFER_AGE_EXT 0x20F4 #endif /* GLX_EXT_buffer_age */ +#ifndef GLX_EXT_context_priority +#define GLX_EXT_context_priority 1 +#define GLX_CONTEXT_PRIORITY_LEVEL_EXT 0x3100 +#define GLX_CONTEXT_PRIORITY_HIGH_EXT 0x3101 +#define GLX_CONTEXT_PRIORITY_MEDIUM_EXT 0x3102 +#define GLX_CONTEXT_PRIORITY_LOW_EXT 0x3103 +#endif /* GLX_EXT_context_priority */ + #ifndef GLX_EXT_create_context_es2_profile #define GLX_EXT_create_context_es2_profile 1 #define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 @@ -270,9 +290,12 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName); #define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 #endif /* GLX_EXT_framebuffer_sRGB */ +#ifndef GLX_EXT_get_drawable_type +#define GLX_EXT_get_drawable_type 1 +#endif /* GLX_EXT_get_drawable_type */ + #ifndef GLX_EXT_import_context #define GLX_EXT_import_context 1 -typedef XID GLXContextID; #define GLX_SHARE_CONTEXT_EXT 0x800A #define GLX_VISUAL_ID_EXT 0x800B #define GLX_SCREEN_EXT 0x800C @@ -290,6 +313,32 @@ void glXFreeContextEXT (Display *dpy, GLXContext context); #endif #endif /* GLX_EXT_import_context */ +#ifndef GLX_EXT_libglvnd +#define GLX_EXT_libglvnd 1 +#define GLX_VENDOR_NAMES_EXT 0x20F6 +#endif /* GLX_EXT_libglvnd */ + +#ifndef GLX_EXT_no_config_context +#define GLX_EXT_no_config_context 1 +#endif /* GLX_EXT_no_config_context */ + +#ifndef GLX_EXT_stereo_tree +#define GLX_EXT_stereo_tree 1 +typedef struct { + int type; + unsigned long serial; + Bool send_event; + Display *display; + int extension; + int evtype; + GLXDrawable window; + Bool stereo_tree; +} GLXStereoNotifyEventEXT; +#define GLX_STEREO_TREE_EXT 0x20F5 +#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001 +#define GLX_STEREO_NOTIFY_EXT 0x00000000 +#endif /* GLX_EXT_stereo_tree */ + #ifndef GLX_EXT_swap_control #define GLX_EXT_swap_control 1 #define GLX_SWAP_INTERVAL_EXT 0x20F1 @@ -407,6 +456,31 @@ GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixm #endif #endif /* GLX_MESA_pixmap_colormap */ +#ifndef GLX_MESA_query_renderer +#define GLX_MESA_query_renderer 1 +#define GLX_RENDERER_VENDOR_ID_MESA 0x8183 +#define GLX_RENDERER_DEVICE_ID_MESA 0x8184 +#define GLX_RENDERER_VERSION_MESA 0x8185 +#define GLX_RENDERER_ACCELERATED_MESA 0x8186 +#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187 +#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188 +#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189 +#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A +#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B +#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C +#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D +typedef Bool ( *PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int *value); +typedef const char *( *PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute); +typedef Bool ( *PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display *dpy, int screen, int renderer, int attribute, unsigned int *value); +typedef const char *( *PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute); +#ifdef GLX_GLXEXT_PROTOTYPES +Bool glXQueryCurrentRendererIntegerMESA (int attribute, unsigned int *value); +const char *glXQueryCurrentRendererStringMESA (int attribute); +Bool glXQueryRendererIntegerMESA (Display *dpy, int screen, int renderer, int attribute, unsigned int *value); +const char *glXQueryRendererStringMESA (Display *dpy, int screen, int renderer, int attribute); +#endif +#endif /* GLX_MESA_query_renderer */ + #ifndef GLX_MESA_release_buffers #define GLX_MESA_release_buffers 1 typedef Bool ( *PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); @@ -419,12 +493,32 @@ Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable); #define GLX_MESA_set_3dfx_mode 1 #define GLX_3DFX_WINDOW_MODE_MESA 0x1 #define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 -typedef Bool ( *PFNGLXSET3DFXMODEMESAPROC) (int mode); +typedef GLboolean ( *PFNGLXSET3DFXMODEMESAPROC) (GLint mode); #ifdef GLX_GLXEXT_PROTOTYPES -Bool glXSet3DfxModeMESA (int mode); +GLboolean glXSet3DfxModeMESA (GLint mode); #endif #endif /* GLX_MESA_set_3dfx_mode */ +#ifndef GLX_MESA_swap_control +#define GLX_MESA_swap_control 1 +typedef int ( *PFNGLXGETSWAPINTERVALMESAPROC) (void); +typedef int ( *PFNGLXSWAPINTERVALMESAPROC) (unsigned int interval); +#ifdef GLX_GLXEXT_PROTOTYPES +int glXGetSwapIntervalMESA (void); +int glXSwapIntervalMESA (unsigned int interval); +#endif +#endif /* GLX_MESA_swap_control */ + +#ifndef GLX_NV_copy_buffer +#define GLX_NV_copy_buffer 1 +typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#ifdef GLX_GLXEXT_PROTOTYPES +void glXCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +void glXNamedCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif +#endif /* GLX_NV_copy_buffer */ + #ifndef GLX_NV_copy_image #define GLX_NV_copy_image 1 typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); @@ -433,11 +527,28 @@ void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLe #endif #endif /* GLX_NV_copy_image */ +#ifndef GLX_NV_delay_before_swap +#define GLX_NV_delay_before_swap 1 +typedef Bool ( *PFNGLXDELAYBEFORESWAPNVPROC) (Display *dpy, GLXDrawable drawable, GLfloat seconds); +#ifdef GLX_GLXEXT_PROTOTYPES +Bool glXDelayBeforeSwapNV (Display *dpy, GLXDrawable drawable, GLfloat seconds); +#endif +#endif /* GLX_NV_delay_before_swap */ + #ifndef GLX_NV_float_buffer #define GLX_NV_float_buffer 1 #define GLX_FLOAT_COMPONENTS_NV 0x20B0 #endif /* GLX_NV_float_buffer */ +#ifndef GLX_NV_multigpu_context +#define GLX_NV_multigpu_context 1 +#define GLX_CONTEXT_MULTIGPU_ATTRIB_NV 0x20AA +#define GLX_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV 0x20AB +#define GLX_CONTEXT_MULTIGPU_ATTRIB_AFR_NV 0x20AC +#define GLX_CONTEXT_MULTIGPU_ATTRIB_MULTICAST_NV 0x20AD +#define GLX_CONTEXT_MULTIGPU_ATTRIB_MULTI_DISPLAY_MULTICAST_NV 0x20AE +#endif /* GLX_NV_multigpu_context */ + #ifndef GLX_NV_multisample_coverage #define GLX_NV_multisample_coverage 1 #define GLX_COVERAGE_SAMPLES_NV 100001 @@ -455,6 +566,11 @@ int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int vi #endif #endif /* GLX_NV_present_video */ +#ifndef GLX_NV_robustness_video_memory_purge +#define GLX_NV_robustness_video_memory_purge 1 +#define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7 +#endif /* GLX_NV_robustness_video_memory_purge */ + #ifndef GLX_NV_swap_group #define GLX_NV_swap_group 1 typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group); @@ -493,8 +609,8 @@ void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV devic #endif #endif /* GLX_NV_video_capture */ -#ifndef GLX_NV_video_output -#define GLX_NV_video_output 1 +#ifndef GLX_NV_video_out +#define GLX_NV_video_out 1 typedef unsigned int GLXVideoDeviceNV; #define GLX_VIDEO_OUT_COLOR_NV 0x20C3 #define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 @@ -520,7 +636,7 @@ int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf); int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); #endif -#endif /* GLX_NV_video_output */ +#endif /* GLX_NV_video_out */ #ifndef GLX_OML_swap_method #define GLX_OML_swap_method 1 @@ -721,13 +837,13 @@ int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int si #define GLX_PBUFFER_SGIX 0x8023 typedef GLXPbufferSGIX ( *PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); typedef void ( *PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); -typedef int ( *PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +typedef void ( *PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); typedef void ( *PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); typedef void ( *PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); #ifdef GLX_GLXEXT_PROTOTYPES GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf); -int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +void glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask); void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask); #endif @@ -825,9 +941,9 @@ int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count); #ifndef GLX_SUN_get_transparent_index #define GLX_SUN_get_transparent_index 1 -typedef Status ( *PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +typedef Status ( *PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex); #ifdef GLX_GLXEXT_PROTOTYPES -Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex); #endif #endif /* GLX_SUN_get_transparent_index */ diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_icd.h b/bgfx/3rdparty/khronos/vulkan-local/vk_icd.h index 41989ee3..59204a34 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vk_icd.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_icd.h @@ -1,27 +1,11 @@ -// -// File: vk_icd.h -// /* - * Copyright (c) 2015-2016 The Khronos Group Inc. - * Copyright (c) 2015-2016 Valve Corporation - * Copyright (c) 2015-2016 LunarG, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2015-2023 The Khronos Group Inc. + * Copyright 2015-2023 Valve Corporation + * Copyright 2015-2023 LunarG, Inc. * + * SPDX-License-Identifier: Apache-2.0 */ - -#ifndef VKICD_H -#define VKICD_H +#pragma once #include "vulkan.h" #include @@ -42,7 +26,17 @@ // call for any API version > 1.0. Otherwise, the loader will // manually determine if it can support the expected version. // Version 6 - Add support for vk_icdEnumerateAdapterPhysicalDevices. -#define CURRENT_LOADER_ICD_INTERFACE_VERSION 6 +// Version 7 - If an ICD supports any of the following functions, they must be +// queryable with vk_icdGetInstanceProcAddr: +// vk_icdNegotiateLoaderICDInterfaceVersion +// vk_icdGetPhysicalDeviceProcAddr +// vk_icdEnumerateAdapterPhysicalDevices (Windows only) +// In addition, these functions no longer need to be exported directly. +// This version allows drivers provided through the extension +// VK_LUNARG_direct_driver_loading be able to support the entire +// Driver-Loader interface. + +#define CURRENT_LOADER_ICD_INTERFACE_VERSION 7 #define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0 #define MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION 4 @@ -70,7 +64,7 @@ extern "C" { #endif VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pVersion); VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName); - VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance isntance, const char* pName); + VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance instance, const char* pName); #if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL vk_icdEnumerateAdapterPhysicalDevices(VkInstance instance, LUID adapterLUID, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); @@ -123,6 +117,7 @@ typedef enum { VK_ICD_WSI_PLATFORM_VI, VK_ICD_WSI_PLATFORM_GGP, VK_ICD_WSI_PLATFORM_SCREEN, + VK_ICD_WSI_PLATFORM_FUCHSIA, } VkIcdWsiPlatform; typedef struct { @@ -242,4 +237,8 @@ typedef struct { } VkIcdSurfaceScreen; #endif // VK_USE_PLATFORM_SCREEN_QNX -#endif // VKICD_H +#ifdef VK_USE_PLATFORM_FUCHSIA +typedef struct { + VkIcdSurfaceBase base; +} VkIcdSurfaceImagePipe; +#endif // VK_USE_PLATFORM_FUCHSIA diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_layer.h b/bgfx/3rdparty/khronos/vulkan-local/vk_layer.h index 0651870c..19d88fce 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vk_layer.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_layer.h @@ -1,39 +1,18 @@ -// -// File: vk_layer.h -// /* - * Copyright (c) 2015-2017 The Khronos Group Inc. - * Copyright (c) 2015-2017 Valve Corporation - * Copyright (c) 2015-2017 LunarG, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2015-2023 The Khronos Group Inc. + * Copyright 2015-2023 Valve Corporation + * Copyright 2015-2023 LunarG, Inc. * + * SPDX-License-Identifier: Apache-2.0 */ +#pragma once /* Need to define dispatch table * Core struct can then have ptr to dispatch table at the top * Along with object ptrs for current and next OBJ */ -#pragma once -#include "vulkan.h" -#if defined(__GNUC__) && __GNUC__ >= 4 -#define VK_LAYER_EXPORT __attribute__((visibility("default"))) -#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) -#define VK_LAYER_EXPORT __attribute__((visibility("default"))) -#else -#define VK_LAYER_EXPORT -#endif +#include "vulkan_core.h" #define MAX_NUM_UNKNOWN_EXTS 250 diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_platform.h b/bgfx/3rdparty/khronos/vulkan-local/vk_platform.h index 3ff8c5d1..ed67a600 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vk_platform.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_platform.h @@ -2,7 +2,7 @@ // File: vk_platform.h // /* -** Copyright 2014-2022 The Khronos Group Inc. +** Copyright 2014-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_sdk_platform.h b/bgfx/3rdparty/khronos/vulkan-local/vk_sdk_platform.h index 96d86769..3bdf5057 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vk_sdk_platform.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_sdk_platform.h @@ -2,9 +2,9 @@ // File: vk_sdk_platform.h // /* - * Copyright (c) 2015-2016 The Khronos Group Inc. - * Copyright (c) 2015-2016 Valve Corporation - * Copyright (c) 2015-2016 LunarG, Inc. + * Copyright (c) 2015-2023 LunarG, Inc. + * Copyright (c) 2015-2023 The Khronos Group Inc. + * Copyright (c) 2015-2023 Valve Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#pragma once -#ifndef VK_SDK_PLATFORM_H -#define VK_SDK_PLATFORM_H +// Allow users to suppress warnings generated by this header file by defining VK_SDK_PLATFORM_SUPRRESS_DEPRECATION_WARNING +#ifndef VK_SDK_PLATFORM_SUPRRESS_DEPRECATION_WARNING + +#if defined(__GNUC__) && __GNUC__ >= 4 +#warning "vk_sdk_platform.h is deprecated and will be removed in future release! Use VK_SDK_PLATFORM_SUPRRESS_DEPRECATION_WARNING to suppress warning!" +#endif + +// MSVC doesn't support warning directive +#if defined(_MSC_VER) +#pragma message("vk_sdk_platform.h is deprecated and will be removed in future release! Use VK_SDK_PLATFORM_SUPRRESS_DEPRECATION_WARNING to suppress warning!") +#endif + +#endif #if defined(_WIN32) +#ifndef NOMINMAX #define NOMINMAX +#endif #ifndef __cplusplus #undef inline #define inline __inline @@ -65,5 +79,3 @@ #define NOEXCEPT #endif #endif - -#endif // VK_SDK_PLATFORM_H diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std.h b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std.h new file mode 100644 index 00000000..d3ebec6a --- /dev/null +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std.h @@ -0,0 +1,310 @@ +#ifndef VULKAN_VIDEO_CODEC_H264STD_H_ +#define VULKAN_VIDEO_CODEC_H264STD_H_ 1 + +/* +** Copyright 2015-2022 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define vulkan_video_codec_h264std 1 +#include +#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32 +#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6 +#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16 +#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS 6 +#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS 64 +#define STD_VIDEO_H264_MAX_NUM_LIST_REF 32 +#define STD_VIDEO_H264_MAX_CHROMA_PLANES 2 + +typedef enum StdVideoH264ChromaFormatIdc { + STD_VIDEO_H264_CHROMA_FORMAT_IDC_MONOCHROME = 0, + STD_VIDEO_H264_CHROMA_FORMAT_IDC_420 = 1, + STD_VIDEO_H264_CHROMA_FORMAT_IDC_422 = 2, + STD_VIDEO_H264_CHROMA_FORMAT_IDC_444 = 3, + STD_VIDEO_H264_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_CHROMA_FORMAT_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264ChromaFormatIdc; + +typedef enum StdVideoH264ProfileIdc { + STD_VIDEO_H264_PROFILE_IDC_BASELINE = 66, + STD_VIDEO_H264_PROFILE_IDC_MAIN = 77, + STD_VIDEO_H264_PROFILE_IDC_HIGH = 100, + STD_VIDEO_H264_PROFILE_IDC_HIGH_444_PREDICTIVE = 244, + STD_VIDEO_H264_PROFILE_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264ProfileIdc; + +typedef enum StdVideoH264LevelIdc { + STD_VIDEO_H264_LEVEL_IDC_1_0 = 0, + STD_VIDEO_H264_LEVEL_IDC_1_1 = 1, + STD_VIDEO_H264_LEVEL_IDC_1_2 = 2, + STD_VIDEO_H264_LEVEL_IDC_1_3 = 3, + STD_VIDEO_H264_LEVEL_IDC_2_0 = 4, + STD_VIDEO_H264_LEVEL_IDC_2_1 = 5, + STD_VIDEO_H264_LEVEL_IDC_2_2 = 6, + STD_VIDEO_H264_LEVEL_IDC_3_0 = 7, + STD_VIDEO_H264_LEVEL_IDC_3_1 = 8, + STD_VIDEO_H264_LEVEL_IDC_3_2 = 9, + STD_VIDEO_H264_LEVEL_IDC_4_0 = 10, + STD_VIDEO_H264_LEVEL_IDC_4_1 = 11, + STD_VIDEO_H264_LEVEL_IDC_4_2 = 12, + STD_VIDEO_H264_LEVEL_IDC_5_0 = 13, + STD_VIDEO_H264_LEVEL_IDC_5_1 = 14, + STD_VIDEO_H264_LEVEL_IDC_5_2 = 15, + STD_VIDEO_H264_LEVEL_IDC_6_0 = 16, + STD_VIDEO_H264_LEVEL_IDC_6_1 = 17, + STD_VIDEO_H264_LEVEL_IDC_6_2 = 18, + STD_VIDEO_H264_LEVEL_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_LEVEL_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264LevelIdc; + +typedef enum StdVideoH264PocType { + STD_VIDEO_H264_POC_TYPE_0 = 0, + STD_VIDEO_H264_POC_TYPE_1 = 1, + STD_VIDEO_H264_POC_TYPE_2 = 2, + STD_VIDEO_H264_POC_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_POC_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264PocType; + +typedef enum StdVideoH264AspectRatioIdc { + STD_VIDEO_H264_ASPECT_RATIO_IDC_UNSPECIFIED = 0, + STD_VIDEO_H264_ASPECT_RATIO_IDC_SQUARE = 1, + STD_VIDEO_H264_ASPECT_RATIO_IDC_12_11 = 2, + STD_VIDEO_H264_ASPECT_RATIO_IDC_10_11 = 3, + STD_VIDEO_H264_ASPECT_RATIO_IDC_16_11 = 4, + STD_VIDEO_H264_ASPECT_RATIO_IDC_40_33 = 5, + STD_VIDEO_H264_ASPECT_RATIO_IDC_24_11 = 6, + STD_VIDEO_H264_ASPECT_RATIO_IDC_20_11 = 7, + STD_VIDEO_H264_ASPECT_RATIO_IDC_32_11 = 8, + STD_VIDEO_H264_ASPECT_RATIO_IDC_80_33 = 9, + STD_VIDEO_H264_ASPECT_RATIO_IDC_18_11 = 10, + STD_VIDEO_H264_ASPECT_RATIO_IDC_15_11 = 11, + STD_VIDEO_H264_ASPECT_RATIO_IDC_64_33 = 12, + STD_VIDEO_H264_ASPECT_RATIO_IDC_160_99 = 13, + STD_VIDEO_H264_ASPECT_RATIO_IDC_4_3 = 14, + STD_VIDEO_H264_ASPECT_RATIO_IDC_3_2 = 15, + STD_VIDEO_H264_ASPECT_RATIO_IDC_2_1 = 16, + STD_VIDEO_H264_ASPECT_RATIO_IDC_EXTENDED_SAR = 255, + STD_VIDEO_H264_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_ASPECT_RATIO_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264AspectRatioIdc; + +typedef enum StdVideoH264WeightedBipredIdc { + STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_DEFAULT = 0, + STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_EXPLICIT = 1, + STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_IMPLICIT = 2, + STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264WeightedBipredIdc; + +typedef enum StdVideoH264ModificationOfPicNumsIdc { + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_SHORT_TERM_SUBTRACT = 0, + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_SHORT_TERM_ADD = 1, + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_LONG_TERM = 2, + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_END = 3, + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264ModificationOfPicNumsIdc; + +typedef enum StdVideoH264MemMgmtControlOp { + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_END = 0, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_SHORT_TERM = 1, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_LONG_TERM = 2, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MARK_LONG_TERM = 3, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_SET_MAX_LONG_TERM_INDEX = 4, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_ALL = 5, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MARK_CURRENT_AS_LONG_TERM = 6, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264MemMgmtControlOp; + +typedef enum StdVideoH264CabacInitIdc { + STD_VIDEO_H264_CABAC_INIT_IDC_0 = 0, + STD_VIDEO_H264_CABAC_INIT_IDC_1 = 1, + STD_VIDEO_H264_CABAC_INIT_IDC_2 = 2, + STD_VIDEO_H264_CABAC_INIT_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_CABAC_INIT_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264CabacInitIdc; + +typedef enum StdVideoH264DisableDeblockingFilterIdc { + STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_DISABLED = 0, + STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_ENABLED = 1, + STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_PARTIAL = 2, + STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264DisableDeblockingFilterIdc; + +typedef enum StdVideoH264SliceType { + STD_VIDEO_H264_SLICE_TYPE_P = 0, + STD_VIDEO_H264_SLICE_TYPE_B = 1, + STD_VIDEO_H264_SLICE_TYPE_I = 2, + STD_VIDEO_H264_SLICE_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_SLICE_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264SliceType; + +typedef enum StdVideoH264PictureType { + STD_VIDEO_H264_PICTURE_TYPE_P = 0, + STD_VIDEO_H264_PICTURE_TYPE_B = 1, + STD_VIDEO_H264_PICTURE_TYPE_I = 2, + STD_VIDEO_H264_PICTURE_TYPE_IDR = 5, + STD_VIDEO_H264_PICTURE_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_PICTURE_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264PictureType; + +typedef enum StdVideoH264NonVclNaluType { + STD_VIDEO_H264_NON_VCL_NALU_TYPE_SPS = 0, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_PPS = 1, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_AUD = 2, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_PREFIX = 3, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_END_OF_SEQUENCE = 4, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_END_OF_STREAM = 5, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_PRECODED = 6, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264NonVclNaluType; +typedef struct StdVideoH264SpsVuiFlags { + uint32_t aspect_ratio_info_present_flag : 1; + uint32_t overscan_info_present_flag : 1; + uint32_t overscan_appropriate_flag : 1; + uint32_t video_signal_type_present_flag : 1; + uint32_t video_full_range_flag : 1; + uint32_t color_description_present_flag : 1; + uint32_t chroma_loc_info_present_flag : 1; + uint32_t timing_info_present_flag : 1; + uint32_t fixed_frame_rate_flag : 1; + uint32_t bitstream_restriction_flag : 1; + uint32_t nal_hrd_parameters_present_flag : 1; + uint32_t vcl_hrd_parameters_present_flag : 1; +} StdVideoH264SpsVuiFlags; + +typedef struct StdVideoH264HrdParameters { + uint8_t cpb_cnt_minus1; + uint8_t bit_rate_scale; + uint8_t cpb_size_scale; + uint8_t reserved1; + uint32_t bit_rate_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; + uint32_t cpb_size_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; + uint8_t cbr_flag[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; + uint32_t initial_cpb_removal_delay_length_minus1; + uint32_t cpb_removal_delay_length_minus1; + uint32_t dpb_output_delay_length_minus1; + uint32_t time_offset_length; +} StdVideoH264HrdParameters; + +typedef struct StdVideoH264SequenceParameterSetVui { + StdVideoH264SpsVuiFlags flags; + StdVideoH264AspectRatioIdc aspect_ratio_idc; + uint16_t sar_width; + uint16_t sar_height; + uint8_t video_format; + uint8_t colour_primaries; + uint8_t transfer_characteristics; + uint8_t matrix_coefficients; + uint32_t num_units_in_tick; + uint32_t time_scale; + uint8_t max_num_reorder_frames; + uint8_t max_dec_frame_buffering; + uint8_t chroma_sample_loc_type_top_field; + uint8_t chroma_sample_loc_type_bottom_field; + uint32_t reserved1; + const StdVideoH264HrdParameters* pHrdParameters; +} StdVideoH264SequenceParameterSetVui; + +typedef struct StdVideoH264SpsFlags { + uint32_t constraint_set0_flag : 1; + uint32_t constraint_set1_flag : 1; + uint32_t constraint_set2_flag : 1; + uint32_t constraint_set3_flag : 1; + uint32_t constraint_set4_flag : 1; + uint32_t constraint_set5_flag : 1; + uint32_t direct_8x8_inference_flag : 1; + uint32_t mb_adaptive_frame_field_flag : 1; + uint32_t frame_mbs_only_flag : 1; + uint32_t delta_pic_order_always_zero_flag : 1; + uint32_t separate_colour_plane_flag : 1; + uint32_t gaps_in_frame_num_value_allowed_flag : 1; + uint32_t qpprime_y_zero_transform_bypass_flag : 1; + uint32_t frame_cropping_flag : 1; + uint32_t seq_scaling_matrix_present_flag : 1; + uint32_t vui_parameters_present_flag : 1; +} StdVideoH264SpsFlags; + +typedef struct StdVideoH264ScalingLists { + uint16_t scaling_list_present_mask; + uint16_t use_default_scaling_matrix_mask; + uint8_t ScalingList4x4[STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS]; + uint8_t ScalingList8x8[STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS]; +} StdVideoH264ScalingLists; + +typedef struct StdVideoH264SequenceParameterSet { + StdVideoH264SpsFlags flags; + StdVideoH264ProfileIdc profile_idc; + StdVideoH264LevelIdc level_idc; + StdVideoH264ChromaFormatIdc chroma_format_idc; + uint8_t seq_parameter_set_id; + uint8_t bit_depth_luma_minus8; + uint8_t bit_depth_chroma_minus8; + uint8_t log2_max_frame_num_minus4; + StdVideoH264PocType pic_order_cnt_type; + int32_t offset_for_non_ref_pic; + int32_t offset_for_top_to_bottom_field; + uint8_t log2_max_pic_order_cnt_lsb_minus4; + uint8_t num_ref_frames_in_pic_order_cnt_cycle; + uint8_t max_num_ref_frames; + uint8_t reserved1; + uint32_t pic_width_in_mbs_minus1; + uint32_t pic_height_in_map_units_minus1; + uint32_t frame_crop_left_offset; + uint32_t frame_crop_right_offset; + uint32_t frame_crop_top_offset; + uint32_t frame_crop_bottom_offset; + uint32_t reserved2; + const int32_t* pOffsetForRefFrame; + const StdVideoH264ScalingLists* pScalingLists; + const StdVideoH264SequenceParameterSetVui* pSequenceParameterSetVui; +} StdVideoH264SequenceParameterSet; + +typedef struct StdVideoH264PpsFlags { + uint32_t transform_8x8_mode_flag : 1; + uint32_t redundant_pic_cnt_present_flag : 1; + uint32_t constrained_intra_pred_flag : 1; + uint32_t deblocking_filter_control_present_flag : 1; + uint32_t weighted_pred_flag : 1; + uint32_t bottom_field_pic_order_in_frame_present_flag : 1; + uint32_t entropy_coding_mode_flag : 1; + uint32_t pic_scaling_matrix_present_flag : 1; +} StdVideoH264PpsFlags; + +typedef struct StdVideoH264PictureParameterSet { + StdVideoH264PpsFlags flags; + uint8_t seq_parameter_set_id; + uint8_t pic_parameter_set_id; + uint8_t num_ref_idx_l0_default_active_minus1; + uint8_t num_ref_idx_l1_default_active_minus1; + StdVideoH264WeightedBipredIdc weighted_bipred_idc; + int8_t pic_init_qp_minus26; + int8_t pic_init_qs_minus26; + int8_t chroma_qp_index_offset; + int8_t second_chroma_qp_index_offset; + const StdVideoH264ScalingLists* pScalingLists; +} StdVideoH264PictureParameterSet; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std_decode.h b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std_decode.h new file mode 100644 index 00000000..b1e79429 --- /dev/null +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std_decode.h @@ -0,0 +1,75 @@ +#ifndef VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ +#define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1 + +/* +** Copyright 2015-2022 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define vulkan_video_codec_h264std_decode 1 + +#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0) + +#define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2 +#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 +#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_decode" + +typedef enum StdVideoDecodeH264FieldOrderCount { + STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0, + STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_BOTTOM = 1, + STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_INVALID = 0x7FFFFFFF, + STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_MAX_ENUM = 0x7FFFFFFF +} StdVideoDecodeH264FieldOrderCount; +typedef struct StdVideoDecodeH264PictureInfoFlags { + uint32_t field_pic_flag : 1; + uint32_t is_intra : 1; + uint32_t IdrPicFlag : 1; + uint32_t bottom_field_flag : 1; + uint32_t is_reference : 1; + uint32_t complementary_field_pair : 1; +} StdVideoDecodeH264PictureInfoFlags; + +typedef struct StdVideoDecodeH264PictureInfo { + StdVideoDecodeH264PictureInfoFlags flags; + uint8_t seq_parameter_set_id; + uint8_t pic_parameter_set_id; + uint8_t reserved1; + uint8_t reserved2; + uint16_t frame_num; + uint16_t idr_pic_id; + int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; +} StdVideoDecodeH264PictureInfo; + +typedef struct StdVideoDecodeH264ReferenceInfoFlags { + uint32_t top_field_flag : 1; + uint32_t bottom_field_flag : 1; + uint32_t used_for_long_term_reference : 1; + uint32_t is_non_existing : 1; +} StdVideoDecodeH264ReferenceInfoFlags; + +typedef struct StdVideoDecodeH264ReferenceInfo { + StdVideoDecodeH264ReferenceInfoFlags flags; + uint16_t FrameNum; + uint16_t reserved; + int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; +} StdVideoDecodeH264ReferenceInfo; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std_encode.h b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std_encode.h new file mode 100644 index 00000000..7bd96aa7 --- /dev/null +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h264std_encode.h @@ -0,0 +1,132 @@ +#ifndef VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_ +#define VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_ 1 + +/* +** Copyright 2015-2022 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define vulkan_video_codec_h264std_encode 1 +// Vulkan 0.9 provisional Vulkan video H.264 encode std specification version number +#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_0_9_8 VK_MAKE_VIDEO_STD_VERSION(0, 9, 8) + +#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_0_9_8 +#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_encode" +typedef struct StdVideoEncodeH264WeightTableFlags { + uint32_t luma_weight_l0_flag; + uint32_t chroma_weight_l0_flag; + uint32_t luma_weight_l1_flag; + uint32_t chroma_weight_l1_flag; +} StdVideoEncodeH264WeightTableFlags; + +typedef struct StdVideoEncodeH264WeightTable { + StdVideoEncodeH264WeightTableFlags flags; + uint8_t luma_log2_weight_denom; + uint8_t chroma_log2_weight_denom; + int8_t luma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF]; + int8_t luma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF]; + int8_t chroma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES]; + int8_t chroma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES]; + int8_t luma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF]; + int8_t luma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF]; + int8_t chroma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES]; + int8_t chroma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES]; +} StdVideoEncodeH264WeightTable; + +typedef struct StdVideoEncodeH264SliceHeaderFlags { + uint32_t direct_spatial_mv_pred_flag : 1; + uint32_t num_ref_idx_active_override_flag : 1; + uint32_t no_output_of_prior_pics_flag : 1; + uint32_t adaptive_ref_pic_marking_mode_flag : 1; + uint32_t no_prior_references_available_flag : 1; +} StdVideoEncodeH264SliceHeaderFlags; + +typedef struct StdVideoEncodeH264PictureInfoFlags { + uint32_t idr_flag : 1; + uint32_t is_reference_flag : 1; + uint32_t used_for_long_term_reference : 1; +} StdVideoEncodeH264PictureInfoFlags; + +typedef struct StdVideoEncodeH264ReferenceInfoFlags { + uint32_t used_for_long_term_reference : 1; +} StdVideoEncodeH264ReferenceInfoFlags; + +typedef struct StdVideoEncodeH264RefMgmtFlags { + uint32_t ref_pic_list_modification_l0_flag : 1; + uint32_t ref_pic_list_modification_l1_flag : 1; +} StdVideoEncodeH264RefMgmtFlags; + +typedef struct StdVideoEncodeH264RefListModEntry { + StdVideoH264ModificationOfPicNumsIdc modification_of_pic_nums_idc; + uint16_t abs_diff_pic_num_minus1; + uint16_t long_term_pic_num; +} StdVideoEncodeH264RefListModEntry; + +typedef struct StdVideoEncodeH264RefPicMarkingEntry { + StdVideoH264MemMgmtControlOp operation; + uint16_t difference_of_pic_nums_minus1; + uint16_t long_term_pic_num; + uint16_t long_term_frame_idx; + uint16_t max_long_term_frame_idx_plus1; +} StdVideoEncodeH264RefPicMarkingEntry; + +typedef struct StdVideoEncodeH264RefMemMgmtCtrlOperations { + StdVideoEncodeH264RefMgmtFlags flags; + uint8_t refList0ModOpCount; + const StdVideoEncodeH264RefListModEntry* pRefList0ModOperations; + uint8_t refList1ModOpCount; + const StdVideoEncodeH264RefListModEntry* pRefList1ModOperations; + uint8_t refPicMarkingOpCount; + const StdVideoEncodeH264RefPicMarkingEntry* pRefPicMarkingOperations; +} StdVideoEncodeH264RefMemMgmtCtrlOperations; + +typedef struct StdVideoEncodeH264PictureInfo { + StdVideoEncodeH264PictureInfoFlags flags; + uint8_t seq_parameter_set_id; + uint8_t pic_parameter_set_id; + StdVideoH264PictureType pictureType; + uint32_t frame_num; + int32_t PicOrderCnt; +} StdVideoEncodeH264PictureInfo; + +typedef struct StdVideoEncodeH264ReferenceInfo { + StdVideoEncodeH264ReferenceInfoFlags flags; + uint32_t FrameNum; + int32_t PicOrderCnt; + uint16_t long_term_pic_num; + uint16_t long_term_frame_idx; +} StdVideoEncodeH264ReferenceInfo; + +typedef struct StdVideoEncodeH264SliceHeader { + StdVideoEncodeH264SliceHeaderFlags flags; + uint32_t first_mb_in_slice; + StdVideoH264SliceType slice_type; + uint16_t idr_pic_id; + uint8_t num_ref_idx_l0_active_minus1; + uint8_t num_ref_idx_l1_active_minus1; + StdVideoH264CabacInitIdc cabac_init_idc; + StdVideoH264DisableDeblockingFilterIdc disable_deblocking_filter_idc; + int8_t slice_alpha_c0_offset_div2; + int8_t slice_beta_offset_div2; + const StdVideoEncodeH264WeightTable* pWeightTable; +} StdVideoEncodeH264SliceHeader; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std.h b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std.h new file mode 100644 index 00000000..862f8817 --- /dev/null +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std.h @@ -0,0 +1,443 @@ +#ifndef VULKAN_VIDEO_CODEC_H265STD_H_ +#define VULKAN_VIDEO_CODEC_H265STD_H_ 1 + +/* +** Copyright 2015-2022 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define vulkan_video_codec_h265std 1 +#define STD_VIDEO_H265_SUBLAYERS_LIST_SIZE 7 +#define STD_VIDEO_H265_CPB_CNT_LIST_SIZE 32 +#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS 6 +#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS 16 +#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS 6 +#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS 64 +#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS 6 +#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS 64 +#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS 2 +#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS 64 +#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE 3 +#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE 128 +#define STD_VIDEO_H265_MAX_DPB_SIZE 16 +#define STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS 32 +#define STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE 6 +#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE 19 +#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE 21 +#define STD_VIDEO_H265_MAX_NUM_LIST_REF 15 +#define STD_VIDEO_H265_MAX_CHROMA_PLANES 2 +#define STD_VIDEO_H265_MAX_SHORT_TERM_REF_PIC_SETS 64 +#define STD_VIDEO_H265_MAX_LONG_TERM_PICS 16 +#define STD_VIDEO_H265_MAX_DELTA_POC 48 + +typedef enum StdVideoH265ChromaFormatIdc { + STD_VIDEO_H265_CHROMA_FORMAT_IDC_MONOCHROME = 0, + STD_VIDEO_H265_CHROMA_FORMAT_IDC_420 = 1, + STD_VIDEO_H265_CHROMA_FORMAT_IDC_422 = 2, + STD_VIDEO_H265_CHROMA_FORMAT_IDC_444 = 3, + STD_VIDEO_H265_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_CHROMA_FORMAT_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265ChromaFormatIdc; + +typedef enum StdVideoH265ProfileIdc { + STD_VIDEO_H265_PROFILE_IDC_MAIN = 1, + STD_VIDEO_H265_PROFILE_IDC_MAIN_10 = 2, + STD_VIDEO_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3, + STD_VIDEO_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSIONS = 4, + STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS = 9, + STD_VIDEO_H265_PROFILE_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265ProfileIdc; + +typedef enum StdVideoH265LevelIdc { + STD_VIDEO_H265_LEVEL_IDC_1_0 = 0, + STD_VIDEO_H265_LEVEL_IDC_2_0 = 1, + STD_VIDEO_H265_LEVEL_IDC_2_1 = 2, + STD_VIDEO_H265_LEVEL_IDC_3_0 = 3, + STD_VIDEO_H265_LEVEL_IDC_3_1 = 4, + STD_VIDEO_H265_LEVEL_IDC_4_0 = 5, + STD_VIDEO_H265_LEVEL_IDC_4_1 = 6, + STD_VIDEO_H265_LEVEL_IDC_5_0 = 7, + STD_VIDEO_H265_LEVEL_IDC_5_1 = 8, + STD_VIDEO_H265_LEVEL_IDC_5_2 = 9, + STD_VIDEO_H265_LEVEL_IDC_6_0 = 10, + STD_VIDEO_H265_LEVEL_IDC_6_1 = 11, + STD_VIDEO_H265_LEVEL_IDC_6_2 = 12, + STD_VIDEO_H265_LEVEL_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_LEVEL_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265LevelIdc; + +typedef enum StdVideoH265SliceType { + STD_VIDEO_H265_SLICE_TYPE_B = 0, + STD_VIDEO_H265_SLICE_TYPE_P = 1, + STD_VIDEO_H265_SLICE_TYPE_I = 2, + STD_VIDEO_H265_SLICE_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_SLICE_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265SliceType; + +typedef enum StdVideoH265PictureType { + STD_VIDEO_H265_PICTURE_TYPE_P = 0, + STD_VIDEO_H265_PICTURE_TYPE_B = 1, + STD_VIDEO_H265_PICTURE_TYPE_I = 2, + STD_VIDEO_H265_PICTURE_TYPE_IDR = 3, + STD_VIDEO_H265_PICTURE_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_PICTURE_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265PictureType; + +typedef enum StdVideoH265AspectRatioIdc { + STD_VIDEO_H265_ASPECT_RATIO_IDC_UNSPECIFIED = 0, + STD_VIDEO_H265_ASPECT_RATIO_IDC_SQUARE = 1, + STD_VIDEO_H265_ASPECT_RATIO_IDC_12_11 = 2, + STD_VIDEO_H265_ASPECT_RATIO_IDC_10_11 = 3, + STD_VIDEO_H265_ASPECT_RATIO_IDC_16_11 = 4, + STD_VIDEO_H265_ASPECT_RATIO_IDC_40_33 = 5, + STD_VIDEO_H265_ASPECT_RATIO_IDC_24_11 = 6, + STD_VIDEO_H265_ASPECT_RATIO_IDC_20_11 = 7, + STD_VIDEO_H265_ASPECT_RATIO_IDC_32_11 = 8, + STD_VIDEO_H265_ASPECT_RATIO_IDC_80_33 = 9, + STD_VIDEO_H265_ASPECT_RATIO_IDC_18_11 = 10, + STD_VIDEO_H265_ASPECT_RATIO_IDC_15_11 = 11, + STD_VIDEO_H265_ASPECT_RATIO_IDC_64_33 = 12, + STD_VIDEO_H265_ASPECT_RATIO_IDC_160_99 = 13, + STD_VIDEO_H265_ASPECT_RATIO_IDC_4_3 = 14, + STD_VIDEO_H265_ASPECT_RATIO_IDC_3_2 = 15, + STD_VIDEO_H265_ASPECT_RATIO_IDC_2_1 = 16, + STD_VIDEO_H265_ASPECT_RATIO_IDC_EXTENDED_SAR = 255, + STD_VIDEO_H265_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_ASPECT_RATIO_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265AspectRatioIdc; +typedef struct StdVideoH265DecPicBufMgr { + uint32_t max_latency_increase_plus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE]; + uint8_t max_dec_pic_buffering_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE]; + uint8_t max_num_reorder_pics[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE]; +} StdVideoH265DecPicBufMgr; + +typedef struct StdVideoH265SubLayerHrdParameters { + uint32_t bit_rate_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE]; + uint32_t cpb_size_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE]; + uint32_t cpb_size_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE]; + uint32_t bit_rate_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE]; + uint32_t cbr_flag; +} StdVideoH265SubLayerHrdParameters; + +typedef struct StdVideoH265HrdFlags { + uint32_t nal_hrd_parameters_present_flag : 1; + uint32_t vcl_hrd_parameters_present_flag : 1; + uint32_t sub_pic_hrd_params_present_flag : 1; + uint32_t sub_pic_cpb_params_in_pic_timing_sei_flag : 1; + uint32_t fixed_pic_rate_general_flag : 8; + uint32_t fixed_pic_rate_within_cvs_flag : 8; + uint32_t low_delay_hrd_flag : 8; +} StdVideoH265HrdFlags; + +typedef struct StdVideoH265HrdParameters { + StdVideoH265HrdFlags flags; + uint8_t tick_divisor_minus2; + uint8_t du_cpb_removal_delay_increment_length_minus1; + uint8_t dpb_output_delay_du_length_minus1; + uint8_t bit_rate_scale; + uint8_t cpb_size_scale; + uint8_t cpb_size_du_scale; + uint8_t initial_cpb_removal_delay_length_minus1; + uint8_t au_cpb_removal_delay_length_minus1; + uint8_t dpb_output_delay_length_minus1; + uint8_t cpb_cnt_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE]; + uint16_t elemental_duration_in_tc_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE]; + uint16_t reserved[3]; + const StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersNal; + const StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersVcl; +} StdVideoH265HrdParameters; + +typedef struct StdVideoH265VpsFlags { + uint32_t vps_temporal_id_nesting_flag : 1; + uint32_t vps_sub_layer_ordering_info_present_flag : 1; + uint32_t vps_timing_info_present_flag : 1; + uint32_t vps_poc_proportional_to_timing_flag : 1; +} StdVideoH265VpsFlags; + +typedef struct StdVideoH265ProfileTierLevelFlags { + uint32_t general_tier_flag : 1; + uint32_t general_progressive_source_flag : 1; + uint32_t general_interlaced_source_flag : 1; + uint32_t general_non_packed_constraint_flag : 1; + uint32_t general_frame_only_constraint_flag : 1; +} StdVideoH265ProfileTierLevelFlags; + +typedef struct StdVideoH265ProfileTierLevel { + StdVideoH265ProfileTierLevelFlags flags; + StdVideoH265ProfileIdc general_profile_idc; + StdVideoH265LevelIdc general_level_idc; +} StdVideoH265ProfileTierLevel; + +typedef struct StdVideoH265VideoParameterSet { + StdVideoH265VpsFlags flags; + uint8_t vps_video_parameter_set_id; + uint8_t vps_max_sub_layers_minus1; + uint8_t reserved1; + uint8_t reserved2; + uint32_t vps_num_units_in_tick; + uint32_t vps_time_scale; + uint32_t vps_num_ticks_poc_diff_one_minus1; + uint32_t reserved3; + const StdVideoH265DecPicBufMgr* pDecPicBufMgr; + const StdVideoH265HrdParameters* pHrdParameters; + const StdVideoH265ProfileTierLevel* pProfileTierLevel; +} StdVideoH265VideoParameterSet; + +typedef struct StdVideoH265ScalingLists { + uint8_t ScalingList4x4[STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS]; + uint8_t ScalingList8x8[STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS]; + uint8_t ScalingList16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS]; + uint8_t ScalingList32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS]; + uint8_t ScalingListDCCoef16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS]; + uint8_t ScalingListDCCoef32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS]; +} StdVideoH265ScalingLists; + +typedef struct StdVideoH265SpsVuiFlags { + uint32_t aspect_ratio_info_present_flag : 1; + uint32_t overscan_info_present_flag : 1; + uint32_t overscan_appropriate_flag : 1; + uint32_t video_signal_type_present_flag : 1; + uint32_t video_full_range_flag : 1; + uint32_t colour_description_present_flag : 1; + uint32_t chroma_loc_info_present_flag : 1; + uint32_t neutral_chroma_indication_flag : 1; + uint32_t field_seq_flag : 1; + uint32_t frame_field_info_present_flag : 1; + uint32_t default_display_window_flag : 1; + uint32_t vui_timing_info_present_flag : 1; + uint32_t vui_poc_proportional_to_timing_flag : 1; + uint32_t vui_hrd_parameters_present_flag : 1; + uint32_t bitstream_restriction_flag : 1; + uint32_t tiles_fixed_structure_flag : 1; + uint32_t motion_vectors_over_pic_boundaries_flag : 1; + uint32_t restricted_ref_pic_lists_flag : 1; +} StdVideoH265SpsVuiFlags; + +typedef struct StdVideoH265SequenceParameterSetVui { + StdVideoH265SpsVuiFlags flags; + StdVideoH265AspectRatioIdc aspect_ratio_idc; + uint16_t sar_width; + uint16_t sar_height; + uint8_t video_format; + uint8_t colour_primaries; + uint8_t transfer_characteristics; + uint8_t matrix_coeffs; + uint8_t chroma_sample_loc_type_top_field; + uint8_t chroma_sample_loc_type_bottom_field; + uint8_t reserved1; + uint8_t reserved2; + uint16_t def_disp_win_left_offset; + uint16_t def_disp_win_right_offset; + uint16_t def_disp_win_top_offset; + uint16_t def_disp_win_bottom_offset; + uint32_t vui_num_units_in_tick; + uint32_t vui_time_scale; + uint32_t vui_num_ticks_poc_diff_one_minus1; + uint16_t min_spatial_segmentation_idc; + uint16_t reserved3; + uint8_t max_bytes_per_pic_denom; + uint8_t max_bits_per_min_cu_denom; + uint8_t log2_max_mv_length_horizontal; + uint8_t log2_max_mv_length_vertical; + const StdVideoH265HrdParameters* pHrdParameters; +} StdVideoH265SequenceParameterSetVui; + +typedef struct StdVideoH265PredictorPaletteEntries { + uint16_t PredictorPaletteEntries[STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE][STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE]; +} StdVideoH265PredictorPaletteEntries; + +typedef struct StdVideoH265SpsFlags { + uint32_t sps_temporal_id_nesting_flag : 1; + uint32_t separate_colour_plane_flag : 1; + uint32_t conformance_window_flag : 1; + uint32_t sps_sub_layer_ordering_info_present_flag : 1; + uint32_t scaling_list_enabled_flag : 1; + uint32_t sps_scaling_list_data_present_flag : 1; + uint32_t amp_enabled_flag : 1; + uint32_t sample_adaptive_offset_enabled_flag : 1; + uint32_t pcm_enabled_flag : 1; + uint32_t pcm_loop_filter_disabled_flag : 1; + uint32_t long_term_ref_pics_present_flag : 1; + uint32_t sps_temporal_mvp_enabled_flag : 1; + uint32_t strong_intra_smoothing_enabled_flag : 1; + uint32_t vui_parameters_present_flag : 1; + uint32_t sps_extension_present_flag : 1; + uint32_t sps_range_extension_flag : 1; + uint32_t transform_skip_rotation_enabled_flag : 1; + uint32_t transform_skip_context_enabled_flag : 1; + uint32_t implicit_rdpcm_enabled_flag : 1; + uint32_t explicit_rdpcm_enabled_flag : 1; + uint32_t extended_precision_processing_flag : 1; + uint32_t intra_smoothing_disabled_flag : 1; + uint32_t high_precision_offsets_enabled_flag : 1; + uint32_t persistent_rice_adaptation_enabled_flag : 1; + uint32_t cabac_bypass_alignment_enabled_flag : 1; + uint32_t sps_scc_extension_flag : 1; + uint32_t sps_curr_pic_ref_enabled_flag : 1; + uint32_t palette_mode_enabled_flag : 1; + uint32_t sps_palette_predictor_initializers_present_flag : 1; + uint32_t intra_boundary_filtering_disabled_flag : 1; +} StdVideoH265SpsFlags; + +typedef struct StdVideoH265ShortTermRefPicSetFlags { + uint32_t inter_ref_pic_set_prediction_flag : 1; + uint32_t delta_rps_sign : 1; +} StdVideoH265ShortTermRefPicSetFlags; + +typedef struct StdVideoH265ShortTermRefPicSet { + StdVideoH265ShortTermRefPicSetFlags flags; + uint32_t delta_idx_minus1; + uint16_t use_delta_flag; + uint16_t abs_delta_rps_minus1; + uint16_t used_by_curr_pic_flag; + uint16_t used_by_curr_pic_s0_flag; + uint16_t used_by_curr_pic_s1_flag; + uint16_t reserved1; + uint8_t reserved2; + uint8_t reserved3; + uint8_t num_negative_pics; + uint8_t num_positive_pics; + uint16_t delta_poc_s0_minus1[STD_VIDEO_H265_MAX_DPB_SIZE]; + uint16_t delta_poc_s1_minus1[STD_VIDEO_H265_MAX_DPB_SIZE]; +} StdVideoH265ShortTermRefPicSet; + +typedef struct StdVideoH265LongTermRefPicsSps { + uint32_t used_by_curr_pic_lt_sps_flag; + uint32_t lt_ref_pic_poc_lsb_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS]; +} StdVideoH265LongTermRefPicsSps; + +typedef struct StdVideoH265SequenceParameterSet { + StdVideoH265SpsFlags flags; + StdVideoH265ChromaFormatIdc chroma_format_idc; + uint32_t pic_width_in_luma_samples; + uint32_t pic_height_in_luma_samples; + uint8_t sps_video_parameter_set_id; + uint8_t sps_max_sub_layers_minus1; + uint8_t sps_seq_parameter_set_id; + uint8_t bit_depth_luma_minus8; + uint8_t bit_depth_chroma_minus8; + uint8_t log2_max_pic_order_cnt_lsb_minus4; + uint8_t log2_min_luma_coding_block_size_minus3; + uint8_t log2_diff_max_min_luma_coding_block_size; + uint8_t log2_min_luma_transform_block_size_minus2; + uint8_t log2_diff_max_min_luma_transform_block_size; + uint8_t max_transform_hierarchy_depth_inter; + uint8_t max_transform_hierarchy_depth_intra; + uint8_t num_short_term_ref_pic_sets; + uint8_t num_long_term_ref_pics_sps; + uint8_t pcm_sample_bit_depth_luma_minus1; + uint8_t pcm_sample_bit_depth_chroma_minus1; + uint8_t log2_min_pcm_luma_coding_block_size_minus3; + uint8_t log2_diff_max_min_pcm_luma_coding_block_size; + uint8_t reserved1; + uint8_t reserved2; + uint8_t palette_max_size; + uint8_t delta_palette_max_predictor_size; + uint8_t motion_vector_resolution_control_idc; + uint8_t sps_num_palette_predictor_initializers_minus1; + uint32_t conf_win_left_offset; + uint32_t conf_win_right_offset; + uint32_t conf_win_top_offset; + uint32_t conf_win_bottom_offset; + const StdVideoH265ProfileTierLevel* pProfileTierLevel; + const StdVideoH265DecPicBufMgr* pDecPicBufMgr; + const StdVideoH265ScalingLists* pScalingLists; + const StdVideoH265ShortTermRefPicSet* pShortTermRefPicSet; + const StdVideoH265LongTermRefPicsSps* pLongTermRefPicsSps; + const StdVideoH265SequenceParameterSetVui* pSequenceParameterSetVui; + const StdVideoH265PredictorPaletteEntries* pPredictorPaletteEntries; +} StdVideoH265SequenceParameterSet; + +typedef struct StdVideoH265PpsFlags { + uint32_t dependent_slice_segments_enabled_flag : 1; + uint32_t output_flag_present_flag : 1; + uint32_t sign_data_hiding_enabled_flag : 1; + uint32_t cabac_init_present_flag : 1; + uint32_t constrained_intra_pred_flag : 1; + uint32_t transform_skip_enabled_flag : 1; + uint32_t cu_qp_delta_enabled_flag : 1; + uint32_t pps_slice_chroma_qp_offsets_present_flag : 1; + uint32_t weighted_pred_flag : 1; + uint32_t weighted_bipred_flag : 1; + uint32_t transquant_bypass_enabled_flag : 1; + uint32_t tiles_enabled_flag : 1; + uint32_t entropy_coding_sync_enabled_flag : 1; + uint32_t uniform_spacing_flag : 1; + uint32_t loop_filter_across_tiles_enabled_flag : 1; + uint32_t pps_loop_filter_across_slices_enabled_flag : 1; + uint32_t deblocking_filter_control_present_flag : 1; + uint32_t deblocking_filter_override_enabled_flag : 1; + uint32_t pps_deblocking_filter_disabled_flag : 1; + uint32_t pps_scaling_list_data_present_flag : 1; + uint32_t lists_modification_present_flag : 1; + uint32_t slice_segment_header_extension_present_flag : 1; + uint32_t pps_extension_present_flag : 1; + uint32_t cross_component_prediction_enabled_flag : 1; + uint32_t chroma_qp_offset_list_enabled_flag : 1; + uint32_t pps_curr_pic_ref_enabled_flag : 1; + uint32_t residual_adaptive_colour_transform_enabled_flag : 1; + uint32_t pps_slice_act_qp_offsets_present_flag : 1; + uint32_t pps_palette_predictor_initializers_present_flag : 1; + uint32_t monochrome_palette_flag : 1; + uint32_t pps_range_extension_flag : 1; +} StdVideoH265PpsFlags; + +typedef struct StdVideoH265PictureParameterSet { + StdVideoH265PpsFlags flags; + uint8_t pps_pic_parameter_set_id; + uint8_t pps_seq_parameter_set_id; + uint8_t sps_video_parameter_set_id; + uint8_t num_extra_slice_header_bits; + uint8_t num_ref_idx_l0_default_active_minus1; + uint8_t num_ref_idx_l1_default_active_minus1; + int8_t init_qp_minus26; + uint8_t diff_cu_qp_delta_depth; + int8_t pps_cb_qp_offset; + int8_t pps_cr_qp_offset; + int8_t pps_beta_offset_div2; + int8_t pps_tc_offset_div2; + uint8_t log2_parallel_merge_level_minus2; + uint8_t log2_max_transform_skip_block_size_minus2; + uint8_t diff_cu_chroma_qp_offset_depth; + uint8_t chroma_qp_offset_list_len_minus1; + int8_t cb_qp_offset_list[STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE]; + int8_t cr_qp_offset_list[STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE]; + uint8_t log2_sao_offset_scale_luma; + uint8_t log2_sao_offset_scale_chroma; + int8_t pps_act_y_qp_offset_plus5; + int8_t pps_act_cb_qp_offset_plus5; + int8_t pps_act_cr_qp_offset_plus3; + uint8_t pps_num_palette_predictor_initializers; + uint8_t luma_bit_depth_entry_minus8; + uint8_t chroma_bit_depth_entry_minus8; + uint8_t num_tile_columns_minus1; + uint8_t num_tile_rows_minus1; + uint8_t reserved1; + uint8_t reserved2; + uint16_t column_width_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE]; + uint16_t row_height_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE]; + uint32_t reserved3; + const StdVideoH265ScalingLists* pScalingLists; + const StdVideoH265PredictorPaletteEntries* pPredictorPaletteEntries; +} StdVideoH265PictureParameterSet; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std_decode.h b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std_decode.h new file mode 100644 index 00000000..d8660d12 --- /dev/null +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std_decode.h @@ -0,0 +1,65 @@ +#ifndef VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ +#define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1 + +/* +** Copyright 2015-2022 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define vulkan_video_codec_h265std_decode 1 + +#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0) + +#define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8 +#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 +#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_decode" +typedef struct StdVideoDecodeH265PictureInfoFlags { + uint32_t IrapPicFlag : 1; + uint32_t IdrPicFlag : 1; + uint32_t IsReference : 1; + uint32_t short_term_ref_pic_set_sps_flag : 1; +} StdVideoDecodeH265PictureInfoFlags; + +typedef struct StdVideoDecodeH265PictureInfo { + StdVideoDecodeH265PictureInfoFlags flags; + uint8_t sps_video_parameter_set_id; + uint8_t pps_seq_parameter_set_id; + uint8_t pps_pic_parameter_set_id; + uint8_t NumDeltaPocsOfRefRpsIdx; + int32_t PicOrderCntVal; + uint16_t NumBitsForSTRefPicSetInSlice; + uint16_t reserved; + uint8_t RefPicSetStCurrBefore[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; + uint8_t RefPicSetStCurrAfter[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; + uint8_t RefPicSetLtCurr[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; +} StdVideoDecodeH265PictureInfo; + +typedef struct StdVideoDecodeH265ReferenceInfoFlags { + uint32_t used_for_long_term_reference : 1; + uint32_t unused_for_reference : 1; +} StdVideoDecodeH265ReferenceInfoFlags; + +typedef struct StdVideoDecodeH265ReferenceInfo { + StdVideoDecodeH265ReferenceInfoFlags flags; + int32_t PicOrderCntVal; +} StdVideoDecodeH265ReferenceInfo; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std_encode.h b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std_encode.h new file mode 100644 index 00000000..5a419b14 --- /dev/null +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codec_h265std_encode.h @@ -0,0 +1,146 @@ +#ifndef VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ +#define VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 1 + +/* +** Copyright 2015-2022 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define vulkan_video_codec_h265std_encode 1 +// Vulkan 0.9 provisional Vulkan video H.265 encode std specification version number +#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_0_9_9 VK_MAKE_VIDEO_STD_VERSION(0, 9, 9) + +#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_0_9_9 +#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_encode" +typedef struct StdVideoEncodeH265WeightTableFlags { + uint16_t luma_weight_l0_flag; + uint16_t chroma_weight_l0_flag; + uint16_t luma_weight_l1_flag; + uint16_t chroma_weight_l1_flag; +} StdVideoEncodeH265WeightTableFlags; + +typedef struct StdVideoEncodeH265WeightTable { + StdVideoEncodeH265WeightTableFlags flags; + uint8_t luma_log2_weight_denom; + int8_t delta_chroma_log2_weight_denom; + int8_t delta_luma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + int8_t luma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + int8_t delta_chroma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES]; + int8_t delta_chroma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES]; + int8_t delta_luma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + int8_t luma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + int8_t delta_chroma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES]; + int8_t delta_chroma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES]; +} StdVideoEncodeH265WeightTable; + +typedef struct StdVideoEncodeH265SliceSegmentHeaderFlags { + uint32_t first_slice_segment_in_pic_flag : 1; + uint32_t no_output_of_prior_pics_flag : 1; + uint32_t dependent_slice_segment_flag : 1; + uint32_t pic_output_flag : 1; + uint32_t short_term_ref_pic_set_sps_flag : 1; + uint32_t slice_temporal_mvp_enable_flag : 1; + uint32_t slice_sao_luma_flag : 1; + uint32_t slice_sao_chroma_flag : 1; + uint32_t num_ref_idx_active_override_flag : 1; + uint32_t mvd_l1_zero_flag : 1; + uint32_t cabac_init_flag : 1; + uint32_t cu_chroma_qp_offset_enabled_flag : 1; + uint32_t deblocking_filter_override_flag : 1; + uint32_t slice_deblocking_filter_disabled_flag : 1; + uint32_t collocated_from_l0_flag : 1; + uint32_t slice_loop_filter_across_slices_enabled_flag : 1; +} StdVideoEncodeH265SliceSegmentHeaderFlags; + +typedef struct StdVideoEncodeH265SliceSegmentLongTermRefPics { + uint8_t num_long_term_sps; + uint8_t num_long_term_pics; + uint8_t lt_idx_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS]; + uint8_t poc_lsb_lt[STD_VIDEO_H265_MAX_LONG_TERM_PICS]; + uint16_t used_by_curr_pic_lt_flag; + uint8_t delta_poc_msb_present_flag[STD_VIDEO_H265_MAX_DELTA_POC]; + uint8_t delta_poc_msb_cycle_lt[STD_VIDEO_H265_MAX_DELTA_POC]; +} StdVideoEncodeH265SliceSegmentLongTermRefPics; + +typedef struct StdVideoEncodeH265SliceSegmentHeader { + StdVideoEncodeH265SliceSegmentHeaderFlags flags; + StdVideoH265SliceType slice_type; + uint32_t slice_segment_address; + uint8_t short_term_ref_pic_set_idx; + uint8_t collocated_ref_idx; + uint8_t num_ref_idx_l0_active_minus1; + uint8_t num_ref_idx_l1_active_minus1; + uint8_t MaxNumMergeCand; + int8_t slice_cb_qp_offset; + int8_t slice_cr_qp_offset; + int8_t slice_beta_offset_div2; + int8_t slice_tc_offset_div2; + int8_t slice_act_y_qp_offset; + int8_t slice_act_cb_qp_offset; + int8_t slice_act_cr_qp_offset; + const StdVideoH265ShortTermRefPicSet* pShortTermRefPicSet; + const StdVideoEncodeH265SliceSegmentLongTermRefPics* pLongTermRefPics; + const StdVideoEncodeH265WeightTable* pWeightTable; +} StdVideoEncodeH265SliceSegmentHeader; + +typedef struct StdVideoEncodeH265ReferenceModificationFlags { + uint32_t ref_pic_list_modification_flag_l0 : 1; + uint32_t ref_pic_list_modification_flag_l1 : 1; +} StdVideoEncodeH265ReferenceModificationFlags; + +typedef struct StdVideoEncodeH265ReferenceModifications { + StdVideoEncodeH265ReferenceModificationFlags flags; + uint8_t referenceList0ModificationsCount; + const uint8_t* pReferenceList0Modifications; + uint8_t referenceList1ModificationsCount; + const uint8_t* pReferenceList1Modifications; +} StdVideoEncodeH265ReferenceModifications; + +typedef struct StdVideoEncodeH265PictureInfoFlags { + uint32_t is_reference_flag : 1; + uint32_t IrapPicFlag : 1; + uint32_t long_term_flag : 1; + uint32_t discardable_flag : 1; + uint32_t cross_layer_bla_flag : 1; +} StdVideoEncodeH265PictureInfoFlags; + +typedef struct StdVideoEncodeH265PictureInfo { + StdVideoEncodeH265PictureInfoFlags flags; + StdVideoH265PictureType PictureType; + uint8_t sps_video_parameter_set_id; + uint8_t pps_seq_parameter_set_id; + uint8_t pps_pic_parameter_set_id; + int32_t PicOrderCntVal; + uint8_t TemporalId; +} StdVideoEncodeH265PictureInfo; + +typedef struct StdVideoEncodeH265ReferenceInfoFlags { + uint32_t used_for_long_term_reference : 1; + uint32_t unused_for_reference : 1; +} StdVideoEncodeH265ReferenceInfoFlags; + +typedef struct StdVideoEncodeH265ReferenceInfo { + StdVideoEncodeH265ReferenceInfoFlags flags; + int32_t PicOrderCntVal; + uint8_t TemporalId; +} StdVideoEncodeH265ReferenceInfo; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codecs_common.h b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codecs_common.h new file mode 100644 index 00000000..1e498265 --- /dev/null +++ b/bgfx/3rdparty/khronos/vulkan-local/vk_video/vulkan_video_codecs_common.h @@ -0,0 +1,31 @@ +#ifndef VULKAN_VIDEO_CODECS_COMMON_H_ +#define VULKAN_VIDEO_CODECS_COMMON_H_ 1 + +/* +** Copyright 2015-2022 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define vulkan_video_codecs_common 1 +#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \ + ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan.h index 3510ac91..426cff58 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan.h @@ -2,7 +2,7 @@ #define VULKAN_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -84,6 +84,14 @@ #include "vulkan_screen.h" #endif + +#ifdef VK_USE_PLATFORM_SCI +#include +#include +#include "vulkan_sci.h" +#endif + + #ifdef VK_ENABLE_BETA_EXTENSIONS #include "vulkan_beta.h" #endif diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_android.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_android.h index 11f53979..d86f43f2 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_android.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_android.h @@ -2,7 +2,7 @@ #define VULKAN_ANDROID_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_KHR_android_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_android_surface 1 struct ANativeWindow; #define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6 @@ -42,6 +43,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( #endif +// VK_ANDROID_external_memory_android_hardware_buffer is a preprocessor guard. Do not pass it to API calls. #define VK_ANDROID_external_memory_android_hardware_buffer 1 struct AHardwareBuffer; #define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 5 diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_beta.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_beta.h index db511024..1871651d 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_beta.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_beta.h @@ -2,7 +2,7 @@ #define VULKAN_BETA_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,356 +19,7 @@ extern "C" { -#define VK_KHR_video_queue 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionKHR) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionParametersKHR) -#define VK_KHR_VIDEO_QUEUE_SPEC_VERSION 7 -#define VK_KHR_VIDEO_QUEUE_EXTENSION_NAME "VK_KHR_video_queue" - -typedef enum VkQueryResultStatusKHR { - VK_QUERY_RESULT_STATUS_ERROR_KHR = -1, - VK_QUERY_RESULT_STATUS_NOT_READY_KHR = 0, - VK_QUERY_RESULT_STATUS_COMPLETE_KHR = 1, - VK_QUERY_RESULT_STATUS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkQueryResultStatusKHR; - -typedef enum VkVideoCodecOperationFlagBitsKHR { - VK_VIDEO_CODEC_OPERATION_NONE_KHR = 0, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT = 0x00010000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT = 0x00020000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_EXT = 0x00000001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_EXT = 0x00000002, -#endif - VK_VIDEO_CODEC_OPERATION_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoCodecOperationFlagBitsKHR; -typedef VkFlags VkVideoCodecOperationFlagsKHR; - -typedef enum VkVideoChromaSubsamplingFlagBitsKHR { - VK_VIDEO_CHROMA_SUBSAMPLING_INVALID_KHR = 0, - VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR = 0x00000001, - VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR = 0x00000002, - VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR = 0x00000004, - VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR = 0x00000008, - VK_VIDEO_CHROMA_SUBSAMPLING_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoChromaSubsamplingFlagBitsKHR; -typedef VkFlags VkVideoChromaSubsamplingFlagsKHR; - -typedef enum VkVideoComponentBitDepthFlagBitsKHR { - VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR = 0, - VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR = 0x00000001, - VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR = 0x00000004, - VK_VIDEO_COMPONENT_BIT_DEPTH_12_BIT_KHR = 0x00000010, - VK_VIDEO_COMPONENT_BIT_DEPTH_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoComponentBitDepthFlagBitsKHR; -typedef VkFlags VkVideoComponentBitDepthFlagsKHR; - -typedef enum VkVideoCapabilityFlagBitsKHR { - VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR = 0x00000001, - VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR = 0x00000002, - VK_VIDEO_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoCapabilityFlagBitsKHR; -typedef VkFlags VkVideoCapabilityFlagsKHR; - -typedef enum VkVideoSessionCreateFlagBitsKHR { - VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR = 0x00000001, - VK_VIDEO_SESSION_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoSessionCreateFlagBitsKHR; -typedef VkFlags VkVideoSessionCreateFlagsKHR; -typedef VkFlags VkVideoSessionParametersCreateFlagsKHR; -typedef VkFlags VkVideoBeginCodingFlagsKHR; -typedef VkFlags VkVideoEndCodingFlagsKHR; - -typedef enum VkVideoCodingControlFlagBitsKHR { - VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR = 0x00000001, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR = 0x00000002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_LAYER_BIT_KHR = 0x00000004, -#endif - VK_VIDEO_CODING_CONTROL_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoCodingControlFlagBitsKHR; -typedef VkFlags VkVideoCodingControlFlagsKHR; -typedef struct VkQueueFamilyQueryResultStatusPropertiesKHR { - VkStructureType sType; - void* pNext; - VkBool32 queryResultStatusSupport; -} VkQueueFamilyQueryResultStatusPropertiesKHR; - -typedef struct VkQueueFamilyVideoPropertiesKHR { - VkStructureType sType; - void* pNext; - VkVideoCodecOperationFlagsKHR videoCodecOperations; -} VkQueueFamilyVideoPropertiesKHR; - -typedef struct VkVideoProfileInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoCodecOperationFlagBitsKHR videoCodecOperation; - VkVideoChromaSubsamplingFlagsKHR chromaSubsampling; - VkVideoComponentBitDepthFlagsKHR lumaBitDepth; - VkVideoComponentBitDepthFlagsKHR chromaBitDepth; -} VkVideoProfileInfoKHR; - -typedef struct VkVideoProfileListInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t profileCount; - const VkVideoProfileInfoKHR* pProfiles; -} VkVideoProfileListInfoKHR; - -typedef struct VkVideoCapabilitiesKHR { - VkStructureType sType; - void* pNext; - VkVideoCapabilityFlagsKHR flags; - VkDeviceSize minBitstreamBufferOffsetAlignment; - VkDeviceSize minBitstreamBufferSizeAlignment; - VkExtent2D pictureAccessGranularity; - VkExtent2D minCodedExtent; - VkExtent2D maxCodedExtent; - uint32_t maxDpbSlots; - uint32_t maxActiveReferencePictures; - VkExtensionProperties stdHeaderVersion; -} VkVideoCapabilitiesKHR; - -typedef struct VkPhysicalDeviceVideoFormatInfoKHR { - VkStructureType sType; - const void* pNext; - VkImageUsageFlags imageUsage; -} VkPhysicalDeviceVideoFormatInfoKHR; - -typedef struct VkVideoFormatPropertiesKHR { - VkStructureType sType; - void* pNext; - VkFormat format; - VkComponentMapping componentMapping; - VkImageCreateFlags imageCreateFlags; - VkImageType imageType; - VkImageTiling imageTiling; - VkImageUsageFlags imageUsageFlags; -} VkVideoFormatPropertiesKHR; - -typedef struct VkVideoPictureResourceInfoKHR { - VkStructureType sType; - const void* pNext; - VkOffset2D codedOffset; - VkExtent2D codedExtent; - uint32_t baseArrayLayer; - VkImageView imageViewBinding; -} VkVideoPictureResourceInfoKHR; - -typedef struct VkVideoReferenceSlotInfoKHR { - VkStructureType sType; - const void* pNext; - int32_t slotIndex; - const VkVideoPictureResourceInfoKHR* pPictureResource; -} VkVideoReferenceSlotInfoKHR; - -typedef struct VkVideoSessionMemoryRequirementsKHR { - VkStructureType sType; - void* pNext; - uint32_t memoryBindIndex; - VkMemoryRequirements memoryRequirements; -} VkVideoSessionMemoryRequirementsKHR; - -typedef struct VkBindVideoSessionMemoryInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t memoryBindIndex; - VkDeviceMemory memory; - VkDeviceSize memoryOffset; - VkDeviceSize memorySize; -} VkBindVideoSessionMemoryInfoKHR; - -typedef struct VkVideoSessionCreateInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t queueFamilyIndex; - VkVideoSessionCreateFlagsKHR flags; - const VkVideoProfileInfoKHR* pVideoProfile; - VkFormat pictureFormat; - VkExtent2D maxCodedExtent; - VkFormat referencePictureFormat; - uint32_t maxDpbSlots; - uint32_t maxActiveReferencePictures; - const VkExtensionProperties* pStdHeaderVersion; -} VkVideoSessionCreateInfoKHR; - -typedef struct VkVideoSessionParametersCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoSessionParametersCreateFlagsKHR flags; - VkVideoSessionParametersKHR videoSessionParametersTemplate; - VkVideoSessionKHR videoSession; -} VkVideoSessionParametersCreateInfoKHR; - -typedef struct VkVideoSessionParametersUpdateInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t updateSequenceCount; -} VkVideoSessionParametersUpdateInfoKHR; - -typedef struct VkVideoBeginCodingInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoBeginCodingFlagsKHR flags; - VkVideoSessionKHR videoSession; - VkVideoSessionParametersKHR videoSessionParameters; - uint32_t referenceSlotCount; - const VkVideoReferenceSlotInfoKHR* pReferenceSlots; -} VkVideoBeginCodingInfoKHR; - -typedef struct VkVideoEndCodingInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoEndCodingFlagsKHR flags; -} VkVideoEndCodingInfoKHR; - -typedef struct VkVideoCodingControlInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoCodingControlFlagsKHR flags; -} VkVideoCodingControlInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR)(VkPhysicalDevice physicalDevice, const VkVideoProfileInfoKHR* pVideoProfile, VkVideoCapabilitiesKHR* pCapabilities); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceVideoFormatInfoKHR* pVideoFormatInfo, uint32_t* pVideoFormatPropertyCount, VkVideoFormatPropertiesKHR* pVideoFormatProperties); -typedef VkResult (VKAPI_PTR *PFN_vkCreateVideoSessionKHR)(VkDevice device, const VkVideoSessionCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkVideoSessionKHR* pVideoSession); -typedef void (VKAPI_PTR *PFN_vkDestroyVideoSessionKHR)(VkDevice device, VkVideoSessionKHR videoSession, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkGetVideoSessionMemoryRequirementsKHR)(VkDevice device, VkVideoSessionKHR videoSession, uint32_t* pMemoryRequirementsCount, VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements); -typedef VkResult (VKAPI_PTR *PFN_vkBindVideoSessionMemoryKHR)(VkDevice device, VkVideoSessionKHR videoSession, uint32_t bindSessionMemoryInfoCount, const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos); -typedef VkResult (VKAPI_PTR *PFN_vkCreateVideoSessionParametersKHR)(VkDevice device, const VkVideoSessionParametersCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkVideoSessionParametersKHR* pVideoSessionParameters); -typedef VkResult (VKAPI_PTR *PFN_vkUpdateVideoSessionParametersKHR)(VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo); -typedef void (VKAPI_PTR *PFN_vkDestroyVideoSessionParametersKHR)(VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkAllocationCallbacks* pAllocator); -typedef void (VKAPI_PTR *PFN_vkCmdBeginVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoBeginCodingInfoKHR* pBeginInfo); -typedef void (VKAPI_PTR *PFN_vkCmdEndVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoEndCodingInfoKHR* pEndCodingInfo); -typedef void (VKAPI_PTR *PFN_vkCmdControlVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoCodingControlInfoKHR* pCodingControlInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceVideoCapabilitiesKHR( - VkPhysicalDevice physicalDevice, - const VkVideoProfileInfoKHR* pVideoProfile, - VkVideoCapabilitiesKHR* pCapabilities); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceVideoFormatPropertiesKHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceVideoFormatInfoKHR* pVideoFormatInfo, - uint32_t* pVideoFormatPropertyCount, - VkVideoFormatPropertiesKHR* pVideoFormatProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateVideoSessionKHR( - VkDevice device, - const VkVideoSessionCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkVideoSessionKHR* pVideoSession); - -VKAPI_ATTR void VKAPI_CALL vkDestroyVideoSessionKHR( - VkDevice device, - VkVideoSessionKHR videoSession, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetVideoSessionMemoryRequirementsKHR( - VkDevice device, - VkVideoSessionKHR videoSession, - uint32_t* pMemoryRequirementsCount, - VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements); - -VKAPI_ATTR VkResult VKAPI_CALL vkBindVideoSessionMemoryKHR( - VkDevice device, - VkVideoSessionKHR videoSession, - uint32_t bindSessionMemoryInfoCount, - const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateVideoSessionParametersKHR( - VkDevice device, - const VkVideoSessionParametersCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkVideoSessionParametersKHR* pVideoSessionParameters); - -VKAPI_ATTR VkResult VKAPI_CALL vkUpdateVideoSessionParametersKHR( - VkDevice device, - VkVideoSessionParametersKHR videoSessionParameters, - const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo); - -VKAPI_ATTR void VKAPI_CALL vkDestroyVideoSessionParametersKHR( - VkDevice device, - VkVideoSessionParametersKHR videoSessionParameters, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR void VKAPI_CALL vkCmdBeginVideoCodingKHR( - VkCommandBuffer commandBuffer, - const VkVideoBeginCodingInfoKHR* pBeginInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdEndVideoCodingKHR( - VkCommandBuffer commandBuffer, - const VkVideoEndCodingInfoKHR* pEndCodingInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdControlVideoCodingKHR( - VkCommandBuffer commandBuffer, - const VkVideoCodingControlInfoKHR* pCodingControlInfo); -#endif - - -#define VK_KHR_video_decode_queue 1 -#define VK_KHR_VIDEO_DECODE_QUEUE_SPEC_VERSION 6 -#define VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME "VK_KHR_video_decode_queue" - -typedef enum VkVideoDecodeCapabilityFlagBitsKHR { - VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR = 0x00000001, - VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR = 0x00000002, - VK_VIDEO_DECODE_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoDecodeCapabilityFlagBitsKHR; -typedef VkFlags VkVideoDecodeCapabilityFlagsKHR; - -typedef enum VkVideoDecodeUsageFlagBitsKHR { - VK_VIDEO_DECODE_USAGE_DEFAULT_KHR = 0, - VK_VIDEO_DECODE_USAGE_TRANSCODING_BIT_KHR = 0x00000001, - VK_VIDEO_DECODE_USAGE_OFFLINE_BIT_KHR = 0x00000002, - VK_VIDEO_DECODE_USAGE_STREAMING_BIT_KHR = 0x00000004, - VK_VIDEO_DECODE_USAGE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoDecodeUsageFlagBitsKHR; -typedef VkFlags VkVideoDecodeUsageFlagsKHR; -typedef VkFlags VkVideoDecodeFlagsKHR; -typedef struct VkVideoDecodeCapabilitiesKHR { - VkStructureType sType; - void* pNext; - VkVideoDecodeCapabilityFlagsKHR flags; -} VkVideoDecodeCapabilitiesKHR; - -typedef struct VkVideoDecodeUsageInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoDecodeUsageFlagsKHR videoUsageHints; -} VkVideoDecodeUsageInfoKHR; - -typedef struct VkVideoDecodeInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoDecodeFlagsKHR flags; - VkBuffer srcBuffer; - VkDeviceSize srcBufferOffset; - VkDeviceSize srcBufferRange; - VkVideoPictureResourceInfoKHR dstPictureResource; - const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot; - uint32_t referenceSlotCount; - const VkVideoReferenceSlotInfoKHR* pReferenceSlots; -} VkVideoDecodeInfoKHR; - -typedef void (VKAPI_PTR *PFN_vkCmdDecodeVideoKHR)(VkCommandBuffer commandBuffer, const VkVideoDecodeInfoKHR* pDecodeInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdDecodeVideoKHR( - VkCommandBuffer commandBuffer, - const VkVideoDecodeInfoKHR* pDecodeInfo); -#endif - - +// VK_KHR_portability_subset is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_portability_subset 1 #define VK_KHR_PORTABILITY_SUBSET_SPEC_VERSION 1 #define VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME "VK_KHR_portability_subset" @@ -400,8 +51,9 @@ typedef struct VkPhysicalDevicePortabilitySubsetPropertiesKHR { +// VK_KHR_video_encode_queue is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_video_encode_queue 1 -#define VK_KHR_VIDEO_ENCODE_QUEUE_SPEC_VERSION 7 +#define VK_KHR_VIDEO_ENCODE_QUEUE_SPEC_VERSION 10 #define VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME "VK_KHR_video_encode_queue" typedef enum VkVideoEncodeTuningModeKHR { @@ -416,18 +68,28 @@ typedef VkFlags VkVideoEncodeFlagsKHR; typedef enum VkVideoEncodeCapabilityFlagBitsKHR { VK_VIDEO_ENCODE_CAPABILITY_PRECEDING_EXTERNALLY_ENCODED_BYTES_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_CAPABILITY_INSUFFICIENT_BITSTREAM_BUFFER_RANGE_DETECTION_BIT_KHR = 0x00000002, VK_VIDEO_ENCODE_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkVideoEncodeCapabilityFlagBitsKHR; typedef VkFlags VkVideoEncodeCapabilityFlagsKHR; typedef enum VkVideoEncodeRateControlModeFlagBitsKHR { - VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR = 0, - VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR = 1, - VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR = 2, + VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR = 0, + VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR = 0x00000004, VK_VIDEO_ENCODE_RATE_CONTROL_MODE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkVideoEncodeRateControlModeFlagBitsKHR; typedef VkFlags VkVideoEncodeRateControlModeFlagsKHR; +typedef enum VkVideoEncodeFeedbackFlagBitsKHR { + VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_HAS_OVERRIDES_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_FEEDBACK_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeFeedbackFlagBitsKHR; +typedef VkFlags VkVideoEncodeFeedbackFlagsKHR; + typedef enum VkVideoEncodeUsageFlagBitsKHR { VK_VIDEO_ENCODE_USAGE_DEFAULT_KHR = 0, VK_VIDEO_ENCODE_USAGE_TRANSCODING_BIT_KHR = 0x00000001, @@ -451,10 +113,9 @@ typedef struct VkVideoEncodeInfoKHR { VkStructureType sType; const void* pNext; VkVideoEncodeFlagsKHR flags; - uint32_t qualityLevel; - VkBuffer dstBitstreamBuffer; - VkDeviceSize dstBitstreamBufferOffset; - VkDeviceSize dstBitstreamBufferMaxRange; + VkBuffer dstBuffer; + VkDeviceSize dstBufferOffset; + VkDeviceSize dstBufferRange; VkVideoPictureResourceInfoKHR srcPictureResource; const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot; uint32_t referenceSlotCount; @@ -467,11 +128,19 @@ typedef struct VkVideoEncodeCapabilitiesKHR { void* pNext; VkVideoEncodeCapabilityFlagsKHR flags; VkVideoEncodeRateControlModeFlagsKHR rateControlModes; - uint8_t rateControlLayerCount; - uint8_t qualityLevelCount; - VkExtent2D inputImageDataFillAlignment; + uint32_t maxRateControlLayers; + uint64_t maxBitrate; + uint32_t maxQualityLevels; + VkExtent2D encodeInputPictureGranularity; + VkVideoEncodeFeedbackFlagsKHR supportedEncodeFeedbackFlags; } VkVideoEncodeCapabilitiesKHR; +typedef struct VkQueryPoolVideoEncodeFeedbackCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoEncodeFeedbackFlagsKHR encodeFeedbackFlags; +} VkQueryPoolVideoEncodeFeedbackCreateInfoKHR; + typedef struct VkVideoEncodeUsageInfoKHR { VkStructureType sType; const void* pNext; @@ -483,12 +152,10 @@ typedef struct VkVideoEncodeUsageInfoKHR { typedef struct VkVideoEncodeRateControlLayerInfoKHR { VkStructureType sType; const void* pNext; - uint32_t averageBitrate; - uint32_t maxBitrate; + uint64_t averageBitrate; + uint64_t maxBitrate; uint32_t frameRateNumerator; uint32_t frameRateDenominator; - uint32_t virtualBufferSizeInMs; - uint32_t initialVirtualBufferSizeInMs; } VkVideoEncodeRateControlLayerInfoKHR; typedef struct VkVideoEncodeRateControlInfoKHR { @@ -496,93 +163,167 @@ typedef struct VkVideoEncodeRateControlInfoKHR { const void* pNext; VkVideoEncodeRateControlFlagsKHR flags; VkVideoEncodeRateControlModeFlagBitsKHR rateControlMode; - uint8_t layerCount; - const VkVideoEncodeRateControlLayerInfoKHR* pLayerConfigs; + uint32_t layerCount; + const VkVideoEncodeRateControlLayerInfoKHR* pLayers; + uint32_t virtualBufferSizeInMs; + uint32_t initialVirtualBufferSizeInMs; } VkVideoEncodeRateControlInfoKHR; +typedef struct VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR { + VkStructureType sType; + const void* pNext; + const VkVideoProfileInfoKHR* pVideoProfile; + uint32_t qualityLevel; +} VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR; + +typedef struct VkVideoEncodeQualityLevelPropertiesKHR { + VkStructureType sType; + void* pNext; + VkVideoEncodeRateControlModeFlagBitsKHR preferredRateControlMode; + uint32_t preferredRateControlLayerCount; +} VkVideoEncodeQualityLevelPropertiesKHR; + +typedef struct VkVideoEncodeQualityLevelInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t qualityLevel; +} VkVideoEncodeQualityLevelInfoKHR; + +typedef struct VkVideoEncodeSessionParametersGetInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoSessionParametersKHR videoSessionParameters; +} VkVideoEncodeSessionParametersGetInfoKHR; + +typedef struct VkVideoEncodeSessionParametersFeedbackInfoKHR { + VkStructureType sType; + void* pNext; + VkBool32 hasOverrides; +} VkVideoEncodeSessionParametersFeedbackInfoKHR; + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR* pQualityLevelInfo, VkVideoEncodeQualityLevelPropertiesKHR* pQualityLevelProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetEncodedVideoSessionParametersKHR)(VkDevice device, const VkVideoEncodeSessionParametersGetInfoKHR* pVideoSessionParametersInfo, VkVideoEncodeSessionParametersFeedbackInfoKHR* pFeedbackInfo, size_t* pDataSize, void* pData); typedef void (VKAPI_PTR *PFN_vkCmdEncodeVideoKHR)(VkCommandBuffer commandBuffer, const VkVideoEncodeInfoKHR* pEncodeInfo); #ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR* pQualityLevelInfo, + VkVideoEncodeQualityLevelPropertiesKHR* pQualityLevelProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetEncodedVideoSessionParametersKHR( + VkDevice device, + const VkVideoEncodeSessionParametersGetInfoKHR* pVideoSessionParametersInfo, + VkVideoEncodeSessionParametersFeedbackInfoKHR* pFeedbackInfo, + size_t* pDataSize, + void* pData); + VKAPI_ATTR void VKAPI_CALL vkCmdEncodeVideoKHR( VkCommandBuffer commandBuffer, const VkVideoEncodeInfoKHR* pEncodeInfo); #endif +// VK_EXT_video_encode_h264 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_video_encode_h264 1 #include "vk_video/vulkan_video_codec_h264std.h" #include "vk_video/vulkan_video_codec_h264std_encode.h" -#define VK_EXT_VIDEO_ENCODE_H264_SPEC_VERSION 9 +#define VK_EXT_VIDEO_ENCODE_H264_SPEC_VERSION 12 #define VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME "VK_EXT_video_encode_h264" -typedef enum VkVideoEncodeH264RateControlStructureEXT { - VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT = 0, - VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_FLAT_EXT = 1, - VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_DYADIC_EXT = 2, - VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH264RateControlStructureEXT; - typedef enum VkVideoEncodeH264CapabilityFlagBitsEXT { - VK_VIDEO_ENCODE_H264_CAPABILITY_DIRECT_8X8_INFERENCE_ENABLED_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H264_CAPABILITY_DIRECT_8X8_INFERENCE_DISABLED_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H264_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H264_CAPABILITY_QPPRIME_Y_ZERO_TRANSFORM_BYPASS_BIT_EXT = 0x00000008, - VK_VIDEO_ENCODE_H264_CAPABILITY_SCALING_LISTS_BIT_EXT = 0x00000010, - VK_VIDEO_ENCODE_H264_CAPABILITY_HRD_COMPLIANCE_BIT_EXT = 0x00000020, - VK_VIDEO_ENCODE_H264_CAPABILITY_CHROMA_QP_OFFSET_BIT_EXT = 0x00000040, - VK_VIDEO_ENCODE_H264_CAPABILITY_SECOND_CHROMA_QP_OFFSET_BIT_EXT = 0x00000080, - VK_VIDEO_ENCODE_H264_CAPABILITY_PIC_INIT_QP_MINUS26_BIT_EXT = 0x00000100, - VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_PRED_BIT_EXT = 0x00000200, - VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BIPRED_EXPLICIT_BIT_EXT = 0x00000400, - VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BIPRED_IMPLICIT_BIT_EXT = 0x00000800, - VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_PRED_NO_TABLE_BIT_EXT = 0x00001000, - VK_VIDEO_ENCODE_H264_CAPABILITY_TRANSFORM_8X8_BIT_EXT = 0x00002000, - VK_VIDEO_ENCODE_H264_CAPABILITY_CABAC_BIT_EXT = 0x00004000, - VK_VIDEO_ENCODE_H264_CAPABILITY_CAVLC_BIT_EXT = 0x00008000, - VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_DISABLED_BIT_EXT = 0x00010000, - VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_ENABLED_BIT_EXT = 0x00020000, - VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_PARTIAL_BIT_EXT = 0x00040000, - VK_VIDEO_ENCODE_H264_CAPABILITY_DISABLE_DIRECT_SPATIAL_MV_PRED_BIT_EXT = 0x00080000, - VK_VIDEO_ENCODE_H264_CAPABILITY_MULTIPLE_SLICE_PER_FRAME_BIT_EXT = 0x00100000, - VK_VIDEO_ENCODE_H264_CAPABILITY_SLICE_MB_COUNT_BIT_EXT = 0x00200000, - VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_EXT = 0x00400000, - VK_VIDEO_ENCODE_H264_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT = 0x00800000, - VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT = 0x01000000, + VK_VIDEO_ENCODE_H264_CAPABILITY_HRD_COMPLIANCE_BIT_EXT = 0x00000001, + VK_VIDEO_ENCODE_H264_CAPABILITY_PREDICTION_WEIGHT_TABLE_GENERATED_BIT_EXT = 0x00000002, + VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_EXT = 0x00000004, + VK_VIDEO_ENCODE_H264_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT = 0x00000008, + VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L0_LIST_BIT_EXT = 0x00000010, + VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT = 0x00000020, + VK_VIDEO_ENCODE_H264_CAPABILITY_PER_PICTURE_TYPE_MIN_MAX_QP_BIT_EXT = 0x00000040, + VK_VIDEO_ENCODE_H264_CAPABILITY_PER_SLICE_CONSTANT_QP_BIT_EXT = 0x00000080, + VK_VIDEO_ENCODE_H264_CAPABILITY_GENERATE_PREFIX_NALU_BIT_EXT = 0x00000100, VK_VIDEO_ENCODE_H264_CAPABILITY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF } VkVideoEncodeH264CapabilityFlagBitsEXT; typedef VkFlags VkVideoEncodeH264CapabilityFlagsEXT; -typedef enum VkVideoEncodeH264InputModeFlagBitsEXT { - VK_VIDEO_ENCODE_H264_INPUT_MODE_FRAME_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H264_INPUT_MODE_SLICE_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H264_INPUT_MODE_NON_VCL_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H264_INPUT_MODE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH264InputModeFlagBitsEXT; -typedef VkFlags VkVideoEncodeH264InputModeFlagsEXT; - -typedef enum VkVideoEncodeH264OutputModeFlagBitsEXT { - VK_VIDEO_ENCODE_H264_OUTPUT_MODE_FRAME_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H264_OUTPUT_MODE_SLICE_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H264_OUTPUT_MODE_NON_VCL_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H264_OUTPUT_MODE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH264OutputModeFlagBitsEXT; -typedef VkFlags VkVideoEncodeH264OutputModeFlagsEXT; +typedef enum VkVideoEncodeH264StdFlagBitsEXT { + VK_VIDEO_ENCODE_H264_STD_SEPARATE_COLOR_PLANE_FLAG_SET_BIT_EXT = 0x00000001, + VK_VIDEO_ENCODE_H264_STD_QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG_SET_BIT_EXT = 0x00000002, + VK_VIDEO_ENCODE_H264_STD_SCALING_MATRIX_PRESENT_FLAG_SET_BIT_EXT = 0x00000004, + VK_VIDEO_ENCODE_H264_STD_CHROMA_QP_INDEX_OFFSET_BIT_EXT = 0x00000008, + VK_VIDEO_ENCODE_H264_STD_SECOND_CHROMA_QP_INDEX_OFFSET_BIT_EXT = 0x00000010, + VK_VIDEO_ENCODE_H264_STD_PIC_INIT_QP_MINUS26_BIT_EXT = 0x00000020, + VK_VIDEO_ENCODE_H264_STD_WEIGHTED_PRED_FLAG_SET_BIT_EXT = 0x00000040, + VK_VIDEO_ENCODE_H264_STD_WEIGHTED_BIPRED_IDC_EXPLICIT_BIT_EXT = 0x00000080, + VK_VIDEO_ENCODE_H264_STD_WEIGHTED_BIPRED_IDC_IMPLICIT_BIT_EXT = 0x00000100, + VK_VIDEO_ENCODE_H264_STD_TRANSFORM_8X8_MODE_FLAG_SET_BIT_EXT = 0x00000200, + VK_VIDEO_ENCODE_H264_STD_DIRECT_SPATIAL_MV_PRED_FLAG_UNSET_BIT_EXT = 0x00000400, + VK_VIDEO_ENCODE_H264_STD_ENTROPY_CODING_MODE_FLAG_UNSET_BIT_EXT = 0x00000800, + VK_VIDEO_ENCODE_H264_STD_ENTROPY_CODING_MODE_FLAG_SET_BIT_EXT = 0x00001000, + VK_VIDEO_ENCODE_H264_STD_DIRECT_8X8_INFERENCE_FLAG_UNSET_BIT_EXT = 0x00002000, + VK_VIDEO_ENCODE_H264_STD_CONSTRAINED_INTRA_PRED_FLAG_SET_BIT_EXT = 0x00004000, + VK_VIDEO_ENCODE_H264_STD_DEBLOCKING_FILTER_DISABLED_BIT_EXT = 0x00008000, + VK_VIDEO_ENCODE_H264_STD_DEBLOCKING_FILTER_ENABLED_BIT_EXT = 0x00010000, + VK_VIDEO_ENCODE_H264_STD_DEBLOCKING_FILTER_PARTIAL_BIT_EXT = 0x00020000, + VK_VIDEO_ENCODE_H264_STD_SLICE_QP_DELTA_BIT_EXT = 0x00080000, + VK_VIDEO_ENCODE_H264_STD_DIFFERENT_SLICE_QP_DELTA_BIT_EXT = 0x00100000, + VK_VIDEO_ENCODE_H264_STD_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkVideoEncodeH264StdFlagBitsEXT; +typedef VkFlags VkVideoEncodeH264StdFlagsEXT; + +typedef enum VkVideoEncodeH264RateControlFlagBitsEXT { + VK_VIDEO_ENCODE_H264_RATE_CONTROL_ATTEMPT_HRD_COMPLIANCE_BIT_EXT = 0x00000001, + VK_VIDEO_ENCODE_H264_RATE_CONTROL_REGULAR_GOP_BIT_EXT = 0x00000002, + VK_VIDEO_ENCODE_H264_RATE_CONTROL_REFERENCE_PATTERN_FLAT_BIT_EXT = 0x00000004, + VK_VIDEO_ENCODE_H264_RATE_CONTROL_REFERENCE_PATTERN_DYADIC_BIT_EXT = 0x00000008, + VK_VIDEO_ENCODE_H264_RATE_CONTROL_TEMPORAL_LAYER_PATTERN_DYADIC_BIT_EXT = 0x00000010, + VK_VIDEO_ENCODE_H264_RATE_CONTROL_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkVideoEncodeH264RateControlFlagBitsEXT; +typedef VkFlags VkVideoEncodeH264RateControlFlagsEXT; typedef struct VkVideoEncodeH264CapabilitiesEXT { VkStructureType sType; void* pNext; VkVideoEncodeH264CapabilityFlagsEXT flags; - VkVideoEncodeH264InputModeFlagsEXT inputModeFlags; - VkVideoEncodeH264OutputModeFlagsEXT outputModeFlags; - uint8_t maxPPictureL0ReferenceCount; - uint8_t maxBPictureL0ReferenceCount; - uint8_t maxL1ReferenceCount; - VkBool32 motionVectorsOverPicBoundariesFlag; - uint32_t maxBytesPerPicDenom; - uint32_t maxBitsPerMbDenom; - uint32_t log2MaxMvLengthHorizontal; - uint32_t log2MaxMvLengthVertical; + StdVideoH264LevelIdc maxLevelIdc; + uint32_t maxSliceCount; + uint32_t maxPPictureL0ReferenceCount; + uint32_t maxBPictureL0ReferenceCount; + uint32_t maxL1ReferenceCount; + uint32_t maxTemporalLayerCount; + VkBool32 expectDyadicTemporalLayerPattern; + int32_t minQp; + int32_t maxQp; + VkBool32 prefersGopRemainingFrames; + VkBool32 requiresGopRemainingFrames; + VkVideoEncodeH264StdFlagsEXT stdSyntaxFlags; } VkVideoEncodeH264CapabilitiesEXT; +typedef struct VkVideoEncodeH264QpEXT { + int32_t qpI; + int32_t qpP; + int32_t qpB; +} VkVideoEncodeH264QpEXT; + +typedef struct VkVideoEncodeH264QualityLevelPropertiesEXT { + VkStructureType sType; + void* pNext; + VkVideoEncodeH264RateControlFlagsEXT preferredRateControlFlags; + uint32_t preferredGopFrameCount; + uint32_t preferredIdrPeriod; + uint32_t preferredConsecutiveBFrameCount; + uint32_t preferredTemporalLayerCount; + VkVideoEncodeH264QpEXT preferredConstantQp; + uint32_t preferredMaxL0ReferenceCount; + uint32_t preferredMaxL1ReferenceCount; + VkBool32 preferredStdEntropyCodingModeFlag; +} VkVideoEncodeH264QualityLevelPropertiesEXT; + +typedef struct VkVideoEncodeH264SessionCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 useMaxLevelIdc; + StdVideoH264LevelIdc maxLevelIdc; +} VkVideoEncodeH264SessionCreateInfoEXT; + typedef struct VkVideoEncodeH264SessionParametersAddInfoEXT { VkStructureType sType; const void* pNext; @@ -600,48 +341,43 @@ typedef struct VkVideoEncodeH264SessionParametersCreateInfoEXT { const VkVideoEncodeH264SessionParametersAddInfoEXT* pParametersAddInfo; } VkVideoEncodeH264SessionParametersCreateInfoEXT; -typedef struct VkVideoEncodeH264DpbSlotInfoEXT { - VkStructureType sType; - const void* pNext; - int8_t slotIndex; - const StdVideoEncodeH264ReferenceInfo* pStdReferenceInfo; -} VkVideoEncodeH264DpbSlotInfoEXT; +typedef struct VkVideoEncodeH264SessionParametersGetInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 writeStdSPS; + VkBool32 writeStdPPS; + uint32_t stdSPSId; + uint32_t stdPPSId; +} VkVideoEncodeH264SessionParametersGetInfoEXT; -typedef struct VkVideoEncodeH264ReferenceListsInfoEXT { - VkStructureType sType; - const void* pNext; - uint8_t referenceList0EntryCount; - const VkVideoEncodeH264DpbSlotInfoEXT* pReferenceList0Entries; - uint8_t referenceList1EntryCount; - const VkVideoEncodeH264DpbSlotInfoEXT* pReferenceList1Entries; - const StdVideoEncodeH264RefMemMgmtCtrlOperations* pMemMgmtCtrlOperations; -} VkVideoEncodeH264ReferenceListsInfoEXT; +typedef struct VkVideoEncodeH264SessionParametersFeedbackInfoEXT { + VkStructureType sType; + void* pNext; + VkBool32 hasStdSPSOverrides; + VkBool32 hasStdPPSOverrides; +} VkVideoEncodeH264SessionParametersFeedbackInfoEXT; typedef struct VkVideoEncodeH264NaluSliceInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t mbCount; - const VkVideoEncodeH264ReferenceListsInfoEXT* pReferenceFinalLists; - const StdVideoEncodeH264SliceHeader* pSliceHeaderStd; + VkStructureType sType; + const void* pNext; + int32_t constantQp; + const StdVideoEncodeH264SliceHeader* pStdSliceHeader; } VkVideoEncodeH264NaluSliceInfoEXT; -typedef struct VkVideoEncodeH264VclFrameInfoEXT { - VkStructureType sType; - const void* pNext; - const VkVideoEncodeH264ReferenceListsInfoEXT* pReferenceFinalLists; - uint32_t naluSliceEntryCount; - const VkVideoEncodeH264NaluSliceInfoEXT* pNaluSliceEntries; - const StdVideoEncodeH264PictureInfo* pCurrentPictureInfo; -} VkVideoEncodeH264VclFrameInfoEXT; +typedef struct VkVideoEncodeH264PictureInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t naluSliceEntryCount; + const VkVideoEncodeH264NaluSliceInfoEXT* pNaluSliceEntries; + const StdVideoEncodeH264PictureInfo* pStdPictureInfo; + VkBool32 generatePrefixNalu; +} VkVideoEncodeH264PictureInfoEXT; -typedef struct VkVideoEncodeH264EmitPictureParametersInfoEXT { - VkStructureType sType; - const void* pNext; - uint8_t spsId; - VkBool32 emitSpsEnable; - uint32_t ppsIdEntryCount; - const uint8_t* ppsIdEntries; -} VkVideoEncodeH264EmitPictureParametersInfoEXT; +typedef struct VkVideoEncodeH264DpbSlotInfoEXT { + VkStructureType sType; + const void* pNext; + const StdVideoEncodeH264ReferenceInfo* pStdReferenceInfo; +} VkVideoEncodeH264DpbSlotInfoEXT; typedef struct VkVideoEncodeH264ProfileInfoEXT { VkStructureType sType; @@ -650,21 +386,15 @@ typedef struct VkVideoEncodeH264ProfileInfoEXT { } VkVideoEncodeH264ProfileInfoEXT; typedef struct VkVideoEncodeH264RateControlInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t gopFrameCount; - uint32_t idrPeriod; - uint32_t consecutiveBFrameCount; - VkVideoEncodeH264RateControlStructureEXT rateControlStructure; - uint8_t temporalLayerCount; + VkStructureType sType; + const void* pNext; + VkVideoEncodeH264RateControlFlagsEXT flags; + uint32_t gopFrameCount; + uint32_t idrPeriod; + uint32_t consecutiveBFrameCount; + uint32_t temporalLayerCount; } VkVideoEncodeH264RateControlInfoEXT; -typedef struct VkVideoEncodeH264QpEXT { - int32_t qpI; - int32_t qpP; - int32_t qpB; -} VkVideoEncodeH264QpEXT; - typedef struct VkVideoEncodeH264FrameSizeEXT { uint32_t frameISize; uint32_t framePSize; @@ -674,9 +404,6 @@ typedef struct VkVideoEncodeH264FrameSizeEXT { typedef struct VkVideoEncodeH264RateControlLayerInfoEXT { VkStructureType sType; const void* pNext; - uint8_t temporalLayerId; - VkBool32 useInitialRcQp; - VkVideoEncodeH264QpEXT initialRcQp; VkBool32 useMinQp; VkVideoEncodeH264QpEXT minQp; VkBool32 useMaxQp; @@ -685,67 +412,64 @@ typedef struct VkVideoEncodeH264RateControlLayerInfoEXT { VkVideoEncodeH264FrameSizeEXT maxFrameSize; } VkVideoEncodeH264RateControlLayerInfoEXT; +typedef struct VkVideoEncodeH264GopRemainingFrameInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 useGopRemainingFrames; + uint32_t gopRemainingI; + uint32_t gopRemainingP; + uint32_t gopRemainingB; +} VkVideoEncodeH264GopRemainingFrameInfoEXT; + +// VK_EXT_video_encode_h265 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_video_encode_h265 1 #include "vk_video/vulkan_video_codec_h265std.h" #include "vk_video/vulkan_video_codec_h265std_encode.h" -#define VK_EXT_VIDEO_ENCODE_H265_SPEC_VERSION 9 +#define VK_EXT_VIDEO_ENCODE_H265_SPEC_VERSION 12 #define VK_EXT_VIDEO_ENCODE_H265_EXTENSION_NAME "VK_EXT_video_encode_h265" -typedef enum VkVideoEncodeH265RateControlStructureEXT { - VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT = 0, - VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_FLAT_EXT = 1, - VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_DYADIC_EXT = 2, - VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH265RateControlStructureEXT; - typedef enum VkVideoEncodeH265CapabilityFlagBitsEXT { - VK_VIDEO_ENCODE_H265_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H265_CAPABILITY_SCALING_LISTS_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H265_CAPABILITY_SAMPLE_ADAPTIVE_OFFSET_ENABLED_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H265_CAPABILITY_PCM_ENABLE_BIT_EXT = 0x00000008, - VK_VIDEO_ENCODE_H265_CAPABILITY_SPS_TEMPORAL_MVP_ENABLED_BIT_EXT = 0x00000010, - VK_VIDEO_ENCODE_H265_CAPABILITY_HRD_COMPLIANCE_BIT_EXT = 0x00000020, - VK_VIDEO_ENCODE_H265_CAPABILITY_INIT_QP_MINUS26_BIT_EXT = 0x00000040, - VK_VIDEO_ENCODE_H265_CAPABILITY_LOG2_PARALLEL_MERGE_LEVEL_MINUS2_BIT_EXT = 0x00000080, - VK_VIDEO_ENCODE_H265_CAPABILITY_SIGN_DATA_HIDING_ENABLED_BIT_EXT = 0x00000100, - VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_ENABLED_BIT_EXT = 0x00000200, - VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_DISABLED_BIT_EXT = 0x00000400, - VK_VIDEO_ENCODE_H265_CAPABILITY_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT_BIT_EXT = 0x00000800, - VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_PRED_BIT_EXT = 0x00001000, - VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_BIPRED_BIT_EXT = 0x00002000, - VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_PRED_NO_TABLE_BIT_EXT = 0x00004000, - VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSQUANT_BYPASS_ENABLED_BIT_EXT = 0x00008000, - VK_VIDEO_ENCODE_H265_CAPABILITY_ENTROPY_CODING_SYNC_ENABLED_BIT_EXT = 0x00010000, - VK_VIDEO_ENCODE_H265_CAPABILITY_DEBLOCKING_FILTER_OVERRIDE_ENABLED_BIT_EXT = 0x00020000, - VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILE_PER_FRAME_BIT_EXT = 0x00040000, - VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_SLICE_PER_TILE_BIT_EXT = 0x00080000, - VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILE_PER_SLICE_BIT_EXT = 0x00100000, - VK_VIDEO_ENCODE_H265_CAPABILITY_SLICE_SEGMENT_CTB_COUNT_BIT_EXT = 0x00200000, - VK_VIDEO_ENCODE_H265_CAPABILITY_ROW_UNALIGNED_SLICE_SEGMENT_BIT_EXT = 0x00400000, - VK_VIDEO_ENCODE_H265_CAPABILITY_DEPENDENT_SLICE_SEGMENT_BIT_EXT = 0x00800000, - VK_VIDEO_ENCODE_H265_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT = 0x01000000, - VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT = 0x02000000, + VK_VIDEO_ENCODE_H265_CAPABILITY_HRD_COMPLIANCE_BIT_EXT = 0x00000001, + VK_VIDEO_ENCODE_H265_CAPABILITY_PREDICTION_WEIGHT_TABLE_GENERATED_BIT_EXT = 0x00000002, + VK_VIDEO_ENCODE_H265_CAPABILITY_ROW_UNALIGNED_SLICE_SEGMENT_BIT_EXT = 0x00000004, + VK_VIDEO_ENCODE_H265_CAPABILITY_DIFFERENT_SLICE_SEGMENT_TYPE_BIT_EXT = 0x00000008, + VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L0_LIST_BIT_EXT = 0x00000010, + VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT = 0x00000020, + VK_VIDEO_ENCODE_H265_CAPABILITY_PER_PICTURE_TYPE_MIN_MAX_QP_BIT_EXT = 0x00000040, + VK_VIDEO_ENCODE_H265_CAPABILITY_PER_SLICE_SEGMENT_CONSTANT_QP_BIT_EXT = 0x00000080, + VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILES_PER_SLICE_SEGMENT_BIT_EXT = 0x00000100, + VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_SLICE_SEGMENTS_PER_TILE_BIT_EXT = 0x00000200, VK_VIDEO_ENCODE_H265_CAPABILITY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF } VkVideoEncodeH265CapabilityFlagBitsEXT; typedef VkFlags VkVideoEncodeH265CapabilityFlagsEXT; -typedef enum VkVideoEncodeH265InputModeFlagBitsEXT { - VK_VIDEO_ENCODE_H265_INPUT_MODE_FRAME_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H265_INPUT_MODE_SLICE_SEGMENT_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H265_INPUT_MODE_NON_VCL_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H265_INPUT_MODE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH265InputModeFlagBitsEXT; -typedef VkFlags VkVideoEncodeH265InputModeFlagsEXT; - -typedef enum VkVideoEncodeH265OutputModeFlagBitsEXT { - VK_VIDEO_ENCODE_H265_OUTPUT_MODE_FRAME_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H265_OUTPUT_MODE_SLICE_SEGMENT_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H265_OUTPUT_MODE_NON_VCL_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H265_OUTPUT_MODE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH265OutputModeFlagBitsEXT; -typedef VkFlags VkVideoEncodeH265OutputModeFlagsEXT; +typedef enum VkVideoEncodeH265StdFlagBitsEXT { + VK_VIDEO_ENCODE_H265_STD_SEPARATE_COLOR_PLANE_FLAG_SET_BIT_EXT = 0x00000001, + VK_VIDEO_ENCODE_H265_STD_SAMPLE_ADAPTIVE_OFFSET_ENABLED_FLAG_SET_BIT_EXT = 0x00000002, + VK_VIDEO_ENCODE_H265_STD_SCALING_LIST_DATA_PRESENT_FLAG_SET_BIT_EXT = 0x00000004, + VK_VIDEO_ENCODE_H265_STD_PCM_ENABLED_FLAG_SET_BIT_EXT = 0x00000008, + VK_VIDEO_ENCODE_H265_STD_SPS_TEMPORAL_MVP_ENABLED_FLAG_SET_BIT_EXT = 0x00000010, + VK_VIDEO_ENCODE_H265_STD_INIT_QP_MINUS26_BIT_EXT = 0x00000020, + VK_VIDEO_ENCODE_H265_STD_WEIGHTED_PRED_FLAG_SET_BIT_EXT = 0x00000040, + VK_VIDEO_ENCODE_H265_STD_WEIGHTED_BIPRED_FLAG_SET_BIT_EXT = 0x00000080, + VK_VIDEO_ENCODE_H265_STD_LOG2_PARALLEL_MERGE_LEVEL_MINUS2_BIT_EXT = 0x00000100, + VK_VIDEO_ENCODE_H265_STD_SIGN_DATA_HIDING_ENABLED_FLAG_SET_BIT_EXT = 0x00000200, + VK_VIDEO_ENCODE_H265_STD_TRANSFORM_SKIP_ENABLED_FLAG_SET_BIT_EXT = 0x00000400, + VK_VIDEO_ENCODE_H265_STD_TRANSFORM_SKIP_ENABLED_FLAG_UNSET_BIT_EXT = 0x00000800, + VK_VIDEO_ENCODE_H265_STD_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT_FLAG_SET_BIT_EXT = 0x00001000, + VK_VIDEO_ENCODE_H265_STD_TRANSQUANT_BYPASS_ENABLED_FLAG_SET_BIT_EXT = 0x00002000, + VK_VIDEO_ENCODE_H265_STD_CONSTRAINED_INTRA_PRED_FLAG_SET_BIT_EXT = 0x00004000, + VK_VIDEO_ENCODE_H265_STD_ENTROPY_CODING_SYNC_ENABLED_FLAG_SET_BIT_EXT = 0x00008000, + VK_VIDEO_ENCODE_H265_STD_DEBLOCKING_FILTER_OVERRIDE_ENABLED_FLAG_SET_BIT_EXT = 0x00010000, + VK_VIDEO_ENCODE_H265_STD_DEPENDENT_SLICE_SEGMENTS_ENABLED_FLAG_SET_BIT_EXT = 0x00020000, + VK_VIDEO_ENCODE_H265_STD_DEPENDENT_SLICE_SEGMENT_FLAG_SET_BIT_EXT = 0x00040000, + VK_VIDEO_ENCODE_H265_STD_SLICE_QP_DELTA_BIT_EXT = 0x00080000, + VK_VIDEO_ENCODE_H265_STD_DIFFERENT_SLICE_QP_DELTA_BIT_EXT = 0x00100000, + VK_VIDEO_ENCODE_H265_STD_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkVideoEncodeH265StdFlagBitsEXT; +typedef VkFlags VkVideoEncodeH265StdFlagsEXT; typedef enum VkVideoEncodeH265CtbSizeFlagBitsEXT { VK_VIDEO_ENCODE_H265_CTB_SIZE_16_BIT_EXT = 0x00000001, @@ -763,31 +487,63 @@ typedef enum VkVideoEncodeH265TransformBlockSizeFlagBitsEXT { VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF } VkVideoEncodeH265TransformBlockSizeFlagBitsEXT; typedef VkFlags VkVideoEncodeH265TransformBlockSizeFlagsEXT; + +typedef enum VkVideoEncodeH265RateControlFlagBitsEXT { + VK_VIDEO_ENCODE_H265_RATE_CONTROL_ATTEMPT_HRD_COMPLIANCE_BIT_EXT = 0x00000001, + VK_VIDEO_ENCODE_H265_RATE_CONTROL_REGULAR_GOP_BIT_EXT = 0x00000002, + VK_VIDEO_ENCODE_H265_RATE_CONTROL_REFERENCE_PATTERN_FLAT_BIT_EXT = 0x00000004, + VK_VIDEO_ENCODE_H265_RATE_CONTROL_REFERENCE_PATTERN_DYADIC_BIT_EXT = 0x00000008, + VK_VIDEO_ENCODE_H265_RATE_CONTROL_TEMPORAL_SUB_LAYER_PATTERN_DYADIC_BIT_EXT = 0x00000010, + VK_VIDEO_ENCODE_H265_RATE_CONTROL_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkVideoEncodeH265RateControlFlagBitsEXT; +typedef VkFlags VkVideoEncodeH265RateControlFlagsEXT; typedef struct VkVideoEncodeH265CapabilitiesEXT { VkStructureType sType; void* pNext; VkVideoEncodeH265CapabilityFlagsEXT flags; - VkVideoEncodeH265InputModeFlagsEXT inputModeFlags; - VkVideoEncodeH265OutputModeFlagsEXT outputModeFlags; + StdVideoH265LevelIdc maxLevelIdc; + uint32_t maxSliceSegmentCount; + VkExtent2D maxTiles; VkVideoEncodeH265CtbSizeFlagsEXT ctbSizes; VkVideoEncodeH265TransformBlockSizeFlagsEXT transformBlockSizes; - uint8_t maxPPictureL0ReferenceCount; - uint8_t maxBPictureL0ReferenceCount; - uint8_t maxL1ReferenceCount; - uint8_t maxSubLayersCount; - uint8_t minLog2MinLumaCodingBlockSizeMinus3; - uint8_t maxLog2MinLumaCodingBlockSizeMinus3; - uint8_t minLog2MinLumaTransformBlockSizeMinus2; - uint8_t maxLog2MinLumaTransformBlockSizeMinus2; - uint8_t minMaxTransformHierarchyDepthInter; - uint8_t maxMaxTransformHierarchyDepthInter; - uint8_t minMaxTransformHierarchyDepthIntra; - uint8_t maxMaxTransformHierarchyDepthIntra; - uint8_t maxDiffCuQpDeltaDepth; - uint8_t minMaxNumMergeCand; - uint8_t maxMaxNumMergeCand; + uint32_t maxPPictureL0ReferenceCount; + uint32_t maxBPictureL0ReferenceCount; + uint32_t maxL1ReferenceCount; + uint32_t maxSubLayerCount; + VkBool32 expectDyadicTemporalSubLayerPattern; + int32_t minQp; + int32_t maxQp; + VkBool32 prefersGopRemainingFrames; + VkBool32 requiresGopRemainingFrames; + VkVideoEncodeH265StdFlagsEXT stdSyntaxFlags; } VkVideoEncodeH265CapabilitiesEXT; +typedef struct VkVideoEncodeH265SessionCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 useMaxLevelIdc; + StdVideoH265LevelIdc maxLevelIdc; +} VkVideoEncodeH265SessionCreateInfoEXT; + +typedef struct VkVideoEncodeH265QpEXT { + int32_t qpI; + int32_t qpP; + int32_t qpB; +} VkVideoEncodeH265QpEXT; + +typedef struct VkVideoEncodeH265QualityLevelPropertiesEXT { + VkStructureType sType; + void* pNext; + VkVideoEncodeH265RateControlFlagsEXT preferredRateControlFlags; + uint32_t preferredGopFrameCount; + uint32_t preferredIdrPeriod; + uint32_t preferredConsecutiveBFrameCount; + uint32_t preferredSubLayerCount; + VkVideoEncodeH265QpEXT preferredConstantQp; + uint32_t preferredMaxL0ReferenceCount; + uint32_t preferredMaxL1ReferenceCount; +} VkVideoEncodeH265QualityLevelPropertiesEXT; + typedef struct VkVideoEncodeH265SessionParametersAddInfoEXT { VkStructureType sType; const void* pNext; @@ -808,50 +564,45 @@ typedef struct VkVideoEncodeH265SessionParametersCreateInfoEXT { const VkVideoEncodeH265SessionParametersAddInfoEXT* pParametersAddInfo; } VkVideoEncodeH265SessionParametersCreateInfoEXT; -typedef struct VkVideoEncodeH265DpbSlotInfoEXT { - VkStructureType sType; - const void* pNext; - int8_t slotIndex; - const StdVideoEncodeH265ReferenceInfo* pStdReferenceInfo; -} VkVideoEncodeH265DpbSlotInfoEXT; - -typedef struct VkVideoEncodeH265ReferenceListsInfoEXT { - VkStructureType sType; - const void* pNext; - uint8_t referenceList0EntryCount; - const VkVideoEncodeH265DpbSlotInfoEXT* pReferenceList0Entries; - uint8_t referenceList1EntryCount; - const VkVideoEncodeH265DpbSlotInfoEXT* pReferenceList1Entries; - const StdVideoEncodeH265ReferenceModifications* pReferenceModifications; -} VkVideoEncodeH265ReferenceListsInfoEXT; +typedef struct VkVideoEncodeH265SessionParametersGetInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 writeStdVPS; + VkBool32 writeStdSPS; + VkBool32 writeStdPPS; + uint32_t stdVPSId; + uint32_t stdSPSId; + uint32_t stdPPSId; +} VkVideoEncodeH265SessionParametersGetInfoEXT; + +typedef struct VkVideoEncodeH265SessionParametersFeedbackInfoEXT { + VkStructureType sType; + void* pNext; + VkBool32 hasStdVPSOverrides; + VkBool32 hasStdSPSOverrides; + VkBool32 hasStdPPSOverrides; +} VkVideoEncodeH265SessionParametersFeedbackInfoEXT; typedef struct VkVideoEncodeH265NaluSliceSegmentInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t ctbCount; - const VkVideoEncodeH265ReferenceListsInfoEXT* pReferenceFinalLists; - const StdVideoEncodeH265SliceSegmentHeader* pSliceSegmentHeaderStd; + VkStructureType sType; + const void* pNext; + int32_t constantQp; + const StdVideoEncodeH265SliceSegmentHeader* pStdSliceSegmentHeader; } VkVideoEncodeH265NaluSliceSegmentInfoEXT; -typedef struct VkVideoEncodeH265VclFrameInfoEXT { +typedef struct VkVideoEncodeH265PictureInfoEXT { VkStructureType sType; const void* pNext; - const VkVideoEncodeH265ReferenceListsInfoEXT* pReferenceFinalLists; uint32_t naluSliceSegmentEntryCount; const VkVideoEncodeH265NaluSliceSegmentInfoEXT* pNaluSliceSegmentEntries; - const StdVideoEncodeH265PictureInfo* pCurrentPictureInfo; -} VkVideoEncodeH265VclFrameInfoEXT; + const StdVideoEncodeH265PictureInfo* pStdPictureInfo; +} VkVideoEncodeH265PictureInfoEXT; -typedef struct VkVideoEncodeH265EmitPictureParametersInfoEXT { - VkStructureType sType; - const void* pNext; - uint8_t vpsId; - uint8_t spsId; - VkBool32 emitVpsEnable; - VkBool32 emitSpsEnable; - uint32_t ppsIdEntryCount; - const uint8_t* ppsIdEntries; -} VkVideoEncodeH265EmitPictureParametersInfoEXT; +typedef struct VkVideoEncodeH265DpbSlotInfoEXT { + VkStructureType sType; + const void* pNext; + const StdVideoEncodeH265ReferenceInfo* pStdReferenceInfo; +} VkVideoEncodeH265DpbSlotInfoEXT; typedef struct VkVideoEncodeH265ProfileInfoEXT { VkStructureType sType; @@ -860,21 +611,15 @@ typedef struct VkVideoEncodeH265ProfileInfoEXT { } VkVideoEncodeH265ProfileInfoEXT; typedef struct VkVideoEncodeH265RateControlInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t gopFrameCount; - uint32_t idrPeriod; - uint32_t consecutiveBFrameCount; - VkVideoEncodeH265RateControlStructureEXT rateControlStructure; - uint8_t subLayerCount; + VkStructureType sType; + const void* pNext; + VkVideoEncodeH265RateControlFlagsEXT flags; + uint32_t gopFrameCount; + uint32_t idrPeriod; + uint32_t consecutiveBFrameCount; + uint32_t subLayerCount; } VkVideoEncodeH265RateControlInfoEXT; -typedef struct VkVideoEncodeH265QpEXT { - int32_t qpI; - int32_t qpP; - int32_t qpB; -} VkVideoEncodeH265QpEXT; - typedef struct VkVideoEncodeH265FrameSizeEXT { uint32_t frameISize; uint32_t framePSize; @@ -884,9 +629,6 @@ typedef struct VkVideoEncodeH265FrameSizeEXT { typedef struct VkVideoEncodeH265RateControlLayerInfoEXT { VkStructureType sType; const void* pNext; - uint8_t temporalId; - VkBool32 useInitialRcQp; - VkVideoEncodeH265QpEXT initialRcQp; VkBool32 useMinQp; VkVideoEncodeH265QpEXT minQp; VkBool32 useMaxQp; @@ -895,116 +637,173 @@ typedef struct VkVideoEncodeH265RateControlLayerInfoEXT { VkVideoEncodeH265FrameSizeEXT maxFrameSize; } VkVideoEncodeH265RateControlLayerInfoEXT; +typedef struct VkVideoEncodeH265GopRemainingFrameInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 useGopRemainingFrames; + uint32_t gopRemainingI; + uint32_t gopRemainingP; + uint32_t gopRemainingB; +} VkVideoEncodeH265GopRemainingFrameInfoEXT; -#define VK_EXT_video_decode_h264 1 -#include "vk_video/vulkan_video_codec_h264std_decode.h" -#define VK_EXT_VIDEO_DECODE_H264_SPEC_VERSION 7 -#define VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME "VK_EXT_video_decode_h264" -typedef enum VkVideoDecodeH264PictureLayoutFlagBitsEXT { - VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_EXT = 0, - VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_EXT = 0x00000001, - VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_EXT = 0x00000002, - VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoDecodeH264PictureLayoutFlagBitsEXT; -typedef VkFlags VkVideoDecodeH264PictureLayoutFlagsEXT; -typedef struct VkVideoDecodeH264ProfileInfoEXT { - VkStructureType sType; - const void* pNext; - StdVideoH264ProfileIdc stdProfileIdc; - VkVideoDecodeH264PictureLayoutFlagBitsEXT pictureLayout; -} VkVideoDecodeH264ProfileInfoEXT; +// VK_AMDX_shader_enqueue is a preprocessor guard. Do not pass it to API calls. +#define VK_AMDX_shader_enqueue 1 +#define VK_AMDX_SHADER_ENQUEUE_SPEC_VERSION 1 +#define VK_AMDX_SHADER_ENQUEUE_EXTENSION_NAME "VK_AMDX_shader_enqueue" +#define VK_SHADER_INDEX_UNUSED_AMDX (~0U) +typedef struct VkPhysicalDeviceShaderEnqueueFeaturesAMDX { + VkStructureType sType; + void* pNext; + VkBool32 shaderEnqueue; +} VkPhysicalDeviceShaderEnqueueFeaturesAMDX; -typedef struct VkVideoDecodeH264CapabilitiesEXT { - VkStructureType sType; - void* pNext; - StdVideoH264LevelIdc maxLevelIdc; - VkOffset2D fieldOffsetGranularity; -} VkVideoDecodeH264CapabilitiesEXT; +typedef struct VkPhysicalDeviceShaderEnqueuePropertiesAMDX { + VkStructureType sType; + void* pNext; + uint32_t maxExecutionGraphDepth; + uint32_t maxExecutionGraphShaderOutputNodes; + uint32_t maxExecutionGraphShaderPayloadSize; + uint32_t maxExecutionGraphShaderPayloadCount; + uint32_t executionGraphDispatchAddressAlignment; +} VkPhysicalDeviceShaderEnqueuePropertiesAMDX; + +typedef struct VkExecutionGraphPipelineScratchSizeAMDX { + VkStructureType sType; + void* pNext; + VkDeviceSize size; +} VkExecutionGraphPipelineScratchSizeAMDX; -typedef struct VkVideoDecodeH264SessionParametersAddInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t stdSPSCount; - const StdVideoH264SequenceParameterSet* pStdSPSs; - uint32_t stdPPSCount; - const StdVideoH264PictureParameterSet* pStdPPSs; -} VkVideoDecodeH264SessionParametersAddInfoEXT; +typedef struct VkExecutionGraphPipelineCreateInfoAMDX { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags flags; + uint32_t stageCount; + const VkPipelineShaderStageCreateInfo* pStages; + const VkPipelineLibraryCreateInfoKHR* pLibraryInfo; + VkPipelineLayout layout; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkExecutionGraphPipelineCreateInfoAMDX; + +typedef union VkDeviceOrHostAddressConstAMDX { + VkDeviceAddress deviceAddress; + const void* hostAddress; +} VkDeviceOrHostAddressConstAMDX; + +typedef struct VkDispatchGraphInfoAMDX { + uint32_t nodeIndex; + uint32_t payloadCount; + VkDeviceOrHostAddressConstAMDX payloads; + uint64_t payloadStride; +} VkDispatchGraphInfoAMDX; + +typedef struct VkDispatchGraphCountInfoAMDX { + uint32_t count; + VkDeviceOrHostAddressConstAMDX infos; + uint64_t stride; +} VkDispatchGraphCountInfoAMDX; + +typedef struct VkPipelineShaderStageNodeCreateInfoAMDX { + VkStructureType sType; + const void* pNext; + const char* pName; + uint32_t index; +} VkPipelineShaderStageNodeCreateInfoAMDX; + +typedef VkResult (VKAPI_PTR *PFN_vkCreateExecutionGraphPipelinesAMDX)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); +typedef VkResult (VKAPI_PTR *PFN_vkGetExecutionGraphPipelineScratchSizeAMDX)(VkDevice device, VkPipeline executionGraph, VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetExecutionGraphPipelineNodeIndexAMDX)(VkDevice device, VkPipeline executionGraph, const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo, uint32_t* pNodeIndex); +typedef void (VKAPI_PTR *PFN_vkCmdInitializeGraphScratchMemoryAMDX)(VkCommandBuffer commandBuffer, VkDeviceAddress scratch); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchGraphAMDX)(VkCommandBuffer commandBuffer, VkDeviceAddress scratch, const VkDispatchGraphCountInfoAMDX* pCountInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchGraphIndirectAMDX)(VkCommandBuffer commandBuffer, VkDeviceAddress scratch, const VkDispatchGraphCountInfoAMDX* pCountInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchGraphIndirectCountAMDX)(VkCommandBuffer commandBuffer, VkDeviceAddress scratch, VkDeviceAddress countInfo); -typedef struct VkVideoDecodeH264SessionParametersCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t maxStdSPSCount; - uint32_t maxStdPPSCount; - const VkVideoDecodeH264SessionParametersAddInfoEXT* pParametersAddInfo; -} VkVideoDecodeH264SessionParametersCreateInfoEXT; +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateExecutionGraphPipelinesAMDX( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); -typedef struct VkVideoDecodeH264PictureInfoEXT { - VkStructureType sType; - const void* pNext; - const StdVideoDecodeH264PictureInfo* pStdPictureInfo; - uint32_t sliceCount; - const uint32_t* pSliceOffsets; -} VkVideoDecodeH264PictureInfoEXT; +VKAPI_ATTR VkResult VKAPI_CALL vkGetExecutionGraphPipelineScratchSizeAMDX( + VkDevice device, + VkPipeline executionGraph, + VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo); -typedef struct VkVideoDecodeH264DpbSlotInfoEXT { - VkStructureType sType; - const void* pNext; - const StdVideoDecodeH264ReferenceInfo* pStdReferenceInfo; -} VkVideoDecodeH264DpbSlotInfoEXT; +VKAPI_ATTR VkResult VKAPI_CALL vkGetExecutionGraphPipelineNodeIndexAMDX( + VkDevice device, + VkPipeline executionGraph, + const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo, + uint32_t* pNodeIndex); +VKAPI_ATTR void VKAPI_CALL vkCmdInitializeGraphScratchMemoryAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch); +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchGraphAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo); -#define VK_EXT_video_decode_h265 1 -#include "vk_video/vulkan_video_codec_h265std_decode.h" -#define VK_EXT_VIDEO_DECODE_H265_SPEC_VERSION 5 -#define VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME "VK_EXT_video_decode_h265" -typedef struct VkVideoDecodeH265ProfileInfoEXT { - VkStructureType sType; - const void* pNext; - StdVideoH265ProfileIdc stdProfileIdc; -} VkVideoDecodeH265ProfileInfoEXT; +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchGraphIndirectAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo); -typedef struct VkVideoDecodeH265CapabilitiesEXT { - VkStructureType sType; - void* pNext; - StdVideoH265LevelIdc maxLevelIdc; -} VkVideoDecodeH265CapabilitiesEXT; +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchGraphIndirectCountAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + VkDeviceAddress countInfo); +#endif -typedef struct VkVideoDecodeH265SessionParametersAddInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t stdVPSCount; - const StdVideoH265VideoParameterSet* pStdVPSs; - uint32_t stdSPSCount; - const StdVideoH265SequenceParameterSet* pStdSPSs; - uint32_t stdPPSCount; - const StdVideoH265PictureParameterSet* pStdPPSs; -} VkVideoDecodeH265SessionParametersAddInfoEXT; -typedef struct VkVideoDecodeH265SessionParametersCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t maxStdVPSCount; - uint32_t maxStdSPSCount; - uint32_t maxStdPPSCount; - const VkVideoDecodeH265SessionParametersAddInfoEXT* pParametersAddInfo; -} VkVideoDecodeH265SessionParametersCreateInfoEXT; - -typedef struct VkVideoDecodeH265PictureInfoEXT { - VkStructureType sType; - const void* pNext; - StdVideoDecodeH265PictureInfo* pStdPictureInfo; - uint32_t sliceCount; - const uint32_t* pSliceOffsets; -} VkVideoDecodeH265PictureInfoEXT; - -typedef struct VkVideoDecodeH265DpbSlotInfoEXT { - VkStructureType sType; - const void* pNext; - const StdVideoDecodeH265ReferenceInfo* pStdReferenceInfo; -} VkVideoDecodeH265DpbSlotInfoEXT; +// VK_NV_displacement_micromap is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_displacement_micromap 1 +#define VK_NV_DISPLACEMENT_MICROMAP_SPEC_VERSION 2 +#define VK_NV_DISPLACEMENT_MICROMAP_EXTENSION_NAME "VK_NV_displacement_micromap" + +typedef enum VkDisplacementMicromapFormatNV { + VK_DISPLACEMENT_MICROMAP_FORMAT_64_TRIANGLES_64_BYTES_NV = 1, + VK_DISPLACEMENT_MICROMAP_FORMAT_256_TRIANGLES_128_BYTES_NV = 2, + VK_DISPLACEMENT_MICROMAP_FORMAT_1024_TRIANGLES_128_BYTES_NV = 3, + VK_DISPLACEMENT_MICROMAP_FORMAT_MAX_ENUM_NV = 0x7FFFFFFF +} VkDisplacementMicromapFormatNV; +typedef struct VkPhysicalDeviceDisplacementMicromapFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 displacementMicromap; +} VkPhysicalDeviceDisplacementMicromapFeaturesNV; + +typedef struct VkPhysicalDeviceDisplacementMicromapPropertiesNV { + VkStructureType sType; + void* pNext; + uint32_t maxDisplacementMicromapSubdivisionLevel; +} VkPhysicalDeviceDisplacementMicromapPropertiesNV; + +typedef struct VkAccelerationStructureTrianglesDisplacementMicromapNV { + VkStructureType sType; + void* pNext; + VkFormat displacementBiasAndScaleFormat; + VkFormat displacementVectorFormat; + VkDeviceOrHostAddressConstKHR displacementBiasAndScaleBuffer; + VkDeviceSize displacementBiasAndScaleStride; + VkDeviceOrHostAddressConstKHR displacementVectorBuffer; + VkDeviceSize displacementVectorStride; + VkDeviceOrHostAddressConstKHR displacedMicromapPrimitiveFlags; + VkDeviceSize displacedMicromapPrimitiveFlagsStride; + VkIndexType indexType; + VkDeviceOrHostAddressConstKHR indexBuffer; + VkDeviceSize indexStride; + uint32_t baseTriangle; + uint32_t usageCountsCount; + const VkMicromapUsageEXT* pUsageCounts; + const VkMicromapUsageEXT* const* ppUsageCounts; + VkMicromapEXT micromap; +} VkAccelerationStructureTrianglesDisplacementMicromapNV; #ifdef __cplusplus diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_core.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_core.h index da5c99dd..bd882702 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_core.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_core.h @@ -2,7 +2,7 @@ #define VULKAN_CORE_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_VERSION_1_0 is a preprocessor guard. Do not pass it to API calls. #define VK_VERSION_1_0 1 #include "vk_platform.h" @@ -58,37 +59,37 @@ extern "C" { #endif #endif -// DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead. -#define VK_MAKE_VERSION(major, minor, patch) \ - ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) +#define VK_MAKE_API_VERSION(variant, major, minor, patch) \ + ((((uint32_t)(variant)) << 29U) | (((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch))) // DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. -//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0 - -#define VK_MAKE_API_VERSION(variant, major, minor, patch) \ - ((((uint32_t)(variant)) << 29) | (((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) +//#define VK_API_VERSION VK_MAKE_API_VERSION(0, 1, 0, 0) // Patch version should always be set to 0 // Vulkan 1.0 version number #define VK_API_VERSION_1_0 VK_MAKE_API_VERSION(0, 1, 0, 0)// Patch version should always be set to 0 // Version of this file -#define VK_HEADER_VERSION 230 +#define VK_HEADER_VERSION 263 // Complete version of this file #define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION) +// DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead. +#define VK_MAKE_VERSION(major, minor, patch) \ + ((((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch))) + // DEPRECATED: This define is deprecated. VK_API_VERSION_MAJOR should be used instead. -#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) +#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22U) // DEPRECATED: This define is deprecated. VK_API_VERSION_MINOR should be used instead. -#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU) +#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12U) & 0x3FFU) // DEPRECATED: This define is deprecated. VK_API_VERSION_PATCH should be used instead. #define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) -#define VK_API_VERSION_VARIANT(version) ((uint32_t)(version) >> 29) -#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22) & 0x7FU) -#define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU) +#define VK_API_VERSION_VARIANT(version) ((uint32_t)(version) >> 29U) +#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22U) & 0x7FU) +#define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12U) & 0x3FFU) #define VK_API_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) typedef uint32_t VkBool32; typedef uint64_t VkDeviceAddress; @@ -168,24 +169,12 @@ typedef enum VkResult { VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, VK_ERROR_INVALID_SHADER_NV = -1000012000, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR = -1000023000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR = -1000023001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR = -1000023002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR = -1000023003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR = -1000023004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR = -1000023005, -#endif VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT = -1000158000, VK_ERROR_NOT_PERMITTED_KHR = -1000174001, VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT = -1000255000, @@ -193,7 +182,11 @@ typedef enum VkResult { VK_THREAD_DONE_KHR = 1000268001, VK_OPERATION_DEFERRED_KHR = 1000268002, VK_OPERATION_NOT_DEFERRED_KHR = 1000268003, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR = -1000299000, +#endif VK_ERROR_COMPRESSION_EXHAUSTED_EXT = -1000338000, + VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT = 1000482000, VK_ERROR_OUT_OF_POOL_MEMORY_KHR = VK_ERROR_OUT_OF_POOL_MEMORY, VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = VK_ERROR_INVALID_EXTERNAL_HANDLE, VK_ERROR_FRAGMENTATION_EXT = VK_ERROR_FRAGMENTATION, @@ -443,66 +436,26 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000, VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001, VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_PROFILE_INFO_KHR = 1000023000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR = 1000023001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR = 1000023002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_SESSION_MEMORY_REQUIREMENTS_KHR = 1000023003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_BIND_VIDEO_SESSION_MEMORY_INFO_KHR = 1000023004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_SESSION_CREATE_INFO_KHR = 1000023005, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR = 1000023006, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_UPDATE_INFO_KHR = 1000023007, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR = 1000023008, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR = 1000023009, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR = 1000023010, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR = 1000023011, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_QUEUE_FAMILY_VIDEO_PROPERTIES_KHR = 1000023012, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR = 1000023013, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_FORMAT_INFO_KHR = 1000023014, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR = 1000023015, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_QUEUE_FAMILY_QUERY_RESULT_STATUS_PROPERTIES_KHR = 1000023016, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR = 1000024000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_DECODE_CAPABILITIES_KHR = 1000024001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_DECODE_USAGE_INFO_KHR = 1000024002, -#endif VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, @@ -524,7 +477,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT = 1000038002, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_VCL_FRAME_INFO_EXT = 1000038003, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PICTURE_INFO_EXT = 1000038003, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_DPB_SLOT_INFO_EXT = 1000038004, @@ -533,7 +486,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_NALU_SLICE_INFO_EXT = 1000038005, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_EMIT_PICTURE_PARAMETERS_INFO_EXT = 1000038006, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_GOP_REMAINING_FRAME_INFO_EXT = 1000038006, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_INFO_EXT = 1000038007, @@ -545,7 +498,16 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_EXT = 1000038009, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_REFERENCE_LISTS_INFO_EXT = 1000038010, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_CREATE_INFO_EXT = 1000038010, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_QUALITY_LEVEL_PROPERTIES_EXT = 1000038011, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_GET_INFO_EXT = 1000038012, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_FEEDBACK_INFO_EXT = 1000038013, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_CAPABILITIES_EXT = 1000039000, @@ -557,7 +519,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_ADD_INFO_EXT = 1000039002, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_VCL_FRAME_INFO_EXT = 1000039003, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_PICTURE_INFO_EXT = 1000039003, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_DPB_SLOT_INFO_EXT = 1000039004, @@ -566,14 +528,11 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_SEGMENT_INFO_EXT = 1000039005, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_EMIT_PICTURE_PARAMETERS_INFO_EXT = 1000039006, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_GOP_REMAINING_FRAME_INFO_EXT = 1000039006, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_PROFILE_INFO_EXT = 1000039007, #endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_REFERENCE_LISTS_INFO_EXT = 1000039008, -#endif #ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_INFO_EXT = 1000039009, #endif @@ -581,23 +540,23 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_LAYER_INFO_EXT = 1000039010, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_EXT = 1000040000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PICTURE_INFO_EXT = 1000040001, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_CREATE_INFO_EXT = 1000039011, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_EXT = 1000040003, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_QUALITY_LEVEL_PROPERTIES_EXT = 1000039012, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_CREATE_INFO_EXT = 1000040004, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_GET_INFO_EXT = 1000039013, #endif #ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT = 1000040005, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT = 1000040006, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_FEEDBACK_INFO_EXT = 1000039014, #endif + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_KHR = 1000040000, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PICTURE_INFO_KHR = 1000040001, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_KHR = 1000040003, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_CREATE_INFO_KHR = 1000040004, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_ADD_INFO_KHR = 1000040005, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_KHR = 1000040006, VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000, VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR = 1000044006, VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_INFO_EXT = 1000044007, @@ -687,6 +646,21 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID = 1000129004, VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID = 1000129005, VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_2_ANDROID = 1000129006, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ENQUEUE_FEATURES_AMDX = 1000134000, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ENQUEUE_PROPERTIES_AMDX = 1000134001, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_SCRATCH_SIZE_AMDX = 1000134002, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_CREATE_INFO_AMDX = 1000134003, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_NODE_CREATE_INFO_AMDX = 1000134004, +#endif VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT = 1000143000, VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT = 1000143001, VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT = 1000143002, @@ -760,24 +734,12 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD = 1000183000, VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT = 1000184000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD = 1000185000, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_EXT = 1000187000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT = 1000187001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_ADD_INFO_EXT = 1000187002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_EXT = 1000187003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PICTURE_INFO_EXT = 1000187004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_DPB_SLOT_INFO_EXT = 1000187005, -#endif + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_KHR = 1000187000, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_KHR = 1000187001, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_ADD_INFO_KHR = 1000187002, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_KHR = 1000187003, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PICTURE_INFO_KHR = 1000187004, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_DPB_SLOT_INFO_KHR = 1000187005, VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_KHR = 1000174000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR = 1000388000, VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR = 1000388001, @@ -853,7 +815,28 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INFO_KHR = 1000269003, VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_STATISTIC_KHR = 1000269004, VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR = 1000269005, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT = 1000270000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT = 1000270001, + VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_EXT = 1000270002, + VK_STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY_EXT = 1000270003, + VK_STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO_EXT = 1000270004, + VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_EXT = 1000270005, + VK_STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO_EXT = 1000270006, + VK_STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO_EXT = 1000270007, + VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT = 1000270008, + VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT = 1000270009, + VK_STRUCTURE_TYPE_MEMORY_MAP_INFO_KHR = 1000271000, + VK_STRUCTURE_TYPE_MEMORY_UNMAP_INFO_KHR = 1000271001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT = 1000273000, + VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT = 1000274000, + VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT = 1000274001, + VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT = 1000274002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT = 1000275000, + VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_FENCE_INFO_EXT = 1000275001, + VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODES_CREATE_INFO_EXT = 1000275002, + VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODE_INFO_EXT = 1000275003, + VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_SCALING_CREATE_INFO_EXT = 1000275004, + VK_STRUCTURE_TYPE_RELEASE_SWAPCHAIN_IMAGES_INFO_EXT = 1000275005, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV = 1000277000, VK_STRUCTURE_TYPE_GRAPHICS_SHADER_GROUP_CREATE_INFO_NV = 1000277001, VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV = 1000277002, @@ -867,6 +850,9 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT = 1000281000, VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDER_PASS_TRANSFORM_INFO_QCOM = 1000282000, VK_STRUCTURE_TYPE_RENDER_PASS_TRANSFORM_BEGIN_INFO_QCOM = 1000282001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT = 1000283000, + VK_STRUCTURE_TYPE_DEPTH_BIAS_INFO_EXT = 1000283001, + VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT = 1000283002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_MEMORY_REPORT_FEATURES_EXT = 1000284000, VK_STRUCTURE_TYPE_DEVICE_DEVICE_MEMORY_REPORT_CREATE_INFO_EXT = 1000284001, VK_STRUCTURE_TYPE_DEVICE_MEMORY_REPORT_CALLBACK_DATA_EXT = 1000284002, @@ -895,9 +881,28 @@ typedef enum VkStructureType { #endif #ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_USAGE_INFO_KHR = 1000299004, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_QUERY_POOL_VIDEO_ENCODE_FEEDBACK_CREATE_INFO_KHR = 1000299005, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_ENCODE_QUALITY_LEVEL_INFO_KHR = 1000299006, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_VIDEO_ENCODE_QUALITY_LEVEL_PROPERTIES_KHR = 1000299007, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_VIDEO_ENCODE_QUALITY_LEVEL_INFO_KHR = 1000299008, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_VIDEO_ENCODE_SESSION_PARAMETERS_GET_INFO_KHR = 1000299009, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_VIDEO_ENCODE_SESSION_PARAMETERS_FEEDBACK_INFO_KHR = 1000299010, #endif VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV = 1000300000, VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV = 1000300001, + VK_STRUCTURE_TYPE_QUERY_LOW_LATENCY_SUPPORT_NV = 1000310000, VK_STRUCTURE_TYPE_EXPORT_METAL_OBJECT_CREATE_INFO_EXT = 1000311000, VK_STRUCTURE_TYPE_EXPORT_METAL_OBJECTS_INFO_EXT = 1000311001, VK_STRUCTURE_TYPE_EXPORT_METAL_DEVICE_INFO_EXT = 1000311002, @@ -912,6 +917,19 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_IMPORT_METAL_SHARED_EVENT_INFO_EXT = 1000311011, VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV = 1000314008, VK_STRUCTURE_TYPE_CHECKPOINT_DATA_2_NV = 1000314009, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT = 1000316000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_DENSITY_MAP_PROPERTIES_EXT = 1000316001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT = 1000316002, + VK_STRUCTURE_TYPE_DESCRIPTOR_ADDRESS_INFO_EXT = 1000316003, + VK_STRUCTURE_TYPE_DESCRIPTOR_GET_INFO_EXT = 1000316004, + VK_STRUCTURE_TYPE_BUFFER_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316005, + VK_STRUCTURE_TYPE_IMAGE_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316006, + VK_STRUCTURE_TYPE_IMAGE_VIEW_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316007, + VK_STRUCTURE_TYPE_SAMPLER_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316008, + VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT = 1000316010, + VK_STRUCTURE_TYPE_DESCRIPTOR_BUFFER_BINDING_INFO_EXT = 1000316011, + VK_STRUCTURE_TYPE_DESCRIPTOR_BUFFER_BINDING_PUSH_DESCRIPTOR_BUFFER_HANDLE_EXT = 1000316012, + VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316009, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT = 1000320000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT = 1000320001, VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT = 1000320002, @@ -934,8 +952,6 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR = 1000336000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT = 1000338000, VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT = 1000338001, - VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT = 1000338002, - VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT = 1000338003, VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT = 1000338004, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT = 1000339000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT = 1000340000, @@ -990,6 +1006,8 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT = 1000392000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT = 1000392001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT = 1000393000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT = 1000395000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_PROPERTIES_EXT = 1000395001, VK_STRUCTURE_TYPE_MICROMAP_BUILD_INFO_EXT = 1000396000, VK_STRUCTURE_TYPE_MICROMAP_VERSION_INFO_EXT = 1000396001, VK_STRUCTURE_TYPE_COPY_MICROMAP_INFO_EXT = 1000396002, @@ -1000,9 +1018,23 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_MICROMAP_CREATE_INFO_EXT = 1000396007, VK_STRUCTURE_TYPE_MICROMAP_BUILD_SIZES_INFO_EXT = 1000396008, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_TRIANGLES_OPACITY_MICROMAP_EXT = 1000396009, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISPLACEMENT_MICROMAP_FEATURES_NV = 1000397000, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISPLACEMENT_MICROMAP_PROPERTIES_NV = 1000397001, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_TRIANGLES_DISPLACEMENT_MICROMAP_NV = 1000397002, +#endif + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI = 1000404000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_PROPERTIES_HUAWEI = 1000404001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT = 1000411000, VK_STRUCTURE_TYPE_SAMPLER_BORDER_COLOR_COMPONENT_MAPPING_CREATE_INFO_EXT = 1000411001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT = 1000412000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM = 1000415000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT = 1000418000, + VK_STRUCTURE_TYPE_IMAGE_VIEW_SLICED_CREATE_INFO_EXT = 1000418001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE = 1000420000, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_BINDING_REFERENCE_VALVE = 1000420001, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_HOST_MAPPING_INFO_VALVE = 1000420002, @@ -1011,17 +1043,27 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM = 1000425000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_PROPERTIES_QCOM = 1000425001, VK_STRUCTURE_TYPE_SUBPASS_FRAGMENT_DENSITY_MAP_OFFSET_END_INFO_QCOM = 1000425002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV = 1000426000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_PROPERTIES_NV = 1000426001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV = 1000427000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV = 1000427001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV = 1000428000, + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_INDIRECT_BUFFER_INFO_NV = 1000428001, + VK_STRUCTURE_TYPE_PIPELINE_INDIRECT_DEVICE_ADDRESS_INFO_NV = 1000428002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV = 1000430000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT = 1000437000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM = 1000440000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_PROPERTIES_QCOM = 1000440001, VK_STRUCTURE_TYPE_IMAGE_VIEW_SAMPLE_WEIGHT_CREATE_INFO_QCOM = 1000440002, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT = 1000453000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT = 1000455000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_PROPERTIES_EXT = 1000455001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT = 1000458000, VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_CONTROL_EXT = 1000458001, VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_FEEDBACK_CREATE_INFO_EXT = 1000458002, VK_STRUCTURE_TYPE_RENDER_PASS_SUBPASS_FEEDBACK_CREATE_INFO_EXT = 1000458003, + VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_INFO_LUNARG = 1000459000, + VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG = 1000459001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT = 1000462000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT = 1000462001, VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT = 1000462002, @@ -1036,12 +1078,52 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_OPTICAL_FLOW_SESSION_CREATE_PRIVATE_DATA_INFO_NV = 1000464010, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT = 1000465000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT = 1000466000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR = 1000470000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR = 1000470001, + VK_STRUCTURE_TYPE_RENDERING_AREA_INFO_KHR = 1000470003, + VK_STRUCTURE_TYPE_DEVICE_IMAGE_SUBRESOURCE_INFO_KHR = 1000470004, + VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR = 1000338002, + VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR = 1000338003, + VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR = 1000470005, + VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR = 1000470006, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR = 1000481000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT = 1000482000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_PROPERTIES_EXT = 1000482001, + VK_STRUCTURE_TYPE_SHADER_CREATE_INFO_EXT = 1000482002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM = 1000484000, VK_STRUCTURE_TYPE_TILE_PROPERTIES_QCOM = 1000484001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_AMIGO_PROFILING_FEATURES_SEC = 1000485000, VK_STRUCTURE_TYPE_AMIGO_PROFILING_SUBMIT_INFO_SEC = 1000485001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM = 1000488000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV = 1000490000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_PROPERTIES_NV = 1000490001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT = 1000351000, VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT = 1000351002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM = 1000497000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM = 1000497001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT = 1000498000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT = 1000499000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR = 1000506000, + VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_KHR = 1000506001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR = 1000506002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM = 1000510000, + VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM = 1000510001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM = 1000518000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM = 1000518001, + VK_STRUCTURE_TYPE_SAMPLER_BLOCK_MATCH_WINDOW_CREATE_INFO_QCOM = 1000518002, + VK_STRUCTURE_TYPE_SAMPLER_CUBIC_WEIGHTS_CREATE_INFO_QCOM = 1000519000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM = 1000519001, + VK_STRUCTURE_TYPE_BLIT_IMAGE_CUBIC_WEIGHTS_INFO_QCOM = 1000519002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM = 1000520000, + VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_YCBCR_DEGAMMA_CREATE_INFO_QCOM = 1000520001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM = 1000521000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT = 1000524000, + VK_STRUCTURE_TYPE_SCREEN_BUFFER_PROPERTIES_QNX = 1000529000, + VK_STRUCTURE_TYPE_SCREEN_BUFFER_FORMAT_PROPERTIES_QNX = 1000529001, + VK_STRUCTURE_TYPE_IMPORT_SCREEN_BUFFER_INFO_QNX = 1000529002, + VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_QNX = 1000529003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_SCREEN_BUFFER_FEATURES_QNX = 1000529004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV = 1000546000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES, VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, @@ -1204,6 +1286,8 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_IMAGE_BLIT_2_KHR = VK_STRUCTURE_TYPE_IMAGE_BLIT_2, VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2_KHR = VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2, VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2_KHR = VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2, + VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT = VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR, + VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT = VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_ARM = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT, VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE = VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT, @@ -1215,6 +1299,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES, VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS_KHR = VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS, VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS_KHR = VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS, + VK_STRUCTURE_TYPE_SHADER_REQUIRED_SUBGROUP_SIZE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO, VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkStructureType; @@ -1242,15 +1327,9 @@ typedef enum VkImageLayout { VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL = 1000314000, VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL = 1000314001, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR = 1000024000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR = 1000024001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR = 1000024002, -#endif VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000, VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT = 1000218000, VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR = 1000164003, @@ -1311,12 +1390,8 @@ typedef enum VkObjectType { VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_OBJECT_TYPE_VIDEO_SESSION_KHR = 1000023000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_OBJECT_TYPE_VIDEO_SESSION_PARAMETERS_KHR = 1000023001, -#endif VK_OBJECT_TYPE_CU_MODULE_NVX = 1000029000, VK_OBJECT_TYPE_CU_FUNCTION_NVX = 1000029001, VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT = 1000128000, @@ -1329,6 +1404,7 @@ typedef enum VkObjectType { VK_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA = 1000366000, VK_OBJECT_TYPE_MICROMAP_EXT = 1000396000, VK_OBJECT_TYPE_OPTICAL_FLOW_SESSION_NV = 1000464000, + VK_OBJECT_TYPE_SHADER_EXT = 1000482000, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE, VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR = VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION, VK_OBJECT_TYPE_PRIVATE_DATA_SLOT_EXT = VK_OBJECT_TYPE_PRIVATE_DATA_SLOT, @@ -1342,6 +1418,7 @@ typedef enum VkVendorId { VK_VENDOR_ID_CODEPLAY = 0x10004, VK_VENDOR_ID_MESA = 0x10005, VK_VENDOR_ID_POCL = 0x10006, + VK_VENDOR_ID_MOBILEYE = 0x10007, VK_VENDOR_ID_MAX_ENUM = 0x7FFFFFFF } VkVendorId; @@ -1608,6 +1685,8 @@ typedef enum VkFormat { VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, VK_FORMAT_R16G16_S10_5_NV = 1000464000, + VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR = 1000470000, + VK_FORMAT_A8_UNORM_KHR = 1000470001, VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK, VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK, VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK, @@ -1692,9 +1771,7 @@ typedef enum VkQueryType { VK_QUERY_TYPE_OCCLUSION = 0, VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, VK_QUERY_TYPE_TIMESTAMP = 2, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR = 1000023000, -#endif VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT = 1000028004, VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR = 1000116000, VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR = 1000150000, @@ -1702,7 +1779,7 @@ typedef enum VkQueryType { VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV = 1000165000, VK_QUERY_TYPE_PERFORMANCE_QUERY_INTEL = 1000210000, #ifdef VK_ENABLE_BETA_EXTENSIONS - VK_QUERY_TYPE_VIDEO_ENCODE_BITSTREAM_BUFFER_RANGE_KHR = 1000299000, + VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR = 1000299000, #endif VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT = 1000328000, VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT = 1000382000, @@ -1858,10 +1935,13 @@ typedef enum VkDynamicState { VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE = 1000377004, VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000, VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, + VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT = 1000099001, + VK_DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT = 1000099002, VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = 1000143000, VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR = 1000347000, VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV = 1000164004, VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV = 1000164006, + VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_ENABLE_NV = 1000205000, VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV = 1000205001, VK_DYNAMIC_STATE_FRAGMENT_SHADING_RATE_KHR = 1000226000, VK_DYNAMIC_STATE_LINE_STIPPLE_EXT = 1000259000, @@ -1900,6 +1980,7 @@ typedef enum VkDynamicState { VK_DYNAMIC_STATE_SHADING_RATE_IMAGE_ENABLE_NV = 1000455030, VK_DYNAMIC_STATE_REPRESENTATIVE_FRAGMENT_TEST_ENABLE_NV = 1000455031, VK_DYNAMIC_STATE_COVERAGE_REDUCTION_MODE_NV = 1000455032, + VK_DYNAMIC_STATE_ATTACHMENT_FEEDBACK_LOOP_ENABLE_EXT = 1000524000, VK_DYNAMIC_STATE_CULL_MODE_EXT = VK_DYNAMIC_STATE_CULL_MODE, VK_DYNAMIC_STATE_FRONT_FACE_EXT = VK_DYNAMIC_STATE_FRONT_FACE, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY, @@ -2065,6 +2146,9 @@ typedef enum VkAttachmentStoreOp { typedef enum VkPipelineBindPoint { VK_PIPELINE_BIND_POINT_GRAPHICS = 0, VK_PIPELINE_BIND_POINT_COMPUTE = 1, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_PIPELINE_BIND_POINT_EXECUTION_GRAPH_AMDX = 1000134000, +#endif VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR = 1000165000, VK_PIPELINE_BIND_POINT_SUBPASS_SHADING_HUAWEI = 1000369003, VK_PIPELINE_BIND_POINT_RAY_TRACING_NV = VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, @@ -2175,12 +2259,8 @@ typedef enum VkFormatFeatureFlagBits { VK_FORMAT_FEATURE_DISJOINT_BIT = 0x00400000, VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = 0x00800000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT = 0x00010000, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_FORMAT_FEATURE_VIDEO_DECODE_OUTPUT_BIT_KHR = 0x02000000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_FORMAT_FEATURE_VIDEO_DECODE_DPB_BIT_KHR = 0x04000000, -#endif VK_FORMAT_FEATURE_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR = 0x20000000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT = 0x00002000, VK_FORMAT_FEATURE_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x01000000, @@ -2222,6 +2302,7 @@ typedef enum VkImageCreateFlagBits { VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV = 0x00002000, VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT = 0x00001000, VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT = 0x00004000, + VK_IMAGE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00010000, VK_IMAGE_CREATE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_BIT_EXT = 0x00040000, VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT = 0x00020000, VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM = 0x00008000, @@ -2256,17 +2337,12 @@ typedef enum VkImageUsageFlagBits { VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR = 0x00000400, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR = 0x00000800, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR = 0x00001000, -#endif VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x00000200, VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00000100, + VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT = 0x00400000, #ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR = 0x00002000, #endif @@ -2319,9 +2395,7 @@ typedef enum VkQueueFlagBits { VK_QUEUE_TRANSFER_BIT = 0x00000004, VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, VK_QUEUE_PROTECTED_BIT = 0x00000010, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_QUEUE_VIDEO_DECODE_BIT_KHR = 0x00000020, -#endif #ifdef VK_ENABLE_BETA_EXTENSIONS VK_QUEUE_VIDEO_ENCODE_BIT_KHR = 0x00000040, #endif @@ -2418,6 +2492,7 @@ typedef enum VkQueryPipelineStatisticFlagBits { VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, VK_QUERY_PIPELINE_STATISTIC_TASK_SHADER_INVOCATIONS_BIT_EXT = 0x00000800, VK_QUERY_PIPELINE_STATISTIC_MESH_SHADER_INVOCATIONS_BIT_EXT = 0x00001000, + VK_QUERY_PIPELINE_STATISTIC_CLUSTER_CULLING_SHADER_INVOCATIONS_BIT_HUAWEI = 0x00002000, VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueryPipelineStatisticFlagBits; typedef VkFlags VkQueryPipelineStatisticFlags; @@ -2428,9 +2503,7 @@ typedef enum VkQueryResultFlagBits { VK_QUERY_RESULT_WAIT_BIT = 0x00000002, VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_QUERY_RESULT_WITH_STATUS_BIT_KHR = 0x00000010, -#endif VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueryResultFlagBits; typedef VkFlags VkQueryResultFlags; @@ -2441,6 +2514,7 @@ typedef enum VkBufferCreateFlagBits { VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, VK_BUFFER_CREATE_PROTECTED_BIT = 0x00000008, VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = 0x00000010, + VK_BUFFER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000020, VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT = VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF @@ -2458,15 +2532,14 @@ typedef enum VkBufferUsageFlagBits { VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT = 0x00020000, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR = 0x00002000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_BUFFER_USAGE_VIDEO_DECODE_DST_BIT_KHR = 0x00004000, -#endif VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT = 0x00000800, VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT = 0x00001000, VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT = 0x00000200, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_BUFFER_USAGE_EXECUTION_GRAPH_SCRATCH_BIT_AMDX = 0x02000000, +#endif VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR = 0x00080000, VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR = 0x00100000, VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR = 0x00000400, @@ -2476,6 +2549,9 @@ typedef enum VkBufferUsageFlagBits { #ifdef VK_ENABLE_BETA_EXTENSIONS VK_BUFFER_USAGE_VIDEO_ENCODE_SRC_BIT_KHR = 0x00010000, #endif + VK_BUFFER_USAGE_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT = 0x00200000, + VK_BUFFER_USAGE_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT = 0x00400000, + VK_BUFFER_USAGE_PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER_BIT_EXT = 0x04000000, VK_BUFFER_USAGE_MICROMAP_BUILD_INPUT_READ_ONLY_BIT_EXT = 0x00800000, VK_BUFFER_USAGE_MICROMAP_STORAGE_BIT_EXT = 0x01000000, VK_BUFFER_USAGE_RAY_TRACING_BIT_NV = VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR, @@ -2488,6 +2564,7 @@ typedef VkFlags VkBufferViewCreateFlags; typedef enum VkImageViewCreateFlagBits { VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DYNAMIC_BIT_EXT = 0x00000001, + VK_IMAGE_VIEW_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000004, VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DEFERRED_BIT_EXT = 0x00000002, VK_IMAGE_VIEW_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageViewCreateFlagBits; @@ -2532,12 +2609,16 @@ typedef enum VkPipelineCreateFlagBits { VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR = 0x00000080, VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV = 0x00040000, VK_PIPELINE_CREATE_LIBRARY_BIT_KHR = 0x00000800, + VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT = 0x20000000, VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT = 0x00800000, VK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXT = 0x00000400, VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV = 0x00100000, VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x02000000, VK_PIPELINE_CREATE_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x04000000, VK_PIPELINE_CREATE_RAY_TRACING_OPACITY_MICROMAP_BIT_EXT = 0x01000000, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_PIPELINE_CREATE_RAY_TRACING_DISPLACEMENT_MICROMAP_BIT_NV = 0x10000000, +#endif VK_PIPELINE_CREATE_NO_PROTECTED_ACCESS_BIT_EXT = 0x08000000, VK_PIPELINE_CREATE_PROTECTED_ACCESS_ONLY_BIT_EXT = 0x40000000, VK_PIPELINE_CREATE_DISPATCH_BASE = VK_PIPELINE_CREATE_DISPATCH_BASE_BIT, @@ -2578,6 +2659,7 @@ typedef enum VkShaderStageFlagBits { VK_SHADER_STAGE_TASK_BIT_EXT = 0x00000040, VK_SHADER_STAGE_MESH_BIT_EXT = 0x00000080, VK_SHADER_STAGE_SUBPASS_SHADING_BIT_HUAWEI = 0x00004000, + VK_SHADER_STAGE_CLUSTER_CULLING_BIT_HUAWEI = 0x00080000, VK_SHADER_STAGE_RAYGEN_BIT_NV = VK_SHADER_STAGE_RAYGEN_BIT_KHR, VK_SHADER_STAGE_ANY_HIT_BIT_NV = VK_SHADER_STAGE_ANY_HIT_BIT_KHR, VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV = VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, @@ -2631,6 +2713,7 @@ typedef VkFlags VkShaderStageFlags; typedef enum VkSamplerCreateFlagBits { VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT = 0x00000001, VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT = 0x00000002, + VK_SAMPLER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000008, VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT = 0x00000004, VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM = 0x00000010, VK_SAMPLER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF @@ -2641,6 +2724,8 @@ typedef enum VkDescriptorPoolCreateFlagBits { VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT = 0x00000002, VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_EXT = 0x00000004, + VK_DESCRIPTOR_POOL_CREATE_ALLOW_OVERALLOCATION_SETS_BIT_NV = 0x00000008, + VK_DESCRIPTOR_POOL_CREATE_ALLOW_OVERALLOCATION_POOLS_BIT_NV = 0x00000010, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT = VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT, VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE = VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_EXT, VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF @@ -2651,6 +2736,9 @@ typedef VkFlags VkDescriptorPoolResetFlags; typedef enum VkDescriptorSetLayoutCreateFlagBits { VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT = 0x00000002, VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = 0x00000001, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_DESCRIPTOR_BUFFER_BIT_EXT = 0x00000010, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_EMBEDDED_IMMUTABLE_SAMPLERS_BIT_EXT = 0x00000020, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_INDIRECT_BINDABLE_BIT_NV = 0x00000080, VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_EXT = 0x00000004, VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT = VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE = VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_EXT, @@ -4807,6 +4895,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands( #endif +// VK_VERSION_1_1 is a preprocessor guard. Do not pass it to API calls. #define VK_VERSION_1_1 1 // Vulkan 1.1 version number #define VK_API_VERSION_1_1 VK_MAKE_API_VERSION(0, 1, 1, 0)// Patch version should always be set to 0 @@ -4924,6 +5013,7 @@ typedef enum VkExternalMemoryHandleTypeFlagBits { VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT = 0x00000100, VK_EXTERNAL_MEMORY_HANDLE_TYPE_ZIRCON_VMO_BIT_FUCHSIA = 0x00000800, VK_EXTERNAL_MEMORY_HANDLE_TYPE_RDMA_ADDRESS_BIT_NV = 0x00001000, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_SCREEN_BUFFER_BIT_QNX = 0x00004000, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, @@ -5672,6 +5762,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport( #endif +// VK_VERSION_1_2 is a preprocessor guard. Do not pass it to API calls. #define VK_VERSION_1_2 1 // Vulkan 1.2 version number #define VK_API_VERSION_1_2 VK_MAKE_API_VERSION(0, 1, 2, 0)// Patch version should always be set to 0 @@ -5703,6 +5794,8 @@ typedef enum VkDriverId { VK_DRIVER_ID_SAMSUNG_PROPRIETARY = 21, VK_DRIVER_ID_MESA_VENUS = 22, VK_DRIVER_ID_MESA_DOZEN = 23, + VK_DRIVER_ID_MESA_NVK = 24, + VK_DRIVER_ID_IMAGINATION_OPEN_SOURCE_MESA = 25, VK_DRIVER_ID_AMD_PROPRIETARY_KHR = VK_DRIVER_ID_AMD_PROPRIETARY, VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR = VK_DRIVER_ID_AMD_OPEN_SOURCE, VK_DRIVER_ID_MESA_RADV_KHR = VK_DRIVER_ID_MESA_RADV, @@ -5732,6 +5825,7 @@ typedef enum VkSamplerReductionMode { VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE = 0, VK_SAMPLER_REDUCTION_MODE_MIN = 1, VK_SAMPLER_REDUCTION_MODE_MAX = 2, + VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_RANGECLAMP_QCOM = 1000521000, VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE, VK_SAMPLER_REDUCTION_MODE_MIN_EXT = VK_SAMPLER_REDUCTION_MODE_MIN, VK_SAMPLER_REDUCTION_MODE_MAX_EXT = VK_SAMPLER_REDUCTION_MODE_MAX, @@ -6424,6 +6518,7 @@ VKAPI_ATTR uint64_t VKAPI_CALL vkGetDeviceMemoryOpaqueCaptureAddress( #endif +// VK_VERSION_1_3 is a preprocessor guard. Do not pass it to API calls. #define VK_VERSION_1_3 1 // Vulkan 1.3 version number #define VK_API_VERSION_1_3 VK_MAKE_API_VERSION(0, 1, 3, 0)// Patch version should always be set to 0 @@ -6515,9 +6610,7 @@ static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR = 0x2000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT = 0x4000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR = 0x4000000000ULL; -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR = 0x04000000ULL; -#endif #ifdef VK_ENABLE_BETA_EXTENSIONS static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VIDEO_ENCODE_BIT_KHR = 0x08000000ULL; #endif @@ -6535,10 +6628,12 @@ static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV = 0 static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV = 0x00100000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_EXT = 0x00080000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_EXT = 0x00100000ULL; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_SUBPASS_SHADER_BIT_HUAWEI = 0x8000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI = 0x8000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI = 0x10000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR = 0x10000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_MICROMAP_BUILD_BIT_EXT = 0x40000000ULL; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CLUSTER_CULLING_SHADER_BIT_HUAWEI = 0x20000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_OPTICAL_FLOW_BIT_NV = 0x20000000ULL; typedef VkFlags64 VkAccessFlags2; @@ -6587,12 +6682,8 @@ static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_READ_BIT = 0x200000000 static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR = 0x200000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT = 0x400000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR = 0x400000000ULL; -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkAccessFlagBits2 VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR = 0x800000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkAccessFlagBits2 VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR = 0x1000000000ULL; -#endif #ifdef VK_ENABLE_BETA_EXTENSIONS static const VkAccessFlagBits2 VK_ACCESS_2_VIDEO_ENCODE_READ_BIT_KHR = 0x2000000000ULL; #endif @@ -6613,6 +6704,7 @@ static const VkAccessFlagBits2 VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_NV = static const VkAccessFlagBits2 VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_NV = 0x00400000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_FRAGMENT_DENSITY_MAP_READ_BIT_EXT = 0x01000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000ULL; +static const VkAccessFlagBits2 VK_ACCESS_2_DESCRIPTOR_BUFFER_READ_BIT_EXT = 0x20000000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI = 0x8000000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_BINDING_TABLE_READ_BIT_KHR = 0x10000000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_MICROMAP_READ_BIT_EXT = 0x100000000000ULL; @@ -6697,15 +6789,12 @@ static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_ static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR = 0x100000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT = 0x200000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT_KHR = 0x200000000ULL; -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VIDEO_DECODE_OUTPUT_BIT_KHR = 0x02000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VIDEO_DECODE_DPB_BIT_KHR = 0x04000000ULL; -#endif static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR = 0x20000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x01000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x40000000ULL; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT = 0x400000000000ULL; #ifdef VK_ENABLE_BETA_EXTENSIONS static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VIDEO_ENCODE_INPUT_BIT_KHR = 0x08000000ULL; #endif @@ -7473,6 +7562,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetDeviceImageSparseMemoryRequirements( #endif +// VK_KHR_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_surface 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) #define VK_KHR_SURFACE_SPEC_VERSION 25 @@ -7587,6 +7677,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR( #endif +// VK_KHR_swapchain is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_swapchain 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) #define VK_KHR_SWAPCHAIN_SPEC_VERSION 70 @@ -7596,6 +7687,7 @@ typedef enum VkSwapchainCreateFlagBitsKHR { VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = 0x00000001, VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = 0x00000002, VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR = 0x00000004, + VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT = 0x00000008, VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkSwapchainCreateFlagBitsKHR; typedef VkFlags VkSwapchainCreateFlagsKHR; @@ -7746,6 +7838,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHR( #endif +// VK_KHR_display is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_display 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR) @@ -7871,6 +7964,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR( #endif +// VK_KHR_display_swapchain is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_display_swapchain 1 #define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 10 #define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain" @@ -7894,84 +7988,501 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR( #endif +// VK_KHR_sampler_mirror_clamp_to_edge is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_sampler_mirror_clamp_to_edge 1 #define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 3 #define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge" -#define VK_KHR_dynamic_rendering 1 -#define VK_KHR_DYNAMIC_RENDERING_SPEC_VERSION 1 -#define VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME "VK_KHR_dynamic_rendering" -typedef VkRenderingFlags VkRenderingFlagsKHR; +// VK_KHR_video_queue is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_queue 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionKHR) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionParametersKHR) +#define VK_KHR_VIDEO_QUEUE_SPEC_VERSION 8 +#define VK_KHR_VIDEO_QUEUE_EXTENSION_NAME "VK_KHR_video_queue" -typedef VkRenderingFlagBits VkRenderingFlagBitsKHR; +typedef enum VkQueryResultStatusKHR { + VK_QUERY_RESULT_STATUS_ERROR_KHR = -1, + VK_QUERY_RESULT_STATUS_NOT_READY_KHR = 0, + VK_QUERY_RESULT_STATUS_COMPLETE_KHR = 1, + VK_QUERY_RESULT_STATUS_INSUFFICIENT_BITSTREAM_BUFFER_RANGE_KHR = -1000299000, + VK_QUERY_RESULT_STATUS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkQueryResultStatusKHR; -typedef VkRenderingInfo VkRenderingInfoKHR; +typedef enum VkVideoCodecOperationFlagBitsKHR { + VK_VIDEO_CODEC_OPERATION_NONE_KHR = 0, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT = 0x00010000, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT = 0x00020000, +#endif + VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR = 0x00000001, + VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR = 0x00000002, + VK_VIDEO_CODEC_OPERATION_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoCodecOperationFlagBitsKHR; +typedef VkFlags VkVideoCodecOperationFlagsKHR; + +typedef enum VkVideoChromaSubsamplingFlagBitsKHR { + VK_VIDEO_CHROMA_SUBSAMPLING_INVALID_KHR = 0, + VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR = 0x00000001, + VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR = 0x00000002, + VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR = 0x00000004, + VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR = 0x00000008, + VK_VIDEO_CHROMA_SUBSAMPLING_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoChromaSubsamplingFlagBitsKHR; +typedef VkFlags VkVideoChromaSubsamplingFlagsKHR; + +typedef enum VkVideoComponentBitDepthFlagBitsKHR { + VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR = 0, + VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR = 0x00000001, + VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR = 0x00000004, + VK_VIDEO_COMPONENT_BIT_DEPTH_12_BIT_KHR = 0x00000010, + VK_VIDEO_COMPONENT_BIT_DEPTH_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoComponentBitDepthFlagBitsKHR; +typedef VkFlags VkVideoComponentBitDepthFlagsKHR; + +typedef enum VkVideoCapabilityFlagBitsKHR { + VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR = 0x00000001, + VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR = 0x00000002, + VK_VIDEO_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoCapabilityFlagBitsKHR; +typedef VkFlags VkVideoCapabilityFlagsKHR; + +typedef enum VkVideoSessionCreateFlagBitsKHR { + VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR = 0x00000001, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_VIDEO_SESSION_CREATE_ALLOW_ENCODE_PARAMETER_OPTIMIZATIONS_BIT_KHR = 0x00000002, +#endif + VK_VIDEO_SESSION_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoSessionCreateFlagBitsKHR; +typedef VkFlags VkVideoSessionCreateFlagsKHR; +typedef VkFlags VkVideoSessionParametersCreateFlagsKHR; +typedef VkFlags VkVideoBeginCodingFlagsKHR; +typedef VkFlags VkVideoEndCodingFlagsKHR; + +typedef enum VkVideoCodingControlFlagBitsKHR { + VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR = 0x00000001, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR = 0x00000002, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR = 0x00000004, +#endif + VK_VIDEO_CODING_CONTROL_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoCodingControlFlagBitsKHR; +typedef VkFlags VkVideoCodingControlFlagsKHR; +typedef struct VkQueueFamilyQueryResultStatusPropertiesKHR { + VkStructureType sType; + void* pNext; + VkBool32 queryResultStatusSupport; +} VkQueueFamilyQueryResultStatusPropertiesKHR; -typedef VkRenderingAttachmentInfo VkRenderingAttachmentInfoKHR; +typedef struct VkQueueFamilyVideoPropertiesKHR { + VkStructureType sType; + void* pNext; + VkVideoCodecOperationFlagsKHR videoCodecOperations; +} VkQueueFamilyVideoPropertiesKHR; -typedef VkPipelineRenderingCreateInfo VkPipelineRenderingCreateInfoKHR; +typedef struct VkVideoProfileInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoCodecOperationFlagBitsKHR videoCodecOperation; + VkVideoChromaSubsamplingFlagsKHR chromaSubsampling; + VkVideoComponentBitDepthFlagsKHR lumaBitDepth; + VkVideoComponentBitDepthFlagsKHR chromaBitDepth; +} VkVideoProfileInfoKHR; -typedef VkPhysicalDeviceDynamicRenderingFeatures VkPhysicalDeviceDynamicRenderingFeaturesKHR; +typedef struct VkVideoProfileListInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t profileCount; + const VkVideoProfileInfoKHR* pProfiles; +} VkVideoProfileListInfoKHR; -typedef VkCommandBufferInheritanceRenderingInfo VkCommandBufferInheritanceRenderingInfoKHR; +typedef struct VkVideoCapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkVideoCapabilityFlagsKHR flags; + VkDeviceSize minBitstreamBufferOffsetAlignment; + VkDeviceSize minBitstreamBufferSizeAlignment; + VkExtent2D pictureAccessGranularity; + VkExtent2D minCodedExtent; + VkExtent2D maxCodedExtent; + uint32_t maxDpbSlots; + uint32_t maxActiveReferencePictures; + VkExtensionProperties stdHeaderVersion; +} VkVideoCapabilitiesKHR; + +typedef struct VkPhysicalDeviceVideoFormatInfoKHR { + VkStructureType sType; + const void* pNext; + VkImageUsageFlags imageUsage; +} VkPhysicalDeviceVideoFormatInfoKHR; -typedef struct VkRenderingFragmentShadingRateAttachmentInfoKHR { +typedef struct VkVideoFormatPropertiesKHR { + VkStructureType sType; + void* pNext; + VkFormat format; + VkComponentMapping componentMapping; + VkImageCreateFlags imageCreateFlags; + VkImageType imageType; + VkImageTiling imageTiling; + VkImageUsageFlags imageUsageFlags; +} VkVideoFormatPropertiesKHR; + +typedef struct VkVideoPictureResourceInfoKHR { VkStructureType sType; const void* pNext; - VkImageView imageView; - VkImageLayout imageLayout; - VkExtent2D shadingRateAttachmentTexelSize; -} VkRenderingFragmentShadingRateAttachmentInfoKHR; + VkOffset2D codedOffset; + VkExtent2D codedExtent; + uint32_t baseArrayLayer; + VkImageView imageViewBinding; +} VkVideoPictureResourceInfoKHR; -typedef struct VkRenderingFragmentDensityMapAttachmentInfoEXT { +typedef struct VkVideoReferenceSlotInfoKHR { + VkStructureType sType; + const void* pNext; + int32_t slotIndex; + const VkVideoPictureResourceInfoKHR* pPictureResource; +} VkVideoReferenceSlotInfoKHR; + +typedef struct VkVideoSessionMemoryRequirementsKHR { + VkStructureType sType; + void* pNext; + uint32_t memoryBindIndex; + VkMemoryRequirements memoryRequirements; +} VkVideoSessionMemoryRequirementsKHR; + +typedef struct VkBindVideoSessionMemoryInfoKHR { VkStructureType sType; const void* pNext; - VkImageView imageView; - VkImageLayout imageLayout; -} VkRenderingFragmentDensityMapAttachmentInfoEXT; + uint32_t memoryBindIndex; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + VkDeviceSize memorySize; +} VkBindVideoSessionMemoryInfoKHR; -typedef struct VkAttachmentSampleCountInfoAMD { +typedef struct VkVideoSessionCreateInfoKHR { VkStructureType sType; const void* pNext; - uint32_t colorAttachmentCount; - const VkSampleCountFlagBits* pColorAttachmentSamples; - VkSampleCountFlagBits depthStencilAttachmentSamples; -} VkAttachmentSampleCountInfoAMD; - -typedef VkAttachmentSampleCountInfoAMD VkAttachmentSampleCountInfoNV; + uint32_t queueFamilyIndex; + VkVideoSessionCreateFlagsKHR flags; + const VkVideoProfileInfoKHR* pVideoProfile; + VkFormat pictureFormat; + VkExtent2D maxCodedExtent; + VkFormat referencePictureFormat; + uint32_t maxDpbSlots; + uint32_t maxActiveReferencePictures; + const VkExtensionProperties* pStdHeaderVersion; +} VkVideoSessionCreateInfoKHR; + +typedef struct VkVideoSessionParametersCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoSessionParametersCreateFlagsKHR flags; + VkVideoSessionParametersKHR videoSessionParametersTemplate; + VkVideoSessionKHR videoSession; +} VkVideoSessionParametersCreateInfoKHR; -typedef struct VkMultiviewPerViewAttributesInfoNVX { +typedef struct VkVideoSessionParametersUpdateInfoKHR { VkStructureType sType; const void* pNext; - VkBool32 perViewAttributes; - VkBool32 perViewAttributesPositionXOnly; -} VkMultiviewPerViewAttributesInfoNVX; + uint32_t updateSequenceCount; +} VkVideoSessionParametersUpdateInfoKHR; -typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderingKHR)(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo); -typedef void (VKAPI_PTR *PFN_vkCmdEndRenderingKHR)(VkCommandBuffer commandBuffer); +typedef struct VkVideoBeginCodingInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoBeginCodingFlagsKHR flags; + VkVideoSessionKHR videoSession; + VkVideoSessionParametersKHR videoSessionParameters; + uint32_t referenceSlotCount; + const VkVideoReferenceSlotInfoKHR* pReferenceSlots; +} VkVideoBeginCodingInfoKHR; + +typedef struct VkVideoEndCodingInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoEndCodingFlagsKHR flags; +} VkVideoEndCodingInfoKHR; + +typedef struct VkVideoCodingControlInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoCodingControlFlagsKHR flags; +} VkVideoCodingControlInfoKHR; + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR)(VkPhysicalDevice physicalDevice, const VkVideoProfileInfoKHR* pVideoProfile, VkVideoCapabilitiesKHR* pCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceVideoFormatInfoKHR* pVideoFormatInfo, uint32_t* pVideoFormatPropertyCount, VkVideoFormatPropertiesKHR* pVideoFormatProperties); +typedef VkResult (VKAPI_PTR *PFN_vkCreateVideoSessionKHR)(VkDevice device, const VkVideoSessionCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkVideoSessionKHR* pVideoSession); +typedef void (VKAPI_PTR *PFN_vkDestroyVideoSessionKHR)(VkDevice device, VkVideoSessionKHR videoSession, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetVideoSessionMemoryRequirementsKHR)(VkDevice device, VkVideoSessionKHR videoSession, uint32_t* pMemoryRequirementsCount, VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements); +typedef VkResult (VKAPI_PTR *PFN_vkBindVideoSessionMemoryKHR)(VkDevice device, VkVideoSessionKHR videoSession, uint32_t bindSessionMemoryInfoCount, const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos); +typedef VkResult (VKAPI_PTR *PFN_vkCreateVideoSessionParametersKHR)(VkDevice device, const VkVideoSessionParametersCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkVideoSessionParametersKHR* pVideoSessionParameters); +typedef VkResult (VKAPI_PTR *PFN_vkUpdateVideoSessionParametersKHR)(VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo); +typedef void (VKAPI_PTR *PFN_vkDestroyVideoSessionParametersKHR)(VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkCmdBeginVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoBeginCodingInfoKHR* pBeginInfo); +typedef void (VKAPI_PTR *PFN_vkCmdEndVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoEndCodingInfoKHR* pEndCodingInfo); +typedef void (VKAPI_PTR *PFN_vkCmdControlVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoCodingControlInfoKHR* pCodingControlInfo); #ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderingKHR( - VkCommandBuffer commandBuffer, - const VkRenderingInfo* pRenderingInfo); +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceVideoCapabilitiesKHR( + VkPhysicalDevice physicalDevice, + const VkVideoProfileInfoKHR* pVideoProfile, + VkVideoCapabilitiesKHR* pCapabilities); -VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderingKHR( - VkCommandBuffer commandBuffer); -#endif +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceVideoFormatPropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceVideoFormatInfoKHR* pVideoFormatInfo, + uint32_t* pVideoFormatPropertyCount, + VkVideoFormatPropertiesKHR* pVideoFormatProperties); +VKAPI_ATTR VkResult VKAPI_CALL vkCreateVideoSessionKHR( + VkDevice device, + const VkVideoSessionCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkVideoSessionKHR* pVideoSession); -#define VK_KHR_multiview 1 -#define VK_KHR_MULTIVIEW_SPEC_VERSION 1 -#define VK_KHR_MULTIVIEW_EXTENSION_NAME "VK_KHR_multiview" -typedef VkRenderPassMultiviewCreateInfo VkRenderPassMultiviewCreateInfoKHR; +VKAPI_ATTR void VKAPI_CALL vkDestroyVideoSessionKHR( + VkDevice device, + VkVideoSessionKHR videoSession, + const VkAllocationCallbacks* pAllocator); -typedef VkPhysicalDeviceMultiviewFeatures VkPhysicalDeviceMultiviewFeaturesKHR; +VKAPI_ATTR VkResult VKAPI_CALL vkGetVideoSessionMemoryRequirementsKHR( + VkDevice device, + VkVideoSessionKHR videoSession, + uint32_t* pMemoryRequirementsCount, + VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements); -typedef VkPhysicalDeviceMultiviewProperties VkPhysicalDeviceMultiviewPropertiesKHR; +VKAPI_ATTR VkResult VKAPI_CALL vkBindVideoSessionMemoryKHR( + VkDevice device, + VkVideoSessionKHR videoSession, + uint32_t bindSessionMemoryInfoCount, + const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos); +VKAPI_ATTR VkResult VKAPI_CALL vkCreateVideoSessionParametersKHR( + VkDevice device, + const VkVideoSessionParametersCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkVideoSessionParametersKHR* pVideoSessionParameters); + +VKAPI_ATTR VkResult VKAPI_CALL vkUpdateVideoSessionParametersKHR( + VkDevice device, + VkVideoSessionParametersKHR videoSessionParameters, + const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo); + +VKAPI_ATTR void VKAPI_CALL vkDestroyVideoSessionParametersKHR( + VkDevice device, + VkVideoSessionParametersKHR videoSessionParameters, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkCmdBeginVideoCodingKHR( + VkCommandBuffer commandBuffer, + const VkVideoBeginCodingInfoKHR* pBeginInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndVideoCodingKHR( + VkCommandBuffer commandBuffer, + const VkVideoEndCodingInfoKHR* pEndCodingInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdControlVideoCodingKHR( + VkCommandBuffer commandBuffer, + const VkVideoCodingControlInfoKHR* pCodingControlInfo); +#endif + + +// VK_KHR_video_decode_queue is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_decode_queue 1 +#define VK_KHR_VIDEO_DECODE_QUEUE_SPEC_VERSION 7 +#define VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME "VK_KHR_video_decode_queue" + +typedef enum VkVideoDecodeCapabilityFlagBitsKHR { + VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR = 0x00000001, + VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR = 0x00000002, + VK_VIDEO_DECODE_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoDecodeCapabilityFlagBitsKHR; +typedef VkFlags VkVideoDecodeCapabilityFlagsKHR; + +typedef enum VkVideoDecodeUsageFlagBitsKHR { + VK_VIDEO_DECODE_USAGE_DEFAULT_KHR = 0, + VK_VIDEO_DECODE_USAGE_TRANSCODING_BIT_KHR = 0x00000001, + VK_VIDEO_DECODE_USAGE_OFFLINE_BIT_KHR = 0x00000002, + VK_VIDEO_DECODE_USAGE_STREAMING_BIT_KHR = 0x00000004, + VK_VIDEO_DECODE_USAGE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoDecodeUsageFlagBitsKHR; +typedef VkFlags VkVideoDecodeUsageFlagsKHR; +typedef VkFlags VkVideoDecodeFlagsKHR; +typedef struct VkVideoDecodeCapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkVideoDecodeCapabilityFlagsKHR flags; +} VkVideoDecodeCapabilitiesKHR; + +typedef struct VkVideoDecodeUsageInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoDecodeUsageFlagsKHR videoUsageHints; +} VkVideoDecodeUsageInfoKHR; + +typedef struct VkVideoDecodeInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoDecodeFlagsKHR flags; + VkBuffer srcBuffer; + VkDeviceSize srcBufferOffset; + VkDeviceSize srcBufferRange; + VkVideoPictureResourceInfoKHR dstPictureResource; + const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot; + uint32_t referenceSlotCount; + const VkVideoReferenceSlotInfoKHR* pReferenceSlots; +} VkVideoDecodeInfoKHR; + +typedef void (VKAPI_PTR *PFN_vkCmdDecodeVideoKHR)(VkCommandBuffer commandBuffer, const VkVideoDecodeInfoKHR* pDecodeInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdDecodeVideoKHR( + VkCommandBuffer commandBuffer, + const VkVideoDecodeInfoKHR* pDecodeInfo); +#endif + + +// VK_KHR_video_decode_h264 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_decode_h264 1 +#include "vk_video/vulkan_video_codec_h264std.h" +#include "vk_video/vulkan_video_codec_h264std_decode.h" +#define VK_KHR_VIDEO_DECODE_H264_SPEC_VERSION 8 +#define VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME "VK_KHR_video_decode_h264" + +typedef enum VkVideoDecodeH264PictureLayoutFlagBitsKHR { + VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR = 0, + VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR = 0x00000001, + VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR = 0x00000002, + VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoDecodeH264PictureLayoutFlagBitsKHR; +typedef VkFlags VkVideoDecodeH264PictureLayoutFlagsKHR; +typedef struct VkVideoDecodeH264ProfileInfoKHR { + VkStructureType sType; + const void* pNext; + StdVideoH264ProfileIdc stdProfileIdc; + VkVideoDecodeH264PictureLayoutFlagBitsKHR pictureLayout; +} VkVideoDecodeH264ProfileInfoKHR; + +typedef struct VkVideoDecodeH264CapabilitiesKHR { + VkStructureType sType; + void* pNext; + StdVideoH264LevelIdc maxLevelIdc; + VkOffset2D fieldOffsetGranularity; +} VkVideoDecodeH264CapabilitiesKHR; + +typedef struct VkVideoDecodeH264SessionParametersAddInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t stdSPSCount; + const StdVideoH264SequenceParameterSet* pStdSPSs; + uint32_t stdPPSCount; + const StdVideoH264PictureParameterSet* pStdPPSs; +} VkVideoDecodeH264SessionParametersAddInfoKHR; + +typedef struct VkVideoDecodeH264SessionParametersCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t maxStdSPSCount; + uint32_t maxStdPPSCount; + const VkVideoDecodeH264SessionParametersAddInfoKHR* pParametersAddInfo; +} VkVideoDecodeH264SessionParametersCreateInfoKHR; + +typedef struct VkVideoDecodeH264PictureInfoKHR { + VkStructureType sType; + const void* pNext; + const StdVideoDecodeH264PictureInfo* pStdPictureInfo; + uint32_t sliceCount; + const uint32_t* pSliceOffsets; +} VkVideoDecodeH264PictureInfoKHR; + +typedef struct VkVideoDecodeH264DpbSlotInfoKHR { + VkStructureType sType; + const void* pNext; + const StdVideoDecodeH264ReferenceInfo* pStdReferenceInfo; +} VkVideoDecodeH264DpbSlotInfoKHR; + + + +// VK_KHR_dynamic_rendering is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_dynamic_rendering 1 +#define VK_KHR_DYNAMIC_RENDERING_SPEC_VERSION 1 +#define VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME "VK_KHR_dynamic_rendering" +typedef VkRenderingFlags VkRenderingFlagsKHR; + +typedef VkRenderingFlagBits VkRenderingFlagBitsKHR; + +typedef VkRenderingInfo VkRenderingInfoKHR; + +typedef VkRenderingAttachmentInfo VkRenderingAttachmentInfoKHR; + +typedef VkPipelineRenderingCreateInfo VkPipelineRenderingCreateInfoKHR; + +typedef VkPhysicalDeviceDynamicRenderingFeatures VkPhysicalDeviceDynamicRenderingFeaturesKHR; + +typedef VkCommandBufferInheritanceRenderingInfo VkCommandBufferInheritanceRenderingInfoKHR; + +typedef struct VkRenderingFragmentShadingRateAttachmentInfoKHR { + VkStructureType sType; + const void* pNext; + VkImageView imageView; + VkImageLayout imageLayout; + VkExtent2D shadingRateAttachmentTexelSize; +} VkRenderingFragmentShadingRateAttachmentInfoKHR; + +typedef struct VkRenderingFragmentDensityMapAttachmentInfoEXT { + VkStructureType sType; + const void* pNext; + VkImageView imageView; + VkImageLayout imageLayout; +} VkRenderingFragmentDensityMapAttachmentInfoEXT; + +typedef struct VkAttachmentSampleCountInfoAMD { + VkStructureType sType; + const void* pNext; + uint32_t colorAttachmentCount; + const VkSampleCountFlagBits* pColorAttachmentSamples; + VkSampleCountFlagBits depthStencilAttachmentSamples; +} VkAttachmentSampleCountInfoAMD; + +typedef VkAttachmentSampleCountInfoAMD VkAttachmentSampleCountInfoNV; + +typedef struct VkMultiviewPerViewAttributesInfoNVX { + VkStructureType sType; + const void* pNext; + VkBool32 perViewAttributes; + VkBool32 perViewAttributesPositionXOnly; +} VkMultiviewPerViewAttributesInfoNVX; + +typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderingKHR)(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo); +typedef void (VKAPI_PTR *PFN_vkCmdEndRenderingKHR)(VkCommandBuffer commandBuffer); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderingKHR( + VkCommandBuffer commandBuffer, + const VkRenderingInfo* pRenderingInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderingKHR( + VkCommandBuffer commandBuffer); +#endif + + +// VK_KHR_multiview is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_multiview 1 +#define VK_KHR_MULTIVIEW_SPEC_VERSION 1 +#define VK_KHR_MULTIVIEW_EXTENSION_NAME "VK_KHR_multiview" +typedef VkRenderPassMultiviewCreateInfo VkRenderPassMultiviewCreateInfoKHR; + +typedef VkPhysicalDeviceMultiviewFeatures VkPhysicalDeviceMultiviewFeaturesKHR; + +typedef VkPhysicalDeviceMultiviewProperties VkPhysicalDeviceMultiviewPropertiesKHR; + +// VK_KHR_get_physical_device_properties2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_get_physical_device_properties2 1 #define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 2 #define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2" @@ -8037,6 +8548,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR( #endif +// VK_KHR_device_group is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_device_group 1 #define VK_KHR_DEVICE_GROUP_SPEC_VERSION 4 #define VK_KHR_DEVICE_GROUP_EXTENSION_NAME "VK_KHR_device_group" @@ -8089,11 +8601,13 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBaseKHR( #endif +// VK_KHR_shader_draw_parameters is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_draw_parameters 1 #define VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION 1 #define VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME "VK_KHR_shader_draw_parameters" +// VK_KHR_maintenance1 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_maintenance1 1 #define VK_KHR_MAINTENANCE_1_SPEC_VERSION 2 #define VK_KHR_MAINTENANCE_1_EXTENSION_NAME "VK_KHR_maintenance1" @@ -8111,6 +8625,7 @@ VKAPI_ATTR void VKAPI_CALL vkTrimCommandPoolKHR( #endif +// VK_KHR_device_group_creation is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_device_group_creation 1 #define VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION 1 #define VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHR_device_group_creation" @@ -8129,6 +8644,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroupsKHR( #endif +// VK_KHR_external_memory_capabilities is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_memory_capabilities 1 #define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities" @@ -8163,6 +8679,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR( #endif +// VK_KHR_external_memory is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_memory 1 #define VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME "VK_KHR_external_memory" @@ -8175,6 +8692,7 @@ typedef VkExportMemoryAllocateInfo VkExportMemoryAllocateInfoKHR; +// VK_KHR_external_memory_fd is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_memory_fd 1 #define VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME "VK_KHR_external_memory_fd" @@ -8215,6 +8733,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHR( #endif +// VK_KHR_external_semaphore_capabilities is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_semaphore_capabilities 1 #define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_semaphore_capabilities" @@ -8240,6 +8759,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR( #endif +// VK_KHR_external_semaphore is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_semaphore 1 #define VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_KHR_external_semaphore" @@ -8251,6 +8771,7 @@ typedef VkExportSemaphoreCreateInfo VkExportSemaphoreCreateInfoKHR; +// VK_KHR_external_semaphore_fd is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_semaphore_fd 1 #define VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME "VK_KHR_external_semaphore_fd" @@ -8285,6 +8806,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHR( #endif +// VK_KHR_push_descriptor is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_push_descriptor 1 #define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 2 #define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor" @@ -8315,6 +8837,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR( #endif +// VK_KHR_shader_float16_int8 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_float16_int8 1 #define VK_KHR_SHADER_FLOAT16_INT8_SPEC_VERSION 1 #define VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME "VK_KHR_shader_float16_int8" @@ -8324,6 +8847,7 @@ typedef VkPhysicalDeviceShaderFloat16Int8Features VkPhysicalDeviceFloat16Int8Fea +// VK_KHR_16bit_storage is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_16bit_storage 1 #define VK_KHR_16BIT_STORAGE_SPEC_VERSION 1 #define VK_KHR_16BIT_STORAGE_EXTENSION_NAME "VK_KHR_16bit_storage" @@ -8331,6 +8855,7 @@ typedef VkPhysicalDevice16BitStorageFeatures VkPhysicalDevice16BitStorageFeature +// VK_KHR_incremental_present is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_incremental_present 1 #define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 2 #define VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME "VK_KHR_incremental_present" @@ -8354,6 +8879,7 @@ typedef struct VkPresentRegionsKHR { +// VK_KHR_descriptor_update_template is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_descriptor_update_template 1 typedef VkDescriptorUpdateTemplate VkDescriptorUpdateTemplateKHR; @@ -8391,6 +8917,7 @@ VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplateKHR( #endif +// VK_KHR_imageless_framebuffer is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_imageless_framebuffer 1 #define VK_KHR_IMAGELESS_FRAMEBUFFER_SPEC_VERSION 1 #define VK_KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME "VK_KHR_imageless_framebuffer" @@ -8404,6 +8931,7 @@ typedef VkRenderPassAttachmentBeginInfo VkRenderPassAttachmentBeginInfoKHR; +// VK_KHR_create_renderpass2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_create_renderpass2 1 #define VK_KHR_CREATE_RENDERPASS_2_SPEC_VERSION 1 #define VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME "VK_KHR_create_renderpass2" @@ -8449,6 +8977,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass2KHR( #endif +// VK_KHR_shared_presentable_image is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shared_presentable_image 1 #define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1 #define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image" @@ -8467,6 +8996,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR( #endif +// VK_KHR_external_fence_capabilities is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_fence_capabilities 1 #define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_fence_capabilities" @@ -8492,6 +9022,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR( #endif +// VK_KHR_external_fence is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_fence 1 #define VK_KHR_EXTERNAL_FENCE_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME "VK_KHR_external_fence" @@ -8503,6 +9034,7 @@ typedef VkExportFenceCreateInfo VkExportFenceCreateInfoKHR; +// VK_KHR_external_fence_fd is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_fence_fd 1 #define VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME "VK_KHR_external_fence_fd" @@ -8537,6 +9069,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceFdKHR( #endif +// VK_KHR_performance_query is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_performance_query 1 #define VK_KHR_PERFORMANCE_QUERY_SPEC_VERSION 1 #define VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME "VK_KHR_performance_query" @@ -8677,6 +9210,7 @@ VKAPI_ATTR void VKAPI_CALL vkReleaseProfilingLockKHR( #endif +// VK_KHR_maintenance2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_maintenance2 1 #define VK_KHR_MAINTENANCE_2_SPEC_VERSION 1 #define VK_KHR_MAINTENANCE_2_EXTENSION_NAME "VK_KHR_maintenance2" @@ -8698,6 +9232,7 @@ typedef VkPipelineTessellationDomainOriginStateCreateInfo VkPipelineTessellation +// VK_KHR_get_surface_capabilities2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_get_surface_capabilities2 1 #define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 #define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" @@ -8736,6 +9271,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR( #endif +// VK_KHR_variable_pointers is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_variable_pointers 1 #define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1 #define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers" @@ -8745,6 +9281,7 @@ typedef VkPhysicalDeviceVariablePointersFeatures VkPhysicalDeviceVariablePointer +// VK_KHR_get_display_properties2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_get_display_properties2 1 #define VK_KHR_GET_DISPLAY_PROPERTIES_2_SPEC_VERSION 1 #define VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_display_properties2" @@ -8808,6 +9345,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilities2KHR( #endif +// VK_KHR_dedicated_allocation is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_dedicated_allocation 1 #define VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION 3 #define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_KHR_dedicated_allocation" @@ -8817,16 +9355,19 @@ typedef VkMemoryDedicatedAllocateInfo VkMemoryDedicatedAllocateInfoKHR; +// VK_KHR_storage_buffer_storage_class is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_storage_buffer_storage_class 1 #define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION 1 #define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME "VK_KHR_storage_buffer_storage_class" +// VK_KHR_relaxed_block_layout is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_relaxed_block_layout 1 #define VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION 1 #define VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME "VK_KHR_relaxed_block_layout" +// VK_KHR_get_memory_requirements2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_get_memory_requirements2 1 #define VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION 1 #define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME "VK_KHR_get_memory_requirements2" @@ -8863,6 +9404,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR( #endif +// VK_KHR_image_format_list is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_image_format_list 1 #define VK_KHR_IMAGE_FORMAT_LIST_SPEC_VERSION 1 #define VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME "VK_KHR_image_format_list" @@ -8870,6 +9412,7 @@ typedef VkImageFormatListCreateInfo VkImageFormatListCreateInfoKHR; +// VK_KHR_sampler_ycbcr_conversion is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_sampler_ycbcr_conversion 1 typedef VkSamplerYcbcrConversion VkSamplerYcbcrConversionKHR; @@ -8910,6 +9453,7 @@ VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversionKHR( #endif +// VK_KHR_bind_memory2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_bind_memory2 1 #define VK_KHR_BIND_MEMORY_2_SPEC_VERSION 1 #define VK_KHR_BIND_MEMORY_2_EXTENSION_NAME "VK_KHR_bind_memory2" @@ -8933,6 +9477,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2KHR( #endif +// VK_KHR_maintenance3 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_maintenance3 1 #define VK_KHR_MAINTENANCE_3_SPEC_VERSION 1 #define VK_KHR_MAINTENANCE_3_EXTENSION_NAME "VK_KHR_maintenance3" @@ -8952,6 +9497,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupportKHR( #endif +// VK_KHR_draw_indirect_count is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_draw_indirect_count 1 #define VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION 1 #define VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_KHR_draw_indirect_count" @@ -8979,6 +9525,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountKHR( #endif +// VK_KHR_shader_subgroup_extended_types is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_subgroup_extended_types 1 #define VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_SPEC_VERSION 1 #define VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME "VK_KHR_shader_subgroup_extended_types" @@ -8986,6 +9533,7 @@ typedef VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures VkPhysicalDeviceShad +// VK_KHR_8bit_storage is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_8bit_storage 1 #define VK_KHR_8BIT_STORAGE_SPEC_VERSION 1 #define VK_KHR_8BIT_STORAGE_EXTENSION_NAME "VK_KHR_8bit_storage" @@ -8993,6 +9541,7 @@ typedef VkPhysicalDevice8BitStorageFeatures VkPhysicalDevice8BitStorageFeaturesK +// VK_KHR_shader_atomic_int64 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_atomic_int64 1 #define VK_KHR_SHADER_ATOMIC_INT64_SPEC_VERSION 1 #define VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME "VK_KHR_shader_atomic_int64" @@ -9000,6 +9549,7 @@ typedef VkPhysicalDeviceShaderAtomicInt64Features VkPhysicalDeviceShaderAtomicIn +// VK_KHR_shader_clock is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_clock 1 #define VK_KHR_SHADER_CLOCK_SPEC_VERSION 1 #define VK_KHR_SHADER_CLOCK_EXTENSION_NAME "VK_KHR_shader_clock" @@ -9012,6 +9562,61 @@ typedef struct VkPhysicalDeviceShaderClockFeaturesKHR { +// VK_KHR_video_decode_h265 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_decode_h265 1 +#include "vk_video/vulkan_video_codec_h265std.h" +#include "vk_video/vulkan_video_codec_h265std_decode.h" +#define VK_KHR_VIDEO_DECODE_H265_SPEC_VERSION 7 +#define VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME "VK_KHR_video_decode_h265" +typedef struct VkVideoDecodeH265ProfileInfoKHR { + VkStructureType sType; + const void* pNext; + StdVideoH265ProfileIdc stdProfileIdc; +} VkVideoDecodeH265ProfileInfoKHR; + +typedef struct VkVideoDecodeH265CapabilitiesKHR { + VkStructureType sType; + void* pNext; + StdVideoH265LevelIdc maxLevelIdc; +} VkVideoDecodeH265CapabilitiesKHR; + +typedef struct VkVideoDecodeH265SessionParametersAddInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t stdVPSCount; + const StdVideoH265VideoParameterSet* pStdVPSs; + uint32_t stdSPSCount; + const StdVideoH265SequenceParameterSet* pStdSPSs; + uint32_t stdPPSCount; + const StdVideoH265PictureParameterSet* pStdPPSs; +} VkVideoDecodeH265SessionParametersAddInfoKHR; + +typedef struct VkVideoDecodeH265SessionParametersCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t maxStdVPSCount; + uint32_t maxStdSPSCount; + uint32_t maxStdPPSCount; + const VkVideoDecodeH265SessionParametersAddInfoKHR* pParametersAddInfo; +} VkVideoDecodeH265SessionParametersCreateInfoKHR; + +typedef struct VkVideoDecodeH265PictureInfoKHR { + VkStructureType sType; + const void* pNext; + const StdVideoDecodeH265PictureInfo* pStdPictureInfo; + uint32_t sliceSegmentCount; + const uint32_t* pSliceSegmentOffsets; +} VkVideoDecodeH265PictureInfoKHR; + +typedef struct VkVideoDecodeH265DpbSlotInfoKHR { + VkStructureType sType; + const void* pNext; + const StdVideoDecodeH265ReferenceInfo* pStdReferenceInfo; +} VkVideoDecodeH265DpbSlotInfoKHR; + + + +// VK_KHR_global_priority is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_global_priority 1 #define VK_MAX_GLOBAL_PRIORITY_SIZE_KHR 16U #define VK_KHR_GLOBAL_PRIORITY_SPEC_VERSION 1 @@ -9049,6 +9654,7 @@ typedef struct VkQueueFamilyGlobalPriorityPropertiesKHR { +// VK_KHR_driver_properties is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_driver_properties 1 #define VK_KHR_DRIVER_PROPERTIES_SPEC_VERSION 1 #define VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME "VK_KHR_driver_properties" @@ -9062,6 +9668,7 @@ typedef VkPhysicalDeviceDriverProperties VkPhysicalDeviceDriverPropertiesKHR; +// VK_KHR_shader_float_controls is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_float_controls 1 #define VK_KHR_SHADER_FLOAT_CONTROLS_SPEC_VERSION 4 #define VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME "VK_KHR_shader_float_controls" @@ -9071,6 +9678,7 @@ typedef VkPhysicalDeviceFloatControlsProperties VkPhysicalDeviceFloatControlsPro +// VK_KHR_depth_stencil_resolve is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_depth_stencil_resolve 1 #define VK_KHR_DEPTH_STENCIL_RESOLVE_SPEC_VERSION 1 #define VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME "VK_KHR_depth_stencil_resolve" @@ -9084,11 +9692,13 @@ typedef VkPhysicalDeviceDepthStencilResolveProperties VkPhysicalDeviceDepthStenc +// VK_KHR_swapchain_mutable_format is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_swapchain_mutable_format 1 #define VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_SPEC_VERSION 1 #define VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME "VK_KHR_swapchain_mutable_format" +// VK_KHR_timeline_semaphore is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_timeline_semaphore 1 #define VK_KHR_TIMELINE_SEMAPHORE_SPEC_VERSION 2 #define VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME "VK_KHR_timeline_semaphore" @@ -9131,6 +9741,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkSignalSemaphoreKHR( #endif +// VK_KHR_vulkan_memory_model is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_vulkan_memory_model 1 #define VK_KHR_VULKAN_MEMORY_MODEL_SPEC_VERSION 3 #define VK_KHR_VULKAN_MEMORY_MODEL_EXTENSION_NAME "VK_KHR_vulkan_memory_model" @@ -9138,6 +9749,7 @@ typedef VkPhysicalDeviceVulkanMemoryModelFeatures VkPhysicalDeviceVulkanMemoryMo +// VK_KHR_shader_terminate_invocation is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_terminate_invocation 1 #define VK_KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION 1 #define VK_KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME "VK_KHR_shader_terminate_invocation" @@ -9145,6 +9757,7 @@ typedef VkPhysicalDeviceShaderTerminateInvocationFeatures VkPhysicalDeviceShader +// VK_KHR_fragment_shading_rate is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_fragment_shading_rate 1 #define VK_KHR_FRAGMENT_SHADING_RATE_SPEC_VERSION 2 #define VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME "VK_KHR_fragment_shading_rate" @@ -9224,11 +9837,13 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetFragmentShadingRateKHR( #endif +// VK_KHR_spirv_1_4 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_spirv_1_4 1 #define VK_KHR_SPIRV_1_4_SPEC_VERSION 1 #define VK_KHR_SPIRV_1_4_EXTENSION_NAME "VK_KHR_spirv_1_4" +// VK_KHR_surface_protected_capabilities is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_surface_protected_capabilities 1 #define VK_KHR_SURFACE_PROTECTED_CAPABILITIES_SPEC_VERSION 1 #define VK_KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME "VK_KHR_surface_protected_capabilities" @@ -9240,6 +9855,7 @@ typedef struct VkSurfaceProtectedCapabilitiesKHR { +// VK_KHR_separate_depth_stencil_layouts is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_separate_depth_stencil_layouts 1 #define VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_SPEC_VERSION 1 #define VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_EXTENSION_NAME "VK_KHR_separate_depth_stencil_layouts" @@ -9251,6 +9867,7 @@ typedef VkAttachmentDescriptionStencilLayout VkAttachmentDescriptionStencilLayou +// VK_KHR_present_wait is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_present_wait 1 #define VK_KHR_PRESENT_WAIT_SPEC_VERSION 1 #define VK_KHR_PRESENT_WAIT_EXTENSION_NAME "VK_KHR_present_wait" @@ -9271,6 +9888,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkWaitForPresentKHR( #endif +// VK_KHR_uniform_buffer_standard_layout is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_uniform_buffer_standard_layout 1 #define VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_SPEC_VERSION 1 #define VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME "VK_KHR_uniform_buffer_standard_layout" @@ -9278,6 +9896,7 @@ typedef VkPhysicalDeviceUniformBufferStandardLayoutFeatures VkPhysicalDeviceUnif +// VK_KHR_buffer_device_address is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_buffer_device_address 1 #define VK_KHR_BUFFER_DEVICE_ADDRESS_SPEC_VERSION 1 #define VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME "VK_KHR_buffer_device_address" @@ -9310,6 +9929,7 @@ VKAPI_ATTR uint64_t VKAPI_CALL vkGetDeviceMemoryOpaqueCaptureAddressKHR( #endif +// VK_KHR_deferred_host_operations is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_deferred_host_operations 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeferredOperationKHR) #define VK_KHR_DEFERRED_HOST_OPERATIONS_SPEC_VERSION 4 @@ -9345,6 +9965,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkDeferredOperationJoinKHR( #endif +// VK_KHR_pipeline_executable_properties is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_pipeline_executable_properties 1 #define VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_SPEC_VERSION 1 #define VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME "VK_KHR_pipeline_executable_properties" @@ -9435,6 +10056,43 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutableInternalRepresentationsKHR #endif +// VK_KHR_map_memory2 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_map_memory2 1 +#define VK_KHR_MAP_MEMORY_2_SPEC_VERSION 1 +#define VK_KHR_MAP_MEMORY_2_EXTENSION_NAME "VK_KHR_map_memory2" +typedef VkFlags VkMemoryUnmapFlagsKHR; +typedef struct VkMemoryMapInfoKHR { + VkStructureType sType; + const void* pNext; + VkMemoryMapFlags flags; + VkDeviceMemory memory; + VkDeviceSize offset; + VkDeviceSize size; +} VkMemoryMapInfoKHR; + +typedef struct VkMemoryUnmapInfoKHR { + VkStructureType sType; + const void* pNext; + VkMemoryUnmapFlagsKHR flags; + VkDeviceMemory memory; +} VkMemoryUnmapInfoKHR; + +typedef VkResult (VKAPI_PTR *PFN_vkMapMemory2KHR)(VkDevice device, const VkMemoryMapInfoKHR* pMemoryMapInfo, void** ppData); +typedef VkResult (VKAPI_PTR *PFN_vkUnmapMemory2KHR)(VkDevice device, const VkMemoryUnmapInfoKHR* pMemoryUnmapInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory2KHR( + VkDevice device, + const VkMemoryMapInfoKHR* pMemoryMapInfo, + void** ppData); + +VKAPI_ATTR VkResult VKAPI_CALL vkUnmapMemory2KHR( + VkDevice device, + const VkMemoryUnmapInfoKHR* pMemoryUnmapInfo); +#endif + + +// VK_KHR_shader_integer_dot_product is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_integer_dot_product 1 #define VK_KHR_SHADER_INTEGER_DOT_PRODUCT_SPEC_VERSION 1 #define VK_KHR_SHADER_INTEGER_DOT_PRODUCT_EXTENSION_NAME "VK_KHR_shader_integer_dot_product" @@ -9444,6 +10102,7 @@ typedef VkPhysicalDeviceShaderIntegerDotProductProperties VkPhysicalDeviceShader +// VK_KHR_pipeline_library is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_pipeline_library 1 #define VK_KHR_PIPELINE_LIBRARY_SPEC_VERSION 1 #define VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME "VK_KHR_pipeline_library" @@ -9456,11 +10115,13 @@ typedef struct VkPipelineLibraryCreateInfoKHR { +// VK_KHR_shader_non_semantic_info is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_non_semantic_info 1 #define VK_KHR_SHADER_NON_SEMANTIC_INFO_SPEC_VERSION 1 #define VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME "VK_KHR_shader_non_semantic_info" +// VK_KHR_present_id is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_present_id 1 #define VK_KHR_PRESENT_ID_SPEC_VERSION 1 #define VK_KHR_PRESENT_ID_EXTENSION_NAME "VK_KHR_present_id" @@ -9479,6 +10140,7 @@ typedef struct VkPhysicalDevicePresentIdFeaturesKHR { +// VK_KHR_synchronization2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_synchronization2 1 #define VK_KHR_SYNCHRONIZATION_2_SPEC_VERSION 1 #define VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME "VK_KHR_synchronization2" @@ -9579,6 +10241,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetQueueCheckpointData2NV( #endif +// VK_KHR_fragment_shader_barycentric is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_fragment_shader_barycentric 1 #define VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION 1 #define VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME "VK_KHR_fragment_shader_barycentric" @@ -9596,6 +10259,7 @@ typedef struct VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR { +// VK_KHR_shader_subgroup_uniform_control_flow is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_subgroup_uniform_control_flow 1 #define VK_KHR_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_SPEC_VERSION 1 #define VK_KHR_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_EXTENSION_NAME "VK_KHR_shader_subgroup_uniform_control_flow" @@ -9607,6 +10271,7 @@ typedef struct VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR { +// VK_KHR_zero_initialize_workgroup_memory is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_zero_initialize_workgroup_memory 1 #define VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_SPEC_VERSION 1 #define VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_EXTENSION_NAME "VK_KHR_zero_initialize_workgroup_memory" @@ -9614,6 +10279,7 @@ typedef VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures VkPhysicalDeviceZe +// VK_KHR_workgroup_memory_explicit_layout is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_workgroup_memory_explicit_layout 1 #define VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_SPEC_VERSION 1 #define VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME "VK_KHR_workgroup_memory_explicit_layout" @@ -9628,6 +10294,7 @@ typedef struct VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR { +// VK_KHR_copy_commands2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_copy_commands2 1 #define VK_KHR_COPY_COMMANDS_2_SPEC_VERSION 1 #define VK_KHR_COPY_COMMANDS_2_EXTENSION_NAME "VK_KHR_copy_commands2" @@ -9687,6 +10354,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage2KHR( #endif +// VK_KHR_format_feature_flags2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_format_feature_flags2 1 #define VK_KHR_FORMAT_FEATURE_FLAGS_2_SPEC_VERSION 2 #define VK_KHR_FORMAT_FEATURE_FLAGS_2_EXTENSION_NAME "VK_KHR_format_feature_flags2" @@ -9698,6 +10366,7 @@ typedef VkFormatProperties3 VkFormatProperties3KHR; +// VK_KHR_ray_tracing_maintenance1 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_ray_tracing_maintenance1 1 #define VK_KHR_RAY_TRACING_MAINTENANCE_1_SPEC_VERSION 1 #define VK_KHR_RAY_TRACING_MAINTENANCE_1_EXTENSION_NAME "VK_KHR_ray_tracing_maintenance1" @@ -9734,11 +10403,13 @@ VKAPI_ATTR void VKAPI_CALL vkCmdTraceRaysIndirect2KHR( #endif +// VK_KHR_portability_enumeration is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_portability_enumeration 1 #define VK_KHR_PORTABILITY_ENUMERATION_SPEC_VERSION 1 #define VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME "VK_KHR_portability_enumeration" +// VK_KHR_maintenance4 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_maintenance4 1 #define VK_KHR_MAINTENANCE_4_SPEC_VERSION 2 #define VK_KHR_MAINTENANCE_4_EXTENSION_NAME "VK_KHR_maintenance4" @@ -9773,6 +10444,263 @@ VKAPI_ATTR void VKAPI_CALL vkGetDeviceImageSparseMemoryRequirementsKHR( #endif +// VK_KHR_maintenance5 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_maintenance5 1 +#define VK_KHR_MAINTENANCE_5_SPEC_VERSION 1 +#define VK_KHR_MAINTENANCE_5_EXTENSION_NAME "VK_KHR_maintenance5" +typedef VkFlags64 VkPipelineCreateFlags2KHR; + +// Flag bits for VkPipelineCreateFlagBits2KHR +typedef VkFlags64 VkPipelineCreateFlagBits2KHR; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DISABLE_OPTIMIZATION_BIT_KHR = 0x00000001ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_ALLOW_DERIVATIVES_BIT_KHR = 0x00000002ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DERIVATIVE_BIT_KHR = 0x00000004ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = 0x00000008ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DISPATCH_BASE_BIT_KHR = 0x00000010ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DEFER_COMPILE_BIT_NV = 0x00000020ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_CAPTURE_STATISTICS_BIT_KHR = 0x00000040ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR = 0x00000080ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_KHR = 0x00000100ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_EARLY_RETURN_ON_FAILURE_BIT_KHR = 0x00000200ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_LINK_TIME_OPTIMIZATION_BIT_EXT = 0x00000400ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT = 0x00800000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR = 0x00000800ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR = 0x00001000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_SKIP_AABBS_BIT_KHR = 0x00002000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR = 0x00004000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR = 0x00008000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR = 0x00010000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR = 0x00020000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR = 0x00080000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_INDIRECT_BINDABLE_BIT_NV = 0x00040000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_ALLOW_MOTION_BIT_NV = 0x00100000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00200000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT = 0x00400000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_OPACITY_MICROMAP_BIT_EXT = 0x01000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x02000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x04000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_NO_PROTECTED_ACCESS_BIT_EXT = 0x08000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_PROTECTED_ACCESS_ONLY_BIT_EXT = 0x40000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_DISPLACEMENT_MICROMAP_BIT_NV = 0x10000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DESCRIPTOR_BUFFER_BIT_EXT = 0x20000000ULL; + +typedef VkFlags64 VkBufferUsageFlags2KHR; + +// Flag bits for VkBufferUsageFlagBits2KHR +typedef VkFlags64 VkBufferUsageFlagBits2KHR; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT_KHR = 0x00000001ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFER_DST_BIT_KHR = 0x00000002ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_UNIFORM_TEXEL_BUFFER_BIT_KHR = 0x00000004ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_STORAGE_TEXEL_BUFFER_BIT_KHR = 0x00000008ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_UNIFORM_BUFFER_BIT_KHR = 0x00000010ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR = 0x00000020ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_INDEX_BUFFER_BIT_KHR = 0x00000040ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VERTEX_BUFFER_BIT_KHR = 0x00000080ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_INDIRECT_BUFFER_BIT_KHR = 0x00000100ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_EXECUTION_GRAPH_SCRATCH_BIT_AMDX = 0x02000000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_CONDITIONAL_RENDERING_BIT_EXT = 0x00000200ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_SHADER_BINDING_TABLE_BIT_KHR = 0x00000400ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_RAY_TRACING_BIT_NV = 0x00000400ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT = 0x00000800ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT = 0x00001000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_DECODE_SRC_BIT_KHR = 0x00002000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_DECODE_DST_BIT_KHR = 0x00004000ULL; +#ifdef VK_ENABLE_BETA_EXTENSIONS +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_ENCODE_DST_BIT_KHR = 0x00008000ULL; +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_ENCODE_SRC_BIT_KHR = 0x00010000ULL; +#endif +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_SHADER_DEVICE_ADDRESS_BIT_KHR = 0x00020000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR = 0x00080000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR = 0x00100000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT = 0x00200000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT = 0x00400000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER_BIT_EXT = 0x04000000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_MICROMAP_BUILD_INPUT_READ_ONLY_BIT_EXT = 0x00800000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_MICROMAP_STORAGE_BIT_EXT = 0x01000000ULL; + +typedef struct VkPhysicalDeviceMaintenance5FeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 maintenance5; +} VkPhysicalDeviceMaintenance5FeaturesKHR; + +typedef struct VkPhysicalDeviceMaintenance5PropertiesKHR { + VkStructureType sType; + void* pNext; + VkBool32 earlyFragmentMultisampleCoverageAfterSampleCounting; + VkBool32 earlyFragmentSampleMaskTestBeforeSampleCounting; + VkBool32 depthStencilSwizzleOneSupport; + VkBool32 polygonModePointSize; + VkBool32 nonStrictSinglePixelWideLinesUseParallelogram; + VkBool32 nonStrictWideLinesUseParallelogram; +} VkPhysicalDeviceMaintenance5PropertiesKHR; + +typedef struct VkRenderingAreaInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t viewMask; + uint32_t colorAttachmentCount; + const VkFormat* pColorAttachmentFormats; + VkFormat depthAttachmentFormat; + VkFormat stencilAttachmentFormat; +} VkRenderingAreaInfoKHR; + +typedef struct VkImageSubresource2KHR { + VkStructureType sType; + void* pNext; + VkImageSubresource imageSubresource; +} VkImageSubresource2KHR; + +typedef struct VkDeviceImageSubresourceInfoKHR { + VkStructureType sType; + const void* pNext; + const VkImageCreateInfo* pCreateInfo; + const VkImageSubresource2KHR* pSubresource; +} VkDeviceImageSubresourceInfoKHR; + +typedef struct VkSubresourceLayout2KHR { + VkStructureType sType; + void* pNext; + VkSubresourceLayout subresourceLayout; +} VkSubresourceLayout2KHR; + +typedef struct VkPipelineCreateFlags2CreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags2KHR flags; +} VkPipelineCreateFlags2CreateInfoKHR; + +typedef struct VkBufferUsageFlags2CreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkBufferUsageFlags2KHR usage; +} VkBufferUsageFlags2CreateInfoKHR; + +typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer2KHR)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, VkIndexType indexType); +typedef void (VKAPI_PTR *PFN_vkGetRenderingAreaGranularityKHR)(VkDevice device, const VkRenderingAreaInfoKHR* pRenderingAreaInfo, VkExtent2D* pGranularity); +typedef void (VKAPI_PTR *PFN_vkGetDeviceImageSubresourceLayoutKHR)(VkDevice device, const VkDeviceImageSubresourceInfoKHR* pInfo, VkSubresourceLayout2KHR* pLayout); +typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout2KHR)(VkDevice device, VkImage image, const VkImageSubresource2KHR* pSubresource, VkSubresourceLayout2KHR* pLayout); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer2KHR( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkDeviceSize size, + VkIndexType indexType); + +VKAPI_ATTR void VKAPI_CALL vkGetRenderingAreaGranularityKHR( + VkDevice device, + const VkRenderingAreaInfoKHR* pRenderingAreaInfo, + VkExtent2D* pGranularity); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceImageSubresourceLayoutKHR( + VkDevice device, + const VkDeviceImageSubresourceInfoKHR* pInfo, + VkSubresourceLayout2KHR* pLayout); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout2KHR( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout); +#endif + + +// VK_KHR_ray_tracing_position_fetch is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_ray_tracing_position_fetch 1 +#define VK_KHR_RAY_TRACING_POSITION_FETCH_SPEC_VERSION 1 +#define VK_KHR_RAY_TRACING_POSITION_FETCH_EXTENSION_NAME "VK_KHR_ray_tracing_position_fetch" +typedef struct VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 rayTracingPositionFetch; +} VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR; + + + +// VK_KHR_cooperative_matrix is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_cooperative_matrix 1 +#define VK_KHR_COOPERATIVE_MATRIX_SPEC_VERSION 2 +#define VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME "VK_KHR_cooperative_matrix" + +typedef enum VkComponentTypeKHR { + VK_COMPONENT_TYPE_FLOAT16_KHR = 0, + VK_COMPONENT_TYPE_FLOAT32_KHR = 1, + VK_COMPONENT_TYPE_FLOAT64_KHR = 2, + VK_COMPONENT_TYPE_SINT8_KHR = 3, + VK_COMPONENT_TYPE_SINT16_KHR = 4, + VK_COMPONENT_TYPE_SINT32_KHR = 5, + VK_COMPONENT_TYPE_SINT64_KHR = 6, + VK_COMPONENT_TYPE_UINT8_KHR = 7, + VK_COMPONENT_TYPE_UINT16_KHR = 8, + VK_COMPONENT_TYPE_UINT32_KHR = 9, + VK_COMPONENT_TYPE_UINT64_KHR = 10, + VK_COMPONENT_TYPE_FLOAT16_NV = VK_COMPONENT_TYPE_FLOAT16_KHR, + VK_COMPONENT_TYPE_FLOAT32_NV = VK_COMPONENT_TYPE_FLOAT32_KHR, + VK_COMPONENT_TYPE_FLOAT64_NV = VK_COMPONENT_TYPE_FLOAT64_KHR, + VK_COMPONENT_TYPE_SINT8_NV = VK_COMPONENT_TYPE_SINT8_KHR, + VK_COMPONENT_TYPE_SINT16_NV = VK_COMPONENT_TYPE_SINT16_KHR, + VK_COMPONENT_TYPE_SINT32_NV = VK_COMPONENT_TYPE_SINT32_KHR, + VK_COMPONENT_TYPE_SINT64_NV = VK_COMPONENT_TYPE_SINT64_KHR, + VK_COMPONENT_TYPE_UINT8_NV = VK_COMPONENT_TYPE_UINT8_KHR, + VK_COMPONENT_TYPE_UINT16_NV = VK_COMPONENT_TYPE_UINT16_KHR, + VK_COMPONENT_TYPE_UINT32_NV = VK_COMPONENT_TYPE_UINT32_KHR, + VK_COMPONENT_TYPE_UINT64_NV = VK_COMPONENT_TYPE_UINT64_KHR, + VK_COMPONENT_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkComponentTypeKHR; + +typedef enum VkScopeKHR { + VK_SCOPE_DEVICE_KHR = 1, + VK_SCOPE_WORKGROUP_KHR = 2, + VK_SCOPE_SUBGROUP_KHR = 3, + VK_SCOPE_QUEUE_FAMILY_KHR = 5, + VK_SCOPE_DEVICE_NV = VK_SCOPE_DEVICE_KHR, + VK_SCOPE_WORKGROUP_NV = VK_SCOPE_WORKGROUP_KHR, + VK_SCOPE_SUBGROUP_NV = VK_SCOPE_SUBGROUP_KHR, + VK_SCOPE_QUEUE_FAMILY_NV = VK_SCOPE_QUEUE_FAMILY_KHR, + VK_SCOPE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkScopeKHR; +typedef struct VkCooperativeMatrixPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t MSize; + uint32_t NSize; + uint32_t KSize; + VkComponentTypeKHR AType; + VkComponentTypeKHR BType; + VkComponentTypeKHR CType; + VkComponentTypeKHR ResultType; + VkBool32 saturatingAccumulation; + VkScopeKHR scope; +} VkCooperativeMatrixPropertiesKHR; + +typedef struct VkPhysicalDeviceCooperativeMatrixFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 cooperativeMatrix; + VkBool32 cooperativeMatrixRobustBufferAccess; +} VkPhysicalDeviceCooperativeMatrixFeaturesKHR; + +typedef struct VkPhysicalDeviceCooperativeMatrixPropertiesKHR { + VkStructureType sType; + void* pNext; + VkShaderStageFlags cooperativeMatrixSupportedStages; +} VkPhysicalDeviceCooperativeMatrixPropertiesKHR; + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkCooperativeMatrixPropertiesKHR* pProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkCooperativeMatrixPropertiesKHR* pProperties); +#endif + + +// VK_EXT_debug_report is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_debug_report 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) #define VK_EXT_DEBUG_REPORT_SPEC_VERSION 10 @@ -9880,21 +10808,25 @@ VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT( #endif +// VK_NV_glsl_shader is a preprocessor guard. Do not pass it to API calls. #define VK_NV_glsl_shader 1 #define VK_NV_GLSL_SHADER_SPEC_VERSION 1 #define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader" +// VK_EXT_depth_range_unrestricted is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_depth_range_unrestricted 1 #define VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION 1 #define VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME "VK_EXT_depth_range_unrestricted" +// VK_IMG_filter_cubic is a preprocessor guard. Do not pass it to API calls. #define VK_IMG_filter_cubic 1 #define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1 #define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic" +// VK_AMD_rasterization_order is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_rasterization_order 1 #define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1 #define VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME "VK_AMD_rasterization_order" @@ -9912,16 +10844,19 @@ typedef struct VkPipelineRasterizationStateRasterizationOrderAMD { +// VK_AMD_shader_trinary_minmax is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_trinary_minmax 1 #define VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION 1 #define VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME "VK_AMD_shader_trinary_minmax" +// VK_AMD_shader_explicit_vertex_parameter is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_explicit_vertex_parameter 1 #define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION 1 #define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME "VK_AMD_shader_explicit_vertex_parameter" +// VK_EXT_debug_marker is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_debug_marker 1 #define VK_EXT_DEBUG_MARKER_SPEC_VERSION 4 #define VK_EXT_DEBUG_MARKER_EXTENSION_NAME "VK_EXT_debug_marker" @@ -9978,11 +10913,13 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT( #endif +// VK_AMD_gcn_shader is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_gcn_shader 1 #define VK_AMD_GCN_SHADER_SPEC_VERSION 1 #define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader" +// VK_NV_dedicated_allocation is a preprocessor guard. Do not pass it to API calls. #define VK_NV_dedicated_allocation 1 #define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1 #define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation" @@ -10007,6 +10944,7 @@ typedef struct VkDedicatedAllocationMemoryAllocateInfoNV { +// VK_EXT_transform_feedback is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_transform_feedback 1 #define VK_EXT_TRANSFORM_FEEDBACK_SPEC_VERSION 1 #define VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME "VK_EXT_transform_feedback" @@ -10094,6 +11032,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectByteCountEXT( #endif +// VK_NVX_binary_import is a preprocessor guard. Do not pass it to API calls. #define VK_NVX_binary_import 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCuModuleNVX) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCuFunctionNVX) @@ -10165,6 +11104,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdCuLaunchKernelNVX( #endif +// VK_NVX_image_view_handle is a preprocessor guard. Do not pass it to API calls. #define VK_NVX_image_view_handle 1 #define VK_NVX_IMAGE_VIEW_HANDLE_SPEC_VERSION 2 #define VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME "VK_NVX_image_view_handle" @@ -10198,6 +11138,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetImageViewAddressNVX( #endif +// VK_AMD_draw_indirect_count is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_draw_indirect_count 1 #define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 2 #define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count" @@ -10225,21 +11166,25 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD( #endif +// VK_AMD_negative_viewport_height is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_negative_viewport_height 1 #define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1 #define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height" +// VK_AMD_gpu_shader_half_float is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_gpu_shader_half_float 1 #define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 2 #define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float" +// VK_AMD_shader_ballot is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_ballot 1 #define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1 #define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot" +// VK_AMD_texture_gather_bias_lod is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_texture_gather_bias_lod 1 #define VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION 1 #define VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME "VK_AMD_texture_gather_bias_lod" @@ -10251,6 +11196,7 @@ typedef struct VkTextureLODGatherFormatPropertiesAMD { +// VK_AMD_shader_info is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_info 1 #define VK_AMD_SHADER_INFO_SPEC_VERSION 1 #define VK_AMD_SHADER_INFO_EXTENSION_NAME "VK_AMD_shader_info" @@ -10292,11 +11238,13 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetShaderInfoAMD( #endif +// VK_AMD_shader_image_load_store_lod is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_image_load_store_lod 1 #define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_SPEC_VERSION 1 #define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME "VK_AMD_shader_image_load_store_lod" +// VK_NV_corner_sampled_image is a preprocessor guard. Do not pass it to API calls. #define VK_NV_corner_sampled_image 1 #define VK_NV_CORNER_SAMPLED_IMAGE_SPEC_VERSION 2 #define VK_NV_CORNER_SAMPLED_IMAGE_EXTENSION_NAME "VK_NV_corner_sampled_image" @@ -10308,11 +11256,13 @@ typedef struct VkPhysicalDeviceCornerSampledImageFeaturesNV { +// VK_IMG_format_pvrtc is a preprocessor guard. Do not pass it to API calls. #define VK_IMG_format_pvrtc 1 #define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1 #define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc" +// VK_NV_external_memory_capabilities is a preprocessor guard. Do not pass it to API calls. #define VK_NV_external_memory_capabilities 1 #define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 #define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_NV_external_memory_capabilities" @@ -10355,6 +11305,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceExternalImageFormatPropertiesN #endif +// VK_NV_external_memory is a preprocessor guard. Do not pass it to API calls. #define VK_NV_external_memory 1 #define VK_NV_EXTERNAL_MEMORY_SPEC_VERSION 1 #define VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME "VK_NV_external_memory" @@ -10372,6 +11323,7 @@ typedef struct VkExportMemoryAllocateInfoNV { +// VK_EXT_validation_flags is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_validation_flags 1 #define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 2 #define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags" @@ -10390,16 +11342,19 @@ typedef struct VkValidationFlagsEXT { +// VK_EXT_shader_subgroup_ballot is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_subgroup_ballot 1 #define VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION 1 #define VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME "VK_EXT_shader_subgroup_ballot" +// VK_EXT_shader_subgroup_vote is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_subgroup_vote 1 #define VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION 1 #define VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME "VK_EXT_shader_subgroup_vote" +// VK_EXT_texture_compression_astc_hdr is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_texture_compression_astc_hdr 1 #define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_SPEC_VERSION 1 #define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_EXTENSION_NAME "VK_EXT_texture_compression_astc_hdr" @@ -10407,6 +11362,7 @@ typedef VkPhysicalDeviceTextureCompressionASTCHDRFeatures VkPhysicalDeviceTextur +// VK_EXT_astc_decode_mode is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_astc_decode_mode 1 #define VK_EXT_ASTC_DECODE_MODE_SPEC_VERSION 1 #define VK_EXT_ASTC_DECODE_MODE_EXTENSION_NAME "VK_EXT_astc_decode_mode" @@ -10424,6 +11380,7 @@ typedef struct VkPhysicalDeviceASTCDecodeFeaturesEXT { +// VK_EXT_pipeline_robustness is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pipeline_robustness 1 #define VK_EXT_PIPELINE_ROBUSTNESS_SPEC_VERSION 1 #define VK_EXT_PIPELINE_ROBUSTNESS_EXTENSION_NAME "VK_EXT_pipeline_robustness" @@ -10469,6 +11426,7 @@ typedef struct VkPipelineRobustnessCreateInfoEXT { +// VK_EXT_conditional_rendering is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_conditional_rendering 1 #define VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION 2 #define VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME "VK_EXT_conditional_rendering" @@ -10512,6 +11470,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdEndConditionalRenderingEXT( #endif +// VK_NV_clip_space_w_scaling is a preprocessor guard. Do not pass it to API calls. #define VK_NV_clip_space_w_scaling 1 #define VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION 1 #define VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME "VK_NV_clip_space_w_scaling" @@ -10539,6 +11498,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWScalingNV( #endif +// VK_EXT_direct_mode_display is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_direct_mode_display 1 #define VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION 1 #define VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME "VK_EXT_direct_mode_display" @@ -10551,6 +11511,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkReleaseDisplayEXT( #endif +// VK_EXT_display_surface_counter is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_display_surface_counter 1 #define VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION 1 #define VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME "VK_EXT_display_surface_counter" @@ -10587,6 +11548,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT( #endif +// VK_EXT_display_control is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_display_control 1 #define VK_EXT_DISPLAY_CONTROL_SPEC_VERSION 1 #define VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME "VK_EXT_display_control" @@ -10663,6 +11625,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainCounterEXT( #endif +// VK_GOOGLE_display_timing is a preprocessor guard. Do not pass it to API calls. #define VK_GOOGLE_display_timing 1 #define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1 #define VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME "VK_GOOGLE_display_timing" @@ -10707,16 +11670,19 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE( #endif +// VK_NV_sample_mask_override_coverage is a preprocessor guard. Do not pass it to API calls. #define VK_NV_sample_mask_override_coverage 1 #define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION 1 #define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME "VK_NV_sample_mask_override_coverage" +// VK_NV_geometry_shader_passthrough is a preprocessor guard. Do not pass it to API calls. #define VK_NV_geometry_shader_passthrough 1 #define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION 1 #define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME "VK_NV_geometry_shader_passthrough" +// VK_NV_viewport_array2 is a preprocessor guard. Do not pass it to API calls. #define VK_NV_viewport_array2 1 #define VK_NV_VIEWPORT_ARRAY_2_SPEC_VERSION 1 #define VK_NV_VIEWPORT_ARRAY_2_EXTENSION_NAME "VK_NV_viewport_array2" @@ -10724,6 +11690,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE( #define VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME VK_NV_VIEWPORT_ARRAY_2_EXTENSION_NAME +// VK_NVX_multiview_per_view_attributes is a preprocessor guard. Do not pass it to API calls. #define VK_NVX_multiview_per_view_attributes 1 #define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION 1 #define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME "VK_NVX_multiview_per_view_attributes" @@ -10735,6 +11702,7 @@ typedef struct VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX { +// VK_NV_viewport_swizzle is a preprocessor guard. Do not pass it to API calls. #define VK_NV_viewport_swizzle 1 #define VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION 1 #define VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME "VK_NV_viewport_swizzle" @@ -10768,8 +11736,9 @@ typedef struct VkPipelineViewportSwizzleStateCreateInfoNV { +// VK_EXT_discard_rectangles is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_discard_rectangles 1 -#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 1 +#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 2 #define VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME "VK_EXT_discard_rectangles" typedef enum VkDiscardRectangleModeEXT { @@ -10794,6 +11763,8 @@ typedef struct VkPipelineDiscardRectangleStateCreateInfoEXT { } VkPipelineDiscardRectangleStateCreateInfoEXT; typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEXT)(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles); +typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 discardRectangleEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleModeEXT)(VkCommandBuffer commandBuffer, VkDiscardRectangleModeEXT discardRectangleMode); #ifndef VK_NO_PROTOTYPES VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT( @@ -10801,9 +11772,18 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT( uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 discardRectangleEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleModeEXT( + VkCommandBuffer commandBuffer, + VkDiscardRectangleModeEXT discardRectangleMode); #endif +// VK_EXT_conservative_rasterization is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_conservative_rasterization 1 #define VK_EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION 1 #define VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME "VK_EXT_conservative_rasterization" @@ -10839,6 +11819,7 @@ typedef struct VkPipelineRasterizationConservativeStateCreateInfoEXT { +// VK_EXT_depth_clip_enable is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_depth_clip_enable 1 #define VK_EXT_DEPTH_CLIP_ENABLE_SPEC_VERSION 1 #define VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME "VK_EXT_depth_clip_enable" @@ -10858,11 +11839,13 @@ typedef struct VkPipelineRasterizationDepthClipStateCreateInfoEXT { +// VK_EXT_swapchain_colorspace is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_swapchain_colorspace 1 #define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 4 #define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace" +// VK_EXT_hdr_metadata is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_hdr_metadata 1 #define VK_EXT_HDR_METADATA_SPEC_VERSION 2 #define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata" @@ -10895,17 +11878,20 @@ VKAPI_ATTR void VKAPI_CALL vkSetHdrMetadataEXT( #endif +// VK_EXT_external_memory_dma_buf is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_external_memory_dma_buf 1 #define VK_EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION 1 #define VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME "VK_EXT_external_memory_dma_buf" +// VK_EXT_queue_family_foreign is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_queue_family_foreign 1 #define VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION 1 #define VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME "VK_EXT_queue_family_foreign" #define VK_QUEUE_FAMILY_FOREIGN_EXT (~2U) +// VK_EXT_debug_utils is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_debug_utils 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugUtilsMessengerEXT) #define VK_EXT_DEBUG_UTILS_SPEC_VERSION 2 @@ -11048,6 +12034,7 @@ VKAPI_ATTR void VKAPI_CALL vkSubmitDebugUtilsMessageEXT( #endif +// VK_EXT_sampler_filter_minmax is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_sampler_filter_minmax 1 #define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 2 #define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax" @@ -11059,21 +12046,25 @@ typedef VkPhysicalDeviceSamplerFilterMinmaxProperties VkPhysicalDeviceSamplerFil +// VK_AMD_gpu_shader_int16 is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_gpu_shader_int16 1 #define VK_AMD_GPU_SHADER_INT16_SPEC_VERSION 2 #define VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME "VK_AMD_gpu_shader_int16" +// VK_AMD_mixed_attachment_samples is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_mixed_attachment_samples 1 #define VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION 1 #define VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME "VK_AMD_mixed_attachment_samples" +// VK_AMD_shader_fragment_mask is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_fragment_mask 1 #define VK_AMD_SHADER_FRAGMENT_MASK_SPEC_VERSION 1 #define VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME "VK_AMD_shader_fragment_mask" +// VK_EXT_inline_uniform_block is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_inline_uniform_block 1 #define VK_EXT_INLINE_UNIFORM_BLOCK_SPEC_VERSION 1 #define VK_EXT_INLINE_UNIFORM_BLOCK_EXTENSION_NAME "VK_EXT_inline_uniform_block" @@ -11087,11 +12078,13 @@ typedef VkDescriptorPoolInlineUniformBlockCreateInfo VkDescriptorPoolInlineUnifo +// VK_EXT_shader_stencil_export is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_stencil_export 1 #define VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION 1 #define VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME "VK_EXT_shader_stencil_export" +// VK_EXT_sample_locations is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_sample_locations 1 #define VK_EXT_SAMPLE_LOCATIONS_SPEC_VERSION 1 #define VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME "VK_EXT_sample_locations" @@ -11166,6 +12159,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMultisamplePropertiesEXT( #endif +// VK_EXT_blend_operation_advanced is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_blend_operation_advanced 1 #define VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION 2 #define VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME "VK_EXT_blend_operation_advanced" @@ -11203,6 +12197,7 @@ typedef struct VkPipelineColorBlendAdvancedStateCreateInfoEXT { +// VK_NV_fragment_coverage_to_color is a preprocessor guard. Do not pass it to API calls. #define VK_NV_fragment_coverage_to_color 1 #define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION 1 #define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME "VK_NV_fragment_coverage_to_color" @@ -11217,6 +12212,7 @@ typedef struct VkPipelineCoverageToColorStateCreateInfoNV { +// VK_NV_framebuffer_mixed_samples is a preprocessor guard. Do not pass it to API calls. #define VK_NV_framebuffer_mixed_samples 1 #define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION 1 #define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME "VK_NV_framebuffer_mixed_samples" @@ -11241,11 +12237,13 @@ typedef struct VkPipelineCoverageModulationStateCreateInfoNV { +// VK_NV_fill_rectangle is a preprocessor guard. Do not pass it to API calls. #define VK_NV_fill_rectangle 1 #define VK_NV_FILL_RECTANGLE_SPEC_VERSION 1 #define VK_NV_FILL_RECTANGLE_EXTENSION_NAME "VK_NV_fill_rectangle" +// VK_NV_shader_sm_builtins is a preprocessor guard. Do not pass it to API calls. #define VK_NV_shader_sm_builtins 1 #define VK_NV_SHADER_SM_BUILTINS_SPEC_VERSION 1 #define VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME "VK_NV_shader_sm_builtins" @@ -11264,11 +12262,13 @@ typedef struct VkPhysicalDeviceShaderSMBuiltinsFeaturesNV { +// VK_EXT_post_depth_coverage is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_post_depth_coverage 1 #define VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION 1 #define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage" +// VK_EXT_image_drm_format_modifier is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_drm_format_modifier 1 #define VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION 2 #define VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME "VK_EXT_image_drm_format_modifier" @@ -11338,6 +12338,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetImageDrmFormatModifierPropertiesEXT( #endif +// VK_EXT_validation_cache is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_validation_cache 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkValidationCacheEXT) #define VK_EXT_VALIDATION_CACHE_SPEC_VERSION 1 @@ -11393,6 +12394,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetValidationCacheDataEXT( #endif +// VK_EXT_descriptor_indexing is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_descriptor_indexing 1 #define VK_EXT_DESCRIPTOR_INDEXING_SPEC_VERSION 2 #define VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME "VK_EXT_descriptor_indexing" @@ -11412,11 +12414,13 @@ typedef VkDescriptorSetVariableDescriptorCountLayoutSupport VkDescriptorSetVaria +// VK_EXT_shader_viewport_index_layer is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_viewport_index_layer 1 #define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION 1 #define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer" +// VK_NV_shading_rate_image is a preprocessor guard. Do not pass it to API calls. #define VK_NV_shading_rate_image 1 #define VK_NV_SHADING_RATE_IMAGE_SPEC_VERSION 3 #define VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME "VK_NV_shading_rate_image" @@ -11517,6 +12521,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetCoarseSampleOrderNV( #endif +// VK_NV_ray_tracing is a preprocessor guard. Do not pass it to API calls. #define VK_NV_ray_tracing 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureNV) #define VK_NV_RAY_TRACING_SPEC_VERSION 3 @@ -11620,6 +12625,10 @@ typedef enum VkBuildAccelerationStructureFlagBitsKHR { VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_UPDATE_EXT = 0x00000040, VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DISABLE_OPACITY_MICROMAPS_EXT = 0x00000080, VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_DATA_UPDATE_EXT = 0x00000100, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DISPLACEMENT_MICROMAP_UPDATE_NV = 0x00000200, +#endif + VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DATA_ACCESS_KHR = 0x00000800, VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR, VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR, VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR, @@ -11891,6 +12900,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCompileDeferredNV( #endif +// VK_NV_representative_fragment_test is a preprocessor guard. Do not pass it to API calls. #define VK_NV_representative_fragment_test 1 #define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION 2 #define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_EXTENSION_NAME "VK_NV_representative_fragment_test" @@ -11908,6 +12918,7 @@ typedef struct VkPipelineRepresentativeFragmentTestStateCreateInfoNV { +// VK_EXT_filter_cubic is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_filter_cubic 1 #define VK_EXT_FILTER_CUBIC_SPEC_VERSION 3 #define VK_EXT_FILTER_CUBIC_EXTENSION_NAME "VK_EXT_filter_cubic" @@ -11926,11 +12937,13 @@ typedef struct VkFilterCubicImageViewImageFormatPropertiesEXT { +// VK_QCOM_render_pass_shader_resolve is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_render_pass_shader_resolve 1 #define VK_QCOM_RENDER_PASS_SHADER_RESOLVE_SPEC_VERSION 4 #define VK_QCOM_RENDER_PASS_SHADER_RESOLVE_EXTENSION_NAME "VK_QCOM_render_pass_shader_resolve" +// VK_EXT_global_priority is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_global_priority 1 #define VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION 2 #define VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME "VK_EXT_global_priority" @@ -11940,6 +12953,7 @@ typedef VkDeviceQueueGlobalPriorityCreateInfoKHR VkDeviceQueueGlobalPriorityCrea +// VK_EXT_external_memory_host is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_external_memory_host 1 #define VK_EXT_EXTERNAL_MEMORY_HOST_SPEC_VERSION 1 #define VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME "VK_EXT_external_memory_host" @@ -11973,6 +12987,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryHostPointerPropertiesEXT( #endif +// VK_AMD_buffer_marker is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_buffer_marker 1 #define VK_AMD_BUFFER_MARKER_SPEC_VERSION 1 #define VK_AMD_BUFFER_MARKER_EXTENSION_NAME "VK_AMD_buffer_marker" @@ -11988,6 +13003,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdWriteBufferMarkerAMD( #endif +// VK_AMD_pipeline_compiler_control is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_pipeline_compiler_control 1 #define VK_AMD_PIPELINE_COMPILER_CONTROL_SPEC_VERSION 1 #define VK_AMD_PIPELINE_COMPILER_CONTROL_EXTENSION_NAME "VK_AMD_pipeline_compiler_control" @@ -12004,6 +13020,7 @@ typedef struct VkPipelineCompilerControlCreateInfoAMD { +// VK_EXT_calibrated_timestamps is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_calibrated_timestamps 1 #define VK_EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION 2 #define VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME "VK_EXT_calibrated_timestamps" @@ -12039,6 +13056,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetCalibratedTimestampsEXT( #endif +// VK_AMD_shader_core_properties is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_core_properties 1 #define VK_AMD_SHADER_CORE_PROPERTIES_SPEC_VERSION 2 #define VK_AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME "VK_AMD_shader_core_properties" @@ -12063,6 +13081,7 @@ typedef struct VkPhysicalDeviceShaderCorePropertiesAMD { +// VK_AMD_memory_overallocation_behavior is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_memory_overallocation_behavior 1 #define VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_SPEC_VERSION 1 #define VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME "VK_AMD_memory_overallocation_behavior" @@ -12081,6 +13100,7 @@ typedef struct VkDeviceMemoryOverallocationCreateInfoAMD { +// VK_EXT_vertex_attribute_divisor is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_vertex_attribute_divisor 1 #define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION 3 #define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME "VK_EXT_vertex_attribute_divisor" @@ -12111,6 +13131,7 @@ typedef struct VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT { +// VK_EXT_pipeline_creation_feedback is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pipeline_creation_feedback 1 #define VK_EXT_PIPELINE_CREATION_FEEDBACK_SPEC_VERSION 1 #define VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME "VK_EXT_pipeline_creation_feedback" @@ -12124,11 +13145,13 @@ typedef VkPipelineCreationFeedback VkPipelineCreationFeedbackEXT; +// VK_NV_shader_subgroup_partitioned is a preprocessor guard. Do not pass it to API calls. #define VK_NV_shader_subgroup_partitioned 1 #define VK_NV_SHADER_SUBGROUP_PARTITIONED_SPEC_VERSION 1 #define VK_NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME "VK_NV_shader_subgroup_partitioned" +// VK_NV_compute_shader_derivatives is a preprocessor guard. Do not pass it to API calls. #define VK_NV_compute_shader_derivatives 1 #define VK_NV_COMPUTE_SHADER_DERIVATIVES_SPEC_VERSION 1 #define VK_NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME "VK_NV_compute_shader_derivatives" @@ -12141,6 +13164,7 @@ typedef struct VkPhysicalDeviceComputeShaderDerivativesFeaturesNV { +// VK_NV_mesh_shader is a preprocessor guard. Do not pass it to API calls. #define VK_NV_mesh_shader 1 #define VK_NV_MESH_SHADER_SPEC_VERSION 1 #define VK_NV_MESH_SHADER_EXTENSION_NAME "VK_NV_mesh_shader" @@ -12202,6 +13226,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksIndirectCountNV( #endif +// VK_NV_fragment_shader_barycentric is a preprocessor guard. Do not pass it to API calls. #define VK_NV_fragment_shader_barycentric 1 #define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION 1 #define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME "VK_NV_fragment_shader_barycentric" @@ -12209,6 +13234,7 @@ typedef VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR VkPhysicalDeviceFra +// VK_NV_shader_image_footprint is a preprocessor guard. Do not pass it to API calls. #define VK_NV_shader_image_footprint 1 #define VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION 2 #define VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME "VK_NV_shader_image_footprint" @@ -12220,8 +13246,9 @@ typedef struct VkPhysicalDeviceShaderImageFootprintFeaturesNV { +// VK_NV_scissor_exclusive is a preprocessor guard. Do not pass it to API calls. #define VK_NV_scissor_exclusive 1 -#define VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION 1 +#define VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION 2 #define VK_NV_SCISSOR_EXCLUSIVE_EXTENSION_NAME "VK_NV_scissor_exclusive" typedef struct VkPipelineViewportExclusiveScissorStateCreateInfoNV { VkStructureType sType; @@ -12236,9 +13263,16 @@ typedef struct VkPhysicalDeviceExclusiveScissorFeaturesNV { VkBool32 exclusiveScissor; } VkPhysicalDeviceExclusiveScissorFeaturesNV; +typedef void (VKAPI_PTR *PFN_vkCmdSetExclusiveScissorEnableNV)(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkBool32* pExclusiveScissorEnables); typedef void (VKAPI_PTR *PFN_vkCmdSetExclusiveScissorNV)(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkRect2D* pExclusiveScissors); #ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetExclusiveScissorEnableNV( + VkCommandBuffer commandBuffer, + uint32_t firstExclusiveScissor, + uint32_t exclusiveScissorCount, + const VkBool32* pExclusiveScissorEnables); + VKAPI_ATTR void VKAPI_CALL vkCmdSetExclusiveScissorNV( VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, @@ -12247,6 +13281,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetExclusiveScissorNV( #endif +// VK_NV_device_diagnostic_checkpoints is a preprocessor guard. Do not pass it to API calls. #define VK_NV_device_diagnostic_checkpoints 1 #define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_SPEC_VERSION 2 #define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME "VK_NV_device_diagnostic_checkpoints" @@ -12278,6 +13313,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetQueueCheckpointDataNV( #endif +// VK_INTEL_shader_integer_functions2 is a preprocessor guard. Do not pass it to API calls. #define VK_INTEL_shader_integer_functions2 1 #define VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_SPEC_VERSION 1 #define VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_EXTENSION_NAME "VK_INTEL_shader_integer_functions2" @@ -12289,6 +13325,7 @@ typedef struct VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL { +// VK_INTEL_performance_query is a preprocessor guard. Do not pass it to API calls. #define VK_INTEL_performance_query 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPerformanceConfigurationINTEL) #define VK_INTEL_PERFORMANCE_QUERY_SPEC_VERSION 2 @@ -12427,6 +13464,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPerformanceParameterINTEL( #endif +// VK_EXT_pci_bus_info is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pci_bus_info 1 #define VK_EXT_PCI_BUS_INFO_SPEC_VERSION 2 #define VK_EXT_PCI_BUS_INFO_EXTENSION_NAME "VK_EXT_pci_bus_info" @@ -12441,6 +13479,7 @@ typedef struct VkPhysicalDevicePCIBusInfoPropertiesEXT { +// VK_AMD_display_native_hdr is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_display_native_hdr 1 #define VK_AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION 1 #define VK_AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME "VK_AMD_display_native_hdr" @@ -12466,6 +13505,7 @@ VKAPI_ATTR void VKAPI_CALL vkSetLocalDimmingAMD( #endif +// VK_EXT_fragment_density_map is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_fragment_density_map 1 #define VK_EXT_FRAGMENT_DENSITY_MAP_SPEC_VERSION 2 #define VK_EXT_FRAGMENT_DENSITY_MAP_EXTENSION_NAME "VK_EXT_fragment_density_map" @@ -12493,6 +13533,7 @@ typedef struct VkRenderPassFragmentDensityMapCreateInfoEXT { +// VK_EXT_scalar_block_layout is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_scalar_block_layout 1 #define VK_EXT_SCALAR_BLOCK_LAYOUT_SPEC_VERSION 1 #define VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME "VK_EXT_scalar_block_layout" @@ -12500,6 +13541,7 @@ typedef VkPhysicalDeviceScalarBlockLayoutFeatures VkPhysicalDeviceScalarBlockLay +// VK_GOOGLE_hlsl_functionality1 is a preprocessor guard. Do not pass it to API calls. #define VK_GOOGLE_hlsl_functionality1 1 #define VK_GOOGLE_HLSL_FUNCTIONALITY_1_SPEC_VERSION 1 #define VK_GOOGLE_HLSL_FUNCTIONALITY_1_EXTENSION_NAME "VK_GOOGLE_hlsl_functionality1" @@ -12507,11 +13549,13 @@ typedef VkPhysicalDeviceScalarBlockLayoutFeatures VkPhysicalDeviceScalarBlockLay #define VK_GOOGLE_HLSL_FUNCTIONALITY1_EXTENSION_NAME VK_GOOGLE_HLSL_FUNCTIONALITY_1_EXTENSION_NAME +// VK_GOOGLE_decorate_string is a preprocessor guard. Do not pass it to API calls. #define VK_GOOGLE_decorate_string 1 #define VK_GOOGLE_DECORATE_STRING_SPEC_VERSION 1 #define VK_GOOGLE_DECORATE_STRING_EXTENSION_NAME "VK_GOOGLE_decorate_string" +// VK_EXT_subgroup_size_control is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_subgroup_size_control 1 #define VK_EXT_SUBGROUP_SIZE_CONTROL_SPEC_VERSION 2 #define VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME "VK_EXT_subgroup_size_control" @@ -12523,6 +13567,7 @@ typedef VkPipelineShaderStageRequiredSubgroupSizeCreateInfo VkPipelineShaderStag +// VK_AMD_shader_core_properties2 is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_core_properties2 1 #define VK_AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION 1 #define VK_AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME "VK_AMD_shader_core_properties2" @@ -12540,6 +13585,7 @@ typedef struct VkPhysicalDeviceShaderCoreProperties2AMD { +// VK_AMD_device_coherent_memory is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_device_coherent_memory 1 #define VK_AMD_DEVICE_COHERENT_MEMORY_SPEC_VERSION 1 #define VK_AMD_DEVICE_COHERENT_MEMORY_EXTENSION_NAME "VK_AMD_device_coherent_memory" @@ -12551,6 +13597,7 @@ typedef struct VkPhysicalDeviceCoherentMemoryFeaturesAMD { +// VK_EXT_shader_image_atomic_int64 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_image_atomic_int64 1 #define VK_EXT_SHADER_IMAGE_ATOMIC_INT64_SPEC_VERSION 1 #define VK_EXT_SHADER_IMAGE_ATOMIC_INT64_EXTENSION_NAME "VK_EXT_shader_image_atomic_int64" @@ -12563,6 +13610,7 @@ typedef struct VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT { +// VK_EXT_memory_budget is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_memory_budget 1 #define VK_EXT_MEMORY_BUDGET_SPEC_VERSION 1 #define VK_EXT_MEMORY_BUDGET_EXTENSION_NAME "VK_EXT_memory_budget" @@ -12575,6 +13623,7 @@ typedef struct VkPhysicalDeviceMemoryBudgetPropertiesEXT { +// VK_EXT_memory_priority is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_memory_priority 1 #define VK_EXT_MEMORY_PRIORITY_SPEC_VERSION 1 #define VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME "VK_EXT_memory_priority" @@ -12592,6 +13641,7 @@ typedef struct VkMemoryPriorityAllocateInfoEXT { +// VK_NV_dedicated_allocation_image_aliasing is a preprocessor guard. Do not pass it to API calls. #define VK_NV_dedicated_allocation_image_aliasing 1 #define VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_SPEC_VERSION 1 #define VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_EXTENSION_NAME "VK_NV_dedicated_allocation_image_aliasing" @@ -12603,6 +13653,7 @@ typedef struct VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV { +// VK_EXT_buffer_device_address is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_buffer_device_address 1 #define VK_EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION 2 #define VK_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME "VK_EXT_buffer_device_address" @@ -12633,6 +13684,7 @@ VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddressEXT( #endif +// VK_EXT_tooling_info is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_tooling_info 1 #define VK_EXT_TOOLING_INFO_SPEC_VERSION 1 #define VK_EXT_TOOLING_INFO_EXTENSION_NAME "VK_EXT_tooling_info" @@ -12652,6 +13704,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceToolPropertiesEXT( #endif +// VK_EXT_separate_stencil_usage is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_separate_stencil_usage 1 #define VK_EXT_SEPARATE_STENCIL_USAGE_SPEC_VERSION 1 #define VK_EXT_SEPARATE_STENCIL_USAGE_EXTENSION_NAME "VK_EXT_separate_stencil_usage" @@ -12659,6 +13712,7 @@ typedef VkImageStencilUsageCreateInfo VkImageStencilUsageCreateInfoEXT; +// VK_EXT_validation_features is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_validation_features 1 #define VK_EXT_VALIDATION_FEATURES_SPEC_VERSION 5 #define VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME "VK_EXT_validation_features" @@ -12694,32 +13748,14 @@ typedef struct VkValidationFeaturesEXT { +// VK_NV_cooperative_matrix is a preprocessor guard. Do not pass it to API calls. #define VK_NV_cooperative_matrix 1 #define VK_NV_COOPERATIVE_MATRIX_SPEC_VERSION 1 #define VK_NV_COOPERATIVE_MATRIX_EXTENSION_NAME "VK_NV_cooperative_matrix" +typedef VkComponentTypeKHR VkComponentTypeNV; + +typedef VkScopeKHR VkScopeNV; -typedef enum VkComponentTypeNV { - VK_COMPONENT_TYPE_FLOAT16_NV = 0, - VK_COMPONENT_TYPE_FLOAT32_NV = 1, - VK_COMPONENT_TYPE_FLOAT64_NV = 2, - VK_COMPONENT_TYPE_SINT8_NV = 3, - VK_COMPONENT_TYPE_SINT16_NV = 4, - VK_COMPONENT_TYPE_SINT32_NV = 5, - VK_COMPONENT_TYPE_SINT64_NV = 6, - VK_COMPONENT_TYPE_UINT8_NV = 7, - VK_COMPONENT_TYPE_UINT16_NV = 8, - VK_COMPONENT_TYPE_UINT32_NV = 9, - VK_COMPONENT_TYPE_UINT64_NV = 10, - VK_COMPONENT_TYPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkComponentTypeNV; - -typedef enum VkScopeNV { - VK_SCOPE_DEVICE_NV = 1, - VK_SCOPE_WORKGROUP_NV = 2, - VK_SCOPE_SUBGROUP_NV = 3, - VK_SCOPE_QUEUE_FAMILY_NV = 5, - VK_SCOPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkScopeNV; typedef struct VkCooperativeMatrixPropertiesNV { VkStructureType sType; void* pNext; @@ -12756,6 +13792,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceCooperativeMatrixPropertiesNV( #endif +// VK_NV_coverage_reduction_mode is a preprocessor guard. Do not pass it to API calls. #define VK_NV_coverage_reduction_mode 1 #define VK_NV_COVERAGE_REDUCTION_MODE_SPEC_VERSION 1 #define VK_NV_COVERAGE_REDUCTION_MODE_EXTENSION_NAME "VK_NV_coverage_reduction_mode" @@ -12798,6 +13835,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSupportedFramebufferMixedSampl #endif +// VK_EXT_fragment_shader_interlock is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_fragment_shader_interlock 1 #define VK_EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION 1 #define VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME "VK_EXT_fragment_shader_interlock" @@ -12811,6 +13849,7 @@ typedef struct VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT { +// VK_EXT_ycbcr_image_arrays is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_ycbcr_image_arrays 1 #define VK_EXT_YCBCR_IMAGE_ARRAYS_SPEC_VERSION 1 #define VK_EXT_YCBCR_IMAGE_ARRAYS_EXTENSION_NAME "VK_EXT_ycbcr_image_arrays" @@ -12822,6 +13861,7 @@ typedef struct VkPhysicalDeviceYcbcrImageArraysFeaturesEXT { +// VK_EXT_provoking_vertex is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_provoking_vertex 1 #define VK_EXT_PROVOKING_VERTEX_SPEC_VERSION 1 #define VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME "VK_EXT_provoking_vertex" @@ -12853,6 +13893,7 @@ typedef struct VkPipelineRasterizationProvokingVertexStateCreateInfoEXT { +// VK_EXT_headless_surface is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_headless_surface 1 #define VK_EXT_HEADLESS_SURFACE_SPEC_VERSION 1 #define VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME "VK_EXT_headless_surface" @@ -12874,6 +13915,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateHeadlessSurfaceEXT( #endif +// VK_EXT_line_rasterization is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_line_rasterization 1 #define VK_EXT_LINE_RASTERIZATION_SPEC_VERSION 1 #define VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME "VK_EXT_line_rasterization" @@ -12921,6 +13963,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetLineStippleEXT( #endif +// VK_EXT_shader_atomic_float is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_atomic_float 1 #define VK_EXT_SHADER_ATOMIC_FLOAT_SPEC_VERSION 1 #define VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME "VK_EXT_shader_atomic_float" @@ -12943,6 +13986,7 @@ typedef struct VkPhysicalDeviceShaderAtomicFloatFeaturesEXT { +// VK_EXT_host_query_reset is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_host_query_reset 1 #define VK_EXT_HOST_QUERY_RESET_SPEC_VERSION 1 #define VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME "VK_EXT_host_query_reset" @@ -12959,6 +14003,7 @@ VKAPI_ATTR void VKAPI_CALL vkResetQueryPoolEXT( #endif +// VK_EXT_index_type_uint8 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_index_type_uint8 1 #define VK_EXT_INDEX_TYPE_UINT8_SPEC_VERSION 1 #define VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME "VK_EXT_index_type_uint8" @@ -12970,6 +14015,7 @@ typedef struct VkPhysicalDeviceIndexTypeUint8FeaturesEXT { +// VK_EXT_extended_dynamic_state is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_extended_dynamic_state 1 #define VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION 1 #define VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_extended_dynamic_state" @@ -13054,28 +14100,270 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilOpEXT( #endif -#define VK_EXT_shader_atomic_float2 1 -#define VK_EXT_SHADER_ATOMIC_FLOAT_2_SPEC_VERSION 1 -#define VK_EXT_SHADER_ATOMIC_FLOAT_2_EXTENSION_NAME "VK_EXT_shader_atomic_float2" -typedef struct VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT { +// VK_EXT_host_image_copy is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_host_image_copy 1 +#define VK_EXT_HOST_IMAGE_COPY_SPEC_VERSION 1 +#define VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME "VK_EXT_host_image_copy" + +typedef enum VkHostImageCopyFlagBitsEXT { + VK_HOST_IMAGE_COPY_MEMCPY_EXT = 0x00000001, + VK_HOST_IMAGE_COPY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkHostImageCopyFlagBitsEXT; +typedef VkFlags VkHostImageCopyFlagsEXT; +typedef struct VkPhysicalDeviceHostImageCopyFeaturesEXT { VkStructureType sType; void* pNext; - VkBool32 shaderBufferFloat16Atomics; - VkBool32 shaderBufferFloat16AtomicAdd; - VkBool32 shaderBufferFloat16AtomicMinMax; - VkBool32 shaderBufferFloat32AtomicMinMax; - VkBool32 shaderBufferFloat64AtomicMinMax; - VkBool32 shaderSharedFloat16Atomics; - VkBool32 shaderSharedFloat16AtomicAdd; - VkBool32 shaderSharedFloat16AtomicMinMax; - VkBool32 shaderSharedFloat32AtomicMinMax; - VkBool32 shaderSharedFloat64AtomicMinMax; - VkBool32 shaderImageFloat32AtomicMinMax; + VkBool32 hostImageCopy; +} VkPhysicalDeviceHostImageCopyFeaturesEXT; + +typedef struct VkPhysicalDeviceHostImageCopyPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t copySrcLayoutCount; + VkImageLayout* pCopySrcLayouts; + uint32_t copyDstLayoutCount; + VkImageLayout* pCopyDstLayouts; + uint8_t optimalTilingLayoutUUID[VK_UUID_SIZE]; + VkBool32 identicalMemoryTypeRequirements; +} VkPhysicalDeviceHostImageCopyPropertiesEXT; + +typedef struct VkMemoryToImageCopyEXT { + VkStructureType sType; + const void* pNext; + const void* pHostPointer; + uint32_t memoryRowLength; + uint32_t memoryImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkMemoryToImageCopyEXT; + +typedef struct VkImageToMemoryCopyEXT { + VkStructureType sType; + const void* pNext; + void* pHostPointer; + uint32_t memoryRowLength; + uint32_t memoryImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkImageToMemoryCopyEXT; + +typedef struct VkCopyMemoryToImageInfoEXT { + VkStructureType sType; + const void* pNext; + VkHostImageCopyFlagsEXT flags; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkMemoryToImageCopyEXT* pRegions; +} VkCopyMemoryToImageInfoEXT; + +typedef struct VkCopyImageToMemoryInfoEXT { + VkStructureType sType; + const void* pNext; + VkHostImageCopyFlagsEXT flags; + VkImage srcImage; + VkImageLayout srcImageLayout; + uint32_t regionCount; + const VkImageToMemoryCopyEXT* pRegions; +} VkCopyImageToMemoryInfoEXT; + +typedef struct VkCopyImageToImageInfoEXT { + VkStructureType sType; + const void* pNext; + VkHostImageCopyFlagsEXT flags; + VkImage srcImage; + VkImageLayout srcImageLayout; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkImageCopy2* pRegions; +} VkCopyImageToImageInfoEXT; + +typedef struct VkHostImageLayoutTransitionInfoEXT { + VkStructureType sType; + const void* pNext; + VkImage image; + VkImageLayout oldLayout; + VkImageLayout newLayout; + VkImageSubresourceRange subresourceRange; +} VkHostImageLayoutTransitionInfoEXT; + +typedef struct VkSubresourceHostMemcpySizeEXT { + VkStructureType sType; + void* pNext; + VkDeviceSize size; +} VkSubresourceHostMemcpySizeEXT; + +typedef struct VkHostImageCopyDevicePerformanceQueryEXT { + VkStructureType sType; + void* pNext; + VkBool32 optimalDeviceAccess; + VkBool32 identicalMemoryLayout; +} VkHostImageCopyDevicePerformanceQueryEXT; + +typedef VkSubresourceLayout2KHR VkSubresourceLayout2EXT; + +typedef VkImageSubresource2KHR VkImageSubresource2EXT; + +typedef VkResult (VKAPI_PTR *PFN_vkCopyMemoryToImageEXT)(VkDevice device, const VkCopyMemoryToImageInfoEXT* pCopyMemoryToImageInfo); +typedef VkResult (VKAPI_PTR *PFN_vkCopyImageToMemoryEXT)(VkDevice device, const VkCopyImageToMemoryInfoEXT* pCopyImageToMemoryInfo); +typedef VkResult (VKAPI_PTR *PFN_vkCopyImageToImageEXT)(VkDevice device, const VkCopyImageToImageInfoEXT* pCopyImageToImageInfo); +typedef VkResult (VKAPI_PTR *PFN_vkTransitionImageLayoutEXT)(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfoEXT* pTransitions); +typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout2EXT)(VkDevice device, VkImage image, const VkImageSubresource2KHR* pSubresource, VkSubresourceLayout2KHR* pLayout); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCopyMemoryToImageEXT( + VkDevice device, + const VkCopyMemoryToImageInfoEXT* pCopyMemoryToImageInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkCopyImageToMemoryEXT( + VkDevice device, + const VkCopyImageToMemoryInfoEXT* pCopyImageToMemoryInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkCopyImageToImageEXT( + VkDevice device, + const VkCopyImageToImageInfoEXT* pCopyImageToImageInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkTransitionImageLayoutEXT( + VkDevice device, + uint32_t transitionCount, + const VkHostImageLayoutTransitionInfoEXT* pTransitions); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout2EXT( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout); +#endif + + +// VK_EXT_shader_atomic_float2 is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_shader_atomic_float2 1 +#define VK_EXT_SHADER_ATOMIC_FLOAT_2_SPEC_VERSION 1 +#define VK_EXT_SHADER_ATOMIC_FLOAT_2_EXTENSION_NAME "VK_EXT_shader_atomic_float2" +typedef struct VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 shaderBufferFloat16Atomics; + VkBool32 shaderBufferFloat16AtomicAdd; + VkBool32 shaderBufferFloat16AtomicMinMax; + VkBool32 shaderBufferFloat32AtomicMinMax; + VkBool32 shaderBufferFloat64AtomicMinMax; + VkBool32 shaderSharedFloat16Atomics; + VkBool32 shaderSharedFloat16AtomicAdd; + VkBool32 shaderSharedFloat16AtomicMinMax; + VkBool32 shaderSharedFloat32AtomicMinMax; + VkBool32 shaderSharedFloat64AtomicMinMax; + VkBool32 shaderImageFloat32AtomicMinMax; VkBool32 sparseImageFloat32AtomicMinMax; } VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT; +// VK_EXT_surface_maintenance1 is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_surface_maintenance1 1 +#define VK_EXT_SURFACE_MAINTENANCE_1_SPEC_VERSION 1 +#define VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME "VK_EXT_surface_maintenance1" + +typedef enum VkPresentScalingFlagBitsEXT { + VK_PRESENT_SCALING_ONE_TO_ONE_BIT_EXT = 0x00000001, + VK_PRESENT_SCALING_ASPECT_RATIO_STRETCH_BIT_EXT = 0x00000002, + VK_PRESENT_SCALING_STRETCH_BIT_EXT = 0x00000004, + VK_PRESENT_SCALING_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkPresentScalingFlagBitsEXT; +typedef VkFlags VkPresentScalingFlagsEXT; + +typedef enum VkPresentGravityFlagBitsEXT { + VK_PRESENT_GRAVITY_MIN_BIT_EXT = 0x00000001, + VK_PRESENT_GRAVITY_MAX_BIT_EXT = 0x00000002, + VK_PRESENT_GRAVITY_CENTERED_BIT_EXT = 0x00000004, + VK_PRESENT_GRAVITY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkPresentGravityFlagBitsEXT; +typedef VkFlags VkPresentGravityFlagsEXT; +typedef struct VkSurfacePresentModeEXT { + VkStructureType sType; + void* pNext; + VkPresentModeKHR presentMode; +} VkSurfacePresentModeEXT; + +typedef struct VkSurfacePresentScalingCapabilitiesEXT { + VkStructureType sType; + void* pNext; + VkPresentScalingFlagsEXT supportedPresentScaling; + VkPresentGravityFlagsEXT supportedPresentGravityX; + VkPresentGravityFlagsEXT supportedPresentGravityY; + VkExtent2D minScaledImageExtent; + VkExtent2D maxScaledImageExtent; +} VkSurfacePresentScalingCapabilitiesEXT; + +typedef struct VkSurfacePresentModeCompatibilityEXT { + VkStructureType sType; + void* pNext; + uint32_t presentModeCount; + VkPresentModeKHR* pPresentModes; +} VkSurfacePresentModeCompatibilityEXT; + + + +// VK_EXT_swapchain_maintenance1 is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_swapchain_maintenance1 1 +#define VK_EXT_SWAPCHAIN_MAINTENANCE_1_SPEC_VERSION 1 +#define VK_EXT_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME "VK_EXT_swapchain_maintenance1" +typedef struct VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 swapchainMaintenance1; +} VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT; + +typedef struct VkSwapchainPresentFenceInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const VkFence* pFences; +} VkSwapchainPresentFenceInfoEXT; + +typedef struct VkSwapchainPresentModesCreateInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t presentModeCount; + const VkPresentModeKHR* pPresentModes; +} VkSwapchainPresentModesCreateInfoEXT; + +typedef struct VkSwapchainPresentModeInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const VkPresentModeKHR* pPresentModes; +} VkSwapchainPresentModeInfoEXT; + +typedef struct VkSwapchainPresentScalingCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkPresentScalingFlagsEXT scalingBehavior; + VkPresentGravityFlagsEXT presentGravityX; + VkPresentGravityFlagsEXT presentGravityY; +} VkSwapchainPresentScalingCreateInfoEXT; + +typedef struct VkReleaseSwapchainImagesInfoEXT { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; + uint32_t imageIndexCount; + const uint32_t* pImageIndices; +} VkReleaseSwapchainImagesInfoEXT; + +typedef VkResult (VKAPI_PTR *PFN_vkReleaseSwapchainImagesEXT)(VkDevice device, const VkReleaseSwapchainImagesInfoEXT* pReleaseInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkReleaseSwapchainImagesEXT( + VkDevice device, + const VkReleaseSwapchainImagesInfoEXT* pReleaseInfo); +#endif + + +// VK_EXT_shader_demote_to_helper_invocation is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_demote_to_helper_invocation 1 #define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_SPEC_VERSION 1 #define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME "VK_EXT_shader_demote_to_helper_invocation" @@ -13083,6 +14371,7 @@ typedef VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures VkPhysicalDeviceS +// VK_NV_device_generated_commands is a preprocessor guard. Do not pass it to API calls. #define VK_NV_device_generated_commands 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNV) #define VK_NV_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 3 @@ -13098,6 +14387,8 @@ typedef enum VkIndirectCommandsTokenTypeNV { VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV = 6, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV = 7, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_NV = 1000328000, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NV = 1000428003, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NV = 1000428004, VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NV = 0x7FFFFFFF } VkIndirectCommandsTokenTypeNV; @@ -13274,6 +14565,7 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNV( #endif +// VK_NV_inherited_viewport_scissor is a preprocessor guard. Do not pass it to API calls. #define VK_NV_inherited_viewport_scissor 1 #define VK_NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION 1 #define VK_NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME "VK_NV_inherited_viewport_scissor" @@ -13293,6 +14585,7 @@ typedef struct VkCommandBufferInheritanceViewportScissorInfoNV { +// VK_EXT_texel_buffer_alignment is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_texel_buffer_alignment 1 #define VK_EXT_TEXEL_BUFFER_ALIGNMENT_SPEC_VERSION 1 #define VK_EXT_TEXEL_BUFFER_ALIGNMENT_EXTENSION_NAME "VK_EXT_texel_buffer_alignment" @@ -13306,6 +14599,7 @@ typedef VkPhysicalDeviceTexelBufferAlignmentProperties VkPhysicalDeviceTexelBuff +// VK_QCOM_render_pass_transform is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_render_pass_transform 1 #define VK_QCOM_RENDER_PASS_TRANSFORM_SPEC_VERSION 3 #define VK_QCOM_RENDER_PASS_TRANSFORM_EXTENSION_NAME "VK_QCOM_render_pass_transform" @@ -13324,6 +14618,51 @@ typedef struct VkCommandBufferInheritanceRenderPassTransformInfoQCOM { +// VK_EXT_depth_bias_control is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_depth_bias_control 1 +#define VK_EXT_DEPTH_BIAS_CONTROL_SPEC_VERSION 1 +#define VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME "VK_EXT_depth_bias_control" + +typedef enum VkDepthBiasRepresentationEXT { + VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORMAT_EXT = 0, + VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORCE_UNORM_EXT = 1, + VK_DEPTH_BIAS_REPRESENTATION_FLOAT_EXT = 2, + VK_DEPTH_BIAS_REPRESENTATION_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDepthBiasRepresentationEXT; +typedef struct VkPhysicalDeviceDepthBiasControlFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 depthBiasControl; + VkBool32 leastRepresentableValueForceUnormRepresentation; + VkBool32 floatRepresentation; + VkBool32 depthBiasExact; +} VkPhysicalDeviceDepthBiasControlFeaturesEXT; + +typedef struct VkDepthBiasInfoEXT { + VkStructureType sType; + const void* pNext; + float depthBiasConstantFactor; + float depthBiasClamp; + float depthBiasSlopeFactor; +} VkDepthBiasInfoEXT; + +typedef struct VkDepthBiasRepresentationInfoEXT { + VkStructureType sType; + const void* pNext; + VkDepthBiasRepresentationEXT depthBiasRepresentation; + VkBool32 depthBiasExact; +} VkDepthBiasRepresentationInfoEXT; + +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias2EXT)(VkCommandBuffer commandBuffer, const VkDepthBiasInfoEXT* pDepthBiasInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias2EXT( + VkCommandBuffer commandBuffer, + const VkDepthBiasInfoEXT* pDepthBiasInfo); +#endif + + +// VK_EXT_device_memory_report is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_device_memory_report 1 #define VK_EXT_DEVICE_MEMORY_REPORT_SPEC_VERSION 2 #define VK_EXT_DEVICE_MEMORY_REPORT_EXTENSION_NAME "VK_EXT_device_memory_report" @@ -13369,6 +14708,7 @@ typedef struct VkDeviceDeviceMemoryReportCreateInfoEXT { +// VK_EXT_acquire_drm_display is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_acquire_drm_display 1 #define VK_EXT_ACQUIRE_DRM_DISPLAY_SPEC_VERSION 1 #define VK_EXT_ACQUIRE_DRM_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_drm_display" @@ -13389,6 +14729,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDrmDisplayEXT( #endif +// VK_EXT_robustness2 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_robustness2 1 #define VK_EXT_ROBUSTNESS_2_SPEC_VERSION 1 #define VK_EXT_ROBUSTNESS_2_EXTENSION_NAME "VK_EXT_robustness2" @@ -13409,6 +14750,7 @@ typedef struct VkPhysicalDeviceRobustness2PropertiesEXT { +// VK_EXT_custom_border_color is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_custom_border_color 1 #define VK_EXT_CUSTOM_BORDER_COLOR_SPEC_VERSION 12 #define VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME "VK_EXT_custom_border_color" @@ -13434,11 +14776,13 @@ typedef struct VkPhysicalDeviceCustomBorderColorFeaturesEXT { +// VK_GOOGLE_user_type is a preprocessor guard. Do not pass it to API calls. #define VK_GOOGLE_user_type 1 #define VK_GOOGLE_USER_TYPE_SPEC_VERSION 1 #define VK_GOOGLE_USER_TYPE_EXTENSION_NAME "VK_GOOGLE_user_type" +// VK_NV_present_barrier is a preprocessor guard. Do not pass it to API calls. #define VK_NV_present_barrier 1 #define VK_NV_PRESENT_BARRIER_SPEC_VERSION 1 #define VK_NV_PRESENT_BARRIER_EXTENSION_NAME "VK_NV_present_barrier" @@ -13462,6 +14806,7 @@ typedef struct VkSwapchainPresentBarrierCreateInfoNV { +// VK_EXT_private_data is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_private_data 1 typedef VkPrivateDataSlot VkPrivateDataSlotEXT; @@ -13508,6 +14853,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPrivateDataEXT( #endif +// VK_EXT_pipeline_creation_cache_control is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pipeline_creation_cache_control 1 #define VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_SPEC_VERSION 3 #define VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_EXTENSION_NAME "VK_EXT_pipeline_creation_cache_control" @@ -13515,6 +14861,7 @@ typedef VkPhysicalDevicePipelineCreationCacheControlFeatures VkPhysicalDevicePip +// VK_NV_device_diagnostics_config is a preprocessor guard. Do not pass it to API calls. #define VK_NV_device_diagnostics_config 1 #define VK_NV_DEVICE_DIAGNOSTICS_CONFIG_SPEC_VERSION 2 #define VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME "VK_NV_device_diagnostics_config" @@ -13541,11 +14888,238 @@ typedef struct VkDeviceDiagnosticsConfigCreateInfoNV { +// VK_QCOM_render_pass_store_ops is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_render_pass_store_ops 1 #define VK_QCOM_RENDER_PASS_STORE_OPS_SPEC_VERSION 2 #define VK_QCOM_RENDER_PASS_STORE_OPS_EXTENSION_NAME "VK_QCOM_render_pass_store_ops" +// VK_NV_low_latency is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_low_latency 1 +#define VK_NV_LOW_LATENCY_SPEC_VERSION 1 +#define VK_NV_LOW_LATENCY_EXTENSION_NAME "VK_NV_low_latency" +typedef struct VkQueryLowLatencySupportNV { + VkStructureType sType; + const void* pNext; + void* pQueriedLowLatencyData; +} VkQueryLowLatencySupportNV; + + + +// VK_EXT_descriptor_buffer is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_descriptor_buffer 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureKHR) +#define VK_EXT_DESCRIPTOR_BUFFER_SPEC_VERSION 1 +#define VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME "VK_EXT_descriptor_buffer" +typedef struct VkPhysicalDeviceDescriptorBufferPropertiesEXT { + VkStructureType sType; + void* pNext; + VkBool32 combinedImageSamplerDescriptorSingleArray; + VkBool32 bufferlessPushDescriptors; + VkBool32 allowSamplerImageViewPostSubmitCreation; + VkDeviceSize descriptorBufferOffsetAlignment; + uint32_t maxDescriptorBufferBindings; + uint32_t maxResourceDescriptorBufferBindings; + uint32_t maxSamplerDescriptorBufferBindings; + uint32_t maxEmbeddedImmutableSamplerBindings; + uint32_t maxEmbeddedImmutableSamplers; + size_t bufferCaptureReplayDescriptorDataSize; + size_t imageCaptureReplayDescriptorDataSize; + size_t imageViewCaptureReplayDescriptorDataSize; + size_t samplerCaptureReplayDescriptorDataSize; + size_t accelerationStructureCaptureReplayDescriptorDataSize; + size_t samplerDescriptorSize; + size_t combinedImageSamplerDescriptorSize; + size_t sampledImageDescriptorSize; + size_t storageImageDescriptorSize; + size_t uniformTexelBufferDescriptorSize; + size_t robustUniformTexelBufferDescriptorSize; + size_t storageTexelBufferDescriptorSize; + size_t robustStorageTexelBufferDescriptorSize; + size_t uniformBufferDescriptorSize; + size_t robustUniformBufferDescriptorSize; + size_t storageBufferDescriptorSize; + size_t robustStorageBufferDescriptorSize; + size_t inputAttachmentDescriptorSize; + size_t accelerationStructureDescriptorSize; + VkDeviceSize maxSamplerDescriptorBufferRange; + VkDeviceSize maxResourceDescriptorBufferRange; + VkDeviceSize samplerDescriptorBufferAddressSpaceSize; + VkDeviceSize resourceDescriptorBufferAddressSpaceSize; + VkDeviceSize descriptorBufferAddressSpaceSize; +} VkPhysicalDeviceDescriptorBufferPropertiesEXT; + +typedef struct VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT { + VkStructureType sType; + void* pNext; + size_t combinedImageSamplerDensityMapDescriptorSize; +} VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT; + +typedef struct VkPhysicalDeviceDescriptorBufferFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 descriptorBuffer; + VkBool32 descriptorBufferCaptureReplay; + VkBool32 descriptorBufferImageLayoutIgnored; + VkBool32 descriptorBufferPushDescriptors; +} VkPhysicalDeviceDescriptorBufferFeaturesEXT; + +typedef struct VkDescriptorAddressInfoEXT { + VkStructureType sType; + void* pNext; + VkDeviceAddress address; + VkDeviceSize range; + VkFormat format; +} VkDescriptorAddressInfoEXT; + +typedef struct VkDescriptorBufferBindingInfoEXT { + VkStructureType sType; + void* pNext; + VkDeviceAddress address; + VkBufferUsageFlags usage; +} VkDescriptorBufferBindingInfoEXT; + +typedef struct VkDescriptorBufferBindingPushDescriptorBufferHandleEXT { + VkStructureType sType; + void* pNext; + VkBuffer buffer; +} VkDescriptorBufferBindingPushDescriptorBufferHandleEXT; + +typedef union VkDescriptorDataEXT { + const VkSampler* pSampler; + const VkDescriptorImageInfo* pCombinedImageSampler; + const VkDescriptorImageInfo* pInputAttachmentImage; + const VkDescriptorImageInfo* pSampledImage; + const VkDescriptorImageInfo* pStorageImage; + const VkDescriptorAddressInfoEXT* pUniformTexelBuffer; + const VkDescriptorAddressInfoEXT* pStorageTexelBuffer; + const VkDescriptorAddressInfoEXT* pUniformBuffer; + const VkDescriptorAddressInfoEXT* pStorageBuffer; + VkDeviceAddress accelerationStructure; +} VkDescriptorDataEXT; + +typedef struct VkDescriptorGetInfoEXT { + VkStructureType sType; + const void* pNext; + VkDescriptorType type; + VkDescriptorDataEXT data; +} VkDescriptorGetInfoEXT; + +typedef struct VkBufferCaptureDescriptorDataInfoEXT { + VkStructureType sType; + const void* pNext; + VkBuffer buffer; +} VkBufferCaptureDescriptorDataInfoEXT; + +typedef struct VkImageCaptureDescriptorDataInfoEXT { + VkStructureType sType; + const void* pNext; + VkImage image; +} VkImageCaptureDescriptorDataInfoEXT; + +typedef struct VkImageViewCaptureDescriptorDataInfoEXT { + VkStructureType sType; + const void* pNext; + VkImageView imageView; +} VkImageViewCaptureDescriptorDataInfoEXT; + +typedef struct VkSamplerCaptureDescriptorDataInfoEXT { + VkStructureType sType; + const void* pNext; + VkSampler sampler; +} VkSamplerCaptureDescriptorDataInfoEXT; + +typedef struct VkOpaqueCaptureDescriptorDataCreateInfoEXT { + VkStructureType sType; + const void* pNext; + const void* opaqueCaptureDescriptorData; +} VkOpaqueCaptureDescriptorDataCreateInfoEXT; + +typedef struct VkAccelerationStructureCaptureDescriptorDataInfoEXT { + VkStructureType sType; + const void* pNext; + VkAccelerationStructureKHR accelerationStructure; + VkAccelerationStructureNV accelerationStructureNV; +} VkAccelerationStructureCaptureDescriptorDataInfoEXT; + +typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutSizeEXT)(VkDevice device, VkDescriptorSetLayout layout, VkDeviceSize* pLayoutSizeInBytes); +typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutBindingOffsetEXT)(VkDevice device, VkDescriptorSetLayout layout, uint32_t binding, VkDeviceSize* pOffset); +typedef void (VKAPI_PTR *PFN_vkGetDescriptorEXT)(VkDevice device, const VkDescriptorGetInfoEXT* pDescriptorInfo, size_t dataSize, void* pDescriptor); +typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorBuffersEXT)(VkCommandBuffer commandBuffer, uint32_t bufferCount, const VkDescriptorBufferBindingInfoEXT* pBindingInfos); +typedef void (VKAPI_PTR *PFN_vkCmdSetDescriptorBufferOffsetsEXT)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const uint32_t* pBufferIndices, const VkDeviceSize* pOffsets); +typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set); +typedef VkResult (VKAPI_PTR *PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT)(VkDevice device, const VkBufferCaptureDescriptorDataInfoEXT* pInfo, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkGetImageOpaqueCaptureDescriptorDataEXT)(VkDevice device, const VkImageCaptureDescriptorDataInfoEXT* pInfo, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT)(VkDevice device, const VkImageViewCaptureDescriptorDataInfoEXT* pInfo, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT)(VkDevice device, const VkSamplerCaptureDescriptorDataInfoEXT* pInfo, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT)(VkDevice device, const VkAccelerationStructureCaptureDescriptorDataInfoEXT* pInfo, void* pData); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSizeEXT( + VkDevice device, + VkDescriptorSetLayout layout, + VkDeviceSize* pLayoutSizeInBytes); + +VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutBindingOffsetEXT( + VkDevice device, + VkDescriptorSetLayout layout, + uint32_t binding, + VkDeviceSize* pOffset); + +VKAPI_ATTR void VKAPI_CALL vkGetDescriptorEXT( + VkDevice device, + const VkDescriptorGetInfoEXT* pDescriptorInfo, + size_t dataSize, + void* pDescriptor); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorBuffersEXT( + VkCommandBuffer commandBuffer, + uint32_t bufferCount, + const VkDescriptorBufferBindingInfoEXT* pBindingInfos); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDescriptorBufferOffsetsEXT( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t firstSet, + uint32_t setCount, + const uint32_t* pBufferIndices, + const VkDeviceSize* pOffsets); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorBufferEmbeddedSamplersEXT( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t set); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetBufferOpaqueCaptureDescriptorDataEXT( + VkDevice device, + const VkBufferCaptureDescriptorDataInfoEXT* pInfo, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetImageOpaqueCaptureDescriptorDataEXT( + VkDevice device, + const VkImageCaptureDescriptorDataInfoEXT* pInfo, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetImageViewOpaqueCaptureDescriptorDataEXT( + VkDevice device, + const VkImageViewCaptureDescriptorDataInfoEXT* pInfo, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSamplerOpaqueCaptureDescriptorDataEXT( + VkDevice device, + const VkSamplerCaptureDescriptorDataInfoEXT* pInfo, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT( + VkDevice device, + const VkAccelerationStructureCaptureDescriptorDataInfoEXT* pInfo, + void* pData); +#endif + + +// VK_EXT_graphics_pipeline_library is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_graphics_pipeline_library 1 #define VK_EXT_GRAPHICS_PIPELINE_LIBRARY_SPEC_VERSION 1 #define VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME "VK_EXT_graphics_pipeline_library" @@ -13573,12 +15147,13 @@ typedef struct VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT { typedef struct VkGraphicsPipelineLibraryCreateInfoEXT { VkStructureType sType; - void* pNext; + const void* pNext; VkGraphicsPipelineLibraryFlagsEXT flags; } VkGraphicsPipelineLibraryCreateInfoEXT; +// VK_AMD_shader_early_and_late_fragment_tests is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_early_and_late_fragment_tests 1 #define VK_AMD_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_SPEC_VERSION 1 #define VK_AMD_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_EXTENSION_NAME "VK_AMD_shader_early_and_late_fragment_tests" @@ -13590,6 +15165,7 @@ typedef struct VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD { +// VK_NV_fragment_shading_rate_enums is a preprocessor guard. Do not pass it to API calls. #define VK_NV_fragment_shading_rate_enums 1 #define VK_NV_FRAGMENT_SHADING_RATE_ENUMS_SPEC_VERSION 1 #define VK_NV_FRAGMENT_SHADING_RATE_ENUMS_EXTENSION_NAME "VK_NV_fragment_shading_rate_enums" @@ -13647,6 +15223,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetFragmentShadingRateEnumNV( #endif +// VK_NV_ray_tracing_motion_blur is a preprocessor guard. Do not pass it to API calls. #define VK_NV_ray_tracing_motion_blur 1 #define VK_NV_RAY_TRACING_MOTION_BLUR_SPEC_VERSION 1 #define VK_NV_RAY_TRACING_MOTION_BLUR_EXTENSION_NAME "VK_NV_ray_tracing_motion_blur" @@ -13737,6 +15314,7 @@ typedef struct VkPhysicalDeviceRayTracingMotionBlurFeaturesNV { +// VK_EXT_ycbcr_2plane_444_formats is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_ycbcr_2plane_444_formats 1 #define VK_EXT_YCBCR_2PLANE_444_FORMATS_SPEC_VERSION 1 #define VK_EXT_YCBCR_2PLANE_444_FORMATS_EXTENSION_NAME "VK_EXT_ycbcr_2plane_444_formats" @@ -13748,6 +15326,7 @@ typedef struct VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT { +// VK_EXT_fragment_density_map2 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_fragment_density_map2 1 #define VK_EXT_FRAGMENT_DENSITY_MAP_2_SPEC_VERSION 1 #define VK_EXT_FRAGMENT_DENSITY_MAP_2_EXTENSION_NAME "VK_EXT_fragment_density_map2" @@ -13768,6 +15347,7 @@ typedef struct VkPhysicalDeviceFragmentDensityMap2PropertiesEXT { +// VK_QCOM_rotated_copy_commands is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_rotated_copy_commands 1 #define VK_QCOM_ROTATED_COPY_COMMANDS_SPEC_VERSION 1 #define VK_QCOM_ROTATED_COPY_COMMANDS_EXTENSION_NAME "VK_QCOM_rotated_copy_commands" @@ -13779,6 +15359,7 @@ typedef struct VkCopyCommandTransformInfoQCOM { +// VK_EXT_image_robustness is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_robustness 1 #define VK_EXT_IMAGE_ROBUSTNESS_SPEC_VERSION 1 #define VK_EXT_IMAGE_ROBUSTNESS_EXTENSION_NAME "VK_EXT_image_robustness" @@ -13786,6 +15367,7 @@ typedef VkPhysicalDeviceImageRobustnessFeatures VkPhysicalDeviceImageRobustnessF +// VK_EXT_image_compression_control is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_compression_control 1 #define VK_EXT_IMAGE_COMPRESSION_CONTROL_SPEC_VERSION 1 #define VK_EXT_IMAGE_COMPRESSION_CONTROL_EXTENSION_NAME "VK_EXT_image_compression_control" @@ -13842,18 +15424,6 @@ typedef struct VkImageCompressionControlEXT { VkImageCompressionFixedRateFlagsEXT* pFixedRateFlags; } VkImageCompressionControlEXT; -typedef struct VkSubresourceLayout2EXT { - VkStructureType sType; - void* pNext; - VkSubresourceLayout subresourceLayout; -} VkSubresourceLayout2EXT; - -typedef struct VkImageSubresource2EXT { - VkStructureType sType; - void* pNext; - VkImageSubresource imageSubresource; -} VkImageSubresource2EXT; - typedef struct VkImageCompressionPropertiesEXT { VkStructureType sType; void* pNext; @@ -13861,17 +15431,9 @@ typedef struct VkImageCompressionPropertiesEXT { VkImageCompressionFixedRateFlagsEXT imageCompressionFixedRateFlags; } VkImageCompressionPropertiesEXT; -typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout2EXT)(VkDevice device, VkImage image, const VkImageSubresource2EXT* pSubresource, VkSubresourceLayout2EXT* pLayout); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout2EXT( - VkDevice device, - VkImage image, - const VkImageSubresource2EXT* pSubresource, - VkSubresourceLayout2EXT* pLayout); -#endif +// VK_EXT_attachment_feedback_loop_layout is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_attachment_feedback_loop_layout 1 #define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_SPEC_VERSION 2 #define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_EXTENSION_NAME "VK_EXT_attachment_feedback_loop_layout" @@ -13883,6 +15445,7 @@ typedef struct VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT { +// VK_EXT_4444_formats is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_4444_formats 1 #define VK_EXT_4444_FORMATS_SPEC_VERSION 1 #define VK_EXT_4444_FORMATS_EXTENSION_NAME "VK_EXT_4444_formats" @@ -13895,8 +15458,9 @@ typedef struct VkPhysicalDevice4444FormatsFeaturesEXT { +// VK_EXT_device_fault is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_device_fault 1 -#define VK_EXT_DEVICE_FAULT_SPEC_VERSION 1 +#define VK_EXT_DEVICE_FAULT_SPEC_VERSION 2 #define VK_EXT_DEVICE_FAULT_EXTENSION_NAME "VK_EXT_device_fault" typedef enum VkDeviceFaultAddressTypeEXT { @@ -13960,6 +15524,8 @@ typedef struct VkDeviceFaultVendorBinaryHeaderVersionOneEXT { uint32_t applicationNameOffset; uint32_t applicationVersion; uint32_t engineNameOffset; + uint32_t engineVersion; + uint32_t apiVersion; } VkDeviceFaultVendorBinaryHeaderVersionOneEXT; typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceFaultInfoEXT)(VkDevice device, VkDeviceFaultCountsEXT* pFaultCounts, VkDeviceFaultInfoEXT* pFaultInfo); @@ -13972,6 +15538,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceFaultInfoEXT( #endif +// VK_ARM_rasterization_order_attachment_access is a preprocessor guard. Do not pass it to API calls. #define VK_ARM_rasterization_order_attachment_access 1 #define VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_SPEC_VERSION 1 #define VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_EXTENSION_NAME "VK_ARM_rasterization_order_attachment_access" @@ -13987,6 +15554,7 @@ typedef VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT VkPhysical +// VK_EXT_rgba10x6_formats is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_rgba10x6_formats 1 #define VK_EXT_RGBA10X6_FORMATS_SPEC_VERSION 1 #define VK_EXT_RGBA10X6_FORMATS_EXTENSION_NAME "VK_EXT_rgba10x6_formats" @@ -13998,24 +15566,7 @@ typedef struct VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT { -#define VK_NV_acquire_winrt_display 1 -#define VK_NV_ACQUIRE_WINRT_DISPLAY_SPEC_VERSION 1 -#define VK_NV_ACQUIRE_WINRT_DISPLAY_EXTENSION_NAME "VK_NV_acquire_winrt_display" -typedef VkResult (VKAPI_PTR *PFN_vkAcquireWinrtDisplayNV)(VkPhysicalDevice physicalDevice, VkDisplayKHR display); -typedef VkResult (VKAPI_PTR *PFN_vkGetWinrtDisplayNV)(VkPhysicalDevice physicalDevice, uint32_t deviceRelativeId, VkDisplayKHR* pDisplay); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkAcquireWinrtDisplayNV( - VkPhysicalDevice physicalDevice, - VkDisplayKHR display); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetWinrtDisplayNV( - VkPhysicalDevice physicalDevice, - uint32_t deviceRelativeId, - VkDisplayKHR* pDisplay); -#endif - - +// VK_VALVE_mutable_descriptor_type is a preprocessor guard. Do not pass it to API calls. #define VK_VALVE_mutable_descriptor_type 1 #define VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION 1 #define VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME "VK_VALVE_mutable_descriptor_type" @@ -14045,6 +15596,7 @@ typedef VkMutableDescriptorTypeCreateInfoEXT VkMutableDescriptorTypeCreateInfoVA +// VK_EXT_vertex_input_dynamic_state is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_vertex_input_dynamic_state 1 #define VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_SPEC_VERSION 2 #define VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_vertex_input_dynamic_state" @@ -14084,6 +15636,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetVertexInputEXT( #endif +// VK_EXT_physical_device_drm is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_physical_device_drm 1 #define VK_EXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION 1 #define VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME "VK_EXT_physical_device_drm" @@ -14100,6 +15653,7 @@ typedef struct VkPhysicalDeviceDrmPropertiesEXT { +// VK_EXT_device_address_binding_report is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_device_address_binding_report 1 #define VK_EXT_DEVICE_ADDRESS_BINDING_REPORT_SPEC_VERSION 1 #define VK_EXT_DEVICE_ADDRESS_BINDING_REPORT_EXTENSION_NAME "VK_EXT_device_address_binding_report" @@ -14132,6 +15686,7 @@ typedef struct VkDeviceAddressBindingCallbackDataEXT { +// VK_EXT_depth_clip_control is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_depth_clip_control 1 #define VK_EXT_DEPTH_CLIP_CONTROL_SPEC_VERSION 1 #define VK_EXT_DEPTH_CLIP_CONTROL_EXTENSION_NAME "VK_EXT_depth_clip_control" @@ -14149,6 +15704,7 @@ typedef struct VkPipelineViewportDepthClipControlCreateInfoEXT { +// VK_EXT_primitive_topology_list_restart is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_primitive_topology_list_restart 1 #define VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_SPEC_VERSION 1 #define VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_EXTENSION_NAME "VK_EXT_primitive_topology_list_restart" @@ -14161,8 +15717,9 @@ typedef struct VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT { +// VK_HUAWEI_subpass_shading is a preprocessor guard. Do not pass it to API calls. #define VK_HUAWEI_subpass_shading 1 -#define VK_HUAWEI_SUBPASS_SHADING_SPEC_VERSION 2 +#define VK_HUAWEI_SUBPASS_SHADING_SPEC_VERSION 3 #define VK_HUAWEI_SUBPASS_SHADING_EXTENSION_NAME "VK_HUAWEI_subpass_shading" typedef struct VkSubpassShadingPipelineCreateInfoHUAWEI { VkStructureType sType; @@ -14197,6 +15754,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSubpassShadingHUAWEI( #endif +// VK_HUAWEI_invocation_mask is a preprocessor guard. Do not pass it to API calls. #define VK_HUAWEI_invocation_mask 1 #define VK_HUAWEI_INVOCATION_MASK_SPEC_VERSION 1 #define VK_HUAWEI_INVOCATION_MASK_EXTENSION_NAME "VK_HUAWEI_invocation_mask" @@ -14216,6 +15774,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdBindInvocationMaskHUAWEI( #endif +// VK_NV_external_memory_rdma is a preprocessor guard. Do not pass it to API calls. #define VK_NV_external_memory_rdma 1 typedef void* VkRemoteAddressNV; #define VK_NV_EXTERNAL_MEMORY_RDMA_SPEC_VERSION 1 @@ -14243,6 +15802,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryRemoteAddressNV( #endif +// VK_EXT_pipeline_properties is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pipeline_properties 1 #define VK_EXT_PIPELINE_PROPERTIES_SPEC_VERSION 1 #define VK_EXT_PIPELINE_PROPERTIES_EXTENSION_NAME "VK_EXT_pipeline_properties" @@ -14270,6 +15830,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelinePropertiesEXT( #endif +// VK_EXT_multisampled_render_to_single_sampled is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_multisampled_render_to_single_sampled 1 #define VK_EXT_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_SPEC_VERSION 1 #define VK_EXT_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_EXTENSION_NAME "VK_EXT_multisampled_render_to_single_sampled" @@ -14294,6 +15855,7 @@ typedef struct VkMultisampledRenderToSingleSampledInfoEXT { +// VK_EXT_extended_dynamic_state2 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_extended_dynamic_state2 1 #define VK_EXT_EXTENDED_DYNAMIC_STATE_2_SPEC_VERSION 1 #define VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME "VK_EXT_extended_dynamic_state2" @@ -14334,6 +15896,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetPrimitiveRestartEnableEXT( #endif +// VK_EXT_color_write_enable is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_color_write_enable 1 #define VK_EXT_COLOR_WRITE_ENABLE_SPEC_VERSION 1 #define VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME "VK_EXT_color_write_enable" @@ -14360,6 +15923,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetColorWrite #endif +// VK_EXT_primitives_generated_query is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_primitives_generated_query 1 #define VK_EXT_PRIMITIVES_GENERATED_QUERY_SPEC_VERSION 1 #define VK_EXT_PRIMITIVES_GENERATED_QUERY_EXTENSION_NAME "VK_EXT_primitives_generated_query" @@ -14373,6 +15937,7 @@ typedef struct VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT { +// VK_EXT_global_priority_query is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_global_priority_query 1 #define VK_EXT_GLOBAL_PRIORITY_QUERY_SPEC_VERSION 1 #define VK_EXT_GLOBAL_PRIORITY_QUERY_EXTENSION_NAME "VK_EXT_global_priority_query" @@ -14383,6 +15948,7 @@ typedef VkQueueFamilyGlobalPriorityPropertiesKHR VkQueueFamilyGlobalPriorityProp +// VK_EXT_image_view_min_lod is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_view_min_lod 1 #define VK_EXT_IMAGE_VIEW_MIN_LOD_SPEC_VERSION 1 #define VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME "VK_EXT_image_view_min_lod" @@ -14400,6 +15966,7 @@ typedef struct VkImageViewMinLodCreateInfoEXT { +// VK_EXT_multi_draw is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_multi_draw 1 #define VK_EXT_MULTI_DRAW_SPEC_VERSION 1 #define VK_EXT_MULTI_DRAW_EXTENSION_NAME "VK_EXT_multi_draw" @@ -14449,6 +16016,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawMultiIndexedEXT( #endif +// VK_EXT_image_2d_view_of_3d is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_2d_view_of_3d 1 #define VK_EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION 1 #define VK_EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME "VK_EXT_image_2d_view_of_3d" @@ -14461,6 +16029,29 @@ typedef struct VkPhysicalDeviceImage2DViewOf3DFeaturesEXT { +// VK_EXT_shader_tile_image is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_shader_tile_image 1 +#define VK_EXT_SHADER_TILE_IMAGE_SPEC_VERSION 1 +#define VK_EXT_SHADER_TILE_IMAGE_EXTENSION_NAME "VK_EXT_shader_tile_image" +typedef struct VkPhysicalDeviceShaderTileImageFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 shaderTileImageColorReadAccess; + VkBool32 shaderTileImageDepthReadAccess; + VkBool32 shaderTileImageStencilReadAccess; +} VkPhysicalDeviceShaderTileImageFeaturesEXT; + +typedef struct VkPhysicalDeviceShaderTileImagePropertiesEXT { + VkStructureType sType; + void* pNext; + VkBool32 shaderTileImageCoherentReadAccelerated; + VkBool32 shaderTileImageReadSampleFromPixelRateInvocation; + VkBool32 shaderTileImageReadFromHelperInvocation; +} VkPhysicalDeviceShaderTileImagePropertiesEXT; + + + +// VK_EXT_opacity_micromap is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_opacity_micromap 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkMicromapEXT) #define VK_EXT_OPACITY_MICROMAP_SPEC_VERSION 2 @@ -14468,6 +16059,9 @@ VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkMicromapEXT) typedef enum VkMicromapTypeEXT { VK_MICROMAP_TYPE_OPACITY_MICROMAP_EXT = 0, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_MICROMAP_TYPE_DISPLACEMENT_MICROMAP_NV = 1000397000, +#endif VK_MICROMAP_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF } VkMicromapTypeEXT; @@ -14729,11 +16323,50 @@ VKAPI_ATTR void VKAPI_CALL vkGetMicromapBuildSizesEXT( #endif +// VK_EXT_load_store_op_none is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_load_store_op_none 1 #define VK_EXT_LOAD_STORE_OP_NONE_SPEC_VERSION 1 #define VK_EXT_LOAD_STORE_OP_NONE_EXTENSION_NAME "VK_EXT_load_store_op_none" +// VK_HUAWEI_cluster_culling_shader is a preprocessor guard. Do not pass it to API calls. +#define VK_HUAWEI_cluster_culling_shader 1 +#define VK_HUAWEI_CLUSTER_CULLING_SHADER_SPEC_VERSION 2 +#define VK_HUAWEI_CLUSTER_CULLING_SHADER_EXTENSION_NAME "VK_HUAWEI_cluster_culling_shader" +typedef struct VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI { + VkStructureType sType; + void* pNext; + VkBool32 clustercullingShader; + VkBool32 multiviewClusterCullingShader; +} VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI; + +typedef struct VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI { + VkStructureType sType; + void* pNext; + uint32_t maxWorkGroupCount[3]; + uint32_t maxWorkGroupSize[3]; + uint32_t maxOutputClusterCount; + VkDeviceSize indirectBufferOffsetAlignment; +} VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI; + +typedef void (VKAPI_PTR *PFN_vkCmdDrawClusterHUAWEI)(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); +typedef void (VKAPI_PTR *PFN_vkCmdDrawClusterIndirectHUAWEI)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdDrawClusterHUAWEI( + VkCommandBuffer commandBuffer, + uint32_t groupCountX, + uint32_t groupCountY, + uint32_t groupCountZ); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawClusterIndirectHUAWEI( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset); +#endif + + +// VK_EXT_border_color_swizzle is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_border_color_swizzle 1 #define VK_EXT_BORDER_COLOR_SWIZZLE_SPEC_VERSION 1 #define VK_EXT_BORDER_COLOR_SWIZZLE_EXTENSION_NAME "VK_EXT_border_color_swizzle" @@ -14753,6 +16386,7 @@ typedef struct VkSamplerBorderColorComponentMappingCreateInfoEXT { +// VK_EXT_pageable_device_local_memory is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pageable_device_local_memory 1 #define VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_SPEC_VERSION 1 #define VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_EXTENSION_NAME "VK_EXT_pageable_device_local_memory" @@ -14772,6 +16406,41 @@ VKAPI_ATTR void VKAPI_CALL vkSetDeviceMemoryPriorityEXT( #endif +// VK_ARM_shader_core_properties is a preprocessor guard. Do not pass it to API calls. +#define VK_ARM_shader_core_properties 1 +#define VK_ARM_SHADER_CORE_PROPERTIES_SPEC_VERSION 1 +#define VK_ARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME "VK_ARM_shader_core_properties" +typedef struct VkPhysicalDeviceShaderCorePropertiesARM { + VkStructureType sType; + void* pNext; + uint32_t pixelRate; + uint32_t texelRate; + uint32_t fmaRate; +} VkPhysicalDeviceShaderCorePropertiesARM; + + + +// VK_EXT_image_sliced_view_of_3d is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_image_sliced_view_of_3d 1 +#define VK_EXT_IMAGE_SLICED_VIEW_OF_3D_SPEC_VERSION 1 +#define VK_EXT_IMAGE_SLICED_VIEW_OF_3D_EXTENSION_NAME "VK_EXT_image_sliced_view_of_3d" +#define VK_REMAINING_3D_SLICES_EXT (~0U) +typedef struct VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 imageSlicedViewOf3D; +} VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT; + +typedef struct VkImageViewSlicedCreateInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t sliceOffset; + uint32_t sliceCount; +} VkImageViewSlicedCreateInfoEXT; + + + +// VK_VALVE_descriptor_set_host_mapping is a preprocessor guard. Do not pass it to API calls. #define VK_VALVE_descriptor_set_host_mapping 1 #define VK_VALVE_DESCRIPTOR_SET_HOST_MAPPING_SPEC_VERSION 1 #define VK_VALVE_DESCRIPTOR_SET_HOST_MAPPING_EXTENSION_NAME "VK_VALVE_descriptor_set_host_mapping" @@ -14811,6 +16480,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetHostMappingVALVE( #endif +// VK_EXT_depth_clamp_zero_one is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_depth_clamp_zero_one 1 #define VK_EXT_DEPTH_CLAMP_ZERO_ONE_SPEC_VERSION 1 #define VK_EXT_DEPTH_CLAMP_ZERO_ONE_EXTENSION_NAME "VK_EXT_depth_clamp_zero_one" @@ -14822,6 +16492,7 @@ typedef struct VkPhysicalDeviceDepthClampZeroOneFeaturesEXT { +// VK_EXT_non_seamless_cube_map is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_non_seamless_cube_map 1 #define VK_EXT_NON_SEAMLESS_CUBE_MAP_SPEC_VERSION 1 #define VK_EXT_NON_SEAMLESS_CUBE_MAP_EXTENSION_NAME "VK_EXT_non_seamless_cube_map" @@ -14833,6 +16504,7 @@ typedef struct VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT { +// VK_QCOM_fragment_density_map_offset is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_fragment_density_map_offset 1 #define VK_QCOM_FRAGMENT_DENSITY_MAP_OFFSET_SPEC_VERSION 1 #define VK_QCOM_FRAGMENT_DENSITY_MAP_OFFSET_EXTENSION_NAME "VK_QCOM_fragment_density_map_offset" @@ -14857,6 +16529,159 @@ typedef struct VkSubpassFragmentDensityMapOffsetEndInfoQCOM { +// VK_NV_copy_memory_indirect is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_copy_memory_indirect 1 +#define VK_NV_COPY_MEMORY_INDIRECT_SPEC_VERSION 1 +#define VK_NV_COPY_MEMORY_INDIRECT_EXTENSION_NAME "VK_NV_copy_memory_indirect" +typedef struct VkCopyMemoryIndirectCommandNV { + VkDeviceAddress srcAddress; + VkDeviceAddress dstAddress; + VkDeviceSize size; +} VkCopyMemoryIndirectCommandNV; + +typedef struct VkCopyMemoryToImageIndirectCommandNV { + VkDeviceAddress srcAddress; + uint32_t bufferRowLength; + uint32_t bufferImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkCopyMemoryToImageIndirectCommandNV; + +typedef struct VkPhysicalDeviceCopyMemoryIndirectFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 indirectCopy; +} VkPhysicalDeviceCopyMemoryIndirectFeaturesNV; + +typedef struct VkPhysicalDeviceCopyMemoryIndirectPropertiesNV { + VkStructureType sType; + void* pNext; + VkQueueFlags supportedQueues; +} VkPhysicalDeviceCopyMemoryIndirectPropertiesNV; + +typedef void (VKAPI_PTR *PFN_vkCmdCopyMemoryIndirectNV)(VkCommandBuffer commandBuffer, VkDeviceAddress copyBufferAddress, uint32_t copyCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdCopyMemoryToImageIndirectNV)(VkCommandBuffer commandBuffer, VkDeviceAddress copyBufferAddress, uint32_t copyCount, uint32_t stride, VkImage dstImage, VkImageLayout dstImageLayout, const VkImageSubresourceLayers* pImageSubresources); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdCopyMemoryIndirectNV( + VkCommandBuffer commandBuffer, + VkDeviceAddress copyBufferAddress, + uint32_t copyCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyMemoryToImageIndirectNV( + VkCommandBuffer commandBuffer, + VkDeviceAddress copyBufferAddress, + uint32_t copyCount, + uint32_t stride, + VkImage dstImage, + VkImageLayout dstImageLayout, + const VkImageSubresourceLayers* pImageSubresources); +#endif + + +// VK_NV_memory_decompression is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_memory_decompression 1 +#define VK_NV_MEMORY_DECOMPRESSION_SPEC_VERSION 1 +#define VK_NV_MEMORY_DECOMPRESSION_EXTENSION_NAME "VK_NV_memory_decompression" + +// Flag bits for VkMemoryDecompressionMethodFlagBitsNV +typedef VkFlags64 VkMemoryDecompressionMethodFlagBitsNV; +static const VkMemoryDecompressionMethodFlagBitsNV VK_MEMORY_DECOMPRESSION_METHOD_GDEFLATE_1_0_BIT_NV = 0x00000001ULL; + +typedef VkFlags64 VkMemoryDecompressionMethodFlagsNV; +typedef struct VkDecompressMemoryRegionNV { + VkDeviceAddress srcAddress; + VkDeviceAddress dstAddress; + VkDeviceSize compressedSize; + VkDeviceSize decompressedSize; + VkMemoryDecompressionMethodFlagsNV decompressionMethod; +} VkDecompressMemoryRegionNV; + +typedef struct VkPhysicalDeviceMemoryDecompressionFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 memoryDecompression; +} VkPhysicalDeviceMemoryDecompressionFeaturesNV; + +typedef struct VkPhysicalDeviceMemoryDecompressionPropertiesNV { + VkStructureType sType; + void* pNext; + VkMemoryDecompressionMethodFlagsNV decompressionMethods; + uint64_t maxDecompressionIndirectCount; +} VkPhysicalDeviceMemoryDecompressionPropertiesNV; + +typedef void (VKAPI_PTR *PFN_vkCmdDecompressMemoryNV)(VkCommandBuffer commandBuffer, uint32_t decompressRegionCount, const VkDecompressMemoryRegionNV* pDecompressMemoryRegions); +typedef void (VKAPI_PTR *PFN_vkCmdDecompressMemoryIndirectCountNV)(VkCommandBuffer commandBuffer, VkDeviceAddress indirectCommandsAddress, VkDeviceAddress indirectCommandsCountAddress, uint32_t stride); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdDecompressMemoryNV( + VkCommandBuffer commandBuffer, + uint32_t decompressRegionCount, + const VkDecompressMemoryRegionNV* pDecompressMemoryRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdDecompressMemoryIndirectCountNV( + VkCommandBuffer commandBuffer, + VkDeviceAddress indirectCommandsAddress, + VkDeviceAddress indirectCommandsCountAddress, + uint32_t stride); +#endif + + +// VK_NV_device_generated_commands_compute is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_device_generated_commands_compute 1 +#define VK_NV_DEVICE_GENERATED_COMMANDS_COMPUTE_SPEC_VERSION 2 +#define VK_NV_DEVICE_GENERATED_COMMANDS_COMPUTE_EXTENSION_NAME "VK_NV_device_generated_commands_compute" +typedef struct VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 deviceGeneratedCompute; + VkBool32 deviceGeneratedComputePipelines; + VkBool32 deviceGeneratedComputeCaptureReplay; +} VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV; + +typedef struct VkComputePipelineIndirectBufferInfoNV { + VkStructureType sType; + const void* pNext; + VkDeviceAddress deviceAddress; + VkDeviceSize size; + VkDeviceAddress pipelineDeviceAddressCaptureReplay; +} VkComputePipelineIndirectBufferInfoNV; + +typedef struct VkPipelineIndirectDeviceAddressInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineBindPoint pipelineBindPoint; + VkPipeline pipeline; +} VkPipelineIndirectDeviceAddressInfoNV; + +typedef struct VkBindPipelineIndirectCommandNV { + VkDeviceAddress pipelineAddress; +} VkBindPipelineIndirectCommandNV; + +typedef void (VKAPI_PTR *PFN_vkGetPipelineIndirectMemoryRequirementsNV)(VkDevice device, const VkComputePipelineCreateInfo* pCreateInfo, VkMemoryRequirements2* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkCmdUpdatePipelineIndirectBufferNV)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); +typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetPipelineIndirectDeviceAddressNV)(VkDevice device, const VkPipelineIndirectDeviceAddressInfoNV* pInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPipelineIndirectMemoryRequirementsNV( + VkDevice device, + const VkComputePipelineCreateInfo* pCreateInfo, + VkMemoryRequirements2* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkCmdUpdatePipelineIndirectBufferNV( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline); + +VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetPipelineIndirectDeviceAddressNV( + VkDevice device, + const VkPipelineIndirectDeviceAddressInfoNV* pInfo); +#endif + + +// VK_NV_linear_color_attachment is a preprocessor guard. Do not pass it to API calls. #define VK_NV_linear_color_attachment 1 #define VK_NV_LINEAR_COLOR_ATTACHMENT_SPEC_VERSION 1 #define VK_NV_LINEAR_COLOR_ATTACHMENT_EXTENSION_NAME "VK_NV_linear_color_attachment" @@ -14868,11 +16693,13 @@ typedef struct VkPhysicalDeviceLinearColorAttachmentFeaturesNV { +// VK_GOOGLE_surfaceless_query is a preprocessor guard. Do not pass it to API calls. #define VK_GOOGLE_surfaceless_query 1 #define VK_GOOGLE_SURFACELESS_QUERY_SPEC_VERSION 2 #define VK_GOOGLE_SURFACELESS_QUERY_EXTENSION_NAME "VK_GOOGLE_surfaceless_query" +// VK_EXT_image_compression_control_swapchain is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_compression_control_swapchain 1 #define VK_EXT_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_SPEC_VERSION 1 #define VK_EXT_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_EXTENSION_NAME "VK_EXT_image_compression_control_swapchain" @@ -14884,6 +16711,7 @@ typedef struct VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT { +// VK_QCOM_image_processing is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_image_processing 1 #define VK_QCOM_IMAGE_PROCESSING_SPEC_VERSION 1 #define VK_QCOM_IMAGE_PROCESSING_EXTENSION_NAME "VK_QCOM_image_processing" @@ -14914,6 +16742,19 @@ typedef struct VkPhysicalDeviceImageProcessingPropertiesQCOM { +// VK_EXT_external_memory_acquire_unmodified is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_external_memory_acquire_unmodified 1 +#define VK_EXT_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_SPEC_VERSION 1 +#define VK_EXT_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXTENSION_NAME "VK_EXT_external_memory_acquire_unmodified" +typedef struct VkExternalMemoryAcquireUnmodifiedEXT { + VkStructureType sType; + const void* pNext; + VkBool32 acquireUnmodifiedMemory; +} VkExternalMemoryAcquireUnmodifiedEXT; + + + +// VK_EXT_extended_dynamic_state3 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_extended_dynamic_state3 1 #define VK_EXT_EXTENDED_DYNAMIC_STATE_3_SPEC_VERSION 2 #define VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME "VK_EXT_extended_dynamic_state3" @@ -15147,6 +16988,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetCoverageReductionModeNV( #endif +// VK_EXT_subpass_merge_feedback is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_subpass_merge_feedback 1 #define VK_EXT_SUBPASS_MERGE_FEEDBACK_SPEC_VERSION 2 #define VK_EXT_SUBPASS_MERGE_FEEDBACK_EXTENSION_NAME "VK_EXT_subpass_merge_feedback" @@ -15204,6 +17046,38 @@ typedef struct VkRenderPassSubpassFeedbackCreateInfoEXT { +// VK_LUNARG_direct_driver_loading is a preprocessor guard. Do not pass it to API calls. +#define VK_LUNARG_direct_driver_loading 1 +#define VK_LUNARG_DIRECT_DRIVER_LOADING_SPEC_VERSION 1 +#define VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME "VK_LUNARG_direct_driver_loading" + +typedef enum VkDirectDriverLoadingModeLUNARG { + VK_DIRECT_DRIVER_LOADING_MODE_EXCLUSIVE_LUNARG = 0, + VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG = 1, + VK_DIRECT_DRIVER_LOADING_MODE_MAX_ENUM_LUNARG = 0x7FFFFFFF +} VkDirectDriverLoadingModeLUNARG; +typedef VkFlags VkDirectDriverLoadingFlagsLUNARG; +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddrLUNARG)( + VkInstance instance, const char* pName); + +typedef struct VkDirectDriverLoadingInfoLUNARG { + VkStructureType sType; + void* pNext; + VkDirectDriverLoadingFlagsLUNARG flags; + PFN_vkGetInstanceProcAddrLUNARG pfnGetInstanceProcAddr; +} VkDirectDriverLoadingInfoLUNARG; + +typedef struct VkDirectDriverLoadingListLUNARG { + VkStructureType sType; + void* pNext; + VkDirectDriverLoadingModeLUNARG mode; + uint32_t driverCount; + const VkDirectDriverLoadingInfoLUNARG* pDrivers; +} VkDirectDriverLoadingListLUNARG; + + + +// VK_EXT_shader_module_identifier is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_module_identifier 1 #define VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT 32U #define VK_EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION 1 @@ -15250,11 +17124,13 @@ VKAPI_ATTR void VKAPI_CALL vkGetShaderModuleCreateInfoIdentifierEXT( #endif +// VK_EXT_rasterization_order_attachment_access is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_rasterization_order_attachment_access 1 #define VK_EXT_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_SPEC_VERSION 1 #define VK_EXT_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_EXTENSION_NAME "VK_EXT_rasterization_order_attachment_access" +// VK_NV_optical_flow is a preprocessor guard. Do not pass it to API calls. #define VK_NV_optical_flow 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkOpticalFlowSessionNV) #define VK_NV_OPTICAL_FLOW_SPEC_VERSION 1 @@ -15419,6 +17295,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdOpticalFlowExecuteNV( #endif +// VK_EXT_legacy_dithering is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_legacy_dithering 1 #define VK_EXT_LEGACY_DITHERING_SPEC_VERSION 1 #define VK_EXT_LEGACY_DITHERING_EXTENSION_NAME "VK_EXT_legacy_dithering" @@ -15430,6 +17307,7 @@ typedef struct VkPhysicalDeviceLegacyDitheringFeaturesEXT { +// VK_EXT_pipeline_protected_access is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pipeline_protected_access 1 #define VK_EXT_PIPELINE_PROTECTED_ACCESS_SPEC_VERSION 1 #define VK_EXT_PIPELINE_PROTECTED_ACCESS_EXTENSION_NAME "VK_EXT_pipeline_protected_access" @@ -15441,6 +17319,94 @@ typedef struct VkPhysicalDevicePipelineProtectedAccessFeaturesEXT { +// VK_EXT_shader_object is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_shader_object 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderEXT) +#define VK_EXT_SHADER_OBJECT_SPEC_VERSION 1 +#define VK_EXT_SHADER_OBJECT_EXTENSION_NAME "VK_EXT_shader_object" + +typedef enum VkShaderCodeTypeEXT { + VK_SHADER_CODE_TYPE_BINARY_EXT = 0, + VK_SHADER_CODE_TYPE_SPIRV_EXT = 1, + VK_SHADER_CODE_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkShaderCodeTypeEXT; + +typedef enum VkShaderCreateFlagBitsEXT { + VK_SHADER_CREATE_LINK_STAGE_BIT_EXT = 0x00000001, + VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT = 0x00000002, + VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT = 0x00000004, + VK_SHADER_CREATE_NO_TASK_SHADER_BIT_EXT = 0x00000008, + VK_SHADER_CREATE_DISPATCH_BASE_BIT_EXT = 0x00000010, + VK_SHADER_CREATE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_EXT = 0x00000020, + VK_SHADER_CREATE_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT = 0x00000040, + VK_SHADER_CREATE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkShaderCreateFlagBitsEXT; +typedef VkFlags VkShaderCreateFlagsEXT; +typedef struct VkPhysicalDeviceShaderObjectFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 shaderObject; +} VkPhysicalDeviceShaderObjectFeaturesEXT; + +typedef struct VkPhysicalDeviceShaderObjectPropertiesEXT { + VkStructureType sType; + void* pNext; + uint8_t shaderBinaryUUID[VK_UUID_SIZE]; + uint32_t shaderBinaryVersion; +} VkPhysicalDeviceShaderObjectPropertiesEXT; + +typedef struct VkShaderCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkShaderCreateFlagsEXT flags; + VkShaderStageFlagBits stage; + VkShaderStageFlags nextStage; + VkShaderCodeTypeEXT codeType; + size_t codeSize; + const void* pCode; + const char* pName; + uint32_t setLayoutCount; + const VkDescriptorSetLayout* pSetLayouts; + uint32_t pushConstantRangeCount; + const VkPushConstantRange* pPushConstantRanges; + const VkSpecializationInfo* pSpecializationInfo; +} VkShaderCreateInfoEXT; + +typedef VkPipelineShaderStageRequiredSubgroupSizeCreateInfo VkShaderRequiredSubgroupSizeCreateInfoEXT; + +typedef VkResult (VKAPI_PTR *PFN_vkCreateShadersEXT)(VkDevice device, uint32_t createInfoCount, const VkShaderCreateInfoEXT* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkShaderEXT* pShaders); +typedef void (VKAPI_PTR *PFN_vkDestroyShaderEXT)(VkDevice device, VkShaderEXT shader, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetShaderBinaryDataEXT)(VkDevice device, VkShaderEXT shader, size_t* pDataSize, void* pData); +typedef void (VKAPI_PTR *PFN_vkCmdBindShadersEXT)(VkCommandBuffer commandBuffer, uint32_t stageCount, const VkShaderStageFlagBits* pStages, const VkShaderEXT* pShaders); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateShadersEXT( + VkDevice device, + uint32_t createInfoCount, + const VkShaderCreateInfoEXT* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkShaderEXT* pShaders); + +VKAPI_ATTR void VKAPI_CALL vkDestroyShaderEXT( + VkDevice device, + VkShaderEXT shader, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetShaderBinaryDataEXT( + VkDevice device, + VkShaderEXT shader, + size_t* pDataSize, + void* pData); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindShadersEXT( + VkCommandBuffer commandBuffer, + uint32_t stageCount, + const VkShaderStageFlagBits* pStages, + const VkShaderEXT* pShaders); +#endif + + +// VK_QCOM_tile_properties is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_tile_properties 1 #define VK_QCOM_TILE_PROPERTIES_SPEC_VERSION 1 #define VK_QCOM_TILE_PROPERTIES_EXTENSION_NAME "VK_QCOM_tile_properties" @@ -15475,6 +17441,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDynamicRenderingTilePropertiesQCOM( #endif +// VK_SEC_amigo_profiling is a preprocessor guard. Do not pass it to API calls. #define VK_SEC_amigo_profiling 1 #define VK_SEC_AMIGO_PROFILING_SPEC_VERSION 1 #define VK_SEC_AMIGO_PROFILING_EXTENSION_NAME "VK_SEC_amigo_profiling" @@ -15493,13 +17460,238 @@ typedef struct VkAmigoProfilingSubmitInfoSEC { +// VK_QCOM_multiview_per_view_viewports is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_multiview_per_view_viewports 1 +#define VK_QCOM_MULTIVIEW_PER_VIEW_VIEWPORTS_SPEC_VERSION 1 +#define VK_QCOM_MULTIVIEW_PER_VIEW_VIEWPORTS_EXTENSION_NAME "VK_QCOM_multiview_per_view_viewports" +typedef struct VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 multiviewPerViewViewports; +} VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM; + + + +// VK_NV_ray_tracing_invocation_reorder is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_ray_tracing_invocation_reorder 1 +#define VK_NV_RAY_TRACING_INVOCATION_REORDER_SPEC_VERSION 1 +#define VK_NV_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME "VK_NV_ray_tracing_invocation_reorder" + +typedef enum VkRayTracingInvocationReorderModeNV { + VK_RAY_TRACING_INVOCATION_REORDER_MODE_NONE_NV = 0, + VK_RAY_TRACING_INVOCATION_REORDER_MODE_REORDER_NV = 1, + VK_RAY_TRACING_INVOCATION_REORDER_MODE_MAX_ENUM_NV = 0x7FFFFFFF +} VkRayTracingInvocationReorderModeNV; +typedef struct VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV { + VkStructureType sType; + void* pNext; + VkRayTracingInvocationReorderModeNV rayTracingInvocationReorderReorderingHint; +} VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV; + +typedef struct VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 rayTracingInvocationReorder; +} VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV; + + + +// VK_EXT_mutable_descriptor_type is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_mutable_descriptor_type 1 #define VK_EXT_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION 1 #define VK_EXT_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME "VK_EXT_mutable_descriptor_type" +// VK_ARM_shader_core_builtins is a preprocessor guard. Do not pass it to API calls. +#define VK_ARM_shader_core_builtins 1 +#define VK_ARM_SHADER_CORE_BUILTINS_SPEC_VERSION 2 +#define VK_ARM_SHADER_CORE_BUILTINS_EXTENSION_NAME "VK_ARM_shader_core_builtins" +typedef struct VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM { + VkStructureType sType; + void* pNext; + VkBool32 shaderCoreBuiltins; +} VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM; + +typedef struct VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM { + VkStructureType sType; + void* pNext; + uint64_t shaderCoreMask; + uint32_t shaderCoreCount; + uint32_t shaderWarpsPerCore; +} VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM; + + + +// VK_EXT_pipeline_library_group_handles is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_pipeline_library_group_handles 1 +#define VK_EXT_PIPELINE_LIBRARY_GROUP_HANDLES_SPEC_VERSION 1 +#define VK_EXT_PIPELINE_LIBRARY_GROUP_HANDLES_EXTENSION_NAME "VK_EXT_pipeline_library_group_handles" +typedef struct VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 pipelineLibraryGroupHandles; +} VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT; + + + +// VK_EXT_dynamic_rendering_unused_attachments is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_dynamic_rendering_unused_attachments 1 +#define VK_EXT_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_SPEC_VERSION 1 +#define VK_EXT_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_EXTENSION_NAME "VK_EXT_dynamic_rendering_unused_attachments" +typedef struct VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 dynamicRenderingUnusedAttachments; +} VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT; + + + +// VK_QCOM_multiview_per_view_render_areas is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_multiview_per_view_render_areas 1 +#define VK_QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION 1 +#define VK_QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME "VK_QCOM_multiview_per_view_render_areas" +typedef struct VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 multiviewPerViewRenderAreas; +} VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM; + +typedef struct VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM { + VkStructureType sType; + const void* pNext; + uint32_t perViewRenderAreaCount; + const VkRect2D* pPerViewRenderAreas; +} VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM; + + + +// VK_QCOM_image_processing2 is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_image_processing2 1 +#define VK_QCOM_IMAGE_PROCESSING_2_SPEC_VERSION 1 +#define VK_QCOM_IMAGE_PROCESSING_2_EXTENSION_NAME "VK_QCOM_image_processing2" + +typedef enum VkBlockMatchWindowCompareModeQCOM { + VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_MIN_QCOM = 0, + VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_MAX_QCOM = 1, + VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_MAX_ENUM_QCOM = 0x7FFFFFFF +} VkBlockMatchWindowCompareModeQCOM; +typedef struct VkPhysicalDeviceImageProcessing2FeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 textureBlockMatch2; +} VkPhysicalDeviceImageProcessing2FeaturesQCOM; + +typedef struct VkPhysicalDeviceImageProcessing2PropertiesQCOM { + VkStructureType sType; + void* pNext; + VkExtent2D maxBlockMatchWindow; +} VkPhysicalDeviceImageProcessing2PropertiesQCOM; + +typedef struct VkSamplerBlockMatchWindowCreateInfoQCOM { + VkStructureType sType; + const void* pNext; + VkExtent2D windowExtent; + VkBlockMatchWindowCompareModeQCOM windowCompareMode; +} VkSamplerBlockMatchWindowCreateInfoQCOM; + + + +// VK_QCOM_filter_cubic_weights is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_filter_cubic_weights 1 +#define VK_QCOM_FILTER_CUBIC_WEIGHTS_SPEC_VERSION 1 +#define VK_QCOM_FILTER_CUBIC_WEIGHTS_EXTENSION_NAME "VK_QCOM_filter_cubic_weights" + +typedef enum VkCubicFilterWeightsQCOM { + VK_CUBIC_FILTER_WEIGHTS_CATMULL_ROM_QCOM = 0, + VK_CUBIC_FILTER_WEIGHTS_ZERO_TANGENT_CARDINAL_QCOM = 1, + VK_CUBIC_FILTER_WEIGHTS_B_SPLINE_QCOM = 2, + VK_CUBIC_FILTER_WEIGHTS_MITCHELL_NETRAVALI_QCOM = 3, + VK_CUBIC_FILTER_WEIGHTS_MAX_ENUM_QCOM = 0x7FFFFFFF +} VkCubicFilterWeightsQCOM; +typedef struct VkPhysicalDeviceCubicWeightsFeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 selectableCubicWeights; +} VkPhysicalDeviceCubicWeightsFeaturesQCOM; + +typedef struct VkSamplerCubicWeightsCreateInfoQCOM { + VkStructureType sType; + const void* pNext; + VkCubicFilterWeightsQCOM cubicWeights; +} VkSamplerCubicWeightsCreateInfoQCOM; + +typedef struct VkBlitImageCubicWeightsInfoQCOM { + VkStructureType sType; + const void* pNext; + VkCubicFilterWeightsQCOM cubicWeights; +} VkBlitImageCubicWeightsInfoQCOM; + + + +// VK_QCOM_ycbcr_degamma is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_ycbcr_degamma 1 +#define VK_QCOM_YCBCR_DEGAMMA_SPEC_VERSION 1 +#define VK_QCOM_YCBCR_DEGAMMA_EXTENSION_NAME "VK_QCOM_ycbcr_degamma" +typedef struct VkPhysicalDeviceYcbcrDegammaFeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 ycbcrDegamma; +} VkPhysicalDeviceYcbcrDegammaFeaturesQCOM; + +typedef struct VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM { + VkStructureType sType; + void* pNext; + VkBool32 enableYDegamma; + VkBool32 enableCbCrDegamma; +} VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM; + + + +// VK_QCOM_filter_cubic_clamp is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_filter_cubic_clamp 1 +#define VK_QCOM_FILTER_CUBIC_CLAMP_SPEC_VERSION 1 +#define VK_QCOM_FILTER_CUBIC_CLAMP_EXTENSION_NAME "VK_QCOM_filter_cubic_clamp" +typedef struct VkPhysicalDeviceCubicClampFeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 cubicRangeClamp; +} VkPhysicalDeviceCubicClampFeaturesQCOM; + + + +// VK_EXT_attachment_feedback_loop_dynamic_state is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_attachment_feedback_loop_dynamic_state 1 +#define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_SPEC_VERSION 1 +#define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_attachment_feedback_loop_dynamic_state" +typedef struct VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 attachmentFeedbackLoopDynamicState; +} VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT; + +typedef void (VKAPI_PTR *PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT)(VkCommandBuffer commandBuffer, VkImageAspectFlags aspectMask); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetAttachmentFeedbackLoopEnableEXT( + VkCommandBuffer commandBuffer, + VkImageAspectFlags aspectMask); +#endif + + +// VK_NV_descriptor_pool_overallocation is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_descriptor_pool_overallocation 1 +#define VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_SPEC_VERSION 1 +#define VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME "VK_NV_descriptor_pool_overallocation" +typedef struct VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 descriptorPoolOverallocation; +} VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV; + + + +// VK_KHR_acceleration_structure is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_acceleration_structure 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureKHR) #define VK_KHR_ACCELERATION_STRUCTURE_SPEC_VERSION 13 #define VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME "VK_KHR_acceleration_structure" @@ -15511,6 +17703,7 @@ typedef enum VkBuildAccelerationStructureModeKHR { typedef enum VkAccelerationStructureCreateFlagBitsKHR { VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = 0x00000001, + VK_ACCELERATION_STRUCTURE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000008, VK_ACCELERATION_STRUCTURE_CREATE_MOTION_BIT_NV = 0x00000004, VK_ACCELERATION_STRUCTURE_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkAccelerationStructureCreateFlagBitsKHR; @@ -15773,6 +17966,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetAccelerationStructureBuildSizesKHR( #endif +// VK_KHR_ray_tracing_pipeline is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_ray_tracing_pipeline 1 #define VK_KHR_RAY_TRACING_PIPELINE_SPEC_VERSION 1 #define VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME "VK_KHR_ray_tracing_pipeline" @@ -15909,6 +18103,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetRayTracingPipelineStackSizeKHR( #endif +// VK_KHR_ray_query is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_ray_query 1 #define VK_KHR_RAY_QUERY_SPEC_VERSION 1 #define VK_KHR_RAY_QUERY_EXTENSION_NAME "VK_KHR_ray_query" @@ -15920,6 +18115,7 @@ typedef struct VkPhysicalDeviceRayQueryFeaturesKHR { +// VK_EXT_mesh_shader is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_mesh_shader 1 #define VK_EXT_MESH_SHADER_SPEC_VERSION 1 #define VK_EXT_MESH_SHADER_EXTENSION_NAME "VK_EXT_mesh_shader" diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_directfb.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_directfb.h index ab3504ef..1f11a082 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_directfb.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_directfb.h @@ -2,7 +2,7 @@ #define VULKAN_DIRECTFB_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_EXT_directfb_surface is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_directfb_surface 1 #define VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION 1 #define VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME "VK_EXT_directfb_surface" diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_fuchsia.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_fuchsia.h index 61774ff9..76e15648 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_fuchsia.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_fuchsia.h @@ -2,7 +2,7 @@ #define VULKAN_FUCHSIA_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_FUCHSIA_imagepipe_surface is a preprocessor guard. Do not pass it to API calls. #define VK_FUCHSIA_imagepipe_surface 1 #define VK_FUCHSIA_IMAGEPIPE_SURFACE_SPEC_VERSION 1 #define VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME "VK_FUCHSIA_imagepipe_surface" @@ -41,6 +42,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA( #endif +// VK_FUCHSIA_external_memory is a preprocessor guard. Do not pass it to API calls. #define VK_FUCHSIA_external_memory 1 #define VK_FUCHSIA_EXTERNAL_MEMORY_SPEC_VERSION 1 #define VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME "VK_FUCHSIA_external_memory" @@ -81,6 +83,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandlePropertiesFUCHSIA( #endif +// VK_FUCHSIA_external_semaphore is a preprocessor guard. Do not pass it to API calls. #define VK_FUCHSIA_external_semaphore 1 #define VK_FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 #define VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_FUCHSIA_external_semaphore" @@ -115,6 +118,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreZirconHandleFUCHSIA( #endif +// VK_FUCHSIA_buffer_collection is a preprocessor guard. Do not pass it to API calls. #define VK_FUCHSIA_buffer_collection 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferCollectionFUCHSIA) #define VK_FUCHSIA_BUFFER_COLLECTION_SPEC_VERSION 2 diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_ggp.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_ggp.h index 19dfd226..9783aa3b 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_ggp.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_ggp.h @@ -2,7 +2,7 @@ #define VULKAN_GGP_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_GGP_stream_descriptor_surface is a preprocessor guard. Do not pass it to API calls. #define VK_GGP_stream_descriptor_surface 1 #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1 #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME "VK_GGP_stream_descriptor_surface" @@ -41,6 +42,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP( #endif +// VK_GGP_frame_token is a preprocessor guard. Do not pass it to API calls. #define VK_GGP_frame_token 1 #define VK_GGP_FRAME_TOKEN_SPEC_VERSION 1 #define VK_GGP_FRAME_TOKEN_EXTENSION_NAME "VK_GGP_frame_token" diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_ios.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_ios.h index 57922054..211429ff 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_ios.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_ios.h @@ -2,7 +2,7 @@ #define VULKAN_IOS_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_MVK_ios_surface is a preprocessor guard. Do not pass it to API calls. #define VK_MVK_ios_surface 1 #define VK_MVK_IOS_SURFACE_SPEC_VERSION 3 #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_macos.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_macos.h index 8e197c7c..c6509cc8 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_macos.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_macos.h @@ -2,7 +2,7 @@ #define VULKAN_MACOS_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_MVK_macos_surface is a preprocessor guard. Do not pass it to API calls. #define VK_MVK_macos_surface 1 #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3 #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_metal.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_metal.h index 11b96409..94563a00 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_metal.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_metal.h @@ -2,7 +2,7 @@ #define VULKAN_METAL_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_EXT_metal_surface is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_metal_surface 1 #ifdef __OBJC__ @class CAMetalLayer; @@ -47,6 +48,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT( #endif +// VK_EXT_metal_objects is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_metal_objects 1 #ifdef __OBJC__ @protocol MTLDevice; diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_screen.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_screen.h index f0ef40a6..981738f7 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_screen.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_screen.h @@ -2,7 +2,7 @@ #define VULKAN_SCREEN_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_QNX_screen_surface is a preprocessor guard. Do not pass it to API calls. #define VK_QNX_screen_surface 1 #define VK_QNX_SCREEN_SURFACE_SPEC_VERSION 1 #define VK_QNX_SCREEN_SURFACE_EXTENSION_NAME "VK_QNX_screen_surface" @@ -47,6 +48,59 @@ VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceScreenPresentationSupportQNX( struct _screen_window* window); #endif + +// VK_QNX_external_memory_screen_buffer is a preprocessor guard. Do not pass it to API calls. +#define VK_QNX_external_memory_screen_buffer 1 +#define VK_QNX_EXTERNAL_MEMORY_SCREEN_BUFFER_SPEC_VERSION 1 +#define VK_QNX_EXTERNAL_MEMORY_SCREEN_BUFFER_EXTENSION_NAME "VK_QNX_external_memory_screen_buffer" +typedef struct VkScreenBufferPropertiesQNX { + VkStructureType sType; + void* pNext; + VkDeviceSize allocationSize; + uint32_t memoryTypeBits; +} VkScreenBufferPropertiesQNX; + +typedef struct VkScreenBufferFormatPropertiesQNX { + VkStructureType sType; + void* pNext; + VkFormat format; + uint64_t externalFormat; + uint64_t screenUsage; + VkFormatFeatureFlags formatFeatures; + VkComponentMapping samplerYcbcrConversionComponents; + VkSamplerYcbcrModelConversion suggestedYcbcrModel; + VkSamplerYcbcrRange suggestedYcbcrRange; + VkChromaLocation suggestedXChromaOffset; + VkChromaLocation suggestedYChromaOffset; +} VkScreenBufferFormatPropertiesQNX; + +typedef struct VkImportScreenBufferInfoQNX { + VkStructureType sType; + const void* pNext; + struct _screen_buffer* buffer; +} VkImportScreenBufferInfoQNX; + +typedef struct VkExternalFormatQNX { + VkStructureType sType; + void* pNext; + uint64_t externalFormat; +} VkExternalFormatQNX; + +typedef struct VkPhysicalDeviceExternalMemoryScreenBufferFeaturesQNX { + VkStructureType sType; + void* pNext; + VkBool32 screenBufferImport; +} VkPhysicalDeviceExternalMemoryScreenBufferFeaturesQNX; + +typedef VkResult (VKAPI_PTR *PFN_vkGetScreenBufferPropertiesQNX)(VkDevice device, const struct _screen_buffer* buffer, VkScreenBufferPropertiesQNX* pProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetScreenBufferPropertiesQNX( + VkDevice device, + const struct _screen_buffer* buffer, + VkScreenBufferPropertiesQNX* pProperties); +#endif + #ifdef __cplusplus } #endif diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_vi.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_vi.h index 0355e7a1..c9227e82 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_vi.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_vi.h @@ -2,7 +2,7 @@ #define VULKAN_VI_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_NN_vi_surface is a preprocessor guard. Do not pass it to API calls. #define VK_NN_vi_surface 1 #define VK_NN_VI_SURFACE_SPEC_VERSION 1 #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_wayland.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_wayland.h index 9afd0b76..c93b2178 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_wayland.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_wayland.h @@ -2,7 +2,7 @@ #define VULKAN_WAYLAND_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_KHR_wayland_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_wayland_surface 1 #define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 #define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_win32.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_win32.h index affe0c02..fae3b853 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_win32.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_win32.h @@ -2,7 +2,7 @@ #define VULKAN_WIN32_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_KHR_win32_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_win32_surface 1 #define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6 #define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface" @@ -47,6 +48,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR( #endif +// VK_KHR_external_memory_win32 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_memory_win32 1 #define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32" @@ -96,6 +98,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR( #endif +// VK_KHR_win32_keyed_mutex is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_win32_keyed_mutex 1 #define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1 #define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex" @@ -113,6 +116,7 @@ typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR { +// VK_KHR_external_semaphore_win32 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_semaphore_win32 1 #define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32" @@ -165,6 +169,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR( #endif +// VK_KHR_external_fence_win32 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_fence_win32 1 #define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32" @@ -208,6 +213,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR( #endif +// VK_NV_external_memory_win32 is a preprocessor guard. Do not pass it to API calls. #define VK_NV_external_memory_win32 1 #define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 #define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32" @@ -236,6 +242,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV( #endif +// VK_NV_win32_keyed_mutex is a preprocessor guard. Do not pass it to API calls. #define VK_NV_win32_keyed_mutex 1 #define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 2 #define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex" @@ -253,6 +260,7 @@ typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV { +// VK_EXT_full_screen_exclusive is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_full_screen_exclusive 1 #define VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION 4 #define VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME "VK_EXT_full_screen_exclusive" @@ -308,6 +316,25 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModes2EXT( VkDeviceGroupPresentModeFlagsKHR* pModes); #endif + +// VK_NV_acquire_winrt_display is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_acquire_winrt_display 1 +#define VK_NV_ACQUIRE_WINRT_DISPLAY_SPEC_VERSION 1 +#define VK_NV_ACQUIRE_WINRT_DISPLAY_EXTENSION_NAME "VK_NV_acquire_winrt_display" +typedef VkResult (VKAPI_PTR *PFN_vkAcquireWinrtDisplayNV)(VkPhysicalDevice physicalDevice, VkDisplayKHR display); +typedef VkResult (VKAPI_PTR *PFN_vkGetWinrtDisplayNV)(VkPhysicalDevice physicalDevice, uint32_t deviceRelativeId, VkDisplayKHR* pDisplay); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireWinrtDisplayNV( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetWinrtDisplayNV( + VkPhysicalDevice physicalDevice, + uint32_t deviceRelativeId, + VkDisplayKHR* pDisplay); +#endif + #ifdef __cplusplus } #endif diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_xcb.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_xcb.h index 68e61b88..de740552 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_xcb.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_xcb.h @@ -2,7 +2,7 @@ #define VULKAN_XCB_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_KHR_xcb_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_xcb_surface 1 #define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 #define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_xlib.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_xlib.h index ea5360ab..1aa632f2 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_xlib.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_xlib.h @@ -2,7 +2,7 @@ #define VULKAN_XLIB_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_KHR_xlib_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_xlib_surface 1 #define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 #define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" diff --git a/bgfx/3rdparty/khronos/vulkan-local/vulkan_xlib_xrandr.h b/bgfx/3rdparty/khronos/vulkan-local/vulkan_xlib_xrandr.h index 8fc35cfc..e164ffc9 100644 --- a/bgfx/3rdparty/khronos/vulkan-local/vulkan_xlib_xrandr.h +++ b/bgfx/3rdparty/khronos/vulkan-local/vulkan_xlib_xrandr.h @@ -2,7 +2,7 @@ #define VULKAN_XLIB_XRANDR_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2023 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_EXT_acquire_xlib_display is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_acquire_xlib_display 1 #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 #define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" diff --git a/bgfx/3rdparty/khronos/wgl/wgl.h b/bgfx/3rdparty/khronos/wgl/wgl.h new file mode 100644 index 00000000..60371ac2 --- /dev/null +++ b/bgfx/3rdparty/khronos/wgl/wgl.h @@ -0,0 +1,936 @@ +#ifndef __wgl_wgl_h_ +#define __wgl_wgl_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT +** +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** https://github.com/KhronosGroup/OpenGL-Registry +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +/* Generated on date 20220530 */ + +/* Generated C header for: + * API: wgl + * Versions considered: .* + * Versions emitted: .* + * Default extensions included: wgl + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef WGL_VERSION_1_0 +#define WGL_VERSION_1_0 1 +#define WGL_FONT_LINES 0 +#define WGL_FONT_POLYGONS 1 +#define WGL_SWAP_MAIN_PLANE 0x00000001 +#define WGL_SWAP_OVERLAY1 0x00000002 +#define WGL_SWAP_OVERLAY2 0x00000004 +#define WGL_SWAP_OVERLAY3 0x00000008 +#define WGL_SWAP_OVERLAY4 0x00000010 +#define WGL_SWAP_OVERLAY5 0x00000020 +#define WGL_SWAP_OVERLAY6 0x00000040 +#define WGL_SWAP_OVERLAY7 0x00000080 +#define WGL_SWAP_OVERLAY8 0x00000100 +#define WGL_SWAP_OVERLAY9 0x00000200 +#define WGL_SWAP_OVERLAY10 0x00000400 +#define WGL_SWAP_OVERLAY11 0x00000800 +#define WGL_SWAP_OVERLAY12 0x00001000 +#define WGL_SWAP_OVERLAY13 0x00002000 +#define WGL_SWAP_OVERLAY14 0x00004000 +#define WGL_SWAP_OVERLAY15 0x00008000 +#define WGL_SWAP_UNDERLAY1 0x00010000 +#define WGL_SWAP_UNDERLAY2 0x00020000 +#define WGL_SWAP_UNDERLAY3 0x00040000 +#define WGL_SWAP_UNDERLAY4 0x00080000 +#define WGL_SWAP_UNDERLAY5 0x00100000 +#define WGL_SWAP_UNDERLAY6 0x00200000 +#define WGL_SWAP_UNDERLAY7 0x00400000 +#define WGL_SWAP_UNDERLAY8 0x00800000 +#define WGL_SWAP_UNDERLAY9 0x01000000 +#define WGL_SWAP_UNDERLAY10 0x02000000 +#define WGL_SWAP_UNDERLAY11 0x04000000 +#define WGL_SWAP_UNDERLAY12 0x08000000 +#define WGL_SWAP_UNDERLAY13 0x10000000 +#define WGL_SWAP_UNDERLAY14 0x20000000 +#define WGL_SWAP_UNDERLAY15 0x40000000 +typedef int (WINAPI * PFNCHOOSEPIXELFORMATPROC) (HDC hDc, const PIXELFORMATDESCRIPTOR *pPfd); +typedef int (WINAPI * PFNDESCRIBEPIXELFORMATPROC) (HDC hdc, int ipfd, UINT cjpfd, const PIXELFORMATDESCRIPTOR *ppfd); +typedef UINT (WINAPI * PFNGETENHMETAFILEPIXELFORMATPROC) (HENHMETAFILE hemf, const PIXELFORMATDESCRIPTOR *ppfd); +typedef int (WINAPI * PFNGETPIXELFORMATPROC) (HDC hdc); +typedef BOOL (WINAPI * PFNSETPIXELFORMATPROC) (HDC hdc, int ipfd, const PIXELFORMATDESCRIPTOR *ppfd); +typedef BOOL (WINAPI * PFNSWAPBUFFERSPROC) (HDC hdc); +typedef BOOL (WINAPI * PFNWGLCOPYCONTEXTPROC) (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask); +typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTPROC) (HDC hDc); +typedef HGLRC (WINAPI * PFNWGLCREATELAYERCONTEXTPROC) (HDC hDc, int level); +typedef BOOL (WINAPI * PFNWGLDELETECONTEXTPROC) (HGLRC oldContext); +typedef BOOL (WINAPI * PFNWGLDESCRIBELAYERPLANEPROC) (HDC hDc, int pixelFormat, int layerPlane, UINT nBytes, const LAYERPLANEDESCRIPTOR *plpd); +typedef HGLRC (WINAPI * PFNWGLGETCURRENTCONTEXTPROC) (void); +typedef HDC (WINAPI * PFNWGLGETCURRENTDCPROC) (void); +typedef int (WINAPI * PFNWGLGETLAYERPALETTEENTRIESPROC) (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr); +typedef PROC (WINAPI * PFNWGLGETPROCADDRESSPROC) (LPCSTR lpszProc); +typedef BOOL (WINAPI * PFNWGLMAKECURRENTPROC) (HDC hDc, HGLRC newContext); +typedef BOOL (WINAPI * PFNWGLREALIZELAYERPALETTEPROC) (HDC hdc, int iLayerPlane, BOOL bRealize); +typedef int (WINAPI * PFNWGLSETLAYERPALETTEENTRIESPROC) (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr); +typedef BOOL (WINAPI * PFNWGLSHARELISTSPROC) (HGLRC hrcSrvShare, HGLRC hrcSrvSource); +typedef BOOL (WINAPI * PFNWGLSWAPLAYERBUFFERSPROC) (HDC hdc, UINT fuFlags); +typedef BOOL (WINAPI * PFNWGLUSEFONTBITMAPSPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase); +typedef BOOL (WINAPI * PFNWGLUSEFONTBITMAPSAPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase); +typedef BOOL (WINAPI * PFNWGLUSEFONTBITMAPSWPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase); +typedef BOOL (WINAPI * PFNWGLUSEFONTOUTLINESPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf); +typedef BOOL (WINAPI * PFNWGLUSEFONTOUTLINESAPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf); +typedef BOOL (WINAPI * PFNWGLUSEFONTOUTLINESWPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf); +#ifdef WGL_WGLEXT_PROTOTYPES +int WINAPI ChoosePixelFormat (HDC hDc, const PIXELFORMATDESCRIPTOR *pPfd); +int WINAPI DescribePixelFormat (HDC hdc, int ipfd, UINT cjpfd, const PIXELFORMATDESCRIPTOR *ppfd); +UINT WINAPI GetEnhMetaFilePixelFormat (HENHMETAFILE hemf, const PIXELFORMATDESCRIPTOR *ppfd); +int WINAPI GetPixelFormat (HDC hdc); +BOOL WINAPI SetPixelFormat (HDC hdc, int ipfd, const PIXELFORMATDESCRIPTOR *ppfd); +BOOL WINAPI SwapBuffers (HDC hdc); +BOOL WINAPI wglCopyContext (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask); +HGLRC WINAPI wglCreateContext (HDC hDc); +HGLRC WINAPI wglCreateLayerContext (HDC hDc, int level); +BOOL WINAPI wglDeleteContext (HGLRC oldContext); +BOOL WINAPI wglDescribeLayerPlane (HDC hDc, int pixelFormat, int layerPlane, UINT nBytes, const LAYERPLANEDESCRIPTOR *plpd); +HGLRC WINAPI wglGetCurrentContext (void); +HDC WINAPI wglGetCurrentDC (void); +int WINAPI wglGetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr); +PROC WINAPI wglGetProcAddress (LPCSTR lpszProc); +BOOL WINAPI wglMakeCurrent (HDC hDc, HGLRC newContext); +BOOL WINAPI wglRealizeLayerPalette (HDC hdc, int iLayerPlane, BOOL bRealize); +int WINAPI wglSetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr); +BOOL WINAPI wglShareLists (HGLRC hrcSrvShare, HGLRC hrcSrvSource); +BOOL WINAPI wglSwapLayerBuffers (HDC hdc, UINT fuFlags); +BOOL WINAPI wglUseFontBitmaps (HDC hDC, DWORD first, DWORD count, DWORD listBase); +BOOL WINAPI wglUseFontBitmapsA (HDC hDC, DWORD first, DWORD count, DWORD listBase); +BOOL WINAPI wglUseFontBitmapsW (HDC hDC, DWORD first, DWORD count, DWORD listBase); +BOOL WINAPI wglUseFontOutlines (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf); +BOOL WINAPI wglUseFontOutlinesA (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf); +BOOL WINAPI wglUseFontOutlinesW (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf); +#endif +#endif /* WGL_VERSION_1_0 */ + +#ifndef WGL_ARB_buffer_region +#define WGL_ARB_buffer_region 1 +#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 +#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 +#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 +typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); +typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); +typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#ifdef WGL_WGLEXT_PROTOTYPES +HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType); +VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion); +BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height); +BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#endif +#endif /* WGL_ARB_buffer_region */ + +#ifndef WGL_ARB_context_flush_control +#define WGL_ARB_context_flush_control 1 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#endif /* WGL_ARB_context_flush_control */ + +#ifndef WGL_ARB_create_context +#define WGL_ARB_create_context 1 +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define ERROR_INVALID_VERSION_ARB 0x2095 +typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); +#ifdef WGL_WGLEXT_PROTOTYPES +HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList); +#endif +#endif /* WGL_ARB_create_context */ + +#ifndef WGL_ARB_create_context_no_error +#define WGL_ARB_create_context_no_error 1 +#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 +#endif /* WGL_ARB_create_context_no_error */ + +#ifndef WGL_ARB_create_context_profile +#define WGL_ARB_create_context_profile 1 +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define ERROR_INVALID_PROFILE_ARB 0x2096 +#endif /* WGL_ARB_create_context_profile */ + +#ifndef WGL_ARB_create_context_robustness +#define WGL_ARB_create_context_robustness 1 +#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 +#endif /* WGL_ARB_create_context_robustness */ + +#ifndef WGL_ARB_extensions_string +#define WGL_ARB_extensions_string 1 +typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); +#ifdef WGL_WGLEXT_PROTOTYPES +const char *WINAPI wglGetExtensionsStringARB (HDC hdc); +#endif +#endif /* WGL_ARB_extensions_string */ + +#ifndef WGL_ARB_framebuffer_sRGB +#define WGL_ARB_framebuffer_sRGB 1 +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 +#endif /* WGL_ARB_framebuffer_sRGB */ + +#ifndef WGL_ARB_make_current_read +#define WGL_ARB_make_current_read 1 +#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 +#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +HDC WINAPI wglGetCurrentReadDCARB (void); +#endif +#endif /* WGL_ARB_make_current_read */ + +#ifndef WGL_ARB_multisample +#define WGL_ARB_multisample 1 +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 +#endif /* WGL_ARB_multisample */ + +#ifndef WGL_ARB_pbuffer +#define WGL_ARB_pbuffer 1 +DECLARE_HANDLE(HPBUFFERARB); +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 +typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#ifdef WGL_WGLEXT_PROTOTYPES +HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer); +int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC); +BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer); +BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#endif +#endif /* WGL_ARB_pbuffer */ + +#ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format 1 +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif +#endif /* WGL_ARB_pixel_format */ + +#ifndef WGL_ARB_pixel_format_float +#define WGL_ARB_pixel_format_float 1 +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 +#endif /* WGL_ARB_pixel_format_float */ + +#ifndef WGL_ARB_render_texture +#define WGL_ARB_render_texture 1 +#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 +#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 +#define WGL_TEXTURE_FORMAT_ARB 0x2072 +#define WGL_TEXTURE_TARGET_ARB 0x2073 +#define WGL_MIPMAP_TEXTURE_ARB 0x2074 +#define WGL_TEXTURE_RGB_ARB 0x2075 +#define WGL_TEXTURE_RGBA_ARB 0x2076 +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 +#define WGL_TEXTURE_1D_ARB 0x2079 +#define WGL_TEXTURE_2D_ARB 0x207A +#define WGL_MIPMAP_LEVEL_ARB 0x207B +#define WGL_CUBE_MAP_FACE_ARB 0x207C +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 +#define WGL_FRONT_LEFT_ARB 0x2083 +#define WGL_FRONT_RIGHT_ARB 0x2084 +#define WGL_BACK_LEFT_ARB 0x2085 +#define WGL_BACK_RIGHT_ARB 0x2086 +#define WGL_AUX0_ARB 0x2087 +#define WGL_AUX1_ARB 0x2088 +#define WGL_AUX2_ARB 0x2089 +#define WGL_AUX3_ARB 0x208A +#define WGL_AUX4_ARB 0x208B +#define WGL_AUX5_ARB 0x208C +#define WGL_AUX6_ARB 0x208D +#define WGL_AUX7_ARB 0x208E +#define WGL_AUX8_ARB 0x208F +#define WGL_AUX9_ARB 0x2090 +typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer); +BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer); +BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList); +#endif +#endif /* WGL_ARB_render_texture */ + +#ifndef WGL_ARB_robustness_application_isolation +#define WGL_ARB_robustness_application_isolation 1 +#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 +#endif /* WGL_ARB_robustness_application_isolation */ + +#ifndef WGL_ARB_robustness_share_group_isolation +#define WGL_ARB_robustness_share_group_isolation 1 +#endif /* WGL_ARB_robustness_share_group_isolation */ + +#ifndef WGL_3DFX_multisample +#define WGL_3DFX_multisample 1 +#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 +#define WGL_SAMPLES_3DFX 0x2061 +#endif /* WGL_3DFX_multisample */ + +#ifndef WGL_3DL_stereo_control +#define WGL_3DL_stereo_control 1 +#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 +#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 +#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 +#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 +typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState); +#endif +#endif /* WGL_3DL_stereo_control */ + +#ifndef WGL_AMD_gpu_association +#define WGL_AMD_gpu_association 1 +#define WGL_GPU_VENDOR_AMD 0x1F00 +#define WGL_GPU_RENDERER_STRING_AMD 0x1F01 +#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 +#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 +#define WGL_GPU_RAM_AMD 0x21A3 +#define WGL_GPU_CLOCK_AMD 0x21A4 +#define WGL_GPU_NUM_PIPES_AMD 0x21A5 +#define WGL_GPU_NUM_SIMD_AMD 0x21A6 +#define WGL_GPU_NUM_RB_AMD 0x21A7 +#define WGL_GPU_NUM_SPI_AMD 0x21A8 +typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids); +typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void *data); +typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); +typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); +typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList); +typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); +typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); +typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); +typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef WGL_WGLEXT_PROTOTYPES +UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids); +INT WINAPI wglGetGPUInfoAMD (UINT id, INT property, GLenum dataType, UINT size, void *data); +UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc); +HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id); +HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList); +BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc); +BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc); +HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void); +VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* WGL_AMD_gpu_association */ + +#ifndef WGL_ATI_pixel_format_float +#define WGL_ATI_pixel_format_float 1 +#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 +#endif /* WGL_ATI_pixel_format_float */ + +#ifndef WGL_ATI_render_texture_rectangle +#define WGL_ATI_render_texture_rectangle 1 +#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5 +#endif /* WGL_ATI_render_texture_rectangle */ + +#ifndef WGL_EXT_colorspace +#define WGL_EXT_colorspace 1 +#define WGL_COLORSPACE_EXT 0x309D +#define WGL_COLORSPACE_SRGB_EXT 0x3089 +#define WGL_COLORSPACE_LINEAR_EXT 0x308A +#endif /* WGL_EXT_colorspace */ + +#ifndef WGL_EXT_create_context_es2_profile +#define WGL_EXT_create_context_es2_profile 1 +#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 +#endif /* WGL_EXT_create_context_es2_profile */ + +#ifndef WGL_EXT_create_context_es_profile +#define WGL_EXT_create_context_es_profile 1 +#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 +#endif /* WGL_EXT_create_context_es_profile */ + +#ifndef WGL_EXT_depth_float +#define WGL_EXT_depth_float 1 +#define WGL_DEPTH_FLOAT_EXT 0x2040 +#endif /* WGL_EXT_depth_float */ + +#ifndef WGL_EXT_display_color_table +#define WGL_EXT_display_color_table 1 +typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length); +typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +#ifdef WGL_WGLEXT_PROTOTYPES +GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id); +GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length); +GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id); +VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id); +#endif +#endif /* WGL_EXT_display_color_table */ + +#ifndef WGL_EXT_extensions_string +#define WGL_EXT_extensions_string 1 +typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); +#ifdef WGL_WGLEXT_PROTOTYPES +const char *WINAPI wglGetExtensionsStringEXT (void); +#endif +#endif /* WGL_EXT_extensions_string */ + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_EXT_framebuffer_sRGB 1 +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 +#endif /* WGL_EXT_framebuffer_sRGB */ + +#ifndef WGL_EXT_make_current_read +#define WGL_EXT_make_current_read 1 +#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +HDC WINAPI wglGetCurrentReadDCEXT (void); +#endif +#endif /* WGL_EXT_make_current_read */ + +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 +#endif /* WGL_EXT_multisample */ + +#ifndef WGL_EXT_pbuffer +#define WGL_EXT_pbuffer 1 +DECLARE_HANDLE(HPBUFFEREXT); +#define WGL_DRAW_TO_PBUFFER_EXT 0x202D +#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E +#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 +#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 +#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 +#define WGL_PBUFFER_LARGEST_EXT 0x2033 +#define WGL_PBUFFER_WIDTH_EXT 0x2034 +#define WGL_PBUFFER_HEIGHT_EXT 0x2035 +typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#ifdef WGL_WGLEXT_PROTOTYPES +HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer); +int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC); +BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer); +BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#endif +#endif /* WGL_EXT_pbuffer */ + +#ifndef WGL_EXT_pixel_format +#define WGL_EXT_pixel_format 1 +#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 +#define WGL_DRAW_TO_WINDOW_EXT 0x2001 +#define WGL_DRAW_TO_BITMAP_EXT 0x2002 +#define WGL_ACCELERATION_EXT 0x2003 +#define WGL_NEED_PALETTE_EXT 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 +#define WGL_SWAP_METHOD_EXT 0x2007 +#define WGL_NUMBER_OVERLAYS_EXT 0x2008 +#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 +#define WGL_TRANSPARENT_EXT 0x200A +#define WGL_TRANSPARENT_VALUE_EXT 0x200B +#define WGL_SHARE_DEPTH_EXT 0x200C +#define WGL_SHARE_STENCIL_EXT 0x200D +#define WGL_SHARE_ACCUM_EXT 0x200E +#define WGL_SUPPORT_GDI_EXT 0x200F +#define WGL_SUPPORT_OPENGL_EXT 0x2010 +#define WGL_DOUBLE_BUFFER_EXT 0x2011 +#define WGL_STEREO_EXT 0x2012 +#define WGL_PIXEL_TYPE_EXT 0x2013 +#define WGL_COLOR_BITS_EXT 0x2014 +#define WGL_RED_BITS_EXT 0x2015 +#define WGL_RED_SHIFT_EXT 0x2016 +#define WGL_GREEN_BITS_EXT 0x2017 +#define WGL_GREEN_SHIFT_EXT 0x2018 +#define WGL_BLUE_BITS_EXT 0x2019 +#define WGL_BLUE_SHIFT_EXT 0x201A +#define WGL_ALPHA_BITS_EXT 0x201B +#define WGL_ALPHA_SHIFT_EXT 0x201C +#define WGL_ACCUM_BITS_EXT 0x201D +#define WGL_ACCUM_RED_BITS_EXT 0x201E +#define WGL_ACCUM_GREEN_BITS_EXT 0x201F +#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 +#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 +#define WGL_DEPTH_BITS_EXT 0x2022 +#define WGL_STENCIL_BITS_EXT 0x2023 +#define WGL_AUX_BUFFERS_EXT 0x2024 +#define WGL_NO_ACCELERATION_EXT 0x2025 +#define WGL_GENERIC_ACCELERATION_EXT 0x2026 +#define WGL_FULL_ACCELERATION_EXT 0x2027 +#define WGL_SWAP_EXCHANGE_EXT 0x2028 +#define WGL_SWAP_COPY_EXT 0x2029 +#define WGL_SWAP_UNDEFINED_EXT 0x202A +#define WGL_TYPE_RGBA_EXT 0x202B +#define WGL_TYPE_COLORINDEX_EXT 0x202C +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif +#endif /* WGL_EXT_pixel_format */ + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_EXT_pixel_format_packed_float 1 +#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 +#endif /* WGL_EXT_pixel_format_packed_float */ + +#ifndef WGL_EXT_swap_control +#define WGL_EXT_swap_control 1 +typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); +typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglSwapIntervalEXT (int interval); +int WINAPI wglGetSwapIntervalEXT (void); +#endif +#endif /* WGL_EXT_swap_control */ + +#ifndef WGL_EXT_swap_control_tear +#define WGL_EXT_swap_control_tear 1 +#endif /* WGL_EXT_swap_control_tear */ + +#ifndef WGL_I3D_digital_video_control +#define WGL_I3D_digital_video_control 1 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 +#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 +#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 +typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue); +BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue); +#endif +#endif /* WGL_I3D_digital_video_control */ + +#ifndef WGL_I3D_gamma +#define WGL_I3D_gamma 1 +#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E +#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue); +BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue); +BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#endif +#endif /* WGL_I3D_gamma */ + +#ifndef WGL_I3D_genlock +#define WGL_I3D_genlock 1 +#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 +#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045 +#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046 +#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047 +#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 +#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 +#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A +#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B +#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C +typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge); +typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglEnableGenlockI3D (HDC hDC); +BOOL WINAPI wglDisableGenlockI3D (HDC hDC); +BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag); +BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource); +BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource); +BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge); +BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge); +BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate); +BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate); +BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay); +BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay); +BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#endif +#endif /* WGL_I3D_genlock */ + +#ifndef WGL_I3D_image_buffer +#define WGL_I3D_image_buffer 1 +#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 +#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 +typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); +typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count); +#ifdef WGL_WGLEXT_PROTOTYPES +LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags); +BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress); +BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count); +#endif +#endif /* WGL_I3D_image_buffer */ + +#ifndef WGL_I3D_swap_frame_lock +#define WGL_I3D_swap_frame_lock 1 +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglEnableFrameLockI3D (void); +BOOL WINAPI wglDisableFrameLockI3D (void); +BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag); +BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag); +#endif +#endif /* WGL_I3D_swap_frame_lock */ + +#ifndef WGL_I3D_swap_frame_usage +#define WGL_I3D_swap_frame_usage 1 +typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage); +typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetFrameUsageI3D (float *pUsage); +BOOL WINAPI wglBeginFrameTrackingI3D (void); +BOOL WINAPI wglEndFrameTrackingI3D (void); +BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#endif +#endif /* WGL_I3D_swap_frame_usage */ + +#ifndef WGL_NV_DX_interop +#define WGL_NV_DX_interop 1 +#define WGL_ACCESS_READ_ONLY_NV 0x00000000 +#define WGL_ACCESS_READ_WRITE_NV 0x00000001 +#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002 +typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle); +typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice); +typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); +typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access); +typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject); +typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access); +typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects); +typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle); +HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice); +BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice); +HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access); +BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject); +BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access); +BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects); +BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects); +#endif +#endif /* WGL_NV_DX_interop */ + +#ifndef WGL_NV_DX_interop2 +#define WGL_NV_DX_interop2 1 +#endif /* WGL_NV_DX_interop2 */ + +#ifndef WGL_NV_copy_image +#define WGL_NV_copy_image 1 +typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* WGL_NV_copy_image */ + +#ifndef WGL_NV_delay_before_swap +#define WGL_NV_delay_before_swap 1 +typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds); +#endif +#endif /* WGL_NV_delay_before_swap */ + +#ifndef WGL_NV_float_buffer +#define WGL_NV_float_buffer 1 +#define WGL_FLOAT_COMPONENTS_NV 0x20B0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 +#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 +#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 +#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 +#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 +#endif /* WGL_NV_float_buffer */ + +#ifndef WGL_NV_gpu_affinity +#define WGL_NV_gpu_affinity 1 +DECLARE_HANDLE(HGPUNV); +struct _GPU_DEVICE { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD Flags; + RECT rcVirtualScreen; +}; +typedef struct _GPU_DEVICE *PGPU_DEVICE; +#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 +#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 +typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); +typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); +typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); +typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); +typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu); +BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); +HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList); +BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); +BOOL WINAPI wglDeleteDCNV (HDC hdc); +#endif +#endif /* WGL_NV_gpu_affinity */ + +#ifndef WGL_NV_multigpu_context +#define WGL_NV_multigpu_context 1 +#define WGL_CONTEXT_MULTIGPU_ATTRIB_NV 0x20AA +#define WGL_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV 0x20AB +#define WGL_CONTEXT_MULTIGPU_ATTRIB_AFR_NV 0x20AC +#define WGL_CONTEXT_MULTIGPU_ATTRIB_MULTICAST_NV 0x20AD +#define WGL_CONTEXT_MULTIGPU_ATTRIB_MULTI_DISPLAY_MULTICAST_NV 0x20AE +#endif /* WGL_NV_multigpu_context */ + +#ifndef WGL_NV_multisample_coverage +#define WGL_NV_multisample_coverage 1 +#define WGL_COVERAGE_SAMPLES_NV 0x2042 +#define WGL_COLOR_SAMPLES_NV 0x20B9 +#endif /* WGL_NV_multisample_coverage */ + +#ifndef WGL_NV_present_video +#define WGL_NV_present_video 1 +DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); +#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 +typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV *phDeviceList); +typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue); +#ifdef WGL_WGLEXT_PROTOTYPES +int WINAPI wglEnumerateVideoDevicesNV (HDC hDc, HVIDEOOUTPUTDEVICENV *phDeviceList); +BOOL WINAPI wglBindVideoDeviceNV (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue); +#endif +#endif /* WGL_NV_present_video */ + +#ifndef WGL_NV_render_depth_texture +#define WGL_NV_render_depth_texture 1 +#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 +#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 +#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 +#define WGL_DEPTH_COMPONENT_NV 0x20A7 +#endif /* WGL_NV_render_depth_texture */ + +#ifndef WGL_NV_render_texture_rectangle +#define WGL_NV_render_texture_rectangle 1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 +#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 +#endif /* WGL_NV_render_texture_rectangle */ + +#ifndef WGL_NV_swap_group +#define WGL_NV_swap_group 1 +typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); +typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); +typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier); +typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count); +typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group); +BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier); +BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier); +BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers); +BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count); +BOOL WINAPI wglResetFrameCountNV (HDC hDC); +#endif +#endif /* WGL_NV_swap_group */ + +#ifndef WGL_NV_vertex_array_range +#define WGL_NV_vertex_array_range 1 +typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); +#ifdef WGL_WGLEXT_PROTOTYPES +void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +void WINAPI wglFreeMemoryNV (void *pointer); +#endif +#endif /* WGL_NV_vertex_array_range */ + +#ifndef WGL_NV_video_capture +#define WGL_NV_video_capture 1 +DECLARE_HANDLE(HVIDEOINPUTDEVICENV); +#define WGL_UNIQUE_ID_NV 0x20CE +#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF +typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); +typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList); +typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); +UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList); +BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue); +BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +#endif +#endif /* WGL_NV_video_capture */ + +#ifndef WGL_NV_video_output +#define WGL_NV_video_output 1 +DECLARE_HANDLE(HPVIDEODEV); +#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 +#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 +#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 +#define WGL_VIDEO_OUT_COLOR_NV 0x20C3 +#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 +#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 +#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define WGL_VIDEO_OUT_FRAME 0x20C8 +#define WGL_VIDEO_OUT_FIELD_1 0x20C9 +#define WGL_VIDEO_OUT_FIELD_2 0x20CA +#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB +#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC +typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); +typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock); +typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice); +BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice); +BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); +BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer); +BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock); +BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#endif +#endif /* WGL_NV_video_output */ + +#ifndef WGL_OML_sync_control +#define WGL_OML_sync_control 1 +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); +typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#ifdef WGL_WGLEXT_PROTOTYPES +BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator); +INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#endif +#endif /* WGL_OML_sync_control */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bgfx/3rdparty/khronos/wgl/wglext.h b/bgfx/3rdparty/khronos/wgl/wglext.h index 783e53d8..cbb374e5 100644 --- a/bgfx/3rdparty/khronos/wgl/wglext.h +++ b/bgfx/3rdparty/khronos/wgl/wglext.h @@ -1,39 +1,18 @@ -#ifndef __wglext_h_ -#define __wglext_h_ 1 +#ifndef __wgl_wglext_h_ +#define __wgl_wglext_h_ 1 #ifdef __cplusplus extern "C" { #endif /* -** Copyright (c) 2013 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT ** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** 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. -*/ -/* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 23730 $ on $Date: 2013-10-28 15:16:34 -0700 (Mon, 28 Oct 2013) $ +** https://github.com/KhronosGroup/OpenGL-Registry */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) @@ -41,7 +20,7 @@ extern "C" { #include #endif -#define WGL_WGLEXT_VERSION 20131028 +#define WGL_WGLEXT_VERSION 20220530 /* Generated C header for: * API: wgl @@ -70,6 +49,13 @@ BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, #endif #endif /* WGL_ARB_buffer_region */ +#ifndef WGL_ARB_context_flush_control +#define WGL_ARB_context_flush_control 1 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#endif /* WGL_ARB_context_flush_control */ + #ifndef WGL_ARB_create_context #define WGL_ARB_create_context 1 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 @@ -85,6 +71,11 @@ HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int #endif #endif /* WGL_ARB_create_context */ +#ifndef WGL_ARB_create_context_no_error +#define WGL_ARB_create_context_no_error 1 +#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 +#endif /* WGL_ARB_create_context_no_error */ + #ifndef WGL_ARB_create_context_profile #define WGL_ARB_create_context_profile 1 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 @@ -308,7 +299,7 @@ BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState); #define WGL_GPU_NUM_RB_AMD 0x21A7 #define WGL_GPU_NUM_SPI_AMD 0x21A8 typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids); -typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data); +typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void *data); typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList); @@ -318,7 +309,7 @@ typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); #ifdef WGL_WGLEXT_PROTOTYPES UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids); -INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data); +INT WINAPI wglGetGPUInfoAMD (UINT id, INT property, GLenum dataType, UINT size, void *data); UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc); HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id); HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList); @@ -334,6 +325,18 @@ VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0 #define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 #endif /* WGL_ATI_pixel_format_float */ +#ifndef WGL_ATI_render_texture_rectangle +#define WGL_ATI_render_texture_rectangle 1 +#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5 +#endif /* WGL_ATI_render_texture_rectangle */ + +#ifndef WGL_EXT_colorspace +#define WGL_EXT_colorspace 1 +#define WGL_COLORSPACE_EXT 0x309D +#define WGL_COLORSPACE_SRGB_EXT 0x3089 +#define WGL_COLORSPACE_LINEAR_EXT 0x308A +#endif /* WGL_EXT_colorspace */ + #ifndef WGL_EXT_create_context_es2_profile #define WGL_EXT_create_context_es2_profile 1 #define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 @@ -693,6 +696,15 @@ BOOL WINAPI wglDeleteDCNV (HDC hdc); #endif #endif /* WGL_NV_gpu_affinity */ +#ifndef WGL_NV_multigpu_context +#define WGL_NV_multigpu_context 1 +#define WGL_CONTEXT_MULTIGPU_ATTRIB_NV 0x20AA +#define WGL_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV 0x20AB +#define WGL_CONTEXT_MULTIGPU_ATTRIB_AFR_NV 0x20AC +#define WGL_CONTEXT_MULTIGPU_ATTRIB_MULTICAST_NV 0x20AD +#define WGL_CONTEXT_MULTIGPU_ATTRIB_MULTI_DISPLAY_MULTICAST_NV 0x20AE +#endif /* WGL_NV_multigpu_context */ + #ifndef WGL_NV_multisample_coverage #define WGL_NV_multisample_coverage 1 #define WGL_COVERAGE_SAMPLES_NV 0x2042 @@ -703,12 +715,12 @@ BOOL WINAPI wglDeleteDCNV (HDC hdc); #define WGL_NV_present_video 1 DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); #define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 -typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList); -typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV *phDeviceList); +typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue); #ifdef WGL_WGLEXT_PROTOTYPES -int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList); -BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +int WINAPI wglEnumerateVideoDevicesNV (HDC hDc, HVIDEOOUTPUTDEVICENV *phDeviceList); +BOOL WINAPI wglBindVideoDeviceNV (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue); #endif #endif /* WGL_NV_present_video */ @@ -813,14 +825,14 @@ BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCount typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); -typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); #ifdef WGL_WGLEXT_PROTOTYPES BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator); INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); -INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); #endif diff --git a/bgfx/3rdparty/meshoptimizer/LICENSE.md b/bgfx/3rdparty/meshoptimizer/LICENSE.md index b673c248..962ed41f 100644 --- a/bgfx/3rdparty/meshoptimizer/LICENSE.md +++ b/bgfx/3rdparty/meshoptimizer/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2022 Arseny Kapoulkine +Copyright (c) 2016-2023 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/bgfx/3rdparty/meshoptimizer/src/clusterizer.cpp b/bgfx/3rdparty/meshoptimizer/src/clusterizer.cpp index b1f7b359..c4672ad6 100644 --- a/bgfx/3rdparty/meshoptimizer/src/clusterizer.cpp +++ b/bgfx/3rdparty/meshoptimizer/src/clusterizer.cpp @@ -283,6 +283,79 @@ static bool appendMeshlet(meshopt_Meshlet& meshlet, unsigned int a, unsigned int return result; } +static unsigned int getNeighborTriangle(const meshopt_Meshlet& meshlet, const Cone* meshlet_cone, unsigned int* meshlet_vertices, const unsigned int* indices, const TriangleAdjacency2& adjacency, const Cone* triangles, const unsigned int* live_triangles, const unsigned char* used, float meshlet_expected_radius, float cone_weight, unsigned int* out_extra) +{ + unsigned int best_triangle = ~0u; + unsigned int best_extra = 5; + float best_score = FLT_MAX; + + for (size_t i = 0; i < meshlet.vertex_count; ++i) + { + unsigned int index = meshlet_vertices[meshlet.vertex_offset + i]; + + unsigned int* neighbors = &adjacency.data[0] + adjacency.offsets[index]; + size_t neighbors_size = adjacency.counts[index]; + + for (size_t j = 0; j < neighbors_size; ++j) + { + unsigned int triangle = neighbors[j]; + unsigned int a = indices[triangle * 3 + 0], b = indices[triangle * 3 + 1], c = indices[triangle * 3 + 2]; + + unsigned int extra = (used[a] == 0xff) + (used[b] == 0xff) + (used[c] == 0xff); + + // triangles that don't add new vertices to meshlets are max. priority + if (extra != 0) + { + // artificially increase the priority of dangling triangles as they're expensive to add to new meshlets + if (live_triangles[a] == 1 || live_triangles[b] == 1 || live_triangles[c] == 1) + extra = 0; + + extra++; + } + + // since topology-based priority is always more important than the score, we can skip scoring in some cases + if (extra > best_extra) + continue; + + float score = 0; + + // caller selects one of two scoring functions: geometrical (based on meshlet cone) or topological (based on remaining triangles) + if (meshlet_cone) + { + const Cone& tri_cone = triangles[triangle]; + + float distance2 = + (tri_cone.px - meshlet_cone->px) * (tri_cone.px - meshlet_cone->px) + + (tri_cone.py - meshlet_cone->py) * (tri_cone.py - meshlet_cone->py) + + (tri_cone.pz - meshlet_cone->pz) * (tri_cone.pz - meshlet_cone->pz); + + float spread = tri_cone.nx * meshlet_cone->nx + tri_cone.ny * meshlet_cone->ny + tri_cone.nz * meshlet_cone->nz; + + score = getMeshletScore(distance2, spread, cone_weight, meshlet_expected_radius); + } + else + { + // each live_triangles entry is >= 1 since it includes the current triangle we're processing + score = float(live_triangles[a] + live_triangles[b] + live_triangles[c] - 3); + } + + // note that topology-based priority is always more important than the score + // this helps maintain reasonable effectiveness of meshlet data and reduces scoring cost + if (extra < best_extra || score < best_score) + { + best_triangle = triangle; + best_extra = extra; + best_score = score; + } + } + } + + if (out_extra) + *out_extra = best_extra; + + return best_triangle; +} + struct KDNode { union @@ -464,13 +537,15 @@ size_t meshopt_buildMeshlets(meshopt_Meshlet* meshlets, unsigned int* meshlet_ve using namespace meshopt; assert(index_count % 3 == 0); - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); assert(max_vertices >= 3 && max_vertices <= kMeshletMaxVertices); assert(max_triangles >= 1 && max_triangles <= kMeshletMaxTriangles); assert(max_triangles % 4 == 0); // ensures the caller will compute output space properly as index data is 4b aligned + assert(cone_weight >= 0 && cone_weight <= 1); + meshopt_Allocator allocator; TriangleAdjacency2 adjacency = {}; @@ -511,65 +586,18 @@ size_t meshopt_buildMeshlets(meshopt_Meshlet* meshlets, unsigned int* meshlet_ve for (;;) { - unsigned int best_triangle = ~0u; - unsigned int best_extra = 5; - float best_score = FLT_MAX; - Cone meshlet_cone = getMeshletCone(meshlet_cone_acc, meshlet.triangle_count); - for (size_t i = 0; i < meshlet.vertex_count; ++i) - { - unsigned int index = meshlet_vertices[meshlet.vertex_offset + i]; - - unsigned int* neighbours = &adjacency.data[0] + adjacency.offsets[index]; - size_t neighbours_size = adjacency.counts[index]; - - for (size_t j = 0; j < neighbours_size; ++j) - { - unsigned int triangle = neighbours[j]; - assert(!emitted_flags[triangle]); - - unsigned int a = indices[triangle * 3 + 0], b = indices[triangle * 3 + 1], c = indices[triangle * 3 + 2]; - assert(a < vertex_count && b < vertex_count && c < vertex_count); - - unsigned int extra = (used[a] == 0xff) + (used[b] == 0xff) + (used[c] == 0xff); - - // triangles that don't add new vertices to meshlets are max. priority - if (extra != 0) - { - // artificially increase the priority of dangling triangles as they're expensive to add to new meshlets - if (live_triangles[a] == 1 || live_triangles[b] == 1 || live_triangles[c] == 1) - extra = 0; - - extra++; - } - - // since topology-based priority is always more important than the score, we can skip scoring in some cases - if (extra > best_extra) - continue; - - const Cone& tri_cone = triangles[triangle]; - - float distance2 = - (tri_cone.px - meshlet_cone.px) * (tri_cone.px - meshlet_cone.px) + - (tri_cone.py - meshlet_cone.py) * (tri_cone.py - meshlet_cone.py) + - (tri_cone.pz - meshlet_cone.pz) * (tri_cone.pz - meshlet_cone.pz); - - float spread = tri_cone.nx * meshlet_cone.nx + tri_cone.ny * meshlet_cone.ny + tri_cone.nz * meshlet_cone.nz; + unsigned int best_extra = 0; + unsigned int best_triangle = getNeighborTriangle(meshlet, &meshlet_cone, meshlet_vertices, indices, adjacency, triangles, live_triangles, used, meshlet_expected_radius, cone_weight, &best_extra); - float score = getMeshletScore(distance2, spread, cone_weight, meshlet_expected_radius); - - // note that topology-based priority is always more important than the score - // this helps maintain reasonable effectiveness of meshlet data and reduces scoring cost - if (extra < best_extra || score < best_score) - { - best_triangle = triangle; - best_extra = extra; - best_score = score; - } - } + // if the best triangle doesn't fit into current meshlet, the spatial scoring we've used is not very meaningful, so we re-select using topological scoring + if (best_triangle != ~0u && (meshlet.vertex_count + best_extra > max_vertices || meshlet.triangle_count >= max_triangles)) + { + best_triangle = getNeighborTriangle(meshlet, NULL, meshlet_vertices, indices, adjacency, triangles, live_triangles, used, meshlet_expected_radius, 0.f, NULL); } + // when we run out of neighboring triangles we need to switch to spatial search; we currently just pick the closest triangle irrespective of connectivity if (best_triangle == ~0u) { float position[3] = {meshlet_cone.px, meshlet_cone.py, meshlet_cone.pz}; @@ -604,16 +632,16 @@ size_t meshopt_buildMeshlets(meshopt_Meshlet* meshlets, unsigned int* meshlet_ve { unsigned int index = indices[best_triangle * 3 + k]; - unsigned int* neighbours = &adjacency.data[0] + adjacency.offsets[index]; - size_t neighbours_size = adjacency.counts[index]; + unsigned int* neighbors = &adjacency.data[0] + adjacency.offsets[index]; + size_t neighbors_size = adjacency.counts[index]; - for (size_t i = 0; i < neighbours_size; ++i) + for (size_t i = 0; i < neighbors_size; ++i) { - unsigned int tri = neighbours[i]; + unsigned int tri = neighbors[i]; if (tri == best_triangle) { - neighbours[i] = neighbours[neighbours_size - 1]; + neighbors[i] = neighbors[neighbors_size - 1]; adjacency.counts[index]--; break; } @@ -687,7 +715,7 @@ meshopt_Bounds meshopt_computeClusterBounds(const unsigned int* indices, size_t assert(index_count % 3 == 0); assert(index_count / 3 <= kMeshletMaxTriangles); - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); (void)vertex_count; @@ -839,7 +867,7 @@ meshopt_Bounds meshopt_computeMeshletBounds(const unsigned int* meshlet_vertices using namespace meshopt; assert(triangle_count <= kMeshletMaxTriangles); - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); unsigned int indices[kMeshletMaxTriangles * 3]; diff --git a/bgfx/3rdparty/meshoptimizer/src/indexgenerator.cpp b/bgfx/3rdparty/meshoptimizer/src/indexgenerator.cpp index 9a25c218..a9d57fb2 100644 --- a/bgfx/3rdparty/meshoptimizer/src/indexgenerator.cpp +++ b/bgfx/3rdparty/meshoptimizer/src/indexgenerator.cpp @@ -178,6 +178,22 @@ static void buildPositionRemap(unsigned int* remap, const float* vertex_position remap[index] = *entry; } + + allocator.deallocate(vertex_table); +} + +template +static void remapVertices(void* destination, const void* vertices, size_t vertex_count, size_t vertex_size, const unsigned int* remap) +{ + size_t block_size = BlockSize == 0 ? vertex_size : BlockSize; + assert(block_size == vertex_size); + + for (size_t i = 0; i < vertex_count; ++i) + if (remap[i] != ~0u) + { + assert(remap[i] < vertex_count); + memcpy(static_cast(destination) + remap[i] * block_size, static_cast(vertices) + i * block_size, block_size); + } } } // namespace meshopt @@ -288,6 +304,8 @@ size_t meshopt_generateVertexRemapMulti(unsigned int* destination, const unsigne void meshopt_remapVertexBuffer(void* destination, const void* vertices, size_t vertex_count, size_t vertex_size, const unsigned int* remap) { + using namespace meshopt; + assert(vertex_size > 0 && vertex_size <= 256); meshopt_Allocator allocator; @@ -300,14 +318,23 @@ void meshopt_remapVertexBuffer(void* destination, const void* vertices, size_t v vertices = vertices_copy; } - for (size_t i = 0; i < vertex_count; ++i) + // specialize the loop for common vertex sizes to ensure memcpy is compiled as an inlined intrinsic + switch (vertex_size) { - if (remap[i] != ~0u) - { - assert(remap[i] < vertex_count); + case 4: + return remapVertices<4>(destination, vertices, vertex_count, vertex_size, remap); - memcpy(static_cast(destination) + remap[i] * vertex_size, static_cast(vertices) + i * vertex_size, vertex_size); - } + case 8: + return remapVertices<8>(destination, vertices, vertex_count, vertex_size, remap); + + case 12: + return remapVertices<12>(destination, vertices, vertex_count, vertex_size, remap); + + case 16: + return remapVertices<16>(destination, vertices, vertex_count, vertex_size, remap); + + default: + return remapVertices<0>(destination, vertices, vertex_count, vertex_size, remap); } } @@ -412,7 +439,7 @@ void meshopt_generateAdjacencyIndexBuffer(unsigned int* destination, const unsig using namespace meshopt; assert(index_count % 3 == 0); - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); meshopt_Allocator allocator; @@ -483,7 +510,7 @@ void meshopt_generateTessellationIndexBuffer(unsigned int* destination, const un using namespace meshopt; assert(index_count % 3 == 0); - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); meshopt_Allocator allocator; diff --git a/bgfx/3rdparty/meshoptimizer/src/meshoptimizer.h b/bgfx/3rdparty/meshoptimizer/src/meshoptimizer.h index f94dbaf9..b763148a 100644 --- a/bgfx/3rdparty/meshoptimizer/src/meshoptimizer.h +++ b/bgfx/3rdparty/meshoptimizer/src/meshoptimizer.h @@ -1,7 +1,7 @@ /** - * meshoptimizer - version 0.18 + * meshoptimizer - version 0.19 * - * Copyright (C) 2016-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2016-2023, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://github.com/zeux/meshoptimizer * * This library is distributed under the MIT License. See notice at the end of this file. @@ -12,7 +12,7 @@ #include /* Version macro; major * 1000 + minor * 10 + patch */ -#define MESHOPTIMIZER_VERSION 180 /* 0.18 */ +#define MESHOPTIMIZER_VERSION 190 /* 0.19 */ /* If no API is defined, assume default */ #ifndef MESHOPTIMIZER_API @@ -37,8 +37,8 @@ extern "C" { #endif /** - * Vertex attribute stream, similar to glVertexPointer - * Each element takes size bytes, with stride controlling the spacing between successive elements. + * Vertex attribute stream + * Each element takes size bytes, beginning at data, with stride controlling the spacing between successive elements (stride >= size). */ struct meshopt_Stream { @@ -115,7 +115,7 @@ MESHOPTIMIZER_API void meshopt_generateShadowIndexBufferMulti(unsigned int* dest * This can be used to implement algorithms like silhouette detection/expansion and other forms of GS-driven rendering. * * destination must contain enough space for the resulting index buffer (index_count*2 elements) - * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer + * vertex_positions should have float3 position in the first 12 bytes of each vertex */ MESHOPTIMIZER_API void meshopt_generateAdjacencyIndexBuffer(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride); @@ -131,7 +131,7 @@ MESHOPTIMIZER_API void meshopt_generateAdjacencyIndexBuffer(unsigned int* destin * See "Tessellation on Any Budget" (John McDonald, GDC 2011) for implementation details. * * destination must contain enough space for the resulting index buffer (index_count*4 elements) - * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer + * vertex_positions should have float3 position in the first 12 bytes of each vertex */ MESHOPTIMIZER_API void meshopt_generateTessellationIndexBuffer(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride); @@ -171,7 +171,7 @@ MESHOPTIMIZER_API void meshopt_optimizeVertexCacheFifo(unsigned int* destination * * destination must contain enough space for the resulting index buffer (index_count elements) * indices must contain index data that is the result of meshopt_optimizeVertexCache (*not* the original mesh indices!) - * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer + * vertex_positions should have float3 position in the first 12 bytes of each vertex * threshold indicates how much the overdraw optimizer can degrade vertex cache efficiency (1.05 = up to 5%) to reduce overdraw more efficiently */ MESHOPTIMIZER_API void meshopt_optimizeOverdraw(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, float threshold); @@ -304,13 +304,22 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_decodeFilterExp(void* buffer, size_t cou * Input data must contain 4 floats for every quaternion (count*4 total). * * meshopt_encodeFilterExp encodes arbitrary (finite) floating-point data with 8-bit exponent and K-bit integer mantissa (1 <= K <= 24). - * Mantissa is shared between all components of a given vector as defined by stride; stride must be divisible by 4. + * Exponent can be shared between all components of a given vector as defined by stride or all values of a given component; stride must be divisible by 4. * Input data must contain stride/4 floats for every vector (count*stride/4 total). - * When individual (scalar) encoding is desired, simply pass stride=4 and adjust count accordingly. */ +enum meshopt_EncodeExpMode +{ + /* When encoding exponents, use separate values for each component (maximum quality) */ + meshopt_EncodeExpSeparate, + /* When encoding exponents, use shared value for all components of each vector (better compression) */ + meshopt_EncodeExpSharedVector, + /* When encoding exponents, use shared value for each component of all vectors (best compression) */ + meshopt_EncodeExpSharedComponent, +}; + MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeFilterOct(void* destination, size_t count, size_t stride, int bits, const float* data); MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeFilterQuat(void* destination, size_t count, size_t stride, int bits, const float* data); -MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeFilterExp(void* destination, size_t count, size_t stride, int bits, const float* data); +MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeFilterExp(void* destination, size_t count, size_t stride, int bits, const float* data, enum meshopt_EncodeExpMode mode); /** * Simplification options @@ -331,13 +340,24 @@ enum * If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended. * * destination must contain enough space for the target index buffer, worst case is index_count elements (*not* target_index_count)! - * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer - * target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation + * vertex_positions should have float3 position in the first 12 bytes of each vertex + * target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation; value range [0..1] * options must be a bitmask composed of meshopt_SimplifyX options; 0 is a safe default * result_error can be NULL; when it's not NULL, it will contain the resulting (relative) error after simplification */ MESHOPTIMIZER_API size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, unsigned int options, float* result_error); +/** + * Experimental: Mesh simplifier with attribute metric + * The algorithm ehnahces meshopt_simplify by incorporating attribute values into the error metric used to prioritize simplification order; see meshopt_simplify documentation for details. + * Note that the number of attributes affects memory requirements and running time; this algorithm requires ~1.5x more memory and time compared to meshopt_simplify when using 4 scalar attributes. + * + * vertex_attributes should have attribute_count floats for each vertex + * attribute_weights should have attribute_count floats in total; the weights determine relative priority of attributes between each other and wrt position. The recommended weight range is [1e-3..1e-1], assuming attribute data is in [0..1] range. + * TODO target_error/result_error currently use combined distance+attribute error; this may change in the future + */ +MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, const float* vertex_attributes, size_t vertex_attributes_stride, const float* attribute_weights, size_t attribute_count, size_t target_index_count, float target_error, unsigned int options, float* result_error); + /** * Experimental: Mesh simplifier (sloppy) * Reduces the number of triangles in the mesh, sacrificing mesh appearance for simplification performance @@ -347,8 +367,8 @@ MESHOPTIMIZER_API size_t meshopt_simplify(unsigned int* destination, const unsig * If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended. * * destination must contain enough space for the target index buffer, worst case is index_count elements (*not* target_index_count)! - * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer - * target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation + * vertex_positions should have float3 position in the first 12 bytes of each vertex + * target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation; value range [0..1] * result_error can be NULL; when it's not NULL, it will contain the resulting (relative) error after simplification */ MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifySloppy(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* result_error); @@ -361,7 +381,7 @@ MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifySloppy(unsigned int* destinati * If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended. * * destination must contain enough space for the target index buffer (target_vertex_count elements) - * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer + * vertex_positions should have float3 position in the first 12 bytes of each vertex */ MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyPoints(unsigned int* destination, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_vertex_count); @@ -423,7 +443,7 @@ struct meshopt_OverdrawStatistics * Returns overdraw statistics using a software rasterizer * Results may not match actual GPU performance * - * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer + * vertex_positions should have float3 position in the first 12 bytes of each vertex */ MESHOPTIMIZER_API struct meshopt_OverdrawStatistics meshopt_analyzeOverdraw(const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride); @@ -461,7 +481,7 @@ struct meshopt_Meshlet * meshlets must contain enough space for all meshlets, worst case size can be computed with meshopt_buildMeshletsBound * meshlet_vertices must contain enough space for all meshlets, worst case size is equal to max_meshlets * max_vertices * meshlet_triangles must contain enough space for all meshlets, worst case size is equal to max_meshlets * max_triangles * 3 - * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer + * vertex_positions should have float3 position in the first 12 bytes of each vertex * max_vertices and max_triangles must not exceed implementation limits (max_vertices <= 255 - not 256!, max_triangles <= 512) * cone_weight should be set to 0 when cone culling is not used, and a value between 0 and 1 otherwise to balance between cluster size and cone culling efficiency */ @@ -492,7 +512,7 @@ struct meshopt_Bounds * For backface culling with orthographic projection, use the following formula to reject backfacing clusters: * dot(view, cone_axis) >= cone_cutoff * - * For perspective projection, you can the formula that needs cone apex in addition to axis & cutoff: + * For perspective projection, you can use the formula that needs cone apex in addition to axis & cutoff: * dot(normalize(cone_apex - camera_position), cone_axis) >= cone_cutoff * * Alternatively, you can use the formula that doesn't need cone apex and uses bounding sphere instead: @@ -501,9 +521,10 @@ struct meshopt_Bounds * dot(center - camera_position, cone_axis) >= cone_cutoff * length(center - camera_position) + radius * * The formula that uses the apex is slightly more accurate but needs the apex; if you are already using bounding sphere - * to do frustum/occlusion culling, the formula that doesn't use the apex may be preferable. + * to do frustum/occlusion culling, the formula that doesn't use the apex may be preferable (for derivation see + * Real-Time Rendering 4th Edition, section 19.3). * - * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer + * vertex_positions should have float3 position in the first 12 bytes of each vertex * index_count/3 should be less than or equal to 512 (the function assumes clusters of limited size) */ MESHOPTIMIZER_API struct meshopt_Bounds meshopt_computeClusterBounds(const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride); @@ -523,7 +544,7 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_spatialSortRemap(unsigned int* destinati * Reorders triangles for spatial locality, and generates a new index buffer. The resulting index buffer can be used with other functions like optimizeVertexCache. * * destination must contain enough space for the resulting index buffer (index_count elements) - * vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer + * vertex_positions should have float3 position in the first 12 bytes of each vertex */ MESHOPTIMIZER_EXPERIMENTAL void meshopt_spatialSortTriangles(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride); @@ -556,19 +577,25 @@ inline int meshopt_quantizeUnorm(float v, int N); inline int meshopt_quantizeSnorm(float v, int N); /** - * Quantize a float into half-precision floating point value + * Quantize a float into half-precision (as defined by IEEE-754 fp16) floating point value * Generates +-inf for overflow, preserves NaN, flushes denormals to zero, rounds to nearest * Representable magnitude range: [6e-5; 65504] * Maximum relative reconstruction error: 5e-4 */ -inline unsigned short meshopt_quantizeHalf(float v); +MESHOPTIMIZER_API unsigned short meshopt_quantizeHalf(float v); /** - * Quantize a float into a floating point value with a limited number of significant mantissa bits + * Quantize a float into a floating point value with a limited number of significant mantissa bits, preserving the IEEE-754 fp32 binary representation * Generates +-inf for overflow, preserves NaN, flushes denormals to zero, rounds to nearest * Assumes N is in a valid mantissa precision range, which is 1..23 */ -inline float meshopt_quantizeFloat(float v, int N); +MESHOPTIMIZER_API float meshopt_quantizeFloat(float v, int N); + +/** + * Reverse quantization of a half-precision (as defined by IEEE-754 fp16) floating point value + * Preserves Inf/NaN, flushes denormals to zero + */ +MESHOPTIMIZER_API float meshopt_dequantizeHalf(unsigned short h); #endif /** @@ -617,6 +644,8 @@ inline int meshopt_decodeIndexSequence(T* destination, size_t index_count, const template inline size_t meshopt_simplify(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, unsigned int options = 0, float* result_error = 0); template +inline size_t meshopt_simplifyWithAttributes(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, const float* vertex_attributes, size_t vertex_attributes_stride, const float* attribute_weights, size_t attribute_count, size_t target_index_count, float target_error, unsigned int options = 0, float* result_error = 0); +template inline size_t meshopt_simplifySloppy(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* result_error = 0); template inline size_t meshopt_stripify(T* destination, const T* indices, size_t index_count, size_t vertex_count, T restart_index); @@ -661,50 +690,6 @@ inline int meshopt_quantizeSnorm(float v, int N) return int(v * scale + round); } - -inline unsigned short meshopt_quantizeHalf(float v) -{ - union { float f; unsigned int ui; } u = {v}; - unsigned int ui = u.ui; - - int s = (ui >> 16) & 0x8000; - int em = ui & 0x7fffffff; - - /* bias exponent and round to nearest; 112 is relative exponent bias (127-15) */ - int h = (em - (112 << 23) + (1 << 12)) >> 13; - - /* underflow: flush to zero; 113 encodes exponent -14 */ - h = (em < (113 << 23)) ? 0 : h; - - /* overflow: infinity; 143 encodes exponent 16 */ - h = (em >= (143 << 23)) ? 0x7c00 : h; - - /* NaN; note that we convert all types of NaN to qNaN */ - h = (em > (255 << 23)) ? 0x7e00 : h; - - return (unsigned short)(s | h); -} - -inline float meshopt_quantizeFloat(float v, int N) -{ - union { float f; unsigned int ui; } u = {v}; - unsigned int ui = u.ui; - - const int mask = (1 << (23 - N)) - 1; - const int round = (1 << (23 - N)) >> 1; - - int e = ui & 0x7f800000; - unsigned int rui = (ui + round) & ~mask; - - /* round all numbers except inf/nan; this is important to make sure nan doesn't overflow into -0 */ - ui = e == 0x7f800000 ? ui : rui; - - /* flush denormals to zero */ - ui = e == 0 ? 0 : ui; - - u.ui = ui; - return u.f; -} #endif /* Internal implementation helpers */ @@ -741,6 +726,13 @@ class meshopt_Allocator return result; } + void deallocate(void* ptr) + { + assert(count > 0 && blocks[count - 1] == ptr); + Storage::deallocate(ptr); + count--; + } + private: void* blocks[24]; size_t count; @@ -958,6 +950,15 @@ inline size_t meshopt_simplify(T* destination, const T* indices, size_t index_co return meshopt_simplify(out.data, in.data, index_count, vertex_positions, vertex_count, vertex_positions_stride, target_index_count, target_error, options, result_error); } +template +inline size_t meshopt_simplifyWithAttributes(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, const float* vertex_attributes, size_t vertex_attributes_stride, const float* attribute_weights, size_t attribute_count, size_t target_index_count, float target_error, unsigned int options, float* result_error) +{ + meshopt_IndexAdapter in(0, indices, index_count); + meshopt_IndexAdapter out(destination, 0, index_count); + + return meshopt_simplifyWithAttributes(out.data, in.data, index_count, vertex_positions, vertex_count, vertex_positions_stride, vertex_attributes, vertex_attributes_stride, attribute_weights, attribute_count, target_index_count, target_error, options, result_error); +} + template inline size_t meshopt_simplifySloppy(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* result_error) { @@ -1044,7 +1045,7 @@ inline void meshopt_spatialSortTriangles(T* destination, const T* indices, size_ #endif /** - * Copyright (c) 2016-2022 Arseny Kapoulkine + * Copyright (c) 2016-2023 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/bgfx/3rdparty/meshoptimizer/src/overdrawanalyzer.cpp b/bgfx/3rdparty/meshoptimizer/src/overdrawanalyzer.cpp index 8d5859ba..8b6f2541 100644 --- a/bgfx/3rdparty/meshoptimizer/src/overdrawanalyzer.cpp +++ b/bgfx/3rdparty/meshoptimizer/src/overdrawanalyzer.cpp @@ -147,7 +147,7 @@ meshopt_OverdrawStatistics meshopt_analyzeOverdraw(const unsigned int* indices, using namespace meshopt; assert(index_count % 3 == 0); - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); meshopt_Allocator allocator; diff --git a/bgfx/3rdparty/meshoptimizer/src/overdrawoptimizer.cpp b/bgfx/3rdparty/meshoptimizer/src/overdrawoptimizer.cpp index 143656ed..cc22dbcf 100644 --- a/bgfx/3rdparty/meshoptimizer/src/overdrawoptimizer.cpp +++ b/bgfx/3rdparty/meshoptimizer/src/overdrawoptimizer.cpp @@ -272,7 +272,7 @@ void meshopt_optimizeOverdraw(unsigned int* destination, const unsigned int* ind using namespace meshopt; assert(index_count % 3 == 0); - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); meshopt_Allocator allocator; diff --git a/bgfx/3rdparty/meshoptimizer/src/quantization.cpp b/bgfx/3rdparty/meshoptimizer/src/quantization.cpp new file mode 100644 index 00000000..09a314d6 --- /dev/null +++ b/bgfx/3rdparty/meshoptimizer/src/quantization.cpp @@ -0,0 +1,70 @@ +// This file is part of meshoptimizer library; see meshoptimizer.h for version/license details +#include "meshoptimizer.h" + +#include + +unsigned short meshopt_quantizeHalf(float v) +{ + union { float f; unsigned int ui; } u = {v}; + unsigned int ui = u.ui; + + int s = (ui >> 16) & 0x8000; + int em = ui & 0x7fffffff; + + // bias exponent and round to nearest; 112 is relative exponent bias (127-15) + int h = (em - (112 << 23) + (1 << 12)) >> 13; + + // underflow: flush to zero; 113 encodes exponent -14 + h = (em < (113 << 23)) ? 0 : h; + + // overflow: infinity; 143 encodes exponent 16 + h = (em >= (143 << 23)) ? 0x7c00 : h; + + // NaN; note that we convert all types of NaN to qNaN + h = (em > (255 << 23)) ? 0x7e00 : h; + + return (unsigned short)(s | h); +} + +float meshopt_quantizeFloat(float v, int N) +{ + assert(N >= 0 && N <= 23); + + union { float f; unsigned int ui; } u = {v}; + unsigned int ui = u.ui; + + const int mask = (1 << (23 - N)) - 1; + const int round = (1 << (23 - N)) >> 1; + + int e = ui & 0x7f800000; + unsigned int rui = (ui + round) & ~mask; + + // round all numbers except inf/nan; this is important to make sure nan doesn't overflow into -0 + ui = e == 0x7f800000 ? ui : rui; + + // flush denormals to zero + ui = e == 0 ? 0 : ui; + + u.ui = ui; + return u.f; +} + +float meshopt_dequantizeHalf(unsigned short h) +{ + unsigned int s = unsigned(h & 0x8000) << 16; + int em = h & 0x7fff; + + // bias exponent and pad mantissa with 0; 112 is relative exponent bias (127-15) + int r = (em + (112 << 10)) << 13; + + // denormal: flush to zero + r = (em < (1 << 10)) ? 0 : r; + + // infinity/NaN; note that we preserve NaN payload as a byproduct of unifying inf/nan cases + // 112 is an exponent bias fixup; since we already applied it once, applying it twice converts 31 to 255 + r += (em >= (31 << 10)) ? (112 << 23) : 0; + + union { float f; unsigned int ui; } u; + u.ui = s | r; + return u.f; +} diff --git a/bgfx/3rdparty/meshoptimizer/src/simplifier.cpp b/bgfx/3rdparty/meshoptimizer/src/simplifier.cpp index 72704c1d..0cd9d063 100644 --- a/bgfx/3rdparty/meshoptimizer/src/simplifier.cpp +++ b/bgfx/3rdparty/meshoptimizer/src/simplifier.cpp @@ -26,6 +26,7 @@ // Peter Lindstrom. Out-of-Core Simplification of Large Polygonal Models. 2000 // Matthias Teschner, Bruno Heidelberger, Matthias Mueller, Danat Pomeranets, Markus Gross. Optimized Spatial Hashing for Collision Detection of Deformable Objects. 2003 // Peter Van Sandt, Yannis Chronis, Jignesh M. Patel. Efficiently Searching In-Memory Sorted Arrays: Revenge of the Interpolation Search? 2019 +// Hugues Hoppe. New Quadric Metric for Simplifying Meshes with Appearance Attributes. 1999 namespace meshopt { @@ -37,31 +38,31 @@ struct EdgeAdjacency unsigned int prev; }; - unsigned int* counts; unsigned int* offsets; Edge* data; }; static void prepareEdgeAdjacency(EdgeAdjacency& adjacency, size_t index_count, size_t vertex_count, meshopt_Allocator& allocator) { - adjacency.counts = allocator.allocate(vertex_count); - adjacency.offsets = allocator.allocate(vertex_count); + adjacency.offsets = allocator.allocate(vertex_count + 1); adjacency.data = allocator.allocate(index_count); } static void updateEdgeAdjacency(EdgeAdjacency& adjacency, const unsigned int* indices, size_t index_count, size_t vertex_count, const unsigned int* remap) { size_t face_count = index_count / 3; + unsigned int* offsets = adjacency.offsets + 1; + EdgeAdjacency::Edge* data = adjacency.data; // fill edge counts - memset(adjacency.counts, 0, vertex_count * sizeof(unsigned int)); + memset(offsets, 0, vertex_count * sizeof(unsigned int)); for (size_t i = 0; i < index_count; ++i) { unsigned int v = remap ? remap[indices[i]] : indices[i]; assert(v < vertex_count); - adjacency.counts[v]++; + offsets[v]++; } // fill offset table @@ -69,8 +70,9 @@ static void updateEdgeAdjacency(EdgeAdjacency& adjacency, const unsigned int* in for (size_t i = 0; i < vertex_count; ++i) { - adjacency.offsets[i] = offset; - offset += adjacency.counts[i]; + unsigned int count = offsets[i]; + offsets[i] = offset; + offset += count; } assert(offset == index_count); @@ -87,26 +89,22 @@ static void updateEdgeAdjacency(EdgeAdjacency& adjacency, const unsigned int* in c = remap[c]; } - adjacency.data[adjacency.offsets[a]].next = b; - adjacency.data[adjacency.offsets[a]].prev = c; - adjacency.offsets[a]++; + data[offsets[a]].next = b; + data[offsets[a]].prev = c; + offsets[a]++; - adjacency.data[adjacency.offsets[b]].next = c; - adjacency.data[adjacency.offsets[b]].prev = a; - adjacency.offsets[b]++; + data[offsets[b]].next = c; + data[offsets[b]].prev = a; + offsets[b]++; - adjacency.data[adjacency.offsets[c]].next = a; - adjacency.data[adjacency.offsets[c]].prev = b; - adjacency.offsets[c]++; + data[offsets[c]].next = a; + data[offsets[c]].prev = b; + offsets[c]++; } - // fix offsets that have been disturbed by the previous pass - for (size_t i = 0; i < vertex_count; ++i) - { - assert(adjacency.offsets[i] >= adjacency.counts[i]); - - adjacency.offsets[i] -= adjacency.counts[i]; - } + // finalize offsets + adjacency.offsets[0] = 0; + assert(adjacency.offsets[vertex_count] == index_count); } struct PositionHasher @@ -203,6 +201,8 @@ static void buildPositionRemap(unsigned int* remap, unsigned int* wedge, const f wedge[i] = wedge[r]; wedge[r] = unsigned(i); } + + allocator.deallocate(table); } enum VertexKind @@ -242,7 +242,7 @@ const unsigned char kHasOpposite[Kind_Count][Kind_Count] = { static bool hasEdge(const EdgeAdjacency& adjacency, unsigned int a, unsigned int b) { - unsigned int count = adjacency.counts[a]; + unsigned int count = adjacency.offsets[a + 1] - adjacency.offsets[a]; const EdgeAdjacency::Edge* edges = adjacency.data + adjacency.offsets[a]; for (size_t i = 0; i < count; ++i) @@ -267,7 +267,7 @@ static void classifyVertices(unsigned char* result, unsigned int* loop, unsigned { unsigned int vertex = unsigned(i); - unsigned int count = adjacency.counts[vertex]; + unsigned int count = adjacency.offsets[vertex + 1] - adjacency.offsets[vertex]; const EdgeAdjacency::Edge* edges = adjacency.data + adjacency.offsets[vertex]; for (size_t j = 0; j < count; ++j) @@ -426,6 +426,23 @@ static float rescalePositions(Vector3* result, const float* vertex_positions_dat return extent; } +static void rescaleAttributes(float* result, const float* vertex_attributes_data, size_t vertex_count, size_t vertex_attributes_stride, const float* attribute_weights, size_t attribute_count) +{ + size_t vertex_attributes_stride_float = vertex_attributes_stride / sizeof(float); + + for (size_t i = 0; i < vertex_count; ++i) + { + for (size_t k = 0; k < attribute_count; ++k) + { + float a = vertex_attributes_data[i * vertex_attributes_stride_float + k]; + + result[i * attribute_count + k] = a * attribute_weights[k]; + } + } +} + +static const size_t kMaxAttributes = 16; + struct Quadric { float a00, a11, a22; @@ -434,6 +451,11 @@ struct Quadric float w; }; +struct QuadricGrad +{ + float gx, gy, gz, gw; +}; + struct Collapse { unsigned int v0; @@ -476,6 +498,17 @@ static void quadricAdd(Quadric& Q, const Quadric& R) Q.w += R.w; } +static void quadricAdd(QuadricGrad* G, const QuadricGrad* R, size_t attribute_count) +{ + for (size_t k = 0; k < attribute_count; ++k) + { + G[k].gx += R[k].gx; + G[k].gy += R[k].gy; + G[k].gz += R[k].gz; + G[k].gw += R[k].gw; + } +} + static float quadricError(const Quadric& Q, const Vector3& v) { float rx = Q.b0; @@ -504,6 +537,45 @@ static float quadricError(const Quadric& Q, const Vector3& v) return fabsf(r) * s; } +static float quadricError(const Quadric& Q, const QuadricGrad* G, size_t attribute_count, const Vector3& v, const float* va) +{ + float rx = Q.b0; + float ry = Q.b1; + float rz = Q.b2; + + rx += Q.a10 * v.y; + ry += Q.a21 * v.z; + rz += Q.a20 * v.x; + + rx *= 2; + ry *= 2; + rz *= 2; + + rx += Q.a00 * v.x; + ry += Q.a11 * v.y; + rz += Q.a22 * v.z; + + float r = Q.c; + r += rx * v.x; + r += ry * v.y; + r += rz * v.z; + + // see quadricFromAttributes for general derivation; here we need to add the parts of (eval(pos) - attr)^2 that depend on attr + for (size_t k = 0; k < attribute_count; ++k) + { + float a = va[k]; + float g = v.x * G[k].gx + v.y * G[k].gy + v.z * G[k].gz + G[k].gw; + + r += a * a * Q.w; + r -= 2 * a * g; + } + + // TODO: weight normalization is breaking attribute error somehow + float s = 1;// Q.w == 0.f ? 0.f : 1.f / Q.w; + + return fabsf(r) * s; +} + static void quadricFromPlane(Quadric& Q, float a, float b, float c, float d, float w) { float aw = a * w; @@ -574,6 +646,82 @@ static void quadricFromTriangleEdge(Quadric& Q, const Vector3& p0, const Vector3 quadricFromPlane(Q, normal.x, normal.y, normal.z, -distance, length * weight); } +static void quadricFromAttributes(Quadric& Q, QuadricGrad* G, const Vector3& p0, const Vector3& p1, const Vector3& p2, const float* va0, const float* va1, const float* va2, size_t attribute_count) +{ + // for each attribute we want to encode the following function into the quadric: + // (eval(pos) - attr)^2 + // where eval(pos) interpolates attribute across the triangle like so: + // eval(pos) = pos.x * gx + pos.y * gy + pos.z * gz + gw + // where gx/gy/gz/gw are gradients + Vector3 p10 = {p1.x - p0.x, p1.y - p0.y, p1.z - p0.z}; + Vector3 p20 = {p2.x - p0.x, p2.y - p0.y, p2.z - p0.z}; + + // weight is scaled linearly with edge length + Vector3 normal = {p10.y * p20.z - p10.z * p20.y, p10.z * p20.x - p10.x * p20.z, p10.x * p20.y - p10.y * p20.x}; + float area = sqrtf(normal.x * normal.x + normal.y * normal.y + normal.z * normal.z); + float w = sqrtf(area); // TODO this needs more experimentation + + // we compute gradients using barycentric coordinates; barycentric coordinates can be computed as follows: + // v = (d11 * d20 - d01 * d21) / denom + // w = (d00 * d21 - d01 * d20) / denom + // u = 1 - v - w + // here v0, v1 are triangle edge vectors, v2 is a vector from point to triangle corner, and dij = dot(vi, vj) + const Vector3& v0 = p10; + const Vector3& v1 = p20; + float d00 = v0.x * v0.x + v0.y * v0.y + v0.z * v0.z; + float d01 = v0.x * v1.x + v0.y * v1.y + v0.z * v1.z; + float d11 = v1.x * v1.x + v1.y * v1.y + v1.z * v1.z; + float denom = d00 * d11 - d01 * d01; + float denomr = denom == 0 ? 0.f : 1.f / denom; + + // precompute gradient factors + // these are derived by directly computing derivative of eval(pos) = a0 * u + a1 * v + a2 * w and factoring out common factors that are shared between attributes + float gx1 = (d11 * v0.x - d01 * v1.x) * denomr; + float gx2 = (d00 * v1.x - d01 * v0.x) * denomr; + float gy1 = (d11 * v0.y - d01 * v1.y) * denomr; + float gy2 = (d00 * v1.y - d01 * v0.y) * denomr; + float gz1 = (d11 * v0.z - d01 * v1.z) * denomr; + float gz2 = (d00 * v1.z - d01 * v0.z) * denomr; + + memset(&Q, 0, sizeof(Quadric)); + + Q.w = w; + + for (size_t k = 0; k < attribute_count; ++k) + { + float a0 = va0[k], a1 = va1[k], a2 = va2[k]; + + // compute gradient of eval(pos) for x/y/z/w + // the formulas below are obtained by directly computing derivative of eval(pos) = a0 * u + a1 * v + a2 * w + float gx = gx1 * (a1 - a0) + gx2 * (a2 - a0); + float gy = gy1 * (a1 - a0) + gy2 * (a2 - a0); + float gz = gz1 * (a1 - a0) + gz2 * (a2 - a0); + float gw = a0 - p0.x * gx - p0.y * gy - p0.z * gz; + + // quadric encodes (eval(pos)-attr)^2; this means that the resulting expansion needs to compute, for example, pos.x * pos.y * K + // since quadrics already encode factors for pos.x * pos.y, we can accumulate almost everything in basic quadric fields + Q.a00 += w * (gx * gx); + Q.a11 += w * (gy * gy); + Q.a22 += w * (gz * gz); + + Q.a10 += w * (gy * gx); + Q.a20 += w * (gz * gx); + Q.a21 += w * (gz * gy); + + Q.b0 += w * (gx * gw); + Q.b1 += w * (gy * gw); + Q.b2 += w * (gz * gw); + + Q.c += w * (gw * gw); + + // the only remaining sum components are ones that depend on attr; these will be addded during error evaluation, see quadricError + G[k].gx = w * gx; + G[k].gy = w * gy; + G[k].gz = w * gz; + G[k].gw = w * gw; + } +} + static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indices, size_t index_count, const Vector3* vertex_positions, const unsigned int* remap) { for (size_t i = 0; i < index_count; i += 3) @@ -595,7 +743,7 @@ static void fillEdgeQuadrics(Quadric* vertex_quadrics, const unsigned int* indic { for (size_t i = 0; i < index_count; i += 3) { - static const int next[3] = {1, 2, 0}; + static const int next[4] = {1, 2, 0, 1}; for (int e = 0; e < 3; ++e) { @@ -621,7 +769,7 @@ static void fillEdgeQuadrics(Quadric* vertex_quadrics, const unsigned int* indic if (kHasOpposite[k0][k1] && remap[i1] > remap[i0]) continue; - unsigned int i2 = indices[i + next[next[e]]]; + unsigned int i2 = indices[i + next[e + 1]]; // we try hard to maintain border edge geometry; seam edges can move more freely // due to topological restrictions on collapses, seam quadrics slightly improves collapse structure but aren't critical @@ -639,6 +787,29 @@ static void fillEdgeQuadrics(Quadric* vertex_quadrics, const unsigned int* indic } } +static void fillAttributeQuadrics(Quadric* attribute_quadrics, QuadricGrad* attribute_gradients, const unsigned int* indices, size_t index_count, const Vector3* vertex_positions, const float* vertex_attributes, size_t attribute_count, const unsigned int* remap) +{ + for (size_t i = 0; i < index_count; i += 3) + { + unsigned int i0 = indices[i + 0]; + unsigned int i1 = indices[i + 1]; + unsigned int i2 = indices[i + 2]; + + Quadric QA; + QuadricGrad G[kMaxAttributes]; + quadricFromAttributes(QA, G, vertex_positions[i0], vertex_positions[i1], vertex_positions[i2], &vertex_attributes[i0 * attribute_count], &vertex_attributes[i1 * attribute_count], &vertex_attributes[i2 * attribute_count], attribute_count); + + // TODO: This blends together attribute weights across attribute discontinuities, which is probably not a great idea + quadricAdd(attribute_quadrics[remap[i0]], QA); + quadricAdd(attribute_quadrics[remap[i1]], QA); + quadricAdd(attribute_quadrics[remap[i2]], QA); + + quadricAdd(&attribute_gradients[remap[i0] * attribute_count], G, attribute_count); + quadricAdd(&attribute_gradients[remap[i1] * attribute_count], G, attribute_count); + quadricAdd(&attribute_gradients[remap[i2] * attribute_count], G, attribute_count); + } +} + // does triangle ABC flip when C is replaced with D? static bool hasTriangleFlip(const Vector3& a, const Vector3& b, const Vector3& c, const Vector3& d) { @@ -649,7 +820,7 @@ static bool hasTriangleFlip(const Vector3& a, const Vector3& b, const Vector3& c Vector3 nbc = {eb.y * ec.z - eb.z * ec.y, eb.z * ec.x - eb.x * ec.z, eb.x * ec.y - eb.y * ec.x}; Vector3 nbd = {eb.y * ed.z - eb.z * ed.y, eb.z * ed.x - eb.x * ed.z, eb.x * ed.y - eb.y * ed.x}; - return nbc.x * nbd.x + nbc.y * nbd.y + nbc.z * nbd.z < 0; + return nbc.x * nbd.x + nbc.y * nbd.y + nbc.z * nbd.z <= 0; } static bool hasTriangleFlips(const EdgeAdjacency& adjacency, const Vector3* vertex_positions, const unsigned int* collapse_remap, unsigned int i0, unsigned int i1) @@ -661,16 +832,15 @@ static bool hasTriangleFlips(const EdgeAdjacency& adjacency, const Vector3* vert const Vector3& v1 = vertex_positions[i1]; const EdgeAdjacency::Edge* edges = &adjacency.data[adjacency.offsets[i0]]; - size_t count = adjacency.counts[i0]; + size_t count = adjacency.offsets[i0 + 1] - adjacency.offsets[i0]; for (size_t i = 0; i < count; ++i) { unsigned int a = collapse_remap[edges[i].next]; unsigned int b = collapse_remap[edges[i].prev]; - // skip triangles that get collapsed - // note: this is mathematically redundant as if either of these is true, the dot product in hasTriangleFlip should be 0 - if (a == i1 || b == i1) + // skip triangles that will get collapsed by i0->i1 collapse or already got collapsed previously + if (a == i1 || b == i1 || a == b) continue; // early-out when at least one triangle flips due to a collapse @@ -681,7 +851,25 @@ static bool hasTriangleFlips(const EdgeAdjacency& adjacency, const Vector3* vert return false; } -static size_t pickEdgeCollapses(Collapse* collapses, const unsigned int* indices, size_t index_count, const unsigned int* remap, const unsigned char* vertex_kind, const unsigned int* loop) +static size_t boundEdgeCollapses(const EdgeAdjacency& adjacency, size_t vertex_count, size_t index_count, unsigned char* vertex_kind) +{ + size_t dual_count = 0; + + for (size_t i = 0; i < vertex_count; ++i) + { + unsigned char k = vertex_kind[i]; + unsigned int e = adjacency.offsets[i + 1] - adjacency.offsets[i]; + + dual_count += (k == Kind_Manifold || k == Kind_Seam) ? e : 0; + } + + assert(dual_count <= index_count); + + // pad capacity by 3 so that we can check for overflow once per triangle instead of once per edge + return (index_count - dual_count / 2) + 3; +} + +static size_t pickEdgeCollapses(Collapse* collapses, size_t collapse_capacity, const unsigned int* indices, size_t index_count, const unsigned int* remap, const unsigned char* vertex_kind, const unsigned int* loop) { size_t collapse_count = 0; @@ -689,6 +877,10 @@ static size_t pickEdgeCollapses(Collapse* collapses, const unsigned int* indices { static const int next[3] = {1, 2, 0}; + // this should never happen as boundEdgeCollapses should give an upper bound for the collapse count, but in an unlikely event it does we can just drop extra collapses + if (collapse_count + 3 > collapse_capacity) + break; + for (int e = 0; e < 3; ++e) { unsigned int i0 = indices[i + e]; @@ -739,7 +931,7 @@ static size_t pickEdgeCollapses(Collapse* collapses, const unsigned int* indices return collapse_count; } -static void rankEdgeCollapses(Collapse* collapses, size_t collapse_count, const Vector3* vertex_positions, const Quadric* vertex_quadrics, const unsigned int* remap) +static void rankEdgeCollapses(Collapse* collapses, size_t collapse_count, const Vector3* vertex_positions, const float* vertex_attributes, const Quadric* vertex_quadrics, const Quadric* attribute_quadrics, const QuadricGrad* attribute_gradients, size_t attribute_count, const unsigned int* remap) { for (size_t i = 0; i < collapse_count; ++i) { @@ -753,11 +945,14 @@ static void rankEdgeCollapses(Collapse* collapses, size_t collapse_count, const unsigned int j0 = c.bidi ? i1 : i0; unsigned int j1 = c.bidi ? i0 : i1; - const Quadric& qi = vertex_quadrics[remap[i0]]; - const Quadric& qj = vertex_quadrics[remap[j0]]; + float ei = quadricError(vertex_quadrics[remap[i0]], vertex_positions[i1]); + float ej = quadricError(vertex_quadrics[remap[j0]], vertex_positions[j1]); - float ei = quadricError(qi, vertex_positions[i1]); - float ej = quadricError(qj, vertex_positions[j1]); + if (attribute_count) + { + ei += quadricError(attribute_quadrics[remap[i0]], &attribute_gradients[remap[i0] * attribute_count], attribute_count, vertex_positions[i1], &vertex_attributes[i1 * attribute_count]); + ej += quadricError(attribute_quadrics[remap[j0]], &attribute_gradients[remap[j0] * attribute_count], attribute_count, vertex_positions[j1], &vertex_attributes[j1 * attribute_count]); + } // pick edge direction with minimal error c.v0 = ei <= ej ? i0 : j0; @@ -766,61 +961,6 @@ static void rankEdgeCollapses(Collapse* collapses, size_t collapse_count, const } } -#if TRACE > 1 -static void dumpEdgeCollapses(const Collapse* collapses, size_t collapse_count, const unsigned char* vertex_kind) -{ - size_t ckinds[Kind_Count][Kind_Count] = {}; - float cerrors[Kind_Count][Kind_Count] = {}; - - for (int k0 = 0; k0 < Kind_Count; ++k0) - for (int k1 = 0; k1 < Kind_Count; ++k1) - cerrors[k0][k1] = FLT_MAX; - - for (size_t i = 0; i < collapse_count; ++i) - { - unsigned int i0 = collapses[i].v0; - unsigned int i1 = collapses[i].v1; - - unsigned char k0 = vertex_kind[i0]; - unsigned char k1 = vertex_kind[i1]; - - ckinds[k0][k1]++; - cerrors[k0][k1] = (collapses[i].error < cerrors[k0][k1]) ? collapses[i].error : cerrors[k0][k1]; - } - - for (int k0 = 0; k0 < Kind_Count; ++k0) - for (int k1 = 0; k1 < Kind_Count; ++k1) - if (ckinds[k0][k1]) - printf("collapses %d -> %d: %d, min error %e\n", k0, k1, int(ckinds[k0][k1]), ckinds[k0][k1] ? sqrtf(cerrors[k0][k1]) : 0.f); -} - -static void dumpLockedCollapses(const unsigned int* indices, size_t index_count, const unsigned char* vertex_kind) -{ - size_t locked_collapses[Kind_Count][Kind_Count] = {}; - - for (size_t i = 0; i < index_count; i += 3) - { - static const int next[3] = {1, 2, 0}; - - for (int e = 0; e < 3; ++e) - { - unsigned int i0 = indices[i + e]; - unsigned int i1 = indices[i + next[e]]; - - unsigned char k0 = vertex_kind[i0]; - unsigned char k1 = vertex_kind[i1]; - - locked_collapses[k0][k1] += !kCanCollapse[k0][k1] && !kCanCollapse[k1][k0]; - } - } - - for (int k0 = 0; k0 < Kind_Count; ++k0) - for (int k1 = 0; k1 < Kind_Count; ++k1) - if (locked_collapses[k0][k1]) - printf("locked collapses %d -> %d: %d\n", k0, k1, int(locked_collapses[k0][k1])); -} -#endif - static void sortEdgeCollapses(unsigned int* sort_order, const Collapse* collapses, size_t collapse_count) { const int sort_bits = 11; @@ -859,7 +999,7 @@ static void sortEdgeCollapses(unsigned int* sort_order, const Collapse* collapse } } -static size_t performEdgeCollapses(unsigned int* collapse_remap, unsigned char* collapse_locked, Quadric* vertex_quadrics, const Collapse* collapses, size_t collapse_count, const unsigned int* collapse_order, const unsigned int* remap, const unsigned int* wedge, const unsigned char* vertex_kind, const Vector3* vertex_positions, const EdgeAdjacency& adjacency, size_t triangle_collapse_goal, float error_limit, float& result_error) +static size_t performEdgeCollapses(unsigned int* collapse_remap, unsigned char* collapse_locked, Quadric* vertex_quadrics, Quadric* attribute_quadrics, QuadricGrad* attribute_gradients, size_t attribute_count, const Collapse* collapses, size_t collapse_count, const unsigned int* collapse_order, const unsigned int* remap, const unsigned int* wedge, const unsigned char* vertex_kind, const Vector3* vertex_positions, const EdgeAdjacency& adjacency, size_t triangle_collapse_goal, float error_limit, float& result_error) { size_t edge_collapses = 0; size_t triangle_collapses = 0; @@ -922,6 +1062,12 @@ static size_t performEdgeCollapses(unsigned int* collapse_remap, unsigned char* quadricAdd(vertex_quadrics[r1], vertex_quadrics[r0]); + if (attribute_count) + { + quadricAdd(attribute_quadrics[r1], attribute_quadrics[r0]); + quadricAdd(&attribute_gradients[r1 * attribute_count], &attribute_gradients[r0 * attribute_count], attribute_count); + } + if (vertex_kind[i0] == Kind_Complex) { unsigned int v = i0; @@ -1277,15 +1423,18 @@ MESHOPTIMIZER_API unsigned int* meshopt_simplifyDebugLoop = 0; MESHOPTIMIZER_API unsigned int* meshopt_simplifyDebugLoopBack = 0; #endif -size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, unsigned int options, float* out_result_error) +size_t meshopt_simplifyEdge(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, const float* vertex_attributes_data, size_t vertex_attributes_stride, const float* attribute_weights, size_t attribute_count, size_t target_index_count, float target_error, unsigned int options, float* out_result_error) { using namespace meshopt; assert(index_count % 3 == 0); - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); assert(target_index_count <= index_count); assert((options & ~(meshopt_SimplifyLockBorder)) == 0); + assert(vertex_attributes_stride >= attribute_count * sizeof(float) && vertex_attributes_stride <= 256); + assert(vertex_attributes_stride % sizeof(float) == 0); + assert(attribute_count <= kMaxAttributes); meshopt_Allocator allocator; @@ -1325,12 +1474,35 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, Vector3* vertex_positions = allocator.allocate(vertex_count); rescalePositions(vertex_positions, vertex_positions_data, vertex_count, vertex_positions_stride); + float* vertex_attributes = NULL; + + if (attribute_count) + { + vertex_attributes = allocator.allocate(vertex_count * attribute_count); + rescaleAttributes(vertex_attributes, vertex_attributes_data, vertex_count, vertex_attributes_stride, attribute_weights, attribute_count); + } + Quadric* vertex_quadrics = allocator.allocate(vertex_count); memset(vertex_quadrics, 0, vertex_count * sizeof(Quadric)); + Quadric* attribute_quadrics = NULL; + QuadricGrad* attribute_gradients = NULL; + + if (attribute_count) + { + attribute_quadrics = allocator.allocate(vertex_count); + memset(attribute_quadrics, 0, vertex_count * sizeof(Quadric)); + + attribute_gradients = allocator.allocate(vertex_count * attribute_count); + memset(attribute_gradients, 0, vertex_count * attribute_count * sizeof(QuadricGrad)); + } + fillFaceQuadrics(vertex_quadrics, indices, index_count, vertex_positions, remap); fillEdgeQuadrics(vertex_quadrics, indices, index_count, vertex_positions, remap, vertex_kind, loop, loopback); + if (attribute_count) + fillAttributeQuadrics(attribute_quadrics, attribute_gradients, indices, index_count, vertex_positions, vertex_attributes, attribute_count, remap); + if (result != indices) memcpy(result, indices, index_count * sizeof(unsigned int)); @@ -1338,8 +1510,10 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t pass_count = 0; #endif - Collapse* edge_collapses = allocator.allocate(index_count); - unsigned int* collapse_order = allocator.allocate(index_count); + size_t collapse_capacity = boundEdgeCollapses(adjacency, vertex_count, index_count, vertex_kind); + + Collapse* edge_collapses = allocator.allocate(collapse_capacity); + unsigned int* collapse_order = allocator.allocate(collapse_capacity); unsigned int* collapse_remap = allocator.allocate(vertex_count); unsigned char* collapse_locked = allocator.allocate(vertex_count); @@ -1354,17 +1528,14 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, // note: throughout the simplification process adjacency structure reflects welded topology for result-in-progress updateEdgeAdjacency(adjacency, result, result_count, vertex_count, remap); - size_t edge_collapse_count = pickEdgeCollapses(edge_collapses, result, result_count, remap, vertex_kind, loop); + size_t edge_collapse_count = pickEdgeCollapses(edge_collapses, collapse_capacity, result, result_count, remap, vertex_kind, loop); + assert(edge_collapse_count <= collapse_capacity); // no edges can be collapsed any more due to topology restrictions if (edge_collapse_count == 0) break; - rankEdgeCollapses(edge_collapses, edge_collapse_count, vertex_positions, vertex_quadrics, remap); - -#if TRACE > 1 - dumpEdgeCollapses(edge_collapses, edge_collapse_count, vertex_kind); -#endif + rankEdgeCollapses(edge_collapses, edge_collapse_count, vertex_positions, vertex_attributes, vertex_quadrics, attribute_quadrics, attribute_gradients, attribute_count, remap); sortEdgeCollapses(collapse_order, edge_collapses, edge_collapse_count); @@ -1379,7 +1550,7 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, printf("pass %d: ", int(pass_count++)); #endif - size_t collapses = performEdgeCollapses(collapse_remap, collapse_locked, vertex_quadrics, edge_collapses, edge_collapse_count, collapse_order, remap, wedge, vertex_kind, vertex_positions, adjacency, triangle_collapse_goal, error_limit, result_error); + size_t collapses = performEdgeCollapses(collapse_remap, collapse_locked, vertex_quadrics, attribute_quadrics, attribute_gradients, attribute_count, edge_collapses, edge_collapse_count, collapse_order, remap, wedge, vertex_kind, vertex_positions, adjacency, triangle_collapse_goal, error_limit, result_error); // no edges can be collapsed any more due to hitting the error limit or triangle collapse limit if (collapses == 0) @@ -1398,10 +1569,6 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, printf("result: %d triangles, error: %e; total %d passes\n", int(result_count), sqrtf(result_error), int(pass_count)); #endif -#if TRACE > 1 - dumpLockedCollapses(result, result_count, vertex_kind); -#endif - #ifndef NDEBUG if (meshopt_simplifyDebugKind) memcpy(meshopt_simplifyDebugKind, vertex_kind, vertex_count); @@ -1420,12 +1587,22 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, return result_count; } +size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, unsigned int options, float* out_result_error) +{ + return meshopt_simplifyEdge(destination, indices, index_count, vertex_positions_data, vertex_count, vertex_positions_stride, NULL, 0, NULL, 0, target_index_count, target_error, options, out_result_error); +} + +size_t meshopt_simplifyWithAttributes(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, const float* vertex_attributes_data, size_t vertex_attributes_stride, const float* attribute_weights, size_t attribute_count, size_t target_index_count, float target_error, unsigned int options, float* out_result_error) +{ + return meshopt_simplifyEdge(destination, indices, index_count, vertex_positions_data, vertex_count, vertex_positions_stride, vertex_attributes_data, vertex_attributes_stride, attribute_weights, attribute_count, target_index_count, target_error, options, out_result_error); +} + size_t meshopt_simplifySloppy(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* out_result_error) { using namespace meshopt; assert(index_count % 3 == 0); - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); assert(target_index_count <= index_count); @@ -1556,7 +1733,7 @@ size_t meshopt_simplifyPoints(unsigned int* destination, const float* vertex_pos { using namespace meshopt; - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); assert(target_vertex_count <= vertex_count); @@ -1668,7 +1845,7 @@ float meshopt_simplifyScale(const float* vertex_positions, size_t vertex_count, { using namespace meshopt; - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); float extent = rescalePositions(NULL, vertex_positions, vertex_count, vertex_positions_stride); diff --git a/bgfx/3rdparty/meshoptimizer/src/spatialorder.cpp b/bgfx/3rdparty/meshoptimizer/src/spatialorder.cpp index b09f80ac..7b1a0694 100644 --- a/bgfx/3rdparty/meshoptimizer/src/spatialorder.cpp +++ b/bgfx/3rdparty/meshoptimizer/src/spatialorder.cpp @@ -113,7 +113,7 @@ void meshopt_spatialSortRemap(unsigned int* destination, const float* vertex_pos { using namespace meshopt; - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); meshopt_Allocator allocator; @@ -144,7 +144,7 @@ void meshopt_spatialSortTriangles(unsigned int* destination, const unsigned int* using namespace meshopt; assert(index_count % 3 == 0); - assert(vertex_positions_stride > 0 && vertex_positions_stride <= 256); + assert(vertex_positions_stride >= 12 && vertex_positions_stride <= 256); assert(vertex_positions_stride % sizeof(float) == 0); (void)vertex_count; diff --git a/bgfx/3rdparty/meshoptimizer/src/vcacheoptimizer.cpp b/bgfx/3rdparty/meshoptimizer/src/vcacheoptimizer.cpp index fb8ade4b..d4b08ba3 100644 --- a/bgfx/3rdparty/meshoptimizer/src/vcacheoptimizer.cpp +++ b/bgfx/3rdparty/meshoptimizer/src/vcacheoptimizer.cpp @@ -110,7 +110,7 @@ static unsigned int getNextVertexDeadEnd(const unsigned int* dead_end, unsigned return ~0u; } -static unsigned int getNextVertexNeighbour(const unsigned int* next_candidates_begin, const unsigned int* next_candidates_end, const unsigned int* live_triangles, const unsigned int* cache_timestamps, unsigned int timestamp, unsigned int cache_size) +static unsigned int getNextVertexNeighbor(const unsigned int* next_candidates_begin, const unsigned int* next_candidates_end, const unsigned int* live_triangles, const unsigned int* cache_timestamps, unsigned int timestamp, unsigned int cache_size) { unsigned int best_candidate = ~0u; int best_priority = -1; @@ -221,9 +221,9 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned triangle_scores[i] = vertex_scores[a] + vertex_scores[b] + vertex_scores[c]; } - unsigned int cache_holder[2 * (kCacheSizeMax + 3)]; + unsigned int cache_holder[2 * (kCacheSizeMax + 4)]; unsigned int* cache = cache_holder; - unsigned int* cache_new = cache_holder + kCacheSizeMax + 3; + unsigned int* cache_new = cache_holder + kCacheSizeMax + 4; size_t cache_count = 0; unsigned int current_triangle = 0; @@ -260,10 +260,8 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned { unsigned int index = cache[i]; - if (index != a && index != b && index != c) - { - cache_new[cache_write++] = index; - } + cache_new[cache_write] = index; + cache_write += (index != a && index != b && index != c); } unsigned int* cache_temp = cache; @@ -281,16 +279,16 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned { unsigned int index = indices[current_triangle * 3 + k]; - unsigned int* neighbours = &adjacency.data[0] + adjacency.offsets[index]; - size_t neighbours_size = adjacency.counts[index]; + unsigned int* neighbors = &adjacency.data[0] + adjacency.offsets[index]; + size_t neighbors_size = adjacency.counts[index]; - for (size_t i = 0; i < neighbours_size; ++i) + for (size_t i = 0; i < neighbors_size; ++i) { - unsigned int tri = neighbours[i]; + unsigned int tri = neighbors[i]; if (tri == current_triangle) { - neighbours[i] = neighbours[neighbours_size - 1]; + neighbors[i] = neighbors[neighbors_size - 1]; adjacency.counts[index]--; break; } @@ -305,6 +303,10 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned { unsigned int index = cache[i]; + // no need to update scores if we are never going to use this vertex + if (adjacency.counts[index] == 0) + continue; + int cache_position = i >= cache_size ? -1 : int(i); // update vertex score @@ -314,10 +316,10 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned vertex_scores[index] = score; // update scores of vertex triangles - const unsigned int* neighbours_begin = &adjacency.data[0] + adjacency.offsets[index]; - const unsigned int* neighbours_end = neighbours_begin + adjacency.counts[index]; + const unsigned int* neighbors_begin = &adjacency.data[0] + adjacency.offsets[index]; + const unsigned int* neighbors_end = neighbors_begin + adjacency.counts[index]; - for (const unsigned int* it = neighbours_begin; it != neighbours_end; ++it) + for (const unsigned int* it = neighbors_begin; it != neighbors_end; ++it) { unsigned int tri = *it; assert(!emitted_flags[tri]); @@ -325,11 +327,8 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned float tri_score = triangle_scores[tri] + score_diff; assert(tri_score > 0); - if (best_score < tri_score) - { - best_triangle = tri; - best_score = tri_score; - } + best_triangle = best_score < tri_score ? tri : best_triangle; + best_score = best_score < tri_score ? tri_score : best_score; triangle_scores[tri] = tri_score; } @@ -412,11 +411,11 @@ void meshopt_optimizeVertexCacheFifo(unsigned int* destination, const unsigned i { const unsigned int* next_candidates_begin = &dead_end[0] + dead_end_top; - // emit all vertex neighbours - const unsigned int* neighbours_begin = &adjacency.data[0] + adjacency.offsets[current_vertex]; - const unsigned int* neighbours_end = neighbours_begin + adjacency.counts[current_vertex]; + // emit all vertex neighbors + const unsigned int* neighbors_begin = &adjacency.data[0] + adjacency.offsets[current_vertex]; + const unsigned int* neighbors_end = neighbors_begin + adjacency.counts[current_vertex]; - for (const unsigned int* it = neighbours_begin; it != neighbours_end; ++it) + for (const unsigned int* it = neighbors_begin; it != neighbors_end; ++it) { unsigned int triangle = *it; @@ -461,7 +460,7 @@ void meshopt_optimizeVertexCacheFifo(unsigned int* destination, const unsigned i const unsigned int* next_candidates_end = &dead_end[0] + dead_end_top; // get next vertex - current_vertex = getNextVertexNeighbour(next_candidates_begin, next_candidates_end, &live_triangles[0], &cache_timestamps[0], timestamp, cache_size); + current_vertex = getNextVertexNeighbor(next_candidates_begin, next_candidates_end, &live_triangles[0], &cache_timestamps[0], timestamp, cache_size); if (current_vertex == ~0u) { diff --git a/bgfx/3rdparty/meshoptimizer/src/vertexcodec.cpp b/bgfx/3rdparty/meshoptimizer/src/vertexcodec.cpp index 7925ea86..167034ba 100644 --- a/bgfx/3rdparty/meshoptimizer/src/vertexcodec.cpp +++ b/bgfx/3rdparty/meshoptimizer/src/vertexcodec.cpp @@ -44,12 +44,22 @@ // When targeting Wasm SIMD we can't use runtime cpuid checks so we unconditionally enable SIMD #if defined(__wasm_simd128__) #define SIMD_WASM +// Prevent compiling other variant when wasm simd compilation is active +#undef SIMD_NEON +#undef SIMD_SSE +#undef SIMD_AVX #endif #ifndef SIMD_TARGET #define SIMD_TARGET #endif +// When targeting AArch64/x64, optimize for latency to allow decoding of individual 16-byte groups to overlap +// We don't do this for 32-bit systems because we need 64-bit math for this and this will hurt in-order CPUs +#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_M_ARM64) +#define SIMD_LATENCYOPT +#endif + #endif // !MESHOPTIMIZER_NO_SIMD #ifdef SIMD_SSE @@ -77,19 +87,17 @@ #endif #ifdef SIMD_WASM -#undef __DEPRECATED -#pragma clang diagnostic ignored "-Wdeprecated-declarations" #include #endif #ifdef SIMD_WASM -#define wasmx_splat_v32x4(v, i) wasm_v32x4_shuffle(v, v, i, i, i, i) -#define wasmx_unpacklo_v8x16(a, b) wasm_v8x16_shuffle(a, b, 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23) -#define wasmx_unpackhi_v8x16(a, b) wasm_v8x16_shuffle(a, b, 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31) -#define wasmx_unpacklo_v16x8(a, b) wasm_v16x8_shuffle(a, b, 0, 8, 1, 9, 2, 10, 3, 11) -#define wasmx_unpackhi_v16x8(a, b) wasm_v16x8_shuffle(a, b, 4, 12, 5, 13, 6, 14, 7, 15) -#define wasmx_unpacklo_v64x2(a, b) wasm_v64x2_shuffle(a, b, 0, 2) -#define wasmx_unpackhi_v64x2(a, b) wasm_v64x2_shuffle(a, b, 1, 3) +#define wasmx_splat_v32x4(v, i) wasm_i32x4_shuffle(v, v, i, i, i, i) +#define wasmx_unpacklo_v8x16(a, b) wasm_i8x16_shuffle(a, b, 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23) +#define wasmx_unpackhi_v8x16(a, b) wasm_i8x16_shuffle(a, b, 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31) +#define wasmx_unpacklo_v16x8(a, b) wasm_i16x8_shuffle(a, b, 0, 8, 1, 9, 2, 10, 3, 11) +#define wasmx_unpackhi_v16x8(a, b) wasm_i16x8_shuffle(a, b, 4, 12, 5, 13, 6, 14, 7, 15) +#define wasmx_unpacklo_v64x2(a, b) wasm_i64x2_shuffle(a, b, 0, 2) +#define wasmx_unpackhi_v64x2(a, b) wasm_i64x2_shuffle(a, b, 1, 3) #endif namespace meshopt @@ -288,7 +296,7 @@ static unsigned char* encodeVertexBlock(unsigned char* data, unsigned char* data return data; } -#if defined(SIMD_FALLBACK) || (!defined(SIMD_SSE) && !defined(SIMD_NEON) && !defined(SIMD_AVX)) +#if defined(SIMD_FALLBACK) || (!defined(SIMD_SSE) && !defined(SIMD_NEON) && !defined(SIMD_AVX) && !defined(SIMD_WASM)) static const unsigned char* decodeBytesGroup(const unsigned char* data, unsigned char* buffer, int bitslog2) { #define READ() byte = *data++ @@ -472,6 +480,18 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi typedef int unaligned_int; #endif +#ifdef SIMD_LATENCYOPT + unsigned int data32; + memcpy(&data32, data, 4); + data32 &= data32 >> 1; + + // arrange bits such that low bits of nibbles of data64 contain all 2-bit elements of data32 + unsigned long long data64 = ((unsigned long long)data32 << 30) | (data32 & 0x3fffffff); + + // adds all 1-bit nibbles together; the sum fits in 4 bits because datacnt=16 would have used mode 3 + int datacnt = int(((data64 & 0x1111111111111111ull) * 0x1111111111111111ull) >> 60); +#endif + __m128i sel2 = _mm_cvtsi32_si128(*reinterpret_cast(data)); __m128i rest = _mm_loadu_si128(reinterpret_cast(data + 4)); @@ -490,11 +510,25 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi _mm_storeu_si128(reinterpret_cast<__m128i*>(buffer), result); +#ifdef SIMD_LATENCYOPT + return data + 4 + datacnt; +#else return data + 4 + kDecodeBytesGroupCount[mask0] + kDecodeBytesGroupCount[mask1]; +#endif } case 2: { +#ifdef SIMD_LATENCYOPT + unsigned long long data64; + memcpy(&data64, data, 8); + data64 &= data64 >> 1; + data64 &= data64 >> 2; + + // adds all 1-bit nibbles together; the sum fits in 4 bits because datacnt=16 would have used mode 3 + int datacnt = int(((data64 & 0x1111111111111111ull) * 0x1111111111111111ull) >> 60); +#endif + __m128i sel4 = _mm_loadl_epi64(reinterpret_cast(data)); __m128i rest = _mm_loadu_si128(reinterpret_cast(data + 8)); @@ -512,7 +546,11 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi _mm_storeu_si128(reinterpret_cast<__m128i*>(buffer), result); +#ifdef SIMD_LATENCYOPT + return data + 8 + datacnt; +#else return data + 8 + kDecodeBytesGroupCount[mask0] + kDecodeBytesGroupCount[mask1]; +#endif } case 3: @@ -604,24 +642,13 @@ static uint8x16_t shuffleBytes(unsigned char mask0, unsigned char mask1, uint8x8 static void neonMoveMask(uint8x16_t mask, unsigned char& mask0, unsigned char& mask1) { - static const unsigned char byte_mask_data[16] = {1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8, 16, 32, 64, 128}; - - uint8x16_t byte_mask = vld1q_u8(byte_mask_data); - uint8x16_t masked = vandq_u8(mask, byte_mask); + // magic constant found using z3 SMT assuming mask has 8 groups of 0xff or 0x00 + const uint64_t magic = 0x000103070f1f3f80ull; -#ifdef __aarch64__ - // aarch64 has horizontal sums; MSVC doesn't expose this via arm64_neon.h so this path is exclusive to clang/gcc - mask0 = vaddv_u8(vget_low_u8(masked)); - mask1 = vaddv_u8(vget_high_u8(masked)); -#else - // we need horizontal sums of each half of masked, which can be done in 3 steps (yielding sums of sizes 2, 4, 8) - uint8x8_t sum1 = vpadd_u8(vget_low_u8(masked), vget_high_u8(masked)); - uint8x8_t sum2 = vpadd_u8(sum1, sum1); - uint8x8_t sum3 = vpadd_u8(sum2, sum2); + uint64x2_t mask2 = vreinterpretq_u64_u8(mask); - mask0 = vget_lane_u8(sum3, 0); - mask1 = vget_lane_u8(sum3, 1); -#endif + mask0 = uint8_t((vgetq_lane_u64(mask2, 0) * magic) >> 56); + mask1 = uint8_t((vgetq_lane_u64(mask2, 1) * magic) >> 56); } static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsigned char* buffer, int bitslog2) @@ -639,6 +666,18 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi case 1: { +#ifdef SIMD_LATENCYOPT + unsigned int data32; + memcpy(&data32, data, 4); + data32 &= data32 >> 1; + + // arrange bits such that low bits of nibbles of data64 contain all 2-bit elements of data32 + unsigned long long data64 = ((unsigned long long)data32 << 30) | (data32 & 0x3fffffff); + + // adds all 1-bit nibbles together; the sum fits in 4 bits because datacnt=16 would have used mode 3 + int datacnt = int(((data64 & 0x1111111111111111ull) * 0x1111111111111111ull) >> 60); +#endif + uint8x8_t sel2 = vld1_u8(data); uint8x8_t sel22 = vzip_u8(vshr_n_u8(sel2, 4), sel2).val[0]; uint8x8x2_t sel2222 = vzip_u8(vshr_n_u8(sel22, 2), sel22); @@ -655,11 +694,25 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi vst1q_u8(buffer, result); +#ifdef SIMD_LATENCYOPT + return data + 4 + datacnt; +#else return data + 4 + kDecodeBytesGroupCount[mask0] + kDecodeBytesGroupCount[mask1]; +#endif } case 2: { +#ifdef SIMD_LATENCYOPT + unsigned long long data64; + memcpy(&data64, data, 8); + data64 &= data64 >> 1; + data64 &= data64 >> 2; + + // adds all 1-bit nibbles together; the sum fits in 4 bits because datacnt=16 would have used mode 3 + int datacnt = int(((data64 & 0x1111111111111111ull) * 0x1111111111111111ull) >> 60); +#endif + uint8x8_t sel4 = vld1_u8(data); uint8x8x2_t sel44 = vzip_u8(vshr_n_u8(sel4, 4), vand_u8(sel4, vdup_n_u8(15))); uint8x16_t sel = vcombine_u8(sel44.val[0], sel44.val[1]); @@ -675,7 +728,11 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi vst1q_u8(buffer, result); +#ifdef SIMD_LATENCYOPT + return data + 8 + datacnt; +#else return data + 8 + kDecodeBytesGroupCount[mask0] + kDecodeBytesGroupCount[mask1]; +#endif } case 3: @@ -702,7 +759,7 @@ static v128_t decodeShuffleMask(unsigned char mask0, unsigned char mask1) v128_t sm1 = wasm_v128_load(&kDecodeBytesGroupShuffle[mask1]); v128_t sm1off = wasm_v128_load(&kDecodeBytesGroupCount[mask0]); - sm1off = wasm_v8x16_shuffle(sm1off, sm1off, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + sm1off = wasm_i8x16_shuffle(sm1off, sm1off, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); v128_t sm1r = wasm_i8x16_add(sm1, sm1off); @@ -715,7 +772,6 @@ static void wasmMoveMask(v128_t mask, unsigned char& mask0, unsigned char& mask1 // magic constant found using z3 SMT assuming mask has 8 groups of 0xff or 0x00 const uint64_t magic = 0x000103070f1f3f80ull; - // TODO: This can use v8x16_bitmask in the future mask0 = uint8_t((wasm_i64x2_extract_lane(mask, 0) * magic) >> 56); mask1 = uint8_t((wasm_i64x2_extract_lane(mask, 1) * magic) >> 56); } @@ -723,9 +779,6 @@ static void wasmMoveMask(v128_t mask, unsigned char& mask0, unsigned char& mask1 SIMD_TARGET static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsigned char* buffer, int bitslog2) { - unsigned char byte, enc, encv; - const unsigned char* data_var; - switch (bitslog2) { case 0: @@ -753,7 +806,7 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi v128_t shuf = decodeShuffleMask(mask0, mask1); - v128_t result = wasm_v128_bitselect(wasm_v8x16_swizzle(rest, shuf), sel, mask); + v128_t result = wasm_v128_bitselect(wasm_i8x16_swizzle(rest, shuf), sel, mask); wasm_v128_store(buffer, result); @@ -775,7 +828,7 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi v128_t shuf = decodeShuffleMask(mask0, mask1); - v128_t result = wasm_v128_bitselect(wasm_v8x16_swizzle(rest, shuf), sel, mask); + v128_t result = wasm_v128_bitselect(wasm_i8x16_swizzle(rest, shuf), sel, mask); wasm_v128_store(buffer, result); diff --git a/bgfx/3rdparty/meshoptimizer/src/vertexfilter.cpp b/bgfx/3rdparty/meshoptimizer/src/vertexfilter.cpp index 606a280a..4b5f444f 100644 --- a/bgfx/3rdparty/meshoptimizer/src/vertexfilter.cpp +++ b/bgfx/3rdparty/meshoptimizer/src/vertexfilter.cpp @@ -30,6 +30,9 @@ // When targeting Wasm SIMD we can't use runtime cpuid checks so we unconditionally enable SIMD #if defined(__wasm_simd128__) #define SIMD_WASM +// Prevent compiling other variant when wasm simd compilation is active +#undef SIMD_NEON +#undef SIMD_SSE #endif #endif // !MESHOPTIMIZER_NO_SIMD @@ -63,6 +66,10 @@ #define wasmx_unziphi_v32x4(a, b) wasm_v32x4_shuffle(a, b, 1, 3, 5, 7) #endif +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + namespace meshopt { @@ -185,9 +192,7 @@ inline uint64_t rotateleft64(uint64_t v, int x) { #if defined(_MSC_VER) && !defined(__clang__) return _rotl64(v, x); -// Apple's Clang 8 is actually vanilla Clang 3.9, there we need to look for -// version 11 instead: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions -#elif defined(__clang__) && ((!defined(__apple_build_version__) && __clang_major__ >= 8) || __clang_major__ >= 11) +#elif defined(__clang__) && __has_builtin(__builtin_rotateleft64) return __builtin_rotateleft64(v, x); #else return (v << (x & 63)) | (v >> ((64 - x) & 63)); @@ -791,6 +796,33 @@ static void decodeFilterExpSimd(unsigned int* data, size_t count) } #endif +// optimized variant of frexp +inline int optlog2(float v) +{ + union + { + float f; + unsigned int ui; + } u; + + u.f = v; + // +1 accounts for implicit 1. in mantissa; denormalized numbers will end up clamped to min_exp by calling code + return u.ui == 0 ? 0 : int((u.ui >> 23) & 0xff) - 127 + 1; +} + +// optimized variant of ldexp +inline float optexp2(int e) +{ + union + { + float f; + unsigned int ui; + } u; + + u.ui = unsigned(e + 127) << 23; + return u.f; +} + } // namespace meshopt void meshopt_decodeFilterOct(void* buffer, size_t count, size_t stride) @@ -918,39 +950,78 @@ void meshopt_encodeFilterQuat(void* destination_, size_t count, size_t stride, i } } -void meshopt_encodeFilterExp(void* destination_, size_t count, size_t stride, int bits, const float* data) +void meshopt_encodeFilterExp(void* destination_, size_t count, size_t stride, int bits, const float* data, enum meshopt_EncodeExpMode mode) { - assert(stride > 0 && stride % 4 == 0); + using namespace meshopt; + + assert(stride > 0 && stride % 4 == 0 && stride <= 256); assert(bits >= 1 && bits <= 24); unsigned int* destination = static_cast(destination_); size_t stride_float = stride / sizeof(float); + int component_exp[64]; + assert(stride_float <= sizeof(component_exp) / sizeof(int)); + + const int min_exp = -100; + + if (mode == meshopt_EncodeExpSharedComponent) + { + for (size_t j = 0; j < stride_float; ++j) + component_exp[j] = min_exp; + + for (size_t i = 0; i < count; ++i) + { + const float* v = &data[i * stride_float]; + + // use maximum exponent to encode values; this guarantees that mantissa is [-1, 1] + for (size_t j = 0; j < stride_float; ++j) + { + int e = optlog2(v[j]); + + component_exp[j] = (component_exp[j] < e) ? e : component_exp[j]; + } + } + } + for (size_t i = 0; i < count; ++i) { const float* v = &data[i * stride_float]; unsigned int* d = &destination[i * stride_float]; - // use maximum exponent to encode values; this guarantess that mantissa is [-1, 1] - int exp = -100; + int vector_exp = min_exp; - for (size_t j = 0; j < stride_float; ++j) + if (mode == meshopt_EncodeExpSharedVector) { - int e; - frexp(v[j], &e); + // use maximum exponent to encode values; this guarantees that mantissa is [-1, 1] + for (size_t j = 0; j < stride_float; ++j) + { + int e = optlog2(v[j]); - exp = (exp < e) ? e : exp; + vector_exp = (vector_exp < e) ? e : vector_exp; + } } + else if (mode == meshopt_EncodeExpSeparate) + { + for (size_t j = 0; j < stride_float; ++j) + { + int e = optlog2(v[j]); - // note that we additionally scale the mantissa to make it a K-bit signed integer (K-1 bits for magnitude) - exp -= (bits - 1); - - // compute renormalized rounded mantissa for each component - int mmask = (1 << 24) - 1; + component_exp[j] = (min_exp < e) ? e : min_exp; + } + } for (size_t j = 0; j < stride_float; ++j) { - int m = int(ldexp(v[j], -exp) + (v[j] >= 0 ? 0.5f : -0.5f)); + int exp = (mode == meshopt_EncodeExpSharedVector) ? vector_exp : component_exp[j]; + + // note that we additionally scale the mantissa to make it a K-bit signed integer (K-1 bits for magnitude) + exp -= (bits - 1); + + // compute renormalized rounded mantissa for each component + int mmask = (1 << 24) - 1; + + int m = int(v[j] * optexp2(-exp) + (v[j] >= 0 ? 0.5f : -0.5f)); d[j] = (m & mmask) | (unsigned(exp) << 24); } diff --git a/bgfx/3rdparty/native_app_glue/LICENSE b/bgfx/3rdparty/native_app_glue/LICENSE new file mode 100644 index 00000000..da97d298 --- /dev/null +++ b/bgfx/3rdparty/native_app_glue/LICENSE @@ -0,0 +1,13 @@ +Copyright (C) 2010 The Android Open Source Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/bgfx/3rdparty/native_app_glue/android_native_app_glue.c b/bgfx/3rdparty/native_app_glue/android_native_app_glue.c new file mode 100644 index 00000000..0c23142e --- /dev/null +++ b/bgfx/3rdparty/native_app_glue/android_native_app_glue.c @@ -0,0 +1,457 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "android_native_app_glue.h" + +#include + +#include +#include +#include +#include + +#include + +#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "threaded_app", __VA_ARGS__)) +#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "threaded_app", __VA_ARGS__)) + +/* For debug builds, always enable the debug traces in this library */ +#ifndef NDEBUG +# define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, "threaded_app", __VA_ARGS__)) +#else +# define LOGV(...) ((void)0) +#endif + +static void free_saved_state(struct android_app* android_app) { + pthread_mutex_lock(&android_app->mutex); + if (android_app->savedState != NULL) { + free(android_app->savedState); + android_app->savedState = NULL; + android_app->savedStateSize = 0; + } + pthread_mutex_unlock(&android_app->mutex); +} + +int8_t android_app_read_cmd(struct android_app* android_app) { + int8_t cmd; + if (read(android_app->msgread, &cmd, sizeof(cmd)) != sizeof(cmd)) { + LOGE("No data on command pipe!"); + return -1; + } + if (cmd == APP_CMD_SAVE_STATE) free_saved_state(android_app); + return cmd; +} + +static void print_cur_config(struct android_app* android_app) { + char lang[2], country[2]; + AConfiguration_getLanguage(android_app->config, lang); + AConfiguration_getCountry(android_app->config, country); + + LOGV("Config: mcc=%d mnc=%d lang=%c%c cnt=%c%c orien=%d touch=%d dens=%d " + "keys=%d nav=%d keysHid=%d navHid=%d sdk=%d size=%d long=%d " + "modetype=%d modenight=%d", + AConfiguration_getMcc(android_app->config), + AConfiguration_getMnc(android_app->config), + lang[0], lang[1], country[0], country[1], + AConfiguration_getOrientation(android_app->config), + AConfiguration_getTouchscreen(android_app->config), + AConfiguration_getDensity(android_app->config), + AConfiguration_getKeyboard(android_app->config), + AConfiguration_getNavigation(android_app->config), + AConfiguration_getKeysHidden(android_app->config), + AConfiguration_getNavHidden(android_app->config), + AConfiguration_getSdkVersion(android_app->config), + AConfiguration_getScreenSize(android_app->config), + AConfiguration_getScreenLong(android_app->config), + AConfiguration_getUiModeType(android_app->config), + AConfiguration_getUiModeNight(android_app->config)); +} + +void android_app_pre_exec_cmd(struct android_app* android_app, int8_t cmd) { + switch (cmd) { + case APP_CMD_INPUT_CHANGED: + LOGV("APP_CMD_INPUT_CHANGED"); + pthread_mutex_lock(&android_app->mutex); + if (android_app->inputQueue != NULL) { + AInputQueue_detachLooper(android_app->inputQueue); + } + android_app->inputQueue = android_app->pendingInputQueue; + if (android_app->inputQueue != NULL) { + LOGV("Attaching input queue to looper"); + AInputQueue_attachLooper(android_app->inputQueue, + android_app->looper, LOOPER_ID_INPUT, NULL, + &android_app->inputPollSource); + } + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + break; + + case APP_CMD_INIT_WINDOW: + LOGV("APP_CMD_INIT_WINDOW"); + pthread_mutex_lock(&android_app->mutex); + android_app->window = android_app->pendingWindow; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + break; + + case APP_CMD_TERM_WINDOW: + LOGV("APP_CMD_TERM_WINDOW"); + pthread_cond_broadcast(&android_app->cond); + break; + + case APP_CMD_RESUME: + case APP_CMD_START: + case APP_CMD_PAUSE: + case APP_CMD_STOP: + LOGV("activityState=%d", cmd); + pthread_mutex_lock(&android_app->mutex); + android_app->activityState = cmd; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + break; + + case APP_CMD_CONFIG_CHANGED: + LOGV("APP_CMD_CONFIG_CHANGED"); + AConfiguration_fromAssetManager(android_app->config, + android_app->activity->assetManager); + print_cur_config(android_app); + break; + + case APP_CMD_DESTROY: + LOGV("APP_CMD_DESTROY"); + android_app->destroyRequested = 1; + break; + } +} + +void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd) { + switch (cmd) { + case APP_CMD_TERM_WINDOW: + LOGV("APP_CMD_TERM_WINDOW"); + pthread_mutex_lock(&android_app->mutex); + android_app->window = NULL; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + break; + + case APP_CMD_SAVE_STATE: + LOGV("APP_CMD_SAVE_STATE"); + pthread_mutex_lock(&android_app->mutex); + android_app->stateSaved = 1; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + break; + + case APP_CMD_RESUME: + free_saved_state(android_app); + break; + } +} + +void app_dummy() { +} + +static void android_app_destroy(struct android_app* android_app) { + LOGV("android_app_destroy!"); + free_saved_state(android_app); + pthread_mutex_lock(&android_app->mutex); + if (android_app->inputQueue != NULL) { + AInputQueue_detachLooper(android_app->inputQueue); + } + AConfiguration_delete(android_app->config); + android_app->destroyed = 1; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + // Can't touch android_app object after this. +} + +static void process_input(struct android_app* app, struct android_poll_source* source) { + AInputEvent* event = NULL; + while (AInputQueue_getEvent(app->inputQueue, &event) >= 0) { + LOGV("New input event: type=%d", AInputEvent_getType(event)); + if (AInputQueue_preDispatchEvent(app->inputQueue, event)) { + continue; + } + int32_t handled = 0; + if (app->onInputEvent != NULL) handled = app->onInputEvent(app, event); + AInputQueue_finishEvent(app->inputQueue, event, handled); + } +} + +static void process_cmd(struct android_app* app, struct android_poll_source* source) { + int8_t cmd = android_app_read_cmd(app); + android_app_pre_exec_cmd(app, cmd); + if (app->onAppCmd != NULL) app->onAppCmd(app, cmd); + android_app_post_exec_cmd(app, cmd); +} + +static void* android_app_entry(void* param) { + struct android_app* android_app = (struct android_app*)param; + + android_app->config = AConfiguration_new(); + AConfiguration_fromAssetManager(android_app->config, android_app->activity->assetManager); + + print_cur_config(android_app); + + android_app->cmdPollSource.id = LOOPER_ID_MAIN; + android_app->cmdPollSource.app = android_app; + android_app->cmdPollSource.process = process_cmd; + android_app->inputPollSource.id = LOOPER_ID_INPUT; + android_app->inputPollSource.app = android_app; + android_app->inputPollSource.process = process_input; + + ALooper* looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS); + ALooper_addFd(looper, android_app->msgread, LOOPER_ID_MAIN, ALOOPER_EVENT_INPUT, NULL, + &android_app->cmdPollSource); + android_app->looper = looper; + + pthread_mutex_lock(&android_app->mutex); + android_app->running = 1; + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + + android_main(android_app); + + android_app_destroy(android_app); + return NULL; +} + +// -------------------------------------------------------------------- +// Native activity interaction (called from main thread) +// -------------------------------------------------------------------- + +static struct android_app* android_app_create(ANativeActivity* activity, + void* savedState, size_t savedStateSize) { + struct android_app* android_app = (struct android_app*)calloc(1, sizeof(struct android_app)); + android_app->activity = activity; + + pthread_mutex_init(&android_app->mutex, NULL); + pthread_cond_init(&android_app->cond, NULL); + + if (savedState != NULL) { + android_app->savedState = malloc(savedStateSize); + android_app->savedStateSize = savedStateSize; + memcpy(android_app->savedState, savedState, savedStateSize); + } + + int msgpipe[2]; + if (pipe(msgpipe)) { + LOGE("could not create pipe: %s", strerror(errno)); + return NULL; + } + android_app->msgread = msgpipe[0]; + android_app->msgwrite = msgpipe[1]; + + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_create(&android_app->thread, &attr, android_app_entry, android_app); + + // Wait for thread to start. + pthread_mutex_lock(&android_app->mutex); + while (!android_app->running) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + pthread_mutex_unlock(&android_app->mutex); + + return android_app; +} + +static void android_app_write_cmd(struct android_app* android_app, int8_t cmd) { + if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) { + LOGE("Failure writing android_app cmd: %s", strerror(errno)); + } +} + +static void android_app_set_input(struct android_app* android_app, AInputQueue* inputQueue) { + pthread_mutex_lock(&android_app->mutex); + android_app->pendingInputQueue = inputQueue; + android_app_write_cmd(android_app, APP_CMD_INPUT_CHANGED); + while (android_app->inputQueue != android_app->pendingInputQueue) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + pthread_mutex_unlock(&android_app->mutex); +} + +static void android_app_set_window(struct android_app* android_app, ANativeWindow* window) { + pthread_mutex_lock(&android_app->mutex); + if (android_app->pendingWindow != NULL) { + android_app_write_cmd(android_app, APP_CMD_TERM_WINDOW); + } + android_app->pendingWindow = window; + if (window != NULL) { + android_app_write_cmd(android_app, APP_CMD_INIT_WINDOW); + } + while (android_app->window != android_app->pendingWindow) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + pthread_mutex_unlock(&android_app->mutex); +} + +static void android_app_set_activity_state(struct android_app* android_app, int8_t cmd) { + pthread_mutex_lock(&android_app->mutex); + android_app_write_cmd(android_app, cmd); + while (android_app->activityState != cmd) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + pthread_mutex_unlock(&android_app->mutex); +} + +static void android_app_free(struct android_app* android_app) { + pthread_mutex_lock(&android_app->mutex); + android_app_write_cmd(android_app, APP_CMD_DESTROY); + while (!android_app->destroyed) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + pthread_mutex_unlock(&android_app->mutex); + + close(android_app->msgread); + close(android_app->msgwrite); + pthread_cond_destroy(&android_app->cond); + pthread_mutex_destroy(&android_app->mutex); + free(android_app); +} + +static struct android_app* ToApp(ANativeActivity* activity) { + return (struct android_app*) activity->instance; +} + +static void onDestroy(ANativeActivity* activity) { + LOGV("Destroy: %p", activity); + android_app_free(ToApp(activity)); +} + +static void onStart(ANativeActivity* activity) { + LOGV("Start: %p", activity); + android_app_set_activity_state(ToApp(activity), APP_CMD_START); +} + +static void onResume(ANativeActivity* activity) { + LOGV("Resume: %p", activity); + android_app_set_activity_state(ToApp(activity), APP_CMD_RESUME); +} + +static void* onSaveInstanceState(ANativeActivity* activity, size_t* outLen) { + LOGV("SaveInstanceState: %p", activity); + + struct android_app* android_app = ToApp(activity); + void* savedState = NULL; + pthread_mutex_lock(&android_app->mutex); + android_app->stateSaved = 0; + android_app_write_cmd(android_app, APP_CMD_SAVE_STATE); + while (!android_app->stateSaved) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + + if (android_app->savedState != NULL) { + savedState = android_app->savedState; + *outLen = android_app->savedStateSize; + android_app->savedState = NULL; + android_app->savedStateSize = 0; + } + + pthread_mutex_unlock(&android_app->mutex); + + return savedState; +} + +static void onPause(ANativeActivity* activity) { + LOGV("Pause: %p", activity); + android_app_set_activity_state(ToApp(activity), APP_CMD_PAUSE); +} + +static void onStop(ANativeActivity* activity) { + LOGV("Stop: %p", activity); + android_app_set_activity_state(ToApp(activity), APP_CMD_STOP); +} + +static void onConfigurationChanged(ANativeActivity* activity) { + LOGV("ConfigurationChanged: %p", activity); + android_app_write_cmd(ToApp(activity), APP_CMD_CONFIG_CHANGED); +} + +static void onContentRectChanged(ANativeActivity* activity, const ARect* r) { + LOGV("ContentRectChanged: l=%d,t=%d,r=%d,b=%d", r->left, r->top, r->right, r->bottom); + struct android_app* android_app = ToApp(activity); + pthread_mutex_lock(&android_app->mutex); + android_app->contentRect = *r; + pthread_mutex_unlock(&android_app->mutex); + android_app_write_cmd(ToApp(activity), APP_CMD_CONTENT_RECT_CHANGED); +} + +static void onLowMemory(ANativeActivity* activity) { + LOGV("LowMemory: %p", activity); + android_app_write_cmd(ToApp(activity), APP_CMD_LOW_MEMORY); +} + +static void onWindowFocusChanged(ANativeActivity* activity, int focused) { + LOGV("WindowFocusChanged: %p -- %d", activity, focused); + android_app_write_cmd(ToApp(activity), focused ? APP_CMD_GAINED_FOCUS : APP_CMD_LOST_FOCUS); +} + +static void onNativeWindowCreated(ANativeActivity* activity, ANativeWindow* window) { + LOGV("NativeWindowCreated: %p -- %p", activity, window); + android_app_set_window(ToApp(activity), window); +} + +static void onNativeWindowDestroyed(ANativeActivity* activity, ANativeWindow* window) { + LOGV("NativeWindowDestroyed: %p -- %p", activity, window); + android_app_set_window(ToApp(activity), NULL); +} + +static void onNativeWindowRedrawNeeded(ANativeActivity* activity, ANativeWindow* window) { + LOGV("NativeWindowRedrawNeeded: %p -- %p", activity, window); + android_app_write_cmd(ToApp(activity), APP_CMD_WINDOW_REDRAW_NEEDED); +} + +static void onNativeWindowResized(ANativeActivity* activity, ANativeWindow* window) { + LOGV("NativeWindowResized: %p -- %p", activity, window); + android_app_write_cmd(ToApp(activity), APP_CMD_WINDOW_RESIZED); +} + +static void onInputQueueCreated(ANativeActivity* activity, AInputQueue* queue) { + LOGV("InputQueueCreated: %p -- %p", activity, queue); + android_app_set_input(ToApp(activity), queue); +} + +static void onInputQueueDestroyed(ANativeActivity* activity, AInputQueue* queue) { + LOGV("InputQueueDestroyed: %p -- %p", activity, queue); + android_app_set_input(ToApp(activity), NULL); +} + +JNIEXPORT +void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_t savedStateSize) { + LOGV("Creating: %p", activity); + + activity->callbacks->onConfigurationChanged = onConfigurationChanged; + activity->callbacks->onContentRectChanged = onContentRectChanged; + activity->callbacks->onDestroy = onDestroy; + activity->callbacks->onInputQueueCreated = onInputQueueCreated; + activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed; + activity->callbacks->onLowMemory = onLowMemory; + activity->callbacks->onNativeWindowCreated = onNativeWindowCreated; + activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed; + activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded; + activity->callbacks->onNativeWindowResized = onNativeWindowResized; + activity->callbacks->onPause = onPause; + activity->callbacks->onResume = onResume; + activity->callbacks->onSaveInstanceState = onSaveInstanceState; + activity->callbacks->onStart = onStart; + activity->callbacks->onStop = onStop; + activity->callbacks->onWindowFocusChanged = onWindowFocusChanged; + + activity->instance = android_app_create(activity, savedState, savedStateSize); +} diff --git a/bgfx/3rdparty/native_app_glue/android_native_app_glue.h b/bgfx/3rdparty/native_app_glue/android_native_app_glue.h new file mode 100644 index 00000000..89eafe3f --- /dev/null +++ b/bgfx/3rdparty/native_app_glue/android_native_app_glue.h @@ -0,0 +1,350 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The native activity interface provided by + * is based on a set of application-provided callbacks that will be called + * by the Activity's main thread when certain events occur. + * + * This means that each one of this callbacks _should_ _not_ block, or they + * risk having the system force-close the application. This programming + * model is direct, lightweight, but constraining. + * + * The 'android_native_app_glue' static library is used to provide a different + * execution model where the application can implement its own main event + * loop in a different thread instead. Here's how it works: + * + * 1/ The application must provide a function named "android_main()" that + * will be called when the activity is created, in a new thread that is + * distinct from the activity's main thread. + * + * 2/ android_main() receives a pointer to a valid "android_app" structure + * that contains references to other important objects, e.g. the + * ANativeActivity obejct instance the application is running in. + * + * 3/ the "android_app" object holds an ALooper instance that already + * listens to two important things: + * + * - activity lifecycle events (e.g. "pause", "resume"). See APP_CMD_XXX + * declarations below. + * + * - input events coming from the AInputQueue attached to the activity. + * + * Each of these correspond to an ALooper identifier returned by + * ALooper_pollOnce with values of LOOPER_ID_MAIN and LOOPER_ID_INPUT, + * respectively. + * + * Your application can use the same ALooper to listen to additional + * file-descriptors. They can either be callback based, or with return + * identifiers starting with LOOPER_ID_USER. + * + * 4/ Whenever you receive a LOOPER_ID_MAIN or LOOPER_ID_INPUT event, + * the returned data will point to an android_poll_source structure. You + * can call the process() function on it, and fill in android_app->onAppCmd + * and android_app->onInputEvent to be called for your own processing + * of the event. + * + * Alternatively, you can call the low-level functions to read and process + * the data directly... look at the process_cmd() and process_input() + * implementations in the glue to see how to do this. + * + * See the sample named "native-activity" that comes with the NDK with a + * full usage example. Also look at the JavaDoc of NativeActivity. + */ + +struct android_app; + +/** + * Data associated with an ALooper fd that will be returned as the "outData" + * when that source has data ready. + */ +struct android_poll_source { + // The identifier of this source. May be LOOPER_ID_MAIN or + // LOOPER_ID_INPUT. + int32_t id; + + // The android_app this ident is associated with. + struct android_app* app; + + // Function to call to perform the standard processing of data from + // this source. + void (*process)(struct android_app* app, struct android_poll_source* source); +}; + +/** + * This is the interface for the standard glue code of a threaded + * application. In this model, the application's code is running + * in its own thread separate from the main thread of the process. + * It is not required that this thread be associated with the Java + * VM, although it will need to be in order to make JNI calls any + * Java objects. + */ +struct android_app { + // The application can place a pointer to its own state object + // here if it likes. + void* userData; + + // Fill this in with the function to process main app commands (APP_CMD_*) + void (*onAppCmd)(struct android_app* app, int32_t cmd); + + // Fill this in with the function to process input events. At this point + // the event has already been pre-dispatched, and it will be finished upon + // return. Return 1 if you have handled the event, 0 for any default + // dispatching. + int32_t (*onInputEvent)(struct android_app* app, AInputEvent* event); + + // The ANativeActivity object instance that this app is running in. + ANativeActivity* activity; + + // The current configuration the app is running in. + AConfiguration* config; + + // This is the last instance's saved state, as provided at creation time. + // It is NULL if there was no state. You can use this as you need; the + // memory will remain around until you call android_app_exec_cmd() for + // APP_CMD_RESUME, at which point it will be freed and savedState set to NULL. + // These variables should only be changed when processing a APP_CMD_SAVE_STATE, + // at which point they will be initialized to NULL and you can malloc your + // state and place the information here. In that case the memory will be + // freed for you later. + void* savedState; + size_t savedStateSize; + + // The ALooper associated with the app's thread. + ALooper* looper; + + // When non-NULL, this is the input queue from which the app will + // receive user input events. + AInputQueue* inputQueue; + + // When non-NULL, this is the window surface that the app can draw in. + ANativeWindow* window; + + // Current content rectangle of the window; this is the area where the + // window's content should be placed to be seen by the user. + ARect contentRect; + + // Current state of the app's activity. May be either APP_CMD_START, + // APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP; see below. + int activityState; + + // This is non-zero when the application's NativeActivity is being + // destroyed and waiting for the app thread to complete. + int destroyRequested; + + // ------------------------------------------------- + // Below are "private" implementation of the glue code. + + pthread_mutex_t mutex; + pthread_cond_t cond; + + int msgread; + int msgwrite; + + pthread_t thread; + + struct android_poll_source cmdPollSource; + struct android_poll_source inputPollSource; + + int running; + int stateSaved; + int destroyed; + int redrawNeeded; + AInputQueue* pendingInputQueue; + ANativeWindow* pendingWindow; + ARect pendingContentRect; +}; + +enum { + /** + * Looper data ID of commands coming from the app's main thread, which + * is returned as an identifier from ALooper_pollOnce(). The data for this + * identifier is a pointer to an android_poll_source structure. + * These can be retrieved and processed with android_app_read_cmd() + * and android_app_exec_cmd(). + */ + LOOPER_ID_MAIN = 1, + + /** + * Looper data ID of events coming from the AInputQueue of the + * application's window, which is returned as an identifier from + * ALooper_pollOnce(). The data for this identifier is a pointer to an + * android_poll_source structure. These can be read via the inputQueue + * object of android_app. + */ + LOOPER_ID_INPUT = 2, + + /** + * Start of user-defined ALooper identifiers. + */ + LOOPER_ID_USER = 3, +}; + +enum { + /** + * Command from main thread: the AInputQueue has changed. Upon processing + * this command, android_app->inputQueue will be updated to the new queue + * (or NULL). + */ + APP_CMD_INPUT_CHANGED, + + /** + * Command from main thread: a new ANativeWindow is ready for use. Upon + * receiving this command, android_app->window will contain the new window + * surface. + */ + APP_CMD_INIT_WINDOW, + + /** + * Command from main thread: the existing ANativeWindow needs to be + * terminated. Upon receiving this command, android_app->window still + * contains the existing window; after calling android_app_exec_cmd + * it will be set to NULL. + */ + APP_CMD_TERM_WINDOW, + + /** + * Command from main thread: the current ANativeWindow has been resized. + * Please redraw with its new size. + */ + APP_CMD_WINDOW_RESIZED, + + /** + * Command from main thread: the system needs that the current ANativeWindow + * be redrawn. You should redraw the window before handing this to + * android_app_exec_cmd() in order to avoid transient drawing glitches. + */ + APP_CMD_WINDOW_REDRAW_NEEDED, + + /** + * Command from main thread: the content area of the window has changed, + * such as from the soft input window being shown or hidden. You can + * find the new content rect in android_app::contentRect. + */ + APP_CMD_CONTENT_RECT_CHANGED, + + /** + * Command from main thread: the app's activity window has gained + * input focus. + */ + APP_CMD_GAINED_FOCUS, + + /** + * Command from main thread: the app's activity window has lost + * input focus. + */ + APP_CMD_LOST_FOCUS, + + /** + * Command from main thread: the current device configuration has changed. + */ + APP_CMD_CONFIG_CHANGED, + + /** + * Command from main thread: the system is running low on memory. + * Try to reduce your memory use. + */ + APP_CMD_LOW_MEMORY, + + /** + * Command from main thread: the app's activity has been started. + */ + APP_CMD_START, + + /** + * Command from main thread: the app's activity has been resumed. + */ + APP_CMD_RESUME, + + /** + * Command from main thread: the app should generate a new saved state + * for itself, to restore from later if needed. If you have saved state, + * allocate it with malloc and place it in android_app.savedState with + * the size in android_app.savedStateSize. The will be freed for you + * later. + */ + APP_CMD_SAVE_STATE, + + /** + * Command from main thread: the app's activity has been paused. + */ + APP_CMD_PAUSE, + + /** + * Command from main thread: the app's activity has been stopped. + */ + APP_CMD_STOP, + + /** + * Command from main thread: the app's activity is being destroyed, + * and waiting for the app thread to clean up and exit before proceeding. + */ + APP_CMD_DESTROY, +}; + +/** + * Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next + * app command message. + */ +int8_t android_app_read_cmd(struct android_app* android_app); + +/** + * Call with the command returned by android_app_read_cmd() to do the + * initial pre-processing of the given command. You can perform your own + * actions for the command after calling this function. + */ +void android_app_pre_exec_cmd(struct android_app* android_app, int8_t cmd); + +/** + * Call with the command returned by android_app_read_cmd() to do the + * final post-processing of the given command. You must have done your own + * actions for the command before calling this function. + */ +void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd); + +/** + * No-op function that used to be used to prevent the linker from stripping app + * glue code. No longer necessary, since __attribute__((visibility("default"))) + * does this for us. + */ +__attribute__(( + deprecated("Calls to app_dummy are no longer necessary. See " + "https://github.com/android-ndk/ndk/issues/381."))) void +app_dummy(); + +/** + * This is the function that application code must implement, representing + * the main entry to the app. + */ +extern void android_main(struct android_app* app); + +#ifdef __cplusplus +} +#endif diff --git a/bgfx/3rdparty/renderdoc/renderdoc_app.h b/bgfx/3rdparty/renderdoc/renderdoc_app.h index 075306c0..402dd3d4 100644 --- a/bgfx/3rdparty/renderdoc/renderdoc_app.h +++ b/bgfx/3rdparty/renderdoc/renderdoc_app.h @@ -1,7 +1,7 @@ /****************************************************************************** * The MIT License (MIT) * - * Copyright (c) 2019-2020 Baldur Karlsson + * Copyright (c) 2019-2022 Baldur Karlsson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -107,15 +107,16 @@ typedef enum RENDERDOC_CaptureOption { // 0 - no callstacks are captured eRENDERDOC_Option_CaptureCallstacks = 3, - // When capturing CPU callstacks, only capture them from drawcalls. + // When capturing CPU callstacks, only capture them from actions. // This option does nothing without the above option being enabled // // Default - disabled // - // 1 - Only captures callstacks for drawcall type API events. + // 1 - Only captures callstacks for actions. // Ignored if CaptureCallstacks is disabled // 0 - Callstacks, if enabled, are captured for every event. eRENDERDOC_Option_CaptureCallstacksOnlyDraws = 4, + eRENDERDOC_Option_CaptureCallstacksOnlyActions = 4, // Specify a delay in seconds to wait for a debugger to attach, after // creating or injecting into a process, before continuing to allow it to run. @@ -451,6 +452,15 @@ typedef uint32_t(RENDERDOC_CC *pRENDERDOC_LaunchReplayUI)(uint32_t connectTarget // ignored and the others will be filled out. typedef void(RENDERDOC_CC *pRENDERDOC_GetAPIVersion)(int *major, int *minor, int *patch); +// Requests that the replay UI show itself (if hidden or not the current top window). This can be +// used in conjunction with IsTargetControlConnected and LaunchReplayUI to intelligently handle +// showing the UI after making a capture. +// +// This will return 1 if the request was successfully passed on, though it's not guaranteed that +// the UI will be on top in all cases depending on OS rules. It will return 0 if there is no current +// target control connection to make such a request, or if there was another error +typedef uint32_t(RENDERDOC_CC *pRENDERDOC_ShowReplayUI)(); + ////////////////////////////////////////////////////////////////////////// // Capturing functions // @@ -524,6 +534,16 @@ typedef uint32_t(RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(RENDERDOC_DevicePoint typedef uint32_t(RENDERDOC_CC *pRENDERDOC_DiscardFrameCapture)(RENDERDOC_DevicePointer device, RENDERDOC_WindowHandle wndHandle); +// Only valid to be called between a call to StartFrameCapture and EndFrameCapture. Gives a custom +// title to the capture produced which will be displayed in the UI. +// +// If multiple captures are ongoing, this title will be applied to the first capture to end after +// this call. The second capture to end will have no title, unless this function is called again. +// +// Calling this function has no effect if no capture is currently running, and if it is called +// multiple times only the last title will be used. +typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureTitle)(const char *title); + ////////////////////////////////////////////////////////////////////////////////////////////////// // RenderDoc API versions // @@ -548,6 +568,9 @@ typedef enum RENDERDOC_Version { eRENDERDOC_API_Version_1_3_0 = 10300, // RENDERDOC_API_1_3_0 = 1 03 00 eRENDERDOC_API_Version_1_4_0 = 10400, // RENDERDOC_API_1_4_0 = 1 04 00 eRENDERDOC_API_Version_1_4_1 = 10401, // RENDERDOC_API_1_4_1 = 1 04 01 + eRENDERDOC_API_Version_1_4_2 = 10402, // RENDERDOC_API_1_4_2 = 1 04 02 + eRENDERDOC_API_Version_1_5_0 = 10500, // RENDERDOC_API_1_5_0 = 1 05 00 + eRENDERDOC_API_Version_1_6_0 = 10600, // RENDERDOC_API_1_6_0 = 1 06 00 } RENDERDOC_Version; // API version changelog: @@ -574,8 +597,12 @@ typedef enum RENDERDOC_Version { // 1.4.0 - Added feature: DiscardFrameCapture() to discard a frame capture in progress and stop // capturing without saving anything to disk. // 1.4.1 - Refactor: Renamed Shutdown to RemoveHooks to better clarify what is happening +// 1.4.2 - Refactor: Renamed 'draws' to 'actions' in callstack capture option. +// 1.5.0 - Added feature: ShowReplayUI() to request that the replay UI show itself if connected +// 1.6.0 - Added feature: SetCaptureTitle() which can be used to set a title for a +// capture made with StartFrameCapture() or EndFrameCapture() -typedef struct RENDERDOC_API_1_4_1 +typedef struct RENDERDOC_API_1_6_0 { pRENDERDOC_GetAPIVersion GetAPIVersion; @@ -647,17 +674,26 @@ typedef struct RENDERDOC_API_1_4_1 // new function in 1.4.0 pRENDERDOC_DiscardFrameCapture DiscardFrameCapture; -} RENDERDOC_API_1_4_1; - -typedef RENDERDOC_API_1_4_1 RENDERDOC_API_1_0_0; -typedef RENDERDOC_API_1_4_1 RENDERDOC_API_1_0_1; -typedef RENDERDOC_API_1_4_1 RENDERDOC_API_1_0_2; -typedef RENDERDOC_API_1_4_1 RENDERDOC_API_1_1_0; -typedef RENDERDOC_API_1_4_1 RENDERDOC_API_1_1_1; -typedef RENDERDOC_API_1_4_1 RENDERDOC_API_1_1_2; -typedef RENDERDOC_API_1_4_1 RENDERDOC_API_1_2_0; -typedef RENDERDOC_API_1_4_1 RENDERDOC_API_1_3_0; -typedef RENDERDOC_API_1_4_1 RENDERDOC_API_1_4_0; + + // new function in 1.5.0 + pRENDERDOC_ShowReplayUI ShowReplayUI; + + // new function in 1.6.0 + pRENDERDOC_SetCaptureTitle SetCaptureTitle; +} RENDERDOC_API_1_6_0; + +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_0_0; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_0_1; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_0_2; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_1_0; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_1_1; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_1_2; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_2_0; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_3_0; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_4_0; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_4_1; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_4_2; +typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_5_0; ////////////////////////////////////////////////////////////////////////////////////////////////// // RenderDoc API entry point diff --git a/bgfx/3rdparty/spirv-cross/main.cpp b/bgfx/3rdparty/spirv-cross/main.cpp index e83284a0..d8aff152 100644 --- a/bgfx/3rdparty/spirv-cross/main.cpp +++ b/bgfx/3rdparty/spirv-cross/main.cpp @@ -536,6 +536,7 @@ static void print_resources(const Compiler &compiler, const ShaderResources &res print_resources(compiler, "push", res.push_constant_buffers); print_resources(compiler, "counters", res.atomic_counters); print_resources(compiler, "acceleration structures", res.acceleration_structures); + print_resources(compiler, "record buffers", res.shader_record_buffers); print_resources(compiler, spv::StorageClassInput, res.builtin_inputs); print_resources(compiler, spv::StorageClassOutput, res.builtin_outputs); } @@ -612,6 +613,12 @@ struct InterfaceVariableRename string variable_name; }; +struct HLSLVertexAttributeRemapNamed +{ + std::string name; + std::string semantic; +}; + struct CLIArguments { const char *input = nullptr; @@ -638,6 +645,7 @@ struct CLIArguments bool msl_pad_fragment_output = false; bool msl_domain_lower_left = false; bool msl_argument_buffers = false; + uint32_t msl_argument_buffers_tier = 0; // Tier 1 bool msl_texture_buffer_native = false; bool msl_framebuffer_fetch = false; bool msl_invariant_float_math = false; @@ -653,6 +661,7 @@ struct CLIArguments bool msl_enable_frag_stencil_ref_builtin = true; uint32_t msl_enable_frag_output_mask = 0xffffffff; bool msl_enable_clip_distance_user_varying = true; + bool msl_raw_buffer_tese_input = false; bool msl_multi_patch_workgroup = false; bool msl_vertex_for_tessellation = false; uint32_t msl_additional_fixed_sample_mask = 0xffffffff; @@ -664,6 +673,10 @@ struct CLIArguments bool msl_emulate_subgroups = false; uint32_t msl_fixed_subgroup_size = 0; bool msl_force_sample_rate_shading = false; + bool msl_manual_helper_invocation_updates = true; + bool msl_check_discarded_frag_stores = false; + bool msl_sample_dref_lod_array_as_grad = false; + bool msl_runtime_array_rich_descriptor = false; const char *msl_combined_sampler_suffix = nullptr; bool glsl_emit_push_constant_as_ubo = false; bool glsl_emit_ubo_as_plain_uniforms = false; @@ -690,6 +703,7 @@ struct CLIArguments SmallVector variable_type_remaps; SmallVector interface_variable_renames; SmallVector hlsl_attr_remap; + SmallVector hlsl_attr_remap_named; SmallVector> masked_stage_outputs; SmallVector masked_stage_builtins; string entry; @@ -709,11 +723,17 @@ struct CLIArguments bool msl = false; bool hlsl = false; bool hlsl_compat = false; + bool hlsl_support_nonzero_base = false; + bool hlsl_base_vertex_index_explicit_binding = false; + uint32_t hlsl_base_vertex_index_register_index = 0; + uint32_t hlsl_base_vertex_index_register_space = 0; + bool hlsl_force_storage_buffer_as_uav = false; bool hlsl_nonwritable_uav_texture_as_srv = false; bool hlsl_enable_16bit_types = false; bool hlsl_flatten_matrix_vertex_input_semantics = false; + bool hlsl_preserve_structured_buffers = false; HLSLBindingFlags hlsl_binding_flags = 0; bool vulkan_semantics = false; bool flatten_multidimensional_arrays = false; @@ -806,6 +826,7 @@ static void print_help_hlsl() "\t\tPointSize is ignored, and PointCoord returns (0.5, 0.5).\n" "\t[--hlsl-support-nonzero-basevertex-baseinstance]:\n\t\tSupport base vertex and base instance by emitting a special cbuffer declared as:\n" "\t\tcbuffer SPIRV_Cross_VertexInfo { int SPIRV_Cross_BaseVertex; int SPIRV_Cross_BaseInstance; };\n" + "\t[--hlsl-basevertex-baseinstance-binding ]:\n\t\tAssign a fixed binding to SPIRV_Cross_VertexInfo.\n" "\t[--hlsl-auto-binding (push, cbv, srv, uav, sampler, all)]\n" "\t\tDo not emit any : register(#) bindings for specific resource types, and rely on HLSL compiler to assign something.\n" "\t[--hlsl-force-storage-buffer-as-uav]:\n\t\tAlways emit SSBOs as UAVs, even when marked as read-only.\n" @@ -816,8 +837,11 @@ static void print_help_hlsl() "\t\tShader must ensure that read/write state is consistent at all call sites.\n" "\t[--set-hlsl-vertex-input-semantic ]:\n\t\tEmits a specific vertex input semantic for a given location.\n" "\t\tOtherwise, TEXCOORD# is used as semantics, where # is location.\n" + "\t[--set-hlsl-named-vertex-input-semantic ]:\n\t\tEmits a specific vertex input semantic for a given name.\n" + "\t\tOpName reflection information must be intact.\n" "\t[--hlsl-enable-16bit-types]:\n\t\tEnables native use of half/int16_t/uint16_t and ByteAddressBuffer interaction with these types. Requires SM 6.2.\n" "\t[--hlsl-flatten-matrix-vertex-input-semantics]:\n\t\tEmits matrix vertex inputs with input semantics as if they were independent vectors, e.g. TEXCOORD{2,3,4} rather than matrix form TEXCOORD2_{0,1,2}.\n" + "\t[--hlsl-preserve-structured-buffers]:\n\t\tEmit SturucturedBuffer rather than ByteAddressBuffer. Requires UserTypeGOOGLE to be emitted. Intended for DXC roundtrips.\n" ); // clang-format on } @@ -837,8 +861,12 @@ static void print_help_msl() "\t[--msl-pad-fragment-output]:\n\t\tAlways emit color outputs as 4-component variables.\n" "\t\tIn Metal, the fragment shader must emit at least as many components as the render target format.\n" "\t[--msl-domain-lower-left]:\n\t\tUse a lower-left tessellation domain.\n" - "\t[--msl-argument-buffers]:\n\t\tEmit Indirect Argument buffers instead of plain bindings.\n" + "\t[--msl-argument-buffers]:\n\t\tEmit Metal argument buffers instead of discrete resource bindings.\n" "\t\tRequires MSL 2.0 to be enabled.\n" + "\t[--msl-argument-buffer-tier]:\n\t\tWhen using Metal argument buffers, indicate the Metal argument buffer tier level supported by the Metal platform.\n" + "\t\tUses same values as Metal MTLArgumentBuffersTier enumeration (0 = Tier1, 1 = Tier2).\n" + "\t\tNOTE: Setting this value no longer enables msl-argument-buffers implicitly.\n" + "\t[--msl-runtime-array-rich-descriptor]:\n\t\tWhen declaring a runtime array of SSBOs, declare an array of {ptr, len} pairs to support OpArrayLength.\n" "\t[--msl-texture-buffer-native]:\n\t\tEnable native support for texel buffers. Otherwise, it is emulated as a normal texture.\n" "\t[--msl-framebuffer-fetch]:\n\t\tImplement subpass inputs with frame buffer fetch.\n" "\t\tEmits [[color(N)]] inputs in fragment stage.\n" @@ -871,20 +899,33 @@ static void print_help_msl() "\t[--msl-disable-frag-stencil-ref-builtin]:\n\t\tDisable FragStencilRef output. Useful if pipeline does not enable stencil output, as pipeline creation might otherwise fail.\n" "\t[--msl-enable-frag-output-mask ]:\n\t\tOnly selectively enable fragment outputs. Useful if pipeline does not enable fragment output for certain locations, as pipeline creation might otherwise fail.\n" "\t[--msl-no-clip-distance-user-varying]:\n\t\tDo not emit user varyings to emulate gl_ClipDistance in fragment shaders.\n" - "\t[--msl-shader-input ]:\n\t\tSpecify the format of the shader input at .\n" + "\t[--msl-add-shader-input ]:\n\t\tSpecify the format of the shader input at .\n" "\t\t can be 'any32', 'any16', 'u16', 'u8', or 'other', to indicate a 32-bit opaque value, 16-bit opaque value, 16-bit unsigned integer, 8-bit unsigned integer, " - "or other-typed variable. is the vector length of the variable, which must be greater than or equal to that declared in the shader.\n" + "or other-typed variable. is the vector length of the variable, which must be greater than or equal to that declared in the shader. can be 'vertex', " + "'primitive', or 'patch' to indicate a per-vertex, per-primitive, or per-patch variable.\n" "\t\tUseful if shader stage interfaces don't match up, as pipeline creation might otherwise fail.\n" - "\t[--msl-shader-output ]:\n\t\tSpecify the format of the shader output at .\n" + "\t[--msl-add-shader-output ]:\n\t\tSpecify the format of the shader output at .\n" "\t\t can be 'any32', 'any16', 'u16', 'u8', or 'other', to indicate a 32-bit opaque value, 16-bit opaque value, 16-bit unsigned integer, 8-bit unsigned integer, " - "or other-typed variable. is the vector length of the variable, which must be greater than or equal to that declared in the shader.\n" + "or other-typed variable. is the vector length of the variable, which must be greater than or equal to that declared in the shader. can be 'vertex', " + "'primitive', or 'patch' to indicate a per-vertex, per-primitive, or per-patch variable.\n" "\t\tUseful if shader stage interfaces don't match up, as pipeline creation might otherwise fail.\n" + "\t[--msl-shader-input ]:\n\t\tSpecify the format of the shader input at .\n" + "\t\t can be 'any32', 'any16', 'u16', 'u8', or 'other', to indicate a 32-bit opaque value, 16-bit opaque value, 16-bit unsigned integer, 8-bit unsigned integer, " + "or other-typed variable. is the vector length of the variable, which must be greater than or equal to that declared in the shader." + "\t\tEquivalent to --msl-add-shader-input with a rate of 'vertex'.\n" + "\t[--msl-shader-output ]:\n\t\tSpecify the format of the shader output at .\n" + "\t\t can be 'any32', 'any16', 'u16', 'u8', or 'other', to indicate a 32-bit opaque value, 16-bit opaque value, 16-bit unsigned integer, 8-bit unsigned integer, " + "or other-typed variable. is the vector length of the variable, which must be greater than or equal to that declared in the shader." + "\t\tEquivalent to --msl-add-shader-output with a rate of 'vertex'.\n" + "\t[--msl-raw-buffer-tese-input]:\n\t\tUse raw buffers for tessellation evaluation input.\n" + "\t\tThis allows the use of nested structures and arrays.\n" + "\t\tIn a future version of SPIRV-Cross, this will become the default.\n" "\t[--msl-multi-patch-workgroup]:\n\t\tUse the new style of tessellation control processing, where multiple patches are processed per workgroup.\n" - "\t\tThis should increase throughput by ensuring all the GPU's SIMD lanes are occupied, but it is not compatible with the old style.\n" - "\t\tIn addition, this style also passes input variables in buffers directly instead of using vertex attribute processing.\n" - "\t\tIn a future version of SPIRV-Cross, this will become the default.\n" + "\t\tThis should increase throughput by ensuring all the GPU's SIMD lanes are occupied, but it is not compatible with the old style.\n" + "\t\tIn addition, this style also passes input variables in buffers directly instead of using vertex attribute processing.\n" + "\t\tIn a future version of SPIRV-Cross, this will become the default.\n" "\t[--msl-vertex-for-tessellation]:\n\t\tWhen handling a vertex shader, marks it as one that will be used with a new-style tessellation control shader.\n" - "\t\tThe vertex shader is output to MSL as a compute kernel which outputs vertices to the buffer in the order they are received, rather than in index order as with --msl-capture-output normally.\n" + "\t\tThe vertex shader is output to MSL as a compute kernel which outputs vertices to the buffer in the order they are received, rather than in index order as with --msl-capture-output normally.\n" "\t[--msl-additional-fixed-sample-mask ]:\n" "\t\tSet an additional fixed sample mask. If the shader outputs a sample mask, then the final sample mask will be a bitwise AND of the two.\n" "\t[--msl-arrayed-subpass-input]:\n\t\tAssume that images of dimension SubpassData have multiple layers. Layered input attachments are accessed relative to BuiltInLayer.\n" @@ -904,6 +945,17 @@ static void print_help_msl() "\t\tIf 0, assume variable subgroup size as actually exposed by Metal.\n" "\t[--msl-force-sample-rate-shading]:\n\t\tForce fragment shaders to run per sample.\n" "\t\tThis adds a [[sample_id]] parameter if none is already present.\n" + "\t[--msl-no-manual-helper-invocation-updates]:\n\t\tDo not manually update the HelperInvocation builtin when a fragment is discarded.\n" + "\t\tSome Metal devices have a bug where simd_is_helper_thread() does not return true\n" + "\t\tafter the fragment is discarded. This behavior is required by Vulkan and SPIR-V, however.\n" + "\t[--msl-check-discarded-frag-stores]:\n\t\tAdd additional checks to resource stores in a fragment shader.\n" + "\t\tSome Metal devices have a bug where stores to resources from a fragment shader\n" + "\t\tcontinue to execute, even when the fragment is discarded. These checks\n" + "\t\tprevent these stores from executing.\n" + "\t[--msl-sample-dref-lod-array-as-grad]:\n\t\tUse a gradient instead of a level argument.\n" + "\t\tSome Metal devices have a bug where the level() argument to\n" + "\t\tdepth2d_array::sample_compare() in a fragment shader is biased by some\n" + "\t\tunknown amount. This prevents the bias from being added.\n" "\t[--msl-combined-sampler-suffix ]:\n\t\tUses a custom suffix for combined samplers.\n"); // clang-format on } @@ -1151,6 +1203,7 @@ static string compile_iteration(const CLIArguments &args, std::vector msl_opts.pad_fragment_output_components = args.msl_pad_fragment_output; msl_opts.tess_domain_origin_lower_left = args.msl_domain_lower_left; msl_opts.argument_buffers = args.msl_argument_buffers; + msl_opts.argument_buffers_tier = static_cast(args.msl_argument_buffers_tier); msl_opts.texture_buffer_native = args.msl_texture_buffer_native; msl_opts.multiview = args.msl_multiview; msl_opts.multiview_layered_rendering = args.msl_multiview_layered_rendering; @@ -1163,6 +1216,7 @@ static string compile_iteration(const CLIArguments &args, std::vector msl_opts.enable_frag_stencil_ref_builtin = args.msl_enable_frag_stencil_ref_builtin; msl_opts.enable_frag_output_mask = args.msl_enable_frag_output_mask; msl_opts.enable_clip_distance_user_varying = args.msl_enable_clip_distance_user_varying; + msl_opts.raw_buffer_tese_input = args.msl_raw_buffer_tese_input; msl_opts.multi_patch_workgroup = args.msl_multi_patch_workgroup; msl_opts.vertex_for_tessellation = args.msl_vertex_for_tessellation; msl_opts.additional_fixed_sample_mask = args.msl_additional_fixed_sample_mask; @@ -1174,7 +1228,11 @@ static string compile_iteration(const CLIArguments &args, std::vector msl_opts.emulate_subgroups = args.msl_emulate_subgroups; msl_opts.fixed_subgroup_size = args.msl_fixed_subgroup_size; msl_opts.force_sample_rate_shading = args.msl_force_sample_rate_shading; + msl_opts.manual_helper_invocation_updates = args.msl_manual_helper_invocation_updates; + msl_opts.check_discarded_frag_stores = args.msl_check_discarded_frag_stores; + msl_opts.sample_dref_lod_array_as_grad = args.msl_sample_dref_lod_array_as_grad; msl_opts.ios_support_base_vertex_instance = true; + msl_opts.runtime_array_rich_descriptor = args.msl_runtime_array_rich_descriptor; msl_comp->set_msl_options(msl_opts); for (auto &v : args.msl_discrete_descriptor_sets) msl_comp->add_discrete_descriptor_set(v); @@ -1368,8 +1426,15 @@ static string compile_iteration(const CLIArguments &args, std::vector hlsl_opts.nonwritable_uav_texture_as_srv = args.hlsl_nonwritable_uav_texture_as_srv; hlsl_opts.enable_16bit_types = args.hlsl_enable_16bit_types; hlsl_opts.flatten_matrix_vertex_input_semantics = args.hlsl_flatten_matrix_vertex_input_semantics; + hlsl_opts.preserve_structured_buffers = args.hlsl_preserve_structured_buffers; hlsl->set_hlsl_options(hlsl_opts); hlsl->set_resource_binding_flags(args.hlsl_binding_flags); + if (args.hlsl_base_vertex_index_explicit_binding) + { + hlsl->set_hlsl_aux_buffer_binding(HLSL_AUX_BINDING_BASE_VERTEX_INSTANCE, + args.hlsl_base_vertex_index_register_index, + args.hlsl_base_vertex_index_register_space); + } } if (build_dummy_sampler) @@ -1457,6 +1522,22 @@ static string compile_iteration(const CLIArguments &args, std::vector { for (auto &remap : args.hlsl_attr_remap) static_cast(compiler.get())->add_vertex_attribute_remap(remap); + + for (auto &named_remap : args.hlsl_attr_remap_named) + { + auto itr = std::find_if(res.stage_inputs.begin(), res.stage_inputs.end(), [&](const Resource &input_res) { + return input_res.name == named_remap.name; + }); + + if (itr != res.stage_inputs.end()) + { + HLSLVertexAttributeRemap remap = { + compiler->get_decoration(itr->id, DecorationLocation), + named_remap.semantic, + }; + static_cast(compiler.get())->add_vertex_attribute_remap(remap); + } + } } auto ret = compiler->compile(); @@ -1532,6 +1613,11 @@ static int main_inner(int argc, char *argv[]) cbs.add("--hlsl-enable-compat", [&args](CLIParser &) { args.hlsl_compat = true; }); cbs.add("--hlsl-support-nonzero-basevertex-baseinstance", [&args](CLIParser &) { args.hlsl_support_nonzero_base = true; }); + cbs.add("--hlsl-basevertex-baseinstance-binding", [&args](CLIParser &parser) { + args.hlsl_base_vertex_index_explicit_binding = true; + args.hlsl_base_vertex_index_register_index = parser.next_uint(); + args.hlsl_base_vertex_index_register_space = parser.next_uint(); + }); cbs.add("--hlsl-auto-binding", [&args](CLIParser &parser) { args.hlsl_binding_flags |= hlsl_resource_type_to_flag(parser.next_string()); }); @@ -1542,6 +1628,7 @@ static int main_inner(int argc, char *argv[]) cbs.add("--hlsl-enable-16bit-types", [&args](CLIParser &) { args.hlsl_enable_16bit_types = true; }); cbs.add("--hlsl-flatten-matrix-vertex-input-semantics", [&args](CLIParser &) { args.hlsl_flatten_matrix_vertex_input_semantics = true; }); + cbs.add("--hlsl-preserve-structured-buffers", [&args](CLIParser &) { args.hlsl_preserve_structured_buffers = true; }); cbs.add("--vulkan-semantics", [&args](CLIParser &) { args.vulkan_semantics = true; }); cbs.add("-V", [&args](CLIParser &) { args.vulkan_semantics = true; }); cbs.add("--flatten-multidimensional-arrays", [&args](CLIParser &) { args.flatten_multidimensional_arrays = true; }); @@ -1552,6 +1639,8 @@ static int main_inner(int argc, char *argv[]) cbs.add("--msl-pad-fragment-output", [&args](CLIParser &) { args.msl_pad_fragment_output = true; }); cbs.add("--msl-domain-lower-left", [&args](CLIParser &) { args.msl_domain_lower_left = true; }); cbs.add("--msl-argument-buffers", [&args](CLIParser &) { args.msl_argument_buffers = true; }); + cbs.add("--msl-argument-buffer-tier", + [&args](CLIParser &parser) { args.msl_argument_buffers_tier = parser.next_uint(); }); cbs.add("--msl-discrete-descriptor-set", [&args](CLIParser &parser) { args.msl_discrete_descriptor_sets.push_back(parser.next_uint()); }); cbs.add("--msl-device-argument-buffer", @@ -1591,6 +1680,56 @@ static int main_inner(int argc, char *argv[]) [&args](CLIParser &parser) { args.msl_enable_frag_output_mask = parser.next_hex_uint(); }); cbs.add("--msl-no-clip-distance-user-varying", [&args](CLIParser &) { args.msl_enable_clip_distance_user_varying = false; }); + cbs.add("--msl-add-shader-input", [&args](CLIParser &parser) { + MSLShaderInterfaceVariable input; + // Make sure next_uint() is called in-order. + input.location = parser.next_uint(); + const char *format = parser.next_value_string("other"); + if (strcmp(format, "any32") == 0) + input.format = MSL_SHADER_VARIABLE_FORMAT_ANY32; + else if (strcmp(format, "any16") == 0) + input.format = MSL_SHADER_VARIABLE_FORMAT_ANY16; + else if (strcmp(format, "u16") == 0) + input.format = MSL_SHADER_VARIABLE_FORMAT_UINT16; + else if (strcmp(format, "u8") == 0) + input.format = MSL_SHADER_VARIABLE_FORMAT_UINT8; + else + input.format = MSL_SHADER_VARIABLE_FORMAT_OTHER; + input.vecsize = parser.next_uint(); + const char *rate = parser.next_value_string("vertex"); + if (strcmp(rate, "primitive") == 0) + input.rate = MSL_SHADER_VARIABLE_RATE_PER_PRIMITIVE; + else if (strcmp(rate, "patch") == 0) + input.rate = MSL_SHADER_VARIABLE_RATE_PER_PATCH; + else + input.rate = MSL_SHADER_VARIABLE_RATE_PER_VERTEX; + args.msl_shader_inputs.push_back(input); + }); + cbs.add("--msl-add-shader-output", [&args](CLIParser &parser) { + MSLShaderInterfaceVariable output; + // Make sure next_uint() is called in-order. + output.location = parser.next_uint(); + const char *format = parser.next_value_string("other"); + if (strcmp(format, "any32") == 0) + output.format = MSL_SHADER_VARIABLE_FORMAT_ANY32; + else if (strcmp(format, "any16") == 0) + output.format = MSL_SHADER_VARIABLE_FORMAT_ANY16; + else if (strcmp(format, "u16") == 0) + output.format = MSL_SHADER_VARIABLE_FORMAT_UINT16; + else if (strcmp(format, "u8") == 0) + output.format = MSL_SHADER_VARIABLE_FORMAT_UINT8; + else + output.format = MSL_SHADER_VARIABLE_FORMAT_OTHER; + output.vecsize = parser.next_uint(); + const char *rate = parser.next_value_string("vertex"); + if (strcmp(rate, "primitive") == 0) + output.rate = MSL_SHADER_VARIABLE_RATE_PER_PRIMITIVE; + else if (strcmp(rate, "patch") == 0) + output.rate = MSL_SHADER_VARIABLE_RATE_PER_PATCH; + else + output.rate = MSL_SHADER_VARIABLE_RATE_PER_VERTEX; + args.msl_shader_outputs.push_back(output); + }); cbs.add("--msl-shader-input", [&args](CLIParser &parser) { MSLShaderInterfaceVariable input; // Make sure next_uint() is called in-order. @@ -1627,6 +1766,7 @@ static int main_inner(int argc, char *argv[]) output.vecsize = parser.next_uint(); args.msl_shader_outputs.push_back(output); }); + cbs.add("--msl-raw-buffer-tese-input", [&args](CLIParser &) { args.msl_raw_buffer_tese_input = true; }); cbs.add("--msl-multi-patch-workgroup", [&args](CLIParser &) { args.msl_multi_patch_workgroup = true; }); cbs.add("--msl-vertex-for-tessellation", [&args](CLIParser &) { args.msl_vertex_for_tessellation = true; }); cbs.add("--msl-additional-fixed-sample-mask", @@ -1642,9 +1782,16 @@ static int main_inner(int argc, char *argv[]) cbs.add("--msl-fixed-subgroup-size", [&args](CLIParser &parser) { args.msl_fixed_subgroup_size = parser.next_uint(); }); cbs.add("--msl-force-sample-rate-shading", [&args](CLIParser &) { args.msl_force_sample_rate_shading = true; }); + cbs.add("--msl-no-manual-helper-invocation-updates", + [&args](CLIParser &) { args.msl_manual_helper_invocation_updates = false; }); + cbs.add("--msl-check-discarded-frag-stores", [&args](CLIParser &) { args.msl_check_discarded_frag_stores = true; }); + cbs.add("--msl-sample-dref-lod-array-as-grad", + [&args](CLIParser &) { args.msl_sample_dref_lod_array_as_grad = true; }); cbs.add("--msl-combined-sampler-suffix", [&args](CLIParser &parser) { args.msl_combined_sampler_suffix = parser.next_string(); }); + cbs.add("--msl-runtime-array-rich-descriptor", + [&args](CLIParser &) { args.msl_runtime_array_rich_descriptor = true; }); cbs.add("--extension", [&args](CLIParser &parser) { args.extensions.push_back(parser.next_string()); }); cbs.add("--rename-entry-point", [&args](CLIParser &parser) { auto old_name = parser.next_string(); @@ -1661,6 +1808,12 @@ static int main_inner(int argc, char *argv[]) remap.semantic = parser.next_string(); args.hlsl_attr_remap.push_back(std::move(remap)); }); + cbs.add("--set-hlsl-named-vertex-input-semantic", [&args](CLIParser &parser) { + HLSLVertexAttributeRemapNamed remap; + remap.name = parser.next_string(); + remap.semantic = parser.next_string(); + args.hlsl_attr_remap_named.push_back(std::move(remap)); + }); cbs.add("--remap", [&args](CLIParser &parser) { string src = parser.next_string(); diff --git a/bgfx/3rdparty/spirv-cross/spirv_common.hpp b/bgfx/3rdparty/spirv-cross/spirv_common.hpp index 5c2ad747..3bf55833 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_common.hpp +++ b/bgfx/3rdparty/spirv-cross/spirv_common.hpp @@ -643,7 +643,9 @@ struct SPIRExtension : IVariant SPV_AMD_shader_explicit_vertex_parameter, SPV_AMD_shader_trinary_minmax, SPV_AMD_gcn_shader, - NonSemanticDebugPrintf + NonSemanticDebugPrintf, + NonSemanticShaderDebugInfo, + NonSemanticGeneric }; explicit SPIRExtension(Extension ext_) @@ -727,6 +729,9 @@ struct SPIRExpression : IVariant // Whether or not this is an access chain expression. bool access_chain = false; + // Whether or not gl_MeshVerticesEXT[].gl_Position (as a whole or .y) is referenced + bool access_meshlet_position_y = false; + // A list of expressions which this expression depends on. SmallVector expression_dependencies; @@ -1578,6 +1583,7 @@ struct AccessChainMeta bool storage_is_invariant = false; bool flattened_struct = false; bool relaxed_precision = false; + bool access_meshlet_position_y = false; }; enum ExtendedDecorations @@ -1661,6 +1667,7 @@ struct Meta std::string alias; std::string qualified_alias; std::string hlsl_semantic; + std::string user_type; Bitset decoration_flags; spv::BuiltIn builtin_type = spv::BuiltInMax; uint32_t location = 0; @@ -1796,6 +1803,33 @@ static inline bool opcode_is_sign_invariant(spv::Op opcode) } } +static inline bool opcode_can_promote_integer_implicitly(spv::Op opcode) +{ + switch (opcode) + { + case spv::OpSNegate: + case spv::OpNot: + case spv::OpBitwiseAnd: + case spv::OpBitwiseOr: + case spv::OpBitwiseXor: + case spv::OpShiftLeftLogical: + case spv::OpShiftRightLogical: + case spv::OpShiftRightArithmetic: + case spv::OpIAdd: + case spv::OpISub: + case spv::OpIMul: + case spv::OpSDiv: + case spv::OpUDiv: + case spv::OpSRem: + case spv::OpUMod: + case spv::OpSMod: + return true; + + default: + return false; + } +} + struct SetBindingPair { uint32_t desc_set; diff --git a/bgfx/3rdparty/spirv-cross/spirv_cpp.cpp b/bgfx/3rdparty/spirv-cross/spirv_cpp.cpp index 8d934d2c..dd0a84c8 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_cpp.cpp +++ b/bgfx/3rdparty/spirv-cross/spirv_cpp.cpp @@ -274,8 +274,6 @@ void CompilerCPP::emit_resources() if (emitted) statement(""); - declare_undefined_values(); - statement("inline void init(spirv_cross_shader& s)"); begin_scope(); statement(resource_type, "::init(s);"); diff --git a/bgfx/3rdparty/spirv-cross/spirv_cross.cpp b/bgfx/3rdparty/spirv-cross/spirv_cross.cpp index 3f30ee93..c1c6a11d 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_cross.cpp +++ b/bgfx/3rdparty/spirv-cross/spirv_cross.cpp @@ -630,6 +630,14 @@ bool Compiler::is_array(const SPIRType &type) const return !type.array.empty(); } +bool Compiler::is_runtime_size_array(const SPIRType &type) +{ + if (type.array.empty()) + return false; + assert(type.array.size() == type.array_size_literal.size()); + return type.array_size_literal.back() && type.array.back() == 0; +} + ShaderResources Compiler::get_shader_resources() const { return get_shader_resources(nullptr); @@ -725,7 +733,7 @@ bool Compiler::InterfaceVariableAccessHandler::handle(Op opcode, const uint32_t case OpExtInst: { - if (length < 5) + if (length < 3) return false; auto &extension_set = compiler.get(args[2]); switch (extension_set.ext) @@ -991,37 +999,49 @@ ShaderResources Compiler::get_shader_resources(const unordered_set * // in the future. res.push_constant_buffers.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); } - // Images - else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::Image && - type.image.sampled == 2) - { - res.storage_images.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); - } - // Separate images - else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::Image && - type.image.sampled == 1) - { - res.separate_images.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); - } - // Separate samplers - else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::Sampler) - { - res.separate_samplers.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); - } - // Textures - else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::SampledImage) + else if (type.storage == StorageClassShaderRecordBufferKHR) { - res.sampled_images.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); + res.shader_record_buffers.push_back({ var.self, var.basetype, type.self, get_remapped_declared_block_name(var.self, ssbo_instance_name) }); } // Atomic counters else if (type.storage == StorageClassAtomicCounter) { res.atomic_counters.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); } - // Acceleration structures - else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::AccelerationStructure) + else if (type.storage == StorageClassUniformConstant) { - res.acceleration_structures.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); + if (type.basetype == SPIRType::Image) + { + // Images + if (type.image.sampled == 2) + { + res.storage_images.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); + } + // Separate images + else if (type.image.sampled == 1) + { + res.separate_images.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); + } + } + // Separate samplers + else if (type.basetype == SPIRType::Sampler) + { + res.separate_samplers.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); + } + // Textures + else if (type.basetype == SPIRType::SampledImage) + { + res.sampled_images.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); + } + // Acceleration structures + else if (type.basetype == SPIRType::AccelerationStructure) + { + res.acceleration_structures.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); + } + else + { + res.gl_plain_uniforms.push_back({ var.self, var.basetype, type.self, get_name(var.self) }); + } } }); @@ -1464,6 +1484,58 @@ bool Compiler::get_binary_offset_for_decoration(VariableID id, spv::Decoration d return true; } +bool Compiler::block_is_noop(const SPIRBlock &block) const +{ + if (block.terminator != SPIRBlock::Direct) + return false; + + auto &child = get(block.next_block); + + // If this block participates in PHI, the block isn't really noop. + for (auto &phi : block.phi_variables) + if (phi.parent == block.self || phi.parent == child.self) + return false; + + for (auto &phi : child.phi_variables) + if (phi.parent == block.self) + return false; + + // Verify all instructions have no semantic impact. + for (auto &i : block.ops) + { + auto op = static_cast(i.op); + + switch (op) + { + // Non-Semantic instructions. + case OpLine: + case OpNoLine: + break; + + case OpExtInst: + { + auto *ops = stream(i); + auto ext = get(ops[2]).ext; + + bool ext_is_nonsemantic_only = + ext == SPIRExtension::NonSemanticShaderDebugInfo || + ext == SPIRExtension::SPV_debug_info || + ext == SPIRExtension::NonSemanticGeneric; + + if (!ext_is_nonsemantic_only) + return false; + + break; + } + + default: + return false; + } + } + + return true; +} + bool Compiler::block_is_loop_candidate(const SPIRBlock &block, SPIRBlock::Method method) const { // Tried and failed. @@ -1521,7 +1593,7 @@ bool Compiler::block_is_loop_candidate(const SPIRBlock &block, SPIRBlock::Method { // Empty loop header that just sets up merge target // and branches to loop body. - bool ret = block.terminator == SPIRBlock::Direct && block.merge == SPIRBlock::MergeLoop && block.ops.empty(); + bool ret = block.terminator == SPIRBlock::Direct && block.merge == SPIRBlock::MergeLoop && block_is_noop(block); if (!ret) return false; @@ -1547,19 +1619,8 @@ bool Compiler::block_is_loop_candidate(const SPIRBlock &block, SPIRBlock::Method ret = child.terminator == SPIRBlock::Select && child.merge == SPIRBlock::MergeNone && (positive_candidate || negative_candidate); - // If we have OpPhi which depends on branches which came from our own block, - // we need to flush phi variables in else block instead of a trivial break, - // so we cannot assume this is a for loop candidate. if (ret) { - for (auto &phi : block.phi_variables) - if (phi.parent == block.self || phi.parent == child.self) - return false; - - for (auto &phi : child.phi_variables) - if (phi.parent == block.self) - return false; - auto *merge = maybe_get(block.merge_block); if (merge) for (auto &phi : merge->phi_variables) @@ -1584,15 +1645,10 @@ bool Compiler::execution_is_noop(const SPIRBlock &from, const SPIRBlock &to) con if (start->self == to.self) return true; - if (!start->ops.empty()) + if (!block_is_noop(*start)) return false; auto &next = get(start->next_block); - // Flushing phi variables does not count as noop. - for (auto &phi : next.phi_variables) - if (phi.parent == start->self) - return false; - start = &next; } } @@ -2341,6 +2397,11 @@ bool Compiler::is_tessellation_shader() const return is_tessellation_shader(get_execution_model()); } +bool Compiler::is_tessellating_triangles() const +{ + return get_execution_mode_bitset().get(ExecutionModeTriangles); +} + void Compiler::set_remapped_variable_state(VariableID id, bool remap_enable) { get(id).remapped_variable = remap_enable; @@ -3204,8 +3265,8 @@ void Compiler::AnalyzeVariableScopeAccessHandler::notify_variable_access(uint32_ return; // Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers. - auto itr = access_chain_children.find(id); - if (itr != end(access_chain_children)) + auto itr = rvalue_forward_children.find(id); + if (itr != end(rvalue_forward_children)) for (auto child_id : itr->second) notify_variable_access(child_id, block); @@ -3313,14 +3374,14 @@ bool Compiler::AnalyzeVariableScopeAccessHandler::handle(spv::Op op, const uint3 if (var) { accessed_variables_to_block[var->self].insert(current_block->self); - access_chain_children[args[1]].insert(var->self); + rvalue_forward_children[args[1]].insert(var->self); } // args[2] might be another access chain we have to track use of. for (uint32_t i = 2; i < length; i++) { notify_variable_access(args[i], current_block->self); - access_chain_children[args[1]].insert(args[i]); + rvalue_forward_children[args[1]].insert(args[i]); } // Also keep track of the access chain pointer itself. @@ -3402,6 +3463,12 @@ bool Compiler::AnalyzeVariableScopeAccessHandler::handle(spv::Op op, const uint3 // Might be an access chain we have to track use of. notify_variable_access(args[2], current_block->self); + + // If we're loading an opaque type we cannot lower it to a temporary, + // we must defer access of args[2] until it's used. + auto &type = compiler.get(args[0]); + if (compiler.type_is_opaque_value(type)) + rvalue_forward_children[args[1]].insert(args[2]); break; } @@ -5394,18 +5461,55 @@ void Compiler::analyze_interlocked_resource_usage() } bool Compiler::type_is_array_of_pointers(const SPIRType &type) const +{ + if (!type_is_top_level_array(type)) + return false; + + // BDA types must have parent type hierarchy. + if (!type.parent_type) + return false; + + // Punch through all array layers. + auto *parent = &get(type.parent_type); + while (type_is_top_level_array(*parent)) + parent = &get(parent->parent_type); + + return type_is_top_level_pointer(*parent); +} + +bool Compiler::type_is_top_level_pointer(const SPIRType &type) const { if (!type.pointer) return false; - // If parent type has same pointer depth, we must have an array of pointers. - return type.pointer_depth == get(type.parent_type).pointer_depth; + // Function pointers, should not be hit by valid SPIR-V. + // Parent type will be SPIRFunction instead. + if (type.basetype == SPIRType::Unknown) + return false; + + // Some types are synthesized in-place without complete type hierarchy and might not have parent types, + // but these types are never array-of-pointer or any complicated BDA type, infer reasonable defaults. + if (type.parent_type) + return type.pointer_depth > get(type.parent_type).pointer_depth; + else + return true; } bool Compiler::type_is_top_level_physical_pointer(const SPIRType &type) const { - return type.pointer && type.storage == StorageClassPhysicalStorageBuffer && - type.pointer_depth > get(type.parent_type).pointer_depth; + return type_is_top_level_pointer(type) && type.storage == StorageClassPhysicalStorageBuffer; +} + +bool Compiler::type_is_top_level_array(const SPIRType &type) const +{ + if (type.array.empty()) + return false; + + // If we have pointer and array, we infer pointer-to-array as it's the only meaningful thing outside BDA. + if (type.parent_type) + return type.array.size() > get(type.parent_type).array.size(); + else + return !type.pointer; } bool Compiler::flush_phi_required(BlockID from, BlockID to) const diff --git a/bgfx/3rdparty/spirv-cross/spirv_cross.hpp b/bgfx/3rdparty/spirv-cross/spirv_cross.hpp index f1c347dd..8f7ba447 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_cross.hpp +++ b/bgfx/3rdparty/spirv-cross/spirv_cross.hpp @@ -94,11 +94,14 @@ struct ShaderResources SmallVector sampled_images; SmallVector atomic_counters; SmallVector acceleration_structures; + SmallVector gl_plain_uniforms; // There can only be one push constant block, // but keep the vector in case this restriction is lifted in the future. SmallVector push_constant_buffers; + SmallVector shader_record_buffers; + // For Vulkan GLSL and HLSL source, // these correspond to separate texture2D and samplers respectively. SmallVector separate_images; @@ -369,6 +372,7 @@ class Compiler spv::ExecutionModel get_execution_model() const; bool is_tessellation_shader() const; + bool is_tessellating_triangles() const; // In SPIR-V, the compute work group size can be represented by a constant vector, in which case // the LocalSize execution mode is ignored. @@ -679,6 +683,7 @@ class Compiler bool is_vector(const SPIRType &type) const; bool is_matrix(const SPIRType &type) const; bool is_array(const SPIRType &type) const; + static bool is_runtime_size_array(const SPIRType &type); uint32_t expression_type_id(uint32_t id) const; const SPIRType &expression_type(uint32_t id) const; bool expression_is_lvalue(uint32_t id) const; @@ -749,6 +754,7 @@ class Compiler bool is_force_recompile = false; bool is_force_recompile_forward_progress = false; + bool block_is_noop(const SPIRBlock &block) const; bool block_is_loop_candidate(const SPIRBlock &block, SPIRBlock::Method method) const; bool types_are_logically_equivalent(const SPIRType &a, const SPIRType &b) const; @@ -1012,7 +1018,8 @@ class Compiler std::unordered_map> partial_write_variables_to_block; std::unordered_set access_chain_expressions; // Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers. - std::unordered_map> access_chain_children; + // This is also relevant when forwarding opaque objects since we cannot lower these to temporaries. + std::unordered_map> rvalue_forward_children; const SPIRBlock *current_block = nullptr; }; @@ -1140,6 +1147,8 @@ class Compiler bool type_is_array_of_pointers(const SPIRType &type) const; bool type_is_top_level_physical_pointer(const SPIRType &type) const; + bool type_is_top_level_pointer(const SPIRType &type) const; + bool type_is_top_level_array(const SPIRType &type) const; bool type_is_block_like(const SPIRType &type) const; bool type_is_opaque_value(const SPIRType &type) const; diff --git a/bgfx/3rdparty/spirv-cross/spirv_cross_c.cpp b/bgfx/3rdparty/spirv-cross/spirv_cross_c.cpp index 2d9401b8..c21fdeb6 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_cross_c.cpp +++ b/bgfx/3rdparty/spirv-cross/spirv_cross_c.cpp @@ -194,6 +194,7 @@ struct spvc_resources_s : ScratchMemoryAllocation SmallVector sampled_images; SmallVector atomic_counters; SmallVector push_constant_buffers; + SmallVector shader_record_buffers; SmallVector separate_images; SmallVector separate_samplers; SmallVector acceleration_structures; @@ -478,6 +479,9 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c case SPVC_COMPILER_OPTION_RELAX_NAN_CHECKS: options->glsl.relax_nan_checks = value != 0; break; + case SPVC_COMPILER_OPTION_GLSL_ENABLE_ROW_MAJOR_LOAD_WORKAROUND: + options->glsl.enable_row_major_load_workaround = value != 0; + break; #endif #if SPIRV_CROSS_C_API_HLSL @@ -714,6 +718,30 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c case SPVC_COMPILER_OPTION_MSL_IOS_SUPPORT_BASE_VERTEX_INSTANCE: options->msl.ios_support_base_vertex_instance = value != 0; break; + + case SPVC_COMPILER_OPTION_MSL_RAW_BUFFER_TESE_INPUT: + options->msl.raw_buffer_tese_input = value != 0; + break; + + case SPVC_COMPILER_OPTION_MSL_SHADER_PATCH_INPUT_BUFFER_INDEX: + options->msl.shader_patch_input_buffer_index = value; + break; + + case SPVC_COMPILER_OPTION_MSL_MANUAL_HELPER_INVOCATION_UPDATES: + options->msl.manual_helper_invocation_updates = value != 0; + break; + + case SPVC_COMPILER_OPTION_MSL_CHECK_DISCARDED_FRAG_STORES: + options->msl.check_discarded_frag_stores = value != 0; + break; + + case SPVC_COMPILER_OPTION_MSL_ARGUMENT_BUFFERS_TIER: + options->msl.argument_buffers_tier = static_cast(value); + break; + + case SPVC_COMPILER_OPTION_MSL_SAMPLE_DREF_LOD_ARRAY_AS_GRAD: + options->msl.sample_dref_lod_array_as_grad = value != 0; + break; #endif default: @@ -792,6 +820,43 @@ spvc_result spvc_compiler_require_extension(spvc_compiler compiler, const char * #endif } +size_t spvc_compiler_get_num_required_extensions(spvc_compiler compiler) +{ +#if SPIRV_CROSS_C_API_GLSL + if (compiler->backend != SPVC_BACKEND_GLSL) + { + compiler->context->report_error("Enabled extensions can only be queried on GLSL backend."); + return SPVC_ERROR_INVALID_ARGUMENT; + } + + return static_cast(compiler->compiler.get())->get_required_extensions().size(); +#else + compiler->context->report_error("Enabled extensions can only be queried on GLSL backend."); + return 0; +#endif +} + +const char *spvc_compiler_get_required_extension(spvc_compiler compiler, size_t index) +{ +#if SPIRV_CROSS_C_API_GLSL + if (compiler->backend != SPVC_BACKEND_GLSL) + { + compiler->context->report_error("Enabled extensions can only be queried on GLSL backend."); + return nullptr; + } + + auto &exts = static_cast(compiler->compiler.get())->get_required_extensions(); + if (index < exts.size()) + return exts[index].c_str(); + else + return nullptr; +#else + (void)index; + compiler->context->report_error("Enabled extensions can only be queried on GLSL backend."); + return nullptr; +#endif +} + spvc_result spvc_compiler_flatten_buffer_block(spvc_compiler compiler, spvc_variable_id id) { #if SPIRV_CROSS_C_API_GLSL @@ -1173,6 +1238,31 @@ spvc_result spvc_compiler_msl_add_shader_input(spvc_compiler compiler, const spv #endif } +spvc_result spvc_compiler_msl_add_shader_input_2(spvc_compiler compiler, const spvc_msl_shader_interface_var_2 *si) +{ +#if SPIRV_CROSS_C_API_MSL + if (compiler->backend != SPVC_BACKEND_MSL) + { + compiler->context->report_error("MSL function used on a non-MSL backend."); + return SPVC_ERROR_INVALID_ARGUMENT; + } + + auto &msl = *static_cast(compiler->compiler.get()); + MSLShaderInterfaceVariable input; + input.location = si->location; + input.format = static_cast(si->format); + input.builtin = static_cast(si->builtin); + input.vecsize = si->vecsize; + input.rate = static_cast(si->rate); + msl.add_msl_shader_input(input); + return SPVC_SUCCESS; +#else + (void)si; + compiler->context->report_error("MSL function used on a non-MSL backend."); + return SPVC_ERROR_INVALID_ARGUMENT; +#endif +} + spvc_result spvc_compiler_msl_add_shader_output(spvc_compiler compiler, const spvc_msl_shader_interface_var *so) { #if SPIRV_CROSS_C_API_MSL @@ -1197,6 +1287,31 @@ spvc_result spvc_compiler_msl_add_shader_output(spvc_compiler compiler, const sp #endif } +spvc_result spvc_compiler_msl_add_shader_output_2(spvc_compiler compiler, const spvc_msl_shader_interface_var_2 *so) +{ +#if SPIRV_CROSS_C_API_MSL + if (compiler->backend != SPVC_BACKEND_MSL) + { + compiler->context->report_error("MSL function used on a non-MSL backend."); + return SPVC_ERROR_INVALID_ARGUMENT; + } + + auto &msl = *static_cast(compiler->compiler.get()); + MSLShaderInterfaceVariable output; + output.location = so->location; + output.format = static_cast(so->format); + output.builtin = static_cast(so->builtin); + output.vecsize = so->vecsize; + output.rate = static_cast(so->rate); + msl.add_msl_shader_output(output); + return SPVC_SUCCESS; +#else + (void)so; + compiler->context->report_error("MSL function used on a non-MSL backend."); + return SPVC_ERROR_INVALID_ARGUMENT; +#endif +} + spvc_result spvc_compiler_msl_add_resource_binding(spvc_compiler compiler, const spvc_msl_resource_binding *binding) { @@ -1684,6 +1799,8 @@ bool spvc_resources_s::copy_resources(const ShaderResources &resources) return false; if (!copy_resources(push_constant_buffers, resources.push_constant_buffers)) return false; + if (!copy_resources(shader_record_buffers, resources.shader_record_buffers)) + return false; if (!copy_resources(separate_images, resources.separate_images)) return false; if (!copy_resources(separate_samplers, resources.separate_samplers)) @@ -1837,6 +1954,10 @@ spvc_result spvc_resources_get_resource_list_for_type(spvc_resources resources, list = &resources->acceleration_structures; break; + case SPVC_RESOURCE_TYPE_SHADER_RECORD_BUFFER: + list = &resources->shader_record_buffers; + break; + default: break; } @@ -2451,6 +2572,51 @@ spvc_type_id spvc_constant_get_type(spvc_constant constant) return constant->constant_type; } +void spvc_constant_set_scalar_fp16(spvc_constant constant, unsigned column, unsigned row, unsigned short value) +{ + constant->m.c[column].r[row].u32 = value; +} + +void spvc_constant_set_scalar_fp32(spvc_constant constant, unsigned column, unsigned row, float value) +{ + constant->m.c[column].r[row].f32 = value; +} + +void spvc_constant_set_scalar_fp64(spvc_constant constant, unsigned column, unsigned row, double value) +{ + constant->m.c[column].r[row].f64 = value; +} + +void spvc_constant_set_scalar_u32(spvc_constant constant, unsigned column, unsigned row, unsigned value) +{ + constant->m.c[column].r[row].u32 = value; +} + +void spvc_constant_set_scalar_i32(spvc_constant constant, unsigned column, unsigned row, int value) +{ + constant->m.c[column].r[row].i32 = value; +} + +void spvc_constant_set_scalar_u16(spvc_constant constant, unsigned column, unsigned row, unsigned short value) +{ + constant->m.c[column].r[row].u32 = uint32_t(value); +} + +void spvc_constant_set_scalar_i16(spvc_constant constant, unsigned column, unsigned row, signed short value) +{ + constant->m.c[column].r[row].u32 = uint32_t(value); +} + +void spvc_constant_set_scalar_u8(spvc_constant constant, unsigned column, unsigned row, unsigned char value) +{ + constant->m.c[column].r[row].u32 = uint32_t(value); +} + +void spvc_constant_set_scalar_i8(spvc_constant constant, unsigned column, unsigned row, signed char value) +{ + constant->m.c[column].r[row].u32 = uint32_t(value); +} + spvc_bool spvc_compiler_get_binary_offset_for_decoration(spvc_compiler compiler, spvc_variable_id id, SpvDecoration decoration, unsigned *word_offset) @@ -2580,6 +2746,20 @@ void spvc_msl_shader_input_init(spvc_msl_shader_input *input) spvc_msl_shader_interface_var_init(input); } +void spvc_msl_shader_interface_var_init_2(spvc_msl_shader_interface_var_2 *var) +{ +#if SPIRV_CROSS_C_API_MSL + MSLShaderInterfaceVariable var_default; + var->location = var_default.location; + var->format = static_cast(var_default.format); + var->builtin = static_cast(var_default.builtin); + var->vecsize = var_default.vecsize; + var->rate = static_cast(var_default.rate); +#else + memset(var, 0, sizeof(*var)); +#endif +} + void spvc_msl_resource_binding_init(spvc_msl_resource_binding *binding) { #if SPIRV_CROSS_C_API_MSL diff --git a/bgfx/3rdparty/spirv-cross/spirv_cross_c.h b/bgfx/3rdparty/spirv-cross/spirv_cross_c.h index 4e6c6397..0d8e6e10 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_cross_c.h +++ b/bgfx/3rdparty/spirv-cross/spirv_cross_c.h @@ -40,7 +40,7 @@ extern "C" { /* Bumped if ABI or API breaks backwards compatibility. */ #define SPVC_C_API_VERSION_MAJOR 0 /* Bumped if APIs or enumerations are added in a backwards compatible way. */ -#define SPVC_C_API_VERSION_MINOR 49 +#define SPVC_C_API_VERSION_MINOR 57 /* Bumped if internal implementation details change. */ #define SPVC_C_API_VERSION_PATCH 0 @@ -225,6 +225,7 @@ typedef enum spvc_resource_type SPVC_RESOURCE_TYPE_SEPARATE_SAMPLERS = 11, SPVC_RESOURCE_TYPE_ACCELERATION_STRUCTURE = 12, SPVC_RESOURCE_TYPE_RAY_QUERY = 13, + SPVC_RESOURCE_TYPE_SHADER_RECORD_BUFFER = 14, SPVC_RESOURCE_TYPE_INT_MAX = 0x7fffffff } spvc_resource_type; @@ -335,7 +336,7 @@ typedef struct spvc_msl_vertex_attribute */ SPVC_PUBLIC_API void spvc_msl_vertex_attribute_init(spvc_msl_vertex_attribute *attr); -/* Maps to C++ API. */ +/* Maps to C++ API. Deprecated; use spvc_msl_shader_interface_var_2. */ typedef struct spvc_msl_shader_interface_var { unsigned location; @@ -346,13 +347,39 @@ typedef struct spvc_msl_shader_interface_var /* * Initializes the shader input struct. + * Deprecated. Use spvc_msl_shader_interface_var_init_2(). */ SPVC_PUBLIC_API void spvc_msl_shader_interface_var_init(spvc_msl_shader_interface_var *var); /* - * Deprecated. Use spvc_msl_shader_interface_var_init(). + * Deprecated. Use spvc_msl_shader_interface_var_init_2(). */ SPVC_PUBLIC_API void spvc_msl_shader_input_init(spvc_msl_shader_input *input); +/* Maps to C++ API. */ +typedef enum spvc_msl_shader_variable_rate +{ + SPVC_MSL_SHADER_VARIABLE_RATE_PER_VERTEX = 0, + SPVC_MSL_SHADER_VARIABLE_RATE_PER_PRIMITIVE = 1, + SPVC_MSL_SHADER_VARIABLE_RATE_PER_PATCH = 2, + + SPVC_MSL_SHADER_VARIABLE_RATE_INT_MAX = 0x7fffffff, +} spvc_msl_shader_variable_rate; + +/* Maps to C++ API. */ +typedef struct spvc_msl_shader_interface_var_2 +{ + unsigned location; + spvc_msl_shader_variable_format format; + SpvBuiltIn builtin; + unsigned vecsize; + spvc_msl_shader_variable_rate rate; +} spvc_msl_shader_interface_var_2; + +/* + * Initializes the shader interface variable struct. + */ +SPVC_PUBLIC_API void spvc_msl_shader_interface_var_init_2(spvc_msl_shader_interface_var_2 *var); + /* Maps to C++ API. */ typedef struct spvc_msl_resource_binding { @@ -689,6 +716,16 @@ typedef enum spvc_compiler_option SPVC_COMPILER_OPTION_RELAX_NAN_CHECKS = 78 | SPVC_COMPILER_OPTION_COMMON_BIT, + SPVC_COMPILER_OPTION_MSL_RAW_BUFFER_TESE_INPUT = 79 | SPVC_COMPILER_OPTION_MSL_BIT, + SPVC_COMPILER_OPTION_MSL_SHADER_PATCH_INPUT_BUFFER_INDEX = 80 | SPVC_COMPILER_OPTION_MSL_BIT, + SPVC_COMPILER_OPTION_MSL_MANUAL_HELPER_INVOCATION_UPDATES = 81 | SPVC_COMPILER_OPTION_MSL_BIT, + SPVC_COMPILER_OPTION_MSL_CHECK_DISCARDED_FRAG_STORES = 82 | SPVC_COMPILER_OPTION_MSL_BIT, + + SPVC_COMPILER_OPTION_GLSL_ENABLE_ROW_MAJOR_LOAD_WORKAROUND = 83 | SPVC_COMPILER_OPTION_GLSL_BIT, + + SPVC_COMPILER_OPTION_MSL_ARGUMENT_BUFFERS_TIER = 84 | SPVC_COMPILER_OPTION_MSL_BIT, + SPVC_COMPILER_OPTION_MSL_SAMPLE_DREF_LOD_ARRAY_AS_GRAD = 85 | SPVC_COMPILER_OPTION_MSL_BIT, + SPVC_COMPILER_OPTION_INT_MAX = 0x7fffffff } spvc_compiler_option; @@ -747,6 +784,8 @@ SPVC_PUBLIC_API spvc_result spvc_compiler_compile(spvc_compiler compiler, const /* Maps to C++ API. */ SPVC_PUBLIC_API spvc_result spvc_compiler_add_header_line(spvc_compiler compiler, const char *line); SPVC_PUBLIC_API spvc_result spvc_compiler_require_extension(spvc_compiler compiler, const char *ext); +SPVC_PUBLIC_API size_t spvc_compiler_get_num_required_extensions(spvc_compiler compiler); +SPVC_PUBLIC_API const char *spvc_compiler_get_required_extension(spvc_compiler compiler, size_t index); SPVC_PUBLIC_API spvc_result spvc_compiler_flatten_buffer_block(spvc_compiler compiler, spvc_variable_id id); SPVC_PUBLIC_API spvc_bool spvc_compiler_variable_is_depth_or_compare(spvc_compiler compiler, spvc_variable_id id); @@ -795,10 +834,16 @@ SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_vertex_attribute(spvc_compiler const spvc_msl_vertex_attribute *attrs); SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_resource_binding(spvc_compiler compiler, const spvc_msl_resource_binding *binding); +/* Deprecated; use spvc_compiler_msl_add_shader_input_2(). */ SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_shader_input(spvc_compiler compiler, const spvc_msl_shader_interface_var *input); +SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_shader_input_2(spvc_compiler compiler, + const spvc_msl_shader_interface_var_2 *input); +/* Deprecated; use spvc_compiler_msl_add_shader_output_2(). */ SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_shader_output(spvc_compiler compiler, const spvc_msl_shader_interface_var *output); +SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_shader_output_2(spvc_compiler compiler, + const spvc_msl_shader_interface_var_2 *output); SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_discrete_descriptor_set(spvc_compiler compiler, unsigned desc_set); SPVC_PUBLIC_API spvc_result spvc_compiler_msl_set_argument_buffer_device_address_space(spvc_compiler compiler, unsigned desc_set, spvc_bool device_address); @@ -1006,6 +1051,19 @@ SPVC_PUBLIC_API int spvc_constant_get_scalar_i8(spvc_constant constant, unsigned SPVC_PUBLIC_API void spvc_constant_get_subconstants(spvc_constant constant, const spvc_constant_id **constituents, size_t *count); SPVC_PUBLIC_API spvc_type_id spvc_constant_get_type(spvc_constant constant); +/* + * C implementation of the C++ api. + */ +SPVC_PUBLIC_API void spvc_constant_set_scalar_fp16(spvc_constant constant, unsigned column, unsigned row, unsigned short value); +SPVC_PUBLIC_API void spvc_constant_set_scalar_fp32(spvc_constant constant, unsigned column, unsigned row, float value); +SPVC_PUBLIC_API void spvc_constant_set_scalar_fp64(spvc_constant constant, unsigned column, unsigned row, double value); +SPVC_PUBLIC_API void spvc_constant_set_scalar_u32(spvc_constant constant, unsigned column, unsigned row, unsigned value); +SPVC_PUBLIC_API void spvc_constant_set_scalar_i32(spvc_constant constant, unsigned column, unsigned row, int value); +SPVC_PUBLIC_API void spvc_constant_set_scalar_u16(spvc_constant constant, unsigned column, unsigned row, unsigned short value); +SPVC_PUBLIC_API void spvc_constant_set_scalar_i16(spvc_constant constant, unsigned column, unsigned row, signed short value); +SPVC_PUBLIC_API void spvc_constant_set_scalar_u8(spvc_constant constant, unsigned column, unsigned row, unsigned char value); +SPVC_PUBLIC_API void spvc_constant_set_scalar_i8(spvc_constant constant, unsigned column, unsigned row, signed char value); + /* * Misc reflection * Maps to C++ API. diff --git a/bgfx/3rdparty/spirv-cross/spirv_cross_containers.hpp b/bgfx/3rdparty/spirv-cross/spirv_cross_containers.hpp index 506b069c..e79b3209 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_cross_containers.hpp +++ b/bgfx/3rdparty/spirv-cross/spirv_cross_containers.hpp @@ -26,6 +26,7 @@ #include "spirv_cross_error_handling.hpp" #include +#include #include #include #include @@ -210,7 +211,8 @@ class SmallVector : public VectorView buffer_capacity = N; } - SmallVector(const T *arg_list_begin, const T *arg_list_end) SPIRV_CROSS_NOEXCEPT : SmallVector() + template + SmallVector(const U *arg_list_begin, const U *arg_list_end) SPIRV_CROSS_NOEXCEPT : SmallVector() { auto count = size_t(arg_list_end - arg_list_begin); reserve(count); @@ -219,7 +221,13 @@ class SmallVector : public VectorView this->buffer_size = count; } - SmallVector(std::initializer_list init) SPIRV_CROSS_NOEXCEPT : SmallVector(init.begin(), init.end()) + template + SmallVector(std::initializer_list init) SPIRV_CROSS_NOEXCEPT : SmallVector(init.begin(), init.end()) + { + } + + template + explicit SmallVector(const U (&init)[M]) SPIRV_CROSS_NOEXCEPT : SmallVector(init, init + M) { } diff --git a/bgfx/3rdparty/spirv-cross/spirv_cross_parsed_ir.cpp b/bgfx/3rdparty/spirv-cross/spirv_cross_parsed_ir.cpp index 3b4d6e5c..c6ddb6a4 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_cross_parsed_ir.cpp +++ b/bgfx/3rdparty/spirv-cross/spirv_cross_parsed_ir.cpp @@ -66,7 +66,7 @@ ParsedIR &ParsedIR::operator=(ParsedIR &&other) SPIRV_CROSS_NOEXCEPT meta = std::move(other.meta); for (int i = 0; i < TypeCount; i++) ids_for_type[i] = std::move(other.ids_for_type[i]); - ids_for_constant_or_type = std::move(other.ids_for_constant_or_type); + ids_for_constant_undef_or_type = std::move(other.ids_for_constant_undef_or_type); ids_for_constant_or_variable = std::move(other.ids_for_constant_or_variable); declared_capabilities = std::move(other.declared_capabilities); declared_extensions = std::move(other.declared_extensions); @@ -102,7 +102,7 @@ ParsedIR &ParsedIR::operator=(const ParsedIR &other) meta = other.meta; for (int i = 0; i < TypeCount; i++) ids_for_type[i] = other.ids_for_type[i]; - ids_for_constant_or_type = other.ids_for_constant_or_type; + ids_for_constant_undef_or_type = other.ids_for_constant_undef_or_type; ids_for_constant_or_variable = other.ids_for_constant_or_variable; declared_capabilities = other.declared_capabilities; declared_extensions = other.declared_extensions; @@ -370,6 +370,10 @@ void ParsedIR::set_decoration_string(ID id, Decoration decoration, const string dec.hlsl_semantic = argument; break; + case DecorationUserTypeGOOGLE: + dec.user_type = argument; + break; + default: break; } @@ -659,6 +663,9 @@ const string &ParsedIR::get_decoration_string(ID id, Decoration decoration) cons case DecorationHlslSemanticGOOGLE: return dec.hlsl_semantic; + case DecorationUserTypeGOOGLE: + return dec.user_type; + default: return empty_string; } @@ -934,7 +941,7 @@ void ParsedIR::add_typed_id(Types type, ID id) { case TypeConstant: ids_for_constant_or_variable.push_back(id); - ids_for_constant_or_type.push_back(id); + ids_for_constant_undef_or_type.push_back(id); break; case TypeVariable: @@ -943,7 +950,8 @@ void ParsedIR::add_typed_id(Types type, ID id) case TypeType: case TypeConstantOp: - ids_for_constant_or_type.push_back(id); + case TypeUndef: + ids_for_constant_undef_or_type.push_back(id); break; default: diff --git a/bgfx/3rdparty/spirv-cross/spirv_cross_parsed_ir.hpp b/bgfx/3rdparty/spirv-cross/spirv_cross_parsed_ir.hpp index 138d9dd4..7f35c381 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_cross_parsed_ir.hpp +++ b/bgfx/3rdparty/spirv-cross/spirv_cross_parsed_ir.hpp @@ -74,8 +74,8 @@ class ParsedIR // Special purpose lists which contain a union of types. // This is needed so we can declare specialization constants and structs in an interleaved fashion, // among other things. - // Constants can be of struct type, and struct array sizes can use specialization constants. - SmallVector ids_for_constant_or_type; + // Constants can be undef or of struct type, and struct array sizes can use specialization constants. + SmallVector ids_for_constant_undef_or_type; SmallVector ids_for_constant_or_variable; // We need to keep track of the width the Ops that contains a type for the diff --git a/bgfx/3rdparty/spirv-cross/spirv_glsl.cpp b/bgfx/3rdparty/spirv-cross/spirv_glsl.cpp index a8129641..56639f0c 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_glsl.cpp +++ b/bgfx/3rdparty/spirv-cross/spirv_glsl.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #ifndef _WIN32 #include @@ -636,6 +637,17 @@ void CompilerGLSL::find_static_extensions() barycentric_is_nv = true; } +void CompilerGLSL::require_polyfill(Polyfill polyfill, bool relaxed) +{ + uint32_t &polyfills = (relaxed && options.es) ? required_polyfills_relaxed : required_polyfills; + + if ((polyfills & polyfill) == 0) + { + polyfills |= polyfill; + force_recompile(); + } +} + void CompilerGLSL::ray_tracing_khr_fixup_locations() { uint32_t location = 0; @@ -701,6 +713,11 @@ string CompilerGLSL::compile() emit_resources(); emit_extension_workarounds(get_execution_model()); + if (required_polyfills != 0) + emit_polyfills(required_polyfills, false); + if (options.es && required_polyfills_relaxed != 0) + emit_polyfills(required_polyfills_relaxed, true); + emit_function(get(ir.default_entry_point), Bitset()); pass_count++; @@ -1249,17 +1266,39 @@ string CompilerGLSL::to_interpolation_qualifiers(const Bitset &flags) if (flags.get(DecorationFlat)) res += "flat "; if (flags.get(DecorationNoPerspective)) + { + if (options.es) + { + if (options.version < 300) + SPIRV_CROSS_THROW("noperspective requires ESSL 300."); + require_extension_internal("GL_NV_shader_noperspective_interpolation"); + } + else if (is_legacy_desktop()) + require_extension_internal("GL_EXT_gpu_shader4"); res += "noperspective "; + } if (flags.get(DecorationCentroid)) res += "centroid "; if (flags.get(DecorationPatch)) res += "patch "; if (flags.get(DecorationSample)) + { + if (options.es) + { + if (options.version < 300) + SPIRV_CROSS_THROW("sample requires ESSL 300."); + else if (options.version < 320) + require_extension_internal("GL_OES_shader_multisample_interpolation"); + } res += "sample "; - if (flags.get(DecorationInvariant)) + } + if (flags.get(DecorationInvariant) && (options.es || options.version >= 120)) res += "invariant "; if (flags.get(DecorationPerPrimitiveEXT)) - res += "perprimitiveEXT "; + { + res += "perprimitiveEXT "; + require_extension_internal("GL_EXT_mesh_shader"); + } if (flags.get(DecorationExplicitInterpAMD)) { @@ -1450,6 +1489,10 @@ const char *CompilerGLSL::format_to_glsl(spv::ImageFormat format) return "rg8i"; case ImageFormatR16i: return "r16i"; + case ImageFormatR64i: + return "r64i"; + case ImageFormatR64ui: + return "r64ui"; default: case ImageFormatUnknown: return nullptr; @@ -1486,7 +1529,7 @@ uint32_t CompilerGLSL::type_to_packed_alignment(const SPIRType &type, const Bits { // If using PhysicalStorageBufferEXT storage class, this is a pointer, // and is 64-bit. - if (type.storage == StorageClassPhysicalStorageBufferEXT) + if (type_is_top_level_physical_pointer(type)) { if (!type.pointer) SPIRV_CROSS_THROW("Types in PhysicalStorageBufferEXT must be pointers."); @@ -1501,8 +1544,7 @@ uint32_t CompilerGLSL::type_to_packed_alignment(const SPIRType &type, const Bits else SPIRV_CROSS_THROW("AddressingModelPhysicalStorageBuffer64EXT must be used for PhysicalStorageBufferEXT."); } - - if (!type.array.empty()) + else if (type_is_top_level_array(type)) { uint32_t minimum_alignment = 1; if (packing_is_vec4_padded(packing)) @@ -1529,7 +1571,7 @@ uint32_t CompilerGLSL::type_to_packed_alignment(const SPIRType &type, const Bits // In std140, struct alignment is rounded up to 16. if (packing_is_vec4_padded(packing)) - alignment = max(alignment, 16u); + alignment = max(alignment, 16u); return alignment; } @@ -1608,21 +1650,9 @@ uint32_t CompilerGLSL::type_to_packed_array_stride(const SPIRType &type, const B uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &flags, BufferPackingStandard packing) { - if (!type.array.empty()) - { - uint32_t packed_size = to_array_size_literal(type) * type_to_packed_array_stride(type, flags, packing); - - // For arrays of vectors and matrices in HLSL, the last element has a size which depends on its vector size, - // so that it is possible to pack other vectors into the last element. - if (packing_is_hlsl(packing) && type.basetype != SPIRType::Struct) - packed_size -= (4 - type.vecsize) * (type.width / 8); - - return packed_size; - } - // If using PhysicalStorageBufferEXT storage class, this is a pointer, // and is 64-bit. - if (type.storage == StorageClassPhysicalStorageBufferEXT) + if (type_is_top_level_physical_pointer(type)) { if (!type.pointer) SPIRV_CROSS_THROW("Types in PhysicalStorageBufferEXT must be pointers."); @@ -1632,6 +1662,17 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f else SPIRV_CROSS_THROW("AddressingModelPhysicalStorageBuffer64EXT must be used for PhysicalStorageBufferEXT."); } + else if (type_is_top_level_array(type)) + { + uint32_t packed_size = to_array_size_literal(type) * type_to_packed_array_stride(type, flags, packing); + + // For arrays of vectors and matrices in HLSL, the last element has a size which depends on its vector size, + // so that it is possible to pack other vectors into the last element. + if (packing_is_hlsl(packing) && type.basetype != SPIRType::Struct) + packed_size -= (4 - type.vecsize) * (type.width / 8); + + return packed_size; + } uint32_t size = 0; @@ -1751,16 +1792,17 @@ bool CompilerGLSL::buffer_is_packing_standard(const SPIRType &type, BufferPackin packed_size = type_to_packed_size(memb_type, member_flags, packing); // We only need to care about this if we have non-array types which can straddle the vec4 boundary. + uint32_t actual_offset = type_struct_member_offset(type, i); + if (packing_is_hlsl(packing)) { // If a member straddles across a vec4 boundary, alignment is actually vec4. - uint32_t begin_word = offset / 16; - uint32_t end_word = (offset + packed_size - 1) / 16; + uint32_t begin_word = actual_offset / 16; + uint32_t end_word = (actual_offset + packed_size - 1) / 16; if (begin_word != end_word) - packed_alignment = max(packed_alignment, 16u); + packed_alignment = max(packed_alignment, 16u); } - uint32_t actual_offset = type_struct_member_offset(type, i); // Field is not in the specified range anymore and we can ignore any further fields. if (actual_offset >= end_offset) break; @@ -1798,8 +1840,9 @@ bool CompilerGLSL::buffer_is_packing_standard(const SPIRType &type, BufferPackin } // Verify array stride rules. - if (!memb_type.array.empty() && type_to_packed_array_stride(memb_type, member_flags, packing) != - type_struct_member_array_stride(type, i)) + if (type_is_top_level_array(memb_type) && + type_to_packed_array_stride(memb_type, member_flags, packing) != + type_struct_member_array_stride(type, i)) { if (failed_validation_index) *failed_validation_index = i; @@ -2713,30 +2756,26 @@ void CompilerGLSL::emit_interface_block(const SPIRVariable &var) { add_resource_name(var.self); - // Tessellation control and evaluation shaders must have either gl_MaxPatchVertices or unsized arrays for input arrays. - // Opt for unsized as it's the more "correct" variant to use. - bool control_point_input_array = type.storage == StorageClassInput && !type.array.empty() && - !has_decoration(var.self, DecorationPatch) && - (get_entry_point().model == ExecutionModelTessellationControl || - get_entry_point().model == ExecutionModelTessellationEvaluation); - - uint32_t old_array_size = 0; - bool old_array_size_literal = true; + // Legacy GLSL did not support int attributes, we automatically + // declare them as float and cast them on load/store + SPIRType newtype = type; + if (is_legacy() && var.storage == StorageClassInput && type.basetype == SPIRType::Int) + newtype.basetype = SPIRType::Float; - if (control_point_input_array) + // Tessellation control and evaluation shaders must have either + // gl_MaxPatchVertices or unsized arrays for input arrays. + // Opt for unsized as it's the more "correct" variant to use. + if (type.storage == StorageClassInput && !type.array.empty() && + !has_decoration(var.self, DecorationPatch) && + (get_entry_point().model == ExecutionModelTessellationControl || + get_entry_point().model == ExecutionModelTessellationEvaluation)) { - swap(type.array.back(), old_array_size); - swap(type.array_size_literal.back(), old_array_size_literal); + newtype.array.back() = 0; + newtype.array_size_literal.back() = true; } statement(layout_for_variable(var), to_qualifiers_glsl(var.self), - variable_decl(type, to_name(var.self), var.self), ";"); - - if (control_point_input_array) - { - swap(type.array.back(), old_array_size); - swap(type.array_size_literal.back(), old_array_size_literal); - } + variable_decl(newtype, to_name(var.self), var.self), ";"); } } } @@ -3123,6 +3162,10 @@ bool CompilerGLSL::should_force_emit_builtin_block(StorageClass storage) should_force = true; } + // Either glslang bug or oversight, but global invariant position does not work in mesh shaders. + if (get_execution_model() == ExecutionModelMeshEXT && position_invariant) + should_force = true; + return should_force; } @@ -3146,9 +3189,30 @@ void CompilerGLSL::fixup_implicit_builtin_block_names(ExecutionModel model) { auto flags = get_buffer_block_flags(var.self); if (flags.get(DecorationPerPrimitiveEXT)) + { set_name(var.self, "gl_MeshPrimitivesEXT"); + set_name(type.self, "gl_MeshPerPrimitiveEXT"); + } else + { set_name(var.self, "gl_MeshVerticesEXT"); + set_name(type.self, "gl_MeshPerVertexEXT"); + } + } + } + + if (model == ExecutionModelMeshEXT && var.storage == StorageClassOutput && !block) + { + auto *m = ir.find_meta(var.self); + if (m && m->decoration.builtin) + { + auto builtin_type = m->decoration.builtin_type; + if (builtin_type == BuiltInPrimitivePointIndicesEXT) + set_name(var.self, "gl_PrimitivePointIndicesEXT"); + else if (builtin_type == BuiltInPrimitiveLineIndicesEXT) + set_name(var.self, "gl_PrimitiveLineIndicesEXT"); + else if (builtin_type == BuiltInPrimitiveTriangleIndicesEXT) + set_name(var.self, "gl_PrimitiveTriangleIndicesEXT"); } } }); @@ -3160,7 +3224,6 @@ void CompilerGLSL::emit_declared_builtin_block(StorageClass storage, ExecutionMo Bitset global_builtins; const SPIRVariable *block_var = nullptr; bool emitted_block = false; - bool builtin_array = false; // Need to use declared size in the type. // These variables might have been declared, but not statically used, so we haven't deduced their size yet. @@ -3243,11 +3306,13 @@ void CompilerGLSL::emit_declared_builtin_block(StorageClass storage, ExecutionMo auto &m = ir.meta[var.self].decoration; if (m.builtin && builtin_is_per_vertex_set(m.builtin_type)) { + // For mesh/tesc output, Clip/Cull is an array-of-array. Look at innermost array type + // for correct result. global_builtins.set(m.builtin_type); if (m.builtin_type == BuiltInCullDistance) - cull_distance_size = to_array_size_literal(type); + cull_distance_size = to_array_size_literal(type, 0); else if (m.builtin_type == BuiltInClipDistance) - clip_distance_size = to_array_size_literal(type); + clip_distance_size = to_array_size_literal(type, 0); if (is_block_builtin(m.builtin_type) && m.decoration_flags.get(DecorationXfbStride) && m.decoration_flags.get(DecorationXfbBuffer) && m.decoration_flags.get(DecorationOffset)) @@ -3284,7 +3349,6 @@ void CompilerGLSL::emit_declared_builtin_block(StorageClass storage, ExecutionMo emitted_builtins = builtins; emitted_block = true; - builtin_array = !type.array.empty(); block_var = &var; }); @@ -3352,6 +3416,8 @@ void CompilerGLSL::emit_declared_builtin_block(StorageClass storage, ExecutionMo auto itr = builtin_xfb_offsets.find(BuiltInPosition); if (itr != end(builtin_xfb_offsets)) statement("layout(xfb_offset = ", itr->second, ") vec4 gl_Position;"); + else if (position_invariant) + statement("invariant vec4 gl_Position;"); else statement("vec4 gl_Position;"); } @@ -3383,39 +3449,29 @@ void CompilerGLSL::emit_declared_builtin_block(StorageClass storage, ExecutionMo statement("float gl_CullDistance[", cull_distance_size, "];"); } + bool builtin_array = model == ExecutionModelTessellationControl || + (model == ExecutionModelMeshEXT && storage == StorageClassOutput) || + (model == ExecutionModelGeometry && storage == StorageClassInput) || + (model == ExecutionModelTessellationEvaluation && storage == StorageClassInput); + if (builtin_array) { + const char *instance_name; + if (model == ExecutionModelMeshEXT) + instance_name = "gl_MeshVerticesEXT"; // Per primitive is never synthesized. + else + instance_name = storage == StorageClassInput ? "gl_in" : "gl_out"; + if (model == ExecutionModelTessellationControl && storage == StorageClassOutput) - end_scope_decl(join(to_name(block_var->self), "[", get_entry_point().output_vertices, "]")); + end_scope_decl(join(instance_name, "[", get_entry_point().output_vertices, "]")); else - end_scope_decl(join(to_name(block_var->self), "[]")); + end_scope_decl(join(instance_name, "[]")); } else end_scope_decl(); statement(""); } -void CompilerGLSL::declare_undefined_values() -{ - bool emitted = false; - ir.for_each_typed_id([&](uint32_t, const SPIRUndef &undef) { - auto &type = this->get(undef.basetype); - // OpUndef can be void for some reason ... - if (type.basetype == SPIRType::Void) - return; - - string initializer; - if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) - initializer = join(" = ", to_zero_initialized_expression(undef.basetype)); - - statement(variable_decl(type, to_name(undef.self), undef.self), initializer, ";"); - emitted = true; - }); - - if (emitted) - statement(""); -} - bool CompilerGLSL::variable_is_lut(const SPIRVariable &var) const { bool statically_assigned = var.statically_assigned && var.static_expression != ID(0) && var.remapped_variable; @@ -3458,6 +3514,8 @@ void CompilerGLSL::emit_resources() break; } + bool global_invariant_position = position_invariant && (options.es || options.version >= 120); + // Emit custom gl_PerVertex for SSO compatibility. if (options.separate_shader_objects && !options.es && execution.model != ExecutionModelFragment) { @@ -3468,11 +3526,13 @@ void CompilerGLSL::emit_resources() case ExecutionModelTessellationEvaluation: emit_declared_builtin_block(StorageClassInput, execution.model); emit_declared_builtin_block(StorageClassOutput, execution.model); + global_invariant_position = false; break; case ExecutionModelVertex: case ExecutionModelMeshEXT: emit_declared_builtin_block(StorageClassOutput, execution.model); + global_invariant_position = false; break; default: @@ -3482,6 +3542,7 @@ void CompilerGLSL::emit_resources() else if (should_force_emit_builtin_block(StorageClassOutput)) { emit_declared_builtin_block(StorageClassOutput, execution.model); + global_invariant_position = false; } else if (execution.geometry_passthrough) { @@ -3502,7 +3563,7 @@ void CompilerGLSL::emit_resources() statement(""); } - if (position_invariant) + if (global_invariant_position) { statement("invariant gl_Position;"); statement(""); @@ -3516,7 +3577,7 @@ void CompilerGLSL::emit_resources() // { auto loop_lock = ir.create_loop_hard_lock(); - for (auto &id_ : ir.ids_for_constant_or_type) + for (auto &id_ : ir.ids_for_constant_undef_or_type) { auto &id = ir.ids[id_]; @@ -3569,6 +3630,22 @@ void CompilerGLSL::emit_resources() emit_struct(*type); } } + else if (id.get_type() == TypeUndef) + { + auto &undef = id.get(); + auto &type = this->get(undef.basetype); + // OpUndef can be void for some reason ... + if (type.basetype == SPIRType::Void) + return; + + string initializer; + if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) + initializer = join(" = ", to_zero_initialized_expression(undef.basetype)); + + // FIXME: If used in a constant, we must declare it as one. + statement(variable_decl(type, to_name(undef.self), undef.self), initializer, ";"); + emitted = true; + } } } @@ -3785,8 +3862,6 @@ void CompilerGLSL::emit_resources() if (emitted) statement(""); - - declare_undefined_values(); } void CompilerGLSL::emit_output_variable_initializer(const SPIRVariable &var) @@ -3938,6 +4013,169 @@ void CompilerGLSL::emit_output_variable_initializer(const SPIRVariable &var) } } +void CompilerGLSL::emit_subgroup_arithmetic_workaround(const std::string &func, Op op, GroupOperation group_op) +{ + std::string result; + switch (group_op) + { + case GroupOperationReduce: + result = "reduction"; + break; + + case GroupOperationExclusiveScan: + result = "excl_scan"; + break; + + case GroupOperationInclusiveScan: + result = "incl_scan"; + break; + + default: + SPIRV_CROSS_THROW("Unsupported workaround for arithmetic group operation"); + } + + struct TypeInfo + { + std::string type; + std::string identity; + }; + + std::vector type_infos; + switch (op) + { + case OpGroupNonUniformIAdd: + { + type_infos.emplace_back(TypeInfo{ "uint", "0u" }); + type_infos.emplace_back(TypeInfo{ "uvec2", "uvec2(0u)" }); + type_infos.emplace_back(TypeInfo{ "uvec3", "uvec3(0u)" }); + type_infos.emplace_back(TypeInfo{ "uvec4", "uvec4(0u)" }); + type_infos.emplace_back(TypeInfo{ "int", "0" }); + type_infos.emplace_back(TypeInfo{ "ivec2", "ivec2(0)" }); + type_infos.emplace_back(TypeInfo{ "ivec3", "ivec3(0)" }); + type_infos.emplace_back(TypeInfo{ "ivec4", "ivec4(0)" }); + break; + } + + case OpGroupNonUniformFAdd: + { + type_infos.emplace_back(TypeInfo{ "float", "0.0f" }); + type_infos.emplace_back(TypeInfo{ "vec2", "vec2(0.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec3", "vec3(0.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec4", "vec4(0.0f)" }); + // ARB_gpu_shader_fp64 is required in GL4.0 which in turn is required by NV_thread_shuffle + type_infos.emplace_back(TypeInfo{ "double", "0.0LF" }); + type_infos.emplace_back(TypeInfo{ "dvec2", "dvec2(0.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec3", "dvec3(0.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec4", "dvec4(0.0LF)" }); + break; + } + + case OpGroupNonUniformIMul: + { + type_infos.emplace_back(TypeInfo{ "uint", "1u" }); + type_infos.emplace_back(TypeInfo{ "uvec2", "uvec2(1u)" }); + type_infos.emplace_back(TypeInfo{ "uvec3", "uvec3(1u)" }); + type_infos.emplace_back(TypeInfo{ "uvec4", "uvec4(1u)" }); + type_infos.emplace_back(TypeInfo{ "int", "1" }); + type_infos.emplace_back(TypeInfo{ "ivec2", "ivec2(1)" }); + type_infos.emplace_back(TypeInfo{ "ivec3", "ivec3(1)" }); + type_infos.emplace_back(TypeInfo{ "ivec4", "ivec4(1)" }); + break; + } + + case OpGroupNonUniformFMul: + { + type_infos.emplace_back(TypeInfo{ "float", "1.0f" }); + type_infos.emplace_back(TypeInfo{ "vec2", "vec2(1.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec3", "vec3(1.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec4", "vec4(1.0f)" }); + type_infos.emplace_back(TypeInfo{ "double", "0.0LF" }); + type_infos.emplace_back(TypeInfo{ "dvec2", "dvec2(1.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec3", "dvec3(1.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec4", "dvec4(1.0LF)" }); + break; + } + + default: + SPIRV_CROSS_THROW("Unsupported workaround for arithmetic group operation"); + } + + const bool op_is_addition = op == OpGroupNonUniformIAdd || op == OpGroupNonUniformFAdd; + const bool op_is_multiplication = op == OpGroupNonUniformIMul || op == OpGroupNonUniformFMul; + std::string op_symbol; + if (op_is_addition) + { + op_symbol = "+="; + } + else if (op_is_multiplication) + { + op_symbol = "*="; + } + + for (const TypeInfo &t : type_infos) + { + statement(t.type, " ", func, "(", t.type, " v)"); + begin_scope(); + statement(t.type, " ", result, " = ", t.identity, ";"); + statement("uvec4 active_threads = subgroupBallot(true);"); + statement("if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize)"); + begin_scope(); + statement("uint total = gl_SubgroupSize / 2u;"); + statement(result, " = v;"); + statement("for (uint i = 1u; i <= total; i <<= 1u)"); + begin_scope(); + statement("bool valid;"); + if (group_op == GroupOperationReduce) + { + statement(t.type, " s = shuffleXorNV(", result, ", i, gl_SubgroupSize, valid);"); + } + else if (group_op == GroupOperationExclusiveScan || group_op == GroupOperationInclusiveScan) + { + statement(t.type, " s = shuffleUpNV(", result, ", i, gl_SubgroupSize, valid);"); + } + if (op_is_addition || op_is_multiplication) + { + statement(result, " ", op_symbol, " valid ? s : ", t.identity, ";"); + } + end_scope(); + if (group_op == GroupOperationExclusiveScan) + { + statement(result, " = shuffleUpNV(", result, ", 1u, gl_SubgroupSize);"); + statement("if (subgroupElect())"); + begin_scope(); + statement(result, " = ", t.identity, ";"); + end_scope(); + } + end_scope(); + statement("else"); + begin_scope(); + if (group_op == GroupOperationExclusiveScan) + { + statement("uint total = subgroupBallotBitCount(gl_SubgroupLtMask);"); + } + else if (group_op == GroupOperationInclusiveScan) + { + statement("uint total = subgroupBallotBitCount(gl_SubgroupLeMask);"); + } + statement("for (uint i = 0u; i < gl_SubgroupSize; ++i)"); + begin_scope(); + statement("bool valid = subgroupBallotBitExtract(active_threads, i);"); + statement(t.type, " s = shuffleNV(v, i, gl_SubgroupSize);"); + if (group_op == GroupOperationExclusiveScan || group_op == GroupOperationInclusiveScan) + { + statement("valid = valid && (i < total);"); + } + if (op_is_addition || op_is_multiplication) + { + statement(result, " ", op_symbol, " valid ? s : ", t.identity, ";"); + } + end_scope(); + end_scope(); + statement("return ", result, ";"); + end_scope(); + } +} + void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) { static const char *workaround_types[] = { "int", "ivec2", "ivec3", "ivec4", "uint", "uvec2", "uvec3", "uvec4", @@ -4341,6 +4579,57 @@ void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) statement("#endif"); statement(""); } + + auto arithmetic_feature_helper = + [&](Supp::Feature feat, std::string func_name, spv::Op op, spv::GroupOperation group_op) + { + if (shader_subgroup_supporter.is_feature_requested(feat)) + { + auto exts = Supp::get_candidates_for_feature(feat, result); + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_shuffle: + emit_subgroup_arithmetic_workaround(func_name, op, group_op); + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + }; + + arithmetic_feature_helper(Supp::SubgroupArithmeticIAddReduce, "subgroupAdd", OpGroupNonUniformIAdd, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticIAddExclusiveScan, "subgroupExclusiveAdd", + OpGroupNonUniformIAdd, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticIAddInclusiveScan, "subgroupInclusiveAdd", + OpGroupNonUniformIAdd, GroupOperationInclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFAddReduce, "subgroupAdd", OpGroupNonUniformFAdd, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticFAddExclusiveScan, "subgroupExclusiveAdd", + OpGroupNonUniformFAdd, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFAddInclusiveScan, "subgroupInclusiveAdd", + OpGroupNonUniformFAdd, GroupOperationInclusiveScan); + + arithmetic_feature_helper(Supp::SubgroupArithmeticIMulReduce, "subgroupMul", OpGroupNonUniformIMul, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticIMulExclusiveScan, "subgroupExclusiveMul", + OpGroupNonUniformIMul, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticIMulInclusiveScan, "subgroupInclusiveMul", + OpGroupNonUniformIMul, GroupOperationInclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFMulReduce, "subgroupMul", OpGroupNonUniformFMul, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticFMulExclusiveScan, "subgroupExclusiveMul", + OpGroupNonUniformFMul, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFMulInclusiveScan, "subgroupInclusiveMul", + OpGroupNonUniformFMul, GroupOperationInclusiveScan); } if (!workaround_ubo_load_overload_types.empty()) @@ -4348,39 +4637,150 @@ void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) for (auto &type_id : workaround_ubo_load_overload_types) { auto &type = get(type_id); - statement(type_to_glsl(type), " spvWorkaroundRowMajor(", type_to_glsl(type), - " wrap) { return wrap; }"); + + if (options.es && is_matrix(type)) + { + // Need both variants. + // GLSL cannot overload on precision, so need to dispatch appropriately. + statement("highp ", type_to_glsl(type), " spvWorkaroundRowMajor(highp ", type_to_glsl(type), " wrap) { return wrap; }"); + statement("mediump ", type_to_glsl(type), " spvWorkaroundRowMajorMP(mediump ", type_to_glsl(type), " wrap) { return wrap; }"); + } + else + { + statement(type_to_glsl(type), " spvWorkaroundRowMajor(", type_to_glsl(type), " wrap) { return wrap; }"); + } } statement(""); } +} - if (requires_transpose_2x2) +void CompilerGLSL::emit_polyfills(uint32_t polyfills, bool relaxed) +{ + const char *qual = ""; + const char *suffix = (options.es && relaxed) ? "MP" : ""; + if (options.es) + qual = relaxed ? "mediump " : "highp "; + + if (polyfills & PolyfillTranspose2x2) { - statement("mat2 spvTranspose(mat2 m)"); + statement(qual, "mat2 spvTranspose", suffix, "(", qual, "mat2 m)"); begin_scope(); statement("return mat2(m[0][0], m[1][0], m[0][1], m[1][1]);"); end_scope(); statement(""); } - if (requires_transpose_3x3) + if (polyfills & PolyfillTranspose3x3) { - statement("mat3 spvTranspose(mat3 m)"); + statement(qual, "mat3 spvTranspose", suffix, "(", qual, "mat3 m)"); begin_scope(); statement("return mat3(m[0][0], m[1][0], m[2][0], m[0][1], m[1][1], m[2][1], m[0][2], m[1][2], m[2][2]);"); end_scope(); statement(""); } - if (requires_transpose_4x4) + if (polyfills & PolyfillTranspose4x4) { - statement("mat4 spvTranspose(mat4 m)"); + statement(qual, "mat4 spvTranspose", suffix, "(", qual, "mat4 m)"); begin_scope(); statement("return mat4(m[0][0], m[1][0], m[2][0], m[3][0], m[0][1], m[1][1], m[2][1], m[3][1], m[0][2], " "m[1][2], m[2][2], m[3][2], m[0][3], m[1][3], m[2][3], m[3][3]);"); end_scope(); statement(""); } + + if (polyfills & PolyfillDeterminant2x2) + { + statement(qual, "float spvDeterminant", suffix, "(", qual, "mat2 m)"); + begin_scope(); + statement("return m[0][0] * m[1][1] - m[0][1] * m[1][0];"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillDeterminant3x3) + { + statement(qual, "float spvDeterminant", suffix, "(", qual, "mat3 m)"); + begin_scope(); + statement("return dot(m[0], vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], " + "m[1][2] * m[2][0] - m[1][0] * m[2][2], " + "m[1][0] * m[2][1] - m[1][1] * m[2][0]));"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillDeterminant4x4) + { + statement(qual, "float spvDeterminant", suffix, "(", qual, "mat4 m)"); + begin_scope(); + statement("return dot(m[0], vec4(" + "m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], " + "m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], " + "m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], " + "m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2]));"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillMatrixInverse2x2) + { + statement(qual, "mat2 spvInverse", suffix, "(", qual, "mat2 m)"); + begin_scope(); + statement("return mat2(m[1][1], -m[0][1], -m[1][0], m[0][0]) " + "* (1.0 / (m[0][0] * m[1][1] - m[1][0] * m[0][1]));"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillMatrixInverse3x3) + { + statement(qual, "mat3 spvInverse", suffix, "(", qual, "mat3 m)"); + begin_scope(); + statement(qual, "vec3 t = vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], m[1][2] * m[2][0] - m[1][0] * m[2][2], m[1][0] * m[2][1] - m[1][1] * m[2][0]);"); + statement("return mat3(t[0], " + "m[0][2] * m[2][1] - m[0][1] * m[2][2], " + "m[0][1] * m[1][2] - m[0][2] * m[1][1], " + "t[1], " + "m[0][0] * m[2][2] - m[0][2] * m[2][0], " + "m[0][2] * m[1][0] - m[0][0] * m[1][2], " + "t[2], " + "m[0][1] * m[2][0] - m[0][0] * m[2][1], " + "m[0][0] * m[1][1] - m[0][1] * m[1][0]) " + "* (1.0 / dot(m[0], t));"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillMatrixInverse4x4) + { + statement(qual, "mat4 spvInverse", suffix, "(", qual, "mat4 m)"); + begin_scope(); + statement(qual, "vec4 t = vec4(" + "m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], " + "m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], " + "m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], " + "m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2]);"); + statement("return mat4(" + "t[0], " + "m[3][1] * m[2][2] * m[0][3] - m[2][1] * m[3][2] * m[0][3] - m[3][1] * m[0][2] * m[2][3] + m[0][1] * m[3][2] * m[2][3] + m[2][1] * m[0][2] * m[3][3] - m[0][1] * m[2][2] * m[3][3], " + "m[1][1] * m[3][2] * m[0][3] - m[3][1] * m[1][2] * m[0][3] + m[3][1] * m[0][2] * m[1][3] - m[0][1] * m[3][2] * m[1][3] - m[1][1] * m[0][2] * m[3][3] + m[0][1] * m[1][2] * m[3][3], " + "m[2][1] * m[1][2] * m[0][3] - m[1][1] * m[2][2] * m[0][3] - m[2][1] * m[0][2] * m[1][3] + m[0][1] * m[2][2] * m[1][3] + m[1][1] * m[0][2] * m[2][3] - m[0][1] * m[1][2] * m[2][3], " + "t[1], " + "m[2][0] * m[3][2] * m[0][3] - m[3][0] * m[2][2] * m[0][3] + m[3][0] * m[0][2] * m[2][3] - m[0][0] * m[3][2] * m[2][3] - m[2][0] * m[0][2] * m[3][3] + m[0][0] * m[2][2] * m[3][3], " + "m[3][0] * m[1][2] * m[0][3] - m[1][0] * m[3][2] * m[0][3] - m[3][0] * m[0][2] * m[1][3] + m[0][0] * m[3][2] * m[1][3] + m[1][0] * m[0][2] * m[3][3] - m[0][0] * m[1][2] * m[3][3], " + "m[1][0] * m[2][2] * m[0][3] - m[2][0] * m[1][2] * m[0][3] + m[2][0] * m[0][2] * m[1][3] - m[0][0] * m[2][2] * m[1][3] - m[1][0] * m[0][2] * m[2][3] + m[0][0] * m[1][2] * m[2][3], " + "t[2], " + "m[3][0] * m[2][1] * m[0][3] - m[2][0] * m[3][1] * m[0][3] - m[3][0] * m[0][1] * m[2][3] + m[0][0] * m[3][1] * m[2][3] + m[2][0] * m[0][1] * m[3][3] - m[0][0] * m[2][1] * m[3][3], " + "m[1][0] * m[3][1] * m[0][3] - m[3][0] * m[1][1] * m[0][3] + m[3][0] * m[0][1] * m[1][3] - m[0][0] * m[3][1] * m[1][3] - m[1][0] * m[0][1] * m[3][3] + m[0][0] * m[1][1] * m[3][3], " + "m[2][0] * m[1][1] * m[0][3] - m[1][0] * m[2][1] * m[0][3] - m[2][0] * m[0][1] * m[1][3] + m[0][0] * m[2][1] * m[1][3] + m[1][0] * m[0][1] * m[2][3] - m[0][0] * m[1][1] * m[2][3], " + "t[3], " + "m[2][0] * m[3][1] * m[0][2] - m[3][0] * m[2][1] * m[0][2] + m[3][0] * m[0][1] * m[2][2] - m[0][0] * m[3][1] * m[2][2] - m[2][0] * m[0][1] * m[3][2] + m[0][0] * m[2][1] * m[3][2], " + "m[3][0] * m[1][1] * m[0][2] - m[1][0] * m[3][1] * m[0][2] - m[3][0] * m[0][1] * m[1][2] + m[0][0] * m[3][1] * m[1][2] + m[1][0] * m[0][1] * m[3][2] - m[0][0] * m[1][1] * m[3][2], " + "m[1][0] * m[2][1] * m[0][2] - m[2][0] * m[1][1] * m[0][2] + m[2][0] * m[0][1] * m[1][2] - m[0][0] * m[2][1] * m[1][2] - m[1][0] * m[0][1] * m[2][2] + m[0][0] * m[1][1] * m[2][2]) " + "* (1.0 / dot(m[0], t));"); + end_scope(); + statement(""); + } } // Returns a string representation of the ID, usable as a function arg. @@ -4523,7 +4923,7 @@ void CompilerGLSL::strip_enclosed_expression(string &expr) expr.erase(begin(expr)); } -string CompilerGLSL::enclose_expression(const string &expr) +bool CompilerGLSL::needs_enclose_expression(const std::string &expr) { bool need_parens = false; @@ -4557,10 +4957,15 @@ string CompilerGLSL::enclose_expression(const string &expr) assert(paren_count == 0); } + return need_parens; +} + +string CompilerGLSL::enclose_expression(const string &expr) +{ // If this expression contains any spaces which are not enclosed by parentheses, // we need to enclose it so we can treat the whole string as an expression. // This happens when two expressions have been part of a binary op earlier. - if (need_parens) + if (needs_enclose_expression(expr)) return join('(', expr, ')'); else return expr; @@ -4717,8 +5122,27 @@ string CompilerGLSL::to_extract_constant_composite_expression(uint32_t result_ty return constant_expression(tmp); } -string CompilerGLSL::to_rerolled_array_expression(const string &base_expr, const SPIRType &type) +string CompilerGLSL::to_rerolled_array_expression(const SPIRType &parent_type, + const string &base_expr, const SPIRType &type) { + bool remapped_boolean = parent_type.basetype == SPIRType::Struct && + type.basetype == SPIRType::Boolean && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean; + + SPIRType tmp_type; + if (remapped_boolean) + { + tmp_type = get(type.parent_type); + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + } + else if (type.basetype == SPIRType::Boolean && backend.boolean_in_struct_remapped_type != SPIRType::Boolean) + { + // It's possible that we have an r-value expression that was OpLoaded from a struct. + // We have to reroll this and explicitly cast the input to bool, because the r-value is short. + tmp_type = get(type.parent_type); + remapped_boolean = true; + } + uint32_t size = to_array_size_literal(type); auto &parent = get(type.parent_type); string expr = "{ "; @@ -4726,10 +5150,14 @@ string CompilerGLSL::to_rerolled_array_expression(const string &base_expr, const for (uint32_t i = 0; i < size; i++) { auto subexpr = join(base_expr, "[", convert_to_string(i), "]"); - if (parent.array.empty()) + if (!type_is_top_level_array(parent)) + { + if (remapped_boolean) + subexpr = join(type_to_glsl(tmp_type), "(", subexpr, ")"); expr += subexpr; + } else - expr += to_rerolled_array_expression(subexpr, parent); + expr += to_rerolled_array_expression(parent_type, subexpr, parent); if (i + 1 < size) expr += ", "; @@ -4739,13 +5167,26 @@ string CompilerGLSL::to_rerolled_array_expression(const string &base_expr, const return expr; } -string CompilerGLSL::to_composite_constructor_expression(uint32_t id, bool block_like_type) +string CompilerGLSL::to_composite_constructor_expression(const SPIRType &parent_type, uint32_t id, bool block_like_type) { auto &type = expression_type(id); - bool reroll_array = !type.array.empty() && - (!backend.array_is_value_type || - (block_like_type && !backend.array_is_value_type_in_buffer_blocks)); + bool reroll_array = false; + bool remapped_boolean = parent_type.basetype == SPIRType::Struct && + type.basetype == SPIRType::Boolean && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean; + + if (type_is_top_level_array(type)) + { + reroll_array = !backend.array_is_value_type || + (block_like_type && !backend.array_is_value_type_in_buffer_blocks); + + if (remapped_boolean) + { + // Forced to reroll if we have to change bool[] to short[]. + reroll_array = true; + } + } if (reroll_array) { @@ -4759,10 +5200,20 @@ string CompilerGLSL::to_composite_constructor_expression(uint32_t id, bool block // We're only triggering one read of the array expression, but this is fine since arrays have to be declared // as temporaries anyways. - return to_rerolled_array_expression(to_enclosed_expression(id), type); + return to_rerolled_array_expression(parent_type, to_enclosed_expression(id), type); } else - return to_unpacked_expression(id); + { + auto expr = to_unpacked_expression(id); + if (remapped_boolean) + { + auto tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + expr = join(type_to_glsl(tmp_type), "(", expr, ")"); + } + + return expr; + } } string CompilerGLSL::to_non_uniform_aware_expression(uint32_t id) @@ -4816,8 +5267,9 @@ string CompilerGLSL::to_expression(uint32_t id, bool register_expression_read) // when consuming an access chain expression. uint32_t physical_type_id = get_extended_decoration(id, SPIRVCrossDecorationPhysicalTypeID); bool is_packed = has_extended_decoration(id, SPIRVCrossDecorationPhysicalTypePacked); + bool relaxed = has_decoration(id, DecorationRelaxedPrecision); return convert_row_major_matrix(e.expression, get(e.expression_type), physical_type_id, - is_packed); + is_packed, relaxed); } else if (flattened_structs.count(id)) { @@ -4859,6 +5311,9 @@ string CompilerGLSL::to_expression(uint32_t id, bool register_expression_read) } } + if (expression_is_forwarded(id)) + return constant_expression(c); + return to_name(id); } else if (c.is_used_as_lut) @@ -4930,6 +5385,80 @@ string CompilerGLSL::to_expression(uint32_t id, bool register_expression_read) } } +SmallVector CompilerGLSL::get_composite_constant_ids(ConstantID const_id) +{ + if (auto *constant = maybe_get(const_id)) + { + const auto &type = get(constant->constant_type); + if (is_array(type) || type.basetype == SPIRType::Struct) + return constant->subconstants; + if (is_matrix(type)) + return SmallVector(constant->m.id); + if (is_vector(type)) + return SmallVector(constant->m.c[0].id); + SPIRV_CROSS_THROW("Unexpected scalar constant!"); + } + if (!const_composite_insert_ids.count(const_id)) + SPIRV_CROSS_THROW("Unimplemented for this OpSpecConstantOp!"); + return const_composite_insert_ids[const_id]; +} + +void CompilerGLSL::fill_composite_constant(SPIRConstant &constant, TypeID type_id, + const SmallVector &initializers) +{ + auto &type = get(type_id); + constant.specialization = true; + if (is_array(type) || type.basetype == SPIRType::Struct) + { + constant.subconstants = initializers; + } + else if (is_matrix(type)) + { + constant.m.columns = type.columns; + for (uint32_t i = 0; i < type.columns; ++i) + { + constant.m.id[i] = initializers[i]; + constant.m.c[i].vecsize = type.vecsize; + } + } + else if (is_vector(type)) + { + constant.m.c[0].vecsize = type.vecsize; + for (uint32_t i = 0; i < type.vecsize; ++i) + constant.m.c[0].id[i] = initializers[i]; + } + else + SPIRV_CROSS_THROW("Unexpected scalar in SpecConstantOp CompositeInsert!"); +} + +void CompilerGLSL::set_composite_constant(ConstantID const_id, TypeID type_id, + const SmallVector &initializers) +{ + if (maybe_get(const_id)) + { + const_composite_insert_ids[const_id] = initializers; + return; + } + + auto &constant = set(const_id, type_id); + fill_composite_constant(constant, type_id, initializers); + forwarded_temporaries.insert(const_id); +} + +TypeID CompilerGLSL::get_composite_member_type(TypeID type_id, uint32_t member_idx) +{ + auto &type = get(type_id); + if (is_array(type)) + return type.parent_type; + if (type.basetype == SPIRType::Struct) + return type.member_types[member_idx]; + if (is_matrix(type)) + return type.parent_type; + if (is_vector(type)) + return type.parent_type; + SPIRV_CROSS_THROW("Shouldn't reach lower than vector handling OpSpecConstantOp CompositeInsert!"); +} + string CompilerGLSL::constant_op_expression(const SPIRConstantOp &cop) { auto &type = get(cop.basetype); @@ -5034,10 +5563,21 @@ string CompilerGLSL::constant_op_expression(const SPIRConstantOp &cop) for (uint32_t i = 2; i < uint32_t(cop.arguments.size()); i++) { uint32_t index = cop.arguments[i]; - if (index >= left_components) + if (index == 0xFFFFFFFF) + { + SPIRConstant c; + c.constant_type = type.parent_type; + assert(type.parent_type != ID(0)); + expr += constant_expression(c); + } + else if (index >= left_components) + { expr += right_arg + "." + "xyzw"[index - left_components]; + } else + { expr += left_arg + "." + "xyzw"[index]; + } if (i + 1 < uint32_t(cop.arguments.size())) expr += ", "; @@ -5055,7 +5595,30 @@ string CompilerGLSL::constant_op_expression(const SPIRConstantOp &cop) } case OpCompositeInsert: - SPIRV_CROSS_THROW("OpCompositeInsert spec constant op is not supported."); + { + SmallVector new_init = get_composite_constant_ids(cop.arguments[1]); + uint32_t idx; + uint32_t target_id = cop.self; + uint32_t target_type_id = cop.basetype; + // We have to drill down to the part we want to modify, and create new + // constants for each containing part. + for (idx = 2; idx < cop.arguments.size() - 1; ++idx) + { + uint32_t new_const = ir.increase_bound_by(1); + uint32_t old_const = new_init[cop.arguments[idx]]; + new_init[cop.arguments[idx]] = new_const; + set_composite_constant(target_id, target_type_id, new_init); + new_init = get_composite_constant_ids(old_const); + target_id = new_const; + target_type_id = get_composite_member_type(target_type_id, cop.arguments[idx]); + } + // Now replace the initializer with the one from this instruction. + new_init[cop.arguments[idx]] = cop.arguments[0]; + set_composite_constant(target_id, target_type_id, new_init); + SPIRConstant tmp_const(cop.basetype); + fill_composite_constant(tmp_const, cop.basetype, const_composite_insert_ids[cop.self]); + return constant_expression(tmp_const); + } default: // Some opcodes are unimplemented here, these are currently not possible to test from glslang. @@ -5160,11 +5723,13 @@ string CompilerGLSL::constant_op_expression(const SPIRConstantOp &cop) } } -string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_block_like_struct_scope) +string CompilerGLSL::constant_expression(const SPIRConstant &c, + bool inside_block_like_struct_scope, + bool inside_struct_scope) { auto &type = get(c.constant_type); - if (type.pointer) + if (type_is_top_level_pointer(type)) { return backend.null_pointer_literal; } @@ -5179,19 +5744,32 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_bloc // with Offset = 0, using no ArrayStride on the enclosed array type. // A particular CTS test hits this scenario. bool array_type_decays = inside_block_like_struct_scope && - !type.array.empty() && !backend.array_is_value_type_in_buffer_blocks; + type_is_top_level_array(type) && + !backend.array_is_value_type_in_buffer_blocks; // Allow Metal to use the array template to make arrays a value type bool needs_trailing_tracket = false; if (backend.use_initializer_list && backend.use_typed_initializer_list && type.basetype == SPIRType::Struct && - type.array.empty()) + !type_is_top_level_array(type)) { res = type_to_glsl_constructor(type) + "{ "; } else if (backend.use_initializer_list && backend.use_typed_initializer_list && backend.array_is_value_type && - !type.array.empty() && !array_type_decays) + type_is_top_level_array(type) && !array_type_decays) { - res = type_to_glsl_constructor(type) + "({ "; + const auto *p_type = &type; + SPIRType tmp_type; + + if (inside_struct_scope && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean && + type.basetype == SPIRType::Boolean) + { + tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + p_type = &tmp_type; + } + + res = type_to_glsl_constructor(*p_type) + "({ "; needs_trailing_tracket = true; } else if (backend.use_initializer_list) @@ -5206,20 +5784,34 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_bloc uint32_t subconstant_index = 0; for (auto &elem : c.subconstants) { - auto &subc = get(elem); - if (subc.specialization) + if (auto *op = maybe_get(elem)) + { + res += constant_op_expression(*op); + } + else if (maybe_get(elem) != nullptr) + { res += to_name(elem); + } else { - if (type.array.empty() && type.basetype == SPIRType::Struct) + auto &subc = get(elem); + if (subc.specialization && !expression_is_forwarded(elem)) + res += to_name(elem); + else { - // When we get down to emitting struct members, override the block-like information. - // For constants, we can freely mix and match block-like state. - inside_block_like_struct_scope = - has_member_decoration(type.self, subconstant_index, DecorationOffset); - } + if (!type_is_top_level_array(type) && type.basetype == SPIRType::Struct) + { + // When we get down to emitting struct members, override the block-like information. + // For constants, we can freely mix and match block-like state. + inside_block_like_struct_scope = + has_member_decoration(type.self, subconstant_index, DecorationOffset); + } - res += constant_expression(subc, inside_block_like_struct_scope); + if (type.basetype == SPIRType::Struct) + inside_struct_scope = true; + + res += constant_expression(subc, inside_block_like_struct_scope, inside_struct_scope); + } } if (&elem != &c.subconstants.back()) @@ -5240,19 +5832,30 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_bloc if (backend.supports_empty_struct) return "{ }"; else if (backend.use_typed_initializer_list) - return join(type_to_glsl(get(c.constant_type)), "{ 0 }"); + return join(type_to_glsl(type), "{ 0 }"); else if (backend.use_initializer_list) return "{ 0 }"; else - return join(type_to_glsl(get(c.constant_type)), "(0)"); + return join(type_to_glsl(type), "(0)"); } else if (c.columns() == 1) { - return constant_expression_vector(c, 0); + auto res = constant_expression_vector(c, 0); + + if (inside_struct_scope && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean && + type.basetype == SPIRType::Boolean) + { + SPIRType tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + res = join(type_to_glsl(tmp_type), "(", res, ")"); + } + + return res; } else { - string res = type_to_glsl(get(c.constant_type)) + "("; + string res = type_to_glsl(type) + "("; for (uint32_t col = 0; col < c.columns(); col++) { if (c.specialization_constant_id(col) != 0) @@ -5264,6 +5867,16 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_bloc res += ", "; } res += ")"; + + if (inside_struct_scope && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean && + type.basetype == SPIRType::Boolean) + { + SPIRType tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + res = join(type_to_glsl(tmp_type), "(", res, ")"); + } + return res; } } @@ -5984,6 +6597,22 @@ void CompilerGLSL::emit_unary_op(uint32_t result_type, uint32_t result_id, uint3 inherit_expression_dependencies(result_id, op0); } +void CompilerGLSL::emit_unary_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op) +{ + auto &type = get(result_type); + bool forward = should_forward(op0); + emit_op(result_type, result_id, join(type_to_glsl(type), "(", op, to_enclosed_unpacked_expression(op0), ")"), forward); + inherit_expression_dependencies(result_id, op0); +} + +void CompilerGLSL::emit_mesh_tasks(SPIRBlock &block) +{ + statement("EmitMeshTasksEXT(", + to_unpacked_expression(block.mesh.groups[0]), ", ", + to_unpacked_expression(block.mesh.groups[1]), ", ", + to_unpacked_expression(block.mesh.groups[2]), ");"); +} + void CompilerGLSL::emit_binary_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op) { // Various FP arithmetic opcodes such as add, sub, mul will hit this. @@ -6127,7 +6756,9 @@ bool CompilerGLSL::emit_complex_bitcast(uint32_t result_type, uint32_t id, uint3 } void CompilerGLSL::emit_binary_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, - const char *op, SPIRType::BaseType input_type, bool skip_cast_if_equal_type) + const char *op, SPIRType::BaseType input_type, + bool skip_cast_if_equal_type, + bool implicit_integer_promotion) { string cast_op0, cast_op1; auto expected_type = binary_op_bitcast_helper(cast_op0, cast_op1, input_type, op0, op1, skip_cast_if_equal_type); @@ -6136,17 +6767,23 @@ void CompilerGLSL::emit_binary_op_cast(uint32_t result_type, uint32_t result_id, // We might have casted away from the result type, so bitcast again. // For example, arithmetic right shift with uint inputs. // Special case boolean outputs since relational opcodes output booleans instead of int/uint. + auto bitop = join(cast_op0, " ", op, " ", cast_op1); string expr; - if (out_type.basetype != input_type && out_type.basetype != SPIRType::Boolean) + + if (implicit_integer_promotion) + { + // Simple value cast. + expr = join(type_to_glsl(out_type), '(', bitop, ')'); + } + else if (out_type.basetype != input_type && out_type.basetype != SPIRType::Boolean) { expected_type.basetype = input_type; - expr = bitcast_glsl_op(out_type, expected_type); - expr += '('; - expr += join(cast_op0, " ", op, " ", cast_op1); - expr += ')'; + expr = join(bitcast_glsl_op(out_type, expected_type), '(', bitop, ')'); } else - expr += join(cast_op0, " ", op, " ", cast_op1); + { + expr = std::move(bitop); + } emit_op(result_type, result_id, expr, should_forward(op0) && should_forward(op1)); inherit_expression_dependencies(result_id, op0); @@ -6163,7 +6800,10 @@ void CompilerGLSL::emit_unary_func_op(uint32_t result_type, uint32_t result_id, void CompilerGLSL::emit_binary_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op) { - bool forward = should_forward(op0) && should_forward(op1); + // Opaque types (e.g. OpTypeSampledImage) must always be forwarded in GLSL + const auto &type = get_type(result_type); + bool must_forward = type_is_opaque_value(type); + bool forward = must_forward || (should_forward(op0) && should_forward(op1)); emit_op(result_type, result_id, join(op, "(", to_unpacked_expression(op0), ", ", to_unpacked_expression(op1), ")"), forward); inherit_expression_dependencies(result_id, op0); @@ -6520,6 +7160,9 @@ string CompilerGLSL::legacy_tex_op(const std::string &op, const SPIRType &imgtyp require_extension_internal("GL_EXT_shadow_samplers"); else SPIRV_CROSS_THROW(join(op, " not allowed on depth samplers in legacy ES")); + + if (imgtype.image.dim == spv::DimCube) + return "shadowCubeNV"; } if (op == "textureSize") @@ -6785,7 +7428,7 @@ string CompilerGLSL::to_combined_image_sampler(VariableID image_id, VariableID s } } -bool CompilerGLSL::is_supported_subgroup_op_in_opengl(spv::Op op) +bool CompilerGLSL::is_supported_subgroup_op_in_opengl(spv::Op op, const uint32_t *ops) { switch (op) { @@ -6804,6 +7447,22 @@ bool CompilerGLSL::is_supported_subgroup_op_in_opengl(spv::Op op) case OpGroupNonUniformBallotBitExtract: case OpGroupNonUniformInverseBallot: return true; + case OpGroupNonUniformIAdd: + case OpGroupNonUniformFAdd: + case OpGroupNonUniformIMul: + case OpGroupNonUniformFMul: + { + const GroupOperation operation = static_cast(ops[3]); + if (operation == GroupOperationReduce || operation == GroupOperationInclusiveScan || + operation == GroupOperationExclusiveScan) + { + return true; + } + else + { + return false; + } + } default: return false; } @@ -7128,8 +7787,14 @@ std::string CompilerGLSL::to_texture_op(const Instruction &i, bool sparse, bool args.grad_x = grad_x; args.grad_y = grad_y; args.lod = lod; - args.coffset = coffset; - args.offset = offset; + + if (coffsets) + args.offset = coffsets; + else if (coffset) + args.offset = coffset; + else + args.offset = offset; + args.bias = bias; args.component = comp; args.sample = sample; @@ -7192,7 +7857,7 @@ bool CompilerGLSL::expression_is_constant_null(uint32_t id) const bool CompilerGLSL::expression_is_non_value_type_array(uint32_t ptr) { auto &type = expression_type(ptr); - if (type.array.empty()) + if (!type_is_top_level_array(get_pointee_type(type))) return false; if (!backend.array_is_value_type) @@ -7521,13 +8186,7 @@ string CompilerGLSL::to_function_args(const TextureFunctionArguments &args, bool farg_str += ", 0"; } - if (args.coffset) - { - forward = forward && should_forward(args.coffset); - farg_str += ", "; - farg_str += bitcast_expression(SPIRType::Int, args.coffset); - } - else if (args.offset) + if (args.offset) { forward = forward && should_forward(args.offset); farg_str += ", "; @@ -7674,8 +8333,22 @@ void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, break; case GLSLstd450Trunc: - emit_unary_func_op(result_type, id, args[0], "trunc"); + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "trunc"); + else + { + // Implement by value-casting to int and back. + bool forward = should_forward(args[0]); + auto op0 = to_unpacked_expression(args[0]); + auto &op0_type = expression_type(args[0]); + auto via_type = op0_type; + via_type.basetype = SPIRType::Int; + auto expr = join(type_to_glsl(op0_type), "(", type_to_glsl(via_type), "(", op0, "))"); + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, args[0]); + } break; + case GLSLstd450SAbs: emit_unary_func_op_cast(result_type, id, args[0], "abs", int_type, int_type); break; @@ -7717,18 +8390,47 @@ void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, else emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "fma"); break; + case GLSLstd450Modf: register_call_out_argument(args[1]); - forced_temporaries.insert(id); - emit_binary_func_op(result_type, id, args[0], args[1], "modf"); + if (!is_legacy()) + { + forced_temporaries.insert(id); + emit_binary_func_op(result_type, id, args[0], args[1], "modf"); + } + else + { + //NB. legacy GLSL doesn't have trunc() either, so we do a value cast + auto &op1_type = expression_type(args[1]); + auto via_type = op1_type; + via_type.basetype = SPIRType::Int; + statement(to_expression(args[1]), " = ", + type_to_glsl(op1_type), "(", type_to_glsl(via_type), + "(", to_expression(args[0]), "));"); + emit_binary_op(result_type, id, args[0], args[1], "-"); + } break; case GLSLstd450ModfStruct: { auto &type = get(result_type); emit_uninitialized_temporary_expression(result_type, id); - statement(to_expression(id), ".", to_member_name(type, 0), " = ", "modf(", to_expression(args[0]), ", ", - to_expression(id), ".", to_member_name(type, 1), ");"); + if (!is_legacy()) + { + statement(to_expression(id), ".", to_member_name(type, 0), " = ", "modf(", to_expression(args[0]), ", ", + to_expression(id), ".", to_member_name(type, 1), ");"); + } + else + { + //NB. legacy GLSL doesn't have trunc() either, so we do a value cast + auto &op0_type = expression_type(args[0]); + auto via_type = op0_type; + via_type.basetype = SPIRType::Int; + statement(to_expression(id), ".", to_member_name(type, 1), " = ", type_to_glsl(op0_type), + "(", type_to_glsl(via_type), "(", to_expression(args[0]), "));"); + statement(to_expression(id), ".", to_member_name(type, 0), " = ", to_enclosed_expression(args[0]), " - ", + to_expression(id), ".", to_member_name(type, 1), ";"); + } break; } @@ -7789,22 +8491,77 @@ void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, emit_unary_func_op(result_type, id, args[0], "atan"); break; case GLSLstd450Sinh: - emit_unary_func_op(result_type, id, args[0], "sinh"); + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "sinh"); + else + { + bool forward = should_forward(args[0]); + auto expr = join("(exp(", to_expression(args[0]), ") - exp(-", to_enclosed_expression(args[0]), ")) * 0.5"); + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, args[0]); + } break; case GLSLstd450Cosh: - emit_unary_func_op(result_type, id, args[0], "cosh"); + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "cosh"); + else + { + bool forward = should_forward(args[0]); + auto expr = join("(exp(", to_expression(args[0]), ") + exp(-", to_enclosed_expression(args[0]), ")) * 0.5"); + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, args[0]); + } break; case GLSLstd450Tanh: - emit_unary_func_op(result_type, id, args[0], "tanh"); + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "tanh"); + else + { + // Create temporaries to store the result of exp(arg) and exp(-arg). + uint32_t &ids = extra_sub_expressions[id]; + if (!ids) + { + ids = ir.increase_bound_by(2); + + // Inherit precision qualifier (legacy has no NoContraction). + if (has_decoration(id, DecorationRelaxedPrecision)) + { + set_decoration(ids, DecorationRelaxedPrecision); + set_decoration(ids + 1, DecorationRelaxedPrecision); + } + } + uint32_t epos_id = ids; + uint32_t eneg_id = ids + 1; + + emit_op(result_type, epos_id, join("exp(", to_expression(args[0]), ")"), false); + emit_op(result_type, eneg_id, join("exp(-", to_enclosed_expression(args[0]), ")"), false); + inherit_expression_dependencies(epos_id, args[0]); + inherit_expression_dependencies(eneg_id, args[0]); + + auto expr = join("(", to_enclosed_expression(epos_id), " - ", to_enclosed_expression(eneg_id), ") / " + "(", to_enclosed_expression(epos_id), " + ", to_enclosed_expression(eneg_id), ")"); + emit_op(result_type, id, expr, true); + inherit_expression_dependencies(id, epos_id); + inherit_expression_dependencies(id, eneg_id); + } break; case GLSLstd450Asinh: - emit_unary_func_op(result_type, id, args[0], "asinh"); + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "asinh"); + else + emit_emulated_ahyper_op(result_type, id, args[0], GLSLstd450Asinh); break; case GLSLstd450Acosh: - emit_unary_func_op(result_type, id, args[0], "acosh"); + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "acosh"); + else + emit_emulated_ahyper_op(result_type, id, args[0], GLSLstd450Acosh); break; case GLSLstd450Atanh: - emit_unary_func_op(result_type, id, args[0], "atanh"); + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "atanh"); + else + emit_emulated_ahyper_op(result_type, id, args[0], GLSLstd450Atanh); break; case GLSLstd450Atan2: emit_binary_func_op(result_type, id, args[0], args[1], "atan"); @@ -7835,11 +8592,74 @@ void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, // Matrix math case GLSLstd450Determinant: - emit_unary_func_op(result_type, id, args[0], "determinant"); + { + // No need to transpose - it doesn't affect the determinant + auto *e = maybe_get(args[0]); + bool old_transpose = e && e->need_transpose; + if (old_transpose) + e->need_transpose = false; + + if (options.version < 150) // also matches ES 100 + { + auto &type = expression_type(args[0]); + assert(type.vecsize >= 2 && type.vecsize <= 4); + assert(type.vecsize == type.columns); + + // ARB_gpu_shader_fp64 needs GLSL 150, other types are not valid + if (type.basetype != SPIRType::Float) + SPIRV_CROSS_THROW("Unsupported type for matrix determinant"); + + bool relaxed = has_decoration(id, DecorationRelaxedPrecision); + require_polyfill(static_cast(PolyfillDeterminant2x2 << (type.vecsize - 2)), + relaxed); + emit_unary_func_op(result_type, id, args[0], + (options.es && relaxed) ? "spvDeterminantMP" : "spvDeterminant"); + } + else + emit_unary_func_op(result_type, id, args[0], "determinant"); + + if (old_transpose) + e->need_transpose = true; break; + } + case GLSLstd450MatrixInverse: - emit_unary_func_op(result_type, id, args[0], "inverse"); + { + // The inverse of the transpose is the same as the transpose of + // the inverse, so we can just flip need_transpose of the result. + auto *a = maybe_get(args[0]); + bool old_transpose = a && a->need_transpose; + if (old_transpose) + a->need_transpose = false; + + const char *func = "inverse"; + if (options.version < 140) // also matches ES 100 + { + auto &type = get(result_type); + assert(type.vecsize >= 2 && type.vecsize <= 4); + assert(type.vecsize == type.columns); + + // ARB_gpu_shader_fp64 needs GLSL 150, other types are invalid + if (type.basetype != SPIRType::Float) + SPIRV_CROSS_THROW("Unsupported type for matrix inverse"); + + bool relaxed = has_decoration(id, DecorationRelaxedPrecision); + require_polyfill(static_cast(PolyfillMatrixInverse2x2 << (type.vecsize - 2)), + relaxed); + func = (options.es && relaxed) ? "spvInverseMP" : "spvInverse"; + } + + bool forward = should_forward(args[0]); + auto &e = emit_op(result_type, id, join(func, "(", to_unpacked_expression(args[0]), ")"), forward); + inherit_expression_dependencies(id, args[0]); + + if (old_transpose) + { + e.need_transpose = true; + a->need_transpose = true; + } break; + } // Lerping case GLSLstd450FMix: @@ -8032,11 +8852,58 @@ void CompilerGLSL::emit_nminmax_op(uint32_t result_type, uint32_t id, uint32_t o ir.meta[tmp_id] = ir.meta[id]; ir.meta[mixed_first_id] = ir.meta[id]; - emit_unary_func_op(btype_id, left_nan_id, op0, "isnan"); - emit_unary_func_op(btype_id, right_nan_id, op1, "isnan"); - emit_binary_func_op(result_type, tmp_id, op0, op1, op == GLSLstd450NMin ? "min" : "max"); - emit_mix_op(result_type, mixed_first_id, tmp_id, op1, left_nan_id); - emit_mix_op(result_type, id, mixed_first_id, op0, right_nan_id); + if (!is_legacy()) + { + emit_unary_func_op(btype_id, left_nan_id, op0, "isnan"); + emit_unary_func_op(btype_id, right_nan_id, op1, "isnan"); + } + else if (expression_type(op0).vecsize > 1) + { + // If the number doesn't equal itself, it must be NaN + emit_binary_func_op(btype_id, left_nan_id, op0, op0, "notEqual"); + emit_binary_func_op(btype_id, right_nan_id, op1, op1, "notEqual"); + } + else + { + emit_binary_op(btype_id, left_nan_id, op0, op0, "!="); + emit_binary_op(btype_id, right_nan_id, op1, op1, "!="); + } + emit_binary_func_op(result_type, tmp_id, op0, op1, op == GLSLstd450NMin ? "min" : "max"); + emit_mix_op(result_type, mixed_first_id, tmp_id, op1, left_nan_id); + emit_mix_op(result_type, id, mixed_first_id, op0, right_nan_id); +} + +void CompilerGLSL::emit_emulated_ahyper_op(uint32_t result_type, uint32_t id, uint32_t op0, GLSLstd450 op) +{ + const char *one = backend.float_literal_suffix ? "1.0f" : "1.0"; + std::string expr; + bool forward = should_forward(op0); + + switch (op) + { + case GLSLstd450Asinh: + expr = join("log(", to_enclosed_expression(op0), " + sqrt(", + to_enclosed_expression(op0), " * ", to_enclosed_expression(op0), " + ", one, "))"); + emit_op(result_type, id, expr, forward); + break; + + case GLSLstd450Acosh: + expr = join("log(", to_enclosed_expression(op0), " + sqrt(", + to_enclosed_expression(op0), " * ", to_enclosed_expression(op0), " - ", one, "))"); + break; + + case GLSLstd450Atanh: + expr = join("log((", one, " + ", to_enclosed_expression(op0), ") / " + "(", one, " - ", to_enclosed_expression(op0), ")) * 0.5", + backend.float_literal_suffix ? "f" : ""); + break; + + default: + SPIRV_CROSS_THROW("Invalid op."); + } + + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, op0); } void CompilerGLSL::emit_spv_amd_shader_ballot_op(uint32_t result_type, uint32_t id, uint32_t eop, const uint32_t *args, @@ -8193,7 +9060,7 @@ void CompilerGLSL::emit_subgroup_op(const Instruction &i) const uint32_t *ops = stream(i); auto op = static_cast(i.op); - if (!options.vulkan_semantics && !is_supported_subgroup_op_in_opengl(op)) + if (!options.vulkan_semantics && !is_supported_subgroup_op_in_opengl(op, ops)) SPIRV_CROSS_THROW("This subgroup operation is only supported in Vulkan semantics."); // If we need to do implicit bitcasts, make sure we do it with the correct type. @@ -8261,12 +9128,34 @@ void CompilerGLSL::emit_subgroup_op(const Instruction &i) } break; - case OpGroupNonUniformFAdd: - case OpGroupNonUniformFMul: + // clang-format off +#define GLSL_GROUP_OP(OP)\ + case OpGroupNonUniform##OP:\ + {\ + auto operation = static_cast(ops[3]);\ + if (operation == GroupOperationClusteredReduce)\ + require_extension_internal("GL_KHR_shader_subgroup_clustered");\ + else if (operation == GroupOperationReduce)\ + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupArithmetic##OP##Reduce);\ + else if (operation == GroupOperationExclusiveScan)\ + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupArithmetic##OP##ExclusiveScan);\ + else if (operation == GroupOperationInclusiveScan)\ + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupArithmetic##OP##InclusiveScan);\ + else\ + SPIRV_CROSS_THROW("Invalid group operation.");\ + break;\ + } + + GLSL_GROUP_OP(IAdd) + GLSL_GROUP_OP(FAdd) + GLSL_GROUP_OP(IMul) + GLSL_GROUP_OP(FMul) + +#undef GLSL_GROUP_OP + // clang-format on + case OpGroupNonUniformFMin: case OpGroupNonUniformFMax: - case OpGroupNonUniformIAdd: - case OpGroupNonUniformIMul: case OpGroupNonUniformSMin: case OpGroupNonUniformSMax: case OpGroupNonUniformUMin: @@ -8622,9 +9511,17 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) case BuiltInPointSize: return "gl_PointSize"; case BuiltInClipDistance: + { + if (options.es) + require_extension_internal("GL_EXT_clip_cull_distance"); return "gl_ClipDistance"; + } case BuiltInCullDistance: + { + if (options.es) + require_extension_internal("GL_EXT_clip_cull_distance"); return "gl_CullDistance"; + } case BuiltInVertexId: if (options.vulkan_semantics) SPIRV_CROSS_THROW("Cannot implement gl_VertexID in Vulkan GLSL. This shader was created " @@ -8769,17 +9666,21 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) return "gl_DrawIDARB"; case BuiltInSampleId: - if (options.es && options.version < 320) + if (is_legacy()) + SPIRV_CROSS_THROW("Sample variables not supported in legacy GLSL."); + else if (options.es && options.version < 320) require_extension_internal("GL_OES_sample_variables"); - if (!options.es && options.version < 400) - SPIRV_CROSS_THROW("gl_SampleID not supported before GLSL 400."); + else if (!options.es && options.version < 400) + require_extension_internal("GL_ARB_sample_shading"); return "gl_SampleID"; case BuiltInSampleMask: - if (options.es && options.version < 320) + if (is_legacy()) + SPIRV_CROSS_THROW("Sample variables not supported in legacy GLSL."); + else if (options.es && options.version < 320) require_extension_internal("GL_OES_sample_variables"); - if (!options.es && options.version < 400) - SPIRV_CROSS_THROW("gl_SampleMask/gl_SampleMaskIn not supported before GLSL 400."); + else if (!options.es && options.version < 400) + require_extension_internal("GL_ARB_sample_shading"); if (storage == StorageClassInput) return "gl_SampleMaskIn"; @@ -8787,10 +9688,12 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) return "gl_SampleMask"; case BuiltInSamplePosition: - if (options.es && options.version < 320) + if (is_legacy()) + SPIRV_CROSS_THROW("Sample variables not supported in legacy GLSL."); + else if (options.es && options.version < 320) require_extension_internal("GL_OES_sample_variables"); - if (!options.es && options.version < 400) - SPIRV_CROSS_THROW("gl_SamplePosition not supported before GLSL 400."); + else if (!options.es && options.version < 400) + require_extension_internal("GL_ARB_sample_shading"); return "gl_SamplePosition"; case BuiltInViewIndex: @@ -9059,6 +9962,15 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice bool relaxed_precision = has_decoration(base, DecorationRelaxedPrecision); bool pending_array_enclose = false; bool dimension_flatten = false; + bool access_meshlet_position_y = false; + + if (auto *base_expr = maybe_get(base)) + { + access_meshlet_position_y = base_expr->access_meshlet_position_y; + } + + // If we are translating access to a structured buffer, the first subscript '._m0' must be hidden + bool hide_first_subscript = count > 1 && is_user_type_structured(base); const auto append_index = [&](uint32_t index, bool is_literal, bool is_ptr_chain = false) { AccessChainFlags mod_flags = flags; @@ -9159,8 +10071,14 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice switch (builtin) { - // case BuiltInCullDistance: // These are already arrays, need to figure out rules for these in tess/geom. - // case BuiltInClipDistance: + case BuiltInCullDistance: + case BuiltInClipDistance: + if (type->array.size() == 1) // Red herring. Only consider block IO for two-dimensional arrays here. + { + append_index(index, is_literal); + break; + } + // fallthrough case BuiltInPosition: case BuiltInPointSize: if (mesh_shader) @@ -9189,6 +10107,14 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice break; } } + else if (backend.force_merged_mesh_block && i == 0 && var && + !is_builtin_variable(*var) && var->storage == StorageClassOutput) + { + if (is_per_primitive_variable(*var)) + expr = join("gl_MeshPrimitivesEXT[", to_expression(index, register_expression_read), "].", expr); + else + expr = join("gl_MeshVerticesEXT[", to_expression(index, register_expression_read), "].", expr); + } else if (options.flatten_multidimensional_arrays && dimension_flatten) { // If we are flattening multidimensional arrays, do manual stride computation. @@ -9220,6 +10146,13 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice append_index(index, is_literal); } + if (var && has_decoration(var->self, DecorationBuiltIn) && + get_decoration(var->self, DecorationBuiltIn) == BuiltInPosition && + get_execution_model() == ExecutionModelMeshEXT) + { + access_meshlet_position_y = true; + } + type_id = type->parent_type; type = &get(type_id); @@ -9238,27 +10171,46 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice if (index >= type->member_types.size()) SPIRV_CROSS_THROW("Member index is out of bounds!"); - BuiltIn builtin; - if (is_member_builtin(*type, index, &builtin) && access_chain_needs_stage_io_builtin_translation(base)) + if (hide_first_subscript) { - if (access_chain_is_arrayed) - { - expr += "."; - expr += builtin_to_glsl(builtin, type->storage); - } - else - expr = builtin_to_glsl(builtin, type->storage); + // First "._m0" subscript has been hidden, subsequent fields must be emitted even for structured buffers + hide_first_subscript = false; } else { - // If the member has a qualified name, use it as the entire chain - string qual_mbr_name = get_member_qualified_name(type_id, index); - if (!qual_mbr_name.empty()) - expr = qual_mbr_name; - else if (flatten_member_reference) - expr += join("_", to_member_name(*type, index)); + BuiltIn builtin = BuiltInMax; + if (is_member_builtin(*type, index, &builtin) && access_chain_needs_stage_io_builtin_translation(base)) + { + if (access_chain_is_arrayed) + { + expr += "."; + expr += builtin_to_glsl(builtin, type->storage); + } + else + expr = builtin_to_glsl(builtin, type->storage); + + if (builtin == BuiltInPosition && get_execution_model() == ExecutionModelMeshEXT) + { + access_meshlet_position_y = true; + } + } else - expr += to_member_reference(base, *type, index, ptr_chain); + { + // If the member has a qualified name, use it as the entire chain + string qual_mbr_name = get_member_qualified_name(type_id, index); + if (!qual_mbr_name.empty()) + expr = qual_mbr_name; + else if (flatten_member_reference) + expr += join("_", to_member_name(*type, index)); + else + { + // Any pointer de-refences for values are handled in the first access chain. + // For pointer chains, the pointer-ness is resolved through an array access. + // The only time this is not true is when accessing array of SSBO/UBO. + // This case is explicitly handled. + expr += to_member_reference(base, *type, index, ptr_chain || i != 0); + } + } } if (has_member_decoration(type->self, index, DecorationInvariant)) @@ -9385,6 +10337,26 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice is_packed); } + if (access_meshlet_position_y) + { + if (is_literal) + { + access_meshlet_position_y = index == 1; + } + else + { + const auto *c = maybe_get(index); + if (c) + access_meshlet_position_y = c->scalar() == 1; + else + { + // We don't know, but we have to assume no. + // Flip Y in mesh shaders is an opt-in horrible hack, so we'll have to assume shaders try to behave. + access_meshlet_position_y = false; + } + } + } + expr += deferred_index; row_major_matrix_needs_conversion = false; @@ -9411,6 +10383,7 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice meta->storage_is_invariant = is_invariant; meta->storage_physical_type = physical_type; meta->relaxed_precision = relaxed_precision; + meta->access_meshlet_position_y = access_meshlet_position_y; } return expr; @@ -9592,10 +10565,13 @@ std::string CompilerGLSL::flattened_access_chain_struct(uint32_t base, const uin // The access chain terminates at the struct, so we need to find matrix strides and row-major information // ahead of time. bool need_transpose = false; + bool relaxed = false; uint32_t matrix_stride = 0; if (member_type.columns > 1) { - need_transpose = combined_decoration_for_member(target_type, i).get(DecorationRowMajor); + auto decorations = combined_decoration_for_member(target_type, i); + need_transpose = decorations.get(DecorationRowMajor); + relaxed = decorations.get(DecorationRelaxedPrecision); matrix_stride = type_struct_member_matrix_stride(target_type, i); } @@ -9604,7 +10580,7 @@ std::string CompilerGLSL::flattened_access_chain_struct(uint32_t base, const uin // Cannot forward transpositions, so resolve them here. if (need_transpose) - expr += convert_row_major_matrix(tmp, member_type, 0, false); + expr += convert_row_major_matrix(tmp, member_type, 0, false, relaxed); else expr += tmp; } @@ -9901,9 +10877,32 @@ bool CompilerGLSL::should_dereference(uint32_t id) if (auto *var = maybe_get(id)) return var->phi_variable; - // If id is an access chain, we should not dereference it. if (auto *expr = maybe_get(id)) - return !expr->access_chain; + { + // If id is an access chain, we should not dereference it. + if (expr->access_chain) + return false; + + // If id is a forwarded copy of a variable pointer, we should not dereference it. + SPIRVariable *var = nullptr; + while (expr->loaded_from && expression_is_forwarded(expr->self)) + { + auto &src_type = expression_type(expr->loaded_from); + // To be a copy, the pointer and its source expression must be the + // same type. Can't check type.self, because for some reason that's + // usually the base type with pointers stripped off. This check is + // complex enough that I've hoisted it out of the while condition. + if (src_type.pointer != type.pointer || src_type.pointer_depth != type.pointer_depth || + src_type.parent_type != type.parent_type) + break; + if ((var = maybe_get(expr->loaded_from))) + break; + if (!(expr = maybe_get(expr->loaded_from))) + break; + } + + return !var || var->phi_variable; + } // Otherwise, we should dereference this pointer expression. return true; @@ -10258,7 +11257,7 @@ string CompilerGLSL::build_composite_combiner(uint32_t return_type, const uint32 bool uses_buffer_offset = type.basetype == SPIRType::Struct && has_member_decoration(type.self, i, DecorationOffset); - subop = to_composite_constructor_expression(elems[i], uses_buffer_offset); + subop = to_composite_constructor_expression(type, elems[i], uses_buffer_offset); } base = e ? e->base_expression : ID(0); @@ -10317,6 +11316,12 @@ bool CompilerGLSL::optimize_read_modify_write(const SPIRType &type, const string char bop = rhs[op]; auto expr = rhs.substr(lhs.size() + 3); + + // Avoids false positives where we get a = a * b + c. + // Normally, these expressions are always enclosed, but unexpected code paths may end up hitting this. + if (needs_enclose_expression(expr)) + return false; + // Try to find increments and decrements. Makes it look neater as += 1, -= 1 is fairly rare to see in real code. // Find some common patterns which are equivalent. if ((bop == '+' || bop == '-') && (expr == "1" || expr == "uint(1)" || expr == "1u" || expr == "int(1u)")) @@ -10342,8 +11347,15 @@ void CompilerGLSL::emit_block_instructions(SPIRBlock &block) if (backend.requires_relaxed_precision_analysis) { // If PHI variables are consumed in unexpected precision contexts, copy them here. - for (auto &phi : block.phi_variables) + for (size_t i = 0, n = block.phi_variables.size(); i < n; i++) { + auto &phi = block.phi_variables[i]; + + // Ensure we only copy once. We know a-priori that this array will lay out + // the same function variables together. + if (i && block.phi_variables[i - 1].function_variable == phi.function_variable) + continue; + auto itr = temporary_to_mirror_precision_alias.find(phi.function_variable); if (itr != temporary_to_mirror_precision_alias.end()) { @@ -10751,8 +11763,10 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) #define GLSL_BOP(op) emit_binary_op(ops[0], ops[1], ops[2], ops[3], #op) #define GLSL_BOP_CAST(op, type) \ - emit_binary_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, opcode_is_sign_invariant(opcode)) + emit_binary_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, \ + opcode_is_sign_invariant(opcode), implicit_integer_promotion) #define GLSL_UOP(op) emit_unary_op(ops[0], ops[1], ops[2], #op) +#define GLSL_UOP_CAST(op) emit_unary_op_cast(ops[0], ops[1], ops[2], #op) #define GLSL_QFOP(op) emit_quaternary_func_op(ops[0], ops[1], ops[2], ops[3], ops[4], ops[5], #op) #define GLSL_TFOP(op) emit_trinary_func_op(ops[0], ops[1], ops[2], ops[3], ops[4], #op) #define GLSL_BFOP(op) emit_binary_func_op(ops[0], ops[1], ops[2], ops[3], #op) @@ -10766,6 +11780,13 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) auto int_type = to_signed_basetype(integer_width); auto uint_type = to_unsigned_basetype(integer_width); + // Handle C implicit integer promotion rules. + // If we get implicit promotion to int, need to make sure we cast by value to intended return type, + // otherwise, future sign-dependent operations and bitcasts will break. + bool implicit_integer_promotion = integer_width < 32 && backend.implicit_c_integer_promotion_rules && + opcode_can_promote_integer_implicitly(opcode) && + get(ops[0]).vecsize == 1; + opcode = get_remapped_spirv_op(opcode); switch (opcode) @@ -10873,7 +11894,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) // it is an array, and our backend does not support arrays as value types. // Emit the temporary, and copy it explicitly. e = &emit_uninitialized_temporary_expression(result_type, id); - emit_array_copy(to_expression(id), id, ptr, StorageClassFunction, get_expression_effective_storage_class(ptr)); + emit_array_copy(nullptr, id, ptr, StorageClassFunction, get_expression_effective_storage_class(ptr)); } else e = &emit_op(result_type, id, expr, forward, !usage_tracking); @@ -10935,6 +11956,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) expr.loaded_from = backing_variable ? backing_variable->self : ID(ops[2]); expr.need_transpose = meta.need_transpose; expr.access_chain = true; + expr.access_meshlet_position_y = meta.access_meshlet_position_y; // Mark the result as being packed. Some platforms handled packed vectors differently than non-packed. if (meta.storage_is_packed) @@ -11491,7 +12513,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) // RHS expression is immutable, so just forward it. // Copying these things really make no sense, but // seems to be allowed anyways. - auto &e = set(id, to_expression(rhs), result_type, true); + auto &e = emit_op(result_type, id, to_expression(rhs), true, true); if (pointer) { auto *var = maybe_get_backing_variable(rhs); @@ -11592,14 +12614,66 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) // ALU case OpIsNan: - GLSL_UFOP(isnan); + if (!is_legacy()) + GLSL_UFOP(isnan); + else + { + // Check if the number doesn't equal itself + auto &type = get(ops[0]); + if (type.vecsize > 1) + emit_binary_func_op(ops[0], ops[1], ops[2], ops[2], "notEqual"); + else + emit_binary_op(ops[0], ops[1], ops[2], ops[2], "!="); + } break; case OpIsInf: - GLSL_UFOP(isinf); + if (!is_legacy()) + GLSL_UFOP(isinf); + else + { + // inf * 2 == inf by IEEE 754 rules, note this also applies to 0.0 + // This is more reliable than checking if product with zero is NaN + uint32_t result_type = ops[0]; + uint32_t result_id = ops[1]; + uint32_t operand = ops[2]; + + auto &type = get(result_type); + std::string expr; + if (type.vecsize > 1) + { + expr = type_to_glsl_constructor(type); + expr += '('; + for (uint32_t i = 0; i < type.vecsize; i++) + { + auto comp = to_extract_component_expression(operand, i); + expr += join(comp, " != 0.0 && 2.0 * ", comp, " == ", comp); + + if (i + 1 < type.vecsize) + expr += ", "; + } + expr += ')'; + } + else + { + // Register an extra read to force writing out a temporary + auto oper = to_enclosed_expression(operand); + track_expression_read(operand); + expr += join(oper, " != 0.0 && 2.0 * ", oper, " == ", oper); + } + emit_op(result_type, result_id, expr, should_forward(operand)); + + inherit_expression_dependencies(result_id, operand); + } break; case OpSNegate: + if (implicit_integer_promotion || expression_type_id(ops[2]) != ops[0]) + GLSL_UOP_CAST(-); + else + GLSL_UOP(-); + break; + case OpFNegate: GLSL_UOP(-); break; @@ -11689,14 +12763,59 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) break; } - case OpFMul: case OpMatrixTimesScalar: + { + auto *a = maybe_get(ops[2]); + + // If the matrix need transpose, just mark the result as needing so. + if (a && a->need_transpose) + { + a->need_transpose = false; + auto expr = join(enclose_expression(to_unpacked_row_major_matrix_expression(ops[2])), " * ", + to_enclosed_unpacked_expression(ops[3])); + bool forward = should_forward(ops[2]) && should_forward(ops[3]); + auto &e = emit_op(ops[0], ops[1], expr, forward); + e.need_transpose = true; + a->need_transpose = true; + inherit_expression_dependencies(ops[1], ops[2]); + inherit_expression_dependencies(ops[1], ops[3]); + } + else + GLSL_BOP(*); + break; + } + + case OpFMul: case OpVectorTimesScalar: GLSL_BOP(*); break; case OpOuterProduct: - GLSL_BFOP(outerProduct); + if (options.version < 120) // Matches GLSL 1.10 / ESSL 1.00 + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t a = ops[2]; + uint32_t b = ops[3]; + + auto &type = get(result_type); + string expr = type_to_glsl_constructor(type); + expr += "("; + for (uint32_t col = 0; col < type.columns; col++) + { + expr += to_enclosed_expression(a); + expr += " * "; + expr += to_extract_component_expression(b, col); + if (col + 1 < type.columns) + expr += ", "; + } + expr += ")"; + emit_op(result_type, id, expr, should_forward(a) && should_forward(b)); + inherit_expression_dependencies(id, a); + inherit_expression_dependencies(id, b); + } + else + GLSL_BFOP(outerProduct); break; case OpDot: @@ -11744,6 +12863,9 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) auto expr = join(to_enclosed_expression(op0), " - ", to_enclosed_expression(op1), " * ", "(", to_enclosed_expression(op0), " / ", to_enclosed_expression(op1), ")"); + if (implicit_integer_promotion) + expr = join(type_to_glsl(get(result_type)), '(', expr, ')'); + emit_op(result_type, result_id, expr, forward); inherit_expression_dependencies(result_id, op0); inherit_expression_dependencies(result_id, op1); @@ -11841,7 +12963,10 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) } case OpNot: - GLSL_UOP(~); + if (implicit_integer_promotion || expression_type_id(ops[2]) != ops[0]) + GLSL_UOP_CAST(~); + else + GLSL_UOP(~); break; case OpUMod: @@ -11858,10 +12983,6 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) case OpFRem: { - if (is_legacy()) - SPIRV_CROSS_THROW("OpFRem requires trunc() and is only supported on non-legacy targets. A workaround is " - "needed for legacy."); - uint32_t result_type = ops[0]; uint32_t result_id = ops[1]; uint32_t op0 = ops[2]; @@ -11869,8 +12990,22 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) // Needs special handling. bool forward = should_forward(op0) && should_forward(op1); - auto expr = join(to_enclosed_expression(op0), " - ", to_enclosed_expression(op1), " * ", "trunc(", - to_enclosed_expression(op0), " / ", to_enclosed_expression(op1), ")"); + std::string expr; + if (!is_legacy()) + { + expr = join(to_enclosed_expression(op0), " - ", to_enclosed_expression(op1), " * ", "trunc(", + to_enclosed_expression(op0), " / ", to_enclosed_expression(op1), ")"); + } + else + { + // Legacy GLSL has no trunc, emulate by casting to int and back + auto &op0_type = expression_type(op0); + auto via_type = op0_type; + via_type.basetype = SPIRType::Int; + expr = join(to_enclosed_expression(op0), " - ", to_enclosed_expression(op1), " * ", + type_to_glsl(op0_type), "(", type_to_glsl(via_type), "(", + to_enclosed_expression(op0), " / ", to_enclosed_expression(op1), "))"); + } emit_op(result_type, result_id, expr, forward); inherit_expression_dependencies(result_id, op0); @@ -12524,7 +13659,12 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) op = "textureQueryLOD"; } else if (options.es) - SPIRV_CROSS_THROW("textureQueryLod not supported in ES profile."); + { + if (options.version < 300) + SPIRV_CROSS_THROW("textureQueryLod not supported in legacy ES"); + require_extension_internal("GL_EXT_texture_query_lod"); + op = "textureQueryLOD"; + } else op = "textureQueryLod"; @@ -12570,6 +13710,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) uint32_t result_type = ops[0]; uint32_t id = ops[1]; + if (options.es) + SPIRV_CROSS_THROW("textureSamples and imageSamples not supported in ES profile."); + else if (options.version < 450) + require_extension_internal("GL_ARB_texture_query_samples"); + string expr; if (type.image.sampled == 2) expr = join("imageSamples(", to_non_uniform_aware_expression(ops[2]), ")"); @@ -13099,7 +14244,9 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) { emit_spv_amd_gcn_shader_op(ops[0], ops[1], ops[3], &ops[4], length - 4); } - else if (ext == SPIRExtension::SPV_debug_info) + else if (ext == SPIRExtension::SPV_debug_info || + ext == SPIRExtension::NonSemanticShaderDebugInfo || + ext == SPIRExtension::NonSemanticGeneric) { break; // Ignore SPIR-V debug information extended instructions. } @@ -13610,6 +14757,42 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) statement("SetMeshOutputsEXT(", to_unpacked_expression(ops[0]), ", ", to_unpacked_expression(ops[1]), ");"); break; + case OpReadClockKHR: + { + auto &type = get(ops[0]); + auto scope = static_cast(evaluate_constant_u32(ops[2])); + const char *op = nullptr; + // Forwarding clock statements leads to a scenario where an SSA value can take on different + // values every time it's evaluated. Block any forwarding attempt. + // We also might want to invalidate all expressions to function as a sort of optimization + // barrier, but might be overkill for now. + if (scope == ScopeDevice) + { + require_extension_internal("GL_EXT_shader_realtime_clock"); + if (type.basetype == SPIRType::BaseType::UInt64) + op = "clockRealtimeEXT()"; + else if (type.basetype == SPIRType::BaseType::UInt && type.vecsize == 2) + op = "clockRealtime2x32EXT()"; + else + SPIRV_CROSS_THROW("Unsupported result type for OpReadClockKHR opcode."); + } + else if (scope == ScopeSubgroup) + { + require_extension_internal("GL_ARB_shader_clock"); + if (type.basetype == SPIRType::BaseType::UInt64) + op = "clockARB()"; + else if (type.basetype == SPIRType::BaseType::UInt && type.vecsize == 2) + op = "clock2x32ARB()"; + else + SPIRV_CROSS_THROW("Unsupported result type for OpReadClockKHR opcode."); + } + else + SPIRV_CROSS_THROW("Unsupported scope for OpReadClockKHR opcode."); + + emit_op(ops[0], ops[1], op, false); + break; + } + default: statement("// unimplemented op ", instruction.op); break; @@ -13742,7 +14925,7 @@ bool CompilerGLSL::member_is_packed_physical_type(const SPIRType &type, uint32_t // Base implementation uses the standard library transpose() function. // Subclasses may override to use a different function. string CompilerGLSL::convert_row_major_matrix(string exp_str, const SPIRType &exp_type, uint32_t /* physical_type_id */, - bool /*is_packed*/) + bool /*is_packed*/, bool relaxed) { strip_enclosed_expression(exp_str); if (!is_matrix(exp_type)) @@ -13772,32 +14955,14 @@ string CompilerGLSL::convert_row_major_matrix(string exp_str, const SPIRType &ex // GLSL 110, ES 100 do not have transpose(), so emulate it. Note that // these GLSL versions do not support non-square matrices. if (exp_type.vecsize == 2 && exp_type.columns == 2) - { - if (!requires_transpose_2x2) - { - requires_transpose_2x2 = true; - force_recompile(); - } - } + require_polyfill(PolyfillTranspose2x2, relaxed); else if (exp_type.vecsize == 3 && exp_type.columns == 3) - { - if (!requires_transpose_3x3) - { - requires_transpose_3x3 = true; - force_recompile(); - } - } + require_polyfill(PolyfillTranspose3x3, relaxed); else if (exp_type.vecsize == 4 && exp_type.columns == 4) - { - if (!requires_transpose_4x4) - { - requires_transpose_4x4 = true; - force_recompile(); - } - } + require_polyfill(PolyfillTranspose4x4, relaxed); else SPIRV_CROSS_THROW("Non-square matrices are not supported in legacy GLSL, cannot transpose."); - return join("spvTranspose(", exp_str, ")"); + return join("spvTranspose", (options.es && relaxed) ? "MP" : "", "(", exp_str, ")"); } else return join("transpose(", exp_str, ")"); @@ -13965,7 +15130,7 @@ string CompilerGLSL::to_qualifiers_glsl(uint32_t id) if (var && var->storage == StorageClassWorkgroup && !backend.shared_is_implied) res += "shared "; - else if (var && var->storage == StorageClassTaskPayloadWorkgroupEXT) + else if (var && var->storage == StorageClassTaskPayloadWorkgroupEXT && !backend.shared_is_implied) res += "taskPayloadSharedEXT "; res += to_interpolation_qualifiers(flags); @@ -14206,6 +15371,14 @@ string CompilerGLSL::image_type_glsl(const SPIRType &type, uint32_t id) switch (imagetype.basetype) { + case SPIRType::Int64: + res = "i64"; + require_extension_internal("GL_EXT_shader_image_int64"); + break; + case SPIRType::UInt64: + res = "u64"; + require_extension_internal("GL_EXT_shader_image_int64"); + break; case SPIRType::Int: case SPIRType::Short: case SPIRType::SByte: @@ -14300,6 +15473,17 @@ string CompilerGLSL::image_type_glsl(const SPIRType &type, uint32_t id) is_depth_image(type, id)) { res += "Shadow"; + + if (type.image.dim == DimCube && is_legacy()) + { + if (!options.es) + require_extension_internal("GL_EXT_gpu_shader4"); + else + { + require_extension_internal("GL_NV_shadow_samplers_cube"); + res += "NV"; + } + } } return res; @@ -14379,7 +15563,20 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) } if (type.basetype == SPIRType::UInt && is_legacy()) - SPIRV_CROSS_THROW("Unsigned integers are not supported on legacy targets."); + { + if (options.es) + SPIRV_CROSS_THROW("Unsigned integers are not supported on legacy ESSL."); + else + require_extension_internal("GL_EXT_gpu_shader4"); + } + + if (type.basetype == SPIRType::AtomicCounter) + { + if (options.es && options.version < 310) + SPIRV_CROSS_THROW("At least ESSL 3.10 required for atomic counters."); + else if (!options.es && options.version < 420) + require_extension_internal("GL_ARB_shader_atomic_counters"); + } if (type.vecsize == 1 && type.columns == 1) // Scalar builtin { @@ -14534,6 +15731,11 @@ void CompilerGLSL::require_extension(const std::string &ext) forced_extensions.push_back(ext); } +const SmallVector &CompilerGLSL::get_required_extensions() const +{ + return forced_extensions; +} + void CompilerGLSL::require_extension_internal(const string &ext) { if (backend.supports_extensions && !has_extension(ext)) @@ -14567,6 +15769,11 @@ bool CompilerGLSL::builtin_translates_to_nonarray(spv::BuiltIn /*builtin*/) cons return false; // GLSL itself does not need to translate array builtin types to non-array builtin types } +bool CompilerGLSL::is_user_type_structured(uint32_t /*id*/) const +{ + return false; // GLSL itself does not have structured user type, but HLSL does with StructuredBuffer and RWStructuredBuffer resources. +} + bool CompilerGLSL::check_atomic_image(uint32_t id) { auto &type = expression_type(id); @@ -15293,6 +16500,17 @@ bool CompilerGLSL::for_loop_initializers_are_same_type(const SPIRBlock &block) return true; } +void CompilerGLSL::emit_block_instructions_with_masked_debug(SPIRBlock &block) +{ + // Have to block debug instructions such as OpLine here, since it will be treated as a statement otherwise, + // which breaks loop optimizations. + // Any line directive would be declared outside the loop body, which would just be confusing either way. + bool old_block_debug_directives = block_debug_directives; + block_debug_directives = true; + emit_block_instructions(block); + block_debug_directives = old_block_debug_directives; +} + bool CompilerGLSL::attempt_emit_loop_header(SPIRBlock &block, SPIRBlock::Method method) { SPIRBlock::ContinueBlockType continue_type = continue_block_type(get(block.continue_block)); @@ -15303,7 +16521,7 @@ bool CompilerGLSL::attempt_emit_loop_header(SPIRBlock &block, SPIRBlock::Method // If we're trying to create a true for loop, // we need to make sure that all opcodes before branch statement do not actually emit any code. // We can then take the condition expression and create a for (; cond ; ) { body; } structure instead. - emit_block_instructions(block); + emit_block_instructions_with_masked_debug(block); bool condition_is_temporary = forced_temporaries.find(block.condition) == end(forced_temporaries); @@ -15383,7 +16601,7 @@ bool CompilerGLSL::attempt_emit_loop_header(SPIRBlock &block, SPIRBlock::Method // If we're trying to create a true for loop, // we need to make sure that all opcodes before branch statement do not actually emit any code. // We can then take the condition expression and create a for (; cond ; ) { body; } structure instead. - emit_block_instructions(child); + emit_block_instructions_with_masked_debug(child); bool condition_is_temporary = forced_temporaries.find(child.condition) == end(forced_temporaries); @@ -15521,6 +16739,24 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) if (block.merge == SPIRBlock::MergeLoop) add_loop_level(); + // If we're emitting PHI variables with precision aliases, we have to emit them as hoisted temporaries. + for (auto var_id : block.dominated_variables) + { + auto &var = get(var_id); + if (var.phi_variable) + { + auto mirrored_precision_itr = temporary_to_mirror_precision_alias.find(var_id); + if (mirrored_precision_itr != temporary_to_mirror_precision_alias.end() && + find_if(block.declare_temporary.begin(), block.declare_temporary.end(), + [mirrored_precision_itr](const std::pair &p) { + return p.second == mirrored_precision_itr->second; + }) == block.declare_temporary.end()) + { + block.declare_temporary.push_back({ var.basetype, mirrored_precision_itr->second }); + } + } + } + emit_hoisted_temporaries(block.declare_temporary); SPIRBlock::ContinueBlockType continue_type = SPIRBlock::ContinueNone; @@ -16125,10 +17361,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) break; case SPIRBlock::EmitMeshTasks: - statement("EmitMeshTasksEXT(", - to_unpacked_expression(block.mesh.groups[0]), ", ", - to_unpacked_expression(block.mesh.groups[1]), ", ", - to_unpacked_expression(block.mesh.groups[2]), ");"); + emit_mesh_tasks(block); break; default: @@ -16305,9 +17538,16 @@ uint32_t CompilerGLSL::mask_relevant_memory_semantics(uint32_t semantics) MemorySemanticsCrossWorkgroupMemoryMask | MemorySemanticsSubgroupMemoryMask); } -void CompilerGLSL::emit_array_copy(const string &lhs, uint32_t, uint32_t rhs_id, StorageClass, StorageClass) +bool CompilerGLSL::emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, StorageClass, StorageClass) { + string lhs; + if (expr) + lhs = expr; + else + lhs = to_expression(lhs_id); + statement(lhs, " = ", to_expression(rhs_id), ";"); + return true; } bool CompilerGLSL::unroll_array_to_complex_store(uint32_t target_id, uint32_t source_id) @@ -16423,7 +17663,12 @@ void CompilerGLSL::cast_from_variable_load(uint32_t source_id, std::string &expr // Only interested in standalone builtin variables. if (!has_decoration(source_id, DecorationBuiltIn)) + { + // Except for int attributes in legacy GLSL, which are cast from float. + if (is_legacy() && expr_type.basetype == SPIRType::Int && var && var->storage == StorageClassInput) + expr = join(type_to_glsl(expr_type), "(", expr, ")"); return; + } auto builtin = static_cast(get_decoration(source_id, DecorationBuiltIn)); auto expected_type = expr_type.basetype; @@ -16715,7 +17960,7 @@ void CompilerGLSL::reorder_type_alias() if (alias_itr < master_itr) { // Must also swap the type order for the constant-type joined array. - auto &joined_types = ir.ids_for_constant_or_type; + auto &joined_types = ir.ids_for_constant_undef_or_type; auto alt_alias_itr = find(begin(joined_types), end(joined_types), *alias_itr); auto alt_master_itr = find(begin(joined_types), end(joined_types), *master_itr); assert(alt_alias_itr != end(joined_types)); @@ -16735,6 +17980,11 @@ void CompilerGLSL::emit_line_directive(uint32_t file_id, uint32_t line_literal) if (redirect_statement) return; + // If we're emitting code in a sensitive context such as condition blocks in for loops, don't emit + // any line directives, because it's not possible. + if (block_debug_directives) + return; + if (options.emit_line_directives) { require_extension_internal("GL_GOOGLE_cpp_style_line_directive"); @@ -16897,6 +18147,7 @@ const char *CompilerGLSL::ShaderSubgroupSupportHelper::get_extension_name(Candid static const char *const retval[CandidateCount] = { "GL_KHR_shader_subgroup_ballot", "GL_KHR_shader_subgroup_basic", "GL_KHR_shader_subgroup_vote", + "GL_KHR_shader_subgroup_arithmetic", "GL_NV_gpu_shader_5", "GL_NV_shader_thread_group", "GL_NV_shader_thread_shuffle", @@ -16945,6 +18196,21 @@ CompilerGLSL::ShaderSubgroupSupportHelper::FeatureVector CompilerGLSL::ShaderSub return { SubgroupMask }; case SubgroupBallotBitCount: return { SubgroupBallot }; + case SubgroupArithmeticIAddReduce: + case SubgroupArithmeticIAddInclusiveScan: + case SubgroupArithmeticFAddReduce: + case SubgroupArithmeticFAddInclusiveScan: + case SubgroupArithmeticIMulReduce: + case SubgroupArithmeticIMulInclusiveScan: + case SubgroupArithmeticFMulReduce: + case SubgroupArithmeticFMulInclusiveScan: + return { SubgroupSize, SubgroupBallot, SubgroupBallotBitCount, SubgroupMask, SubgroupBallotBitExtract }; + case SubgroupArithmeticIAddExclusiveScan: + case SubgroupArithmeticFAddExclusiveScan: + case SubgroupArithmeticIMulExclusiveScan: + case SubgroupArithmeticFMulExclusiveScan: + return { SubgroupSize, SubgroupBallot, SubgroupBallotBitCount, + SubgroupMask, SubgroupElect, SubgroupBallotBitExtract }; default: return {}; } @@ -16958,11 +18224,15 @@ CompilerGLSL::ShaderSubgroupSupportHelper::FeatureMask CompilerGLSL::ShaderSubgr bool CompilerGLSL::ShaderSubgroupSupportHelper::can_feature_be_implemented_without_extensions(Feature feature) { - static const bool retval[FeatureCount] = { false, false, false, false, false, false, - true, // SubgroupBalloFindLSB_MSB - false, false, false, false, - true, // SubgroupMemBarrier - replaced with workgroup memory barriers - false, false, true, false }; + static const bool retval[FeatureCount] = { + false, false, false, false, false, false, + true, // SubgroupBalloFindLSB_MSB + false, false, false, false, + true, // SubgroupMemBarrier - replaced with workgroup memory barriers + false, false, true, false, + false, false, false, false, false, false, // iadd, fadd + false, false, false, false, false, false, // imul , fmul + }; return retval[feature]; } @@ -16974,7 +18244,11 @@ CompilerGLSL::ShaderSubgroupSupportHelper::Candidate CompilerGLSL::ShaderSubgrou KHR_shader_subgroup_ballot, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_vote, KHR_shader_subgroup_vote, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, - KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot + KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, }; return extensions[feature]; @@ -17070,6 +18344,19 @@ CompilerGLSL::ShaderSubgroupSupportHelper::CandidateVector CompilerGLSL::ShaderS return { NV_shader_thread_group }; case SubgroupBallotBitCount: return {}; + case SubgroupArithmeticIAddReduce: + case SubgroupArithmeticIAddExclusiveScan: + case SubgroupArithmeticIAddInclusiveScan: + case SubgroupArithmeticFAddReduce: + case SubgroupArithmeticFAddExclusiveScan: + case SubgroupArithmeticFAddInclusiveScan: + case SubgroupArithmeticIMulReduce: + case SubgroupArithmeticIMulExclusiveScan: + case SubgroupArithmeticIMulInclusiveScan: + case SubgroupArithmeticFMulReduce: + case SubgroupArithmeticFMulExclusiveScan: + case SubgroupArithmeticFMulInclusiveScan: + return { KHR_shader_subgroup_arithmetic, NV_shader_thread_shuffle }; default: return {}; } @@ -17094,6 +18381,7 @@ CompilerGLSL::ShaderSubgroupSupportHelper::Result::Result() weights[KHR_shader_subgroup_ballot] = big_num; weights[KHR_shader_subgroup_basic] = big_num; weights[KHR_shader_subgroup_vote] = big_num; + weights[KHR_shader_subgroup_arithmetic] = big_num; } void CompilerGLSL::request_workaround_wrapper_overload(TypeID id) @@ -17124,6 +18412,7 @@ void CompilerGLSL::rewrite_load_for_wrapped_row_major(std::string &expr, TypeID auto *type = &get(loaded_type); bool rewrite = false; + bool relaxed = options.es; if (is_matrix(*type)) { @@ -17134,24 +18423,31 @@ void CompilerGLSL::rewrite_load_for_wrapped_row_major(std::string &expr, TypeID // If an access chain occurred, the workaround is not required, so loading vectors or scalars don't need workaround. type = &backing_type; } + else + { + // If we're loading a composite, we don't have overloads like these. + relaxed = false; + } if (type->basetype == SPIRType::Struct) { // If we're loading a struct where any member is a row-major matrix, apply the workaround. for (uint32_t i = 0; i < uint32_t(type->member_types.size()); i++) { - if (combined_decoration_for_member(*type, i).get(DecorationRowMajor)) - { + auto decorations = combined_decoration_for_member(*type, i); + if (decorations.get(DecorationRowMajor)) rewrite = true; - break; - } + + // Since we decide on a per-struct basis, only use mediump wrapper if all candidates are mediump. + if (!decorations.get(DecorationRelaxedPrecision)) + relaxed = false; } } if (rewrite) { request_workaround_wrapper_overload(loaded_type); - expr = join("spvWorkaroundRowMajor(", expr, ")"); + expr = join("spvWorkaroundRowMajor", (relaxed ? "MP" : ""), "(", expr, ")"); } } @@ -17210,6 +18506,22 @@ bool CompilerGLSL::is_stage_output_block_member_masked(const SPIRVariable &var, } } +bool CompilerGLSL::is_per_primitive_variable(const SPIRVariable &var) const +{ + if (has_decoration(var.self, DecorationPerPrimitiveEXT)) + return true; + + auto &type = get(var.basetype); + if (!has_decoration(type.self, DecorationBlock)) + return false; + + for (uint32_t i = 0, n = uint32_t(type.member_types.size()); i < n; i++) + if (!has_member_decoration(type.self, i, DecorationPerPrimitiveEXT)) + return false; + + return true; +} + bool CompilerGLSL::is_stage_output_location_masked(uint32_t location, uint32_t component) const { return masked_output_locations.count({ location, component }) != 0; diff --git a/bgfx/3rdparty/spirv-cross/spirv_glsl.hpp b/bgfx/3rdparty/spirv-cross/spirv_glsl.hpp index 2d1dad6c..8a841f34 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_glsl.hpp +++ b/bgfx/3rdparty/spirv-cross/spirv_glsl.hpp @@ -258,6 +258,10 @@ class CompilerGLSL : public Compiler // require_extension("GL_KHR_my_extension"); void require_extension(const std::string &ext); + // Returns the list of required extensions. After compilation this will contains any other + // extensions that the compiler used automatically, in addition to the user specified ones. + const SmallVector &get_required_extensions() const; + // Legacy GLSL compatibility method. // Takes a uniform or push constant variable and flattens it into a (i|u)vec4 array[N]; array instead. // For this to work, all types in the block must be the same basic type, e.g. mixing vec2 and vec4 is fine, but @@ -292,6 +296,7 @@ class CompilerGLSL : public Compiler KHR_shader_subgroup_ballot, KHR_shader_subgroup_basic, KHR_shader_subgroup_vote, + KHR_shader_subgroup_arithmetic, NV_gpu_shader_5, NV_shader_thread_group, NV_shader_thread_shuffle, @@ -324,7 +329,18 @@ class CompilerGLSL : public Compiler SubgroupInverseBallot_InclBitCount_ExclBitCout = 13, SubgroupBallotBitExtract = 14, SubgroupBallotBitCount = 15, - + SubgroupArithmeticIAddReduce = 16, + SubgroupArithmeticIAddExclusiveScan = 17, + SubgroupArithmeticIAddInclusiveScan = 18, + SubgroupArithmeticFAddReduce = 19, + SubgroupArithmeticFAddExclusiveScan = 20, + SubgroupArithmeticFAddInclusiveScan = 21, + SubgroupArithmeticIMulReduce = 22, + SubgroupArithmeticIMulExclusiveScan = 23, + SubgroupArithmeticIMulInclusiveScan = 24, + SubgroupArithmeticFMulReduce = 25, + SubgroupArithmeticFMulExclusiveScan = 26, + SubgroupArithmeticFMulInclusiveScan = 27, FeatureCount }; @@ -358,7 +374,7 @@ class CompilerGLSL : public Compiler }; // TODO remove this function when all subgroup ops are supported (or make it always return true) - static bool is_supported_subgroup_op_in_opengl(spv::Op op); + static bool is_supported_subgroup_op_in_opengl(spv::Op op, const uint32_t *ops); void reset(uint32_t iteration_count); void emit_function(SPIRFunction &func, const Bitset &return_flags); @@ -381,6 +397,7 @@ class CompilerGLSL : public Compiler }; TemporaryCopy handle_instruction_precision(const Instruction &instr); void emit_block_instructions(SPIRBlock &block); + void emit_block_instructions_with_masked_debug(SPIRBlock &block); // For relax_nan_checks. GLSLstd450 get_remapped_glsl_op(GLSLstd450 std450_op) const; @@ -414,7 +431,9 @@ class CompilerGLSL : public Compiler const std::string &qualifier = "", uint32_t base_offset = 0); virtual void emit_struct_padding_target(const SPIRType &type); virtual std::string image_type_glsl(const SPIRType &type, uint32_t id = 0); - std::string constant_expression(const SPIRConstant &c, bool inside_block_like_struct_scope = false); + std::string constant_expression(const SPIRConstant &c, + bool inside_block_like_struct_scope = false, + bool inside_struct_scope = false); virtual std::string constant_op_expression(const SPIRConstantOp &cop); virtual std::string constant_expression_vector(const SPIRConstant &c, uint32_t vector); virtual void emit_fixup(); @@ -448,7 +467,7 @@ class CompilerGLSL : public Compiler TextureFunctionArguments() = default; TextureFunctionBaseArguments base; uint32_t coord = 0, coord_components = 0, dref = 0; - uint32_t grad_x = 0, grad_y = 0, lod = 0, coffset = 0, offset = 0; + uint32_t grad_x = 0, grad_y = 0, lod = 0, offset = 0; uint32_t bias = 0, component = 0, sample = 0, sparse_texel = 0, min_lod = 0; bool nonuniform_expression = false; }; @@ -465,6 +484,8 @@ class CompilerGLSL : public Compiler virtual bool builtin_translates_to_nonarray(spv::BuiltIn builtin) const; + virtual bool is_user_type_structured(uint32_t id) const; + void emit_copy_logical_type(uint32_t lhs_id, uint32_t lhs_type_id, uint32_t rhs_id, uint32_t rhs_type_id, SmallVector chain); @@ -525,6 +546,7 @@ class CompilerGLSL : public Compiler SmallVector *redirect_statement = nullptr; const SPIRBlock *current_continue_block = nullptr; bool block_temporary_hoisting = false; + bool block_debug_directives = false; void begin_scope(); void end_scope(); @@ -552,7 +574,8 @@ class CompilerGLSL : public Compiler bool member_is_remapped_physical_type(const SPIRType &type, uint32_t index) const; bool member_is_packed_physical_type(const SPIRType &type, uint32_t index) const; virtual std::string convert_row_major_matrix(std::string exp_str, const SPIRType &exp_type, - uint32_t physical_type_id, bool is_packed); + uint32_t physical_type_id, bool is_packed, + bool relaxed = false); std::unordered_set local_variable_names; std::unordered_set resource_names; @@ -589,6 +612,7 @@ class CompilerGLSL : public Compiler const char *uint16_t_literal_suffix = "us"; const char *nonuniform_qualifier = "nonuniformEXT"; const char *boolean_mix_function = "mix"; + SPIRType::BaseType boolean_in_struct_remapped_type = SPIRType::Boolean; bool swizzle_is_function = false; bool shared_is_implied = false; bool unsized_array_supported = true; @@ -602,6 +626,7 @@ class CompilerGLSL : public Compiler bool allow_precision_qualifiers = false; bool can_swizzle_scalar = false; bool force_gl_in_out_block = false; + bool force_merged_mesh_block = false; bool can_return_array = true; bool allow_truncated_access_chain = false; bool supports_extensions = false; @@ -619,11 +644,14 @@ class CompilerGLSL : public Compiler bool support_64bit_switch = false; bool workgroup_size_is_hidden = false; bool requires_relaxed_precision_analysis = false; + bool implicit_c_integer_promotion_rules = false; } backend; void emit_struct(SPIRType &type); void emit_resources(); void emit_extension_workarounds(spv::ExecutionModel model); + void emit_subgroup_arithmetic_workaround(const std::string &func, spv::Op op, spv::GroupOperation group_op); + void emit_polyfills(uint32_t polyfills, bool relaxed); void emit_buffer_block_native(const SPIRVariable &var); void emit_buffer_reference_block(uint32_t type_id, bool forward_declaration); void emit_buffer_block_legacy(const SPIRVariable &var); @@ -661,6 +689,7 @@ class CompilerGLSL : public Compiler bool should_suppress_usage_tracking(uint32_t id) const; void emit_mix_op(uint32_t result_type, uint32_t id, uint32_t left, uint32_t right, uint32_t lerp); void emit_nminmax_op(uint32_t result_type, uint32_t id, uint32_t op0, uint32_t op1, GLSLstd450 op); + void emit_emulated_ahyper_op(uint32_t result_type, uint32_t result_id, uint32_t op0, GLSLstd450 op); bool to_trivial_mix_op(const SPIRType &type, std::string &op, uint32_t left, uint32_t right, uint32_t lerp); void emit_quaternary_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, uint32_t op2, uint32_t op3, const char *op); @@ -691,7 +720,7 @@ class CompilerGLSL : public Compiler void emit_unrolled_binary_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op, bool negate, SPIRType::BaseType expected_type); void emit_binary_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op, - SPIRType::BaseType input_type, bool skip_cast_if_equal_type); + SPIRType::BaseType input_type, bool skip_cast_if_equal_type, bool implicit_integer_promotion); SPIRType binary_op_bitcast_helper(std::string &cast_op0, std::string &cast_op1, SPIRType::BaseType &input_type, uint32_t op0, uint32_t op1, bool skip_cast_if_equal_type); @@ -702,6 +731,8 @@ class CompilerGLSL : public Compiler uint32_t false_value); void emit_unary_op(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op); + void emit_unary_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op); + virtual void emit_mesh_tasks(SPIRBlock &block); bool expression_is_forwarded(uint32_t id) const; bool expression_suppresses_usage_tracking(uint32_t id) const; bool expression_read_implies_multiple_reads(uint32_t id) const; @@ -750,8 +781,8 @@ class CompilerGLSL : public Compiler void append_global_func_args(const SPIRFunction &func, uint32_t index, SmallVector &arglist); std::string to_non_uniform_aware_expression(uint32_t id); std::string to_expression(uint32_t id, bool register_expression_read = true); - std::string to_composite_constructor_expression(uint32_t id, bool block_like_type); - std::string to_rerolled_array_expression(const std::string &expr, const SPIRType &type); + std::string to_composite_constructor_expression(const SPIRType &parent_type, uint32_t id, bool block_like_type); + std::string to_rerolled_array_expression(const SPIRType &parent_type, const std::string &expr, const SPIRType &type); std::string to_enclosed_expression(uint32_t id, bool register_expression_read = true); std::string to_unpacked_expression(uint32_t id, bool register_expression_read = true); std::string to_unpacked_row_major_matrix_expression(uint32_t id); @@ -762,12 +793,13 @@ class CompilerGLSL : public Compiler std::string to_extract_component_expression(uint32_t id, uint32_t index); std::string to_extract_constant_composite_expression(uint32_t result_type, const SPIRConstant &c, const uint32_t *chain, uint32_t length); + static bool needs_enclose_expression(const std::string &expr); std::string enclose_expression(const std::string &expr); std::string dereference_expression(const SPIRType &expression_type, const std::string &expr); std::string address_of_expression(const std::string &expr); void strip_enclosed_expression(std::string &expr); std::string to_member_name(const SPIRType &type, uint32_t index); - virtual std::string to_member_reference(uint32_t base, const SPIRType &type, uint32_t index, bool ptr_chain); + virtual std::string to_member_reference(uint32_t base, const SPIRType &type, uint32_t index, bool ptr_chain_is_resolved); std::string to_multi_member_reference(const SPIRType &type, const SmallVector &indices); std::string type_to_glsl_constructor(const SPIRType &type); std::string argument_decl(const SPIRFunction::Parameter &arg); @@ -783,7 +815,7 @@ class CompilerGLSL : public Compiler std::string layout_for_variable(const SPIRVariable &variable); std::string to_combined_image_sampler(VariableID image_id, VariableID samp_id); virtual bool skip_argument(uint32_t id) const; - virtual void emit_array_copy(const std::string &lhs, uint32_t lhs_id, uint32_t rhs_id, + virtual bool emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, spv::StorageClass lhs_storage, spv::StorageClass rhs_storage); virtual void emit_block_hints(const SPIRBlock &block); virtual std::string to_initializer_expression(const SPIRVariable &var); @@ -880,9 +912,23 @@ class CompilerGLSL : public Compiler return !options.es && options.version < 130; } - bool requires_transpose_2x2 = false; - bool requires_transpose_3x3 = false; - bool requires_transpose_4x4 = false; + enum Polyfill : uint32_t + { + PolyfillTranspose2x2 = 1 << 0, + PolyfillTranspose3x3 = 1 << 1, + PolyfillTranspose4x4 = 1 << 2, + PolyfillDeterminant2x2 = 1 << 3, + PolyfillDeterminant3x3 = 1 << 4, + PolyfillDeterminant4x4 = 1 << 5, + PolyfillMatrixInverse2x2 = 1 << 6, + PolyfillMatrixInverse3x3 = 1 << 7, + PolyfillMatrixInverse4x4 = 1 << 8, + }; + + uint32_t required_polyfills = 0; + uint32_t required_polyfills_relaxed = 0; + void require_polyfill(Polyfill polyfill, bool relaxed); + bool ray_tracing_is_khr = false; bool barycentric_is_nv = false; void ray_tracing_khr_fixup_locations(); @@ -934,8 +980,6 @@ class CompilerGLSL : public Compiler bool type_is_empty(const SPIRType &type); - virtual void declare_undefined_values(); - bool can_use_io_location(spv::StorageClass storage, bool block); const Instruction *get_next_instruction_in_block(const Instruction &instr); static uint32_t mask_relevant_memory_semantics(uint32_t semantics); @@ -980,6 +1024,7 @@ class CompilerGLSL : public Compiler bool is_stage_output_builtin_masked(spv::BuiltIn builtin) const; bool is_stage_output_variable_masked(const SPIRVariable &var) const; bool is_stage_output_block_member_masked(const SPIRVariable &var, uint32_t index, bool strip_array) const; + bool is_per_primitive_variable(const SPIRVariable &var) const; uint32_t get_accumulated_member_location(const SPIRVariable &var, uint32_t mbr_idx, bool strip_array) const; uint32_t get_declared_member_location(const SPIRVariable &var, uint32_t mbr_idx, bool strip_array) const; std::unordered_set masked_output_locations; @@ -987,6 +1032,12 @@ class CompilerGLSL : public Compiler private: void init(); + + SmallVector get_composite_constant_ids(ConstantID const_id); + void fill_composite_constant(SPIRConstant &constant, TypeID type_id, const SmallVector &initializers); + void set_composite_constant(ConstantID const_id, TypeID type_id, const SmallVector &initializers); + TypeID get_composite_member_type(TypeID type_id, uint32_t member_idx); + std::unordered_map> const_composite_insert_ids; }; } // namespace SPIRV_CROSS_NAMESPACE diff --git a/bgfx/3rdparty/spirv-cross/spirv_hlsl.cpp b/bgfx/3rdparty/spirv-cross/spirv_hlsl.cpp index 919727d7..8ba79b63 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_hlsl.cpp +++ b/bgfx/3rdparty/spirv-cross/spirv_hlsl.cpp @@ -603,55 +603,156 @@ void CompilerHLSL::emit_builtin_outputs_in_struct() break; case BuiltInClipDistance: + { + static const char *types[] = { "float", "float2", "float3", "float4" }; + // HLSL is a bit weird here, use SV_ClipDistance0, SV_ClipDistance1 and so on with vectors. - for (uint32_t clip = 0; clip < clip_distance_count; clip += 4) + if (execution.model == ExecutionModelMeshEXT) { - uint32_t to_declare = clip_distance_count - clip; - if (to_declare > 4) - to_declare = 4; + if (clip_distance_count > 4) + SPIRV_CROSS_THROW("Clip distance count > 4 not supported for mesh shaders."); - uint32_t semantic_index = clip / 4; + if (clip_distance_count == 1) + { + // Avoids having to hack up access_chain code. Makes it trivially indexable. + statement("float gl_ClipDistance[1] : SV_ClipDistance;"); + } + else + { + // Replace array with vector directly, avoids any weird fixup path. + statement(types[clip_distance_count - 1], " gl_ClipDistance : SV_ClipDistance;"); + } + } + else + { + for (uint32_t clip = 0; clip < clip_distance_count; clip += 4) + { + uint32_t to_declare = clip_distance_count - clip; + if (to_declare > 4) + to_declare = 4; - static const char *types[] = { "float", "float2", "float3", "float4" }; - statement(types[to_declare - 1], " ", builtin_to_glsl(builtin, StorageClassOutput), semantic_index, - " : SV_ClipDistance", semantic_index, ";"); + uint32_t semantic_index = clip / 4; + + statement(types[to_declare - 1], " ", builtin_to_glsl(builtin, StorageClassOutput), semantic_index, + " : SV_ClipDistance", semantic_index, ";"); + } } break; + } case BuiltInCullDistance: + { + static const char *types[] = { "float", "float2", "float3", "float4" }; + // HLSL is a bit weird here, use SV_CullDistance0, SV_CullDistance1 and so on with vectors. - for (uint32_t cull = 0; cull < cull_distance_count; cull += 4) + if (execution.model == ExecutionModelMeshEXT) { - uint32_t to_declare = cull_distance_count - cull; - if (to_declare > 4) - to_declare = 4; + if (cull_distance_count > 4) + SPIRV_CROSS_THROW("Cull distance count > 4 not supported for mesh shaders."); - uint32_t semantic_index = cull / 4; + if (cull_distance_count == 1) + { + // Avoids having to hack up access_chain code. Makes it trivially indexable. + statement("float gl_CullDistance[1] : SV_CullDistance;"); + } + else + { + // Replace array with vector directly, avoids any weird fixup path. + statement(types[cull_distance_count - 1], " gl_CullDistance : SV_CullDistance;"); + } + } + else + { + for (uint32_t cull = 0; cull < cull_distance_count; cull += 4) + { + uint32_t to_declare = cull_distance_count - cull; + if (to_declare > 4) + to_declare = 4; - static const char *types[] = { "float", "float2", "float3", "float4" }; - statement(types[to_declare - 1], " ", builtin_to_glsl(builtin, StorageClassOutput), semantic_index, - " : SV_CullDistance", semantic_index, ";"); + uint32_t semantic_index = cull / 4; + + statement(types[to_declare - 1], " ", builtin_to_glsl(builtin, StorageClassOutput), semantic_index, + " : SV_CullDistance", semantic_index, ";"); + } } break; + } case BuiltInPointSize: // If point_size_compat is enabled, just ignore PointSize. // PointSize does not exist in HLSL, but some code bases might want to be able to use these shaders, // even if it means working around the missing feature. - if (hlsl_options.point_size_compat) - break; - else + if (legacy) + { + type = "float"; + semantic = "PSIZE"; + } + else if (!hlsl_options.point_size_compat) SPIRV_CROSS_THROW("Unsupported builtin in HLSL."); + break; + + case BuiltInLayer: + case BuiltInPrimitiveId: + case BuiltInViewportIndex: + case BuiltInPrimitiveShadingRateKHR: + case BuiltInCullPrimitiveEXT: + // per-primitive attributes handled separatly + break; + + case BuiltInPrimitivePointIndicesEXT: + case BuiltInPrimitiveLineIndicesEXT: + case BuiltInPrimitiveTriangleIndicesEXT: + // meshlet local-index buffer handled separatly + break; + + default: + SPIRV_CROSS_THROW("Unsupported builtin in HLSL."); + } + + if (type && semantic) + statement(type, " ", builtin_to_glsl(builtin, StorageClassOutput), " : ", semantic, ";"); + }); +} +void CompilerHLSL::emit_builtin_primitive_outputs_in_struct() +{ + active_output_builtins.for_each_bit([&](uint32_t i) { + const char *type = nullptr; + const char *semantic = nullptr; + auto builtin = static_cast(i); + switch (builtin) + { case BuiltInLayer: - if (hlsl_options.shader_model < 50 || get_entry_point().model != ExecutionModelGeometry) - SPIRV_CROSS_THROW("Render target array index output is only supported in GS 5.0 or higher."); + { + if (hlsl_options.shader_model < 50) + SPIRV_CROSS_THROW("Render target array index output is only supported in SM 5.0 or higher."); type = "uint"; semantic = "SV_RenderTargetArrayIndex"; break; + } + + case BuiltInPrimitiveId: + type = "uint"; + semantic = "SV_PrimitiveID"; + break; + + case BuiltInViewportIndex: + type = "uint"; + semantic = "SV_ViewportArrayIndex"; + break; + + case BuiltInPrimitiveShadingRateKHR: + type = "uint"; + semantic = "SV_ShadingRate"; + break; + + case BuiltInCullPrimitiveEXT: + type = "bool"; + semantic = "SV_CullPrimitive"; + break; default: - SPIRV_CROSS_THROW("Unsupported builtin in HLSL."); + break; } if (type && semantic) @@ -748,6 +849,8 @@ void CompilerHLSL::emit_builtin_inputs_in_struct() case BuiltInSubgroupLeMask: case BuiltInSubgroupGtMask: case BuiltInSubgroupGeMask: + case BuiltInBaseVertex: + case BuiltInBaseInstance: // Handled specially. break; @@ -915,6 +1018,7 @@ void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, unord string binding; bool use_location_number = true; + bool need_matrix_unroll = false; bool legacy = hlsl_options.shader_model <= 30; if (execution.model == ExecutionModelFragment && var.storage == StorageClassOutput) { @@ -930,6 +1034,12 @@ void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, unord if (legacy) // COLOR must be a four-component vector on legacy shader model targets (HLSL ERR_COLOR_4COMP) type.vecsize = 4; } + else if (var.storage == StorageClassInput && execution.model == ExecutionModelVertex) + { + need_matrix_unroll = true; + if (legacy) // Inputs must be floating-point in legacy targets. + type.basetype = SPIRType::Float; + } const auto get_vacant_location = [&]() -> uint32_t { for (uint32_t i = 0; i < 64; i++) @@ -938,8 +1048,6 @@ void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, unord SPIRV_CROSS_THROW("All locations from 0 to 63 are exhausted."); }; - bool need_matrix_unroll = var.storage == StorageClassInput && execution.model == ExecutionModelVertex; - auto name = to_name(var.self); if (use_location_number) { @@ -979,17 +1087,25 @@ void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, unord } else { - statement(to_interpolation_qualifiers(get_decoration_bitset(var.self)), variable_decl(type, name), " : ", + auto decl_type = type; + if (execution.model == ExecutionModelMeshEXT) + { + decl_type.array.erase(decl_type.array.begin()); + decl_type.array_size_literal.erase(decl_type.array_size_literal.begin()); + } + statement(to_interpolation_qualifiers(get_decoration_bitset(var.self)), variable_decl(decl_type, name), " : ", semantic, ";"); // Structs and arrays should consume more locations. - uint32_t consumed_locations = type_to_consumed_locations(type); + uint32_t consumed_locations = type_to_consumed_locations(decl_type); for (uint32_t i = 0; i < consumed_locations; i++) active_locations.insert(location_number + i); } } else + { statement(variable_decl(type, name), " : ", binding, ";"); + } } std::string CompilerHLSL::builtin_to_glsl(spv::BuiltIn builtin, spv::StorageClass storage) @@ -1032,8 +1148,6 @@ void CompilerHLSL::emit_builtin_variables() Bitset builtins = active_input_builtins; builtins.merge_or(active_output_builtins); - bool need_base_vertex_info = false; - std::unordered_map builtin_to_initializer; ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { if (!is_builtin_variable(var) || var.storage != StorageClassOutput || !var.initializer) @@ -1071,6 +1185,18 @@ void CompilerHLSL::emit_builtin_variables() if (init_itr != builtin_to_initializer.end()) init_expr = join(" = ", to_expression(init_itr->second)); + if (get_execution_model() == ExecutionModelMeshEXT) + { + if (builtin == BuiltInPosition || builtin == BuiltInPointSize || builtin == BuiltInClipDistance || + builtin == BuiltInCullDistance || builtin == BuiltInLayer || builtin == BuiltInPrimitiveId || + builtin == BuiltInViewportIndex || builtin == BuiltInCullPrimitiveEXT || + builtin == BuiltInPrimitiveShadingRateKHR || builtin == BuiltInPrimitivePointIndicesEXT || + builtin == BuiltInPrimitiveLineIndicesEXT || builtin == BuiltInPrimitiveTriangleIndicesEXT) + { + return; + } + } + switch (builtin) { case BuiltInFragCoord: @@ -1087,7 +1213,13 @@ void CompilerHLSL::emit_builtin_variables() case BuiltInInstanceIndex: type = "int"; if (hlsl_options.support_nonzero_base_vertex_base_instance) - need_base_vertex_info = true; + base_vertex_info.used = true; + break; + + case BuiltInBaseVertex: + case BuiltInBaseInstance: + type = "int"; + base_vertex_info.used = true; break; case BuiltInInstanceId: @@ -1096,7 +1228,7 @@ void CompilerHLSL::emit_builtin_variables() break; case BuiltInPointSize: - if (hlsl_options.point_size_compat) + if (hlsl_options.point_size_compat || hlsl_options.shader_model <= 30) { // Just emit the global variable, it will be ignored. type = "float"; @@ -1165,6 +1297,13 @@ void CompilerHLSL::emit_builtin_variables() type = "uint"; break; + case BuiltInViewportIndex: + case BuiltInPrimitiveShadingRateKHR: + case BuiltInPrimitiveLineIndicesEXT: + case BuiltInCullPrimitiveEXT: + type = "uint"; + break; + default: SPIRV_CROSS_THROW(join("Unsupported builtin in HLSL: ", unsigned(builtin))); } @@ -1187,9 +1326,17 @@ void CompilerHLSL::emit_builtin_variables() } }); - if (need_base_vertex_info) + if (base_vertex_info.used) { - statement("cbuffer SPIRV_Cross_VertexInfo"); + string binding_info; + if (base_vertex_info.explicit_binding) + { + binding_info = join(" : register(b", base_vertex_info.register_index); + if (base_vertex_info.register_space) + binding_info += join(", space", base_vertex_info.register_space); + binding_info += ")"; + } + statement("cbuffer SPIRV_Cross_VertexInfo", binding_info); begin_scope(); statement("int SPIRV_Cross_BaseVertex;"); statement("int SPIRV_Cross_BaseInstance;"); @@ -1198,6 +1345,30 @@ void CompilerHLSL::emit_builtin_variables() } } +void CompilerHLSL::set_hlsl_aux_buffer_binding(HLSLAuxBinding binding, uint32_t register_index, uint32_t register_space) +{ + if (binding == HLSL_AUX_BINDING_BASE_VERTEX_INSTANCE) + { + base_vertex_info.explicit_binding = true; + base_vertex_info.register_space = register_space; + base_vertex_info.register_index = register_index; + } +} + +void CompilerHLSL::unset_hlsl_aux_buffer_binding(HLSLAuxBinding binding) +{ + if (binding == HLSL_AUX_BINDING_BASE_VERTEX_INSTANCE) + base_vertex_info.explicit_binding = false; +} + +bool CompilerHLSL::is_hlsl_aux_buffer_binding_used(HLSLAuxBinding binding) const +{ + if (binding == HLSL_AUX_BINDING_BASE_VERTEX_INSTANCE) + return base_vertex_info.used; + else + return false; +} + void CompilerHLSL::emit_composite_constants() { // HLSL cannot declare structs or arrays inline, so we must move them out to @@ -1245,7 +1416,7 @@ void CompilerHLSL::emit_specialization_constants_and_structs() }); auto loop_lock = ir.create_loop_hard_lock(); - for (auto &id_ : ir.ids_for_constant_or_type) + for (auto &id_ : ir.ids_for_constant_undef_or_type) { auto &id = ir.ids[id_]; @@ -1307,6 +1478,21 @@ void CompilerHLSL::emit_specialization_constants_and_structs() emit_struct(type); } } + else if (id.get_type() == TypeUndef) + { + auto &undef = id.get(); + auto &type = this->get(undef.basetype); + // OpUndef can be void for some reason ... + if (type.basetype == SPIRType::Void) + return; + + string initializer; + if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) + initializer = join(" = ", to_zero_initialized_expression(undef.basetype)); + + statement("static ", variable_decl(type, to_name(undef.self), undef.self), initializer, ";"); + emitted = true; + } } if (emitted) @@ -1327,12 +1513,12 @@ void CompilerHLSL::replace_illegal_names() "double", "DomainShader", "dword", "else", "export", "false", "float", "for", "fxgroup", "GeometryShader", "groupshared", "half", "HullShader", - "if", "in", "inline", "inout", "InputPatch", "int", "interface", + "indices", "if", "in", "inline", "inout", "InputPatch", "int", "interface", "line", "lineadj", "linear", "LineStream", "matrix", "min16float", "min10float", "min16int", "min16uint", "namespace", "nointerpolation", "noperspective", "NULL", "out", "OutputPatch", - "packoffset", "pass", "pixelfragment", "PixelShader", "point", + "payload", "packoffset", "pass", "pixelfragment", "PixelShader", "point", "PointStream", "precise", "RasterizerState", "RenderTargetView", "return", "register", "row_major", "RWBuffer", "RWByteAddressBuffer", "RWStructuredBuffer", "RWTexture1D", "RWTexture1DArray", "RWTexture2D", @@ -1343,40 +1529,32 @@ void CompilerHLSL::replace_illegal_names() "Texture1DArray", "Texture2D", "Texture2DArray", "Texture2DMS", "Texture2DMSArray", "Texture3D", "TextureCube", "TextureCubeArray", "true", "typedef", "triangle", "triangleadj", "TriangleStream", "uint", "uniform", "unorm", "unsigned", - "vector", "vertexfragment", "VertexShader", "void", "volatile", "while", + "vector", "vertexfragment", "VertexShader", "vertices", "void", "volatile", "while", }; CompilerGLSL::replace_illegal_names(keywords); CompilerGLSL::replace_illegal_names(); } -void CompilerHLSL::declare_undefined_values() -{ - bool emitted = false; - ir.for_each_typed_id([&](uint32_t, const SPIRUndef &undef) { - auto &type = this->get(undef.basetype); - // OpUndef can be void for some reason ... - if (type.basetype == SPIRType::Void) - return; - - string initializer; - if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) - initializer = join(" = ", to_zero_initialized_expression(undef.basetype)); - - statement("static ", variable_decl(type, to_name(undef.self), undef.self), initializer, ";"); - emitted = true; - }); - - if (emitted) - statement(""); -} - void CompilerHLSL::emit_resources() { auto &execution = get_entry_point(); replace_illegal_names(); + switch (execution.model) + { + case ExecutionModelGeometry: + case ExecutionModelTessellationControl: + case ExecutionModelTessellationEvaluation: + case ExecutionModelMeshEXT: + fixup_implicit_builtin_block_names(execution.model); + break; + + default: + break; + } + emit_specialization_constants_and_structs(); emit_composite_constants(); @@ -1449,18 +1627,21 @@ void CompilerHLSL::emit_resources() // Emit builtin input and output variables here. emit_builtin_variables(); - ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { - auto &type = this->get(var.basetype); + if (execution.model != ExecutionModelMeshEXT) + { + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + auto &type = this->get(var.basetype); - if (var.storage != StorageClassFunction && !var.remapped_variable && type.pointer && - (var.storage == StorageClassInput || var.storage == StorageClassOutput) && !is_builtin_variable(var) && - interface_variable_exists_in_entry_point(var.self)) - { - // Builtin variables are handled separately. - emit_interface_block_globally(var); - emitted = true; - } - }); + if (var.storage != StorageClassFunction && !var.remapped_variable && type.pointer && + (var.storage == StorageClassInput || var.storage == StorageClassOutput) && !is_builtin_variable(var) && + interface_variable_exists_in_entry_point(var.self)) + { + // Builtin variables are handled separately. + emit_interface_block_globally(var); + emitted = true; + } + }); + } if (emitted) statement(""); @@ -1574,23 +1755,48 @@ void CompilerHLSL::emit_resources() statement(""); } + const bool is_mesh_shader = execution.model == ExecutionModelMeshEXT; if (!output_variables.empty() || !active_output_builtins.empty()) { - require_output = true; - statement("struct SPIRV_Cross_Output"); + sort(output_variables.begin(), output_variables.end(), variable_compare); + require_output = !is_mesh_shader; + statement(is_mesh_shader ? "struct gl_MeshPerVertexEXT" : "struct SPIRV_Cross_Output"); begin_scope(); - sort(output_variables.begin(), output_variables.end(), variable_compare); for (auto &var : output_variables) { - if (var.block) + if (is_per_primitive_variable(*var.var)) + continue; + if (var.block && is_mesh_shader && var.block_member_index != 0) + continue; + if (var.block && !is_mesh_shader) emit_interface_block_member_in_struct(*var.var, var.block_member_index, var.location, active_outputs); else emit_interface_block_in_struct(*var.var, active_outputs); } emit_builtin_outputs_in_struct(); + if (!is_mesh_shader) + emit_builtin_primitive_outputs_in_struct(); end_scope_decl(); statement(""); + + if (is_mesh_shader) + { + statement("struct gl_MeshPerPrimitiveEXT"); + begin_scope(); + for (auto &var : output_variables) + { + if (!is_per_primitive_variable(*var.var)) + continue; + if (var.block && var.block_member_index != 0) + continue; + + emit_interface_block_in_struct(*var.var, active_outputs); + } + emit_builtin_primitive_outputs_in_struct(); + end_scope_decl(); + statement(""); + } } // Global variables. @@ -1600,6 +1806,9 @@ void CompilerHLSL::emit_resources() if (is_hidden_variable(var, true)) continue; + if (var.storage == StorageClassTaskPayloadWorkgroupEXT && is_mesh_shader) + continue; + if (var.storage != StorageClassOutput) { if (!variable_is_lut(var)) @@ -1610,6 +1819,7 @@ void CompilerHLSL::emit_resources() switch (var.storage) { case StorageClassWorkgroup: + case StorageClassTaskPayloadWorkgroupEXT: storage = "groupshared"; break; @@ -1634,8 +1844,6 @@ void CompilerHLSL::emit_resources() if (emitted) statement(""); - declare_undefined_values(); - if (requires_op_fmod) { static const char *types[] = { @@ -2046,6 +2254,20 @@ void CompilerHLSL::emit_resources() end_scope(); statement(""); } + + if (is_mesh_shader && options.vertex.flip_vert_y) + { + statement("float4 spvFlipVertY(float4 v)"); + begin_scope(); + statement("return float4(v.x, -v.y, v.z, v.w);"); + end_scope(); + statement(""); + statement("float spvFlipVertY(float v)"); + begin_scope(); + statement("return -v;"); + end_scope(); + statement(""); + } } void CompilerHLSL::emit_texture_size_variants(uint64_t variant_mask, const char *vecsize_qualifier, bool uav, @@ -2126,6 +2348,194 @@ void CompilerHLSL::emit_texture_size_variants(uint64_t variant_mask, const char } } +void CompilerHLSL::analyze_meshlet_writes() +{ + uint32_t id_per_vertex = 0; + uint32_t id_per_primitive = 0; + bool need_per_primitive = false; + bool need_per_vertex = false; + + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + auto &type = this->get(var.basetype); + bool block = has_decoration(type.self, DecorationBlock); + if (var.storage == StorageClassOutput && block && is_builtin_variable(var)) + { + auto flags = get_buffer_block_flags(var.self); + if (flags.get(DecorationPerPrimitiveEXT)) + id_per_primitive = var.self; + else + id_per_vertex = var.self; + } + else if (var.storage == StorageClassOutput) + { + Bitset flags; + if (block) + flags = get_buffer_block_flags(var.self); + else + flags = get_decoration_bitset(var.self); + + if (flags.get(DecorationPerPrimitiveEXT)) + need_per_primitive = true; + else + need_per_vertex = true; + } + }); + + // If we have per-primitive outputs, and no per-primitive builtins, + // empty version of gl_MeshPerPrimitiveEXT will be emitted. + // If we don't use block IO for vertex output, we'll also need to synthesize the PerVertex block. + + const auto generate_block = [&](const char *block_name, const char *instance_name, bool per_primitive) -> uint32_t { + auto &execution = get_entry_point(); + + uint32_t op_type = ir.increase_bound_by(4); + uint32_t op_arr = op_type + 1; + uint32_t op_ptr = op_type + 2; + uint32_t op_var = op_type + 3; + + auto &type = set(op_type); + type.basetype = SPIRType::Struct; + set_name(op_type, block_name); + set_decoration(op_type, DecorationBlock); + if (per_primitive) + set_decoration(op_type, DecorationPerPrimitiveEXT); + + auto &arr = set(op_arr, type); + arr.parent_type = type.self; + arr.array.push_back(per_primitive ? execution.output_primitives : execution.output_vertices); + arr.array_size_literal.push_back(true); + + auto &ptr = set(op_ptr, arr); + ptr.parent_type = arr.self; + ptr.pointer = true; + ptr.pointer_depth++; + ptr.storage = StorageClassOutput; + set_decoration(op_ptr, DecorationBlock); + set_name(op_ptr, block_name); + + auto &var = set(op_var, op_ptr, StorageClassOutput); + if (per_primitive) + set_decoration(op_var, DecorationPerPrimitiveEXT); + set_name(op_var, instance_name); + execution.interface_variables.push_back(var.self); + + return op_var; + }; + + if (id_per_vertex == 0 && need_per_vertex) + id_per_vertex = generate_block("gl_MeshPerVertexEXT", "gl_MeshVerticesEXT", false); + if (id_per_primitive == 0 && need_per_primitive) + id_per_primitive = generate_block("gl_MeshPerPrimitiveEXT", "gl_MeshPrimitivesEXT", true); + + unordered_set processed_func_ids; + analyze_meshlet_writes(ir.default_entry_point, id_per_vertex, id_per_primitive, processed_func_ids); +} + +void CompilerHLSL::analyze_meshlet_writes(uint32_t func_id, uint32_t id_per_vertex, uint32_t id_per_primitive, + std::unordered_set &processed_func_ids) +{ + // Avoid processing a function more than once + if (processed_func_ids.find(func_id) != processed_func_ids.end()) + return; + processed_func_ids.insert(func_id); + + auto &func = get(func_id); + // Recursively establish global args added to functions on which we depend. + for (auto& block : func.blocks) + { + auto &b = get(block); + for (auto &i : b.ops) + { + auto ops = stream(i); + auto op = static_cast(i.op); + + switch (op) + { + case OpFunctionCall: + { + // Then recurse into the function itself to extract globals used internally in the function + uint32_t inner_func_id = ops[2]; + analyze_meshlet_writes(inner_func_id, id_per_vertex, id_per_primitive, processed_func_ids); + auto &inner_func = get(inner_func_id); + for (auto &iarg : inner_func.arguments) + { + if (!iarg.alias_global_variable) + continue; + + bool already_declared = false; + for (auto &arg : func.arguments) + { + if (arg.id == iarg.id) + { + already_declared = true; + break; + } + } + + if (!already_declared) + { + // basetype is effectively ignored here since we declare the argument + // with explicit types. Just pass down a valid type. + func.arguments.push_back({ expression_type_id(iarg.id), iarg.id, + iarg.read_count, iarg.write_count, true }); + } + } + break; + } + + case OpStore: + case OpLoad: + case OpInBoundsAccessChain: + case OpAccessChain: + case OpPtrAccessChain: + case OpInBoundsPtrAccessChain: + case OpArrayLength: + { + auto *var = maybe_get(ops[op == OpStore ? 0 : 2]); + if (var && (var->storage == StorageClassOutput || var->storage == StorageClassTaskPayloadWorkgroupEXT)) + { + bool already_declared = false; + auto builtin_type = BuiltIn(get_decoration(var->self, DecorationBuiltIn)); + + uint32_t var_id = var->self; + if (var->storage != StorageClassTaskPayloadWorkgroupEXT && + builtin_type != BuiltInPrimitivePointIndicesEXT && + builtin_type != BuiltInPrimitiveLineIndicesEXT && + builtin_type != BuiltInPrimitiveTriangleIndicesEXT) + { + var_id = is_per_primitive_variable(*var) ? id_per_primitive : id_per_vertex; + } + + for (auto &arg : func.arguments) + { + if (arg.id == var_id) + { + already_declared = true; + break; + } + } + + if (!already_declared) + { + // basetype is effectively ignored here since we declare the argument + // with explicit types. Just pass down a valid type. + uint32_t type_id = expression_type_id(var_id); + if (var->storage == StorageClassTaskPayloadWorkgroupEXT) + func.arguments.push_back({ type_id, var_id, 1u, 0u, true }); + else + func.arguments.push_back({ type_id, var_id, 1u, 1u, true }); + } + } + break; + } + + default: + break; + } + } + } +} + string CompilerHLSL::layout_for_member(const SPIRType &type, uint32_t index) { auto &flags = get_member_decoration_bitset(type.self, index); @@ -2178,6 +2588,19 @@ void CompilerHLSL::emit_rayquery_function(const char *commited, const char *cand emit_op(ops[0], ops[1], join(to_expression(ops[2]), is_commited ? commited : candidate), false); } +void CompilerHLSL::emit_mesh_tasks(SPIRBlock &block) +{ + if (block.mesh.payload != 0) + { + statement("DispatchMesh(", to_unpacked_expression(block.mesh.groups[0]), ", ", to_unpacked_expression(block.mesh.groups[1]), ", ", + to_unpacked_expression(block.mesh.groups[2]), ", ", to_unpacked_expression(block.mesh.payload), ");"); + } + else + { + SPIRV_CROSS_THROW("Amplification shader in HLSL must have payload"); + } +} + void CompilerHLSL::emit_buffer_block(const SPIRVariable &var) { auto &type = get(var.basetype); @@ -2194,11 +2617,30 @@ void CompilerHLSL::emit_buffer_block(const SPIRVariable &var) bool is_readonly = flags.get(DecorationNonWritable) && !is_hlsl_force_storage_buffer_as_uav(var.self); bool is_coherent = flags.get(DecorationCoherent) && !is_readonly; bool is_interlocked = interlocked_resources.count(var.self) > 0; - const char *type_name = "ByteAddressBuffer "; - if (!is_readonly) - type_name = is_interlocked ? "RasterizerOrderedByteAddressBuffer " : "RWByteAddressBuffer "; + + auto to_structuredbuffer_subtype_name = [this](const SPIRType &parent_type) -> std::string + { + if (parent_type.basetype == SPIRType::Struct && parent_type.member_types.size() == 1) + { + // Use type of first struct member as a StructuredBuffer will have only one '._m0' field in SPIR-V + const auto &member0_type = this->get(parent_type.member_types.front()); + return this->type_to_glsl(member0_type); + } + else + { + // Otherwise, this StructuredBuffer only has a basic subtype, e.g. StructuredBuffer + return this->type_to_glsl(parent_type); + } + }; + + std::string type_name; + if (is_user_type_structured(var.self)) + type_name = join(is_readonly ? "" : is_interlocked ? "RasterizerOrdered" : "RW", "StructuredBuffer<", to_structuredbuffer_subtype_name(type), ">"); + else + type_name = is_readonly ? "ByteAddressBuffer" : is_interlocked ? "RasterizerOrderedByteAddressBuffer" : "RWByteAddressBuffer"; + add_resource_name(var.self); - statement(is_coherent ? "globallycoherent " : "", type_name, to_name(var.self), type_to_array_glsl(type), + statement(is_coherent ? "globallycoherent " : "", type_name, " ", to_name(var.self), type_to_array_glsl(type), to_resource_binding(var), ";"); } else @@ -2421,6 +2863,10 @@ string CompilerHLSL::get_inner_entry_point_name() const return "frag_main"; else if (execution.model == ExecutionModelGLCompute) return "comp_main"; + else if (execution.model == ExecutionModelMeshEXT) + return "mesh_main"; + else if (execution.model == ExecutionModelTaskEXT) + return "task_main"; else SPIRV_CROSS_THROW("Unsupported execution model."); } @@ -2534,8 +2980,58 @@ void CompilerHLSL::emit_hlsl_entry_point() switch (execution.model) { + case ExecutionModelTaskEXT: + case ExecutionModelMeshEXT: case ExecutionModelGLCompute: { + if (execution.model == ExecutionModelMeshEXT) + { + if (execution.flags.get(ExecutionModeOutputTrianglesEXT)) + statement("[outputtopology(\"triangle\")]"); + else if (execution.flags.get(ExecutionModeOutputLinesEXT)) + statement("[outputtopology(\"line\")]"); + else if (execution.flags.get(ExecutionModeOutputPoints)) + SPIRV_CROSS_THROW("Topology mode \"points\" is not supported in DirectX"); + + auto &func = get(ir.default_entry_point); + for (auto &arg : func.arguments) + { + auto &var = get(arg.id); + auto &base_type = get(var.basetype); + bool block = has_decoration(base_type.self, DecorationBlock); + if (var.storage == StorageClassTaskPayloadWorkgroupEXT) + { + arguments.push_back("in payload " + variable_decl(var)); + } + else if (block) + { + auto flags = get_buffer_block_flags(var.self); + if (flags.get(DecorationPerPrimitiveEXT) || has_decoration(arg.id, DecorationPerPrimitiveEXT)) + { + arguments.push_back("out primitives gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[" + + std::to_string(execution.output_primitives) + "]"); + } + else + { + arguments.push_back("out vertices gl_MeshPerVertexEXT gl_MeshVerticesEXT[" + + std::to_string(execution.output_vertices) + "]"); + } + } + else + { + if (execution.flags.get(ExecutionModeOutputTrianglesEXT)) + { + arguments.push_back("out indices uint3 gl_PrimitiveTriangleIndicesEXT[" + + std::to_string(execution.output_primitives) + "]"); + } + else + { + arguments.push_back("out indices uint2 gl_PrimitiveLineIndicesEXT[" + + std::to_string(execution.output_primitives) + "]"); + } + } + } + } SpecializationConstant wg_x, wg_y, wg_z; get_work_group_size_specialization_constants(wg_x, wg_y, wg_z); @@ -2612,6 +3108,14 @@ void CompilerHLSL::emit_hlsl_entry_point() statement(builtin, " = int(stage_input.", builtin, ");"); break; + case BuiltInBaseVertex: + statement(builtin, " = SPIRV_Cross_BaseVertex;"); + break; + + case BuiltInBaseInstance: + statement(builtin, " = SPIRV_Cross_BaseInstance;"); + break; + case BuiltInInstanceId: // D3D semantics are uint, but shader wants int. statement(builtin, " = int(stage_input.", builtin, ");"); @@ -2749,9 +3253,19 @@ void CompilerHLSL::emit_hlsl_entry_point() // Run the shader. if (execution.model == ExecutionModelVertex || execution.model == ExecutionModelFragment || - execution.model == ExecutionModelGLCompute) - { - statement(get_inner_entry_point_name(), "();"); + execution.model == ExecutionModelGLCompute || + execution.model == ExecutionModelMeshEXT || + execution.model == ExecutionModelTaskEXT) + { + // For mesh shaders, we receive special arguments that we must pass down as function arguments. + // HLSL does not support proper reference types for passing these IO blocks, + // but DXC post-inlining seems to magically fix it up anyways *shrug*. + SmallVector arglist; + auto &func = get(ir.default_entry_point); + // The arguments are marked out, avoid detecting reads and emitting inout. + for (auto &arg : func.arguments) + arglist.push_back(to_expression(arg.id, false)); + statement(get_inner_entry_point_name(), "(", merge(arglist), ");"); } else SPIRV_CROSS_THROW("Unsupported shader stage."); @@ -2763,8 +3277,8 @@ void CompilerHLSL::emit_hlsl_entry_point() // Copy builtins from globals to return struct. active_output_builtins.for_each_bit([&](uint32_t i) { - // PointSize doesn't exist in HLSL. - if (i == BuiltInPointSize) + // PointSize doesn't exist in HLSL SM 4+. + if (i == BuiltInPointSize && !legacy) return; switch (static_cast(i)) @@ -3030,9 +3544,9 @@ void CompilerHLSL::emit_texture_op(const Instruction &i, bool sparse) else { auto &imgformat = get(imgtype.image.type); - if (imgformat.basetype != SPIRType::Float) + if (hlsl_options.shader_model < 67 && imgformat.basetype != SPIRType::Float) { - SPIRV_CROSS_THROW("Sampling non-float textures is not supported in HLSL."); + SPIRV_CROSS_THROW("Sampling non-float textures is not supported in HLSL SM < 6.7."); } if (hlsl_options.shader_model >= 40) @@ -3043,7 +3557,7 @@ void CompilerHLSL::emit_texture_op(const Instruction &i, bool sparse) { if (gather) { - SPIRV_CROSS_THROW("GatherCmp does not exist in HLSL."); + texop += ".GatherCmp"; } else if (lod || grad_x || grad_y) { @@ -3660,10 +4174,16 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, emit_unary_func_op(result_type, id, args[0], "round"); break; + case GLSLstd450Trunc: + emit_unary_func_op(result_type, id, args[0], "trunc"); + break; + case GLSLstd450Acosh: case GLSLstd450Asinh: case GLSLstd450Atanh: - SPIRV_CROSS_THROW("Inverse hyperbolics are not supported on HLSL."); + // These are not supported in HLSL, always emulate them. + emit_emulated_ahyper_op(result_type, id, args[0], op); + break; case GLSLstd450FMix: case GLSLstd450IMix: @@ -4444,6 +4964,19 @@ void CompilerHLSL::write_access_chain(const SPIRAccessChain &chain, uint32_t val void CompilerHLSL::emit_store(const Instruction &instruction) { auto ops = stream(instruction); + if (options.vertex.flip_vert_y) + { + auto *expr = maybe_get(ops[0]); + if (expr != nullptr && expr->access_meshlet_position_y) + { + auto lhs = to_dereferenced_expression(ops[0]); + auto rhs = to_unpacked_expression(ops[1]); + statement(lhs, " = spvFlipVertY(", rhs, ");"); + register_write(ops[0]); + return; + } + } + auto *chain = maybe_get(ops[0]); if (chain) write_access_chain(*chain, ops[1], {}); @@ -4482,6 +5015,12 @@ void CompilerHLSL::emit_access_chain(const Instruction &instruction) auto *backing_variable = maybe_get_backing_variable(ops[2]); + if (backing_variable != nullptr && is_user_type_structured(backing_variable->self)) + { + CompilerGLSL::emit_instruction(instruction); + return; + } + string base; if (to_plain_buffer_length != 0) base = access_chain(ops[2], &ops[3], to_plain_buffer_length, get(ops[0])); @@ -4919,7 +5458,7 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction) #define HLSL_BOP(op) emit_binary_op(ops[0], ops[1], ops[2], ops[3], #op) #define HLSL_BOP_CAST(op, type) \ - emit_binary_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, opcode_is_sign_invariant(opcode)) + emit_binary_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, opcode_is_sign_invariant(opcode), false) #define HLSL_UOP(op) emit_unary_op(ops[0], ops[1], ops[2], #op) #define HLSL_QFOP(op) emit_quaternary_func_op(ops[0], ops[1], ops[2], ops[3], ops[4], ops[5], #op) #define HLSL_TFOP(op) emit_trinary_func_op(ops[0], ops[1], ops[2], ops[3], ops[4], #op) @@ -5544,6 +6083,11 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction) break; } + case OpAtomicFAddEXT: + case OpAtomicFMinEXT: + case OpAtomicFMaxEXT: + SPIRV_CROSS_THROW("Floating-point atomics are not supported in HLSL."); + case OpAtomicCompareExchange: case OpAtomicExchange: case OpAtomicISub: @@ -5773,7 +6317,7 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction) case OpRayQueryGenerateIntersectionKHR: { flush_variable_declaration(ops[0]); - statement(to_expression(ops[0]), ".CommitProceduralPrimitiveHit(", ops[1], ");"); + statement(to_expression(ops[0]), ".CommitProceduralPrimitiveHit(", to_expression(ops[1]), ");"); break; } case OpRayQueryConfirmIntersectionKHR: @@ -5880,6 +6424,11 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction) emit_op(ops[0], ops[1], join(to_expression(ops[2]), ".WorldRayDirection()"), false); break; } + case OpSetMeshOutputsEXT: + { + statement("SetMeshOutputCounts(", to_unpacked_expression(ops[0]), ", ", to_unpacked_expression(ops[1]), ");"); + break; + } default: CompilerGLSL::emit_instruction(instruction); break; @@ -6080,6 +6629,8 @@ string CompilerHLSL::compile() backend.can_return_array = false; backend.nonuniform_qualifier = "NonUniformResourceIndex"; backend.support_case_fallthrough = false; + backend.force_merged_mesh_block = get_execution_model() == ExecutionModelMeshEXT; + backend.force_gl_in_out_block = backend.force_merged_mesh_block; // SM 4.1 does not support precise for some reason. backend.support_precise_qualifier = hlsl_options.shader_model >= 50 || hlsl_options.shader_model == 40; @@ -6092,6 +6643,8 @@ string CompilerHLSL::compile() update_active_builtins(); analyze_image_and_sampler_usage(); analyze_interlocked_resource_usage(); + if (get_execution_model() == ExecutionModelMeshEXT) + analyze_meshlet_writes(); // Subpass input needs SV_Position. if (need_subpass_input) @@ -6197,3 +6750,17 @@ bool CompilerHLSL::builtin_translates_to_nonarray(spv::BuiltIn builtin) const { return (builtin == BuiltInSampleMask); } + +bool CompilerHLSL::is_user_type_structured(uint32_t id) const +{ + if (hlsl_options.preserve_structured_buffers) + { + // Compare left hand side of string only as these user types can contain more meta data such as their subtypes, + // e.g. "structuredbuffer:int" + const std::string &user_type = get_decoration_string(id, DecorationUserTypeGOOGLE); + return user_type.compare(0, 16, "structuredbuffer") == 0 || + user_type.compare(0, 18, "rwstructuredbuffer") == 0 || + user_type.compare(0, 33, "rasterizerorderedstructuredbuffer") == 0; + } + return false; +} diff --git a/bgfx/3rdparty/spirv-cross/spirv_hlsl.hpp b/bgfx/3rdparty/spirv-cross/spirv_hlsl.hpp index f01bcf96..a5d30b1b 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_hlsl.hpp +++ b/bgfx/3rdparty/spirv-cross/spirv_hlsl.hpp @@ -98,6 +98,11 @@ struct HLSLResourceBinding } cbv, uav, srv, sampler; }; +enum HLSLAuxBinding +{ + HLSL_AUX_BINDING_BASE_VERTEX_INSTANCE = 0 +}; + class CompilerHLSL : public CompilerGLSL { public: @@ -105,7 +110,7 @@ class CompilerHLSL : public CompilerGLSL { uint32_t shader_model = 30; // TODO: map ps_4_0_level_9_0,... somehow - // Allows the PointSize builtin, and ignores it, as PointSize is not supported in HLSL. + // Allows the PointSize builtin in SM 4.0+, and ignores it, as PointSize is not supported in SM 4+. bool point_size_compat = false; // Allows the PointCoord builtin, returns float2(0.5, 0.5), as PointCoord is not supported in HLSL. @@ -140,6 +145,11 @@ class CompilerHLSL : public CompilerGLSL // Rather than emitting main() for the entry point, use the name in SPIR-V. bool use_entry_point_name = false; + + // Preserve (RW)StructuredBuffer types if the input source was HLSL. + // This relies on UserTypeGOOGLE to encode the buffer type either as "structuredbuffer" or "rwstructuredbuffer" + // whereas the type can be extended with an optional subtype, e.g. "structuredbuffer:int". + bool preserve_structured_buffers = false; }; explicit CompilerHLSL(std::vector spirv_) @@ -211,6 +221,11 @@ class CompilerHLSL : public CompilerGLSL // Controls which storage buffer bindings will be forced to be declared as UAVs. void set_hlsl_force_storage_buffer_as_uav(uint32_t desc_set, uint32_t binding); + // By default, these magic buffers are not assigned a specific binding. + void set_hlsl_aux_buffer_binding(HLSLAuxBinding binding, uint32_t register_index, uint32_t register_space); + void unset_hlsl_aux_buffer_binding(HLSLAuxBinding binding); + bool is_hlsl_aux_buffer_binding_used(HLSLAuxBinding binding) const; + private: std::string type_to_glsl(const SPIRType &type, uint32_t id = 0) override; std::string image_type_hlsl(const SPIRType &type, uint32_t id); @@ -220,14 +235,13 @@ class CompilerHLSL : public CompilerGLSL void emit_hlsl_entry_point(); void emit_header() override; void emit_resources(); - void declare_undefined_values() override; void emit_interface_block_globally(const SPIRVariable &type); void emit_interface_block_in_struct(const SPIRVariable &var, std::unordered_set &active_locations); - void emit_interface_block_member_in_struct(const SPIRVariable &var, uint32_t member_index, - uint32_t location, + void emit_interface_block_member_in_struct(const SPIRVariable &var, uint32_t member_index, uint32_t location, std::unordered_set &active_locations); void emit_builtin_inputs_in_struct(); void emit_builtin_outputs_in_struct(); + void emit_builtin_primitive_outputs_in_struct(); void emit_texture_op(const Instruction &i, bool sparse) override; void emit_instruction(const Instruction &instruction) override; void emit_glsl_op(uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args, @@ -271,6 +285,7 @@ class CompilerHLSL : public CompilerGLSL void emit_struct_member(const SPIRType &type, uint32_t member_type_id, uint32_t index, const std::string &qualifier, uint32_t base_offset = 0) override; void emit_rayquery_function(const char *commited, const char *candidate, const uint32_t *ops); + void emit_mesh_tasks(SPIRBlock &block) override; const char *to_storage_qualifiers_glsl(const SPIRVariable &var) override; void replace_illegal_names() override; @@ -345,6 +360,10 @@ class CompilerHLSL : public CompilerGLSL TypeUnpackUint64 }; + void analyze_meshlet_writes(); + void analyze_meshlet_writes(uint32_t func_id, uint32_t id_per_vertex, uint32_t id_per_primitive, + std::unordered_set &processed_func_ids); + BitcastType get_bitcast_type(uint32_t result_type, uint32_t op0); void emit_builtin_variables(); @@ -373,9 +392,20 @@ class CompilerHLSL : public CompilerGLSL std::unordered_set force_uav_buffer_bindings; + struct + { + uint32_t register_index = 0; + uint32_t register_space = 0; + bool explicit_binding = false; + bool used = false; + } base_vertex_info; + // Returns true for BuiltInSampleMask because gl_SampleMask[] is an array in SPIR-V, but SV_Coverage is a scalar in HLSL. bool builtin_translates_to_nonarray(spv::BuiltIn builtin) const override; + // Returns true if the specified ID has a UserTypeGOOGLE decoration for StructuredBuffer or RWStructuredBuffer resources. + bool is_user_type_structured(uint32_t id) const override; + std::vector composite_selection_workaround_types; std::string get_inner_entry_point_name() const; diff --git a/bgfx/3rdparty/spirv-cross/spirv_msl.cpp b/bgfx/3rdparty/spirv-cross/spirv_msl.cpp index d81a8189..363d4852 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_msl.cpp +++ b/bgfx/3rdparty/spirv-cross/spirv_msl.cpp @@ -234,7 +234,8 @@ void CompilerMSL::build_implicit_builtins() bool need_sample_pos = active_input_builtins.get(BuiltInSamplePosition); bool need_vertex_params = capture_output_to_buffer && get_execution_model() == ExecutionModelVertex && !msl_options.vertex_for_tessellation; - bool need_tesc_params = get_execution_model() == ExecutionModelTessellationControl; + bool need_tesc_params = is_tesc_shader(); + bool need_tese_params = is_tese_shader() && msl_options.raw_buffer_tese_input; bool need_subgroup_mask = active_input_builtins.get(BuiltInSubgroupEqMask) || active_input_builtins.get(BuiltInSubgroupGeMask) || active_input_builtins.get(BuiltInSubgroupGtMask) || active_input_builtins.get(BuiltInSubgroupLeMask) || @@ -257,9 +258,9 @@ void CompilerMSL::build_implicit_builtins() bool need_workgroup_size = msl_options.emulate_subgroups && active_input_builtins.get(BuiltInNumSubgroups); if (need_subpass_input || need_sample_pos || need_subgroup_mask || need_vertex_params || need_tesc_params || - need_multiview || need_dispatch_base || need_vertex_base_params || need_grid_params || needs_sample_id || - needs_subgroup_invocation_id || needs_subgroup_size || has_additional_fixed_sample_mask() || need_local_invocation_index || - need_workgroup_size) + need_tese_params || need_multiview || need_dispatch_base || need_vertex_base_params || need_grid_params || + needs_sample_id || needs_subgroup_invocation_id || needs_subgroup_size || needs_helper_invocation || + has_additional_fixed_sample_mask() || need_local_invocation_index || need_workgroup_size) { bool has_frag_coord = false; bool has_sample_id = false; @@ -273,6 +274,7 @@ void CompilerMSL::build_implicit_builtins() bool has_subgroup_size = false; bool has_view_idx = false; bool has_layer = false; + bool has_helper_invocation = false; bool has_local_invocation_index = false; bool has_workgroup_size = false; uint32_t workgroup_id_type = 0; @@ -365,23 +367,28 @@ void CompilerMSL::build_implicit_builtins() } } - if (need_tesc_params) + if (need_tesc_params && builtin == BuiltInInvocationId) { - switch (builtin) - { - case BuiltInInvocationId: - builtin_invocation_id_id = var.self; - mark_implicit_builtin(StorageClassInput, BuiltInInvocationId, var.self); - has_invocation_id = true; - break; - case BuiltInPrimitiveId: - builtin_primitive_id_id = var.self; - mark_implicit_builtin(StorageClassInput, BuiltInPrimitiveId, var.self); - has_primitive_id = true; - break; - default: - break; - } + builtin_invocation_id_id = var.self; + mark_implicit_builtin(StorageClassInput, BuiltInInvocationId, var.self); + has_invocation_id = true; + } + + if ((need_tesc_params || need_tese_params) && builtin == BuiltInPrimitiveId) + { + builtin_primitive_id_id = var.self; + mark_implicit_builtin(StorageClassInput, BuiltInPrimitiveId, var.self); + has_primitive_id = true; + } + + if (need_tese_params && builtin == BuiltInTessLevelOuter) + { + tess_level_outer_var_id = var.self; + } + + if (need_tese_params && builtin == BuiltInTessLevelInner) + { + tess_level_inner_var_id = var.self; } if ((need_subgroup_mask || needs_subgroup_invocation_id) && builtin == BuiltInSubgroupLocalInvocationId) @@ -424,6 +431,13 @@ void CompilerMSL::build_implicit_builtins() } } + if (needs_helper_invocation && builtin == BuiltInHelperInvocation) + { + builtin_helper_invocation_id = var.self; + mark_implicit_builtin(StorageClassInput, BuiltInHelperInvocation, var.self); + has_helper_invocation = true; + } + if (need_local_invocation_index && builtin == BuiltInLocalInvocationIndex) { builtin_local_invocation_index_id = var.self; @@ -640,7 +654,7 @@ void CompilerMSL::build_implicit_builtins() } if ((need_tesc_params && (msl_options.multi_patch_workgroup || !has_invocation_id || !has_primitive_id)) || - need_grid_params) + (need_tese_params && !has_primitive_id) || need_grid_params) { uint32_t type_ptr_id = ir.increase_bound_by(1); @@ -653,7 +667,7 @@ void CompilerMSL::build_implicit_builtins() auto &ptr_type = set(type_ptr_id, uint_type_ptr); ptr_type.self = get_uint_type_id(); - if (msl_options.multi_patch_workgroup || need_grid_params) + if ((need_tesc_params && msl_options.multi_patch_workgroup) || need_grid_params) { uint32_t var_id = ir.increase_bound_by(1); @@ -674,7 +688,7 @@ void CompilerMSL::build_implicit_builtins() mark_implicit_builtin(StorageClassInput, BuiltInInvocationId, var_id); } - if (need_tesc_params && !has_primitive_id) + if ((need_tesc_params || need_tese_params) && !has_primitive_id) { uint32_t var_id = ir.increase_bound_by(1); @@ -800,6 +814,35 @@ void CompilerMSL::build_implicit_builtins() mark_implicit_builtin(StorageClassOutput, BuiltInSampleMask, var_id); } + if (!has_helper_invocation && needs_helper_invocation) + { + uint32_t offset = ir.increase_bound_by(3); + uint32_t type_id = offset; + uint32_t type_ptr_id = offset + 1; + uint32_t var_id = offset + 2; + + // Create gl_HelperInvocation. + SPIRType bool_type; + bool_type.basetype = SPIRType::Boolean; + bool_type.width = 8; + bool_type.vecsize = 1; + set(type_id, bool_type); + + SPIRType bool_type_ptr_in; + bool_type_ptr_in = bool_type; + bool_type_ptr_in.pointer = true; + bool_type_ptr_in.pointer_depth++; + bool_type_ptr_in.parent_type = type_id; + bool_type_ptr_in.storage = StorageClassInput; + + auto &ptr_in_type = set(type_ptr_id, bool_type_ptr_in); + ptr_in_type.self = type_id; + set(var_id, type_ptr_id, StorageClassInput); + set_decoration(var_id, DecorationBuiltIn, BuiltInHelperInvocation); + builtin_helper_invocation_id = var_id; + mark_implicit_builtin(StorageClassInput, BuiltInHelperInvocation, var_id); + } + if (need_local_invocation_index && !has_local_invocation_index) { uint32_t offset = ir.increase_bound_by(2); @@ -856,7 +899,7 @@ void CompilerMSL::build_implicit_builtins() swizzle_buffer_id = var_id; } - if (!buffers_requiring_array_length.empty()) + if (needs_buffer_size_buffer()) { uint32_t var_id = build_constant_uint_array_pointer(); set_name(var_id, "spvBufferSizeConstants"); @@ -891,11 +934,9 @@ void CompilerMSL::build_implicit_builtins() } // If we're returning a struct from a vertex-like entry point, we must return a position attribute. - bool need_position = - (get_execution_model() == ExecutionModelVertex || - get_execution_model() == ExecutionModelTessellationEvaluation) && - !capture_output_to_buffer && !get_is_rasterization_disabled() && - !active_output_builtins.get(BuiltInPosition); + bool need_position = (get_execution_model() == ExecutionModelVertex || is_tese_shader()) && + !capture_output_to_buffer && !get_is_rasterization_disabled() && + !active_output_builtins.get(BuiltInPosition); if (need_position) { @@ -1085,7 +1126,7 @@ SPIRType &CompilerMSL::get_patch_stage_out_struct_type() std::string CompilerMSL::get_tess_factor_struct_name() { - if (get_entry_point().flags.get(ExecutionModeTriangles)) + if (is_tessellating_triangles()) return "MTLTriangleTessellationFactorsHalf"; return "MTLQuadTessellationFactorsHalf"; } @@ -1271,7 +1312,7 @@ void CompilerMSL::emit_entry_point_declarations() else { is_using_builtin_array = true; - statement(get_argument_address_space(var), " ", type_to_glsl(type), "* ", to_restrict(var_id), name, + statement(get_argument_address_space(var), " ", type_to_glsl(type), "* ", to_restrict(var_id, true), name, type_to_array_glsl(type), " ="); uint32_t dim = uint32_t(type.array.size()); @@ -1306,30 +1347,61 @@ void CompilerMSL::emit_entry_point_declarations() } else { - statement(get_argument_address_space(var), " auto& ", to_restrict(var_id), name, " = *(", + statement(get_argument_address_space(var), " auto& ", to_restrict(var_id, true), name, " = *(", get_argument_address_space(var), " ", type_to_glsl(type), "* ", to_restrict(var_id, false), ")((", get_argument_address_space(var), " char* ", to_restrict(var_id, false), ")", to_name(arg_id), ".", ensure_valid_name(name, "m"), " + ", to_name(dynamic_offsets_buffer_id), "[", base_index, "]);"); } } - // Emit buffer arrays here. - for (uint32_t array_id : buffer_arrays_discrete) + bool has_runtime_array_declaration = false; + for (SPIRVariable *arg : entry_point_bindings) { - const auto &var = get(array_id); + const auto &var = *arg; const auto &type = get_variable_data_type(var); const auto &buffer_type = get_variable_element_type(var); - string name = to_name(array_id); - statement(get_argument_address_space(var), " ", type_to_glsl(buffer_type), "* ", to_restrict(array_id), name, - "[] ="); - begin_scope(); - for (uint32_t i = 0; i < to_array_size_literal(type); ++i) - statement(name, "_", i, ","); - end_scope_decl(); - statement_no_indent(""); + const string name = to_name(var.self); + if (is_runtime_size_array(type)) + { + if (msl_options.argument_buffers_tier < Options::ArgumentBuffersTier::Tier2) + { + SPIRV_CROSS_THROW("Unsized array of descriptors requires argument buffer tier 2"); + } + switch (type.basetype) + { + case SPIRType::Image: + case SPIRType::Sampler: + case SPIRType::AccelerationStructure: + statement("spvDescriptorArray<", type_to_glsl(buffer_type), "> ", name, " {", name, "_};"); + break; + case SPIRType::SampledImage: + statement("spvDescriptorArray<", type_to_glsl(buffer_type), "> ", name, " {", name, "_};"); + statement("spvDescriptorArray ", name, "Smplr {", name, "Smplr_};"); + break; + case SPIRType::Struct: + statement("spvDescriptorArray<", get_argument_address_space(var), " ", type_to_glsl(buffer_type), "*> ", + name, " {", name, "_};"); + break; + default: + break; + } + has_runtime_array_declaration = true; + } + else if (!type.array.empty() && type.basetype == SPIRType::Struct) + { + // Emit only buffer arrays here. + statement(get_argument_address_space(var), " ", type_to_glsl(buffer_type), "* ", + to_restrict(var.self, true), name, "[] ="); + begin_scope(); + for (uint32_t i = 0; i < to_array_size_literal(type); ++i) + statement(name, "_", i, ","); + end_scope_decl(); + statement_no_indent(""); + } } - // Discrete descriptors are processed in entry point emission every compiler iteration. - buffer_arrays_discrete.clear(); + + if (has_runtime_array_declaration) + statement_no_indent(""); // Emit buffer aliases here. for (auto &var_id : buffer_aliases_discrete) @@ -1343,7 +1415,7 @@ void CompilerMSL::emit_entry_point_declarations() uint32_t desc_binding = get_decoration(var_id, DecorationBinding); auto alias_name = join("spvBufferAliasSet", desc_set, "Binding", desc_binding); - statement(addr_space, " auto& ", to_restrict(var_id), + statement(addr_space, " auto& ", to_restrict(var_id, true), name, " = *(", addr_space, " ", type_to_glsl(type), "*)", alias_name, ";"); } @@ -1361,7 +1433,7 @@ void CompilerMSL::emit_entry_point_declarations() if (type.array.empty()) { - statement(addr_space, " auto& ", to_restrict(var_id), to_name(var_id), " = (", addr_space, " ", + statement(addr_space, " auto& ", to_restrict(var_id, true), to_name(var_id), " = (", addr_space, " ", type_to_glsl(type), "&)", ir.meta[alias_id].decoration.qualified_alias, ";"); } else @@ -1373,7 +1445,7 @@ void CompilerMSL::emit_entry_point_declarations() // address space of the argument buffer itself, which is usually constant, but can be const device for // large argument buffers. is_using_builtin_array = true; - statement(desc_addr_space, " auto& ", to_restrict(var_id), to_name(var_id), " = (", addr_space, " ", + statement(desc_addr_space, " auto& ", to_restrict(var_id, true), to_name(var_id), " = (", addr_space, " ", type_to_glsl(type), "* ", desc_addr_space, " (&)", type_to_array_glsl(type), ")", ir.meta[alias_id].decoration.qualified_alias, ";"); is_using_builtin_array = false; @@ -1411,8 +1483,6 @@ string CompilerMSL::compile() backend.basic_uint8_type = "uchar"; backend.basic_int16_type = "short"; backend.basic_uint16_type = "ushort"; - backend.discard_literal = "discard_fragment()"; - backend.demote_literal = "discard_fragment()"; backend.boolean_mix_function = "select"; backend.swizzle_is_function = false; backend.shared_is_implied = false; @@ -1428,6 +1498,7 @@ string CompilerMSL::compile() backend.support_small_type_sampling_result = true; backend.supports_empty_struct = true; backend.support_64bit_switch = true; + backend.boolean_in_struct_remapped_type = SPIRType::Short; // Allow Metal to use the array template unless we force it off. backend.can_return_array = !msl_options.force_native_arrays; @@ -1435,6 +1506,7 @@ string CompilerMSL::compile() // Arrays which are part of buffer objects are never considered to be value types (just plain C-style). backend.array_is_value_type_in_buffer_blocks = false; backend.support_pointer_to_pointer = true; + backend.implicit_c_integer_promotion_rules = true; capture_output_to_buffer = msl_options.capture_output_to_buffer; is_rasterization_disabled = msl_options.disable_rasterization || capture_output_to_buffer; @@ -1456,6 +1528,20 @@ string CompilerMSL::compile() preprocess_op_codes(); build_implicit_builtins(); + if (needs_manual_helper_invocation_updates() && + (active_input_builtins.get(BuiltInHelperInvocation) || needs_helper_invocation)) + { + string discard_expr = + join(builtin_to_glsl(BuiltInHelperInvocation, StorageClassInput), " = true, discard_fragment()"); + backend.discard_literal = discard_expr; + backend.demote_literal = discard_expr; + } + else + { + backend.discard_literal = "discard_fragment()"; + backend.demote_literal = "discard_fragment()"; + } + fixup_image_load_store_access(); set_enabled_interface_variables(get_active_interface_variables()); @@ -1483,10 +1569,10 @@ string CompilerMSL::compile() stage_out_var_id = add_interface_block(StorageClassOutput); patch_stage_out_var_id = add_interface_block(StorageClassOutput, true); stage_in_var_id = add_interface_block(StorageClassInput); - if (get_execution_model() == ExecutionModelTessellationEvaluation) + if (is_tese_shader()) patch_stage_in_var_id = add_interface_block(StorageClassInput, true); - if (get_execution_model() == ExecutionModelTessellationControl) + if (is_tesc_shader()) stage_out_ptr_var_id = add_interface_block_pointer(stage_out_var_id, StorageClassOutput); if (is_tessellation_shader()) stage_in_ptr_var_id = add_interface_block_pointer(stage_in_var_id, StorageClassInput); @@ -1560,13 +1646,13 @@ void CompilerMSL::preprocess_op_codes() // Before MSL 2.1 (2.2 for textures), Metal vertex functions that write to // resources must disable rasterization and return void. - if (preproc.uses_resource_write) + if ((preproc.uses_buffer_write && !msl_options.supports_msl_version(2, 1)) || + (preproc.uses_image_write && !msl_options.supports_msl_version(2, 2))) is_rasterization_disabled = true; // Tessellation control shaders are run as compute functions in Metal, and so // must capture their output to a buffer. - if (get_execution_model() == ExecutionModelTessellationControl || - (get_execution_model() == ExecutionModelVertex && msl_options.vertex_for_tessellation)) + if (is_tesc_shader() || (get_execution_model() == ExecutionModelVertex && msl_options.vertex_for_tessellation)) { is_rasterization_disabled = true; capture_output_to_buffer = true; @@ -1583,6 +1669,27 @@ void CompilerMSL::preprocess_op_codes() (is_sample_rate() && (active_input_builtins.get(BuiltInFragCoord) || (need_subpass_input_ms && !msl_options.use_framebuffer_fetch_subpasses)))) needs_sample_id = true; + if (preproc.needs_helper_invocation) + needs_helper_invocation = true; + + // OpKill is removed by the parser, so we need to identify those by inspecting + // blocks. + ir.for_each_typed_id([&preproc](uint32_t, SPIRBlock &block) { + if (block.terminator == SPIRBlock::Kill) + preproc.uses_discard = true; + }); + + // Fragment shaders that both write to storage resources and discard fragments + // need checks on the writes, to work around Metal allowing these writes despite + // the fragment being dead. + if (msl_options.check_discarded_frag_stores && preproc.uses_discard && + (preproc.uses_buffer_write || preproc.uses_image_write)) + { + frag_shader_needs_discard_checks = true; + needs_helper_invocation = true; + // Fragment discard store checks imply manual HelperInvocation updates. + msl_options.manual_helper_invocation_updates = true; + } if (is_intersection_query()) { @@ -1623,10 +1730,26 @@ void CompilerMSL::extract_global_variables_from_functions() ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { // Some builtins resolve directly to a function call which does not need any declared variables. // Skip these. - if (var.storage == StorageClassInput && has_decoration(var.self, DecorationBuiltIn) && - BuiltIn(get_decoration(var.self, DecorationBuiltIn)) == BuiltInHelperInvocation) + if (var.storage == StorageClassInput && has_decoration(var.self, DecorationBuiltIn)) { - return; + auto bi_type = BuiltIn(get_decoration(var.self, DecorationBuiltIn)); + if (bi_type == BuiltInHelperInvocation && !needs_manual_helper_invocation_updates()) + return; + if (bi_type == BuiltInHelperInvocation && needs_manual_helper_invocation_updates()) + { + if (msl_options.is_ios() && !msl_options.supports_msl_version(2, 3)) + SPIRV_CROSS_THROW("simd_is_helper_thread() requires version 2.3 on iOS."); + else if (msl_options.is_macos() && !msl_options.supports_msl_version(2, 1)) + SPIRV_CROSS_THROW("simd_is_helper_thread() requires version 2.1 on macOS."); + // Make sure this is declared and initialized. + // Force this to have the proper name. + set_name(var.self, builtin_to_glsl(BuiltInHelperInvocation, StorageClassInput)); + auto &entry_func = this->get(ir.default_entry_point); + entry_func.add_local_variable(var.self); + vars_needing_early_declaration.push_back(var.self); + entry_func.fixup_hooks_in.push_back([this, &var]() + { statement(to_name(var.self), " = simd_is_helper_thread();"); }); + } } if (var.storage == StorageClassInput || var.storage == StorageClassOutput || @@ -1742,6 +1865,9 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: if (global_var_ids.find(rvalue_id) != global_var_ids.end()) added_arg_ids.insert(rvalue_id); + if (needs_frag_discard_checks()) + added_arg_ids.insert(builtin_helper_invocation_id); + break; } @@ -1756,6 +1882,26 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: break; } + case OpAtomicExchange: + case OpAtomicCompareExchange: + case OpAtomicStore: + case OpAtomicIIncrement: + case OpAtomicIDecrement: + case OpAtomicIAdd: + case OpAtomicFAddEXT: + case OpAtomicISub: + case OpAtomicSMin: + case OpAtomicUMin: + case OpAtomicSMax: + case OpAtomicUMax: + case OpAtomicAnd: + case OpAtomicOr: + case OpAtomicXor: + case OpImageWrite: + if (needs_frag_discard_checks()) + added_arg_ids.insert(builtin_helper_invocation_id); + break; + // Emulate texture2D atomic operations case OpImageTexelPointer: { @@ -1837,6 +1983,17 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: break; } + case OpDemoteToHelperInvocation: + if (needs_manual_helper_invocation_updates() && + (active_input_builtins.get(BuiltInHelperInvocation) || needs_helper_invocation)) + added_arg_ids.insert(builtin_helper_invocation_id); + break; + + case OpIsHelperInvocationEXT: + if (needs_manual_helper_invocation_updates()) + added_arg_ids.insert(builtin_helper_invocation_id); + break; + case OpRayQueryInitializeKHR: case OpRayQueryProceedKHR: case OpRayQueryTerminateKHR: @@ -1880,6 +2037,10 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: break; } + if (needs_manual_helper_invocation_updates() && b.terminator == SPIRBlock::Kill && + (active_input_builtins.get(BuiltInHelperInvocation) || needs_helper_invocation)) + added_arg_ids.insert(builtin_helper_invocation_id); + // TODO: Add all other operations which can affect memory. // We should consider a more unified system here to reduce boiler-plate. // This kind of analysis is done in several places ... @@ -1906,9 +2067,8 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: bool is_patch = has_decoration(arg_id, DecorationPatch) || is_patch_block(*p_type); bool is_block = has_decoration(p_type->self, DecorationBlock); bool is_control_point_storage = - !is_patch && - ((is_tessellation_shader() && var.storage == StorageClassInput) || - (get_execution_model() == ExecutionModelTessellationControl && var.storage == StorageClassOutput)); + !is_patch && ((is_tessellation_shader() && var.storage == StorageClassInput) || + (is_tesc_shader() && var.storage == StorageClassOutput)); bool is_patch_block_storage = is_patch && is_block && var.storage == StorageClassOutput; bool is_builtin = is_builtin_variable(var); bool variable_is_stage_io = @@ -1924,8 +2084,8 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: if (is_redirected_to_global_stage_io) { - // Tessellation control shaders see inputs and per-vertex outputs as arrays. - // Similarly, tessellation evaluation shaders see per-vertex inputs as arrays. + // Tessellation control shaders see inputs and per-point outputs as arrays. + // Similarly, tessellation evaluation shaders see per-point inputs as arrays. // We collected them into a structure; we must pass the array of this // structure to the function. std::string name; @@ -1948,10 +2108,6 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: } } - // Tessellation control shaders see inputs and per-vertex outputs as arrays. - // Similarly, tessellation evaluation shaders see per-vertex inputs as arrays. - // We collected them into a structure; we must pass the array of this - // structure to the function. if (var.storage == StorageClassInput) { auto &added_in = is_patch ? patch_added_in : control_point_added_in; @@ -1975,6 +2131,8 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: set(next_id, type_id, StorageClassFunction, 0, arg_id); set_name(next_id, name); + if (is_tese_shader() && msl_options.raw_buffer_tese_input && var.storage == StorageClassInput) + set_decoration(next_id, DecorationNonWritable); } else if (is_builtin && has_decoration(p_type->self, DecorationBlock)) { @@ -2016,8 +2174,7 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: func.add_parameter(type_id, next_id, true); set(next_id, type_id, StorageClassFunction, 0, arg_id); - // Ensure the existing variable has a valid name and the new variable has all the same meta info - set_name(arg_id, ensure_valid_name(to_name(arg_id), "v")); + // Ensure the new variable has all the same meta info ir.meta[next_id] = ir.meta[arg_id]; } } @@ -2239,7 +2396,7 @@ bool CompilerMSL::add_component_variable_to_interface_block(spv::StorageClass st if (pad_fragment_output) { uint32_t locn = get_decoration(var.self, DecorationLocation); - num_components = std::max(num_components, get_target_components_for_fragment_location(locn)); + num_components = max(num_components, get_target_components_for_fragment_location(locn)); } // We have already declared an IO block member as m_location_N. @@ -2994,7 +3151,7 @@ void CompilerMSL::add_plain_member_variable_to_interface_block(StorageClass stor { set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, location); mark_location_as_used_by_shader(location, get(mbr_type_id), storage); - location++; + location += type_to_location_count(get(mbr_type_id)); } else if (has_member_decoration(var_type.self, mbr_idx, DecorationLocation)) { @@ -3011,7 +3168,7 @@ void CompilerMSL::add_plain_member_variable_to_interface_block(StorageClass stor } set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, location); mark_location_as_used_by_shader(location, get(mbr_type_id), storage); - location++; + location += type_to_location_count(get(mbr_type_id)); } else if (has_decoration(var.self, DecorationLocation)) { @@ -3027,21 +3184,21 @@ void CompilerMSL::add_plain_member_variable_to_interface_block(StorageClass stor } set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, location); mark_location_as_used_by_shader(location, get(mbr_type_id), storage); - location++; + location += type_to_location_count(get(mbr_type_id)); } else if (is_builtin && is_tessellation_shader() && storage == StorageClassInput && inputs_by_builtin.count(builtin)) { location = inputs_by_builtin[builtin].location; set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, location); mark_location_as_used_by_shader(location, get(mbr_type_id), storage); - location++; + location += type_to_location_count(get(mbr_type_id)); } else if (is_builtin && capture_output_to_buffer && storage == StorageClassOutput && outputs_by_builtin.count(builtin)) { location = outputs_by_builtin[builtin].location; set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, location); mark_location_as_used_by_shader(location, get(mbr_type_id), storage); - location++; + location += type_to_location_count(get(mbr_type_id)); } // Copy the component location, if present. @@ -3111,19 +3268,10 @@ void CompilerMSL::add_plain_member_variable_to_interface_block(StorageClass stor void CompilerMSL::add_tess_level_input_to_interface_block(const std::string &ib_var_ref, SPIRType &ib_type, SPIRVariable &var) { - auto &entry_func = get(ir.default_entry_point); auto &var_type = get_variable_element_type(var); BuiltIn builtin = BuiltIn(get_decoration(var.self, DecorationBuiltIn)); - - // Force the variable to have the proper name. - string var_name = builtin_to_glsl(builtin, StorageClassFunction); - set_name(var.self, var_name); - - // We need to declare the variable early and at entry-point scope. - entry_func.add_local_variable(var.self); - vars_needing_early_declaration.push_back(var.self); - bool triangles = get_execution_mode_bitset().get(ExecutionModeTriangles); + bool triangles = is_tessellating_triangles(); string mbr_name; // Add a reference to the variable type to the interface struct. @@ -3169,7 +3317,7 @@ void CompilerMSL::add_tess_level_input_to_interface_block(const std::string &ib_ } else { - mbr_name = var_name; + mbr_name = builtin_to_glsl(builtin, StorageClassFunction); uint32_t type_id = build_extended_vector_type(var_type.self, builtin == BuiltInTessLevelOuter ? 4 : 2); @@ -3189,27 +3337,49 @@ void CompilerMSL::add_tess_level_input_to_interface_block(const std::string &ib_ mark_locations(new_var_type); } + add_tess_level_input(ib_var_ref, mbr_name, var); +} + +void CompilerMSL::add_tess_level_input(const std::string &base_ref, const std::string &mbr_name, SPIRVariable &var) +{ + auto &entry_func = get(ir.default_entry_point); + BuiltIn builtin = BuiltIn(get_decoration(var.self, DecorationBuiltIn)); + + // Force the variable to have the proper name. + string var_name = builtin_to_glsl(builtin, StorageClassFunction); + set_name(var.self, var_name); + + // We need to declare the variable early and at entry-point scope. + entry_func.add_local_variable(var.self); + vars_needing_early_declaration.push_back(var.self); + bool triangles = is_tessellating_triangles(); + if (builtin == BuiltInTessLevelOuter) { - entry_func.fixup_hooks_in.push_back([=]() { - statement(var_name, "[0] = ", ib_var_ref, ".", mbr_name, ".x;"); - statement(var_name, "[1] = ", ib_var_ref, ".", mbr_name, ".y;"); - statement(var_name, "[2] = ", ib_var_ref, ".", mbr_name, ".z;"); - if (!triangles) - statement(var_name, "[3] = ", ib_var_ref, ".", mbr_name, ".w;"); - }); + entry_func.fixup_hooks_in.push_back( + [=]() + { + statement(var_name, "[0] = ", base_ref, ".", mbr_name, "[0];"); + statement(var_name, "[1] = ", base_ref, ".", mbr_name, "[1];"); + statement(var_name, "[2] = ", base_ref, ".", mbr_name, "[2];"); + if (!triangles) + statement(var_name, "[3] = ", base_ref, ".", mbr_name, "[3];"); + }); } else { entry_func.fixup_hooks_in.push_back([=]() { if (triangles) { - statement(var_name, "[0] = ", ib_var_ref, ".", mbr_name, ".w;"); + if (msl_options.raw_buffer_tese_input) + statement(var_name, "[0] = ", base_ref, ".", mbr_name, ";"); + else + statement(var_name, "[0] = ", base_ref, ".", mbr_name, "[3];"); } else { - statement(var_name, "[0] = ", ib_var_ref, ".", mbr_name, ".x;"); - statement(var_name, "[1] = ", ib_var_ref, ".", mbr_name, ".y;"); + statement(var_name, "[0] = ", base_ref, ".", mbr_name, "[0];"); + statement(var_name, "[1] = ", base_ref, ".", mbr_name, "[1];"); } }); } @@ -3220,7 +3390,8 @@ bool CompilerMSL::variable_storage_requires_stage_io(spv::StorageClass storage) if (storage == StorageClassOutput) return !capture_output_to_buffer; else if (storage == StorageClassInput) - return !(get_execution_model() == ExecutionModelTessellationControl && msl_options.multi_patch_workgroup); + return !(is_tesc_shader() && msl_options.multi_patch_workgroup) && + !(is_tese_shader() && msl_options.raw_buffer_tese_input); else return false; } @@ -3345,7 +3516,8 @@ void CompilerMSL::add_variable_to_interface_block(StorageClass storage, const st if (var_type.basetype == SPIRType::Struct) { - bool block_requires_flattening = variable_storage_requires_stage_io(storage) || is_block; + bool block_requires_flattening = + variable_storage_requires_stage_io(storage) || (is_block && var_type.array.empty()); bool needs_local_declaration = !is_builtin && block_requires_flattening && meta.allow_local_declaration; if (needs_local_declaration) @@ -3474,8 +3646,7 @@ void CompilerMSL::add_variable_to_interface_block(StorageClass storage, const st // If we're redirecting a block, we might still need to access the original block // variable if we're masking some members. - if (masked_block && !needs_local_declaration && - (!is_builtin_variable(var) || get_execution_model() == ExecutionModelTessellationControl)) + if (masked_block && !needs_local_declaration && (!is_builtin_variable(var) || is_tesc_shader())) { if (is_builtin_variable(var)) { @@ -3496,8 +3667,8 @@ void CompilerMSL::add_variable_to_interface_block(StorageClass storage, const st } } } - else if (get_execution_model() == ExecutionModelTessellationEvaluation && storage == StorageClassInput && - !meta.strip_array && is_builtin && (builtin == BuiltInTessLevelOuter || builtin == BuiltInTessLevelInner)) + else if (is_tese_shader() && storage == StorageClassInput && !meta.strip_array && is_builtin && + (builtin == BuiltInTessLevelOuter || builtin == BuiltInTessLevelInner)) { add_tess_level_input_to_interface_block(ib_var_ref, ib_type, var); } @@ -3534,8 +3705,7 @@ void CompilerMSL::fix_up_interface_member_indices(StorageClass storage, uint32_t // Only needed for tessellation shaders and pull-model interpolants. // Need to redirect interface indices back to variables themselves. // For structs, each member of the struct need a separate instance. - if (get_execution_model() != ExecutionModelTessellationControl && - !(get_execution_model() == ExecutionModelTessellationEvaluation && storage == StorageClassInput) && + if (!is_tesc_shader() && !(is_tese_shader() && storage == StorageClassInput) && !(get_execution_model() == ExecutionModelFragment && storage == StorageClassInput && !pull_model_inputs.empty())) return; @@ -3624,9 +3794,8 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch) // These builtins are part of the stage in/out structs. bool is_interface_block_builtin = - builtin_is_stage_in_out || - (get_execution_model() == ExecutionModelTessellationEvaluation && - (bi_type == BuiltInTessLevelOuter || bi_type == BuiltInTessLevelInner)); + builtin_is_stage_in_out || (is_tese_shader() && !msl_options.raw_buffer_tese_input && + (bi_type == BuiltInTessLevelOuter || bi_type == BuiltInTessLevelInner)); bool is_active = interface_variable_exists_in_entry_point(var.self); if (is_builtin && is_active) @@ -3709,7 +3878,7 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch) for (uint32_t location_offset = 0; location_offset < array_size; location_offset++) { auto &location_meta = meta.location_meta[location + location_offset]; - location_meta.num_components = std::max(location_meta.num_components, component + type.vecsize); + location_meta.num_components = max(location_meta.num_components, component + type.vecsize); // For variables sharing location, decorations and base type must match. location_meta.base_type_id = type.self; @@ -3722,12 +3891,29 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch) } } } + + if (is_tese_shader() && msl_options.raw_buffer_tese_input && patch && storage == StorageClassInput && + (bi_type == BuiltInTessLevelOuter || bi_type == BuiltInTessLevelInner)) + { + // In this case, we won't add the builtin to the interface struct, + // but we still need the hook to run to populate the arrays. + string base_ref = join(tess_factor_buffer_var_name, "[", to_expression(builtin_primitive_id_id), "]"); + const char *mbr_name = + bi_type == BuiltInTessLevelOuter ? "edgeTessellationFactor" : "insideTessellationFactor"; + add_tess_level_input(base_ref, mbr_name, var); + if (inputs_by_builtin.count(bi_type)) + { + uint32_t locn = inputs_by_builtin[bi_type].location; + mark_location_as_used_by_shader(locn, type, StorageClassInput); + } + } }); // If no variables qualify, leave. // For patch input in a tessellation evaluation shader, the per-vertex stage inputs // are included in a special patch control point array. - if (vars.empty() && !(storage == StorageClassInput && patch && stage_in_var_id)) + if (vars.empty() && + !(!msl_options.raw_buffer_tese_input && storage == StorageClassInput && patch && stage_in_var_id)) return 0; // Add a new typed variable for this interface structure. @@ -3750,8 +3936,9 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch) { case StorageClassInput: ib_var_ref = patch ? patch_stage_in_var_name : stage_in_var_name; - if (get_execution_model() == ExecutionModelTessellationControl) + switch (get_execution_model()) { + case ExecutionModelTessellationControl: // Add a hook to populate the shared workgroup memory containing the gl_in array. entry_func.fixup_hooks_in.push_back([=]() { // Can't use PatchVertices, PrimitiveId, or InvocationId yet; the hooks for those may not have run yet. @@ -3777,6 +3964,33 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch) statement(" return;"); } }); + break; + case ExecutionModelTessellationEvaluation: + if (!msl_options.raw_buffer_tese_input) + break; + if (patch) + { + entry_func.fixup_hooks_in.push_back( + [=]() + { + statement("const device ", to_name(ir.default_entry_point), "_", ib_var_ref, "& ", ib_var_ref, + " = ", patch_input_buffer_var_name, "[", to_expression(builtin_primitive_id_id), + "];"); + }); + } + else + { + entry_func.fixup_hooks_in.push_back( + [=]() + { + statement("const device ", to_name(ir.default_entry_point), "_", ib_var_ref, "* gl_in = &", + input_buffer_var_name, "[", to_expression(builtin_primitive_id_id), " * ", + get_entry_point().output_vertices, "];"); + }); + } + break; + default: + break; } break; @@ -3902,29 +4116,33 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch) for (auto *p_var : vars) { - bool strip_array = - (get_execution_model() == ExecutionModelTessellationControl || - (get_execution_model() == ExecutionModelTessellationEvaluation && storage == StorageClassInput)) && - !patch; + bool strip_array = (is_tesc_shader() || (is_tese_shader() && storage == StorageClassInput)) && !patch; // Fixing up flattened stores in TESC is impossible since the memory is group shared either via // device (not masked) or threadgroup (masked) storage classes and it's race condition city. meta.strip_array = strip_array; - meta.allow_local_declaration = !strip_array && !(get_execution_model() == ExecutionModelTessellationControl && - storage == StorageClassOutput); + meta.allow_local_declaration = !strip_array && !(is_tesc_shader() && storage == StorageClassOutput); add_variable_to_interface_block(storage, ib_var_ref, ib_type, *p_var, meta); } - if (get_execution_model() == ExecutionModelTessellationControl && msl_options.multi_patch_workgroup && + if (((is_tesc_shader() && msl_options.multi_patch_workgroup) || + (is_tese_shader() && msl_options.raw_buffer_tese_input)) && storage == StorageClassInput) { - // For tessellation control inputs, add all outputs from the vertex shader to ensure + // For tessellation inputs, add all outputs from the previous stage to ensure // the struct containing them is the correct size and layout. for (auto &input : inputs_by_location) { if (location_inputs_in_use.count(input.first.location) != 0) continue; + if (patch != (input.second.rate == MSL_SHADER_VARIABLE_RATE_PER_PATCH)) + continue; + + // Tessellation levels have their own struct, so there's no need to add them here. + if (input.second.builtin == BuiltInTessLevelOuter || input.second.builtin == BuiltInTessLevelInner) + continue; + // Create a fake variable to put at the location. uint32_t offset = ir.increase_bound_by(4); uint32_t type_id = offset; @@ -4007,7 +4225,7 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch) type.vecsize = output.second.vecsize; set(type_id, type); - if (get_execution_model() == ExecutionModelTessellationControl) + if (is_tesc_shader()) { type.array.push_back(0); type.array_size_literal.push_back(true); @@ -4017,7 +4235,7 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch) type.pointer = true; type.pointer_depth++; - type.parent_type = get_execution_model() == ExecutionModelTessellationControl ? array_type_id : type_id; + type.parent_type = is_tesc_shader() ? array_type_id : type_id; type.storage = storage; auto &ptr_type = set(ptr_type_id, type); ptr_type.self = type.parent_type; @@ -4067,7 +4285,7 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch) fix_up_interface_member_indices(storage, ib_type_id); // For patch inputs, add one more member, holding the array of control point data. - if (get_execution_model() == ExecutionModelTessellationEvaluation && storage == StorageClassInput && patch && + if (is_tese_shader() && !msl_options.raw_buffer_tese_input && storage == StorageClassInput && patch && stage_in_var_id) { uint32_t pcp_type_id = ir.increase_bound_by(1); @@ -4081,6 +4299,9 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage, bool patch) set_member_name(ib_type.self, mbr_idx, "gl_in"); } + if (storage == StorageClassInput) + set_decoration(ib_var_id, DecorationNonWritable); + return ib_var_id; } @@ -4092,7 +4313,7 @@ uint32_t CompilerMSL::add_interface_block_pointer(uint32_t ib_var_id, StorageCla uint32_t ib_ptr_var_id; uint32_t next_id = ir.increase_bound_by(3); auto &ib_type = expression_type(ib_var_id); - if (get_execution_model() == ExecutionModelTessellationControl) + if (is_tesc_shader() || (is_tese_shader() && msl_options.raw_buffer_tese_input)) { // Tessellation control per-vertex I/O is presented as an array, so we must // do the same with our struct here. @@ -4101,10 +4322,12 @@ uint32_t CompilerMSL::add_interface_block_pointer(uint32_t ib_var_id, StorageCla ib_ptr_type.parent_type = ib_ptr_type.type_alias = ib_type.self; ib_ptr_type.pointer = true; ib_ptr_type.pointer_depth++; - ib_ptr_type.storage = - storage == StorageClassInput ? - (msl_options.multi_patch_workgroup ? StorageClassStorageBuffer : StorageClassWorkgroup) : - StorageClassStorageBuffer; + ib_ptr_type.storage = storage == StorageClassInput ? + ((is_tesc_shader() && msl_options.multi_patch_workgroup) || + (is_tese_shader() && msl_options.raw_buffer_tese_input) ? + StorageClassStorageBuffer : + StorageClassWorkgroup) : + StorageClassStorageBuffer; ir.meta[ib_ptr_type_id] = ir.meta[ib_type.self]; // To ensure that get_variable_data_type() doesn't strip off the pointer, // which we need, use another pointer. @@ -4118,6 +4341,8 @@ uint32_t CompilerMSL::add_interface_block_pointer(uint32_t ib_var_id, StorageCla ib_ptr_var_id = next_id; set(ib_ptr_var_id, ib_ptr_ptr_type_id, StorageClassFunction, 0); set_name(ib_ptr_var_id, storage == StorageClassInput ? "gl_in" : "gl_out"); + if (storage == StorageClassInput) + set_decoration(ib_ptr_var_id, DecorationNonWritable); } else { @@ -4322,7 +4547,7 @@ void CompilerMSL::mark_scalar_layout_structs(const SPIRType &type) for (uint32_t dim = 0; dim < dimensions; dim++) { uint32_t array_size = to_array_size_literal(mbr_type, dim); - array_stride /= max(array_size, 1u); + array_stride /= max(array_size, 1u); } // Set expected struct size based on ArrayStride. @@ -4529,7 +4754,7 @@ void CompilerMSL::ensure_member_packing_rules_msl(SPIRType &ib_type, uint32_t in // Hack off array-of-arrays until we find the array stride per element we must have to make it work. uint32_t dimensions = uint32_t(mbr_type.array.size() - 1); for (uint32_t dim = 0; dim < dimensions; dim++) - array_stride /= max(to_array_size_literal(mbr_type, dim), 1u); + array_stride /= max(to_array_size_literal(mbr_type, dim), 1u); // Pointers are 8 bytes uint32_t mbr_width_in_bytes = is_buff_ptr ? 8 : (mbr_type.width / 8); @@ -4740,6 +4965,11 @@ void CompilerMSL::emit_store_statement(uint32_t lhs_expression, uint32_t rhs_exp auto &physical_type = get(physical_type_id); + string cast_addr_space = "thread"; + auto *p_var_lhs = maybe_get_backing_variable(lhs_expression); + if (p_var_lhs) + cast_addr_space = get_type_address_space(get(p_var_lhs->basetype), lhs_expression); + if (is_matrix(type)) { const char *packed_pfx = lhs_packed_type ? "packed_" : ""; @@ -4767,7 +4997,7 @@ void CompilerMSL::emit_store_statement(uint32_t lhs_expression, uint32_t rhs_exp write_type.columns = 1; if (physical_type.columns != type.columns) - cast_expr = join("(device ", packed_pfx, type_to_glsl(write_type), "&)"); + cast_expr = join("(", cast_addr_space, " ", packed_pfx, type_to_glsl(write_type), "&)"); if (rhs_transpose) { @@ -4809,7 +5039,7 @@ void CompilerMSL::emit_store_statement(uint32_t lhs_expression, uint32_t rhs_exp write_type.columns = 1; if (physical_type.vecsize != type.vecsize) - cast_expr = join("(device ", packed_pfx, type_to_glsl(write_type), "&)"); + cast_expr = join("(", cast_addr_space, " ", packed_pfx, type_to_glsl(write_type), "&)"); if (rhs_transpose) { @@ -4864,7 +5094,7 @@ void CompilerMSL::emit_store_statement(uint32_t lhs_expression, uint32_t rhs_exp auto column_index = lhs_expr.find_last_of('['); if (column_index != string::npos) { - statement("((device ", type_to_glsl(write_type), "*)&", + statement("((", cast_addr_space, " ", type_to_glsl(write_type), "*)&", lhs_expr.insert(column_index, join('[', c, ']', ")")), " = ", to_extract_component_expression(rhs_expression, c), ";"); } @@ -4887,7 +5117,7 @@ void CompilerMSL::emit_store_statement(uint32_t lhs_expression, uint32_t rhs_exp // Unpack the expression so we can store to it with a float or float2. // It's still an l-value, so it's fine. Most other unpacking of expressions turn them into r-values instead. - lhs = join("(device ", type_to_glsl(type), "&)", enclose_expression(lhs)); + lhs = join("(", cast_addr_space, " ", type_to_glsl(type), "&)", enclose_expression(lhs)); if (!optimize_read_modify_write(expression_type(rhs_expression), lhs, rhs)) statement(lhs, " = ", rhs, ";"); } @@ -6988,6 +7218,99 @@ void CompilerMSL::emit_custom_functions() end_scope(); end_scope_decl(); statement(""); + break; + + case SPVFuncImplRayQueryIntersectionParams: + statement("intersection_params spvMakeIntersectionParams(uint flags)"); + begin_scope(); + statement("intersection_params ip;"); + statement("if ((flags & ", RayFlagsOpaqueKHRMask, ") != 0)"); + statement(" ip.force_opacity(forced_opacity::opaque);"); + statement("if ((flags & ", RayFlagsNoOpaqueKHRMask, ") != 0)"); + statement(" ip.force_opacity(forced_opacity::non_opaque);"); + statement("if ((flags & ", RayFlagsTerminateOnFirstHitKHRMask, ") != 0)"); + statement(" ip.accept_any_intersection(true);"); + // RayFlagsSkipClosestHitShaderKHRMask is not available in MSL + statement("if ((flags & ", RayFlagsCullBackFacingTrianglesKHRMask, ") != 0)"); + statement(" ip.set_triangle_cull_mode(triangle_cull_mode::back);"); + statement("if ((flags & ", RayFlagsCullFrontFacingTrianglesKHRMask, ") != 0)"); + statement(" ip.set_triangle_cull_mode(triangle_cull_mode::front);"); + statement("if ((flags & ", RayFlagsCullOpaqueKHRMask, ") != 0)"); + statement(" ip.set_opacity_cull_mode(opacity_cull_mode::opaque);"); + statement("if ((flags & ", RayFlagsCullNoOpaqueKHRMask, ") != 0)"); + statement(" ip.set_opacity_cull_mode(opacity_cull_mode::non_opaque);"); + statement("if ((flags & ", RayFlagsSkipTrianglesKHRMask, ") != 0)"); + statement(" ip.set_geometry_cull_mode(geometry_cull_mode::triangle);"); + statement("if ((flags & ", RayFlagsSkipAABBsKHRMask, ") != 0)"); + statement(" ip.set_geometry_cull_mode(geometry_cull_mode::bounding_box);"); + statement("return ip;"); + end_scope(); + statement(""); + break; + + case SPVFuncImplVariableDescriptor: + statement("template"); + statement("struct spvDescriptor"); + begin_scope(); + statement("T value;"); + end_scope_decl(); + statement(""); + break; + + case SPVFuncImplVariableSizedDescriptor: + statement("template"); + statement("struct spvBufferDescriptor"); + begin_scope(); + statement("T value;"); + statement("int length;"); + statement("const device T& operator -> () const device"); + begin_scope(); + statement("return value;"); + end_scope(); + statement("const device T& operator * () const device"); + begin_scope(); + statement("return value;"); + end_scope(); + end_scope_decl(); + statement(""); + break; + + case SPVFuncImplVariableDescriptorArray: + statement("template"); + statement("struct spvDescriptorArray"); + begin_scope(); + statement("spvDescriptorArray(const device spvDescriptor* ptr) : ptr(ptr)"); + begin_scope(); + end_scope(); + statement("const device T& operator [] (size_t i) const"); + begin_scope(); + statement("return ptr[i].value;"); + end_scope(); + statement("const device spvDescriptor* ptr;"); + end_scope_decl(); + statement(""); + + if (msl_options.runtime_array_rich_descriptor) + { + statement("template"); + statement("struct spvDescriptorArray"); + begin_scope(); + statement("spvDescriptorArray(const device spvBufferDescriptor* ptr) : ptr(ptr)"); + begin_scope(); + end_scope(); + statement("const device T* operator [] (size_t i) const"); + begin_scope(); + statement("return ptr[i].value;"); + end_scope(); + statement("const int length(int i) const"); + begin_scope(); + statement("return ptr[i].length;"); + end_scope(); + statement("const device spvBufferDescriptor* ptr;"); + end_scope_decl(); + statement(""); + } + break; default: break; @@ -7008,7 +7331,7 @@ static string inject_top_level_storage_qualifier(const string &expr, const strin else if (last_pointer == string::npos) last_significant = last_reference; else - last_significant = std::max(last_reference, last_pointer); + last_significant = max(last_reference, last_pointer); if (last_significant == string::npos) return join(qualifier, " ", expr); @@ -7019,28 +7342,6 @@ static string inject_top_level_storage_qualifier(const string &expr, const strin } } -// Undefined global memory is not allowed in MSL. -// Declare constant and init to zeros. Use {}, as global constructors can break Metal. -void CompilerMSL::declare_undefined_values() -{ - bool emitted = false; - ir.for_each_typed_id([&](uint32_t, SPIRUndef &undef) { - auto &type = this->get(undef.basetype); - // OpUndef can be void for some reason ... - if (type.basetype == SPIRType::Void) - return; - - statement(inject_top_level_storage_qualifier( - variable_decl(type, to_name(undef.self), undef.self), - "constant"), - " = {};"); - emitted = true; - }); - - if (emitted) - statement(""); -} - void CompilerMSL::declare_constant_arrays() { bool fully_inlined = ir.ids_for_type[TypeFunction].size() == 1; @@ -7058,7 +7359,7 @@ void CompilerMSL::declare_constant_arrays() // FIXME: However, hoisting constants to main() means we need to pass down constant arrays to leaf functions if they are used there. // If there are multiple functions in the module, drop this case to avoid breaking use cases which do not need to // link into Metal libraries. This is hacky. - if (!type.array.empty() && (!fully_inlined || is_scalar(type) || is_vector(type))) + if (type_is_top_level_array(type) && (!fully_inlined || is_scalar(type) || is_vector(type))) { add_resource_name(c.self); auto name = to_name(c.self); @@ -7090,7 +7391,7 @@ void CompilerMSL::declare_complex_constant_arrays() return; auto &type = this->get(c.constant_type); - if (!type.array.empty() && !(is_scalar(type) || is_vector(type))) + if (type_is_top_level_array(type) && !(is_scalar(type) || is_vector(type))) { add_resource_name(c.self); auto name = to_name(c.self); @@ -7106,7 +7407,6 @@ void CompilerMSL::declare_complex_constant_arrays() void CompilerMSL::emit_resources() { declare_constant_arrays(); - declare_undefined_values(); // Emit the special [[stage_in]] and [[stage_out]] interface blocks which we created. emit_interface_block(stage_out_var_id); @@ -7169,7 +7469,16 @@ void CompilerMSL::emit_specialization_constants_and_structs() emitted = false; declared_structs.clear(); - for (auto &id_ : ir.ids_for_constant_or_type) + // It is possible to have multiple spec constants that use the same spec constant ID. + // The most common cause of this is defining spec constants in GLSL while also declaring + // the workgroup size to use those spec constants. But, Metal forbids declaring more than + // one variable with the same function constant ID. + // In this case, we must only declare one variable with the [[function_constant(id)]] + // attribute, and use its initializer to initialize all the spec constants with + // that ID. + std::unordered_map unique_func_constants; + + for (auto &id_ : ir.ids_for_constant_undef_or_type) { auto &id = ir.ids[id_]; @@ -7192,7 +7501,6 @@ void CompilerMSL::emit_specialization_constants_and_structs() string sc_type_name = type_to_glsl(type); add_resource_name(c.self); string sc_name = to_name(c.self); - string sc_tmp_name = sc_name + "_tmp"; // Function constants are only supported in MSL 1.2 and later. // If we don't support it just declare the "default" directly. @@ -7202,12 +7510,18 @@ void CompilerMSL::emit_specialization_constants_and_structs() if (msl_options.supports_msl_version(1, 2) && has_decoration(c.self, DecorationSpecId) && !c.is_used_as_array_length) { - uint32_t constant_id = get_decoration(c.self, DecorationSpecId); // Only scalar, non-composite values can be function constants. - statement("constant ", sc_type_name, " ", sc_tmp_name, " [[function_constant(", constant_id, - ")]];"); + uint32_t constant_id = get_decoration(c.self, DecorationSpecId); + if (!unique_func_constants.count(constant_id)) + unique_func_constants.insert(make_pair(constant_id, c.self)); + SPIRType::BaseType sc_tmp_type = expression_type(unique_func_constants[constant_id]).basetype; + string sc_tmp_name = to_name(unique_func_constants[constant_id]) + "_tmp"; + if (unique_func_constants[constant_id] == c.self) + statement("constant ", sc_type_name, " ", sc_tmp_name, " [[function_constant(", constant_id, + ")]];"); statement("constant ", sc_type_name, " ", sc_name, " = is_function_constant_defined(", sc_tmp_name, - ") ? ", sc_tmp_name, " : ", constant_expression(c), ";"); + ") ? ", bitcast_expression(type, sc_tmp_type, sc_tmp_name), " : ", constant_expression(c), + ";"); } else if (has_decoration(c.self, DecorationSpecId)) { @@ -7282,6 +7596,21 @@ void CompilerMSL::emit_specialization_constants_and_structs() emit_struct(get(type_id)); } } + else if (id.get_type() == TypeUndef) + { + auto &undef = id.get(); + auto &type = get(undef.basetype); + // OpUndef can be void for some reason ... + if (type.basetype == SPIRType::Void) + return; + + // Undefined global memory is not allowed in MSL. + // Declare constant and init to zeros. Use {}, as global constructors can break Metal. + statement( + inject_top_level_storage_qualifier(variable_decl(type, to_name(undef.self), undef.self), "constant"), + " = {};"); + emitted = true; + } } if (emitted) @@ -7325,7 +7654,7 @@ bool CompilerMSL::emit_tessellation_io_load(uint32_t result_type_id, uint32_t id auto &result_type = get(result_type_id); if (ptr_type.storage != StorageClassInput && ptr_type.storage != StorageClassOutput) return false; - if (ptr_type.storage == StorageClassOutput && get_execution_model() == ExecutionModelTessellationEvaluation) + if (ptr_type.storage == StorageClassOutput && is_tese_shader()) return false; if (has_decoration(ptr, DecorationPatch)) @@ -7647,21 +7976,22 @@ bool CompilerMSL::emit_tessellation_access_chain(const uint32_t *ops, uint32_t l bool flatten_composites = false; bool is_block = false; - - if (var) - is_block = has_decoration(get_variable_data_type(*var).self, DecorationBlock); + bool is_arrayed = false; if (var) { + auto &type = get_variable_data_type(*var); + is_block = has_decoration(type.self, DecorationBlock); + is_arrayed = !type.array.empty(); + flatten_composites = variable_storage_requires_stage_io(var->storage); - patch = has_decoration(ops[2], DecorationPatch) || is_patch_block(get_variable_data_type(*var)); + patch = has_decoration(ops[2], DecorationPatch) || is_patch_block(type); // Should match strip_array in add_interface_block. - flat_data = var->storage == StorageClassInput || - (var->storage == StorageClassOutput && get_execution_model() == ExecutionModelTessellationControl); + flat_data = var->storage == StorageClassInput || (var->storage == StorageClassOutput && is_tesc_shader()); // Patch inputs are treated as normal block IO variables, so they don't deal with this path at all. - if (patch && (!is_block || var->storage == StorageClassInput)) + if (patch && (!is_block || is_arrayed || var->storage == StorageClassInput)) flat_data = false; // We might have a chained access chain, where @@ -7942,8 +8272,8 @@ bool CompilerMSL::emit_tessellation_access_chain(const uint32_t *ops, uint32_t l // Don't do this if the index is a constant 1, though. We need to drop stores // to that one. auto *m = ir.find_meta(var ? var->self : ID(0)); - if (get_execution_model() == ExecutionModelTessellationControl && var && m && - m->decoration.builtin_type == BuiltInTessLevelInner && get_entry_point().flags.get(ExecutionModeTriangles)) + if (is_tesc_shader() && var && m && m->decoration.builtin_type == BuiltInTessLevelInner && + is_tessellating_triangles()) { auto *c = maybe_get(ops[3]); if (c && c->scalar() == 1) @@ -7960,7 +8290,7 @@ bool CompilerMSL::emit_tessellation_access_chain(const uint32_t *ops, uint32_t l bool CompilerMSL::is_out_of_bounds_tessellation_level(uint32_t id_lhs) { - if (!get_entry_point().flags.get(ExecutionModeTriangles)) + if (!is_tessellating_triangles()) return false; // In SPIR-V, TessLevelInner always has two elements and TessLevelOuter always has @@ -7970,7 +8300,7 @@ bool CompilerMSL::is_out_of_bounds_tessellation_level(uint32_t id_lhs) // In Metal, however, only the first element of TessLevelInner and the first three // of TessLevelOuter are accessible. This stems from how in Metal, the tessellation // levels must be stored to a dedicated buffer in a particular format that depends - // on the patch type. Therefore, in Triangles mode, any access to the second + // on the patch type. Therefore, in Triangles mode, any store to the second // inner level or the fourth outer level must be dropped. const auto *e = maybe_get(id_lhs); if (!e || !e->access_chain) @@ -8012,8 +8342,7 @@ bool CompilerMSL::access_chain_needs_stage_io_builtin_translation(uint32_t base) // Avoid overriding it back to just gl_ClipDistance. // This can only happen in scenarios where we cannot flatten/unflatten access chains, so, the only case // where this triggers is evaluation shader inputs. - bool redirect_builtin = get_execution_model() == ExecutionModelTessellationEvaluation ? - var->storage == StorageClassOutput : false; + bool redirect_builtin = is_tese_shader() ? var->storage == StorageClassOutput : false; return redirect_builtin; } @@ -8094,8 +8423,9 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) { #define MSL_BOP(op) emit_binary_op(ops[0], ops[1], ops[2], ops[3], #op) #define MSL_PTR_BOP(op) emit_binary_ptr_op(ops[0], ops[1], ops[2], ops[3], #op) + // MSL does care about implicit integer promotion, but those cases are all handled in common code. #define MSL_BOP_CAST(op, type) \ - emit_binary_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, opcode_is_sign_invariant(opcode)) + emit_binary_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, opcode_is_sign_invariant(opcode), false) #define MSL_UOP(op) emit_unary_op(ops[0], ops[1], ops[2], #op) #define MSL_QFOP(op) emit_quaternary_func_op(ops[0], ops[1], ops[2], ops[3], ops[4], ops[5], #op) #define MSL_TFOP(op) emit_trinary_func_op(ops[0], ops[1], ops[2], ops[3], ops[4], #op) @@ -8402,6 +8732,7 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) break; case OpAtomicIAdd: + case OpAtomicFAddEXT: MSL_AFMO(add); break; @@ -8439,9 +8770,9 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) // Mark that this shader reads from this image uint32_t img_id = ops[2]; auto &type = expression_type(img_id); + auto *p_var = maybe_get_backing_variable(img_id); if (type.image.dim != DimSubpassData) { - auto *p_var = maybe_get_backing_variable(img_id); if (p_var && has_decoration(p_var->self, DecorationNonReadable)) { unset_decoration(p_var->self, DecorationNonReadable); @@ -8449,6 +8780,10 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) } } + // Metal requires explicit fences to break up RAW hazards, even within the same shader invocation + if (msl_options.readwrite_texture_fences && p_var && !has_decoration(p_var->self, DecorationNonWritable)) + statement(to_expression(img_id), ".fence();"); + emit_texture_op(instruction, false); break; } @@ -8541,9 +8876,16 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) args.base.is_fetch = true; args.coord = coord_id; args.lod = lod; - statement(join(to_expression(img_id), ".write(", - remap_swizzle(store_type, texel_type.vecsize, to_expression(texel_id)), ", ", - CompilerMSL::to_function_args(args, &forward), ");")); + + string expr; + if (needs_frag_discard_checks()) + expr = join("(", builtin_to_glsl(BuiltInHelperInvocation, StorageClassInput), " ? ((void)0) : "); + expr += join(to_expression(img_id), ".write(", + remap_swizzle(store_type, texel_type.vecsize, to_expression(texel_id)), ", ", + CompilerMSL::to_function_args(args, &forward), ")"); + if (needs_frag_discard_checks()) + expr += ")"; + statement(expr, ";"); if (p_var && variable_storage_is_aliased(*p_var)) flush_all_aliased_variables(); @@ -8698,14 +9040,34 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) break; case OpStore: - if (is_out_of_bounds_tessellation_level(ops[0])) - break; + { + const auto &type = expression_type(ops[0]); - if (maybe_emit_array_assignment(ops[0], ops[1])) + if (is_out_of_bounds_tessellation_level(ops[0])) break; - CompilerGLSL::emit_instruction(instruction); + if (needs_frag_discard_checks() && + (type.storage == StorageClassStorageBuffer || type.storage == StorageClassUniform)) + { + // If we're in a continue block, this kludge will make the block too complex + // to emit normally. + assert(current_emitting_block); + auto cont_type = continue_block_type(*current_emitting_block); + if (cont_type != SPIRBlock::ContinueNone && cont_type != SPIRBlock::ComplexLoop) + { + current_emitting_block->complex_continue = true; + force_recompile(); + } + statement("if (!", builtin_to_glsl(BuiltInHelperInvocation, StorageClassInput), ")"); + begin_scope(); + } + if (!maybe_emit_array_assignment(ops[0], ops[1])) + CompilerGLSL::emit_instruction(instruction); + if (needs_frag_discard_checks() && + (type.storage == StorageClassStorageBuffer || type.storage == StorageClassUniform)) + end_scope(); break; + } // Compute barriers case OpMemoryBarrier: @@ -8862,12 +9224,33 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) uint32_t op0 = ops[2]; uint32_t op1 = ops[3]; auto &type = get(result_type); + auto input_type = opcode == OpSMulExtended ? int_type : uint_type; + auto &output_type = get_type(result_type); + string cast_op0, cast_op1; + + auto expected_type = binary_op_bitcast_helper(cast_op0, cast_op1, input_type, op0, op1, false); + emit_uninitialized_temporary_expression(result_type, result_id); - statement(to_expression(result_id), ".", to_member_name(type, 0), " = ", - to_enclosed_unpacked_expression(op0), " * ", to_enclosed_unpacked_expression(op1), ";"); - statement(to_expression(result_id), ".", to_member_name(type, 1), " = mulhi(", - to_unpacked_expression(op0), ", ", to_unpacked_expression(op1), ");"); + string mullo_expr, mulhi_expr; + mullo_expr = join(cast_op0, " * ", cast_op1); + mulhi_expr = join("mulhi(", cast_op0, ", ", cast_op1, ")"); + + auto &low_type = get_type(output_type.member_types[0]); + auto &high_type = get_type(output_type.member_types[1]); + if (low_type.basetype != input_type) + { + expected_type.basetype = input_type; + mullo_expr = join(bitcast_glsl_op(low_type, expected_type), "(", mullo_expr, ")"); + } + if (high_type.basetype != input_type) + { + expected_type.basetype = input_type; + mulhi_expr = join(bitcast_glsl_op(high_type, expected_type), "(", mulhi_expr, ")"); + } + + statement(to_expression(result_id), ".", to_member_name(type, 0), " = ", mullo_expr, ";"); + statement(to_expression(result_id), ".", to_member_name(type, 1), " = ", mulhi_expr, ";"); break; } @@ -8882,6 +9265,16 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) break; } + // Legacy sub-group stuff ... + case OpSubgroupBallotKHR: + case OpSubgroupFirstInvocationKHR: + case OpSubgroupReadInvocationKHR: + case OpSubgroupAllKHR: + case OpSubgroupAnyKHR: + case OpSubgroupAllEqualKHR: + emit_subgroup_op(instruction); + break; + // SPV_INTEL_shader_integer_functions2 case OpUCountLeadingZerosINTEL: MSL_UFOP(clz); @@ -8952,7 +9345,10 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) SPIRV_CROSS_THROW("simd_is_helper_thread() requires MSL 2.3 on iOS."); else if (msl_options.is_macos() && !msl_options.supports_msl_version(2, 1)) SPIRV_CROSS_THROW("simd_is_helper_thread() requires MSL 2.1 on macOS."); - emit_op(ops[0], ops[1], "simd_is_helper_thread()", false); + emit_op(ops[0], ops[1], + needs_manual_helper_invocation_updates() ? builtin_to_glsl(BuiltInHelperInvocation, StorageClassInput) : + "simd_is_helper_thread()", + false); break; case OpBeginInvocationInterlockEXT: @@ -8969,10 +9365,11 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) case OpRayQueryInitializeKHR: { flush_variable_declaration(ops[0]); + add_spv_func_and_recompile(SPVFuncImplRayQueryIntersectionParams); statement(to_expression(ops[0]), ".reset(", "ray(", to_expression(ops[4]), ", ", to_expression(ops[6]), ", ", to_expression(ops[5]), ", ", to_expression(ops[7]), "), ", to_expression(ops[1]), - ", intersection_params());"); + ", spvMakeIntersectionParams(", to_expression(ops[2]), "));"); break; } case OpRayQueryProceedKHR: @@ -9122,7 +9519,7 @@ void CompilerMSL::emit_texture_op(const Instruction &i, bool sparse) void CompilerMSL::emit_barrier(uint32_t id_exe_scope, uint32_t id_mem_scope, uint32_t id_mem_sem) { - if (get_execution_model() != ExecutionModelGLCompute && get_execution_model() != ExecutionModelTessellationControl) + if (get_execution_model() != ExecutionModelGLCompute && !is_tesc_shader()) return; uint32_t exe_scope = id_exe_scope ? evaluate_constant_u32(id_exe_scope) : uint32_t(ScopeInvocation); @@ -9149,13 +9546,12 @@ void CompilerMSL::emit_barrier(uint32_t id_exe_scope, uint32_t id_mem_scope, uin string mem_flags = ""; // For tesc shaders, this also affects objects in the Output storage class. // Since in Metal, these are placed in a device buffer, we have to sync device memory here. - if (get_execution_model() == ExecutionModelTessellationControl || + if (is_tesc_shader() || (mem_sem & (MemorySemanticsUniformMemoryMask | MemorySemanticsCrossWorkgroupMemoryMask))) mem_flags += "mem_flags::mem_device"; // Fix tessellation patch function processing - if (get_execution_model() == ExecutionModelTessellationControl || - (mem_sem & (MemorySemanticsSubgroupMemoryMask | MemorySemanticsWorkgroupMemoryMask))) + if (is_tesc_shader() || (mem_sem & (MemorySemanticsSubgroupMemoryMask | MemorySemanticsWorkgroupMemoryMask))) { if (!mem_flags.empty()) mem_flags += " | "; @@ -9213,7 +9609,7 @@ static bool storage_class_array_is_thread(StorageClass storage) } } -void CompilerMSL::emit_array_copy(const string &lhs, uint32_t lhs_id, uint32_t rhs_id, +bool CompilerMSL::emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, StorageClass lhs_storage, StorageClass rhs_storage) { // Allow Metal to use the array template to make arrays a value type. @@ -9252,10 +9648,21 @@ void CompilerMSL::emit_array_copy(const string &lhs, uint32_t lhs_id, uint32_t r // Avoid spvCopy* wrapper functions; Otherwise, spvUnsafeArray<> template cannot be used with that storage qualifier. if (lhs_is_array_template && rhs_is_array_template && !using_builtin_array()) { - statement(lhs, " = ", to_expression(rhs_id), ";"); + // Fall back to normal copy path. + return false; } else { + // Ensure the LHS variable has been declared + if (lhs_var) + flush_variable_declaration(lhs_var->self); + + string lhs; + if (expr) + lhs = expr; + else + lhs = to_expression(lhs_id); + // Assignment from an array initializer is fine. auto &type = expression_type(rhs_id); auto *var = maybe_get_backing_variable(rhs_id); @@ -9329,11 +9736,13 @@ void CompilerMSL::emit_array_copy(const string &lhs, uint32_t lhs_id, uint32_t r else statement("spvArrayCopy", tag, type.array.size(), "(", lhs, ", ", to_expression(rhs_id), ");"); } + + return true; } uint32_t CompilerMSL::get_physical_tess_level_array_size(spv::BuiltIn builtin) const { - if (get_execution_mode_bitset().get(ExecutionModeTriangles)) + if (is_tessellating_triangles()) return builtin == BuiltInTessLevelInner ? 1 : 3; else return builtin == BuiltInTessLevelInner ? 2 : 4; @@ -9347,7 +9756,7 @@ bool CompilerMSL::maybe_emit_array_assignment(uint32_t id_lhs, uint32_t id_rhs) { // We only care about assignments of an entire array auto &type = expression_type(id_rhs); - if (type.array.size() == 0) + if (!type_is_top_level_array(get_pointee_type(type))) return false; auto *var = maybe_get(id_lhs); @@ -9367,8 +9776,7 @@ bool CompilerMSL::maybe_emit_array_assignment(uint32_t id_lhs, uint32_t id_rhs) return true; } - if (get_execution_model() == ExecutionModelTessellationControl && - has_decoration(id_lhs, DecorationBuiltIn)) + if (is_tesc_shader() && has_decoration(id_lhs, DecorationBuiltIn)) { auto builtin = BuiltIn(get_decoration(id_lhs, DecorationBuiltIn)); // Need to manually unroll the array store. @@ -9386,14 +9794,11 @@ bool CompilerMSL::maybe_emit_array_assignment(uint32_t id_lhs, uint32_t id_rhs) } } - // Ensure the LHS variable has been declared - auto *p_v_lhs = maybe_get_backing_variable(id_lhs); - if (p_v_lhs) - flush_variable_declaration(p_v_lhs->self); - auto lhs_storage = get_expression_effective_storage_class(id_lhs); auto rhs_storage = get_expression_effective_storage_class(id_rhs); - emit_array_copy(to_expression(id_lhs), id_lhs, id_rhs, lhs_storage, rhs_storage); + if (!emit_array_copy(nullptr, id_lhs, id_rhs, lhs_storage, rhs_storage)) + return false; + register_write(id_lhs); return true; @@ -9404,7 +9809,7 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id, uint32_t mem_order_1, uint32_t mem_order_2, bool has_mem_order_2, uint32_t obj, uint32_t op1, bool op1_is_pointer, bool op1_is_literal, uint32_t op2) { - string exp = string(op) + "("; + string exp; auto &type = get_pointee_type(expression_type(obj)); auto expected_type = type.basetype; @@ -9419,13 +9824,33 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id, auto remapped_type = type; remapped_type.basetype = expected_type; - exp += "("; auto *var = maybe_get_backing_variable(obj); if (!var) SPIRV_CROSS_THROW("No backing variable for atomic operation."); + const auto &res_type = get(var->basetype); + + bool is_atomic_compare_exchange_strong = op1_is_pointer && op1; + + bool check_discard = opcode != OpAtomicLoad && needs_frag_discard_checks() && + ((res_type.storage == StorageClassUniformConstant && res_type.basetype == SPIRType::Image) || + var->storage == StorageClassStorageBuffer || var->storage == StorageClassUniform); + + if (check_discard) + { + if (is_atomic_compare_exchange_strong) + { + // We're already emitting a CAS loop here; a conditional won't hurt. + emit_uninitialized_temporary_expression(result_type, result_id); + statement("if (!", builtin_to_glsl(BuiltInHelperInvocation, StorageClassInput), ")"); + begin_scope(); + } + else + exp = join("(!", builtin_to_glsl(BuiltInHelperInvocation, StorageClassInput), " ? "); + } + exp += string(op) + "("; + exp += "("; // Emulate texture2D atomic operations - const auto &res_type = get(var->basetype); if (res_type.storage == StorageClassUniformConstant && res_type.basetype == SPIRType::Image) { exp += "device"; @@ -9444,8 +9869,6 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id, exp += "&"; exp += to_enclosed_expression(obj); - bool is_atomic_compare_exchange_strong = op1_is_pointer && op1; - if (is_atomic_compare_exchange_strong) { assert(strcmp(op, "atomic_compare_exchange_weak_explicit") == 0); @@ -9467,11 +9890,42 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id, // the CAS loop, otherwise it will loop infinitely, with the comparison test always failing. // The function updates the comparitor value from the memory value, so the additional // comparison test evaluates the memory value against the expected value. - emit_uninitialized_temporary_expression(result_type, result_id); + if (!check_discard) + emit_uninitialized_temporary_expression(result_type, result_id); statement("do"); begin_scope(); statement(to_name(result_id), " = ", to_expression(op1), ";"); end_scope_decl(join("while (!", exp, " && ", to_name(result_id), " == ", to_enclosed_expression(op1), ")")); + if (check_discard) + { + end_scope(); + statement("else"); + begin_scope(); + exp = "atomic_load_explicit("; + exp += "("; + // Emulate texture2D atomic operations + if (res_type.storage == StorageClassUniformConstant && res_type.basetype == SPIRType::Image) + exp += "device"; + else + exp += get_argument_address_space(*var); + + exp += " atomic_"; + exp += type_to_glsl(remapped_type); + exp += "*)"; + + exp += "&"; + exp += to_enclosed_expression(obj); + + if (has_mem_order_2) + exp += string(", ") + get_memory_order(mem_order_2); + else + exp += string(", ") + get_memory_order(mem_order_1); + + exp += ")"; + + statement(to_name(result_id), " = ", exp, ";"); + end_scope(); + } } else { @@ -9492,6 +9946,38 @@ void CompilerMSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id, exp += ")"; + if (check_discard) + { + exp += " : "; + if (strcmp(op, "atomic_store_explicit") != 0) + { + exp += "atomic_load_explicit("; + exp += "("; + // Emulate texture2D atomic operations + if (res_type.storage == StorageClassUniformConstant && res_type.basetype == SPIRType::Image) + exp += "device"; + else + exp += get_argument_address_space(*var); + + exp += " atomic_"; + exp += type_to_glsl(remapped_type); + exp += "*)"; + + exp += "&"; + exp += to_enclosed_expression(obj); + + if (has_mem_order_2) + exp += string(", ") + get_memory_order(mem_order_2); + else + exp += string(", ") + get_memory_order(mem_order_1); + + exp += ")"; + } + else + exp += "((void)0)"; + exp += ")"; + } + if (expected_type != type.basetype) exp = bitcast_expression(type, expected_type, exp); @@ -9993,9 +10479,9 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &) // Manufacture automatic sampler arg for SampledImage texture if (arg_type.image.dim != DimBuffer) { - if (arg_type.array.empty()) + if (arg_type.array.empty() || is_runtime_size_array(arg_type)) { - decl += join(", ", sampler_type(arg_type, arg.id), " ", to_sampler_expression(arg.id)); + decl += join(", ", sampler_type(arg_type, arg.id), " ", to_sampler_expression(name_id)); } else { @@ -10003,7 +10489,8 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &) descriptor_address_space(name_id, StorageClassUniformConstant, "thread const"); - decl += join(", ", sampler_address_space, " ", sampler_type(arg_type, arg.id), "& ", to_sampler_expression(arg.id)); + decl += join(", ", sampler_address_space, " ", sampler_type(arg_type, name_id), "& ", + to_sampler_expression(name_id)); } } } @@ -10013,10 +10500,10 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &) !is_dynamic_img_sampler) { bool arg_is_array = !arg_type.array.empty(); - decl += join(", constant uint", arg_is_array ? "* " : "& ", to_swizzle_expression(arg.id)); + decl += join(", constant uint", arg_is_array ? "* " : "& ", to_swizzle_expression(name_id)); } - if (buffers_requiring_array_length.count(name_id)) + if (buffer_requires_array_length(name_id)) { bool arg_is_array = !arg_type.array.empty(); decl += join(", constant uint", arg_is_array ? "* " : "& ", to_buffer_size_expression(name_id)); @@ -10380,25 +10867,24 @@ string CompilerMSL::to_function_args(const TextureFunctionArguments &args, bool break; } - if (args.base.is_fetch && (args.offset || args.coffset)) + if (args.base.is_fetch && args.offset) { - uint32_t offset_expr = args.offset ? args.offset : args.coffset; // Fetch offsets must be applied directly to the coordinate. - forward = forward && should_forward(offset_expr); - auto &type = expression_type(offset_expr); + forward = forward && should_forward(args.offset); + auto &type = expression_type(args.offset); if (imgtype.image.dim == Dim1D && msl_options.texture_1D_as_2D) { if (type.basetype != SPIRType::UInt) - tex_coords += join(" + uint2(", bitcast_expression(SPIRType::UInt, offset_expr), ", 0)"); + tex_coords += join(" + uint2(", bitcast_expression(SPIRType::UInt, args.offset), ", 0)"); else - tex_coords += join(" + uint2(", to_enclosed_expression(offset_expr), ", 0)"); + tex_coords += join(" + uint2(", to_enclosed_expression(args.offset), ", 0)"); } else { if (type.basetype != SPIRType::UInt) - tex_coords += " + " + bitcast_expression(SPIRType::UInt, offset_expr); + tex_coords += " + " + bitcast_expression(SPIRType::UInt, args.offset); else - tex_coords += " + " + to_enclosed_expression(offset_expr); + tex_coords += " + " + to_enclosed_expression(args.offset); } } @@ -10503,7 +10989,8 @@ string CompilerMSL::to_function_args(const TextureFunctionArguments &args, bool // We will detect a compile-time constant 0 value for gradient and promote that to level(0) on MSL. bool constant_zero_x = !grad_x || expression_is_constant_null(grad_x); bool constant_zero_y = !grad_y || expression_is_constant_null(grad_y); - if (constant_zero_x && constant_zero_y) + if (constant_zero_x && constant_zero_y && + (!imgtype.image.arrayed || !msl_options.sample_dref_lod_array_as_grad)) { lod = 0; grad_x = 0; @@ -10549,6 +11036,55 @@ string CompilerMSL::to_function_args(const TextureFunctionArguments &args, bool { farg_str += ", " + to_expression(lod); } + else if (msl_options.sample_dref_lod_array_as_grad && args.dref && imgtype.image.arrayed) + { + if (msl_options.is_macos() && !msl_options.supports_msl_version(2, 3)) + SPIRV_CROSS_THROW("Using non-constant 0.0 gradient() qualifier for sample_compare. This is not " + "supported on macOS prior to MSL 2.3."); + // Some Metal devices have a bug where the LoD is erroneously biased upward + // when using a level() argument. Since this doesn't happen as much with gradient2d(), + // if we perform the LoD calculation in reverse, we can pass a gradient + // instead. + // lod = log2(rhoMax/eta) -> exp2(lod) = rhoMax/eta + // If we make all of the scale factors the same, eta will be 1 and + // exp2(lod) = rho. + // rhoX = dP/dx * extent; rhoY = dP/dy * extent + // Therefore, dP/dx = dP/dy = exp2(lod)/extent. + // (Subtracting 0.5 before exponentiation gives better results.) + string grad_opt, extent; + VariableID base_img = img; + if (auto *combined = maybe_get(img)) + base_img = combined->image; + switch (imgtype.image.dim) + { + case Dim1D: + grad_opt = "2d"; + extent = join("float2(", to_expression(base_img), ".get_width(), 1.0)"); + break; + case Dim2D: + grad_opt = "2d"; + extent = join("float2(", to_expression(base_img), ".get_width(), ", to_expression(base_img), ".get_height())"); + break; + case DimCube: + if (imgtype.image.arrayed && msl_options.emulate_cube_array) + { + grad_opt = "2d"; + extent = join("float2(", to_expression(base_img), ".get_width())"); + } + else + { + grad_opt = "cube"; + extent = join("float3(", to_expression(base_img), ".get_width())"); + } + break; + default: + grad_opt = "unsupported_gradient_dimension"; + extent = "float3(1.0)"; + break; + } + farg_str += join(", gradient", grad_opt, "(exp2(", to_expression(lod), " - 0.5) / ", extent, ", exp2(", + to_expression(lod), " - 0.5) / ", extent, ")"); + } else { farg_str += ", level(" + to_expression(lod) + ")"; @@ -10602,13 +11138,7 @@ string CompilerMSL::to_function_args(const TextureFunctionArguments &args, bool // Add offsets string offset_expr; const SPIRType *offset_type = nullptr; - if (args.coffset && !args.base.is_fetch) - { - forward = forward && should_forward(args.coffset); - offset_expr = to_expression(args.coffset); - offset_type = &expression_type(args.coffset); - } - else if (args.offset && !args.base.is_fetch) + if (args.offset && !args.base.is_fetch) { forward = forward && should_forward(args.offset); offset_expr = to_expression(args.offset); @@ -10688,7 +11218,7 @@ string CompilerMSL::to_function_args(const TextureFunctionArguments &args, bool // If the texture coordinates are floating point, invokes MSL round() function to round them. string CompilerMSL::round_fp_tex_coords(string tex_coords, bool coord_is_fp) { - return coord_is_fp ? ("round(" + tex_coords + ")") : tex_coords; + return coord_is_fp ? ("rint(" + tex_coords + ")") : tex_coords; } // Returns a string to use in an image sampling function argument. @@ -11053,7 +11583,7 @@ string CompilerMSL::to_func_call_arg(const SPIRFunction::Parameter &arg, uint32_ else if (msl_options.swizzle_texture_samples && has_sampled_images && is_sampled_image_type(type)) arg_str += ", " + to_swizzle_expression(var_id ? var_id : id); - if (buffers_requiring_array_length.count(var_id)) + if (buffer_requires_array_length(var_id)) arg_str += ", " + to_buffer_size_expression(var_id ? var_id : id); if (is_dynamic_img_sampler) @@ -11137,6 +11667,19 @@ string CompilerMSL::to_buffer_size_expression(uint32_t id) { auto buffer_expr = expr.substr(0, index); auto array_expr = expr.substr(index); + if (auto var = maybe_get_backing_variable(id)) + { + auto &var_type = get(var->basetype); + if (is_runtime_size_array(var_type)) + { + if (!msl_options.runtime_array_rich_descriptor) + SPIRV_CROSS_THROW("OpArrayLength requires rich descriptor format"); + + auto last_pos = array_expr.find_last_of(']'); + if (last_pos != std::string::npos) + return buffer_expr + ".length(" + array_expr.substr(1, last_pos - 1) + ")"; + } + } return buffer_expr + buffer_size_name_suffix + array_expr; } } @@ -11173,11 +11716,11 @@ bool CompilerMSL::member_is_non_native_row_major_matrix(const SPIRType &type, ui } string CompilerMSL::convert_row_major_matrix(string exp_str, const SPIRType &exp_type, uint32_t physical_type_id, - bool is_packed) + bool is_packed, bool relaxed) { if (!is_matrix(exp_type)) { - return CompilerGLSL::convert_row_major_matrix(std::move(exp_str), exp_type, physical_type_id, is_packed); + return CompilerGLSL::convert_row_major_matrix(std::move(exp_str), exp_type, physical_type_id, is_packed, relaxed); } else { @@ -11287,11 +11830,14 @@ string CompilerMSL::to_struct_member(const SPIRType &type, uint32_t member_type_ } } - // Very specifically, image load-store in argument buffers are disallowed on MSL on iOS. - if (msl_options.is_ios() && physical_type.basetype == SPIRType::Image && physical_type.image.sampled == 2) + // iOS Tier 1 argument buffers do not support writable images. + if (physical_type.basetype == SPIRType::Image && + physical_type.image.sampled == 2 && + msl_options.is_ios() && + msl_options.argument_buffers_tier <= Options::ArgumentBuffersTier::Tier1 && + !has_decoration(orig_id, DecorationNonWritable)) { - if (!has_decoration(orig_id, DecorationNonWritable)) - SPIRV_CROSS_THROW("Writable images are not allowed in argument buffers on iOS."); + SPIRV_CROSS_THROW("Writable images are not allowed on Tier1 argument buffers on iOS."); } // Array information is baked into these types. @@ -11406,8 +11952,7 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in } // Vertex and tessellation evaluation function outputs - if (((execution.model == ExecutionModelVertex && !msl_options.vertex_for_tessellation) || - execution.model == ExecutionModelTessellationEvaluation) && + if (((execution.model == ExecutionModelVertex && !msl_options.vertex_for_tessellation) || is_tese_shader()) && type.storage == StorageClassOutput) { if (is_builtin) @@ -11461,7 +12006,7 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in } // Tessellation control function inputs - if (execution.model == ExecutionModelTessellationControl && type.storage == StorageClassInput) + if (is_tesc_shader() && type.storage == StorageClassInput) { if (is_builtin) { @@ -11498,7 +12043,7 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in } // Tessellation control function outputs - if (execution.model == ExecutionModelTessellationControl && type.storage == StorageClassOutput) + if (is_tesc_shader() && type.storage == StorageClassOutput) { // For this type of shader, we always arrange for it to capture its // output to a buffer. For this reason, qualifiers are irrelevant here. @@ -11509,7 +12054,7 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in } // Tessellation evaluation function inputs - if (execution.model == ExecutionModelTessellationEvaluation && type.storage == StorageClassInput) + if (is_tese_shader() && type.storage == StorageClassInput) { if (is_builtin) { @@ -11525,6 +12070,10 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in break; } } + + if (msl_options.raw_buffer_tese_input) + return ""; + // The special control point array must not be marked with an attribute. if (get_type(type.member_types[index]).basetype == SPIRType::ControlPointArray) return ""; @@ -11782,7 +12331,7 @@ uint32_t CompilerMSL::get_or_allocate_builtin_input_member_location(spv::BuiltIn // Triangle tess level inputs are shared in one packed float4, // mark both builtins as sharing one location. - if (get_execution_mode_bitset().get(ExecutionModeTriangles) && + if (!msl_options.raw_buffer_tese_input && is_tessellating_triangles() && (builtin == BuiltInTessLevelInner || builtin == BuiltInTessLevelOuter)) { builtin_to_automatic_input_location[BuiltInTessLevelInner] = loc; @@ -11826,8 +12375,7 @@ uint32_t CompilerMSL::get_or_allocate_builtin_output_member_location(spv::BuiltI // Triangle tess level inputs are shared in one packed float4; // mark both builtins as sharing one location. - if (get_execution_mode_bitset().get(ExecutionModeTriangles) && - (builtin == BuiltInTessLevelInner || builtin == BuiltInTessLevelOuter)) + if (is_tessellating_triangles() && (builtin == BuiltInTessLevelInner || builtin == BuiltInTessLevelOuter)) { builtin_to_automatic_output_location[BuiltInTessLevelInner] = loc; builtin_to_automatic_output_location[BuiltInTessLevelOuter] = loc; @@ -11869,10 +12417,9 @@ string CompilerMSL::func_type_decl(SPIRType &type) if (execution.flags.get(ExecutionModeIsolines)) SPIRV_CROSS_THROW("Metal does not support isoline tessellation."); if (msl_options.is_ios()) - entry_type = - join("[[ patch(", execution.flags.get(ExecutionModeTriangles) ? "triangle" : "quad", ") ]] vertex"); + entry_type = join("[[ patch(", is_tessellating_triangles() ? "triangle" : "quad", ") ]] vertex"); else - entry_type = join("[[ patch(", execution.flags.get(ExecutionModeTriangles) ? "triangle" : "quad", ", ", + entry_type = join("[[ patch(", is_tessellating_triangles() ? "triangle" : "quad", ", ", execution.output_vertices, ") ]] vertex"); break; case ExecutionModelFragment: @@ -11896,6 +12443,16 @@ string CompilerMSL::func_type_decl(SPIRType &type) return entry_type + " " + return_type; } +bool CompilerMSL::is_tesc_shader() const +{ + return get_execution_model() == ExecutionModelTessellationControl; +} + +bool CompilerMSL::is_tese_shader() const +{ + return get_execution_model() == ExecutionModelTessellationEvaluation; +} + bool CompilerMSL::uses_explicit_early_fragment_test() { auto &ep_flags = get_entry_point().flags; @@ -11967,9 +12524,20 @@ string CompilerMSL::get_type_address_space(const SPIRType &type, uint32_t id, bo break; case StorageClassInput: - if (get_execution_model() == ExecutionModelTessellationControl && var && - var->basevariable == stage_in_ptr_var_id) - addr_space = msl_options.multi_patch_workgroup ? "constant" : "threadgroup"; + if (is_tesc_shader() && var && var->basevariable == stage_in_ptr_var_id) + addr_space = msl_options.multi_patch_workgroup ? "const device" : "threadgroup"; + // Don't pass tessellation levels in the device AS; we load and convert them + // to float manually. + if (is_tese_shader() && msl_options.raw_buffer_tese_input && var) + { + bool is_stage_in = var->basevariable == stage_in_ptr_var_id; + bool is_patch_stage_in = has_decoration(var->self, DecorationPatch); + bool is_builtin = has_decoration(var->self, DecorationBuiltIn); + BuiltIn builtin = (BuiltIn)get_decoration(var->self, DecorationBuiltIn); + bool is_tess_level = is_builtin && (builtin == BuiltInTessLevelOuter || builtin == BuiltInTessLevelInner); + if (is_stage_in || (is_patch_stage_in && !is_tess_level)) + addr_space = "const device"; + } if (get_execution_model() == ExecutionModelFragment && var && var->basevariable == stage_in_var_id) addr_space = "thread"; break; @@ -12027,19 +12595,21 @@ const char *CompilerMSL::to_restrict(uint32_t id, bool space) else flags = get_decoration_bitset(id); - return flags.get(DecorationRestrict) ? (space ? "restrict " : "restrict") : ""; + return flags.get(DecorationRestrict) || flags.get(DecorationRestrictPointerEXT) ? + (space ? "__restrict " : "__restrict") : ""; } string CompilerMSL::entry_point_arg_stage_in() { string decl; - if (get_execution_model() == ExecutionModelTessellationControl && msl_options.multi_patch_workgroup) + if ((is_tesc_shader() && msl_options.multi_patch_workgroup) || + (is_tese_shader() && msl_options.raw_buffer_tese_input)) return decl; // Stage-in structure uint32_t stage_in_id; - if (get_execution_model() == ExecutionModelTessellationEvaluation) + if (is_tese_shader()) stage_in_id = patch_stage_in_var_id; else stage_in_id = stage_in_var_id; @@ -12079,7 +12649,7 @@ bool CompilerMSL::is_direct_input_builtin(BuiltIn bi_type) return false; case BuiltInInvocationId: case BuiltInPrimitiveId: - return get_execution_model() != ExecutionModelTessellationControl || !msl_options.multi_patch_workgroup; + return !is_tesc_shader() || !msl_options.multi_patch_workgroup; // Tess. evaluation function in case BuiltInTessLevelInner: case BuiltInTessLevelOuter: @@ -12170,7 +12740,7 @@ void CompilerMSL::entry_point_args_builtin(string &ep_args) else ep_args += builtin_type_decl(bi_type, var_id) + " " + to_expression(var_id); - ep_args += " [[" + builtin_qualifier(bi_type); + ep_args += string(" [[") + builtin_qualifier(bi_type); if (bi_type == BuiltInSampleMask && get_entry_point().flags.get(ExecutionModePostDepthCoverage)) { if (!msl_options.supports_msl_version(2)) @@ -12234,7 +12804,7 @@ void CompilerMSL::entry_point_args_builtin(string &ep_args) " [[buffer(", msl_options.shader_output_buffer_index, ")]]"); } - if (get_execution_model() == ExecutionModelTessellationControl) + if (is_tesc_shader()) { if (!ep_args.empty()) ep_args += ", "; @@ -12276,7 +12846,7 @@ void CompilerMSL::entry_point_args_builtin(string &ep_args) // a buffer to hold the per-patch data, a buffer to hold the per-patch // tessellation levels, and a block of workgroup memory to hold the // input control point data. - if (get_execution_model() == ExecutionModelTessellationControl) + if (is_tesc_shader()) { if (patch_stage_out_var_id) { @@ -12310,20 +12880,22 @@ void CompilerMSL::entry_point_args_builtin(string &ep_args) if (outer_factor_initializer_id && (c = maybe_get(outer_factor_initializer_id))) { auto &entry_func = get(ir.default_entry_point); - entry_func.fixup_hooks_in.push_back([=]() { - uint32_t components = get_execution_mode_bitset().get(ExecutionModeTriangles) ? 3 : 4; - for (uint32_t i = 0; i < components; i++) - { - statement(builtin_to_glsl(BuiltInTessLevelOuter, StorageClassOutput), "[", i, "] = ", - "half(", to_expression(c->subconstants[i]), ");"); - } - }); + entry_func.fixup_hooks_in.push_back( + [=]() + { + uint32_t components = is_tessellating_triangles() ? 3 : 4; + for (uint32_t i = 0; i < components; i++) + { + statement(builtin_to_glsl(BuiltInTessLevelOuter, StorageClassOutput), "[", i, + "] = ", "half(", to_expression(c->subconstants[i]), ");"); + } + }); } if (inner_factor_initializer_id && (c = maybe_get(inner_factor_initializer_id))) { auto &entry_func = get(ir.default_entry_point); - if (get_execution_mode_bitset().get(ExecutionModeTriangles)) + if (is_tessellating_triangles()) { entry_func.fixup_hooks_in.push_back([=]() { statement(builtin_to_glsl(BuiltInTessLevelInner, StorageClassOutput), " = ", "half(", @@ -12359,6 +12931,36 @@ void CompilerMSL::entry_point_args_builtin(string &ep_args) } } } + // Tessellation evaluation shaders get three additional parameters: + // a buffer for the per-patch data, a buffer for the per-patch + // tessellation levels, and a buffer for the control point data. + if (is_tese_shader() && msl_options.raw_buffer_tese_input) + { + if (patch_stage_in_var_id) + { + if (!ep_args.empty()) + ep_args += ", "; + ep_args += + join("const device ", type_to_glsl(get_patch_stage_in_struct_type()), "* ", patch_input_buffer_var_name, + " [[buffer(", convert_to_string(msl_options.shader_patch_input_buffer_index), ")]]"); + } + + if (tess_level_inner_var_id || tess_level_outer_var_id) + { + if (!ep_args.empty()) + ep_args += ", "; + ep_args += join("const device ", get_tess_factor_struct_name(), "* ", tess_factor_buffer_var_name, + " [[buffer(", convert_to_string(msl_options.shader_tess_factor_buffer_index), ")]]"); + } + + if (stage_in_var_id) + { + if (!ep_args.empty()) + ep_args += ", "; + ep_args += join("const device ", type_to_glsl(get_stage_in_struct_type()), "* ", input_buffer_var_name, + " [[buffer(", convert_to_string(msl_options.shader_input_buffer_index), ")]]"); + } + } } string CompilerMSL::entry_point_args_argument_buffer(bool append_comma) @@ -12399,7 +13001,7 @@ string CompilerMSL::entry_point_args_argument_buffer(bool append_comma) claimed_bindings.set(buffer_binding); - ep_args += get_argument_address_space(var) + " " + type_to_glsl(type) + "& " + to_restrict(id) + to_name(id); + ep_args += get_argument_address_space(var) + " " + type_to_glsl(type) + "& " + to_restrict(id, true) + to_name(id); ep_args += " [[buffer(" + convert_to_string(buffer_binding) + ")]]"; next_metal_resource_index_buffer = max(next_metal_resource_index_buffer, buffer_binding + 1); @@ -12454,6 +13056,7 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) SmallVector resources; + entry_point_bindings.clear(); ir.for_each_typed_id([&](uint32_t var_id, SPIRVariable &var) { if ((var.storage == StorageClassUniform || var.storage == StorageClassUniformConstant || var.storage == StorageClassPushConstant || var.storage == StorageClassStorageBuffer) && @@ -12483,10 +13086,6 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) (resource.var->storage == StorageClassUniform || resource.var->storage == StorageClassStorageBuffer)) { - // Possible, but horrible to implement, ignore for now. - if (!type.array.empty()) - SPIRV_CROSS_THROW("Aliasing arrayed discrete descriptors is currently not supported."); - descriptor_alias = resource.var; // Self-reference marks that we should declare the resource, // and it's being used as an alias (so we can emit void* instead). @@ -12525,6 +13124,7 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) if (constexpr_sampler && constexpr_sampler->ycbcr_conversion_enable) plane_count = constexpr_sampler->planes; + entry_point_bindings.push_back(&var); for (uint32_t i = 0; i < plane_count; i++) resources.push_back({ &var, descriptor_alias, to_name(var_id), SPIRType::Image, get_metal_resource_index(var, SPIRType::Image, i), i, secondary_index }); @@ -12545,15 +13145,16 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) if (!descriptor_alias) resource_index = get_metal_resource_index(var, type.basetype); + entry_point_bindings.push_back(&var); resources.push_back({ &var, descriptor_alias, to_name(var_id), type.basetype, resource_index, 0, secondary_index }); } } }); - stable_sort(resources.begin(), resources.end(), [](const Resource &lhs, const Resource &rhs) { - return tie(lhs.basetype, lhs.index) < tie(rhs.basetype, rhs.index); - }); + stable_sort(resources.begin(), resources.end(), + [](const Resource &lhs, const Resource &rhs) + { return tie(lhs.basetype, lhs.index) < tie(rhs.basetype, rhs.index); }); for (auto &r : resources) { @@ -12601,23 +13202,45 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) // later. uint32_t array_size = to_array_size_literal(type); - if (array_size == 0) - SPIRV_CROSS_THROW("Unsized arrays of buffers are not supported in MSL."); - - // Allow Metal to use the array template to make arrays a value type is_using_builtin_array = true; - buffer_arrays_discrete.push_back(var_id); - for (uint32_t i = 0; i < array_size; ++i) + if (is_runtime_size_array(type)) { + add_spv_func_and_recompile(SPVFuncImplVariableDescriptorArray); if (!ep_args.empty()) ep_args += ", "; - ep_args += get_argument_address_space(var) + " " + type_to_glsl(type) + "* " + to_restrict(var_id) + - r.name + "_" + convert_to_string(i); - ep_args += " [[buffer(" + convert_to_string(r.index + i) + ")"; + const bool ssbo = has_decoration(type.self, DecorationBufferBlock); + if ((var.storage == spv::StorageClassStorageBuffer || ssbo) && + msl_options.runtime_array_rich_descriptor) + { + add_spv_func_and_recompile(SPVFuncImplVariableSizedDescriptor); + ep_args += "const device spvBufferDescriptor<" + get_argument_address_space(var) + " " + + type_to_glsl(type) + "*>* "; + } + else + { + ep_args += "const device spvDescriptor<" + get_argument_address_space(var) + " " + + type_to_glsl(type) + "*>* "; + } + ep_args += to_restrict(var_id, true) + r.name + "_"; + ep_args += " [[buffer(" + convert_to_string(r.index) + ")"; if (interlocked_resources.count(var_id)) ep_args += ", raster_order_group(0)"; ep_args += "]]"; } + else + { + for (uint32_t i = 0; i < array_size; ++i) + { + if (!ep_args.empty()) + ep_args += ", "; + ep_args += get_argument_address_space(var) + " " + type_to_glsl(type) + "* " + + to_restrict(var_id, true) + r.name + "_" + convert_to_string(i); + ep_args += " [[buffer(" + convert_to_string(r.index + i) + ")"; + if (interlocked_resources.count(var_id)) + ep_args += ", raster_order_group(0)"; + ep_args += "]]"; + } + } is_using_builtin_array = false; } else @@ -12625,7 +13248,7 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) if (!ep_args.empty()) ep_args += ", "; ep_args += - get_argument_address_space(var) + " " + type_to_glsl(type) + "& " + to_restrict(var_id) + r.name; + get_argument_address_space(var) + " " + type_to_glsl(type) + "& " + to_restrict(var_id, true) + r.name; ep_args += " [[buffer(" + convert_to_string(r.index) + ")"; if (interlocked_resources.count(var_id)) ep_args += ", raster_order_group(0)"; @@ -12637,7 +13260,10 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) if (!ep_args.empty()) ep_args += ", "; ep_args += sampler_type(type, var_id) + " " + r.name; - ep_args += " [[sampler(" + convert_to_string(r.index) + ")]]"; + if (is_runtime_size_array(type)) + ep_args += "_ [[buffer(" + convert_to_string(r.index) + ")]]"; + else + ep_args += " [[sampler(" + convert_to_string(r.index) + ")]]"; break; case SPIRType::Image: { @@ -12651,7 +13277,12 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) ep_args += image_type_glsl(type, var_id) + " " + r.name; if (r.plane > 0) ep_args += join(plane_name_suffix, r.plane); - ep_args += " [[texture(" + convert_to_string(r.index) + ")"; + + if (is_runtime_size_array(type)) + ep_args += "_ [[buffer(" + convert_to_string(r.index) + ")"; + else + ep_args += " [[texture(" + convert_to_string(r.index) + ")"; + if (interlocked_resources.count(var_id)) ep_args += ", raster_order_group(0)"; ep_args += "]]"; @@ -12677,9 +13308,22 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) break; } case SPIRType::AccelerationStructure: - ep_args += ", " + type_to_glsl(type, var_id) + " " + r.name; - ep_args += " [[buffer(" + convert_to_string(r.index) + ")]]"; + { + if (is_runtime_size_array(type)) + { + add_spv_func_and_recompile(SPVFuncImplVariableDescriptor); + const auto &parent_type = get(type.parent_type); + ep_args += ", const device spvDescriptor<" + type_to_glsl(parent_type) + ">* " + + to_restrict(var_id, true) + r.name + "_"; + ep_args += " [[buffer(" + convert_to_string(r.index) + ")]]"; + } + else + { + ep_args += ", " + type_to_glsl(type, var_id) + " " + r.name; + ep_args += " [[buffer(" + convert_to_string(r.index) + ")]]"; + } break; + } default: if (!ep_args.empty()) ep_args += ", "; @@ -12762,27 +13406,29 @@ void CompilerMSL::fix_up_shader_inputs_outputs() else if ((var.storage == StorageClassStorageBuffer || (var.storage == StorageClassUniform && ssbo)) && !is_hidden_variable(var)) { - if (buffers_requiring_array_length.count(var.self)) + if (buffer_requires_array_length(var.self)) { - entry_func.fixup_hooks_in.push_back([this, &type, &var, var_id]() { - bool is_array_type = !type.array.empty(); - - uint32_t desc_set = get_decoration(var_id, DecorationDescriptorSet); - if (descriptor_set_is_argument_buffer(desc_set)) - { - statement("constant uint", is_array_type ? "* " : "& ", to_buffer_size_expression(var_id), - is_array_type ? " = &" : " = ", to_name(argument_buffer_ids[desc_set]), - ".spvBufferSizeConstants", "[", - convert_to_string(get_metal_resource_index(var, SPIRType::Image)), "];"); - } - else - { - // If we have an array of images, we need to be able to index into it, so take a pointer instead. - statement("constant uint", is_array_type ? "* " : "& ", to_buffer_size_expression(var_id), - is_array_type ? " = &" : " = ", to_name(buffer_size_buffer_id), "[", - convert_to_string(get_metal_resource_index(var, type.basetype)), "];"); - } - }); + entry_func.fixup_hooks_in.push_back( + [this, &type, &var, var_id]() + { + bool is_array_type = !type.array.empty() && !is_runtime_size_array(type); + + uint32_t desc_set = get_decoration(var_id, DecorationDescriptorSet); + if (descriptor_set_is_argument_buffer(desc_set)) + { + statement("constant uint", is_array_type ? "* " : "& ", to_buffer_size_expression(var_id), + is_array_type ? " = &" : " = ", to_name(argument_buffer_ids[desc_set]), + ".spvBufferSizeConstants", "[", + convert_to_string(get_metal_resource_index(var, SPIRType::Image)), "];"); + } + else + { + // If we have an array of images, we need to be able to index into it, so take a pointer instead. + statement("constant uint", is_array_type ? "* " : "& ", to_buffer_size_expression(var_id), + is_array_type ? " = &" : " = ", to_name(buffer_size_buffer_id), "[", + convert_to_string(get_metal_resource_index(var, type.basetype)), "];"); + } + }); } } }); @@ -12818,7 +13464,7 @@ void CompilerMSL::fix_up_shader_inputs_outputs() break; case BuiltInInvocationId: // This is direct-mapped without multi-patch workgroups. - if (get_execution_model() != ExecutionModelTessellationControl || !msl_options.multi_patch_workgroup) + if (!is_tesc_shader() || !msl_options.multi_patch_workgroup) break; entry_func.fixup_hooks_in.push_back([=]() { @@ -12830,7 +13476,7 @@ void CompilerMSL::fix_up_shader_inputs_outputs() case BuiltInPrimitiveId: // This is natively supported by fragment and tessellation evaluation shaders. // In tessellation control shaders, this is direct-mapped without multi-patch workgroups. - if (get_execution_model() != ExecutionModelTessellationControl || !msl_options.multi_patch_workgroup) + if (!is_tesc_shader() || !msl_options.multi_patch_workgroup) break; entry_func.fixup_hooks_in.push_back([=]() { @@ -12840,7 +13486,7 @@ void CompilerMSL::fix_up_shader_inputs_outputs() }); break; case BuiltInPatchVertices: - if (get_execution_model() == ExecutionModelTessellationEvaluation) + if (is_tese_shader()) entry_func.fixup_hooks_in.push_back([=]() { statement(builtin_type_decl(bi_type), " ", to_expression(var_id), " = ", to_expression(patch_stage_in_var_id), ".gl_in.size();"); @@ -12863,7 +13509,7 @@ void CompilerMSL::fix_up_shader_inputs_outputs() // Emit a fixup to account for the shifted domain. Don't do this for triangles; // MoltenVK will just reverse the winding order instead. - if (msl_options.tess_domain_origin_lower_left && !get_entry_point().flags.get(ExecutionModeTriangles)) + if (msl_options.tess_domain_origin_lower_left && !is_tessellating_triangles()) { string tc = to_expression(var_id); entry_func.fixup_hooks_in.push_back([=]() { statement(tc, ".y = 1.0 - ", tc, ".y;"); }); @@ -13357,8 +14003,6 @@ uint32_t CompilerMSL::get_metal_resource_index(SPIRVariable &var, SPIRType::Base for (uint32_t i = 0; i < uint32_t(type.array.size()); i++) binding_stride *= to_array_size_literal(type, i); - assert(binding_stride != 0); - // If a binding has not been specified, revert to incrementing resource indices. uint32_t resource_index; @@ -13370,6 +14014,11 @@ uint32_t CompilerMSL::get_metal_resource_index(SPIRVariable &var, SPIRType::Base } else { + if (is_runtime_size_array(type)) + { + basetype = SPIRType::Struct; + binding_stride = 1; + } // Allocate from plain bindings which are allocated per resource type. switch (basetype) { @@ -13472,6 +14121,7 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) bool type_is_image = type.basetype == SPIRType::Image || type.basetype == SPIRType::SampledImage || type.basetype == SPIRType::Sampler; + bool type_is_tlas = type.basetype == SPIRType::AccelerationStructure; // For opaque types we handle const later due to descriptor address spaces. const char *cv_qualifier = (constref && !type_is_image) ? "const " : ""; @@ -13522,6 +14172,18 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) else decl = join(cv_qualifier, type_to_glsl(type, arg.id)); } + else if (is_runtime_size_array(type)) + { + const auto *parent_type = &get(type.parent_type); + auto type_name = type_to_glsl(*parent_type, arg.id); + if (type.basetype == SPIRType::AccelerationStructure) + decl = join("spvDescriptorArray<", type_name, ">"); + else if (type_is_image) + decl = join("spvDescriptorArray<", cv_qualifier, type_name, ">"); + else + decl = join("spvDescriptorArray<", address_space, " ", type_name, "*>"); + address_space = "const"; + } else if ((type_storage == StorageClassUniform || type_storage == StorageClassStorageBuffer) && is_array(type)) { is_using_builtin_array = true; @@ -13543,7 +14205,9 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) decl += join(" ", cv_qualifier); } else + { decl = join(cv_qualifier, type_to_glsl(type, arg.id)); + } } if (!builtin && !is_pointer && @@ -13561,7 +14225,7 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) // non-constant arrays, but we can create thread const from constant. decl = string("thread const ") + decl; decl += " (&"; - const char *restrict_kw = to_restrict(name_id); + const char *restrict_kw = to_restrict(name_id, true); if (*restrict_kw) { decl += " "; @@ -13593,7 +14257,7 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) } // Special case, need to override the array size here if we're using tess level as an argument. - if (get_execution_model() == ExecutionModelTessellationControl && builtin && + if (is_tesc_shader() && builtin && (builtin_type == BuiltInTessLevelInner || builtin_type == BuiltInTessLevelOuter)) { uint32_t array_size = get_physical_tess_level_array_size(builtin_type); @@ -13610,6 +14274,10 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) decl += join("[", array_size, "]"); } } + else if (is_runtime_size_array(type)) + { + decl += " " + to_expression(name_id); + } else { auto array_size_decl = type_to_array_glsl(type); @@ -13618,7 +14286,7 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) else decl += " (&"; - const char *restrict_kw = to_restrict(name_id); + const char *restrict_kw = to_restrict(name_id, true); if (*restrict_kw) { decl += " "; @@ -13633,7 +14301,8 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) } } } - else if (!type_is_image && (!pull_model_inputs.count(var.basevariable) || type.basetype == SPIRType::Struct)) + else if (!type_is_image && !type_is_tlas && + (!pull_model_inputs.count(var.basevariable) || type.basetype == SPIRType::Struct)) { // If this is going to be a reference to a variable pointer, the address space // for the reference has to go before the '&', but after the '*'. @@ -13650,12 +14319,16 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) } decl += "&"; decl += " "; - decl += to_restrict(name_id); + decl += to_restrict(name_id, true); decl += to_expression(name_id); } - else if (type_is_image) + else if (type_is_image || type_is_tlas) { - if (type.array.empty()) + if (is_runtime_size_array(type)) + { + decl = address_space + " " + decl + " " + to_expression(name_id); + } + else if (type.array.empty()) { // For non-arrayed types we can just pass opaque descriptors by value. // This fixes problems if descriptors are passed by value from argument buffers and plain descriptors @@ -14068,9 +14741,9 @@ void CompilerMSL::sync_entry_point_aliases_and_names() entry.second.name = ir.meta[entry.first].decoration.alias; } -string CompilerMSL::to_member_reference(uint32_t base, const SPIRType &type, uint32_t index, bool ptr_chain) +string CompilerMSL::to_member_reference(uint32_t base, const SPIRType &type, uint32_t index, bool ptr_chain_is_resolved) { - auto *var = maybe_get(base); + auto *var = maybe_get_backing_variable(base); // If this is a buffer array, we have to dereference the buffer pointers. // Otherwise, if this is a pointer expression, dereference it. @@ -14080,14 +14753,15 @@ string CompilerMSL::to_member_reference(uint32_t base, const SPIRType &type, uin { // Only allow -> dereference for block types. This is so we get expressions like // buffer[i]->first_member.second_member, rather than buffer[i]->first->second. - bool is_block = has_decoration(type.self, DecorationBlock) || has_decoration(type.self, DecorationBufferBlock); + const bool is_block = + has_decoration(type.self, DecorationBlock) || has_decoration(type.self, DecorationBufferBlock); bool is_buffer_variable = is_block && (var->storage == StorageClassUniform || var->storage == StorageClassStorageBuffer); declared_as_pointer = is_buffer_variable && is_array(get(var->basetype)); } - if (declared_as_pointer || (!ptr_chain && should_dereference(base))) + if (declared_as_pointer || (!ptr_chain_is_resolved && should_dereference(base))) return join("->", to_member_name(type, index)); else return join(".", to_member_name(type, index)); @@ -14114,7 +14788,7 @@ string CompilerMSL::type_to_glsl(const SPIRType &type, uint32_t id, bool member) string type_name; // Pointer? - if (type.pointer) + if (type_is_top_level_pointer(type) || type_is_array_of_pointers(type)) { assert(type.pointer_depth > 0); @@ -14137,7 +14811,17 @@ string CompilerMSL::type_to_glsl(const SPIRType &type, uint32_t id, bool member) while (type_is_pointer(*p_parent_type)) p_parent_type = &get(p_parent_type->parent_type); + // If we're emitting BDA, just use the templated type. + // Emitting builtin arrays need a lot of cooperation with other code to ensure + // the C-style nesting works right. + // FIXME: This is somewhat of a hack. + bool old_is_using_builtin_array = is_using_builtin_array; + if (type_is_top_level_physical_pointer(type)) + is_using_builtin_array = false; + type_name = join(type_address_space, " ", type_to_glsl(*p_parent_type, id)); + + is_using_builtin_array = old_is_using_builtin_array; } switch (type.basetype) @@ -14150,7 +14834,7 @@ string CompilerMSL::type_to_glsl(const SPIRType &type, uint32_t id, bool member) default: // Anything else can be a raw pointer. type_name += "*"; - restrict_kw = to_restrict(id); + restrict_kw = to_restrict(id, false); if (*restrict_kw) { type_name += " "; @@ -14350,23 +15034,25 @@ bool CompilerMSL::variable_decl_is_remapped_storage(const SPIRVariable &variable if (storage == StorageClassWorkgroup) { - auto model = get_execution_model(); - // Specially masked IO block variable. // Normally, we will never access IO blocks directly here. // The only scenario which that should occur is with a masked IO block. - if (model == ExecutionModelTessellationControl && variable.storage == StorageClassOutput && + if (is_tesc_shader() && variable.storage == StorageClassOutput && has_decoration(get(variable.basetype).self, DecorationBlock)) { return true; } - return variable.storage == StorageClassOutput && - model == ExecutionModelTessellationControl && - is_stage_output_variable_masked(variable); + return variable.storage == StorageClassOutput && is_tesc_shader() && is_stage_output_variable_masked(variable); } else if (storage == StorageClassStorageBuffer) { + // These builtins are passed directly; we don't want to use remapping + // for them. + auto builtin = (BuiltIn)get_decoration(variable.self, DecorationBuiltIn); + if (is_tese_shader() && is_builtin_variable(variable) && (builtin == BuiltInTessCoord || builtin == BuiltInPrimitiveId)) + return false; + // We won't be able to catch writes to control point outputs here since variable // refers to a function local pointer. // This is fine, as there cannot be concurrent writers to that memory anyways, @@ -14425,7 +15111,14 @@ std::string CompilerMSL::sampler_type(const SPIRType &type, uint32_t id) array_size = get_resource_array_size(id); if (array_size == 0) - SPIRV_CROSS_THROW("Unsized array of samplers is not supported in MSL."); + { + add_spv_func_and_recompile(SPVFuncImplVariableDescriptor); + add_spv_func_and_recompile(SPVFuncImplVariableDescriptorArray); + auto &parent = get(get_pointee_type(type).parent_type); + if (processing_entry_point) + return join("const device spvDescriptor<", sampler_type(parent, id), ">*"); + return join("const spvDescriptorArray<", sampler_type(parent, id), ">"); + } auto &parent = get(get_pointee_type(type).parent_type); return join("array<", sampler_type(parent, id), ", ", array_size, ">"); @@ -14471,7 +15164,12 @@ string CompilerMSL::image_type_glsl(const SPIRType &type, uint32_t id) array_size = get_resource_array_size(id); if (array_size == 0) - SPIRV_CROSS_THROW("Unsized array of images is not supported in MSL."); + { + add_spv_func_and_recompile(SPVFuncImplVariableDescriptor); + add_spv_func_and_recompile(SPVFuncImplVariableDescriptorArray); + auto &parent = get(get_pointee_type(type).parent_type); + return join("const device spvDescriptor<", image_type_glsl(parent, id), ">*"); + } auto &parent = get(get_pointee_type(type).parent_type); return join("array<", image_type_glsl(parent, id), ", ", array_size, ">"); @@ -14687,6 +15385,10 @@ void CompilerMSL::emit_subgroup_op(const Instruction &i) case OpGroupNonUniformBallotFindLSB: case OpGroupNonUniformBallotFindMSB: case OpGroupNonUniformBallotBitCount: + case OpSubgroupBallotKHR: + case OpSubgroupAllKHR: + case OpSubgroupAnyKHR: + case OpSubgroupAllEqualKHR: if (!msl_options.supports_msl_version(2, 2)) SPIRV_CROSS_THROW("Ballot ops on iOS requires Metal 2.2 and up."); break; @@ -14697,6 +15399,7 @@ void CompilerMSL::emit_subgroup_op(const Instruction &i) case OpGroupNonUniformShuffleDown: case OpGroupNonUniformQuadSwap: case OpGroupNonUniformQuadBroadcast: + case OpSubgroupReadInvocationKHR: break; } } @@ -14712,14 +15415,31 @@ void CompilerMSL::emit_subgroup_op(const Instruction &i) case OpGroupNonUniformShuffleXor: case OpGroupNonUniformShuffleUp: case OpGroupNonUniformShuffleDown: + case OpSubgroupReadInvocationKHR: break; } } - uint32_t result_type = ops[0]; - uint32_t id = ops[1]; + uint32_t op_idx = 0; + uint32_t result_type = ops[op_idx++]; + uint32_t id = ops[op_idx++]; - auto scope = static_cast(evaluate_constant_u32(ops[2])); + Scope scope; + switch (op) + { + case OpSubgroupBallotKHR: + case OpSubgroupFirstInvocationKHR: + case OpSubgroupReadInvocationKHR: + case OpSubgroupAllKHR: + case OpSubgroupAnyKHR: + case OpSubgroupAllEqualKHR: + // These earlier instructions don't have the scope operand. + scope = ScopeSubgroup; + break; + default: + scope = static_cast(evaluate_constant_u32(ops[op_idx++])); + break; + } if (scope != ScopeSubgroup) SPIRV_CROSS_THROW("Only subgroup scope is supported."); @@ -14733,47 +15453,50 @@ void CompilerMSL::emit_subgroup_op(const Instruction &i) break; case OpGroupNonUniformBroadcast: - emit_binary_func_op(result_type, id, ops[3], ops[4], "spvSubgroupBroadcast"); + case OpSubgroupReadInvocationKHR: + emit_binary_func_op(result_type, id, ops[op_idx], ops[op_idx + 1], "spvSubgroupBroadcast"); break; case OpGroupNonUniformBroadcastFirst: - emit_unary_func_op(result_type, id, ops[3], "spvSubgroupBroadcastFirst"); + case OpSubgroupFirstInvocationKHR: + emit_unary_func_op(result_type, id, ops[op_idx], "spvSubgroupBroadcastFirst"); break; case OpGroupNonUniformBallot: - emit_unary_func_op(result_type, id, ops[3], "spvSubgroupBallot"); + case OpSubgroupBallotKHR: + emit_unary_func_op(result_type, id, ops[op_idx], "spvSubgroupBallot"); break; case OpGroupNonUniformInverseBallot: - emit_binary_func_op(result_type, id, ops[3], builtin_subgroup_invocation_id_id, "spvSubgroupBallotBitExtract"); + emit_binary_func_op(result_type, id, ops[op_idx], builtin_subgroup_invocation_id_id, "spvSubgroupBallotBitExtract"); break; case OpGroupNonUniformBallotBitExtract: - emit_binary_func_op(result_type, id, ops[3], ops[4], "spvSubgroupBallotBitExtract"); + emit_binary_func_op(result_type, id, ops[op_idx], ops[op_idx + 1], "spvSubgroupBallotBitExtract"); break; case OpGroupNonUniformBallotFindLSB: - emit_binary_func_op(result_type, id, ops[3], builtin_subgroup_size_id, "spvSubgroupBallotFindLSB"); + emit_binary_func_op(result_type, id, ops[op_idx], builtin_subgroup_size_id, "spvSubgroupBallotFindLSB"); break; case OpGroupNonUniformBallotFindMSB: - emit_binary_func_op(result_type, id, ops[3], builtin_subgroup_size_id, "spvSubgroupBallotFindMSB"); + emit_binary_func_op(result_type, id, ops[op_idx], builtin_subgroup_size_id, "spvSubgroupBallotFindMSB"); break; case OpGroupNonUniformBallotBitCount: { - auto operation = static_cast(ops[3]); + auto operation = static_cast(ops[op_idx++]); switch (operation) { case GroupOperationReduce: - emit_binary_func_op(result_type, id, ops[4], builtin_subgroup_size_id, "spvSubgroupBallotBitCount"); + emit_binary_func_op(result_type, id, ops[op_idx], builtin_subgroup_size_id, "spvSubgroupBallotBitCount"); break; case GroupOperationInclusiveScan: - emit_binary_func_op(result_type, id, ops[4], builtin_subgroup_invocation_id_id, + emit_binary_func_op(result_type, id, ops[op_idx], builtin_subgroup_invocation_id_id, "spvSubgroupBallotInclusiveBitCount"); break; case GroupOperationExclusiveScan: - emit_binary_func_op(result_type, id, ops[4], builtin_subgroup_invocation_id_id, + emit_binary_func_op(result_type, id, ops[op_idx], builtin_subgroup_invocation_id_id, "spvSubgroupBallotExclusiveBitCount"); break; default: @@ -14783,57 +15506,60 @@ void CompilerMSL::emit_subgroup_op(const Instruction &i) } case OpGroupNonUniformShuffle: - emit_binary_func_op(result_type, id, ops[3], ops[4], "spvSubgroupShuffle"); + emit_binary_func_op(result_type, id, ops[op_idx], ops[op_idx + 1], "spvSubgroupShuffle"); break; case OpGroupNonUniformShuffleXor: - emit_binary_func_op(result_type, id, ops[3], ops[4], "spvSubgroupShuffleXor"); + emit_binary_func_op(result_type, id, ops[op_idx], ops[op_idx + 1], "spvSubgroupShuffleXor"); break; case OpGroupNonUniformShuffleUp: - emit_binary_func_op(result_type, id, ops[3], ops[4], "spvSubgroupShuffleUp"); + emit_binary_func_op(result_type, id, ops[op_idx], ops[op_idx + 1], "spvSubgroupShuffleUp"); break; case OpGroupNonUniformShuffleDown: - emit_binary_func_op(result_type, id, ops[3], ops[4], "spvSubgroupShuffleDown"); + emit_binary_func_op(result_type, id, ops[op_idx], ops[op_idx + 1], "spvSubgroupShuffleDown"); break; case OpGroupNonUniformAll: + case OpSubgroupAllKHR: if (msl_options.use_quadgroup_operation()) - emit_unary_func_op(result_type, id, ops[3], "quad_all"); + emit_unary_func_op(result_type, id, ops[op_idx], "quad_all"); else - emit_unary_func_op(result_type, id, ops[3], "simd_all"); + emit_unary_func_op(result_type, id, ops[op_idx], "simd_all"); break; case OpGroupNonUniformAny: + case OpSubgroupAnyKHR: if (msl_options.use_quadgroup_operation()) - emit_unary_func_op(result_type, id, ops[3], "quad_any"); + emit_unary_func_op(result_type, id, ops[op_idx], "quad_any"); else - emit_unary_func_op(result_type, id, ops[3], "simd_any"); + emit_unary_func_op(result_type, id, ops[op_idx], "simd_any"); break; case OpGroupNonUniformAllEqual: - emit_unary_func_op(result_type, id, ops[3], "spvSubgroupAllEqual"); + case OpSubgroupAllEqualKHR: + emit_unary_func_op(result_type, id, ops[op_idx], "spvSubgroupAllEqual"); break; // clang-format off #define MSL_GROUP_OP(op, msl_op) \ case OpGroupNonUniform##op: \ { \ - auto operation = static_cast(ops[3]); \ + auto operation = static_cast(ops[op_idx++]); \ if (operation == GroupOperationReduce) \ - emit_unary_func_op(result_type, id, ops[4], "simd_" #msl_op); \ + emit_unary_func_op(result_type, id, ops[op_idx], "simd_" #msl_op); \ else if (operation == GroupOperationInclusiveScan) \ - emit_unary_func_op(result_type, id, ops[4], "simd_prefix_inclusive_" #msl_op); \ + emit_unary_func_op(result_type, id, ops[op_idx], "simd_prefix_inclusive_" #msl_op); \ else if (operation == GroupOperationExclusiveScan) \ - emit_unary_func_op(result_type, id, ops[4], "simd_prefix_exclusive_" #msl_op); \ + emit_unary_func_op(result_type, id, ops[op_idx], "simd_prefix_exclusive_" #msl_op); \ else if (operation == GroupOperationClusteredReduce) \ { \ /* Only cluster sizes of 4 are supported. */ \ - uint32_t cluster_size = evaluate_constant_u32(ops[5]); \ + uint32_t cluster_size = evaluate_constant_u32(ops[op_idx + 1]); \ if (cluster_size != 4) \ SPIRV_CROSS_THROW("Metal only supports quad ClusteredReduce."); \ - emit_unary_func_op(result_type, id, ops[4], "quad_" #msl_op); \ + emit_unary_func_op(result_type, id, ops[op_idx], "quad_" #msl_op); \ } \ else \ SPIRV_CROSS_THROW("Invalid group operation."); \ @@ -14849,9 +15575,9 @@ case OpGroupNonUniform##op: \ #define MSL_GROUP_OP(op, msl_op) \ case OpGroupNonUniform##op: \ { \ - auto operation = static_cast(ops[3]); \ + auto operation = static_cast(ops[op_idx++]); \ if (operation == GroupOperationReduce) \ - emit_unary_func_op(result_type, id, ops[4], "simd_" #msl_op); \ + emit_unary_func_op(result_type, id, ops[op_idx], "simd_" #msl_op); \ else if (operation == GroupOperationInclusiveScan) \ SPIRV_CROSS_THROW("Metal doesn't support InclusiveScan for OpGroupNonUniform" #op "."); \ else if (operation == GroupOperationExclusiveScan) \ @@ -14859,10 +15585,10 @@ case OpGroupNonUniform##op: \ else if (operation == GroupOperationClusteredReduce) \ { \ /* Only cluster sizes of 4 are supported. */ \ - uint32_t cluster_size = evaluate_constant_u32(ops[5]); \ + uint32_t cluster_size = evaluate_constant_u32(ops[op_idx + 1]); \ if (cluster_size != 4) \ SPIRV_CROSS_THROW("Metal only supports quad ClusteredReduce."); \ - emit_unary_func_op(result_type, id, ops[4], "quad_" #msl_op); \ + emit_unary_func_op(result_type, id, ops[op_idx], "quad_" #msl_op); \ } \ else \ SPIRV_CROSS_THROW("Invalid group operation."); \ @@ -14872,9 +15598,9 @@ case OpGroupNonUniform##op: \ #define MSL_GROUP_OP_CAST(op, msl_op, type) \ case OpGroupNonUniform##op: \ { \ - auto operation = static_cast(ops[3]); \ + auto operation = static_cast(ops[op_idx++]); \ if (operation == GroupOperationReduce) \ - emit_unary_func_op_cast(result_type, id, ops[4], "simd_" #msl_op, type, type); \ + emit_unary_func_op_cast(result_type, id, ops[op_idx], "simd_" #msl_op, type, type); \ else if (operation == GroupOperationInclusiveScan) \ SPIRV_CROSS_THROW("Metal doesn't support InclusiveScan for OpGroupNonUniform" #op "."); \ else if (operation == GroupOperationExclusiveScan) \ @@ -14882,10 +15608,10 @@ case OpGroupNonUniform##op: \ else if (operation == GroupOperationClusteredReduce) \ { \ /* Only cluster sizes of 4 are supported. */ \ - uint32_t cluster_size = evaluate_constant_u32(ops[5]); \ + uint32_t cluster_size = evaluate_constant_u32(ops[op_idx + 1]); \ if (cluster_size != 4) \ SPIRV_CROSS_THROW("Metal only supports quad ClusteredReduce."); \ - emit_unary_func_op_cast(result_type, id, ops[4], "quad_" #msl_op, type, type); \ + emit_unary_func_op_cast(result_type, id, ops[op_idx], "quad_" #msl_op, type, type); \ } \ else \ SPIRV_CROSS_THROW("Invalid group operation."); \ @@ -14909,11 +15635,11 @@ case OpGroupNonUniform##op: \ #undef MSL_GROUP_OP_CAST case OpGroupNonUniformQuadSwap: - emit_binary_func_op(result_type, id, ops[3], ops[4], "spvQuadSwap"); + emit_binary_func_op(result_type, id, ops[op_idx], ops[op_idx + 1], "spvQuadSwap"); break; case OpGroupNonUniformQuadBroadcast: - emit_binary_func_op(result_type, id, ops[3], ops[4], "spvQuadBroadcast"); + emit_binary_func_op(result_type, id, ops[op_idx], ops[op_idx + 1], "spvQuadBroadcast"); break; default: @@ -15086,7 +15812,7 @@ string CompilerMSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) case BuiltInClipDistance: case BuiltInCullDistance: case BuiltInLayer: - if (get_execution_model() == ExecutionModelTessellationControl) + if (is_tesc_shader()) break; if (storage != StorageClassInput && current_function && (current_function->self == ir.default_entry_point) && !is_stage_output_builtin_masked(builtin)) @@ -15118,8 +15844,8 @@ string CompilerMSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) break; case BuiltInTessLevelOuter: - if (get_execution_model() == ExecutionModelTessellationControl && - storage != StorageClassInput && current_function && (current_function->self == ir.default_entry_point)) + if (is_tesc_shader() && storage != StorageClassInput && current_function && + (current_function->self == ir.default_entry_point)) { return join(tess_factor_buffer_var_name, "[", to_expression(builtin_primitive_id_id), "].edgeTessellationFactor"); @@ -15127,8 +15853,8 @@ string CompilerMSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) break; case BuiltInTessLevelInner: - if (get_execution_model() == ExecutionModelTessellationControl && - storage != StorageClassInput && current_function && (current_function->self == ir.default_entry_point)) + if (is_tesc_shader() && storage != StorageClassInput && current_function && + (current_function->self == ir.default_entry_point)) { return join(tess_factor_buffer_var_name, "[", to_expression(builtin_primitive_id_id), "].insideTessellationFactor"); @@ -15136,6 +15862,8 @@ string CompilerMSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) break; case BuiltInHelperInvocation: + if (needs_manual_helper_invocation_updates()) + break; if (msl_options.is_ios() && !msl_options.supports_msl_version(2, 3)) SPIRV_CROSS_THROW("simd_is_helper_thread() requires version 2.3 on iOS."); else if (msl_options.is_macos() && !msl_options.supports_msl_version(2, 1)) @@ -15371,7 +16099,6 @@ string CompilerMSL::builtin_qualifier(BuiltIn builtin) // Returns an MSL string type declaration for a SPIR-V builtin string CompilerMSL::builtin_type_decl(BuiltIn builtin, uint32_t id) { - const SPIREntryPoint &execution = get_entry_point(); switch (builtin) { // Vertex function in @@ -15415,12 +16142,12 @@ string CompilerMSL::builtin_type_decl(BuiltIn builtin, uint32_t id) // Tess. control function out case BuiltInTessLevelInner: - if (execution.model == ExecutionModelTessellationEvaluation) - return !execution.flags.get(ExecutionModeTriangles) ? "float2" : "float"; + if (is_tese_shader()) + return (msl_options.raw_buffer_tese_input || is_tessellating_triangles()) ? "float" : "float2"; return "half"; case BuiltInTessLevelOuter: - if (execution.model == ExecutionModelTessellationEvaluation) - return !execution.flags.get(ExecutionModeTriangles) ? "float4" : "float"; + if (is_tese_shader()) + return (msl_options.raw_buffer_tese_input || is_tessellating_triangles()) ? "float" : "float4"; return "half"; // Tess. evaluation function in @@ -15495,8 +16222,8 @@ string CompilerMSL::built_in_func_arg(BuiltIn builtin, bool prefix_comma) // Handle HLSL-style 0-based vertex/instance index. builtin_declaration = true; bi_arg += builtin_type_decl(builtin); - bi_arg += " " + builtin_to_glsl(builtin, StorageClassInput); - bi_arg += " [[" + builtin_qualifier(builtin) + "]]"; + bi_arg += string(" ") + builtin_to_glsl(builtin, StorageClassInput); + bi_arg += string(" [[") + builtin_qualifier(builtin) + string("]]"); builtin_declaration = false; return bi_arg; @@ -15544,7 +16271,7 @@ uint32_t CompilerMSL::get_declared_type_array_stride_msl(const SPIRType &type, b for (uint32_t dim = 0; dim < dimensions; dim++) { uint32_t array_size = to_array_size_literal(type, dim); - value_size *= max(array_size, 1u); + value_size *= max(array_size, 1u); } return value_size; @@ -15655,7 +16382,7 @@ uint32_t CompilerMSL::get_declared_type_size_msl(const SPIRType &type, bool is_p if (!type.array.empty()) { uint32_t array_size = to_array_size_literal(type); - return get_declared_type_array_stride_msl(type, is_packed, row_major) * max(array_size, 1u); + return get_declared_type_array_stride_msl(type, is_packed, row_major) * max(array_size, 1u); } if (type.basetype == SPIRType::Struct) @@ -15850,6 +16577,10 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui suppress_missing_prototypes = true; break; + case OpDemoteToHelperInvocationEXT: + uses_discard = true; + break; + // Emulate texture2D atomic operations case OpImageTexelPointer: { @@ -15859,8 +16590,7 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui } case OpImageWrite: - if (!compiler.msl_options.supports_msl_version(2, 2)) - uses_resource_write = true; + uses_image_write = true; break; case OpStore: @@ -15874,6 +16604,7 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui case OpAtomicIIncrement: case OpAtomicIDecrement: case OpAtomicIAdd: + case OpAtomicFAddEXT: case OpAtomicISub: case OpAtomicSMin: case OpAtomicUMin: @@ -15887,9 +16618,11 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui auto it = image_pointers.find(args[2]); if (it != image_pointers.end()) { + uses_image_write = true; compiler.atomic_image_vars.insert(it->second); } - check_resource_write(args[2]); + else + check_resource_write(args[2]); break; } @@ -15900,8 +16633,10 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui if (it != image_pointers.end()) { compiler.atomic_image_vars.insert(it->second); + uses_image_write = true; } - check_resource_write(args[0]); + else + check_resource_write(args[0]); break; } @@ -15935,8 +16670,12 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui case OpArrayLength: { auto *var = compiler.maybe_get_backing_variable(args[2]); - if (var) - compiler.buffers_requiring_array_length.insert(var->self); + if (var != nullptr) + { + auto &type = compiler.get(var->basetype); + if (!is_runtime_size_array(type)) + compiler.buffers_requiring_array_length.insert(var->self); + } break; } @@ -16004,6 +16743,11 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui break; } + case OpIsHelperInvocationEXT: + if (compiler.needs_manual_helper_invocation_updates()) + needs_helper_invocation = true; + break; + default: break; } @@ -16021,9 +16765,8 @@ void CompilerMSL::OpCodePreprocessor::check_resource_write(uint32_t var_id) { auto *p_var = compiler.maybe_get_backing_variable(var_id); StorageClass sc = p_var ? p_var->storage : StorageClassMax; - if (!compiler.msl_options.supports_msl_version(2, 1) && - (sc == StorageClassUniform || sc == StorageClassStorageBuffer)) - uses_resource_write = true; + if (sc == StorageClassUniform || sc == StorageClassStorageBuffer) + uses_buffer_write = true; } // Returns an enumeration of a SPIR-V function that needs to be output for certain Op codes. @@ -16071,6 +16814,7 @@ CompilerMSL::SPVFuncImpl CompilerMSL::OpCodePreprocessor::get_spv_func_impl(Op o case OpAtomicIIncrement: case OpAtomicIDecrement: case OpAtomicIAdd: + case OpAtomicFAddEXT: case OpAtomicISub: case OpAtomicSMin: case OpAtomicUMin: @@ -16168,12 +16912,15 @@ CompilerMSL::SPVFuncImpl CompilerMSL::OpCodePreprocessor::get_spv_func_impl(Op o } case OpGroupNonUniformBroadcast: + case OpSubgroupReadInvocationKHR: return SPVFuncImplSubgroupBroadcast; case OpGroupNonUniformBroadcastFirst: + case OpSubgroupFirstInvocationKHR: return SPVFuncImplSubgroupBroadcastFirst; case OpGroupNonUniformBallot: + case OpSubgroupBallotKHR: return SPVFuncImplSubgroupBallot; case OpGroupNonUniformInverseBallot: @@ -16190,6 +16937,7 @@ CompilerMSL::SPVFuncImpl CompilerMSL::OpCodePreprocessor::get_spv_func_impl(Op o return SPVFuncImplSubgroupBallotBitCount; case OpGroupNonUniformAllEqual: + case OpSubgroupAllEqualKHR: return SPVFuncImplSubgroupAllEqual; case OpGroupNonUniformShuffle: @@ -16318,21 +17066,32 @@ void CompilerMSL::cast_from_variable_load(uint32_t source_id, std::string &expr, bool is_packed = has_extended_decoration(source_id, SPIRVCrossDecorationPhysicalTypePacked); auto *source_expr = maybe_get(source_id); auto *var = maybe_get_backing_variable(source_id); - const SPIRType *var_type, *phys_type; + const SPIRType *var_type = nullptr, *phys_type = nullptr; + if (uint32_t phys_id = get_extended_decoration(source_id, SPIRVCrossDecorationPhysicalTypeID)) phys_type = &get(phys_id); else phys_type = &expr_type; + if (var) { source_id = var->self; var_type = &get_variable_data_type(*var); } + bool rewrite_boolean_load = + expr_type.basetype == SPIRType::Boolean && + (var && (var->storage == StorageClassWorkgroup || var_type->basetype == SPIRType::Struct)); + // Type fixups for workgroup variables if they are booleans. - if (var && (var->storage == StorageClassWorkgroup || var_type->basetype == SPIRType::Struct) && - expr_type.basetype == SPIRType::Boolean) - expr = join(type_to_glsl(expr_type), "(", expr, ")"); + if (rewrite_boolean_load) + { + if (type_is_top_level_array(expr_type)) + expr = to_rerolled_array_expression(expr_type, expr, expr_type); + else + expr = join(type_to_glsl(expr_type), "(", expr, ")"); + } + // Type fixups for workgroup variables if they are matrices. // Don't do fixup for packed types; those are handled specially. // FIXME: Maybe use a type like spvStorageMatrix for packed matrices? @@ -16392,7 +17151,7 @@ void CompilerMSL::cast_from_variable_load(uint32_t source_id, std::string &expr, case BuiltInTessLevelInner: case BuiltInTessLevelOuter: - if (get_execution_model() == ExecutionModelTessellationControl) + if (is_tesc_shader()) { expected_type = SPIRType::Half; expected_width = 16; @@ -16422,7 +17181,7 @@ void CompilerMSL::cast_from_variable_load(uint32_t source_id, std::string &expr, wrap_expr += ", "; } - if (get_execution_mode_bitset().get(ExecutionModeTriangles)) + if (is_tessellating_triangles()) wrap_expr += ", 0.0"; wrap_expr += " })"; @@ -16444,25 +17203,38 @@ void CompilerMSL::cast_to_variable_store(uint32_t target_id, std::string &expr, bool is_packed = has_extended_decoration(target_id, SPIRVCrossDecorationPhysicalTypePacked); auto *target_expr = maybe_get(target_id); auto *var = maybe_get_backing_variable(target_id); - const SPIRType *var_type, *phys_type; + const SPIRType *var_type = nullptr, *phys_type = nullptr; + if (uint32_t phys_id = get_extended_decoration(target_id, SPIRVCrossDecorationPhysicalTypeID)) phys_type = &get(phys_id); else phys_type = &expr_type; + if (var) { target_id = var->self; var_type = &get_variable_data_type(*var); } - // Type fixups for workgroup variables if they are booleans. - if (var && (var->storage == StorageClassWorkgroup || var_type->basetype == SPIRType::Struct) && - expr_type.basetype == SPIRType::Boolean) + bool rewrite_boolean_store = + expr_type.basetype == SPIRType::Boolean && + (var && (var->storage == StorageClassWorkgroup || var_type->basetype == SPIRType::Struct)); + + // Type fixups for workgroup variables or struct members if they are booleans. + if (rewrite_boolean_store) { - auto short_type = expr_type; - short_type.basetype = SPIRType::Short; - expr = join(type_to_glsl(short_type), "(", expr, ")"); + if (type_is_top_level_array(expr_type)) + { + expr = to_rerolled_array_expression(*var_type, expr, expr_type); + } + else + { + auto short_type = expr_type; + short_type.basetype = SPIRType::Short; + expr = join(type_to_glsl(short_type), "(", expr, ")"); + } } + // Type fixups for workgroup variables if they are matrices. // Don't do fixup for packed types; those are handled specially. // FIXME: Maybe use a type like spvStorageMatrix for packed matrices? @@ -16562,13 +17334,14 @@ bool CompilerMSL::descriptor_set_is_argument_buffer(uint32_t desc_set) const bool CompilerMSL::is_supported_argument_buffer_type(const SPIRType &type) const { - // Very specifically, image load-store in argument buffers are disallowed on MSL on iOS. - // But we won't know when the argument buffer is encoded whether this image will have - // a NonWritable decoration. So just use discrete arguments for all storage images - // on iOS. - bool is_storage_image = type.basetype == SPIRType::Image && type.image.sampled == 2; - bool is_supported_type = !msl_options.is_ios() || !is_storage_image; - return !type_is_msl_framebuffer_fetch(type) && is_supported_type; + // iOS Tier 1 argument buffers do not support writable images. + // When the argument buffer is encoded, we don't know whether this image will have a + // NonWritable decoration, so just use discrete arguments for all storage images on iOS. + bool is_supported_type = !(type.basetype == SPIRType::Image && + type.image.sampled == 2 && + msl_options.is_ios() && + msl_options.argument_buffers_tier <= Options::ArgumentBuffersTier::Tier1); + return is_supported_type && !type_is_msl_framebuffer_fetch(type); } void CompilerMSL::analyze_argument_buffers() @@ -16705,7 +17478,7 @@ void CompilerMSL::analyze_argument_buffers() // Check if this descriptor set needs a swizzle buffer. if (needs_swizzle_buffer_def && is_sampled_image_type(type)) set_needs_swizzle_buffer[desc_set] = true; - else if (buffers_requiring_array_length.count(var_id) != 0) + else if (buffer_requires_array_length(var_id)) { set_needs_buffer_sizes[desc_set] = true; needs_buffer_sizes = true; @@ -16827,51 +17600,51 @@ void CompilerMSL::analyze_argument_buffers() // member_index and next_arg_buff_index are incremented when padding members are added. if (msl_options.pad_argument_buffer_resources) { - while (resource.index > next_arg_buff_index) + auto &rez_bind = get_argument_buffer_resource(desc_set, next_arg_buff_index); + if (!resource.descriptor_alias) { - auto &rez_bind = get_argument_buffer_resource(desc_set, next_arg_buff_index); - switch (rez_bind.basetype) + while (resource.index > next_arg_buff_index) { - case SPIRType::Void: - case SPIRType::Boolean: - case SPIRType::SByte: - case SPIRType::UByte: - case SPIRType::Short: - case SPIRType::UShort: - case SPIRType::Int: - case SPIRType::UInt: - case SPIRType::Int64: - case SPIRType::UInt64: - case SPIRType::AtomicCounter: - case SPIRType::Half: - case SPIRType::Float: - case SPIRType::Double: - add_argument_buffer_padding_buffer_type(buffer_type, member_index, next_arg_buff_index, rez_bind); - break; - case SPIRType::Image: - add_argument_buffer_padding_image_type(buffer_type, member_index, next_arg_buff_index, rez_bind); - break; - case SPIRType::Sampler: - add_argument_buffer_padding_sampler_type(buffer_type, member_index, next_arg_buff_index, rez_bind); - break; - case SPIRType::SampledImage: - if (next_arg_buff_index == rez_bind.msl_sampler) - add_argument_buffer_padding_sampler_type(buffer_type, member_index, next_arg_buff_index, rez_bind); - else + switch (rez_bind.basetype) + { + case SPIRType::Void: + case SPIRType::Boolean: + case SPIRType::SByte: + case SPIRType::UByte: + case SPIRType::Short: + case SPIRType::UShort: + case SPIRType::Int: + case SPIRType::UInt: + case SPIRType::Int64: + case SPIRType::UInt64: + case SPIRType::AtomicCounter: + case SPIRType::Half: + case SPIRType::Float: + case SPIRType::Double: + add_argument_buffer_padding_buffer_type(buffer_type, member_index, next_arg_buff_index, rez_bind); + break; + case SPIRType::Image: add_argument_buffer_padding_image_type(buffer_type, member_index, next_arg_buff_index, rez_bind); - break; - default: - break; + break; + case SPIRType::Sampler: + add_argument_buffer_padding_sampler_type(buffer_type, member_index, next_arg_buff_index, rez_bind); + break; + case SPIRType::SampledImage: + if (next_arg_buff_index == rez_bind.msl_sampler) + add_argument_buffer_padding_sampler_type(buffer_type, member_index, next_arg_buff_index, rez_bind); + else + add_argument_buffer_padding_image_type(buffer_type, member_index, next_arg_buff_index, rez_bind); + break; + default: + break; + } } } // Adjust the number of slots consumed by current member itself. - // If actual member is an array, allow runtime array resolution as well. - uint32_t elem_cnt = type.array.empty() ? 1 : to_array_size_literal(type); - if (elem_cnt == 0) - elem_cnt = get_resource_array_size(var.self); - - next_arg_buff_index += elem_cnt; + // Use the count value from the app, instead of the shader, in case the + // shader is only accesing part, or even one element, of the array. + next_arg_buff_index += rez_bind.count; } string mbr_name = ensure_valid_name(resource.name, "m"); @@ -17023,8 +17796,7 @@ void CompilerMSL::add_argument_buffer_padding_buffer_type(SPIRType &struct_type, argument_buffer_padding_buffer_type_id = ptr_type_id; } - for (uint32_t rez_idx = 0; rez_idx < rez_bind.count; rez_idx++) - add_argument_buffer_padding_type(argument_buffer_padding_buffer_type_id, struct_type, mbr_idx, arg_buff_index, 1); + add_argument_buffer_padding_type(argument_buffer_padding_buffer_type_id, struct_type, mbr_idx, arg_buff_index, rez_bind.count); } // Adds an argument buffer padding argument image type as a member of the struct type at the member index. @@ -17142,7 +17914,7 @@ string CompilerMSL::additional_fixed_sample_mask_str() const #pragma warning(push) #pragma warning(disable : 4996) #endif -#if _WIN32 +#if defined(_WIN32) sprintf(print_buffer, "0x%x", msl_options.additional_fixed_sample_mask); #else snprintf(print_buffer, sizeof(print_buffer), "0x%x", msl_options.additional_fixed_sample_mask); diff --git a/bgfx/3rdparty/spirv-cross/spirv_msl.hpp b/bgfx/3rdparty/spirv-cross/spirv_msl.hpp index 1a7ee5c0..26167f67 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_msl.hpp +++ b/bgfx/3rdparty/spirv-cross/spirv_msl.hpp @@ -58,6 +58,17 @@ enum MSLShaderVariableFormat MSL_SHADER_VARIABLE_FORMAT_INT_MAX = 0x7fffffff }; +// Indicates the rate at which a variable changes value, one of: per-vertex, +// per-primitive, or per-patch. +enum MSLShaderVariableRate +{ + MSL_SHADER_VARIABLE_RATE_PER_VERTEX = 0, + MSL_SHADER_VARIABLE_RATE_PER_PRIMITIVE = 1, + MSL_SHADER_VARIABLE_RATE_PER_PATCH = 2, + + MSL_SHADER_VARIABLE_RATE_INT_MAX = 0x7fffffff, +}; + // Defines MSL characteristics of a shader interface variable at a particular location. // After compilation, it is possible to query whether or not this location was used. // If vecsize is nonzero, it must be greater than or equal to the vecsize declared in the shader, @@ -69,6 +80,7 @@ struct MSLShaderInterfaceVariable MSLShaderVariableFormat format = MSL_SHADER_VARIABLE_FORMAT_OTHER; spv::BuiltIn builtin = spv::BuiltInMax; uint32_t vecsize = 0; + MSLShaderVariableRate rate = MSL_SHADER_VARIABLE_RATE_PER_VERTEX; }; // Matches the binding index of a MSL resource for a binding within a descriptor set. @@ -306,6 +318,7 @@ class CompilerMSL : public CompilerGLSL uint32_t dynamic_offsets_buffer_index = 23; uint32_t shader_input_buffer_index = 22; uint32_t shader_index_buffer_index = 21; + uint32_t shader_patch_input_buffer_index = 20; uint32_t shader_input_wg_index = 0; uint32_t device_index = 0; uint32_t enable_frag_output_mask = 0xffffffff; @@ -326,10 +339,28 @@ class CompilerMSL : public CompilerGLSL bool dispatch_base = false; bool texture_1D_as_2D = false; - // Enable use of MSL 2.0 indirect argument buffers. + // Enable use of Metal argument buffers. // MSL 2.0 must also be enabled. bool argument_buffers = false; + // Defines Metal argument buffer tier levels. + // Uses same values as Metal MTLArgumentBuffersTier enumeration. + enum class ArgumentBuffersTier + { + Tier1 = 0, + Tier2 = 1, + }; + + // When using Metal argument buffers, indicates the Metal argument buffer tier level supported by the Metal platform. + // Ignored when Options::argument_buffers is disabled. + // - Tier1 supports writable images on macOS, but not on iOS. + // - Tier2 supports writable images on macOS and iOS, and higher resource count limits. + // Tier capabilities based on recommendations from Apple engineering. + ArgumentBuffersTier argument_buffers_tier = ArgumentBuffersTier::Tier1; + + // Enables specifick argument buffer format with extra information to track SSBO-length + bool runtime_array_rich_descriptor = false; + // Ensures vertex and instance indices start at zero. This reflects the behavior of HLSL with SV_VertexID and SV_InstanceID. bool enable_base_index_zero = false; @@ -387,6 +418,11 @@ class CompilerMSL : public CompilerGLSL // builtins are processed, but should result in more efficient usage of the GPU. bool multi_patch_workgroup = false; + // Use storage buffers instead of vertex-style attributes for tessellation evaluation + // input. This may require conversion of inputs in the generated post-tessellation + // vertex shader, but allows the use of nested arrays. + bool raw_buffer_tese_input = false; + // If set, a vertex shader will be compiled as part of a tessellation pipeline. // It will be translated as a compute kernel, so it can use the global invocation ID // to index the output buffer. @@ -440,6 +476,35 @@ class CompilerMSL : public CompilerGLSL // the extra threads away. bool force_sample_rate_shading = false; + // If set, gl_HelperInvocation will be set manually whenever a fragment is discarded. + // Some Metal devices have a bug where simd_is_helper_thread() does not return true + // after a fragment has been discarded. This is a workaround that is only expected to be needed + // until the bug is fixed in Metal; it is provided as an option to allow disabling it when that occurs. + bool manual_helper_invocation_updates = true; + + // If set, extra checks will be emitted in fragment shaders to prevent writes + // from discarded fragments. Some Metal devices have a bug where writes to storage resources + // from discarded fragment threads continue to occur, despite the fragment being + // discarded. This is a workaround that is only expected to be needed until the + // bug is fixed in Metal; it is provided as an option so it can be enabled + // only when the bug is present. + bool check_discarded_frag_stores = false; + + // If set, Lod operands to OpImageSample*DrefExplicitLod for 1D and 2D array images + // will be implemented using a gradient instead of passing the level operand directly. + // Some Metal devices have a bug where the level() argument to depth2d_array::sample_compare() + // in a fragment shader is biased by some unknown amount, possibly dependent on the + // partial derivatives of the texture coordinates. This is a workaround that is only + // expected to be needed until the bug is fixed in Metal; it is provided as an option + // so it can be enabled only when the bug is present. + bool sample_dref_lod_array_as_grad = false; + + // MSL doesn't guarantee coherence between writes and subsequent reads of read_write textures. + // This inserts fences before each read of a read_write texture to ensure coherency. + // If you're sure you never rely on this, you can set this to false for a possible performance improvement. + // Note: Only Apple's GPU compiler takes advantage of the lack of coherency, so make sure to test on Apple GPUs if you disable this. + bool readwrite_texture_fences = true; + bool is_ios() const { return platform == iOS; @@ -504,6 +569,11 @@ class CompilerMSL : public CompilerGLSL return !buffers_requiring_array_length.empty(); } + bool buffer_requires_array_length(VariableID id) const + { + return buffers_requiring_array_length.count(id) != 0; + } + // Provide feedback to calling API to allow it to pass a buffer // containing the view mask for the current multiview subpass. bool needs_view_mask_buffer() const @@ -734,6 +804,10 @@ class CompilerMSL : public CompilerGLSL SPVFuncImplConvertYCbCrBT601, SPVFuncImplConvertYCbCrBT2020, SPVFuncImplDynamicImageSampler, + SPVFuncImplRayQueryIntersectionParams, + SPVFuncImplVariableDescriptor, + SPVFuncImplVariableSizedDescriptor, + SPVFuncImplVariableDescriptorArray, }; // If the underlying resource has been used for comparison then duplicate loads of that resource must be too @@ -794,10 +868,9 @@ class CompilerMSL : public CompilerGLSL std::string bitcast_glsl_op(const SPIRType &result_type, const SPIRType &argument_type) override; bool emit_complex_bitcast(uint32_t result_id, uint32_t id, uint32_t op0) override; bool skip_argument(uint32_t id) const override; - std::string to_member_reference(uint32_t base, const SPIRType &type, uint32_t index, bool ptr_chain) override; + std::string to_member_reference(uint32_t base, const SPIRType &type, uint32_t index, bool ptr_chain_is_resolved) override; std::string to_qualifiers_glsl(uint32_t id) override; void replace_illegal_names() override; - void declare_undefined_values() override; void declare_constant_arrays(); void replace_illegal_entry_point_names(); @@ -813,7 +886,10 @@ class CompilerMSL : public CompilerGLSL bool is_non_native_row_major_matrix(uint32_t id) override; bool member_is_non_native_row_major_matrix(const SPIRType &type, uint32_t index) override; std::string convert_row_major_matrix(std::string exp_str, const SPIRType &exp_type, uint32_t physical_type_id, - bool is_packed) override; + bool is_packed, bool relaxed) override; + + bool is_tesc_shader() const; + bool is_tese_shader() const; void preprocess_op_codes(); void localize_global_variables(); @@ -871,6 +947,7 @@ class CompilerMSL : public CompilerGLSL const std::string &var_chain_qual, uint32_t &location, uint32_t &var_mbr_idx); void add_tess_level_input_to_interface_block(const std::string &ib_var_ref, SPIRType &ib_type, SPIRVariable &var); + void add_tess_level_input(const std::string &base_ref, const std::string &mbr_name, SPIRVariable &var); void fix_up_interface_member_indices(spv::StorageClass storage, uint32_t ib_type_id); @@ -953,7 +1030,7 @@ class CompilerMSL : public CompilerGLSL bool validate_member_packing_rules_msl(const SPIRType &type, uint32_t index) const; std::string get_argument_address_space(const SPIRVariable &argument); std::string get_type_address_space(const SPIRType &type, uint32_t id, bool argument = false); - const char *to_restrict(uint32_t id, bool space = true); + const char *to_restrict(uint32_t id, bool space); SPIRType &get_stage_in_struct_type(); SPIRType &get_stage_out_struct_type(); SPIRType &get_patch_stage_in_struct_type(); @@ -968,7 +1045,7 @@ class CompilerMSL : public CompilerGLSL void add_pragma_line(const std::string &line); void add_typedef_line(const std::string &line); void emit_barrier(uint32_t id_exe_scope, uint32_t id_mem_scope, uint32_t id_mem_sem); - void emit_array_copy(const std::string &lhs, uint32_t lhs_id, uint32_t rhs_id, + bool emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, spv::StorageClass lhs_storage, spv::StorageClass rhs_storage) override; void build_implicit_builtins(); uint32_t build_constant_uint_array_pointer(); @@ -978,6 +1055,7 @@ class CompilerMSL : public CompilerGLSL uint32_t builtin_frag_coord_id = 0; uint32_t builtin_sample_id_id = 0; uint32_t builtin_sample_mask_id = 0; + uint32_t builtin_helper_invocation_id = 0; uint32_t builtin_vertex_idx_id = 0; uint32_t builtin_base_vertex_id = 0; uint32_t builtin_instance_idx_id = 0; @@ -1002,6 +1080,7 @@ class CompilerMSL : public CompilerGLSL uint32_t argument_buffer_padding_sampler_type_id = 0; bool does_shader_write_sample_mask = false; + bool frag_shader_needs_discard_checks = false; void cast_to_variable_store(uint32_t target_id, std::string &expr, const SPIRType &expr_type) override; void cast_from_variable_load(uint32_t source_id, std::string &expr, const SPIRType &expr_type) override; @@ -1058,6 +1137,8 @@ class CompilerMSL : public CompilerGLSL VariableID patch_stage_out_var_id = 0; VariableID stage_in_ptr_var_id = 0; VariableID stage_out_ptr_var_id = 0; + VariableID tess_level_inner_var_id = 0; + VariableID tess_level_outer_var_id = 0; VariableID stage_out_masked_builtin_type_id = 0; // Handle HLSL-style 0-based vertex/instance index. @@ -1084,6 +1165,7 @@ class CompilerMSL : public CompilerGLSL bool needs_subgroup_invocation_id = false; bool needs_subgroup_size = false; bool needs_sample_id = false; + bool needs_helper_invocation = false; std::string qual_pos_var_name; std::string stage_in_var_name = "in"; std::string stage_out_var_name = "out"; @@ -1096,6 +1178,7 @@ class CompilerMSL : public CompilerGLSL std::string input_wg_var_name = "gl_in"; std::string input_buffer_var_name = "spvIn"; std::string output_buffer_var_name = "spvOut"; + std::string patch_input_buffer_var_name = "spvPatchIn"; std::string patch_output_buffer_var_name = "spvPatchOut"; std::string tess_factor_buffer_var_name = "spvTessLevel"; std::string index_buffer_var_name = "spvIndices"; @@ -1107,12 +1190,13 @@ class CompilerMSL : public CompilerGLSL const MSLConstexprSampler *find_constexpr_sampler(uint32_t id) const; std::unordered_set buffers_requiring_array_length; - SmallVector buffer_arrays_discrete; SmallVector> buffer_aliases_argument; SmallVector buffer_aliases_discrete; std::unordered_set atomic_image_vars; // Emulate texture2D atomic operations std::unordered_set pull_model_inputs; + SmallVector entry_point_bindings; + // Must be ordered since array is in a specific order. std::map> buffers_requiring_dynamic_offset; @@ -1150,6 +1234,16 @@ class CompilerMSL : public CompilerGLSL bool variable_storage_requires_stage_io(spv::StorageClass storage) const; + bool needs_manual_helper_invocation_updates() const + { + return msl_options.manual_helper_invocation_updates && msl_options.supports_msl_version(2, 3); + } + bool needs_frag_discard_checks() const + { + return get_execution_model() == spv::ExecutionModelFragment && msl_options.supports_msl_version(2, 3) && + msl_options.check_discarded_frag_stores && frag_shader_needs_discard_checks; + } + bool has_additional_fixed_sample_mask() const { return msl_options.additional_fixed_sample_mask != 0xffffffff; } std::string additional_fixed_sample_mask_str() const; @@ -1170,10 +1264,13 @@ class CompilerMSL : public CompilerGLSL std::unordered_map image_pointers; // Emulate texture2D atomic operations bool suppress_missing_prototypes = false; bool uses_atomics = false; - bool uses_resource_write = false; + bool uses_image_write = false; + bool uses_buffer_write = false; + bool uses_discard = false; bool needs_subgroup_invocation_id = false; bool needs_subgroup_size = false; bool needs_sample_id = false; + bool needs_helper_invocation = false; }; // OpcodeHandler that scans for uses of sampled images diff --git a/bgfx/3rdparty/spirv-cross/spirv_parser.cpp b/bgfx/3rdparty/spirv-cross/spirv_parser.cpp index 49eb1933..01c2e381 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_parser.cpp +++ b/bgfx/3rdparty/spirv-cross/spirv_parser.cpp @@ -275,24 +275,30 @@ void Parser::parse(const Instruction &instruction) case OpExtInstImport: { uint32_t id = ops[0]; + + SPIRExtension::Extension spirv_ext = SPIRExtension::Unsupported; + auto ext = extract_string(ir.spirv, instruction.offset + 1); if (ext == "GLSL.std.450") - set(id, SPIRExtension::GLSL); + spirv_ext = SPIRExtension::GLSL; else if (ext == "DebugInfo") - set(id, SPIRExtension::SPV_debug_info); + spirv_ext = SPIRExtension::SPV_debug_info; else if (ext == "SPV_AMD_shader_ballot") - set(id, SPIRExtension::SPV_AMD_shader_ballot); + spirv_ext = SPIRExtension::SPV_AMD_shader_ballot; else if (ext == "SPV_AMD_shader_explicit_vertex_parameter") - set(id, SPIRExtension::SPV_AMD_shader_explicit_vertex_parameter); + spirv_ext = SPIRExtension::SPV_AMD_shader_explicit_vertex_parameter; else if (ext == "SPV_AMD_shader_trinary_minmax") - set(id, SPIRExtension::SPV_AMD_shader_trinary_minmax); + spirv_ext = SPIRExtension::SPV_AMD_shader_trinary_minmax; else if (ext == "SPV_AMD_gcn_shader") - set(id, SPIRExtension::SPV_AMD_gcn_shader); + spirv_ext = SPIRExtension::SPV_AMD_gcn_shader; else if (ext == "NonSemantic.DebugPrintf") - set(id, SPIRExtension::NonSemanticDebugPrintf); - else - set(id, SPIRExtension::Unsupported); + spirv_ext = SPIRExtension::NonSemanticDebugPrintf; + else if (ext == "NonSemantic.Shader.DebugInfo.100") + spirv_ext = SPIRExtension::NonSemanticShaderDebugInfo; + else if (ext.find("NonSemantic.") == 0) + spirv_ext = SPIRExtension::NonSemanticGeneric; + set(id, spirv_ext); // Other SPIR-V extensions which have ExtInstrs are currently not supported. break; diff --git a/bgfx/3rdparty/spirv-cross/spirv_reflect.cpp b/bgfx/3rdparty/spirv-cross/spirv_reflect.cpp index 0bd224e6..9fcd3bc0 100644 --- a/bgfx/3rdparty/spirv-cross/spirv_reflect.cpp +++ b/bgfx/3rdparty/spirv-cross/spirv_reflect.cpp @@ -292,7 +292,7 @@ bool CompilerReflection::type_is_reference(const SPIRType &type) const { // Physical pointers and arrays of physical pointers need to refer to the pointee's type. return type_is_top_level_physical_pointer(type) || - (!type.array.empty() && type_is_top_level_physical_pointer(get(type.parent_type))); + (type_is_array_of_pointers(type) && type.storage == StorageClassPhysicalStorageBuffer); } void CompilerReflection::emit_types() diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/1.0/spirv.hpp11 b/bgfx/3rdparty/spirv-headers/include/spirv/1.0/spirv.hpp11 new file mode 100644 index 00000000..8896e81b --- /dev/null +++ b/bgfx/3rdparty/spirv-headers/include/spirv/1.0/spirv.hpp11 @@ -0,0 +1,1002 @@ +// Copyright (c) 2014-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. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10000 +#define SPV_REVISION 12 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010000; +static const unsigned int Revision = 12; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum class SourceLanguage : unsigned { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + Max = 0x7fffffff, +}; + +enum class ExecutionModel : unsigned { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + Max = 0x7fffffff, +}; + +enum class AddressingModel : unsigned { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + Max = 0x7fffffff, +}; + +enum class MemoryModel : unsigned { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + Max = 0x7fffffff, +}; + +enum class ExecutionMode : unsigned { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + Max = 0x7fffffff, +}; + +enum class StorageClass : unsigned { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + Max = 0x7fffffff, +}; + +enum class Dim : unsigned { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + Max = 0x7fffffff, +}; + +enum class SamplerAddressingMode : unsigned { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + Max = 0x7fffffff, +}; + +enum class SamplerFilterMode : unsigned { + Nearest = 0, + Linear = 1, + Max = 0x7fffffff, +}; + +enum class ImageFormat : unsigned { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + Max = 0x7fffffff, +}; + +enum class ImageChannelOrder : unsigned { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + Max = 0x7fffffff, +}; + +enum class ImageChannelDataType : unsigned { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + Max = 0x7fffffff, +}; + +enum class ImageOperandsShift : unsigned { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + Max = 0x7fffffff, +}; + +enum class ImageOperandsMask : unsigned { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, +}; + +enum class FPFastMathModeShift : unsigned { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + Max = 0x7fffffff, +}; + +enum class FPFastMathModeMask : unsigned { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, +}; + +enum class FPRoundingMode : unsigned { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + Max = 0x7fffffff, +}; + +enum class LinkageType : unsigned { + Export = 0, + Import = 1, + Max = 0x7fffffff, +}; + +enum class AccessQualifier : unsigned { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + Max = 0x7fffffff, +}; + +enum class FunctionParameterAttribute : unsigned { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + Max = 0x7fffffff, +}; + +enum class Decoration : unsigned { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + Max = 0x7fffffff, +}; + +enum class BuiltIn : unsigned { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMaskKHR = 4416, + SubgroupGeMaskKHR = 4417, + SubgroupGtMaskKHR = 4418, + SubgroupLeMaskKHR = 4419, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + Max = 0x7fffffff, +}; + +enum class SelectionControlShift : unsigned { + Flatten = 0, + DontFlatten = 1, + Max = 0x7fffffff, +}; + +enum class SelectionControlMask : unsigned { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, +}; + +enum class LoopControlShift : unsigned { + Unroll = 0, + DontUnroll = 1, + Max = 0x7fffffff, +}; + +enum class LoopControlMask : unsigned { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, +}; + +enum class FunctionControlShift : unsigned { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + Max = 0x7fffffff, +}; + +enum class FunctionControlMask : unsigned { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, +}; + +enum class MemorySemanticsShift : unsigned { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + Max = 0x7fffffff, +}; + +enum class MemorySemanticsMask : unsigned { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, +}; + +enum class MemoryAccessShift : unsigned { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + Max = 0x7fffffff, +}; + +enum class MemoryAccessMask : unsigned { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, +}; + +enum class Scope : unsigned { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + Max = 0x7fffffff, +}; + +enum class GroupOperation : unsigned { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + Max = 0x7fffffff, +}; + +enum class KernelEnqueueFlags : unsigned { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoShift : unsigned { + CmdExecTime = 0, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoMask : unsigned { + MaskNone = 0, + CmdExecTime = 0x00000001, +}; + +enum class Capability : unsigned { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + Max = 0x7fffffff, +}; + +enum class Op : unsigned { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + Max = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/1.1/spirv.hpp11 b/bgfx/3rdparty/spirv-headers/include/spirv/1.1/spirv.hpp11 new file mode 100644 index 00000000..992d43b5 --- /dev/null +++ b/bgfx/3rdparty/spirv-headers/include/spirv/1.1/spirv.hpp11 @@ -0,0 +1,1024 @@ +// Copyright (c) 2014-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. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10100 +#define SPV_REVISION 8 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010100; +static const unsigned int Revision = 8; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum class SourceLanguage : unsigned { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + Max = 0x7fffffff, +}; + +enum class ExecutionModel : unsigned { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + Max = 0x7fffffff, +}; + +enum class AddressingModel : unsigned { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + Max = 0x7fffffff, +}; + +enum class MemoryModel : unsigned { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + Max = 0x7fffffff, +}; + +enum class ExecutionMode : unsigned { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + Initializer = 33, + Finalizer = 34, + SubgroupSize = 35, + SubgroupsPerWorkgroup = 36, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + Max = 0x7fffffff, +}; + +enum class StorageClass : unsigned { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + Max = 0x7fffffff, +}; + +enum class Dim : unsigned { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + Max = 0x7fffffff, +}; + +enum class SamplerAddressingMode : unsigned { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + Max = 0x7fffffff, +}; + +enum class SamplerFilterMode : unsigned { + Nearest = 0, + Linear = 1, + Max = 0x7fffffff, +}; + +enum class ImageFormat : unsigned { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + Max = 0x7fffffff, +}; + +enum class ImageChannelOrder : unsigned { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + Max = 0x7fffffff, +}; + +enum class ImageChannelDataType : unsigned { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + Max = 0x7fffffff, +}; + +enum class ImageOperandsShift : unsigned { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + Max = 0x7fffffff, +}; + +enum class ImageOperandsMask : unsigned { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, +}; + +enum class FPFastMathModeShift : unsigned { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + Max = 0x7fffffff, +}; + +enum class FPFastMathModeMask : unsigned { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, +}; + +enum class FPRoundingMode : unsigned { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + Max = 0x7fffffff, +}; + +enum class LinkageType : unsigned { + Export = 0, + Import = 1, + Max = 0x7fffffff, +}; + +enum class AccessQualifier : unsigned { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + Max = 0x7fffffff, +}; + +enum class FunctionParameterAttribute : unsigned { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + Max = 0x7fffffff, +}; + +enum class Decoration : unsigned { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + MaxByteOffset = 45, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + Max = 0x7fffffff, +}; + +enum class BuiltIn : unsigned { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMaskKHR = 4416, + SubgroupGeMaskKHR = 4417, + SubgroupGtMaskKHR = 4418, + SubgroupLeMaskKHR = 4419, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + Max = 0x7fffffff, +}; + +enum class SelectionControlShift : unsigned { + Flatten = 0, + DontFlatten = 1, + Max = 0x7fffffff, +}; + +enum class SelectionControlMask : unsigned { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, +}; + +enum class LoopControlShift : unsigned { + Unroll = 0, + DontUnroll = 1, + DependencyInfinite = 2, + DependencyLength = 3, + Max = 0x7fffffff, +}; + +enum class LoopControlMask : unsigned { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, + DependencyInfinite = 0x00000004, + DependencyLength = 0x00000008, +}; + +enum class FunctionControlShift : unsigned { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + Max = 0x7fffffff, +}; + +enum class FunctionControlMask : unsigned { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, +}; + +enum class MemorySemanticsShift : unsigned { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + Max = 0x7fffffff, +}; + +enum class MemorySemanticsMask : unsigned { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, +}; + +enum class MemoryAccessShift : unsigned { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + Max = 0x7fffffff, +}; + +enum class MemoryAccessMask : unsigned { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, +}; + +enum class Scope : unsigned { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + Max = 0x7fffffff, +}; + +enum class GroupOperation : unsigned { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + Max = 0x7fffffff, +}; + +enum class KernelEnqueueFlags : unsigned { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoShift : unsigned { + CmdExecTime = 0, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoMask : unsigned { + MaskNone = 0, + CmdExecTime = 0x00000001, +}; + +enum class Capability : unsigned { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupDispatch = 58, + NamedBarrier = 59, + PipeStorage = 60, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + Max = 0x7fffffff, +}; + +enum class Op : unsigned { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + Max = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/1.2/spirv.hpp11 b/bgfx/3rdparty/spirv-headers/include/spirv/1.2/spirv.hpp11 new file mode 100644 index 00000000..7a875fdb --- /dev/null +++ b/bgfx/3rdparty/spirv-headers/include/spirv/1.2/spirv.hpp11 @@ -0,0 +1,1030 @@ +// Copyright (c) 2014-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. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10200 +#define SPV_REVISION 2 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010200; +static const unsigned int Revision = 2; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum class SourceLanguage : unsigned { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + Max = 0x7fffffff, +}; + +enum class ExecutionModel : unsigned { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + Max = 0x7fffffff, +}; + +enum class AddressingModel : unsigned { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + Max = 0x7fffffff, +}; + +enum class MemoryModel : unsigned { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + Max = 0x7fffffff, +}; + +enum class ExecutionMode : unsigned { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + Initializer = 33, + Finalizer = 34, + SubgroupSize = 35, + SubgroupsPerWorkgroup = 36, + SubgroupsPerWorkgroupId = 37, + LocalSizeId = 38, + LocalSizeHintId = 39, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + Max = 0x7fffffff, +}; + +enum class StorageClass : unsigned { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + Max = 0x7fffffff, +}; + +enum class Dim : unsigned { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + Max = 0x7fffffff, +}; + +enum class SamplerAddressingMode : unsigned { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + Max = 0x7fffffff, +}; + +enum class SamplerFilterMode : unsigned { + Nearest = 0, + Linear = 1, + Max = 0x7fffffff, +}; + +enum class ImageFormat : unsigned { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + Max = 0x7fffffff, +}; + +enum class ImageChannelOrder : unsigned { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + Max = 0x7fffffff, +}; + +enum class ImageChannelDataType : unsigned { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + Max = 0x7fffffff, +}; + +enum class ImageOperandsShift : unsigned { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + Max = 0x7fffffff, +}; + +enum class ImageOperandsMask : unsigned { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, +}; + +enum class FPFastMathModeShift : unsigned { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + Max = 0x7fffffff, +}; + +enum class FPFastMathModeMask : unsigned { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, +}; + +enum class FPRoundingMode : unsigned { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + Max = 0x7fffffff, +}; + +enum class LinkageType : unsigned { + Export = 0, + Import = 1, + Max = 0x7fffffff, +}; + +enum class AccessQualifier : unsigned { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + Max = 0x7fffffff, +}; + +enum class FunctionParameterAttribute : unsigned { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + Max = 0x7fffffff, +}; + +enum class Decoration : unsigned { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + MaxByteOffset = 45, + AlignmentId = 46, + MaxByteOffsetId = 47, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + Max = 0x7fffffff, +}; + +enum class BuiltIn : unsigned { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMaskKHR = 4416, + SubgroupGeMaskKHR = 4417, + SubgroupGtMaskKHR = 4418, + SubgroupLeMaskKHR = 4419, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + Max = 0x7fffffff, +}; + +enum class SelectionControlShift : unsigned { + Flatten = 0, + DontFlatten = 1, + Max = 0x7fffffff, +}; + +enum class SelectionControlMask : unsigned { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, +}; + +enum class LoopControlShift : unsigned { + Unroll = 0, + DontUnroll = 1, + DependencyInfinite = 2, + DependencyLength = 3, + Max = 0x7fffffff, +}; + +enum class LoopControlMask : unsigned { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, + DependencyInfinite = 0x00000004, + DependencyLength = 0x00000008, +}; + +enum class FunctionControlShift : unsigned { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + Max = 0x7fffffff, +}; + +enum class FunctionControlMask : unsigned { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, +}; + +enum class MemorySemanticsShift : unsigned { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + Max = 0x7fffffff, +}; + +enum class MemorySemanticsMask : unsigned { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, +}; + +enum class MemoryAccessShift : unsigned { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + Max = 0x7fffffff, +}; + +enum class MemoryAccessMask : unsigned { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, +}; + +enum class Scope : unsigned { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + Max = 0x7fffffff, +}; + +enum class GroupOperation : unsigned { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + Max = 0x7fffffff, +}; + +enum class KernelEnqueueFlags : unsigned { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoShift : unsigned { + CmdExecTime = 0, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoMask : unsigned { + MaskNone = 0, + CmdExecTime = 0x00000001, +}; + +enum class Capability : unsigned { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupDispatch = 58, + NamedBarrier = 59, + PipeStorage = 60, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + Max = 0x7fffffff, +}; + +enum class Op : unsigned { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpExecutionModeId = 331, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + Max = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/spir-v.xml b/bgfx/3rdparty/spirv-headers/include/spirv/spir-v.xml index 7acaed34..989b996b 100644 --- a/bgfx/3rdparty/spirv-headers/include/spirv/spir-v.xml +++ b/bgfx/3rdparty/spirv-headers/include/spirv/spir-v.xml @@ -62,7 +62,7 @@ - + @@ -82,10 +82,15 @@ - + - + + + + + + @@ -138,13 +143,17 @@ + + + + - + @@ -168,13 +177,16 @@ + + + - + diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/NonSemanticClspvReflection.h b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/NonSemanticClspvReflection.h index 7994fd59..1a315492 100644 --- a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/NonSemanticClspvReflection.h +++ b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/NonSemanticClspvReflection.h @@ -33,7 +33,7 @@ extern "C" { #endif enum { - NonSemanticClspvReflectionRevision = 3, + NonSemanticClspvReflectionRevision = 5, NonSemanticClspvReflectionRevision_BitWidthPadding = 0x7fffffff }; @@ -71,10 +71,24 @@ enum NonSemanticClspvReflectionInstructions { NonSemanticClspvReflectionImageArgumentInfoChannelDataTypePushConstant = 31, NonSemanticClspvReflectionImageArgumentInfoChannelOrderUniform = 32, NonSemanticClspvReflectionImageArgumentInfoChannelDataTypeUniform = 33, + NonSemanticClspvReflectionArgumentStorageTexelBuffer = 34, + NonSemanticClspvReflectionArgumentUniformTexelBuffer = 35, + NonSemanticClspvReflectionConstantDataPointerPushConstant = 36, + NonSemanticClspvReflectionProgramScopeVariablePointerPushConstant = 37, + NonSemanticClspvReflectionPrintfInfo = 38, + NonSemanticClspvReflectionPrintfBufferStorageBuffer = 39, + NonSemanticClspvReflectionPrintfBufferPointerPushConstant = 40, NonSemanticClspvReflectionInstructionsMax = 0x7fffffff }; +enum NonSemanticClspvReflectionKernelPropertyFlags { + NonSemanticClspvReflectionNone = 0x0, + NonSemanticClspvReflectionMayUsePrintf = 0x1, + NonSemanticClspvReflectionKernelPropertyFlagsMax = 0x7fffffff +}; + + #ifdef __cplusplus } #endif diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/NonSemanticDebugBreak.h b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/NonSemanticDebugBreak.h new file mode 100644 index 00000000..6ec2b5bb --- /dev/null +++ b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/NonSemanticDebugBreak.h @@ -0,0 +1,50 @@ +// Copyright (c) 2020 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_NonSemanticDebugBreak_H_ +#define SPIRV_UNIFIED1_NonSemanticDebugBreak_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + NonSemanticDebugBreakRevision = 1, + NonSemanticDebugBreakRevision_BitWidthPadding = 0x7fffffff +}; + +enum NonSemanticDebugBreakInstructions { + NonSemanticDebugBreakDebugBreak = 1, + NonSemanticDebugBreakInstructionsMax = 0x7fffffff +}; + + +#ifdef __cplusplus +} +#endif + +#endif // SPIRV_UNIFIED1_NonSemanticDebugBreak_H_ diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/extinst.nonsemantic.clspvreflection.grammar.json b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/extinst.nonsemantic.clspvreflection.grammar.json index c5502f90..d6499cce 100644 --- a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/extinst.nonsemantic.clspvreflection.grammar.json +++ b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/extinst.nonsemantic.clspvreflection.grammar.json @@ -1,12 +1,15 @@ { - "revision" : 3, + "revision" : 5, "instructions" : [ { "opname" : "Kernel", "opcode" : 1, "operands" : [ { "kind" : "IdRef", "name" : "Kernel" }, - { "kind" : "IdRef", "name" : "Name" } + { "kind" : "IdRef", "name" : "Name" }, + { "kind" : "IdRef", "name" : "NumArguments", "quantifier" : "?" }, + { "kind" : "IdRef", "name" : "Flags", "quantifier" : "?" }, + { "kind" : "IdRef", "name" : "Attributes", "quantifier" : "?" } ] }, { @@ -325,6 +328,89 @@ { "kind" : "IdRef", "name" : "Offset" }, { "kind" : "IdRef", "name" : "Size" } ] + }, + { + "opname" : "ArgumentStorageTexelBuffer", + "opcode" : 34, + "operands" : [ + { "kind" : "IdRef", "name" : "Decl" }, + { "kind" : "IdRef", "name" : "Ordinal" }, + { "kind" : "IdRef", "name" : "DescriptorSet" }, + { "kind" : "IdRef", "name" : "Binding" }, + { "kind" : "IdRef", "name" : "ArgInfo", "quantifier" : "?" } + ] + }, + { + "opname" : "ArgumentUniformTexelBuffer", + "opcode" : 35, + "operands" : [ + { "kind" : "IdRef", "name" : "Decl" }, + { "kind" : "IdRef", "name" : "Ordinal" }, + { "kind" : "IdRef", "name" : "DescriptorSet" }, + { "kind" : "IdRef", "name" : "Binding" }, + { "kind" : "IdRef", "name" : "ArgInfo", "quantifier" : "?" } + ] + }, + { + "opname" : "ConstantDataPointerPushConstant", + "opcode" : 36, + "operands" : [ + { "kind" : "IdRef", "name" : "Offset"}, + { "kind" : "IdRef", "name" : "Size"}, + { "kind" : "IdRef", "name" : "Data" } + ] + }, + { + "opname" : "ProgramScopeVariablePointerPushConstant", + "opcode" : 37, + "operands" : [ + { "kind" : "IdRef", "name" : "Offset"}, + { "kind" : "IdRef", "name" : "Size"}, + { "kind" : "IdRef", "name" : "Data" } + ] + }, + { + "opname" : "PrintfInfo", + "opcode" : 38, + "operands" : [ + { "kind" : "IdRef", "name" : "PrintfID" }, + { "kind" : "IdRef", "name" : "FormatString" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "ArgumentSizes"} + ] + }, + { + "opname" : "PrintfBufferStorageBuffer", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "DescriptorSet" }, + { "kind" : "IdRef", "name" : "Binding" }, + { "kind" : "IdRef", "name" : "BufferSize"} + ] + }, + { + "opname" : "PrintfBufferPointerPushConstant", + "opcode" : 40, + "operands" : [ + { "kind" : "IdRef", "name" : "Offset" }, + { "kind" : "IdRef", "name" : "Size"}, + { "kind" : "IdRef", "name" : "BufferSize"} + ] + } + ], + "operand_kinds" : [ + { + "category" : "BitEnum", + "kind" : "KernelPropertyFlags", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0" + }, + { + "enumerant" : "MayUsePrintf", + "value" : "0x1" + } + ] } ] } diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/extinst.nonsemantic.debugbreak.grammar.json b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/extinst.nonsemantic.debugbreak.grammar.json new file mode 100644 index 00000000..ae288833 --- /dev/null +++ b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/extinst.nonsemantic.debugbreak.grammar.json @@ -0,0 +1,9 @@ +{ + "revision" : 1, + "instructions" : [ + { + "opname" : "DebugBreak", + "opcode" : 1 + } + ] +} diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.core.grammar.json b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.core.grammar.json index 5cedfb04..b6bbc2c3 100644 --- a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.core.grammar.json +++ b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.core.grammar.json @@ -137,7 +137,8 @@ { "opname" : "OpNop", "class" : "Miscellaneous", - "opcode" : 0 + "opcode" : 0, + "version" : "1.0" }, { "opname" : "OpUndef", @@ -146,7 +147,8 @@ "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" } - ] + ], + "version" : "1.0" }, { "opname" : "OpSourceContinued", @@ -154,7 +156,8 @@ "opcode" : 2, "operands" : [ { "kind" : "LiteralString", "name" : "'Continued Source'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSource", @@ -165,7 +168,8 @@ { "kind" : "LiteralInteger", "name" : "'Version'" }, { "kind" : "IdRef", "quantifier" : "?", "name" : "'File'" }, { "kind" : "LiteralString", "quantifier" : "?", "name" : "'Source'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSourceExtension", @@ -173,7 +177,8 @@ "opcode" : 4, "operands" : [ { "kind" : "LiteralString", "name" : "'Extension'" } - ] + ], + "version": "1.0" }, { "opname" : "OpName", @@ -182,7 +187,8 @@ "operands" : [ { "kind" : "IdRef", "name" : "'Target'" }, { "kind" : "LiteralString", "name" : "'Name'" } - ] + ], + "version": "1.0" }, { "opname" : "OpMemberName", @@ -192,7 +198,8 @@ { "kind" : "IdRef", "name" : "'Type'" }, { "kind" : "LiteralInteger", "name" : "'Member'" }, { "kind" : "LiteralString", "name" : "'Name'" } - ] + ], + "version": "1.0" }, { "opname" : "OpString", @@ -201,7 +208,8 @@ "operands" : [ { "kind" : "IdResult" }, { "kind" : "LiteralString", "name" : "'String'" } - ] + ], + "version": "1.0" }, { "opname" : "OpLine", @@ -211,7 +219,8 @@ { "kind" : "IdRef", "name" : "'File'" }, { "kind" : "LiteralInteger", "name" : "'Line'" }, { "kind" : "LiteralInteger", "name" : "'Column'" } - ] + ], + "version": "1.0" }, { "opname" : "OpExtension", @@ -219,7 +228,8 @@ "opcode" : 10, "operands" : [ { "kind" : "LiteralString", "name" : "'Name'" } - ] + ], + "version": "1.0" }, { "opname" : "OpExtInstImport", @@ -228,7 +238,8 @@ "operands" : [ { "kind" : "IdResult" }, { "kind" : "LiteralString", "name" : "'Name'" } - ] + ], + "version": "1.0" }, { "opname" : "OpExtInst", @@ -240,7 +251,8 @@ { "kind" : "IdRef", "name" : "'Set'" }, { "kind" : "LiteralExtInstInteger", "name" : "'Instruction'" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Operand 1', +\n'Operand 2', +\n..." } - ] + ], + "version": "1.0" }, { "opname" : "OpMemoryModel", @@ -249,7 +261,8 @@ "operands" : [ { "kind" : "AddressingModel" }, { "kind" : "MemoryModel" } - ] + ], + "version": "1.0" }, { "opname" : "OpEntryPoint", @@ -260,7 +273,8 @@ { "kind" : "IdRef", "name" : "'Entry Point'" }, { "kind" : "LiteralString", "name" : "'Name'" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Interface'" } - ] + ], + "version": "1.0" }, { "opname" : "OpExecutionMode", @@ -269,7 +283,8 @@ "operands" : [ { "kind" : "IdRef", "name" : "'Entry Point'" }, { "kind" : "ExecutionMode", "name" : "'Mode'" } - ] + ], + "version": "1.0" }, { "opname" : "OpCapability", @@ -277,7 +292,8 @@ "opcode" : 17, "operands" : [ { "kind" : "Capability", "name" : "'Capability'" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeVoid", @@ -285,7 +301,8 @@ "opcode" : 19, "operands" : [ { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeBool", @@ -293,7 +310,8 @@ "opcode" : 20, "operands" : [ { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeInt", @@ -303,7 +321,8 @@ { "kind" : "IdResult" }, { "kind" : "LiteralInteger", "name" : "'Width'" }, { "kind" : "LiteralInteger", "name" : "'Signedness'" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeFloat", @@ -312,7 +331,8 @@ "operands" : [ { "kind" : "IdResult" }, { "kind" : "LiteralInteger", "name" : "'Width'" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeVector", @@ -322,7 +342,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Component Type'" }, { "kind" : "LiteralInteger", "name" : "'Component Count'" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeMatrix", @@ -333,7 +354,8 @@ { "kind" : "IdRef", "name" : "'Column Type'" }, { "kind" : "LiteralInteger", "name" : "'Column Count'" } ], - "capabilities" : [ "Matrix" ] + "capabilities" : [ "Matrix" ], + "version": "1.0" }, { "opname" : "OpTypeImage", @@ -349,7 +371,8 @@ { "kind" : "LiteralInteger", "name" : "'Sampled'" }, { "kind" : "ImageFormat" }, { "kind" : "AccessQualifier", "quantifier" : "?" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeSampler", @@ -357,7 +380,8 @@ "opcode" : 26, "operands" : [ { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeSampledImage", @@ -366,7 +390,8 @@ "operands" : [ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Image Type'" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeArray", @@ -376,7 +401,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Element Type'" }, { "kind" : "IdRef", "name" : "'Length'" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeRuntimeArray", @@ -386,7 +412,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Element Type'" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpTypeStruct", @@ -395,7 +422,8 @@ "operands" : [ { "kind" : "IdResult" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Member 0 type', +\n'member 1 type', +\n..." } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeOpaque", @@ -405,7 +433,8 @@ { "kind" : "IdResult" }, { "kind" : "LiteralString", "name" : "The name of the opaque type." } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpTypePointer", @@ -415,7 +444,8 @@ { "kind" : "IdResult" }, { "kind" : "StorageClass" }, { "kind" : "IdRef", "name" : "'Type'" } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeFunction", @@ -425,7 +455,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Return Type'" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Parameter 0 Type', +\n'Parameter 1 Type', +\n..." } - ] + ], + "version": "1.0" }, { "opname" : "OpTypeEvent", @@ -434,7 +465,8 @@ "operands" : [ { "kind" : "IdResult" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpTypeDeviceEvent", @@ -443,7 +475,8 @@ "operands" : [ { "kind" : "IdResult" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpTypeReserveId", @@ -452,7 +485,8 @@ "operands" : [ { "kind" : "IdResult" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpTypeQueue", @@ -461,7 +495,8 @@ "operands" : [ { "kind" : "IdResult" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpTypePipe", @@ -471,7 +506,8 @@ { "kind" : "IdResult" }, { "kind" : "AccessQualifier", "name" : "'Qualifier'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpTypeForwardPointer", @@ -484,7 +520,8 @@ "capabilities" : [ "Addresses", "PhysicalStorageBufferAddresses" - ] + ], + "version": "1.0" }, { "opname" : "OpConstantTrue", @@ -493,7 +530,8 @@ "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpConstantFalse", @@ -502,7 +540,8 @@ "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpConstant", @@ -512,7 +551,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "LiteralContextDependentNumber", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpConstantComposite", @@ -522,7 +562,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } - ] + ], + "version": "1.0" }, { "opname" : "OpConstantSampler", @@ -535,7 +576,8 @@ { "kind" : "LiteralInteger", "name" : "'Param'" }, { "kind" : "SamplerFilterMode" } ], - "capabilities" : [ "LiteralSampler" ] + "capabilities" : [ "LiteralSampler" ], + "version": "1.0" }, { "opname" : "OpConstantNull", @@ -544,7 +586,8 @@ "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpSpecConstantTrue", @@ -553,7 +596,8 @@ "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpSpecConstantFalse", @@ -562,7 +606,8 @@ "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpSpecConstant", @@ -572,7 +617,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "LiteralContextDependentNumber", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSpecConstantComposite", @@ -582,7 +628,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSpecConstantOp", @@ -592,7 +639,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "LiteralSpecConstantOpInteger", "name" : "'Opcode'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFunction", @@ -603,7 +651,8 @@ { "kind" : "IdResult" }, { "kind" : "FunctionControl" }, { "kind" : "IdRef", "name" : "'Function Type'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFunctionParameter", @@ -612,12 +661,14 @@ "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpFunctionEnd", "class" : "Function", - "opcode" : 56 + "opcode" : 56, + "version" : "1.0" }, { "opname" : "OpFunctionCall", @@ -628,7 +679,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Function'" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Argument 0', +\n'Argument 1', +\n..." } - ] + ], + "version": "1.0" }, { "opname" : "OpVariable", @@ -639,7 +691,8 @@ { "kind" : "IdResult" }, { "kind" : "StorageClass" }, { "kind" : "IdRef", "quantifier" : "?", "name" : "'Initializer'" } - ] + ], + "version": "1.0" }, { "opname" : "OpImageTexelPointer", @@ -651,7 +704,8 @@ { "kind" : "IdRef", "name" : "'Image'" }, { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "IdRef", "name" : "'Sample'" } - ] + ], + "version": "1.0" }, { "opname" : "OpLoad", @@ -662,7 +716,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Pointer'" }, { "kind" : "MemoryAccess", "quantifier" : "?" } - ] + ], + "version": "1.0" }, { "opname" : "OpStore", @@ -672,7 +727,8 @@ { "kind" : "IdRef", "name" : "'Pointer'" }, { "kind" : "IdRef", "name" : "'Object'" }, { "kind" : "MemoryAccess", "quantifier" : "?" } - ] + ], + "version": "1.0" }, { "opname" : "OpCopyMemory", @@ -683,7 +739,8 @@ { "kind" : "IdRef", "name" : "'Source'" }, { "kind" : "MemoryAccess", "quantifier" : "?" }, { "kind" : "MemoryAccess", "quantifier" : "?" } - ] + ], + "version": "1.0" }, { "opname" : "OpCopyMemorySized", @@ -696,7 +753,8 @@ { "kind" : "MemoryAccess", "quantifier" : "?" }, { "kind" : "MemoryAccess", "quantifier" : "?" } ], - "capabilities" : [ "Addresses" ] + "capabilities" : [ "Addresses" ], + "version": "1.0" }, { "opname" : "OpAccessChain", @@ -707,7 +765,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Base'" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } - ] + ], + "version": "1.0" }, { "opname" : "OpInBoundsAccessChain", @@ -718,7 +777,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Base'" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } - ] + ], + "version": "1.0" }, { "opname" : "OpPtrAccessChain", @@ -736,7 +796,8 @@ "VariablePointers", "VariablePointersStorageBuffer", "PhysicalStorageBufferAddresses" - ] + ], + "version": "1.0" }, { "opname" : "OpArrayLength", @@ -748,7 +809,8 @@ { "kind" : "IdRef", "name" : "'Structure'" }, { "kind" : "LiteralInteger", "name" : "'Array member'" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpGenericPtrMemSemantics", @@ -759,7 +821,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Pointer'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpInBoundsPtrAccessChain", @@ -772,7 +835,8 @@ { "kind" : "IdRef", "name" : "'Element'" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } ], - "capabilities" : [ "Addresses" ] + "capabilities" : [ "Addresses" ], + "version": "1.0" }, { "opname" : "OpDecorate", @@ -781,7 +845,8 @@ "operands" : [ { "kind" : "IdRef", "name" : "'Target'" }, { "kind" : "Decoration" } - ] + ], + "version": "1.0" }, { "opname" : "OpMemberDecorate", @@ -791,7 +856,8 @@ { "kind" : "IdRef", "name" : "'Structure Type'" }, { "kind" : "LiteralInteger", "name" : "'Member'" }, { "kind" : "Decoration" } - ] + ], + "version": "1.0" }, { "opname" : "OpDecorationGroup", @@ -799,7 +865,8 @@ "opcode" : 73, "operands" : [ { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpGroupDecorate", @@ -808,7 +875,8 @@ "operands" : [ { "kind" : "IdRef", "name" : "'Decoration Group'" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Targets'" } - ] + ], + "version": "1.0" }, { "opname" : "OpGroupMemberDecorate", @@ -817,7 +885,8 @@ "operands" : [ { "kind" : "IdRef", "name" : "'Decoration Group'" }, { "kind" : "PairIdRefLiteralInteger", "quantifier" : "*", "name" : "'Targets'" } - ] + ], + "version": "1.0" }, { "opname" : "OpVectorExtractDynamic", @@ -828,7 +897,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Vector'" }, { "kind" : "IdRef", "name" : "'Index'" } - ] + ], + "version": "1.0" }, { "opname" : "OpVectorInsertDynamic", @@ -840,7 +910,8 @@ { "kind" : "IdRef", "name" : "'Vector'" }, { "kind" : "IdRef", "name" : "'Component'" }, { "kind" : "IdRef", "name" : "'Index'" } - ] + ], + "version": "1.0" }, { "opname" : "OpVectorShuffle", @@ -852,7 +923,8 @@ { "kind" : "IdRef", "name" : "'Vector 1'" }, { "kind" : "IdRef", "name" : "'Vector 2'" }, { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Components'" } - ] + ], + "version": "1.0" }, { "opname" : "OpCompositeConstruct", @@ -862,7 +934,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } - ] + ], + "version": "1.0" }, { "opname" : "OpCompositeExtract", @@ -873,7 +946,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Composite'" }, { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Indexes'" } - ] + ], + "version": "1.0" }, { "opname" : "OpCompositeInsert", @@ -885,7 +959,8 @@ { "kind" : "IdRef", "name" : "'Object'" }, { "kind" : "IdRef", "name" : "'Composite'" }, { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Indexes'" } - ] + ], + "version": "1.0" }, { "opname" : "OpCopyObject", @@ -895,7 +970,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand'" } - ] + ], + "version": "1.0" }, { "opname" : "OpTranspose", @@ -906,7 +982,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Matrix'" } ], - "capabilities" : [ "Matrix" ] + "capabilities" : [ "Matrix" ], + "version": "1.0" }, { "opname" : "OpSampledImage", @@ -917,7 +994,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Image'" }, { "kind" : "IdRef", "name" : "'Sampler'" } - ] + ], + "version": "1.0" }, { "opname" : "OpImageSampleImplicitLod", @@ -930,7 +1008,8 @@ { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpImageSampleExplicitLod", @@ -942,7 +1021,8 @@ { "kind" : "IdRef", "name" : "'Sampled Image'" }, { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "ImageOperands" } - ] + ], + "version": "1.0" }, { "opname" : "OpImageSampleDrefImplicitLod", @@ -956,7 +1036,8 @@ { "kind" : "IdRef", "name" : "'D~ref~'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpImageSampleDrefExplicitLod", @@ -970,7 +1051,8 @@ { "kind" : "IdRef", "name" : "'D~ref~'" }, { "kind" : "ImageOperands" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpImageSampleProjImplicitLod", @@ -983,7 +1065,8 @@ { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpImageSampleProjExplicitLod", @@ -996,7 +1079,8 @@ { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "ImageOperands" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpImageSampleProjDrefImplicitLod", @@ -1010,7 +1094,8 @@ { "kind" : "IdRef", "name" : "'D~ref~'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpImageSampleProjDrefExplicitLod", @@ -1024,7 +1109,8 @@ { "kind" : "IdRef", "name" : "'D~ref~'" }, { "kind" : "ImageOperands" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpImageFetch", @@ -1036,7 +1122,8 @@ { "kind" : "IdRef", "name" : "'Image'" }, { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "ImageOperands", "quantifier" : "?" } - ] + ], + "version": "1.0" }, { "opname" : "OpImageGather", @@ -1050,7 +1137,8 @@ { "kind" : "IdRef", "name" : "'Component'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpImageDrefGather", @@ -1064,7 +1152,8 @@ { "kind" : "IdRef", "name" : "'D~ref~'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpImageRead", @@ -1076,7 +1165,8 @@ { "kind" : "IdRef", "name" : "'Image'" }, { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "ImageOperands", "quantifier" : "?" } - ] + ], + "version": "1.0" }, { "opname" : "OpImageWrite", @@ -1087,7 +1177,8 @@ { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "IdRef", "name" : "'Texel'" }, { "kind" : "ImageOperands", "quantifier" : "?" } - ] + ], + "version": "1.0" }, { "opname" : "OpImage", @@ -1097,7 +1188,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Sampled Image'" } - ] + ], + "version": "1.0" }, { "opname" : "OpImageQueryFormat", @@ -1108,7 +1200,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Image'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpImageQueryOrder", @@ -1119,7 +1212,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Image'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpImageQuerySizeLod", @@ -1131,7 +1225,8 @@ { "kind" : "IdRef", "name" : "'Image'" }, { "kind" : "IdRef", "name" : "'Level of Detail'" } ], - "capabilities" : [ "Kernel", "ImageQuery" ] + "capabilities" : [ "Kernel", "ImageQuery" ], + "version": "1.0" }, { "opname" : "OpImageQuerySize", @@ -1142,7 +1237,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Image'" } ], - "capabilities" : [ "Kernel", "ImageQuery" ] + "capabilities" : [ "Kernel", "ImageQuery" ], + "version": "1.0" }, { "opname" : "OpImageQueryLod", @@ -1154,7 +1250,8 @@ { "kind" : "IdRef", "name" : "'Sampled Image'" }, { "kind" : "IdRef", "name" : "'Coordinate'" } ], - "capabilities" : [ "ImageQuery" ] + "capabilities" : [ "ImageQuery" ], + "version": "1.0" }, { "opname" : "OpImageQueryLevels", @@ -1165,7 +1262,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Image'" } ], - "capabilities" : [ "Kernel", "ImageQuery" ] + "capabilities" : [ "Kernel", "ImageQuery" ], + "version": "1.0" }, { "opname" : "OpImageQuerySamples", @@ -1176,7 +1274,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Image'" } ], - "capabilities" : [ "Kernel", "ImageQuery" ] + "capabilities" : [ "Kernel", "ImageQuery" ], + "version": "1.0" }, { "opname" : "OpConvertFToU", @@ -1186,7 +1285,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Float Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpConvertFToS", @@ -1196,7 +1296,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Float Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpConvertSToF", @@ -1206,7 +1307,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Signed Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpConvertUToF", @@ -1216,7 +1318,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Unsigned Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpUConvert", @@ -1226,7 +1329,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Unsigned Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSConvert", @@ -1236,7 +1340,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Signed Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFConvert", @@ -1246,7 +1351,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Float Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpQuantizeToF16", @@ -1256,7 +1362,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpConvertPtrToU", @@ -1270,7 +1377,8 @@ "capabilities" : [ "Addresses", "PhysicalStorageBufferAddresses" - ] + ], + "version": "1.0" }, { "opname" : "OpSatConvertSToU", @@ -1281,7 +1389,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Signed Value'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpSatConvertUToS", @@ -1292,7 +1401,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Unsigned Value'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpConvertUToPtr", @@ -1306,7 +1416,8 @@ "capabilities" : [ "Addresses", "PhysicalStorageBufferAddresses" - ] + ], + "version": "1.0" }, { "opname" : "OpPtrCastToGeneric", @@ -1317,7 +1428,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Pointer'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpGenericCastToPtr", @@ -1328,7 +1440,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Pointer'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpGenericCastToPtrExplicit", @@ -1340,7 +1453,8 @@ { "kind" : "IdRef", "name" : "'Pointer'" }, { "kind" : "StorageClass", "name" : "'Storage'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpBitcast", @@ -1350,7 +1464,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSNegate", @@ -1360,7 +1475,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFNegate", @@ -1370,7 +1486,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand'" } - ] + ], + "version": "1.0" }, { "opname" : "OpIAdd", @@ -1381,7 +1498,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFAdd", @@ -1392,7 +1510,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpISub", @@ -1403,7 +1522,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFSub", @@ -1414,7 +1534,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpIMul", @@ -1425,7 +1546,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFMul", @@ -1436,7 +1558,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpUDiv", @@ -1447,7 +1570,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSDiv", @@ -1458,7 +1582,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFDiv", @@ -1469,7 +1594,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpUMod", @@ -1480,7 +1606,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSRem", @@ -1491,7 +1618,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSMod", @@ -1502,7 +1630,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFRem", @@ -1513,7 +1642,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFMod", @@ -1524,7 +1654,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpVectorTimesScalar", @@ -1535,7 +1666,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Vector'" }, { "kind" : "IdRef", "name" : "'Scalar'" } - ] + ], + "version": "1.0" }, { "opname" : "OpMatrixTimesScalar", @@ -1547,7 +1679,8 @@ { "kind" : "IdRef", "name" : "'Matrix'" }, { "kind" : "IdRef", "name" : "'Scalar'" } ], - "capabilities" : [ "Matrix" ] + "capabilities" : [ "Matrix" ], + "version": "1.0" }, { "opname" : "OpVectorTimesMatrix", @@ -1559,7 +1692,8 @@ { "kind" : "IdRef", "name" : "'Vector'" }, { "kind" : "IdRef", "name" : "'Matrix'" } ], - "capabilities" : [ "Matrix" ] + "capabilities" : [ "Matrix" ], + "version": "1.0" }, { "opname" : "OpMatrixTimesVector", @@ -1571,7 +1705,8 @@ { "kind" : "IdRef", "name" : "'Matrix'" }, { "kind" : "IdRef", "name" : "'Vector'" } ], - "capabilities" : [ "Matrix" ] + "capabilities" : [ "Matrix" ], + "version": "1.0" }, { "opname" : "OpMatrixTimesMatrix", @@ -1583,7 +1718,8 @@ { "kind" : "IdRef", "name" : "'LeftMatrix'" }, { "kind" : "IdRef", "name" : "'RightMatrix'" } ], - "capabilities" : [ "Matrix" ] + "capabilities" : [ "Matrix" ], + "version": "1.0" }, { "opname" : "OpOuterProduct", @@ -1595,7 +1731,8 @@ { "kind" : "IdRef", "name" : "'Vector 1'" }, { "kind" : "IdRef", "name" : "'Vector 2'" } ], - "capabilities" : [ "Matrix" ] + "capabilities" : [ "Matrix" ], + "version": "1.0" }, { "opname" : "OpDot", @@ -1606,7 +1743,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Vector 1'" }, { "kind" : "IdRef", "name" : "'Vector 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpIAddCarry", @@ -1617,7 +1755,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpISubBorrow", @@ -1628,7 +1767,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpUMulExtended", @@ -1639,7 +1779,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSMulExtended", @@ -1650,7 +1791,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAny", @@ -1660,7 +1802,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Vector'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAll", @@ -1670,7 +1813,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Vector'" } - ] + ], + "version": "1.0" }, { "opname" : "OpIsNan", @@ -1680,7 +1824,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'x'" } - ] + ], + "version": "1.0" }, { "opname" : "OpIsInf", @@ -1690,7 +1835,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'x'" } - ] + ], + "version": "1.0" }, { "opname" : "OpIsFinite", @@ -1701,7 +1847,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'x'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpIsNormal", @@ -1712,7 +1859,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'x'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpSignBitSet", @@ -1723,7 +1871,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'x'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpLessOrGreater", @@ -1736,6 +1885,7 @@ { "kind" : "IdRef", "name" : "'y'" } ], "capabilities" : [ "Kernel" ], + "version" : "1.0", "lastVersion" : "1.5" }, { @@ -1748,7 +1898,8 @@ { "kind" : "IdRef", "name" : "'x'" }, { "kind" : "IdRef", "name" : "'y'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpUnordered", @@ -1760,7 +1911,8 @@ { "kind" : "IdRef", "name" : "'x'" }, { "kind" : "IdRef", "name" : "'y'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpLogicalEqual", @@ -1771,7 +1923,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpLogicalNotEqual", @@ -1782,7 +1935,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpLogicalOr", @@ -1793,7 +1947,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpLogicalAnd", @@ -1804,7 +1959,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version" : "1.0" }, { "opname" : "OpLogicalNot", @@ -1814,7 +1970,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSelect", @@ -1826,7 +1983,8 @@ { "kind" : "IdRef", "name" : "'Condition'" }, { "kind" : "IdRef", "name" : "'Object 1'" }, { "kind" : "IdRef", "name" : "'Object 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpIEqual", @@ -1837,7 +1995,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpINotEqual", @@ -1848,7 +2007,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpUGreaterThan", @@ -1859,7 +2019,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSGreaterThan", @@ -1870,7 +2031,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpUGreaterThanEqual", @@ -1881,7 +2043,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSGreaterThanEqual", @@ -1892,7 +2055,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpULessThan", @@ -1903,7 +2067,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSLessThan", @@ -1914,7 +2079,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpULessThanEqual", @@ -1925,7 +2091,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSLessThanEqual", @@ -1936,7 +2103,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFOrdEqual", @@ -1947,7 +2115,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFUnordEqual", @@ -1958,7 +2127,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFOrdNotEqual", @@ -1969,7 +2139,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFUnordNotEqual", @@ -1980,7 +2151,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFOrdLessThan", @@ -1991,7 +2163,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFUnordLessThan", @@ -2002,7 +2175,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFOrdGreaterThan", @@ -2013,7 +2187,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFUnordGreaterThan", @@ -2024,7 +2199,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFOrdLessThanEqual", @@ -2035,7 +2211,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFUnordLessThanEqual", @@ -2046,7 +2223,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFOrdGreaterThanEqual", @@ -2057,7 +2235,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpFUnordGreaterThanEqual", @@ -2068,7 +2247,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpShiftRightLogical", @@ -2079,7 +2259,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Base'" }, { "kind" : "IdRef", "name" : "'Shift'" } - ] + ], + "version": "1.0" }, { "opname" : "OpShiftRightArithmetic", @@ -2090,7 +2271,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Base'" }, { "kind" : "IdRef", "name" : "'Shift'" } - ] + ], + "version": "1.0" }, { "opname" : "OpShiftLeftLogical", @@ -2101,7 +2283,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Base'" }, { "kind" : "IdRef", "name" : "'Shift'" } - ] + ], + "version": "1.0" }, { "opname" : "OpBitwiseOr", @@ -2112,7 +2295,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpBitwiseXor", @@ -2123,7 +2307,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpBitwiseAnd", @@ -2134,7 +2319,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand 1'" }, { "kind" : "IdRef", "name" : "'Operand 2'" } - ] + ], + "version": "1.0" }, { "opname" : "OpNot", @@ -2144,7 +2330,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Operand'" } - ] + ], + "version": "1.0" }, { "opname" : "OpBitFieldInsert", @@ -2158,7 +2345,8 @@ { "kind" : "IdRef", "name" : "'Offset'" }, { "kind" : "IdRef", "name" : "'Count'" } ], - "capabilities" : [ "Shader", "BitInstructions" ] + "capabilities" : [ "Shader", "BitInstructions" ], + "version": "1.0" }, { "opname" : "OpBitFieldSExtract", @@ -2171,7 +2359,8 @@ { "kind" : "IdRef", "name" : "'Offset'" }, { "kind" : "IdRef", "name" : "'Count'" } ], - "capabilities" : [ "Shader", "BitInstructions" ] + "capabilities" : [ "Shader", "BitInstructions" ], + "version": "1.0" }, { "opname" : "OpBitFieldUExtract", @@ -2184,7 +2373,8 @@ { "kind" : "IdRef", "name" : "'Offset'" }, { "kind" : "IdRef", "name" : "'Count'" } ], - "capabilities" : [ "Shader", "BitInstructions" ] + "capabilities" : [ "Shader", "BitInstructions" ], + "version": "1.0" }, { "opname" : "OpBitReverse", @@ -2195,7 +2385,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Base'" } ], - "capabilities" : [ "Shader", "BitInstructions" ] + "capabilities" : [ "Shader", "BitInstructions" ], + "version": "1.0" }, { "opname" : "OpBitCount", @@ -2205,7 +2396,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Base'" } - ] + ], + "version": "1.0" }, { "opname" : "OpDPdx", @@ -2216,7 +2408,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'P'" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpDPdy", @@ -2227,7 +2420,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'P'" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpFwidth", @@ -2238,7 +2432,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'P'" } ], - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpDPdxFine", @@ -2249,7 +2444,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'P'" } ], - "capabilities" : [ "DerivativeControl" ] + "capabilities" : [ "DerivativeControl" ], + "version": "1.0" }, { "opname" : "OpDPdyFine", @@ -2260,7 +2456,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'P'" } ], - "capabilities" : [ "DerivativeControl" ] + "capabilities" : [ "DerivativeControl" ], + "version": "1.0" }, { "opname" : "OpFwidthFine", @@ -2271,7 +2468,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'P'" } ], - "capabilities" : [ "DerivativeControl" ] + "capabilities" : [ "DerivativeControl" ], + "version": "1.0" }, { "opname" : "OpDPdxCoarse", @@ -2282,7 +2480,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'P'" } ], - "capabilities" : [ "DerivativeControl" ] + "capabilities" : [ "DerivativeControl" ], + "version": "1.0" }, { "opname" : "OpDPdyCoarse", @@ -2293,7 +2492,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'P'" } ], - "capabilities" : [ "DerivativeControl" ] + "capabilities" : [ "DerivativeControl" ], + "version": "1.0" }, { "opname" : "OpFwidthCoarse", @@ -2304,19 +2504,22 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'P'" } ], - "capabilities" : [ "DerivativeControl" ] + "capabilities" : [ "DerivativeControl" ], + "version": "1.0" }, { "opname" : "OpEmitVertex", "class" : "Primitive", "opcode" : 218, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "opname" : "OpEndPrimitive", "class" : "Primitive", "opcode" : 219, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "opname" : "OpEmitStreamVertex", @@ -2325,7 +2528,8 @@ "operands" : [ { "kind" : "IdRef", "name" : "'Stream'" } ], - "capabilities" : [ "GeometryStreams" ] + "capabilities" : [ "GeometryStreams" ], + "version": "1.0" }, { "opname" : "OpEndStreamPrimitive", @@ -2334,7 +2538,8 @@ "operands" : [ { "kind" : "IdRef", "name" : "'Stream'" } ], - "capabilities" : [ "GeometryStreams" ] + "capabilities" : [ "GeometryStreams" ], + "version": "1.0" }, { "opname" : "OpControlBarrier", @@ -2344,7 +2549,8 @@ { "kind" : "IdScope", "name" : "'Execution'" }, { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } - ] + ], + "version": "1.0" }, { "opname" : "OpMemoryBarrier", @@ -2353,7 +2559,8 @@ "operands" : [ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicLoad", @@ -2365,7 +2572,8 @@ { "kind" : "IdRef", "name" : "'Pointer'" }, { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicStore", @@ -2376,7 +2584,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicExchange", @@ -2389,7 +2598,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicCompareExchange", @@ -2404,7 +2614,8 @@ { "kind" : "IdMemorySemantics", "name" : "'Unequal'" }, { "kind" : "IdRef", "name" : "'Value'" }, { "kind" : "IdRef", "name" : "'Comparator'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicCompareExchangeWeak", @@ -2421,6 +2632,7 @@ { "kind" : "IdRef", "name" : "'Comparator'" } ], "capabilities" : [ "Kernel" ], + "version" : "1.0", "lastVersion" : "1.3" }, { @@ -2433,7 +2645,8 @@ { "kind" : "IdRef", "name" : "'Pointer'" }, { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicIDecrement", @@ -2445,7 +2658,8 @@ { "kind" : "IdRef", "name" : "'Pointer'" }, { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicIAdd", @@ -2458,7 +2672,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicISub", @@ -2471,7 +2686,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicSMin", @@ -2484,7 +2700,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicUMin", @@ -2497,7 +2714,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicSMax", @@ -2510,7 +2728,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicUMax", @@ -2523,7 +2742,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicAnd", @@ -2536,7 +2756,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicOr", @@ -2549,7 +2770,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpAtomicXor", @@ -2562,7 +2784,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpPhi", @@ -2572,7 +2795,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, { "kind" : "PairIdRefIdRef", "quantifier" : "*", "name" : "'Variable, Parent, ...'" } - ] + ], + "version": "1.0" }, { "opname" : "OpLoopMerge", @@ -2582,7 +2806,8 @@ { "kind" : "IdRef", "name" : "'Merge Block'" }, { "kind" : "IdRef", "name" : "'Continue Target'" }, { "kind" : "LoopControl" } - ] + ], + "version": "1.0" }, { "opname" : "OpSelectionMerge", @@ -2591,7 +2816,8 @@ "operands" : [ { "kind" : "IdRef", "name" : "'Merge Block'" }, { "kind" : "SelectionControl" } - ] + ], + "version": "1.0" }, { "opname" : "OpLabel", @@ -2599,7 +2825,8 @@ "opcode" : 248, "operands" : [ { "kind" : "IdResult" } - ] + ], + "version": "1.0" }, { "opname" : "OpBranch", @@ -2607,7 +2834,8 @@ "opcode" : 249, "operands" : [ { "kind" : "IdRef", "name" : "'Target Label'" } - ] + ], + "version": "1.0" }, { "opname" : "OpBranchConditional", @@ -2618,7 +2846,8 @@ { "kind" : "IdRef", "name" : "'True Label'" }, { "kind" : "IdRef", "name" : "'False Label'" }, { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Branch weights'" } - ] + ], + "version": "1.0" }, { "opname" : "OpSwitch", @@ -2628,18 +2857,21 @@ { "kind" : "IdRef", "name" : "'Selector'" }, { "kind" : "IdRef", "name" : "'Default'" }, { "kind" : "PairLiteralIntegerIdRef", "quantifier" : "*", "name" : "'Target'" } - ] + ], + "version": "1.0" }, { "opname" : "OpKill", "class" : "Control-Flow", "opcode" : 252, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "opname" : "OpReturn", "class" : "Control-Flow", - "opcode" : 253 + "opcode" : 253, + "version" : "1.0" }, { "opname" : "OpReturnValue", @@ -2647,12 +2879,14 @@ "opcode" : 254, "operands" : [ { "kind" : "IdRef", "name" : "'Value'" } - ] + ], + "version": "1.0" }, { "opname" : "OpUnreachable", "class" : "Control-Flow", - "opcode" : 255 + "opcode" : 255, + "version" : "1.0" }, { "opname" : "OpLifetimeStart", @@ -2662,7 +2896,8 @@ { "kind" : "IdRef", "name" : "'Pointer'" }, { "kind" : "LiteralInteger", "name" : "'Size'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpLifetimeStop", @@ -2672,7 +2907,8 @@ { "kind" : "IdRef", "name" : "'Pointer'" }, { "kind" : "LiteralInteger", "name" : "'Size'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpGroupAsyncCopy", @@ -2688,7 +2924,8 @@ { "kind" : "IdRef", "name" : "'Stride'" }, { "kind" : "IdRef", "name" : "'Event'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpGroupWaitEvents", @@ -2699,7 +2936,8 @@ { "kind" : "IdRef", "name" : "'Num Events'" }, { "kind" : "IdRef", "name" : "'Events List'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpGroupAll", @@ -2711,7 +2949,8 @@ { "kind" : "IdScope", "name" : "'Execution'" }, { "kind" : "IdRef", "name" : "'Predicate'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpGroupAny", @@ -2723,7 +2962,8 @@ { "kind" : "IdScope", "name" : "'Execution'" }, { "kind" : "IdRef", "name" : "'Predicate'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpGroupBroadcast", @@ -2736,7 +2976,8 @@ { "kind" : "IdRef", "name" : "'Value'" }, { "kind" : "IdRef", "name" : "'LocalId'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpGroupIAdd", @@ -2749,7 +2990,8 @@ { "kind" : "GroupOperation", "name" : "'Operation'" }, { "kind" : "IdRef", "name" : "'X'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpGroupFAdd", @@ -2762,7 +3004,8 @@ { "kind" : "GroupOperation", "name" : "'Operation'" }, { "kind" : "IdRef", "name" : "'X'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpGroupFMin", @@ -2775,7 +3018,8 @@ { "kind" : "GroupOperation", "name" : "'Operation'" }, { "kind" : "IdRef", "name" : "'X'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpGroupUMin", @@ -2788,7 +3032,8 @@ { "kind" : "GroupOperation", "name" : "'Operation'" }, { "kind" : "IdRef", "name" : "'X'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpGroupSMin", @@ -2801,7 +3046,8 @@ { "kind" : "GroupOperation", "name" : "'Operation'" }, { "kind" : "IdRef", "name" : "'X'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpGroupFMax", @@ -2814,7 +3060,8 @@ { "kind" : "GroupOperation", "name" : "'Operation'" }, { "kind" : "IdRef", "name" : "'X'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpGroupUMax", @@ -2827,7 +3074,8 @@ { "kind" : "GroupOperation", "name" : "'Operation'" }, { "kind" : "IdRef", "name" : "'X'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpGroupSMax", @@ -2840,7 +3088,8 @@ { "kind" : "GroupOperation", "name" : "'Operation'" }, { "kind" : "IdRef", "name" : "'X'" } ], - "capabilities" : [ "Groups" ] + "capabilities" : [ "Groups" ], + "version": "1.0" }, { "opname" : "OpReadPipe", @@ -2854,7 +3103,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpWritePipe", @@ -2868,7 +3118,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpReservedReadPipe", @@ -2884,7 +3135,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpReservedWritePipe", @@ -2900,7 +3152,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpReserveReadPipePackets", @@ -2914,7 +3167,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpReserveWritePipePackets", @@ -2928,7 +3182,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpCommitReadPipe", @@ -2940,7 +3195,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpCommitWritePipe", @@ -2952,7 +3208,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpIsValidReserveId", @@ -2963,7 +3220,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Reserve Id'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpGetNumPipePackets", @@ -2976,7 +3234,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpGetMaxPipePackets", @@ -2989,7 +3248,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpGroupReserveReadPipePackets", @@ -3004,7 +3264,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpGroupReserveWritePipePackets", @@ -3019,7 +3280,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpGroupCommitReadPipe", @@ -3032,7 +3294,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpGroupCommitWritePipe", @@ -3045,7 +3308,8 @@ { "kind" : "IdRef", "name" : "'Packet Size'" }, { "kind" : "IdRef", "name" : "'Packet Alignment'" } ], - "capabilities" : [ "Pipes" ] + "capabilities" : [ "Pipes" ], + "version": "1.0" }, { "opname" : "OpEnqueueMarker", @@ -3059,7 +3323,8 @@ { "kind" : "IdRef", "name" : "'Wait Events'" }, { "kind" : "IdRef", "name" : "'Ret Event'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpEnqueueKernel", @@ -3080,7 +3345,8 @@ { "kind" : "IdRef", "name" : "'Param Align'" }, { "kind" : "IdRef", "quantifier" : "*", "name" : "'Local Size'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpGetKernelNDrangeSubGroupCount", @@ -3095,7 +3361,8 @@ { "kind" : "IdRef", "name" : "'Param Size'" }, { "kind" : "IdRef", "name" : "'Param Align'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpGetKernelNDrangeMaxSubGroupSize", @@ -3110,7 +3377,8 @@ { "kind" : "IdRef", "name" : "'Param Size'" }, { "kind" : "IdRef", "name" : "'Param Align'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpGetKernelWorkGroupSize", @@ -3124,7 +3392,8 @@ { "kind" : "IdRef", "name" : "'Param Size'" }, { "kind" : "IdRef", "name" : "'Param Align'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpGetKernelPreferredWorkGroupSizeMultiple", @@ -3138,7 +3407,8 @@ { "kind" : "IdRef", "name" : "'Param Size'" }, { "kind" : "IdRef", "name" : "'Param Align'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpRetainEvent", @@ -3147,7 +3417,8 @@ "operands" : [ { "kind" : "IdRef", "name" : "'Event'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpReleaseEvent", @@ -3156,7 +3427,8 @@ "operands" : [ { "kind" : "IdRef", "name" : "'Event'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpCreateUserEvent", @@ -3166,7 +3438,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpIsValidEvent", @@ -3177,7 +3450,8 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Event'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpSetUserEventStatus", @@ -3187,7 +3461,8 @@ { "kind" : "IdRef", "name" : "'Event'" }, { "kind" : "IdRef", "name" : "'Status'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpCaptureEventProfilingInfo", @@ -3198,7 +3473,8 @@ { "kind" : "IdRef", "name" : "'Profiling Info'" }, { "kind" : "IdRef", "name" : "'Value'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpGetDefaultQueue", @@ -3208,7 +3484,8 @@ { "kind" : "IdResultType" }, { "kind" : "IdResult" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpBuildNDRange", @@ -3221,7 +3498,8 @@ { "kind" : "IdRef", "name" : "'LocalWorkSize'" }, { "kind" : "IdRef", "name" : "'GlobalWorkOffset'" } ], - "capabilities" : [ "DeviceEnqueue" ] + "capabilities" : [ "DeviceEnqueue" ], + "version": "1.0" }, { "opname" : "OpImageSparseSampleImplicitLod", @@ -3234,7 +3512,8 @@ { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "SparseResidency" ] + "capabilities" : [ "SparseResidency" ], + "version": "1.0" }, { "opname" : "OpImageSparseSampleExplicitLod", @@ -3247,7 +3526,8 @@ { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "ImageOperands" } ], - "capabilities" : [ "SparseResidency" ] + "capabilities" : [ "SparseResidency" ], + "version": "1.0" }, { "opname" : "OpImageSparseSampleDrefImplicitLod", @@ -3261,7 +3541,8 @@ { "kind" : "IdRef", "name" : "'D~ref~'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "SparseResidency" ] + "capabilities" : [ "SparseResidency" ], + "version": "1.0" }, { "opname" : "OpImageSparseSampleDrefExplicitLod", @@ -3275,7 +3556,8 @@ { "kind" : "IdRef", "name" : "'D~ref~'" }, { "kind" : "ImageOperands" } ], - "capabilities" : [ "SparseResidency" ] + "capabilities" : [ "SparseResidency" ], + "version": "1.0" }, { "opname" : "OpImageSparseSampleProjImplicitLod", @@ -3346,7 +3628,8 @@ { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "SparseResidency" ] + "capabilities" : [ "SparseResidency" ], + "version": "1.0" }, { "opname" : "OpImageSparseGather", @@ -3360,7 +3643,8 @@ { "kind" : "IdRef", "name" : "'Component'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "SparseResidency" ] + "capabilities" : [ "SparseResidency" ], + "version": "1.0" }, { "opname" : "OpImageSparseDrefGather", @@ -3374,7 +3658,8 @@ { "kind" : "IdRef", "name" : "'D~ref~'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "SparseResidency" ] + "capabilities" : [ "SparseResidency" ], + "version": "1.0" }, { "opname" : "OpImageSparseTexelsResident", @@ -3385,12 +3670,14 @@ { "kind" : "IdResult" }, { "kind" : "IdRef", "name" : "'Resident Code'" } ], - "capabilities" : [ "SparseResidency" ] + "capabilities" : [ "SparseResidency" ], + "version": "1.0" }, { "opname" : "OpNoLine", "class" : "Debug", - "opcode" : 317 + "opcode" : 317, + "version" : "1.0" }, { "opname" : "OpAtomicFlagTestAndSet", @@ -3403,7 +3690,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpAtomicFlagClear", @@ -3414,7 +3702,8 @@ { "kind" : "IdScope", "name" : "'Memory'" }, { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } ], - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "opname" : "OpImageSparseRead", @@ -3427,7 +3716,8 @@ { "kind" : "IdRef", "name" : "'Coordinate'" }, { "kind" : "ImageOperands", "quantifier" : "?" } ], - "capabilities" : [ "SparseResidency" ] + "capabilities" : [ "SparseResidency" ], + "version": "1.0" }, { "opname" : "OpSizeOf", @@ -4102,6 +4392,43 @@ "capabilities" : [ "Addresses", "VariablePointers", "VariablePointersStorageBuffer" ], "version" : "1.4" }, + { + "opname" : "OpColorAttachmentReadEXT", + "class" : "Image", + "opcode" : 4160, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Attachment'" }, + { "kind" : "IdRef", "name" : "'Sample'", "quantifier" : "?" } + ], + "capabilities": [ "TileImageColorReadAccessEXT" ], + "version" : "None" + }, + { + "opname" : "OpDepthAttachmentReadEXT", + "class" : "Image", + "opcode" : 4161, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sample'", "quantifier" : "?" } + ], + "capabilities" : [ "TileImageDepthReadAccessEXT" ], + "version" : "None" + }, + { + "opname" : "OpStencilAttachmentReadEXT", + "class" : "Image", + "opcode" : 4162, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sample'", "quantifier" : "?" } + ], + "capabilities" : [ "TileImageStencilReadAccessEXT" ], + "version" : "None" + }, { "opname" : "OpTerminateInvocation", "class" : "Control-Flow", @@ -4456,6 +4783,77 @@ "extensions" : [ "SPV_KHR_integer_dot_product" ], "version" : "1.6" }, + { + "opname" : "OpTypeCooperativeMatrixKHR", + "class" : "Type-Declaration", + "opcode" : 4456, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Component Type'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdRef", "name" : "'Rows'" }, + { "kind" : "IdRef", "name" : "'Columns'" }, + { "kind" : "IdRef", "name" : "'Use'" } + ], + "capabilities" : [ "CooperativeMatrixKHR" ], + "version" : "None" + }, + { + "opname" : "OpCooperativeMatrixLoadKHR", + "class" : "Memory", + "opcode" : 4457, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'MemoryLayout'" }, + { "kind" : "IdRef", "name" : "'Stride'", "quantifier": "?" }, + { "kind" : "MemoryAccess", "name" : "'Memory Operand'", "quantifier" : "?" } + ], + "capabilities" : [ "CooperativeMatrixKHR" ], + "version" : "None" + }, + { + "opname" : "OpCooperativeMatrixStoreKHR", + "class" : "Memory", + "opcode" : 4458, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Object'" }, + { "kind" : "IdRef", "name" : "'MemoryLayout'" }, + { "kind" : "IdRef", "name" : "'Stride'", "quantifier": "?" }, + { "kind" : "MemoryAccess", "name" : "'Memory Operand'", "quantifier" : "?" } + ], + "capabilities" : [ "CooperativeMatrixKHR" ], + "version" : "None" + }, + { + "opname" : "OpCooperativeMatrixMulAddKHR", + "class" : "Arithmetic", + "opcode" : 4459, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'A'" }, + { "kind" : "IdRef", "name" : "'B'" }, + { "kind" : "IdRef", "name" : "'C'" }, + { "kind" : "CooperativeMatrixOperands", "name" : "'Cooperative Matrix Operands'", "quantifier" : "?" } + ], + "capabilities" : [ "CooperativeMatrixKHR" ], + "version" : "None" + }, + { + "opname" : "OpCooperativeMatrixLengthKHR", + "class" : "Miscellaneous", + "opcode" : 4460, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Type'" } + ], + "capabilities" : [ "CooperativeMatrixKHR" ], + "version" : "None" + }, { "opname" : "OpTypeRayQueryKHR", "class" : "Reserved", @@ -4592,6 +4990,66 @@ "extensions" : [ "SPV_KHR_ray_query" ], "version" : "None" }, + { + "opname" : "OpImageSampleWeightedQCOM", + "class" : "Image", + "opcode" : 4480, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Texture'" }, + { "kind" : "IdRef", "name" : "'Coordinates'" }, + { "kind" : "IdRef", "name" : "'Weights'" } + ], + "capabilities" : [ "TextureSampleWeightedQCOM" ], + "version" : "None" + }, + { + "opname" : "OpImageBoxFilterQCOM", + "class" : "Image", + "opcode" : 4481, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Texture'" }, + { "kind" : "IdRef", "name" : "'Coordinates'" }, + { "kind" : "IdRef", "name" : "'Box Size'" } + ], + "capabilities" : [ "TextureBoxFilterQCOM" ], + "version" : "None" + }, + { + "opname" : "OpImageBlockMatchSSDQCOM", + "class" : "Image", + "opcode" : 4482, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Target Coordinates'" }, + { "kind" : "IdRef", "name" : "'Reference'" }, + { "kind" : "IdRef", "name" : "'Reference Coordinates'" }, + { "kind" : "IdRef", "name" : "'Block Size'" } + ], + "capabilities" : [ "TextureBlockMatchQCOM" ], + "version" : "None" + }, + { + "opname" : "OpImageBlockMatchSADQCOM", + "class" : "Image", + "opcode" : 4483, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Target Coordinates'" }, + { "kind" : "IdRef", "name" : "'Reference'" }, + { "kind" : "IdRef", "name" : "'Reference Coordinates'" }, + { "kind" : "IdRef", "name" : "'Block Size'" } + ], + "capabilities" : [ "TextureBlockMatchQCOM" ], + "version" : "None" + }, { "opname" : "OpGroupIAddNonUniformAMD", "class" : "Group", @@ -4751,33 +5209,522 @@ { "kind" : "IdScope", "name" : "'Scope'" } ], "capabilities" : [ "ShaderClockKHR" ], - "extensions" : [ "SPV_KHR_shader_clock" ], "version" : "None" }, { - "opname" : "OpImageSampleFootprintNV", - "class" : "Image", - "opcode" : 5283, + "opname" : "OpFinalizeNodePayloadsAMDX", + "class" : "Reserved", + "opcode" : 5075, + "operands" : [ + { "kind" : "IdRef", "name": "'Payload Array'" } + ], + "capabilities" : [ "ShaderEnqueueAMDX" ], + "version" : "None" + }, + { + "opname" : "OpFinishWritingNodePayloadAMDX", + "class" : "Reserved", + "opcode" : 5078, "operands" : [ { "kind" : "IdResultType" }, { "kind" : "IdResult" }, - { "kind" : "IdRef", "name" : "'Sampled Image'" }, - { "kind" : "IdRef", "name" : "'Coordinate'" }, - { "kind" : "IdRef", "name" : "'Granularity'" }, - { "kind" : "IdRef", "name" : "'Coarse'" }, - { "kind" : "ImageOperands", "quantifier" : "?" } + { "kind" : "IdRef", "name": "'Payload'" } ], - "capabilities" : [ "ImageFootprintNV" ], - "extensions" : [ "SPV_NV_shader_image_footprint" ], + "capabilities" : [ "ShaderEnqueueAMDX" ], "version" : "None" }, { - "opname" : "OpEmitMeshTasksEXT", + "opname" : "OpInitializeNodePayloadsAMDX", "class" : "Reserved", - "opcode" : 5294, + "opcode" : 5090, "operands" : [ - { "kind" : "IdRef", "name" : "'Group Count X'" }, - { "kind" : "IdRef", "name" : "'Group Count Y'" }, + { "kind" : "IdRef", "name": "'Payload Array'" }, + { "kind" : "IdScope", "name": "'Visibility'" }, + { "kind" : "IdRef", "name": "'Payload Count'" }, + { "kind" : "IdRef", "name": "'Node Index'" } + ], + "capabilities" : [ "ShaderEnqueueAMDX" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectRecordHitMotionNV", + "class" : "Reserved", + "opcode" : 5249, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "name" : "'Acceleration Structure'" }, + { "kind" : "IdRef", "name" : "'InstanceId'" }, + { "kind" : "IdRef", "name" : "'PrimitiveId'" }, + { "kind" : "IdRef", "name" : "'GeometryIndex'" }, + { "kind" : "IdRef", "name" : "'Hit Kind'" }, + { "kind" : "IdRef", "name" : "'SBT Record Offset'" }, + { "kind" : "IdRef", "name" : "'SBT Record Stride'" }, + { "kind" : "IdRef", "name" : "'Origin'" }, + { "kind" : "IdRef", "name" : "'TMin'" }, + { "kind" : "IdRef", "name" : "'Direction'" }, + { "kind" : "IdRef", "name" : "'TMax'" }, + { "kind" : "IdRef", "name" : "'Current Time'" }, + { "kind" : "IdRef", "name" : "'HitObject Attributes'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV", "RayTracingMotionBlurNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectRecordHitWithIndexMotionNV", + "class" : "Reserved", + "opcode" : 5250, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "name" : "'Acceleration Structure'" }, + { "kind" : "IdRef", "name" : "'InstanceId'" }, + { "kind" : "IdRef", "name" : "'PrimitiveId'" }, + { "kind" : "IdRef", "name" : "'GeometryIndex'" }, + { "kind" : "IdRef", "name" : "'Hit Kind'" }, + { "kind" : "IdRef", "name" : "'SBT Record Index'" }, + { "kind" : "IdRef", "name" : "'Origin'" }, + { "kind" : "IdRef", "name" : "'TMin'" }, + { "kind" : "IdRef", "name" : "'Direction'" }, + { "kind" : "IdRef", "name" : "'TMax'" }, + { "kind" : "IdRef", "name" : "'Current Time'" }, + { "kind" : "IdRef", "name" : "'HitObject Attributes'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV", "RayTracingMotionBlurNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectRecordMissMotionNV", + "class" : "Reserved", + "opcode" : 5251, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "name" : "'SBT Index'" }, + { "kind" : "IdRef", "name" : "'Origin'" }, + { "kind" : "IdRef", "name" : "'TMin'" }, + { "kind" : "IdRef", "name" : "'Direction'" }, + { "kind" : "IdRef", "name" : "'TMax'" }, + { "kind" : "IdRef", "name" : "'Current Time'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV", "RayTracingMotionBlurNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetWorldToObjectNV", + "class" : "Reserved", + "opcode" : 5252, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetObjectToWorldNV", + "class" : "Reserved", + "opcode" : 5253, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetObjectRayDirectionNV", + "class" : "Reserved", + "opcode" : 5254, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetObjectRayOriginNV", + "class" : "Reserved", + "opcode" : 5255, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectTraceRayMotionNV", + "class" : "Reserved", + "opcode" : 5256, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "name" : "'Acceleration Structure'"}, + { "kind" : "IdRef", "name" : "'RayFlags'"}, + { "kind" : "IdRef", "name" : "'Cullmask'"}, + { "kind" : "IdRef", "name" : "'SBT Record Offset'"}, + { "kind" : "IdRef", "name" : "'SBT Record Stride'"}, + { "kind" : "IdRef", "name" : "'Miss Index'"}, + { "kind" : "IdRef", "name" : "'Origin'"}, + { "kind" : "IdRef", "name" : "'TMin'"}, + { "kind" : "IdRef", "name" : "'Direction'"}, + { "kind" : "IdRef", "name" : "'TMax'"}, + { "kind" : "IdRef", "name" : "'Time'"}, + { "kind" : "IdRef", "name" : "'Payload'"} + ], + "capabilities" : [ "ShaderInvocationReorderNV", "RayTracingMotionBlurNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetShaderRecordBufferHandleNV", + "class" : "Reserved", + "opcode" : 5257, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetShaderBindingTableRecordIndexNV", + "class" : "Reserved", + "opcode" : 5258, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectRecordEmptyNV", + "class" : "Reserved", + "opcode" : 5259, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectTraceRayNV", + "class" : "Reserved", + "opcode" : 5260, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "name" : "'Acceleration Structure'"}, + { "kind" : "IdRef", "name" : "'RayFlags'"}, + { "kind" : "IdRef", "name" : "'Cullmask'"}, + { "kind" : "IdRef", "name" : "'SBT Record Offset'"}, + { "kind" : "IdRef", "name" : "'SBT Record Stride'"}, + { "kind" : "IdRef", "name" : "'Miss Index'"}, + { "kind" : "IdRef", "name" : "'Origin'"}, + { "kind" : "IdRef", "name" : "'TMin'"}, + { "kind" : "IdRef", "name" : "'Direction'"}, + { "kind" : "IdRef", "name" : "'TMax'"}, + { "kind" : "IdRef", "name" : "'Payload'"} + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectRecordHitNV", + "class" : "Reserved", + "opcode" : 5261, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "name" : "'Acceleration Structure'" }, + { "kind" : "IdRef", "name" : "'InstanceId'" }, + { "kind" : "IdRef", "name" : "'PrimitiveId'" }, + { "kind" : "IdRef", "name" : "'GeometryIndex'" }, + { "kind" : "IdRef", "name" : "'Hit Kind'" }, + { "kind" : "IdRef", "name" : "'SBT Record Offset'" }, + { "kind" : "IdRef", "name" : "'SBT Record Stride'" }, + { "kind" : "IdRef", "name" : "'Origin'" }, + { "kind" : "IdRef", "name" : "'TMin'" }, + { "kind" : "IdRef", "name" : "'Direction'" }, + { "kind" : "IdRef", "name" : "'TMax'" }, + { "kind" : "IdRef", "name" : "'HitObject Attributes'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectRecordHitWithIndexNV", + "class" : "Reserved", + "opcode" : 5262, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "name" : "'Acceleration Structure'" }, + { "kind" : "IdRef", "name" : "'InstanceId'" }, + { "kind" : "IdRef", "name" : "'PrimitiveId'" }, + { "kind" : "IdRef", "name" : "'GeometryIndex'" }, + { "kind" : "IdRef", "name" : "'Hit Kind'" }, + { "kind" : "IdRef", "name" : "'SBT Record Index'" }, + { "kind" : "IdRef", "name" : "'Origin'" }, + { "kind" : "IdRef", "name" : "'TMin'" }, + { "kind" : "IdRef", "name" : "'Direction'" }, + { "kind" : "IdRef", "name" : "'TMax'" }, + { "kind" : "IdRef", "name" : "'HitObject Attributes'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectRecordMissNV", + "class" : "Reserved", + "opcode" : 5263, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "name" : "'SBT Index'" }, + { "kind" : "IdRef", "name" : "'Origin'" }, + { "kind" : "IdRef", "name" : "'TMin'" }, + { "kind" : "IdRef", "name" : "'Direction'" }, + { "kind" : "IdRef", "name" : "'TMax'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectExecuteShaderNV", + "class" : "Reserved", + "opcode" : 5264, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "name" : "'Payload'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetCurrentTimeNV", + "class" : "Reserved", + "opcode" : 5265, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetAttributesNV", + "class" : "Reserved", + "opcode" : 5266, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "name" : "'Hit Object Attribute'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetHitKindNV", + "class" : "Reserved", + "opcode" : 5267, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetPrimitiveIndexNV", + "class" : "Reserved", + "opcode" : 5268, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetGeometryIndexNV", + "class" : "Reserved", + "opcode" : 5269, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetInstanceIdNV", + "class" : "Reserved", + "opcode" : 5270, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetInstanceCustomIndexNV", + "class" : "Reserved", + "opcode" : 5271, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetWorldRayDirectionNV", + "class" : "Reserved", + "opcode" : 5272, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetWorldRayOriginNV", + "class" : "Reserved", + "opcode" : 5273, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetRayTMaxNV", + "class" : "Reserved", + "opcode" : 5274, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectGetRayTMinNV", + "class" : "Reserved", + "opcode" : 5275, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectIsEmptyNV", + "class" : "Reserved", + "opcode" : 5276, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectIsHitNV", + "class" : "Reserved", + "opcode" : 5277, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpHitObjectIsMissNV", + "class" : "Reserved", + "opcode" : 5278, + "operands" : [ + { "kind" : "IdResultType"}, + { "kind" : "IdResult"}, + { "kind" : "IdRef", "name" : "'Hit Object'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpReorderThreadWithHitObjectNV", + "class" : "Reserved", + "opcode" : 5279, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hit Object'" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "'Hint'" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "'Bits'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpReorderThreadWithHintNV", + "class" : "Reserved", + "opcode" : 5280, + "operands" : [ + { "kind" : "IdRef", "name" : "'Hint'" }, + { "kind" : "IdRef", "name" : "'Bits'" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpTypeHitObjectNV", + "class" : "Reserved", + "opcode" : 5281, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, + { + "opname" : "OpImageSampleFootprintNV", + "class" : "Image", + "opcode" : 5283, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Granularity'" }, + { "kind" : "IdRef", "name" : "'Coarse'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "ImageFootprintNV" ], + "extensions" : [ "SPV_NV_shader_image_footprint" ], + "version" : "None" + }, + { + "opname" : "OpEmitMeshTasksEXT", + "class" : "Reserved", + "opcode" : 5294, + "operands" : [ + { "kind" : "IdRef", "name" : "'Group Count X'" }, + { "kind" : "IdRef", "name" : "'Group Count Y'" }, { "kind" : "IdRef", "name" : "'Group Count Z'" }, { "kind" : "IdRef", "quantifier" : "?", "name" : "'Payload'" } ], @@ -4932,6 +5879,25 @@ "extensions" : [ "SPV_NV_ray_tracing_motion_blur" ], "version" : "None" }, + { + "opname" : "OpRayQueryGetIntersectionTriangleVertexPositionsKHR", + "class" : "Reserved", + "opcode" : 5340, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { + "kind" : "IdRef", + "name" : "'RayQuery'" + }, + { + "kind" : "IdRef", + "name" : "'Intersection'" + } + ], + "capabilities" : [ "RayQueryPositionFetchKHR" ], + "version" : "None" + }, { "opname" : "OpTypeAccelerationStructureNV", "class" : "Reserved", @@ -8589,6 +9555,30 @@ "capabilities" : [ "LongConstantCompositeINTEL" ], "version" : "None" }, + { + "opname" : "OpConvertFToBF16INTEL", + "class" : "Conversion", + "opcode" : 6116, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ], + "capabilities" : [ "BFloat16ConversionINTEL" ], + "version" : "None" + }, + { + "opname" : "OpConvertBF16ToFINTEL", + "class" : "Conversion", + "opcode" : 6117, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'BFloat16 Value'" } + ], + "capabilities" : [ "BFloat16ConversionINTEL" ], + "version" : "None" + }, { "opname" : "OpControlBarrierArriveINTEL", "class" : "Barrier", @@ -8741,14 +9731,16 @@ "capabilities" : [ "Shader" ], "parameters" : [ { "kind" : "IdRef" } - ] + ], + "version": "1.0" }, { "enumerant" : "Lod", "value" : "0x0002", "parameters" : [ { "kind" : "IdRef" } - ] + ], + "version": "1.0" }, { "enumerant" : "Grad", @@ -8756,14 +9748,16 @@ "parameters" : [ { "kind" : "IdRef" }, { "kind" : "IdRef" } - ] + ], + "version": "1.0" }, { "enumerant" : "ConstOffset", "value" : "0x0008", "parameters" : [ { "kind" : "IdRef" } - ] + ], + "version": "1.0" }, { "enumerant" : "Offset", @@ -8771,7 +9765,8 @@ "capabilities" : [ "ImageGatherExtended" ], "parameters" : [ { "kind" : "IdRef" } - ] + ], + "version": "1.0" }, { "enumerant" : "ConstOffsets", @@ -8779,14 +9774,16 @@ "capabilities" : [ "ImageGatherExtended" ], "parameters" : [ { "kind" : "IdRef" } - ] + ], + "version": "1.0" }, { "enumerant" : "Sample", "value" : "0x0040", "parameters" : [ { "kind" : "IdRef" } - ] + ], + "version": "1.0" }, { "enumerant" : "MinLod", @@ -8794,7 +9791,8 @@ "capabilities" : [ "MinLod" ], "parameters" : [ { "kind" : "IdRef" } - ] + ], + "version": "1.0" }, { "enumerant" : "MakeTexelAvailable", @@ -8880,7 +9878,8 @@ "value" : "0x10000", "parameters" : [ { "kind" : "IdRef" } - ] + ], + "version": "1.0" } ] }, @@ -8890,27 +9889,33 @@ "enumerants" : [ { "enumerant" : "None", - "value" : "0x0000" + "value" : "0x0000", + "version" : "1.0" }, { "enumerant" : "NotNaN", - "value" : "0x0001" + "value" : "0x0001", + "version" : "1.0" }, { "enumerant" : "NotInf", - "value" : "0x0002" + "value" : "0x0002", + "version" : "1.0" }, { "enumerant" : "NSZ", - "value" : "0x0004" + "value" : "0x0004", + "version" : "1.0" }, { "enumerant" : "AllowRecip", - "value" : "0x0008" + "value" : "0x0008", + "version" : "1.0" }, { "enumerant" : "Fast", - "value" : "0x0010" + "value" : "0x0010", + "version" : "1.0" }, { "enumerant" : "AllowContractFastINTEL", @@ -8932,15 +9937,18 @@ "enumerants" : [ { "enumerant" : "None", - "value" : "0x0000" + "value" : "0x0000", + "version" : "1.0" }, { "enumerant" : "Flatten", - "value" : "0x0001" + "value" : "0x0001", + "version" : "1.0" }, { "enumerant" : "DontFlatten", - "value" : "0x0002" + "value" : "0x0002", + "version" : "1.0" } ] }, @@ -8950,15 +9958,18 @@ "enumerants" : [ { "enumerant" : "None", - "value" : "0x0000" + "value" : "0x0000", + "version" : "1.0" }, { "enumerant" : "Unroll", - "value" : "0x0001" + "value" : "0x0001", + "version" : "1.0" }, { "enumerant" : "DontUnroll", - "value" : "0x0002" + "value" : "0x0002", + "version" : "1.0" }, { "enumerant" : "DependencyInfinite", @@ -9020,7 +10031,6 @@ { "kind" : "LiteralInteger" } ], "capabilities" : [ "FPGALoopControlsINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_loop_controls" ], "version" : "None" }, { @@ -9030,7 +10040,6 @@ { "kind" : "LiteralInteger" } ], "capabilities" : [ "FPGALoopControlsINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_loop_controls" ], "version" : "None" }, { @@ -9040,7 +10049,6 @@ { "kind" : "LiteralInteger" } ], "capabilities" : [ "FPGALoopControlsINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_loop_controls" ], "version" : "None" }, { @@ -9050,7 +10058,6 @@ { "kind" : "LiteralInteger" } ], "capabilities" : [ "FPGALoopControlsINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_loop_controls" ], "version" : "None" }, { @@ -9060,7 +10067,6 @@ { "kind" : "LiteralInteger" } ], "capabilities" : [ "FPGALoopControlsINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_loop_controls" ], "version" : "None" }, { @@ -9070,7 +10076,6 @@ { "kind" : "LiteralInteger" } ], "capabilities" : [ "FPGALoopControlsINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_loop_controls" ], "version" : "None" }, { @@ -9080,17 +10085,30 @@ { "kind" : "LiteralInteger" } ], "capabilities" : [ "FPGALoopControlsINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_loop_controls" ], "version" : "None" }, { "enumerant" : "NoFusionINTEL", "value" : "0x800000", + "capabilities" : [ "FPGALoopControlsINTEL" ], + "version" : "None" + }, + { + "enumerant" : "LoopCountINTEL", + "value" : "0x1000000", + "parameters" : [ + { "kind" : "LiteralInteger" } + ], + "capabilities" : [ "FPGALoopControlsINTEL" ], + "version" : "None" + }, + { + "enumerant" : "MaxReinvocationDelayINTEL", + "value" : "0x2000000", "parameters" : [ { "kind" : "LiteralInteger" } ], "capabilities" : [ "FPGALoopControlsINTEL" ], - "extensions" : [ "SPV_INTEL_fpga_loop_controls" ], "version" : "None" } ] @@ -9101,23 +10119,28 @@ "enumerants" : [ { "enumerant" : "None", - "value" : "0x0000" + "value" : "0x0000", + "version" : "1.0" }, { "enumerant" : "Inline", - "value" : "0x0001" + "value" : "0x0001", + "version" : "1.0" }, { "enumerant" : "DontInline", - "value" : "0x0002" + "value" : "0x0002", + "version" : "1.0" }, { "enumerant" : "Pure", - "value" : "0x0004" + "value" : "0x0004", + "version" : "1.0" }, { "enumerant" : "Const", - "value" : "0x0008" + "value" : "0x0008", + "version" : "1.0" }, { "enumerant" : "OptNoneINTEL", @@ -9133,53 +10156,65 @@ "enumerants" : [ { "enumerant" : "Relaxed", - "value" : "0x0000" + "value" : "0x0000", + "version" : "1.0" }, { "enumerant" : "None", - "value" : "0x0000" + "value" : "0x0000", + "version" : "1.0" }, { "enumerant" : "Acquire", - "value" : "0x0002" + "value" : "0x0002", + "version" : "1.0" }, { "enumerant" : "Release", - "value" : "0x0004" + "value" : "0x0004", + "version" : "1.0" }, { "enumerant" : "AcquireRelease", - "value" : "0x0008" + "value" : "0x0008", + "version" : "1.0" }, { "enumerant" : "SequentiallyConsistent", - "value" : "0x0010" + "value" : "0x0010", + "version" : "1.0" }, { "enumerant" : "UniformMemory", "value" : "0x0040", - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "SubgroupMemory", - "value" : "0x0080" + "value" : "0x0080", + "version" : "1.0" }, { "enumerant" : "WorkgroupMemory", - "value" : "0x0100" + "value" : "0x0100", + "version" : "1.0" }, { "enumerant" : "CrossWorkgroupMemory", - "value" : "0x0200" + "value" : "0x0200", + "version" : "1.0" }, { "enumerant" : "AtomicCounterMemory", "value" : "0x0400", - "capabilities" : [ "AtomicStorage" ] + "capabilities" : [ "AtomicStorage" ], + "version": "1.0" }, { "enumerant" : "ImageMemory", - "value" : "0x0800" + "value" : "0x0800", + "version" : "1.0" }, { "enumerant" : "OutputMemory", @@ -9235,22 +10270,26 @@ "enumerants" : [ { "enumerant" : "None", - "value" : "0x0000" + "value" : "0x0000", + "version" : "1.0" }, { "enumerant" : "Volatile", - "value" : "0x0001" + "value" : "0x0001", + "version" : "1.0" }, { "enumerant" : "Aligned", "value" : "0x0002", "parameters" : [ { "kind" : "LiteralInteger" } - ] + ], + "version" : "1.0" }, { "enumerant" : "Nontemporal", - "value" : "0x0004" + "value" : "0x0004", + "version" : "1.0" }, { "enumerant" : "MakePointerAvailable", @@ -9331,12 +10370,14 @@ "enumerants" : [ { "enumerant" : "None", - "value" : "0x0000" + "value" : "0x0000", + "version" : "1.0" }, { "enumerant" : "CmdExecTime", "value" : "0x0001", - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" } ] }, @@ -9409,6 +10450,12 @@ "value" : "0x0200", "capabilities" : [ "RayTraversalPrimitiveCullingKHR" ], "version" : "None" + }, + { + "enumerant" : "ForceOpacityMicromap2StateEXT", + "value" : "0x0400", + "capabilities" : [ "RayTracingOpacityMicromapEXT" ], + "version" : "None" } ] }, @@ -9448,35 +10495,58 @@ "enumerants" : [ { "enumerant" : "Unknown", - "value" : 0 + "value" : 0, + "version" : "1.0" }, { "enumerant" : "ESSL", - "value" : 1 + "value" : 1, + "version" : "1.0" }, { "enumerant" : "GLSL", - "value" : 2 + "value" : 2, + "version" : "1.0" }, { "enumerant" : "OpenCL_C", - "value" : 3 + "value" : 3, + "version" : "1.0" }, { "enumerant" : "OpenCL_CPP", - "value" : 4 + "value" : 4, + "version" : "1.0" }, { "enumerant" : "HLSL", - "value" : 5 + "value" : 5, + "version" : "1.0" }, { "enumerant" : "CPP_for_OpenCL", - "value" : 6 + "value" : 6, + "version" : "1.0" }, { "enumerant" : "SYCL", - "value" : 7 + "value" : 7, + "version" : "1.0" + }, + { + "enumerant" : "HERO_C", + "value" : 8, + "version" : "1.0" + }, + { + "enumerant" : "NZSL", + "value" : 9, + "version" : "1.0" + }, + { + "enumerant" : "WGSL", + "value" : 10, + "version" : "1.0" } ] }, @@ -9487,37 +10557,44 @@ { "enumerant" : "Vertex", "value" : 0, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "TessellationControl", "value" : 1, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "TessellationEvaluation", "value" : 2, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "Geometry", "value" : 3, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "enumerant" : "Fragment", "value" : 4, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "GLCompute", "value" : 5, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Kernel", "value" : 6, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "TaskNV", @@ -9623,17 +10700,20 @@ "enumerants" : [ { "enumerant" : "Logical", - "value" : 0 + "value" : 0, + "version" : "1.0" }, { "enumerant" : "Physical32", "value" : 1, - "capabilities" : [ "Addresses" ] + "capabilities" : [ "Addresses" ], + "version": "1.0" }, { "enumerant" : "Physical64", "value" : 2, - "capabilities" : [ "Addresses" ] + "capabilities" : [ "Addresses" ], + "version": "1.0" }, { "enumerant" : "PhysicalStorageBuffer64", @@ -9658,17 +10738,20 @@ { "enumerant" : "Simple", "value" : 0, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "GLSL450", "value" : 1, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "OpenCL", "value" : 2, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Vulkan", @@ -9695,82 +10778,98 @@ "capabilities" : [ "Geometry" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Number of <>'" } - ] + ], + "version": "1.0" }, { "enumerant" : "SpacingEqual", "value" : 1, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "SpacingFractionalEven", "value" : 2, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "SpacingFractionalOdd", "value" : 3, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "VertexOrderCw", "value" : 4, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "VertexOrderCcw", "value" : 5, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "PixelCenterInteger", "value" : 6, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "OriginUpperLeft", "value" : 7, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "OriginLowerLeft", "value" : 8, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "EarlyFragmentTests", "value" : 9, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "PointMode", "value" : 10, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "Xfb", "value" : 11, - "capabilities" : [ "TransformFeedback" ] + "capabilities" : [ "TransformFeedback" ], + "version": "1.0" }, { "enumerant" : "DepthReplacing", "value" : 12, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "DepthGreater", "value" : 14, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "DepthLess", "value" : 15, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "DepthUnchanged", "value" : 16, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "LocalSize", @@ -9779,7 +10878,8 @@ { "kind" : "LiteralInteger", "name" : "'x size'" }, { "kind" : "LiteralInteger", "name" : "'y size'" }, { "kind" : "LiteralInteger", "name" : "'z size'" } - ] + ], + "version": "1.0" }, { "enumerant" : "LocalSizeHint", @@ -9789,42 +10889,50 @@ { "kind" : "LiteralInteger", "name" : "'x size'" }, { "kind" : "LiteralInteger", "name" : "'y size'" }, { "kind" : "LiteralInteger", "name" : "'z size'" } - ] + ], + "version": "1.0" }, { "enumerant" : "InputPoints", "value" : 19, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "enumerant" : "InputLines", "value" : 20, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "enumerant" : "InputLinesAdjacency", "value" : 21, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "enumerant" : "Triangles", "value" : 22, - "capabilities" : [ "Geometry", "Tessellation" ] + "capabilities" : [ "Geometry", "Tessellation" ], + "version": "1.0" }, { "enumerant" : "InputTrianglesAdjacency", "value" : 23, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "enumerant" : "Quads", "value" : 24, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "Isolines", "value" : 25, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "OutputVertices", @@ -9832,22 +10940,26 @@ "capabilities" : [ "Geometry", "Tessellation", "MeshShadingNV", "MeshShadingEXT" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Vertex count'" } - ] + ], + "version": "1.0" }, { "enumerant" : "OutputPoints", "value" : 27, - "capabilities" : [ "Geometry", "MeshShadingNV", "MeshShadingEXT" ] + "capabilities" : [ "Geometry", "MeshShadingNV", "MeshShadingEXT" ], + "version": "1.0" }, { "enumerant" : "OutputLineStrip", "value" : 28, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "enumerant" : "OutputTriangleStrip", "value" : 29, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "enumerant" : "VecTypeHint", @@ -9855,12 +10967,14 @@ "capabilities" : [ "Kernel" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Vector type'" } - ] + ], + "version": "1.0" }, { "enumerant" : "ContractionOff", "value" : 31, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Initializer", @@ -9922,6 +11036,24 @@ ], "version" : "1.2" }, + { + "enumerant" : "NonCoherentColorAttachmentReadEXT", + "value" : 4169, + "capabilities" : [ "TileImageColorReadAccessEXT" ], + "version" : "None" + }, + { + "enumerant" : "NonCoherentDepthAttachmentReadEXT", + "value" : 4170, + "capabilities" : [ "TileImageDepthReadAccessEXT" ], + "version" : "None" + }, + { + "enumerant" : "NonCoherentStencilAttachmentReadEXT", + "value" : 4171, + "capabilities" : [ "TileImageStencilReadAccessEXT" ], + "version" : "None" + }, { "enumerant" : "SubgroupUniformControlFlowKHR", "value" : 4421, @@ -10000,6 +11132,52 @@ "extensions" : [ "SPV_EXT_shader_stencil_export" ], "version" : "None" }, + { + "enumerant" : "CoalescingAMDX", + "value" : 5069, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "version" : "None" + }, + { + "enumerant" : "MaxNodeRecursionAMDX", + "value" : 5071, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Number of recursions'" } + ], + "version" : "None" + }, + { + "enumerant" : "StaticNumWorkgroupsAMDX", + "value" : 5072, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'x size'" }, + { "kind" : "IdRef", "name" : "'y size'" }, + { "kind" : "IdRef", "name" : "'z size'" } + ], + "version" : "None" + }, + { + "enumerant" : "ShaderIndexAMDX", + "value" : 5073, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Shader Index'" } + ], + "version" : "None" + }, + { + "enumerant" : "MaxNumWorkgroupsAMDX", + "value" : 5077, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'x size'" }, + { "kind" : "IdRef", "name" : "'y size'" }, + { "kind" : "IdRef", "name" : "'z size'" } + ], + "version" : "None" + }, { "enumerant": "StencilRefUnchangedFrontAMD", "value": 5079, @@ -10239,6 +11417,24 @@ "capabilities" : [ "FPGAKernelAttributesINTEL" ], "version" : "None" }, + { + "enumerant" : "StreamingInterfaceINTEL", + "value" : 6154, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'StallFreeReturn'" } + ], + "capabilities" : [ "FPGAKernelAttributesINTEL" ], + "version" : "None" + }, + { + "enumerant" : "RegisterMapInterfaceINTEL", + "value" : 6160, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'WaitForDoneWrite'" } + ], + "capabilities" : [ "FPGAKernelAttributesv2INTEL" ], + "version" : "None" + }, { "enumerant" : "NamedBarrierCountINTEL", "value" : 6417, @@ -10256,57 +11452,69 @@ "enumerants" : [ { "enumerant" : "UniformConstant", - "value" : 0 + "value" : 0, + "version" : "1.0" }, { "enumerant" : "Input", - "value" : 1 + "value" : 1, + "version" : "1.0" }, { "enumerant" : "Uniform", "value" : 2, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Output", "value" : 3, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Workgroup", - "value" : 4 + "value" : 4, + "version" : "1.0" }, { "enumerant" : "CrossWorkgroup", - "value" : 5 + "value" : 5, + "version" : "1.0" }, { "enumerant" : "Private", "value" : 6, - "capabilities" : [ "Shader", "VectorComputeINTEL" ] + "capabilities" : [ "Shader", "VectorComputeINTEL" ], + "version": "1.0" }, { "enumerant" : "Function", - "value" : 7 + "value" : 7, + "version" : "1.0" }, { "enumerant" : "Generic", "value" : 8, - "capabilities" : [ "GenericPointer" ] + "capabilities" : [ "GenericPointer" ], + "version": "1.0" }, { "enumerant" : "PushConstant", "value" : 9, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "AtomicCounter", "value" : 10, - "capabilities" : [ "AtomicStorage" ] + "capabilities" : [ "AtomicStorage" ], + "version": "1.0" }, { "enumerant" : "Image", - "value" : 11 + "value" : 11, + "version" : "1.0" }, { "enumerant" : "StorageBuffer", @@ -10318,6 +11526,24 @@ "capabilities" : [ "Shader" ], "version" : "1.3" }, + { + "enumerant" : "TileImageEXT", + "value" : 4172, + "capabilities" : [ "TileImageColorReadAccessEXT" ], + "version" : "None" + }, + { + "enumerant" : "NodePayloadAMDX", + "value" : 5068, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "version" : "None" + }, + { + "enumerant" : "NodeOutputPayloadAMDX", + "value" : 5076, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "version" : "None" + }, { "enumerant" : "CallableDataNV", "value" : 5328, @@ -10416,6 +11642,12 @@ "capabilities" : [ "PhysicalStorageBufferAddresses" ], "version" : "1.5" }, + { + "enumerant" : "HitObjectAttributeNV", + "value" : 5385, + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, { "enumerant" : "TaskPayloadWorkgroupEXT", "value" : 5402, @@ -10457,36 +11689,48 @@ { "enumerant" : "1D", "value" : 0, - "capabilities" : [ "Sampled1D", "Image1D" ] + "capabilities" : [ "Sampled1D" ], + "version": "1.0" }, { "enumerant" : "2D", "value" : 1, - "capabilities" : [ "Shader", "Kernel", "ImageMSArray" ] + "version" : "1.0" }, { "enumerant" : "3D", - "value" : 2 + "value" : 2, + "version" : "1.0" }, { "enumerant" : "Cube", "value" : 3, - "capabilities" : [ "Shader", "ImageCubeArray" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rect", "value" : 4, - "capabilities" : [ "SampledRect", "ImageRect" ] + "capabilities" : [ "SampledRect" ], + "version": "1.0" }, { "enumerant" : "Buffer", "value" : 5, - "capabilities" : [ "SampledBuffer", "ImageBuffer" ] + "capabilities" : [ "SampledBuffer" ], + "version": "1.0" }, { "enumerant" : "SubpassData", "value" : 6, - "capabilities" : [ "InputAttachment" ] + "capabilities" : [ "InputAttachment" ], + "version": "1.0" + }, + { + "enumerant" : "TileImageDataEXT", + "value" : 4173, + "capabilities" : [ "TileImageColorReadAccessEXT" ], + "version" : "None" } ] }, @@ -10497,27 +11741,32 @@ { "enumerant" : "None", "value" : 0, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "ClampToEdge", "value" : 1, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Clamp", "value" : 2, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Repeat", "value" : 3, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "RepeatMirrored", "value" : 4, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" } ] }, @@ -10528,12 +11777,14 @@ { "enumerant" : "Nearest", "value" : 0, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Linear", "value" : 1, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" } ] }, @@ -10543,212 +11794,254 @@ "enumerants" : [ { "enumerant" : "Unknown", - "value" : 0 + "value" : 0, + "version" : "1.0" }, { "enumerant" : "Rgba32f", "value" : 1, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rgba16f", "value" : 2, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "R32f", "value" : 3, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rgba8", "value" : 4, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rgba8Snorm", "value" : 5, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rg32f", "value" : 6, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rg16f", "value" : 7, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R11fG11fB10f", "value" : 8, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R16f", "value" : 9, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rgba16", "value" : 10, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rgb10A2", "value" : 11, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rg16", "value" : 12, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rg8", "value" : 13, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R16", "value" : 14, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R8", "value" : 15, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rgba16Snorm", "value" : 16, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rg16Snorm", "value" : 17, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rg8Snorm", "value" : 18, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R16Snorm", "value" : 19, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R8Snorm", "value" : 20, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rgba32i", "value" : 21, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rgba16i", "value" : 22, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rgba8i", "value" : 23, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "R32i", "value" : 24, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rg32i", "value" : 25, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rg16i", "value" : 26, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rg8i", "value" : 27, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R16i", "value" : 28, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R8i", "value" : 29, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rgba32ui", "value" : 30, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rgba16ui", "value" : 31, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rgba8ui", "value" : 32, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "R32ui", "value" : 33, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Rgb10a2ui", "value" : 34, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rg32ui", "value" : 35, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rg16ui", "value" : 36, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "Rg8ui", "value" : 37, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R16ui", "value" : 38, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R8ui", "value" : 39, - "capabilities" : [ "StorageImageExtendedFormats" ] + "capabilities" : [ "StorageImageExtendedFormats" ], + "version": "1.0" }, { "enumerant" : "R64ui", "value" : 40, - "capabilities" : [ "Int64ImageEXT" ] + "capabilities" : [ "Int64ImageEXT" ], + "version": "1.0" }, { "enumerant" : "R64i", "value" : 41, - "capabilities" : [ "Int64ImageEXT" ] + "capabilities" : [ "Int64ImageEXT" ], + "version": "1.0" } ] }, @@ -10759,102 +12052,122 @@ { "enumerant" : "R", "value" : 0, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "A", "value" : 1, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "RG", "value" : 2, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "RA", "value" : 3, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "RGB", "value" : 4, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "RGBA", "value" : 5, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "BGRA", "value" : 6, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "ARGB", "value" : 7, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Intensity", "value" : 8, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Luminance", "value" : 9, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Rx", "value" : 10, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "RGx", "value" : 11, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "RGBx", "value" : 12, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Depth", "value" : 13, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "DepthStencil", "value" : 14, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "sRGB", "value" : 15, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "sRGBx", "value" : 16, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "sRGBA", "value" : 17, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "sBGRA", "value" : 18, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "ABGR", "value" : 19, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" } ] }, @@ -10865,87 +12178,116 @@ { "enumerant" : "SnormInt8", "value" : 0, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "SnormInt16", "value" : 1, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "UnormInt8", "value" : 2, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "UnormInt16", "value" : 3, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "UnormShort565", "value" : 4, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "UnormShort555", "value" : 5, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "UnormInt101010", "value" : 6, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "SignedInt8", "value" : 7, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "SignedInt16", "value" : 8, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "SignedInt32", "value" : 9, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "UnsignedInt8", "value" : 10, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "UnsignedInt16", "value" : 11, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "UnsignedInt32", "value" : 12, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "HalfFloat", "value" : 13, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Float", "value" : 14, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "UnormInt24", "value" : 15, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "UnormInt101010_2", "value" : 16, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" + }, + { + "enumerant" : "UnsignedIntRaw10EXT", + "value" : 19, + "capabilities" : [ "Kernel" ], + "version": "1.0" + }, + { + "enumerant" : "UnsignedIntRaw12EXT", + "value" : 20, + "capabilities" : [ "Kernel" ], + "version": "1.0" } ] }, @@ -10955,19 +12297,23 @@ "enumerants" : [ { "enumerant" : "RTE", - "value" : 0 + "value" : 0, + "version" : "1.0" }, { "enumerant" : "RTZ", - "value" : 1 + "value" : 1, + "version" : "1.0" }, { "enumerant" : "RTP", - "value" : 2 + "value" : 2, + "version" : "1.0" }, { "enumerant" : "RTN", - "value" : 3 + "value" : 3, + "version" : "1.0" } ] }, @@ -11098,12 +12444,14 @@ { "enumerant" : "Export", "value" : 0, - "capabilities" : [ "Linkage" ] + "capabilities" : [ "Linkage" ], + "version": "1.0" }, { "enumerant" : "Import", "value" : 1, - "capabilities" : [ "Linkage" ] + "capabilities" : [ "Linkage" ], + "version": "1.0" }, { "enumerant" : "LinkOnceODR", @@ -11121,17 +12469,50 @@ { "enumerant" : "ReadOnly", "value" : 0, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "WriteOnly", "value" : 1, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "ReadWrite", "value" : 2, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "HostAccessQualifier", + "enumerants" : [ + { + "enumerant" : "NoneINTEL", + "value" : 0, + "capabilities" : [ "GlobalVariableHostAccessINTEL" ], + "version" : "None" + }, + { + "enumerant" : "ReadINTEL", + "value" : 1, + "capabilities" : [ "GlobalVariableHostAccessINTEL" ], + "version" : "None" + }, + { + "enumerant" : "WriteINTEL", + "value" : 2, + "capabilities" : [ "GlobalVariableHostAccessINTEL" ], + "version" : "None" + }, + { + "enumerant" : "ReadWriteINTEL", + "value" : 3, + "capabilities" : [ "GlobalVariableHostAccessINTEL" ], + "version" : "None" } ] }, @@ -11142,42 +12523,56 @@ { "enumerant" : "Zext", "value" : 0, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Sext", "value" : 1, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "ByVal", "value" : 2, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Sret", "value" : 3, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "NoAlias", "value" : 4, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "NoCapture", "value" : 5, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "NoWrite", "value" : 6, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "NoReadWrite", "value" : 7, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" + }, + { + "enumerant" : "RuntimeAlignedINTEL", + "value" : 5940, + "capabilities" : [ "RuntimeAlignedAttributeINTEL" ], + "version": "1.0" } ] }, @@ -11188,7 +12583,8 @@ { "enumerant" : "RelaxedPrecision", "value" : 0, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "SpecId", @@ -11196,28 +12592,33 @@ "capabilities" : [ "Shader", "Kernel" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Specialization Constant ID'" } - ] + ], + "version": "1.0" }, { "enumerant" : "Block", "value" : 2, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "BufferBlock", "value" : 3, "capabilities" : [ "Shader" ], + "version": "1.0", "lastVersion" : "1.3" }, { "enumerant" : "RowMajor", "value" : 4, - "capabilities" : [ "Matrix" ] + "capabilities" : [ "Matrix" ], + "version": "1.0" }, { "enumerant" : "ColMajor", "value" : 5, - "capabilities" : [ "Matrix" ] + "capabilities" : [ "Matrix" ], + "version": "1.0" }, { "enumerant" : "ArrayStride", @@ -11225,7 +12626,8 @@ "capabilities" : [ "Shader" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Array Stride'" } - ] + ], + "version": "1.0" }, { "enumerant" : "MatrixStride", @@ -11233,93 +12635,112 @@ "capabilities" : [ "Matrix" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Matrix Stride'" } - ] + ], + "version": "1.0" }, { "enumerant" : "GLSLShared", "value" : 8, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "GLSLPacked", "value" : 9, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "CPacked", "value" : 10, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "BuiltIn", "value" : 11, "parameters" : [ { "kind" : "BuiltIn" } - ] + ], + "version": "1.0" }, { "enumerant" : "NoPerspective", "value" : 13, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Flat", "value" : 14, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Patch", "value" : 15, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "Centroid", "value" : 16, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Sample", "value" : 17, - "capabilities" : [ "SampleRateShading" ] + "capabilities" : [ "SampleRateShading" ], + "version": "1.0" }, { "enumerant" : "Invariant", "value" : 18, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Restrict", - "value" : 19 + "value" : 19, + "version" : "1.0" }, { "enumerant" : "Aliased", - "value" : 20 + "value" : 20, + "version" : "1.0" }, { "enumerant" : "Volatile", - "value" : 21 + "value" : 21, + "version" : "1.0" }, { "enumerant" : "Constant", "value" : 22, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Coherent", - "value" : 23 + "value" : 23, + "version": "1.0" }, { "enumerant" : "NonWritable", - "value" : 24 + "value" : 24, + "version": "1.0" }, { "enumerant" : "NonReadable", - "value" : 25 + "value" : 25, + "version": "1.0" }, { "enumerant" : "Uniform", "value" : 26, - "capabilities" : [ "Shader", "UniformDecoration" ] + "capabilities" : [ "Shader", "UniformDecoration" ], + "version": "1.0" }, { "enumerant" : "UniformId", @@ -11333,7 +12754,8 @@ { "enumerant" : "SaturatedConversion", "value" : 28, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Stream", @@ -11341,7 +12763,8 @@ "capabilities" : [ "GeometryStreams" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Stream Number'" } - ] + ], + "version": "1.0" }, { "enumerant" : "Location", @@ -11349,7 +12772,8 @@ "capabilities" : [ "Shader" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Location'" } - ] + ], + "version": "1.0" }, { "enumerant" : "Component", @@ -11357,7 +12781,8 @@ "capabilities" : [ "Shader" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Component'" } - ] + ], + "version": "1.0" }, { "enumerant" : "Index", @@ -11365,7 +12790,8 @@ "capabilities" : [ "Shader" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Index'" } - ] + ], + "version": "1.0" }, { "enumerant" : "Binding", @@ -11373,7 +12799,8 @@ "capabilities" : [ "Shader" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Binding Point'" } - ] + ], + "version": "1.0" }, { "enumerant" : "DescriptorSet", @@ -11381,7 +12808,8 @@ "capabilities" : [ "Shader" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Descriptor Set'" } - ] + ], + "version": "1.0" }, { "enumerant" : "Offset", @@ -11389,7 +12817,8 @@ "capabilities" : [ "Shader" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Byte Offset'" } - ] + ], + "version": "1.0" }, { "enumerant" : "XfbBuffer", @@ -11397,7 +12826,8 @@ "capabilities" : [ "TransformFeedback" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'XFB Buffer Number'" } - ] + ], + "version": "1.0" }, { "enumerant" : "XfbStride", @@ -11405,7 +12835,8 @@ "capabilities" : [ "TransformFeedback" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'XFB Stride'" } - ] + ], + "version": "1.0" }, { "enumerant" : "FuncParamAttr", @@ -11413,14 +12844,16 @@ "capabilities" : [ "Kernel" ], "parameters" : [ { "kind" : "FunctionParameterAttribute", "name" : "'Function Parameter Attribute'" } - ] + ], + "version": "1.0" }, { "enumerant" : "FPRoundingMode", "value" : 39, "parameters" : [ { "kind" : "FPRoundingMode", "name" : "'Floating-Point Rounding Mode'" } - ] + ], + "version": "1.0" }, { "enumerant" : "FPFastMathMode", @@ -11428,7 +12861,8 @@ "capabilities" : [ "Kernel" ], "parameters" : [ { "kind" : "FPFastMathMode", "name" : "'Fast-Math Mode'" } - ] + ], + "version": "1.0" }, { "enumerant" : "LinkageAttributes", @@ -11437,12 +12871,14 @@ "parameters" : [ { "kind" : "LiteralString", "name" : "'Name'" }, { "kind" : "LinkageType", "name" : "'Linkage Type'" } - ] + ], + "version": "1.0" }, { "enumerant" : "NoContraction", "value" : 42, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "InputAttachmentIndex", @@ -11450,7 +12886,8 @@ "capabilities" : [ "InputAttachment" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Attachment Index'" } - ] + ], + "version": "1.0" }, { "enumerant" : "Alignment", @@ -11458,7 +12895,8 @@ "capabilities" : [ "Kernel" ], "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Alignment'" } - ] + ], + "version": "1.0" }, { "enumerant" : "MaxByteOffset", @@ -11499,12 +12937,57 @@ "extensions" : [ "SPV_KHR_no_integer_wrap_decoration" ], "version" : "1.4" }, + { + "enumerant" : "WeightTextureQCOM", + "value" : 4487, + "extensions" : [ "SPV_QCOM_image_processing" ], + "version" : "None" + }, + { + "enumerant" : "BlockMatchTextureQCOM", + "value" : 4488, + "extensions" : [ "SPV_QCOM_image_processing" ], + "version" : "None" + }, { "enumerant" : "ExplicitInterpAMD", "value" : 4999, "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ], "version" : "None" }, + { + "enumerant" : "NodeSharesPayloadLimitsWithAMDX", + "value" : 5019, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Payload Array'" } + ], + "version" : "None" + }, + { + "enumerant" : "NodeMaxPayloadsAMDX", + "value" : 5020, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Max number of payloads'" } + ], + "version" : "None" + }, + { + "enumerant" : "TrackFinishWritingAMDX", + "value" : 5078, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "version" : "None" + }, + { + "enumerant" : "PayloadNodeNameAMDX", + "value" : 5091, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "parameters" : [ + { "kind" : "LiteralString", "name" : "'Node Name'" } + ], + "version" : "None" + }, { "enumerant" : "OverrideCoverageNV", "value" : 5248, @@ -11533,7 +13016,8 @@ "version" : "None", "parameters" : [ { "kind" : "LiteralInteger", "name" : "'Offset'" } - ] + ], + "version": "1.0" }, { "enumerant" : "PerPrimitiveNV", @@ -11618,6 +13102,12 @@ "extensions" : [ "SPV_EXT_physical_storage_buffer" ], "version" : "1.5" }, + { + "enumerant" : "HitObjectShaderRecordBufferNV", + "value" : 5386, + "capabilities" : [ "ShaderInvocationReorderNV" ], + "version" : "None" + }, { "enumerant" : "BindlessSamplerNV", "value" : 5398, @@ -11923,6 +13413,16 @@ "capabilities" : [ "LoopFuseINTEL" ], "version" : "None" }, + { + "enumerant" : "MathOpDSPModeINTEL", + "value" : 5909, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Mode'" }, + { "kind" : "LiteralInteger", "name" : "'Propagate'" } + ], + "capabilities" : [ "FPGADSPControlINTEL" ], + "version" : "None" + }, { "enumerant" : "AliasScopeINTEL", "value" : 5914, @@ -11941,6 +13441,33 @@ "capabilities" : [ "MemoryAccessAliasingINTEL" ], "version" : "None" }, + { + "enumerant" : "InitiationIntervalINTEL", + "value" : 5917, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Cycles'" } + ], + "capabilities" : [ "FPGAInvocationPipeliningAttributesINTEL" ], + "version" : "None" + }, + { + "enumerant" : "MaxConcurrencyINTEL", + "value" : 5918, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Invocations'" } + ], + "capabilities" : [ "FPGAInvocationPipeliningAttributesINTEL" ], + "version" : "None" + }, + { + "enumerant" : "PipelineEnableINTEL", + "value" : 5919, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Enable'" } + ], + "capabilities" : [ "FPGAInvocationPipeliningAttributesINTEL" ], + "version" : "None" + }, { "enumerant" : "BufferLocationINTEL", "value" : 5921, @@ -11963,28 +13490,157 @@ "enumerant" : "FunctionFloatingPointModeINTEL", "value" : 6080, "parameters" : [ - { "kind" : "LiteralInteger", "name" : "'Target Width'" }, - { "kind" : "FPOperationMode", "name" : "'FP Operation Mode'" } + { "kind" : "LiteralInteger", "name" : "'Target Width'" }, + { "kind" : "FPOperationMode", "name" : "'FP Operation Mode'" } + ], + "capabilities" : [ "FunctionFloatControlINTEL" ], + "version" : "None" + }, + { + "enumerant" : "SingleElementVectorINTEL", + "value" : 6085, + "capabilities" : [ "VectorComputeINTEL" ], + "version" : "None" + }, + { + "enumerant" : "VectorComputeCallableFunctionINTEL", + "value" : 6087, + "capabilities" : [ "VectorComputeINTEL" ], + "version" : "None" + }, + { + "enumerant" : "MediaBlockIOINTEL", + "value" : 6140, + "capabilities" : [ "VectorComputeINTEL" ], + "version" : "None" + }, + { + "enumerant" : "InitModeINTEL", + "value" : 6147, + "parameters": [ + { "kind" : "InitializationModeQualifier", "name" : "'Trigger'" } + ], + "capabilities" : [ "GlobalVariableFPGADecorationsINTEL" ], + "version" : "None" + }, + { + "enumerant" : "ImplementInRegisterMapINTEL", + "value" : 6148, + "parameters": [ + { "kind" : "LiteralInteger", "name" : "Value" } + ], + "capabilities" : [ "GlobalVariableFPGADecorationsINTEL" ], + "version" : "None" + }, + { + "enumerant" : "HostAccessINTEL", + "value" : 6168, + "parameters": [ + { "kind" : "HostAccessQualifier", "name" : "'Access'" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ], + "capabilities" : [ "GlobalVariableHostAccessINTEL" ], + "version" : "None" + }, + { + "enumerant" : "FPMaxErrorDecorationINTEL", + "value" : 6170, + "parameters" : [ + { "kind" : "LiteralFloat", "name" : "'Max Error'" } + ], + "capabilities" : [ "FPMaxErrorINTEL" ], + "version" : "None" + }, + { + "enumerant" : "LatencyControlLabelINTEL", + "value" : 6172, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Latency Label'" } + ], + "capabilities" : [ "FPGALatencyControlINTEL" ], + "version" : "None" + }, + { + "enumerant" : "LatencyControlConstraintINTEL", + "value" : 6173, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Relative To'" }, + { "kind" : "LiteralInteger", "name" : "'Control Type'" }, + { "kind" : "LiteralInteger", "name" : "'Relative Cycle'" } + ], + "capabilities" : [ "FPGALatencyControlINTEL" ], + "version" : "None" + }, + { + "enumerant" : "ConduitKernelArgumentINTEL", + "value" : 6175, + "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "version" : "None" + }, + { + "enumerant" : "RegisterMapKernelArgumentINTEL", + "value" : 6176, + "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "version" : "None" + }, + { + "enumerant" : "MMHostInterfaceAddressWidthINTEL", + "value" : 6177, + "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'AddressWidth'" } + ], + "version" : "None" + }, + { + "enumerant" : "MMHostInterfaceDataWidthINTEL", + "value" : 6178, + "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'DataWidth'" } + ], + "version" : "None" + }, + { + "enumerant" : "MMHostInterfaceLatencyINTEL", + "value" : 6179, + "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Latency'" } + ], + "version" : "None" + }, + { + "enumerant" : "MMHostInterfaceReadWriteModeINTEL", + "value" : 6180, + "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "parameters" : [ + { "kind" : "AccessQualifier", "name" : "'ReadWriteMode'" } ], - "capabilities" : [ "FunctionFloatControlINTEL" ], "version" : "None" }, { - "enumerant" : "SingleElementVectorINTEL", - "value" : 6085, - "capabilities" : [ "VectorComputeINTEL" ], + "enumerant" : "MMHostInterfaceMaxBurstINTEL", + "value" : 6181, + "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'MaxBurstCount'" } + ], "version" : "None" }, { - "enumerant" : "VectorComputeCallableFunctionINTEL", - "value" : 6087, - "capabilities" : [ "VectorComputeINTEL" ], + "enumerant" : "MMHostInterfaceWaitRequestINTEL", + "value" : 6182, + "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Waitrequest'" } + ], "version" : "None" }, { - "enumerant" : "MediaBlockIOINTEL", - "value" : 6140, - "capabilities" : [ "VectorComputeINTEL" ], + "enumerant" : "StableKernelArgumentINTEL", + "value" : 6183, + "capabilities" : [ "FPGAArgumentInterfacesINTEL" ], "version" : "None" } ] @@ -11996,226 +13652,272 @@ { "enumerant" : "Position", "value" : 0, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "PointSize", "value" : 1, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "ClipDistance", "value" : 3, - "capabilities" : [ "ClipDistance" ] + "capabilities" : [ "ClipDistance" ], + "version": "1.0" }, { "enumerant" : "CullDistance", "value" : 4, - "capabilities" : [ "CullDistance" ] + "capabilities" : [ "CullDistance" ], + "version": "1.0" }, { "enumerant" : "VertexId", "value" : 5, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "InstanceId", "value" : 6, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "PrimitiveId", "value" : 7, - "capabilities" : [ "Geometry", "Tessellation", "RayTracingNV", "RayTracingKHR", "MeshShadingNV", "MeshShadingEXT" ] + "capabilities" : [ "Geometry", "Tessellation", "RayTracingNV", "RayTracingKHR", "MeshShadingNV", "MeshShadingEXT" ], + "version": "1.0" }, { "enumerant" : "InvocationId", "value" : 8, - "capabilities" : [ "Geometry", "Tessellation" ] + "capabilities" : [ "Geometry", "Tessellation" ], + "version": "1.0" }, { "enumerant" : "Layer", "value" : 9, - "capabilities" : [ "Geometry", "ShaderLayer", "ShaderViewportIndexLayerEXT", "MeshShadingNV", "MeshShadingEXT" ] + "capabilities" : [ "Geometry", "ShaderLayer", "ShaderViewportIndexLayerEXT", "MeshShadingNV", "MeshShadingEXT" ], + "version": "1.0" }, { "enumerant" : "ViewportIndex", "value" : 10, - "capabilities" : [ "MultiViewport", "ShaderViewportIndex", "ShaderViewportIndexLayerEXT", "MeshShadingNV", "MeshShadingEXT" ] + "capabilities" : [ "MultiViewport", "ShaderViewportIndex", "ShaderViewportIndexLayerEXT", "MeshShadingNV", "MeshShadingEXT" ], + "version": "1.0" }, { "enumerant" : "TessLevelOuter", "value" : 11, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "TessLevelInner", "value" : 12, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "TessCoord", "value" : 13, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "PatchVertices", "value" : 14, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "FragCoord", "value" : 15, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "PointCoord", "value" : 16, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "FrontFacing", "value" : 17, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "SampleId", "value" : 18, - "capabilities" : [ "SampleRateShading" ] + "capabilities" : [ "SampleRateShading" ], + "version": "1.0" }, { "enumerant" : "SamplePosition", "value" : 19, - "capabilities" : [ "SampleRateShading" ] + "capabilities" : [ "SampleRateShading" ], + "version": "1.0" }, { "enumerant" : "SampleMask", "value" : 20, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "FragDepth", "value" : 22, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "HelperInvocation", "value" : 23, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "NumWorkgroups", - "value" : 24 + "value" : 24, + "version" : "1.0" }, { "enumerant" : "WorkgroupSize", - "value" : 25 + "value" : 25, + "version" : "1.0" }, { "enumerant" : "WorkgroupId", - "value" : 26 + "value" : 26, + "version" : "1.0" }, { "enumerant" : "LocalInvocationId", - "value" : 27 + "value" : 27, + "version" : "1.0" }, { "enumerant" : "GlobalInvocationId", - "value" : 28 + "value" : 28, + "version" : "1.0" }, { "enumerant" : "LocalInvocationIndex", - "value" : 29 + "value" : 29, + "version" : "1.0" }, { "enumerant" : "WorkDim", "value" : 30, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "GlobalSize", "value" : 31, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "EnqueuedWorkgroupSize", "value" : 32, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "GlobalOffset", "value" : 33, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "GlobalLinearId", "value" : 34, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "SubgroupSize", "value" : 36, - "capabilities" : [ "Kernel", "GroupNonUniform", "SubgroupBallotKHR" ] + "capabilities" : [ "Kernel", "GroupNonUniform", "SubgroupBallotKHR" ], + "version": "1.0" }, { "enumerant" : "SubgroupMaxSize", "value" : 37, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "NumSubgroups", "value" : 38, - "capabilities" : [ "Kernel", "GroupNonUniform" ] + "capabilities" : [ "Kernel", "GroupNonUniform" ], + "version": "1.0" }, { "enumerant" : "NumEnqueuedSubgroups", "value" : 39, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "SubgroupId", "value" : 40, - "capabilities" : [ "Kernel", "GroupNonUniform" ] + "capabilities" : [ "Kernel", "GroupNonUniform" ], + "version": "1.0" }, { "enumerant" : "SubgroupLocalInvocationId", "value" : 41, - "capabilities" : [ "Kernel", "GroupNonUniform", "SubgroupBallotKHR" ] + "capabilities" : [ "Kernel", "GroupNonUniform", "SubgroupBallotKHR" ], + "version": "1.0" }, { "enumerant" : "VertexIndex", "value" : 42, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "InstanceIndex", "value" : 43, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "CoreIDARM", "value" : 4160, - "capabilities" : [ "CoreBuiltinsARM" ] + "capabilities" : [ "CoreBuiltinsARM" ], + "version": "1.0" }, { "enumerant" : "CoreCountARM", "value" : 4161, - "capabilities" : [ "CoreBuiltinsARM" ] + "capabilities" : [ "CoreBuiltinsARM" ], + "version": "1.0" }, { "enumerant" : "CoreMaxIDARM", "value" : 4162, - "capabilities" : [ "CoreBuiltinsARM" ] + "capabilities" : [ "CoreBuiltinsARM" ], + "version": "1.0" }, { "enumerant" : "WarpIDARM", "value" : 4163, - "capabilities" : [ "CoreBuiltinsARM" ] + "capabilities" : [ "CoreBuiltinsARM" ], + "version": "1.0" }, { "enumerant" : "WarpMaxIDARM", "value" : 4164, - "capabilities" : [ "CoreBuiltinsARM" ] + "capabilities" : [ "CoreBuiltinsARM" ], + "version": "1.0" }, { "enumerant" : "SubgroupEqMask", @@ -12380,6 +14082,18 @@ "extensions" : [ "SPV_EXT_shader_stencil_export" ], "version" : "None" }, + { + "enumerant" : "CoalescedInputCountAMDX", + "value" : 5021, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "version" : "None" + }, + { + "enumerant" : "ShaderIndexAMDX", + "value" : 5073, + "capabilities" : [ "ShaderEnqueueAMDX" ], + "version" : "None" + }, { "enumerant" : "ViewportMaskNV", "value" : 5253, @@ -12744,6 +14458,12 @@ "extensions" : [ "SPV_NV_ray_tracing_motion_blur" ], "version" : "None" }, + { + "enumerant" : "HitTriangleVertexPositionsKHR", + "value" : 5335, + "capabilities" : [ "RayTracingPositionFetchKHR" ], + "version" : "None" + }, { "enumerant" : "IncomingRayFlagsNV", "value" : 5351, @@ -12808,23 +14528,28 @@ "enumerants" : [ { "enumerant" : "CrossDevice", - "value" : 0 + "value" : 0, + "version" : "1.0" }, { "enumerant" : "Device", - "value" : 1 + "value" : 1, + "version" : "1.0" }, { "enumerant" : "Workgroup", - "value" : 2 + "value" : 2, + "version" : "1.0" }, { "enumerant" : "Subgroup", - "value" : 3 + "value" : 3, + "version" : "1.0" }, { "enumerant" : "Invocation", - "value" : 4 + "value" : 4, + "version" : "1.0" }, { "enumerant" : "QueueFamily", @@ -12853,17 +14578,20 @@ { "enumerant" : "Reduce", "value" : 0, - "capabilities" : [ "Kernel", "GroupNonUniformArithmetic", "GroupNonUniformBallot" ] + "capabilities" : [ "Kernel", "GroupNonUniformArithmetic", "GroupNonUniformBallot" ], + "version": "1.0" }, { "enumerant" : "InclusiveScan", "value" : 1, - "capabilities" : [ "Kernel", "GroupNonUniformArithmetic", "GroupNonUniformBallot" ] + "capabilities" : [ "Kernel", "GroupNonUniformArithmetic", "GroupNonUniformBallot" ], + "version": "1.0" }, { "enumerant" : "ExclusiveScan", "value" : 2, - "capabilities" : [ "Kernel", "GroupNonUniformArithmetic", "GroupNonUniformBallot" ] + "capabilities" : [ "Kernel", "GroupNonUniformArithmetic", "GroupNonUniformBallot" ], + "version": "1.0" }, { "enumerant" : "ClusteredReduce", @@ -12901,17 +14629,20 @@ { "enumerant" : "NoWait", "value" : 0, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "WaitKernel", "value" : 1, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "WaitWorkGroup", "value" : 2, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" } ] }, @@ -12921,272 +14652,328 @@ "enumerants" : [ { "enumerant" : "Matrix", - "value" : 0 + "value" : 0, + "version" : "1.0" }, { "enumerant" : "Shader", "value" : 1, - "capabilities" : [ "Matrix" ] + "capabilities" : [ "Matrix" ], + "version": "1.0" }, { "enumerant" : "Geometry", "value" : 2, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Tessellation", "value" : 3, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Addresses", - "value" : 4 + "value" : 4, + "version" : "1.0" }, { "enumerant" : "Linkage", - "value" : 5 + "value" : 5, + "version" : "1.0" }, { "enumerant" : "Kernel", - "value" : 6 + "value" : 6, + "version" : "1.0" }, { "enumerant" : "Vector16", "value" : 7, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Float16Buffer", "value" : 8, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Float16", - "value" : 9 + "value" : 9, + "version" : "1.0" }, { "enumerant" : "Float64", - "value" : 10 + "value" : 10, + "version" : "1.0" }, { "enumerant" : "Int64", - "value" : 11 + "value" : 11, + "version" : "1.0" }, { "enumerant" : "Int64Atomics", "value" : 12, - "capabilities" : [ "Int64" ] + "capabilities" : [ "Int64" ], + "version": "1.0" }, { "enumerant" : "ImageBasic", "value" : 13, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "ImageReadWrite", "value" : 14, - "capabilities" : [ "ImageBasic" ] + "capabilities" : [ "ImageBasic" ], + "version": "1.0" }, { "enumerant" : "ImageMipmap", "value" : 15, - "capabilities" : [ "ImageBasic" ] + "capabilities" : [ "ImageBasic" ], + "version": "1.0" }, { "enumerant" : "Pipes", "value" : 17, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "Groups", "value" : 18, - "extensions" : [ "SPV_AMD_shader_ballot" ] + "extensions" : [ "SPV_AMD_shader_ballot" ], + "version": "1.0" }, { "enumerant" : "DeviceEnqueue", "value" : 19, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "LiteralSampler", "value" : 20, - "capabilities" : [ "Kernel" ] + "capabilities" : [ "Kernel" ], + "version": "1.0" }, { "enumerant" : "AtomicStorage", "value" : 21, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Int16", - "value" : 22 + "value" : 22, + "version" : "1.0" }, { "enumerant" : "TessellationPointSize", "value" : 23, - "capabilities" : [ "Tessellation" ] + "capabilities" : [ "Tessellation" ], + "version": "1.0" }, { "enumerant" : "GeometryPointSize", "value" : 24, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "enumerant" : "ImageGatherExtended", "value" : 25, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "StorageImageMultisample", "value" : 27, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "UniformBufferArrayDynamicIndexing", "value" : 28, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "SampledImageArrayDynamicIndexing", "value" : 29, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "StorageBufferArrayDynamicIndexing", "value" : 30, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "StorageImageArrayDynamicIndexing", "value" : 31, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "ClipDistance", "value" : 32, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "CullDistance", "value" : 33, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "ImageCubeArray", "value" : 34, - "capabilities" : [ "SampledCubeArray" ] + "capabilities" : [ "SampledCubeArray" ], + "version": "1.0" }, { "enumerant" : "SampleRateShading", "value" : 35, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "ImageRect", "value" : 36, - "capabilities" : [ "SampledRect" ] + "capabilities" : [ "SampledRect" ], + "version": "1.0" }, { "enumerant" : "SampledRect", "value" : 37, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "GenericPointer", "value" : 38, - "capabilities" : [ "Addresses" ] + "capabilities" : [ "Addresses" ], + "version": "1.0" }, { "enumerant" : "Int8", - "value" : 39 + "value" : 39, + "version" : "1.0" }, { "enumerant" : "InputAttachment", "value" : 40, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "SparseResidency", "value" : 41, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "MinLod", "value" : 42, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "Sampled1D", - "value" : 43 + "value" : 43, + "version" : "1.0" }, { "enumerant" : "Image1D", "value" : 44, - "capabilities" : [ "Sampled1D" ] + "capabilities" : [ "Sampled1D" ], + "version": "1.0" }, { "enumerant" : "SampledCubeArray", "value" : 45, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "SampledBuffer", - "value" : 46 + "value" : 46, + "version" : "1.0" }, { "enumerant" : "ImageBuffer", "value" : 47, - "capabilities" : [ "SampledBuffer" ] + "capabilities" : [ "SampledBuffer" ], + "version": "1.0" }, { "enumerant" : "ImageMSArray", "value" : 48, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "StorageImageExtendedFormats", "value" : 49, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "ImageQuery", "value" : 50, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "DerivativeControl", "value" : 51, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "InterpolationFunction", "value" : 52, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "TransformFeedback", "value" : 53, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "GeometryStreams", "value" : 54, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "enumerant" : "StorageImageReadWithoutFormat", "value" : 55, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "StorageImageWriteWithoutFormat", "value" : 56, - "capabilities" : [ "Shader" ] + "capabilities" : [ "Shader" ], + "version": "1.0" }, { "enumerant" : "MultiViewport", "value" : 57, - "capabilities" : [ "Geometry" ] + "capabilities" : [ "Geometry" ], + "version": "1.0" }, { "enumerant" : "SubgroupDispatch", @@ -13271,7 +15058,26 @@ { "enumerant" : "CoreBuiltinsARM", "value" : 4165, - "extensions" : [ "SPV_ARM_core_builtins" ] + "extensions" : [ "SPV_ARM_core_builtins" ], + "version": "None" + }, + { + "enumerant" : "TileImageColorReadAccessEXT", + "value" : 4166, + "extensions" : [ "SPV_EXT_shader_tile_image" ], + "version" : "None" + }, + { + "enumerant" : "TileImageDepthReadAccessEXT", + "value" : 4167, + "extensions" : [ "SPV_EXT_shader_tile_image" ], + "version" : "None" + }, + { + "enumerant" : "TileImageStencilReadAccessEXT", + "value" : 4168, + "extensions" : [ "SPV_EXT_shader_tile_image" ], + "version" : "None" }, { "enumerant" : "FragmentShadingRateKHR", @@ -13480,6 +15286,24 @@ "extensions" : [ "SPV_KHR_ray_tracing" ], "version" : "None" }, + { + "enumerant" : "TextureSampleWeightedQCOM", + "value" : 4484, + "extensions" : [ "SPV_QCOM_image_processing" ], + "version" : "None" + }, + { + "enumerant" : "TextureBoxFilterQCOM", + "value" : 4485, + "extensions" : [ "SPV_QCOM_image_processing" ], + "version" : "None" + }, + { + "enumerant" : "TextureBlockMatchQCOM", + "value" : 4486, + "extensions" : [ "SPV_QCOM_image_processing" ], + "version" : "None" + }, { "enumerant" : "Float16ImageAMD", "value" : 5008, @@ -13525,10 +15349,16 @@ { "enumerant" : "ShaderClockKHR", "value" : 5055, - "capabilities" : [ "Shader" ], "extensions" : [ "SPV_KHR_shader_clock" ], "version" : "None" }, + { + "enumerant" : "ShaderEnqueueAMDX", + "value" : 5067, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMDX_shader_enqueue" ], + "version" : "None" + }, { "enumerant" : "SampleMaskOverrideCoverageNV", "value" : 5249, @@ -13799,6 +15629,13 @@ "extensions" : [ "SPV_EXT_descriptor_indexing" ], "version" : "1.5" }, + { + "enumerant" : "RayTracingPositionFetchKHR", + "value" : 5336, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_ray_tracing_position_fetch" ], + "version" : "None" + }, { "enumerant" : "RayTracingNV", "value" : 5340, @@ -13910,12 +15747,33 @@ "extensions" : [ "SPV_EXT_demote_to_helper_invocation" ], "version" : "1.6" }, + { + "enumerant" : "RayTracingOpacityMicromapEXT", + "value" : 5381, + "capabilities" : [ "RayQueryKHR","RayTracingKHR" ], + "extensions" : [ "SPV_EXT_opacity_micromap" ], + "version" : "None" + }, + { + "enumerant" : "ShaderInvocationReorderNV", + "value" : 5383, + "capabilities" : [ "RayTracingKHR" ], + "extensions" : [ "SPV_NV_shader_invocation_reorder" ], + "version" : "None" + }, { "enumerant" : "BindlessTextureNV", "value" : 5390, "extensions" : [ "SPV_NV_bindless_texture" ], "version" : "None" }, + { + "enumerant" : "RayQueryPositionFetchKHR", + "value" : 5391, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_ray_tracing_position_fetch" ], + "version" : "None" + }, { "enumerant" : "SubgroupShuffleINTEL", "value" : 5568, @@ -14111,12 +15969,24 @@ "extensions" : [ "SPV_INTEL_loop_fuse" ], "version" : "None" }, + { + "enumerant" : "FPGADSPControlINTEL", + "value" : 5908, + "extensions" : [ "SPV_INTEL_fpga_dsp_control" ], + "version" : "None" + }, { "enumerant" : "MemoryAccessAliasingINTEL", "value" : 5910, "extensions" : [ "SPV_INTEL_memory_access_aliasing" ], "version" : "None" }, + { + "enumerant" : "FPGAInvocationPipeliningAttributesINTEL", + "value" : 5916, + "extensions" : [ "SPV_INTEL_fpga_invocation_pipelining_attributes" ], + "version" : "None" + }, { "enumerant" : "FPGABufferLocationINTEL", "value" : 5920, @@ -14135,6 +16005,12 @@ "extensions" : [ "SPV_INTEL_usm_storage_classes" ], "version" : "None" }, + { + "enumerant" : "RuntimeAlignedAttributeINTEL", + "value" : 5939, + "extensions" : [ "SPV_INTEL_runtime_aligned" ], + "version" : "None" + }, { "enumerant" : "IOPipesINTEL", "value" : 5943, @@ -14205,6 +16081,12 @@ "extensions" : [ "SPV_KHR_ray_cull_mask" ], "version" : "None" }, + { + "enumerant" : "CooperativeMatrixKHR", + "value" : 6022, + "extensions" : [ "SPV_KHR_cooperative_matrix" ], + "version" : "None" + }, { "enumerant" : "BitInstructions", "value" : 6025, @@ -14254,12 +16136,55 @@ "extensions" : [ "SPV_INTEL_debug_module" ], "version" : "None" }, + { + "enumerant" : "BFloat16ConversionINTEL", + "value" : 6115, + "extensions" : [ "SPV_INTEL_bfloat16_conversion" ], + "version" : "None" + }, { "enumerant" : "SplitBarrierINTEL", "value" : 6141, "extensions" : [ "SPV_INTEL_split_barrier" ], "version" : "None" }, + { + "enumerant" : "GlobalVariableFPGADecorationsINTEL", + "value" : 6146, + "extensions": [ "SPV_INTEL_global_variable_fpga_decorations" ], + "version" : "None" + }, + { + "enumerant" : "FPGAKernelAttributesv2INTEL", + "value" : 6161, + "capabilities" : [ "FPGAKernelAttributesINTEL" ], + "extensions" : [ "SPV_INTEL_kernel_attributes" ], + "version" : "None" + }, + { + "enumerant" : "GlobalVariableHostAccessINTEL", + "value" : 6167, + "extensions": [ "SPV_INTEL_global_variable_host_access" ], + "version" : "None" + }, + { + "enumerant" : "FPMaxErrorINTEL", + "value" : 6169, + "extensions" : [ "SPV_INTEL_fp_max_error" ], + "version" : "None" + }, + { + "enumerant" : "FPGALatencyControlINTEL", + "value" : 6171, + "extensions" : [ "SPV_INTEL_fpga_latency_control" ], + "version" : "None" + }, + { + "enumerant" : "FPGAArgumentInterfacesINTEL", + "value" : 6174, + "extensions" : [ "SPV_INTEL_fpga_argument_interfaces" ], + "version" : "None" + }, { "enumerant" : "GroupUniformArithmeticKHR", "value" : 6400, @@ -14345,6 +16270,97 @@ } ] }, + { + "category" : "BitEnum", + "kind" : "CooperativeMatrixOperands", + "enumerants" : [ + { + "enumerant" : "NoneKHR", + "value" : "0x0000", + "version" : "None" + }, + { + "enumerant" : "MatrixASignedComponentsKHR", + "value" : "0x0001", + "version" : "None" + }, + { + "enumerant" : "MatrixBSignedComponentsKHR", + "value" : "0x0002", + "version" : "None" + }, + { + "enumerant" : "MatrixCSignedComponentsKHR", + "value" : "0x0004", + "version" : "None" + }, + { + "enumerant" : "MatrixResultSignedComponentsKHR", + "value" : "0x0008", + "version" : "None" + }, + { + "enumerant" : "SaturatingAccumulationKHR", + "value" : "0x0010", + "version" : "None" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "CooperativeMatrixLayout", + "enumerants" : [ + { + "enumerant" : "RowMajorKHR", + "value" : 0, + "version" : "None" + }, + { + "enumerant" : "ColumnMajorKHR", + "value" : 1, + "version" : "None" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "CooperativeMatrixUse", + "enumerants" : [ + { + "enumerant" : "MatrixAKHR", + "value" : 0, + "version" : "None" + }, + { + "enumerant" : "MatrixBKHR", + "value" : 1, + "version" : "None" + }, + { + "enumerant" : "MatrixAccumulatorKHR", + "value" : 2, + "version" : "None" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "InitializationModeQualifier", + "enumerants" : [ + { + "enumerant" : "InitOnDeviceReprogramINTEL", + "value" : 0, + "capabilities" : [ "GlobalVariableFPGADecorationsINTEL" ], + "version" : "None" + }, + { + "enumerant" : "InitOnDeviceResetINTEL", + "value" : 1, + "capabilities" : [ "GlobalVariableFPGADecorationsINTEL" ], + "version" : "None" + } + ] + }, { "category" : "Id", "kind" : "IdResultType", diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.h b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.h index c3b1b3b4..d3813406 100644 --- a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.h +++ b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.h @@ -73,6 +73,9 @@ typedef enum SpvSourceLanguage_ { SpvSourceLanguageHLSL = 5, SpvSourceLanguageCPP_for_OpenCL = 6, SpvSourceLanguageSYCL = 7, + SpvSourceLanguageHERO_C = 8, + SpvSourceLanguageNZSL = 9, + SpvSourceLanguageWGSL = 10, SpvSourceLanguageMax = 0x7fffffff, } SpvSourceLanguage; @@ -160,6 +163,9 @@ typedef enum SpvExecutionMode_ { SpvExecutionModeSubgroupsPerWorkgroupId = 37, SpvExecutionModeLocalSizeId = 38, SpvExecutionModeLocalSizeHintId = 39, + SpvExecutionModeNonCoherentColorAttachmentReadEXT = 4169, + SpvExecutionModeNonCoherentDepthAttachmentReadEXT = 4170, + SpvExecutionModeNonCoherentStencilAttachmentReadEXT = 4171, SpvExecutionModeSubgroupUniformControlFlowKHR = 4421, SpvExecutionModePostDepthCoverage = 4446, SpvExecutionModeDenormPreserve = 4459, @@ -169,6 +175,11 @@ typedef enum SpvExecutionMode_ { SpvExecutionModeRoundingModeRTZ = 4463, SpvExecutionModeEarlyAndLateFragmentTestsAMD = 5017, SpvExecutionModeStencilRefReplacingEXT = 5027, + SpvExecutionModeCoalescingAMDX = 5069, + SpvExecutionModeMaxNodeRecursionAMDX = 5071, + SpvExecutionModeStaticNumWorkgroupsAMDX = 5072, + SpvExecutionModeShaderIndexAMDX = 5073, + SpvExecutionModeMaxNumWorkgroupsAMDX = 5077, SpvExecutionModeStencilRefUnchangedFrontAMD = 5079, SpvExecutionModeStencilRefGreaterFrontAMD = 5080, SpvExecutionModeStencilRefLessFrontAMD = 5081, @@ -199,6 +210,8 @@ typedef enum SpvExecutionMode_ { SpvExecutionModeNoGlobalOffsetINTEL = 5895, SpvExecutionModeNumSIMDWorkitemsINTEL = 5896, SpvExecutionModeSchedulerTargetFmaxMhzINTEL = 5903, + SpvExecutionModeStreamingInterfaceINTEL = 6154, + SpvExecutionModeRegisterMapInterfaceINTEL = 6160, SpvExecutionModeNamedBarrierCountINTEL = 6417, SpvExecutionModeMax = 0x7fffffff, } SpvExecutionMode; @@ -217,6 +230,9 @@ typedef enum SpvStorageClass_ { SpvStorageClassAtomicCounter = 10, SpvStorageClassImage = 11, SpvStorageClassStorageBuffer = 12, + SpvStorageClassTileImageEXT = 4172, + SpvStorageClassNodePayloadAMDX = 5068, + SpvStorageClassNodeOutputPayloadAMDX = 5076, SpvStorageClassCallableDataKHR = 5328, SpvStorageClassCallableDataNV = 5328, SpvStorageClassIncomingCallableDataKHR = 5329, @@ -231,6 +247,7 @@ typedef enum SpvStorageClass_ { SpvStorageClassShaderRecordBufferNV = 5343, SpvStorageClassPhysicalStorageBuffer = 5349, SpvStorageClassPhysicalStorageBufferEXT = 5349, + SpvStorageClassHitObjectAttributeNV = 5385, SpvStorageClassTaskPayloadWorkgroupEXT = 5402, SpvStorageClassCodeSectionINTEL = 5605, SpvStorageClassDeviceOnlyINTEL = 5936, @@ -246,6 +263,7 @@ typedef enum SpvDim_ { SpvDimRect = 4, SpvDimBuffer = 5, SpvDimSubpassData = 6, + SpvDimTileImageDataEXT = 4173, SpvDimMax = 0x7fffffff, } SpvDim; @@ -352,6 +370,8 @@ typedef enum SpvImageChannelDataType_ { SpvImageChannelDataTypeFloat = 14, SpvImageChannelDataTypeUnormInt24 = 15, SpvImageChannelDataTypeUnormInt101010_2 = 16, + SpvImageChannelDataTypeUnsignedIntRaw10EXT = 19, + SpvImageChannelDataTypeUnsignedIntRaw12EXT = 20, SpvImageChannelDataTypeMax = 0x7fffffff, } SpvImageChannelDataType; @@ -456,6 +476,7 @@ typedef enum SpvFunctionParameterAttribute_ { SpvFunctionParameterAttributeNoCapture = 5, SpvFunctionParameterAttributeNoWrite = 6, SpvFunctionParameterAttributeNoReadWrite = 7, + SpvFunctionParameterAttributeRuntimeAlignedINTEL = 5940, SpvFunctionParameterAttributeMax = 0x7fffffff, } SpvFunctionParameterAttribute; @@ -509,7 +530,13 @@ typedef enum SpvDecoration_ { SpvDecorationMaxByteOffsetId = 47, SpvDecorationNoSignedWrap = 4469, SpvDecorationNoUnsignedWrap = 4470, + SpvDecorationWeightTextureQCOM = 4487, + SpvDecorationBlockMatchTextureQCOM = 4488, SpvDecorationExplicitInterpAMD = 4999, + SpvDecorationNodeSharesPayloadLimitsWithAMDX = 5019, + SpvDecorationNodeMaxPayloadsAMDX = 5020, + SpvDecorationTrackFinishWritingAMDX = 5078, + SpvDecorationPayloadNodeNameAMDX = 5091, SpvDecorationOverrideCoverageNV = 5248, SpvDecorationPassthroughNV = 5250, SpvDecorationViewportRelativeNV = 5252, @@ -526,6 +553,7 @@ typedef enum SpvDecoration_ { SpvDecorationRestrictPointerEXT = 5355, SpvDecorationAliasedPointer = 5356, SpvDecorationAliasedPointerEXT = 5356, + SpvDecorationHitObjectShaderRecordBufferNV = 5386, SpvDecorationBindlessSamplerNV = 5398, SpvDecorationBindlessImageNV = 5399, SpvDecorationBoundSamplerNV = 5400, @@ -564,14 +592,33 @@ typedef enum SpvDecoration_ { SpvDecorationPrefetchINTEL = 5902, SpvDecorationStallEnableINTEL = 5905, SpvDecorationFuseLoopsInFunctionINTEL = 5907, + SpvDecorationMathOpDSPModeINTEL = 5909, SpvDecorationAliasScopeINTEL = 5914, SpvDecorationNoAliasINTEL = 5915, + SpvDecorationInitiationIntervalINTEL = 5917, + SpvDecorationMaxConcurrencyINTEL = 5918, + SpvDecorationPipelineEnableINTEL = 5919, SpvDecorationBufferLocationINTEL = 5921, SpvDecorationIOPipeStorageINTEL = 5944, SpvDecorationFunctionFloatingPointModeINTEL = 6080, SpvDecorationSingleElementVectorINTEL = 6085, SpvDecorationVectorComputeCallableFunctionINTEL = 6087, SpvDecorationMediaBlockIOINTEL = 6140, + SpvDecorationInitModeINTEL = 6147, + SpvDecorationImplementInRegisterMapINTEL = 6148, + SpvDecorationHostAccessINTEL = 6168, + SpvDecorationFPMaxErrorDecorationINTEL = 6170, + SpvDecorationLatencyControlLabelINTEL = 6172, + SpvDecorationLatencyControlConstraintINTEL = 6173, + SpvDecorationConduitKernelArgumentINTEL = 6175, + SpvDecorationRegisterMapKernelArgumentINTEL = 6176, + SpvDecorationMMHostInterfaceAddressWidthINTEL = 6177, + SpvDecorationMMHostInterfaceDataWidthINTEL = 6178, + SpvDecorationMMHostInterfaceLatencyINTEL = 6179, + SpvDecorationMMHostInterfaceReadWriteModeINTEL = 6180, + SpvDecorationMMHostInterfaceMaxBurstINTEL = 6181, + SpvDecorationMMHostInterfaceWaitRequestINTEL = 6182, + SpvDecorationStableKernelArgumentINTEL = 6183, SpvDecorationMax = 0x7fffffff, } SpvDecoration; @@ -647,6 +694,8 @@ typedef enum SpvBuiltIn_ { SpvBuiltInBaryCoordSmoothSampleAMD = 4997, SpvBuiltInBaryCoordPullModelAMD = 4998, SpvBuiltInFragStencilRefEXT = 5014, + SpvBuiltInCoalescedInputCountAMDX = 5021, + SpvBuiltInShaderIndexAMDX = 5073, SpvBuiltInViewportMaskNV = 5253, SpvBuiltInSecondaryPositionNV = 5257, SpvBuiltInSecondaryViewportMaskNV = 5258, @@ -699,6 +748,7 @@ typedef enum SpvBuiltIn_ { SpvBuiltInHitKindKHR = 5333, SpvBuiltInHitKindNV = 5333, SpvBuiltInCurrentRayTimeNV = 5334, + SpvBuiltInHitTriangleVertexPositionsKHR = 5335, SpvBuiltInIncomingRayFlagsKHR = 5351, SpvBuiltInIncomingRayFlagsNV = 5351, SpvBuiltInRayGeometryIndexKHR = 5352, @@ -740,6 +790,8 @@ typedef enum SpvLoopControlShift_ { SpvLoopControlMaxInterleavingINTELShift = 21, SpvLoopControlSpeculatedIterationsINTELShift = 22, SpvLoopControlNoFusionINTELShift = 23, + SpvLoopControlLoopCountINTELShift = 24, + SpvLoopControlMaxReinvocationDelayINTELShift = 25, SpvLoopControlMax = 0x7fffffff, } SpvLoopControlShift; @@ -762,6 +814,8 @@ typedef enum SpvLoopControlMask_ { SpvLoopControlMaxInterleavingINTELMask = 0x00200000, SpvLoopControlSpeculatedIterationsINTELMask = 0x00400000, SpvLoopControlNoFusionINTELMask = 0x00800000, + SpvLoopControlLoopCountINTELMask = 0x01000000, + SpvLoopControlMaxReinvocationDelayINTELMask = 0x02000000, } SpvLoopControlMask; typedef enum SpvFunctionControlShift_ { @@ -966,6 +1020,9 @@ typedef enum SpvCapability_ { SpvCapabilityShaderViewportIndex = 70, SpvCapabilityUniformDecoration = 71, SpvCapabilityCoreBuiltinsARM = 4165, + SpvCapabilityTileImageColorReadAccessEXT = 4166, + SpvCapabilityTileImageDepthReadAccessEXT = 4167, + SpvCapabilityTileImageStencilReadAccessEXT = 4168, SpvCapabilityFragmentShadingRateKHR = 4422, SpvCapabilitySubgroupBallotKHR = 4423, SpvCapabilityDrawParameters = 4427, @@ -997,6 +1054,9 @@ typedef enum SpvCapability_ { SpvCapabilityRayQueryKHR = 4472, SpvCapabilityRayTraversalPrimitiveCullingKHR = 4478, SpvCapabilityRayTracingKHR = 4479, + SpvCapabilityTextureSampleWeightedQCOM = 4484, + SpvCapabilityTextureBoxFilterQCOM = 4485, + SpvCapabilityTextureBlockMatchQCOM = 4486, SpvCapabilityFloat16ImageAMD = 5008, SpvCapabilityImageGatherBiasLodAMD = 5009, SpvCapabilityFragmentMaskAMD = 5010, @@ -1004,6 +1064,7 @@ typedef enum SpvCapability_ { SpvCapabilityImageReadWriteLodAMD = 5015, SpvCapabilityInt64ImageEXT = 5016, SpvCapabilityShaderClockKHR = 5055, + SpvCapabilityShaderEnqueueAMDX = 5067, SpvCapabilitySampleMaskOverrideCoverageNV = 5249, SpvCapabilityGeometryShaderPassthroughNV = 5251, SpvCapabilityShaderViewportIndexLayerEXT = 5254, @@ -1045,6 +1106,7 @@ typedef enum SpvCapability_ { SpvCapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311, SpvCapabilityStorageTexelBufferArrayNonUniformIndexing = 5312, SpvCapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312, + SpvCapabilityRayTracingPositionFetchKHR = 5336, SpvCapabilityRayTracingNV = 5340, SpvCapabilityRayTracingMotionBlurNV = 5341, SpvCapabilityVulkanMemoryModel = 5345, @@ -1062,7 +1124,10 @@ typedef enum SpvCapability_ { SpvCapabilityFragmentShaderPixelInterlockEXT = 5378, SpvCapabilityDemoteToHelperInvocation = 5379, SpvCapabilityDemoteToHelperInvocationEXT = 5379, + SpvCapabilityRayTracingOpacityMicromapEXT = 5381, + SpvCapabilityShaderInvocationReorderNV = 5383, SpvCapabilityBindlessTextureNV = 5390, + SpvCapabilityRayQueryPositionFetchKHR = 5391, SpvCapabilitySubgroupShuffleINTEL = 5568, SpvCapabilitySubgroupBufferBlockIOINTEL = 5569, SpvCapabilitySubgroupImageBlockIOINTEL = 5570, @@ -1095,10 +1160,13 @@ typedef enum SpvCapability_ { SpvCapabilityFPGAMemoryAccessesINTEL = 5898, SpvCapabilityFPGAClusterAttributesINTEL = 5904, SpvCapabilityLoopFuseINTEL = 5906, + SpvCapabilityFPGADSPControlINTEL = 5908, SpvCapabilityMemoryAccessAliasingINTEL = 5910, + SpvCapabilityFPGAInvocationPipeliningAttributesINTEL = 5916, SpvCapabilityFPGABufferLocationINTEL = 5920, SpvCapabilityArbitraryPrecisionFixedPointINTEL = 5922, SpvCapabilityUSMStorageClassesINTEL = 5935, + SpvCapabilityRuntimeAlignedAttributeINTEL = 5939, SpvCapabilityIOPipesINTEL = 5943, SpvCapabilityBlockingPipesINTEL = 5945, SpvCapabilityFPGARegINTEL = 5948, @@ -1111,6 +1179,7 @@ typedef enum SpvCapability_ { SpvCapabilityDotProduct = 6019, SpvCapabilityDotProductKHR = 6019, SpvCapabilityRayCullMaskKHR = 6020, + SpvCapabilityCooperativeMatrixKHR = 6022, SpvCapabilityBitInstructions = 6025, SpvCapabilityGroupNonUniformRotateKHR = 6026, SpvCapabilityAtomicFloat32AddEXT = 6033, @@ -1119,7 +1188,14 @@ typedef enum SpvCapability_ { SpvCapabilityOptNoneINTEL = 6094, SpvCapabilityAtomicFloat16AddEXT = 6095, SpvCapabilityDebugInfoModuleINTEL = 6114, + SpvCapabilityBFloat16ConversionINTEL = 6115, SpvCapabilitySplitBarrierINTEL = 6141, + SpvCapabilityGlobalVariableFPGADecorationsINTEL = 6146, + SpvCapabilityFPGAKernelAttributesv2INTEL = 6161, + SpvCapabilityGlobalVariableHostAccessINTEL = 6167, + SpvCapabilityFPMaxErrorINTEL = 6169, + SpvCapabilityFPGALatencyControlINTEL = 6171, + SpvCapabilityFPGAArgumentInterfacesINTEL = 6174, SpvCapabilityGroupUniformArithmeticKHR = 6400, SpvCapabilityMax = 0x7fffffff, } SpvCapability; @@ -1135,6 +1211,7 @@ typedef enum SpvRayFlagsShift_ { SpvRayFlagsCullNoOpaqueKHRShift = 7, SpvRayFlagsSkipTrianglesKHRShift = 8, SpvRayFlagsSkipAABBsKHRShift = 9, + SpvRayFlagsForceOpacityMicromap2StateEXTShift = 10, SpvRayFlagsMax = 0x7fffffff, } SpvRayFlagsShift; @@ -1150,6 +1227,7 @@ typedef enum SpvRayFlagsMask_ { SpvRayFlagsCullNoOpaqueKHRMask = 0x00000080, SpvRayFlagsSkipTrianglesKHRMask = 0x00000100, SpvRayFlagsSkipAABBsKHRMask = 0x00000200, + SpvRayFlagsForceOpacityMicromap2StateEXTMask = 0x00000400, } SpvRayFlagsMask; typedef enum SpvRayQueryIntersection_ { @@ -1225,6 +1303,51 @@ typedef enum SpvPackedVectorFormat_ { SpvPackedVectorFormatMax = 0x7fffffff, } SpvPackedVectorFormat; +typedef enum SpvCooperativeMatrixOperandsShift_ { + SpvCooperativeMatrixOperandsMatrixASignedComponentsKHRShift = 0, + SpvCooperativeMatrixOperandsMatrixBSignedComponentsKHRShift = 1, + SpvCooperativeMatrixOperandsMatrixCSignedComponentsKHRShift = 2, + SpvCooperativeMatrixOperandsMatrixResultSignedComponentsKHRShift = 3, + SpvCooperativeMatrixOperandsSaturatingAccumulationKHRShift = 4, + SpvCooperativeMatrixOperandsMax = 0x7fffffff, +} SpvCooperativeMatrixOperandsShift; + +typedef enum SpvCooperativeMatrixOperandsMask_ { + SpvCooperativeMatrixOperandsMaskNone = 0, + SpvCooperativeMatrixOperandsMatrixASignedComponentsKHRMask = 0x00000001, + SpvCooperativeMatrixOperandsMatrixBSignedComponentsKHRMask = 0x00000002, + SpvCooperativeMatrixOperandsMatrixCSignedComponentsKHRMask = 0x00000004, + SpvCooperativeMatrixOperandsMatrixResultSignedComponentsKHRMask = 0x00000008, + SpvCooperativeMatrixOperandsSaturatingAccumulationKHRMask = 0x00000010, +} SpvCooperativeMatrixOperandsMask; + +typedef enum SpvCooperativeMatrixLayout_ { + SpvCooperativeMatrixLayoutRowMajorKHR = 0, + SpvCooperativeMatrixLayoutColumnMajorKHR = 1, + SpvCooperativeMatrixLayoutMax = 0x7fffffff, +} SpvCooperativeMatrixLayout; + +typedef enum SpvCooperativeMatrixUse_ { + SpvCooperativeMatrixUseMatrixAKHR = 0, + SpvCooperativeMatrixUseMatrixBKHR = 1, + SpvCooperativeMatrixUseMatrixAccumulatorKHR = 2, + SpvCooperativeMatrixUseMax = 0x7fffffff, +} SpvCooperativeMatrixUse; + +typedef enum SpvInitializationModeQualifier_ { + SpvInitializationModeQualifierInitOnDeviceReprogramINTEL = 0, + SpvInitializationModeQualifierInitOnDeviceResetINTEL = 1, + SpvInitializationModeQualifierMax = 0x7fffffff, +} SpvInitializationModeQualifier; + +typedef enum SpvHostAccessQualifier_ { + SpvHostAccessQualifierNoneINTEL = 0, + SpvHostAccessQualifierReadINTEL = 1, + SpvHostAccessQualifierWriteINTEL = 2, + SpvHostAccessQualifierReadWriteINTEL = 3, + SpvHostAccessQualifierMax = 0x7fffffff, +} SpvHostAccessQualifier; + typedef enum SpvOp_ { SpvOpNop = 0, SpvOpUndef = 1, @@ -1570,6 +1693,9 @@ typedef enum SpvOp_ { SpvOpPtrEqual = 401, SpvOpPtrNotEqual = 402, SpvOpPtrDiff = 403, + SpvOpColorAttachmentReadEXT = 4160, + SpvOpDepthAttachmentReadEXT = 4161, + SpvOpStencilAttachmentReadEXT = 4162, SpvOpTerminateInvocation = 4416, SpvOpSubgroupBallotKHR = 4421, SpvOpSubgroupFirstInvocationKHR = 4422, @@ -1595,6 +1721,11 @@ typedef enum SpvOp_ { SpvOpUDotAccSatKHR = 4454, SpvOpSUDotAccSat = 4455, SpvOpSUDotAccSatKHR = 4455, + SpvOpTypeCooperativeMatrixKHR = 4456, + SpvOpCooperativeMatrixLoadKHR = 4457, + SpvOpCooperativeMatrixStoreKHR = 4458, + SpvOpCooperativeMatrixMulAddKHR = 4459, + SpvOpCooperativeMatrixLengthKHR = 4460, SpvOpTypeRayQueryKHR = 4472, SpvOpRayQueryInitializeKHR = 4473, SpvOpRayQueryTerminateKHR = 4474, @@ -1602,6 +1733,10 @@ typedef enum SpvOp_ { SpvOpRayQueryConfirmIntersectionKHR = 4476, SpvOpRayQueryProceedKHR = 4477, SpvOpRayQueryGetIntersectionTypeKHR = 4479, + SpvOpImageSampleWeightedQCOM = 4480, + SpvOpImageBoxFilterQCOM = 4481, + SpvOpImageBlockMatchSSDQCOM = 4482, + SpvOpImageBlockMatchSADQCOM = 4483, SpvOpGroupIAddNonUniformAMD = 5000, SpvOpGroupFAddNonUniformAMD = 5001, SpvOpGroupFMinNonUniformAMD = 5002, @@ -1613,6 +1748,42 @@ typedef enum SpvOp_ { SpvOpFragmentMaskFetchAMD = 5011, SpvOpFragmentFetchAMD = 5012, SpvOpReadClockKHR = 5056, + SpvOpFinalizeNodePayloadsAMDX = 5075, + SpvOpFinishWritingNodePayloadAMDX = 5078, + SpvOpInitializeNodePayloadsAMDX = 5090, + SpvOpHitObjectRecordHitMotionNV = 5249, + SpvOpHitObjectRecordHitWithIndexMotionNV = 5250, + SpvOpHitObjectRecordMissMotionNV = 5251, + SpvOpHitObjectGetWorldToObjectNV = 5252, + SpvOpHitObjectGetObjectToWorldNV = 5253, + SpvOpHitObjectGetObjectRayDirectionNV = 5254, + SpvOpHitObjectGetObjectRayOriginNV = 5255, + SpvOpHitObjectTraceRayMotionNV = 5256, + SpvOpHitObjectGetShaderRecordBufferHandleNV = 5257, + SpvOpHitObjectGetShaderBindingTableRecordIndexNV = 5258, + SpvOpHitObjectRecordEmptyNV = 5259, + SpvOpHitObjectTraceRayNV = 5260, + SpvOpHitObjectRecordHitNV = 5261, + SpvOpHitObjectRecordHitWithIndexNV = 5262, + SpvOpHitObjectRecordMissNV = 5263, + SpvOpHitObjectExecuteShaderNV = 5264, + SpvOpHitObjectGetCurrentTimeNV = 5265, + SpvOpHitObjectGetAttributesNV = 5266, + SpvOpHitObjectGetHitKindNV = 5267, + SpvOpHitObjectGetPrimitiveIndexNV = 5268, + SpvOpHitObjectGetGeometryIndexNV = 5269, + SpvOpHitObjectGetInstanceIdNV = 5270, + SpvOpHitObjectGetInstanceCustomIndexNV = 5271, + SpvOpHitObjectGetWorldRayDirectionNV = 5272, + SpvOpHitObjectGetWorldRayOriginNV = 5273, + SpvOpHitObjectGetRayTMaxNV = 5274, + SpvOpHitObjectGetRayTMinNV = 5275, + SpvOpHitObjectIsEmptyNV = 5276, + SpvOpHitObjectIsHitNV = 5277, + SpvOpHitObjectIsMissNV = 5278, + SpvOpReorderThreadWithHitObjectNV = 5279, + SpvOpReorderThreadWithHintNV = 5280, + SpvOpTypeHitObjectNV = 5281, SpvOpImageSampleFootprintNV = 5283, SpvOpEmitMeshTasksEXT = 5294, SpvOpSetMeshOutputsEXT = 5295, @@ -1625,6 +1796,7 @@ typedef enum SpvOp_ { SpvOpTraceNV = 5337, SpvOpTraceMotionNV = 5338, SpvOpTraceRayMotionNV = 5339, + SpvOpRayQueryGetIntersectionTriangleVertexPositionsKHR = 5340, SpvOpTypeAccelerationStructureKHR = 5341, SpvOpTypeAccelerationStructureNV = 5341, SpvOpExecuteCallableNV = 5344, @@ -1886,6 +2058,8 @@ typedef enum SpvOp_ { SpvOpTypeStructContinuedINTEL = 6090, SpvOpConstantCompositeContinuedINTEL = 6091, SpvOpSpecConstantCompositeContinuedINTEL = 6092, + SpvOpConvertFToBF16INTEL = 6116, + SpvOpConvertBF16ToFINTEL = 6117, SpvOpControlBarrierArriveINTEL = 6142, SpvOpControlBarrierWaitINTEL = 6143, SpvOpGroupIMulKHR = 6401, @@ -2251,6 +2425,9 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpPtrEqual: *hasResult = true; *hasResultType = true; break; case SpvOpPtrNotEqual: *hasResult = true; *hasResultType = true; break; case SpvOpPtrDiff: *hasResult = true; *hasResultType = true; break; + case SpvOpColorAttachmentReadEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpDepthAttachmentReadEXT: *hasResult = true; *hasResultType = true; break; + case SpvOpStencilAttachmentReadEXT: *hasResult = true; *hasResultType = true; break; case SpvOpTerminateInvocation: *hasResult = false; *hasResultType = false; break; case SpvOpSubgroupBallotKHR: *hasResult = true; *hasResultType = true; break; case SpvOpSubgroupFirstInvocationKHR: *hasResult = true; *hasResultType = true; break; @@ -2270,6 +2447,11 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpSDotAccSat: *hasResult = true; *hasResultType = true; break; case SpvOpUDotAccSat: *hasResult = true; *hasResultType = true; break; case SpvOpSUDotAccSat: *hasResult = true; *hasResultType = true; break; + case SpvOpTypeCooperativeMatrixKHR: *hasResult = true; *hasResultType = false; break; + case SpvOpCooperativeMatrixLoadKHR: *hasResult = true; *hasResultType = true; break; + case SpvOpCooperativeMatrixStoreKHR: *hasResult = false; *hasResultType = false; break; + case SpvOpCooperativeMatrixMulAddKHR: *hasResult = true; *hasResultType = true; break; + case SpvOpCooperativeMatrixLengthKHR: *hasResult = true; *hasResultType = true; break; case SpvOpTypeRayQueryKHR: *hasResult = true; *hasResultType = false; break; case SpvOpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break; case SpvOpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break; @@ -2277,6 +2459,10 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpRayQueryConfirmIntersectionKHR: *hasResult = false; *hasResultType = false; break; case SpvOpRayQueryProceedKHR: *hasResult = true; *hasResultType = true; break; case SpvOpRayQueryGetIntersectionTypeKHR: *hasResult = true; *hasResultType = true; break; + case SpvOpImageSampleWeightedQCOM: *hasResult = true; *hasResultType = true; break; + case SpvOpImageBoxFilterQCOM: *hasResult = true; *hasResultType = true; break; + case SpvOpImageBlockMatchSSDQCOM: *hasResult = true; *hasResultType = true; break; + case SpvOpImageBlockMatchSADQCOM: *hasResult = true; *hasResultType = true; break; case SpvOpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case SpvOpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case SpvOpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; @@ -2288,6 +2474,42 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpFragmentMaskFetchAMD: *hasResult = true; *hasResultType = true; break; case SpvOpFragmentFetchAMD: *hasResult = true; *hasResultType = true; break; case SpvOpReadClockKHR: *hasResult = true; *hasResultType = true; break; + case SpvOpFinalizeNodePayloadsAMDX: *hasResult = false; *hasResultType = false; break; + case SpvOpFinishWritingNodePayloadAMDX: *hasResult = true; *hasResultType = true; break; + case SpvOpInitializeNodePayloadsAMDX: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectRecordHitMotionNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectRecordHitWithIndexMotionNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectRecordMissMotionNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectGetWorldToObjectNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetObjectToWorldNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetObjectRayDirectionNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetObjectRayOriginNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectTraceRayMotionNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectGetShaderRecordBufferHandleNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetShaderBindingTableRecordIndexNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectRecordEmptyNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectTraceRayNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectRecordHitNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectRecordHitWithIndexNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectRecordMissNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectExecuteShaderNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectGetCurrentTimeNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetAttributesNV: *hasResult = false; *hasResultType = false; break; + case SpvOpHitObjectGetHitKindNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetPrimitiveIndexNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetGeometryIndexNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetInstanceIdNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetInstanceCustomIndexNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetWorldRayDirectionNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetWorldRayOriginNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetRayTMaxNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectGetRayTMinNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectIsEmptyNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectIsHitNV: *hasResult = true; *hasResultType = true; break; + case SpvOpHitObjectIsMissNV: *hasResult = true; *hasResultType = true; break; + case SpvOpReorderThreadWithHitObjectNV: *hasResult = false; *hasResultType = false; break; + case SpvOpReorderThreadWithHintNV: *hasResult = false; *hasResultType = false; break; + case SpvOpTypeHitObjectNV: *hasResult = true; *hasResultType = false; break; case SpvOpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break; case SpvOpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break; case SpvOpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break; @@ -2299,6 +2521,7 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpTraceNV: *hasResult = false; *hasResultType = false; break; case SpvOpTraceMotionNV: *hasResult = false; *hasResultType = false; break; case SpvOpTraceRayMotionNV: *hasResult = false; *hasResultType = false; break; + case SpvOpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break; case SpvOpTypeAccelerationStructureNV: *hasResult = true; *hasResultType = false; break; case SpvOpExecuteCallableNV: *hasResult = false; *hasResultType = false; break; case SpvOpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break; @@ -2556,6 +2779,8 @@ inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultTy case SpvOpTypeStructContinuedINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpSpecConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break; + case SpvOpConvertFToBF16INTEL: *hasResult = true; *hasResultType = true; break; + case SpvOpConvertBF16ToFINTEL: *hasResult = true; *hasResultType = true; break; case SpvOpControlBarrierArriveINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpControlBarrierWaitINTEL: *hasResult = false; *hasResultType = false; break; case SpvOpGroupIMulKHR: *hasResult = true; *hasResultType = true; break; diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.hpp11 b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.hpp11 new file mode 100644 index 00000000..f7c3e23d --- /dev/null +++ b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.hpp11 @@ -0,0 +1,2844 @@ +// Copyright (c) 2014-2020 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. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python, C#, D, Beef +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// - C# will use enum classes in the Specification class located in the "Spv" namespace, +// e.g.: Spv.Specification.SourceLanguage.GLSL +// - D will have tokens under the "spv" module, e.g: spv.SourceLanguage.GLSL +// - Beef will use enum classes in the Specification class located in the "Spv" namespace, +// e.g.: Spv.Specification.SourceLanguage.GLSL +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10600 +#define SPV_REVISION 1 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010600; +static const unsigned int Revision = 1; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum class SourceLanguage : unsigned { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + CPP_for_OpenCL = 6, + SYCL = 7, + HERO_C = 8, + NZSL = 9, + WGSL = 10, + Max = 0x7fffffff, +}; + +enum class ExecutionModel : unsigned { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + TaskNV = 5267, + MeshNV = 5268, + RayGenerationKHR = 5313, + RayGenerationNV = 5313, + IntersectionKHR = 5314, + IntersectionNV = 5314, + AnyHitKHR = 5315, + AnyHitNV = 5315, + ClosestHitKHR = 5316, + ClosestHitNV = 5316, + MissKHR = 5317, + MissNV = 5317, + CallableKHR = 5318, + CallableNV = 5318, + TaskEXT = 5364, + MeshEXT = 5365, + Max = 0x7fffffff, +}; + +enum class AddressingModel : unsigned { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + PhysicalStorageBuffer64 = 5348, + PhysicalStorageBuffer64EXT = 5348, + Max = 0x7fffffff, +}; + +enum class MemoryModel : unsigned { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + Vulkan = 3, + VulkanKHR = 3, + Max = 0x7fffffff, +}; + +enum class ExecutionMode : unsigned { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + Initializer = 33, + Finalizer = 34, + SubgroupSize = 35, + SubgroupsPerWorkgroup = 36, + SubgroupsPerWorkgroupId = 37, + LocalSizeId = 38, + LocalSizeHintId = 39, + NonCoherentColorAttachmentReadEXT = 4169, + NonCoherentDepthAttachmentReadEXT = 4170, + NonCoherentStencilAttachmentReadEXT = 4171, + SubgroupUniformControlFlowKHR = 4421, + PostDepthCoverage = 4446, + DenormPreserve = 4459, + DenormFlushToZero = 4460, + SignedZeroInfNanPreserve = 4461, + RoundingModeRTE = 4462, + RoundingModeRTZ = 4463, + EarlyAndLateFragmentTestsAMD = 5017, + StencilRefReplacingEXT = 5027, + CoalescingAMDX = 5069, + MaxNodeRecursionAMDX = 5071, + StaticNumWorkgroupsAMDX = 5072, + ShaderIndexAMDX = 5073, + MaxNumWorkgroupsAMDX = 5077, + StencilRefUnchangedFrontAMD = 5079, + StencilRefGreaterFrontAMD = 5080, + StencilRefLessFrontAMD = 5081, + StencilRefUnchangedBackAMD = 5082, + StencilRefGreaterBackAMD = 5083, + StencilRefLessBackAMD = 5084, + OutputLinesEXT = 5269, + OutputLinesNV = 5269, + OutputPrimitivesEXT = 5270, + OutputPrimitivesNV = 5270, + DerivativeGroupQuadsNV = 5289, + DerivativeGroupLinearNV = 5290, + OutputTrianglesEXT = 5298, + OutputTrianglesNV = 5298, + PixelInterlockOrderedEXT = 5366, + PixelInterlockUnorderedEXT = 5367, + SampleInterlockOrderedEXT = 5368, + SampleInterlockUnorderedEXT = 5369, + ShadingRateInterlockOrderedEXT = 5370, + ShadingRateInterlockUnorderedEXT = 5371, + SharedLocalMemorySizeINTEL = 5618, + RoundingModeRTPINTEL = 5620, + RoundingModeRTNINTEL = 5621, + FloatingPointModeALTINTEL = 5622, + FloatingPointModeIEEEINTEL = 5623, + MaxWorkgroupSizeINTEL = 5893, + MaxWorkDimINTEL = 5894, + NoGlobalOffsetINTEL = 5895, + NumSIMDWorkitemsINTEL = 5896, + SchedulerTargetFmaxMhzINTEL = 5903, + StreamingInterfaceINTEL = 6154, + RegisterMapInterfaceINTEL = 6160, + NamedBarrierCountINTEL = 6417, + Max = 0x7fffffff, +}; + +enum class StorageClass : unsigned { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + TileImageEXT = 4172, + NodePayloadAMDX = 5068, + NodeOutputPayloadAMDX = 5076, + CallableDataKHR = 5328, + CallableDataNV = 5328, + IncomingCallableDataKHR = 5329, + IncomingCallableDataNV = 5329, + RayPayloadKHR = 5338, + RayPayloadNV = 5338, + HitAttributeKHR = 5339, + HitAttributeNV = 5339, + IncomingRayPayloadKHR = 5342, + IncomingRayPayloadNV = 5342, + ShaderRecordBufferKHR = 5343, + ShaderRecordBufferNV = 5343, + PhysicalStorageBuffer = 5349, + PhysicalStorageBufferEXT = 5349, + HitObjectAttributeNV = 5385, + TaskPayloadWorkgroupEXT = 5402, + CodeSectionINTEL = 5605, + DeviceOnlyINTEL = 5936, + HostOnlyINTEL = 5937, + Max = 0x7fffffff, +}; + +enum class Dim : unsigned { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + TileImageDataEXT = 4173, + Max = 0x7fffffff, +}; + +enum class SamplerAddressingMode : unsigned { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + Max = 0x7fffffff, +}; + +enum class SamplerFilterMode : unsigned { + Nearest = 0, + Linear = 1, + Max = 0x7fffffff, +}; + +enum class ImageFormat : unsigned { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + R64ui = 40, + R64i = 41, + Max = 0x7fffffff, +}; + +enum class ImageChannelOrder : unsigned { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + Max = 0x7fffffff, +}; + +enum class ImageChannelDataType : unsigned { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + UnsignedIntRaw10EXT = 19, + UnsignedIntRaw12EXT = 20, + Max = 0x7fffffff, +}; + +enum class ImageOperandsShift : unsigned { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + MakeTexelAvailable = 8, + MakeTexelAvailableKHR = 8, + MakeTexelVisible = 9, + MakeTexelVisibleKHR = 9, + NonPrivateTexel = 10, + NonPrivateTexelKHR = 10, + VolatileTexel = 11, + VolatileTexelKHR = 11, + SignExtend = 12, + ZeroExtend = 13, + Nontemporal = 14, + Offsets = 16, + Max = 0x7fffffff, +}; + +enum class ImageOperandsMask : unsigned { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, + MakeTexelAvailable = 0x00000100, + MakeTexelAvailableKHR = 0x00000100, + MakeTexelVisible = 0x00000200, + MakeTexelVisibleKHR = 0x00000200, + NonPrivateTexel = 0x00000400, + NonPrivateTexelKHR = 0x00000400, + VolatileTexel = 0x00000800, + VolatileTexelKHR = 0x00000800, + SignExtend = 0x00001000, + ZeroExtend = 0x00002000, + Nontemporal = 0x00004000, + Offsets = 0x00010000, +}; + +enum class FPFastMathModeShift : unsigned { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + AllowContractFastINTEL = 16, + AllowReassocINTEL = 17, + Max = 0x7fffffff, +}; + +enum class FPFastMathModeMask : unsigned { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, + AllowContractFastINTEL = 0x00010000, + AllowReassocINTEL = 0x00020000, +}; + +enum class FPRoundingMode : unsigned { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + Max = 0x7fffffff, +}; + +enum class LinkageType : unsigned { + Export = 0, + Import = 1, + LinkOnceODR = 2, + Max = 0x7fffffff, +}; + +enum class AccessQualifier : unsigned { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + Max = 0x7fffffff, +}; + +enum class FunctionParameterAttribute : unsigned { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + RuntimeAlignedINTEL = 5940, + Max = 0x7fffffff, +}; + +enum class Decoration : unsigned { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + UniformId = 27, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + MaxByteOffset = 45, + AlignmentId = 46, + MaxByteOffsetId = 47, + NoSignedWrap = 4469, + NoUnsignedWrap = 4470, + WeightTextureQCOM = 4487, + BlockMatchTextureQCOM = 4488, + ExplicitInterpAMD = 4999, + NodeSharesPayloadLimitsWithAMDX = 5019, + NodeMaxPayloadsAMDX = 5020, + TrackFinishWritingAMDX = 5078, + PayloadNodeNameAMDX = 5091, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + PerPrimitiveEXT = 5271, + PerPrimitiveNV = 5271, + PerViewNV = 5272, + PerTaskNV = 5273, + PerVertexKHR = 5285, + PerVertexNV = 5285, + NonUniform = 5300, + NonUniformEXT = 5300, + RestrictPointer = 5355, + RestrictPointerEXT = 5355, + AliasedPointer = 5356, + AliasedPointerEXT = 5356, + HitObjectShaderRecordBufferNV = 5386, + BindlessSamplerNV = 5398, + BindlessImageNV = 5399, + BoundSamplerNV = 5400, + BoundImageNV = 5401, + SIMTCallINTEL = 5599, + ReferencedIndirectlyINTEL = 5602, + ClobberINTEL = 5607, + SideEffectsINTEL = 5608, + VectorComputeVariableINTEL = 5624, + FuncParamIOKindINTEL = 5625, + VectorComputeFunctionINTEL = 5626, + StackCallINTEL = 5627, + GlobalVariableOffsetINTEL = 5628, + CounterBuffer = 5634, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + UserSemantic = 5635, + UserTypeGOOGLE = 5636, + FunctionRoundingModeINTEL = 5822, + FunctionDenormModeINTEL = 5823, + RegisterINTEL = 5825, + MemoryINTEL = 5826, + NumbanksINTEL = 5827, + BankwidthINTEL = 5828, + MaxPrivateCopiesINTEL = 5829, + SinglepumpINTEL = 5830, + DoublepumpINTEL = 5831, + MaxReplicatesINTEL = 5832, + SimpleDualPortINTEL = 5833, + MergeINTEL = 5834, + BankBitsINTEL = 5835, + ForcePow2DepthINTEL = 5836, + BurstCoalesceINTEL = 5899, + CacheSizeINTEL = 5900, + DontStaticallyCoalesceINTEL = 5901, + PrefetchINTEL = 5902, + StallEnableINTEL = 5905, + FuseLoopsInFunctionINTEL = 5907, + MathOpDSPModeINTEL = 5909, + AliasScopeINTEL = 5914, + NoAliasINTEL = 5915, + InitiationIntervalINTEL = 5917, + MaxConcurrencyINTEL = 5918, + PipelineEnableINTEL = 5919, + BufferLocationINTEL = 5921, + IOPipeStorageINTEL = 5944, + FunctionFloatingPointModeINTEL = 6080, + SingleElementVectorINTEL = 6085, + VectorComputeCallableFunctionINTEL = 6087, + MediaBlockIOINTEL = 6140, + InitModeINTEL = 6147, + ImplementInRegisterMapINTEL = 6148, + HostAccessINTEL = 6168, + FPMaxErrorDecorationINTEL = 6170, + LatencyControlLabelINTEL = 6172, + LatencyControlConstraintINTEL = 6173, + ConduitKernelArgumentINTEL = 6175, + RegisterMapKernelArgumentINTEL = 6176, + MMHostInterfaceAddressWidthINTEL = 6177, + MMHostInterfaceDataWidthINTEL = 6178, + MMHostInterfaceLatencyINTEL = 6179, + MMHostInterfaceReadWriteModeINTEL = 6180, + MMHostInterfaceMaxBurstINTEL = 6181, + MMHostInterfaceWaitRequestINTEL = 6182, + StableKernelArgumentINTEL = 6183, + Max = 0x7fffffff, +}; + +enum class BuiltIn : unsigned { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + CoreIDARM = 4160, + CoreCountARM = 4161, + CoreMaxIDARM = 4162, + WarpIDARM = 4163, + WarpMaxIDARM = 4164, + SubgroupEqMask = 4416, + SubgroupEqMaskKHR = 4416, + SubgroupGeMask = 4417, + SubgroupGeMaskKHR = 4417, + SubgroupGtMask = 4418, + SubgroupGtMaskKHR = 4418, + SubgroupLeMask = 4419, + SubgroupLeMaskKHR = 4419, + SubgroupLtMask = 4420, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + PrimitiveShadingRateKHR = 4432, + DeviceIndex = 4438, + ViewIndex = 4440, + ShadingRateKHR = 4444, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + CoalescedInputCountAMDX = 5021, + ShaderIndexAMDX = 5073, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + FullyCoveredEXT = 5264, + TaskCountNV = 5274, + PrimitiveCountNV = 5275, + PrimitiveIndicesNV = 5276, + ClipDistancePerViewNV = 5277, + CullDistancePerViewNV = 5278, + LayerPerViewNV = 5279, + MeshViewCountNV = 5280, + MeshViewIndicesNV = 5281, + BaryCoordKHR = 5286, + BaryCoordNV = 5286, + BaryCoordNoPerspKHR = 5287, + BaryCoordNoPerspNV = 5287, + FragSizeEXT = 5292, + FragmentSizeNV = 5292, + FragInvocationCountEXT = 5293, + InvocationsPerPixelNV = 5293, + PrimitivePointIndicesEXT = 5294, + PrimitiveLineIndicesEXT = 5295, + PrimitiveTriangleIndicesEXT = 5296, + CullPrimitiveEXT = 5299, + LaunchIdKHR = 5319, + LaunchIdNV = 5319, + LaunchSizeKHR = 5320, + LaunchSizeNV = 5320, + WorldRayOriginKHR = 5321, + WorldRayOriginNV = 5321, + WorldRayDirectionKHR = 5322, + WorldRayDirectionNV = 5322, + ObjectRayOriginKHR = 5323, + ObjectRayOriginNV = 5323, + ObjectRayDirectionKHR = 5324, + ObjectRayDirectionNV = 5324, + RayTminKHR = 5325, + RayTminNV = 5325, + RayTmaxKHR = 5326, + RayTmaxNV = 5326, + InstanceCustomIndexKHR = 5327, + InstanceCustomIndexNV = 5327, + ObjectToWorldKHR = 5330, + ObjectToWorldNV = 5330, + WorldToObjectKHR = 5331, + WorldToObjectNV = 5331, + HitTNV = 5332, + HitKindKHR = 5333, + HitKindNV = 5333, + CurrentRayTimeNV = 5334, + HitTriangleVertexPositionsKHR = 5335, + IncomingRayFlagsKHR = 5351, + IncomingRayFlagsNV = 5351, + RayGeometryIndexKHR = 5352, + WarpsPerSMNV = 5374, + SMCountNV = 5375, + WarpIDNV = 5376, + SMIDNV = 5377, + CullMaskKHR = 6021, + Max = 0x7fffffff, +}; + +enum class SelectionControlShift : unsigned { + Flatten = 0, + DontFlatten = 1, + Max = 0x7fffffff, +}; + +enum class SelectionControlMask : unsigned { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, +}; + +enum class LoopControlShift : unsigned { + Unroll = 0, + DontUnroll = 1, + DependencyInfinite = 2, + DependencyLength = 3, + MinIterations = 4, + MaxIterations = 5, + IterationMultiple = 6, + PeelCount = 7, + PartialCount = 8, + InitiationIntervalINTEL = 16, + MaxConcurrencyINTEL = 17, + DependencyArrayINTEL = 18, + PipelineEnableINTEL = 19, + LoopCoalesceINTEL = 20, + MaxInterleavingINTEL = 21, + SpeculatedIterationsINTEL = 22, + NoFusionINTEL = 23, + LoopCountINTEL = 24, + MaxReinvocationDelayINTEL = 25, + Max = 0x7fffffff, +}; + +enum class LoopControlMask : unsigned { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, + DependencyInfinite = 0x00000004, + DependencyLength = 0x00000008, + MinIterations = 0x00000010, + MaxIterations = 0x00000020, + IterationMultiple = 0x00000040, + PeelCount = 0x00000080, + PartialCount = 0x00000100, + InitiationIntervalINTEL = 0x00010000, + MaxConcurrencyINTEL = 0x00020000, + DependencyArrayINTEL = 0x00040000, + PipelineEnableINTEL = 0x00080000, + LoopCoalesceINTEL = 0x00100000, + MaxInterleavingINTEL = 0x00200000, + SpeculatedIterationsINTEL = 0x00400000, + NoFusionINTEL = 0x00800000, + LoopCountINTEL = 0x01000000, + MaxReinvocationDelayINTEL = 0x02000000, +}; + +enum class FunctionControlShift : unsigned { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + OptNoneINTEL = 16, + Max = 0x7fffffff, +}; + +enum class FunctionControlMask : unsigned { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, + OptNoneINTEL = 0x00010000, +}; + +enum class MemorySemanticsShift : unsigned { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + OutputMemory = 12, + OutputMemoryKHR = 12, + MakeAvailable = 13, + MakeAvailableKHR = 13, + MakeVisible = 14, + MakeVisibleKHR = 14, + Volatile = 15, + Max = 0x7fffffff, +}; + +enum class MemorySemanticsMask : unsigned { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, + OutputMemory = 0x00001000, + OutputMemoryKHR = 0x00001000, + MakeAvailable = 0x00002000, + MakeAvailableKHR = 0x00002000, + MakeVisible = 0x00004000, + MakeVisibleKHR = 0x00004000, + Volatile = 0x00008000, +}; + +enum class MemoryAccessShift : unsigned { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + MakePointerAvailable = 3, + MakePointerAvailableKHR = 3, + MakePointerVisible = 4, + MakePointerVisibleKHR = 4, + NonPrivatePointer = 5, + NonPrivatePointerKHR = 5, + AliasScopeINTELMask = 16, + NoAliasINTELMask = 17, + Max = 0x7fffffff, +}; + +enum class MemoryAccessMask : unsigned { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, + MakePointerAvailable = 0x00000008, + MakePointerAvailableKHR = 0x00000008, + MakePointerVisible = 0x00000010, + MakePointerVisibleKHR = 0x00000010, + NonPrivatePointer = 0x00000020, + NonPrivatePointerKHR = 0x00000020, + AliasScopeINTELMask = 0x00010000, + NoAliasINTELMask = 0x00020000, +}; + +enum class Scope : unsigned { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + QueueFamily = 5, + QueueFamilyKHR = 5, + ShaderCallKHR = 6, + Max = 0x7fffffff, +}; + +enum class GroupOperation : unsigned { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + ClusteredReduce = 3, + PartitionedReduceNV = 6, + PartitionedInclusiveScanNV = 7, + PartitionedExclusiveScanNV = 8, + Max = 0x7fffffff, +}; + +enum class KernelEnqueueFlags : unsigned { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoShift : unsigned { + CmdExecTime = 0, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoMask : unsigned { + MaskNone = 0, + CmdExecTime = 0x00000001, +}; + +enum class Capability : unsigned { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupDispatch = 58, + NamedBarrier = 59, + PipeStorage = 60, + GroupNonUniform = 61, + GroupNonUniformVote = 62, + GroupNonUniformArithmetic = 63, + GroupNonUniformBallot = 64, + GroupNonUniformShuffle = 65, + GroupNonUniformShuffleRelative = 66, + GroupNonUniformClustered = 67, + GroupNonUniformQuad = 68, + ShaderLayer = 69, + ShaderViewportIndex = 70, + UniformDecoration = 71, + CoreBuiltinsARM = 4165, + TileImageColorReadAccessEXT = 4166, + TileImageDepthReadAccessEXT = 4167, + TileImageStencilReadAccessEXT = 4168, + FragmentShadingRateKHR = 4422, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + WorkgroupMemoryExplicitLayoutKHR = 4428, + WorkgroupMemoryExplicitLayout8BitAccessKHR = 4429, + WorkgroupMemoryExplicitLayout16BitAccessKHR = 4430, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + StorageBuffer8BitAccess = 4448, + UniformAndStorageBuffer8BitAccess = 4449, + StoragePushConstant8 = 4450, + DenormPreserve = 4464, + DenormFlushToZero = 4465, + SignedZeroInfNanPreserve = 4466, + RoundingModeRTE = 4467, + RoundingModeRTZ = 4468, + RayQueryProvisionalKHR = 4471, + RayQueryKHR = 4472, + RayTraversalPrimitiveCullingKHR = 4478, + RayTracingKHR = 4479, + TextureSampleWeightedQCOM = 4484, + TextureBoxFilterQCOM = 4485, + TextureBlockMatchQCOM = 4486, + Float16ImageAMD = 5008, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + Int64ImageEXT = 5016, + ShaderClockKHR = 5055, + ShaderEnqueueAMDX = 5067, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + FragmentFullyCoveredEXT = 5265, + MeshShadingNV = 5266, + ImageFootprintNV = 5282, + MeshShadingEXT = 5283, + FragmentBarycentricKHR = 5284, + FragmentBarycentricNV = 5284, + ComputeDerivativeGroupQuadsNV = 5288, + FragmentDensityEXT = 5291, + ShadingRateNV = 5291, + GroupNonUniformPartitionedNV = 5297, + ShaderNonUniform = 5301, + ShaderNonUniformEXT = 5301, + RuntimeDescriptorArray = 5302, + RuntimeDescriptorArrayEXT = 5302, + InputAttachmentArrayDynamicIndexing = 5303, + InputAttachmentArrayDynamicIndexingEXT = 5303, + UniformTexelBufferArrayDynamicIndexing = 5304, + UniformTexelBufferArrayDynamicIndexingEXT = 5304, + StorageTexelBufferArrayDynamicIndexing = 5305, + StorageTexelBufferArrayDynamicIndexingEXT = 5305, + UniformBufferArrayNonUniformIndexing = 5306, + UniformBufferArrayNonUniformIndexingEXT = 5306, + SampledImageArrayNonUniformIndexing = 5307, + SampledImageArrayNonUniformIndexingEXT = 5307, + StorageBufferArrayNonUniformIndexing = 5308, + StorageBufferArrayNonUniformIndexingEXT = 5308, + StorageImageArrayNonUniformIndexing = 5309, + StorageImageArrayNonUniformIndexingEXT = 5309, + InputAttachmentArrayNonUniformIndexing = 5310, + InputAttachmentArrayNonUniformIndexingEXT = 5310, + UniformTexelBufferArrayNonUniformIndexing = 5311, + UniformTexelBufferArrayNonUniformIndexingEXT = 5311, + StorageTexelBufferArrayNonUniformIndexing = 5312, + StorageTexelBufferArrayNonUniformIndexingEXT = 5312, + RayTracingPositionFetchKHR = 5336, + RayTracingNV = 5340, + RayTracingMotionBlurNV = 5341, + VulkanMemoryModel = 5345, + VulkanMemoryModelKHR = 5345, + VulkanMemoryModelDeviceScope = 5346, + VulkanMemoryModelDeviceScopeKHR = 5346, + PhysicalStorageBufferAddresses = 5347, + PhysicalStorageBufferAddressesEXT = 5347, + ComputeDerivativeGroupLinearNV = 5350, + RayTracingProvisionalKHR = 5353, + CooperativeMatrixNV = 5357, + FragmentShaderSampleInterlockEXT = 5363, + FragmentShaderShadingRateInterlockEXT = 5372, + ShaderSMBuiltinsNV = 5373, + FragmentShaderPixelInterlockEXT = 5378, + DemoteToHelperInvocation = 5379, + DemoteToHelperInvocationEXT = 5379, + RayTracingOpacityMicromapEXT = 5381, + ShaderInvocationReorderNV = 5383, + BindlessTextureNV = 5390, + RayQueryPositionFetchKHR = 5391, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + SubgroupImageMediaBlockIOINTEL = 5579, + RoundToInfinityINTEL = 5582, + FloatingPointModeINTEL = 5583, + IntegerFunctions2INTEL = 5584, + FunctionPointersINTEL = 5603, + IndirectReferencesINTEL = 5604, + AsmINTEL = 5606, + AtomicFloat32MinMaxEXT = 5612, + AtomicFloat64MinMaxEXT = 5613, + AtomicFloat16MinMaxEXT = 5616, + VectorComputeINTEL = 5617, + VectorAnyINTEL = 5619, + ExpectAssumeKHR = 5629, + SubgroupAvcMotionEstimationINTEL = 5696, + SubgroupAvcMotionEstimationIntraINTEL = 5697, + SubgroupAvcMotionEstimationChromaINTEL = 5698, + VariableLengthArrayINTEL = 5817, + FunctionFloatControlINTEL = 5821, + FPGAMemoryAttributesINTEL = 5824, + FPFastMathModeINTEL = 5837, + ArbitraryPrecisionIntegersINTEL = 5844, + ArbitraryPrecisionFloatingPointINTEL = 5845, + UnstructuredLoopControlsINTEL = 5886, + FPGALoopControlsINTEL = 5888, + KernelAttributesINTEL = 5892, + FPGAKernelAttributesINTEL = 5897, + FPGAMemoryAccessesINTEL = 5898, + FPGAClusterAttributesINTEL = 5904, + LoopFuseINTEL = 5906, + FPGADSPControlINTEL = 5908, + MemoryAccessAliasingINTEL = 5910, + FPGAInvocationPipeliningAttributesINTEL = 5916, + FPGABufferLocationINTEL = 5920, + ArbitraryPrecisionFixedPointINTEL = 5922, + USMStorageClassesINTEL = 5935, + RuntimeAlignedAttributeINTEL = 5939, + IOPipesINTEL = 5943, + BlockingPipesINTEL = 5945, + FPGARegINTEL = 5948, + DotProductInputAll = 6016, + DotProductInputAllKHR = 6016, + DotProductInput4x8Bit = 6017, + DotProductInput4x8BitKHR = 6017, + DotProductInput4x8BitPacked = 6018, + DotProductInput4x8BitPackedKHR = 6018, + DotProduct = 6019, + DotProductKHR = 6019, + RayCullMaskKHR = 6020, + CooperativeMatrixKHR = 6022, + BitInstructions = 6025, + GroupNonUniformRotateKHR = 6026, + AtomicFloat32AddEXT = 6033, + AtomicFloat64AddEXT = 6034, + LongConstantCompositeINTEL = 6089, + OptNoneINTEL = 6094, + AtomicFloat16AddEXT = 6095, + DebugInfoModuleINTEL = 6114, + BFloat16ConversionINTEL = 6115, + SplitBarrierINTEL = 6141, + GlobalVariableFPGADecorationsINTEL = 6146, + FPGAKernelAttributesv2INTEL = 6161, + GlobalVariableHostAccessINTEL = 6167, + FPMaxErrorINTEL = 6169, + FPGALatencyControlINTEL = 6171, + FPGAArgumentInterfacesINTEL = 6174, + GroupUniformArithmeticKHR = 6400, + Max = 0x7fffffff, +}; + +enum class RayFlagsShift : unsigned { + OpaqueKHR = 0, + NoOpaqueKHR = 1, + TerminateOnFirstHitKHR = 2, + SkipClosestHitShaderKHR = 3, + CullBackFacingTrianglesKHR = 4, + CullFrontFacingTrianglesKHR = 5, + CullOpaqueKHR = 6, + CullNoOpaqueKHR = 7, + SkipTrianglesKHR = 8, + SkipAABBsKHR = 9, + ForceOpacityMicromap2StateEXT = 10, + Max = 0x7fffffff, +}; + +enum class RayFlagsMask : unsigned { + MaskNone = 0, + OpaqueKHR = 0x00000001, + NoOpaqueKHR = 0x00000002, + TerminateOnFirstHitKHR = 0x00000004, + SkipClosestHitShaderKHR = 0x00000008, + CullBackFacingTrianglesKHR = 0x00000010, + CullFrontFacingTrianglesKHR = 0x00000020, + CullOpaqueKHR = 0x00000040, + CullNoOpaqueKHR = 0x00000080, + SkipTrianglesKHR = 0x00000100, + SkipAABBsKHR = 0x00000200, + ForceOpacityMicromap2StateEXT = 0x00000400, +}; + +enum class RayQueryIntersection : unsigned { + RayQueryCandidateIntersectionKHR = 0, + RayQueryCommittedIntersectionKHR = 1, + Max = 0x7fffffff, +}; + +enum class RayQueryCommittedIntersectionType : unsigned { + RayQueryCommittedIntersectionNoneKHR = 0, + RayQueryCommittedIntersectionTriangleKHR = 1, + RayQueryCommittedIntersectionGeneratedKHR = 2, + Max = 0x7fffffff, +}; + +enum class RayQueryCandidateIntersectionType : unsigned { + RayQueryCandidateIntersectionTriangleKHR = 0, + RayQueryCandidateIntersectionAABBKHR = 1, + Max = 0x7fffffff, +}; + +enum class FragmentShadingRateShift : unsigned { + Vertical2Pixels = 0, + Vertical4Pixels = 1, + Horizontal2Pixels = 2, + Horizontal4Pixels = 3, + Max = 0x7fffffff, +}; + +enum class FragmentShadingRateMask : unsigned { + MaskNone = 0, + Vertical2Pixels = 0x00000001, + Vertical4Pixels = 0x00000002, + Horizontal2Pixels = 0x00000004, + Horizontal4Pixels = 0x00000008, +}; + +enum class FPDenormMode : unsigned { + Preserve = 0, + FlushToZero = 1, + Max = 0x7fffffff, +}; + +enum class FPOperationMode : unsigned { + IEEE = 0, + ALT = 1, + Max = 0x7fffffff, +}; + +enum class QuantizationModes : unsigned { + TRN = 0, + TRN_ZERO = 1, + RND = 2, + RND_ZERO = 3, + RND_INF = 4, + RND_MIN_INF = 5, + RND_CONV = 6, + RND_CONV_ODD = 7, + Max = 0x7fffffff, +}; + +enum class OverflowModes : unsigned { + WRAP = 0, + SAT = 1, + SAT_ZERO = 2, + SAT_SYM = 3, + Max = 0x7fffffff, +}; + +enum class PackedVectorFormat : unsigned { + PackedVectorFormat4x8Bit = 0, + PackedVectorFormat4x8BitKHR = 0, + Max = 0x7fffffff, +}; + +enum class CooperativeMatrixOperandsShift : unsigned { + MatrixASignedComponentsKHR = 0, + MatrixBSignedComponentsKHR = 1, + MatrixCSignedComponentsKHR = 2, + MatrixResultSignedComponentsKHR = 3, + SaturatingAccumulationKHR = 4, + Max = 0x7fffffff, +}; + +enum class CooperativeMatrixOperandsMask : unsigned { + MaskNone = 0, + MatrixASignedComponentsKHR = 0x00000001, + MatrixBSignedComponentsKHR = 0x00000002, + MatrixCSignedComponentsKHR = 0x00000004, + MatrixResultSignedComponentsKHR = 0x00000008, + SaturatingAccumulationKHR = 0x00000010, +}; + +enum class CooperativeMatrixLayout : unsigned { + RowMajorKHR = 0, + ColumnMajorKHR = 1, + Max = 0x7fffffff, +}; + +enum class CooperativeMatrixUse : unsigned { + MatrixAKHR = 0, + MatrixBKHR = 1, + MatrixAccumulatorKHR = 2, + Max = 0x7fffffff, +}; + +enum class InitializationModeQualifier : unsigned { + InitOnDeviceReprogramINTEL = 0, + InitOnDeviceResetINTEL = 1, + Max = 0x7fffffff, +}; + +enum class HostAccessQualifier : unsigned { + NoneINTEL = 0, + ReadINTEL = 1, + WriteINTEL = 2, + ReadWriteINTEL = 3, + Max = 0x7fffffff, +}; + +enum class Op : unsigned { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpExecutionModeId = 331, + OpDecorateId = 332, + OpGroupNonUniformElect = 333, + OpGroupNonUniformAll = 334, + OpGroupNonUniformAny = 335, + OpGroupNonUniformAllEqual = 336, + OpGroupNonUniformBroadcast = 337, + OpGroupNonUniformBroadcastFirst = 338, + OpGroupNonUniformBallot = 339, + OpGroupNonUniformInverseBallot = 340, + OpGroupNonUniformBallotBitExtract = 341, + OpGroupNonUniformBallotBitCount = 342, + OpGroupNonUniformBallotFindLSB = 343, + OpGroupNonUniformBallotFindMSB = 344, + OpGroupNonUniformShuffle = 345, + OpGroupNonUniformShuffleXor = 346, + OpGroupNonUniformShuffleUp = 347, + OpGroupNonUniformShuffleDown = 348, + OpGroupNonUniformIAdd = 349, + OpGroupNonUniformFAdd = 350, + OpGroupNonUniformIMul = 351, + OpGroupNonUniformFMul = 352, + OpGroupNonUniformSMin = 353, + OpGroupNonUniformUMin = 354, + OpGroupNonUniformFMin = 355, + OpGroupNonUniformSMax = 356, + OpGroupNonUniformUMax = 357, + OpGroupNonUniformFMax = 358, + OpGroupNonUniformBitwiseAnd = 359, + OpGroupNonUniformBitwiseOr = 360, + OpGroupNonUniformBitwiseXor = 361, + OpGroupNonUniformLogicalAnd = 362, + OpGroupNonUniformLogicalOr = 363, + OpGroupNonUniformLogicalXor = 364, + OpGroupNonUniformQuadBroadcast = 365, + OpGroupNonUniformQuadSwap = 366, + OpCopyLogical = 400, + OpPtrEqual = 401, + OpPtrNotEqual = 402, + OpPtrDiff = 403, + OpColorAttachmentReadEXT = 4160, + OpDepthAttachmentReadEXT = 4161, + OpStencilAttachmentReadEXT = 4162, + OpTerminateInvocation = 4416, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpGroupNonUniformRotateKHR = 4431, + OpSubgroupReadInvocationKHR = 4432, + OpTraceRayKHR = 4445, + OpExecuteCallableKHR = 4446, + OpConvertUToAccelerationStructureKHR = 4447, + OpIgnoreIntersectionKHR = 4448, + OpTerminateRayKHR = 4449, + OpSDot = 4450, + OpSDotKHR = 4450, + OpUDot = 4451, + OpUDotKHR = 4451, + OpSUDot = 4452, + OpSUDotKHR = 4452, + OpSDotAccSat = 4453, + OpSDotAccSatKHR = 4453, + OpUDotAccSat = 4454, + OpUDotAccSatKHR = 4454, + OpSUDotAccSat = 4455, + OpSUDotAccSatKHR = 4455, + OpTypeCooperativeMatrixKHR = 4456, + OpCooperativeMatrixLoadKHR = 4457, + OpCooperativeMatrixStoreKHR = 4458, + OpCooperativeMatrixMulAddKHR = 4459, + OpCooperativeMatrixLengthKHR = 4460, + OpTypeRayQueryKHR = 4472, + OpRayQueryInitializeKHR = 4473, + OpRayQueryTerminateKHR = 4474, + OpRayQueryGenerateIntersectionKHR = 4475, + OpRayQueryConfirmIntersectionKHR = 4476, + OpRayQueryProceedKHR = 4477, + OpRayQueryGetIntersectionTypeKHR = 4479, + OpImageSampleWeightedQCOM = 4480, + OpImageBoxFilterQCOM = 4481, + OpImageBlockMatchSSDQCOM = 4482, + OpImageBlockMatchSADQCOM = 4483, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpReadClockKHR = 5056, + OpFinalizeNodePayloadsAMDX = 5075, + OpFinishWritingNodePayloadAMDX = 5078, + OpInitializeNodePayloadsAMDX = 5090, + OpHitObjectRecordHitMotionNV = 5249, + OpHitObjectRecordHitWithIndexMotionNV = 5250, + OpHitObjectRecordMissMotionNV = 5251, + OpHitObjectGetWorldToObjectNV = 5252, + OpHitObjectGetObjectToWorldNV = 5253, + OpHitObjectGetObjectRayDirectionNV = 5254, + OpHitObjectGetObjectRayOriginNV = 5255, + OpHitObjectTraceRayMotionNV = 5256, + OpHitObjectGetShaderRecordBufferHandleNV = 5257, + OpHitObjectGetShaderBindingTableRecordIndexNV = 5258, + OpHitObjectRecordEmptyNV = 5259, + OpHitObjectTraceRayNV = 5260, + OpHitObjectRecordHitNV = 5261, + OpHitObjectRecordHitWithIndexNV = 5262, + OpHitObjectRecordMissNV = 5263, + OpHitObjectExecuteShaderNV = 5264, + OpHitObjectGetCurrentTimeNV = 5265, + OpHitObjectGetAttributesNV = 5266, + OpHitObjectGetHitKindNV = 5267, + OpHitObjectGetPrimitiveIndexNV = 5268, + OpHitObjectGetGeometryIndexNV = 5269, + OpHitObjectGetInstanceIdNV = 5270, + OpHitObjectGetInstanceCustomIndexNV = 5271, + OpHitObjectGetWorldRayDirectionNV = 5272, + OpHitObjectGetWorldRayOriginNV = 5273, + OpHitObjectGetRayTMaxNV = 5274, + OpHitObjectGetRayTMinNV = 5275, + OpHitObjectIsEmptyNV = 5276, + OpHitObjectIsHitNV = 5277, + OpHitObjectIsMissNV = 5278, + OpReorderThreadWithHitObjectNV = 5279, + OpReorderThreadWithHintNV = 5280, + OpTypeHitObjectNV = 5281, + OpImageSampleFootprintNV = 5283, + OpEmitMeshTasksEXT = 5294, + OpSetMeshOutputsEXT = 5295, + OpGroupNonUniformPartitionNV = 5296, + OpWritePackedPrimitiveIndices4x8NV = 5299, + OpReportIntersectionKHR = 5334, + OpReportIntersectionNV = 5334, + OpIgnoreIntersectionNV = 5335, + OpTerminateRayNV = 5336, + OpTraceNV = 5337, + OpTraceMotionNV = 5338, + OpTraceRayMotionNV = 5339, + OpRayQueryGetIntersectionTriangleVertexPositionsKHR = 5340, + OpTypeAccelerationStructureKHR = 5341, + OpTypeAccelerationStructureNV = 5341, + OpExecuteCallableNV = 5344, + OpTypeCooperativeMatrixNV = 5358, + OpCooperativeMatrixLoadNV = 5359, + OpCooperativeMatrixStoreNV = 5360, + OpCooperativeMatrixMulAddNV = 5361, + OpCooperativeMatrixLengthNV = 5362, + OpBeginInvocationInterlockEXT = 5364, + OpEndInvocationInterlockEXT = 5365, + OpDemoteToHelperInvocation = 5380, + OpDemoteToHelperInvocationEXT = 5380, + OpIsHelperInvocationEXT = 5381, + OpConvertUToImageNV = 5391, + OpConvertUToSamplerNV = 5392, + OpConvertImageToUNV = 5393, + OpConvertSamplerToUNV = 5394, + OpConvertUToSampledImageNV = 5395, + OpConvertSampledImageToUNV = 5396, + OpSamplerImageAddressingModeNV = 5397, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpSubgroupImageMediaBlockReadINTEL = 5580, + OpSubgroupImageMediaBlockWriteINTEL = 5581, + OpUCountLeadingZerosINTEL = 5585, + OpUCountTrailingZerosINTEL = 5586, + OpAbsISubINTEL = 5587, + OpAbsUSubINTEL = 5588, + OpIAddSatINTEL = 5589, + OpUAddSatINTEL = 5590, + OpIAverageINTEL = 5591, + OpUAverageINTEL = 5592, + OpIAverageRoundedINTEL = 5593, + OpUAverageRoundedINTEL = 5594, + OpISubSatINTEL = 5595, + OpUSubSatINTEL = 5596, + OpIMul32x16INTEL = 5597, + OpUMul32x16INTEL = 5598, + OpConstantFunctionPointerINTEL = 5600, + OpFunctionPointerCallINTEL = 5601, + OpAsmTargetINTEL = 5609, + OpAsmINTEL = 5610, + OpAsmCallINTEL = 5611, + OpAtomicFMinEXT = 5614, + OpAtomicFMaxEXT = 5615, + OpAssumeTrueKHR = 5630, + OpExpectKHR = 5631, + OpDecorateString = 5632, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateString = 5633, + OpMemberDecorateStringGOOGLE = 5633, + OpVmeImageINTEL = 5699, + OpTypeVmeImageINTEL = 5700, + OpTypeAvcImePayloadINTEL = 5701, + OpTypeAvcRefPayloadINTEL = 5702, + OpTypeAvcSicPayloadINTEL = 5703, + OpTypeAvcMcePayloadINTEL = 5704, + OpTypeAvcMceResultINTEL = 5705, + OpTypeAvcImeResultINTEL = 5706, + OpTypeAvcImeResultSingleReferenceStreamoutINTEL = 5707, + OpTypeAvcImeResultDualReferenceStreamoutINTEL = 5708, + OpTypeAvcImeSingleReferenceStreaminINTEL = 5709, + OpTypeAvcImeDualReferenceStreaminINTEL = 5710, + OpTypeAvcRefResultINTEL = 5711, + OpTypeAvcSicResultINTEL = 5712, + OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL = 5713, + OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL = 5714, + OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL = 5715, + OpSubgroupAvcMceSetInterShapePenaltyINTEL = 5716, + OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL = 5717, + OpSubgroupAvcMceSetInterDirectionPenaltyINTEL = 5718, + OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL = 5719, + OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL = 5720, + OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL = 5721, + OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL = 5722, + OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL = 5723, + OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL = 5724, + OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL = 5725, + OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL = 5726, + OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL = 5727, + OpSubgroupAvcMceSetAcOnlyHaarINTEL = 5728, + OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL = 5729, + OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL = 5730, + OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL = 5731, + OpSubgroupAvcMceConvertToImePayloadINTEL = 5732, + OpSubgroupAvcMceConvertToImeResultINTEL = 5733, + OpSubgroupAvcMceConvertToRefPayloadINTEL = 5734, + OpSubgroupAvcMceConvertToRefResultINTEL = 5735, + OpSubgroupAvcMceConvertToSicPayloadINTEL = 5736, + OpSubgroupAvcMceConvertToSicResultINTEL = 5737, + OpSubgroupAvcMceGetMotionVectorsINTEL = 5738, + OpSubgroupAvcMceGetInterDistortionsINTEL = 5739, + OpSubgroupAvcMceGetBestInterDistortionsINTEL = 5740, + OpSubgroupAvcMceGetInterMajorShapeINTEL = 5741, + OpSubgroupAvcMceGetInterMinorShapeINTEL = 5742, + OpSubgroupAvcMceGetInterDirectionsINTEL = 5743, + OpSubgroupAvcMceGetInterMotionVectorCountINTEL = 5744, + OpSubgroupAvcMceGetInterReferenceIdsINTEL = 5745, + OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL = 5746, + OpSubgroupAvcImeInitializeINTEL = 5747, + OpSubgroupAvcImeSetSingleReferenceINTEL = 5748, + OpSubgroupAvcImeSetDualReferenceINTEL = 5749, + OpSubgroupAvcImeRefWindowSizeINTEL = 5750, + OpSubgroupAvcImeAdjustRefOffsetINTEL = 5751, + OpSubgroupAvcImeConvertToMcePayloadINTEL = 5752, + OpSubgroupAvcImeSetMaxMotionVectorCountINTEL = 5753, + OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL = 5754, + OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL = 5755, + OpSubgroupAvcImeSetWeightedSadINTEL = 5756, + OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL = 5757, + OpSubgroupAvcImeEvaluateWithDualReferenceINTEL = 5758, + OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL = 5759, + OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL = 5760, + OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL = 5761, + OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL = 5762, + OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL = 5763, + OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL = 5764, + OpSubgroupAvcImeConvertToMceResultINTEL = 5765, + OpSubgroupAvcImeGetSingleReferenceStreaminINTEL = 5766, + OpSubgroupAvcImeGetDualReferenceStreaminINTEL = 5767, + OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL = 5768, + OpSubgroupAvcImeStripDualReferenceStreamoutINTEL = 5769, + OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL = 5770, + OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL = 5771, + OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL = 5772, + OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL = 5773, + OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL = 5774, + OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL = 5775, + OpSubgroupAvcImeGetBorderReachedINTEL = 5776, + OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL = 5777, + OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL = 5778, + OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL = 5779, + OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL = 5780, + OpSubgroupAvcFmeInitializeINTEL = 5781, + OpSubgroupAvcBmeInitializeINTEL = 5782, + OpSubgroupAvcRefConvertToMcePayloadINTEL = 5783, + OpSubgroupAvcRefSetBidirectionalMixDisableINTEL = 5784, + OpSubgroupAvcRefSetBilinearFilterEnableINTEL = 5785, + OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL = 5786, + OpSubgroupAvcRefEvaluateWithDualReferenceINTEL = 5787, + OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL = 5788, + OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL = 5789, + OpSubgroupAvcRefConvertToMceResultINTEL = 5790, + OpSubgroupAvcSicInitializeINTEL = 5791, + OpSubgroupAvcSicConfigureSkcINTEL = 5792, + OpSubgroupAvcSicConfigureIpeLumaINTEL = 5793, + OpSubgroupAvcSicConfigureIpeLumaChromaINTEL = 5794, + OpSubgroupAvcSicGetMotionVectorMaskINTEL = 5795, + OpSubgroupAvcSicConvertToMcePayloadINTEL = 5796, + OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL = 5797, + OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL = 5798, + OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL = 5799, + OpSubgroupAvcSicSetBilinearFilterEnableINTEL = 5800, + OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL = 5801, + OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL = 5802, + OpSubgroupAvcSicEvaluateIpeINTEL = 5803, + OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL = 5804, + OpSubgroupAvcSicEvaluateWithDualReferenceINTEL = 5805, + OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL = 5806, + OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL = 5807, + OpSubgroupAvcSicConvertToMceResultINTEL = 5808, + OpSubgroupAvcSicGetIpeLumaShapeINTEL = 5809, + OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL = 5810, + OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL = 5811, + OpSubgroupAvcSicGetPackedIpeLumaModesINTEL = 5812, + OpSubgroupAvcSicGetIpeChromaModeINTEL = 5813, + OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814, + OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815, + OpSubgroupAvcSicGetInterRawSadsINTEL = 5816, + OpVariableLengthArrayINTEL = 5818, + OpSaveMemoryINTEL = 5819, + OpRestoreMemoryINTEL = 5820, + OpArbitraryFloatSinCosPiINTEL = 5840, + OpArbitraryFloatCastINTEL = 5841, + OpArbitraryFloatCastFromIntINTEL = 5842, + OpArbitraryFloatCastToIntINTEL = 5843, + OpArbitraryFloatAddINTEL = 5846, + OpArbitraryFloatSubINTEL = 5847, + OpArbitraryFloatMulINTEL = 5848, + OpArbitraryFloatDivINTEL = 5849, + OpArbitraryFloatGTINTEL = 5850, + OpArbitraryFloatGEINTEL = 5851, + OpArbitraryFloatLTINTEL = 5852, + OpArbitraryFloatLEINTEL = 5853, + OpArbitraryFloatEQINTEL = 5854, + OpArbitraryFloatRecipINTEL = 5855, + OpArbitraryFloatRSqrtINTEL = 5856, + OpArbitraryFloatCbrtINTEL = 5857, + OpArbitraryFloatHypotINTEL = 5858, + OpArbitraryFloatSqrtINTEL = 5859, + OpArbitraryFloatLogINTEL = 5860, + OpArbitraryFloatLog2INTEL = 5861, + OpArbitraryFloatLog10INTEL = 5862, + OpArbitraryFloatLog1pINTEL = 5863, + OpArbitraryFloatExpINTEL = 5864, + OpArbitraryFloatExp2INTEL = 5865, + OpArbitraryFloatExp10INTEL = 5866, + OpArbitraryFloatExpm1INTEL = 5867, + OpArbitraryFloatSinINTEL = 5868, + OpArbitraryFloatCosINTEL = 5869, + OpArbitraryFloatSinCosINTEL = 5870, + OpArbitraryFloatSinPiINTEL = 5871, + OpArbitraryFloatCosPiINTEL = 5872, + OpArbitraryFloatASinINTEL = 5873, + OpArbitraryFloatASinPiINTEL = 5874, + OpArbitraryFloatACosINTEL = 5875, + OpArbitraryFloatACosPiINTEL = 5876, + OpArbitraryFloatATanINTEL = 5877, + OpArbitraryFloatATanPiINTEL = 5878, + OpArbitraryFloatATan2INTEL = 5879, + OpArbitraryFloatPowINTEL = 5880, + OpArbitraryFloatPowRINTEL = 5881, + OpArbitraryFloatPowNINTEL = 5882, + OpLoopControlINTEL = 5887, + OpAliasDomainDeclINTEL = 5911, + OpAliasScopeDeclINTEL = 5912, + OpAliasScopeListDeclINTEL = 5913, + OpFixedSqrtINTEL = 5923, + OpFixedRecipINTEL = 5924, + OpFixedRsqrtINTEL = 5925, + OpFixedSinINTEL = 5926, + OpFixedCosINTEL = 5927, + OpFixedSinCosINTEL = 5928, + OpFixedSinPiINTEL = 5929, + OpFixedCosPiINTEL = 5930, + OpFixedSinCosPiINTEL = 5931, + OpFixedLogINTEL = 5932, + OpFixedExpINTEL = 5933, + OpPtrCastToCrossWorkgroupINTEL = 5934, + OpCrossWorkgroupCastToPtrINTEL = 5938, + OpReadPipeBlockingINTEL = 5946, + OpWritePipeBlockingINTEL = 5947, + OpFPGARegINTEL = 5949, + OpRayQueryGetRayTMinKHR = 6016, + OpRayQueryGetRayFlagsKHR = 6017, + OpRayQueryGetIntersectionTKHR = 6018, + OpRayQueryGetIntersectionInstanceCustomIndexKHR = 6019, + OpRayQueryGetIntersectionInstanceIdKHR = 6020, + OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR = 6021, + OpRayQueryGetIntersectionGeometryIndexKHR = 6022, + OpRayQueryGetIntersectionPrimitiveIndexKHR = 6023, + OpRayQueryGetIntersectionBarycentricsKHR = 6024, + OpRayQueryGetIntersectionFrontFaceKHR = 6025, + OpRayQueryGetIntersectionCandidateAABBOpaqueKHR = 6026, + OpRayQueryGetIntersectionObjectRayDirectionKHR = 6027, + OpRayQueryGetIntersectionObjectRayOriginKHR = 6028, + OpRayQueryGetWorldRayDirectionKHR = 6029, + OpRayQueryGetWorldRayOriginKHR = 6030, + OpRayQueryGetIntersectionObjectToWorldKHR = 6031, + OpRayQueryGetIntersectionWorldToObjectKHR = 6032, + OpAtomicFAddEXT = 6035, + OpTypeBufferSurfaceINTEL = 6086, + OpTypeStructContinuedINTEL = 6090, + OpConstantCompositeContinuedINTEL = 6091, + OpSpecConstantCompositeContinuedINTEL = 6092, + OpConvertFToBF16INTEL = 6116, + OpConvertBF16ToFINTEL = 6117, + OpControlBarrierArriveINTEL = 6142, + OpControlBarrierWaitINTEL = 6143, + OpGroupIMulKHR = 6401, + OpGroupFMulKHR = 6402, + OpGroupBitwiseAndKHR = 6403, + OpGroupBitwiseOrKHR = 6404, + OpGroupBitwiseXorKHR = 6405, + OpGroupLogicalAndKHR = 6406, + OpGroupLogicalOrKHR = 6407, + OpGroupLogicalXorKHR = 6408, + Max = 0x7fffffff, +}; + +#ifdef SPV_ENABLE_UTILITY_CODE +#ifndef __cplusplus +#include +#endif +inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { + *hasResult = *hasResultType = false; + switch (opcode) { + default: /* unknown opcode */ break; + case Op::OpNop: *hasResult = false; *hasResultType = false; break; + case Op::OpUndef: *hasResult = true; *hasResultType = true; break; + case Op::OpSourceContinued: *hasResult = false; *hasResultType = false; break; + case Op::OpSource: *hasResult = false; *hasResultType = false; break; + case Op::OpSourceExtension: *hasResult = false; *hasResultType = false; break; + case Op::OpName: *hasResult = false; *hasResultType = false; break; + case Op::OpMemberName: *hasResult = false; *hasResultType = false; break; + case Op::OpString: *hasResult = true; *hasResultType = false; break; + case Op::OpLine: *hasResult = false; *hasResultType = false; break; + case Op::OpExtension: *hasResult = false; *hasResultType = false; break; + case Op::OpExtInstImport: *hasResult = true; *hasResultType = false; break; + case Op::OpExtInst: *hasResult = true; *hasResultType = true; break; + case Op::OpMemoryModel: *hasResult = false; *hasResultType = false; break; + case Op::OpEntryPoint: *hasResult = false; *hasResultType = false; break; + case Op::OpExecutionMode: *hasResult = false; *hasResultType = false; break; + case Op::OpCapability: *hasResult = false; *hasResultType = false; break; + case Op::OpTypeVoid: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeBool: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeInt: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeFloat: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeVector: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeMatrix: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeImage: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeSampler: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeSampledImage: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeArray: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeRuntimeArray: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeStruct: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeOpaque: *hasResult = true; *hasResultType = false; break; + case Op::OpTypePointer: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeFunction: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeEvent: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeDeviceEvent: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeReserveId: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeQueue: *hasResult = true; *hasResultType = false; break; + case Op::OpTypePipe: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeForwardPointer: *hasResult = false; *hasResultType = false; break; + case Op::OpConstantTrue: *hasResult = true; *hasResultType = true; break; + case Op::OpConstantFalse: *hasResult = true; *hasResultType = true; break; + case Op::OpConstant: *hasResult = true; *hasResultType = true; break; + case Op::OpConstantComposite: *hasResult = true; *hasResultType = true; break; + case Op::OpConstantSampler: *hasResult = true; *hasResultType = true; break; + case Op::OpConstantNull: *hasResult = true; *hasResultType = true; break; + case Op::OpSpecConstantTrue: *hasResult = true; *hasResultType = true; break; + case Op::OpSpecConstantFalse: *hasResult = true; *hasResultType = true; break; + case Op::OpSpecConstant: *hasResult = true; *hasResultType = true; break; + case Op::OpSpecConstantComposite: *hasResult = true; *hasResultType = true; break; + case Op::OpSpecConstantOp: *hasResult = true; *hasResultType = true; break; + case Op::OpFunction: *hasResult = true; *hasResultType = true; break; + case Op::OpFunctionParameter: *hasResult = true; *hasResultType = true; break; + case Op::OpFunctionEnd: *hasResult = false; *hasResultType = false; break; + case Op::OpFunctionCall: *hasResult = true; *hasResultType = true; break; + case Op::OpVariable: *hasResult = true; *hasResultType = true; break; + case Op::OpImageTexelPointer: *hasResult = true; *hasResultType = true; break; + case Op::OpLoad: *hasResult = true; *hasResultType = true; break; + case Op::OpStore: *hasResult = false; *hasResultType = false; break; + case Op::OpCopyMemory: *hasResult = false; *hasResultType = false; break; + case Op::OpCopyMemorySized: *hasResult = false; *hasResultType = false; break; + case Op::OpAccessChain: *hasResult = true; *hasResultType = true; break; + case Op::OpInBoundsAccessChain: *hasResult = true; *hasResultType = true; break; + case Op::OpPtrAccessChain: *hasResult = true; *hasResultType = true; break; + case Op::OpArrayLength: *hasResult = true; *hasResultType = true; break; + case Op::OpGenericPtrMemSemantics: *hasResult = true; *hasResultType = true; break; + case Op::OpInBoundsPtrAccessChain: *hasResult = true; *hasResultType = true; break; + case Op::OpDecorate: *hasResult = false; *hasResultType = false; break; + case Op::OpMemberDecorate: *hasResult = false; *hasResultType = false; break; + case Op::OpDecorationGroup: *hasResult = true; *hasResultType = false; break; + case Op::OpGroupDecorate: *hasResult = false; *hasResultType = false; break; + case Op::OpGroupMemberDecorate: *hasResult = false; *hasResultType = false; break; + case Op::OpVectorExtractDynamic: *hasResult = true; *hasResultType = true; break; + case Op::OpVectorInsertDynamic: *hasResult = true; *hasResultType = true; break; + case Op::OpVectorShuffle: *hasResult = true; *hasResultType = true; break; + case Op::OpCompositeConstruct: *hasResult = true; *hasResultType = true; break; + case Op::OpCompositeExtract: *hasResult = true; *hasResultType = true; break; + case Op::OpCompositeInsert: *hasResult = true; *hasResultType = true; break; + case Op::OpCopyObject: *hasResult = true; *hasResultType = true; break; + case Op::OpTranspose: *hasResult = true; *hasResultType = true; break; + case Op::OpSampledImage: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSampleImplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSampleExplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSampleDrefImplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSampleDrefExplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSampleProjImplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSampleProjExplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSampleProjDrefImplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSampleProjDrefExplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageFetch: *hasResult = true; *hasResultType = true; break; + case Op::OpImageGather: *hasResult = true; *hasResultType = true; break; + case Op::OpImageDrefGather: *hasResult = true; *hasResultType = true; break; + case Op::OpImageRead: *hasResult = true; *hasResultType = true; break; + case Op::OpImageWrite: *hasResult = false; *hasResultType = false; break; + case Op::OpImage: *hasResult = true; *hasResultType = true; break; + case Op::OpImageQueryFormat: *hasResult = true; *hasResultType = true; break; + case Op::OpImageQueryOrder: *hasResult = true; *hasResultType = true; break; + case Op::OpImageQuerySizeLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageQuerySize: *hasResult = true; *hasResultType = true; break; + case Op::OpImageQueryLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageQueryLevels: *hasResult = true; *hasResultType = true; break; + case Op::OpImageQuerySamples: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertFToU: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertFToS: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertSToF: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertUToF: *hasResult = true; *hasResultType = true; break; + case Op::OpUConvert: *hasResult = true; *hasResultType = true; break; + case Op::OpSConvert: *hasResult = true; *hasResultType = true; break; + case Op::OpFConvert: *hasResult = true; *hasResultType = true; break; + case Op::OpQuantizeToF16: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertPtrToU: *hasResult = true; *hasResultType = true; break; + case Op::OpSatConvertSToU: *hasResult = true; *hasResultType = true; break; + case Op::OpSatConvertUToS: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertUToPtr: *hasResult = true; *hasResultType = true; break; + case Op::OpPtrCastToGeneric: *hasResult = true; *hasResultType = true; break; + case Op::OpGenericCastToPtr: *hasResult = true; *hasResultType = true; break; + case Op::OpGenericCastToPtrExplicit: *hasResult = true; *hasResultType = true; break; + case Op::OpBitcast: *hasResult = true; *hasResultType = true; break; + case Op::OpSNegate: *hasResult = true; *hasResultType = true; break; + case Op::OpFNegate: *hasResult = true; *hasResultType = true; break; + case Op::OpIAdd: *hasResult = true; *hasResultType = true; break; + case Op::OpFAdd: *hasResult = true; *hasResultType = true; break; + case Op::OpISub: *hasResult = true; *hasResultType = true; break; + case Op::OpFSub: *hasResult = true; *hasResultType = true; break; + case Op::OpIMul: *hasResult = true; *hasResultType = true; break; + case Op::OpFMul: *hasResult = true; *hasResultType = true; break; + case Op::OpUDiv: *hasResult = true; *hasResultType = true; break; + case Op::OpSDiv: *hasResult = true; *hasResultType = true; break; + case Op::OpFDiv: *hasResult = true; *hasResultType = true; break; + case Op::OpUMod: *hasResult = true; *hasResultType = true; break; + case Op::OpSRem: *hasResult = true; *hasResultType = true; break; + case Op::OpSMod: *hasResult = true; *hasResultType = true; break; + case Op::OpFRem: *hasResult = true; *hasResultType = true; break; + case Op::OpFMod: *hasResult = true; *hasResultType = true; break; + case Op::OpVectorTimesScalar: *hasResult = true; *hasResultType = true; break; + case Op::OpMatrixTimesScalar: *hasResult = true; *hasResultType = true; break; + case Op::OpVectorTimesMatrix: *hasResult = true; *hasResultType = true; break; + case Op::OpMatrixTimesVector: *hasResult = true; *hasResultType = true; break; + case Op::OpMatrixTimesMatrix: *hasResult = true; *hasResultType = true; break; + case Op::OpOuterProduct: *hasResult = true; *hasResultType = true; break; + case Op::OpDot: *hasResult = true; *hasResultType = true; break; + case Op::OpIAddCarry: *hasResult = true; *hasResultType = true; break; + case Op::OpISubBorrow: *hasResult = true; *hasResultType = true; break; + case Op::OpUMulExtended: *hasResult = true; *hasResultType = true; break; + case Op::OpSMulExtended: *hasResult = true; *hasResultType = true; break; + case Op::OpAny: *hasResult = true; *hasResultType = true; break; + case Op::OpAll: *hasResult = true; *hasResultType = true; break; + case Op::OpIsNan: *hasResult = true; *hasResultType = true; break; + case Op::OpIsInf: *hasResult = true; *hasResultType = true; break; + case Op::OpIsFinite: *hasResult = true; *hasResultType = true; break; + case Op::OpIsNormal: *hasResult = true; *hasResultType = true; break; + case Op::OpSignBitSet: *hasResult = true; *hasResultType = true; break; + case Op::OpLessOrGreater: *hasResult = true; *hasResultType = true; break; + case Op::OpOrdered: *hasResult = true; *hasResultType = true; break; + case Op::OpUnordered: *hasResult = true; *hasResultType = true; break; + case Op::OpLogicalEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpLogicalNotEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpLogicalOr: *hasResult = true; *hasResultType = true; break; + case Op::OpLogicalAnd: *hasResult = true; *hasResultType = true; break; + case Op::OpLogicalNot: *hasResult = true; *hasResultType = true; break; + case Op::OpSelect: *hasResult = true; *hasResultType = true; break; + case Op::OpIEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpINotEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpUGreaterThan: *hasResult = true; *hasResultType = true; break; + case Op::OpSGreaterThan: *hasResult = true; *hasResultType = true; break; + case Op::OpUGreaterThanEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpSGreaterThanEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpULessThan: *hasResult = true; *hasResultType = true; break; + case Op::OpSLessThan: *hasResult = true; *hasResultType = true; break; + case Op::OpULessThanEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpSLessThanEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpFOrdEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpFUnordEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpFOrdNotEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpFUnordNotEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpFOrdLessThan: *hasResult = true; *hasResultType = true; break; + case Op::OpFUnordLessThan: *hasResult = true; *hasResultType = true; break; + case Op::OpFOrdGreaterThan: *hasResult = true; *hasResultType = true; break; + case Op::OpFUnordGreaterThan: *hasResult = true; *hasResultType = true; break; + case Op::OpFOrdLessThanEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpFUnordLessThanEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpFOrdGreaterThanEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpFUnordGreaterThanEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpShiftRightLogical: *hasResult = true; *hasResultType = true; break; + case Op::OpShiftRightArithmetic: *hasResult = true; *hasResultType = true; break; + case Op::OpShiftLeftLogical: *hasResult = true; *hasResultType = true; break; + case Op::OpBitwiseOr: *hasResult = true; *hasResultType = true; break; + case Op::OpBitwiseXor: *hasResult = true; *hasResultType = true; break; + case Op::OpBitwiseAnd: *hasResult = true; *hasResultType = true; break; + case Op::OpNot: *hasResult = true; *hasResultType = true; break; + case Op::OpBitFieldInsert: *hasResult = true; *hasResultType = true; break; + case Op::OpBitFieldSExtract: *hasResult = true; *hasResultType = true; break; + case Op::OpBitFieldUExtract: *hasResult = true; *hasResultType = true; break; + case Op::OpBitReverse: *hasResult = true; *hasResultType = true; break; + case Op::OpBitCount: *hasResult = true; *hasResultType = true; break; + case Op::OpDPdx: *hasResult = true; *hasResultType = true; break; + case Op::OpDPdy: *hasResult = true; *hasResultType = true; break; + case Op::OpFwidth: *hasResult = true; *hasResultType = true; break; + case Op::OpDPdxFine: *hasResult = true; *hasResultType = true; break; + case Op::OpDPdyFine: *hasResult = true; *hasResultType = true; break; + case Op::OpFwidthFine: *hasResult = true; *hasResultType = true; break; + case Op::OpDPdxCoarse: *hasResult = true; *hasResultType = true; break; + case Op::OpDPdyCoarse: *hasResult = true; *hasResultType = true; break; + case Op::OpFwidthCoarse: *hasResult = true; *hasResultType = true; break; + case Op::OpEmitVertex: *hasResult = false; *hasResultType = false; break; + case Op::OpEndPrimitive: *hasResult = false; *hasResultType = false; break; + case Op::OpEmitStreamVertex: *hasResult = false; *hasResultType = false; break; + case Op::OpEndStreamPrimitive: *hasResult = false; *hasResultType = false; break; + case Op::OpControlBarrier: *hasResult = false; *hasResultType = false; break; + case Op::OpMemoryBarrier: *hasResult = false; *hasResultType = false; break; + case Op::OpAtomicLoad: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicStore: *hasResult = false; *hasResultType = false; break; + case Op::OpAtomicExchange: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicCompareExchange: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicCompareExchangeWeak: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicIIncrement: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicIDecrement: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicIAdd: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicISub: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicSMin: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicUMin: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicSMax: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicUMax: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicAnd: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicOr: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicXor: *hasResult = true; *hasResultType = true; break; + case Op::OpPhi: *hasResult = true; *hasResultType = true; break; + case Op::OpLoopMerge: *hasResult = false; *hasResultType = false; break; + case Op::OpSelectionMerge: *hasResult = false; *hasResultType = false; break; + case Op::OpLabel: *hasResult = true; *hasResultType = false; break; + case Op::OpBranch: *hasResult = false; *hasResultType = false; break; + case Op::OpBranchConditional: *hasResult = false; *hasResultType = false; break; + case Op::OpSwitch: *hasResult = false; *hasResultType = false; break; + case Op::OpKill: *hasResult = false; *hasResultType = false; break; + case Op::OpReturn: *hasResult = false; *hasResultType = false; break; + case Op::OpReturnValue: *hasResult = false; *hasResultType = false; break; + case Op::OpUnreachable: *hasResult = false; *hasResultType = false; break; + case Op::OpLifetimeStart: *hasResult = false; *hasResultType = false; break; + case Op::OpLifetimeStop: *hasResult = false; *hasResultType = false; break; + case Op::OpGroupAsyncCopy: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupWaitEvents: *hasResult = false; *hasResultType = false; break; + case Op::OpGroupAll: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupAny: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupBroadcast: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupIAdd: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupFAdd: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupFMin: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupUMin: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupSMin: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupFMax: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupUMax: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupSMax: *hasResult = true; *hasResultType = true; break; + case Op::OpReadPipe: *hasResult = true; *hasResultType = true; break; + case Op::OpWritePipe: *hasResult = true; *hasResultType = true; break; + case Op::OpReservedReadPipe: *hasResult = true; *hasResultType = true; break; + case Op::OpReservedWritePipe: *hasResult = true; *hasResultType = true; break; + case Op::OpReserveReadPipePackets: *hasResult = true; *hasResultType = true; break; + case Op::OpReserveWritePipePackets: *hasResult = true; *hasResultType = true; break; + case Op::OpCommitReadPipe: *hasResult = false; *hasResultType = false; break; + case Op::OpCommitWritePipe: *hasResult = false; *hasResultType = false; break; + case Op::OpIsValidReserveId: *hasResult = true; *hasResultType = true; break; + case Op::OpGetNumPipePackets: *hasResult = true; *hasResultType = true; break; + case Op::OpGetMaxPipePackets: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupReserveReadPipePackets: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupReserveWritePipePackets: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupCommitReadPipe: *hasResult = false; *hasResultType = false; break; + case Op::OpGroupCommitWritePipe: *hasResult = false; *hasResultType = false; break; + case Op::OpEnqueueMarker: *hasResult = true; *hasResultType = true; break; + case Op::OpEnqueueKernel: *hasResult = true; *hasResultType = true; break; + case Op::OpGetKernelNDrangeSubGroupCount: *hasResult = true; *hasResultType = true; break; + case Op::OpGetKernelNDrangeMaxSubGroupSize: *hasResult = true; *hasResultType = true; break; + case Op::OpGetKernelWorkGroupSize: *hasResult = true; *hasResultType = true; break; + case Op::OpGetKernelPreferredWorkGroupSizeMultiple: *hasResult = true; *hasResultType = true; break; + case Op::OpRetainEvent: *hasResult = false; *hasResultType = false; break; + case Op::OpReleaseEvent: *hasResult = false; *hasResultType = false; break; + case Op::OpCreateUserEvent: *hasResult = true; *hasResultType = true; break; + case Op::OpIsValidEvent: *hasResult = true; *hasResultType = true; break; + case Op::OpSetUserEventStatus: *hasResult = false; *hasResultType = false; break; + case Op::OpCaptureEventProfilingInfo: *hasResult = false; *hasResultType = false; break; + case Op::OpGetDefaultQueue: *hasResult = true; *hasResultType = true; break; + case Op::OpBuildNDRange: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseSampleImplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseSampleExplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseSampleDrefImplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseSampleDrefExplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseSampleProjImplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseSampleProjExplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseSampleProjDrefImplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseSampleProjDrefExplicitLod: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseFetch: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseGather: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseDrefGather: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSparseTexelsResident: *hasResult = true; *hasResultType = true; break; + case Op::OpNoLine: *hasResult = false; *hasResultType = false; break; + case Op::OpAtomicFlagTestAndSet: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicFlagClear: *hasResult = false; *hasResultType = false; break; + case Op::OpImageSparseRead: *hasResult = true; *hasResultType = true; break; + case Op::OpSizeOf: *hasResult = true; *hasResultType = true; break; + case Op::OpTypePipeStorage: *hasResult = true; *hasResultType = false; break; + case Op::OpConstantPipeStorage: *hasResult = true; *hasResultType = true; break; + case Op::OpCreatePipeFromPipeStorage: *hasResult = true; *hasResultType = true; break; + case Op::OpGetKernelLocalSizeForSubgroupCount: *hasResult = true; *hasResultType = true; break; + case Op::OpGetKernelMaxNumSubgroups: *hasResult = true; *hasResultType = true; break; + case Op::OpTypeNamedBarrier: *hasResult = true; *hasResultType = false; break; + case Op::OpNamedBarrierInitialize: *hasResult = true; *hasResultType = true; break; + case Op::OpMemoryNamedBarrier: *hasResult = false; *hasResultType = false; break; + case Op::OpModuleProcessed: *hasResult = false; *hasResultType = false; break; + case Op::OpExecutionModeId: *hasResult = false; *hasResultType = false; break; + case Op::OpDecorateId: *hasResult = false; *hasResultType = false; break; + case Op::OpGroupNonUniformElect: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformAll: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformAny: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformAllEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformBroadcast: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformBroadcastFirst: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformBallot: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformInverseBallot: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformBallotBitExtract: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformBallotBitCount: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformBallotFindLSB: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformBallotFindMSB: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformShuffle: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformShuffleXor: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformShuffleUp: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformShuffleDown: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformIAdd: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformFAdd: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformIMul: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformFMul: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformSMin: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformUMin: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformFMin: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformSMax: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformUMax: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformFMax: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformBitwiseAnd: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformBitwiseOr: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformBitwiseXor: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformLogicalAnd: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformLogicalOr: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformLogicalXor: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformQuadBroadcast: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformQuadSwap: *hasResult = true; *hasResultType = true; break; + case Op::OpCopyLogical: *hasResult = true; *hasResultType = true; break; + case Op::OpPtrEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpPtrNotEqual: *hasResult = true; *hasResultType = true; break; + case Op::OpPtrDiff: *hasResult = true; *hasResultType = true; break; + 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::OpTerminateInvocation: *hasResult = false; *hasResultType = false; break; + case Op::OpSubgroupBallotKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupFirstInvocationKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpTraceRayKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpIgnoreIntersectionKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpTerminateRayKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpSDot: *hasResult = true; *hasResultType = true; break; + case Op::OpUDot: *hasResult = true; *hasResultType = true; break; + case Op::OpSUDot: *hasResult = true; *hasResultType = true; break; + case Op::OpSDotAccSat: *hasResult = true; *hasResultType = true; break; + case Op::OpUDotAccSat: *hasResult = true; *hasResultType = true; break; + case Op::OpSUDotAccSat: *hasResult = true; *hasResultType = true; break; + case Op::OpTypeCooperativeMatrixKHR: *hasResult = true; *hasResultType = false; break; + case Op::OpCooperativeMatrixLoadKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpCooperativeMatrixStoreKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpCooperativeMatrixMulAddKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpCooperativeMatrixLengthKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpTypeRayQueryKHR: *hasResult = true; *hasResultType = false; break; + case Op::OpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpRayQueryGenerateIntersectionKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpRayQueryConfirmIntersectionKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpRayQueryProceedKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionTypeKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpImageSampleWeightedQCOM: *hasResult = true; *hasResultType = true; break; + 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::OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupUMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupSMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupFMaxNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupUMaxNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupSMaxNonUniformAMD: *hasResult = true; *hasResultType = true; break; + case Op::OpFragmentMaskFetchAMD: *hasResult = true; *hasResultType = true; break; + case Op::OpFragmentFetchAMD: *hasResult = true; *hasResultType = true; break; + case Op::OpReadClockKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpFinalizeNodePayloadsAMDX: *hasResult = false; *hasResultType = false; break; + case Op::OpFinishWritingNodePayloadAMDX: *hasResult = true; *hasResultType = true; break; + case Op::OpInitializeNodePayloadsAMDX: *hasResult = false; *hasResultType = false; 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; + case Op::OpHitObjectGetWorldToObjectNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetObjectToWorldNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetObjectRayDirectionNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetObjectRayOriginNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectTraceRayMotionNV: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectGetShaderRecordBufferHandleNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetShaderBindingTableRecordIndexNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectRecordEmptyNV: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectTraceRayNV: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordHitNV: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordHitWithIndexNV: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectRecordMissNV: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectExecuteShaderNV: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectGetCurrentTimeNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetAttributesNV: *hasResult = false; *hasResultType = false; break; + case Op::OpHitObjectGetHitKindNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetPrimitiveIndexNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetGeometryIndexNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetInstanceIdNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetInstanceCustomIndexNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetWorldRayDirectionNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetWorldRayOriginNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetRayTMaxNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectGetRayTMinNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectIsEmptyNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectIsHitNV: *hasResult = true; *hasResultType = true; break; + case Op::OpHitObjectIsMissNV: *hasResult = true; *hasResultType = true; break; + case Op::OpReorderThreadWithHitObjectNV: *hasResult = false; *hasResultType = false; break; + case Op::OpReorderThreadWithHintNV: *hasResult = false; *hasResultType = false; break; + case Op::OpTypeHitObjectNV: *hasResult = true; *hasResultType = false; break; + case Op::OpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break; + case Op::OpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break; + case Op::OpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break; + case Op::OpReportIntersectionNV: *hasResult = true; *hasResultType = true; break; + case Op::OpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break; + case Op::OpTerminateRayNV: *hasResult = false; *hasResultType = false; break; + case Op::OpTraceNV: *hasResult = false; *hasResultType = false; break; + case Op::OpTraceMotionNV: *hasResult = false; *hasResultType = false; break; + case Op::OpTraceRayMotionNV: *hasResult = false; *hasResultType = false; break; + case Op::OpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpTypeAccelerationStructureNV: *hasResult = true; *hasResultType = false; break; + case Op::OpExecuteCallableNV: *hasResult = false; *hasResultType = false; 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; + case Op::OpCooperativeMatrixMulAddNV: *hasResult = true; *hasResultType = true; break; + case Op::OpCooperativeMatrixLengthNV: *hasResult = true; *hasResultType = true; break; + case Op::OpBeginInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpEndInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break; + case Op::OpDemoteToHelperInvocation: *hasResult = false; *hasResultType = false; break; + case Op::OpIsHelperInvocationEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertUToImageNV: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertUToSamplerNV: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertImageToUNV: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertSamplerToUNV: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertUToSampledImageNV: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertSampledImageToUNV: *hasResult = true; *hasResultType = true; break; + case Op::OpSamplerImageAddressingModeNV: *hasResult = false; *hasResultType = false; break; + case Op::OpSubgroupShuffleINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupShuffleDownINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupShuffleUpINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupShuffleXorINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupBlockReadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; + case Op::OpSubgroupImageBlockReadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupImageBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; + case Op::OpSubgroupImageMediaBlockReadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupImageMediaBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; + case Op::OpUCountLeadingZerosINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpUCountTrailingZerosINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpAbsISubINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpAbsUSubINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpIAddSatINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpUAddSatINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpIAverageINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpUAverageINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpIAverageRoundedINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpUAverageRoundedINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpISubSatINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpUSubSatINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpIMul32x16INTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpUMul32x16INTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpConstantFunctionPointerINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFunctionPointerCallINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpAsmTargetINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpAsmINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpAsmCallINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicFMinEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicFMaxEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpAssumeTrueKHR: *hasResult = false; *hasResultType = false; break; + case Op::OpExpectKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpDecorateString: *hasResult = false; *hasResultType = false; break; + case Op::OpMemberDecorateString: *hasResult = false; *hasResultType = false; break; + case Op::OpVmeImageINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpTypeVmeImageINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcImePayloadINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcRefPayloadINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcSicPayloadINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcMcePayloadINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcMceResultINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcImeResultINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcImeResultSingleReferenceStreamoutINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcImeResultDualReferenceStreamoutINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcImeSingleReferenceStreaminINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcImeDualReferenceStreaminINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcRefResultINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeAvcSicResultINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceSetInterShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceSetInterDirectionPenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceSetAcOnlyHaarINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceConvertToImePayloadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceConvertToImeResultINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceConvertToRefPayloadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceConvertToRefResultINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceConvertToSicPayloadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceConvertToSicResultINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetMotionVectorsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetInterDistortionsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetBestInterDistortionsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetInterMajorShapeINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetInterMinorShapeINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetInterDirectionsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetInterMotionVectorCountINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetInterReferenceIdsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeInitializeINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeSetSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeSetDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeRefWindowSizeINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeAdjustRefOffsetINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeConvertToMcePayloadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeSetMaxMotionVectorCountINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeSetWeightedSadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeEvaluateWithDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeConvertToMceResultINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetSingleReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetDualReferenceStreaminINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeStripDualReferenceStreamoutINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetBorderReachedINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcFmeInitializeINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcBmeInitializeINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcRefConvertToMcePayloadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcRefSetBidirectionalMixDisableINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcRefSetBilinearFilterEnableINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcRefEvaluateWithDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcRefConvertToMceResultINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicInitializeINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicConfigureSkcINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicConfigureIpeLumaINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicConfigureIpeLumaChromaINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicGetMotionVectorMaskINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicConvertToMcePayloadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicSetBilinearFilterEnableINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicEvaluateIpeINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicEvaluateWithDualReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicConvertToMceResultINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicGetIpeLumaShapeINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicGetPackedIpeLumaModesINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicGetIpeChromaModeINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSubgroupAvcSicGetInterRawSadsINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpSaveMemoryINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpRestoreMemoryINTEL: *hasResult = false; *hasResultType = false; break; + case Op::OpArbitraryFloatSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatCastINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatCastFromIntINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatCastToIntINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatAddINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatSubINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatMulINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatDivINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatGTINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatGEINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatLTINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatLEINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatEQINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatRecipINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatRSqrtINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatCbrtINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatHypotINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatSqrtINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatLogINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatLog2INTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatLog10INTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatLog1pINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatExpINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatExp2INTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatExp10INTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatExpm1INTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatSinINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatCosINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatSinCosINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatSinPiINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatCosPiINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatASinINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatASinPiINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatACosINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatACosPiINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatATanINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatATanPiINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatATan2INTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatPowINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatPowRINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpArbitraryFloatPowNINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpLoopControlINTEL: *hasResult = false; *hasResultType = false; break; + case Op::OpAliasDomainDeclINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpAliasScopeDeclINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpAliasScopeListDeclINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedSinINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedCosINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedSinCosINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedSinPiINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedCosPiINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedSinCosPiINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedLogINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFixedExpINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpPtrCastToCrossWorkgroupINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpCrossWorkgroupCastToPtrINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpReadPipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpWritePipeBlockingINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpFPGARegINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetRayTMinKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetRayFlagsKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionTKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionInstanceCustomIndexKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionInstanceIdKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionGeometryIndexKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionPrimitiveIndexKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionBarycentricsKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionFrontFaceKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionCandidateAABBOpaqueKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionObjectRayDirectionKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionObjectRayOriginKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetWorldRayDirectionKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetWorldRayOriginKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionObjectToWorldKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpRayQueryGetIntersectionWorldToObjectKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpAtomicFAddEXT: *hasResult = true; *hasResultType = true; break; + case Op::OpTypeBufferSurfaceINTEL: *hasResult = true; *hasResultType = false; break; + case Op::OpTypeStructContinuedINTEL: *hasResult = false; *hasResultType = false; break; + case Op::OpConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break; + case Op::OpSpecConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break; + case Op::OpConvertFToBF16INTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpConvertBF16ToFINTEL: *hasResult = true; *hasResultType = true; break; + case Op::OpControlBarrierArriveINTEL: *hasResult = false; *hasResultType = false; break; + case Op::OpControlBarrierWaitINTEL: *hasResult = false; *hasResultType = false; break; + case Op::OpGroupIMulKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupFMulKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupBitwiseAndKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupBitwiseOrKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupBitwiseXorKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupLogicalAndKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupLogicalOrKHR: *hasResult = true; *hasResultType = true; break; + case Op::OpGroupLogicalXorKHR: *hasResult = true; *hasResultType = true; break; + } +} +#endif /* SPV_ENABLE_UTILITY_CODE */ + +// Overload bitwise operators for mask bit combining + +constexpr ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +constexpr ImageOperandsMask operator&(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) & unsigned(b)); } +constexpr ImageOperandsMask operator^(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) ^ unsigned(b)); } +constexpr ImageOperandsMask operator~(ImageOperandsMask a) { return ImageOperandsMask(~unsigned(a)); } +constexpr FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +constexpr FPFastMathModeMask operator&(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) & unsigned(b)); } +constexpr FPFastMathModeMask operator^(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) ^ unsigned(b)); } +constexpr FPFastMathModeMask operator~(FPFastMathModeMask a) { return FPFastMathModeMask(~unsigned(a)); } +constexpr SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +constexpr SelectionControlMask operator&(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) & unsigned(b)); } +constexpr SelectionControlMask operator^(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) ^ unsigned(b)); } +constexpr SelectionControlMask operator~(SelectionControlMask a) { return SelectionControlMask(~unsigned(a)); } +constexpr LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +constexpr LoopControlMask operator&(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) & unsigned(b)); } +constexpr LoopControlMask operator^(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) ^ unsigned(b)); } +constexpr LoopControlMask operator~(LoopControlMask a) { return LoopControlMask(~unsigned(a)); } +constexpr FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +constexpr FunctionControlMask operator&(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) & unsigned(b)); } +constexpr FunctionControlMask operator^(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) ^ unsigned(b)); } +constexpr FunctionControlMask operator~(FunctionControlMask a) { return FunctionControlMask(~unsigned(a)); } +constexpr MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +constexpr MemorySemanticsMask operator&(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) & unsigned(b)); } +constexpr MemorySemanticsMask operator^(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) ^ unsigned(b)); } +constexpr MemorySemanticsMask operator~(MemorySemanticsMask a) { return MemorySemanticsMask(~unsigned(a)); } +constexpr MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +constexpr MemoryAccessMask operator&(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) & unsigned(b)); } +constexpr MemoryAccessMask operator^(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) ^ unsigned(b)); } +constexpr MemoryAccessMask operator~(MemoryAccessMask a) { return MemoryAccessMask(~unsigned(a)); } +constexpr KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } +constexpr KernelProfilingInfoMask operator&(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) & unsigned(b)); } +constexpr KernelProfilingInfoMask operator^(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) ^ unsigned(b)); } +constexpr KernelProfilingInfoMask operator~(KernelProfilingInfoMask a) { return KernelProfilingInfoMask(~unsigned(a)); } +constexpr RayFlagsMask operator|(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) | unsigned(b)); } +constexpr RayFlagsMask operator&(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) & unsigned(b)); } +constexpr RayFlagsMask operator^(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) ^ unsigned(b)); } +constexpr RayFlagsMask operator~(RayFlagsMask a) { return RayFlagsMask(~unsigned(a)); } +constexpr FragmentShadingRateMask operator|(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) | unsigned(b)); } +constexpr FragmentShadingRateMask operator&(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) & unsigned(b)); } +constexpr FragmentShadingRateMask operator^(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) ^ unsigned(b)); } +constexpr FragmentShadingRateMask operator~(FragmentShadingRateMask a) { return FragmentShadingRateMask(~unsigned(a)); } +constexpr CooperativeMatrixOperandsMask operator|(CooperativeMatrixOperandsMask a, CooperativeMatrixOperandsMask b) { return CooperativeMatrixOperandsMask(unsigned(a) | unsigned(b)); } +constexpr CooperativeMatrixOperandsMask operator&(CooperativeMatrixOperandsMask a, CooperativeMatrixOperandsMask b) { return CooperativeMatrixOperandsMask(unsigned(a) & unsigned(b)); } +constexpr CooperativeMatrixOperandsMask operator^(CooperativeMatrixOperandsMask a, CooperativeMatrixOperandsMask b) { return CooperativeMatrixOperandsMask(unsigned(a) ^ unsigned(b)); } +constexpr CooperativeMatrixOperandsMask operator~(CooperativeMatrixOperandsMask a) { return CooperativeMatrixOperandsMask(~unsigned(a)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.json b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.json index ebd09eec..b1b60a4c 100644 --- a/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.json +++ b/bgfx/3rdparty/spirv-headers/include/spirv/unified1/spirv.json @@ -75,7 +75,10 @@ "OpenCL_CPP": 4, "HLSL": 5, "CPP_for_OpenCL": 6, - "SYCL": 7 + "SYCL": 7, + "HERO_C": 8, + "NZSL": 9, + "WGSL": 10 } }, { @@ -175,6 +178,9 @@ "SubgroupsPerWorkgroupId": 37, "LocalSizeId": 38, "LocalSizeHintId": 39, + "NonCoherentColorAttachmentReadEXT": 4169, + "NonCoherentDepthAttachmentReadEXT": 4170, + "NonCoherentStencilAttachmentReadEXT": 4171, "SubgroupUniformControlFlowKHR": 4421, "PostDepthCoverage": 4446, "DenormPreserve": 4459, @@ -184,6 +190,11 @@ "RoundingModeRTZ": 4463, "EarlyAndLateFragmentTestsAMD": 5017, "StencilRefReplacingEXT": 5027, + "CoalescingAMDX": 5069, + "MaxNodeRecursionAMDX": 5071, + "StaticNumWorkgroupsAMDX": 5072, + "ShaderIndexAMDX": 5073, + "MaxNumWorkgroupsAMDX": 5077, "StencilRefUnchangedFrontAMD": 5079, "StencilRefGreaterFrontAMD": 5080, "StencilRefLessFrontAMD": 5081, @@ -214,6 +225,8 @@ "NoGlobalOffsetINTEL": 5895, "NumSIMDWorkitemsINTEL": 5896, "SchedulerTargetFmaxMhzINTEL": 5903, + "StreamingInterfaceINTEL": 6154, + "RegisterMapInterfaceINTEL": 6160, "NamedBarrierCountINTEL": 6417 } }, @@ -235,6 +248,9 @@ "AtomicCounter": 10, "Image": 11, "StorageBuffer": 12, + "TileImageEXT": 4172, + "NodePayloadAMDX": 5068, + "NodeOutputPayloadAMDX": 5076, "CallableDataKHR": 5328, "CallableDataNV": 5328, "IncomingCallableDataKHR": 5329, @@ -249,6 +265,7 @@ "ShaderRecordBufferNV": 5343, "PhysicalStorageBuffer": 5349, "PhysicalStorageBufferEXT": 5349, + "HitObjectAttributeNV": 5385, "TaskPayloadWorkgroupEXT": 5402, "CodeSectionINTEL": 5605, "DeviceOnlyINTEL": 5936, @@ -266,7 +283,8 @@ "Cube": 3, "Rect": 4, "Buffer": 5, - "SubpassData": 6 + "SubpassData": 6, + "TileImageDataEXT": 4173 } }, { @@ -387,7 +405,9 @@ "HalfFloat": 13, "Float": 14, "UnormInt24": 15, - "UnormInt101010_2": 16 + "UnormInt101010_2": 16, + "UnsignedIntRaw10EXT": 19, + "UnsignedIntRaw12EXT": 20 } }, { @@ -474,7 +494,8 @@ "NoAlias": 4, "NoCapture": 5, "NoWrite": 6, - "NoReadWrite": 7 + "NoReadWrite": 7, + "RuntimeAlignedINTEL": 5940 } }, { @@ -531,7 +552,13 @@ "MaxByteOffsetId": 47, "NoSignedWrap": 4469, "NoUnsignedWrap": 4470, + "WeightTextureQCOM": 4487, + "BlockMatchTextureQCOM": 4488, "ExplicitInterpAMD": 4999, + "NodeSharesPayloadLimitsWithAMDX": 5019, + "NodeMaxPayloadsAMDX": 5020, + "TrackFinishWritingAMDX": 5078, + "PayloadNodeNameAMDX": 5091, "OverrideCoverageNV": 5248, "PassthroughNV": 5250, "ViewportRelativeNV": 5252, @@ -548,6 +575,7 @@ "RestrictPointerEXT": 5355, "AliasedPointer": 5356, "AliasedPointerEXT": 5356, + "HitObjectShaderRecordBufferNV": 5386, "BindlessSamplerNV": 5398, "BindlessImageNV": 5399, "BoundSamplerNV": 5400, @@ -586,14 +614,33 @@ "PrefetchINTEL": 5902, "StallEnableINTEL": 5905, "FuseLoopsInFunctionINTEL": 5907, + "MathOpDSPModeINTEL": 5909, "AliasScopeINTEL": 5914, "NoAliasINTEL": 5915, + "InitiationIntervalINTEL": 5917, + "MaxConcurrencyINTEL": 5918, + "PipelineEnableINTEL": 5919, "BufferLocationINTEL": 5921, "IOPipeStorageINTEL": 5944, "FunctionFloatingPointModeINTEL": 6080, "SingleElementVectorINTEL": 6085, "VectorComputeCallableFunctionINTEL": 6087, - "MediaBlockIOINTEL": 6140 + "MediaBlockIOINTEL": 6140, + "InitModeINTEL": 6147, + "ImplementInRegisterMapINTEL": 6148, + "HostAccessINTEL": 6168, + "FPMaxErrorDecorationINTEL": 6170, + "LatencyControlLabelINTEL": 6172, + "LatencyControlConstraintINTEL": 6173, + "ConduitKernelArgumentINTEL": 6175, + "RegisterMapKernelArgumentINTEL": 6176, + "MMHostInterfaceAddressWidthINTEL": 6177, + "MMHostInterfaceDataWidthINTEL": 6178, + "MMHostInterfaceLatencyINTEL": 6179, + "MMHostInterfaceReadWriteModeINTEL": 6180, + "MMHostInterfaceMaxBurstINTEL": 6181, + "MMHostInterfaceWaitRequestINTEL": 6182, + "StableKernelArgumentINTEL": 6183 } }, { @@ -672,6 +719,8 @@ "BaryCoordSmoothSampleAMD": 4997, "BaryCoordPullModelAMD": 4998, "FragStencilRefEXT": 5014, + "CoalescedInputCountAMDX": 5021, + "ShaderIndexAMDX": 5073, "ViewportMaskNV": 5253, "SecondaryPositionNV": 5257, "SecondaryViewportMaskNV": 5258, @@ -724,6 +773,7 @@ "HitKindKHR": 5333, "HitKindNV": 5333, "CurrentRayTimeNV": 5334, + "HitTriangleVertexPositionsKHR": 5335, "IncomingRayFlagsKHR": 5351, "IncomingRayFlagsNV": 5351, "RayGeometryIndexKHR": 5352, @@ -764,7 +814,9 @@ "LoopCoalesceINTEL": 20, "MaxInterleavingINTEL": 21, "SpeculatedIterationsINTEL": 22, - "NoFusionINTEL": 23 + "NoFusionINTEL": 23, + "LoopCountINTEL": 24, + "MaxReinvocationDelayINTEL": 25 } }, { @@ -944,6 +996,9 @@ "ShaderViewportIndex": 70, "UniformDecoration": 71, "CoreBuiltinsARM": 4165, + "TileImageColorReadAccessEXT": 4166, + "TileImageDepthReadAccessEXT": 4167, + "TileImageStencilReadAccessEXT": 4168, "FragmentShadingRateKHR": 4422, "SubgroupBallotKHR": 4423, "DrawParameters": 4427, @@ -975,6 +1030,9 @@ "RayQueryKHR": 4472, "RayTraversalPrimitiveCullingKHR": 4478, "RayTracingKHR": 4479, + "TextureSampleWeightedQCOM": 4484, + "TextureBoxFilterQCOM": 4485, + "TextureBlockMatchQCOM": 4486, "Float16ImageAMD": 5008, "ImageGatherBiasLodAMD": 5009, "FragmentMaskAMD": 5010, @@ -982,6 +1040,7 @@ "ImageReadWriteLodAMD": 5015, "Int64ImageEXT": 5016, "ShaderClockKHR": 5055, + "ShaderEnqueueAMDX": 5067, "SampleMaskOverrideCoverageNV": 5249, "GeometryShaderPassthroughNV": 5251, "ShaderViewportIndexLayerEXT": 5254, @@ -1023,6 +1082,7 @@ "UniformTexelBufferArrayNonUniformIndexingEXT": 5311, "StorageTexelBufferArrayNonUniformIndexing": 5312, "StorageTexelBufferArrayNonUniformIndexingEXT": 5312, + "RayTracingPositionFetchKHR": 5336, "RayTracingNV": 5340, "RayTracingMotionBlurNV": 5341, "VulkanMemoryModel": 5345, @@ -1040,7 +1100,10 @@ "FragmentShaderPixelInterlockEXT": 5378, "DemoteToHelperInvocation": 5379, "DemoteToHelperInvocationEXT": 5379, + "RayTracingOpacityMicromapEXT": 5381, + "ShaderInvocationReorderNV": 5383, "BindlessTextureNV": 5390, + "RayQueryPositionFetchKHR": 5391, "SubgroupShuffleINTEL": 5568, "SubgroupBufferBlockIOINTEL": 5569, "SubgroupImageBlockIOINTEL": 5570, @@ -1073,10 +1136,13 @@ "FPGAMemoryAccessesINTEL": 5898, "FPGAClusterAttributesINTEL": 5904, "LoopFuseINTEL": 5906, + "FPGADSPControlINTEL": 5908, "MemoryAccessAliasingINTEL": 5910, + "FPGAInvocationPipeliningAttributesINTEL": 5916, "FPGABufferLocationINTEL": 5920, "ArbitraryPrecisionFixedPointINTEL": 5922, "USMStorageClassesINTEL": 5935, + "RuntimeAlignedAttributeINTEL": 5939, "IOPipesINTEL": 5943, "BlockingPipesINTEL": 5945, "FPGARegINTEL": 5948, @@ -1089,6 +1155,7 @@ "DotProduct": 6019, "DotProductKHR": 6019, "RayCullMaskKHR": 6020, + "CooperativeMatrixKHR": 6022, "BitInstructions": 6025, "GroupNonUniformRotateKHR": 6026, "AtomicFloat32AddEXT": 6033, @@ -1097,7 +1164,14 @@ "OptNoneINTEL": 6094, "AtomicFloat16AddEXT": 6095, "DebugInfoModuleINTEL": 6114, + "BFloat16ConversionINTEL": 6115, "SplitBarrierINTEL": 6141, + "GlobalVariableFPGADecorationsINTEL": 6146, + "FPGAKernelAttributesv2INTEL": 6161, + "GlobalVariableHostAccessINTEL": 6167, + "FPMaxErrorINTEL": 6169, + "FPGALatencyControlINTEL": 6171, + "FPGAArgumentInterfacesINTEL": 6174, "GroupUniformArithmeticKHR": 6400 } }, @@ -1115,7 +1189,8 @@ "CullOpaqueKHR": 6, "CullNoOpaqueKHR": 7, "SkipTrianglesKHR": 8, - "SkipAABBsKHR": 9 + "SkipAABBsKHR": 9, + "ForceOpacityMicromap2StateEXT": 10 } }, { @@ -1210,6 +1285,57 @@ "PackedVectorFormat4x8BitKHR": 0 } }, + { + "Name": "CooperativeMatrixOperands", + "Type": "Bit", + "Values": + { + "MatrixASignedComponentsKHR": 0, + "MatrixBSignedComponentsKHR": 1, + "MatrixCSignedComponentsKHR": 2, + "MatrixResultSignedComponentsKHR": 3, + "SaturatingAccumulationKHR": 4 + } + }, + { + "Name": "CooperativeMatrixLayout", + "Type": "Value", + "Values": + { + "RowMajorKHR": 0, + "ColumnMajorKHR": 1 + } + }, + { + "Name": "CooperativeMatrixUse", + "Type": "Value", + "Values": + { + "MatrixAKHR": 0, + "MatrixBKHR": 1, + "MatrixAccumulatorKHR": 2 + } + }, + { + "Name": "InitializationModeQualifier", + "Type": "Value", + "Values": + { + "InitOnDeviceReprogramINTEL": 0, + "InitOnDeviceResetINTEL": 1 + } + }, + { + "Name": "HostAccessQualifier", + "Type": "Value", + "Values": + { + "NoneINTEL": 0, + "ReadINTEL": 1, + "WriteINTEL": 2, + "ReadWriteINTEL": 3 + } + }, { "Name": "Op", "Type": "Value", @@ -1559,6 +1685,9 @@ "OpPtrEqual": 401, "OpPtrNotEqual": 402, "OpPtrDiff": 403, + "OpColorAttachmentReadEXT": 4160, + "OpDepthAttachmentReadEXT": 4161, + "OpStencilAttachmentReadEXT": 4162, "OpTerminateInvocation": 4416, "OpSubgroupBallotKHR": 4421, "OpSubgroupFirstInvocationKHR": 4422, @@ -1584,6 +1713,11 @@ "OpUDotAccSatKHR": 4454, "OpSUDotAccSat": 4455, "OpSUDotAccSatKHR": 4455, + "OpTypeCooperativeMatrixKHR": 4456, + "OpCooperativeMatrixLoadKHR": 4457, + "OpCooperativeMatrixStoreKHR": 4458, + "OpCooperativeMatrixMulAddKHR": 4459, + "OpCooperativeMatrixLengthKHR": 4460, "OpTypeRayQueryKHR": 4472, "OpRayQueryInitializeKHR": 4473, "OpRayQueryTerminateKHR": 4474, @@ -1591,6 +1725,10 @@ "OpRayQueryConfirmIntersectionKHR": 4476, "OpRayQueryProceedKHR": 4477, "OpRayQueryGetIntersectionTypeKHR": 4479, + "OpImageSampleWeightedQCOM": 4480, + "OpImageBoxFilterQCOM": 4481, + "OpImageBlockMatchSSDQCOM": 4482, + "OpImageBlockMatchSADQCOM": 4483, "OpGroupIAddNonUniformAMD": 5000, "OpGroupFAddNonUniformAMD": 5001, "OpGroupFMinNonUniformAMD": 5002, @@ -1602,6 +1740,42 @@ "OpFragmentMaskFetchAMD": 5011, "OpFragmentFetchAMD": 5012, "OpReadClockKHR": 5056, + "OpFinalizeNodePayloadsAMDX": 5075, + "OpFinishWritingNodePayloadAMDX": 5078, + "OpInitializeNodePayloadsAMDX": 5090, + "OpHitObjectRecordHitMotionNV": 5249, + "OpHitObjectRecordHitWithIndexMotionNV": 5250, + "OpHitObjectRecordMissMotionNV": 5251, + "OpHitObjectGetWorldToObjectNV": 5252, + "OpHitObjectGetObjectToWorldNV": 5253, + "OpHitObjectGetObjectRayDirectionNV": 5254, + "OpHitObjectGetObjectRayOriginNV": 5255, + "OpHitObjectTraceRayMotionNV": 5256, + "OpHitObjectGetShaderRecordBufferHandleNV": 5257, + "OpHitObjectGetShaderBindingTableRecordIndexNV": 5258, + "OpHitObjectRecordEmptyNV": 5259, + "OpHitObjectTraceRayNV": 5260, + "OpHitObjectRecordHitNV": 5261, + "OpHitObjectRecordHitWithIndexNV": 5262, + "OpHitObjectRecordMissNV": 5263, + "OpHitObjectExecuteShaderNV": 5264, + "OpHitObjectGetCurrentTimeNV": 5265, + "OpHitObjectGetAttributesNV": 5266, + "OpHitObjectGetHitKindNV": 5267, + "OpHitObjectGetPrimitiveIndexNV": 5268, + "OpHitObjectGetGeometryIndexNV": 5269, + "OpHitObjectGetInstanceIdNV": 5270, + "OpHitObjectGetInstanceCustomIndexNV": 5271, + "OpHitObjectGetWorldRayDirectionNV": 5272, + "OpHitObjectGetWorldRayOriginNV": 5273, + "OpHitObjectGetRayTMaxNV": 5274, + "OpHitObjectGetRayTMinNV": 5275, + "OpHitObjectIsEmptyNV": 5276, + "OpHitObjectIsHitNV": 5277, + "OpHitObjectIsMissNV": 5278, + "OpReorderThreadWithHitObjectNV": 5279, + "OpReorderThreadWithHintNV": 5280, + "OpTypeHitObjectNV": 5281, "OpImageSampleFootprintNV": 5283, "OpEmitMeshTasksEXT": 5294, "OpSetMeshOutputsEXT": 5295, @@ -1614,6 +1788,7 @@ "OpTraceNV": 5337, "OpTraceMotionNV": 5338, "OpTraceRayMotionNV": 5339, + "OpRayQueryGetIntersectionTriangleVertexPositionsKHR": 5340, "OpTypeAccelerationStructureKHR": 5341, "OpTypeAccelerationStructureNV": 5341, "OpExecuteCallableNV": 5344, @@ -1875,6 +2050,8 @@ "OpTypeStructContinuedINTEL": 6090, "OpConstantCompositeContinuedINTEL": 6091, "OpSpecConstantCompositeContinuedINTEL": 6092, + "OpConvertFToBF16INTEL": 6116, + "OpConvertBF16ToFINTEL": 6117, "OpControlBarrierArriveINTEL": 6142, "OpControlBarrierWaitINTEL": 6143, "OpGroupIMulKHR": 6401, diff --git a/bgfx/3rdparty/spirv-tools/include/generated/build-version.inc b/bgfx/3rdparty/spirv-tools/include/generated/build-version.inc index fec6cef2..f1284e9c 100644 --- a/bgfx/3rdparty/spirv-tools/include/generated/build-version.inc +++ b/bgfx/3rdparty/spirv-tools/include/generated/build-version.inc @@ -1 +1 @@ -"v2022.4-dev", "SPIRV-Tools v2022.4-dev 9af8fde5414723dfc630c20d733548f881e4804a" +"v2023.4", "SPIRV-Tools v2023.4 v2022.4-324-gfaa88377" diff --git a/bgfx/3rdparty/spirv-tools/include/generated/core.insts-unified1.inc b/bgfx/3rdparty/spirv-tools/include/generated/core.insts-unified1.inc index 88d80690..6fb92bf5 100644 --- a/bgfx/3rdparty/spirv-tools/include/generated/core.insts-unified1.inc +++ b/bgfx/3rdparty/spirv-tools/include/generated/core.insts-unified1.inc @@ -1,79 +1,91 @@ -static const SpvCapability pygen_variable_caps_Addresses[] = {SpvCapabilityAddresses}; -static const SpvCapability pygen_variable_caps_AddressesPhysicalStorageBufferAddresses[] = {SpvCapabilityAddresses, SpvCapabilityPhysicalStorageBufferAddresses}; -static const SpvCapability pygen_variable_caps_AddressesVariablePointersVariablePointersStorageBuffer[] = {SpvCapabilityAddresses, SpvCapabilityVariablePointers, SpvCapabilityVariablePointersStorageBuffer}; -static const SpvCapability pygen_variable_caps_AddressesVariablePointersVariablePointersStorageBufferPhysicalStorageBufferAddresses[] = {SpvCapabilityAddresses, SpvCapabilityVariablePointers, SpvCapabilityVariablePointersStorageBuffer, SpvCapabilityPhysicalStorageBufferAddresses}; -static const SpvCapability pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL[] = {SpvCapabilityArbitraryPrecisionFixedPointINTEL}; -static const SpvCapability pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL[] = {SpvCapabilityArbitraryPrecisionFloatingPointINTEL}; -static const SpvCapability pygen_variable_caps_AsmINTEL[] = {SpvCapabilityAsmINTEL}; -static const SpvCapability pygen_variable_caps_AtomicFloat16AddEXTAtomicFloat32AddEXTAtomicFloat64AddEXT[] = {SpvCapabilityAtomicFloat16AddEXT, SpvCapabilityAtomicFloat32AddEXT, SpvCapabilityAtomicFloat64AddEXT}; -static const SpvCapability pygen_variable_caps_AtomicFloat16MinMaxEXTAtomicFloat32MinMaxEXTAtomicFloat64MinMaxEXT[] = {SpvCapabilityAtomicFloat16MinMaxEXT, SpvCapabilityAtomicFloat32MinMaxEXT, SpvCapabilityAtomicFloat64MinMaxEXT}; -static const SpvCapability pygen_variable_caps_BindlessTextureNV[] = {SpvCapabilityBindlessTextureNV}; -static const SpvCapability pygen_variable_caps_BlockingPipesINTEL[] = {SpvCapabilityBlockingPipesINTEL}; -static const SpvCapability pygen_variable_caps_CooperativeMatrixNV[] = {SpvCapabilityCooperativeMatrixNV}; -static const SpvCapability pygen_variable_caps_DemoteToHelperInvocation[] = {SpvCapabilityDemoteToHelperInvocation}; -static const SpvCapability pygen_variable_caps_DemoteToHelperInvocationEXT[] = {SpvCapabilityDemoteToHelperInvocationEXT}; -static const SpvCapability pygen_variable_caps_DerivativeControl[] = {SpvCapabilityDerivativeControl}; -static const SpvCapability pygen_variable_caps_DeviceEnqueue[] = {SpvCapabilityDeviceEnqueue}; -static const SpvCapability pygen_variable_caps_DotProduct[] = {SpvCapabilityDotProduct}; -static const SpvCapability pygen_variable_caps_DotProductKHR[] = {SpvCapabilityDotProductKHR}; -static const SpvCapability pygen_variable_caps_ExpectAssumeKHR[] = {SpvCapabilityExpectAssumeKHR}; -static const SpvCapability pygen_variable_caps_FPGARegINTEL[] = {SpvCapabilityFPGARegINTEL}; -static const SpvCapability pygen_variable_caps_FragmentMaskAMD[] = {SpvCapabilityFragmentMaskAMD}; -static const SpvCapability pygen_variable_caps_FragmentShaderSampleInterlockEXTFragmentShaderPixelInterlockEXTFragmentShaderShadingRateInterlockEXT[] = {SpvCapabilityFragmentShaderSampleInterlockEXT, SpvCapabilityFragmentShaderPixelInterlockEXT, SpvCapabilityFragmentShaderShadingRateInterlockEXT}; -static const SpvCapability pygen_variable_caps_FunctionPointersINTEL[] = {SpvCapabilityFunctionPointersINTEL}; -static const SpvCapability pygen_variable_caps_Geometry[] = {SpvCapabilityGeometry}; -static const SpvCapability pygen_variable_caps_GeometryStreams[] = {SpvCapabilityGeometryStreams}; -static const SpvCapability pygen_variable_caps_GroupNonUniform[] = {SpvCapabilityGroupNonUniform}; -static const SpvCapability pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV[] = {SpvCapabilityGroupNonUniformArithmetic, SpvCapabilityGroupNonUniformClustered, SpvCapabilityGroupNonUniformPartitionedNV}; -static const SpvCapability pygen_variable_caps_GroupNonUniformBallot[] = {SpvCapabilityGroupNonUniformBallot}; -static const SpvCapability pygen_variable_caps_GroupNonUniformPartitionedNV[] = {SpvCapabilityGroupNonUniformPartitionedNV}; -static const SpvCapability pygen_variable_caps_GroupNonUniformQuad[] = {SpvCapabilityGroupNonUniformQuad}; -static const SpvCapability pygen_variable_caps_GroupNonUniformRotateKHR[] = {SpvCapabilityGroupNonUniformRotateKHR}; -static const SpvCapability pygen_variable_caps_GroupNonUniformShuffle[] = {SpvCapabilityGroupNonUniformShuffle}; -static const SpvCapability pygen_variable_caps_GroupNonUniformShuffleRelative[] = {SpvCapabilityGroupNonUniformShuffleRelative}; -static const SpvCapability pygen_variable_caps_GroupNonUniformVote[] = {SpvCapabilityGroupNonUniformVote}; -static const SpvCapability pygen_variable_caps_GroupUniformArithmeticKHR[] = {SpvCapabilityGroupUniformArithmeticKHR}; -static const SpvCapability pygen_variable_caps_Groups[] = {SpvCapabilityGroups}; -static const SpvCapability pygen_variable_caps_ImageFootprintNV[] = {SpvCapabilityImageFootprintNV}; -static const SpvCapability pygen_variable_caps_ImageQuery[] = {SpvCapabilityImageQuery}; -static const SpvCapability pygen_variable_caps_IntegerFunctions2INTEL[] = {SpvCapabilityIntegerFunctions2INTEL}; -static const SpvCapability pygen_variable_caps_Kernel[] = {SpvCapabilityKernel}; -static const SpvCapability pygen_variable_caps_KernelImageQuery[] = {SpvCapabilityKernel, SpvCapabilityImageQuery}; -static const SpvCapability pygen_variable_caps_LiteralSampler[] = {SpvCapabilityLiteralSampler}; -static const SpvCapability pygen_variable_caps_LongConstantCompositeINTEL[] = {SpvCapabilityLongConstantCompositeINTEL}; -static const SpvCapability pygen_variable_caps_Matrix[] = {SpvCapabilityMatrix}; -static const SpvCapability pygen_variable_caps_MemoryAccessAliasingINTEL[] = {SpvCapabilityMemoryAccessAliasingINTEL}; -static const SpvCapability pygen_variable_caps_MeshShadingEXT[] = {SpvCapabilityMeshShadingEXT}; -static const SpvCapability pygen_variable_caps_MeshShadingNV[] = {SpvCapabilityMeshShadingNV}; -static const SpvCapability pygen_variable_caps_NamedBarrier[] = {SpvCapabilityNamedBarrier}; -static const SpvCapability pygen_variable_caps_PipeStorage[] = {SpvCapabilityPipeStorage}; -static const SpvCapability pygen_variable_caps_Pipes[] = {SpvCapabilityPipes}; -static const SpvCapability pygen_variable_caps_RayQueryKHR[] = {SpvCapabilityRayQueryKHR}; -static const SpvCapability pygen_variable_caps_RayTracingKHR[] = {SpvCapabilityRayTracingKHR}; -static const SpvCapability pygen_variable_caps_RayTracingKHRRayQueryKHR[] = {SpvCapabilityRayTracingKHR, SpvCapabilityRayQueryKHR}; -static const SpvCapability pygen_variable_caps_RayTracingMotionBlurNV[] = {SpvCapabilityRayTracingMotionBlurNV}; -static const SpvCapability pygen_variable_caps_RayTracingNV[] = {SpvCapabilityRayTracingNV}; -static const SpvCapability pygen_variable_caps_RayTracingNVRayTracingKHR[] = {SpvCapabilityRayTracingNV, SpvCapabilityRayTracingKHR}; -static const SpvCapability pygen_variable_caps_RayTracingNVRayTracingKHRRayQueryKHR[] = {SpvCapabilityRayTracingNV, SpvCapabilityRayTracingKHR, SpvCapabilityRayQueryKHR}; -static const SpvCapability pygen_variable_caps_Shader[] = {SpvCapabilityShader}; -static const SpvCapability pygen_variable_caps_ShaderBitInstructions[] = {SpvCapabilityShader, SpvCapabilityBitInstructions}; -static const SpvCapability pygen_variable_caps_ShaderClockKHR[] = {SpvCapabilityShaderClockKHR}; -static const SpvCapability pygen_variable_caps_SparseResidency[] = {SpvCapabilitySparseResidency}; -static const SpvCapability pygen_variable_caps_SplitBarrierINTEL[] = {SpvCapabilitySplitBarrierINTEL}; -static const SpvCapability pygen_variable_caps_SubgroupAvcMotionEstimationINTEL[] = {SpvCapabilitySubgroupAvcMotionEstimationINTEL}; -static const SpvCapability pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationChromaINTEL[] = {SpvCapabilitySubgroupAvcMotionEstimationINTEL, SpvCapabilitySubgroupAvcMotionEstimationChromaINTEL}; -static const SpvCapability pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL[] = {SpvCapabilitySubgroupAvcMotionEstimationINTEL, SpvCapabilitySubgroupAvcMotionEstimationIntraINTEL}; -static const SpvCapability pygen_variable_caps_SubgroupBallotKHR[] = {SpvCapabilitySubgroupBallotKHR}; -static const SpvCapability pygen_variable_caps_SubgroupBufferBlockIOINTEL[] = {SpvCapabilitySubgroupBufferBlockIOINTEL}; -static const SpvCapability pygen_variable_caps_SubgroupDispatch[] = {SpvCapabilitySubgroupDispatch}; -static const SpvCapability pygen_variable_caps_SubgroupImageBlockIOINTEL[] = {SpvCapabilitySubgroupImageBlockIOINTEL}; -static const SpvCapability pygen_variable_caps_SubgroupImageMediaBlockIOINTEL[] = {SpvCapabilitySubgroupImageMediaBlockIOINTEL}; -static const SpvCapability pygen_variable_caps_SubgroupShuffleINTEL[] = {SpvCapabilitySubgroupShuffleINTEL}; -static const SpvCapability pygen_variable_caps_SubgroupVoteKHR[] = {SpvCapabilitySubgroupVoteKHR}; -static const SpvCapability pygen_variable_caps_USMStorageClassesINTEL[] = {SpvCapabilityUSMStorageClassesINTEL}; -static const SpvCapability pygen_variable_caps_UnstructuredLoopControlsINTEL[] = {SpvCapabilityUnstructuredLoopControlsINTEL}; -static const SpvCapability pygen_variable_caps_VariableLengthArrayINTEL[] = {SpvCapabilityVariableLengthArrayINTEL}; -static const SpvCapability pygen_variable_caps_VectorComputeINTEL[] = {SpvCapabilityVectorComputeINTEL}; +static const spv::Capability pygen_variable_caps_Addresses[] = {spv::Capability::Addresses}; +static const spv::Capability pygen_variable_caps_AddressesPhysicalStorageBufferAddresses[] = {spv::Capability::Addresses, spv::Capability::PhysicalStorageBufferAddresses}; +static const spv::Capability pygen_variable_caps_AddressesVariablePointersVariablePointersStorageBuffer[] = {spv::Capability::Addresses, spv::Capability::VariablePointers, spv::Capability::VariablePointersStorageBuffer}; +static const spv::Capability pygen_variable_caps_AddressesVariablePointersVariablePointersStorageBufferPhysicalStorageBufferAddresses[] = {spv::Capability::Addresses, spv::Capability::VariablePointers, spv::Capability::VariablePointersStorageBuffer, spv::Capability::PhysicalStorageBufferAddresses}; +static const spv::Capability pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL[] = {spv::Capability::ArbitraryPrecisionFixedPointINTEL}; +static const spv::Capability pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL[] = {spv::Capability::ArbitraryPrecisionFloatingPointINTEL}; +static const spv::Capability pygen_variable_caps_AsmINTEL[] = {spv::Capability::AsmINTEL}; +static const spv::Capability pygen_variable_caps_AtomicFloat16AddEXTAtomicFloat32AddEXTAtomicFloat64AddEXT[] = {spv::Capability::AtomicFloat16AddEXT, spv::Capability::AtomicFloat32AddEXT, spv::Capability::AtomicFloat64AddEXT}; +static const spv::Capability pygen_variable_caps_AtomicFloat16MinMaxEXTAtomicFloat32MinMaxEXTAtomicFloat64MinMaxEXT[] = {spv::Capability::AtomicFloat16MinMaxEXT, spv::Capability::AtomicFloat32MinMaxEXT, spv::Capability::AtomicFloat64MinMaxEXT}; +static const spv::Capability pygen_variable_caps_BFloat16ConversionINTEL[] = {spv::Capability::BFloat16ConversionINTEL}; +static const spv::Capability pygen_variable_caps_BindlessTextureNV[] = {spv::Capability::BindlessTextureNV}; +static const spv::Capability pygen_variable_caps_BlockingPipesINTEL[] = {spv::Capability::BlockingPipesINTEL}; +static const spv::Capability pygen_variable_caps_CooperativeMatrixKHR[] = {spv::Capability::CooperativeMatrixKHR}; +static const spv::Capability pygen_variable_caps_CooperativeMatrixNV[] = {spv::Capability::CooperativeMatrixNV}; +static const spv::Capability pygen_variable_caps_DemoteToHelperInvocation[] = {spv::Capability::DemoteToHelperInvocation}; +static const spv::Capability pygen_variable_caps_DemoteToHelperInvocationEXT[] = {spv::Capability::DemoteToHelperInvocationEXT}; +static const spv::Capability pygen_variable_caps_DerivativeControl[] = {spv::Capability::DerivativeControl}; +static const spv::Capability pygen_variable_caps_DeviceEnqueue[] = {spv::Capability::DeviceEnqueue}; +static const spv::Capability pygen_variable_caps_DotProduct[] = {spv::Capability::DotProduct}; +static const spv::Capability pygen_variable_caps_DotProductKHR[] = {spv::Capability::DotProductKHR}; +static const spv::Capability pygen_variable_caps_ExpectAssumeKHR[] = {spv::Capability::ExpectAssumeKHR}; +static const spv::Capability pygen_variable_caps_FPGARegINTEL[] = {spv::Capability::FPGARegINTEL}; +static const spv::Capability pygen_variable_caps_FragmentMaskAMD[] = {spv::Capability::FragmentMaskAMD}; +static const spv::Capability pygen_variable_caps_FragmentShaderSampleInterlockEXTFragmentShaderPixelInterlockEXTFragmentShaderShadingRateInterlockEXT[] = {spv::Capability::FragmentShaderSampleInterlockEXT, spv::Capability::FragmentShaderPixelInterlockEXT, spv::Capability::FragmentShaderShadingRateInterlockEXT}; +static const spv::Capability pygen_variable_caps_FunctionPointersINTEL[] = {spv::Capability::FunctionPointersINTEL}; +static const spv::Capability pygen_variable_caps_Geometry[] = {spv::Capability::Geometry}; +static const spv::Capability pygen_variable_caps_GeometryStreams[] = {spv::Capability::GeometryStreams}; +static const spv::Capability pygen_variable_caps_GroupNonUniform[] = {spv::Capability::GroupNonUniform}; +static const spv::Capability pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV[] = {spv::Capability::GroupNonUniformArithmetic, spv::Capability::GroupNonUniformClustered, spv::Capability::GroupNonUniformPartitionedNV}; +static const spv::Capability pygen_variable_caps_GroupNonUniformBallot[] = {spv::Capability::GroupNonUniformBallot}; +static const spv::Capability pygen_variable_caps_GroupNonUniformPartitionedNV[] = {spv::Capability::GroupNonUniformPartitionedNV}; +static const spv::Capability pygen_variable_caps_GroupNonUniformQuad[] = {spv::Capability::GroupNonUniformQuad}; +static const spv::Capability pygen_variable_caps_GroupNonUniformRotateKHR[] = {spv::Capability::GroupNonUniformRotateKHR}; +static const spv::Capability pygen_variable_caps_GroupNonUniformShuffle[] = {spv::Capability::GroupNonUniformShuffle}; +static const spv::Capability pygen_variable_caps_GroupNonUniformShuffleRelative[] = {spv::Capability::GroupNonUniformShuffleRelative}; +static const spv::Capability pygen_variable_caps_GroupNonUniformVote[] = {spv::Capability::GroupNonUniformVote}; +static const spv::Capability pygen_variable_caps_GroupUniformArithmeticKHR[] = {spv::Capability::GroupUniformArithmeticKHR}; +static const spv::Capability pygen_variable_caps_Groups[] = {spv::Capability::Groups}; +static const spv::Capability pygen_variable_caps_ImageFootprintNV[] = {spv::Capability::ImageFootprintNV}; +static const spv::Capability pygen_variable_caps_ImageQuery[] = {spv::Capability::ImageQuery}; +static const spv::Capability pygen_variable_caps_IntegerFunctions2INTEL[] = {spv::Capability::IntegerFunctions2INTEL}; +static const spv::Capability pygen_variable_caps_Kernel[] = {spv::Capability::Kernel}; +static const spv::Capability pygen_variable_caps_KernelImageQuery[] = {spv::Capability::Kernel, spv::Capability::ImageQuery}; +static const spv::Capability pygen_variable_caps_LiteralSampler[] = {spv::Capability::LiteralSampler}; +static const spv::Capability pygen_variable_caps_LongConstantCompositeINTEL[] = {spv::Capability::LongConstantCompositeINTEL}; +static const spv::Capability pygen_variable_caps_Matrix[] = {spv::Capability::Matrix}; +static const spv::Capability pygen_variable_caps_MemoryAccessAliasingINTEL[] = {spv::Capability::MemoryAccessAliasingINTEL}; +static const spv::Capability pygen_variable_caps_MeshShadingEXT[] = {spv::Capability::MeshShadingEXT}; +static const spv::Capability pygen_variable_caps_MeshShadingNV[] = {spv::Capability::MeshShadingNV}; +static const spv::Capability pygen_variable_caps_NamedBarrier[] = {spv::Capability::NamedBarrier}; +static const spv::Capability pygen_variable_caps_PipeStorage[] = {spv::Capability::PipeStorage}; +static const spv::Capability pygen_variable_caps_Pipes[] = {spv::Capability::Pipes}; +static const spv::Capability pygen_variable_caps_RayQueryKHR[] = {spv::Capability::RayQueryKHR}; +static const spv::Capability pygen_variable_caps_RayQueryPositionFetchKHR[] = {spv::Capability::RayQueryPositionFetchKHR}; +static const spv::Capability pygen_variable_caps_RayTracingKHR[] = {spv::Capability::RayTracingKHR}; +static const spv::Capability pygen_variable_caps_RayTracingKHRRayQueryKHR[] = {spv::Capability::RayTracingKHR, spv::Capability::RayQueryKHR}; +static const spv::Capability pygen_variable_caps_RayTracingMotionBlurNV[] = {spv::Capability::RayTracingMotionBlurNV}; +static const spv::Capability pygen_variable_caps_RayTracingNV[] = {spv::Capability::RayTracingNV}; +static const spv::Capability pygen_variable_caps_RayTracingNVRayTracingKHR[] = {spv::Capability::RayTracingNV, spv::Capability::RayTracingKHR}; +static const spv::Capability pygen_variable_caps_RayTracingNVRayTracingKHRRayQueryKHR[] = {spv::Capability::RayTracingNV, spv::Capability::RayTracingKHR, spv::Capability::RayQueryKHR}; +static const spv::Capability pygen_variable_caps_Shader[] = {spv::Capability::Shader}; +static const spv::Capability pygen_variable_caps_ShaderBitInstructions[] = {spv::Capability::Shader, spv::Capability::BitInstructions}; +static const spv::Capability pygen_variable_caps_ShaderClockKHR[] = {spv::Capability::ShaderClockKHR}; +static const spv::Capability pygen_variable_caps_ShaderEnqueueAMDX[] = {spv::Capability::ShaderEnqueueAMDX}; +static const spv::Capability pygen_variable_caps_ShaderInvocationReorderNV[] = {spv::Capability::ShaderInvocationReorderNV}; +static const spv::Capability pygen_variable_caps_ShaderInvocationReorderNVRayTracingMotionBlurNV[] = {spv::Capability::ShaderInvocationReorderNV, spv::Capability::RayTracingMotionBlurNV}; +static const spv::Capability pygen_variable_caps_SparseResidency[] = {spv::Capability::SparseResidency}; +static const spv::Capability pygen_variable_caps_SplitBarrierINTEL[] = {spv::Capability::SplitBarrierINTEL}; +static const spv::Capability pygen_variable_caps_SubgroupAvcMotionEstimationINTEL[] = {spv::Capability::SubgroupAvcMotionEstimationINTEL}; +static const spv::Capability pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationChromaINTEL[] = {spv::Capability::SubgroupAvcMotionEstimationINTEL, spv::Capability::SubgroupAvcMotionEstimationChromaINTEL}; +static const spv::Capability pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL[] = {spv::Capability::SubgroupAvcMotionEstimationINTEL, spv::Capability::SubgroupAvcMotionEstimationIntraINTEL}; +static const spv::Capability pygen_variable_caps_SubgroupBallotKHR[] = {spv::Capability::SubgroupBallotKHR}; +static const spv::Capability pygen_variable_caps_SubgroupBufferBlockIOINTEL[] = {spv::Capability::SubgroupBufferBlockIOINTEL}; +static const spv::Capability pygen_variable_caps_SubgroupDispatch[] = {spv::Capability::SubgroupDispatch}; +static const spv::Capability pygen_variable_caps_SubgroupImageBlockIOINTEL[] = {spv::Capability::SubgroupImageBlockIOINTEL}; +static const spv::Capability pygen_variable_caps_SubgroupImageMediaBlockIOINTEL[] = {spv::Capability::SubgroupImageMediaBlockIOINTEL}; +static const spv::Capability pygen_variable_caps_SubgroupShuffleINTEL[] = {spv::Capability::SubgroupShuffleINTEL}; +static const spv::Capability pygen_variable_caps_SubgroupVoteKHR[] = {spv::Capability::SubgroupVoteKHR}; +static const spv::Capability pygen_variable_caps_TextureBlockMatchQCOM[] = {spv::Capability::TextureBlockMatchQCOM}; +static const spv::Capability pygen_variable_caps_TextureBoxFilterQCOM[] = {spv::Capability::TextureBoxFilterQCOM}; +static const spv::Capability pygen_variable_caps_TextureSampleWeightedQCOM[] = {spv::Capability::TextureSampleWeightedQCOM}; +static const spv::Capability pygen_variable_caps_TileImageColorReadAccessEXT[] = {spv::Capability::TileImageColorReadAccessEXT}; +static const spv::Capability pygen_variable_caps_TileImageDepthReadAccessEXT[] = {spv::Capability::TileImageDepthReadAccessEXT}; +static const spv::Capability pygen_variable_caps_TileImageStencilReadAccessEXT[] = {spv::Capability::TileImageStencilReadAccessEXT}; +static const spv::Capability pygen_variable_caps_USMStorageClassesINTEL[] = {spv::Capability::USMStorageClassesINTEL}; +static const spv::Capability pygen_variable_caps_UnstructuredLoopControlsINTEL[] = {spv::Capability::UnstructuredLoopControlsINTEL}; +static const spv::Capability pygen_variable_caps_VariableLengthArrayINTEL[] = {spv::Capability::VariableLengthArrayINTEL}; +static const spv::Capability pygen_variable_caps_VectorComputeINTEL[] = {spv::Capability::VectorComputeINTEL}; static const spvtools::Extension pygen_variable_exts_SPV_AMD_shader_ballot[] = {spvtools::Extension::kSPV_AMD_shader_ballot}; static const spvtools::Extension pygen_variable_exts_SPV_AMD_shader_fragment_mask[] = {spvtools::Extension::kSPV_AMD_shader_fragment_mask}; @@ -93,7 +105,6 @@ static const spvtools::Extension pygen_variable_exts_SPV_KHR_ray_query[] = {spvt static const spvtools::Extension pygen_variable_exts_SPV_KHR_ray_tracing[] = {spvtools::Extension::kSPV_KHR_ray_tracing}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_ray_tracingSPV_KHR_ray_query[] = {spvtools::Extension::kSPV_KHR_ray_tracing, spvtools::Extension::kSPV_KHR_ray_query}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_shader_ballot[] = {spvtools::Extension::kSPV_KHR_shader_ballot}; -static const spvtools::Extension pygen_variable_exts_SPV_KHR_shader_clock[] = {spvtools::Extension::kSPV_KHR_shader_clock}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_subgroup_vote[] = {spvtools::Extension::kSPV_KHR_subgroup_vote}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_terminate_invocation[] = {spvtools::Extension::kSPV_KHR_terminate_invocation}; static const spvtools::Extension pygen_variable_exts_SPV_NV_cooperative_matrix[] = {spvtools::Extension::kSPV_NV_cooperative_matrix}; @@ -106,674 +117,725 @@ static const spvtools::Extension pygen_variable_exts_SPV_NV_shader_image_footpri static const spvtools::Extension pygen_variable_exts_SPV_NV_shader_subgroup_partitioned[] = {spvtools::Extension::kSPV_NV_shader_subgroup_partitioned}; static const spv_opcode_desc_t kOpcodeTableEntries[] = { - {"Nop", SpvOpNop, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Undef", SpvOpUndef, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SourceContinued", SpvOpSourceContinued, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Source", SpvOpSource, 0, nullptr, 4, {SPV_OPERAND_TYPE_SOURCE_LANGUAGE, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SourceExtension", SpvOpSourceExtension, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Name", SpvOpName, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MemberName", SpvOpMemberName, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"String", SpvOpString, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Line", SpvOpLine, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Extension", SpvOpExtension, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ExtInstImport", SpvOpExtInstImport, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ExtInst", SpvOpExtInst, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MemoryModel", SpvOpMemoryModel, 0, nullptr, 2, {SPV_OPERAND_TYPE_ADDRESSING_MODEL, SPV_OPERAND_TYPE_MEMORY_MODEL}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"EntryPoint", SpvOpEntryPoint, 0, nullptr, 4, {SPV_OPERAND_TYPE_EXECUTION_MODEL, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ExecutionMode", SpvOpExecutionMode, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_EXECUTION_MODE}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Capability", SpvOpCapability, 0, nullptr, 1, {SPV_OPERAND_TYPE_CAPABILITY}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeVoid", SpvOpTypeVoid, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeBool", SpvOpTypeBool, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeInt", SpvOpTypeInt, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeFloat", SpvOpTypeFloat, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeVector", SpvOpTypeVector, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeMatrix", SpvOpTypeMatrix, 1, pygen_variable_caps_Matrix, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeImage", SpvOpTypeImage, 0, nullptr, 9, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DIMENSIONALITY, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT, SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeSampler", SpvOpTypeSampler, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeSampledImage", SpvOpTypeSampledImage, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeArray", SpvOpTypeArray, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeRuntimeArray", SpvOpTypeRuntimeArray, 1, pygen_variable_caps_Shader, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeStruct", SpvOpTypeStruct, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeOpaque", SpvOpTypeOpaque, 1, pygen_variable_caps_Kernel, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypePointer", SpvOpTypePointer, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_STORAGE_CLASS, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeFunction", SpvOpTypeFunction, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeEvent", SpvOpTypeEvent, 1, pygen_variable_caps_Kernel, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeDeviceEvent", SpvOpTypeDeviceEvent, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeReserveId", SpvOpTypeReserveId, 1, pygen_variable_caps_Pipes, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeQueue", SpvOpTypeQueue, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypePipe", SpvOpTypePipe, 1, pygen_variable_caps_Pipes, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ACCESS_QUALIFIER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TypeForwardPointer", SpvOpTypeForwardPointer, 2, pygen_variable_caps_AddressesPhysicalStorageBufferAddresses, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_STORAGE_CLASS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConstantTrue", SpvOpConstantTrue, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConstantFalse", SpvOpConstantFalse, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Constant", SpvOpConstant, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConstantComposite", SpvOpConstantComposite, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConstantSampler", SpvOpConstantSampler, 1, pygen_variable_caps_LiteralSampler, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConstantNull", SpvOpConstantNull, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SpecConstantTrue", SpvOpSpecConstantTrue, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SpecConstantFalse", SpvOpSpecConstantFalse, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SpecConstant", SpvOpSpecConstant, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SpecConstantComposite", SpvOpSpecConstantComposite, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SpecConstantOp", SpvOpSpecConstantOp, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Function", SpvOpFunction, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_FUNCTION_CONTROL, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FunctionParameter", SpvOpFunctionParameter, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FunctionEnd", SpvOpFunctionEnd, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FunctionCall", SpvOpFunctionCall, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Variable", SpvOpVariable, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_STORAGE_CLASS, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageTexelPointer", SpvOpImageTexelPointer, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Load", SpvOpLoad, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Store", SpvOpStore, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CopyMemory", SpvOpCopyMemory, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CopyMemorySized", SpvOpCopyMemorySized, 1, pygen_variable_caps_Addresses, 5, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AccessChain", SpvOpAccessChain, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InBoundsAccessChain", SpvOpInBoundsAccessChain, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"PtrAccessChain", SpvOpPtrAccessChain, 4, pygen_variable_caps_AddressesVariablePointersVariablePointersStorageBufferPhysicalStorageBufferAddresses, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ArrayLength", SpvOpArrayLength, 1, pygen_variable_caps_Shader, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GenericPtrMemSemantics", SpvOpGenericPtrMemSemantics, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InBoundsPtrAccessChain", SpvOpInBoundsPtrAccessChain, 1, pygen_variable_caps_Addresses, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Decorate", SpvOpDecorate, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MemberDecorate", SpvOpMemberDecorate, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DecorationGroup", SpvOpDecorationGroup, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupDecorate", SpvOpGroupDecorate, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupMemberDecorate", SpvOpGroupMemberDecorate, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"VectorExtractDynamic", SpvOpVectorExtractDynamic, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"VectorInsertDynamic", SpvOpVectorInsertDynamic, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"VectorShuffle", SpvOpVectorShuffle, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CompositeConstruct", SpvOpCompositeConstruct, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CompositeExtract", SpvOpCompositeExtract, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CompositeInsert", SpvOpCompositeInsert, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CopyObject", SpvOpCopyObject, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Transpose", SpvOpTranspose, 1, pygen_variable_caps_Matrix, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SampledImage", SpvOpSampledImage, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSampleImplicitLod", SpvOpImageSampleImplicitLod, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSampleExplicitLod", SpvOpImageSampleExplicitLod, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSampleDrefImplicitLod", SpvOpImageSampleDrefImplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSampleDrefExplicitLod", SpvOpImageSampleDrefExplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSampleProjImplicitLod", SpvOpImageSampleProjImplicitLod, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSampleProjExplicitLod", SpvOpImageSampleProjExplicitLod, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSampleProjDrefImplicitLod", SpvOpImageSampleProjDrefImplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSampleProjDrefExplicitLod", SpvOpImageSampleProjDrefExplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageFetch", SpvOpImageFetch, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageGather", SpvOpImageGather, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageDrefGather", SpvOpImageDrefGather, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageRead", SpvOpImageRead, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageWrite", SpvOpImageWrite, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Image", SpvOpImage, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageQueryFormat", SpvOpImageQueryFormat, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageQueryOrder", SpvOpImageQueryOrder, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageQuerySizeLod", SpvOpImageQuerySizeLod, 2, pygen_variable_caps_KernelImageQuery, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageQuerySize", SpvOpImageQuerySize, 2, pygen_variable_caps_KernelImageQuery, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageQueryLod", SpvOpImageQueryLod, 1, pygen_variable_caps_ImageQuery, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageQueryLevels", SpvOpImageQueryLevels, 2, pygen_variable_caps_KernelImageQuery, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageQuerySamples", SpvOpImageQuerySamples, 2, pygen_variable_caps_KernelImageQuery, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConvertFToU", SpvOpConvertFToU, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConvertFToS", SpvOpConvertFToS, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConvertSToF", SpvOpConvertSToF, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConvertUToF", SpvOpConvertUToF, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UConvert", SpvOpUConvert, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SConvert", SpvOpSConvert, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FConvert", SpvOpFConvert, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"QuantizeToF16", SpvOpQuantizeToF16, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConvertPtrToU", SpvOpConvertPtrToU, 2, pygen_variable_caps_AddressesPhysicalStorageBufferAddresses, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SatConvertSToU", SpvOpSatConvertSToU, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SatConvertUToS", SpvOpSatConvertUToS, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConvertUToPtr", SpvOpConvertUToPtr, 2, pygen_variable_caps_AddressesPhysicalStorageBufferAddresses, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"PtrCastToGeneric", SpvOpPtrCastToGeneric, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GenericCastToPtr", SpvOpGenericCastToPtr, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GenericCastToPtrExplicit", SpvOpGenericCastToPtrExplicit, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_STORAGE_CLASS}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Bitcast", SpvOpBitcast, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SNegate", SpvOpSNegate, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FNegate", SpvOpFNegate, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"IAdd", SpvOpIAdd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FAdd", SpvOpFAdd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ISub", SpvOpISub, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FSub", SpvOpFSub, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"IMul", SpvOpIMul, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FMul", SpvOpFMul, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UDiv", SpvOpUDiv, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SDiv", SpvOpSDiv, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FDiv", SpvOpFDiv, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UMod", SpvOpUMod, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SRem", SpvOpSRem, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SMod", SpvOpSMod, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FRem", SpvOpFRem, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FMod", SpvOpFMod, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"VectorTimesScalar", SpvOpVectorTimesScalar, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MatrixTimesScalar", SpvOpMatrixTimesScalar, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"VectorTimesMatrix", SpvOpVectorTimesMatrix, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MatrixTimesVector", SpvOpMatrixTimesVector, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MatrixTimesMatrix", SpvOpMatrixTimesMatrix, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"OuterProduct", SpvOpOuterProduct, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Dot", SpvOpDot, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"IAddCarry", SpvOpIAddCarry, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ISubBorrow", SpvOpISubBorrow, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UMulExtended", SpvOpUMulExtended, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SMulExtended", SpvOpSMulExtended, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Any", SpvOpAny, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"All", SpvOpAll, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"IsNan", SpvOpIsNan, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"IsInf", SpvOpIsInf, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"IsFinite", SpvOpIsFinite, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"IsNormal", SpvOpIsNormal, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SignBitSet", SpvOpSignBitSet, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LessOrGreater", SpvOpLessOrGreater, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), SPV_SPIRV_VERSION_WORD(1,5)}, - {"Ordered", SpvOpOrdered, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Unordered", SpvOpUnordered, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LogicalEqual", SpvOpLogicalEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LogicalNotEqual", SpvOpLogicalNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LogicalOr", SpvOpLogicalOr, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LogicalAnd", SpvOpLogicalAnd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LogicalNot", SpvOpLogicalNot, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Select", SpvOpSelect, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"IEqual", SpvOpIEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"INotEqual", SpvOpINotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UGreaterThan", SpvOpUGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SGreaterThan", SpvOpSGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UGreaterThanEqual", SpvOpUGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SGreaterThanEqual", SpvOpSGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ULessThan", SpvOpULessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SLessThan", SpvOpSLessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ULessThanEqual", SpvOpULessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SLessThanEqual", SpvOpSLessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FOrdEqual", SpvOpFOrdEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FUnordEqual", SpvOpFUnordEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FOrdNotEqual", SpvOpFOrdNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FUnordNotEqual", SpvOpFUnordNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FOrdLessThan", SpvOpFOrdLessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FUnordLessThan", SpvOpFUnordLessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FOrdGreaterThan", SpvOpFOrdGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FUnordGreaterThan", SpvOpFUnordGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FOrdLessThanEqual", SpvOpFOrdLessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FUnordLessThanEqual", SpvOpFUnordLessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FOrdGreaterThanEqual", SpvOpFOrdGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FUnordGreaterThanEqual", SpvOpFUnordGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ShiftRightLogical", SpvOpShiftRightLogical, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ShiftRightArithmetic", SpvOpShiftRightArithmetic, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ShiftLeftLogical", SpvOpShiftLeftLogical, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BitwiseOr", SpvOpBitwiseOr, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BitwiseXor", SpvOpBitwiseXor, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BitwiseAnd", SpvOpBitwiseAnd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Not", SpvOpNot, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BitFieldInsert", SpvOpBitFieldInsert, 2, pygen_variable_caps_ShaderBitInstructions, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BitFieldSExtract", SpvOpBitFieldSExtract, 2, pygen_variable_caps_ShaderBitInstructions, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BitFieldUExtract", SpvOpBitFieldUExtract, 2, pygen_variable_caps_ShaderBitInstructions, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BitReverse", SpvOpBitReverse, 2, pygen_variable_caps_ShaderBitInstructions, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BitCount", SpvOpBitCount, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DPdx", SpvOpDPdx, 1, pygen_variable_caps_Shader, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DPdy", SpvOpDPdy, 1, pygen_variable_caps_Shader, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Fwidth", SpvOpFwidth, 1, pygen_variable_caps_Shader, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DPdxFine", SpvOpDPdxFine, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DPdyFine", SpvOpDPdyFine, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FwidthFine", SpvOpFwidthFine, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DPdxCoarse", SpvOpDPdxCoarse, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DPdyCoarse", SpvOpDPdyCoarse, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FwidthCoarse", SpvOpFwidthCoarse, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"EmitVertex", SpvOpEmitVertex, 1, pygen_variable_caps_Geometry, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"EndPrimitive", SpvOpEndPrimitive, 1, pygen_variable_caps_Geometry, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"EmitStreamVertex", SpvOpEmitStreamVertex, 1, pygen_variable_caps_GeometryStreams, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"EndStreamPrimitive", SpvOpEndStreamPrimitive, 1, pygen_variable_caps_GeometryStreams, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ControlBarrier", SpvOpControlBarrier, 0, nullptr, 3, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MemoryBarrier", SpvOpMemoryBarrier, 0, nullptr, 2, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicLoad", SpvOpAtomicLoad, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicStore", SpvOpAtomicStore, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicExchange", SpvOpAtomicExchange, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicCompareExchange", SpvOpAtomicCompareExchange, 0, nullptr, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicCompareExchangeWeak", SpvOpAtomicCompareExchangeWeak, 1, pygen_variable_caps_Kernel, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), SPV_SPIRV_VERSION_WORD(1,3)}, - {"AtomicIIncrement", SpvOpAtomicIIncrement, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicIDecrement", SpvOpAtomicIDecrement, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicIAdd", SpvOpAtomicIAdd, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicISub", SpvOpAtomicISub, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicSMin", SpvOpAtomicSMin, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicUMin", SpvOpAtomicUMin, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicSMax", SpvOpAtomicSMax, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicUMax", SpvOpAtomicUMax, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicAnd", SpvOpAtomicAnd, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicOr", SpvOpAtomicOr, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicXor", SpvOpAtomicXor, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Phi", SpvOpPhi, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LoopMerge", SpvOpLoopMerge, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LOOP_CONTROL}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SelectionMerge", SpvOpSelectionMerge, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SELECTION_CONTROL}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Label", SpvOpLabel, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Branch", SpvOpBranch, 0, nullptr, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BranchConditional", SpvOpBranchConditional, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Switch", SpvOpSwitch, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Kill", SpvOpKill, 1, pygen_variable_caps_Shader, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Return", SpvOpReturn, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ReturnValue", SpvOpReturnValue, 0, nullptr, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Unreachable", SpvOpUnreachable, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LifetimeStart", SpvOpLifetimeStart, 1, pygen_variable_caps_Kernel, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LifetimeStop", SpvOpLifetimeStop, 1, pygen_variable_caps_Kernel, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupAsyncCopy", SpvOpGroupAsyncCopy, 1, pygen_variable_caps_Kernel, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupWaitEvents", SpvOpGroupWaitEvents, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupAll", SpvOpGroupAll, 1, pygen_variable_caps_Groups, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupAny", SpvOpGroupAny, 1, pygen_variable_caps_Groups, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupBroadcast", SpvOpGroupBroadcast, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupIAdd", SpvOpGroupIAdd, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupFAdd", SpvOpGroupFAdd, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupFMin", SpvOpGroupFMin, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupUMin", SpvOpGroupUMin, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupSMin", SpvOpGroupSMin, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupFMax", SpvOpGroupFMax, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupUMax", SpvOpGroupUMax, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupSMax", SpvOpGroupSMax, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ReadPipe", SpvOpReadPipe, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"WritePipe", SpvOpWritePipe, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ReservedReadPipe", SpvOpReservedReadPipe, 1, pygen_variable_caps_Pipes, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ReservedWritePipe", SpvOpReservedWritePipe, 1, pygen_variable_caps_Pipes, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ReserveReadPipePackets", SpvOpReserveReadPipePackets, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ReserveWritePipePackets", SpvOpReserveWritePipePackets, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CommitReadPipe", SpvOpCommitReadPipe, 1, pygen_variable_caps_Pipes, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CommitWritePipe", SpvOpCommitWritePipe, 1, pygen_variable_caps_Pipes, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"IsValidReserveId", SpvOpIsValidReserveId, 1, pygen_variable_caps_Pipes, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GetNumPipePackets", SpvOpGetNumPipePackets, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GetMaxPipePackets", SpvOpGetMaxPipePackets, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupReserveReadPipePackets", SpvOpGroupReserveReadPipePackets, 1, pygen_variable_caps_Pipes, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupReserveWritePipePackets", SpvOpGroupReserveWritePipePackets, 1, pygen_variable_caps_Pipes, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupCommitReadPipe", SpvOpGroupCommitReadPipe, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GroupCommitWritePipe", SpvOpGroupCommitWritePipe, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"EnqueueMarker", SpvOpEnqueueMarker, 1, pygen_variable_caps_DeviceEnqueue, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"EnqueueKernel", SpvOpEnqueueKernel, 1, pygen_variable_caps_DeviceEnqueue, 13, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GetKernelNDrangeSubGroupCount", SpvOpGetKernelNDrangeSubGroupCount, 1, pygen_variable_caps_DeviceEnqueue, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GetKernelNDrangeMaxSubGroupSize", SpvOpGetKernelNDrangeMaxSubGroupSize, 1, pygen_variable_caps_DeviceEnqueue, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GetKernelWorkGroupSize", SpvOpGetKernelWorkGroupSize, 1, pygen_variable_caps_DeviceEnqueue, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GetKernelPreferredWorkGroupSizeMultiple", SpvOpGetKernelPreferredWorkGroupSizeMultiple, 1, pygen_variable_caps_DeviceEnqueue, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RetainEvent", SpvOpRetainEvent, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ReleaseEvent", SpvOpReleaseEvent, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CreateUserEvent", SpvOpCreateUserEvent, 1, pygen_variable_caps_DeviceEnqueue, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"IsValidEvent", SpvOpIsValidEvent, 1, pygen_variable_caps_DeviceEnqueue, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SetUserEventStatus", SpvOpSetUserEventStatus, 1, pygen_variable_caps_DeviceEnqueue, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CaptureEventProfilingInfo", SpvOpCaptureEventProfilingInfo, 1, pygen_variable_caps_DeviceEnqueue, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GetDefaultQueue", SpvOpGetDefaultQueue, 1, pygen_variable_caps_DeviceEnqueue, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BuildNDRange", SpvOpBuildNDRange, 1, pygen_variable_caps_DeviceEnqueue, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSparseSampleImplicitLod", SpvOpImageSparseSampleImplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSparseSampleExplicitLod", SpvOpImageSparseSampleExplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSparseSampleDrefImplicitLod", SpvOpImageSparseSampleDrefImplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSparseSampleDrefExplicitLod", SpvOpImageSparseSampleDrefExplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSparseSampleProjImplicitLod", SpvOpImageSparseSampleProjImplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ImageSparseSampleProjExplicitLod", SpvOpImageSparseSampleProjExplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ImageSparseSampleProjDrefImplicitLod", SpvOpImageSparseSampleProjDrefImplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ImageSparseSampleProjDrefExplicitLod", SpvOpImageSparseSampleProjDrefExplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ImageSparseFetch", SpvOpImageSparseFetch, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSparseGather", SpvOpImageSparseGather, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSparseDrefGather", SpvOpImageSparseDrefGather, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSparseTexelsResident", SpvOpImageSparseTexelsResident, 1, pygen_variable_caps_SparseResidency, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NoLine", SpvOpNoLine, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicFlagTestAndSet", SpvOpAtomicFlagTestAndSet, 1, pygen_variable_caps_Kernel, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicFlagClear", SpvOpAtomicFlagClear, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageSparseRead", SpvOpImageSparseRead, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SizeOf", SpvOpSizeOf, 1, pygen_variable_caps_Addresses, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, - {"TypePipeStorage", SpvOpTypePipeStorage, 1, pygen_variable_caps_PipeStorage, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, - {"ConstantPipeStorage", SpvOpConstantPipeStorage, 1, pygen_variable_caps_PipeStorage, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, - {"CreatePipeFromPipeStorage", SpvOpCreatePipeFromPipeStorage, 1, pygen_variable_caps_PipeStorage, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, - {"GetKernelLocalSizeForSubgroupCount", SpvOpGetKernelLocalSizeForSubgroupCount, 1, pygen_variable_caps_SubgroupDispatch, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, - {"GetKernelMaxNumSubgroups", SpvOpGetKernelMaxNumSubgroups, 1, pygen_variable_caps_SubgroupDispatch, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, - {"TypeNamedBarrier", SpvOpTypeNamedBarrier, 1, pygen_variable_caps_NamedBarrier, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, - {"NamedBarrierInitialize", SpvOpNamedBarrierInitialize, 1, pygen_variable_caps_NamedBarrier, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, - {"MemoryNamedBarrier", SpvOpMemoryNamedBarrier, 1, pygen_variable_caps_NamedBarrier, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, - {"ModuleProcessed", SpvOpModuleProcessed, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, - {"ExecutionModeId", SpvOpExecutionModeId, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_EXECUTION_MODE}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,2), 0xffffffffu}, - {"DecorateId", SpvOpDecorateId, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 1, pygen_variable_exts_SPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,2), 0xffffffffu}, - {"GroupNonUniformElect", SpvOpGroupNonUniformElect, 1, pygen_variable_caps_GroupNonUniform, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformAll", SpvOpGroupNonUniformAll, 1, pygen_variable_caps_GroupNonUniformVote, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformAny", SpvOpGroupNonUniformAny, 1, pygen_variable_caps_GroupNonUniformVote, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformAllEqual", SpvOpGroupNonUniformAllEqual, 1, pygen_variable_caps_GroupNonUniformVote, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformBroadcast", SpvOpGroupNonUniformBroadcast, 1, pygen_variable_caps_GroupNonUniformBallot, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformBroadcastFirst", SpvOpGroupNonUniformBroadcastFirst, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformBallot", SpvOpGroupNonUniformBallot, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformInverseBallot", SpvOpGroupNonUniformInverseBallot, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformBallotBitExtract", SpvOpGroupNonUniformBallotBitExtract, 1, pygen_variable_caps_GroupNonUniformBallot, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformBallotBitCount", SpvOpGroupNonUniformBallotBitCount, 1, pygen_variable_caps_GroupNonUniformBallot, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformBallotFindLSB", SpvOpGroupNonUniformBallotFindLSB, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformBallotFindMSB", SpvOpGroupNonUniformBallotFindMSB, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformShuffle", SpvOpGroupNonUniformShuffle, 1, pygen_variable_caps_GroupNonUniformShuffle, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformShuffleXor", SpvOpGroupNonUniformShuffleXor, 1, pygen_variable_caps_GroupNonUniformShuffle, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformShuffleUp", SpvOpGroupNonUniformShuffleUp, 1, pygen_variable_caps_GroupNonUniformShuffleRelative, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformShuffleDown", SpvOpGroupNonUniformShuffleDown, 1, pygen_variable_caps_GroupNonUniformShuffleRelative, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformIAdd", SpvOpGroupNonUniformIAdd, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformFAdd", SpvOpGroupNonUniformFAdd, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformIMul", SpvOpGroupNonUniformIMul, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformFMul", SpvOpGroupNonUniformFMul, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformSMin", SpvOpGroupNonUniformSMin, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformUMin", SpvOpGroupNonUniformUMin, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformFMin", SpvOpGroupNonUniformFMin, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformSMax", SpvOpGroupNonUniformSMax, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformUMax", SpvOpGroupNonUniformUMax, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformFMax", SpvOpGroupNonUniformFMax, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformBitwiseAnd", SpvOpGroupNonUniformBitwiseAnd, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformBitwiseOr", SpvOpGroupNonUniformBitwiseOr, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformBitwiseXor", SpvOpGroupNonUniformBitwiseXor, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformLogicalAnd", SpvOpGroupNonUniformLogicalAnd, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformLogicalOr", SpvOpGroupNonUniformLogicalOr, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformLogicalXor", SpvOpGroupNonUniformLogicalXor, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformQuadBroadcast", SpvOpGroupNonUniformQuadBroadcast, 1, pygen_variable_caps_GroupNonUniformQuad, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"GroupNonUniformQuadSwap", SpvOpGroupNonUniformQuadSwap, 1, pygen_variable_caps_GroupNonUniformQuad, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, - {"CopyLogical", SpvOpCopyLogical, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, - {"PtrEqual", SpvOpPtrEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, - {"PtrNotEqual", SpvOpPtrNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, - {"PtrDiff", SpvOpPtrDiff, 3, pygen_variable_caps_AddressesVariablePointersVariablePointersStorageBuffer, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, - {"TerminateInvocation", SpvOpTerminateInvocation, 1, pygen_variable_caps_Shader, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_KHR_terminate_invocation, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"SubgroupBallotKHR", SpvOpSubgroupBallotKHR, 1, pygen_variable_caps_SubgroupBallotKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"SubgroupFirstInvocationKHR", SpvOpSubgroupFirstInvocationKHR, 1, pygen_variable_caps_SubgroupBallotKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"SubgroupAllKHR", SpvOpSubgroupAllKHR, 1, pygen_variable_caps_SubgroupVoteKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_subgroup_vote, 0xffffffffu, 0xffffffffu}, - {"SubgroupAnyKHR", SpvOpSubgroupAnyKHR, 1, pygen_variable_caps_SubgroupVoteKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_subgroup_vote, 0xffffffffu, 0xffffffffu}, - {"SubgroupAllEqualKHR", SpvOpSubgroupAllEqualKHR, 1, pygen_variable_caps_SubgroupVoteKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_subgroup_vote, 0xffffffffu, 0xffffffffu}, - {"GroupNonUniformRotateKHR", SpvOpGroupNonUniformRotateKHR, 1, pygen_variable_caps_GroupNonUniformRotateKHR, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupReadInvocationKHR", SpvOpSubgroupReadInvocationKHR, 1, pygen_variable_caps_SubgroupBallotKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"TraceRayKHR", SpvOpTraceRayKHR, 1, pygen_variable_caps_RayTracingKHR, 11, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, - {"ExecuteCallableKHR", SpvOpExecuteCallableKHR, 1, pygen_variable_caps_RayTracingKHR, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, - {"ConvertUToAccelerationStructureKHR", SpvOpConvertUToAccelerationStructureKHR, 2, pygen_variable_caps_RayTracingKHRRayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 2, pygen_variable_exts_SPV_KHR_ray_tracingSPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"IgnoreIntersectionKHR", SpvOpIgnoreIntersectionKHR, 1, pygen_variable_caps_RayTracingKHR, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, - {"TerminateRayKHR", SpvOpTerminateRayKHR, 1, pygen_variable_caps_RayTracingKHR, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, - {"SDot", SpvOpSDot, 1, pygen_variable_caps_DotProduct, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"SDotKHR", SpvOpSDotKHR, 1, pygen_variable_caps_DotProductKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"UDot", SpvOpUDot, 1, pygen_variable_caps_DotProduct, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"UDotKHR", SpvOpUDotKHR, 1, pygen_variable_caps_DotProductKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"SUDot", SpvOpSUDot, 1, pygen_variable_caps_DotProduct, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"SUDotKHR", SpvOpSUDotKHR, 1, pygen_variable_caps_DotProductKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"SDotAccSat", SpvOpSDotAccSat, 1, pygen_variable_caps_DotProduct, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"SDotAccSatKHR", SpvOpSDotAccSatKHR, 1, pygen_variable_caps_DotProductKHR, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"UDotAccSat", SpvOpUDotAccSat, 1, pygen_variable_caps_DotProduct, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"UDotAccSatKHR", SpvOpUDotAccSatKHR, 1, pygen_variable_caps_DotProductKHR, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"SUDotAccSat", SpvOpSUDotAccSat, 1, pygen_variable_caps_DotProduct, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"SUDotAccSatKHR", SpvOpSUDotAccSatKHR, 1, pygen_variable_caps_DotProductKHR, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"TypeRayQueryKHR", SpvOpTypeRayQueryKHR, 1, pygen_variable_caps_RayQueryKHR, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryInitializeKHR", SpvOpRayQueryInitializeKHR, 1, pygen_variable_caps_RayQueryKHR, 8, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryTerminateKHR", SpvOpRayQueryTerminateKHR, 1, pygen_variable_caps_RayQueryKHR, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGenerateIntersectionKHR", SpvOpRayQueryGenerateIntersectionKHR, 1, pygen_variable_caps_RayQueryKHR, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryConfirmIntersectionKHR", SpvOpRayQueryConfirmIntersectionKHR, 1, pygen_variable_caps_RayQueryKHR, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryProceedKHR", SpvOpRayQueryProceedKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionTypeKHR", SpvOpRayQueryGetIntersectionTypeKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"GroupIAddNonUniformAMD", SpvOpGroupIAddNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"GroupFAddNonUniformAMD", SpvOpGroupFAddNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"GroupFMinNonUniformAMD", SpvOpGroupFMinNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"GroupUMinNonUniformAMD", SpvOpGroupUMinNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"GroupSMinNonUniformAMD", SpvOpGroupSMinNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"GroupFMaxNonUniformAMD", SpvOpGroupFMaxNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"GroupUMaxNonUniformAMD", SpvOpGroupUMaxNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"GroupSMaxNonUniformAMD", SpvOpGroupSMaxNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, - {"FragmentMaskFetchAMD", SpvOpFragmentMaskFetchAMD, 1, pygen_variable_caps_FragmentMaskAMD, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_fragment_mask, 0xffffffffu, 0xffffffffu}, - {"FragmentFetchAMD", SpvOpFragmentFetchAMD, 1, pygen_variable_caps_FragmentMaskAMD, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_fragment_mask, 0xffffffffu, 0xffffffffu}, - {"ReadClockKHR", SpvOpReadClockKHR, 1, pygen_variable_caps_ShaderClockKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_shader_clock, 0xffffffffu, 0xffffffffu}, - {"ImageSampleFootprintNV", SpvOpImageSampleFootprintNV, 1, pygen_variable_caps_ImageFootprintNV, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 1, pygen_variable_exts_SPV_NV_shader_image_footprint, 0xffffffffu, 0xffffffffu}, - {"EmitMeshTasksEXT", SpvOpEmitMeshTasksEXT, 1, pygen_variable_caps_MeshShadingEXT, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SetMeshOutputsEXT", SpvOpSetMeshOutputsEXT, 1, pygen_variable_caps_MeshShadingEXT, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"GroupNonUniformPartitionNV", SpvOpGroupNonUniformPartitionNV, 1, pygen_variable_caps_GroupNonUniformPartitionedNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_NV_shader_subgroup_partitioned, 0xffffffffu, 0xffffffffu}, - {"WritePackedPrimitiveIndices4x8NV", SpvOpWritePackedPrimitiveIndices4x8NV, 1, pygen_variable_caps_MeshShadingNV, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_NV_mesh_shader, 0xffffffffu, 0xffffffffu}, - {"ReportIntersectionKHR", SpvOpReportIntersectionKHR, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 2, pygen_variable_exts_SPV_NV_ray_tracingSPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, - {"ReportIntersectionNV", SpvOpReportIntersectionNV, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 2, pygen_variable_exts_SPV_NV_ray_tracingSPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, - {"IgnoreIntersectionNV", SpvOpIgnoreIntersectionNV, 1, pygen_variable_caps_RayTracingNV, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing, 0xffffffffu, 0xffffffffu}, - {"TerminateRayNV", SpvOpTerminateRayNV, 1, pygen_variable_caps_RayTracingNV, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing, 0xffffffffu, 0xffffffffu}, - {"TraceNV", SpvOpTraceNV, 1, pygen_variable_caps_RayTracingNV, 11, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing, 0xffffffffu, 0xffffffffu}, - {"TraceMotionNV", SpvOpTraceMotionNV, 1, pygen_variable_caps_RayTracingMotionBlurNV, 12, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing_motion_blur, 0xffffffffu, 0xffffffffu}, - {"TraceRayMotionNV", SpvOpTraceRayMotionNV, 1, pygen_variable_caps_RayTracingMotionBlurNV, 12, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing_motion_blur, 0xffffffffu, 0xffffffffu}, - {"TypeAccelerationStructureKHR", SpvOpTypeAccelerationStructureKHR, 3, pygen_variable_caps_RayTracingNVRayTracingKHRRayQueryKHR, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 3, pygen_variable_exts_SPV_NV_ray_tracingSPV_KHR_ray_tracingSPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"TypeAccelerationStructureNV", SpvOpTypeAccelerationStructureNV, 3, pygen_variable_caps_RayTracingNVRayTracingKHRRayQueryKHR, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 3, pygen_variable_exts_SPV_NV_ray_tracingSPV_KHR_ray_tracingSPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"ExecuteCallableNV", SpvOpExecuteCallableNV, 1, pygen_variable_caps_RayTracingNV, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing, 0xffffffffu, 0xffffffffu}, - {"TypeCooperativeMatrixNV", SpvOpTypeCooperativeMatrixNV, 1, pygen_variable_caps_CooperativeMatrixNV, 5, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 1, pygen_variable_exts_SPV_NV_cooperative_matrix, 0xffffffffu, 0xffffffffu}, - {"CooperativeMatrixLoadNV", SpvOpCooperativeMatrixLoadNV, 1, pygen_variable_caps_CooperativeMatrixNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 1, 1, 1, pygen_variable_exts_SPV_NV_cooperative_matrix, 0xffffffffu, 0xffffffffu}, - {"CooperativeMatrixStoreNV", SpvOpCooperativeMatrixStoreNV, 1, pygen_variable_caps_CooperativeMatrixNV, 5, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 1, pygen_variable_exts_SPV_NV_cooperative_matrix, 0xffffffffu, 0xffffffffu}, - {"CooperativeMatrixMulAddNV", SpvOpCooperativeMatrixMulAddNV, 1, pygen_variable_caps_CooperativeMatrixNV, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_NV_cooperative_matrix, 0xffffffffu, 0xffffffffu}, - {"CooperativeMatrixLengthNV", SpvOpCooperativeMatrixLengthNV, 1, pygen_variable_caps_CooperativeMatrixNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_NV_cooperative_matrix, 0xffffffffu, 0xffffffffu}, - {"BeginInvocationInterlockEXT", SpvOpBeginInvocationInterlockEXT, 3, pygen_variable_caps_FragmentShaderSampleInterlockEXTFragmentShaderPixelInterlockEXTFragmentShaderShadingRateInterlockEXT, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_EXT_fragment_shader_interlock, 0xffffffffu, 0xffffffffu}, - {"EndInvocationInterlockEXT", SpvOpEndInvocationInterlockEXT, 3, pygen_variable_caps_FragmentShaderSampleInterlockEXTFragmentShaderPixelInterlockEXTFragmentShaderShadingRateInterlockEXT, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_EXT_fragment_shader_interlock, 0xffffffffu, 0xffffffffu}, - {"DemoteToHelperInvocation", SpvOpDemoteToHelperInvocation, 1, pygen_variable_caps_DemoteToHelperInvocation, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"DemoteToHelperInvocationEXT", SpvOpDemoteToHelperInvocationEXT, 1, pygen_variable_caps_DemoteToHelperInvocationEXT, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"IsHelperInvocationEXT", SpvOpIsHelperInvocationEXT, 1, pygen_variable_caps_DemoteToHelperInvocationEXT, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 1, pygen_variable_exts_SPV_EXT_demote_to_helper_invocation, 0xffffffffu, 0xffffffffu}, - {"ConvertUToImageNV", SpvOpConvertUToImageNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ConvertUToSamplerNV", SpvOpConvertUToSamplerNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ConvertImageToUNV", SpvOpConvertImageToUNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ConvertSamplerToUNV", SpvOpConvertSamplerToUNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ConvertUToSampledImageNV", SpvOpConvertUToSampledImageNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ConvertSampledImageToUNV", SpvOpConvertSampledImageToUNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SamplerImageAddressingModeNV", SpvOpSamplerImageAddressingModeNV, 1, pygen_variable_caps_BindlessTextureNV, 1, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupShuffleINTEL", SpvOpSubgroupShuffleINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupShuffleDownINTEL", SpvOpSubgroupShuffleDownINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupShuffleUpINTEL", SpvOpSubgroupShuffleUpINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupShuffleXorINTEL", SpvOpSubgroupShuffleXorINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupBlockReadINTEL", SpvOpSubgroupBlockReadINTEL, 1, pygen_variable_caps_SubgroupBufferBlockIOINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupBlockWriteINTEL", SpvOpSubgroupBlockWriteINTEL, 1, pygen_variable_caps_SubgroupBufferBlockIOINTEL, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupImageBlockReadINTEL", SpvOpSubgroupImageBlockReadINTEL, 1, pygen_variable_caps_SubgroupImageBlockIOINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupImageBlockWriteINTEL", SpvOpSubgroupImageBlockWriteINTEL, 1, pygen_variable_caps_SubgroupImageBlockIOINTEL, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupImageMediaBlockReadINTEL", SpvOpSubgroupImageMediaBlockReadINTEL, 1, pygen_variable_caps_SubgroupImageMediaBlockIOINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupImageMediaBlockWriteINTEL", SpvOpSubgroupImageMediaBlockWriteINTEL, 1, pygen_variable_caps_SubgroupImageMediaBlockIOINTEL, 5, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"UCountLeadingZerosINTEL", SpvOpUCountLeadingZerosINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"UCountTrailingZerosINTEL", SpvOpUCountTrailingZerosINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"AbsISubINTEL", SpvOpAbsISubINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"AbsUSubINTEL", SpvOpAbsUSubINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"IAddSatINTEL", SpvOpIAddSatINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"UAddSatINTEL", SpvOpUAddSatINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"IAverageINTEL", SpvOpIAverageINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"UAverageINTEL", SpvOpUAverageINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"IAverageRoundedINTEL", SpvOpIAverageRoundedINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"UAverageRoundedINTEL", SpvOpUAverageRoundedINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ISubSatINTEL", SpvOpISubSatINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"USubSatINTEL", SpvOpUSubSatINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"IMul32x16INTEL", SpvOpIMul32x16INTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"UMul32x16INTEL", SpvOpUMul32x16INTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ConstantFunctionPointerINTEL", SpvOpConstantFunctionPointerINTEL, 1, pygen_variable_caps_FunctionPointersINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_INTEL_function_pointers, 0xffffffffu, 0xffffffffu}, - {"FunctionPointerCallINTEL", SpvOpFunctionPointerCallINTEL, 1, pygen_variable_caps_FunctionPointersINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 1, pygen_variable_exts_SPV_INTEL_function_pointers, 0xffffffffu, 0xffffffffu}, - {"AsmTargetINTEL", SpvOpAsmTargetINTEL, 1, pygen_variable_caps_AsmINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"AsmINTEL", SpvOpAsmINTEL, 1, pygen_variable_caps_AsmINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"AsmCallINTEL", SpvOpAsmCallINTEL, 1, pygen_variable_caps_AsmINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"AtomicFMinEXT", SpvOpAtomicFMinEXT, 3, pygen_variable_caps_AtomicFloat16MinMaxEXTAtomicFloat32MinMaxEXTAtomicFloat64MinMaxEXT, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"AtomicFMaxEXT", SpvOpAtomicFMaxEXT, 3, pygen_variable_caps_AtomicFloat16MinMaxEXTAtomicFloat32MinMaxEXTAtomicFloat64MinMaxEXT, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"AssumeTrueKHR", SpvOpAssumeTrueKHR, 1, pygen_variable_caps_ExpectAssumeKHR, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_expect_assume, 0xffffffffu, 0xffffffffu}, - {"ExpectKHR", SpvOpExpectKHR, 1, pygen_variable_caps_ExpectAssumeKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_expect_assume, 0xffffffffu, 0xffffffffu}, - {"DecorateString", SpvOpDecorateString, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 2, pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, - {"DecorateStringGOOGLE", SpvOpDecorateStringGOOGLE, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 2, pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, - {"MemberDecorateString", SpvOpMemberDecorateString, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 2, pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, - {"MemberDecorateStringGOOGLE", SpvOpMemberDecorateStringGOOGLE, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 2, pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, - {"VmeImageINTEL", SpvOpVmeImageINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeVmeImageINTEL", SpvOpTypeVmeImageINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcImePayloadINTEL", SpvOpTypeAvcImePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcRefPayloadINTEL", SpvOpTypeAvcRefPayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcSicPayloadINTEL", SpvOpTypeAvcSicPayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcMcePayloadINTEL", SpvOpTypeAvcMcePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcMceResultINTEL", SpvOpTypeAvcMceResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcImeResultINTEL", SpvOpTypeAvcImeResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcImeResultSingleReferenceStreamoutINTEL", SpvOpTypeAvcImeResultSingleReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcImeResultDualReferenceStreamoutINTEL", SpvOpTypeAvcImeResultDualReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcImeSingleReferenceStreaminINTEL", SpvOpTypeAvcImeSingleReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcImeDualReferenceStreaminINTEL", SpvOpTypeAvcImeDualReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcRefResultINTEL", SpvOpTypeAvcRefResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeAvcSicResultINTEL", SpvOpTypeAvcSicResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL", SpvOpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL", SpvOpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultInterShapePenaltyINTEL", SpvOpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceSetInterShapePenaltyINTEL", SpvOpSubgroupAvcMceSetInterShapePenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL", SpvOpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceSetInterDirectionPenaltyINTEL", SpvOpSubgroupAvcMceSetInterDirectionPenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL", SpvOpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL", SpvOpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL", SpvOpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL", SpvOpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL", SpvOpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceSetMotionVectorCostFunctionINTEL", SpvOpSubgroupAvcMceSetMotionVectorCostFunctionINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL", SpvOpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL", SpvOpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL", SpvOpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationChromaINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceSetAcOnlyHaarINTEL", SpvOpSubgroupAvcMceSetAcOnlyHaarINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL", SpvOpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL", SpvOpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL", SpvOpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceConvertToImePayloadINTEL", SpvOpSubgroupAvcMceConvertToImePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceConvertToImeResultINTEL", SpvOpSubgroupAvcMceConvertToImeResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceConvertToRefPayloadINTEL", SpvOpSubgroupAvcMceConvertToRefPayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceConvertToRefResultINTEL", SpvOpSubgroupAvcMceConvertToRefResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceConvertToSicPayloadINTEL", SpvOpSubgroupAvcMceConvertToSicPayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceConvertToSicResultINTEL", SpvOpSubgroupAvcMceConvertToSicResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetMotionVectorsINTEL", SpvOpSubgroupAvcMceGetMotionVectorsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetInterDistortionsINTEL", SpvOpSubgroupAvcMceGetInterDistortionsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetBestInterDistortionsINTEL", SpvOpSubgroupAvcMceGetBestInterDistortionsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetInterMajorShapeINTEL", SpvOpSubgroupAvcMceGetInterMajorShapeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetInterMinorShapeINTEL", SpvOpSubgroupAvcMceGetInterMinorShapeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetInterDirectionsINTEL", SpvOpSubgroupAvcMceGetInterDirectionsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetInterMotionVectorCountINTEL", SpvOpSubgroupAvcMceGetInterMotionVectorCountINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetInterReferenceIdsINTEL", SpvOpSubgroupAvcMceGetInterReferenceIdsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL", SpvOpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeInitializeINTEL", SpvOpSubgroupAvcImeInitializeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeSetSingleReferenceINTEL", SpvOpSubgroupAvcImeSetSingleReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeSetDualReferenceINTEL", SpvOpSubgroupAvcImeSetDualReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeRefWindowSizeINTEL", SpvOpSubgroupAvcImeRefWindowSizeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeAdjustRefOffsetINTEL", SpvOpSubgroupAvcImeAdjustRefOffsetINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeConvertToMcePayloadINTEL", SpvOpSubgroupAvcImeConvertToMcePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeSetMaxMotionVectorCountINTEL", SpvOpSubgroupAvcImeSetMaxMotionVectorCountINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeSetUnidirectionalMixDisableINTEL", SpvOpSubgroupAvcImeSetUnidirectionalMixDisableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeSetEarlySearchTerminationThresholdINTEL", SpvOpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeSetWeightedSadINTEL", SpvOpSubgroupAvcImeSetWeightedSadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeEvaluateWithSingleReferenceINTEL", SpvOpSubgroupAvcImeEvaluateWithSingleReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeEvaluateWithDualReferenceINTEL", SpvOpSubgroupAvcImeEvaluateWithDualReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL", SpvOpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL", SpvOpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL", SpvOpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL", SpvOpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL", SpvOpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL", SpvOpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeConvertToMceResultINTEL", SpvOpSubgroupAvcImeConvertToMceResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetSingleReferenceStreaminINTEL", SpvOpSubgroupAvcImeGetSingleReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetDualReferenceStreaminINTEL", SpvOpSubgroupAvcImeGetDualReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeStripSingleReferenceStreamoutINTEL", SpvOpSubgroupAvcImeStripSingleReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeStripDualReferenceStreamoutINTEL", SpvOpSubgroupAvcImeStripDualReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL", SpvOpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL", SpvOpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL", SpvOpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL", SpvOpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL", SpvOpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL", SpvOpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetBorderReachedINTEL", SpvOpSubgroupAvcImeGetBorderReachedINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetTruncatedSearchIndicationINTEL", SpvOpSubgroupAvcImeGetTruncatedSearchIndicationINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL", SpvOpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL", SpvOpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL", SpvOpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcFmeInitializeINTEL", SpvOpSubgroupAvcFmeInitializeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcBmeInitializeINTEL", SpvOpSubgroupAvcBmeInitializeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcRefConvertToMcePayloadINTEL", SpvOpSubgroupAvcRefConvertToMcePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcRefSetBidirectionalMixDisableINTEL", SpvOpSubgroupAvcRefSetBidirectionalMixDisableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcRefSetBilinearFilterEnableINTEL", SpvOpSubgroupAvcRefSetBilinearFilterEnableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcRefEvaluateWithSingleReferenceINTEL", SpvOpSubgroupAvcRefEvaluateWithSingleReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcRefEvaluateWithDualReferenceINTEL", SpvOpSubgroupAvcRefEvaluateWithDualReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcRefEvaluateWithMultiReferenceINTEL", SpvOpSubgroupAvcRefEvaluateWithMultiReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL", SpvOpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcRefConvertToMceResultINTEL", SpvOpSubgroupAvcRefConvertToMceResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicInitializeINTEL", SpvOpSubgroupAvcSicInitializeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicConfigureSkcINTEL", SpvOpSubgroupAvcSicConfigureSkcINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicConfigureIpeLumaINTEL", SpvOpSubgroupAvcSicConfigureIpeLumaINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicConfigureIpeLumaChromaINTEL", SpvOpSubgroupAvcSicConfigureIpeLumaChromaINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationChromaINTEL, 13, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicGetMotionVectorMaskINTEL", SpvOpSubgroupAvcSicGetMotionVectorMaskINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicConvertToMcePayloadINTEL", SpvOpSubgroupAvcSicConvertToMcePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicSetIntraLumaShapePenaltyINTEL", SpvOpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicSetIntraLumaModeCostFunctionINTEL", SpvOpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicSetIntraChromaModeCostFunctionINTEL", SpvOpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationChromaINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicSetBilinearFilterEnableINTEL", SpvOpSubgroupAvcSicSetBilinearFilterEnableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicSetSkcForwardTransformEnableINTEL", SpvOpSubgroupAvcSicSetSkcForwardTransformEnableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicSetBlockBasedRawSkipSadINTEL", SpvOpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicEvaluateIpeINTEL", SpvOpSubgroupAvcSicEvaluateIpeINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicEvaluateWithSingleReferenceINTEL", SpvOpSubgroupAvcSicEvaluateWithSingleReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicEvaluateWithDualReferenceINTEL", SpvOpSubgroupAvcSicEvaluateWithDualReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicEvaluateWithMultiReferenceINTEL", SpvOpSubgroupAvcSicEvaluateWithMultiReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL", SpvOpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicConvertToMceResultINTEL", SpvOpSubgroupAvcSicConvertToMceResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicGetIpeLumaShapeINTEL", SpvOpSubgroupAvcSicGetIpeLumaShapeINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicGetBestIpeLumaDistortionINTEL", SpvOpSubgroupAvcSicGetBestIpeLumaDistortionINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicGetBestIpeChromaDistortionINTEL", SpvOpSubgroupAvcSicGetBestIpeChromaDistortionINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicGetPackedIpeLumaModesINTEL", SpvOpSubgroupAvcSicGetPackedIpeLumaModesINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicGetIpeChromaModeINTEL", SpvOpSubgroupAvcSicGetIpeChromaModeINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationChromaINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL", SpvOpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL", SpvOpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SubgroupAvcSicGetInterRawSadsINTEL", SpvOpSubgroupAvcSicGetInterRawSadsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"VariableLengthArrayINTEL", SpvOpVariableLengthArrayINTEL, 1, pygen_variable_caps_VariableLengthArrayINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SaveMemoryINTEL", SpvOpSaveMemoryINTEL, 1, pygen_variable_caps_VariableLengthArrayINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"RestoreMemoryINTEL", SpvOpRestoreMemoryINTEL, 1, pygen_variable_caps_VariableLengthArrayINTEL, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatSinCosPiINTEL", SpvOpArbitraryFloatSinCosPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatCastINTEL", SpvOpArbitraryFloatCastINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatCastFromIntINTEL", SpvOpArbitraryFloatCastFromIntINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatCastToIntINTEL", SpvOpArbitraryFloatCastToIntINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatAddINTEL", SpvOpArbitraryFloatAddINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatSubINTEL", SpvOpArbitraryFloatSubINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatMulINTEL", SpvOpArbitraryFloatMulINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatDivINTEL", SpvOpArbitraryFloatDivINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatGTINTEL", SpvOpArbitraryFloatGTINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatGEINTEL", SpvOpArbitraryFloatGEINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatLTINTEL", SpvOpArbitraryFloatLTINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatLEINTEL", SpvOpArbitraryFloatLEINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatEQINTEL", SpvOpArbitraryFloatEQINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatRecipINTEL", SpvOpArbitraryFloatRecipINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatRSqrtINTEL", SpvOpArbitraryFloatRSqrtINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatCbrtINTEL", SpvOpArbitraryFloatCbrtINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatHypotINTEL", SpvOpArbitraryFloatHypotINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatSqrtINTEL", SpvOpArbitraryFloatSqrtINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatLogINTEL", SpvOpArbitraryFloatLogINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatLog2INTEL", SpvOpArbitraryFloatLog2INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatLog10INTEL", SpvOpArbitraryFloatLog10INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatLog1pINTEL", SpvOpArbitraryFloatLog1pINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatExpINTEL", SpvOpArbitraryFloatExpINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatExp2INTEL", SpvOpArbitraryFloatExp2INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatExp10INTEL", SpvOpArbitraryFloatExp10INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatExpm1INTEL", SpvOpArbitraryFloatExpm1INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatSinINTEL", SpvOpArbitraryFloatSinINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatCosINTEL", SpvOpArbitraryFloatCosINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatSinCosINTEL", SpvOpArbitraryFloatSinCosINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatSinPiINTEL", SpvOpArbitraryFloatSinPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatCosPiINTEL", SpvOpArbitraryFloatCosPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatASinINTEL", SpvOpArbitraryFloatASinINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatASinPiINTEL", SpvOpArbitraryFloatASinPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatACosINTEL", SpvOpArbitraryFloatACosINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatACosPiINTEL", SpvOpArbitraryFloatACosPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatATanINTEL", SpvOpArbitraryFloatATanINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatATanPiINTEL", SpvOpArbitraryFloatATanPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatATan2INTEL", SpvOpArbitraryFloatATan2INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatPowINTEL", SpvOpArbitraryFloatPowINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatPowRINTEL", SpvOpArbitraryFloatPowRINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ArbitraryFloatPowNINTEL", SpvOpArbitraryFloatPowNINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"LoopControlINTEL", SpvOpLoopControlINTEL, 1, pygen_variable_caps_UnstructuredLoopControlsINTEL, 1, {SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 0, 0, 1, pygen_variable_exts_SPV_INTEL_unstructured_loop_controls, 0xffffffffu, 0xffffffffu}, - {"AliasDomainDeclINTEL", SpvOpAliasDomainDeclINTEL, 1, pygen_variable_caps_MemoryAccessAliasingINTEL, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 0, 1, pygen_variable_exts_SPV_INTEL_memory_access_aliasing, 0xffffffffu, 0xffffffffu}, - {"AliasScopeDeclINTEL", SpvOpAliasScopeDeclINTEL, 1, pygen_variable_caps_MemoryAccessAliasingINTEL, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 0, 1, pygen_variable_exts_SPV_INTEL_memory_access_aliasing, 0xffffffffu, 0xffffffffu}, - {"AliasScopeListDeclINTEL", SpvOpAliasScopeListDeclINTEL, 1, pygen_variable_caps_MemoryAccessAliasingINTEL, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 0, 1, pygen_variable_exts_SPV_INTEL_memory_access_aliasing, 0xffffffffu, 0xffffffffu}, - {"FixedSqrtINTEL", SpvOpFixedSqrtINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"FixedRecipINTEL", SpvOpFixedRecipINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"FixedRsqrtINTEL", SpvOpFixedRsqrtINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"FixedSinINTEL", SpvOpFixedSinINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"FixedCosINTEL", SpvOpFixedCosINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"FixedSinCosINTEL", SpvOpFixedSinCosINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"FixedSinPiINTEL", SpvOpFixedSinPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"FixedCosPiINTEL", SpvOpFixedCosPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"FixedSinCosPiINTEL", SpvOpFixedSinCosPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"FixedLogINTEL", SpvOpFixedLogINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"FixedExpINTEL", SpvOpFixedExpINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"PtrCastToCrossWorkgroupINTEL", SpvOpPtrCastToCrossWorkgroupINTEL, 1, pygen_variable_caps_USMStorageClassesINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"CrossWorkgroupCastToPtrINTEL", SpvOpCrossWorkgroupCastToPtrINTEL, 1, pygen_variable_caps_USMStorageClassesINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ReadPipeBlockingINTEL", SpvOpReadPipeBlockingINTEL, 1, pygen_variable_caps_BlockingPipesINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_INTEL_blocking_pipes, 0xffffffffu, 0xffffffffu}, - {"WritePipeBlockingINTEL", SpvOpWritePipeBlockingINTEL, 1, pygen_variable_caps_BlockingPipesINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_INTEL_blocking_pipes, 0xffffffffu, 0xffffffffu}, - {"FPGARegINTEL", SpvOpFPGARegINTEL, 1, pygen_variable_caps_FPGARegINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_INTEL_fpga_reg, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetRayTMinKHR", SpvOpRayQueryGetRayTMinKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetRayFlagsKHR", SpvOpRayQueryGetRayFlagsKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionTKHR", SpvOpRayQueryGetIntersectionTKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionInstanceCustomIndexKHR", SpvOpRayQueryGetIntersectionInstanceCustomIndexKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionInstanceIdKHR", SpvOpRayQueryGetIntersectionInstanceIdKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR", SpvOpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionGeometryIndexKHR", SpvOpRayQueryGetIntersectionGeometryIndexKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionPrimitiveIndexKHR", SpvOpRayQueryGetIntersectionPrimitiveIndexKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionBarycentricsKHR", SpvOpRayQueryGetIntersectionBarycentricsKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionFrontFaceKHR", SpvOpRayQueryGetIntersectionFrontFaceKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionCandidateAABBOpaqueKHR", SpvOpRayQueryGetIntersectionCandidateAABBOpaqueKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionObjectRayDirectionKHR", SpvOpRayQueryGetIntersectionObjectRayDirectionKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionObjectRayOriginKHR", SpvOpRayQueryGetIntersectionObjectRayOriginKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetWorldRayDirectionKHR", SpvOpRayQueryGetWorldRayDirectionKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetWorldRayOriginKHR", SpvOpRayQueryGetWorldRayOriginKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionObjectToWorldKHR", SpvOpRayQueryGetIntersectionObjectToWorldKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"RayQueryGetIntersectionWorldToObjectKHR", SpvOpRayQueryGetIntersectionWorldToObjectKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, - {"AtomicFAddEXT", SpvOpAtomicFAddEXT, 3, pygen_variable_caps_AtomicFloat16AddEXTAtomicFloat32AddEXTAtomicFloat64AddEXT, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_EXT_shader_atomic_float_add, 0xffffffffu, 0xffffffffu}, - {"TypeBufferSurfaceINTEL", SpvOpTypeBufferSurfaceINTEL, 1, pygen_variable_caps_VectorComputeINTEL, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ACCESS_QUALIFIER}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"TypeStructContinuedINTEL", SpvOpTypeStructContinuedINTEL, 1, pygen_variable_caps_LongConstantCompositeINTEL, 1, {SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ConstantCompositeContinuedINTEL", SpvOpConstantCompositeContinuedINTEL, 1, pygen_variable_caps_LongConstantCompositeINTEL, 1, {SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"SpecConstantCompositeContinuedINTEL", SpvOpSpecConstantCompositeContinuedINTEL, 1, pygen_variable_caps_LongConstantCompositeINTEL, 1, {SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ControlBarrierArriveINTEL", SpvOpControlBarrierArriveINTEL, 1, pygen_variable_caps_SplitBarrierINTEL, 3, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"ControlBarrierWaitINTEL", SpvOpControlBarrierWaitINTEL, 1, pygen_variable_caps_SplitBarrierINTEL, 3, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"GroupIMulKHR", SpvOpGroupIMulKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"GroupFMulKHR", SpvOpGroupFMulKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"GroupBitwiseAndKHR", SpvOpGroupBitwiseAndKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"GroupBitwiseOrKHR", SpvOpGroupBitwiseOrKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"GroupBitwiseXorKHR", SpvOpGroupBitwiseXorKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"GroupLogicalAndKHR", SpvOpGroupLogicalAndKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"GroupLogicalOrKHR", SpvOpGroupLogicalOrKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, - {"GroupLogicalXorKHR", SpvOpGroupLogicalXorKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu} + {"Nop", spv::Op::OpNop, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Undef", spv::Op::OpUndef, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SourceContinued", spv::Op::OpSourceContinued, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Source", spv::Op::OpSource, 0, nullptr, 4, {SPV_OPERAND_TYPE_SOURCE_LANGUAGE, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SourceExtension", spv::Op::OpSourceExtension, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Name", spv::Op::OpName, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MemberName", spv::Op::OpMemberName, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"String", spv::Op::OpString, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Line", spv::Op::OpLine, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Extension", spv::Op::OpExtension, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ExtInstImport", spv::Op::OpExtInstImport, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ExtInst", spv::Op::OpExtInst, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MemoryModel", spv::Op::OpMemoryModel, 0, nullptr, 2, {SPV_OPERAND_TYPE_ADDRESSING_MODEL, SPV_OPERAND_TYPE_MEMORY_MODEL}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"EntryPoint", spv::Op::OpEntryPoint, 0, nullptr, 4, {SPV_OPERAND_TYPE_EXECUTION_MODEL, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ExecutionMode", spv::Op::OpExecutionMode, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_EXECUTION_MODE}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Capability", spv::Op::OpCapability, 0, nullptr, 1, {SPV_OPERAND_TYPE_CAPABILITY}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeVoid", spv::Op::OpTypeVoid, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeBool", spv::Op::OpTypeBool, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeInt", spv::Op::OpTypeInt, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeFloat", spv::Op::OpTypeFloat, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeVector", spv::Op::OpTypeVector, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeMatrix", spv::Op::OpTypeMatrix, 1, pygen_variable_caps_Matrix, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeImage", spv::Op::OpTypeImage, 0, nullptr, 9, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DIMENSIONALITY, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT, SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeSampler", spv::Op::OpTypeSampler, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeSampledImage", spv::Op::OpTypeSampledImage, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeArray", spv::Op::OpTypeArray, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeRuntimeArray", spv::Op::OpTypeRuntimeArray, 1, pygen_variable_caps_Shader, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeStruct", spv::Op::OpTypeStruct, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeOpaque", spv::Op::OpTypeOpaque, 1, pygen_variable_caps_Kernel, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypePointer", spv::Op::OpTypePointer, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_STORAGE_CLASS, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeFunction", spv::Op::OpTypeFunction, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeEvent", spv::Op::OpTypeEvent, 1, pygen_variable_caps_Kernel, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeDeviceEvent", spv::Op::OpTypeDeviceEvent, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeReserveId", spv::Op::OpTypeReserveId, 1, pygen_variable_caps_Pipes, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeQueue", spv::Op::OpTypeQueue, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypePipe", spv::Op::OpTypePipe, 1, pygen_variable_caps_Pipes, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ACCESS_QUALIFIER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TypeForwardPointer", spv::Op::OpTypeForwardPointer, 2, pygen_variable_caps_AddressesPhysicalStorageBufferAddresses, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_STORAGE_CLASS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConstantTrue", spv::Op::OpConstantTrue, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConstantFalse", spv::Op::OpConstantFalse, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Constant", spv::Op::OpConstant, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConstantComposite", spv::Op::OpConstantComposite, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConstantSampler", spv::Op::OpConstantSampler, 1, pygen_variable_caps_LiteralSampler, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConstantNull", spv::Op::OpConstantNull, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SpecConstantTrue", spv::Op::OpSpecConstantTrue, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SpecConstantFalse", spv::Op::OpSpecConstantFalse, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SpecConstant", spv::Op::OpSpecConstant, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SpecConstantComposite", spv::Op::OpSpecConstantComposite, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SpecConstantOp", spv::Op::OpSpecConstantOp, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Function", spv::Op::OpFunction, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_FUNCTION_CONTROL, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FunctionParameter", spv::Op::OpFunctionParameter, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FunctionEnd", spv::Op::OpFunctionEnd, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FunctionCall", spv::Op::OpFunctionCall, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Variable", spv::Op::OpVariable, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_STORAGE_CLASS, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageTexelPointer", spv::Op::OpImageTexelPointer, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Load", spv::Op::OpLoad, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Store", spv::Op::OpStore, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CopyMemory", spv::Op::OpCopyMemory, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CopyMemorySized", spv::Op::OpCopyMemorySized, 1, pygen_variable_caps_Addresses, 5, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AccessChain", spv::Op::OpAccessChain, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InBoundsAccessChain", spv::Op::OpInBoundsAccessChain, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"PtrAccessChain", spv::Op::OpPtrAccessChain, 4, pygen_variable_caps_AddressesVariablePointersVariablePointersStorageBufferPhysicalStorageBufferAddresses, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ArrayLength", spv::Op::OpArrayLength, 1, pygen_variable_caps_Shader, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GenericPtrMemSemantics", spv::Op::OpGenericPtrMemSemantics, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InBoundsPtrAccessChain", spv::Op::OpInBoundsPtrAccessChain, 1, pygen_variable_caps_Addresses, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Decorate", spv::Op::OpDecorate, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MemberDecorate", spv::Op::OpMemberDecorate, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DecorationGroup", spv::Op::OpDecorationGroup, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupDecorate", spv::Op::OpGroupDecorate, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupMemberDecorate", spv::Op::OpGroupMemberDecorate, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"VectorExtractDynamic", spv::Op::OpVectorExtractDynamic, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"VectorInsertDynamic", spv::Op::OpVectorInsertDynamic, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"VectorShuffle", spv::Op::OpVectorShuffle, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CompositeConstruct", spv::Op::OpCompositeConstruct, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CompositeExtract", spv::Op::OpCompositeExtract, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CompositeInsert", spv::Op::OpCompositeInsert, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CopyObject", spv::Op::OpCopyObject, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Transpose", spv::Op::OpTranspose, 1, pygen_variable_caps_Matrix, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SampledImage", spv::Op::OpSampledImage, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSampleImplicitLod", spv::Op::OpImageSampleImplicitLod, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSampleExplicitLod", spv::Op::OpImageSampleExplicitLod, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSampleDrefImplicitLod", spv::Op::OpImageSampleDrefImplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSampleDrefExplicitLod", spv::Op::OpImageSampleDrefExplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSampleProjImplicitLod", spv::Op::OpImageSampleProjImplicitLod, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSampleProjExplicitLod", spv::Op::OpImageSampleProjExplicitLod, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSampleProjDrefImplicitLod", spv::Op::OpImageSampleProjDrefImplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSampleProjDrefExplicitLod", spv::Op::OpImageSampleProjDrefExplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageFetch", spv::Op::OpImageFetch, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageGather", spv::Op::OpImageGather, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageDrefGather", spv::Op::OpImageDrefGather, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageRead", spv::Op::OpImageRead, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageWrite", spv::Op::OpImageWrite, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Image", spv::Op::OpImage, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageQueryFormat", spv::Op::OpImageQueryFormat, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageQueryOrder", spv::Op::OpImageQueryOrder, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageQuerySizeLod", spv::Op::OpImageQuerySizeLod, 2, pygen_variable_caps_KernelImageQuery, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageQuerySize", spv::Op::OpImageQuerySize, 2, pygen_variable_caps_KernelImageQuery, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageQueryLod", spv::Op::OpImageQueryLod, 1, pygen_variable_caps_ImageQuery, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageQueryLevels", spv::Op::OpImageQueryLevels, 2, pygen_variable_caps_KernelImageQuery, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageQuerySamples", spv::Op::OpImageQuerySamples, 2, pygen_variable_caps_KernelImageQuery, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConvertFToU", spv::Op::OpConvertFToU, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConvertFToS", spv::Op::OpConvertFToS, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConvertSToF", spv::Op::OpConvertSToF, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConvertUToF", spv::Op::OpConvertUToF, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UConvert", spv::Op::OpUConvert, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SConvert", spv::Op::OpSConvert, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FConvert", spv::Op::OpFConvert, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"QuantizeToF16", spv::Op::OpQuantizeToF16, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConvertPtrToU", spv::Op::OpConvertPtrToU, 2, pygen_variable_caps_AddressesPhysicalStorageBufferAddresses, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SatConvertSToU", spv::Op::OpSatConvertSToU, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SatConvertUToS", spv::Op::OpSatConvertUToS, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConvertUToPtr", spv::Op::OpConvertUToPtr, 2, pygen_variable_caps_AddressesPhysicalStorageBufferAddresses, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"PtrCastToGeneric", spv::Op::OpPtrCastToGeneric, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GenericCastToPtr", spv::Op::OpGenericCastToPtr, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GenericCastToPtrExplicit", spv::Op::OpGenericCastToPtrExplicit, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_STORAGE_CLASS}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Bitcast", spv::Op::OpBitcast, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SNegate", spv::Op::OpSNegate, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FNegate", spv::Op::OpFNegate, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"IAdd", spv::Op::OpIAdd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FAdd", spv::Op::OpFAdd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ISub", spv::Op::OpISub, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FSub", spv::Op::OpFSub, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"IMul", spv::Op::OpIMul, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FMul", spv::Op::OpFMul, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UDiv", spv::Op::OpUDiv, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SDiv", spv::Op::OpSDiv, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FDiv", spv::Op::OpFDiv, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UMod", spv::Op::OpUMod, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SRem", spv::Op::OpSRem, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SMod", spv::Op::OpSMod, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FRem", spv::Op::OpFRem, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FMod", spv::Op::OpFMod, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"VectorTimesScalar", spv::Op::OpVectorTimesScalar, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MatrixTimesScalar", spv::Op::OpMatrixTimesScalar, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"VectorTimesMatrix", spv::Op::OpVectorTimesMatrix, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MatrixTimesVector", spv::Op::OpMatrixTimesVector, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MatrixTimesMatrix", spv::Op::OpMatrixTimesMatrix, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"OuterProduct", spv::Op::OpOuterProduct, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Dot", spv::Op::OpDot, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"IAddCarry", spv::Op::OpIAddCarry, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ISubBorrow", spv::Op::OpISubBorrow, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UMulExtended", spv::Op::OpUMulExtended, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SMulExtended", spv::Op::OpSMulExtended, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Any", spv::Op::OpAny, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"All", spv::Op::OpAll, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"IsNan", spv::Op::OpIsNan, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"IsInf", spv::Op::OpIsInf, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"IsFinite", spv::Op::OpIsFinite, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"IsNormal", spv::Op::OpIsNormal, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SignBitSet", spv::Op::OpSignBitSet, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LessOrGreater", spv::Op::OpLessOrGreater, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), SPV_SPIRV_VERSION_WORD(1,5)}, + {"Ordered", spv::Op::OpOrdered, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Unordered", spv::Op::OpUnordered, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LogicalEqual", spv::Op::OpLogicalEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LogicalNotEqual", spv::Op::OpLogicalNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LogicalOr", spv::Op::OpLogicalOr, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LogicalAnd", spv::Op::OpLogicalAnd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LogicalNot", spv::Op::OpLogicalNot, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Select", spv::Op::OpSelect, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"IEqual", spv::Op::OpIEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"INotEqual", spv::Op::OpINotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UGreaterThan", spv::Op::OpUGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SGreaterThan", spv::Op::OpSGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UGreaterThanEqual", spv::Op::OpUGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SGreaterThanEqual", spv::Op::OpSGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ULessThan", spv::Op::OpULessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SLessThan", spv::Op::OpSLessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ULessThanEqual", spv::Op::OpULessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SLessThanEqual", spv::Op::OpSLessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FOrdEqual", spv::Op::OpFOrdEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FUnordEqual", spv::Op::OpFUnordEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FOrdNotEqual", spv::Op::OpFOrdNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FUnordNotEqual", spv::Op::OpFUnordNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FOrdLessThan", spv::Op::OpFOrdLessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FUnordLessThan", spv::Op::OpFUnordLessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FOrdGreaterThan", spv::Op::OpFOrdGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FUnordGreaterThan", spv::Op::OpFUnordGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FOrdLessThanEqual", spv::Op::OpFOrdLessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FUnordLessThanEqual", spv::Op::OpFUnordLessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FOrdGreaterThanEqual", spv::Op::OpFOrdGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FUnordGreaterThanEqual", spv::Op::OpFUnordGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ShiftRightLogical", spv::Op::OpShiftRightLogical, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ShiftRightArithmetic", spv::Op::OpShiftRightArithmetic, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ShiftLeftLogical", spv::Op::OpShiftLeftLogical, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BitwiseOr", spv::Op::OpBitwiseOr, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BitwiseXor", spv::Op::OpBitwiseXor, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BitwiseAnd", spv::Op::OpBitwiseAnd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Not", spv::Op::OpNot, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BitFieldInsert", spv::Op::OpBitFieldInsert, 2, pygen_variable_caps_ShaderBitInstructions, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BitFieldSExtract", spv::Op::OpBitFieldSExtract, 2, pygen_variable_caps_ShaderBitInstructions, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BitFieldUExtract", spv::Op::OpBitFieldUExtract, 2, pygen_variable_caps_ShaderBitInstructions, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BitReverse", spv::Op::OpBitReverse, 2, pygen_variable_caps_ShaderBitInstructions, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BitCount", spv::Op::OpBitCount, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DPdx", spv::Op::OpDPdx, 1, pygen_variable_caps_Shader, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DPdy", spv::Op::OpDPdy, 1, pygen_variable_caps_Shader, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Fwidth", spv::Op::OpFwidth, 1, pygen_variable_caps_Shader, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DPdxFine", spv::Op::OpDPdxFine, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DPdyFine", spv::Op::OpDPdyFine, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FwidthFine", spv::Op::OpFwidthFine, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DPdxCoarse", spv::Op::OpDPdxCoarse, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DPdyCoarse", spv::Op::OpDPdyCoarse, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FwidthCoarse", spv::Op::OpFwidthCoarse, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"EmitVertex", spv::Op::OpEmitVertex, 1, pygen_variable_caps_Geometry, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"EndPrimitive", spv::Op::OpEndPrimitive, 1, pygen_variable_caps_Geometry, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"EmitStreamVertex", spv::Op::OpEmitStreamVertex, 1, pygen_variable_caps_GeometryStreams, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"EndStreamPrimitive", spv::Op::OpEndStreamPrimitive, 1, pygen_variable_caps_GeometryStreams, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ControlBarrier", spv::Op::OpControlBarrier, 0, nullptr, 3, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MemoryBarrier", spv::Op::OpMemoryBarrier, 0, nullptr, 2, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicLoad", spv::Op::OpAtomicLoad, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicStore", spv::Op::OpAtomicStore, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicExchange", spv::Op::OpAtomicExchange, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicCompareExchange", spv::Op::OpAtomicCompareExchange, 0, nullptr, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicCompareExchangeWeak", spv::Op::OpAtomicCompareExchangeWeak, 1, pygen_variable_caps_Kernel, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), SPV_SPIRV_VERSION_WORD(1,3)}, + {"AtomicIIncrement", spv::Op::OpAtomicIIncrement, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicIDecrement", spv::Op::OpAtomicIDecrement, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicIAdd", spv::Op::OpAtomicIAdd, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicISub", spv::Op::OpAtomicISub, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicSMin", spv::Op::OpAtomicSMin, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicUMin", spv::Op::OpAtomicUMin, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicSMax", spv::Op::OpAtomicSMax, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicUMax", spv::Op::OpAtomicUMax, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicAnd", spv::Op::OpAtomicAnd, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicOr", spv::Op::OpAtomicOr, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicXor", spv::Op::OpAtomicXor, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Phi", spv::Op::OpPhi, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LoopMerge", spv::Op::OpLoopMerge, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LOOP_CONTROL}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SelectionMerge", spv::Op::OpSelectionMerge, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SELECTION_CONTROL}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Label", spv::Op::OpLabel, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Branch", spv::Op::OpBranch, 0, nullptr, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BranchConditional", spv::Op::OpBranchConditional, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Switch", spv::Op::OpSwitch, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Kill", spv::Op::OpKill, 1, pygen_variable_caps_Shader, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Return", spv::Op::OpReturn, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ReturnValue", spv::Op::OpReturnValue, 0, nullptr, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Unreachable", spv::Op::OpUnreachable, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LifetimeStart", spv::Op::OpLifetimeStart, 1, pygen_variable_caps_Kernel, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LifetimeStop", spv::Op::OpLifetimeStop, 1, pygen_variable_caps_Kernel, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupAsyncCopy", spv::Op::OpGroupAsyncCopy, 1, pygen_variable_caps_Kernel, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupWaitEvents", spv::Op::OpGroupWaitEvents, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupAll", spv::Op::OpGroupAll, 1, pygen_variable_caps_Groups, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupAny", spv::Op::OpGroupAny, 1, pygen_variable_caps_Groups, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupBroadcast", spv::Op::OpGroupBroadcast, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupIAdd", spv::Op::OpGroupIAdd, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupFAdd", spv::Op::OpGroupFAdd, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupFMin", spv::Op::OpGroupFMin, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupUMin", spv::Op::OpGroupUMin, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupSMin", spv::Op::OpGroupSMin, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupFMax", spv::Op::OpGroupFMax, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupUMax", spv::Op::OpGroupUMax, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupSMax", spv::Op::OpGroupSMax, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ReadPipe", spv::Op::OpReadPipe, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WritePipe", spv::Op::OpWritePipe, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ReservedReadPipe", spv::Op::OpReservedReadPipe, 1, pygen_variable_caps_Pipes, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ReservedWritePipe", spv::Op::OpReservedWritePipe, 1, pygen_variable_caps_Pipes, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ReserveReadPipePackets", spv::Op::OpReserveReadPipePackets, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ReserveWritePipePackets", spv::Op::OpReserveWritePipePackets, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CommitReadPipe", spv::Op::OpCommitReadPipe, 1, pygen_variable_caps_Pipes, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CommitWritePipe", spv::Op::OpCommitWritePipe, 1, pygen_variable_caps_Pipes, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"IsValidReserveId", spv::Op::OpIsValidReserveId, 1, pygen_variable_caps_Pipes, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GetNumPipePackets", spv::Op::OpGetNumPipePackets, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GetMaxPipePackets", spv::Op::OpGetMaxPipePackets, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupReserveReadPipePackets", spv::Op::OpGroupReserveReadPipePackets, 1, pygen_variable_caps_Pipes, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupReserveWritePipePackets", spv::Op::OpGroupReserveWritePipePackets, 1, pygen_variable_caps_Pipes, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupCommitReadPipe", spv::Op::OpGroupCommitReadPipe, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GroupCommitWritePipe", spv::Op::OpGroupCommitWritePipe, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"EnqueueMarker", spv::Op::OpEnqueueMarker, 1, pygen_variable_caps_DeviceEnqueue, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"EnqueueKernel", spv::Op::OpEnqueueKernel, 1, pygen_variable_caps_DeviceEnqueue, 13, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GetKernelNDrangeSubGroupCount", spv::Op::OpGetKernelNDrangeSubGroupCount, 1, pygen_variable_caps_DeviceEnqueue, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GetKernelNDrangeMaxSubGroupSize", spv::Op::OpGetKernelNDrangeMaxSubGroupSize, 1, pygen_variable_caps_DeviceEnqueue, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GetKernelWorkGroupSize", spv::Op::OpGetKernelWorkGroupSize, 1, pygen_variable_caps_DeviceEnqueue, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GetKernelPreferredWorkGroupSizeMultiple", spv::Op::OpGetKernelPreferredWorkGroupSizeMultiple, 1, pygen_variable_caps_DeviceEnqueue, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RetainEvent", spv::Op::OpRetainEvent, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ReleaseEvent", spv::Op::OpReleaseEvent, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CreateUserEvent", spv::Op::OpCreateUserEvent, 1, pygen_variable_caps_DeviceEnqueue, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"IsValidEvent", spv::Op::OpIsValidEvent, 1, pygen_variable_caps_DeviceEnqueue, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SetUserEventStatus", spv::Op::OpSetUserEventStatus, 1, pygen_variable_caps_DeviceEnqueue, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CaptureEventProfilingInfo", spv::Op::OpCaptureEventProfilingInfo, 1, pygen_variable_caps_DeviceEnqueue, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GetDefaultQueue", spv::Op::OpGetDefaultQueue, 1, pygen_variable_caps_DeviceEnqueue, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BuildNDRange", spv::Op::OpBuildNDRange, 1, pygen_variable_caps_DeviceEnqueue, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSparseSampleImplicitLod", spv::Op::OpImageSparseSampleImplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSparseSampleExplicitLod", spv::Op::OpImageSparseSampleExplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSparseSampleDrefImplicitLod", spv::Op::OpImageSparseSampleDrefImplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSparseSampleDrefExplicitLod", spv::Op::OpImageSparseSampleDrefExplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSparseSampleProjImplicitLod", spv::Op::OpImageSparseSampleProjImplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ImageSparseSampleProjExplicitLod", spv::Op::OpImageSparseSampleProjExplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ImageSparseSampleProjDrefImplicitLod", spv::Op::OpImageSparseSampleProjDrefImplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ImageSparseSampleProjDrefExplicitLod", spv::Op::OpImageSparseSampleProjDrefExplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ImageSparseFetch", spv::Op::OpImageSparseFetch, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSparseGather", spv::Op::OpImageSparseGather, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSparseDrefGather", spv::Op::OpImageSparseDrefGather, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSparseTexelsResident", spv::Op::OpImageSparseTexelsResident, 1, pygen_variable_caps_SparseResidency, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NoLine", spv::Op::OpNoLine, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicFlagTestAndSet", spv::Op::OpAtomicFlagTestAndSet, 1, pygen_variable_caps_Kernel, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicFlagClear", spv::Op::OpAtomicFlagClear, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageSparseRead", spv::Op::OpImageSparseRead, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SizeOf", spv::Op::OpSizeOf, 1, pygen_variable_caps_Addresses, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, + {"TypePipeStorage", spv::Op::OpTypePipeStorage, 1, pygen_variable_caps_PipeStorage, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, + {"ConstantPipeStorage", spv::Op::OpConstantPipeStorage, 1, pygen_variable_caps_PipeStorage, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, + {"CreatePipeFromPipeStorage", spv::Op::OpCreatePipeFromPipeStorage, 1, pygen_variable_caps_PipeStorage, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, + {"GetKernelLocalSizeForSubgroupCount", spv::Op::OpGetKernelLocalSizeForSubgroupCount, 1, pygen_variable_caps_SubgroupDispatch, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, + {"GetKernelMaxNumSubgroups", spv::Op::OpGetKernelMaxNumSubgroups, 1, pygen_variable_caps_SubgroupDispatch, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, + {"TypeNamedBarrier", spv::Op::OpTypeNamedBarrier, 1, pygen_variable_caps_NamedBarrier, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, + {"NamedBarrierInitialize", spv::Op::OpNamedBarrierInitialize, 1, pygen_variable_caps_NamedBarrier, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, + {"MemoryNamedBarrier", spv::Op::OpMemoryNamedBarrier, 1, pygen_variable_caps_NamedBarrier, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, + {"ModuleProcessed", spv::Op::OpModuleProcessed, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, + {"ExecutionModeId", spv::Op::OpExecutionModeId, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_EXECUTION_MODE}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,2), 0xffffffffu}, + {"DecorateId", spv::Op::OpDecorateId, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 1, pygen_variable_exts_SPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,2), 0xffffffffu}, + {"GroupNonUniformElect", spv::Op::OpGroupNonUniformElect, 1, pygen_variable_caps_GroupNonUniform, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformAll", spv::Op::OpGroupNonUniformAll, 1, pygen_variable_caps_GroupNonUniformVote, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformAny", spv::Op::OpGroupNonUniformAny, 1, pygen_variable_caps_GroupNonUniformVote, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformAllEqual", spv::Op::OpGroupNonUniformAllEqual, 1, pygen_variable_caps_GroupNonUniformVote, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformBroadcast", spv::Op::OpGroupNonUniformBroadcast, 1, pygen_variable_caps_GroupNonUniformBallot, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformBroadcastFirst", spv::Op::OpGroupNonUniformBroadcastFirst, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformBallot", spv::Op::OpGroupNonUniformBallot, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformInverseBallot", spv::Op::OpGroupNonUniformInverseBallot, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformBallotBitExtract", spv::Op::OpGroupNonUniformBallotBitExtract, 1, pygen_variable_caps_GroupNonUniformBallot, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformBallotBitCount", spv::Op::OpGroupNonUniformBallotBitCount, 1, pygen_variable_caps_GroupNonUniformBallot, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformBallotFindLSB", spv::Op::OpGroupNonUniformBallotFindLSB, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformBallotFindMSB", spv::Op::OpGroupNonUniformBallotFindMSB, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformShuffle", spv::Op::OpGroupNonUniformShuffle, 1, pygen_variable_caps_GroupNonUniformShuffle, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformShuffleXor", spv::Op::OpGroupNonUniformShuffleXor, 1, pygen_variable_caps_GroupNonUniformShuffle, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformShuffleUp", spv::Op::OpGroupNonUniformShuffleUp, 1, pygen_variable_caps_GroupNonUniformShuffleRelative, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformShuffleDown", spv::Op::OpGroupNonUniformShuffleDown, 1, pygen_variable_caps_GroupNonUniformShuffleRelative, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformIAdd", spv::Op::OpGroupNonUniformIAdd, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformFAdd", spv::Op::OpGroupNonUniformFAdd, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformIMul", spv::Op::OpGroupNonUniformIMul, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformFMul", spv::Op::OpGroupNonUniformFMul, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformSMin", spv::Op::OpGroupNonUniformSMin, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformUMin", spv::Op::OpGroupNonUniformUMin, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformFMin", spv::Op::OpGroupNonUniformFMin, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformSMax", spv::Op::OpGroupNonUniformSMax, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformUMax", spv::Op::OpGroupNonUniformUMax, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformFMax", spv::Op::OpGroupNonUniformFMax, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformBitwiseAnd", spv::Op::OpGroupNonUniformBitwiseAnd, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformBitwiseOr", spv::Op::OpGroupNonUniformBitwiseOr, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformBitwiseXor", spv::Op::OpGroupNonUniformBitwiseXor, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformLogicalAnd", spv::Op::OpGroupNonUniformLogicalAnd, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformLogicalOr", spv::Op::OpGroupNonUniformLogicalOr, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformLogicalXor", spv::Op::OpGroupNonUniformLogicalXor, 3, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClusteredGroupNonUniformPartitionedNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformQuadBroadcast", spv::Op::OpGroupNonUniformQuadBroadcast, 1, pygen_variable_caps_GroupNonUniformQuad, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"GroupNonUniformQuadSwap", spv::Op::OpGroupNonUniformQuadSwap, 1, pygen_variable_caps_GroupNonUniformQuad, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"CopyLogical", spv::Op::OpCopyLogical, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, + {"PtrEqual", spv::Op::OpPtrEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, + {"PtrNotEqual", spv::Op::OpPtrNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, + {"PtrDiff", spv::Op::OpPtrDiff, 3, pygen_variable_caps_AddressesVariablePointersVariablePointersStorageBuffer, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, + {"ColorAttachmentReadEXT", spv::Op::OpColorAttachmentReadEXT, 1, pygen_variable_caps_TileImageColorReadAccessEXT, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"DepthAttachmentReadEXT", spv::Op::OpDepthAttachmentReadEXT, 1, pygen_variable_caps_TileImageDepthReadAccessEXT, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"StencilAttachmentReadEXT", spv::Op::OpStencilAttachmentReadEXT, 1, pygen_variable_caps_TileImageStencilReadAccessEXT, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TerminateInvocation", spv::Op::OpTerminateInvocation, 1, pygen_variable_caps_Shader, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_KHR_terminate_invocation, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"SubgroupBallotKHR", spv::Op::OpSubgroupBallotKHR, 1, pygen_variable_caps_SubgroupBallotKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"SubgroupFirstInvocationKHR", spv::Op::OpSubgroupFirstInvocationKHR, 1, pygen_variable_caps_SubgroupBallotKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"SubgroupAllKHR", spv::Op::OpSubgroupAllKHR, 1, pygen_variable_caps_SubgroupVoteKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_subgroup_vote, 0xffffffffu, 0xffffffffu}, + {"SubgroupAnyKHR", spv::Op::OpSubgroupAnyKHR, 1, pygen_variable_caps_SubgroupVoteKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_subgroup_vote, 0xffffffffu, 0xffffffffu}, + {"SubgroupAllEqualKHR", spv::Op::OpSubgroupAllEqualKHR, 1, pygen_variable_caps_SubgroupVoteKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_subgroup_vote, 0xffffffffu, 0xffffffffu}, + {"GroupNonUniformRotateKHR", spv::Op::OpGroupNonUniformRotateKHR, 1, pygen_variable_caps_GroupNonUniformRotateKHR, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupReadInvocationKHR", spv::Op::OpSubgroupReadInvocationKHR, 1, pygen_variable_caps_SubgroupBallotKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"TraceRayKHR", spv::Op::OpTraceRayKHR, 1, pygen_variable_caps_RayTracingKHR, 11, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, + {"ExecuteCallableKHR", spv::Op::OpExecuteCallableKHR, 1, pygen_variable_caps_RayTracingKHR, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, + {"ConvertUToAccelerationStructureKHR", spv::Op::OpConvertUToAccelerationStructureKHR, 2, pygen_variable_caps_RayTracingKHRRayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 2, pygen_variable_exts_SPV_KHR_ray_tracingSPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"IgnoreIntersectionKHR", spv::Op::OpIgnoreIntersectionKHR, 1, pygen_variable_caps_RayTracingKHR, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, + {"TerminateRayKHR", spv::Op::OpTerminateRayKHR, 1, pygen_variable_caps_RayTracingKHR, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, + {"SDot", spv::Op::OpSDot, 1, pygen_variable_caps_DotProduct, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"SDotKHR", spv::Op::OpSDotKHR, 1, pygen_variable_caps_DotProductKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"UDot", spv::Op::OpUDot, 1, pygen_variable_caps_DotProduct, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"UDotKHR", spv::Op::OpUDotKHR, 1, pygen_variable_caps_DotProductKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"SUDot", spv::Op::OpSUDot, 1, pygen_variable_caps_DotProduct, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"SUDotKHR", spv::Op::OpSUDotKHR, 1, pygen_variable_caps_DotProductKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"SDotAccSat", spv::Op::OpSDotAccSat, 1, pygen_variable_caps_DotProduct, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"SDotAccSatKHR", spv::Op::OpSDotAccSatKHR, 1, pygen_variable_caps_DotProductKHR, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"UDotAccSat", spv::Op::OpUDotAccSat, 1, pygen_variable_caps_DotProduct, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"UDotAccSatKHR", spv::Op::OpUDotAccSatKHR, 1, pygen_variable_caps_DotProductKHR, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"SUDotAccSat", spv::Op::OpSUDotAccSat, 1, pygen_variable_caps_DotProduct, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"SUDotAccSatKHR", spv::Op::OpSUDotAccSatKHR, 1, pygen_variable_caps_DotProductKHR, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT}, 1, 1, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"TypeCooperativeMatrixKHR", spv::Op::OpTypeCooperativeMatrixKHR, 1, pygen_variable_caps_CooperativeMatrixKHR, 6, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"CooperativeMatrixLoadKHR", spv::Op::OpCooperativeMatrixLoadKHR, 1, pygen_variable_caps_CooperativeMatrixKHR, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"CooperativeMatrixStoreKHR", spv::Op::OpCooperativeMatrixStoreKHR, 1, pygen_variable_caps_CooperativeMatrixKHR, 5, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"CooperativeMatrixMulAddKHR", spv::Op::OpCooperativeMatrixMulAddKHR, 1, pygen_variable_caps_CooperativeMatrixKHR, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"CooperativeMatrixLengthKHR", spv::Op::OpCooperativeMatrixLengthKHR, 1, pygen_variable_caps_CooperativeMatrixKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeRayQueryKHR", spv::Op::OpTypeRayQueryKHR, 1, pygen_variable_caps_RayQueryKHR, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryInitializeKHR", spv::Op::OpRayQueryInitializeKHR, 1, pygen_variable_caps_RayQueryKHR, 8, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryTerminateKHR", spv::Op::OpRayQueryTerminateKHR, 1, pygen_variable_caps_RayQueryKHR, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGenerateIntersectionKHR", spv::Op::OpRayQueryGenerateIntersectionKHR, 1, pygen_variable_caps_RayQueryKHR, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryConfirmIntersectionKHR", spv::Op::OpRayQueryConfirmIntersectionKHR, 1, pygen_variable_caps_RayQueryKHR, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryProceedKHR", spv::Op::OpRayQueryProceedKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionTypeKHR", spv::Op::OpRayQueryGetIntersectionTypeKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"ImageSampleWeightedQCOM", spv::Op::OpImageSampleWeightedQCOM, 1, pygen_variable_caps_TextureSampleWeightedQCOM, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ImageBoxFilterQCOM", spv::Op::OpImageBoxFilterQCOM, 1, pygen_variable_caps_TextureBoxFilterQCOM, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ImageBlockMatchSSDQCOM", spv::Op::OpImageBlockMatchSSDQCOM, 1, pygen_variable_caps_TextureBlockMatchQCOM, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ImageBlockMatchSADQCOM", spv::Op::OpImageBlockMatchSADQCOM, 1, pygen_variable_caps_TextureBlockMatchQCOM, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"GroupIAddNonUniformAMD", spv::Op::OpGroupIAddNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"GroupFAddNonUniformAMD", spv::Op::OpGroupFAddNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"GroupFMinNonUniformAMD", spv::Op::OpGroupFMinNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"GroupUMinNonUniformAMD", spv::Op::OpGroupUMinNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"GroupSMinNonUniformAMD", spv::Op::OpGroupSMinNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"GroupFMaxNonUniformAMD", spv::Op::OpGroupFMaxNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"GroupUMaxNonUniformAMD", spv::Op::OpGroupUMaxNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"GroupSMaxNonUniformAMD", spv::Op::OpGroupSMaxNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu, 0xffffffffu}, + {"FragmentMaskFetchAMD", spv::Op::OpFragmentMaskFetchAMD, 1, pygen_variable_caps_FragmentMaskAMD, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_fragment_mask, 0xffffffffu, 0xffffffffu}, + {"FragmentFetchAMD", spv::Op::OpFragmentFetchAMD, 1, pygen_variable_caps_FragmentMaskAMD, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_fragment_mask, 0xffffffffu, 0xffffffffu}, + {"ReadClockKHR", spv::Op::OpReadClockKHR, 1, pygen_variable_caps_ShaderClockKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FinalizeNodePayloadsAMDX", spv::Op::OpFinalizeNodePayloadsAMDX, 1, pygen_variable_caps_ShaderEnqueueAMDX, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FinishWritingNodePayloadAMDX", spv::Op::OpFinishWritingNodePayloadAMDX, 1, pygen_variable_caps_ShaderEnqueueAMDX, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"InitializeNodePayloadsAMDX", spv::Op::OpInitializeNodePayloadsAMDX, 1, pygen_variable_caps_ShaderEnqueueAMDX, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectRecordHitMotionNV", spv::Op::OpHitObjectRecordHitMotionNV, 2, pygen_variable_caps_ShaderInvocationReorderNVRayTracingMotionBlurNV, 14, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectRecordHitWithIndexMotionNV", spv::Op::OpHitObjectRecordHitWithIndexMotionNV, 2, pygen_variable_caps_ShaderInvocationReorderNVRayTracingMotionBlurNV, 13, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectRecordMissMotionNV", spv::Op::OpHitObjectRecordMissMotionNV, 2, pygen_variable_caps_ShaderInvocationReorderNVRayTracingMotionBlurNV, 7, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetWorldToObjectNV", spv::Op::OpHitObjectGetWorldToObjectNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetObjectToWorldNV", spv::Op::OpHitObjectGetObjectToWorldNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetObjectRayDirectionNV", spv::Op::OpHitObjectGetObjectRayDirectionNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetObjectRayOriginNV", spv::Op::OpHitObjectGetObjectRayOriginNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectTraceRayMotionNV", spv::Op::OpHitObjectTraceRayMotionNV, 2, pygen_variable_caps_ShaderInvocationReorderNVRayTracingMotionBlurNV, 13, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetShaderRecordBufferHandleNV", spv::Op::OpHitObjectGetShaderRecordBufferHandleNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetShaderBindingTableRecordIndexNV", spv::Op::OpHitObjectGetShaderBindingTableRecordIndexNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectRecordEmptyNV", spv::Op::OpHitObjectRecordEmptyNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectTraceRayNV", spv::Op::OpHitObjectTraceRayNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 12, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectRecordHitNV", spv::Op::OpHitObjectRecordHitNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 13, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectRecordHitWithIndexNV", spv::Op::OpHitObjectRecordHitWithIndexNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 12, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectRecordMissNV", spv::Op::OpHitObjectRecordMissNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 6, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectExecuteShaderNV", spv::Op::OpHitObjectExecuteShaderNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetCurrentTimeNV", spv::Op::OpHitObjectGetCurrentTimeNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetAttributesNV", spv::Op::OpHitObjectGetAttributesNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetHitKindNV", spv::Op::OpHitObjectGetHitKindNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetPrimitiveIndexNV", spv::Op::OpHitObjectGetPrimitiveIndexNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetGeometryIndexNV", spv::Op::OpHitObjectGetGeometryIndexNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetInstanceIdNV", spv::Op::OpHitObjectGetInstanceIdNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetInstanceCustomIndexNV", spv::Op::OpHitObjectGetInstanceCustomIndexNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetWorldRayDirectionNV", spv::Op::OpHitObjectGetWorldRayDirectionNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetWorldRayOriginNV", spv::Op::OpHitObjectGetWorldRayOriginNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetRayTMaxNV", spv::Op::OpHitObjectGetRayTMaxNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectGetRayTMinNV", spv::Op::OpHitObjectGetRayTMinNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectIsEmptyNV", spv::Op::OpHitObjectIsEmptyNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectIsHitNV", spv::Op::OpHitObjectIsHitNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"HitObjectIsMissNV", spv::Op::OpHitObjectIsMissNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ReorderThreadWithHitObjectNV", spv::Op::OpReorderThreadWithHitObjectNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ReorderThreadWithHintNV", spv::Op::OpReorderThreadWithHintNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeHitObjectNV", spv::Op::OpTypeHitObjectNV, 1, pygen_variable_caps_ShaderInvocationReorderNV, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ImageSampleFootprintNV", spv::Op::OpImageSampleFootprintNV, 1, pygen_variable_caps_ImageFootprintNV, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 1, pygen_variable_exts_SPV_NV_shader_image_footprint, 0xffffffffu, 0xffffffffu}, + {"EmitMeshTasksEXT", spv::Op::OpEmitMeshTasksEXT, 1, pygen_variable_caps_MeshShadingEXT, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SetMeshOutputsEXT", spv::Op::OpSetMeshOutputsEXT, 1, pygen_variable_caps_MeshShadingEXT, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"GroupNonUniformPartitionNV", spv::Op::OpGroupNonUniformPartitionNV, 1, pygen_variable_caps_GroupNonUniformPartitionedNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_NV_shader_subgroup_partitioned, 0xffffffffu, 0xffffffffu}, + {"WritePackedPrimitiveIndices4x8NV", spv::Op::OpWritePackedPrimitiveIndices4x8NV, 1, pygen_variable_caps_MeshShadingNV, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_NV_mesh_shader, 0xffffffffu, 0xffffffffu}, + {"ReportIntersectionKHR", spv::Op::OpReportIntersectionKHR, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 2, pygen_variable_exts_SPV_NV_ray_tracingSPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, + {"ReportIntersectionNV", spv::Op::OpReportIntersectionNV, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 2, pygen_variable_exts_SPV_NV_ray_tracingSPV_KHR_ray_tracing, 0xffffffffu, 0xffffffffu}, + {"IgnoreIntersectionNV", spv::Op::OpIgnoreIntersectionNV, 1, pygen_variable_caps_RayTracingNV, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing, 0xffffffffu, 0xffffffffu}, + {"TerminateRayNV", spv::Op::OpTerminateRayNV, 1, pygen_variable_caps_RayTracingNV, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing, 0xffffffffu, 0xffffffffu}, + {"TraceNV", spv::Op::OpTraceNV, 1, pygen_variable_caps_RayTracingNV, 11, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing, 0xffffffffu, 0xffffffffu}, + {"TraceMotionNV", spv::Op::OpTraceMotionNV, 1, pygen_variable_caps_RayTracingMotionBlurNV, 12, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing_motion_blur, 0xffffffffu, 0xffffffffu}, + {"TraceRayMotionNV", spv::Op::OpTraceRayMotionNV, 1, pygen_variable_caps_RayTracingMotionBlurNV, 12, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing_motion_blur, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionTriangleVertexPositionsKHR", spv::Op::OpRayQueryGetIntersectionTriangleVertexPositionsKHR, 1, pygen_variable_caps_RayQueryPositionFetchKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAccelerationStructureKHR", spv::Op::OpTypeAccelerationStructureKHR, 3, pygen_variable_caps_RayTracingNVRayTracingKHRRayQueryKHR, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 3, pygen_variable_exts_SPV_NV_ray_tracingSPV_KHR_ray_tracingSPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"TypeAccelerationStructureNV", spv::Op::OpTypeAccelerationStructureNV, 3, pygen_variable_caps_RayTracingNVRayTracingKHRRayQueryKHR, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 3, pygen_variable_exts_SPV_NV_ray_tracingSPV_KHR_ray_tracingSPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"ExecuteCallableNV", spv::Op::OpExecuteCallableNV, 1, pygen_variable_caps_RayTracingNV, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_NV_ray_tracing, 0xffffffffu, 0xffffffffu}, + {"TypeCooperativeMatrixNV", spv::Op::OpTypeCooperativeMatrixNV, 1, pygen_variable_caps_CooperativeMatrixNV, 5, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 1, pygen_variable_exts_SPV_NV_cooperative_matrix, 0xffffffffu, 0xffffffffu}, + {"CooperativeMatrixLoadNV", spv::Op::OpCooperativeMatrixLoadNV, 1, pygen_variable_caps_CooperativeMatrixNV, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 1, 1, 1, pygen_variable_exts_SPV_NV_cooperative_matrix, 0xffffffffu, 0xffffffffu}, + {"CooperativeMatrixStoreNV", spv::Op::OpCooperativeMatrixStoreNV, 1, pygen_variable_caps_CooperativeMatrixNV, 5, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 1, pygen_variable_exts_SPV_NV_cooperative_matrix, 0xffffffffu, 0xffffffffu}, + {"CooperativeMatrixMulAddNV", spv::Op::OpCooperativeMatrixMulAddNV, 1, pygen_variable_caps_CooperativeMatrixNV, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_NV_cooperative_matrix, 0xffffffffu, 0xffffffffu}, + {"CooperativeMatrixLengthNV", spv::Op::OpCooperativeMatrixLengthNV, 1, pygen_variable_caps_CooperativeMatrixNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_NV_cooperative_matrix, 0xffffffffu, 0xffffffffu}, + {"BeginInvocationInterlockEXT", spv::Op::OpBeginInvocationInterlockEXT, 3, pygen_variable_caps_FragmentShaderSampleInterlockEXTFragmentShaderPixelInterlockEXTFragmentShaderShadingRateInterlockEXT, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_EXT_fragment_shader_interlock, 0xffffffffu, 0xffffffffu}, + {"EndInvocationInterlockEXT", spv::Op::OpEndInvocationInterlockEXT, 3, pygen_variable_caps_FragmentShaderSampleInterlockEXTFragmentShaderPixelInterlockEXTFragmentShaderShadingRateInterlockEXT, 0, {}, 0, 0, 1, pygen_variable_exts_SPV_EXT_fragment_shader_interlock, 0xffffffffu, 0xffffffffu}, + {"DemoteToHelperInvocation", spv::Op::OpDemoteToHelperInvocation, 1, pygen_variable_caps_DemoteToHelperInvocation, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"DemoteToHelperInvocationEXT", spv::Op::OpDemoteToHelperInvocationEXT, 1, pygen_variable_caps_DemoteToHelperInvocationEXT, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"IsHelperInvocationEXT", spv::Op::OpIsHelperInvocationEXT, 1, pygen_variable_caps_DemoteToHelperInvocationEXT, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 1, pygen_variable_exts_SPV_EXT_demote_to_helper_invocation, 0xffffffffu, 0xffffffffu}, + {"ConvertUToImageNV", spv::Op::OpConvertUToImageNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ConvertUToSamplerNV", spv::Op::OpConvertUToSamplerNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ConvertImageToUNV", spv::Op::OpConvertImageToUNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ConvertSamplerToUNV", spv::Op::OpConvertSamplerToUNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ConvertUToSampledImageNV", spv::Op::OpConvertUToSampledImageNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ConvertSampledImageToUNV", spv::Op::OpConvertSampledImageToUNV, 1, pygen_variable_caps_BindlessTextureNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SamplerImageAddressingModeNV", spv::Op::OpSamplerImageAddressingModeNV, 1, pygen_variable_caps_BindlessTextureNV, 1, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupShuffleINTEL", spv::Op::OpSubgroupShuffleINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupShuffleDownINTEL", spv::Op::OpSubgroupShuffleDownINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupShuffleUpINTEL", spv::Op::OpSubgroupShuffleUpINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupShuffleXorINTEL", spv::Op::OpSubgroupShuffleXorINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupBlockReadINTEL", spv::Op::OpSubgroupBlockReadINTEL, 1, pygen_variable_caps_SubgroupBufferBlockIOINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupBlockWriteINTEL", spv::Op::OpSubgroupBlockWriteINTEL, 1, pygen_variable_caps_SubgroupBufferBlockIOINTEL, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupImageBlockReadINTEL", spv::Op::OpSubgroupImageBlockReadINTEL, 1, pygen_variable_caps_SubgroupImageBlockIOINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupImageBlockWriteINTEL", spv::Op::OpSubgroupImageBlockWriteINTEL, 1, pygen_variable_caps_SubgroupImageBlockIOINTEL, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupImageMediaBlockReadINTEL", spv::Op::OpSubgroupImageMediaBlockReadINTEL, 1, pygen_variable_caps_SubgroupImageMediaBlockIOINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupImageMediaBlockWriteINTEL", spv::Op::OpSubgroupImageMediaBlockWriteINTEL, 1, pygen_variable_caps_SubgroupImageMediaBlockIOINTEL, 5, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"UCountLeadingZerosINTEL", spv::Op::OpUCountLeadingZerosINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"UCountTrailingZerosINTEL", spv::Op::OpUCountTrailingZerosINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"AbsISubINTEL", spv::Op::OpAbsISubINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"AbsUSubINTEL", spv::Op::OpAbsUSubINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"IAddSatINTEL", spv::Op::OpIAddSatINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"UAddSatINTEL", spv::Op::OpUAddSatINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"IAverageINTEL", spv::Op::OpIAverageINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"UAverageINTEL", spv::Op::OpUAverageINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"IAverageRoundedINTEL", spv::Op::OpIAverageRoundedINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"UAverageRoundedINTEL", spv::Op::OpUAverageRoundedINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ISubSatINTEL", spv::Op::OpISubSatINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"USubSatINTEL", spv::Op::OpUSubSatINTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"IMul32x16INTEL", spv::Op::OpIMul32x16INTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"UMul32x16INTEL", spv::Op::OpUMul32x16INTEL, 1, pygen_variable_caps_IntegerFunctions2INTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ConstantFunctionPointerINTEL", spv::Op::OpConstantFunctionPointerINTEL, 1, pygen_variable_caps_FunctionPointersINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_INTEL_function_pointers, 0xffffffffu, 0xffffffffu}, + {"FunctionPointerCallINTEL", spv::Op::OpFunctionPointerCallINTEL, 1, pygen_variable_caps_FunctionPointersINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 1, pygen_variable_exts_SPV_INTEL_function_pointers, 0xffffffffu, 0xffffffffu}, + {"AsmTargetINTEL", spv::Op::OpAsmTargetINTEL, 1, pygen_variable_caps_AsmINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"AsmINTEL", spv::Op::OpAsmINTEL, 1, pygen_variable_caps_AsmINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"AsmCallINTEL", spv::Op::OpAsmCallINTEL, 1, pygen_variable_caps_AsmINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"AtomicFMinEXT", spv::Op::OpAtomicFMinEXT, 3, pygen_variable_caps_AtomicFloat16MinMaxEXTAtomicFloat32MinMaxEXTAtomicFloat64MinMaxEXT, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"AtomicFMaxEXT", spv::Op::OpAtomicFMaxEXT, 3, pygen_variable_caps_AtomicFloat16MinMaxEXTAtomicFloat32MinMaxEXTAtomicFloat64MinMaxEXT, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"AssumeTrueKHR", spv::Op::OpAssumeTrueKHR, 1, pygen_variable_caps_ExpectAssumeKHR, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 1, pygen_variable_exts_SPV_KHR_expect_assume, 0xffffffffu, 0xffffffffu}, + {"ExpectKHR", spv::Op::OpExpectKHR, 1, pygen_variable_caps_ExpectAssumeKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_expect_assume, 0xffffffffu, 0xffffffffu}, + {"DecorateString", spv::Op::OpDecorateString, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 2, pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, + {"DecorateStringGOOGLE", spv::Op::OpDecorateStringGOOGLE, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 2, pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, + {"MemberDecorateString", spv::Op::OpMemberDecorateString, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 2, pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, + {"MemberDecorateStringGOOGLE", spv::Op::OpMemberDecorateStringGOOGLE, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 2, pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, + {"VmeImageINTEL", spv::Op::OpVmeImageINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeVmeImageINTEL", spv::Op::OpTypeVmeImageINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcImePayloadINTEL", spv::Op::OpTypeAvcImePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcRefPayloadINTEL", spv::Op::OpTypeAvcRefPayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcSicPayloadINTEL", spv::Op::OpTypeAvcSicPayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcMcePayloadINTEL", spv::Op::OpTypeAvcMcePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcMceResultINTEL", spv::Op::OpTypeAvcMceResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcImeResultINTEL", spv::Op::OpTypeAvcImeResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcImeResultSingleReferenceStreamoutINTEL", spv::Op::OpTypeAvcImeResultSingleReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcImeResultDualReferenceStreamoutINTEL", spv::Op::OpTypeAvcImeResultDualReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcImeSingleReferenceStreaminINTEL", spv::Op::OpTypeAvcImeSingleReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcImeDualReferenceStreaminINTEL", spv::Op::OpTypeAvcImeDualReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcRefResultINTEL", spv::Op::OpTypeAvcRefResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeAvcSicResultINTEL", spv::Op::OpTypeAvcSicResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL", spv::Op::OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL", spv::Op::OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultInterShapePenaltyINTEL", spv::Op::OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceSetInterShapePenaltyINTEL", spv::Op::OpSubgroupAvcMceSetInterShapePenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL", spv::Op::OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceSetInterDirectionPenaltyINTEL", spv::Op::OpSubgroupAvcMceSetInterDirectionPenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL", spv::Op::OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL", spv::Op::OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL", spv::Op::OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL", spv::Op::OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL", spv::Op::OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceSetMotionVectorCostFunctionINTEL", spv::Op::OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL", spv::Op::OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL", spv::Op::OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL", spv::Op::OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationChromaINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceSetAcOnlyHaarINTEL", spv::Op::OpSubgroupAvcMceSetAcOnlyHaarINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL", spv::Op::OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL", spv::Op::OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL", spv::Op::OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceConvertToImePayloadINTEL", spv::Op::OpSubgroupAvcMceConvertToImePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceConvertToImeResultINTEL", spv::Op::OpSubgroupAvcMceConvertToImeResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceConvertToRefPayloadINTEL", spv::Op::OpSubgroupAvcMceConvertToRefPayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceConvertToRefResultINTEL", spv::Op::OpSubgroupAvcMceConvertToRefResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceConvertToSicPayloadINTEL", spv::Op::OpSubgroupAvcMceConvertToSicPayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceConvertToSicResultINTEL", spv::Op::OpSubgroupAvcMceConvertToSicResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetMotionVectorsINTEL", spv::Op::OpSubgroupAvcMceGetMotionVectorsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetInterDistortionsINTEL", spv::Op::OpSubgroupAvcMceGetInterDistortionsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetBestInterDistortionsINTEL", spv::Op::OpSubgroupAvcMceGetBestInterDistortionsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetInterMajorShapeINTEL", spv::Op::OpSubgroupAvcMceGetInterMajorShapeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetInterMinorShapeINTEL", spv::Op::OpSubgroupAvcMceGetInterMinorShapeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetInterDirectionsINTEL", spv::Op::OpSubgroupAvcMceGetInterDirectionsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetInterMotionVectorCountINTEL", spv::Op::OpSubgroupAvcMceGetInterMotionVectorCountINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetInterReferenceIdsINTEL", spv::Op::OpSubgroupAvcMceGetInterReferenceIdsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL", spv::Op::OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeInitializeINTEL", spv::Op::OpSubgroupAvcImeInitializeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeSetSingleReferenceINTEL", spv::Op::OpSubgroupAvcImeSetSingleReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeSetDualReferenceINTEL", spv::Op::OpSubgroupAvcImeSetDualReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeRefWindowSizeINTEL", spv::Op::OpSubgroupAvcImeRefWindowSizeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeAdjustRefOffsetINTEL", spv::Op::OpSubgroupAvcImeAdjustRefOffsetINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeConvertToMcePayloadINTEL", spv::Op::OpSubgroupAvcImeConvertToMcePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeSetMaxMotionVectorCountINTEL", spv::Op::OpSubgroupAvcImeSetMaxMotionVectorCountINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeSetUnidirectionalMixDisableINTEL", spv::Op::OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeSetEarlySearchTerminationThresholdINTEL", spv::Op::OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeSetWeightedSadINTEL", spv::Op::OpSubgroupAvcImeSetWeightedSadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeEvaluateWithSingleReferenceINTEL", spv::Op::OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeEvaluateWithDualReferenceINTEL", spv::Op::OpSubgroupAvcImeEvaluateWithDualReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL", spv::Op::OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL", spv::Op::OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL", spv::Op::OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL", spv::Op::OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL", spv::Op::OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL", spv::Op::OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeConvertToMceResultINTEL", spv::Op::OpSubgroupAvcImeConvertToMceResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetSingleReferenceStreaminINTEL", spv::Op::OpSubgroupAvcImeGetSingleReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetDualReferenceStreaminINTEL", spv::Op::OpSubgroupAvcImeGetDualReferenceStreaminINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeStripSingleReferenceStreamoutINTEL", spv::Op::OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeStripDualReferenceStreamoutINTEL", spv::Op::OpSubgroupAvcImeStripDualReferenceStreamoutINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL", spv::Op::OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL", spv::Op::OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL", spv::Op::OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL", spv::Op::OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL", spv::Op::OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL", spv::Op::OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetBorderReachedINTEL", spv::Op::OpSubgroupAvcImeGetBorderReachedINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetTruncatedSearchIndicationINTEL", spv::Op::OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL", spv::Op::OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL", spv::Op::OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL", spv::Op::OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcFmeInitializeINTEL", spv::Op::OpSubgroupAvcFmeInitializeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcBmeInitializeINTEL", spv::Op::OpSubgroupAvcBmeInitializeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcRefConvertToMcePayloadINTEL", spv::Op::OpSubgroupAvcRefConvertToMcePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcRefSetBidirectionalMixDisableINTEL", spv::Op::OpSubgroupAvcRefSetBidirectionalMixDisableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcRefSetBilinearFilterEnableINTEL", spv::Op::OpSubgroupAvcRefSetBilinearFilterEnableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcRefEvaluateWithSingleReferenceINTEL", spv::Op::OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcRefEvaluateWithDualReferenceINTEL", spv::Op::OpSubgroupAvcRefEvaluateWithDualReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcRefEvaluateWithMultiReferenceINTEL", spv::Op::OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL", spv::Op::OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcRefConvertToMceResultINTEL", spv::Op::OpSubgroupAvcRefConvertToMceResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicInitializeINTEL", spv::Op::OpSubgroupAvcSicInitializeINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicConfigureSkcINTEL", spv::Op::OpSubgroupAvcSicConfigureSkcINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicConfigureIpeLumaINTEL", spv::Op::OpSubgroupAvcSicConfigureIpeLumaINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicConfigureIpeLumaChromaINTEL", spv::Op::OpSubgroupAvcSicConfigureIpeLumaChromaINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationChromaINTEL, 13, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicGetMotionVectorMaskINTEL", spv::Op::OpSubgroupAvcSicGetMotionVectorMaskINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicConvertToMcePayloadINTEL", spv::Op::OpSubgroupAvcSicConvertToMcePayloadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicSetIntraLumaShapePenaltyINTEL", spv::Op::OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicSetIntraLumaModeCostFunctionINTEL", spv::Op::OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicSetIntraChromaModeCostFunctionINTEL", spv::Op::OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationChromaINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicSetBilinearFilterEnableINTEL", spv::Op::OpSubgroupAvcSicSetBilinearFilterEnableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicSetSkcForwardTransformEnableINTEL", spv::Op::OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicSetBlockBasedRawSkipSadINTEL", spv::Op::OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicEvaluateIpeINTEL", spv::Op::OpSubgroupAvcSicEvaluateIpeINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicEvaluateWithSingleReferenceINTEL", spv::Op::OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicEvaluateWithDualReferenceINTEL", spv::Op::OpSubgroupAvcSicEvaluateWithDualReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicEvaluateWithMultiReferenceINTEL", spv::Op::OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL", spv::Op::OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicConvertToMceResultINTEL", spv::Op::OpSubgroupAvcSicConvertToMceResultINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicGetIpeLumaShapeINTEL", spv::Op::OpSubgroupAvcSicGetIpeLumaShapeINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicGetBestIpeLumaDistortionINTEL", spv::Op::OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicGetBestIpeChromaDistortionINTEL", spv::Op::OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicGetPackedIpeLumaModesINTEL", spv::Op::OpSubgroupAvcSicGetPackedIpeLumaModesINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicGetIpeChromaModeINTEL", spv::Op::OpSubgroupAvcSicGetIpeChromaModeINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationChromaINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL", spv::Op::OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL", spv::Op::OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL, 2, pygen_variable_caps_SubgroupAvcMotionEstimationINTELSubgroupAvcMotionEstimationIntraINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SubgroupAvcSicGetInterRawSadsINTEL", spv::Op::OpSubgroupAvcSicGetInterRawSadsINTEL, 1, pygen_variable_caps_SubgroupAvcMotionEstimationINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"VariableLengthArrayINTEL", spv::Op::OpVariableLengthArrayINTEL, 1, pygen_variable_caps_VariableLengthArrayINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SaveMemoryINTEL", spv::Op::OpSaveMemoryINTEL, 1, pygen_variable_caps_VariableLengthArrayINTEL, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"RestoreMemoryINTEL", spv::Op::OpRestoreMemoryINTEL, 1, pygen_variable_caps_VariableLengthArrayINTEL, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatSinCosPiINTEL", spv::Op::OpArbitraryFloatSinCosPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatCastINTEL", spv::Op::OpArbitraryFloatCastINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatCastFromIntINTEL", spv::Op::OpArbitraryFloatCastFromIntINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatCastToIntINTEL", spv::Op::OpArbitraryFloatCastToIntINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatAddINTEL", spv::Op::OpArbitraryFloatAddINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatSubINTEL", spv::Op::OpArbitraryFloatSubINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatMulINTEL", spv::Op::OpArbitraryFloatMulINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatDivINTEL", spv::Op::OpArbitraryFloatDivINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatGTINTEL", spv::Op::OpArbitraryFloatGTINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatGEINTEL", spv::Op::OpArbitraryFloatGEINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatLTINTEL", spv::Op::OpArbitraryFloatLTINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatLEINTEL", spv::Op::OpArbitraryFloatLEINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatEQINTEL", spv::Op::OpArbitraryFloatEQINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatRecipINTEL", spv::Op::OpArbitraryFloatRecipINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatRSqrtINTEL", spv::Op::OpArbitraryFloatRSqrtINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatCbrtINTEL", spv::Op::OpArbitraryFloatCbrtINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatHypotINTEL", spv::Op::OpArbitraryFloatHypotINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatSqrtINTEL", spv::Op::OpArbitraryFloatSqrtINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatLogINTEL", spv::Op::OpArbitraryFloatLogINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatLog2INTEL", spv::Op::OpArbitraryFloatLog2INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatLog10INTEL", spv::Op::OpArbitraryFloatLog10INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatLog1pINTEL", spv::Op::OpArbitraryFloatLog1pINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatExpINTEL", spv::Op::OpArbitraryFloatExpINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatExp2INTEL", spv::Op::OpArbitraryFloatExp2INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatExp10INTEL", spv::Op::OpArbitraryFloatExp10INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatExpm1INTEL", spv::Op::OpArbitraryFloatExpm1INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatSinINTEL", spv::Op::OpArbitraryFloatSinINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatCosINTEL", spv::Op::OpArbitraryFloatCosINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatSinCosINTEL", spv::Op::OpArbitraryFloatSinCosINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatSinPiINTEL", spv::Op::OpArbitraryFloatSinPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatCosPiINTEL", spv::Op::OpArbitraryFloatCosPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatASinINTEL", spv::Op::OpArbitraryFloatASinINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatASinPiINTEL", spv::Op::OpArbitraryFloatASinPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatACosINTEL", spv::Op::OpArbitraryFloatACosINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatACosPiINTEL", spv::Op::OpArbitraryFloatACosPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatATanINTEL", spv::Op::OpArbitraryFloatATanINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatATanPiINTEL", spv::Op::OpArbitraryFloatATanPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatATan2INTEL", spv::Op::OpArbitraryFloatATan2INTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatPowINTEL", spv::Op::OpArbitraryFloatPowINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatPowRINTEL", spv::Op::OpArbitraryFloatPowRINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 10, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ArbitraryFloatPowNINTEL", spv::Op::OpArbitraryFloatPowNINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFloatingPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"LoopControlINTEL", spv::Op::OpLoopControlINTEL, 1, pygen_variable_caps_UnstructuredLoopControlsINTEL, 1, {SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 0, 0, 1, pygen_variable_exts_SPV_INTEL_unstructured_loop_controls, 0xffffffffu, 0xffffffffu}, + {"AliasDomainDeclINTEL", spv::Op::OpAliasDomainDeclINTEL, 1, pygen_variable_caps_MemoryAccessAliasingINTEL, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 0, 1, pygen_variable_exts_SPV_INTEL_memory_access_aliasing, 0xffffffffu, 0xffffffffu}, + {"AliasScopeDeclINTEL", spv::Op::OpAliasScopeDeclINTEL, 1, pygen_variable_caps_MemoryAccessAliasingINTEL, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 0, 1, pygen_variable_exts_SPV_INTEL_memory_access_aliasing, 0xffffffffu, 0xffffffffu}, + {"AliasScopeListDeclINTEL", spv::Op::OpAliasScopeListDeclINTEL, 1, pygen_variable_caps_MemoryAccessAliasingINTEL, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 0, 1, pygen_variable_exts_SPV_INTEL_memory_access_aliasing, 0xffffffffu, 0xffffffffu}, + {"FixedSqrtINTEL", spv::Op::OpFixedSqrtINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FixedRecipINTEL", spv::Op::OpFixedRecipINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FixedRsqrtINTEL", spv::Op::OpFixedRsqrtINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FixedSinINTEL", spv::Op::OpFixedSinINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FixedCosINTEL", spv::Op::OpFixedCosINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FixedSinCosINTEL", spv::Op::OpFixedSinCosINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FixedSinPiINTEL", spv::Op::OpFixedSinPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FixedCosPiINTEL", spv::Op::OpFixedCosPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FixedSinCosPiINTEL", spv::Op::OpFixedSinCosPiINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FixedLogINTEL", spv::Op::OpFixedLogINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"FixedExpINTEL", spv::Op::OpFixedExpINTEL, 1, pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL, 9, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"PtrCastToCrossWorkgroupINTEL", spv::Op::OpPtrCastToCrossWorkgroupINTEL, 1, pygen_variable_caps_USMStorageClassesINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"CrossWorkgroupCastToPtrINTEL", spv::Op::OpCrossWorkgroupCastToPtrINTEL, 1, pygen_variable_caps_USMStorageClassesINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ReadPipeBlockingINTEL", spv::Op::OpReadPipeBlockingINTEL, 1, pygen_variable_caps_BlockingPipesINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_INTEL_blocking_pipes, 0xffffffffu, 0xffffffffu}, + {"WritePipeBlockingINTEL", spv::Op::OpWritePipeBlockingINTEL, 1, pygen_variable_caps_BlockingPipesINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_INTEL_blocking_pipes, 0xffffffffu, 0xffffffffu}, + {"FPGARegINTEL", spv::Op::OpFPGARegINTEL, 1, pygen_variable_caps_FPGARegINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_INTEL_fpga_reg, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetRayTMinKHR", spv::Op::OpRayQueryGetRayTMinKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetRayFlagsKHR", spv::Op::OpRayQueryGetRayFlagsKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionTKHR", spv::Op::OpRayQueryGetIntersectionTKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionInstanceCustomIndexKHR", spv::Op::OpRayQueryGetIntersectionInstanceCustomIndexKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionInstanceIdKHR", spv::Op::OpRayQueryGetIntersectionInstanceIdKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR", spv::Op::OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionGeometryIndexKHR", spv::Op::OpRayQueryGetIntersectionGeometryIndexKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionPrimitiveIndexKHR", spv::Op::OpRayQueryGetIntersectionPrimitiveIndexKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionBarycentricsKHR", spv::Op::OpRayQueryGetIntersectionBarycentricsKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionFrontFaceKHR", spv::Op::OpRayQueryGetIntersectionFrontFaceKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionCandidateAABBOpaqueKHR", spv::Op::OpRayQueryGetIntersectionCandidateAABBOpaqueKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionObjectRayDirectionKHR", spv::Op::OpRayQueryGetIntersectionObjectRayDirectionKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionObjectRayOriginKHR", spv::Op::OpRayQueryGetIntersectionObjectRayOriginKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetWorldRayDirectionKHR", spv::Op::OpRayQueryGetWorldRayDirectionKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetWorldRayOriginKHR", spv::Op::OpRayQueryGetWorldRayOriginKHR, 1, pygen_variable_caps_RayQueryKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionObjectToWorldKHR", spv::Op::OpRayQueryGetIntersectionObjectToWorldKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"RayQueryGetIntersectionWorldToObjectKHR", spv::Op::OpRayQueryGetIntersectionWorldToObjectKHR, 1, pygen_variable_caps_RayQueryKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_ray_query, 0xffffffffu, 0xffffffffu}, + {"AtomicFAddEXT", spv::Op::OpAtomicFAddEXT, 3, pygen_variable_caps_AtomicFloat16AddEXTAtomicFloat32AddEXTAtomicFloat64AddEXT, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_EXT_shader_atomic_float_add, 0xffffffffu, 0xffffffffu}, + {"TypeBufferSurfaceINTEL", spv::Op::OpTypeBufferSurfaceINTEL, 1, pygen_variable_caps_VectorComputeINTEL, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ACCESS_QUALIFIER}, 1, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"TypeStructContinuedINTEL", spv::Op::OpTypeStructContinuedINTEL, 1, pygen_variable_caps_LongConstantCompositeINTEL, 1, {SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ConstantCompositeContinuedINTEL", spv::Op::OpConstantCompositeContinuedINTEL, 1, pygen_variable_caps_LongConstantCompositeINTEL, 1, {SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"SpecConstantCompositeContinuedINTEL", spv::Op::OpSpecConstantCompositeContinuedINTEL, 1, pygen_variable_caps_LongConstantCompositeINTEL, 1, {SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ConvertFToBF16INTEL", spv::Op::OpConvertFToBF16INTEL, 1, pygen_variable_caps_BFloat16ConversionINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ConvertBF16ToFINTEL", spv::Op::OpConvertBF16ToFINTEL, 1, pygen_variable_caps_BFloat16ConversionINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ControlBarrierArriveINTEL", spv::Op::OpControlBarrierArriveINTEL, 1, pygen_variable_caps_SplitBarrierINTEL, 3, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"ControlBarrierWaitINTEL", spv::Op::OpControlBarrierWaitINTEL, 1, pygen_variable_caps_SplitBarrierINTEL, 3, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"GroupIMulKHR", spv::Op::OpGroupIMulKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"GroupFMulKHR", spv::Op::OpGroupFMulKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"GroupBitwiseAndKHR", spv::Op::OpGroupBitwiseAndKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"GroupBitwiseOrKHR", spv::Op::OpGroupBitwiseOrKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"GroupBitwiseXorKHR", spv::Op::OpGroupBitwiseXorKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"GroupLogicalAndKHR", spv::Op::OpGroupLogicalAndKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"GroupLogicalOrKHR", spv::Op::OpGroupLogicalOrKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu}, + {"GroupLogicalXorKHR", spv::Op::OpGroupLogicalXorKHR, 1, pygen_variable_caps_GroupUniformArithmeticKHR, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu, 0xffffffffu} }; \ No newline at end of file diff --git a/bgfx/3rdparty/spirv-tools/include/generated/enum_string_mapping.inc b/bgfx/3rdparty/spirv-tools/include/generated/enum_string_mapping.inc index e2752e29..0515002a 100644 --- a/bgfx/3rdparty/spirv-tools/include/generated/enum_string_mapping.inc +++ b/bgfx/3rdparty/spirv-tools/include/generated/enum_string_mapping.inc @@ -1,5 +1,7 @@ const char* ExtensionToString(Extension extension) { switch (extension) { + case Extension::kSPV_AMDX_shader_enqueue: + return "SPV_AMDX_shader_enqueue"; case Extension::kSPV_AMD_gcn_shader: return "SPV_AMD_gcn_shader"; case Extension::kSPV_AMD_gpu_shader_half_float: @@ -36,6 +38,8 @@ const char* ExtensionToString(Extension extension) { return "SPV_EXT_fragment_shader_interlock"; case Extension::kSPV_EXT_mesh_shader: return "SPV_EXT_mesh_shader"; + case Extension::kSPV_EXT_opacity_micromap: + return "SPV_EXT_opacity_micromap"; case Extension::kSPV_EXT_physical_storage_buffer: return "SPV_EXT_physical_storage_buffer"; case Extension::kSPV_EXT_shader_atomic_float16_add: @@ -48,6 +52,8 @@ const char* ExtensionToString(Extension extension) { return "SPV_EXT_shader_image_int64"; case Extension::kSPV_EXT_shader_stencil_export: return "SPV_EXT_shader_stencil_export"; + case Extension::kSPV_EXT_shader_tile_image: + return "SPV_EXT_shader_tile_image"; case Extension::kSPV_EXT_shader_viewport_index_layer: return "SPV_EXT_shader_viewport_index_layer"; case Extension::kSPV_GOOGLE_decorate_string: @@ -62,6 +68,8 @@ const char* ExtensionToString(Extension extension) { return "SPV_INTEL_arbitrary_precision_floating_point"; case Extension::kSPV_INTEL_arbitrary_precision_integers: return "SPV_INTEL_arbitrary_precision_integers"; + case Extension::kSPV_INTEL_bfloat16_conversion: + return "SPV_INTEL_bfloat16_conversion"; case Extension::kSPV_INTEL_blocking_pipes: return "SPV_INTEL_blocking_pipes"; case Extension::kSPV_INTEL_debug_module: @@ -72,10 +80,20 @@ const char* ExtensionToString(Extension extension) { return "SPV_INTEL_float_controls2"; case Extension::kSPV_INTEL_fp_fast_math_mode: return "SPV_INTEL_fp_fast_math_mode"; + case Extension::kSPV_INTEL_fp_max_error: + return "SPV_INTEL_fp_max_error"; + case Extension::kSPV_INTEL_fpga_argument_interfaces: + return "SPV_INTEL_fpga_argument_interfaces"; case Extension::kSPV_INTEL_fpga_buffer_location: return "SPV_INTEL_fpga_buffer_location"; case Extension::kSPV_INTEL_fpga_cluster_attributes: return "SPV_INTEL_fpga_cluster_attributes"; + case Extension::kSPV_INTEL_fpga_dsp_control: + return "SPV_INTEL_fpga_dsp_control"; + case Extension::kSPV_INTEL_fpga_invocation_pipelining_attributes: + return "SPV_INTEL_fpga_invocation_pipelining_attributes"; + case Extension::kSPV_INTEL_fpga_latency_control: + return "SPV_INTEL_fpga_latency_control"; case Extension::kSPV_INTEL_fpga_loop_controls: return "SPV_INTEL_fpga_loop_controls"; case Extension::kSPV_INTEL_fpga_memory_accesses: @@ -86,6 +104,10 @@ const char* ExtensionToString(Extension extension) { return "SPV_INTEL_fpga_reg"; case Extension::kSPV_INTEL_function_pointers: return "SPV_INTEL_function_pointers"; + case Extension::kSPV_INTEL_global_variable_fpga_decorations: + return "SPV_INTEL_global_variable_fpga_decorations"; + case Extension::kSPV_INTEL_global_variable_host_access: + return "SPV_INTEL_global_variable_host_access"; case Extension::kSPV_INTEL_inline_assembly: return "SPV_INTEL_inline_assembly"; case Extension::kSPV_INTEL_io_pipes: @@ -102,6 +124,8 @@ const char* ExtensionToString(Extension extension) { return "SPV_INTEL_memory_access_aliasing"; case Extension::kSPV_INTEL_optnone: return "SPV_INTEL_optnone"; + case Extension::kSPV_INTEL_runtime_aligned: + return "SPV_INTEL_runtime_aligned"; case Extension::kSPV_INTEL_shader_integer_functions2: return "SPV_INTEL_shader_integer_functions2"; case Extension::kSPV_INTEL_split_barrier: @@ -122,6 +146,8 @@ const char* ExtensionToString(Extension extension) { return "SPV_KHR_8bit_storage"; case Extension::kSPV_KHR_bit_instructions: return "SPV_KHR_bit_instructions"; + case Extension::kSPV_KHR_cooperative_matrix: + return "SPV_KHR_cooperative_matrix"; case Extension::kSPV_KHR_device_group: return "SPV_KHR_device_group"; case Extension::kSPV_KHR_expect_assume: @@ -152,6 +178,8 @@ const char* ExtensionToString(Extension extension) { return "SPV_KHR_ray_query"; case Extension::kSPV_KHR_ray_tracing: return "SPV_KHR_ray_tracing"; + case Extension::kSPV_KHR_ray_tracing_position_fetch: + return "SPV_KHR_ray_tracing_position_fetch"; case Extension::kSPV_KHR_shader_atomic_counter_ops: return "SPV_KHR_shader_atomic_counter_ops"; case Extension::kSPV_KHR_shader_ballot: @@ -200,6 +228,8 @@ const char* ExtensionToString(Extension extension) { return "SPV_NV_sample_mask_override_coverage"; case Extension::kSPV_NV_shader_image_footprint: return "SPV_NV_shader_image_footprint"; + case Extension::kSPV_NV_shader_invocation_reorder: + return "SPV_NV_shader_invocation_reorder"; case Extension::kSPV_NV_shader_sm_builtins: return "SPV_NV_shader_sm_builtins"; case Extension::kSPV_NV_shader_subgroup_partitioned: @@ -210,6 +240,8 @@ const char* ExtensionToString(Extension extension) { return "SPV_NV_stereo_view_rendering"; case Extension::kSPV_NV_viewport_array2: return "SPV_NV_viewport_array2"; + case Extension::kSPV_QCOM_image_processing: + return "SPV_QCOM_image_processing"; case Extension::kSPV_VALIDATOR_ignore_type_decl_unique: return "SPV_VALIDATOR_ignore_type_decl_unique"; } @@ -219,8 +251,8 @@ const char* ExtensionToString(Extension extension) { bool GetExtensionFromString(const char* str, Extension* extension) { - static const char* known_ext_strs[] = { "SPV_AMD_gcn_shader", "SPV_AMD_gpu_shader_half_float", "SPV_AMD_gpu_shader_half_float_fetch", "SPV_AMD_gpu_shader_int16", "SPV_AMD_shader_ballot", "SPV_AMD_shader_early_and_late_fragment_tests", "SPV_AMD_shader_explicit_vertex_parameter", "SPV_AMD_shader_fragment_mask", "SPV_AMD_shader_image_load_store_lod", "SPV_AMD_shader_trinary_minmax", "SPV_AMD_texture_gather_bias_lod", "SPV_ARM_core_builtins", "SPV_EXT_demote_to_helper_invocation", "SPV_EXT_descriptor_indexing", "SPV_EXT_fragment_fully_covered", "SPV_EXT_fragment_invocation_density", "SPV_EXT_fragment_shader_interlock", "SPV_EXT_mesh_shader", "SPV_EXT_physical_storage_buffer", "SPV_EXT_shader_atomic_float16_add", "SPV_EXT_shader_atomic_float_add", "SPV_EXT_shader_atomic_float_min_max", "SPV_EXT_shader_image_int64", "SPV_EXT_shader_stencil_export", "SPV_EXT_shader_viewport_index_layer", "SPV_GOOGLE_decorate_string", "SPV_GOOGLE_hlsl_functionality1", "SPV_GOOGLE_user_type", "SPV_INTEL_arbitrary_precision_fixed_point", "SPV_INTEL_arbitrary_precision_floating_point", "SPV_INTEL_arbitrary_precision_integers", "SPV_INTEL_blocking_pipes", "SPV_INTEL_debug_module", "SPV_INTEL_device_side_avc_motion_estimation", "SPV_INTEL_float_controls2", "SPV_INTEL_fp_fast_math_mode", "SPV_INTEL_fpga_buffer_location", "SPV_INTEL_fpga_cluster_attributes", "SPV_INTEL_fpga_loop_controls", "SPV_INTEL_fpga_memory_accesses", "SPV_INTEL_fpga_memory_attributes", "SPV_INTEL_fpga_reg", "SPV_INTEL_function_pointers", "SPV_INTEL_inline_assembly", "SPV_INTEL_io_pipes", "SPV_INTEL_kernel_attributes", "SPV_INTEL_long_constant_composite", "SPV_INTEL_loop_fuse", "SPV_INTEL_media_block_io", "SPV_INTEL_memory_access_aliasing", "SPV_INTEL_optnone", "SPV_INTEL_shader_integer_functions2", "SPV_INTEL_split_barrier", "SPV_INTEL_subgroups", "SPV_INTEL_unstructured_loop_controls", "SPV_INTEL_usm_storage_classes", "SPV_INTEL_variable_length_array", "SPV_INTEL_vector_compute", "SPV_KHR_16bit_storage", "SPV_KHR_8bit_storage", "SPV_KHR_bit_instructions", "SPV_KHR_device_group", "SPV_KHR_expect_assume", "SPV_KHR_float_controls", "SPV_KHR_fragment_shader_barycentric", "SPV_KHR_fragment_shading_rate", "SPV_KHR_integer_dot_product", "SPV_KHR_linkonce_odr", "SPV_KHR_multiview", "SPV_KHR_no_integer_wrap_decoration", "SPV_KHR_non_semantic_info", "SPV_KHR_physical_storage_buffer", "SPV_KHR_post_depth_coverage", "SPV_KHR_ray_cull_mask", "SPV_KHR_ray_query", "SPV_KHR_ray_tracing", "SPV_KHR_shader_atomic_counter_ops", "SPV_KHR_shader_ballot", "SPV_KHR_shader_clock", "SPV_KHR_shader_draw_parameters", "SPV_KHR_storage_buffer_storage_class", "SPV_KHR_subgroup_rotate", "SPV_KHR_subgroup_uniform_control_flow", "SPV_KHR_subgroup_vote", "SPV_KHR_terminate_invocation", "SPV_KHR_uniform_group_instructions", "SPV_KHR_variable_pointers", "SPV_KHR_vulkan_memory_model", "SPV_KHR_workgroup_memory_explicit_layout", "SPV_NVX_multiview_per_view_attributes", "SPV_NV_bindless_texture", "SPV_NV_compute_shader_derivatives", "SPV_NV_cooperative_matrix", "SPV_NV_fragment_shader_barycentric", "SPV_NV_geometry_shader_passthrough", "SPV_NV_mesh_shader", "SPV_NV_ray_tracing", "SPV_NV_ray_tracing_motion_blur", "SPV_NV_sample_mask_override_coverage", "SPV_NV_shader_image_footprint", "SPV_NV_shader_sm_builtins", "SPV_NV_shader_subgroup_partitioned", "SPV_NV_shading_rate", "SPV_NV_stereo_view_rendering", "SPV_NV_viewport_array2", "SPV_VALIDATOR_ignore_type_decl_unique" }; - static const Extension known_ext_ids[] = { Extension::kSPV_AMD_gcn_shader, Extension::kSPV_AMD_gpu_shader_half_float, Extension::kSPV_AMD_gpu_shader_half_float_fetch, Extension::kSPV_AMD_gpu_shader_int16, Extension::kSPV_AMD_shader_ballot, Extension::kSPV_AMD_shader_early_and_late_fragment_tests, Extension::kSPV_AMD_shader_explicit_vertex_parameter, Extension::kSPV_AMD_shader_fragment_mask, Extension::kSPV_AMD_shader_image_load_store_lod, Extension::kSPV_AMD_shader_trinary_minmax, Extension::kSPV_AMD_texture_gather_bias_lod, Extension::kSPV_ARM_core_builtins, Extension::kSPV_EXT_demote_to_helper_invocation, Extension::kSPV_EXT_descriptor_indexing, Extension::kSPV_EXT_fragment_fully_covered, Extension::kSPV_EXT_fragment_invocation_density, Extension::kSPV_EXT_fragment_shader_interlock, Extension::kSPV_EXT_mesh_shader, Extension::kSPV_EXT_physical_storage_buffer, Extension::kSPV_EXT_shader_atomic_float16_add, Extension::kSPV_EXT_shader_atomic_float_add, Extension::kSPV_EXT_shader_atomic_float_min_max, Extension::kSPV_EXT_shader_image_int64, Extension::kSPV_EXT_shader_stencil_export, Extension::kSPV_EXT_shader_viewport_index_layer, Extension::kSPV_GOOGLE_decorate_string, Extension::kSPV_GOOGLE_hlsl_functionality1, Extension::kSPV_GOOGLE_user_type, Extension::kSPV_INTEL_arbitrary_precision_fixed_point, Extension::kSPV_INTEL_arbitrary_precision_floating_point, Extension::kSPV_INTEL_arbitrary_precision_integers, Extension::kSPV_INTEL_blocking_pipes, Extension::kSPV_INTEL_debug_module, Extension::kSPV_INTEL_device_side_avc_motion_estimation, Extension::kSPV_INTEL_float_controls2, Extension::kSPV_INTEL_fp_fast_math_mode, Extension::kSPV_INTEL_fpga_buffer_location, Extension::kSPV_INTEL_fpga_cluster_attributes, Extension::kSPV_INTEL_fpga_loop_controls, Extension::kSPV_INTEL_fpga_memory_accesses, Extension::kSPV_INTEL_fpga_memory_attributes, Extension::kSPV_INTEL_fpga_reg, Extension::kSPV_INTEL_function_pointers, Extension::kSPV_INTEL_inline_assembly, Extension::kSPV_INTEL_io_pipes, Extension::kSPV_INTEL_kernel_attributes, Extension::kSPV_INTEL_long_constant_composite, Extension::kSPV_INTEL_loop_fuse, Extension::kSPV_INTEL_media_block_io, Extension::kSPV_INTEL_memory_access_aliasing, Extension::kSPV_INTEL_optnone, Extension::kSPV_INTEL_shader_integer_functions2, Extension::kSPV_INTEL_split_barrier, Extension::kSPV_INTEL_subgroups, Extension::kSPV_INTEL_unstructured_loop_controls, Extension::kSPV_INTEL_usm_storage_classes, Extension::kSPV_INTEL_variable_length_array, Extension::kSPV_INTEL_vector_compute, Extension::kSPV_KHR_16bit_storage, Extension::kSPV_KHR_8bit_storage, Extension::kSPV_KHR_bit_instructions, Extension::kSPV_KHR_device_group, Extension::kSPV_KHR_expect_assume, Extension::kSPV_KHR_float_controls, Extension::kSPV_KHR_fragment_shader_barycentric, Extension::kSPV_KHR_fragment_shading_rate, Extension::kSPV_KHR_integer_dot_product, Extension::kSPV_KHR_linkonce_odr, Extension::kSPV_KHR_multiview, Extension::kSPV_KHR_no_integer_wrap_decoration, Extension::kSPV_KHR_non_semantic_info, Extension::kSPV_KHR_physical_storage_buffer, Extension::kSPV_KHR_post_depth_coverage, Extension::kSPV_KHR_ray_cull_mask, Extension::kSPV_KHR_ray_query, Extension::kSPV_KHR_ray_tracing, Extension::kSPV_KHR_shader_atomic_counter_ops, Extension::kSPV_KHR_shader_ballot, Extension::kSPV_KHR_shader_clock, Extension::kSPV_KHR_shader_draw_parameters, Extension::kSPV_KHR_storage_buffer_storage_class, Extension::kSPV_KHR_subgroup_rotate, Extension::kSPV_KHR_subgroup_uniform_control_flow, Extension::kSPV_KHR_subgroup_vote, Extension::kSPV_KHR_terminate_invocation, Extension::kSPV_KHR_uniform_group_instructions, Extension::kSPV_KHR_variable_pointers, Extension::kSPV_KHR_vulkan_memory_model, Extension::kSPV_KHR_workgroup_memory_explicit_layout, Extension::kSPV_NVX_multiview_per_view_attributes, Extension::kSPV_NV_bindless_texture, Extension::kSPV_NV_compute_shader_derivatives, Extension::kSPV_NV_cooperative_matrix, Extension::kSPV_NV_fragment_shader_barycentric, Extension::kSPV_NV_geometry_shader_passthrough, Extension::kSPV_NV_mesh_shader, Extension::kSPV_NV_ray_tracing, Extension::kSPV_NV_ray_tracing_motion_blur, Extension::kSPV_NV_sample_mask_override_coverage, Extension::kSPV_NV_shader_image_footprint, Extension::kSPV_NV_shader_sm_builtins, Extension::kSPV_NV_shader_subgroup_partitioned, Extension::kSPV_NV_shading_rate, Extension::kSPV_NV_stereo_view_rendering, Extension::kSPV_NV_viewport_array2, Extension::kSPV_VALIDATOR_ignore_type_decl_unique }; + static const char* known_ext_strs[] = { "SPV_AMDX_shader_enqueue", "SPV_AMD_gcn_shader", "SPV_AMD_gpu_shader_half_float", "SPV_AMD_gpu_shader_half_float_fetch", "SPV_AMD_gpu_shader_int16", "SPV_AMD_shader_ballot", "SPV_AMD_shader_early_and_late_fragment_tests", "SPV_AMD_shader_explicit_vertex_parameter", "SPV_AMD_shader_fragment_mask", "SPV_AMD_shader_image_load_store_lod", "SPV_AMD_shader_trinary_minmax", "SPV_AMD_texture_gather_bias_lod", "SPV_ARM_core_builtins", "SPV_EXT_demote_to_helper_invocation", "SPV_EXT_descriptor_indexing", "SPV_EXT_fragment_fully_covered", "SPV_EXT_fragment_invocation_density", "SPV_EXT_fragment_shader_interlock", "SPV_EXT_mesh_shader", "SPV_EXT_opacity_micromap", "SPV_EXT_physical_storage_buffer", "SPV_EXT_shader_atomic_float16_add", "SPV_EXT_shader_atomic_float_add", "SPV_EXT_shader_atomic_float_min_max", "SPV_EXT_shader_image_int64", "SPV_EXT_shader_stencil_export", "SPV_EXT_shader_tile_image", "SPV_EXT_shader_viewport_index_layer", "SPV_GOOGLE_decorate_string", "SPV_GOOGLE_hlsl_functionality1", "SPV_GOOGLE_user_type", "SPV_INTEL_arbitrary_precision_fixed_point", "SPV_INTEL_arbitrary_precision_floating_point", "SPV_INTEL_arbitrary_precision_integers", "SPV_INTEL_bfloat16_conversion", "SPV_INTEL_blocking_pipes", "SPV_INTEL_debug_module", "SPV_INTEL_device_side_avc_motion_estimation", "SPV_INTEL_float_controls2", "SPV_INTEL_fp_fast_math_mode", "SPV_INTEL_fp_max_error", "SPV_INTEL_fpga_argument_interfaces", "SPV_INTEL_fpga_buffer_location", "SPV_INTEL_fpga_cluster_attributes", "SPV_INTEL_fpga_dsp_control", "SPV_INTEL_fpga_invocation_pipelining_attributes", "SPV_INTEL_fpga_latency_control", "SPV_INTEL_fpga_loop_controls", "SPV_INTEL_fpga_memory_accesses", "SPV_INTEL_fpga_memory_attributes", "SPV_INTEL_fpga_reg", "SPV_INTEL_function_pointers", "SPV_INTEL_global_variable_fpga_decorations", "SPV_INTEL_global_variable_host_access", "SPV_INTEL_inline_assembly", "SPV_INTEL_io_pipes", "SPV_INTEL_kernel_attributes", "SPV_INTEL_long_constant_composite", "SPV_INTEL_loop_fuse", "SPV_INTEL_media_block_io", "SPV_INTEL_memory_access_aliasing", "SPV_INTEL_optnone", "SPV_INTEL_runtime_aligned", "SPV_INTEL_shader_integer_functions2", "SPV_INTEL_split_barrier", "SPV_INTEL_subgroups", "SPV_INTEL_unstructured_loop_controls", "SPV_INTEL_usm_storage_classes", "SPV_INTEL_variable_length_array", "SPV_INTEL_vector_compute", "SPV_KHR_16bit_storage", "SPV_KHR_8bit_storage", "SPV_KHR_bit_instructions", "SPV_KHR_cooperative_matrix", "SPV_KHR_device_group", "SPV_KHR_expect_assume", "SPV_KHR_float_controls", "SPV_KHR_fragment_shader_barycentric", "SPV_KHR_fragment_shading_rate", "SPV_KHR_integer_dot_product", "SPV_KHR_linkonce_odr", "SPV_KHR_multiview", "SPV_KHR_no_integer_wrap_decoration", "SPV_KHR_non_semantic_info", "SPV_KHR_physical_storage_buffer", "SPV_KHR_post_depth_coverage", "SPV_KHR_ray_cull_mask", "SPV_KHR_ray_query", "SPV_KHR_ray_tracing", "SPV_KHR_ray_tracing_position_fetch", "SPV_KHR_shader_atomic_counter_ops", "SPV_KHR_shader_ballot", "SPV_KHR_shader_clock", "SPV_KHR_shader_draw_parameters", "SPV_KHR_storage_buffer_storage_class", "SPV_KHR_subgroup_rotate", "SPV_KHR_subgroup_uniform_control_flow", "SPV_KHR_subgroup_vote", "SPV_KHR_terminate_invocation", "SPV_KHR_uniform_group_instructions", "SPV_KHR_variable_pointers", "SPV_KHR_vulkan_memory_model", "SPV_KHR_workgroup_memory_explicit_layout", "SPV_NVX_multiview_per_view_attributes", "SPV_NV_bindless_texture", "SPV_NV_compute_shader_derivatives", "SPV_NV_cooperative_matrix", "SPV_NV_fragment_shader_barycentric", "SPV_NV_geometry_shader_passthrough", "SPV_NV_mesh_shader", "SPV_NV_ray_tracing", "SPV_NV_ray_tracing_motion_blur", "SPV_NV_sample_mask_override_coverage", "SPV_NV_shader_image_footprint", "SPV_NV_shader_invocation_reorder", "SPV_NV_shader_sm_builtins", "SPV_NV_shader_subgroup_partitioned", "SPV_NV_shading_rate", "SPV_NV_stereo_view_rendering", "SPV_NV_viewport_array2", "SPV_QCOM_image_processing", "SPV_VALIDATOR_ignore_type_decl_unique" }; + static const Extension known_ext_ids[] = { Extension::kSPV_AMDX_shader_enqueue, Extension::kSPV_AMD_gcn_shader, Extension::kSPV_AMD_gpu_shader_half_float, Extension::kSPV_AMD_gpu_shader_half_float_fetch, Extension::kSPV_AMD_gpu_shader_int16, Extension::kSPV_AMD_shader_ballot, Extension::kSPV_AMD_shader_early_and_late_fragment_tests, Extension::kSPV_AMD_shader_explicit_vertex_parameter, Extension::kSPV_AMD_shader_fragment_mask, Extension::kSPV_AMD_shader_image_load_store_lod, Extension::kSPV_AMD_shader_trinary_minmax, Extension::kSPV_AMD_texture_gather_bias_lod, Extension::kSPV_ARM_core_builtins, Extension::kSPV_EXT_demote_to_helper_invocation, Extension::kSPV_EXT_descriptor_indexing, Extension::kSPV_EXT_fragment_fully_covered, Extension::kSPV_EXT_fragment_invocation_density, Extension::kSPV_EXT_fragment_shader_interlock, Extension::kSPV_EXT_mesh_shader, Extension::kSPV_EXT_opacity_micromap, Extension::kSPV_EXT_physical_storage_buffer, Extension::kSPV_EXT_shader_atomic_float16_add, Extension::kSPV_EXT_shader_atomic_float_add, Extension::kSPV_EXT_shader_atomic_float_min_max, Extension::kSPV_EXT_shader_image_int64, Extension::kSPV_EXT_shader_stencil_export, Extension::kSPV_EXT_shader_tile_image, Extension::kSPV_EXT_shader_viewport_index_layer, Extension::kSPV_GOOGLE_decorate_string, Extension::kSPV_GOOGLE_hlsl_functionality1, Extension::kSPV_GOOGLE_user_type, Extension::kSPV_INTEL_arbitrary_precision_fixed_point, Extension::kSPV_INTEL_arbitrary_precision_floating_point, Extension::kSPV_INTEL_arbitrary_precision_integers, Extension::kSPV_INTEL_bfloat16_conversion, Extension::kSPV_INTEL_blocking_pipes, Extension::kSPV_INTEL_debug_module, Extension::kSPV_INTEL_device_side_avc_motion_estimation, Extension::kSPV_INTEL_float_controls2, Extension::kSPV_INTEL_fp_fast_math_mode, Extension::kSPV_INTEL_fp_max_error, Extension::kSPV_INTEL_fpga_argument_interfaces, Extension::kSPV_INTEL_fpga_buffer_location, Extension::kSPV_INTEL_fpga_cluster_attributes, Extension::kSPV_INTEL_fpga_dsp_control, Extension::kSPV_INTEL_fpga_invocation_pipelining_attributes, Extension::kSPV_INTEL_fpga_latency_control, Extension::kSPV_INTEL_fpga_loop_controls, Extension::kSPV_INTEL_fpga_memory_accesses, Extension::kSPV_INTEL_fpga_memory_attributes, Extension::kSPV_INTEL_fpga_reg, Extension::kSPV_INTEL_function_pointers, Extension::kSPV_INTEL_global_variable_fpga_decorations, Extension::kSPV_INTEL_global_variable_host_access, Extension::kSPV_INTEL_inline_assembly, Extension::kSPV_INTEL_io_pipes, Extension::kSPV_INTEL_kernel_attributes, Extension::kSPV_INTEL_long_constant_composite, Extension::kSPV_INTEL_loop_fuse, Extension::kSPV_INTEL_media_block_io, Extension::kSPV_INTEL_memory_access_aliasing, Extension::kSPV_INTEL_optnone, Extension::kSPV_INTEL_runtime_aligned, Extension::kSPV_INTEL_shader_integer_functions2, Extension::kSPV_INTEL_split_barrier, Extension::kSPV_INTEL_subgroups, Extension::kSPV_INTEL_unstructured_loop_controls, Extension::kSPV_INTEL_usm_storage_classes, Extension::kSPV_INTEL_variable_length_array, Extension::kSPV_INTEL_vector_compute, Extension::kSPV_KHR_16bit_storage, Extension::kSPV_KHR_8bit_storage, Extension::kSPV_KHR_bit_instructions, Extension::kSPV_KHR_cooperative_matrix, Extension::kSPV_KHR_device_group, Extension::kSPV_KHR_expect_assume, Extension::kSPV_KHR_float_controls, Extension::kSPV_KHR_fragment_shader_barycentric, Extension::kSPV_KHR_fragment_shading_rate, Extension::kSPV_KHR_integer_dot_product, Extension::kSPV_KHR_linkonce_odr, Extension::kSPV_KHR_multiview, Extension::kSPV_KHR_no_integer_wrap_decoration, Extension::kSPV_KHR_non_semantic_info, Extension::kSPV_KHR_physical_storage_buffer, Extension::kSPV_KHR_post_depth_coverage, Extension::kSPV_KHR_ray_cull_mask, Extension::kSPV_KHR_ray_query, Extension::kSPV_KHR_ray_tracing, Extension::kSPV_KHR_ray_tracing_position_fetch, Extension::kSPV_KHR_shader_atomic_counter_ops, Extension::kSPV_KHR_shader_ballot, Extension::kSPV_KHR_shader_clock, Extension::kSPV_KHR_shader_draw_parameters, Extension::kSPV_KHR_storage_buffer_storage_class, Extension::kSPV_KHR_subgroup_rotate, Extension::kSPV_KHR_subgroup_uniform_control_flow, Extension::kSPV_KHR_subgroup_vote, Extension::kSPV_KHR_terminate_invocation, Extension::kSPV_KHR_uniform_group_instructions, Extension::kSPV_KHR_variable_pointers, Extension::kSPV_KHR_vulkan_memory_model, Extension::kSPV_KHR_workgroup_memory_explicit_layout, Extension::kSPV_NVX_multiview_per_view_attributes, Extension::kSPV_NV_bindless_texture, Extension::kSPV_NV_compute_shader_derivatives, Extension::kSPV_NV_cooperative_matrix, Extension::kSPV_NV_fragment_shader_barycentric, Extension::kSPV_NV_geometry_shader_passthrough, Extension::kSPV_NV_mesh_shader, Extension::kSPV_NV_ray_tracing, Extension::kSPV_NV_ray_tracing_motion_blur, Extension::kSPV_NV_sample_mask_override_coverage, Extension::kSPV_NV_shader_image_footprint, Extension::kSPV_NV_shader_invocation_reorder, Extension::kSPV_NV_shader_sm_builtins, Extension::kSPV_NV_shader_subgroup_partitioned, Extension::kSPV_NV_shading_rate, Extension::kSPV_NV_stereo_view_rendering, Extension::kSPV_NV_viewport_array2, Extension::kSPV_QCOM_image_processing, Extension::kSPV_VALIDATOR_ignore_type_decl_unique }; const auto b = std::begin(known_ext_strs); const auto e = std::end(known_ext_strs); const auto found = std::equal_range( @@ -234,412 +266,456 @@ const char* ExtensionToString(Extension extension) { } -const char* CapabilityToString(SpvCapability capability) { +const char* CapabilityToString(spv::Capability capability) { switch (capability) { - case SpvCapabilityMatrix: + case spv::Capability::Matrix: return "Matrix"; - case SpvCapabilityShader: + case spv::Capability::Shader: return "Shader"; - case SpvCapabilityGeometry: + case spv::Capability::Geometry: return "Geometry"; - case SpvCapabilityTessellation: + case spv::Capability::Tessellation: return "Tessellation"; - case SpvCapabilityAddresses: + case spv::Capability::Addresses: return "Addresses"; - case SpvCapabilityLinkage: + case spv::Capability::Linkage: return "Linkage"; - case SpvCapabilityKernel: + case spv::Capability::Kernel: return "Kernel"; - case SpvCapabilityVector16: + case spv::Capability::Vector16: return "Vector16"; - case SpvCapabilityFloat16Buffer: + case spv::Capability::Float16Buffer: return "Float16Buffer"; - case SpvCapabilityFloat16: + case spv::Capability::Float16: return "Float16"; - case SpvCapabilityFloat64: + case spv::Capability::Float64: return "Float64"; - case SpvCapabilityInt64: + case spv::Capability::Int64: return "Int64"; - case SpvCapabilityInt64Atomics: + case spv::Capability::Int64Atomics: return "Int64Atomics"; - case SpvCapabilityImageBasic: + case spv::Capability::ImageBasic: return "ImageBasic"; - case SpvCapabilityImageReadWrite: + case spv::Capability::ImageReadWrite: return "ImageReadWrite"; - case SpvCapabilityImageMipmap: + case spv::Capability::ImageMipmap: return "ImageMipmap"; - case SpvCapabilityPipes: + case spv::Capability::Pipes: return "Pipes"; - case SpvCapabilityGroups: + case spv::Capability::Groups: return "Groups"; - case SpvCapabilityDeviceEnqueue: + case spv::Capability::DeviceEnqueue: return "DeviceEnqueue"; - case SpvCapabilityLiteralSampler: + case spv::Capability::LiteralSampler: return "LiteralSampler"; - case SpvCapabilityAtomicStorage: + case spv::Capability::AtomicStorage: return "AtomicStorage"; - case SpvCapabilityInt16: + case spv::Capability::Int16: return "Int16"; - case SpvCapabilityTessellationPointSize: + case spv::Capability::TessellationPointSize: return "TessellationPointSize"; - case SpvCapabilityGeometryPointSize: + case spv::Capability::GeometryPointSize: return "GeometryPointSize"; - case SpvCapabilityImageGatherExtended: + case spv::Capability::ImageGatherExtended: return "ImageGatherExtended"; - case SpvCapabilityStorageImageMultisample: + case spv::Capability::StorageImageMultisample: return "StorageImageMultisample"; - case SpvCapabilityUniformBufferArrayDynamicIndexing: + case spv::Capability::UniformBufferArrayDynamicIndexing: return "UniformBufferArrayDynamicIndexing"; - case SpvCapabilitySampledImageArrayDynamicIndexing: + case spv::Capability::SampledImageArrayDynamicIndexing: return "SampledImageArrayDynamicIndexing"; - case SpvCapabilityStorageBufferArrayDynamicIndexing: + case spv::Capability::StorageBufferArrayDynamicIndexing: return "StorageBufferArrayDynamicIndexing"; - case SpvCapabilityStorageImageArrayDynamicIndexing: + case spv::Capability::StorageImageArrayDynamicIndexing: return "StorageImageArrayDynamicIndexing"; - case SpvCapabilityClipDistance: + case spv::Capability::ClipDistance: return "ClipDistance"; - case SpvCapabilityCullDistance: + case spv::Capability::CullDistance: return "CullDistance"; - case SpvCapabilityImageCubeArray: + case spv::Capability::ImageCubeArray: return "ImageCubeArray"; - case SpvCapabilitySampleRateShading: + case spv::Capability::SampleRateShading: return "SampleRateShading"; - case SpvCapabilityImageRect: + case spv::Capability::ImageRect: return "ImageRect"; - case SpvCapabilitySampledRect: + case spv::Capability::SampledRect: return "SampledRect"; - case SpvCapabilityGenericPointer: + case spv::Capability::GenericPointer: return "GenericPointer"; - case SpvCapabilityInt8: + case spv::Capability::Int8: return "Int8"; - case SpvCapabilityInputAttachment: + case spv::Capability::InputAttachment: return "InputAttachment"; - case SpvCapabilitySparseResidency: + case spv::Capability::SparseResidency: return "SparseResidency"; - case SpvCapabilityMinLod: + case spv::Capability::MinLod: return "MinLod"; - case SpvCapabilitySampled1D: + case spv::Capability::Sampled1D: return "Sampled1D"; - case SpvCapabilityImage1D: + case spv::Capability::Image1D: return "Image1D"; - case SpvCapabilitySampledCubeArray: + case spv::Capability::SampledCubeArray: return "SampledCubeArray"; - case SpvCapabilitySampledBuffer: + case spv::Capability::SampledBuffer: return "SampledBuffer"; - case SpvCapabilityImageBuffer: + case spv::Capability::ImageBuffer: return "ImageBuffer"; - case SpvCapabilityImageMSArray: + case spv::Capability::ImageMSArray: return "ImageMSArray"; - case SpvCapabilityStorageImageExtendedFormats: + case spv::Capability::StorageImageExtendedFormats: return "StorageImageExtendedFormats"; - case SpvCapabilityImageQuery: + case spv::Capability::ImageQuery: return "ImageQuery"; - case SpvCapabilityDerivativeControl: + case spv::Capability::DerivativeControl: return "DerivativeControl"; - case SpvCapabilityInterpolationFunction: + case spv::Capability::InterpolationFunction: return "InterpolationFunction"; - case SpvCapabilityTransformFeedback: + case spv::Capability::TransformFeedback: return "TransformFeedback"; - case SpvCapabilityGeometryStreams: + case spv::Capability::GeometryStreams: return "GeometryStreams"; - case SpvCapabilityStorageImageReadWithoutFormat: + case spv::Capability::StorageImageReadWithoutFormat: return "StorageImageReadWithoutFormat"; - case SpvCapabilityStorageImageWriteWithoutFormat: + case spv::Capability::StorageImageWriteWithoutFormat: return "StorageImageWriteWithoutFormat"; - case SpvCapabilityMultiViewport: + case spv::Capability::MultiViewport: return "MultiViewport"; - case SpvCapabilitySubgroupDispatch: + case spv::Capability::SubgroupDispatch: return "SubgroupDispatch"; - case SpvCapabilityNamedBarrier: + case spv::Capability::NamedBarrier: return "NamedBarrier"; - case SpvCapabilityPipeStorage: + case spv::Capability::PipeStorage: return "PipeStorage"; - case SpvCapabilityGroupNonUniform: + case spv::Capability::GroupNonUniform: return "GroupNonUniform"; - case SpvCapabilityGroupNonUniformVote: + case spv::Capability::GroupNonUniformVote: return "GroupNonUniformVote"; - case SpvCapabilityGroupNonUniformArithmetic: + case spv::Capability::GroupNonUniformArithmetic: return "GroupNonUniformArithmetic"; - case SpvCapabilityGroupNonUniformBallot: + case spv::Capability::GroupNonUniformBallot: return "GroupNonUniformBallot"; - case SpvCapabilityGroupNonUniformShuffle: + case spv::Capability::GroupNonUniformShuffle: return "GroupNonUniformShuffle"; - case SpvCapabilityGroupNonUniformShuffleRelative: + case spv::Capability::GroupNonUniformShuffleRelative: return "GroupNonUniformShuffleRelative"; - case SpvCapabilityGroupNonUniformClustered: + case spv::Capability::GroupNonUniformClustered: return "GroupNonUniformClustered"; - case SpvCapabilityGroupNonUniformQuad: + case spv::Capability::GroupNonUniformQuad: return "GroupNonUniformQuad"; - case SpvCapabilityShaderLayer: + case spv::Capability::ShaderLayer: return "ShaderLayer"; - case SpvCapabilityShaderViewportIndex: + case spv::Capability::ShaderViewportIndex: return "ShaderViewportIndex"; - case SpvCapabilityUniformDecoration: + case spv::Capability::UniformDecoration: return "UniformDecoration"; - case SpvCapabilityCoreBuiltinsARM: + case spv::Capability::CoreBuiltinsARM: return "CoreBuiltinsARM"; - case SpvCapabilityFragmentShadingRateKHR: + case spv::Capability::TileImageColorReadAccessEXT: + return "TileImageColorReadAccessEXT"; + case spv::Capability::TileImageDepthReadAccessEXT: + return "TileImageDepthReadAccessEXT"; + case spv::Capability::TileImageStencilReadAccessEXT: + return "TileImageStencilReadAccessEXT"; + case spv::Capability::FragmentShadingRateKHR: return "FragmentShadingRateKHR"; - case SpvCapabilitySubgroupBallotKHR: + case spv::Capability::SubgroupBallotKHR: return "SubgroupBallotKHR"; - case SpvCapabilityDrawParameters: + case spv::Capability::DrawParameters: return "DrawParameters"; - case SpvCapabilityWorkgroupMemoryExplicitLayoutKHR: + case spv::Capability::WorkgroupMemoryExplicitLayoutKHR: return "WorkgroupMemoryExplicitLayoutKHR"; - case SpvCapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR: + case spv::Capability::WorkgroupMemoryExplicitLayout8BitAccessKHR: return "WorkgroupMemoryExplicitLayout8BitAccessKHR"; - case SpvCapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR: + case spv::Capability::WorkgroupMemoryExplicitLayout16BitAccessKHR: return "WorkgroupMemoryExplicitLayout16BitAccessKHR"; - case SpvCapabilitySubgroupVoteKHR: + case spv::Capability::SubgroupVoteKHR: return "SubgroupVoteKHR"; - case SpvCapabilityStorageBuffer16BitAccess: + case spv::Capability::StorageBuffer16BitAccess: return "StorageBuffer16BitAccess"; - case SpvCapabilityUniformAndStorageBuffer16BitAccess: + case spv::Capability::UniformAndStorageBuffer16BitAccess: return "UniformAndStorageBuffer16BitAccess"; - case SpvCapabilityStoragePushConstant16: + case spv::Capability::StoragePushConstant16: return "StoragePushConstant16"; - case SpvCapabilityStorageInputOutput16: + case spv::Capability::StorageInputOutput16: return "StorageInputOutput16"; - case SpvCapabilityDeviceGroup: + case spv::Capability::DeviceGroup: return "DeviceGroup"; - case SpvCapabilityMultiView: + case spv::Capability::MultiView: return "MultiView"; - case SpvCapabilityVariablePointersStorageBuffer: + case spv::Capability::VariablePointersStorageBuffer: return "VariablePointersStorageBuffer"; - case SpvCapabilityVariablePointers: + case spv::Capability::VariablePointers: return "VariablePointers"; - case SpvCapabilityAtomicStorageOps: + case spv::Capability::AtomicStorageOps: return "AtomicStorageOps"; - case SpvCapabilitySampleMaskPostDepthCoverage: + case spv::Capability::SampleMaskPostDepthCoverage: return "SampleMaskPostDepthCoverage"; - case SpvCapabilityStorageBuffer8BitAccess: + case spv::Capability::StorageBuffer8BitAccess: return "StorageBuffer8BitAccess"; - case SpvCapabilityUniformAndStorageBuffer8BitAccess: + case spv::Capability::UniformAndStorageBuffer8BitAccess: return "UniformAndStorageBuffer8BitAccess"; - case SpvCapabilityStoragePushConstant8: + case spv::Capability::StoragePushConstant8: return "StoragePushConstant8"; - case SpvCapabilityDenormPreserve: + case spv::Capability::DenormPreserve: return "DenormPreserve"; - case SpvCapabilityDenormFlushToZero: + case spv::Capability::DenormFlushToZero: return "DenormFlushToZero"; - case SpvCapabilitySignedZeroInfNanPreserve: + case spv::Capability::SignedZeroInfNanPreserve: return "SignedZeroInfNanPreserve"; - case SpvCapabilityRoundingModeRTE: + case spv::Capability::RoundingModeRTE: return "RoundingModeRTE"; - case SpvCapabilityRoundingModeRTZ: + case spv::Capability::RoundingModeRTZ: return "RoundingModeRTZ"; - case SpvCapabilityRayQueryProvisionalKHR: + case spv::Capability::RayQueryProvisionalKHR: return "RayQueryProvisionalKHR"; - case SpvCapabilityRayQueryKHR: + case spv::Capability::RayQueryKHR: return "RayQueryKHR"; - case SpvCapabilityRayTraversalPrimitiveCullingKHR: + case spv::Capability::RayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR"; - case SpvCapabilityRayTracingKHR: + case spv::Capability::RayTracingKHR: return "RayTracingKHR"; - case SpvCapabilityFloat16ImageAMD: + case spv::Capability::TextureSampleWeightedQCOM: + return "TextureSampleWeightedQCOM"; + case spv::Capability::TextureBoxFilterQCOM: + return "TextureBoxFilterQCOM"; + case spv::Capability::TextureBlockMatchQCOM: + return "TextureBlockMatchQCOM"; + case spv::Capability::Float16ImageAMD: return "Float16ImageAMD"; - case SpvCapabilityImageGatherBiasLodAMD: + case spv::Capability::ImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD"; - case SpvCapabilityFragmentMaskAMD: + case spv::Capability::FragmentMaskAMD: return "FragmentMaskAMD"; - case SpvCapabilityStencilExportEXT: + case spv::Capability::StencilExportEXT: return "StencilExportEXT"; - case SpvCapabilityImageReadWriteLodAMD: + case spv::Capability::ImageReadWriteLodAMD: return "ImageReadWriteLodAMD"; - case SpvCapabilityInt64ImageEXT: + case spv::Capability::Int64ImageEXT: return "Int64ImageEXT"; - case SpvCapabilityShaderClockKHR: + case spv::Capability::ShaderClockKHR: return "ShaderClockKHR"; - case SpvCapabilitySampleMaskOverrideCoverageNV: + case spv::Capability::ShaderEnqueueAMDX: + return "ShaderEnqueueAMDX"; + case spv::Capability::SampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV"; - case SpvCapabilityGeometryShaderPassthroughNV: + case spv::Capability::GeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV"; - case SpvCapabilityShaderViewportIndexLayerEXT: + case spv::Capability::ShaderViewportIndexLayerEXT: return "ShaderViewportIndexLayerEXT"; - case SpvCapabilityShaderViewportMaskNV: + case spv::Capability::ShaderViewportMaskNV: return "ShaderViewportMaskNV"; - case SpvCapabilityShaderStereoViewNV: + case spv::Capability::ShaderStereoViewNV: return "ShaderStereoViewNV"; - case SpvCapabilityPerViewAttributesNV: + case spv::Capability::PerViewAttributesNV: return "PerViewAttributesNV"; - case SpvCapabilityFragmentFullyCoveredEXT: + case spv::Capability::FragmentFullyCoveredEXT: return "FragmentFullyCoveredEXT"; - case SpvCapabilityMeshShadingNV: + case spv::Capability::MeshShadingNV: return "MeshShadingNV"; - case SpvCapabilityImageFootprintNV: + case spv::Capability::ImageFootprintNV: return "ImageFootprintNV"; - case SpvCapabilityMeshShadingEXT: + case spv::Capability::MeshShadingEXT: return "MeshShadingEXT"; - case SpvCapabilityFragmentBarycentricKHR: + case spv::Capability::FragmentBarycentricKHR: return "FragmentBarycentricKHR"; - case SpvCapabilityComputeDerivativeGroupQuadsNV: + case spv::Capability::ComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV"; - case SpvCapabilityFragmentDensityEXT: + case spv::Capability::FragmentDensityEXT: return "FragmentDensityEXT"; - case SpvCapabilityGroupNonUniformPartitionedNV: + case spv::Capability::GroupNonUniformPartitionedNV: return "GroupNonUniformPartitionedNV"; - case SpvCapabilityShaderNonUniform: + case spv::Capability::ShaderNonUniform: return "ShaderNonUniform"; - case SpvCapabilityRuntimeDescriptorArray: + case spv::Capability::RuntimeDescriptorArray: return "RuntimeDescriptorArray"; - case SpvCapabilityInputAttachmentArrayDynamicIndexing: + case spv::Capability::InputAttachmentArrayDynamicIndexing: return "InputAttachmentArrayDynamicIndexing"; - case SpvCapabilityUniformTexelBufferArrayDynamicIndexing: + case spv::Capability::UniformTexelBufferArrayDynamicIndexing: return "UniformTexelBufferArrayDynamicIndexing"; - case SpvCapabilityStorageTexelBufferArrayDynamicIndexing: + case spv::Capability::StorageTexelBufferArrayDynamicIndexing: return "StorageTexelBufferArrayDynamicIndexing"; - case SpvCapabilityUniformBufferArrayNonUniformIndexing: + case spv::Capability::UniformBufferArrayNonUniformIndexing: return "UniformBufferArrayNonUniformIndexing"; - case SpvCapabilitySampledImageArrayNonUniformIndexing: + case spv::Capability::SampledImageArrayNonUniformIndexing: return "SampledImageArrayNonUniformIndexing"; - case SpvCapabilityStorageBufferArrayNonUniformIndexing: + case spv::Capability::StorageBufferArrayNonUniformIndexing: return "StorageBufferArrayNonUniformIndexing"; - case SpvCapabilityStorageImageArrayNonUniformIndexing: + case spv::Capability::StorageImageArrayNonUniformIndexing: return "StorageImageArrayNonUniformIndexing"; - case SpvCapabilityInputAttachmentArrayNonUniformIndexing: + case spv::Capability::InputAttachmentArrayNonUniformIndexing: return "InputAttachmentArrayNonUniformIndexing"; - case SpvCapabilityUniformTexelBufferArrayNonUniformIndexing: + case spv::Capability::UniformTexelBufferArrayNonUniformIndexing: return "UniformTexelBufferArrayNonUniformIndexing"; - case SpvCapabilityStorageTexelBufferArrayNonUniformIndexing: + case spv::Capability::StorageTexelBufferArrayNonUniformIndexing: return "StorageTexelBufferArrayNonUniformIndexing"; - case SpvCapabilityRayTracingNV: + case spv::Capability::RayTracingPositionFetchKHR: + return "RayTracingPositionFetchKHR"; + case spv::Capability::RayTracingNV: return "RayTracingNV"; - case SpvCapabilityRayTracingMotionBlurNV: + case spv::Capability::RayTracingMotionBlurNV: return "RayTracingMotionBlurNV"; - case SpvCapabilityVulkanMemoryModel: + case spv::Capability::VulkanMemoryModel: return "VulkanMemoryModel"; - case SpvCapabilityVulkanMemoryModelDeviceScope: + case spv::Capability::VulkanMemoryModelDeviceScope: return "VulkanMemoryModelDeviceScope"; - case SpvCapabilityPhysicalStorageBufferAddresses: + case spv::Capability::PhysicalStorageBufferAddresses: return "PhysicalStorageBufferAddresses"; - case SpvCapabilityComputeDerivativeGroupLinearNV: + case spv::Capability::ComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV"; - case SpvCapabilityRayTracingProvisionalKHR: + case spv::Capability::RayTracingProvisionalKHR: return "RayTracingProvisionalKHR"; - case SpvCapabilityCooperativeMatrixNV: + case spv::Capability::CooperativeMatrixNV: return "CooperativeMatrixNV"; - case SpvCapabilityFragmentShaderSampleInterlockEXT: + case spv::Capability::FragmentShaderSampleInterlockEXT: return "FragmentShaderSampleInterlockEXT"; - case SpvCapabilityFragmentShaderShadingRateInterlockEXT: + case spv::Capability::FragmentShaderShadingRateInterlockEXT: return "FragmentShaderShadingRateInterlockEXT"; - case SpvCapabilityShaderSMBuiltinsNV: + case spv::Capability::ShaderSMBuiltinsNV: return "ShaderSMBuiltinsNV"; - case SpvCapabilityFragmentShaderPixelInterlockEXT: + case spv::Capability::FragmentShaderPixelInterlockEXT: return "FragmentShaderPixelInterlockEXT"; - case SpvCapabilityDemoteToHelperInvocation: + case spv::Capability::DemoteToHelperInvocation: return "DemoteToHelperInvocation"; - case SpvCapabilityBindlessTextureNV: + case spv::Capability::RayTracingOpacityMicromapEXT: + return "RayTracingOpacityMicromapEXT"; + case spv::Capability::ShaderInvocationReorderNV: + return "ShaderInvocationReorderNV"; + case spv::Capability::BindlessTextureNV: return "BindlessTextureNV"; - case SpvCapabilitySubgroupShuffleINTEL: + case spv::Capability::RayQueryPositionFetchKHR: + return "RayQueryPositionFetchKHR"; + case spv::Capability::SubgroupShuffleINTEL: return "SubgroupShuffleINTEL"; - case SpvCapabilitySubgroupBufferBlockIOINTEL: + case spv::Capability::SubgroupBufferBlockIOINTEL: return "SubgroupBufferBlockIOINTEL"; - case SpvCapabilitySubgroupImageBlockIOINTEL: + case spv::Capability::SubgroupImageBlockIOINTEL: return "SubgroupImageBlockIOINTEL"; - case SpvCapabilitySubgroupImageMediaBlockIOINTEL: + case spv::Capability::SubgroupImageMediaBlockIOINTEL: return "SubgroupImageMediaBlockIOINTEL"; - case SpvCapabilityRoundToInfinityINTEL: + case spv::Capability::RoundToInfinityINTEL: return "RoundToInfinityINTEL"; - case SpvCapabilityFloatingPointModeINTEL: + case spv::Capability::FloatingPointModeINTEL: return "FloatingPointModeINTEL"; - case SpvCapabilityIntegerFunctions2INTEL: + case spv::Capability::IntegerFunctions2INTEL: return "IntegerFunctions2INTEL"; - case SpvCapabilityFunctionPointersINTEL: + case spv::Capability::FunctionPointersINTEL: return "FunctionPointersINTEL"; - case SpvCapabilityIndirectReferencesINTEL: + case spv::Capability::IndirectReferencesINTEL: return "IndirectReferencesINTEL"; - case SpvCapabilityAsmINTEL: + case spv::Capability::AsmINTEL: return "AsmINTEL"; - case SpvCapabilityAtomicFloat32MinMaxEXT: + case spv::Capability::AtomicFloat32MinMaxEXT: return "AtomicFloat32MinMaxEXT"; - case SpvCapabilityAtomicFloat64MinMaxEXT: + case spv::Capability::AtomicFloat64MinMaxEXT: return "AtomicFloat64MinMaxEXT"; - case SpvCapabilityAtomicFloat16MinMaxEXT: + case spv::Capability::AtomicFloat16MinMaxEXT: return "AtomicFloat16MinMaxEXT"; - case SpvCapabilityVectorComputeINTEL: + case spv::Capability::VectorComputeINTEL: return "VectorComputeINTEL"; - case SpvCapabilityVectorAnyINTEL: + case spv::Capability::VectorAnyINTEL: return "VectorAnyINTEL"; - case SpvCapabilityExpectAssumeKHR: + case spv::Capability::ExpectAssumeKHR: return "ExpectAssumeKHR"; - case SpvCapabilitySubgroupAvcMotionEstimationINTEL: + case spv::Capability::SubgroupAvcMotionEstimationINTEL: return "SubgroupAvcMotionEstimationINTEL"; - case SpvCapabilitySubgroupAvcMotionEstimationIntraINTEL: + case spv::Capability::SubgroupAvcMotionEstimationIntraINTEL: return "SubgroupAvcMotionEstimationIntraINTEL"; - case SpvCapabilitySubgroupAvcMotionEstimationChromaINTEL: + case spv::Capability::SubgroupAvcMotionEstimationChromaINTEL: return "SubgroupAvcMotionEstimationChromaINTEL"; - case SpvCapabilityVariableLengthArrayINTEL: + case spv::Capability::VariableLengthArrayINTEL: return "VariableLengthArrayINTEL"; - case SpvCapabilityFunctionFloatControlINTEL: + case spv::Capability::FunctionFloatControlINTEL: return "FunctionFloatControlINTEL"; - case SpvCapabilityFPGAMemoryAttributesINTEL: + case spv::Capability::FPGAMemoryAttributesINTEL: return "FPGAMemoryAttributesINTEL"; - case SpvCapabilityFPFastMathModeINTEL: + case spv::Capability::FPFastMathModeINTEL: return "FPFastMathModeINTEL"; - case SpvCapabilityArbitraryPrecisionIntegersINTEL: + case spv::Capability::ArbitraryPrecisionIntegersINTEL: return "ArbitraryPrecisionIntegersINTEL"; - case SpvCapabilityArbitraryPrecisionFloatingPointINTEL: + case spv::Capability::ArbitraryPrecisionFloatingPointINTEL: return "ArbitraryPrecisionFloatingPointINTEL"; - case SpvCapabilityUnstructuredLoopControlsINTEL: + case spv::Capability::UnstructuredLoopControlsINTEL: return "UnstructuredLoopControlsINTEL"; - case SpvCapabilityFPGALoopControlsINTEL: + case spv::Capability::FPGALoopControlsINTEL: return "FPGALoopControlsINTEL"; - case SpvCapabilityKernelAttributesINTEL: + case spv::Capability::KernelAttributesINTEL: return "KernelAttributesINTEL"; - case SpvCapabilityFPGAKernelAttributesINTEL: + case spv::Capability::FPGAKernelAttributesINTEL: return "FPGAKernelAttributesINTEL"; - case SpvCapabilityFPGAMemoryAccessesINTEL: + case spv::Capability::FPGAMemoryAccessesINTEL: return "FPGAMemoryAccessesINTEL"; - case SpvCapabilityFPGAClusterAttributesINTEL: + case spv::Capability::FPGAClusterAttributesINTEL: return "FPGAClusterAttributesINTEL"; - case SpvCapabilityLoopFuseINTEL: + case spv::Capability::LoopFuseINTEL: return "LoopFuseINTEL"; - case SpvCapabilityMemoryAccessAliasingINTEL: + case spv::Capability::FPGADSPControlINTEL: + return "FPGADSPControlINTEL"; + case spv::Capability::MemoryAccessAliasingINTEL: return "MemoryAccessAliasingINTEL"; - case SpvCapabilityFPGABufferLocationINTEL: + case spv::Capability::FPGAInvocationPipeliningAttributesINTEL: + return "FPGAInvocationPipeliningAttributesINTEL"; + case spv::Capability::FPGABufferLocationINTEL: return "FPGABufferLocationINTEL"; - case SpvCapabilityArbitraryPrecisionFixedPointINTEL: + case spv::Capability::ArbitraryPrecisionFixedPointINTEL: return "ArbitraryPrecisionFixedPointINTEL"; - case SpvCapabilityUSMStorageClassesINTEL: + case spv::Capability::USMStorageClassesINTEL: return "USMStorageClassesINTEL"; - case SpvCapabilityIOPipesINTEL: + case spv::Capability::RuntimeAlignedAttributeINTEL: + return "RuntimeAlignedAttributeINTEL"; + case spv::Capability::IOPipesINTEL: return "IOPipesINTEL"; - case SpvCapabilityBlockingPipesINTEL: + case spv::Capability::BlockingPipesINTEL: return "BlockingPipesINTEL"; - case SpvCapabilityFPGARegINTEL: + case spv::Capability::FPGARegINTEL: return "FPGARegINTEL"; - case SpvCapabilityDotProductInputAll: + case spv::Capability::DotProductInputAll: return "DotProductInputAll"; - case SpvCapabilityDotProductInput4x8Bit: + case spv::Capability::DotProductInput4x8Bit: return "DotProductInput4x8Bit"; - case SpvCapabilityDotProductInput4x8BitPacked: + case spv::Capability::DotProductInput4x8BitPacked: return "DotProductInput4x8BitPacked"; - case SpvCapabilityDotProduct: + case spv::Capability::DotProduct: return "DotProduct"; - case SpvCapabilityRayCullMaskKHR: + case spv::Capability::RayCullMaskKHR: return "RayCullMaskKHR"; - case SpvCapabilityBitInstructions: + case spv::Capability::CooperativeMatrixKHR: + return "CooperativeMatrixKHR"; + case spv::Capability::BitInstructions: return "BitInstructions"; - case SpvCapabilityGroupNonUniformRotateKHR: + case spv::Capability::GroupNonUniformRotateKHR: return "GroupNonUniformRotateKHR"; - case SpvCapabilityAtomicFloat32AddEXT: + case spv::Capability::AtomicFloat32AddEXT: return "AtomicFloat32AddEXT"; - case SpvCapabilityAtomicFloat64AddEXT: + case spv::Capability::AtomicFloat64AddEXT: return "AtomicFloat64AddEXT"; - case SpvCapabilityLongConstantCompositeINTEL: + case spv::Capability::LongConstantCompositeINTEL: return "LongConstantCompositeINTEL"; - case SpvCapabilityOptNoneINTEL: + case spv::Capability::OptNoneINTEL: return "OptNoneINTEL"; - case SpvCapabilityAtomicFloat16AddEXT: + case spv::Capability::AtomicFloat16AddEXT: return "AtomicFloat16AddEXT"; - case SpvCapabilityDebugInfoModuleINTEL: + case spv::Capability::DebugInfoModuleINTEL: return "DebugInfoModuleINTEL"; - case SpvCapabilitySplitBarrierINTEL: + case spv::Capability::BFloat16ConversionINTEL: + return "BFloat16ConversionINTEL"; + case spv::Capability::SplitBarrierINTEL: return "SplitBarrierINTEL"; - case SpvCapabilityGroupUniformArithmeticKHR: + case spv::Capability::GlobalVariableFPGADecorationsINTEL: + return "GlobalVariableFPGADecorationsINTEL"; + case spv::Capability::FPGAKernelAttributesv2INTEL: + return "FPGAKernelAttributesv2INTEL"; + case spv::Capability::GlobalVariableHostAccessINTEL: + return "GlobalVariableHostAccessINTEL"; + case spv::Capability::FPMaxErrorINTEL: + return "FPMaxErrorINTEL"; + case spv::Capability::FPGALatencyControlINTEL: + return "FPGALatencyControlINTEL"; + case spv::Capability::FPGAArgumentInterfacesINTEL: + return "FPGAArgumentInterfacesINTEL"; + case spv::Capability::GroupUniformArithmeticKHR: return "GroupUniformArithmeticKHR"; - case SpvCapabilityMax: - assert(0 && "Attempting to convert SpvCapabilityMax to string"); + case spv::Capability::Max: + assert(0 && "Attempting to convert spv::Capability::Max to string"); return ""; } diff --git a/bgfx/3rdparty/spirv-tools/include/generated/extension_enum.inc b/bgfx/3rdparty/spirv-tools/include/generated/extension_enum.inc index ed70cefc..d9a83e13 100644 --- a/bgfx/3rdparty/spirv-tools/include/generated/extension_enum.inc +++ b/bgfx/3rdparty/spirv-tools/include/generated/extension_enum.inc @@ -1,3 +1,4 @@ +kSPV_AMDX_shader_enqueue, kSPV_AMD_gcn_shader, kSPV_AMD_gpu_shader_half_float, kSPV_AMD_gpu_shader_half_float_fetch, @@ -16,12 +17,14 @@ kSPV_EXT_fragment_fully_covered, kSPV_EXT_fragment_invocation_density, kSPV_EXT_fragment_shader_interlock, kSPV_EXT_mesh_shader, +kSPV_EXT_opacity_micromap, kSPV_EXT_physical_storage_buffer, kSPV_EXT_shader_atomic_float16_add, kSPV_EXT_shader_atomic_float_add, kSPV_EXT_shader_atomic_float_min_max, kSPV_EXT_shader_image_int64, kSPV_EXT_shader_stencil_export, +kSPV_EXT_shader_tile_image, kSPV_EXT_shader_viewport_index_layer, kSPV_GOOGLE_decorate_string, kSPV_GOOGLE_hlsl_functionality1, @@ -29,18 +32,26 @@ kSPV_GOOGLE_user_type, kSPV_INTEL_arbitrary_precision_fixed_point, kSPV_INTEL_arbitrary_precision_floating_point, kSPV_INTEL_arbitrary_precision_integers, +kSPV_INTEL_bfloat16_conversion, kSPV_INTEL_blocking_pipes, kSPV_INTEL_debug_module, kSPV_INTEL_device_side_avc_motion_estimation, kSPV_INTEL_float_controls2, kSPV_INTEL_fp_fast_math_mode, +kSPV_INTEL_fp_max_error, +kSPV_INTEL_fpga_argument_interfaces, kSPV_INTEL_fpga_buffer_location, kSPV_INTEL_fpga_cluster_attributes, +kSPV_INTEL_fpga_dsp_control, +kSPV_INTEL_fpga_invocation_pipelining_attributes, +kSPV_INTEL_fpga_latency_control, kSPV_INTEL_fpga_loop_controls, kSPV_INTEL_fpga_memory_accesses, kSPV_INTEL_fpga_memory_attributes, kSPV_INTEL_fpga_reg, kSPV_INTEL_function_pointers, +kSPV_INTEL_global_variable_fpga_decorations, +kSPV_INTEL_global_variable_host_access, kSPV_INTEL_inline_assembly, kSPV_INTEL_io_pipes, kSPV_INTEL_kernel_attributes, @@ -49,6 +60,7 @@ kSPV_INTEL_loop_fuse, kSPV_INTEL_media_block_io, kSPV_INTEL_memory_access_aliasing, kSPV_INTEL_optnone, +kSPV_INTEL_runtime_aligned, kSPV_INTEL_shader_integer_functions2, kSPV_INTEL_split_barrier, kSPV_INTEL_subgroups, @@ -59,6 +71,7 @@ kSPV_INTEL_vector_compute, kSPV_KHR_16bit_storage, kSPV_KHR_8bit_storage, kSPV_KHR_bit_instructions, +kSPV_KHR_cooperative_matrix, kSPV_KHR_device_group, kSPV_KHR_expect_assume, kSPV_KHR_float_controls, @@ -74,6 +87,7 @@ kSPV_KHR_post_depth_coverage, kSPV_KHR_ray_cull_mask, kSPV_KHR_ray_query, kSPV_KHR_ray_tracing, +kSPV_KHR_ray_tracing_position_fetch, kSPV_KHR_shader_atomic_counter_ops, kSPV_KHR_shader_ballot, kSPV_KHR_shader_clock, @@ -98,9 +112,11 @@ kSPV_NV_ray_tracing, kSPV_NV_ray_tracing_motion_blur, kSPV_NV_sample_mask_override_coverage, kSPV_NV_shader_image_footprint, +kSPV_NV_shader_invocation_reorder, kSPV_NV_shader_sm_builtins, kSPV_NV_shader_subgroup_partitioned, kSPV_NV_shading_rate, kSPV_NV_stereo_view_rendering, kSPV_NV_viewport_array2, +kSPV_QCOM_image_processing, kSPV_VALIDATOR_ignore_type_decl_unique \ No newline at end of file diff --git a/bgfx/3rdparty/spirv-tools/include/generated/generators.inc b/bgfx/3rdparty/spirv-tools/include/generated/generators.inc index 35d190df..f917145b 100644 --- a/bgfx/3rdparty/spirv-tools/include/generated/generators.inc +++ b/bgfx/3rdparty/spirv-tools/include/generated/generators.inc @@ -30,6 +30,11 @@ {29, "Mikkosoft Productions", "MSP Shader Compiler", "Mikkosoft Productions MSP Shader Compiler"}, {30, "SpvGenTwo community", "SpvGenTwo SPIR-V IR Tools", "SpvGenTwo community SpvGenTwo SPIR-V IR Tools"}, {31, "Google", "Skia SkSL", "Google Skia SkSL"}, -{32, "TornadoVM", "SPIRV Beehive Toolkit", "TornadoVM SPIRV Beehive Toolkit"}, +{32, "TornadoVM", "Beehive SPIRV Toolkit", "TornadoVM Beehive SPIRV Toolkit"}, {33, "DragonJoker", "ShaderWriter", "DragonJoker ShaderWriter"}, -{34, "Rayan Hatout", "SPIRVSmith", "Rayan Hatout SPIRVSmith"}, \ No newline at end of file +{34, "Rayan Hatout", "SPIRVSmith", "Rayan Hatout SPIRVSmith"}, +{35, "Saarland University", "Shady", "Saarland University Shady"}, +{36, "Taichi Graphics", "Taichi", "Taichi Graphics Taichi"}, +{37, "heroseh", "Hero C Compiler", "heroseh Hero C Compiler"}, +{38, "Meta", "SparkSL", "Meta SparkSL"}, +{39, "SirLynix", "Nazara ShaderLang Compiler", "SirLynix Nazara ShaderLang Compiler"}, \ No newline at end of file diff --git a/bgfx/3rdparty/spirv-tools/include/generated/glsl.std.450.insts.inc b/bgfx/3rdparty/spirv-tools/include/generated/glsl.std.450.insts.inc index 7d3866d8..89fe9480 100644 --- a/bgfx/3rdparty/spirv-tools/include/generated/glsl.std.450.insts.inc +++ b/bgfx/3rdparty/spirv-tools/include/generated/glsl.std.450.insts.inc @@ -1,5 +1,5 @@ -static const SpvCapability pygen_variable_caps_Float64[] = {SpvCapabilityFloat64}; -static const SpvCapability pygen_variable_caps_InterpolationFunction[] = {SpvCapabilityInterpolationFunction}; +static const spv::Capability pygen_variable_caps_Float64[] = {spv::Capability::Float64}; +static const spv::Capability pygen_variable_caps_InterpolationFunction[] = {spv::Capability::InterpolationFunction}; static const spv_ext_inst_desc_t glsl_entries[] = { {"Round", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, diff --git a/bgfx/3rdparty/spirv-tools/include/generated/nonsemantic.clspvreflection.insts.inc b/bgfx/3rdparty/spirv-tools/include/generated/nonsemantic.clspvreflection.insts.inc index 01cbf254..f774297d 100644 --- a/bgfx/3rdparty/spirv-tools/include/generated/nonsemantic.clspvreflection.insts.inc +++ b/bgfx/3rdparty/spirv-tools/include/generated/nonsemantic.clspvreflection.insts.inc @@ -1,7 +1,7 @@ static const spv_ext_inst_desc_t nonsemantic_clspvreflection_entries[] = { - {"Kernel", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Kernel", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, {"ArgumentInfo", 2, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, {"ArgumentStorageBuffer", 3, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, {"ArgumentUniform", 4, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, @@ -33,5 +33,12 @@ static const spv_ext_inst_desc_t nonsemantic_clspvreflection_entries[] = { {"ImageArgumentInfoChannelOrderPushConstant", 30, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, {"ImageArgumentInfoChannelDataTypePushConstant", 31, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, {"ImageArgumentInfoChannelOrderUniform", 32, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, - {"ImageArgumentInfoChannelDataTypeUniform", 33, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}} + {"ImageArgumentInfoChannelDataTypeUniform", 33, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"ArgumentStorageTexelBuffer", 34, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, + {"ArgumentUniformTexelBuffer", 35, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, + {"ConstantDataPointerPushConstant", 36, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"ProgramScopeVariablePointerPushConstant", 37, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"PrintfInfo", 38, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_NONE}}, + {"PrintfBufferStorageBuffer", 39, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"PrintfBufferPointerPushConstant", 40, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}} }; \ No newline at end of file diff --git a/bgfx/3rdparty/spirv-tools/include/generated/operand.kinds-unified1.inc b/bgfx/3rdparty/spirv-tools/include/generated/operand.kinds-unified1.inc index 397f5c39..159fc32c 100644 --- a/bgfx/3rdparty/spirv-tools/include/generated/operand.kinds-unified1.inc +++ b/bgfx/3rdparty/spirv-tools/include/generated/operand.kinds-unified1.inc @@ -1,129 +1,141 @@ -static const SpvCapability pygen_variable_caps_Addresses[] = {SpvCapabilityAddresses}; -static const SpvCapability pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL[] = {SpvCapabilityArbitraryPrecisionFixedPointINTEL}; -static const SpvCapability pygen_variable_caps_AsmINTEL[] = {SpvCapabilityAsmINTEL}; -static const SpvCapability pygen_variable_caps_AtomicStorage[] = {SpvCapabilityAtomicStorage}; -static const SpvCapability pygen_variable_caps_BindlessTextureNV[] = {SpvCapabilityBindlessTextureNV}; -static const SpvCapability pygen_variable_caps_ClipDistance[] = {SpvCapabilityClipDistance}; -static const SpvCapability pygen_variable_caps_ComputeDerivativeGroupLinearNV[] = {SpvCapabilityComputeDerivativeGroupLinearNV}; -static const SpvCapability pygen_variable_caps_ComputeDerivativeGroupQuadsNV[] = {SpvCapabilityComputeDerivativeGroupQuadsNV}; -static const SpvCapability pygen_variable_caps_CoreBuiltinsARM[] = {SpvCapabilityCoreBuiltinsARM}; -static const SpvCapability pygen_variable_caps_CullDistance[] = {SpvCapabilityCullDistance}; -static const SpvCapability pygen_variable_caps_DenormFlushToZero[] = {SpvCapabilityDenormFlushToZero}; -static const SpvCapability pygen_variable_caps_DenormPreserve[] = {SpvCapabilityDenormPreserve}; -static const SpvCapability pygen_variable_caps_DeviceEnqueue[] = {SpvCapabilityDeviceEnqueue}; -static const SpvCapability pygen_variable_caps_DeviceGroup[] = {SpvCapabilityDeviceGroup}; -static const SpvCapability pygen_variable_caps_DrawParameters[] = {SpvCapabilityDrawParameters}; -static const SpvCapability pygen_variable_caps_DrawParametersMeshShadingNVMeshShadingEXT[] = {SpvCapabilityDrawParameters, SpvCapabilityMeshShadingNV, SpvCapabilityMeshShadingEXT}; -static const SpvCapability pygen_variable_caps_FPFastMathModeINTEL[] = {SpvCapabilityFPFastMathModeINTEL}; -static const SpvCapability pygen_variable_caps_FPGABufferLocationINTEL[] = {SpvCapabilityFPGABufferLocationINTEL}; -static const SpvCapability pygen_variable_caps_FPGAClusterAttributesINTEL[] = {SpvCapabilityFPGAClusterAttributesINTEL}; -static const SpvCapability pygen_variable_caps_FPGAKernelAttributesINTEL[] = {SpvCapabilityFPGAKernelAttributesINTEL}; -static const SpvCapability pygen_variable_caps_FPGALoopControlsINTEL[] = {SpvCapabilityFPGALoopControlsINTEL}; -static const SpvCapability pygen_variable_caps_FPGAMemoryAccessesINTEL[] = {SpvCapabilityFPGAMemoryAccessesINTEL}; -static const SpvCapability pygen_variable_caps_FPGAMemoryAttributesINTEL[] = {SpvCapabilityFPGAMemoryAttributesINTEL}; -static const SpvCapability pygen_variable_caps_FragmentBarycentricNVFragmentBarycentricKHR[] = {SpvCapabilityFragmentBarycentricNV, SpvCapabilityFragmentBarycentricKHR}; -static const SpvCapability pygen_variable_caps_FragmentDensityEXTShadingRateNV[] = {SpvCapabilityFragmentDensityEXT, SpvCapabilityShadingRateNV}; -static const SpvCapability pygen_variable_caps_FragmentFullyCoveredEXT[] = {SpvCapabilityFragmentFullyCoveredEXT}; -static const SpvCapability pygen_variable_caps_FragmentShaderPixelInterlockEXT[] = {SpvCapabilityFragmentShaderPixelInterlockEXT}; -static const SpvCapability pygen_variable_caps_FragmentShaderSampleInterlockEXT[] = {SpvCapabilityFragmentShaderSampleInterlockEXT}; -static const SpvCapability pygen_variable_caps_FragmentShaderShadingRateInterlockEXT[] = {SpvCapabilityFragmentShaderShadingRateInterlockEXT}; -static const SpvCapability pygen_variable_caps_FragmentShadingRateKHR[] = {SpvCapabilityFragmentShadingRateKHR}; -static const SpvCapability pygen_variable_caps_FunctionFloatControlINTEL[] = {SpvCapabilityFunctionFloatControlINTEL}; -static const SpvCapability pygen_variable_caps_FunctionPointersINTEL[] = {SpvCapabilityFunctionPointersINTEL}; -static const SpvCapability pygen_variable_caps_GenericPointer[] = {SpvCapabilityGenericPointer}; -static const SpvCapability pygen_variable_caps_Geometry[] = {SpvCapabilityGeometry}; -static const SpvCapability pygen_variable_caps_GeometryMeshShadingNVMeshShadingEXT[] = {SpvCapabilityGeometry, SpvCapabilityMeshShadingNV, SpvCapabilityMeshShadingEXT}; -static const SpvCapability pygen_variable_caps_GeometryShaderLayerShaderViewportIndexLayerEXTMeshShadingNVMeshShadingEXT[] = {SpvCapabilityGeometry, SpvCapabilityShaderLayer, SpvCapabilityShaderViewportIndexLayerEXT, SpvCapabilityMeshShadingNV, SpvCapabilityMeshShadingEXT}; -static const SpvCapability pygen_variable_caps_GeometryTessellation[] = {SpvCapabilityGeometry, SpvCapabilityTessellation}; -static const SpvCapability pygen_variable_caps_GeometryTessellationMeshShadingNVMeshShadingEXT[] = {SpvCapabilityGeometry, SpvCapabilityTessellation, SpvCapabilityMeshShadingNV, SpvCapabilityMeshShadingEXT}; -static const SpvCapability pygen_variable_caps_GeometryTessellationRayTracingNVRayTracingKHRMeshShadingNVMeshShadingEXT[] = {SpvCapabilityGeometry, SpvCapabilityTessellation, SpvCapabilityRayTracingNV, SpvCapabilityRayTracingKHR, SpvCapabilityMeshShadingNV, SpvCapabilityMeshShadingEXT}; -static const SpvCapability pygen_variable_caps_GeometryShaderPassthroughNV[] = {SpvCapabilityGeometryShaderPassthroughNV}; -static const SpvCapability pygen_variable_caps_GeometryStreams[] = {SpvCapabilityGeometryStreams}; -static const SpvCapability pygen_variable_caps_GroupNonUniform[] = {SpvCapabilityGroupNonUniform}; -static const SpvCapability pygen_variable_caps_GroupNonUniformClustered[] = {SpvCapabilityGroupNonUniformClustered}; -static const SpvCapability pygen_variable_caps_GroupNonUniformPartitionedNV[] = {SpvCapabilityGroupNonUniformPartitionedNV}; -static const SpvCapability pygen_variable_caps_IOPipesINTEL[] = {SpvCapabilityIOPipesINTEL}; -static const SpvCapability pygen_variable_caps_ImageBasic[] = {SpvCapabilityImageBasic}; -static const SpvCapability pygen_variable_caps_ImageBuffer[] = {SpvCapabilityImageBuffer}; -static const SpvCapability pygen_variable_caps_ImageBufferShaderNonUniform[] = {SpvCapabilityImageBuffer, SpvCapabilityShaderNonUniform}; -static const SpvCapability pygen_variable_caps_ImageGatherExtended[] = {SpvCapabilityImageGatherExtended}; -static const SpvCapability pygen_variable_caps_IndirectReferencesINTEL[] = {SpvCapabilityIndirectReferencesINTEL}; -static const SpvCapability pygen_variable_caps_InputAttachment[] = {SpvCapabilityInputAttachment}; -static const SpvCapability pygen_variable_caps_InputAttachmentShaderNonUniform[] = {SpvCapabilityInputAttachment, SpvCapabilityShaderNonUniform}; -static const SpvCapability pygen_variable_caps_Int64[] = {SpvCapabilityInt64}; -static const SpvCapability pygen_variable_caps_Int64ImageEXT[] = {SpvCapabilityInt64ImageEXT}; -static const SpvCapability pygen_variable_caps_Int8[] = {SpvCapabilityInt8}; -static const SpvCapability pygen_variable_caps_Kernel[] = {SpvCapabilityKernel}; -static const SpvCapability pygen_variable_caps_KernelGroupNonUniform[] = {SpvCapabilityKernel, SpvCapabilityGroupNonUniform}; -static const SpvCapability pygen_variable_caps_KernelGroupNonUniformSubgroupBallotKHR[] = {SpvCapabilityKernel, SpvCapabilityGroupNonUniform, SpvCapabilitySubgroupBallotKHR}; -static const SpvCapability pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot[] = {SpvCapabilityKernel, SpvCapabilityGroupNonUniformArithmetic, SpvCapabilityGroupNonUniformBallot}; -static const SpvCapability pygen_variable_caps_KernelAttributesINTEL[] = {SpvCapabilityKernelAttributesINTEL}; -static const SpvCapability pygen_variable_caps_Linkage[] = {SpvCapabilityLinkage}; -static const SpvCapability pygen_variable_caps_LoopFuseINTEL[] = {SpvCapabilityLoopFuseINTEL}; -static const SpvCapability pygen_variable_caps_Matrix[] = {SpvCapabilityMatrix}; -static const SpvCapability pygen_variable_caps_MemoryAccessAliasingINTEL[] = {SpvCapabilityMemoryAccessAliasingINTEL}; -static const SpvCapability pygen_variable_caps_MeshShadingEXT[] = {SpvCapabilityMeshShadingEXT}; -static const SpvCapability pygen_variable_caps_MeshShadingNV[] = {SpvCapabilityMeshShadingNV}; -static const SpvCapability pygen_variable_caps_MeshShadingNVMeshShadingEXT[] = {SpvCapabilityMeshShadingNV, SpvCapabilityMeshShadingEXT}; -static const SpvCapability pygen_variable_caps_MinLod[] = {SpvCapabilityMinLod}; -static const SpvCapability pygen_variable_caps_MultiView[] = {SpvCapabilityMultiView}; -static const SpvCapability pygen_variable_caps_MultiViewport[] = {SpvCapabilityMultiViewport}; -static const SpvCapability pygen_variable_caps_MultiViewportShaderViewportIndexShaderViewportIndexLayerEXTMeshShadingNVMeshShadingEXT[] = {SpvCapabilityMultiViewport, SpvCapabilityShaderViewportIndex, SpvCapabilityShaderViewportIndexLayerEXT, SpvCapabilityMeshShadingNV, SpvCapabilityMeshShadingEXT}; -static const SpvCapability pygen_variable_caps_OptNoneINTEL[] = {SpvCapabilityOptNoneINTEL}; -static const SpvCapability pygen_variable_caps_PerViewAttributesNVMeshShadingNV[] = {SpvCapabilityPerViewAttributesNV, SpvCapabilityMeshShadingNV}; -static const SpvCapability pygen_variable_caps_PhysicalStorageBufferAddresses[] = {SpvCapabilityPhysicalStorageBufferAddresses}; -static const SpvCapability pygen_variable_caps_Pipes[] = {SpvCapabilityPipes}; -static const SpvCapability pygen_variable_caps_RayCullMaskKHR[] = {SpvCapabilityRayCullMaskKHR}; -static const SpvCapability pygen_variable_caps_RayQueryKHR[] = {SpvCapabilityRayQueryKHR}; -static const SpvCapability pygen_variable_caps_RayQueryKHRRayTracingKHR[] = {SpvCapabilityRayQueryKHR, SpvCapabilityRayTracingKHR}; -static const SpvCapability pygen_variable_caps_RayTracingKHR[] = {SpvCapabilityRayTracingKHR}; -static const SpvCapability pygen_variable_caps_RayTracingMotionBlurNV[] = {SpvCapabilityRayTracingMotionBlurNV}; -static const SpvCapability pygen_variable_caps_RayTracingNV[] = {SpvCapabilityRayTracingNV}; -static const SpvCapability pygen_variable_caps_RayTracingNVRayTracingKHR[] = {SpvCapabilityRayTracingNV, SpvCapabilityRayTracingKHR}; -static const SpvCapability pygen_variable_caps_RayTraversalPrimitiveCullingKHR[] = {SpvCapabilityRayTraversalPrimitiveCullingKHR}; -static const SpvCapability pygen_variable_caps_RoundToInfinityINTEL[] = {SpvCapabilityRoundToInfinityINTEL}; -static const SpvCapability pygen_variable_caps_RoundingModeRTE[] = {SpvCapabilityRoundingModeRTE}; -static const SpvCapability pygen_variable_caps_RoundingModeRTZ[] = {SpvCapabilityRoundingModeRTZ}; -static const SpvCapability pygen_variable_caps_SampleMaskOverrideCoverageNV[] = {SpvCapabilitySampleMaskOverrideCoverageNV}; -static const SpvCapability pygen_variable_caps_SampleMaskPostDepthCoverage[] = {SpvCapabilitySampleMaskPostDepthCoverage}; -static const SpvCapability pygen_variable_caps_SampleRateShading[] = {SpvCapabilitySampleRateShading}; -static const SpvCapability pygen_variable_caps_Sampled1D[] = {SpvCapabilitySampled1D}; -static const SpvCapability pygen_variable_caps_Sampled1DImage1D[] = {SpvCapabilitySampled1D, SpvCapabilityImage1D}; -static const SpvCapability pygen_variable_caps_SampledBuffer[] = {SpvCapabilitySampledBuffer}; -static const SpvCapability pygen_variable_caps_SampledBufferImageBuffer[] = {SpvCapabilitySampledBuffer, SpvCapabilityImageBuffer}; -static const SpvCapability pygen_variable_caps_SampledBufferShaderNonUniform[] = {SpvCapabilitySampledBuffer, SpvCapabilityShaderNonUniform}; -static const SpvCapability pygen_variable_caps_SampledCubeArray[] = {SpvCapabilitySampledCubeArray}; -static const SpvCapability pygen_variable_caps_SampledRect[] = {SpvCapabilitySampledRect}; -static const SpvCapability pygen_variable_caps_SampledRectImageRect[] = {SpvCapabilitySampledRect, SpvCapabilityImageRect}; -static const SpvCapability pygen_variable_caps_Shader[] = {SpvCapabilityShader}; -static const SpvCapability pygen_variable_caps_ShaderImageCubeArray[] = {SpvCapabilityShader, SpvCapabilityImageCubeArray}; -static const SpvCapability pygen_variable_caps_ShaderKernel[] = {SpvCapabilityShader, SpvCapabilityKernel}; -static const SpvCapability pygen_variable_caps_ShaderKernelImageMSArray[] = {SpvCapabilityShader, SpvCapabilityKernel, SpvCapabilityImageMSArray}; -static const SpvCapability pygen_variable_caps_ShaderUniformDecoration[] = {SpvCapabilityShader, SpvCapabilityUniformDecoration}; -static const SpvCapability pygen_variable_caps_ShaderVectorComputeINTEL[] = {SpvCapabilityShader, SpvCapabilityVectorComputeINTEL}; -static const SpvCapability pygen_variable_caps_ShaderNonUniform[] = {SpvCapabilityShaderNonUniform}; -static const SpvCapability pygen_variable_caps_ShaderSMBuiltinsNV[] = {SpvCapabilityShaderSMBuiltinsNV}; -static const SpvCapability pygen_variable_caps_ShaderStereoViewNV[] = {SpvCapabilityShaderStereoViewNV}; -static const SpvCapability pygen_variable_caps_ShaderViewportIndexLayerNV[] = {SpvCapabilityShaderViewportIndexLayerNV}; -static const SpvCapability pygen_variable_caps_ShaderViewportMaskNV[] = {SpvCapabilityShaderViewportMaskNV}; -static const SpvCapability pygen_variable_caps_ShaderViewportMaskNVMeshShadingNV[] = {SpvCapabilityShaderViewportMaskNV, SpvCapabilityMeshShadingNV}; -static const SpvCapability pygen_variable_caps_ShadingRateNVFragmentDensityEXT[] = {SpvCapabilityShadingRateNV, SpvCapabilityFragmentDensityEXT}; -static const SpvCapability pygen_variable_caps_SignedZeroInfNanPreserve[] = {SpvCapabilitySignedZeroInfNanPreserve}; -static const SpvCapability pygen_variable_caps_StencilExportEXT[] = {SpvCapabilityStencilExportEXT}; -static const SpvCapability pygen_variable_caps_StorageBuffer16BitAccessStorageUniformBufferBlock16[] = {SpvCapabilityStorageBuffer16BitAccess, SpvCapabilityStorageUniformBufferBlock16}; -static const SpvCapability pygen_variable_caps_StorageBuffer8BitAccess[] = {SpvCapabilityStorageBuffer8BitAccess}; -static const SpvCapability pygen_variable_caps_StorageImageExtendedFormats[] = {SpvCapabilityStorageImageExtendedFormats}; -static const SpvCapability pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot[] = {SpvCapabilitySubgroupBallotKHR, SpvCapabilityGroupNonUniformBallot}; -static const SpvCapability pygen_variable_caps_SubgroupDispatch[] = {SpvCapabilitySubgroupDispatch}; -static const SpvCapability pygen_variable_caps_Tessellation[] = {SpvCapabilityTessellation}; -static const SpvCapability pygen_variable_caps_TransformFeedback[] = {SpvCapabilityTransformFeedback}; -static const SpvCapability pygen_variable_caps_USMStorageClassesINTEL[] = {SpvCapabilityUSMStorageClassesINTEL}; -static const SpvCapability pygen_variable_caps_VariablePointersStorageBuffer[] = {SpvCapabilityVariablePointersStorageBuffer}; -static const SpvCapability pygen_variable_caps_VectorAnyINTEL[] = {SpvCapabilityVectorAnyINTEL}; -static const SpvCapability pygen_variable_caps_VectorComputeINTEL[] = {SpvCapabilityVectorComputeINTEL}; -static const SpvCapability pygen_variable_caps_VulkanMemoryModel[] = {SpvCapabilityVulkanMemoryModel}; -static const SpvCapability pygen_variable_caps_WorkgroupMemoryExplicitLayoutKHR[] = {SpvCapabilityWorkgroupMemoryExplicitLayoutKHR}; +static const spv::Capability pygen_variable_caps_Addresses[] = {spv::Capability::Addresses}; +static const spv::Capability pygen_variable_caps_ArbitraryPrecisionFixedPointINTEL[] = {spv::Capability::ArbitraryPrecisionFixedPointINTEL}; +static const spv::Capability pygen_variable_caps_AsmINTEL[] = {spv::Capability::AsmINTEL}; +static const spv::Capability pygen_variable_caps_AtomicStorage[] = {spv::Capability::AtomicStorage}; +static const spv::Capability pygen_variable_caps_BindlessTextureNV[] = {spv::Capability::BindlessTextureNV}; +static const spv::Capability pygen_variable_caps_ClipDistance[] = {spv::Capability::ClipDistance}; +static const spv::Capability pygen_variable_caps_ComputeDerivativeGroupLinearNV[] = {spv::Capability::ComputeDerivativeGroupLinearNV}; +static const spv::Capability pygen_variable_caps_ComputeDerivativeGroupQuadsNV[] = {spv::Capability::ComputeDerivativeGroupQuadsNV}; +static const spv::Capability pygen_variable_caps_CoreBuiltinsARM[] = {spv::Capability::CoreBuiltinsARM}; +static const spv::Capability pygen_variable_caps_CullDistance[] = {spv::Capability::CullDistance}; +static const spv::Capability pygen_variable_caps_DenormFlushToZero[] = {spv::Capability::DenormFlushToZero}; +static const spv::Capability pygen_variable_caps_DenormPreserve[] = {spv::Capability::DenormPreserve}; +static const spv::Capability pygen_variable_caps_DeviceEnqueue[] = {spv::Capability::DeviceEnqueue}; +static const spv::Capability pygen_variable_caps_DeviceGroup[] = {spv::Capability::DeviceGroup}; +static const spv::Capability pygen_variable_caps_DrawParameters[] = {spv::Capability::DrawParameters}; +static const spv::Capability pygen_variable_caps_DrawParametersMeshShadingNVMeshShadingEXT[] = {spv::Capability::DrawParameters, spv::Capability::MeshShadingNV, spv::Capability::MeshShadingEXT}; +static const spv::Capability pygen_variable_caps_FPFastMathModeINTEL[] = {spv::Capability::FPFastMathModeINTEL}; +static const spv::Capability pygen_variable_caps_FPGAArgumentInterfacesINTEL[] = {spv::Capability::FPGAArgumentInterfacesINTEL}; +static const spv::Capability pygen_variable_caps_FPGABufferLocationINTEL[] = {spv::Capability::FPGABufferLocationINTEL}; +static const spv::Capability pygen_variable_caps_FPGAClusterAttributesINTEL[] = {spv::Capability::FPGAClusterAttributesINTEL}; +static const spv::Capability pygen_variable_caps_FPGADSPControlINTEL[] = {spv::Capability::FPGADSPControlINTEL}; +static const spv::Capability pygen_variable_caps_FPGAInvocationPipeliningAttributesINTEL[] = {spv::Capability::FPGAInvocationPipeliningAttributesINTEL}; +static const spv::Capability pygen_variable_caps_FPGAKernelAttributesINTEL[] = {spv::Capability::FPGAKernelAttributesINTEL}; +static const spv::Capability pygen_variable_caps_FPGAKernelAttributesv2INTEL[] = {spv::Capability::FPGAKernelAttributesv2INTEL}; +static const spv::Capability pygen_variable_caps_FPGALatencyControlINTEL[] = {spv::Capability::FPGALatencyControlINTEL}; +static const spv::Capability pygen_variable_caps_FPGALoopControlsINTEL[] = {spv::Capability::FPGALoopControlsINTEL}; +static const spv::Capability pygen_variable_caps_FPGAMemoryAccessesINTEL[] = {spv::Capability::FPGAMemoryAccessesINTEL}; +static const spv::Capability pygen_variable_caps_FPGAMemoryAttributesINTEL[] = {spv::Capability::FPGAMemoryAttributesINTEL}; +static const spv::Capability pygen_variable_caps_FPMaxErrorINTEL[] = {spv::Capability::FPMaxErrorINTEL}; +static const spv::Capability pygen_variable_caps_FragmentBarycentricNVFragmentBarycentricKHR[] = {spv::Capability::FragmentBarycentricNV, spv::Capability::FragmentBarycentricKHR}; +static const spv::Capability pygen_variable_caps_FragmentDensityEXTShadingRateNV[] = {spv::Capability::FragmentDensityEXT, spv::Capability::ShadingRateNV}; +static const spv::Capability pygen_variable_caps_FragmentFullyCoveredEXT[] = {spv::Capability::FragmentFullyCoveredEXT}; +static const spv::Capability pygen_variable_caps_FragmentShaderPixelInterlockEXT[] = {spv::Capability::FragmentShaderPixelInterlockEXT}; +static const spv::Capability pygen_variable_caps_FragmentShaderSampleInterlockEXT[] = {spv::Capability::FragmentShaderSampleInterlockEXT}; +static const spv::Capability pygen_variable_caps_FragmentShaderShadingRateInterlockEXT[] = {spv::Capability::FragmentShaderShadingRateInterlockEXT}; +static const spv::Capability pygen_variable_caps_FragmentShadingRateKHR[] = {spv::Capability::FragmentShadingRateKHR}; +static const spv::Capability pygen_variable_caps_FunctionFloatControlINTEL[] = {spv::Capability::FunctionFloatControlINTEL}; +static const spv::Capability pygen_variable_caps_FunctionPointersINTEL[] = {spv::Capability::FunctionPointersINTEL}; +static const spv::Capability pygen_variable_caps_GenericPointer[] = {spv::Capability::GenericPointer}; +static const spv::Capability pygen_variable_caps_Geometry[] = {spv::Capability::Geometry}; +static const spv::Capability pygen_variable_caps_GeometryMeshShadingNVMeshShadingEXT[] = {spv::Capability::Geometry, spv::Capability::MeshShadingNV, spv::Capability::MeshShadingEXT}; +static const spv::Capability pygen_variable_caps_GeometryShaderLayerShaderViewportIndexLayerEXTMeshShadingNVMeshShadingEXT[] = {spv::Capability::Geometry, spv::Capability::ShaderLayer, spv::Capability::ShaderViewportIndexLayerEXT, spv::Capability::MeshShadingNV, spv::Capability::MeshShadingEXT}; +static const spv::Capability pygen_variable_caps_GeometryTessellation[] = {spv::Capability::Geometry, spv::Capability::Tessellation}; +static const spv::Capability pygen_variable_caps_GeometryTessellationMeshShadingNVMeshShadingEXT[] = {spv::Capability::Geometry, spv::Capability::Tessellation, spv::Capability::MeshShadingNV, spv::Capability::MeshShadingEXT}; +static const spv::Capability pygen_variable_caps_GeometryTessellationRayTracingNVRayTracingKHRMeshShadingNVMeshShadingEXT[] = {spv::Capability::Geometry, spv::Capability::Tessellation, spv::Capability::RayTracingNV, spv::Capability::RayTracingKHR, spv::Capability::MeshShadingNV, spv::Capability::MeshShadingEXT}; +static const spv::Capability pygen_variable_caps_GeometryShaderPassthroughNV[] = {spv::Capability::GeometryShaderPassthroughNV}; +static const spv::Capability pygen_variable_caps_GeometryStreams[] = {spv::Capability::GeometryStreams}; +static const spv::Capability pygen_variable_caps_GlobalVariableFPGADecorationsINTEL[] = {spv::Capability::GlobalVariableFPGADecorationsINTEL}; +static const spv::Capability pygen_variable_caps_GlobalVariableHostAccessINTEL[] = {spv::Capability::GlobalVariableHostAccessINTEL}; +static const spv::Capability pygen_variable_caps_GroupNonUniform[] = {spv::Capability::GroupNonUniform}; +static const spv::Capability pygen_variable_caps_GroupNonUniformClustered[] = {spv::Capability::GroupNonUniformClustered}; +static const spv::Capability pygen_variable_caps_GroupNonUniformPartitionedNV[] = {spv::Capability::GroupNonUniformPartitionedNV}; +static const spv::Capability pygen_variable_caps_IOPipesINTEL[] = {spv::Capability::IOPipesINTEL}; +static const spv::Capability pygen_variable_caps_ImageBasic[] = {spv::Capability::ImageBasic}; +static const spv::Capability pygen_variable_caps_ImageBuffer[] = {spv::Capability::ImageBuffer}; +static const spv::Capability pygen_variable_caps_ImageBufferShaderNonUniform[] = {spv::Capability::ImageBuffer, spv::Capability::ShaderNonUniform}; +static const spv::Capability pygen_variable_caps_ImageGatherExtended[] = {spv::Capability::ImageGatherExtended}; +static const spv::Capability pygen_variable_caps_IndirectReferencesINTEL[] = {spv::Capability::IndirectReferencesINTEL}; +static const spv::Capability pygen_variable_caps_InputAttachment[] = {spv::Capability::InputAttachment}; +static const spv::Capability pygen_variable_caps_InputAttachmentShaderNonUniform[] = {spv::Capability::InputAttachment, spv::Capability::ShaderNonUniform}; +static const spv::Capability pygen_variable_caps_Int64[] = {spv::Capability::Int64}; +static const spv::Capability pygen_variable_caps_Int64ImageEXT[] = {spv::Capability::Int64ImageEXT}; +static const spv::Capability pygen_variable_caps_Int8[] = {spv::Capability::Int8}; +static const spv::Capability pygen_variable_caps_Kernel[] = {spv::Capability::Kernel}; +static const spv::Capability pygen_variable_caps_KernelGroupNonUniform[] = {spv::Capability::Kernel, spv::Capability::GroupNonUniform}; +static const spv::Capability pygen_variable_caps_KernelGroupNonUniformSubgroupBallotKHR[] = {spv::Capability::Kernel, spv::Capability::GroupNonUniform, spv::Capability::SubgroupBallotKHR}; +static const spv::Capability pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot[] = {spv::Capability::Kernel, spv::Capability::GroupNonUniformArithmetic, spv::Capability::GroupNonUniformBallot}; +static const spv::Capability pygen_variable_caps_KernelAttributesINTEL[] = {spv::Capability::KernelAttributesINTEL}; +static const spv::Capability pygen_variable_caps_Linkage[] = {spv::Capability::Linkage}; +static const spv::Capability pygen_variable_caps_LoopFuseINTEL[] = {spv::Capability::LoopFuseINTEL}; +static const spv::Capability pygen_variable_caps_Matrix[] = {spv::Capability::Matrix}; +static const spv::Capability pygen_variable_caps_MemoryAccessAliasingINTEL[] = {spv::Capability::MemoryAccessAliasingINTEL}; +static const spv::Capability pygen_variable_caps_MeshShadingEXT[] = {spv::Capability::MeshShadingEXT}; +static const spv::Capability pygen_variable_caps_MeshShadingNV[] = {spv::Capability::MeshShadingNV}; +static const spv::Capability pygen_variable_caps_MeshShadingNVMeshShadingEXT[] = {spv::Capability::MeshShadingNV, spv::Capability::MeshShadingEXT}; +static const spv::Capability pygen_variable_caps_MinLod[] = {spv::Capability::MinLod}; +static const spv::Capability pygen_variable_caps_MultiView[] = {spv::Capability::MultiView}; +static const spv::Capability pygen_variable_caps_MultiViewport[] = {spv::Capability::MultiViewport}; +static const spv::Capability pygen_variable_caps_MultiViewportShaderViewportIndexShaderViewportIndexLayerEXTMeshShadingNVMeshShadingEXT[] = {spv::Capability::MultiViewport, spv::Capability::ShaderViewportIndex, spv::Capability::ShaderViewportIndexLayerEXT, spv::Capability::MeshShadingNV, spv::Capability::MeshShadingEXT}; +static const spv::Capability pygen_variable_caps_OptNoneINTEL[] = {spv::Capability::OptNoneINTEL}; +static const spv::Capability pygen_variable_caps_PerViewAttributesNVMeshShadingNV[] = {spv::Capability::PerViewAttributesNV, spv::Capability::MeshShadingNV}; +static const spv::Capability pygen_variable_caps_PhysicalStorageBufferAddresses[] = {spv::Capability::PhysicalStorageBufferAddresses}; +static const spv::Capability pygen_variable_caps_Pipes[] = {spv::Capability::Pipes}; +static const spv::Capability pygen_variable_caps_RayCullMaskKHR[] = {spv::Capability::RayCullMaskKHR}; +static const spv::Capability pygen_variable_caps_RayQueryKHR[] = {spv::Capability::RayQueryKHR}; +static const spv::Capability pygen_variable_caps_RayQueryKHRRayTracingKHR[] = {spv::Capability::RayQueryKHR, spv::Capability::RayTracingKHR}; +static const spv::Capability pygen_variable_caps_RayTracingKHR[] = {spv::Capability::RayTracingKHR}; +static const spv::Capability pygen_variable_caps_RayTracingMotionBlurNV[] = {spv::Capability::RayTracingMotionBlurNV}; +static const spv::Capability pygen_variable_caps_RayTracingNV[] = {spv::Capability::RayTracingNV}; +static const spv::Capability pygen_variable_caps_RayTracingNVRayTracingKHR[] = {spv::Capability::RayTracingNV, spv::Capability::RayTracingKHR}; +static const spv::Capability pygen_variable_caps_RayTracingOpacityMicromapEXT[] = {spv::Capability::RayTracingOpacityMicromapEXT}; +static const spv::Capability pygen_variable_caps_RayTracingPositionFetchKHR[] = {spv::Capability::RayTracingPositionFetchKHR}; +static const spv::Capability pygen_variable_caps_RayTraversalPrimitiveCullingKHR[] = {spv::Capability::RayTraversalPrimitiveCullingKHR}; +static const spv::Capability pygen_variable_caps_RoundToInfinityINTEL[] = {spv::Capability::RoundToInfinityINTEL}; +static const spv::Capability pygen_variable_caps_RoundingModeRTE[] = {spv::Capability::RoundingModeRTE}; +static const spv::Capability pygen_variable_caps_RoundingModeRTZ[] = {spv::Capability::RoundingModeRTZ}; +static const spv::Capability pygen_variable_caps_RuntimeAlignedAttributeINTEL[] = {spv::Capability::RuntimeAlignedAttributeINTEL}; +static const spv::Capability pygen_variable_caps_SampleMaskOverrideCoverageNV[] = {spv::Capability::SampleMaskOverrideCoverageNV}; +static const spv::Capability pygen_variable_caps_SampleMaskPostDepthCoverage[] = {spv::Capability::SampleMaskPostDepthCoverage}; +static const spv::Capability pygen_variable_caps_SampleRateShading[] = {spv::Capability::SampleRateShading}; +static const spv::Capability pygen_variable_caps_Sampled1D[] = {spv::Capability::Sampled1D}; +static const spv::Capability pygen_variable_caps_SampledBuffer[] = {spv::Capability::SampledBuffer}; +static const spv::Capability pygen_variable_caps_SampledBufferShaderNonUniform[] = {spv::Capability::SampledBuffer, spv::Capability::ShaderNonUniform}; +static const spv::Capability pygen_variable_caps_SampledCubeArray[] = {spv::Capability::SampledCubeArray}; +static const spv::Capability pygen_variable_caps_SampledRect[] = {spv::Capability::SampledRect}; +static const spv::Capability pygen_variable_caps_Shader[] = {spv::Capability::Shader}; +static const spv::Capability pygen_variable_caps_ShaderKernel[] = {spv::Capability::Shader, spv::Capability::Kernel}; +static const spv::Capability pygen_variable_caps_ShaderUniformDecoration[] = {spv::Capability::Shader, spv::Capability::UniformDecoration}; +static const spv::Capability pygen_variable_caps_ShaderVectorComputeINTEL[] = {spv::Capability::Shader, spv::Capability::VectorComputeINTEL}; +static const spv::Capability pygen_variable_caps_ShaderEnqueueAMDX[] = {spv::Capability::ShaderEnqueueAMDX}; +static const spv::Capability pygen_variable_caps_ShaderInvocationReorderNV[] = {spv::Capability::ShaderInvocationReorderNV}; +static const spv::Capability pygen_variable_caps_ShaderNonUniform[] = {spv::Capability::ShaderNonUniform}; +static const spv::Capability pygen_variable_caps_ShaderSMBuiltinsNV[] = {spv::Capability::ShaderSMBuiltinsNV}; +static const spv::Capability pygen_variable_caps_ShaderStereoViewNV[] = {spv::Capability::ShaderStereoViewNV}; +static const spv::Capability pygen_variable_caps_ShaderViewportIndexLayerNV[] = {spv::Capability::ShaderViewportIndexLayerNV}; +static const spv::Capability pygen_variable_caps_ShaderViewportMaskNV[] = {spv::Capability::ShaderViewportMaskNV}; +static const spv::Capability pygen_variable_caps_ShaderViewportMaskNVMeshShadingNV[] = {spv::Capability::ShaderViewportMaskNV, spv::Capability::MeshShadingNV}; +static const spv::Capability pygen_variable_caps_ShadingRateNVFragmentDensityEXT[] = {spv::Capability::ShadingRateNV, spv::Capability::FragmentDensityEXT}; +static const spv::Capability pygen_variable_caps_SignedZeroInfNanPreserve[] = {spv::Capability::SignedZeroInfNanPreserve}; +static const spv::Capability pygen_variable_caps_StencilExportEXT[] = {spv::Capability::StencilExportEXT}; +static const spv::Capability pygen_variable_caps_StorageBuffer16BitAccessStorageUniformBufferBlock16[] = {spv::Capability::StorageBuffer16BitAccess, spv::Capability::StorageUniformBufferBlock16}; +static const spv::Capability pygen_variable_caps_StorageBuffer8BitAccess[] = {spv::Capability::StorageBuffer8BitAccess}; +static const spv::Capability pygen_variable_caps_StorageImageExtendedFormats[] = {spv::Capability::StorageImageExtendedFormats}; +static const spv::Capability pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot[] = {spv::Capability::SubgroupBallotKHR, spv::Capability::GroupNonUniformBallot}; +static const spv::Capability pygen_variable_caps_SubgroupDispatch[] = {spv::Capability::SubgroupDispatch}; +static const spv::Capability pygen_variable_caps_Tessellation[] = {spv::Capability::Tessellation}; +static const spv::Capability pygen_variable_caps_TileImageColorReadAccessEXT[] = {spv::Capability::TileImageColorReadAccessEXT}; +static const spv::Capability pygen_variable_caps_TileImageDepthReadAccessEXT[] = {spv::Capability::TileImageDepthReadAccessEXT}; +static const spv::Capability pygen_variable_caps_TileImageStencilReadAccessEXT[] = {spv::Capability::TileImageStencilReadAccessEXT}; +static const spv::Capability pygen_variable_caps_TransformFeedback[] = {spv::Capability::TransformFeedback}; +static const spv::Capability pygen_variable_caps_USMStorageClassesINTEL[] = {spv::Capability::USMStorageClassesINTEL}; +static const spv::Capability pygen_variable_caps_VariablePointersStorageBuffer[] = {spv::Capability::VariablePointersStorageBuffer}; +static const spv::Capability pygen_variable_caps_VectorAnyINTEL[] = {spv::Capability::VectorAnyINTEL}; +static const spv::Capability pygen_variable_caps_VectorComputeINTEL[] = {spv::Capability::VectorComputeINTEL}; +static const spv::Capability pygen_variable_caps_VulkanMemoryModel[] = {spv::Capability::VulkanMemoryModel}; +static const spv::Capability pygen_variable_caps_WorkgroupMemoryExplicitLayoutKHR[] = {spv::Capability::WorkgroupMemoryExplicitLayoutKHR}; +static const spvtools::Extension pygen_variable_exts_SPV_AMDX_shader_enqueue[] = {spvtools::Extension::kSPV_AMDX_shader_enqueue}; static const spvtools::Extension pygen_variable_exts_SPV_AMD_gpu_shader_half_float_fetch[] = {spvtools::Extension::kSPV_AMD_gpu_shader_half_float_fetch}; static const spvtools::Extension pygen_variable_exts_SPV_AMD_shader_ballot[] = {spvtools::Extension::kSPV_AMD_shader_ballot}; static const spvtools::Extension pygen_variable_exts_SPV_AMD_shader_early_and_late_fragment_tests[] = {spvtools::Extension::kSPV_AMD_shader_early_and_late_fragment_tests}; @@ -141,30 +153,40 @@ static const spvtools::Extension pygen_variable_exts_SPV_EXT_fragment_shader_int static const spvtools::Extension pygen_variable_exts_SPV_EXT_mesh_shader[] = {spvtools::Extension::kSPV_EXT_mesh_shader}; static const spvtools::Extension pygen_variable_exts_SPV_EXT_mesh_shaderSPV_KHR_shader_draw_parametersSPV_NV_mesh_shader[] = {spvtools::Extension::kSPV_EXT_mesh_shader, spvtools::Extension::kSPV_KHR_shader_draw_parameters, spvtools::Extension::kSPV_NV_mesh_shader}; static const spvtools::Extension pygen_variable_exts_SPV_EXT_mesh_shaderSPV_NV_mesh_shader[] = {spvtools::Extension::kSPV_EXT_mesh_shader, spvtools::Extension::kSPV_NV_mesh_shader}; +static const spvtools::Extension pygen_variable_exts_SPV_EXT_opacity_micromap[] = {spvtools::Extension::kSPV_EXT_opacity_micromap}; static const spvtools::Extension pygen_variable_exts_SPV_EXT_physical_storage_bufferSPV_KHR_physical_storage_buffer[] = {spvtools::Extension::kSPV_EXT_physical_storage_buffer, spvtools::Extension::kSPV_KHR_physical_storage_buffer}; static const spvtools::Extension pygen_variable_exts_SPV_EXT_shader_atomic_float16_add[] = {spvtools::Extension::kSPV_EXT_shader_atomic_float16_add}; static const spvtools::Extension pygen_variable_exts_SPV_EXT_shader_atomic_float_add[] = {spvtools::Extension::kSPV_EXT_shader_atomic_float_add}; static const spvtools::Extension pygen_variable_exts_SPV_EXT_shader_atomic_float_min_max[] = {spvtools::Extension::kSPV_EXT_shader_atomic_float_min_max}; static const spvtools::Extension pygen_variable_exts_SPV_EXT_shader_image_int64[] = {spvtools::Extension::kSPV_EXT_shader_image_int64}; static const spvtools::Extension pygen_variable_exts_SPV_EXT_shader_stencil_export[] = {spvtools::Extension::kSPV_EXT_shader_stencil_export}; +static const spvtools::Extension pygen_variable_exts_SPV_EXT_shader_tile_image[] = {spvtools::Extension::kSPV_EXT_shader_tile_image}; static const spvtools::Extension pygen_variable_exts_SPV_EXT_shader_viewport_index_layerSPV_NV_viewport_array2[] = {spvtools::Extension::kSPV_EXT_shader_viewport_index_layer, spvtools::Extension::kSPV_NV_viewport_array2}; static const spvtools::Extension pygen_variable_exts_SPV_GOOGLE_hlsl_functionality1[] = {spvtools::Extension::kSPV_GOOGLE_hlsl_functionality1}; static const spvtools::Extension pygen_variable_exts_SPV_GOOGLE_user_type[] = {spvtools::Extension::kSPV_GOOGLE_user_type}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_arbitrary_precision_fixed_point[] = {spvtools::Extension::kSPV_INTEL_arbitrary_precision_fixed_point}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_arbitrary_precision_floating_point[] = {spvtools::Extension::kSPV_INTEL_arbitrary_precision_floating_point}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_arbitrary_precision_integers[] = {spvtools::Extension::kSPV_INTEL_arbitrary_precision_integers}; +static const spvtools::Extension pygen_variable_exts_SPV_INTEL_bfloat16_conversion[] = {spvtools::Extension::kSPV_INTEL_bfloat16_conversion}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_blocking_pipes[] = {spvtools::Extension::kSPV_INTEL_blocking_pipes}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_debug_module[] = {spvtools::Extension::kSPV_INTEL_debug_module}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_device_side_avc_motion_estimation[] = {spvtools::Extension::kSPV_INTEL_device_side_avc_motion_estimation}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_float_controls2[] = {spvtools::Extension::kSPV_INTEL_float_controls2}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fp_fast_math_mode[] = {spvtools::Extension::kSPV_INTEL_fp_fast_math_mode}; +static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fp_max_error[] = {spvtools::Extension::kSPV_INTEL_fp_max_error}; +static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fpga_argument_interfaces[] = {spvtools::Extension::kSPV_INTEL_fpga_argument_interfaces}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fpga_buffer_location[] = {spvtools::Extension::kSPV_INTEL_fpga_buffer_location}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fpga_cluster_attributes[] = {spvtools::Extension::kSPV_INTEL_fpga_cluster_attributes}; +static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fpga_dsp_control[] = {spvtools::Extension::kSPV_INTEL_fpga_dsp_control}; +static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fpga_invocation_pipelining_attributes[] = {spvtools::Extension::kSPV_INTEL_fpga_invocation_pipelining_attributes}; +static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fpga_latency_control[] = {spvtools::Extension::kSPV_INTEL_fpga_latency_control}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fpga_loop_controls[] = {spvtools::Extension::kSPV_INTEL_fpga_loop_controls}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fpga_memory_accesses[] = {spvtools::Extension::kSPV_INTEL_fpga_memory_accesses}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fpga_memory_attributes[] = {spvtools::Extension::kSPV_INTEL_fpga_memory_attributes}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_fpga_reg[] = {spvtools::Extension::kSPV_INTEL_fpga_reg}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_function_pointers[] = {spvtools::Extension::kSPV_INTEL_function_pointers}; +static const spvtools::Extension pygen_variable_exts_SPV_INTEL_global_variable_fpga_decorations[] = {spvtools::Extension::kSPV_INTEL_global_variable_fpga_decorations}; +static const spvtools::Extension pygen_variable_exts_SPV_INTEL_global_variable_host_access[] = {spvtools::Extension::kSPV_INTEL_global_variable_host_access}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_inline_assembly[] = {spvtools::Extension::kSPV_INTEL_inline_assembly}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_io_pipes[] = {spvtools::Extension::kSPV_INTEL_io_pipes}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_kernel_attributes[] = {spvtools::Extension::kSPV_INTEL_kernel_attributes}; @@ -173,6 +195,7 @@ static const spvtools::Extension pygen_variable_exts_SPV_INTEL_loop_fuse[] = {sp static const spvtools::Extension pygen_variable_exts_SPV_INTEL_media_block_io[] = {spvtools::Extension::kSPV_INTEL_media_block_io}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_memory_access_aliasing[] = {spvtools::Extension::kSPV_INTEL_memory_access_aliasing}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_optnone[] = {spvtools::Extension::kSPV_INTEL_optnone}; +static const spvtools::Extension pygen_variable_exts_SPV_INTEL_runtime_aligned[] = {spvtools::Extension::kSPV_INTEL_runtime_aligned}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_shader_integer_functions2[] = {spvtools::Extension::kSPV_INTEL_shader_integer_functions2}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_split_barrier[] = {spvtools::Extension::kSPV_INTEL_split_barrier}; static const spvtools::Extension pygen_variable_exts_SPV_INTEL_subgroups[] = {spvtools::Extension::kSPV_INTEL_subgroups}; @@ -183,6 +206,7 @@ static const spvtools::Extension pygen_variable_exts_SPV_INTEL_vector_compute[] static const spvtools::Extension pygen_variable_exts_SPV_KHR_16bit_storage[] = {spvtools::Extension::kSPV_KHR_16bit_storage}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_8bit_storage[] = {spvtools::Extension::kSPV_KHR_8bit_storage}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_bit_instructions[] = {spvtools::Extension::kSPV_KHR_bit_instructions}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_cooperative_matrix[] = {spvtools::Extension::kSPV_KHR_cooperative_matrix}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_device_group[] = {spvtools::Extension::kSPV_KHR_device_group}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_expect_assume[] = {spvtools::Extension::kSPV_KHR_expect_assume}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_float_controls[] = {spvtools::Extension::kSPV_KHR_float_controls}; @@ -198,6 +222,7 @@ static const spvtools::Extension pygen_variable_exts_SPV_KHR_ray_query[] = {spvt static const spvtools::Extension pygen_variable_exts_SPV_KHR_ray_querySPV_KHR_ray_tracing[] = {spvtools::Extension::kSPV_KHR_ray_query, spvtools::Extension::kSPV_KHR_ray_tracing}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_ray_tracing[] = {spvtools::Extension::kSPV_KHR_ray_tracing}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_ray_tracingSPV_NV_ray_tracing[] = {spvtools::Extension::kSPV_KHR_ray_tracing, spvtools::Extension::kSPV_NV_ray_tracing}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_ray_tracing_position_fetch[] = {spvtools::Extension::kSPV_KHR_ray_tracing_position_fetch}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_shader_atomic_counter_ops[] = {spvtools::Extension::kSPV_KHR_shader_atomic_counter_ops}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_shader_ballot[] = {spvtools::Extension::kSPV_KHR_shader_ballot}; static const spvtools::Extension pygen_variable_exts_SPV_KHR_shader_clock[] = {spvtools::Extension::kSPV_KHR_shader_clock}; @@ -222,21 +247,23 @@ static const spvtools::Extension pygen_variable_exts_SPV_NV_ray_tracing[] = {spv static const spvtools::Extension pygen_variable_exts_SPV_NV_ray_tracing_motion_blur[] = {spvtools::Extension::kSPV_NV_ray_tracing_motion_blur}; static const spvtools::Extension pygen_variable_exts_SPV_NV_sample_mask_override_coverage[] = {spvtools::Extension::kSPV_NV_sample_mask_override_coverage}; static const spvtools::Extension pygen_variable_exts_SPV_NV_shader_image_footprint[] = {spvtools::Extension::kSPV_NV_shader_image_footprint}; +static const spvtools::Extension pygen_variable_exts_SPV_NV_shader_invocation_reorder[] = {spvtools::Extension::kSPV_NV_shader_invocation_reorder}; static const spvtools::Extension pygen_variable_exts_SPV_NV_shader_sm_builtins[] = {spvtools::Extension::kSPV_NV_shader_sm_builtins}; static const spvtools::Extension pygen_variable_exts_SPV_NV_shader_subgroup_partitioned[] = {spvtools::Extension::kSPV_NV_shader_subgroup_partitioned}; static const spvtools::Extension pygen_variable_exts_SPV_NV_stereo_view_rendering[] = {spvtools::Extension::kSPV_NV_stereo_view_rendering}; static const spvtools::Extension pygen_variable_exts_SPV_NV_viewport_array2[] = {spvtools::Extension::kSPV_NV_viewport_array2}; +static const spvtools::Extension pygen_variable_exts_SPV_QCOM_image_processing[] = {spvtools::Extension::kSPV_QCOM_image_processing}; static const spv_operand_desc_t pygen_variable_ImageOperandsEntries[] = { {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Bias", 0x0001, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Lod", 0x0002, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Grad", 0x0004, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConstOffset", 0x0008, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Offset", 0x0010, 1, pygen_variable_caps_ImageGatherExtended, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ConstOffsets", 0x0020, 1, pygen_variable_caps_ImageGatherExtended, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Sample", 0x0040, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MinLod", 0x0080, 1, pygen_variable_caps_MinLod, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"Bias", 0x0001, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Lod", 0x0002, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Grad", 0x0004, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConstOffset", 0x0008, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Offset", 0x0010, 1, pygen_variable_caps_ImageGatherExtended, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ConstOffsets", 0x0020, 1, pygen_variable_caps_ImageGatherExtended, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Sample", 0x0040, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MinLod", 0x0080, 1, pygen_variable_caps_MinLod, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"MakeTexelAvailable", 0x0100, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {SPV_OPERAND_TYPE_SCOPE_ID}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"MakeTexelAvailableKHR", 0x0100, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {SPV_OPERAND_TYPE_SCOPE_ID}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"MakeTexelVisible", 0x0200, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {SPV_OPERAND_TYPE_SCOPE_ID}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, @@ -248,30 +275,30 @@ static const spv_operand_desc_t pygen_variable_ImageOperandsEntries[] = { {"SignExtend", 0x1000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, {"ZeroExtend", 0x2000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, {"Nontemporal", 0x4000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"Offsets", 0x10000, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"Offsets", 0x10000, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_FPFastMathModeEntries[] = { - {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NotNaN", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NotInf", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NSZ", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AllowRecip", 0x0008, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Fast", 0x0010, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NotNaN", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NotInf", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NSZ", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AllowRecip", 0x0008, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Fast", 0x0010, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"AllowContractFastINTEL", 0x10000, 1, pygen_variable_caps_FPFastMathModeINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"AllowReassocINTEL", 0x20000, 1, pygen_variable_caps_FPFastMathModeINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_SelectionControlEntries[] = { - {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Flatten", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DontFlatten", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Flatten", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DontFlatten", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_LoopControlEntries[] = { - {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Unroll", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DontUnroll", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Unroll", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DontUnroll", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"DependencyInfinite", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, {"DependencyLength", 0x0008, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, {"MinIterations", 0x0010, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, @@ -279,38 +306,40 @@ static const spv_operand_desc_t pygen_variable_LoopControlEntries[] = { {"IterationMultiple", 0x0040, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, {"PeelCount", 0x0080, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, {"PartialCount", 0x0100, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, - {"InitiationIntervalINTEL", 0x10000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 1, pygen_variable_exts_SPV_INTEL_fpga_loop_controls, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, - {"MaxConcurrencyINTEL", 0x20000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 1, pygen_variable_exts_SPV_INTEL_fpga_loop_controls, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, - {"DependencyArrayINTEL", 0x40000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 1, pygen_variable_exts_SPV_INTEL_fpga_loop_controls, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, - {"PipelineEnableINTEL", 0x80000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 1, pygen_variable_exts_SPV_INTEL_fpga_loop_controls, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, - {"LoopCoalesceINTEL", 0x100000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 1, pygen_variable_exts_SPV_INTEL_fpga_loop_controls, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, - {"MaxInterleavingINTEL", 0x200000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 1, pygen_variable_exts_SPV_INTEL_fpga_loop_controls, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, - {"SpeculatedIterationsINTEL", 0x400000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 1, pygen_variable_exts_SPV_INTEL_fpga_loop_controls, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, - {"NoFusionINTEL", 0x800000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 1, pygen_variable_exts_SPV_INTEL_fpga_loop_controls, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu} + {"InitiationIntervalINTEL", 0x10000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"MaxConcurrencyINTEL", 0x20000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"DependencyArrayINTEL", 0x40000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"PipelineEnableINTEL", 0x80000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"LoopCoalesceINTEL", 0x100000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"MaxInterleavingINTEL", 0x200000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"SpeculatedIterationsINTEL", 0x400000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"NoFusionINTEL", 0x800000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"LoopCountINTEL", 0x1000000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"MaxReinvocationDelayINTEL", 0x2000000, 1, pygen_variable_caps_FPGALoopControlsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_FunctionControlEntries[] = { - {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Inline", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DontInline", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Pure", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Const", 0x0008, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Inline", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DontInline", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Pure", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Const", 0x0008, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"OptNoneINTEL", 0x10000, 1, pygen_variable_caps_OptNoneINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_MemorySemanticsEntries[] = { - {"Relaxed", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Acquire", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Release", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AcquireRelease", 0x0008, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SequentiallyConsistent", 0x0010, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UniformMemory", 0x0040, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SubgroupMemory", 0x0080, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"WorkgroupMemory", 0x0100, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CrossWorkgroupMemory", 0x0200, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicCounterMemory", 0x0400, 1, pygen_variable_caps_AtomicStorage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageMemory", 0x0800, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"Relaxed", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Acquire", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Release", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AcquireRelease", 0x0008, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SequentiallyConsistent", 0x0010, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UniformMemory", 0x0040, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SubgroupMemory", 0x0080, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WorkgroupMemory", 0x0100, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CrossWorkgroupMemory", 0x0200, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicCounterMemory", 0x0400, 1, pygen_variable_caps_AtomicStorage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageMemory", 0x0800, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"OutputMemory", 0x1000, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"OutputMemoryKHR", 0x1000, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"MakeAvailable", 0x2000, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, @@ -321,10 +350,10 @@ static const spv_operand_desc_t pygen_variable_MemorySemanticsEntries[] = { }; static const spv_operand_desc_t pygen_variable_MemoryAccessEntries[] = { - {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Volatile", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Aligned", 0x0002, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Nontemporal", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Volatile", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Aligned", 0x0002, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Nontemporal", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"MakePointerAvailable", 0x0008, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {SPV_OPERAND_TYPE_SCOPE_ID}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"MakePointerAvailableKHR", 0x0008, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {SPV_OPERAND_TYPE_SCOPE_ID}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"MakePointerVisible", 0x0010, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {SPV_OPERAND_TYPE_SCOPE_ID}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, @@ -336,8 +365,8 @@ static const spv_operand_desc_t pygen_variable_MemoryAccessEntries[] = { }; static const spv_operand_desc_t pygen_variable_KernelProfilingInfoEntries[] = { - {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CmdExecTime", 0x0001, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CmdExecTime", 0x0001, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_RayFlagsEntries[] = { @@ -351,7 +380,8 @@ static const spv_operand_desc_t pygen_variable_RayFlagsEntries[] = { {"CullOpaqueKHR", 0x0040, 2, pygen_variable_caps_RayQueryKHRRayTracingKHR, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"CullNoOpaqueKHR", 0x0080, 2, pygen_variable_caps_RayQueryKHRRayTracingKHR, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"SkipTrianglesKHR", 0x0100, 1, pygen_variable_caps_RayTraversalPrimitiveCullingKHR, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, - {"SkipAABBsKHR", 0x0200, 1, pygen_variable_caps_RayTraversalPrimitiveCullingKHR, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} + {"SkipAABBsKHR", 0x0200, 1, pygen_variable_caps_RayTraversalPrimitiveCullingKHR, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"ForceOpacityMicromap2StateEXT", 0x0400, 1, pygen_variable_caps_RayTracingOpacityMicromapEXT, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_FragmentShadingRateEntries[] = { @@ -362,24 +392,27 @@ static const spv_operand_desc_t pygen_variable_FragmentShadingRateEntries[] = { }; static const spv_operand_desc_t pygen_variable_SourceLanguageEntries[] = { - {"Unknown", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ESSL", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GLSL", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"OpenCL_C", 3, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"OpenCL_CPP", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"HLSL", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CPP_for_OpenCL", 6, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SYCL", 7, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"Unknown", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ESSL", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GLSL", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"OpenCL_C", 3, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"OpenCL_CPP", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"HLSL", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CPP_for_OpenCL", 6, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SYCL", 7, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"HERO_C", 8, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NZSL", 9, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WGSL", 10, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_ExecutionModelEntries[] = { - {"Vertex", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TessellationControl", 1, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TessellationEvaluation", 2, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Geometry", 3, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Fragment", 4, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GLCompute", 5, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Kernel", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"Vertex", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TessellationControl", 1, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TessellationEvaluation", 2, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Geometry", 3, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Fragment", 4, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GLCompute", 5, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Kernel", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"TaskNV", 5267, 1, pygen_variable_caps_MeshShadingNV, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"MeshNV", 5268, 1, pygen_variable_caps_MeshShadingNV, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"RayGenerationNV", 5313, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, @@ -399,53 +432,53 @@ static const spv_operand_desc_t pygen_variable_ExecutionModelEntries[] = { }; static const spv_operand_desc_t pygen_variable_AddressingModelEntries[] = { - {"Logical", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Physical32", 1, 1, pygen_variable_caps_Addresses, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Physical64", 2, 1, pygen_variable_caps_Addresses, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"Logical", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Physical32", 1, 1, pygen_variable_caps_Addresses, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Physical64", 2, 1, pygen_variable_caps_Addresses, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"PhysicalStorageBuffer64", 5348, 1, pygen_variable_caps_PhysicalStorageBufferAddresses, 2, pygen_variable_exts_SPV_EXT_physical_storage_bufferSPV_KHR_physical_storage_buffer, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"PhysicalStorageBuffer64EXT", 5348, 1, pygen_variable_caps_PhysicalStorageBufferAddresses, 2, pygen_variable_exts_SPV_EXT_physical_storage_bufferSPV_KHR_physical_storage_buffer, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_MemoryModelEntries[] = { - {"Simple", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GLSL450", 1, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"OpenCL", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"Simple", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GLSL450", 1, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"OpenCL", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"Vulkan", 3, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"VulkanKHR", 3, 1, pygen_variable_caps_VulkanMemoryModel, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_ExecutionModeEntries[] = { - {"Invocations", 0, 1, pygen_variable_caps_Geometry, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SpacingEqual", 1, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SpacingFractionalEven", 2, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SpacingFractionalOdd", 3, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"VertexOrderCw", 4, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"VertexOrderCcw", 5, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"PixelCenterInteger", 6, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"OriginUpperLeft", 7, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"OriginLowerLeft", 8, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"EarlyFragmentTests", 9, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"PointMode", 10, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Xfb", 11, 1, pygen_variable_caps_TransformFeedback, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DepthReplacing", 12, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DepthGreater", 14, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DepthLess", 15, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DepthUnchanged", 16, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LocalSize", 17, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LocalSizeHint", 18, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InputPoints", 19, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InputLines", 20, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InputLinesAdjacency", 21, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Triangles", 22, 2, pygen_variable_caps_GeometryTessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InputTrianglesAdjacency", 23, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Quads", 24, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Isolines", 25, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"OutputVertices", 26, 4, pygen_variable_caps_GeometryTessellationMeshShadingNVMeshShadingEXT, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"OutputPoints", 27, 3, pygen_variable_caps_GeometryMeshShadingNVMeshShadingEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"OutputLineStrip", 28, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"OutputTriangleStrip", 29, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"VecTypeHint", 30, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ContractionOff", 31, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"Invocations", 0, 1, pygen_variable_caps_Geometry, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SpacingEqual", 1, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SpacingFractionalEven", 2, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SpacingFractionalOdd", 3, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"VertexOrderCw", 4, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"VertexOrderCcw", 5, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"PixelCenterInteger", 6, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"OriginUpperLeft", 7, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"OriginLowerLeft", 8, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"EarlyFragmentTests", 9, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"PointMode", 10, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Xfb", 11, 1, pygen_variable_caps_TransformFeedback, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DepthReplacing", 12, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DepthGreater", 14, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DepthLess", 15, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DepthUnchanged", 16, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LocalSize", 17, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LocalSizeHint", 18, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InputPoints", 19, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InputLines", 20, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InputLinesAdjacency", 21, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Triangles", 22, 2, pygen_variable_caps_GeometryTessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InputTrianglesAdjacency", 23, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Quads", 24, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Isolines", 25, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"OutputVertices", 26, 4, pygen_variable_caps_GeometryTessellationMeshShadingNVMeshShadingEXT, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"OutputPoints", 27, 3, pygen_variable_caps_GeometryMeshShadingNVMeshShadingEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"OutputLineStrip", 28, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"OutputTriangleStrip", 29, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"VecTypeHint", 30, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ContractionOff", 31, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"Initializer", 33, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, {"Finalizer", 34, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, {"SubgroupSize", 35, 1, pygen_variable_caps_SubgroupDispatch, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, @@ -453,6 +486,9 @@ static const spv_operand_desc_t pygen_variable_ExecutionModeEntries[] = { {"SubgroupsPerWorkgroupId", 37, 1, pygen_variable_caps_SubgroupDispatch, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,2), 0xffffffffu}, {"LocalSizeId", 38, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,2), 0xffffffffu}, {"LocalSizeHintId", 39, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,2), 0xffffffffu}, + {"NonCoherentColorAttachmentReadEXT", 4169, 1, pygen_variable_caps_TileImageColorReadAccessEXT, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"NonCoherentDepthAttachmentReadEXT", 4170, 1, pygen_variable_caps_TileImageDepthReadAccessEXT, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"NonCoherentStencilAttachmentReadEXT", 4171, 1, pygen_variable_caps_TileImageStencilReadAccessEXT, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"SubgroupUniformControlFlowKHR", 4421, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_subgroup_uniform_control_flow, {}, 0xffffffffu, 0xffffffffu}, {"PostDepthCoverage", 4446, 1, pygen_variable_caps_SampleMaskPostDepthCoverage, 1, pygen_variable_exts_SPV_KHR_post_depth_coverage, {}, 0xffffffffu, 0xffffffffu}, {"DenormPreserve", 4459, 1, pygen_variable_caps_DenormPreserve, 1, pygen_variable_exts_SPV_KHR_float_controls, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, @@ -462,6 +498,11 @@ static const spv_operand_desc_t pygen_variable_ExecutionModeEntries[] = { {"RoundingModeRTZ", 4463, 1, pygen_variable_caps_RoundingModeRTZ, 1, pygen_variable_exts_SPV_KHR_float_controls, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, {"EarlyAndLateFragmentTestsAMD", 5017, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_AMD_shader_early_and_late_fragment_tests, {}, 0xffffffffu, 0xffffffffu}, {"StencilRefReplacingEXT", 5027, 1, pygen_variable_caps_StencilExportEXT, 1, pygen_variable_exts_SPV_EXT_shader_stencil_export, {}, 0xffffffffu, 0xffffffffu}, + {"CoalescingAMDX", 5069, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"MaxNodeRecursionAMDX", 5071, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {SPV_OPERAND_TYPE_ID}, 0xffffffffu, 0xffffffffu}, + {"StaticNumWorkgroupsAMDX", 5072, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0xffffffffu, 0xffffffffu}, + {"ShaderIndexAMDX", 5073, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {SPV_OPERAND_TYPE_ID}, 0xffffffffu, 0xffffffffu}, + {"MaxNumWorkgroupsAMDX", 5077, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0xffffffffu, 0xffffffffu}, {"StencilRefUnchangedFrontAMD", 5079, 1, pygen_variable_caps_StencilExportEXT, 2, pygen_variable_exts_SPV_AMD_shader_early_and_late_fragment_testsSPV_EXT_shader_stencil_export, {}, 0xffffffffu, 0xffffffffu}, {"StencilRefGreaterFrontAMD", 5080, 1, pygen_variable_caps_StencilExportEXT, 2, pygen_variable_exts_SPV_AMD_shader_early_and_late_fragment_testsSPV_EXT_shader_stencil_export, {}, 0xffffffffu, 0xffffffffu}, {"StencilRefLessFrontAMD", 5081, 1, pygen_variable_caps_StencilExportEXT, 2, pygen_variable_exts_SPV_AMD_shader_early_and_late_fragment_testsSPV_EXT_shader_stencil_export, {}, 0xffffffffu, 0xffffffffu}, @@ -492,23 +533,28 @@ static const spv_operand_desc_t pygen_variable_ExecutionModeEntries[] = { {"NoGlobalOffsetINTEL", 5895, 1, pygen_variable_caps_KernelAttributesINTEL, 1, pygen_variable_exts_SPV_INTEL_kernel_attributes, {}, 0xffffffffu, 0xffffffffu}, {"NumSIMDWorkitemsINTEL", 5896, 1, pygen_variable_caps_FPGAKernelAttributesINTEL, 1, pygen_variable_exts_SPV_INTEL_kernel_attributes, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, {"SchedulerTargetFmaxMhzINTEL", 5903, 1, pygen_variable_caps_FPGAKernelAttributesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"StreamingInterfaceINTEL", 6154, 1, pygen_variable_caps_FPGAKernelAttributesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"RegisterMapInterfaceINTEL", 6160, 1, pygen_variable_caps_FPGAKernelAttributesv2INTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, {"NamedBarrierCountINTEL", 6417, 1, pygen_variable_caps_VectorComputeINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_StorageClassEntries[] = { - {"UniformConstant", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Input", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Uniform", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Output", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Workgroup", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CrossWorkgroup", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Private", 6, 2, pygen_variable_caps_ShaderVectorComputeINTEL, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Function", 7, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Generic", 8, 1, pygen_variable_caps_GenericPointer, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"PushConstant", 9, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicCounter", 10, 1, pygen_variable_caps_AtomicStorage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Image", 11, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"UniformConstant", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Input", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Uniform", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Output", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Workgroup", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CrossWorkgroup", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Private", 6, 2, pygen_variable_caps_ShaderVectorComputeINTEL, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Function", 7, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Generic", 8, 1, pygen_variable_caps_GenericPointer, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"PushConstant", 9, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicCounter", 10, 1, pygen_variable_caps_AtomicStorage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Image", 11, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"StorageBuffer", 12, 1, pygen_variable_caps_Shader, 2, pygen_variable_exts_SPV_KHR_storage_buffer_storage_classSPV_KHR_variable_pointers, {}, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, + {"TileImageEXT", 4172, 1, pygen_variable_caps_TileImageColorReadAccessEXT, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"NodePayloadAMDX", 5068, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"NodeOutputPayloadAMDX", 5076, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"CallableDataNV", 5328, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 2, pygen_variable_exts_SPV_KHR_ray_tracingSPV_NV_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, {"CallableDataKHR", 5328, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 2, pygen_variable_exts_SPV_KHR_ray_tracingSPV_NV_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, {"IncomingCallableDataNV", 5329, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 2, pygen_variable_exts_SPV_KHR_ray_tracingSPV_NV_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, @@ -523,6 +569,7 @@ static const spv_operand_desc_t pygen_variable_StorageClassEntries[] = { {"ShaderRecordBufferKHR", 5343, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 2, pygen_variable_exts_SPV_KHR_ray_tracingSPV_NV_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, {"PhysicalStorageBuffer", 5349, 1, pygen_variable_caps_PhysicalStorageBufferAddresses, 2, pygen_variable_exts_SPV_EXT_physical_storage_bufferSPV_KHR_physical_storage_buffer, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"PhysicalStorageBufferEXT", 5349, 1, pygen_variable_caps_PhysicalStorageBufferAddresses, 2, pygen_variable_exts_SPV_EXT_physical_storage_bufferSPV_KHR_physical_storage_buffer, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, + {"HitObjectAttributeNV", 5385, 1, pygen_variable_caps_ShaderInvocationReorderNV, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"TaskPayloadWorkgroupEXT", 5402, 1, pygen_variable_caps_MeshShadingEXT, 1, pygen_variable_exts_SPV_EXT_mesh_shader, {}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, {"CodeSectionINTEL", 5605, 1, pygen_variable_caps_FunctionPointersINTEL, 1, pygen_variable_exts_SPV_INTEL_function_pointers, {}, 0xffffffffu, 0xffffffffu}, {"DeviceOnlyINTEL", 5936, 1, pygen_variable_caps_USMStorageClassesINTEL, 1, pygen_variable_exts_SPV_INTEL_usm_storage_classes, {}, 0xffffffffu, 0xffffffffu}, @@ -530,121 +577,124 @@ static const spv_operand_desc_t pygen_variable_StorageClassEntries[] = { }; static const spv_operand_desc_t pygen_variable_DimEntries[] = { - {"1D", 0, 2, pygen_variable_caps_Sampled1DImage1D, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"2D", 1, 3, pygen_variable_caps_ShaderKernelImageMSArray, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"3D", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Cube", 3, 2, pygen_variable_caps_ShaderImageCubeArray, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rect", 4, 2, pygen_variable_caps_SampledRectImageRect, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Buffer", 5, 2, pygen_variable_caps_SampledBufferImageBuffer, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SubpassData", 6, 1, pygen_variable_caps_InputAttachment, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"1D", 0, 1, pygen_variable_caps_Sampled1D, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"2D", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"3D", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Cube", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rect", 4, 1, pygen_variable_caps_SampledRect, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Buffer", 5, 1, pygen_variable_caps_SampledBuffer, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SubpassData", 6, 1, pygen_variable_caps_InputAttachment, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TileImageDataEXT", 4173, 1, pygen_variable_caps_TileImageColorReadAccessEXT, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_SamplerAddressingModeEntries[] = { - {"None", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ClampToEdge", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Clamp", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Repeat", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RepeatMirrored", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"None", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ClampToEdge", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Clamp", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Repeat", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RepeatMirrored", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_SamplerFilterModeEntries[] = { - {"Nearest", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Linear", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"Nearest", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Linear", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_ImageFormatEntries[] = { - {"Unknown", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba32f", 1, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba16f", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R32f", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba8", 4, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba8Snorm", 5, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg32f", 6, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg16f", 7, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R11fG11fB10f", 8, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R16f", 9, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba16", 10, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgb10A2", 11, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg16", 12, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg8", 13, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R16", 14, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R8", 15, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba16Snorm", 16, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg16Snorm", 17, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg8Snorm", 18, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R16Snorm", 19, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R8Snorm", 20, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba32i", 21, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba16i", 22, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba8i", 23, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R32i", 24, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg32i", 25, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg16i", 26, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg8i", 27, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R16i", 28, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R8i", 29, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba32ui", 30, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba16ui", 31, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgba8ui", 32, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R32ui", 33, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rgb10a2ui", 34, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg32ui", 35, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg16ui", 36, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rg8ui", 37, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R16ui", 38, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R8ui", 39, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R64ui", 40, 1, pygen_variable_caps_Int64ImageEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"R64i", 41, 1, pygen_variable_caps_Int64ImageEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"Unknown", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba32f", 1, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba16f", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R32f", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba8", 4, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba8Snorm", 5, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg32f", 6, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg16f", 7, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R11fG11fB10f", 8, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R16f", 9, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba16", 10, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgb10A2", 11, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg16", 12, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg8", 13, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R16", 14, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R8", 15, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba16Snorm", 16, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg16Snorm", 17, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg8Snorm", 18, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R16Snorm", 19, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R8Snorm", 20, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba32i", 21, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba16i", 22, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba8i", 23, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R32i", 24, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg32i", 25, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg16i", 26, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg8i", 27, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R16i", 28, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R8i", 29, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba32ui", 30, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba16ui", 31, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgba8ui", 32, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R32ui", 33, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rgb10a2ui", 34, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg32ui", 35, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg16ui", 36, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rg8ui", 37, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R16ui", 38, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R8ui", 39, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R64ui", 40, 1, pygen_variable_caps_Int64ImageEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"R64i", 41, 1, pygen_variable_caps_Int64ImageEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_ImageChannelOrderEntries[] = { - {"R", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"A", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RG", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RA", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RGB", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RGBA", 5, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BGRA", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ARGB", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Intensity", 8, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Luminance", 9, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Rx", 10, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RGx", 11, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RGBx", 12, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Depth", 13, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DepthStencil", 14, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"sRGB", 15, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"sRGBx", 16, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"sRGBA", 17, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"sBGRA", 18, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ABGR", 19, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"R", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"A", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RG", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RA", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RGB", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RGBA", 5, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BGRA", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ARGB", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Intensity", 8, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Luminance", 9, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Rx", 10, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RGx", 11, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RGBx", 12, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Depth", 13, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DepthStencil", 14, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"sRGB", 15, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"sRGBx", 16, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"sRGBA", 17, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"sBGRA", 18, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ABGR", 19, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_ImageChannelDataTypeEntries[] = { - {"SnormInt8", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SnormInt16", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UnormInt8", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UnormInt16", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UnormShort565", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UnormShort555", 5, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UnormInt101010", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SignedInt8", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SignedInt16", 8, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SignedInt32", 9, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UnsignedInt8", 10, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UnsignedInt16", 11, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UnsignedInt32", 12, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"HalfFloat", 13, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Float", 14, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UnormInt24", 15, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UnormInt101010_2", 16, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"SnormInt8", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SnormInt16", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnormInt8", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnormInt16", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnormShort565", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnormShort555", 5, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnormInt101010", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SignedInt8", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SignedInt16", 8, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SignedInt32", 9, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnsignedInt8", 10, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnsignedInt16", 11, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnsignedInt32", 12, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"HalfFloat", 13, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Float", 14, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnormInt24", 15, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnormInt101010_2", 16, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnsignedIntRaw10EXT", 19, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UnsignedIntRaw12EXT", 20, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_FPRoundingModeEntries[] = { - {"RTE", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RTZ", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RTP", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"RTN", 3, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"RTE", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RTZ", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RTP", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RTN", 3, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_FPDenormModeEntries[] = { @@ -676,83 +726,97 @@ static const spv_operand_desc_t pygen_variable_OverflowModesEntries[] = { }; static const spv_operand_desc_t pygen_variable_LinkageTypeEntries[] = { - {"Export", 0, 1, pygen_variable_caps_Linkage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Import", 1, 1, pygen_variable_caps_Linkage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"Export", 0, 1, pygen_variable_caps_Linkage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Import", 1, 1, pygen_variable_caps_Linkage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"LinkOnceODR", 2, 1, pygen_variable_caps_Linkage, 1, pygen_variable_exts_SPV_KHR_linkonce_odr, {}, 0xffffffffu, 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_AccessQualifierEntries[] = { - {"ReadOnly", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"WriteOnly", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ReadWrite", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"ReadOnly", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WriteOnly", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ReadWrite", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} +}; + +static const spv_operand_desc_t pygen_variable_HostAccessQualifierEntries[] = { + {"NoneINTEL", 0, 1, pygen_variable_caps_GlobalVariableHostAccessINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"ReadINTEL", 1, 1, pygen_variable_caps_GlobalVariableHostAccessINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"WriteINTEL", 2, 1, pygen_variable_caps_GlobalVariableHostAccessINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"ReadWriteINTEL", 3, 1, pygen_variable_caps_GlobalVariableHostAccessINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_FunctionParameterAttributeEntries[] = { - {"Zext", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Sext", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ByVal", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Sret", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NoAlias", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NoCapture", 5, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NoWrite", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NoReadWrite", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"Zext", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Sext", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ByVal", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Sret", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NoAlias", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NoCapture", 5, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NoWrite", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NoReadWrite", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"RuntimeAlignedINTEL", 5940, 1, pygen_variable_caps_RuntimeAlignedAttributeINTEL, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_DecorationEntries[] = { - {"RelaxedPrecision", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SpecId", 1, 2, pygen_variable_caps_ShaderKernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Block", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BufferBlock", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), SPV_SPIRV_VERSION_WORD(1,3)}, - {"RowMajor", 4, 1, pygen_variable_caps_Matrix, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ColMajor", 5, 1, pygen_variable_caps_Matrix, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ArrayStride", 6, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MatrixStride", 7, 1, pygen_variable_caps_Matrix, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GLSLShared", 8, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GLSLPacked", 9, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CPacked", 10, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"BuiltIn", 11, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_BUILT_IN}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NoPerspective", 13, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Flat", 14, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Patch", 15, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Centroid", 16, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Sample", 17, 1, pygen_variable_caps_SampleRateShading, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Invariant", 18, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Restrict", 19, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Aliased", 20, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Volatile", 21, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Constant", 22, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Coherent", 23, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NonWritable", 24, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NonReadable", 25, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Uniform", 26, 2, pygen_variable_caps_ShaderUniformDecoration, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"RelaxedPrecision", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SpecId", 1, 2, pygen_variable_caps_ShaderKernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Block", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BufferBlock", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), SPV_SPIRV_VERSION_WORD(1,3)}, + {"RowMajor", 4, 1, pygen_variable_caps_Matrix, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ColMajor", 5, 1, pygen_variable_caps_Matrix, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ArrayStride", 6, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MatrixStride", 7, 1, pygen_variable_caps_Matrix, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GLSLShared", 8, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GLSLPacked", 9, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CPacked", 10, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"BuiltIn", 11, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_BUILT_IN}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NoPerspective", 13, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Flat", 14, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Patch", 15, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Centroid", 16, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Sample", 17, 1, pygen_variable_caps_SampleRateShading, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Invariant", 18, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Restrict", 19, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Aliased", 20, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Volatile", 21, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Constant", 22, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Coherent", 23, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NonWritable", 24, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NonReadable", 25, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Uniform", 26, 2, pygen_variable_caps_ShaderUniformDecoration, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"UniformId", 27, 2, pygen_variable_caps_ShaderUniformDecoration, 0, nullptr, {SPV_OPERAND_TYPE_SCOPE_ID}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, - {"SaturatedConversion", 28, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Stream", 29, 1, pygen_variable_caps_GeometryStreams, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Location", 30, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Component", 31, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Index", 32, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Binding", 33, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DescriptorSet", 34, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Offset", 35, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"XfbBuffer", 36, 1, pygen_variable_caps_TransformFeedback, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"XfbStride", 37, 1, pygen_variable_caps_TransformFeedback, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FuncParamAttr", 38, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FPRoundingMode", 39, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_FP_ROUNDING_MODE}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FPFastMathMode", 40, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LinkageAttributes", 41, 1, pygen_variable_caps_Linkage, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LINKAGE_TYPE}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NoContraction", 42, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InputAttachmentIndex", 43, 1, pygen_variable_caps_InputAttachment, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Alignment", 44, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"SaturatedConversion", 28, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Stream", 29, 1, pygen_variable_caps_GeometryStreams, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Location", 30, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Component", 31, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Index", 32, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Binding", 33, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DescriptorSet", 34, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Offset", 35, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"XfbBuffer", 36, 1, pygen_variable_caps_TransformFeedback, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"XfbStride", 37, 1, pygen_variable_caps_TransformFeedback, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FuncParamAttr", 38, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FPRoundingMode", 39, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_FP_ROUNDING_MODE}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FPFastMathMode", 40, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LinkageAttributes", 41, 1, pygen_variable_caps_Linkage, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LINKAGE_TYPE}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NoContraction", 42, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InputAttachmentIndex", 43, 1, pygen_variable_caps_InputAttachment, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Alignment", 44, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"MaxByteOffset", 45, 1, pygen_variable_caps_Addresses, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, {"AlignmentId", 46, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,2), 0xffffffffu}, {"MaxByteOffsetId", 47, 1, pygen_variable_caps_Addresses, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,2), 0xffffffffu}, {"NoSignedWrap", 4469, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_no_integer_wrap_decoration, {}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, {"NoUnsignedWrap", 4470, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_no_integer_wrap_decoration, {}, SPV_SPIRV_VERSION_WORD(1,4), 0xffffffffu}, + {"WeightTextureQCOM", 4487, 0, nullptr, 1, pygen_variable_exts_SPV_QCOM_image_processing, {}, 0xffffffffu, 0xffffffffu}, + {"BlockMatchTextureQCOM", 4488, 0, nullptr, 1, pygen_variable_exts_SPV_QCOM_image_processing, {}, 0xffffffffu, 0xffffffffu}, {"ExplicitInterpAMD", 4999, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu, 0xffffffffu}, + {"NodeSharesPayloadLimitsWithAMDX", 5019, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {SPV_OPERAND_TYPE_ID}, 0xffffffffu, 0xffffffffu}, + {"NodeMaxPayloadsAMDX", 5020, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {SPV_OPERAND_TYPE_ID}, 0xffffffffu, 0xffffffffu}, + {"TrackFinishWritingAMDX", 5078, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"PayloadNodeNameAMDX", 5091, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0xffffffffu, 0xffffffffu}, {"OverrideCoverageNV", 5248, 1, pygen_variable_caps_SampleMaskOverrideCoverageNV, 1, pygen_variable_exts_SPV_NV_sample_mask_override_coverage, {}, 0xffffffffu, 0xffffffffu}, {"PassthroughNV", 5250, 1, pygen_variable_caps_GeometryShaderPassthroughNV, 1, pygen_variable_exts_SPV_NV_geometry_shader_passthrough, {}, 0xffffffffu, 0xffffffffu}, {"ViewportRelativeNV", 5252, 1, pygen_variable_caps_ShaderViewportMaskNV, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, - {"SecondaryViewportRelativeNV", 5256, 1, pygen_variable_caps_ShaderStereoViewNV, 1, pygen_variable_exts_SPV_NV_stereo_view_rendering, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"SecondaryViewportRelativeNV", 5256, 1, pygen_variable_caps_ShaderStereoViewNV, 1, pygen_variable_exts_SPV_NV_stereo_view_rendering, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"PerPrimitiveNV", 5271, 2, pygen_variable_caps_MeshShadingNVMeshShadingEXT, 2, pygen_variable_exts_SPV_EXT_mesh_shaderSPV_NV_mesh_shader, {}, 0xffffffffu, 0xffffffffu}, {"PerPrimitiveEXT", 5271, 2, pygen_variable_caps_MeshShadingNVMeshShadingEXT, 2, pygen_variable_exts_SPV_EXT_mesh_shaderSPV_NV_mesh_shader, {}, 0xffffffffu, 0xffffffffu}, {"PerViewNV", 5272, 1, pygen_variable_caps_MeshShadingNV, 1, pygen_variable_exts_SPV_NV_mesh_shader, {}, 0xffffffffu, 0xffffffffu}, @@ -765,6 +829,7 @@ static const spv_operand_desc_t pygen_variable_DecorationEntries[] = { {"RestrictPointerEXT", 5355, 1, pygen_variable_caps_PhysicalStorageBufferAddresses, 2, pygen_variable_exts_SPV_EXT_physical_storage_bufferSPV_KHR_physical_storage_buffer, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"AliasedPointer", 5356, 1, pygen_variable_caps_PhysicalStorageBufferAddresses, 2, pygen_variable_exts_SPV_EXT_physical_storage_bufferSPV_KHR_physical_storage_buffer, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"AliasedPointerEXT", 5356, 1, pygen_variable_caps_PhysicalStorageBufferAddresses, 2, pygen_variable_exts_SPV_EXT_physical_storage_bufferSPV_KHR_physical_storage_buffer, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, + {"HitObjectShaderRecordBufferNV", 5386, 1, pygen_variable_caps_ShaderInvocationReorderNV, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"BindlessSamplerNV", 5398, 1, pygen_variable_caps_BindlessTextureNV, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"BindlessImageNV", 5399, 1, pygen_variable_caps_BindlessTextureNV, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"BoundSamplerNV", 5400, 1, pygen_variable_caps_BindlessTextureNV, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, @@ -803,63 +868,82 @@ static const spv_operand_desc_t pygen_variable_DecorationEntries[] = { {"PrefetchINTEL", 5902, 1, pygen_variable_caps_FPGAMemoryAccessesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, {"StallEnableINTEL", 5905, 1, pygen_variable_caps_FPGAClusterAttributesINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"FuseLoopsInFunctionINTEL", 5907, 1, pygen_variable_caps_LoopFuseINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"MathOpDSPModeINTEL", 5909, 1, pygen_variable_caps_FPGADSPControlINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, {"AliasScopeINTEL", 5914, 1, pygen_variable_caps_MemoryAccessAliasingINTEL, 0, nullptr, {SPV_OPERAND_TYPE_ID}, 0xffffffffu, 0xffffffffu}, {"NoAliasINTEL", 5915, 1, pygen_variable_caps_MemoryAccessAliasingINTEL, 0, nullptr, {SPV_OPERAND_TYPE_ID}, 0xffffffffu, 0xffffffffu}, + {"InitiationIntervalINTEL", 5917, 1, pygen_variable_caps_FPGAInvocationPipeliningAttributesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"MaxConcurrencyINTEL", 5918, 1, pygen_variable_caps_FPGAInvocationPipeliningAttributesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"PipelineEnableINTEL", 5919, 1, pygen_variable_caps_FPGAInvocationPipeliningAttributesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, {"BufferLocationINTEL", 5921, 1, pygen_variable_caps_FPGABufferLocationINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, {"IOPipeStorageINTEL", 5944, 1, pygen_variable_caps_IOPipesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, {"FunctionFloatingPointModeINTEL", 6080, 1, pygen_variable_caps_FunctionFloatControlINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_FPOPERATION_MODE}, 0xffffffffu, 0xffffffffu}, {"SingleElementVectorINTEL", 6085, 1, pygen_variable_caps_VectorComputeINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"VectorComputeCallableFunctionINTEL", 6087, 1, pygen_variable_caps_VectorComputeINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, - {"MediaBlockIOINTEL", 6140, 1, pygen_variable_caps_VectorComputeINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} + {"MediaBlockIOINTEL", 6140, 1, pygen_variable_caps_VectorComputeINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"InitModeINTEL", 6147, 1, pygen_variable_caps_GlobalVariableFPGADecorationsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_INITIALIZATION_MODE_QUALIFIER}, 0xffffffffu, 0xffffffffu}, + {"ImplementInRegisterMapINTEL", 6148, 1, pygen_variable_caps_GlobalVariableFPGADecorationsINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"HostAccessINTEL", 6168, 1, pygen_variable_caps_GlobalVariableHostAccessINTEL, 0, nullptr, {SPV_OPERAND_TYPE_HOST_ACCESS_QUALIFIER, SPV_OPERAND_TYPE_LITERAL_STRING}, 0xffffffffu, 0xffffffffu}, + {"FPMaxErrorDecorationINTEL", 6170, 1, pygen_variable_caps_FPMaxErrorINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_FLOAT}, 0xffffffffu, 0xffffffffu}, + {"LatencyControlLabelINTEL", 6172, 1, pygen_variable_caps_FPGALatencyControlINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"LatencyControlConstraintINTEL", 6173, 1, pygen_variable_caps_FPGALatencyControlINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"ConduitKernelArgumentINTEL", 6175, 1, pygen_variable_caps_FPGAArgumentInterfacesINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"RegisterMapKernelArgumentINTEL", 6176, 1, pygen_variable_caps_FPGAArgumentInterfacesINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"MMHostInterfaceAddressWidthINTEL", 6177, 1, pygen_variable_caps_FPGAArgumentInterfacesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"MMHostInterfaceDataWidthINTEL", 6178, 1, pygen_variable_caps_FPGAArgumentInterfacesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"MMHostInterfaceLatencyINTEL", 6179, 1, pygen_variable_caps_FPGAArgumentInterfacesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"MMHostInterfaceReadWriteModeINTEL", 6180, 1, pygen_variable_caps_FPGAArgumentInterfacesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_ACCESS_QUALIFIER}, 0xffffffffu, 0xffffffffu}, + {"MMHostInterfaceMaxBurstINTEL", 6181, 1, pygen_variable_caps_FPGAArgumentInterfacesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"MMHostInterfaceWaitRequestINTEL", 6182, 1, pygen_variable_caps_FPGAArgumentInterfacesINTEL, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu, 0xffffffffu}, + {"StableKernelArgumentINTEL", 6183, 1, pygen_variable_caps_FPGAArgumentInterfacesINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_BuiltInEntries[] = { - {"Position", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"PointSize", 1, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ClipDistance", 3, 1, pygen_variable_caps_ClipDistance, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CullDistance", 4, 1, pygen_variable_caps_CullDistance, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"VertexId", 5, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InstanceId", 6, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"PrimitiveId", 7, 6, pygen_variable_caps_GeometryTessellationRayTracingNVRayTracingKHRMeshShadingNVMeshShadingEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InvocationId", 8, 2, pygen_variable_caps_GeometryTessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Layer", 9, 5, pygen_variable_caps_GeometryShaderLayerShaderViewportIndexLayerEXTMeshShadingNVMeshShadingEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ViewportIndex", 10, 5, pygen_variable_caps_MultiViewportShaderViewportIndexShaderViewportIndexLayerEXTMeshShadingNVMeshShadingEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TessLevelOuter", 11, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TessLevelInner", 12, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TessCoord", 13, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"PatchVertices", 14, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FragCoord", 15, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"PointCoord", 16, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FrontFacing", 17, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SampleId", 18, 1, pygen_variable_caps_SampleRateShading, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SamplePosition", 19, 1, pygen_variable_caps_SampleRateShading, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SampleMask", 20, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"FragDepth", 22, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"HelperInvocation", 23, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NumWorkgroups", 24, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"WorkgroupSize", 25, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"WorkgroupId", 26, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LocalInvocationId", 27, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GlobalInvocationId", 28, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LocalInvocationIndex", 29, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"WorkDim", 30, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GlobalSize", 31, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"EnqueuedWorkgroupSize", 32, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GlobalOffset", 33, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GlobalLinearId", 34, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SubgroupSize", 36, 3, pygen_variable_caps_KernelGroupNonUniformSubgroupBallotKHR, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SubgroupMaxSize", 37, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NumSubgroups", 38, 2, pygen_variable_caps_KernelGroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"NumEnqueuedSubgroups", 39, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SubgroupId", 40, 2, pygen_variable_caps_KernelGroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SubgroupLocalInvocationId", 41, 3, pygen_variable_caps_KernelGroupNonUniformSubgroupBallotKHR, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"VertexIndex", 42, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InstanceIndex", 43, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CoreIDARM", 4160, 1, pygen_variable_caps_CoreBuiltinsARM, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CoreCountARM", 4161, 1, pygen_variable_caps_CoreBuiltinsARM, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CoreMaxIDARM", 4162, 1, pygen_variable_caps_CoreBuiltinsARM, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"WarpIDARM", 4163, 1, pygen_variable_caps_CoreBuiltinsARM, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"WarpMaxIDARM", 4164, 1, pygen_variable_caps_CoreBuiltinsARM, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"Position", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"PointSize", 1, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ClipDistance", 3, 1, pygen_variable_caps_ClipDistance, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CullDistance", 4, 1, pygen_variable_caps_CullDistance, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"VertexId", 5, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InstanceId", 6, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"PrimitiveId", 7, 6, pygen_variable_caps_GeometryTessellationRayTracingNVRayTracingKHRMeshShadingNVMeshShadingEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InvocationId", 8, 2, pygen_variable_caps_GeometryTessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Layer", 9, 5, pygen_variable_caps_GeometryShaderLayerShaderViewportIndexLayerEXTMeshShadingNVMeshShadingEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ViewportIndex", 10, 5, pygen_variable_caps_MultiViewportShaderViewportIndexShaderViewportIndexLayerEXTMeshShadingNVMeshShadingEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TessLevelOuter", 11, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TessLevelInner", 12, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TessCoord", 13, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"PatchVertices", 14, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FragCoord", 15, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"PointCoord", 16, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FrontFacing", 17, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SampleId", 18, 1, pygen_variable_caps_SampleRateShading, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SamplePosition", 19, 1, pygen_variable_caps_SampleRateShading, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SampleMask", 20, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"FragDepth", 22, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"HelperInvocation", 23, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NumWorkgroups", 24, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WorkgroupSize", 25, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WorkgroupId", 26, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LocalInvocationId", 27, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GlobalInvocationId", 28, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LocalInvocationIndex", 29, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WorkDim", 30, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GlobalSize", 31, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"EnqueuedWorkgroupSize", 32, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GlobalOffset", 33, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GlobalLinearId", 34, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SubgroupSize", 36, 3, pygen_variable_caps_KernelGroupNonUniformSubgroupBallotKHR, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SubgroupMaxSize", 37, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NumSubgroups", 38, 2, pygen_variable_caps_KernelGroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"NumEnqueuedSubgroups", 39, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SubgroupId", 40, 2, pygen_variable_caps_KernelGroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SubgroupLocalInvocationId", 41, 3, pygen_variable_caps_KernelGroupNonUniformSubgroupBallotKHR, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"VertexIndex", 42, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InstanceIndex", 43, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CoreIDARM", 4160, 1, pygen_variable_caps_CoreBuiltinsARM, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CoreCountARM", 4161, 1, pygen_variable_caps_CoreBuiltinsARM, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CoreMaxIDARM", 4162, 1, pygen_variable_caps_CoreBuiltinsARM, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WarpIDARM", 4163, 1, pygen_variable_caps_CoreBuiltinsARM, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WarpMaxIDARM", 4164, 1, pygen_variable_caps_CoreBuiltinsARM, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"SubgroupEqMask", 4416, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 1, pygen_variable_exts_SPV_KHR_shader_ballot, {}, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, {"SubgroupEqMaskKHR", 4416, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 1, pygen_variable_exts_SPV_KHR_shader_ballot, {}, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, {"SubgroupGeMask", 4417, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 1, pygen_variable_exts_SPV_KHR_shader_ballot, {}, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, @@ -885,6 +969,8 @@ static const spv_operand_desc_t pygen_variable_BuiltInEntries[] = { {"BaryCoordSmoothSampleAMD", 4997, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu, 0xffffffffu}, {"BaryCoordPullModelAMD", 4998, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu, 0xffffffffu}, {"FragStencilRefEXT", 5014, 1, pygen_variable_caps_StencilExportEXT, 1, pygen_variable_exts_SPV_EXT_shader_stencil_export, {}, 0xffffffffu, 0xffffffffu}, + {"CoalescedInputCountAMDX", 5021, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"ShaderIndexAMDX", 5073, 1, pygen_variable_caps_ShaderEnqueueAMDX, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"ViewportMaskNV", 5253, 2, pygen_variable_caps_ShaderViewportMaskNVMeshShadingNV, 2, pygen_variable_exts_SPV_NV_mesh_shaderSPV_NV_viewport_array2, {}, 0xffffffffu, 0xffffffffu}, {"SecondaryPositionNV", 5257, 1, pygen_variable_caps_ShaderStereoViewNV, 1, pygen_variable_exts_SPV_NV_stereo_view_rendering, {}, 0xffffffffu, 0xffffffffu}, {"SecondaryViewportMaskNV", 5258, 1, pygen_variable_caps_ShaderStereoViewNV, 1, pygen_variable_exts_SPV_NV_stereo_view_rendering, {}, 0xffffffffu, 0xffffffffu}, @@ -937,6 +1023,7 @@ static const spv_operand_desc_t pygen_variable_BuiltInEntries[] = { {"HitKindNV", 5333, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 2, pygen_variable_exts_SPV_KHR_ray_tracingSPV_NV_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, {"HitKindKHR", 5333, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 2, pygen_variable_exts_SPV_KHR_ray_tracingSPV_NV_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, {"CurrentRayTimeNV", 5334, 1, pygen_variable_caps_RayTracingMotionBlurNV, 1, pygen_variable_exts_SPV_NV_ray_tracing_motion_blur, {}, 0xffffffffu, 0xffffffffu}, + {"HitTriangleVertexPositionsKHR", 5335, 1, pygen_variable_caps_RayTracingPositionFetchKHR, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, {"IncomingRayFlagsNV", 5351, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 2, pygen_variable_exts_SPV_KHR_ray_tracingSPV_NV_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, {"IncomingRayFlagsKHR", 5351, 2, pygen_variable_caps_RayTracingNVRayTracingKHR, 2, pygen_variable_exts_SPV_KHR_ray_tracingSPV_NV_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, {"RayGeometryIndexKHR", 5352, 1, pygen_variable_caps_RayTracingKHR, 1, pygen_variable_exts_SPV_KHR_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, @@ -948,20 +1035,20 @@ static const spv_operand_desc_t pygen_variable_BuiltInEntries[] = { }; static const spv_operand_desc_t pygen_variable_ScopeEntries[] = { - {"CrossDevice", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Device", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Workgroup", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Subgroup", 3, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Invocation", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"CrossDevice", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Device", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Workgroup", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Subgroup", 3, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Invocation", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"QueueFamily", 5, 1, pygen_variable_caps_VulkanMemoryModel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"QueueFamilyKHR", 5, 1, pygen_variable_caps_VulkanMemoryModel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"ShaderCallKHR", 6, 1, pygen_variable_caps_RayTracingKHR, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_GroupOperationEntries[] = { - {"Reduce", 0, 3, pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InclusiveScan", 1, 3, pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ExclusiveScan", 2, 3, pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"Reduce", 0, 3, pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InclusiveScan", 1, 3, pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ExclusiveScan", 2, 3, pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"ClusteredReduce", 3, 1, pygen_variable_caps_GroupNonUniformClustered, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, {"PartitionedReduceNV", 6, 1, pygen_variable_caps_GroupNonUniformPartitionedNV, 1, pygen_variable_exts_SPV_NV_shader_subgroup_partitioned, {}, 0xffffffffu, 0xffffffffu}, {"PartitionedInclusiveScanNV", 7, 1, pygen_variable_caps_GroupNonUniformPartitionedNV, 1, pygen_variable_exts_SPV_NV_shader_subgroup_partitioned, {}, 0xffffffffu, 0xffffffffu}, @@ -969,68 +1056,68 @@ static const spv_operand_desc_t pygen_variable_GroupOperationEntries[] = { }; static const spv_operand_desc_t pygen_variable_KernelEnqueueFlagsEntries[] = { - {"NoWait", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"WaitKernel", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"WaitWorkGroup", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu} + {"NoWait", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WaitKernel", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"WaitWorkGroup", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu} }; static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = { - {"Matrix", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Shader", 1, 1, pygen_variable_caps_Matrix, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Geometry", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Tessellation", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Addresses", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Linkage", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Kernel", 6, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Vector16", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Float16Buffer", 8, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Float16", 9, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Float64", 10, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Int64", 11, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Int64Atomics", 12, 1, pygen_variable_caps_Int64, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageBasic", 13, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageReadWrite", 14, 1, pygen_variable_caps_ImageBasic, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageMipmap", 15, 1, pygen_variable_caps_ImageBasic, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Pipes", 17, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Groups", 18, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_ballot, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DeviceEnqueue", 19, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"LiteralSampler", 20, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"AtomicStorage", 21, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Int16", 22, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TessellationPointSize", 23, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GeometryPointSize", 24, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageGatherExtended", 25, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"StorageImageMultisample", 27, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"UniformBufferArrayDynamicIndexing", 28, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SampledImageArrayDynamicIndexing", 29, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"StorageBufferArrayDynamicIndexing", 30, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"StorageImageArrayDynamicIndexing", 31, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ClipDistance", 32, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"CullDistance", 33, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageCubeArray", 34, 1, pygen_variable_caps_SampledCubeArray, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SampleRateShading", 35, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageRect", 36, 1, pygen_variable_caps_SampledRect, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SampledRect", 37, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GenericPointer", 38, 1, pygen_variable_caps_Addresses, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Int8", 39, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InputAttachment", 40, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SparseResidency", 41, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MinLod", 42, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Sampled1D", 43, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"Image1D", 44, 1, pygen_variable_caps_Sampled1D, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SampledCubeArray", 45, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"SampledBuffer", 46, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageBuffer", 47, 1, pygen_variable_caps_SampledBuffer, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageMSArray", 48, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"StorageImageExtendedFormats", 49, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"ImageQuery", 50, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"DerivativeControl", 51, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"InterpolationFunction", 52, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"TransformFeedback", 53, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"GeometryStreams", 54, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"StorageImageReadWithoutFormat", 55, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"StorageImageWriteWithoutFormat", 56, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, - {"MultiViewport", 57, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"Matrix", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Shader", 1, 1, pygen_variable_caps_Matrix, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Geometry", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Tessellation", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Addresses", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Linkage", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Kernel", 6, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Vector16", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Float16Buffer", 8, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Float16", 9, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Float64", 10, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Int64", 11, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Int64Atomics", 12, 1, pygen_variable_caps_Int64, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageBasic", 13, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageReadWrite", 14, 1, pygen_variable_caps_ImageBasic, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageMipmap", 15, 1, pygen_variable_caps_ImageBasic, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Pipes", 17, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Groups", 18, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_ballot, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DeviceEnqueue", 19, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"LiteralSampler", 20, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"AtomicStorage", 21, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Int16", 22, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TessellationPointSize", 23, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GeometryPointSize", 24, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageGatherExtended", 25, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"StorageImageMultisample", 27, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"UniformBufferArrayDynamicIndexing", 28, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SampledImageArrayDynamicIndexing", 29, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"StorageBufferArrayDynamicIndexing", 30, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"StorageImageArrayDynamicIndexing", 31, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ClipDistance", 32, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"CullDistance", 33, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageCubeArray", 34, 1, pygen_variable_caps_SampledCubeArray, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SampleRateShading", 35, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageRect", 36, 1, pygen_variable_caps_SampledRect, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SampledRect", 37, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GenericPointer", 38, 1, pygen_variable_caps_Addresses, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Int8", 39, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InputAttachment", 40, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SparseResidency", 41, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MinLod", 42, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Sampled1D", 43, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"Image1D", 44, 1, pygen_variable_caps_Sampled1D, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SampledCubeArray", 45, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"SampledBuffer", 46, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageBuffer", 47, 1, pygen_variable_caps_SampledBuffer, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageMSArray", 48, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"StorageImageExtendedFormats", 49, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"ImageQuery", 50, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"DerivativeControl", 51, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"InterpolationFunction", 52, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"TransformFeedback", 53, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"GeometryStreams", 54, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"StorageImageReadWithoutFormat", 55, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"StorageImageWriteWithoutFormat", 56, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, + {"MultiViewport", 57, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,0), 0xffffffffu}, {"SubgroupDispatch", 58, 1, pygen_variable_caps_DeviceEnqueue, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, {"NamedBarrier", 59, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, {"PipeStorage", 60, 1, pygen_variable_caps_Pipes, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1), 0xffffffffu}, @@ -1045,7 +1132,10 @@ static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = { {"ShaderLayer", 69, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"ShaderViewportIndex", 70, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"UniformDecoration", 71, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, - {"CoreBuiltinsARM", 4165, 0, nullptr, 1, pygen_variable_exts_SPV_ARM_core_builtins, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, + {"CoreBuiltinsARM", 4165, 0, nullptr, 1, pygen_variable_exts_SPV_ARM_core_builtins, {}, 0xffffffffu, 0xffffffffu}, + {"TileImageColorReadAccessEXT", 4166, 0, nullptr, 1, pygen_variable_exts_SPV_EXT_shader_tile_image, {}, 0xffffffffu, 0xffffffffu}, + {"TileImageDepthReadAccessEXT", 4167, 0, nullptr, 1, pygen_variable_exts_SPV_EXT_shader_tile_image, {}, 0xffffffffu, 0xffffffffu}, + {"TileImageStencilReadAccessEXT", 4168, 0, nullptr, 1, pygen_variable_exts_SPV_EXT_shader_tile_image, {}, 0xffffffffu, 0xffffffffu}, {"FragmentShadingRateKHR", 4422, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_fragment_shading_rate, {}, 0xffffffffu, 0xffffffffu}, {"SubgroupBallotKHR", 4423, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_shader_ballot, {}, 0xffffffffu, 0xffffffffu}, {"DrawParameters", 4427, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_shader_draw_parameters, {}, SPV_SPIRV_VERSION_WORD(1,3), 0xffffffffu}, @@ -1077,13 +1167,17 @@ static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = { {"RayQueryKHR", 4472, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_ray_query, {}, 0xffffffffu, 0xffffffffu}, {"RayTraversalPrimitiveCullingKHR", 4478, 2, pygen_variable_caps_RayQueryKHRRayTracingKHR, 2, pygen_variable_exts_SPV_KHR_ray_querySPV_KHR_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, {"RayTracingKHR", 4479, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, + {"TextureSampleWeightedQCOM", 4484, 0, nullptr, 1, pygen_variable_exts_SPV_QCOM_image_processing, {}, 0xffffffffu, 0xffffffffu}, + {"TextureBoxFilterQCOM", 4485, 0, nullptr, 1, pygen_variable_exts_SPV_QCOM_image_processing, {}, 0xffffffffu, 0xffffffffu}, + {"TextureBlockMatchQCOM", 4486, 0, nullptr, 1, pygen_variable_exts_SPV_QCOM_image_processing, {}, 0xffffffffu, 0xffffffffu}, {"Float16ImageAMD", 5008, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_AMD_gpu_shader_half_float_fetch, {}, 0xffffffffu, 0xffffffffu}, {"ImageGatherBiasLodAMD", 5009, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_AMD_texture_gather_bias_lod, {}, 0xffffffffu, 0xffffffffu}, {"FragmentMaskAMD", 5010, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_AMD_shader_fragment_mask, {}, 0xffffffffu, 0xffffffffu}, {"StencilExportEXT", 5013, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_EXT_shader_stencil_export, {}, 0xffffffffu, 0xffffffffu}, {"ImageReadWriteLodAMD", 5015, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_AMD_shader_image_load_store_lod, {}, 0xffffffffu, 0xffffffffu}, {"Int64ImageEXT", 5016, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_EXT_shader_image_int64, {}, 0xffffffffu, 0xffffffffu}, - {"ShaderClockKHR", 5055, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_shader_clock, {}, 0xffffffffu, 0xffffffffu}, + {"ShaderClockKHR", 5055, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_shader_clock, {}, 0xffffffffu, 0xffffffffu}, + {"ShaderEnqueueAMDX", 5067, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_AMDX_shader_enqueue, {}, 0xffffffffu, 0xffffffffu}, {"SampleMaskOverrideCoverageNV", 5249, 1, pygen_variable_caps_SampleRateShading, 1, pygen_variable_exts_SPV_NV_sample_mask_override_coverage, {}, 0xffffffffu, 0xffffffffu}, {"GeometryShaderPassthroughNV", 5251, 1, pygen_variable_caps_Geometry, 1, pygen_variable_exts_SPV_NV_geometry_shader_passthrough, {}, 0xffffffffu, 0xffffffffu}, {"ShaderViewportIndexLayerEXT", 5254, 1, pygen_variable_caps_MultiViewport, 2, pygen_variable_exts_SPV_EXT_shader_viewport_index_layerSPV_NV_viewport_array2, {}, 0xffffffffu, 0xffffffffu}, @@ -1125,6 +1219,7 @@ static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = { {"UniformTexelBufferArrayNonUniformIndexingEXT", 5311, 2, pygen_variable_caps_SampledBufferShaderNonUniform, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"StorageTexelBufferArrayNonUniformIndexing", 5312, 2, pygen_variable_caps_ImageBufferShaderNonUniform, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, {"StorageTexelBufferArrayNonUniformIndexingEXT", 5312, 2, pygen_variable_caps_ImageBufferShaderNonUniform, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, + {"RayTracingPositionFetchKHR", 5336, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_ray_tracing_position_fetch, {}, 0xffffffffu, 0xffffffffu}, {"RayTracingNV", 5340, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_NV_ray_tracing, {}, 0xffffffffu, 0xffffffffu}, {"RayTracingMotionBlurNV", 5341, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_NV_ray_tracing_motion_blur, {}, 0xffffffffu, 0xffffffffu}, {"VulkanMemoryModel", 5345, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_vulkan_memory_model, {}, SPV_SPIRV_VERSION_WORD(1,5), 0xffffffffu}, @@ -1142,7 +1237,10 @@ static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = { {"FragmentShaderPixelInterlockEXT", 5378, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_EXT_fragment_shader_interlock, {}, 0xffffffffu, 0xffffffffu}, {"DemoteToHelperInvocation", 5379, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_EXT_demote_to_helper_invocation, {}, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, {"DemoteToHelperInvocationEXT", 5379, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_EXT_demote_to_helper_invocation, {}, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, + {"RayTracingOpacityMicromapEXT", 5381, 2, pygen_variable_caps_RayQueryKHRRayTracingKHR, 1, pygen_variable_exts_SPV_EXT_opacity_micromap, {}, 0xffffffffu, 0xffffffffu}, + {"ShaderInvocationReorderNV", 5383, 1, pygen_variable_caps_RayTracingKHR, 1, pygen_variable_exts_SPV_NV_shader_invocation_reorder, {}, 0xffffffffu, 0xffffffffu}, {"BindlessTextureNV", 5390, 0, nullptr, 1, pygen_variable_exts_SPV_NV_bindless_texture, {}, 0xffffffffu, 0xffffffffu}, + {"RayQueryPositionFetchKHR", 5391, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_ray_tracing_position_fetch, {}, 0xffffffffu, 0xffffffffu}, {"SubgroupShuffleINTEL", 5568, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_subgroups, {}, 0xffffffffu, 0xffffffffu}, {"SubgroupBufferBlockIOINTEL", 5569, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_subgroups, {}, 0xffffffffu, 0xffffffffu}, {"SubgroupImageBlockIOINTEL", 5570, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_subgroups, {}, 0xffffffffu, 0xffffffffu}, @@ -1175,10 +1273,13 @@ static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = { {"FPGAMemoryAccessesINTEL", 5898, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_fpga_memory_accesses, {}, 0xffffffffu, 0xffffffffu}, {"FPGAClusterAttributesINTEL", 5904, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_fpga_cluster_attributes, {}, 0xffffffffu, 0xffffffffu}, {"LoopFuseINTEL", 5906, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_loop_fuse, {}, 0xffffffffu, 0xffffffffu}, + {"FPGADSPControlINTEL", 5908, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_fpga_dsp_control, {}, 0xffffffffu, 0xffffffffu}, {"MemoryAccessAliasingINTEL", 5910, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_memory_access_aliasing, {}, 0xffffffffu, 0xffffffffu}, + {"FPGAInvocationPipeliningAttributesINTEL", 5916, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_fpga_invocation_pipelining_attributes, {}, 0xffffffffu, 0xffffffffu}, {"FPGABufferLocationINTEL", 5920, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_fpga_buffer_location, {}, 0xffffffffu, 0xffffffffu}, {"ArbitraryPrecisionFixedPointINTEL", 5922, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_arbitrary_precision_fixed_point, {}, 0xffffffffu, 0xffffffffu}, {"USMStorageClassesINTEL", 5935, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_usm_storage_classes, {}, 0xffffffffu, 0xffffffffu}, + {"RuntimeAlignedAttributeINTEL", 5939, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_runtime_aligned, {}, 0xffffffffu, 0xffffffffu}, {"IOPipesINTEL", 5943, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_io_pipes, {}, 0xffffffffu, 0xffffffffu}, {"BlockingPipesINTEL", 5945, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_blocking_pipes, {}, 0xffffffffu, 0xffffffffu}, {"FPGARegINTEL", 5948, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_fpga_reg, {}, 0xffffffffu, 0xffffffffu}, @@ -1191,6 +1292,7 @@ static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = { {"DotProduct", 6019, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, {}, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, {"DotProductKHR", 6019, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, {}, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu}, {"RayCullMaskKHR", 6020, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_ray_cull_mask, {}, 0xffffffffu, 0xffffffffu}, + {"CooperativeMatrixKHR", 6022, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_cooperative_matrix, {}, 0xffffffffu, 0xffffffffu}, {"BitInstructions", 6025, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_bit_instructions, {}, 0xffffffffu, 0xffffffffu}, {"GroupNonUniformRotateKHR", 6026, 1, pygen_variable_caps_GroupNonUniform, 1, pygen_variable_exts_SPV_KHR_subgroup_rotate, {}, 0xffffffffu, 0xffffffffu}, {"AtomicFloat32AddEXT", 6033, 0, nullptr, 1, pygen_variable_exts_SPV_EXT_shader_atomic_float_add, {}, 0xffffffffu, 0xffffffffu}, @@ -1199,7 +1301,14 @@ static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = { {"OptNoneINTEL", 6094, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_optnone, {}, 0xffffffffu, 0xffffffffu}, {"AtomicFloat16AddEXT", 6095, 0, nullptr, 1, pygen_variable_exts_SPV_EXT_shader_atomic_float16_add, {}, 0xffffffffu, 0xffffffffu}, {"DebugInfoModuleINTEL", 6114, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_debug_module, {}, 0xffffffffu, 0xffffffffu}, + {"BFloat16ConversionINTEL", 6115, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_bfloat16_conversion, {}, 0xffffffffu, 0xffffffffu}, {"SplitBarrierINTEL", 6141, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_split_barrier, {}, 0xffffffffu, 0xffffffffu}, + {"GlobalVariableFPGADecorationsINTEL", 6146, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_global_variable_fpga_decorations, {}, 0xffffffffu, 0xffffffffu}, + {"FPGAKernelAttributesv2INTEL", 6161, 1, pygen_variable_caps_FPGAKernelAttributesINTEL, 1, pygen_variable_exts_SPV_INTEL_kernel_attributes, {}, 0xffffffffu, 0xffffffffu}, + {"GlobalVariableHostAccessINTEL", 6167, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_global_variable_host_access, {}, 0xffffffffu, 0xffffffffu}, + {"FPMaxErrorINTEL", 6169, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_fp_max_error, {}, 0xffffffffu, 0xffffffffu}, + {"FPGALatencyControlINTEL", 6171, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_fpga_latency_control, {}, 0xffffffffu, 0xffffffffu}, + {"FPGAArgumentInterfacesINTEL", 6174, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_fpga_argument_interfaces, {}, 0xffffffffu, 0xffffffffu}, {"GroupUniformArithmeticKHR", 6400, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_uniform_group_instructions, {}, 0xffffffffu, 0xffffffffu} }; @@ -1224,6 +1333,31 @@ static const spv_operand_desc_t pygen_variable_PackedVectorFormatEntries[] = { {"PackedVectorFormat4x8BitKHR", 0, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_integer_dot_product, {}, SPV_SPIRV_VERSION_WORD(1,6), 0xffffffffu} }; +static const spv_operand_desc_t pygen_variable_CooperativeMatrixOperandsEntries[] = { + {"NoneKHR", 0x0000, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"MatrixASignedComponentsKHR", 0x0001, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"MatrixBSignedComponentsKHR", 0x0002, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"MatrixCSignedComponentsKHR", 0x0004, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"MatrixResultSignedComponentsKHR", 0x0008, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"SaturatingAccumulationKHR", 0x0010, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} +}; + +static const spv_operand_desc_t pygen_variable_CooperativeMatrixLayoutEntries[] = { + {"RowMajorKHR", 0, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"ColumnMajorKHR", 1, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} +}; + +static const spv_operand_desc_t pygen_variable_CooperativeMatrixUseEntries[] = { + {"MatrixAKHR", 0, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"MatrixBKHR", 1, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"MatrixAccumulatorKHR", 2, 0, nullptr, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} +}; + +static const spv_operand_desc_t pygen_variable_InitializationModeQualifierEntries[] = { + {"InitOnDeviceReprogramINTEL", 0, 1, pygen_variable_caps_GlobalVariableFPGADecorationsINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu}, + {"InitOnDeviceResetINTEL", 1, 1, pygen_variable_caps_GlobalVariableFPGADecorationsINTEL, 0, nullptr, {}, 0xffffffffu, 0xffffffffu} +}; + static const spv_operand_desc_t pygen_variable_DebugInfoFlagsEntries[] = { {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, {"FlagIsProtected", 0x01, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0), 0xffffffffu}, @@ -1372,6 +1506,7 @@ static const spv_operand_desc_group_t pygen_variable_OperandInfoTable[] = { {SPV_OPERAND_TYPE_OVERFLOW_MODES, ARRAY_SIZE(pygen_variable_OverflowModesEntries), pygen_variable_OverflowModesEntries}, {SPV_OPERAND_TYPE_LINKAGE_TYPE, ARRAY_SIZE(pygen_variable_LinkageTypeEntries), pygen_variable_LinkageTypeEntries}, {SPV_OPERAND_TYPE_ACCESS_QUALIFIER, ARRAY_SIZE(pygen_variable_AccessQualifierEntries), pygen_variable_AccessQualifierEntries}, + {SPV_OPERAND_TYPE_HOST_ACCESS_QUALIFIER, ARRAY_SIZE(pygen_variable_HostAccessQualifierEntries), pygen_variable_HostAccessQualifierEntries}, {SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, ARRAY_SIZE(pygen_variable_FunctionParameterAttributeEntries), pygen_variable_FunctionParameterAttributeEntries}, {SPV_OPERAND_TYPE_DECORATION, ARRAY_SIZE(pygen_variable_DecorationEntries), pygen_variable_DecorationEntries}, {SPV_OPERAND_TYPE_BUILT_IN, ARRAY_SIZE(pygen_variable_BuiltInEntries), pygen_variable_BuiltInEntries}, @@ -1383,6 +1518,10 @@ static const spv_operand_desc_group_t pygen_variable_OperandInfoTable[] = { {SPV_OPERAND_TYPE_RAY_QUERY_COMMITTED_INTERSECTION_TYPE, ARRAY_SIZE(pygen_variable_RayQueryCommittedIntersectionTypeEntries), pygen_variable_RayQueryCommittedIntersectionTypeEntries}, {SPV_OPERAND_TYPE_RAY_QUERY_CANDIDATE_INTERSECTION_TYPE, ARRAY_SIZE(pygen_variable_RayQueryCandidateIntersectionTypeEntries), pygen_variable_RayQueryCandidateIntersectionTypeEntries}, {SPV_OPERAND_TYPE_PACKED_VECTOR_FORMAT, ARRAY_SIZE(pygen_variable_PackedVectorFormatEntries), pygen_variable_PackedVectorFormatEntries}, + {SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_OPERANDS, ARRAY_SIZE(pygen_variable_CooperativeMatrixOperandsEntries), pygen_variable_CooperativeMatrixOperandsEntries}, + {SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_LAYOUT, ARRAY_SIZE(pygen_variable_CooperativeMatrixLayoutEntries), pygen_variable_CooperativeMatrixLayoutEntries}, + {SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_USE, ARRAY_SIZE(pygen_variable_CooperativeMatrixUseEntries), pygen_variable_CooperativeMatrixUseEntries}, + {SPV_OPERAND_TYPE_INITIALIZATION_MODE_QUALIFIER, ARRAY_SIZE(pygen_variable_InitializationModeQualifierEntries), pygen_variable_InitializationModeQualifierEntries}, {SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, ARRAY_SIZE(pygen_variable_DebugInfoFlagsEntries), pygen_variable_DebugInfoFlagsEntries}, {SPV_OPERAND_TYPE_DEBUG_BASE_TYPE_ATTRIBUTE_ENCODING, ARRAY_SIZE(pygen_variable_DebugBaseTypeAttributeEncodingEntries), pygen_variable_DebugBaseTypeAttributeEncodingEntries}, {SPV_OPERAND_TYPE_DEBUG_COMPOSITE_TYPE, ARRAY_SIZE(pygen_variable_DebugCompositeTypeEntries), pygen_variable_DebugCompositeTypeEntries}, @@ -1397,5 +1536,6 @@ static const spv_operand_desc_group_t pygen_variable_OperandInfoTable[] = { {SPV_OPERAND_TYPE_OPTIONAL_IMAGE, ARRAY_SIZE(pygen_variable_ImageOperandsEntries), pygen_variable_ImageOperandsEntries}, {SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, ARRAY_SIZE(pygen_variable_MemoryAccessEntries), pygen_variable_MemoryAccessEntries}, {SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER, ARRAY_SIZE(pygen_variable_AccessQualifierEntries), pygen_variable_AccessQualifierEntries}, - {SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT, ARRAY_SIZE(pygen_variable_PackedVectorFormatEntries), pygen_variable_PackedVectorFormatEntries} + {SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT, ARRAY_SIZE(pygen_variable_PackedVectorFormatEntries), pygen_variable_PackedVectorFormatEntries}, + {SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS, ARRAY_SIZE(pygen_variable_CooperativeMatrixOperandsEntries), pygen_variable_CooperativeMatrixOperandsEntries} }; \ No newline at end of file diff --git a/bgfx/3rdparty/spirv-tools/include/spirv-tools/instrument.hpp b/bgfx/3rdparty/spirv-tools/include/spirv-tools/instrument.hpp index a19491fd..34e169a9 100644 --- a/bgfx/3rdparty/spirv-tools/include/spirv-tools/instrument.hpp +++ b/bgfx/3rdparty/spirv-tools/include/spirv-tools/instrument.hpp @@ -36,16 +36,25 @@ namespace spvtools { // generated by InstrumentPass::GenDebugStreamWrite. This method is utilized // by InstBindlessCheckPass, InstBuffAddrCheckPass, and InstDebugPrintfPass. // -// The first member of the debug output buffer contains the next available word +// The 1st member of the debug output buffer contains a set of flags +// controlling the behavior of instrumentation code. +static const int kDebugOutputFlagsOffset = 0; + +// Values stored at kDebugOutputFlagsOffset +enum kInstFlags : unsigned int { + kInstBufferOOBEnable = 0x1, +}; + +// The 2nd member of the debug output buffer contains the next available word // in the data stream to be written. Shaders will atomically read and update // this value so as not to overwrite each others records. This value must be // initialized to zero -static const int kDebugOutputSizeOffset = 0; +static const int kDebugOutputSizeOffset = 1; -// The second member of the output buffer is the start of the stream of records +// The 3rd member of the output buffer is the start of the stream of records // written by the instrumented shaders. Each record represents a validation // error. The format of the records is documented below. -static const int kDebugOutputDataOffset = 1; +static const int kDebugOutputDataOffset = 2; // Common Stream Record Offsets // @@ -137,23 +146,29 @@ static const int kInstValidationOutError = kInstStageOutCnt; // about the validation error. // // A bindless bounds error will output the index and the bound. -static const int kInstBindlessBoundsOutDescIndex = kInstStageOutCnt + 1; -static const int kInstBindlessBoundsOutDescBound = kInstStageOutCnt + 2; -static const int kInstBindlessBoundsOutUnused = kInstStageOutCnt + 3; -static const int kInstBindlessBoundsOutCnt = kInstStageOutCnt + 4; +static const int kInstBindlessBoundsOutDescSet = kInstStageOutCnt + 1; +static const int kInstBindlessBoundsOutDescBinding = kInstStageOutCnt + 2; +static const int kInstBindlessBoundsOutDescIndex = kInstStageOutCnt + 3; +static const int kInstBindlessBoundsOutDescBound = kInstStageOutCnt + 4; +static const int kInstBindlessBoundsOutUnused = kInstStageOutCnt + 5; +static const int kInstBindlessBoundsOutCnt = kInstStageOutCnt + 6; // A descriptor uninitialized error will output the index. -static const int kInstBindlessUninitOutDescIndex = kInstStageOutCnt + 1; -static const int kInstBindlessUninitOutUnused = kInstStageOutCnt + 2; -static const int kInstBindlessUninitOutUnused2 = kInstStageOutCnt + 3; -static const int kInstBindlessUninitOutCnt = kInstStageOutCnt + 4; +static const int kInstBindlessUninitOutDescSet = kInstStageOutCnt + 1; +static const int kInstBindlessUninitOutBinding = kInstStageOutCnt + 2; +static const int kInstBindlessUninitOutDescIndex = kInstStageOutCnt + 3; +static const int kInstBindlessUninitOutUnused = kInstStageOutCnt + 4; +static const int kInstBindlessUninitOutUnused2 = kInstStageOutCnt + 5; +static const int kInstBindlessUninitOutCnt = kInstStageOutCnt + 6; // A buffer out-of-bounds error will output the descriptor // index, the buffer offset and the buffer size -static const int kInstBindlessBuffOOBOutDescIndex = kInstStageOutCnt + 1; -static const int kInstBindlessBuffOOBOutBuffOff = kInstStageOutCnt + 2; -static const int kInstBindlessBuffOOBOutBuffSize = kInstStageOutCnt + 3; -static const int kInstBindlessBuffOOBOutCnt = kInstStageOutCnt + 4; +static const int kInstBindlessBuffOOBOutDescSet = kInstStageOutCnt + 1; +static const int kInstBindlessBuffOOBOutDescBinding = kInstStageOutCnt + 2; +static const int kInstBindlessBuffOOBOutDescIndex = kInstStageOutCnt + 3; +static const int kInstBindlessBuffOOBOutBuffOff = kInstStageOutCnt + 4; +static const int kInstBindlessBuffOOBOutBuffSize = kInstStageOutCnt + 5; +static const int kInstBindlessBuffOOBOutCnt = kInstStageOutCnt + 6; // A buffer address unalloc error will output the 64-bit pointer in // two 32-bit pieces, lower bits first. @@ -162,23 +177,16 @@ static const int kInstBuffAddrUnallocOutDescPtrHi = kInstStageOutCnt + 2; static const int kInstBuffAddrUnallocOutCnt = kInstStageOutCnt + 3; // Maximum Output Record Member Count -static const int kInstMaxOutCnt = kInstStageOutCnt + 4; +static const int kInstMaxOutCnt = kInstStageOutCnt + 6; // Validation Error Codes // // These are the possible validation error codes. -static const int kInstErrorBindlessBounds = 0; -static const int kInstErrorBindlessUninit = 1; -static const int kInstErrorBuffAddrUnallocRef = 2; -// Deleted: static const int kInstErrorBindlessBuffOOB = 3; -// This comment will will remain for 2 releases to allow -// for the transition of all builds. Buffer OOB is -// generating the following four differentiated codes instead: -static const int kInstErrorBuffOOBUniform = 4; -static const int kInstErrorBuffOOBStorage = 5; -static const int kInstErrorBuffOOBUniformTexel = 6; -static const int kInstErrorBuffOOBStorageTexel = 7; -static const int kInstErrorMax = kInstErrorBuffOOBStorageTexel; +static const int kInstErrorBindlessBounds = 1; +static const int kInstErrorBindlessUninit = 2; +static const int kInstErrorBuffAddrUnallocRef = 3; +static const int kInstErrorOOB = 4; +static const int kInstErrorMax = kInstErrorOOB; // Direct Input Buffer Offsets // @@ -208,26 +216,37 @@ static const int kDebugInputBindingBuffAddr = 2; // This is the output buffer written by InstDebugPrintfPass. static const int kDebugOutputPrintfStream = 3; +// clang-format off // Bindless Validation Input Buffer Format // -// An input buffer for bindless validation consists of a single array of -// unsigned integers we will call Data[]. This array is formatted as follows. -// -// At offset kDebugInputBindlessInitOffset in Data[] is a single uint which -// gives an offset to the start of the bindless initialization data. More -// specifically, if the following value is zero, we know that the descriptor at -// (set = s, binding = b, index = i) is not initialized; if the value is -// non-zero, and the descriptor points to a buffer, the value is the length of -// the buffer in bytes and can be used to check for out-of-bounds buffer -// references: -// Data[ i + Data[ b + Data[ s + Data[ kDebugInputBindlessInitOffset ] ] ] ] -static const int kDebugInputBindlessInitOffset = 0; - -// At offset kDebugInputBindlessOffsetLengths is some number of uints which -// provide the bindless length data. More specifically, the number of -// descriptors at (set=s, binding=b) is: -// Data[ Data[ s + kDebugInputBindlessOffsetLengths ] + b ] -static const int kDebugInputBindlessOffsetLengths = 1; +// An input buffer for bindless validation has this structure: +// GLSL: +// layout(buffer_reference, std430, buffer_reference_align = 8) buffer DescriptorSetData { +// uint num_bindings; +// uint data[]; +// }; +// +// layout(set = 7, binding = 1, std430) buffer inst_bindless_InputBuffer +// { +// DescriptorSetData desc_sets[32]; +// } inst_bindless_input_buffer; +// +// +// To look up the length of a binding: +// uint length = inst_bindless_input_buffer[set].data[binding]; +// Scalar bindings have a length of 1. +// +// To look up the initialization state of a descriptor in a binding: +// uint num_bindings = inst_bindless_input_buffer[set].num_bindings; +// uint binding_state_start = inst_bindless_input_buffer[set].data[num_bindings + binding]; +// uint init_state = inst_bindless_input_buffer[set].data[binding_state_start + index]; +// +// For scalar bindings, use 0 for the index. +// clang-format on +// +// The size of the inst_bindless_input_buffer array, regardless of how many +// descriptor sets the device supports. +static const int kDebugInputBindlessMaxDescSets = 32; // Buffer Device Address Input Buffer Format // diff --git a/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.h b/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.h index 1643b5a9..9010a381 100644 --- a/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.h +++ b/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.h @@ -143,6 +143,7 @@ typedef enum spv_operand_type_t { // may be larger than 32, which would require such a typed literal value to // occupy multiple SPIR-V words. SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, + SPV_OPERAND_TYPE_LITERAL_FLOAT, // Always 32-bit float. // Set 3: The literal string operand type. SPV_OPERAND_TYPE_LITERAL_STRING, @@ -286,6 +287,18 @@ typedef enum spv_operand_type_t { // An optional packed vector format SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT, + // Concrete operand types for cooperative matrix. + SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_OPERANDS, + // An optional cooperative matrix operands + SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS, + SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_LAYOUT, + SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_USE, + + // Enum type from SPV_INTEL_global_variable_fpga_decorations + SPV_OPERAND_TYPE_INITIALIZATION_MODE_QUALIFIER, + // Enum type from SPV_INTEL_global_variable_host_access + SPV_OPERAND_TYPE_HOST_ACCESS_QUALIFIER, + // This is a sentinel value, and does not represent an operand type. // It should come last. SPV_OPERAND_TYPE_NUM_OPERAND_TYPES, @@ -403,6 +416,19 @@ typedef struct spv_parsed_instruction_t { uint16_t num_operands; } spv_parsed_instruction_t; +typedef struct spv_parsed_header_t { + // The magic number of the SPIR-V module. + uint32_t magic; + // Version number. + uint32_t version; + // Generator's magic number. + uint32_t generator; + // IDs bound for this module (0 < id < bound). + uint32_t bound; + // reserved. + uint32_t reserved; +} spv_parsed_header_t; + typedef struct spv_const_binary_t { const uint32_t* code; const size_t wordCount; @@ -442,6 +468,8 @@ typedef struct spv_reducer_options_t spv_reducer_options_t; typedef struct spv_fuzzer_options_t spv_fuzzer_options_t; +typedef struct spv_optimizer_t spv_optimizer_t; + // Type Definitions typedef spv_const_binary_t* spv_const_binary; @@ -901,6 +929,63 @@ SPIRV_TOOLS_EXPORT spv_result_t spvBinaryParse( const size_t num_words, spv_parsed_header_fn_t parse_header, spv_parsed_instruction_fn_t parse_instruction, spv_diagnostic* diagnostic); +// The optimizer interface. + +// A pointer to a function that accepts a log message from an optimizer. +typedef void (*spv_message_consumer)( + spv_message_level_t, const char*, const spv_position_t*, const char*); + +// Creates and returns an optimizer object. This object must be passed to +// optimizer APIs below and is valid until passed to spvOptimizerDestroy. +SPIRV_TOOLS_EXPORT spv_optimizer_t* spvOptimizerCreate(spv_target_env env); + +// Destroys the given optimizer object. +SPIRV_TOOLS_EXPORT void spvOptimizerDestroy(spv_optimizer_t* optimizer); + +// Sets an spv_message_consumer on an optimizer object. +SPIRV_TOOLS_EXPORT void spvOptimizerSetMessageConsumer( + spv_optimizer_t* optimizer, spv_message_consumer consumer); + +// Registers passes that attempt to legalize the generated code. +SPIRV_TOOLS_EXPORT void spvOptimizerRegisterLegalizationPasses( + spv_optimizer_t* optimizer); + +// Registers passes that attempt to improve performance of generated code. +SPIRV_TOOLS_EXPORT void spvOptimizerRegisterPerformancePasses( + spv_optimizer_t* optimizer); + +// Registers passes that attempt to improve the size of generated code. +SPIRV_TOOLS_EXPORT void spvOptimizerRegisterSizePasses( + spv_optimizer_t* optimizer); + +// Registers a pass specified by a flag in an optimizer object. +SPIRV_TOOLS_EXPORT bool spvOptimizerRegisterPassFromFlag( + spv_optimizer_t* optimizer, const char* flag); + +// Registers passes specified by length number of flags in an optimizer object. +SPIRV_TOOLS_EXPORT bool spvOptimizerRegisterPassesFromFlags( + spv_optimizer_t* optimizer, const char** flags, const size_t flag_count); + +// Optimizes the SPIR-V code of size |word_count| pointed to by |binary| and +// returns an optimized spv_binary in |optimized_binary|. +// +// Returns SPV_SUCCESS on successful optimization, whether or not the module is +// modified. Returns an SPV_ERROR_* if the module fails to validate or if +// errors occur when processing using any of the registered passes. In that +// case, no further passes are executed and the |optimized_binary| contents may +// be invalid. +// +// By default, the binary is validated before any transforms are performed, +// and optionally after each transform. Validation uses SPIR-V spec rules +// for the SPIR-V version named in the binary's header (at word offset 1). +// Additionally, if the target environment is a client API (such as +// Vulkan 1.1), then validate for that client API version, to the extent +// that it is verifiable from data in the binary itself, or from the +// validator options set on the optimizer options. +SPIRV_TOOLS_EXPORT spv_result_t spvOptimizerRun( + spv_optimizer_t* optimizer, const uint32_t* binary, const size_t word_count, + spv_binary* optimized_binary, const spv_optimizer_options options); + #ifdef __cplusplus } #endif diff --git a/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.hpp b/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.hpp index 408e3ebb..ee6c8469 100644 --- a/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.hpp +++ b/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.hpp @@ -31,6 +31,11 @@ using MessageConsumer = std::function; +using HeaderParser = std::function; +using InstructionParser = + std::function; + // C++ RAII wrapper around the C context object spv_context. class Context { public: @@ -336,6 +341,23 @@ class SpirvTools { std::string* text, uint32_t options = kDefaultDisassembleOption) const; + // Parses a SPIR-V binary, specified as counted sequence of 32-bit words. + // Parsing feedback is provided via two callbacks provided as std::function. + // In a valid parse the parsed-header callback is called once, and + // then the parsed-instruction callback is called once for each instruction + // in the stream. + // Returns true on successful parsing. + // If diagnostic is non-null, a diagnostic is emitted on failed parsing. + // If diagnostic is null the context's message consumer + // will be used to emit any errors. If a callback returns anything other than + // SPV_SUCCESS, then that status code is returned, no further callbacks are + // issued, and no additional diagnostics are emitted. + // This is a wrapper around the C API spvBinaryParse. + bool Parse(const std::vector& binary, + const HeaderParser& header_parser, + const InstructionParser& instruction_parser, + spv_diagnostic* diagnostic = nullptr); + // Validates the given SPIR-V |binary|. Returns true if no issues are found. // Otherwise, returns false and communicates issues via the message consumer // registered. diff --git a/bgfx/3rdparty/spirv-tools/include/spirv-tools/linker.hpp b/bgfx/3rdparty/spirv-tools/include/spirv-tools/linker.hpp index d2f3e72c..5b60cb9f 100644 --- a/bgfx/3rdparty/spirv-tools/include/spirv-tools/linker.hpp +++ b/bgfx/3rdparty/spirv-tools/include/spirv-tools/linker.hpp @@ -26,11 +26,6 @@ namespace spvtools { class LinkerOptions { public: - LinkerOptions() - : create_library_(false), - verify_ids_(false), - allow_partial_linkage_(false) {} - // Returns whether a library or an executable should be produced by the // linking phase. // @@ -63,10 +58,16 @@ class LinkerOptions { allow_partial_linkage_ = allow_partial_linkage; } + bool GetUseHighestVersion() const { return use_highest_version_; } + void SetUseHighestVersion(bool use_highest_vers) { + use_highest_version_ = use_highest_vers; + } + private: - bool create_library_; - bool verify_ids_; - bool allow_partial_linkage_; + bool create_library_{false}; + bool verify_ids_{false}; + bool allow_partial_linkage_{false}; + bool use_highest_version_{false}; }; // Links one or more SPIR-V modules into a new SPIR-V module. That is, combine diff --git a/bgfx/3rdparty/spirv-tools/include/spirv-tools/optimizer.hpp b/bgfx/3rdparty/spirv-tools/include/spirv-tools/optimizer.hpp index 94973560..260fa72c 100644 --- a/bgfx/3rdparty/spirv-tools/include/spirv-tools/optimizer.hpp +++ b/bgfx/3rdparty/spirv-tools/include/spirv-tools/optimizer.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -96,12 +97,24 @@ class Optimizer { // Registers passes that attempt to improve performance of generated code. // This sequence of passes is subject to constant review and will change // from time to time. + // + // If |preserve_interface| is true, all non-io variables in the entry point + // interface are considered live and are not eliminated. + // |preserve_interface| should be true if HLSL is generated + // from the SPIR-V bytecode. Optimizer& RegisterPerformancePasses(); + Optimizer& RegisterPerformancePasses(bool preserve_interface); // Registers passes that attempt to improve the size of generated code. // This sequence of passes is subject to constant review and will change // from time to time. + // + // If |preserve_interface| is true, all non-io variables in the entry point + // interface are considered live and are not eliminated. + // |preserve_interface| should be true if HLSL is generated + // from the SPIR-V bytecode. Optimizer& RegisterSizePasses(); + Optimizer& RegisterSizePasses(bool preserve_interface); // Registers passes that attempt to legalize the generated code. // @@ -111,7 +124,13 @@ class Optimizer { // // This sequence of passes is subject to constant review and will change // from time to time. + // + // If |preserve_interface| is true, all non-io variables in the entry point + // interface are considered live and are not eliminated. + // |preserve_interface| should be true if HLSL is generated + // from the SPIR-V bytecode. Optimizer& RegisterLegalizationPasses(); + Optimizer& RegisterLegalizationPasses(bool preserve_interface); // Register passes specified in the list of |flags|. Each flag must be a // string of a form accepted by Optimizer::FlagHasValidForm(). @@ -520,8 +539,14 @@ Optimizer::PassToken CreateDeadInsertElimPass(); // interface are considered live and are not eliminated. This mode is needed // by GPU-Assisted validation instrumentation, where a change in the interface // is not allowed. +// +// If |remove_outputs| is true, allow outputs to be removed from the interface. +// This is only safe if the caller knows that there is no corresponding input +// variable in the following shader. It is false by default. Optimizer::PassToken CreateAggressiveDCEPass(); Optimizer::PassToken CreateAggressiveDCEPass(bool preserve_interface); +Optimizer::PassToken CreateAggressiveDCEPass(bool preserve_interface, + bool remove_outputs); // Creates a remove-unused-interface-variables pass. // Removes variables referenced on the |OpEntryPoint| instruction that are not @@ -744,16 +769,8 @@ Optimizer::PassToken CreateCombineAccessChainsPass(); // The instrumentation will read and write buffers in debug // descriptor set |desc_set|. It will write |shader_id| in each output record // to identify the shader module which generated the record. -// |desc_length_enable| controls instrumentation of runtime descriptor array -// references, |desc_init_enable| controls instrumentation of descriptor -// initialization checking, and |buff_oob_enable| controls instrumentation -// of storage and uniform buffer bounds checking, all of which require input -// buffer support. |texbuff_oob_enable| controls instrumentation of texel -// buffers, which does not require input buffer support. -Optimizer::PassToken CreateInstBindlessCheckPass( - uint32_t desc_set, uint32_t shader_id, bool desc_length_enable = false, - bool desc_init_enable = false, bool buff_oob_enable = false, - bool texbuff_oob_enable = false); +Optimizer::PassToken CreateInstBindlessCheckPass(uint32_t desc_set, + uint32_t shader_id); // Create a pass to instrument physical buffer address checking // This pass instruments all physical buffer address references to check that @@ -887,12 +904,59 @@ Optimizer::PassToken CreateAmdExtToKhrPass(); Optimizer::PassToken CreateInterpolateFixupPass(); // Removes unused components from composite input variables. Current -// implementation just removes trailing unused components from input arrays. -// The pass performs best after maximizing dead code removal. A subsequent dead -// code elimination pass would be beneficial in removing newly unused component -// types. +// implementation just removes trailing unused components from input arrays +// and structs. The pass performs best after maximizing dead code removal. +// A subsequent dead code elimination pass would be beneficial in removing +// newly unused component types. +// +// WARNING: This pass can only be safely applied standalone to vertex shaders +// as it can otherwise cause interface incompatibilities with the preceding +// shader in the pipeline. If applied to non-vertex shaders, the user should +// follow by applying EliminateDeadOutputStores and +// EliminateDeadOutputComponents to the preceding shader. Optimizer::PassToken CreateEliminateDeadInputComponentsPass(); +// Removes unused components from composite output variables. Current +// implementation just removes trailing unused components from output arrays +// and structs. The pass performs best after eliminating dead output stores. +// A subsequent dead code elimination pass would be beneficial in removing +// newly unused component types. Currently only supports vertex and fragment +// shaders. +// +// WARNING: This pass cannot be safely applied standalone as it can cause +// interface incompatibility with the following shader in the pipeline. The +// user should first apply EliminateDeadInputComponents to the following +// shader, then apply EliminateDeadOutputStores to this shader. +Optimizer::PassToken CreateEliminateDeadOutputComponentsPass(); + +// Removes unused components from composite input variables. This safe +// version will not cause interface incompatibilities since it only changes +// vertex shaders. The current implementation just removes trailing unused +// components from input structs and input arrays. The pass performs best +// after maximizing dead code removal. A subsequent dead code elimination +// pass would be beneficial in removing newly unused component types. +Optimizer::PassToken CreateEliminateDeadInputComponentsSafePass(); + +// Analyzes shader and populates |live_locs| and |live_builtins|. Best results +// will be obtained if shader has all dead code eliminated first. |live_locs| +// and |live_builtins| are subsequently used when calling +// CreateEliminateDeadOutputStoresPass on the preceding shader. Currently only +// supports tesc, tese, geom, and frag shaders. +Optimizer::PassToken CreateAnalyzeLiveInputPass( + std::unordered_set* live_locs, + std::unordered_set* live_builtins); + +// Removes stores to output locations not listed in |live_locs| or +// |live_builtins|. Best results are obtained if constant propagation is +// performed first. A subsequent call to ADCE will eliminate any dead code +// created by the removal of the stores. A subsequent call to +// CreateEliminateDeadOutputComponentsPass will eliminate any dead output +// components created by the elimination of the stores. Currently only supports +// vert, tesc, tese, and geom shaders. +Optimizer::PassToken CreateEliminateDeadOutputStoresPass( + std::unordered_set* live_locs, + std::unordered_set* live_builtins); + // Creates a convert-to-sampled-image pass to convert images and/or // samplers with given pairs of descriptor set and binding to sampled image. // If a pair of an image and a sampler have the same pair of descriptor set and @@ -917,6 +981,22 @@ Optimizer::PassToken CreateRemoveDontInlinePass(); // object, currently the pass would remove accesschain pointer argument passed // to the function Optimizer::PassToken CreateFixFuncCallArgumentsPass(); + +// Creates a trim-capabilities pass. +// This pass removes unused capabilities for a given module, and if possible, +// associated extensions. +// See `trim_capabilities.h` for the list of supported capabilities. +// +// If the module contains unsupported capabilities, this pass will ignore them. +// This should be fine in most cases, but could yield to incorrect results if +// the unknown capability interacts with one of the trimmed capabilities. +Optimizer::PassToken CreateTrimCapabilitiesPass(); + +// Creates a switch-descriptorset pass. +// This pass changes any DescriptorSet decorations with the value |ds_from| to +// use the new value |ds_to|. +Optimizer::PassToken CreateSwitchDescriptorSetPass(uint32_t ds_from, + uint32_t ds_to); } // namespace spvtools #endif // INCLUDE_SPIRV_TOOLS_OPTIMIZER_HPP_ diff --git a/bgfx/3rdparty/spirv-tools/source/assembly_grammar.cpp b/bgfx/3rdparty/spirv-tools/source/assembly_grammar.cpp index 4f5942ab..0092d01a 100644 --- a/bgfx/3rdparty/spirv-tools/source/assembly_grammar.cpp +++ b/bgfx/3rdparty/spirv-tools/source/assembly_grammar.cpp @@ -21,6 +21,7 @@ #include "source/ext_inst.h" #include "source/opcode.h" #include "source/operand.h" +#include "source/spirv_target_env.h" #include "source/table.h" namespace spvtools { @@ -78,16 +79,16 @@ spv_result_t spvTextParseMaskOperand(spv_target_env env, // Associates an opcode with its name. struct SpecConstantOpcodeEntry { - SpvOp opcode; + spv::Op opcode; const char* name; }; // All the opcodes allowed as the operation for OpSpecConstantOp. -// The name does not have the usual "Op" prefix. For example opcode SpvOpIAdd -// is associated with the name "IAdd". +// The name does not have the usual "Op" prefix. For example opcode +// spv::Op::IAdd is associated with the name "IAdd". // // clang-format off -#define CASE(NAME) { SpvOp##NAME, #NAME } +#define CASE(NAME) { spv::Op::Op##NAME, #NAME } const SpecConstantOpcodeEntry kOpSpecConstantOpcodes[] = { // Conversion CASE(SConvert), @@ -154,11 +155,12 @@ const SpecConstantOpcodeEntry kOpSpecConstantOpcodes[] = { CASE(InBoundsAccessChain), CASE(PtrAccessChain), CASE(InBoundsPtrAccessChain), - CASE(CooperativeMatrixLengthNV) + CASE(CooperativeMatrixLengthNV), + CASE(CooperativeMatrixLengthKHR) }; // The 60 is determined by counting the opcodes listed in the spec. -static_assert(60 == sizeof(kOpSpecConstantOpcodes)/sizeof(kOpSpecConstantOpcodes[0]), +static_assert(61 == sizeof(kOpSpecConstantOpcodes)/sizeof(kOpSpecConstantOpcodes[0]), "OpSpecConstantOp opcode table is incomplete"); #undef CASE // clang-format on @@ -173,17 +175,20 @@ bool AssemblyGrammar::isValid() const { } CapabilitySet AssemblyGrammar::filterCapsAgainstTargetEnv( - const SpvCapability* cap_array, uint32_t count) const { + const spv::Capability* cap_array, uint32_t count) const { CapabilitySet cap_set; + const auto version = spvVersionForTargetEnv(target_env_); for (uint32_t i = 0; i < count; ++i) { - spv_operand_desc cap_desc = {}; + spv_operand_desc entry = {}; if (SPV_SUCCESS == lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, static_cast(cap_array[i]), - &cap_desc)) { - // spvOperandTableValueLookup() filters capabilities internally - // according to the current target environment by itself. So we - // should be safe to add this capability if the lookup succeeds. - cap_set.Add(cap_array[i]); + &entry)) { + // This token is visible in this environment if it's in an appropriate + // core version, or it is enabled by a capability or an extension. + if ((version >= entry->minVersion && version <= entry->lastVersion) || + entry->numExtensions > 0u || entry->numCapabilities > 0u) { + cap_set.insert(cap_array[i]); + } } } return cap_set; @@ -194,7 +199,7 @@ spv_result_t AssemblyGrammar::lookupOpcode(const char* name, return spvOpcodeTableNameLookup(target_env_, opcodeTable_, name, desc); } -spv_result_t AssemblyGrammar::lookupOpcode(SpvOp opcode, +spv_result_t AssemblyGrammar::lookupOpcode(spv::Op opcode, spv_opcode_desc* desc) const { return spvOpcodeTableValueLookup(target_env_, opcodeTable_, opcode, desc); } @@ -214,7 +219,7 @@ spv_result_t AssemblyGrammar::lookupOperand(spv_operand_type_t type, } spv_result_t AssemblyGrammar::lookupSpecConstantOpcode(const char* name, - SpvOp* opcode) const { + spv::Op* opcode) const { const auto* last = kOpSpecConstantOpcodes + kNumOpSpecConstantOpcodes; const auto* found = std::find_if(kOpSpecConstantOpcodes, last, @@ -226,7 +231,7 @@ spv_result_t AssemblyGrammar::lookupSpecConstantOpcode(const char* name, return SPV_SUCCESS; } -spv_result_t AssemblyGrammar::lookupSpecConstantOpcode(SpvOp opcode) const { +spv_result_t AssemblyGrammar::lookupSpecConstantOpcode(spv::Op opcode) const { const auto* last = kOpSpecConstantOpcodes + kNumOpSpecConstantOpcodes; const auto* found = std::find_if(kOpSpecConstantOpcodes, last, diff --git a/bgfx/3rdparty/spirv-tools/source/assembly_grammar.h b/bgfx/3rdparty/spirv-tools/source/assembly_grammar.h index 17c2bd3b..36fdd08a 100644 --- a/bgfx/3rdparty/spirv-tools/source/assembly_grammar.h +++ b/bgfx/3rdparty/spirv-tools/source/assembly_grammar.h @@ -41,7 +41,7 @@ class AssemblyGrammar { // Removes capabilities not available in the current target environment and // returns the rest. - CapabilitySet filterCapsAgainstTargetEnv(const SpvCapability* cap_array, + CapabilitySet filterCapsAgainstTargetEnv(const spv::Capability* cap_array, uint32_t count) const; // Fills in the desc parameter with the information about the opcode @@ -52,7 +52,7 @@ class AssemblyGrammar { // Fills in the desc parameter with the information about the opcode // of the valid. Returns SPV_SUCCESS if the opcode was found, and // SPV_ERROR_INVALID_LOOKUP if the opcode does not exist. - spv_result_t lookupOpcode(SpvOp opcode, spv_opcode_desc* desc) const; + spv_result_t lookupOpcode(spv::Op opcode, spv_opcode_desc* desc) const; // Fills in the desc parameter with the information about the given // operand. Returns SPV_SUCCESS if the operand was found, and @@ -82,11 +82,12 @@ class AssemblyGrammar { // the integer add opcode for OpSpecConstantOp. On success, returns // SPV_SUCCESS and sends the discovered operation code through the opcode // parameter. On failure, returns SPV_ERROR_INVALID_LOOKUP. - spv_result_t lookupSpecConstantOpcode(const char* name, SpvOp* opcode) const; + spv_result_t lookupSpecConstantOpcode(const char* name, + spv::Op* opcode) const; // Returns SPV_SUCCESS if the given opcode is valid as the opcode operand // to OpSpecConstantOp. - spv_result_t lookupSpecConstantOpcode(SpvOp opcode) const; + spv_result_t lookupSpecConstantOpcode(spv::Op opcode) const; // Parses a mask expression string for the given operand type. // diff --git a/bgfx/3rdparty/spirv-tools/source/binary.cpp b/bgfx/3rdparty/spirv-tools/source/binary.cpp index 24d32f8c..3cfdee04 100644 --- a/bgfx/3rdparty/spirv-tools/source/binary.cpp +++ b/bgfx/3rdparty/spirv-tools/source/binary.cpp @@ -156,7 +156,7 @@ class Parser { // Issues a diagnostic describing an exhaustion of input condition when // trying to decode an instruction operand, and returns // SPV_ERROR_INVALID_BINARY. - spv_result_t exhaustedInputDiagnostic(size_t inst_offset, SpvOp opcode, + spv_result_t exhaustedInputDiagnostic(size_t inst_offset, spv::Op opcode, spv_operand_type_t type) { return diagnostic() << "End of input reached while decoding Op" << spvOpcodeString(opcode) << " starting at word " @@ -318,7 +318,7 @@ spv_result_t Parser::parseInstruction() { << inst_word_count; } spv_opcode_desc opcode_desc; - if (grammar_.lookupOpcode(static_cast(inst.opcode), &opcode_desc)) + if (grammar_.lookupOpcode(static_cast(inst.opcode), &opcode_desc)) return diagnostic() << "Invalid opcode: " << inst.opcode; // Advance past the opcode word. But remember the of the start @@ -418,7 +418,7 @@ spv_result_t Parser::parseOperand(size_t inst_offset, std::vector* words, std::vector* operands, spv_operand_pattern_t* expected_operands) { - const SpvOp opcode = static_cast(inst->opcode); + const spv::Op opcode = static_cast(inst->opcode); // We'll fill in this result as we go along. spv_parsed_operand_t parsed_operand; parsed_operand.offset = uint16_t(_.word_index - inst_offset); @@ -473,7 +473,7 @@ spv_result_t Parser::parseOperand(size_t inst_offset, if (!word) return diagnostic(SPV_ERROR_INVALID_ID) << "Id is 0"; parsed_operand.type = SPV_OPERAND_TYPE_ID; - if (opcode == SpvOpExtInst && parsed_operand.offset == 3) { + if (opcode == spv::Op::OpExtInst && parsed_operand.offset == 3) { // The current word is the extended instruction set Id. // Set the extended instruction set type for the current instruction. auto ext_inst_type_iter = _.import_id_to_ext_inst_type.find(word); @@ -494,7 +494,7 @@ spv_result_t Parser::parseOperand(size_t inst_offset, break; case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: { - assert(SpvOpExtInst == opcode); + assert(spv::Op::OpExtInst == opcode); assert(inst->ext_inst_type != SPV_EXT_INST_TYPE_NONE); spv_ext_inst_desc ext_inst; if (grammar_.lookupExtInst(inst->ext_inst_type, word, &ext_inst) == @@ -516,14 +516,14 @@ spv_result_t Parser::parseOperand(size_t inst_offset, } break; case SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER: { - assert(SpvOpSpecConstantOp == opcode); - if (word > static_cast(SpvOp::SpvOpMax) || - grammar_.lookupSpecConstantOpcode(SpvOp(word))) { + assert(spv::Op::OpSpecConstantOp == opcode); + if (word > static_cast(spv::Op::Max) || + grammar_.lookupSpecConstantOpcode(spv::Op(word))) { return diagnostic() << "Invalid " << spvOperandTypeStr(type) << ": " << word; } spv_opcode_desc opcode_entry = nullptr; - if (grammar_.lookupOpcode(SpvOp(word), &opcode_entry)) { + if (grammar_.lookupOpcode(spv::Op(word), &opcode_entry)) { return diagnostic(SPV_ERROR_INTERNAL) << "OpSpecConstant opcode table out of sync"; } @@ -546,10 +546,17 @@ spv_result_t Parser::parseOperand(size_t inst_offset, parsed_operand.number_bit_width = 32; break; + case SPV_OPERAND_TYPE_LITERAL_FLOAT: + // These are regular single-word literal float operands. + parsed_operand.type = SPV_OPERAND_TYPE_LITERAL_FLOAT; + parsed_operand.number_kind = SPV_NUMBER_FLOATING; + parsed_operand.number_bit_width = 32; + break; + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: parsed_operand.type = SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER; - if (opcode == SpvOpSwitch) { + if (opcode == spv::Op::OpSwitch) { // The literal operands have the same type as the value // referenced by the selector Id. const uint32_t selector_id = peekAt(inst_offset + 1); @@ -575,7 +582,8 @@ spv_result_t Parser::parseOperand(size_t inst_offset, << " is not a scalar integer"; } } else { - assert(opcode == SpvOpConstant || opcode == SpvOpSpecConstant); + assert(opcode == spv::Op::OpConstant || + opcode == spv::Op::OpSpecConstant); // The literal number type is determined by the type Id for the // constant. assert(inst->type_id); @@ -607,7 +615,7 @@ spv_result_t Parser::parseOperand(size_t inst_offset, parsed_operand.num_words = uint16_t(string_num_words); parsed_operand.type = SPV_OPERAND_TYPE_LITERAL_STRING; - if (SpvOpExtInstImport == opcode) { + if (spv::Op::OpExtInstImport == opcode) { // Record the extended instruction type for the ID for this import. // There is only one string literal argument to OpExtInstImport, // so it's sufficient to guard this just on the opcode. @@ -625,7 +633,6 @@ spv_result_t Parser::parseOperand(size_t inst_offset, } break; case SPV_OPERAND_TYPE_CAPABILITY: - case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: case SPV_OPERAND_TYPE_EXECUTION_MODEL: case SPV_OPERAND_TYPE_ADDRESSING_MODEL: case SPV_OPERAND_TYPE_MEMORY_MODEL: @@ -682,6 +689,21 @@ spv_result_t Parser::parseOperand(size_t inst_offset, spvPushOperandTypes(entry->operandTypes, expected_operands); } break; + case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: { + spv_operand_desc entry; + if (grammar_.lookupOperand(type, word, &entry)) { + return diagnostic() + << "Invalid " << spvOperandTypeStr(parsed_operand.type) + << " operand: " << word + << ", if you are creating a new source language please use " + "value 0 " + "(Unknown) and when ready, add your source language to " + "SPRIV-Headers"; + } + // Prepare to accept operands to this operand, if needed. + spvPushOperandTypes(entry->operandTypes, expected_operands); + } break; + case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: case SPV_OPERAND_TYPE_FUNCTION_CONTROL: case SPV_OPERAND_TYPE_LOOP_CONTROL: @@ -690,7 +712,9 @@ spv_result_t Parser::parseOperand(size_t inst_offset, case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: case SPV_OPERAND_TYPE_SELECTION_CONTROL: case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_INFO_FLAGS: - case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS: { + case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS: + case SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_OPERANDS: + case SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS: { // This operand is a mask. // Map an optional operand type to its corresponding concrete type. @@ -698,6 +722,8 @@ spv_result_t Parser::parseOperand(size_t inst_offset, parsed_operand.type = SPV_OPERAND_TYPE_IMAGE; else if (type == SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS) parsed_operand.type = SPV_OPERAND_TYPE_MEMORY_ACCESS; + if (type == SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS) + parsed_operand.type = SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_OPERANDS; // Check validity of set mask bits. Also prepare for operands for those // masks if they have any. To get operand order correct, scan from @@ -789,14 +815,14 @@ spv_result_t Parser::setNumericTypeInfoForType( void Parser::recordNumberType(size_t inst_offset, const spv_parsed_instruction_t* inst) { - const SpvOp opcode = static_cast(inst->opcode); + const spv::Op opcode = static_cast(inst->opcode); if (spvOpcodeGeneratesType(opcode)) { NumberType info = {SPV_NUMBER_NONE, 0}; - if (SpvOpTypeInt == opcode) { + if (spv::Op::OpTypeInt == opcode) { const bool is_signed = peekAt(inst_offset + 3) != 0; info.type = is_signed ? SPV_NUMBER_SIGNED_INT : SPV_NUMBER_UNSIGNED_INT; info.bit_width = peekAt(inst_offset + 2); - } else if (SpvOpTypeFloat == opcode) { + } else if (spv::Op::OpTypeFloat == opcode) { info.type = SPV_NUMBER_FLOATING; info.bit_width = peekAt(inst_offset + 2); } diff --git a/bgfx/3rdparty/spirv-tools/source/cfa.h b/bgfx/3rdparty/spirv-tools/source/cfa.h index 2743ab40..9ae3e39a 100644 --- a/bgfx/3rdparty/spirv-tools/source/cfa.h +++ b/bgfx/3rdparty/spirv-tools/source/cfa.h @@ -275,10 +275,16 @@ std::vector> CFA::CalculateDominators( std::vector> out; for (auto idom : idoms) { + // At this point if there is no dominator for the node, just make it + // reflexive. + auto dominator = std::get<1>(idom).dominator; + if (dominator == undefined_dom) { + dominator = std::get<1>(idom).postorder_index; + } // NOTE: performing a const cast for convenient usage with // UpdateImmediateDominators out.push_back({const_cast(std::get<0>(idom)), - const_cast(postorder[std::get<1>(idom).dominator])}); + const_cast(postorder[dominator])}); } // Sort by postorder index to generate a deterministic ordering of edges. diff --git a/bgfx/3rdparty/spirv-tools/source/diff/diff.cpp b/bgfx/3rdparty/spirv-tools/source/diff/diff.cpp index 7ed41de5..6269af50 100644 --- a/bgfx/3rdparty/spirv-tools/source/diff/diff.cpp +++ b/bgfx/3rdparty/spirv-tools/source/diff/diff.cpp @@ -44,8 +44,8 @@ using IdGroup = std::vector; // different implementations produce identical results. using IdGroupMapByName = std::map; using IdGroupMapByTypeId = std::map; -using IdGroupMapByOp = std::map; -using IdGroupMapByStorageClass = std::map; +using IdGroupMapByOp = std::map; +using IdGroupMapByStorageClass = std::map; // A set of potential id mappings that haven't been resolved yet. Any id in src // may map in any id in dst. Note that ids are added in the same order as they @@ -101,9 +101,12 @@ class IdMap { return from < id_map_.size() && id_map_[from] != 0; } - // Map any ids in src and dst that have not been mapped to new ids in dst and - // src respectively. - void MapUnmatchedIds(IdMap& other_way); + bool IsMapped(const opt::Instruction* from_inst) const { + assert(from_inst != nullptr); + assert(!from_inst->HasResultId()); + + return inst_map_.find(from_inst) != inst_map_.end(); + } // Some instructions don't have result ids. Those are mapped by pointer. void MapInsts(const opt::Instruction* from_inst, @@ -117,6 +120,12 @@ class IdMap { uint32_t IdBound() const { return static_cast(id_map_.size()); } + // Generate a fresh id in this mapping's domain. + uint32_t MakeFreshId() { + id_map_.push_back(0); + return static_cast(id_map_.size()) - 1; + } + private: // Given an id, returns the corresponding id in the other module, or 0 if not // matched yet. @@ -150,10 +159,16 @@ class SrcDstIdMap { bool IsSrcMapped(uint32_t src) { return src_to_dst_.IsMapped(src); } bool IsDstMapped(uint32_t dst) { return dst_to_src_.IsMapped(dst); } + bool IsDstMapped(const opt::Instruction* dst_inst) { + return dst_to_src_.IsMapped(dst_inst); + } // Map any ids in src and dst that have not been mapped to new ids in dst and - // src respectively. - void MapUnmatchedIds(); + // src respectively. Use src_insn_defined and dst_insn_defined to ignore ids + // that are simply never defined. (Since we assume the inputs are valid + // SPIR-V, this implies they are also never used.) + void MapUnmatchedIds(std::function src_insn_defined, + std::function dst_insn_defined); // Some instructions don't have result ids. Those are mapped by pointer. void MapInsts(const opt::Instruction* src_inst, @@ -203,6 +218,11 @@ struct IdInstructions { void MapIdToInstruction(uint32_t id, const opt::Instruction* inst); + // Return true if id is mapped to any instruction, false otherwise. + bool IsDefined(uint32_t id) { + return id < inst_map_.size() && inst_map_[id] != nullptr; + } + void MapIdsToInstruction( opt::IteratorRange section); void MapIdsToInfos( @@ -301,10 +321,10 @@ class Differ { // Get various properties from an id. These Helper functions are passed to // `GroupIds` and `GroupIdsAndMatch` below (as the `get_group` argument). uint32_t GroupIdsHelperGetTypeId(const IdInstructions& id_to, uint32_t id); - SpvStorageClass GroupIdsHelperGetTypePointerStorageClass( + spv::StorageClass GroupIdsHelperGetTypePointerStorageClass( const IdInstructions& id_to, uint32_t id); - SpvOp GroupIdsHelperGetTypePointerTypeOp(const IdInstructions& id_to, - uint32_t id); + spv::Op GroupIdsHelperGetTypePointerTypeOp(const IdInstructions& id_to, + uint32_t id); // Given a list of ids, groups them based on some value. The `get_group` // function extracts a piece of information corresponding to each id, and the @@ -338,6 +358,59 @@ class Differ { std::function match_group); + // Bucket `src_ids` and `dst_ids` by the key ids returned by `get_group`, and + // then call `match_group` on pairs of buckets whose key ids are matched with + // each other. + // + // For example, suppose we want to pair up groups of instructions with the + // same type. Naturally, the source instructions refer to their types by their + // ids in the source, and the destination instructions use destination type + // ids, so simply comparing source and destination type ids as integers, as + // `GroupIdsAndMatch` would do, is meaningless. But if a prior call to + // `MatchTypeIds` has established type matches between the two modules, then + // we can consult those to pair source and destination buckets whose types are + // equivalent. + // + // Suppose our input groups are as follows: + // + // - src_ids: { 1 -> 100, 2 -> 300, 3 -> 100, 4 -> 200 } + // - dst_ids: { 5 -> 10, 6 -> 20, 7 -> 10, 8 -> 300 } + // + // Here, `X -> Y` means that the instruction with SPIR-V id `X` is a member of + // the group, and `Y` is the id of its type. If we use + // `Differ::GroupIdsHelperGetTypeId` for `get_group`, then + // `get_group(X) == Y`. + // + // These instructions are bucketed by type as follows: + // + // - source: [1, 3] -> 100 + // [4] -> 200 + // [2] -> 300 + // + // - destination: [5, 7] -> 10 + // [6] -> 20 + // [8] -> 300 + // + // Now suppose that we have previously matched up src type 100 with dst type + // 10, and src type 200 with dst type 20, but no other types are matched. + // + // Then `match_group` is called twice: + // - Once with ([1,3], [5, 7]), corresponding to 100/10 + // - Once with ([4],[6]), corresponding to 200/20 + // + // The source type 300 isn't matched with anything, so the fact that there's a + // destination type 300 is irrelevant, and thus 2 and 8 are never passed to + // `match_group`. + // + // This function isn't specific to types; it simply buckets by the ids + // returned from `get_group`, and consults existing matches to pair up the + // resulting buckets. + void GroupIdsAndMatchByMappedId( + const IdGroup& src_ids, const IdGroup& dst_ids, + uint32_t (Differ::*get_group)(const IdInstructions&, uint32_t), + std::function + match_group); + // Helper functions that determine if two instructions match bool DoIdsMatch(uint32_t src_id, uint32_t dst_id); bool DoesOperandMatch(const opt::Operand& src_operand, @@ -414,8 +487,8 @@ class Differ { // Helper functions to retrieve information pertaining to an id const opt::Instruction* GetInst(const IdInstructions& id_to, uint32_t id); uint32_t GetConstantUint(const IdInstructions& id_to, uint32_t constant_id); - SpvExecutionModel GetExecutionModel(const opt::Module* module, - uint32_t entry_point_id); + spv::ExecutionModel GetExecutionModel(const opt::Module* module, + uint32_t entry_point_id); bool HasName(const IdInstructions& id_to, uint32_t id); // Get the OpName associated with an id std::string GetName(const IdInstructions& id_to, uint32_t id, bool* has_name); @@ -424,20 +497,21 @@ class Differ { // string, and this improves diff between SPIR-V from those tools and others. std::string GetSanitizedName(const IdInstructions& id_to, uint32_t id); uint32_t GetVarTypeId(const IdInstructions& id_to, uint32_t var_id, - SpvStorageClass* storage_class); + spv::StorageClass* storage_class); bool GetDecorationValue(const IdInstructions& id_to, uint32_t id, - SpvDecoration decoration, uint32_t* decoration_value); + spv::Decoration decoration, + uint32_t* decoration_value); const opt::Instruction* GetForwardPointerInst(const IdInstructions& id_to, uint32_t id); bool IsIntType(const IdInstructions& id_to, uint32_t type_id); bool IsFloatType(const IdInstructions& id_to, uint32_t type_id); bool IsConstantUint(const IdInstructions& id_to, uint32_t id); bool IsVariable(const IdInstructions& id_to, uint32_t pointer_id); - bool IsOp(const IdInstructions& id_to, uint32_t id, SpvOp opcode); + bool IsOp(const IdInstructions& id_to, uint32_t id, spv::Op opcode); bool IsPerVertexType(const IdInstructions& id_to, uint32_t type_id); bool IsPerVertexVariable(const IdInstructions& id_to, uint32_t type_id); - SpvStorageClass GetPerVertexStorageClass(const opt::Module* module, - uint32_t type_id); + spv::StorageClass GetPerVertexStorageClass(const opt::Module* module, + uint32_t type_id); spv_ext_inst_type_t GetExtInstType(const IdInstructions& id_to, uint32_t set_id); spv_number_kind_t GetNumberKind(const IdInstructions& id_to, @@ -503,36 +577,27 @@ class Differ { FunctionMap dst_funcs_; }; -void IdMap::MapUnmatchedIds(IdMap& other_way) { - const uint32_t src_id_bound = static_cast(id_map_.size()); - const uint32_t dst_id_bound = static_cast(other_way.id_map_.size()); - - uint32_t next_src_id = src_id_bound; - uint32_t next_dst_id = dst_id_bound; +void SrcDstIdMap::MapUnmatchedIds( + std::function src_insn_defined, + std::function dst_insn_defined) { + const uint32_t src_id_bound = static_cast(src_to_dst_.IdBound()); + const uint32_t dst_id_bound = static_cast(dst_to_src_.IdBound()); for (uint32_t src_id = 1; src_id < src_id_bound; ++src_id) { - if (!IsMapped(src_id)) { - MapIds(src_id, next_dst_id); - - other_way.id_map_.push_back(0); - other_way.MapIds(next_dst_id++, src_id); + if (!src_to_dst_.IsMapped(src_id) && src_insn_defined(src_id)) { + uint32_t fresh_dst_id = dst_to_src_.MakeFreshId(); + MapIds(src_id, fresh_dst_id); } } for (uint32_t dst_id = 1; dst_id < dst_id_bound; ++dst_id) { - if (!other_way.IsMapped(dst_id)) { - id_map_.push_back(0); - MapIds(next_src_id, dst_id); - - other_way.MapIds(dst_id, next_src_id++); + if (!dst_to_src_.IsMapped(dst_id) && dst_insn_defined(dst_id)) { + uint32_t fresh_src_id = src_to_dst_.MakeFreshId(); + MapIds(fresh_src_id, dst_id); } } } -void SrcDstIdMap::MapUnmatchedIds() { - src_to_dst_.MapUnmatchedIds(dst_to_src_); -} - void IdInstructions::MapIdToInstruction(uint32_t id, const opt::Instruction* inst) { assert(id != 0); @@ -561,19 +626,19 @@ void IdInstructions::MapIdsToInfos( uint32_t id_operand = 0; switch (inst.opcode()) { - case SpvOpName: + case spv::Op::OpName: info_map = &name_map_; break; - case SpvOpMemberName: + case spv::Op::OpMemberName: info_map = &name_map_; break; - case SpvOpDecorate: + case spv::Op::OpDecorate: info_map = &decoration_map_; break; - case SpvOpMemberDecorate: + case spv::Op::OpMemberDecorate: info_map = &decoration_map_; break; - case SpvOpTypeForwardPointer: { + case spv::Op::OpTypeForwardPointer: { uint32_t id = inst.GetSingleWordOperand(0); assert(id != 0); @@ -731,10 +796,10 @@ int Differ::ComparePreambleInstructions(const opt::Instruction* a, // Instead of comparing OpExecutionMode entry point ids as ids, compare them // through their corresponding execution model. This simplifies traversing // the sorted list of instructions between src and dst modules. - if (a->opcode() == SpvOpExecutionMode) { - const SpvExecutionModel src_model = + if (a->opcode() == spv::Op::OpExecutionMode) { + const spv::ExecutionModel src_model = GetExecutionModel(src_inst_module, a->GetSingleWordOperand(0)); - const SpvExecutionModel dst_model = + const spv::ExecutionModel dst_model = GetExecutionModel(dst_inst_module, b->GetSingleWordOperand(0)); if (src_model < dst_model) { @@ -818,17 +883,17 @@ uint32_t Differ::GroupIdsHelperGetTypeId(const IdInstructions& id_to, return GetInst(id_to, id)->type_id(); } -SpvStorageClass Differ::GroupIdsHelperGetTypePointerStorageClass( +spv::StorageClass Differ::GroupIdsHelperGetTypePointerStorageClass( const IdInstructions& id_to, uint32_t id) { const opt::Instruction* inst = GetInst(id_to, id); - assert(inst && inst->opcode() == SpvOpTypePointer); - return SpvStorageClass(inst->GetSingleWordInOperand(0)); + assert(inst && inst->opcode() == spv::Op::OpTypePointer); + return spv::StorageClass(inst->GetSingleWordInOperand(0)); } -SpvOp Differ::GroupIdsHelperGetTypePointerTypeOp(const IdInstructions& id_to, - uint32_t id) { +spv::Op Differ::GroupIdsHelperGetTypePointerTypeOp(const IdInstructions& id_to, + uint32_t id) { const opt::Instruction* inst = GetInst(id_to, id); - assert(inst && inst->opcode() == SpvOpTypePointer); + assert(inst && inst->opcode() == spv::Op::OpTypePointer); const uint32_t type_id = inst->GetSingleWordInOperand(1); const opt::Instruction* type_inst = GetInst(id_to, type_id); @@ -888,6 +953,37 @@ void Differ::GroupIdsAndMatch( } } +void Differ::GroupIdsAndMatchByMappedId( + const IdGroup& src_ids, const IdGroup& dst_ids, + uint32_t (Differ::*get_group)(const IdInstructions&, uint32_t), + std::function + match_group) { + // Group the ids based on a key (get_group) + std::map src_groups; + std::map dst_groups; + + GroupIds(src_ids, true, &src_groups, get_group); + GroupIds(dst_ids, false, &dst_groups, get_group); + + // Iterate over pairs of groups whose keys map to each other. + for (const auto& iter : src_groups) { + const uint32_t& src_key = iter.first; + const IdGroup& src_group = iter.second; + + if (src_key == 0) { + continue; + } + + if (id_map_.IsSrcMapped(src_key)) { + const uint32_t& dst_key = id_map_.MappedDstId(src_key); + const IdGroup& dst_group = dst_groups[dst_key]; + + // Let the caller match the groups as appropriate. + match_group(src_group, dst_group); + } + } +} + bool Differ::DoIdsMatch(uint32_t src_id, uint32_t dst_id) { assert(dst_id != 0); return id_map_.MappedDstId(src_id) == dst_id; @@ -1020,7 +1116,7 @@ bool Differ::DoInstructionsMatchFuzzy(const opt::Instruction* src_inst, } // For external instructions, make sure the set and opcode of the external // instruction matches too. - if (src_inst->opcode() == SpvOpExtInst) { + if (src_inst->opcode() == spv::Op::OpExtInst) { if (!DoOperandsMatch(src_inst, dst_inst, 0, 2)) { return false; } @@ -1064,26 +1160,26 @@ bool Differ::DoDebugAndAnnotationInstructionsMatch( } switch (src_inst->opcode()) { - case SpvOpString: - case SpvOpSourceExtension: - case SpvOpModuleProcessed: + case spv::Op::OpString: + case spv::Op::OpSourceExtension: + case spv::Op::OpModuleProcessed: return DoesOperandMatch(src_inst->GetOperand(0), dst_inst->GetOperand(0)); - case SpvOpSource: + case spv::Op::OpSource: return DoOperandsMatch(src_inst, dst_inst, 0, 2); - case SpvOpSourceContinued: + case spv::Op::OpSourceContinued: return true; - case SpvOpName: + case spv::Op::OpName: return DoOperandsMatch(src_inst, dst_inst, 0, 1); - case SpvOpMemberName: + case spv::Op::OpMemberName: return DoOperandsMatch(src_inst, dst_inst, 0, 2); - case SpvOpDecorate: + case spv::Op::OpDecorate: return DoOperandsMatch(src_inst, dst_inst, 0, 2); - case SpvOpMemberDecorate: + case spv::Op::OpMemberDecorate: return DoOperandsMatch(src_inst, dst_inst, 0, 3); - case SpvOpExtInst: - case SpvOpDecorationGroup: - case SpvOpGroupDecorate: - case SpvOpGroupMemberDecorate: + case spv::Op::OpExtInst: + case spv::Op::OpDecorationGroup: + case spv::Op::OpGroupDecorate: + case spv::Op::OpGroupMemberDecorate: return false; default: return false; @@ -1095,9 +1191,9 @@ bool Differ::AreVariablesMatchable(uint32_t src_id, uint32_t dst_id, // Variables must match by their built-in decorations. uint32_t src_built_in_decoration = 0, dst_built_in_decoration = 0; const bool src_is_built_in = GetDecorationValue( - src_id_to_, src_id, SpvDecorationBuiltIn, &src_built_in_decoration); + src_id_to_, src_id, spv::Decoration::BuiltIn, &src_built_in_decoration); const bool dst_is_built_in = GetDecorationValue( - dst_id_to_, dst_id, SpvDecorationBuiltIn, &dst_built_in_decoration); + dst_id_to_, dst_id, spv::Decoration::BuiltIn, &dst_built_in_decoration); if (src_is_built_in != dst_is_built_in) { return false; @@ -1107,7 +1203,7 @@ bool Differ::AreVariablesMatchable(uint32_t src_id, uint32_t dst_id, } // Check their types and storage classes. - SpvStorageClass src_storage_class, dst_storage_class; + spv::StorageClass src_storage_class, dst_storage_class; const uint32_t src_type_id = GetVarTypeId(src_id_to_, src_id, &src_storage_class); const uint32_t dst_type_id = @@ -1127,12 +1223,14 @@ bool Differ::AreVariablesMatchable(uint32_t src_id, uint32_t dst_id, // Allow one of the two to be Private while the other is Input or // Output, this allows matching in/out variables that have been turned // global as part of linking two stages (as done in ANGLE). - const bool src_is_io = src_storage_class == SpvStorageClassInput || - src_storage_class == SpvStorageClassOutput; - const bool dst_is_io = dst_storage_class == SpvStorageClassInput || - dst_storage_class == SpvStorageClassOutput; - const bool src_is_private = src_storage_class == SpvStorageClassPrivate; - const bool dst_is_private = dst_storage_class == SpvStorageClassPrivate; + const bool src_is_io = src_storage_class == spv::StorageClass::Input || + src_storage_class == spv::StorageClass::Output; + const bool dst_is_io = dst_storage_class == spv::StorageClass::Input || + dst_storage_class == spv::StorageClass::Output; + const bool src_is_private = + src_storage_class == spv::StorageClass::Private; + const bool dst_is_private = + dst_storage_class == spv::StorageClass::Private; if (!((src_is_io && dst_is_private) || (src_is_private && dst_is_io))) { return false; @@ -1277,16 +1375,16 @@ bool Differ::MatchOpSpecConstant(const opt::Instruction* src_inst, // Otherwise, match them by SpecId. uint32_t src_spec_id, dst_spec_id; - if (GetDecorationValue(src_id_to_, src_id, SpvDecorationSpecId, + if (GetDecorationValue(src_id_to_, src_id, spv::Decoration::SpecId, &src_spec_id) && - GetDecorationValue(dst_id_to_, dst_id, SpvDecorationSpecId, + GetDecorationValue(dst_id_to_, dst_id, spv::Decoration::SpecId, &dst_spec_id)) { return src_spec_id == dst_spec_id; } // There is no SpecId decoration, while not practical, still valid. // SpecConstantOp don't have SpecId and can be matched by operands - if (src_inst->opcode() == SpvOpSpecConstantOp) { + if (src_inst->opcode() == spv::Op::OpSpecConstantOp) { if (src_inst->NumInOperandWords() == dst_inst->NumInOperandWords()) { return DoOperandsMatch(src_inst, dst_inst, 0, src_inst->NumInOperandWords()); @@ -1327,13 +1425,13 @@ bool Differ::MatchOpVariable(const opt::Instruction* src_inst, // built-in decorations. uint32_t src_built_in_decoration; const bool src_is_built_in = GetDecorationValue( - src_id_to_, src_id, SpvDecorationBuiltIn, &src_built_in_decoration); + src_id_to_, src_id, spv::Decoration::BuiltIn, &src_built_in_decoration); if (src_is_built_in && AreVariablesMatchable(src_id, dst_id, flexibility)) { return true; } - SpvStorageClass src_storage_class, dst_storage_class; + spv::StorageClass src_storage_class, dst_storage_class; GetVarTypeId(src_id_to_, src_id, &src_storage_class); GetVarTypeId(dst_id_to_, dst_id, &dst_storage_class); @@ -1348,13 +1446,13 @@ bool Differ::MatchOpVariable(const opt::Instruction* src_inst, uint32_t src_binding = 0, dst_binding = 0; const bool src_has_set = GetDecorationValue( - src_id_to_, src_id, SpvDecorationDescriptorSet, &src_set); + src_id_to_, src_id, spv::Decoration::DescriptorSet, &src_set); const bool dst_has_set = GetDecorationValue( - dst_id_to_, dst_id, SpvDecorationDescriptorSet, &dst_set); - const bool src_has_binding = - GetDecorationValue(src_id_to_, src_id, SpvDecorationBinding, &src_set); - const bool dst_has_binding = - GetDecorationValue(dst_id_to_, dst_id, SpvDecorationBinding, &dst_set); + dst_id_to_, dst_id, spv::Decoration::DescriptorSet, &dst_set); + const bool src_has_binding = GetDecorationValue( + src_id_to_, src_id, spv::Decoration::Binding, &src_set); + const bool dst_has_binding = GetDecorationValue( + dst_id_to_, dst_id, spv::Decoration::Binding, &dst_set); if (src_has_set && dst_has_set && src_has_binding && dst_has_binding) { return src_set == dst_set && src_binding == dst_binding; @@ -1367,9 +1465,9 @@ bool Differ::MatchOpVariable(const opt::Instruction* src_inst, uint32_t src_location, dst_location; const bool src_has_location = GetDecorationValue( - src_id_to_, src_id, SpvDecorationLocation, &src_location); + src_id_to_, src_id, spv::Decoration::Location, &src_location); const bool dst_has_location = GetDecorationValue( - dst_id_to_, dst_id, SpvDecorationLocation, &dst_location); + dst_id_to_, dst_id, spv::Decoration::Location, &dst_location); if (src_has_location && dst_has_location) { return src_location == dst_location; @@ -1384,25 +1482,25 @@ bool Differ::MatchPerVertexType(uint32_t src_type_id, uint32_t dst_type_id) { // For gl_PerVertex, find the type pointer of this type (array) and make sure // the storage classes of src and dst match; geometry and tessellation shaders // have two instances of gl_PerVertex. - SpvStorageClass src_storage_class = + spv::StorageClass src_storage_class = GetPerVertexStorageClass(src_, src_type_id); - SpvStorageClass dst_storage_class = + spv::StorageClass dst_storage_class = GetPerVertexStorageClass(dst_, dst_type_id); - assert(src_storage_class == SpvStorageClassInput || - src_storage_class == SpvStorageClassOutput); - assert(dst_storage_class == SpvStorageClassInput || - dst_storage_class == SpvStorageClassOutput); + assert(src_storage_class == spv::StorageClass::Input || + src_storage_class == spv::StorageClass::Output); + assert(dst_storage_class == spv::StorageClass::Input || + dst_storage_class == spv::StorageClass::Output); return src_storage_class == dst_storage_class; } bool Differ::MatchPerVertexVariable(const opt::Instruction* src_inst, const opt::Instruction* dst_inst) { - SpvStorageClass src_storage_class = - SpvStorageClass(src_inst->GetSingleWordInOperand(0)); - SpvStorageClass dst_storage_class = - SpvStorageClass(dst_inst->GetSingleWordInOperand(0)); + spv::StorageClass src_storage_class = + spv::StorageClass(src_inst->GetSingleWordInOperand(0)); + spv::StorageClass dst_storage_class = + spv::StorageClass(dst_inst->GetSingleWordInOperand(0)); return src_storage_class == dst_storage_class; } @@ -1416,7 +1514,6 @@ void Differ::MatchTypeForwardPointersByName(const IdGroup& src, GroupIdsAndMatch( src, dst, "", &Differ::GetSanitizedName, [this](const IdGroup& src_group, const IdGroup& dst_group) { - // Match only if there's a unique forward declaration with this debug // name. if (src_group.size() == 1 && dst_group.size() == 1) { @@ -1479,7 +1576,7 @@ InstructionList Differ::GetFunctionHeader(const opt::Function& function) { InstructionList body; function.WhileEachInst( [&body](const opt::Instruction* inst) { - if (inst->opcode() == SpvOpLabel) { + if (inst->opcode() == spv::Op::OpLabel) { return false; } body.push_back(inst); @@ -1571,6 +1668,8 @@ void Differ::BestEffortMatchFunctions(const IdGroup& src_func_ids, id_map_.MapIds(match_result.src_id, match_result.dst_id); + MatchFunctionParamIds(src_funcs_[match_result.src_id], + dst_funcs_[match_result.dst_id]); MatchIdsInFunctionBodies(src_func_insts.at(match_result.src_id), dst_func_insts.at(match_result.dst_id), match_result.src_match, match_result.dst_match, 0); @@ -1595,7 +1694,6 @@ void Differ::MatchFunctionParamIds(const opt::Function* src_func, GroupIdsAndMatch( src_params, dst_params, "", &Differ::GetSanitizedName, [this](const IdGroup& src_group, const IdGroup& dst_group) { - // There shouldn't be two parameters with the same name, so the ids // should match. There is nothing restricting the SPIR-V however to have // two parameters with the same name, so be resilient against that. @@ -1606,17 +1704,17 @@ void Differ::MatchFunctionParamIds(const opt::Function* src_func, // Then match the parameters by their type. If there are multiple of them, // match them by their order. - GroupIdsAndMatch( - src_params, dst_params, 0, &Differ::GroupIdsHelperGetTypeId, + GroupIdsAndMatchByMappedId( + src_params, dst_params, &Differ::GroupIdsHelperGetTypeId, [this](const IdGroup& src_group_by_type_id, const IdGroup& dst_group_by_type_id) { - const size_t shared_param_count = std::min(src_group_by_type_id.size(), dst_group_by_type_id.size()); for (size_t param_index = 0; param_index < shared_param_count; ++param_index) { - id_map_.MapIds(src_group_by_type_id[0], dst_group_by_type_id[0]); + id_map_.MapIds(src_group_by_type_id[param_index], + dst_group_by_type_id[param_index]); } }); } @@ -1694,12 +1792,12 @@ void Differ::MatchVariablesUsedByMatchedInstructions( default: // TODO: match functions based on OpFunctionCall? break; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: - case SpvOpLoad: - case SpvOpStore: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: + case spv::Op::OpLoad: + case spv::Op::OpStore: const uint32_t src_pointer_id = src_inst->GetSingleWordInOperand(0); const uint32_t dst_pointer_id = dst_inst->GetSingleWordInOperand(0); if (IsVariable(src_id_to_, src_pointer_id) && @@ -1727,23 +1825,24 @@ const opt::Instruction* Differ::GetInst(const IdInstructions& id_to, uint32_t Differ::GetConstantUint(const IdInstructions& id_to, uint32_t constant_id) { const opt::Instruction* constant_inst = GetInst(id_to, constant_id); - assert(constant_inst->opcode() == SpvOpConstant); - assert(GetInst(id_to, constant_inst->type_id())->opcode() == SpvOpTypeInt); + assert(constant_inst->opcode() == spv::Op::OpConstant); + assert(GetInst(id_to, constant_inst->type_id())->opcode() == + spv::Op::OpTypeInt); return constant_inst->GetSingleWordInOperand(0); } -SpvExecutionModel Differ::GetExecutionModel(const opt::Module* module, - uint32_t entry_point_id) { +spv::ExecutionModel Differ::GetExecutionModel(const opt::Module* module, + uint32_t entry_point_id) { for (const opt::Instruction& inst : module->entry_points()) { - assert(inst.opcode() == SpvOpEntryPoint); + assert(inst.opcode() == spv::Op::OpEntryPoint); if (inst.GetSingleWordOperand(1) == entry_point_id) { - return SpvExecutionModel(inst.GetSingleWordOperand(0)); + return spv::ExecutionModel(inst.GetSingleWordOperand(0)); } } assert(false && "Unreachable"); - return SpvExecutionModel(0xFFF); + return spv::ExecutionModel(0xFFF); } bool Differ::HasName(const IdInstructions& id_to, uint32_t id) { @@ -1751,7 +1850,7 @@ bool Differ::HasName(const IdInstructions& id_to, uint32_t id) { assert(id < id_to.name_map_.size()); for (const opt::Instruction* inst : id_to.name_map_[id]) { - if (inst->opcode() == SpvOpName) { + if (inst->opcode() == spv::Op::OpName) { return true; } } @@ -1765,7 +1864,7 @@ std::string Differ::GetName(const IdInstructions& id_to, uint32_t id, assert(id < id_to.name_map_.size()); for (const opt::Instruction* inst : id_to.name_map_[id]) { - if (inst->opcode() == SpvOpName) { + if (inst->opcode() == spv::Op::OpName) { *has_name = true; return inst->GetOperand(1).AsString(); } @@ -1788,11 +1887,11 @@ std::string Differ::GetSanitizedName(const IdInstructions& id_to, uint32_t id) { } uint32_t Differ::GetVarTypeId(const IdInstructions& id_to, uint32_t var_id, - SpvStorageClass* storage_class) { + spv::StorageClass* storage_class) { const opt::Instruction* var_inst = GetInst(id_to, var_id); - assert(var_inst->opcode() == SpvOpVariable); + assert(var_inst->opcode() == spv::Op::OpVariable); - *storage_class = SpvStorageClass(var_inst->GetSingleWordInOperand(0)); + *storage_class = spv::StorageClass(var_inst->GetSingleWordInOperand(0)); // Get the type pointer from the variable. const uint32_t type_pointer_id = var_inst->type_id(); @@ -1803,15 +1902,15 @@ uint32_t Differ::GetVarTypeId(const IdInstructions& id_to, uint32_t var_id, } bool Differ::GetDecorationValue(const IdInstructions& id_to, uint32_t id, - SpvDecoration decoration, + spv::Decoration decoration, uint32_t* decoration_value) { assert(id != 0); assert(id < id_to.decoration_map_.size()); for (const opt::Instruction* inst : id_to.decoration_map_[id]) { - if (inst->opcode() == SpvOpDecorate && + if (inst->opcode() == spv::Op::OpDecorate && inst->GetSingleWordOperand(0) == id && - inst->GetSingleWordOperand(1) == decoration) { + spv::Decoration(inst->GetSingleWordOperand(1)) == decoration) { *decoration_value = inst->GetSingleWordOperand(2); return true; } @@ -1828,28 +1927,28 @@ const opt::Instruction* Differ::GetForwardPointerInst( } bool Differ::IsIntType(const IdInstructions& id_to, uint32_t type_id) { - return IsOp(id_to, type_id, SpvOpTypeInt); + return IsOp(id_to, type_id, spv::Op::OpTypeInt); } bool Differ::IsFloatType(const IdInstructions& id_to, uint32_t type_id) { - return IsOp(id_to, type_id, SpvOpTypeFloat); + return IsOp(id_to, type_id, spv::Op::OpTypeFloat); } bool Differ::IsConstantUint(const IdInstructions& id_to, uint32_t id) { const opt::Instruction* constant_inst = GetInst(id_to, id); - if (constant_inst->opcode() != SpvOpConstant) { + if (constant_inst->opcode() != spv::Op::OpConstant) { return false; } const opt::Instruction* type_inst = GetInst(id_to, constant_inst->type_id()); - return type_inst->opcode() == SpvOpTypeInt; + return type_inst->opcode() == spv::Op::OpTypeInt; } bool Differ::IsVariable(const IdInstructions& id_to, uint32_t pointer_id) { - return IsOp(id_to, pointer_id, SpvOpVariable); + return IsOp(id_to, pointer_id, spv::Op::OpVariable); } -bool Differ::IsOp(const IdInstructions& id_to, uint32_t id, SpvOp op) { +bool Differ::IsOp(const IdInstructions& id_to, uint32_t id, spv::Op op) { return GetInst(id_to, id)->opcode() == op; } @@ -1858,17 +1957,18 @@ bool Differ::IsPerVertexType(const IdInstructions& id_to, uint32_t type_id) { assert(type_id < id_to.decoration_map_.size()); for (const opt::Instruction* inst : id_to.decoration_map_[type_id]) { - if (inst->opcode() == SpvOpMemberDecorate && + if (inst->opcode() == spv::Op::OpMemberDecorate && inst->GetSingleWordOperand(0) == type_id && - inst->GetSingleWordOperand(2) == SpvDecorationBuiltIn) { - SpvBuiltIn built_in = SpvBuiltIn(inst->GetSingleWordOperand(3)); + spv::Decoration(inst->GetSingleWordOperand(2)) == + spv::Decoration::BuiltIn) { + spv::BuiltIn built_in = spv::BuiltIn(inst->GetSingleWordOperand(3)); // Only gl_PerVertex can have, and it can only have, the following // built-in decorations. - return built_in == SpvBuiltInPosition || - built_in == SpvBuiltInPointSize || - built_in == SpvBuiltInClipDistance || - built_in == SpvBuiltInCullDistance; + return built_in == spv::BuiltIn::Position || + built_in == spv::BuiltIn::PointSize || + built_in == spv::BuiltIn::ClipDistance || + built_in == spv::BuiltIn::CullDistance; } } @@ -1877,12 +1977,12 @@ bool Differ::IsPerVertexType(const IdInstructions& id_to, uint32_t type_id) { bool Differ::IsPerVertexVariable(const IdInstructions& id_to, uint32_t var_id) { // Get the type from the type pointer. - SpvStorageClass storage_class; + spv::StorageClass storage_class; uint32_t type_id = GetVarTypeId(id_to, var_id, &storage_class); const opt::Instruction* type_inst = GetInst(id_to, type_id); // If array, get the element type. - if (type_inst->opcode() == SpvOpTypeArray) { + if (type_inst->opcode() == spv::Op::OpTypeArray) { type_id = type_inst->GetSingleWordInOperand(0); } @@ -1890,21 +1990,21 @@ bool Differ::IsPerVertexVariable(const IdInstructions& id_to, uint32_t var_id) { return IsPerVertexType(id_to, type_id); } -SpvStorageClass Differ::GetPerVertexStorageClass(const opt::Module* module, - uint32_t type_id) { +spv::StorageClass Differ::GetPerVertexStorageClass(const opt::Module* module, + uint32_t type_id) { for (const opt::Instruction& inst : module->types_values()) { switch (inst.opcode()) { - case SpvOpTypeArray: + case spv::Op::OpTypeArray: // The gl_PerVertex instance could be an array, look for a variable of // the array type instead. if (inst.GetSingleWordInOperand(0) == type_id) { type_id = inst.result_id(); } break; - case SpvOpTypePointer: + case spv::Op::OpTypePointer: // Find the storage class of the pointer to this type. if (inst.GetSingleWordInOperand(1) == type_id) { - return SpvStorageClass(inst.GetSingleWordInOperand(0)); + return spv::StorageClass(inst.GetSingleWordInOperand(0)); } break; default: @@ -1915,7 +2015,7 @@ SpvStorageClass Differ::GetPerVertexStorageClass(const opt::Module* module, // gl_PerVertex is declared, but is unused. Return either of Input or Output // classes just so it matches one in the other module. This should be highly // unlikely, perhaps except for ancient GS-used-to-emulate-CS scenarios. - return SpvStorageClassOutput; + return spv::StorageClass::Output; } spv_ext_inst_type_t Differ::GetExtInstType(const IdInstructions& id_to, @@ -1938,12 +2038,16 @@ spv_number_kind_t Differ::GetNumberKind(const IdInstructions& id_to, // Always unsigned integers. *number_bit_width = 32; return SPV_NUMBER_UNSIGNED_INT; + case SPV_OPERAND_TYPE_LITERAL_FLOAT: + // Always float. + *number_bit_width = 32; + return SPV_NUMBER_FLOATING; case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: switch (inst.opcode()) { - case SpvOpSwitch: - case SpvOpConstant: - case SpvOpSpecConstant: + case spv::Op::OpSwitch: + case spv::Op::OpConstant: + case spv::Op::OpSpecConstant: // Same kind of number as the selector (OpSwitch) or the type // (Op*Constant). return GetTypeNumberKind(id_to, inst.GetSingleWordOperand(0), @@ -1969,12 +2073,12 @@ spv_number_kind_t Differ::GetTypeNumberKind(const IdInstructions& id_to, } switch (type_inst->opcode()) { - case SpvOpTypeInt: + case spv::Op::OpTypeInt: *number_bit_width = type_inst->GetSingleWordOperand(1); return type_inst->GetSingleWordOperand(2) == 0 ? SPV_NUMBER_UNSIGNED_INT : SPV_NUMBER_SIGNED_INT; break; - case SpvOpTypeFloat: + case spv::Op::OpTypeFloat: *number_bit_width = type_inst->GetSingleWordOperand(1); return SPV_NUMBER_FLOATING; default: @@ -2059,9 +2163,10 @@ void Differ::MatchEntryPointIds() { } // Otherwise match them by name. - bool matched = false; for (const opt::Instruction* src_inst : src_insts) { for (const opt::Instruction* dst_inst : dst_insts) { + if (id_map_.IsDstMapped(dst_inst)) continue; + const opt::Operand& src_name = src_inst->GetOperand(2); const opt::Operand& dst_name = dst_inst->GetOperand(2); @@ -2070,13 +2175,9 @@ void Differ::MatchEntryPointIds() { uint32_t dst_id = dst_inst->GetSingleWordOperand(1); id_map_.MapIds(src_id, dst_id); id_map_.MapInsts(src_inst, dst_inst); - matched = true; break; } } - if (matched) { - break; - } } } } @@ -2092,7 +2193,7 @@ void Differ::MatchTypeForwardPointers() { return inst.GetSingleWordOperand(0); }; auto accept_type_forward_pointer_ops = [](const opt::Instruction& inst) { - return inst.opcode() == SpvOpTypeForwardPointer; + return inst.opcode() == spv::Op::OpTypeForwardPointer; }; PoolPotentialIds(src_->types_values(), potential_id_map.src_ids, true, @@ -2116,20 +2217,18 @@ void Differ::MatchTypeForwardPointers() { // - If leftover is unique, match // Group forwarded pointers by storage class first and loop over them. - GroupIdsAndMatch( - potential_id_map.src_ids, potential_id_map.dst_ids, SpvStorageClassMax, - &Differ::GroupIdsHelperGetTypePointerStorageClass, + GroupIdsAndMatch( + potential_id_map.src_ids, potential_id_map.dst_ids, + spv::StorageClass::Max, &Differ::GroupIdsHelperGetTypePointerStorageClass, [this](const IdGroup& src_group_by_storage_class, const IdGroup& dst_group_by_storage_class) { - // Group them further by the type they are pointing to and loop over // them. - GroupIdsAndMatch( - src_group_by_storage_class, dst_group_by_storage_class, SpvOpMax, - &Differ::GroupIdsHelperGetTypePointerTypeOp, + GroupIdsAndMatch( + src_group_by_storage_class, dst_group_by_storage_class, + spv::Op::Max, &Differ::GroupIdsHelperGetTypePointerTypeOp, [this](const IdGroup& src_group_by_type_op, const IdGroup& dst_group_by_type_op) { - // Group them even further by debug info, if possible and match by // debug name. MatchTypeForwardPointersByName(src_group_by_type_op, @@ -2182,8 +2281,8 @@ void Differ::MatchTypeIds() { MatchIds(potential_id_map, [this, flexibility]( const opt::Instruction* src_inst, const opt::Instruction* dst_inst) { - const SpvOp src_op = src_inst->opcode(); - const SpvOp dst_op = dst_inst->opcode(); + const spv::Op src_op = src_inst->opcode(); + const spv::Op dst_op = dst_inst->opcode(); // Don't match if the opcode is not the same. if (src_op != dst_op) { @@ -2191,26 +2290,28 @@ void Differ::MatchTypeIds() { } switch (src_op) { - case SpvOpTypeVoid: - case SpvOpTypeBool: - case SpvOpTypeSampler: - // void, bool and sampler are unique, match them. + case spv::Op::OpTypeVoid: + case spv::Op::OpTypeBool: + case spv::Op::OpTypeSampler: + case spv::Op::OpTypeAccelerationStructureNV: + case spv::Op::OpTypeRayQueryKHR: + // the above types have no operands and are unique, match them. return true; - case SpvOpTypeInt: - case SpvOpTypeFloat: - case SpvOpTypeVector: - case SpvOpTypeMatrix: - case SpvOpTypeSampledImage: - case SpvOpTypeRuntimeArray: - case SpvOpTypePointer: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeSampledImage: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypePointer: // Match these instructions when all operands match. assert(src_inst->NumInOperandWords() == dst_inst->NumInOperandWords()); return DoOperandsMatch(src_inst, dst_inst, 0, src_inst->NumInOperandWords()); - case SpvOpTypeFunction: - case SpvOpTypeImage: + case spv::Op::OpTypeFunction: + case spv::Op::OpTypeImage: // Match function types only if they have the same number of operands, // and they all match. // Match image types similarly, expecting the optional final parameter @@ -2221,7 +2322,7 @@ void Differ::MatchTypeIds() { return DoOperandsMatch(src_inst, dst_inst, 0, src_inst->NumInOperandWords()); - case SpvOpTypeArray: + case spv::Op::OpTypeArray: // Match arrays only if the element type and length match. The length // is an id of a constant, so the actual constant it's defining is // compared instead. @@ -2238,7 +2339,7 @@ void Differ::MatchTypeIds() { // example if a spec contant is used). return DoOperandsMatch(src_inst, dst_inst, 1, 1); - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: return MatchOpTypeStruct(src_inst, dst_inst, flexibility); default: @@ -2270,8 +2371,8 @@ void Differ::MatchConstants() { MatchIds(potential_id_map, [this, flexibility]( const opt::Instruction* src_inst, const opt::Instruction* dst_inst) { - const SpvOp src_op = src_inst->opcode(); - const SpvOp dst_op = dst_inst->opcode(); + const spv::Op src_op = src_inst->opcode(); + const spv::Op dst_op = dst_inst->opcode(); // Don't match if the opcode is not the same. if (src_op != dst_op) { @@ -2279,14 +2380,14 @@ void Differ::MatchConstants() { } switch (src_op) { - case SpvOpConstantTrue: - case SpvOpConstantFalse: + case spv::Op::OpConstantTrue: + case spv::Op::OpConstantFalse: // true and false are unique, match them. return true; - case SpvOpConstant: + case spv::Op::OpConstant: return MatchOpConstant(src_inst, dst_inst, flexibility); - case SpvOpConstantComposite: - case SpvOpSpecConstantComposite: + case spv::Op::OpConstantComposite: + case spv::Op::OpSpecConstantComposite: // Composite constants must match in type and value. // // TODO: match OpConstantNull with OpConstantComposite with all zeros @@ -2299,7 +2400,7 @@ void Differ::MatchConstants() { dst_inst->GetOperand(0)) && DoOperandsMatch(src_inst, dst_inst, 0, src_inst->NumInOperandWords()); - case SpvOpConstantSampler: + case spv::Op::OpConstantSampler: // Match sampler constants exactly. // TODO: Allow flexibility in parameters to better diff shaders where // the sampler param has changed. @@ -2307,15 +2408,15 @@ void Differ::MatchConstants() { dst_inst->NumInOperandWords()); return DoOperandsMatch(src_inst, dst_inst, 0, src_inst->NumInOperandWords()); - case SpvOpConstantNull: + case spv::Op::OpConstantNull: // Match null constants as long as the type matches. return DoesOperandMatch(src_inst->GetOperand(0), dst_inst->GetOperand(0)); - case SpvOpSpecConstantTrue: - case SpvOpSpecConstantFalse: - case SpvOpSpecConstant: - case SpvOpSpecConstantOp: + case spv::Op::OpSpecConstantTrue: + case spv::Op::OpSpecConstantFalse: + case spv::Op::OpSpecConstant: + case spv::Op::OpSpecConstantOp: // Match spec constants by name if available, then by the SpecId // decoration. return MatchOpSpecConstant(src_inst, dst_inst); @@ -2334,7 +2435,7 @@ void Differ::MatchVariableIds() { return inst.result_id(); }; auto accept_type_ops = [](const opt::Instruction& inst) { - return inst.opcode() == SpvOpVariable; + return inst.opcode() == spv::Op::OpVariable; }; PoolPotentialIds(src_->types_values(), potential_id_map.src_ids, true, @@ -2350,8 +2451,8 @@ void Differ::MatchVariableIds() { MatchIds(potential_id_map, [this, flexibility](const opt::Instruction* src_inst, const opt::Instruction* dst_inst) { - assert(src_inst->opcode() == SpvOpVariable); - assert(dst_inst->opcode() == SpvOpVariable); + assert(src_inst->opcode() == spv::Op::OpVariable); + assert(dst_inst->opcode() == spv::Op::OpVariable); return MatchOpVariable(src_inst, dst_inst, flexibility); }); @@ -2373,7 +2474,6 @@ void Differ::MatchFunctions() { GroupIdsAndMatch( src_func_ids, dst_func_ids, "", &Differ::GetSanitizedName, [this](const IdGroup& src_group, const IdGroup& dst_group) { - // If there is a single function with this name in src and dst, it's a // definite match. if (src_group.size() == 1 && dst_group.size() == 1) { @@ -2387,7 +2487,6 @@ void Differ::MatchFunctions() { &Differ::GroupIdsHelperGetTypeId, [this](const IdGroup& src_group_by_type_id, const IdGroup& dst_group_by_type_id) { - if (src_group_by_type_id.size() == 1 && dst_group_by_type_id.size() == 1) { id_map_.MapIds(src_group_by_type_id[0], @@ -2432,7 +2531,6 @@ void Differ::MatchFunctions() { src_func_ids, dst_func_ids, 0, &Differ::GroupIdsHelperGetTypeId, [this](const IdGroup& src_group_by_type_id, const IdGroup& dst_group_by_type_id) { - BestEffortMatchFunctions(src_group_by_type_id, dst_group_by_type_id, src_func_insts_, dst_func_insts_); }); @@ -2597,7 +2695,7 @@ void Differ::ToParsedInstruction( parsed_inst->num_words = static_cast(inst_binary.size()); parsed_inst->opcode = static_cast(inst.opcode()); parsed_inst->ext_inst_type = - inst.opcode() == SpvOpExtInst + inst.opcode() == spv::Op::OpExtInst ? GetExtInstType(id_to, original_inst.GetSingleWordInOperand(0)) : SPV_EXT_INST_TYPE_NONE; parsed_inst->type_id = @@ -2642,7 +2740,9 @@ opt::Instruction Differ::ToMappedSrcIds(const opt::Instruction& dst_inst) { } spv_result_t Differ::Output() { - id_map_.MapUnmatchedIds(); + id_map_.MapUnmatchedIds( + [this](uint32_t src_id) { return src_id_to_.IsDefined(src_id); }, + [this](uint32_t dst_id) { return dst_id_to_.IsDefined(dst_id); }); src_id_to_.inst_map_.resize(id_map_.SrcToDstMap().IdBound(), nullptr); dst_id_to_.inst_map_.resize(id_map_.DstToSrcMap().IdBound(), nullptr); diff --git a/bgfx/3rdparty/spirv-tools/source/disassemble.cpp b/bgfx/3rdparty/spirv-tools/source/disassemble.cpp index 1d61b9f9..5173fbf6 100644 --- a/bgfx/3rdparty/spirv-tools/source/disassemble.cpp +++ b/bgfx/3rdparty/spirv-tools/source/disassemble.cpp @@ -244,7 +244,7 @@ void InstructionDisassembler::EmitHeaderSchema(uint32_t schema) { void InstructionDisassembler::EmitInstruction( const spv_parsed_instruction_t& inst, size_t inst_byte_offset) { - auto opcode = static_cast(inst.opcode); + auto opcode = static_cast(inst.opcode); if (inst.result_id) { SetBlue(); @@ -268,7 +268,7 @@ void InstructionDisassembler::EmitInstruction( EmitOperand(inst, i); } - if (comment_ && opcode == SpvOpName) { + if (comment_ && opcode == spv::Op::OpName) { const spv_parsed_operand_t& operand = inst.operands[0]; const uint32_t word = inst.words[operand.offset]; stream_ << " ; id %" << word; @@ -290,8 +290,8 @@ void InstructionDisassembler::EmitInstruction( void InstructionDisassembler::EmitSectionComment( const spv_parsed_instruction_t& inst, bool& inserted_decoration_space, bool& inserted_debug_space, bool& inserted_type_space) { - auto opcode = static_cast(inst.opcode); - if (comment_ && opcode == SpvOpFunction) { + auto opcode = static_cast(inst.opcode); + if (comment_ && opcode == spv::Op::OpFunction) { stream_ << std::endl; stream_ << std::string(indent_, ' '); stream_ << "; Function " << name_mapper_(inst.result_id) << std::endl; @@ -351,13 +351,14 @@ void InstructionDisassembler::EmitOperand(const spv_parsed_instruction_t& inst, } break; case SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER: { spv_opcode_desc opcode_desc; - if (grammar_.lookupOpcode(SpvOp(word), &opcode_desc)) + if (grammar_.lookupOpcode(spv::Op(word), &opcode_desc)) assert(false && "should have caught this earlier"); SetRed(); stream_ << opcode_desc->name; } break; case SPV_OPERAND_TYPE_LITERAL_INTEGER: - case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: { + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: + case SPV_OPERAND_TYPE_LITERAL_FLOAT: { SetRed(); EmitNumericLiteral(&stream_, inst, operand); ResetColor(); diff --git a/bgfx/3rdparty/spirv-tools/source/enum_set.h b/bgfx/3rdparty/spirv-tools/source/enum_set.h index d4d31e33..a3751388 100644 --- a/bgfx/3rdparty/spirv-tools/source/enum_set.h +++ b/bgfx/3rdparty/spirv-tools/source/enum_set.h @@ -1,4 +1,4 @@ -// Copyright (c) 2016 Google Inc. +// Copyright (c) 2023 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,196 +12,457 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SOURCE_ENUM_SET_H_ -#define SOURCE_ENUM_SET_H_ - +#include +#include #include #include -#include -#include -#include +#include +#include +#include +#include + +#ifndef SOURCE_ENUM_SET_H_ +#define SOURCE_ENUM_SET_H_ #include "source/latest_version_spirv_header.h" -#include "source/util/make_unique.h" namespace spvtools { -// A set of values of a 32-bit enum type. -// It is fast and compact for the common case, where enum values -// are at most 63. But it can represent enums with larger values, -// as may appear in extensions. -template +// This container is optimized to store and retrieve unsigned enum values. +// The base model for this implementation is an open-addressing hashtable with +// linear probing. For small enums (max index < 64), all operations are O(1). +// +// - Enums are stored in buckets (64 contiguous values max per bucket) +// - Buckets ranges don't overlap, but don't have to be contiguous. +// - Enums are packed into 64-bits buckets, using 1 bit per enum value. +// +// Example: +// - MyEnum { A = 0, B = 1, C = 64, D = 65 } +// - 2 buckets are required: +// - bucket 0, storing values in the range [ 0; 64[ +// - bucket 1, storing values in the range [64; 128[ +// +// - Buckets are stored in a sorted vector (sorted by bucket range). +// - Retrieval is done by computing the theoretical bucket index using the enum +// value, and +// doing a linear scan from this position. +// - Insertion is done by retrieving the bucket and either: +// - inserting a new bucket in the sorted vector when no buckets has a +// compatible range. +// - setting the corresponding bit in the bucket. +// This means insertion in the middle/beginning can cause a memmove when no +// bucket is available. In our case, this happens at most 23 times for the +// largest enum we have (Opcodes). +template class EnumSet { private: - // The ForEach method will call the functor on enum values in - // enum value order (lowest to highest). To make that easier, use - // an ordered set for the overflow values. - using OverflowSetType = std::set; + using BucketType = uint64_t; + using ElementType = std::underlying_type_t; + static_assert(std::is_enum_v, "EnumSets only works with enums."); + static_assert(std::is_signed_v == false, + "EnumSet doesn't supports signed enums."); + + // Each bucket can hold up to `kBucketSize` distinct, contiguous enum values. + // The first value a bucket can hold must be aligned on `kBucketSize`. + struct Bucket { + // bit mask to store `kBucketSize` enums. + BucketType data; + // 1st enum this bucket can represent. + T start; + + friend bool operator==(const Bucket& lhs, const Bucket& rhs) { + return lhs.start == rhs.start && lhs.data == rhs.data; + } + }; + + // How many distinct values can a bucket hold? 1 bit per value. + static constexpr size_t kBucketSize = sizeof(BucketType) * 8ULL; public: - // Construct an empty set. - EnumSet() {} - // Construct an set with just the given enum value. - explicit EnumSet(EnumType c) { Add(c); } - // Construct an set from an initializer list of enum values. - EnumSet(std::initializer_list cs) { - for (auto c : cs) Add(c); - } - EnumSet(uint32_t count, const EnumType* ptr) { - for (uint32_t i = 0; i < count; ++i) Add(ptr[i]); - } - // Copy constructor. - EnumSet(const EnumSet& other) { *this = other; } - // Move constructor. The moved-from set is emptied. - EnumSet(EnumSet&& other) { - mask_ = other.mask_; - overflow_ = std::move(other.overflow_); - other.mask_ = 0; - other.overflow_.reset(nullptr); - } - // Assignment operator. - EnumSet& operator=(const EnumSet& other) { - if (&other != this) { - mask_ = other.mask_; - overflow_.reset(other.overflow_ ? new OverflowSetType(*other.overflow_) - : nullptr); + class Iterator { + public: + typedef Iterator self_type; + typedef T value_type; + typedef T& reference; + typedef T* pointer; + typedef std::forward_iterator_tag iterator_category; + typedef size_t difference_type; + + Iterator(const Iterator& other) + : set_(other.set_), + bucketIndex_(other.bucketIndex_), + bucketOffset_(other.bucketOffset_) {} + + Iterator& operator++() { + do { + if (bucketIndex_ >= set_->buckets_.size()) { + bucketIndex_ = set_->buckets_.size(); + bucketOffset_ = 0; + break; + } + + if (bucketOffset_ + 1 == kBucketSize) { + bucketOffset_ = 0; + ++bucketIndex_; + } else { + ++bucketOffset_; + } + + } while (bucketIndex_ < set_->buckets_.size() && + !set_->HasEnumAt(bucketIndex_, bucketOffset_)); + return *this; } - return *this; - } - friend bool operator==(const EnumSet& a, const EnumSet& b) { - if (a.mask_ != b.mask_) { - return false; + Iterator operator++(int) { + Iterator old = *this; + operator++(); + return old; } - if (a.overflow_ == nullptr && b.overflow_ == nullptr) { - return true; + T operator*() const { + assert(set_->HasEnumAt(bucketIndex_, bucketOffset_) && + "operator*() called on an invalid iterator."); + return GetValueFromBucket(set_->buckets_[bucketIndex_], bucketOffset_); } - if (a.overflow_ == nullptr || b.overflow_ == nullptr) { - return false; + bool operator!=(const Iterator& other) const { + return set_ != other.set_ || bucketOffset_ != other.bucketOffset_ || + bucketIndex_ != other.bucketIndex_; } - return *a.overflow_ == *b.overflow_; + bool operator==(const Iterator& other) const { + return !(operator!=(other)); + } + + Iterator& operator=(const Iterator& other) { + set_ = other.set_; + bucketIndex_ = other.bucketIndex_; + bucketOffset_ = other.bucketOffset_; + return *this; + } + + private: + Iterator(const EnumSet* set, size_t bucketIndex, ElementType bucketOffset) + : set_(set), bucketIndex_(bucketIndex), bucketOffset_(bucketOffset) {} + + private: + const EnumSet* set_ = nullptr; + // Index of the bucket in the vector. + size_t bucketIndex_ = 0; + // Offset in bits in the current bucket. + ElementType bucketOffset_ = 0; + + friend class EnumSet; + }; + + // Required to allow the use of std::inserter. + using value_type = T; + using const_iterator = Iterator; + using iterator = Iterator; + + public: + iterator cbegin() const noexcept { + auto it = iterator(this, /* bucketIndex= */ 0, /* bucketOffset= */ 0); + if (buckets_.size() == 0) { + return it; + } + + // The iterator has the logic to find the next valid bit. If the value 0 + // is not stored, use it to find the next valid bit. + if (!HasEnumAt(it.bucketIndex_, it.bucketOffset_)) { + ++it; + } + + return it; } - friend bool operator!=(const EnumSet& a, const EnumSet& b) { - return !(a == b); + iterator begin() const noexcept { return cbegin(); } + + iterator cend() const noexcept { + return iterator(this, buckets_.size(), /* bucketOffset= */ 0); } - // Adds the given enum value to the set. This has no effect if the - // enum value is already in the set. - void Add(EnumType c) { AddWord(ToWord(c)); } + iterator end() const noexcept { return cend(); } - // Removes the given enum value from the set. This has no effect if the - // enum value is not in the set. - void Remove(EnumType c) { RemoveWord(ToWord(c)); } + // Creates an empty set. + EnumSet() : buckets_(0), size_(0) {} - // Returns true if this enum value is in the set. - bool Contains(EnumType c) const { return ContainsWord(ToWord(c)); } + // Creates a set and store `value` in it. + EnumSet(T value) : EnumSet() { insert(value); } - // Applies f to each enum in the set, in order from smallest enum - // value to largest. - void ForEach(std::function f) const { - for (uint32_t i = 0; i < 64; ++i) { - if (mask_ & AsMask(i)) f(static_cast(i)); + // Creates a set and stores each `values` in it. + EnumSet(std::initializer_list values) : EnumSet() { + for (auto item : values) { + insert(item); } - if (overflow_) { - for (uint32_t c : *overflow_) f(static_cast(c)); + } + + // Creates a set, and insert `count` enum values pointed by `array` in it. + EnumSet(ElementType count, const T* array) : EnumSet() { + for (ElementType i = 0; i < count; i++) { + insert(array[i]); } } - // Returns true if the set is empty. - bool IsEmpty() const { - if (mask_) return false; - if (overflow_ && !overflow_->empty()) return false; - return true; + // Creates a set initialized with the content of the range [begin; end[. + template + EnumSet(InputIt begin, InputIt end) : EnumSet() { + for (; begin != end; ++begin) { + insert(*begin); + } } - // Returns true if the set contains ANY of the elements of |in_set|, - // or if |in_set| is empty. - bool HasAnyOf(const EnumSet& in_set) const { - if (in_set.IsEmpty()) return true; + // Copies the EnumSet `other` into a new EnumSet. + EnumSet(const EnumSet& other) + : buckets_(other.buckets_), size_(other.size_) {} - if (mask_ & in_set.mask_) return true; + // Moves the EnumSet `other` into a new EnumSet. + EnumSet(EnumSet&& other) + : buckets_(std::move(other.buckets_)), size_(other.size_) {} - if (!overflow_ || !in_set.overflow_) return false; + // Deep-copies the EnumSet `other` into this EnumSet. + EnumSet& operator=(const EnumSet& other) { + buckets_ = other.buckets_; + size_ = other.size_; + return *this; + } + + // Matches std::unordered_set::insert behavior. + std::pair insert(const T& value) { + const size_t index = FindBucketForValue(value); + const ElementType offset = ComputeBucketOffset(value); - for (uint32_t item : *in_set.overflow_) { - if (overflow_->find(item) != overflow_->end()) return true; + if (index >= buckets_.size() || + buckets_[index].start != ComputeBucketStart(value)) { + size_ += 1; + InsertBucketFor(index, value); + return std::make_pair(Iterator(this, index, offset), true); } - return false; + auto& bucket = buckets_[index]; + const auto mask = ComputeMaskForValue(value); + if (bucket.data & mask) { + return std::make_pair(Iterator(this, index, offset), false); + } + + size_ += 1; + bucket.data |= ComputeMaskForValue(value); + return std::make_pair(Iterator(this, index, offset), true); } - private: - // Adds the given enum value (as a 32-bit word) to the set. This has no - // effect if the enum value is already in the set. - void AddWord(uint32_t word) { - if (auto new_bits = AsMask(word)) { - mask_ |= new_bits; - } else { - Overflow().insert(word); + // Inserts `value` in the set if possible. + // Similar to `std::unordered_set::insert`, except the hint is ignored. + // Returns an iterator to the inserted element, or the element preventing + // insertion. + iterator insert(const_iterator, const T& value) { + return insert(value).first; + } + + // Inserts `value` in the set if possible. + // Similar to `std::unordered_set::insert`, except the hint is ignored. + // Returns an iterator to the inserted element, or the element preventing + // insertion. + iterator insert(const_iterator, T&& value) { return insert(value).first; } + + // Inserts all the values in the range [`first`; `last[. + // Similar to `std::unordered_set::insert`. + template + void insert(InputIt first, InputIt last) { + for (auto it = first; it != last; ++it) { + insert(*it); + } + } + + // Removes the value `value` into the set. + // Similar to `std::unordered_set::erase`. + // Returns the number of erased elements. + size_t erase(const T& value) { + const size_t index = FindBucketForValue(value); + if (index >= buckets_.size() || + buckets_[index].start != ComputeBucketStart(value)) { + return 0; + } + + auto& bucket = buckets_[index]; + const auto mask = ComputeMaskForValue(value); + if (!(bucket.data & mask)) { + return 0; } + + size_ -= 1; + bucket.data &= ~mask; + if (bucket.data == 0) { + buckets_.erase(buckets_.cbegin() + index); + } + return 1; } - // Removes the given enum value (as a 32-bit word) from the set. This has no - // effect if the enum value is not in the set. - void RemoveWord(uint32_t word) { - if (auto new_bits = AsMask(word)) { - mask_ &= ~new_bits; - } else { - auto itr = Overflow().find(word); - if (itr != Overflow().end()) Overflow().erase(itr); + // Returns true if `value` is present in the set. + bool contains(T value) const { + const size_t index = FindBucketForValue(value); + if (index >= buckets_.size() || + buckets_[index].start != ComputeBucketStart(value)) { + return false; } + auto& bucket = buckets_[index]; + return bucket.data & ComputeMaskForValue(value); } - // Returns true if the enum represented as a 32-bit word is in the set. - bool ContainsWord(uint32_t word) const { - // We shouldn't call Overflow() since this is a const method. - if (auto bits = AsMask(word)) { - return (mask_ & bits) != 0; - } else if (auto overflow = overflow_.get()) { - return overflow->find(word) != overflow->end(); + // Returns the 1 if `value` is present in the set, `0` otherwise. + inline size_t count(T value) const { return contains(value) ? 1 : 0; } + + // Returns true if the set is holds no values. + inline bool empty() const { return size_ == 0; } + + // Returns the number of enums stored in this set. + size_t size() const { return size_; } + + // Returns true if this set contains at least one value contained in `in_set`. + // Note: If `in_set` is empty, this function returns true. + bool HasAnyOf(const EnumSet& in_set) const { + if (in_set.empty()) { + return true; + } + + auto lhs = buckets_.cbegin(); + auto rhs = in_set.buckets_.cbegin(); + + while (lhs != buckets_.cend() && rhs != in_set.buckets_.cend()) { + if (lhs->start == rhs->start) { + if (lhs->data & rhs->data) { + // At least 1 bit is shared. Early return. + return true; + } + + lhs++; + rhs++; + continue; + } + + // LHS bucket is smaller than the current RHS bucket. Catching up on RHS. + if (lhs->start < rhs->start) { + lhs++; + continue; + } + + // Otherwise, RHS needs to catch up on LHS. + rhs++; } - // The word is large, but the set doesn't have large members, so - // it doesn't have an overflow set. + return false; } - // Returns the enum value as a uint32_t. - uint32_t ToWord(EnumType value) const { - static_assert(sizeof(EnumType) <= sizeof(uint32_t), - "EnumType must statically castable to uint32_t"); - return static_cast(value); + private: + // Returns the index of the last bucket in which `value` could be stored. + static constexpr inline size_t ComputeLargestPossibleBucketIndexFor(T value) { + return static_cast(value) / kBucketSize; } - // Determines whether the given enum value can be represented - // as a bit in a uint64_t mask. If so, then returns that mask bit. - // Otherwise, returns 0. - uint64_t AsMask(uint32_t word) const { - if (word > 63) return 0; - return uint64_t(1) << word; + // Returns the smallest enum value that could be contained in the same bucket + // as `value`. + static constexpr inline T ComputeBucketStart(T value) { + return static_cast(kBucketSize * + ComputeLargestPossibleBucketIndexFor(value)); } - // Ensures that overflow_set_ references a set. A new empty set is - // allocated if one doesn't exist yet. Returns overflow_set_. - OverflowSetType& Overflow() { - if (overflow_.get() == nullptr) { - overflow_ = MakeUnique(); + // Returns the index of the bit that corresponds to `value` in the bucket. + static constexpr inline ElementType ComputeBucketOffset(T value) { + return static_cast(value) % kBucketSize; + } + + // Returns the bitmask used to represent the enum `value` in its bucket. + static constexpr inline BucketType ComputeMaskForValue(T value) { + return 1ULL << ComputeBucketOffset(value); + } + + // Returns the `enum` stored in `bucket` at `offset`. + // `offset` is the bit-offset in the bucket storage. + static constexpr inline T GetValueFromBucket(const Bucket& bucket, + BucketType offset) { + return static_cast(static_cast(bucket.start) + offset); + } + + // For a given enum `value`, finds the bucket index that could contain this + // value. If no such bucket is found, the index at which the new bucket should + // be inserted is returned. + size_t FindBucketForValue(T value) const { + // Set is empty, insert at 0. + if (buckets_.size() == 0) { + return 0; } - return *overflow_; + + const T wanted_start = ComputeBucketStart(value); + assert(buckets_.size() > 0 && + "Size must not be 0 here. Has the code above changed?"); + size_t index = std::min(buckets_.size() - 1, + ComputeLargestPossibleBucketIndexFor(value)); + + // This loops behaves like std::upper_bound with a reverse iterator. + // Buckets are sorted. 3 main cases: + // - The bucket matches + // => returns the bucket index. + // - The found bucket is larger + // => scans left until it finds the correct bucket, or insertion point. + // - The found bucket is smaller + // => We are at the end, so we return past-end index for insertion. + for (; buckets_[index].start >= wanted_start; index--) { + if (index == 0) { + return 0; + } + } + + return index + 1; + } + + // Creates a new bucket to store `value` and inserts it at `index`. + // If the `index` is past the end, the bucket is inserted at the end of the + // vector. + void InsertBucketFor(size_t index, T value) { + const T bucket_start = ComputeBucketStart(value); + Bucket bucket = {1ULL << ComputeBucketOffset(value), bucket_start}; + auto it = buckets_.emplace(buckets_.begin() + index, std::move(bucket)); +#if defined(NDEBUG) + (void)it; // Silencing unused variable warning. +#else + assert(std::next(it) == buckets_.end() || + std::next(it)->start > bucket_start); + assert(it == buckets_.begin() || std::prev(it)->start < bucket_start); +#endif + } + + // Returns true if the bucket at `bucketIndex/ stores the enum at + // `bucketOffset`, false otherwise. + bool HasEnumAt(size_t bucketIndex, BucketType bucketOffset) const { + assert(bucketIndex < buckets_.size()); + assert(bucketOffset < kBucketSize); + return buckets_[bucketIndex].data & (1ULL << bucketOffset); + } + + // Returns true if `lhs` and `rhs` hold the exact same values. + friend bool operator==(const EnumSet& lhs, const EnumSet& rhs) { + if (lhs.size_ != rhs.size_) { + return false; + } + + if (lhs.buckets_.size() != rhs.buckets_.size()) { + return false; + } + return lhs.buckets_ == rhs.buckets_; + } + + // Returns true if `lhs` and `rhs` hold at least 1 different value. + friend bool operator!=(const EnumSet& lhs, const EnumSet& rhs) { + return !(lhs == rhs); } - // Enums with values up to 63 are stored as bits in this mask. - uint64_t mask_ = 0; - // Enums with values larger than 63 are stored in this set. - // This set should normally be empty or very small. - std::unique_ptr overflow_ = {}; + // Storage for the buckets. + std::vector buckets_; + // How many enums is this set storing. + size_t size_ = 0; }; -// A set of SpvCapability, optimized for small capability values. -using CapabilitySet = EnumSet; +// A set of spv::Capability. +using CapabilitySet = EnumSet; } // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/enum_string_mapping.h b/bgfx/3rdparty/spirv-tools/source/enum_string_mapping.h index af8f56b8..b1365840 100644 --- a/bgfx/3rdparty/spirv-tools/source/enum_string_mapping.h +++ b/bgfx/3rdparty/spirv-tools/source/enum_string_mapping.h @@ -29,7 +29,7 @@ bool GetExtensionFromString(const char* str, Extension* extension); const char* ExtensionToString(Extension extension); // Returns text string corresponding to |capability|. -const char* CapabilityToString(SpvCapability capability); +const char* CapabilityToString(spv::Capability capability); } // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/extensions.cpp b/bgfx/3rdparty/spirv-tools/source/extensions.cpp index 049a3ad1..ac987fcc 100644 --- a/bgfx/3rdparty/spirv-tools/source/extensions.cpp +++ b/bgfx/3rdparty/spirv-tools/source/extensions.cpp @@ -24,7 +24,9 @@ namespace spvtools { std::string GetExtensionString(const spv_parsed_instruction_t* inst) { - if (inst->opcode != SpvOpExtension) return "ERROR_not_op_extension"; + if (inst->opcode != static_cast(spv::Op::OpExtension)) { + return "ERROR_not_op_extension"; + } assert(inst->num_operands == 1); @@ -38,8 +40,9 @@ std::string GetExtensionString(const spv_parsed_instruction_t* inst) { std::string ExtensionSetToString(const ExtensionSet& extensions) { std::stringstream ss; - extensions.ForEach( - [&ss](Extension ext) { ss << ExtensionToString(ext) << " "; }); + for (auto extension : extensions) { + ss << ExtensionToString(extension) << " "; + } return ss.str(); } diff --git a/bgfx/3rdparty/spirv-tools/source/extensions.h b/bgfx/3rdparty/spirv-tools/source/extensions.h index 8023444c..cda4924a 100644 --- a/bgfx/3rdparty/spirv-tools/source/extensions.h +++ b/bgfx/3rdparty/spirv-tools/source/extensions.h @@ -15,6 +15,7 @@ #ifndef SOURCE_EXTENSIONS_H_ #define SOURCE_EXTENSIONS_H_ +#include #include #include "source/enum_set.h" @@ -23,7 +24,7 @@ namespace spvtools { // The known SPIR-V extensions. -enum Extension { +enum Extension : uint32_t { #include "extension_enum.inc" }; diff --git a/bgfx/3rdparty/spirv-tools/source/instruction.h b/bgfx/3rdparty/spirv-tools/source/instruction.h index 9e7dccd0..2acbb572 100644 --- a/bgfx/3rdparty/spirv-tools/source/instruction.h +++ b/bgfx/3rdparty/spirv-tools/source/instruction.h @@ -26,7 +26,7 @@ struct spv_instruction_t { // Normally, both opcode and extInstType contain valid data. // However, when the assembler parses ! as the first word in // an instruction and opcode and extInstType are invalid. - SpvOp opcode; + spv::Op opcode; spv_ext_inst_type_t extInstType; // The Id of the result type, if this instruction has one. Zero otherwise. diff --git a/bgfx/3rdparty/spirv-tools/source/latest_version_spirv_header.h b/bgfx/3rdparty/spirv-tools/source/latest_version_spirv_header.h index e4f28e43..f6ab5c84 100644 --- a/bgfx/3rdparty/spirv-tools/source/latest_version_spirv_header.h +++ b/bgfx/3rdparty/spirv-tools/source/latest_version_spirv_header.h @@ -15,6 +15,6 @@ #ifndef SOURCE_LATEST_VERSION_SPIRV_HEADER_H_ #define SOURCE_LATEST_VERSION_SPIRV_HEADER_H_ -#include "spirv/unified1/spirv.h" +#include "spirv/unified1/spirv.hpp11" #endif // SOURCE_LATEST_VERSION_SPIRV_HEADER_H_ diff --git a/bgfx/3rdparty/spirv-tools/source/libspirv.cpp b/bgfx/3rdparty/spirv-tools/source/libspirv.cpp index be76caaa..83e8629b 100644 --- a/bgfx/3rdparty/spirv-tools/source/libspirv.cpp +++ b/bgfx/3rdparty/spirv-tools/source/libspirv.cpp @@ -108,6 +108,40 @@ bool SpirvTools::Disassemble(const uint32_t* binary, const size_t binary_size, return status == SPV_SUCCESS; } +struct CxxParserContext { + const HeaderParser& header_parser; + const InstructionParser& instruction_parser; +}; + +bool SpirvTools::Parse(const std::vector& binary, + const HeaderParser& header_parser, + const InstructionParser& instruction_parser, + spv_diagnostic* diagnostic) { + CxxParserContext parser_context = {header_parser, instruction_parser}; + + spv_parsed_header_fn_t header_fn_wrapper = + [](void* user_data, spv_endianness_t endianness, uint32_t magic, + uint32_t version, uint32_t generator, uint32_t id_bound, + uint32_t reserved) { + CxxParserContext* ctx = reinterpret_cast(user_data); + spv_parsed_header_t header = {magic, version, generator, id_bound, + reserved}; + + return ctx->header_parser(endianness, header); + }; + + spv_parsed_instruction_fn_t instruction_fn_wrapper = + [](void* user_data, const spv_parsed_instruction_t* instruction) { + CxxParserContext* ctx = reinterpret_cast(user_data); + return ctx->instruction_parser(*instruction); + }; + + spv_result_t status = spvBinaryParse( + impl_->context, &parser_context, binary.data(), binary.size(), + header_fn_wrapper, instruction_fn_wrapper, diagnostic); + return status == SPV_SUCCESS; +} + bool SpirvTools::Validate(const std::vector& binary) const { return Validate(binary.data(), binary.size()); } diff --git a/bgfx/3rdparty/spirv-tools/source/link/linker.cpp b/bgfx/3rdparty/spirv-tools/source/link/linker.cpp index 3b388cc6..58930e45 100644 --- a/bgfx/3rdparty/spirv-tools/source/link/linker.cpp +++ b/bgfx/3rdparty/spirv-tools/source/link/linker.cpp @@ -57,12 +57,12 @@ using opt::analysis::TypeManager; // Stores various information about an imported or exported symbol. struct LinkageSymbolInfo { - SpvId id; // ID of the symbol - SpvId type_id; // ID of the type of the symbol + spv::Id id; // ID of the symbol + spv::Id type_id; // ID of the type of the symbol std::string name; // unique name defining the symbol and used for matching // imports and exports together - std::vector parameter_ids; // ID of the parameters of the symbol, if - // it is a function + std::vector parameter_ids; // ID of the parameters of the symbol, if + // it is a function }; struct LinkageEntry { LinkageSymbolInfo imported_symbol; @@ -91,7 +91,8 @@ spv_result_t ShiftIdsInModules(const MessageConsumer& consumer, // should be non-null. |max_id_bound| should be strictly greater than 0. spv_result_t GenerateHeader(const MessageConsumer& consumer, const std::vector& modules, - uint32_t max_id_bound, opt::ModuleHeader* header); + uint32_t max_id_bound, opt::ModuleHeader* header, + const LinkerOptions& options); // Merge all the modules from |in_modules| into a single module owned by // |linked_context|. @@ -202,7 +203,8 @@ spv_result_t ShiftIdsInModules(const MessageConsumer& consumer, spv_result_t GenerateHeader(const MessageConsumer& consumer, const std::vector& modules, - uint32_t max_id_bound, opt::ModuleHeader* header) { + uint32_t max_id_bound, opt::ModuleHeader* header, + const LinkerOptions& options) { spv_position_t position = {}; if (modules.empty()) @@ -212,10 +214,12 @@ spv_result_t GenerateHeader(const MessageConsumer& consumer, return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_DATA) << "|max_id_bound| of GenerateHeader should not be null."; - const uint32_t linked_version = modules.front()->version(); + uint32_t linked_version = modules.front()->version(); for (std::size_t i = 1; i < modules.size(); ++i) { const uint32_t module_version = modules[i]->version(); - if (module_version != linked_version) + if (options.GetUseHighestVersion()) { + linked_version = std::max(linked_version, module_version); + } else if (module_version != linked_version) { return DiagnosticStream({0, 0, 1}, consumer, "", SPV_ERROR_INTERNAL) << "Conflicting SPIR-V versions: " << SPV_SPIRV_VERSION_MAJOR_PART(linked_version) << "." @@ -224,9 +228,10 @@ spv_result_t GenerateHeader(const MessageConsumer& consumer, << SPV_SPIRV_VERSION_MAJOR_PART(module_version) << "." << SPV_SPIRV_VERSION_MINOR_PART(module_version) << " (input module " << (i + 1) << ")."; + } } - header->magic_number = SpvMagicNumber; + header->magic_number = spv::MagicNumber; header->version = linked_version; header->generator = SPV_GENERATOR_WORD(SPV_GENERATOR_KHRONOS_LINKER, 0); header->bound = max_id_bound; @@ -367,7 +372,7 @@ spv_result_t MergeModules(const MessageConsumer& consumer, std::vector processed_words = spvtools::utils::MakeVector(processed_string); linked_module->AddDebug3Inst(std::unique_ptr( - new Instruction(linked_context, SpvOpModuleProcessed, 0u, 0u, + new Instruction(linked_context, spv::Op::OpModuleProcessed, 0u, 0u, {{SPV_OPERAND_TYPE_LITERAL_STRING, processed_words}}))); } @@ -377,7 +382,7 @@ spv_result_t MergeModules(const MessageConsumer& consumer, std::unique_ptr(inst.Clone(linked_context))); // TODO(pierremoreau): Since the modules have not been validate, should we - // expect SpvStorageClassFunction variables outside + // expect spv::StorageClass::Function variables outside // functions? for (const auto& module : input_modules) { for (const auto& inst : module->types_values()) { @@ -414,16 +419,18 @@ spv_result_t GetImportExportPairs(const MessageConsumer& consumer, // Figure out the imports and exports for (const auto& decoration : linked_context.annotations()) { - if (decoration.opcode() != SpvOpDecorate || - decoration.GetSingleWordInOperand(1u) != SpvDecorationLinkageAttributes) + if (decoration.opcode() != spv::Op::OpDecorate || + spv::Decoration(decoration.GetSingleWordInOperand(1u)) != + spv::Decoration::LinkageAttributes) continue; - const SpvId id = decoration.GetSingleWordInOperand(0u); + const spv::Id id = decoration.GetSingleWordInOperand(0u); // Ignore if the targeted symbol is a built-in bool is_built_in = false; for (const auto& id_decoration : decoration_manager.GetDecorationsFor(id, false)) { - if (id_decoration->GetSingleWordInOperand(1u) == SpvDecorationBuiltIn) { + if (spv::Decoration(id_decoration->GetSingleWordInOperand(1u)) == + spv::Decoration::BuiltIn) { is_built_in = true; break; } @@ -447,9 +454,9 @@ spv_result_t GetImportExportPairs(const MessageConsumer& consumer, return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_BINARY) << "ID " << id << " is never defined:\n"; - if (def_inst->opcode() == SpvOpVariable) { + if (def_inst->opcode() == spv::Op::OpVariable) { symbol_info.type_id = def_inst->type_id(); - } else if (def_inst->opcode() == SpvOpFunction) { + } else if (def_inst->opcode() == spv::Op::OpFunction) { symbol_info.type_id = def_inst->GetSingleWordInOperand(1u); // range-based for loop calls begin()/end(), but never cbegin()/cend(), @@ -467,9 +474,9 @@ spv_result_t GetImportExportPairs(const MessageConsumer& consumer, << " LinkageAttributes; " << id << " is neither of them.\n"; } - if (type == SpvLinkageTypeImport) + if (spv::LinkageType(type) == spv::LinkageType::Import) imports.push_back(symbol_info); - else if (type == SpvLinkageTypeExport) + else if (spv::LinkageType(type) == spv::LinkageType::Export) exports[symbol_info.name].push_back(symbol_info); } @@ -585,7 +592,7 @@ spv_result_t RemoveLinkageSpecificInstructions( // TODO(pierremoreau): This will not work if the decoration is applied // through a group, but the linker does not support that // either. - std::unordered_set imports; + std::unordered_set imports; if (options.GetAllowPartialLinkage()) { imports.reserve(linkings_to_do.size()); for (const auto& linking_entry : linkings_to_do) @@ -601,9 +608,11 @@ spv_result_t RemoveLinkageSpecificInstructions( // * if we do not allow partial linkage, remove all import annotations; // * otherwise, remove the annotation only if there was a corresponding // export. - if (inst->opcode() == SpvOpDecorate && - inst->GetSingleWordOperand(1u) == SpvDecorationLinkageAttributes && - inst->GetSingleWordOperand(3u) == SpvLinkageTypeImport && + if (inst->opcode() == spv::Op::OpDecorate && + spv::Decoration(inst->GetSingleWordOperand(1u)) == + spv::Decoration::LinkageAttributes && + spv::LinkageType(inst->GetSingleWordOperand(3u)) == + spv::LinkageType::Import && (!options.GetAllowPartialLinkage() || imports.find(inst->GetSingleWordOperand(0u)) != imports.end())) { linked_context->KillInst(&*inst); @@ -616,9 +625,11 @@ spv_result_t RemoveLinkageSpecificInstructions( for (auto inst = next; inst != linked_context->annotation_end(); inst = next) { ++next; - if (inst->opcode() == SpvOpDecorate && - inst->GetSingleWordOperand(1u) == SpvDecorationLinkageAttributes && - inst->GetSingleWordOperand(3u) == SpvLinkageTypeExport) { + if (inst->opcode() == spv::Op::OpDecorate && + spv::Decoration(inst->GetSingleWordOperand(1u)) == + spv::Decoration::LinkageAttributes && + spv::LinkageType(inst->GetSingleWordOperand(3u)) == + spv::LinkageType::Export) { linked_context->KillInst(&*inst); } } @@ -628,10 +639,11 @@ spv_result_t RemoveLinkageSpecificInstructions( // not allowed if (!options.GetCreateLibrary() && !options.GetAllowPartialLinkage()) { for (auto& inst : linked_context->capabilities()) - if (inst.GetSingleWordInOperand(0u) == SpvCapabilityLinkage) { + if (spv::Capability(inst.GetSingleWordInOperand(0u)) == + spv::Capability::Linkage) { linked_context->KillInst(&inst); // The RemoveDuplicatesPass did remove duplicated capabilities, so we - // now there aren’t more SpvCapabilityLinkage further down. + // now there aren’t more spv::Capability::Linkage further down. break; } } @@ -671,7 +683,7 @@ spv_result_t VerifyLimits(const MessageConsumer& consumer, size_t num_global_values = 0u; for (const auto& inst : linked_context.module()->types_values()) { - num_global_values += inst.opcode() == SpvOpVariable; + num_global_values += inst.opcode() == spv::Op::OpVariable; } if (num_global_values >= SPV_LIMIT_GLOBAL_VARIABLES_MAX) DiagnosticStream(position, consumer, "", SPV_WARNING) @@ -746,7 +758,7 @@ spv_result_t Link(const Context& context, const uint32_t* const* binaries, // Phase 2: Generate the header opt::ModuleHeader header; - res = GenerateHeader(consumer, modules, max_id_bound, &header); + res = GenerateHeader(consumer, modules, max_id_bound, &header, options); if (res != SPV_SUCCESS) return res; IRContext linked_context(c_context->target_env, consumer); linked_context.module()->SetHeader(header); diff --git a/bgfx/3rdparty/spirv-tools/source/lint/divergence_analysis.cpp b/bgfx/3rdparty/spirv-tools/source/lint/divergence_analysis.cpp index b5a72b45..fe32e1ac 100644 --- a/bgfx/3rdparty/spirv-tools/source/lint/divergence_analysis.cpp +++ b/bgfx/3rdparty/spirv-tools/source/lint/divergence_analysis.cpp @@ -19,7 +19,6 @@ #include "source/opt/dataflow.h" #include "source/opt/function.h" #include "source/opt/instruction.h" -#include "spirv/unified1/spirv.h" namespace spvtools { namespace lint { @@ -32,7 +31,7 @@ void DivergenceAnalysis::EnqueueSuccessors(opt::Instruction* inst) { uint32_t block_id; if (inst->IsBlockTerminator()) { block_id = context().get_instr_block(inst)->id(); - } else if (inst->opcode() == SpvOpLabel) { + } else if (inst->opcode() == spv::Op::OpLabel) { block_id = inst->result_id(); opt::BasicBlock* bb = context().cfg()->block(block_id); // Only enqueue phi instructions, as other uses don't affect divergence. @@ -54,7 +53,7 @@ void DivergenceAnalysis::EnqueueSuccessors(opt::Instruction* inst) { opt::DataFlowAnalysis::VisitResult DivergenceAnalysis::Visit( opt::Instruction* inst) { - if (inst->opcode() == SpvOpLabel) { + if (inst->opcode() == spv::Op::OpLabel) { return VisitBlock(inst->result_id()); } else { return VisitInstruction(inst); @@ -128,12 +127,12 @@ DivergenceAnalysis::ComputeInstructionDivergence(opt::Instruction* inst) { // Device/QueueFamily could satisfy fully uniform. uint32_t id = inst->result_id(); // Handle divergence roots. - if (inst->opcode() == SpvOpFunctionParameter) { + if (inst->opcode() == spv::Op::OpFunctionParameter) { divergence_source_[id] = 0; return divergence_[id] = DivergenceLevel::kDivergent; } else if (inst->IsLoad()) { spvtools::opt::Instruction* var = inst->GetBaseAddress(); - if (var->opcode() != SpvOpVariable) { + if (var->opcode() != spv::Op::OpVariable) { // Assume divergent. divergence_source_[id] = 0; return DivergenceLevel::kDivergent; @@ -166,29 +165,30 @@ DivergenceAnalysis::ComputeVariableDivergence(opt::Instruction* var) { uint32_t def_id = var->result_id(); DivergenceLevel ret; switch (type->storage_class()) { - case SpvStorageClassFunction: - case SpvStorageClassGeneric: - case SpvStorageClassAtomicCounter: - case SpvStorageClassStorageBuffer: - case SpvStorageClassPhysicalStorageBuffer: - case SpvStorageClassOutput: - case SpvStorageClassWorkgroup: - case SpvStorageClassImage: // Image atomics probably aren't uniform. - case SpvStorageClassPrivate: + case spv::StorageClass::Function: + case spv::StorageClass::Generic: + case spv::StorageClass::AtomicCounter: + case spv::StorageClass::StorageBuffer: + case spv::StorageClass::PhysicalStorageBuffer: + case spv::StorageClass::Output: + case spv::StorageClass::Workgroup: + case spv::StorageClass::Image: // Image atomics probably aren't uniform. + case spv::StorageClass::Private: ret = DivergenceLevel::kDivergent; break; - case SpvStorageClassInput: + case spv::StorageClass::Input: ret = DivergenceLevel::kDivergent; // If this variable has a Flat decoration, it is partially uniform. // TODO(kuhar): Track access chain indices and also consider Flat members // of a structure. context().get_decoration_mgr()->WhileEachDecoration( - def_id, SpvDecorationFlat, [&ret](const opt::Instruction&) { + def_id, static_cast(spv::Decoration::Flat), + [&ret](const opt::Instruction&) { ret = DivergenceLevel::kPartiallyUniform; return false; }); break; - case SpvStorageClassUniformConstant: + case spv::StorageClass::UniformConstant: // May be a storage image which is also written to; mark those as // divergent. if (!var->IsVulkanStorageImage() || var->IsReadOnlyPointer()) { @@ -197,9 +197,10 @@ DivergenceAnalysis::ComputeVariableDivergence(opt::Instruction* var) { ret = DivergenceLevel::kDivergent; } break; - case SpvStorageClassUniform: - case SpvStorageClassPushConstant: - case SpvStorageClassCrossWorkgroup: // Not for shaders; default uniform. + case spv::StorageClass::Uniform: + case spv::StorageClass::PushConstant: + case spv::StorageClass::CrossWorkgroup: // Not for shaders; default + // uniform. default: ret = DivergenceLevel::kUniform; break; @@ -216,7 +217,7 @@ void DivergenceAnalysis::Setup(opt::Function* function) { function->entry().get(), [this](const opt::BasicBlock* bb) { uint32_t id = bb->id(); if (bb->terminator() == nullptr || - bb->terminator()->opcode() != SpvOpBranch) { + bb->terminator()->opcode() != spv::Op::OpBranch) { follow_unconditional_branches_[id] = id; } else { uint32_t target_id = bb->terminator()->GetSingleWordInOperand(0); diff --git a/bgfx/3rdparty/spirv-tools/source/lint/lint_divergent_derivatives.cpp b/bgfx/3rdparty/spirv-tools/source/lint/lint_divergent_derivatives.cpp index 512847b0..82d5ac63 100644 --- a/bgfx/3rdparty/spirv-tools/source/lint/lint_divergent_derivatives.cpp +++ b/bgfx/3rdparty/spirv-tools/source/lint/lint_divergent_derivatives.cpp @@ -27,7 +27,6 @@ #include "source/opt/instruction.h" #include "source/opt/ir_context.h" #include "spirv-tools/libspirv.h" -#include "spirv/unified1/spirv.h" namespace spvtools { namespace lint { @@ -43,7 +42,7 @@ std::string GetFriendlyName(opt::IRContext* context, uint32_t id) { ss << id; } else { opt::Instruction* inst_name = names.begin()->second; - if (inst_name->opcode() == SpvOpName) { + if (inst_name->opcode() == spv::Op::OpName) { ss << names.begin()->second->GetInOperand(0).AsString(); ss << "[" << id << "]"; } else { @@ -54,26 +53,26 @@ std::string GetFriendlyName(opt::IRContext* context, uint32_t id) { } bool InstructionHasDerivative(const opt::Instruction& inst) { - static const SpvOp derivative_opcodes[] = { + static const spv::Op derivative_opcodes[] = { // Implicit derivatives. - SpvOpImageSampleImplicitLod, - SpvOpImageSampleDrefImplicitLod, - SpvOpImageSampleProjImplicitLod, - SpvOpImageSampleProjDrefImplicitLod, - SpvOpImageSparseSampleImplicitLod, - SpvOpImageSparseSampleDrefImplicitLod, - SpvOpImageSparseSampleProjImplicitLod, - SpvOpImageSparseSampleProjDrefImplicitLod, + spv::Op::OpImageSampleImplicitLod, + spv::Op::OpImageSampleDrefImplicitLod, + spv::Op::OpImageSampleProjImplicitLod, + spv::Op::OpImageSampleProjDrefImplicitLod, + spv::Op::OpImageSparseSampleImplicitLod, + spv::Op::OpImageSparseSampleDrefImplicitLod, + spv::Op::OpImageSparseSampleProjImplicitLod, + spv::Op::OpImageSparseSampleProjDrefImplicitLod, // Explicit derivatives. - SpvOpDPdx, - SpvOpDPdy, - SpvOpFwidth, - SpvOpDPdxFine, - SpvOpDPdyFine, - SpvOpFwidthFine, - SpvOpDPdxCoarse, - SpvOpDPdyCoarse, - SpvOpFwidthCoarse, + spv::Op::OpDPdx, + spv::Op::OpDPdy, + spv::Op::OpFwidth, + spv::Op::OpDPdxFine, + spv::Op::OpDPdyFine, + spv::Op::OpFwidthFine, + spv::Op::OpDPdxCoarse, + spv::Op::OpDPdyCoarse, + spv::Op::OpFwidthCoarse, }; return std::find(std::begin(derivative_opcodes), std::end(derivative_opcodes), inst.opcode()) != std::end(derivative_opcodes); @@ -97,13 +96,14 @@ void PrintDivergenceFlow(opt::IRContext* context, DivergenceAnalysis div, opt::analysis::DefUseManager* def_use = context->get_def_use_mgr(); opt::CFG* cfg = context->cfg(); while (id != 0) { - bool is_block = def_use->GetDef(id)->opcode() == SpvOpLabel; + bool is_block = def_use->GetDef(id)->opcode() == spv::Op::OpLabel; if (is_block) { Warn(context, nullptr) << "block " << GetFriendlyName(context, id) << " is divergent"; uint32_t source = div.GetDivergenceSource(id); // Skip intermediate blocks. - while (source != 0 && def_use->GetDef(source)->opcode() == SpvOpLabel) { + while (source != 0 && + def_use->GetDef(source)->opcode() == spv::Op::OpLabel) { id = source; source = div.GetDivergenceSource(id); } @@ -122,7 +122,7 @@ void PrintDivergenceFlow(opt::IRContext* context, DivergenceAnalysis div, opt::Instruction* source_def = source == 0 ? nullptr : def_use->GetDef(source); // First print data -> data dependencies. - while (source != 0 && source_def->opcode() != SpvOpLabel) { + while (source != 0 && source_def->opcode() != spv::Op::OpLabel) { Warn(context, def_use->GetDef(id)) << "because " << GetFriendlyName(context, id) << " uses value " << GetFriendlyName(context, source) diff --git a/bgfx/3rdparty/spirv-tools/source/lint/linter.cpp b/bgfx/3rdparty/spirv-tools/source/lint/linter.cpp index e4ed04ea..74806767 100644 --- a/bgfx/3rdparty/spirv-tools/source/lint/linter.cpp +++ b/bgfx/3rdparty/spirv-tools/source/lint/linter.cpp @@ -19,7 +19,6 @@ #include "source/opt/ir_context.h" #include "spirv-tools/libspirv.h" #include "spirv-tools/libspirv.hpp" -#include "spirv/unified1/spirv.h" namespace spvtools { diff --git a/bgfx/3rdparty/spirv-tools/source/name_mapper.cpp b/bgfx/3rdparty/spirv-tools/source/name_mapper.cpp index 3b31d33a..b2d0f445 100644 --- a/bgfx/3rdparty/spirv-tools/source/name_mapper.cpp +++ b/bgfx/3rdparty/spirv-tools/source/name_mapper.cpp @@ -100,18 +100,18 @@ void FriendlyNameMapper::SaveName(uint32_t id, void FriendlyNameMapper::SaveBuiltInName(uint32_t target_id, uint32_t built_in) { #define GLCASE(name) \ - case SpvBuiltIn##name: \ + case spv::BuiltIn::name: \ SaveName(target_id, "gl_" #name); \ return; #define GLCASE2(name, suggested) \ - case SpvBuiltIn##name: \ + case spv::BuiltIn::name: \ SaveName(target_id, "gl_" #suggested); \ return; #define CASE(name) \ - case SpvBuiltIn##name: \ + case spv::BuiltIn::name: \ SaveName(target_id, #name); \ return; - switch (built_in) { + switch (spv::BuiltIn(built_in)) { GLCASE(Position) GLCASE(PointSize) GLCASE(ClipDistance) @@ -170,28 +170,28 @@ void FriendlyNameMapper::SaveBuiltInName(uint32_t target_id, spv_result_t FriendlyNameMapper::ParseInstruction( const spv_parsed_instruction_t& inst) { const auto result_id = inst.result_id; - switch (inst.opcode) { - case SpvOpName: + switch (spv::Op(inst.opcode)) { + case spv::Op::OpName: SaveName(inst.words[1], spvDecodeLiteralStringOperand(inst, 1)); break; - case SpvOpDecorate: + case spv::Op::OpDecorate: // Decorations come after OpName. So OpName will take precedence over // decorations. // // In theory, we should also handle OpGroupDecorate. But that's unlikely // to occur. - if (inst.words[2] == SpvDecorationBuiltIn) { + if (spv::Decoration(inst.words[2]) == spv::Decoration::BuiltIn) { assert(inst.num_words > 3); SaveBuiltInName(inst.words[1], inst.words[3]); } break; - case SpvOpTypeVoid: + case spv::Op::OpTypeVoid: SaveName(result_id, "void"); break; - case SpvOpTypeBool: + case spv::Op::OpTypeBool: SaveName(result_id, "bool"); break; - case SpvOpTypeInt: { + case spv::Op::OpTypeInt: { std::string signedness; std::string root; const auto bit_width = inst.words[2]; @@ -216,7 +216,7 @@ spv_result_t FriendlyNameMapper::ParseInstruction( if (0 == inst.words[3]) signedness = "u"; SaveName(result_id, signedness + root); } break; - case SpvOpTypeFloat: { + case spv::Op::OpTypeFloat: { const auto bit_width = inst.words[2]; switch (bit_width) { case 16: @@ -233,68 +233,68 @@ spv_result_t FriendlyNameMapper::ParseInstruction( break; } } break; - case SpvOpTypeVector: + case spv::Op::OpTypeVector: SaveName(result_id, std::string("v") + to_string(inst.words[3]) + NameForId(inst.words[2])); break; - case SpvOpTypeMatrix: + case spv::Op::OpTypeMatrix: SaveName(result_id, std::string("mat") + to_string(inst.words[3]) + NameForId(inst.words[2])); break; - case SpvOpTypeArray: + case spv::Op::OpTypeArray: SaveName(result_id, std::string("_arr_") + NameForId(inst.words[2]) + "_" + NameForId(inst.words[3])); break; - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeRuntimeArray: SaveName(result_id, std::string("_runtimearr_") + NameForId(inst.words[2])); break; - case SpvOpTypePointer: + case spv::Op::OpTypePointer: SaveName(result_id, std::string("_ptr_") + NameForEnumOperand(SPV_OPERAND_TYPE_STORAGE_CLASS, inst.words[2]) + "_" + NameForId(inst.words[3])); break; - case SpvOpTypePipe: + case spv::Op::OpTypePipe: SaveName(result_id, std::string("Pipe") + NameForEnumOperand(SPV_OPERAND_TYPE_ACCESS_QUALIFIER, inst.words[2])); break; - case SpvOpTypeEvent: + case spv::Op::OpTypeEvent: SaveName(result_id, "Event"); break; - case SpvOpTypeDeviceEvent: + case spv::Op::OpTypeDeviceEvent: SaveName(result_id, "DeviceEvent"); break; - case SpvOpTypeReserveId: + case spv::Op::OpTypeReserveId: SaveName(result_id, "ReserveId"); break; - case SpvOpTypeQueue: + case spv::Op::OpTypeQueue: SaveName(result_id, "Queue"); break; - case SpvOpTypeOpaque: + case spv::Op::OpTypeOpaque: SaveName(result_id, std::string("Opaque_") + Sanitize(spvDecodeLiteralStringOperand(inst, 1))); break; - case SpvOpTypePipeStorage: + case spv::Op::OpTypePipeStorage: SaveName(result_id, "PipeStorage"); break; - case SpvOpTypeNamedBarrier: + case spv::Op::OpTypeNamedBarrier: SaveName(result_id, "NamedBarrier"); break; - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: // Structs are mapped rather simplisitically. Just indicate that they // are a struct and then give the raw Id number. SaveName(result_id, std::string("_struct_") + to_string(result_id)); break; - case SpvOpConstantTrue: + case spv::Op::OpConstantTrue: SaveName(result_id, "true"); break; - case SpvOpConstantFalse: + case spv::Op::OpConstantFalse: SaveName(result_id, "false"); break; - case SpvOpConstant: { + case spv::Op::OpConstant: { std::ostringstream value; EmitNumericLiteral(&value, inst, inst.operands[2]); auto value_str = value.str(); diff --git a/bgfx/3rdparty/spirv-tools/source/opcode.cpp b/bgfx/3rdparty/spirv-tools/source/opcode.cpp index 3f927290..ffbb2e8b 100644 --- a/bgfx/3rdparty/spirv-tools/source/opcode.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opcode.cpp @@ -64,7 +64,7 @@ const char* spvGeneratorStr(uint32_t generator) { return "Unknown"; } -uint32_t spvOpcodeMake(uint16_t wordCount, SpvOp opcode) { +uint32_t spvOpcodeMake(uint16_t wordCount, spv::Op opcode) { return ((uint32_t)opcode) | (((uint32_t)wordCount) << 16); } @@ -125,7 +125,7 @@ spv_result_t spvOpcodeTableNameLookup(spv_target_env env, spv_result_t spvOpcodeTableValueLookup(spv_target_env env, const spv_opcode_table table, - const SpvOp opcode, + const spv::Op opcode, spv_opcode_desc* pEntry) { if (!table) return SPV_ERROR_INVALID_TABLE; if (!pEntry) return SPV_ERROR_INVALID_POINTER; @@ -166,7 +166,7 @@ spv_result_t spvOpcodeTableValueLookup(spv_target_env env, return SPV_ERROR_INVALID_LOOKUP; } -void spvInstructionCopy(const uint32_t* words, const SpvOp opcode, +void spvInstructionCopy(const uint32_t* words, const spv::Op opcode, const uint16_t wordCount, const spv_endianness_t endian, spv_instruction_t* pInst) { pInst->opcode = opcode; @@ -177,7 +177,7 @@ void spvInstructionCopy(const uint32_t* words, const SpvOp opcode, uint16_t thisWordCount; uint16_t thisOpcode; spvOpcodeSplit(pInst->words[wordIndex], &thisWordCount, &thisOpcode); - assert(opcode == static_cast(thisOpcode) && + assert(opcode == static_cast(thisOpcode) && wordCount == thisWordCount && "Endianness failed!"); } } @@ -186,7 +186,7 @@ void spvInstructionCopy(const uint32_t* words, const SpvOp opcode, const char* spvOpcodeString(const uint32_t opcode) { const auto beg = kOpcodeTableEntries; const auto end = kOpcodeTableEntries + ARRAY_SIZE(kOpcodeTableEntries); - spv_opcode_desc_t needle = {"", static_cast(opcode), + spv_opcode_desc_t needle = {"", static_cast(opcode), 0, nullptr, 0, {}, false, false, @@ -196,7 +196,7 @@ const char* spvOpcodeString(const uint32_t opcode) { return lhs.opcode < rhs.opcode; }; auto it = std::lower_bound(beg, end, needle, comp); - if (it != end && it->opcode == opcode) { + if (it != end && it->opcode == spv::Op(opcode)) { return it->name; } @@ -204,140 +204,148 @@ const char* spvOpcodeString(const uint32_t opcode) { return "unknown"; } -int32_t spvOpcodeIsScalarType(const SpvOp opcode) { +const char* spvOpcodeString(const spv::Op opcode) { + return spvOpcodeString(static_cast(opcode)); +} + +int32_t spvOpcodeIsScalarType(const spv::Op opcode) { switch (opcode) { - case SpvOpTypeInt: - case SpvOpTypeFloat: - case SpvOpTypeBool: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: + case spv::Op::OpTypeBool: return true; default: return false; } } -int32_t spvOpcodeIsSpecConstant(const SpvOp opcode) { +int32_t spvOpcodeIsSpecConstant(const spv::Op opcode) { switch (opcode) { - case SpvOpSpecConstantTrue: - case SpvOpSpecConstantFalse: - case SpvOpSpecConstant: - case SpvOpSpecConstantComposite: - case SpvOpSpecConstantOp: + case spv::Op::OpSpecConstantTrue: + case spv::Op::OpSpecConstantFalse: + case spv::Op::OpSpecConstant: + case spv::Op::OpSpecConstantComposite: + case spv::Op::OpSpecConstantOp: return true; default: return false; } } -int32_t spvOpcodeIsConstant(const SpvOp opcode) { +int32_t spvOpcodeIsConstant(const spv::Op opcode) { switch (opcode) { - case SpvOpConstantTrue: - case SpvOpConstantFalse: - case SpvOpConstant: - case SpvOpConstantComposite: - case SpvOpConstantSampler: - case SpvOpConstantNull: - case SpvOpSpecConstantTrue: - case SpvOpSpecConstantFalse: - case SpvOpSpecConstant: - case SpvOpSpecConstantComposite: - case SpvOpSpecConstantOp: + case spv::Op::OpConstantTrue: + case spv::Op::OpConstantFalse: + case spv::Op::OpConstant: + case spv::Op::OpConstantComposite: + case spv::Op::OpConstantSampler: + case spv::Op::OpConstantNull: + case spv::Op::OpConstantFunctionPointerINTEL: + case spv::Op::OpSpecConstantTrue: + case spv::Op::OpSpecConstantFalse: + case spv::Op::OpSpecConstant: + case spv::Op::OpSpecConstantComposite: + case spv::Op::OpSpecConstantOp: return true; default: return false; } } -bool spvOpcodeIsConstantOrUndef(const SpvOp opcode) { - return opcode == SpvOpUndef || spvOpcodeIsConstant(opcode); +bool spvOpcodeIsConstantOrUndef(const spv::Op opcode) { + return opcode == spv::Op::OpUndef || spvOpcodeIsConstant(opcode); } -bool spvOpcodeIsScalarSpecConstant(const SpvOp opcode) { +bool spvOpcodeIsScalarSpecConstant(const spv::Op opcode) { switch (opcode) { - case SpvOpSpecConstantTrue: - case SpvOpSpecConstantFalse: - case SpvOpSpecConstant: + case spv::Op::OpSpecConstantTrue: + case spv::Op::OpSpecConstantFalse: + case spv::Op::OpSpecConstant: return true; default: return false; } } -int32_t spvOpcodeIsComposite(const SpvOp opcode) { +int32_t spvOpcodeIsComposite(const spv::Op opcode) { switch (opcode) { - case SpvOpTypeVector: - case SpvOpTypeMatrix: - case SpvOpTypeArray: - case SpvOpTypeStruct: - case SpvOpTypeCooperativeMatrixNV: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeStruct: + case spv::Op::OpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixKHR: return true; default: return false; } } -bool spvOpcodeReturnsLogicalVariablePointer(const SpvOp opcode) { +bool spvOpcodeReturnsLogicalVariablePointer(const spv::Op opcode) { switch (opcode) { - case SpvOpVariable: - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpFunctionParameter: - case SpvOpImageTexelPointer: - case SpvOpCopyObject: - case SpvOpSelect: - case SpvOpPhi: - case SpvOpFunctionCall: - case SpvOpPtrAccessChain: - case SpvOpLoad: - case SpvOpConstantNull: + case spv::Op::OpVariable: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpFunctionParameter: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpCopyObject: + case spv::Op::OpSelect: + case spv::Op::OpPhi: + case spv::Op::OpFunctionCall: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpLoad: + case spv::Op::OpConstantNull: return true; default: return false; } } -int32_t spvOpcodeReturnsLogicalPointer(const SpvOp opcode) { +int32_t spvOpcodeReturnsLogicalPointer(const spv::Op opcode) { switch (opcode) { - case SpvOpVariable: - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpFunctionParameter: - case SpvOpImageTexelPointer: - case SpvOpCopyObject: + case spv::Op::OpVariable: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpFunctionParameter: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpCopyObject: return true; default: return false; } } -int32_t spvOpcodeGeneratesType(SpvOp op) { +int32_t spvOpcodeGeneratesType(spv::Op op) { switch (op) { - case SpvOpTypeVoid: - case SpvOpTypeBool: - case SpvOpTypeInt: - case SpvOpTypeFloat: - case SpvOpTypeVector: - case SpvOpTypeMatrix: - case SpvOpTypeImage: - case SpvOpTypeSampler: - case SpvOpTypeSampledImage: - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: - case SpvOpTypeStruct: - case SpvOpTypeOpaque: - case SpvOpTypePointer: - case SpvOpTypeFunction: - case SpvOpTypeEvent: - case SpvOpTypeDeviceEvent: - case SpvOpTypeReserveId: - case SpvOpTypeQueue: - case SpvOpTypePipe: - case SpvOpTypePipeStorage: - case SpvOpTypeNamedBarrier: - case SpvOpTypeAccelerationStructureNV: - case SpvOpTypeCooperativeMatrixNV: - // case SpvOpTypeAccelerationStructureKHR: covered by - // SpvOpTypeAccelerationStructureNV - case SpvOpTypeRayQueryKHR: + case spv::Op::OpTypeVoid: + case spv::Op::OpTypeBool: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeImage: + case spv::Op::OpTypeSampler: + case spv::Op::OpTypeSampledImage: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeStruct: + case spv::Op::OpTypeOpaque: + case spv::Op::OpTypePointer: + case spv::Op::OpTypeFunction: + case spv::Op::OpTypeEvent: + case spv::Op::OpTypeDeviceEvent: + case spv::Op::OpTypeReserveId: + case spv::Op::OpTypeQueue: + case spv::Op::OpTypePipe: + case spv::Op::OpTypePipeStorage: + case spv::Op::OpTypeNamedBarrier: + case spv::Op::OpTypeAccelerationStructureNV: + case spv::Op::OpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixKHR: + // case spv::Op::OpTypeAccelerationStructureKHR: covered by + // spv::Op::OpTypeAccelerationStructureNV + case spv::Op::OpTypeRayQueryKHR: + case spv::Op::OpTypeHitObjectNV: return true; default: // In particular, OpTypeForwardPointer does not generate a type, @@ -348,15 +356,15 @@ int32_t spvOpcodeGeneratesType(SpvOp op) { return 0; } -bool spvOpcodeIsDecoration(const SpvOp opcode) { +bool spvOpcodeIsDecoration(const spv::Op opcode) { switch (opcode) { - case SpvOpDecorate: - case SpvOpDecorateId: - case SpvOpMemberDecorate: - case SpvOpGroupDecorate: - case SpvOpGroupMemberDecorate: - case SpvOpDecorateStringGOOGLE: - case SpvOpMemberDecorateStringGOOGLE: + case spv::Op::OpDecorate: + case spv::Op::OpDecorateId: + case spv::Op::OpMemberDecorate: + case spv::Op::OpGroupDecorate: + case spv::Op::OpGroupMemberDecorate: + case spv::Op::OpDecorateStringGOOGLE: + case spv::Op::OpMemberDecorateStringGOOGLE: return true; default: break; @@ -364,402 +372,403 @@ bool spvOpcodeIsDecoration(const SpvOp opcode) { return false; } -bool spvOpcodeIsLoad(const SpvOp opcode) { +bool spvOpcodeIsLoad(const spv::Op opcode) { switch (opcode) { - case SpvOpLoad: - case SpvOpImageSampleExplicitLod: - case SpvOpImageSampleImplicitLod: - case SpvOpImageSampleDrefImplicitLod: - case SpvOpImageSampleDrefExplicitLod: - case SpvOpImageSampleProjImplicitLod: - case SpvOpImageSampleProjExplicitLod: - case SpvOpImageSampleProjDrefImplicitLod: - case SpvOpImageSampleProjDrefExplicitLod: - case SpvOpImageFetch: - case SpvOpImageGather: - case SpvOpImageDrefGather: - case SpvOpImageRead: - case SpvOpImageSparseSampleImplicitLod: - case SpvOpImageSparseSampleExplicitLod: - case SpvOpImageSparseSampleDrefExplicitLod: - case SpvOpImageSparseSampleDrefImplicitLod: - case SpvOpImageSparseFetch: - case SpvOpImageSparseGather: - case SpvOpImageSparseDrefGather: - case SpvOpImageSparseRead: + case spv::Op::OpLoad: + case spv::Op::OpImageSampleExplicitLod: + case spv::Op::OpImageSampleImplicitLod: + case spv::Op::OpImageSampleDrefImplicitLod: + case spv::Op::OpImageSampleDrefExplicitLod: + case spv::Op::OpImageSampleProjImplicitLod: + case spv::Op::OpImageSampleProjExplicitLod: + case spv::Op::OpImageSampleProjDrefImplicitLod: + case spv::Op::OpImageSampleProjDrefExplicitLod: + case spv::Op::OpImageFetch: + case spv::Op::OpImageGather: + case spv::Op::OpImageDrefGather: + case spv::Op::OpImageRead: + case spv::Op::OpImageSparseSampleImplicitLod: + case spv::Op::OpImageSparseSampleExplicitLod: + case spv::Op::OpImageSparseSampleDrefExplicitLod: + case spv::Op::OpImageSparseSampleDrefImplicitLod: + case spv::Op::OpImageSparseFetch: + case spv::Op::OpImageSparseGather: + case spv::Op::OpImageSparseDrefGather: + case spv::Op::OpImageSparseRead: return true; default: return false; } } -bool spvOpcodeIsBranch(SpvOp opcode) { +bool spvOpcodeIsBranch(spv::Op opcode) { switch (opcode) { - case SpvOpBranch: - case SpvOpBranchConditional: - case SpvOpSwitch: + case spv::Op::OpBranch: + case spv::Op::OpBranchConditional: + case spv::Op::OpSwitch: return true; default: return false; } } -bool spvOpcodeIsAtomicWithLoad(const SpvOp opcode) { +bool spvOpcodeIsAtomicWithLoad(const spv::Op opcode) { switch (opcode) { - case SpvOpAtomicLoad: - case SpvOpAtomicExchange: - case SpvOpAtomicCompareExchange: - case SpvOpAtomicCompareExchangeWeak: - case SpvOpAtomicIIncrement: - case SpvOpAtomicIDecrement: - case SpvOpAtomicIAdd: - case SpvOpAtomicFAddEXT: - case SpvOpAtomicISub: - case SpvOpAtomicSMin: - case SpvOpAtomicUMin: - case SpvOpAtomicFMinEXT: - case SpvOpAtomicSMax: - case SpvOpAtomicUMax: - case SpvOpAtomicFMaxEXT: - case SpvOpAtomicAnd: - case SpvOpAtomicOr: - case SpvOpAtomicXor: - case SpvOpAtomicFlagTestAndSet: + case spv::Op::OpAtomicLoad: + case spv::Op::OpAtomicExchange: + case spv::Op::OpAtomicCompareExchange: + case spv::Op::OpAtomicCompareExchangeWeak: + case spv::Op::OpAtomicIIncrement: + case spv::Op::OpAtomicIDecrement: + case spv::Op::OpAtomicIAdd: + case spv::Op::OpAtomicFAddEXT: + case spv::Op::OpAtomicISub: + case spv::Op::OpAtomicSMin: + case spv::Op::OpAtomicUMin: + case spv::Op::OpAtomicFMinEXT: + case spv::Op::OpAtomicSMax: + case spv::Op::OpAtomicUMax: + case spv::Op::OpAtomicFMaxEXT: + case spv::Op::OpAtomicAnd: + case spv::Op::OpAtomicOr: + case spv::Op::OpAtomicXor: + case spv::Op::OpAtomicFlagTestAndSet: return true; default: return false; } } -bool spvOpcodeIsAtomicOp(const SpvOp opcode) { - return (spvOpcodeIsAtomicWithLoad(opcode) || opcode == SpvOpAtomicStore || - opcode == SpvOpAtomicFlagClear); +bool spvOpcodeIsAtomicOp(const spv::Op opcode) { + return (spvOpcodeIsAtomicWithLoad(opcode) || + opcode == spv::Op::OpAtomicStore || + opcode == spv::Op::OpAtomicFlagClear); } -bool spvOpcodeIsReturn(SpvOp opcode) { +bool spvOpcodeIsReturn(spv::Op opcode) { switch (opcode) { - case SpvOpReturn: - case SpvOpReturnValue: + case spv::Op::OpReturn: + case spv::Op::OpReturnValue: return true; default: return false; } } -bool spvOpcodeIsAbort(SpvOp opcode) { +bool spvOpcodeIsAbort(spv::Op opcode) { switch (opcode) { - case SpvOpKill: - case SpvOpUnreachable: - case SpvOpTerminateInvocation: - case SpvOpTerminateRayKHR: - case SpvOpIgnoreIntersectionKHR: - case SpvOpEmitMeshTasksEXT: + case spv::Op::OpKill: + case spv::Op::OpUnreachable: + case spv::Op::OpTerminateInvocation: + case spv::Op::OpTerminateRayKHR: + case spv::Op::OpIgnoreIntersectionKHR: + case spv::Op::OpEmitMeshTasksEXT: return true; default: return false; } } -bool spvOpcodeIsReturnOrAbort(SpvOp opcode) { +bool spvOpcodeIsReturnOrAbort(spv::Op opcode) { return spvOpcodeIsReturn(opcode) || spvOpcodeIsAbort(opcode); } -bool spvOpcodeIsBlockTerminator(SpvOp opcode) { +bool spvOpcodeIsBlockTerminator(spv::Op opcode) { return spvOpcodeIsBranch(opcode) || spvOpcodeIsReturnOrAbort(opcode); } -bool spvOpcodeIsBaseOpaqueType(SpvOp opcode) { +bool spvOpcodeIsBaseOpaqueType(spv::Op opcode) { switch (opcode) { - case SpvOpTypeImage: - case SpvOpTypeSampler: - case SpvOpTypeSampledImage: - case SpvOpTypeOpaque: - case SpvOpTypeEvent: - case SpvOpTypeDeviceEvent: - case SpvOpTypeReserveId: - case SpvOpTypeQueue: - case SpvOpTypePipe: - case SpvOpTypeForwardPointer: - case SpvOpTypePipeStorage: - case SpvOpTypeNamedBarrier: + case spv::Op::OpTypeImage: + case spv::Op::OpTypeSampler: + case spv::Op::OpTypeSampledImage: + case spv::Op::OpTypeOpaque: + case spv::Op::OpTypeEvent: + case spv::Op::OpTypeDeviceEvent: + case spv::Op::OpTypeReserveId: + case spv::Op::OpTypeQueue: + case spv::Op::OpTypePipe: + case spv::Op::OpTypeForwardPointer: + case spv::Op::OpTypePipeStorage: + case spv::Op::OpTypeNamedBarrier: return true; default: return false; } } -bool spvOpcodeIsNonUniformGroupOperation(SpvOp opcode) { +bool spvOpcodeIsNonUniformGroupOperation(spv::Op opcode) { switch (opcode) { - case SpvOpGroupNonUniformElect: - case SpvOpGroupNonUniformAll: - case SpvOpGroupNonUniformAny: - case SpvOpGroupNonUniformAllEqual: - case SpvOpGroupNonUniformBroadcast: - case SpvOpGroupNonUniformBroadcastFirst: - case SpvOpGroupNonUniformBallot: - case SpvOpGroupNonUniformInverseBallot: - case SpvOpGroupNonUniformBallotBitExtract: - case SpvOpGroupNonUniformBallotBitCount: - case SpvOpGroupNonUniformBallotFindLSB: - case SpvOpGroupNonUniformBallotFindMSB: - case SpvOpGroupNonUniformShuffle: - case SpvOpGroupNonUniformShuffleXor: - case SpvOpGroupNonUniformShuffleUp: - case SpvOpGroupNonUniformShuffleDown: - case SpvOpGroupNonUniformIAdd: - case SpvOpGroupNonUniformFAdd: - case SpvOpGroupNonUniformIMul: - case SpvOpGroupNonUniformFMul: - case SpvOpGroupNonUniformSMin: - case SpvOpGroupNonUniformUMin: - case SpvOpGroupNonUniformFMin: - case SpvOpGroupNonUniformSMax: - case SpvOpGroupNonUniformUMax: - case SpvOpGroupNonUniformFMax: - case SpvOpGroupNonUniformBitwiseAnd: - case SpvOpGroupNonUniformBitwiseOr: - case SpvOpGroupNonUniformBitwiseXor: - case SpvOpGroupNonUniformLogicalAnd: - case SpvOpGroupNonUniformLogicalOr: - case SpvOpGroupNonUniformLogicalXor: - case SpvOpGroupNonUniformQuadBroadcast: - case SpvOpGroupNonUniformQuadSwap: - case SpvOpGroupNonUniformRotateKHR: + case spv::Op::OpGroupNonUniformElect: + case spv::Op::OpGroupNonUniformAll: + case spv::Op::OpGroupNonUniformAny: + case spv::Op::OpGroupNonUniformAllEqual: + case spv::Op::OpGroupNonUniformBroadcast: + case spv::Op::OpGroupNonUniformBroadcastFirst: + case spv::Op::OpGroupNonUniformBallot: + case spv::Op::OpGroupNonUniformInverseBallot: + case spv::Op::OpGroupNonUniformBallotBitExtract: + case spv::Op::OpGroupNonUniformBallotBitCount: + case spv::Op::OpGroupNonUniformBallotFindLSB: + case spv::Op::OpGroupNonUniformBallotFindMSB: + case spv::Op::OpGroupNonUniformShuffle: + case spv::Op::OpGroupNonUniformShuffleXor: + case spv::Op::OpGroupNonUniformShuffleUp: + case spv::Op::OpGroupNonUniformShuffleDown: + case spv::Op::OpGroupNonUniformIAdd: + case spv::Op::OpGroupNonUniformFAdd: + case spv::Op::OpGroupNonUniformIMul: + case spv::Op::OpGroupNonUniformFMul: + case spv::Op::OpGroupNonUniformSMin: + case spv::Op::OpGroupNonUniformUMin: + case spv::Op::OpGroupNonUniformFMin: + case spv::Op::OpGroupNonUniformSMax: + case spv::Op::OpGroupNonUniformUMax: + case spv::Op::OpGroupNonUniformFMax: + case spv::Op::OpGroupNonUniformBitwiseAnd: + case spv::Op::OpGroupNonUniformBitwiseOr: + case spv::Op::OpGroupNonUniformBitwiseXor: + case spv::Op::OpGroupNonUniformLogicalAnd: + case spv::Op::OpGroupNonUniformLogicalOr: + case spv::Op::OpGroupNonUniformLogicalXor: + case spv::Op::OpGroupNonUniformQuadBroadcast: + case spv::Op::OpGroupNonUniformQuadSwap: + case spv::Op::OpGroupNonUniformRotateKHR: return true; default: return false; } } -bool spvOpcodeIsScalarizable(SpvOp opcode) { +bool spvOpcodeIsScalarizable(spv::Op opcode) { switch (opcode) { - case SpvOpPhi: - case SpvOpCopyObject: - case SpvOpConvertFToU: - case SpvOpConvertFToS: - case SpvOpConvertSToF: - case SpvOpConvertUToF: - case SpvOpUConvert: - case SpvOpSConvert: - case SpvOpFConvert: - case SpvOpQuantizeToF16: - case SpvOpVectorInsertDynamic: - case SpvOpSNegate: - case SpvOpFNegate: - case SpvOpIAdd: - case SpvOpFAdd: - case SpvOpISub: - case SpvOpFSub: - case SpvOpIMul: - case SpvOpFMul: - case SpvOpUDiv: - case SpvOpSDiv: - case SpvOpFDiv: - case SpvOpUMod: - case SpvOpSRem: - case SpvOpSMod: - case SpvOpFRem: - case SpvOpFMod: - case SpvOpVectorTimesScalar: - case SpvOpIAddCarry: - case SpvOpISubBorrow: - case SpvOpUMulExtended: - case SpvOpSMulExtended: - case SpvOpShiftRightLogical: - case SpvOpShiftRightArithmetic: - case SpvOpShiftLeftLogical: - case SpvOpBitwiseOr: - case SpvOpBitwiseAnd: - case SpvOpNot: - case SpvOpBitFieldInsert: - case SpvOpBitFieldSExtract: - case SpvOpBitFieldUExtract: - case SpvOpBitReverse: - case SpvOpBitCount: - case SpvOpIsNan: - case SpvOpIsInf: - case SpvOpIsFinite: - case SpvOpIsNormal: - case SpvOpSignBitSet: - case SpvOpLessOrGreater: - case SpvOpOrdered: - case SpvOpUnordered: - case SpvOpLogicalEqual: - case SpvOpLogicalNotEqual: - case SpvOpLogicalOr: - case SpvOpLogicalAnd: - case SpvOpLogicalNot: - case SpvOpSelect: - case SpvOpIEqual: - case SpvOpINotEqual: - case SpvOpUGreaterThan: - case SpvOpSGreaterThan: - case SpvOpUGreaterThanEqual: - case SpvOpSGreaterThanEqual: - case SpvOpULessThan: - case SpvOpSLessThan: - case SpvOpULessThanEqual: - case SpvOpSLessThanEqual: - case SpvOpFOrdEqual: - case SpvOpFUnordEqual: - case SpvOpFOrdNotEqual: - case SpvOpFUnordNotEqual: - case SpvOpFOrdLessThan: - case SpvOpFUnordLessThan: - case SpvOpFOrdGreaterThan: - case SpvOpFUnordGreaterThan: - case SpvOpFOrdLessThanEqual: - case SpvOpFUnordLessThanEqual: - case SpvOpFOrdGreaterThanEqual: - case SpvOpFUnordGreaterThanEqual: + case spv::Op::OpPhi: + case spv::Op::OpCopyObject: + case spv::Op::OpConvertFToU: + case spv::Op::OpConvertFToS: + case spv::Op::OpConvertSToF: + case spv::Op::OpConvertUToF: + case spv::Op::OpUConvert: + case spv::Op::OpSConvert: + case spv::Op::OpFConvert: + case spv::Op::OpQuantizeToF16: + case spv::Op::OpVectorInsertDynamic: + case spv::Op::OpSNegate: + case spv::Op::OpFNegate: + case spv::Op::OpIAdd: + case spv::Op::OpFAdd: + case spv::Op::OpISub: + case spv::Op::OpFSub: + case spv::Op::OpIMul: + case spv::Op::OpFMul: + case spv::Op::OpUDiv: + case spv::Op::OpSDiv: + case spv::Op::OpFDiv: + case spv::Op::OpUMod: + case spv::Op::OpSRem: + case spv::Op::OpSMod: + case spv::Op::OpFRem: + case spv::Op::OpFMod: + case spv::Op::OpVectorTimesScalar: + case spv::Op::OpIAddCarry: + case spv::Op::OpISubBorrow: + case spv::Op::OpUMulExtended: + case spv::Op::OpSMulExtended: + case spv::Op::OpShiftRightLogical: + case spv::Op::OpShiftRightArithmetic: + case spv::Op::OpShiftLeftLogical: + case spv::Op::OpBitwiseOr: + case spv::Op::OpBitwiseAnd: + case spv::Op::OpNot: + case spv::Op::OpBitFieldInsert: + case spv::Op::OpBitFieldSExtract: + case spv::Op::OpBitFieldUExtract: + case spv::Op::OpBitReverse: + case spv::Op::OpBitCount: + case spv::Op::OpIsNan: + case spv::Op::OpIsInf: + case spv::Op::OpIsFinite: + case spv::Op::OpIsNormal: + case spv::Op::OpSignBitSet: + case spv::Op::OpLessOrGreater: + case spv::Op::OpOrdered: + case spv::Op::OpUnordered: + case spv::Op::OpLogicalEqual: + case spv::Op::OpLogicalNotEqual: + case spv::Op::OpLogicalOr: + case spv::Op::OpLogicalAnd: + case spv::Op::OpLogicalNot: + case spv::Op::OpSelect: + case spv::Op::OpIEqual: + case spv::Op::OpINotEqual: + case spv::Op::OpUGreaterThan: + case spv::Op::OpSGreaterThan: + case spv::Op::OpUGreaterThanEqual: + case spv::Op::OpSGreaterThanEqual: + case spv::Op::OpULessThan: + case spv::Op::OpSLessThan: + case spv::Op::OpULessThanEqual: + case spv::Op::OpSLessThanEqual: + case spv::Op::OpFOrdEqual: + case spv::Op::OpFUnordEqual: + case spv::Op::OpFOrdNotEqual: + case spv::Op::OpFUnordNotEqual: + case spv::Op::OpFOrdLessThan: + case spv::Op::OpFUnordLessThan: + case spv::Op::OpFOrdGreaterThan: + case spv::Op::OpFUnordGreaterThan: + case spv::Op::OpFOrdLessThanEqual: + case spv::Op::OpFUnordLessThanEqual: + case spv::Op::OpFOrdGreaterThanEqual: + case spv::Op::OpFUnordGreaterThanEqual: return true; default: return false; } } -bool spvOpcodeIsDebug(SpvOp opcode) { +bool spvOpcodeIsDebug(spv::Op opcode) { switch (opcode) { - case SpvOpName: - case SpvOpMemberName: - case SpvOpSource: - case SpvOpSourceContinued: - case SpvOpSourceExtension: - case SpvOpString: - case SpvOpLine: - case SpvOpNoLine: - case SpvOpModuleProcessed: + case spv::Op::OpName: + case spv::Op::OpMemberName: + case spv::Op::OpSource: + case spv::Op::OpSourceContinued: + case spv::Op::OpSourceExtension: + case spv::Op::OpString: + case spv::Op::OpLine: + case spv::Op::OpNoLine: + case spv::Op::OpModuleProcessed: return true; default: return false; } } -bool spvOpcodeIsCommutativeBinaryOperator(SpvOp opcode) { +bool spvOpcodeIsCommutativeBinaryOperator(spv::Op opcode) { switch (opcode) { - case SpvOpPtrEqual: - case SpvOpPtrNotEqual: - case SpvOpIAdd: - case SpvOpFAdd: - case SpvOpIMul: - case SpvOpFMul: - case SpvOpDot: - case SpvOpIAddCarry: - case SpvOpUMulExtended: - case SpvOpSMulExtended: - case SpvOpBitwiseOr: - case SpvOpBitwiseXor: - case SpvOpBitwiseAnd: - case SpvOpOrdered: - case SpvOpUnordered: - case SpvOpLogicalEqual: - case SpvOpLogicalNotEqual: - case SpvOpLogicalOr: - case SpvOpLogicalAnd: - case SpvOpIEqual: - case SpvOpINotEqual: - case SpvOpFOrdEqual: - case SpvOpFUnordEqual: - case SpvOpFOrdNotEqual: - case SpvOpFUnordNotEqual: + case spv::Op::OpPtrEqual: + case spv::Op::OpPtrNotEqual: + case spv::Op::OpIAdd: + case spv::Op::OpFAdd: + case spv::Op::OpIMul: + case spv::Op::OpFMul: + case spv::Op::OpDot: + case spv::Op::OpIAddCarry: + case spv::Op::OpUMulExtended: + case spv::Op::OpSMulExtended: + case spv::Op::OpBitwiseOr: + case spv::Op::OpBitwiseXor: + case spv::Op::OpBitwiseAnd: + case spv::Op::OpOrdered: + case spv::Op::OpUnordered: + case spv::Op::OpLogicalEqual: + case spv::Op::OpLogicalNotEqual: + case spv::Op::OpLogicalOr: + case spv::Op::OpLogicalAnd: + case spv::Op::OpIEqual: + case spv::Op::OpINotEqual: + case spv::Op::OpFOrdEqual: + case spv::Op::OpFUnordEqual: + case spv::Op::OpFOrdNotEqual: + case spv::Op::OpFUnordNotEqual: return true; default: return false; } } -bool spvOpcodeIsLinearAlgebra(SpvOp opcode) { +bool spvOpcodeIsLinearAlgebra(spv::Op opcode) { switch (opcode) { - case SpvOpTranspose: - case SpvOpVectorTimesScalar: - case SpvOpMatrixTimesScalar: - case SpvOpVectorTimesMatrix: - case SpvOpMatrixTimesVector: - case SpvOpMatrixTimesMatrix: - case SpvOpOuterProduct: - case SpvOpDot: + case spv::Op::OpTranspose: + case spv::Op::OpVectorTimesScalar: + case spv::Op::OpMatrixTimesScalar: + case spv::Op::OpVectorTimesMatrix: + case spv::Op::OpMatrixTimesVector: + case spv::Op::OpMatrixTimesMatrix: + case spv::Op::OpOuterProduct: + case spv::Op::OpDot: return true; default: return false; } } -bool spvOpcodeIsImageSample(const SpvOp opcode) { +bool spvOpcodeIsImageSample(const spv::Op opcode) { switch (opcode) { - case SpvOpImageSampleImplicitLod: - case SpvOpImageSampleExplicitLod: - case SpvOpImageSampleDrefImplicitLod: - case SpvOpImageSampleDrefExplicitLod: - case SpvOpImageSampleProjImplicitLod: - case SpvOpImageSampleProjExplicitLod: - case SpvOpImageSampleProjDrefImplicitLod: - case SpvOpImageSampleProjDrefExplicitLod: - case SpvOpImageSparseSampleImplicitLod: - case SpvOpImageSparseSampleExplicitLod: - case SpvOpImageSparseSampleDrefImplicitLod: - case SpvOpImageSparseSampleDrefExplicitLod: + case spv::Op::OpImageSampleImplicitLod: + case spv::Op::OpImageSampleExplicitLod: + case spv::Op::OpImageSampleDrefImplicitLod: + case spv::Op::OpImageSampleDrefExplicitLod: + case spv::Op::OpImageSampleProjImplicitLod: + case spv::Op::OpImageSampleProjExplicitLod: + case spv::Op::OpImageSampleProjDrefImplicitLod: + case spv::Op::OpImageSampleProjDrefExplicitLod: + case spv::Op::OpImageSparseSampleImplicitLod: + case spv::Op::OpImageSparseSampleExplicitLod: + case spv::Op::OpImageSparseSampleDrefImplicitLod: + case spv::Op::OpImageSparseSampleDrefExplicitLod: return true; default: return false; } } -std::vector spvOpcodeMemorySemanticsOperandIndices(SpvOp opcode) { +std::vector spvOpcodeMemorySemanticsOperandIndices(spv::Op opcode) { switch (opcode) { - case SpvOpMemoryBarrier: + case spv::Op::OpMemoryBarrier: return {1}; - case SpvOpAtomicStore: - case SpvOpControlBarrier: - case SpvOpAtomicFlagClear: - case SpvOpMemoryNamedBarrier: + case spv::Op::OpAtomicStore: + case spv::Op::OpControlBarrier: + case spv::Op::OpAtomicFlagClear: + case spv::Op::OpMemoryNamedBarrier: return {2}; - case SpvOpAtomicLoad: - case SpvOpAtomicExchange: - case SpvOpAtomicIIncrement: - case SpvOpAtomicIDecrement: - case SpvOpAtomicIAdd: - case SpvOpAtomicFAddEXT: - case SpvOpAtomicISub: - case SpvOpAtomicSMin: - case SpvOpAtomicUMin: - case SpvOpAtomicSMax: - case SpvOpAtomicUMax: - case SpvOpAtomicAnd: - case SpvOpAtomicOr: - case SpvOpAtomicXor: - case SpvOpAtomicFlagTestAndSet: + case spv::Op::OpAtomicLoad: + case spv::Op::OpAtomicExchange: + case spv::Op::OpAtomicIIncrement: + case spv::Op::OpAtomicIDecrement: + case spv::Op::OpAtomicIAdd: + case spv::Op::OpAtomicFAddEXT: + case spv::Op::OpAtomicISub: + case spv::Op::OpAtomicSMin: + case spv::Op::OpAtomicUMin: + case spv::Op::OpAtomicSMax: + case spv::Op::OpAtomicUMax: + case spv::Op::OpAtomicAnd: + case spv::Op::OpAtomicOr: + case spv::Op::OpAtomicXor: + case spv::Op::OpAtomicFlagTestAndSet: return {4}; - case SpvOpAtomicCompareExchange: - case SpvOpAtomicCompareExchangeWeak: + case spv::Op::OpAtomicCompareExchange: + case spv::Op::OpAtomicCompareExchangeWeak: return {4, 5}; default: return {}; } } -bool spvOpcodeIsAccessChain(SpvOp opcode) { +bool spvOpcodeIsAccessChain(spv::Op opcode) { switch (opcode) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: return true; default: return false; } } -bool spvOpcodeIsBit(SpvOp opcode) { +bool spvOpcodeIsBit(spv::Op opcode) { switch (opcode) { - case SpvOpShiftRightLogical: - case SpvOpShiftRightArithmetic: - case SpvOpShiftLeftLogical: - case SpvOpBitwiseOr: - case SpvOpBitwiseXor: - case SpvOpBitwiseAnd: - case SpvOpNot: - case SpvOpBitReverse: - case SpvOpBitCount: + case spv::Op::OpShiftRightLogical: + case spv::Op::OpShiftRightArithmetic: + case spv::Op::OpShiftLeftLogical: + case spv::Op::OpBitwiseOr: + case spv::Op::OpBitwiseXor: + case spv::Op::OpBitwiseAnd: + case spv::Op::OpNot: + case spv::Op::OpBitReverse: + case spv::Op::OpBitCount: return true; default: return false; diff --git a/bgfx/3rdparty/spirv-tools/source/opcode.h b/bgfx/3rdparty/spirv-tools/source/opcode.h index 77a0bed2..217aeb2b 100644 --- a/bgfx/3rdparty/spirv-tools/source/opcode.h +++ b/bgfx/3rdparty/spirv-tools/source/opcode.h @@ -29,7 +29,7 @@ const char* spvGeneratorStr(uint32_t generator); // Combines word_count and opcode enumerant in single word. -uint32_t spvOpcodeMake(uint16_t word_count, SpvOp opcode); +uint32_t spvOpcodeMake(uint16_t word_count, spv::Op opcode); // Splits word into into two constituent parts: word_count and opcode. void spvOpcodeSplit(const uint32_t word, uint16_t* word_count, @@ -45,115 +45,118 @@ spv_result_t spvOpcodeTableNameLookup(spv_target_env, // SPV_SUCCESS and writes a handle of the table entry into *entry. spv_result_t spvOpcodeTableValueLookup(spv_target_env, const spv_opcode_table table, - const SpvOp opcode, + const spv::Op opcode, spv_opcode_desc* entry); // Copies an instruction's word and fixes the endianness to host native. The // source instruction's stream/opcode/endianness is in the words/opcode/endian // parameter. The word_count parameter specifies the number of words to copy. // Writes copied instruction into *inst. -void spvInstructionCopy(const uint32_t* words, const SpvOp opcode, +void spvInstructionCopy(const uint32_t* words, const spv::Op opcode, const uint16_t word_count, const spv_endianness_t endian, spv_instruction_t* inst); // Determine if the given opcode is a scalar type. Returns zero if false, // non-zero otherwise. -int32_t spvOpcodeIsScalarType(const SpvOp opcode); +int32_t spvOpcodeIsScalarType(const spv::Op opcode); // Determines if the given opcode is a specialization constant. Returns zero if // false, non-zero otherwise. -int32_t spvOpcodeIsSpecConstant(const SpvOp opcode); +int32_t spvOpcodeIsSpecConstant(const spv::Op opcode); // Determines if the given opcode is a constant. Returns zero if false, non-zero // otherwise. -int32_t spvOpcodeIsConstant(const SpvOp opcode); +int32_t spvOpcodeIsConstant(const spv::Op opcode); // Returns true if the given opcode is a constant or undef. -bool spvOpcodeIsConstantOrUndef(const SpvOp opcode); +bool spvOpcodeIsConstantOrUndef(const spv::Op opcode); // Returns true if the given opcode is a scalar specialization constant. -bool spvOpcodeIsScalarSpecConstant(const SpvOp opcode); +bool spvOpcodeIsScalarSpecConstant(const spv::Op opcode); // Determines if the given opcode is a composite type. Returns zero if false, // non-zero otherwise. -int32_t spvOpcodeIsComposite(const SpvOp opcode); +int32_t spvOpcodeIsComposite(const spv::Op opcode); // Determines if the given opcode results in a pointer when using the logical // addressing model. Returns zero if false, non-zero otherwise. -int32_t spvOpcodeReturnsLogicalPointer(const SpvOp opcode); +int32_t spvOpcodeReturnsLogicalPointer(const spv::Op opcode); // Returns whether the given opcode could result in a pointer or a variable // pointer when using the logical addressing model. -bool spvOpcodeReturnsLogicalVariablePointer(const SpvOp opcode); +bool spvOpcodeReturnsLogicalVariablePointer(const spv::Op opcode); // Determines if the given opcode generates a type. Returns zero if false, // non-zero otherwise. -int32_t spvOpcodeGeneratesType(SpvOp opcode); +int32_t spvOpcodeGeneratesType(spv::Op opcode); // Returns true if the opcode adds a decoration to an id. -bool spvOpcodeIsDecoration(const SpvOp opcode); +bool spvOpcodeIsDecoration(const spv::Op opcode); // Returns true if the opcode is a load from memory into a result id. This // function only considers core instructions. -bool spvOpcodeIsLoad(const SpvOp opcode); +bool spvOpcodeIsLoad(const spv::Op opcode); // Returns true if the opcode is an atomic operation that uses the original // value. -bool spvOpcodeIsAtomicWithLoad(const SpvOp opcode); +bool spvOpcodeIsAtomicWithLoad(const spv::Op opcode); // Returns true if the opcode is an atomic operation. -bool spvOpcodeIsAtomicOp(const SpvOp opcode); +bool spvOpcodeIsAtomicOp(const spv::Op opcode); // Returns true if the given opcode is a branch instruction. -bool spvOpcodeIsBranch(SpvOp opcode); +bool spvOpcodeIsBranch(spv::Op opcode); // Returns true if the given opcode is a return instruction. -bool spvOpcodeIsReturn(SpvOp opcode); +bool spvOpcodeIsReturn(spv::Op opcode); // Returns true if the given opcode aborts execution. To abort means that after // executing that instruction, no other instructions will be executed regardless // of the context in which the instruction appears. Note that `OpUnreachable` // is considered an abort even if its behaviour is undefined. -bool spvOpcodeIsAbort(SpvOp opcode); +bool spvOpcodeIsAbort(spv::Op opcode); // Returns true if the given opcode is a return instruction or it aborts // execution. -bool spvOpcodeIsReturnOrAbort(SpvOp opcode); +bool spvOpcodeIsReturnOrAbort(spv::Op opcode); // Returns true if the given opcode is a basic block terminator. -bool spvOpcodeIsBlockTerminator(SpvOp opcode); +bool spvOpcodeIsBlockTerminator(spv::Op opcode); // Returns true if the given opcode always defines an opaque type. -bool spvOpcodeIsBaseOpaqueType(SpvOp opcode); +bool spvOpcodeIsBaseOpaqueType(spv::Op opcode); // Returns true if the given opcode is a non-uniform group operation. -bool spvOpcodeIsNonUniformGroupOperation(SpvOp opcode); +bool spvOpcodeIsNonUniformGroupOperation(spv::Op opcode); // Returns true if the opcode with vector inputs could be divided into a series // of independent scalar operations that would give the same result. -bool spvOpcodeIsScalarizable(SpvOp opcode); +bool spvOpcodeIsScalarizable(spv::Op opcode); // Returns true if the given opcode is a debug instruction. -bool spvOpcodeIsDebug(SpvOp opcode); +bool spvOpcodeIsDebug(spv::Op opcode); // Returns true for opcodes that are binary operators, // where the order of the operands is irrelevant. -bool spvOpcodeIsCommutativeBinaryOperator(SpvOp opcode); +bool spvOpcodeIsCommutativeBinaryOperator(spv::Op opcode); // Returns true for opcodes that represent linear algebra instructions. -bool spvOpcodeIsLinearAlgebra(SpvOp opcode); +bool spvOpcodeIsLinearAlgebra(spv::Op opcode); // Returns true for opcodes that represent image sample instructions. -bool spvOpcodeIsImageSample(SpvOp opcode); +bool spvOpcodeIsImageSample(spv::Op opcode); // Returns a vector containing the indices of the memory semantics // operands for |opcode|. -std::vector spvOpcodeMemorySemanticsOperandIndices(SpvOp opcode); +std::vector spvOpcodeMemorySemanticsOperandIndices(spv::Op opcode); // Returns true for opcodes that represent access chain instructions. -bool spvOpcodeIsAccessChain(SpvOp opcode); +bool spvOpcodeIsAccessChain(spv::Op opcode); // Returns true for opcodes that represent bit instructions. -bool spvOpcodeIsBit(SpvOp opcode); +bool spvOpcodeIsBit(spv::Op opcode); + +// Gets the name of an instruction, without the "Op" prefix. +const char* spvOpcodeString(const spv::Op opcode); #endif // SOURCE_OPCODE_H_ diff --git a/bgfx/3rdparty/spirv-tools/source/operand.cpp b/bgfx/3rdparty/spirv-tools/source/operand.cpp index 0c255a35..5349a2d4 100644 --- a/bgfx/3rdparty/spirv-tools/source/operand.cpp +++ b/bgfx/3rdparty/spirv-tools/source/operand.cpp @@ -26,7 +26,6 @@ #include "source/macro.h" #include "source/opcode.h" #include "source/spirv_constant.h" -#include "source/spirv_target_env.h" // For now, assume unified1 contains up to SPIR-V 1.3 and no later // SPIR-V version. @@ -48,7 +47,7 @@ spv_result_t spvOperandTableGet(spv_operand_table* pOperandTable, return SPV_SUCCESS; } -spv_result_t spvOperandTableNameLookup(spv_target_env env, +spv_result_t spvOperandTableNameLookup(spv_target_env, const spv_operand_table table, const spv_operand_type_t type, const char* name, @@ -57,31 +56,18 @@ spv_result_t spvOperandTableNameLookup(spv_target_env env, if (!table) return SPV_ERROR_INVALID_TABLE; if (!name || !pEntry) return SPV_ERROR_INVALID_POINTER; - const auto version = spvVersionForTargetEnv(env); for (uint64_t typeIndex = 0; typeIndex < table->count; ++typeIndex) { const auto& group = table->types[typeIndex]; if (type != group.type) continue; for (uint64_t index = 0; index < group.count; ++index) { const auto& entry = group.entries[index]; // We consider the current operand as available as long as - // 1. The target environment satisfies the minimal requirement of the - // operand; or - // 2. There is at least one extension enabling this operand; or - // 3. There is at least one capability enabling this operand. - // - // Note that the second rule assumes the extension enabling this operand - // is indeed requested in the SPIR-V code; checking that should be - // validator's work. + // it is in the grammar. It might not be *valid* to use, + // but that should be checked by the validator, not by parsing. if (nameLength == strlen(entry.name) && !strncmp(entry.name, name, nameLength)) { - if ((version >= entry.minVersion && version <= entry.lastVersion) || - entry.numExtensions > 0u || entry.numCapabilities > 0u) { - *pEntry = &entry; - return SPV_SUCCESS; - } else { - // if there is no extension/capability then the version is wrong - return SPV_ERROR_WRONG_VERSION; - } + *pEntry = &entry; + return SPV_SUCCESS; } } } @@ -89,7 +75,7 @@ spv_result_t spvOperandTableNameLookup(spv_target_env env, return SPV_ERROR_INVALID_LOOKUP; } -spv_result_t spvOperandTableValueLookup(spv_target_env env, +spv_result_t spvOperandTableValueLookup(spv_target_env, const spv_operand_table table, const spv_operand_type_t type, const uint32_t value, @@ -110,33 +96,15 @@ spv_result_t spvOperandTableValueLookup(spv_target_env env, const auto beg = group.entries; const auto end = group.entries + group.count; - // We need to loop here because there can exist multiple symbols for the - // same operand value, and they can be introduced in different target - // environments, which means they can have different minimal version - // requirements. For example, SubgroupEqMaskKHR can exist in any SPIR-V - // version as long as the SPV_KHR_shader_ballot extension is there; but - // starting from SPIR-V 1.3, SubgroupEqMask, which has the same numeric - // value as SubgroupEqMaskKHR, is available in core SPIR-V without extension - // requirements. // Assumes the underlying table is already sorted ascendingly according to // opcode value. - const auto version = spvVersionForTargetEnv(env); - for (auto it = std::lower_bound(beg, end, needle, comp); - it != end && it->value == value; ++it) { - // We consider the current operand as available as long as - // 1. The target environment satisfies the minimal requirement of the - // operand; or - // 2. There is at least one extension enabling this operand; or - // 3. There is at least one capability enabling this operand. - // - // Note that the second rule assumes the extension enabling this operand - // is indeed requested in the SPIR-V code; checking that should be - // validator's work. - if ((version >= it->minVersion && version <= it->lastVersion) || - it->numExtensions > 0u || it->numCapabilities > 0u) { - *pEntry = it; - return SPV_SUCCESS; - } + auto it = std::lower_bound(beg, end, needle, comp); + if (it != end && it->value == value) { + // The current operand is considered available as long as + // it is in the grammar. It might not be *valid* to use, + // but that should be checked by the validator, not by parsing. + *pEntry = it; + return SPV_SUCCESS; } } @@ -155,6 +123,7 @@ const char* spvOperandTypeStr(spv_operand_type_t type) { case SPV_OPERAND_TYPE_LITERAL_INTEGER: case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER: case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_NUMBER: + case SPV_OPERAND_TYPE_LITERAL_FLOAT: return "literal number"; case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: return "possibly multi-word literal integer"; @@ -236,6 +205,17 @@ const char* spvOperandTypeStr(spv_operand_type_t type) { case SPV_OPERAND_TYPE_PACKED_VECTOR_FORMAT: case SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT: return "packed vector format"; + case SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_OPERANDS: + case SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS: + return "cooperative matrix operands"; + case SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_LAYOUT: + return "cooperative matrix layout"; + case SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_USE: + return "cooperative matrix use"; + case SPV_OPERAND_TYPE_INITIALIZATION_MODE_QUALIFIER: + return "initialization mode qualifier"; + case SPV_OPERAND_TYPE_HOST_ACCESS_QUALIFIER: + return "host access qualifier"; case SPV_OPERAND_TYPE_IMAGE: case SPV_OPERAND_TYPE_OPTIONAL_IMAGE: return "image"; @@ -325,6 +305,7 @@ bool spvOperandIsConcrete(spv_operand_type_t type) { } switch (type) { case SPV_OPERAND_TYPE_LITERAL_INTEGER: + case SPV_OPERAND_TYPE_LITERAL_FLOAT: case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: case SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER: case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: @@ -369,6 +350,10 @@ bool spvOperandIsConcrete(spv_operand_type_t type) { case SPV_OPERAND_TYPE_QUANTIZATION_MODES: case SPV_OPERAND_TYPE_OVERFLOW_MODES: case SPV_OPERAND_TYPE_PACKED_VECTOR_FORMAT: + case SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_LAYOUT: + case SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_USE: + case SPV_OPERAND_TYPE_INITIALIZATION_MODE_QUALIFIER: + case SPV_OPERAND_TYPE_HOST_ACCESS_QUALIFIER: return true; default: break; @@ -387,6 +372,7 @@ bool spvOperandIsConcreteMask(spv_operand_type_t type) { case SPV_OPERAND_TYPE_FRAGMENT_SHADING_RATE: case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS: case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_INFO_FLAGS: + case SPV_OPERAND_TYPE_COOPERATIVE_MATRIX_OPERANDS: return true; default: break; @@ -405,6 +391,7 @@ bool spvOperandIsOptional(spv_operand_type_t type) { case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: case SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER: case SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT: + case SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS: case SPV_OPERAND_TYPE_OPTIONAL_CIV: return true; default: @@ -512,7 +499,7 @@ bool spvIsInIdType(spv_operand_type_t type) { } std::function spvOperandCanBeForwardDeclaredFunction( - SpvOp opcode) { + spv::Op opcode) { std::function out; if (spvOpcodeGeneratesType(opcode)) { // All types can use forward pointers. @@ -520,57 +507,57 @@ std::function spvOperandCanBeForwardDeclaredFunction( return out; } switch (opcode) { - case SpvOpExecutionMode: - case SpvOpExecutionModeId: - case SpvOpEntryPoint: - case SpvOpName: - case SpvOpMemberName: - case SpvOpSelectionMerge: - case SpvOpDecorate: - case SpvOpMemberDecorate: - case SpvOpDecorateId: - case SpvOpDecorateStringGOOGLE: - case SpvOpMemberDecorateStringGOOGLE: - case SpvOpBranch: - case SpvOpLoopMerge: + case spv::Op::OpExecutionMode: + case spv::Op::OpExecutionModeId: + case spv::Op::OpEntryPoint: + case spv::Op::OpName: + case spv::Op::OpMemberName: + case spv::Op::OpSelectionMerge: + case spv::Op::OpDecorate: + case spv::Op::OpMemberDecorate: + case spv::Op::OpDecorateId: + case spv::Op::OpDecorateStringGOOGLE: + case spv::Op::OpMemberDecorateStringGOOGLE: + case spv::Op::OpBranch: + case spv::Op::OpLoopMerge: out = [](unsigned) { return true; }; break; - case SpvOpGroupDecorate: - case SpvOpGroupMemberDecorate: - case SpvOpBranchConditional: - case SpvOpSwitch: + case spv::Op::OpGroupDecorate: + case spv::Op::OpGroupMemberDecorate: + case spv::Op::OpBranchConditional: + case spv::Op::OpSwitch: out = [](unsigned index) { return index != 0; }; break; - case SpvOpFunctionCall: + case spv::Op::OpFunctionCall: // The Function parameter. out = [](unsigned index) { return index == 2; }; break; - case SpvOpPhi: + case spv::Op::OpPhi: out = [](unsigned index) { return index > 1; }; break; - case SpvOpEnqueueKernel: + case spv::Op::OpEnqueueKernel: // The Invoke parameter. out = [](unsigned index) { return index == 8; }; break; - case SpvOpGetKernelNDrangeSubGroupCount: - case SpvOpGetKernelNDrangeMaxSubGroupSize: + case spv::Op::OpGetKernelNDrangeSubGroupCount: + case spv::Op::OpGetKernelNDrangeMaxSubGroupSize: // The Invoke parameter. out = [](unsigned index) { return index == 3; }; break; - case SpvOpGetKernelWorkGroupSize: - case SpvOpGetKernelPreferredWorkGroupSizeMultiple: + case spv::Op::OpGetKernelWorkGroupSize: + case spv::Op::OpGetKernelPreferredWorkGroupSizeMultiple: // The Invoke parameter. out = [](unsigned index) { return index == 2; }; break; - case SpvOpTypeForwardPointer: + case spv::Op::OpTypeForwardPointer: out = [](unsigned index) { return index == 0; }; break; - case SpvOpTypeArray: + case spv::Op::OpTypeArray: out = [](unsigned index) { return index == 1; }; break; default: diff --git a/bgfx/3rdparty/spirv-tools/source/operand.h b/bgfx/3rdparty/spirv-tools/source/operand.h index 7c73c6f5..a3010d93 100644 --- a/bgfx/3rdparty/spirv-tools/source/operand.h +++ b/bgfx/3rdparty/spirv-tools/source/operand.h @@ -139,7 +139,7 @@ bool spvIsInIdType(spv_operand_type_t type); // of the operand can be forward declared. This function will // used in the SSA validation stage of the pipeline std::function spvOperandCanBeForwardDeclaredFunction( - SpvOp opcode); + spv::Op opcode); // Takes the instruction key of a debug info extension instruction // and returns a function object that will return true if the index diff --git a/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp index 7fa5c8a9..87324cdb 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp @@ -21,61 +21,58 @@ #include #include "source/cfa.h" -#include "source/latest_version_glsl_std_450_header.h" #include "source/opt/eliminate_dead_functions_util.h" #include "source/opt/ir_builder.h" -#include "source/opt/iterator.h" #include "source/opt/reflect.h" #include "source/spirv_constant.h" #include "source/util/string_utils.h" namespace spvtools { namespace opt { - namespace { -const uint32_t kTypePointerStorageClassInIdx = 0; -const uint32_t kEntryPointFunctionIdInIdx = 1; -const uint32_t kSelectionMergeMergeBlockIdInIdx = 0; -const uint32_t kLoopMergeContinueBlockIdInIdx = 1; -const uint32_t kCopyMemoryTargetAddrInIdx = 0; -const uint32_t kCopyMemorySourceAddrInIdx = 1; -const uint32_t kLoadSourceAddrInIdx = 0; -const uint32_t kDebugDeclareOperandVariableIndex = 5; -const uint32_t kGlobalVariableVariableIndex = 12; +constexpr uint32_t kTypePointerStorageClassInIdx = 0; +constexpr uint32_t kEntryPointFunctionIdInIdx = 1; +constexpr uint32_t kSelectionMergeMergeBlockIdInIdx = 0; +constexpr uint32_t kLoopMergeContinueBlockIdInIdx = 1; +constexpr uint32_t kCopyMemoryTargetAddrInIdx = 0; +constexpr uint32_t kCopyMemorySourceAddrInIdx = 1; +constexpr uint32_t kLoadSourceAddrInIdx = 0; +constexpr uint32_t kDebugDeclareOperandVariableIndex = 5; +constexpr uint32_t kGlobalVariableVariableIndex = 12; // Sorting functor to present annotation instructions in an easy-to-process // order. The functor orders by opcode first and falls back on unique id // ordering if both instructions have the same opcode. // // Desired priority: -// SpvOpGroupDecorate -// SpvOpGroupMemberDecorate -// SpvOpDecorate -// SpvOpMemberDecorate -// SpvOpDecorateId -// SpvOpDecorateStringGOOGLE -// SpvOpDecorationGroup +// spv::Op::OpGroupDecorate +// spv::Op::OpGroupMemberDecorate +// spv::Op::OpDecorate +// spv::Op::OpMemberDecorate +// spv::Op::OpDecorateId +// spv::Op::OpDecorateStringGOOGLE +// spv::Op::OpDecorationGroup struct DecorationLess { bool operator()(const Instruction* lhs, const Instruction* rhs) const { assert(lhs && rhs); - SpvOp lhsOp = lhs->opcode(); - SpvOp rhsOp = rhs->opcode(); + spv::Op lhsOp = lhs->opcode(); + spv::Op rhsOp = rhs->opcode(); if (lhsOp != rhsOp) { #define PRIORITY_CASE(opcode) \ if (lhsOp == opcode && rhsOp != opcode) return true; \ if (rhsOp == opcode && lhsOp != opcode) return false; // OpGroupDecorate and OpGroupMember decorate are highest priority to // eliminate dead targets early and simplify subsequent checks. - PRIORITY_CASE(SpvOpGroupDecorate) - PRIORITY_CASE(SpvOpGroupMemberDecorate) - PRIORITY_CASE(SpvOpDecorate) - PRIORITY_CASE(SpvOpMemberDecorate) - PRIORITY_CASE(SpvOpDecorateId) - PRIORITY_CASE(SpvOpDecorateStringGOOGLE) + PRIORITY_CASE(spv::Op::OpGroupDecorate) + PRIORITY_CASE(spv::Op::OpGroupMemberDecorate) + PRIORITY_CASE(spv::Op::OpDecorate) + PRIORITY_CASE(spv::Op::OpMemberDecorate) + PRIORITY_CASE(spv::Op::OpDecorateId) + PRIORITY_CASE(spv::Op::OpDecorateStringGOOGLE) // OpDecorationGroup is lowest priority to ensure use/def chains remain // usable for instructions that target this group. - PRIORITY_CASE(SpvOpDecorationGroup) + PRIORITY_CASE(spv::Op::OpDecorationGroup) #undef PRIORITY_CASE } @@ -86,25 +83,26 @@ struct DecorationLess { } // namespace -bool AggressiveDCEPass::IsVarOfStorage(uint32_t varId, uint32_t storageClass) { +bool AggressiveDCEPass::IsVarOfStorage(uint32_t varId, + spv::StorageClass storageClass) { if (varId == 0) return false; const Instruction* varInst = get_def_use_mgr()->GetDef(varId); - const SpvOp op = varInst->opcode(); - if (op != SpvOpVariable) return false; + const spv::Op op = varInst->opcode(); + if (op != spv::Op::OpVariable) return false; const uint32_t varTypeId = varInst->type_id(); const Instruction* varTypeInst = get_def_use_mgr()->GetDef(varTypeId); - if (varTypeInst->opcode() != SpvOpTypePointer) return false; - return varTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx) == - storageClass; + if (varTypeInst->opcode() != spv::Op::OpTypePointer) return false; + return spv::StorageClass(varTypeInst->GetSingleWordInOperand( + kTypePointerStorageClassInIdx)) == storageClass; } bool AggressiveDCEPass::IsLocalVar(uint32_t varId, Function* func) { - if (IsVarOfStorage(varId, SpvStorageClassFunction)) { + if (IsVarOfStorage(varId, spv::StorageClass::Function)) { return true; } - if (!IsVarOfStorage(varId, SpvStorageClassPrivate) && - !IsVarOfStorage(varId, SpvStorageClassWorkgroup)) { + if (!IsVarOfStorage(varId, spv::StorageClass::Private) && + !IsVarOfStorage(varId, spv::StorageClass::Workgroup)) { return false; } @@ -122,21 +120,21 @@ void AggressiveDCEPass::AddStores(Function* func, uint32_t ptrId) { if (blk && blk->GetParent() != func) return; switch (user->opcode()) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpCopyObject: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpCopyObject: this->AddStores(func, user->result_id()); break; - case SpvOpLoad: + case spv::Op::OpLoad: break; - case SpvOpCopyMemory: - case SpvOpCopyMemorySized: + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyMemorySized: if (user->GetSingleWordInOperand(kCopyMemoryTargetAddrInIdx) == ptrId) { AddToWorklist(user); } break; // If default, assume it stores e.g. frexp, modf, function call - case SpvOpStore: + case spv::Op::OpStore: default: AddToWorklist(user); break; @@ -154,11 +152,12 @@ bool AggressiveDCEPass::AllExtensionsSupported() const { // Only allow NonSemantic.Shader.DebugInfo.100, we cannot safely optimise // around unknown extended instruction sets even if they are non-semantic for (auto& inst : context()->module()->ext_inst_imports()) { - assert(inst.opcode() == SpvOpExtInstImport && + assert(inst.opcode() == spv::Op::OpExtInstImport && "Expecting an import of an extension's instruction set."); const std::string extension_name = inst.GetInOperand(0).AsString(); if (spvtools::utils::starts_with(extension_name, "NonSemantic.") && - extension_name != "NonSemantic.Shader.DebugInfo.100") { + (extension_name != "NonSemantic.Shader.DebugInfo.100") && + (extension_name != "NonSemantic.DebugPrintf")) { return false; } } @@ -172,11 +171,11 @@ bool AggressiveDCEPass::IsTargetDead(Instruction* inst) { // This must be a decoration group. We go through annotations in a specific // order. So if this is not used by any group or group member decorates, it // is dead. - assert(tInst->opcode() == SpvOpDecorationGroup); + assert(tInst->opcode() == spv::Op::OpDecorationGroup); bool dead = true; get_def_use_mgr()->ForEachUser(tInst, [&dead](Instruction* user) { - if (user->opcode() == SpvOpGroupDecorate || - user->opcode() == SpvOpGroupMemberDecorate) + if (user->opcode() == spv::Op::OpGroupDecorate || + user->opcode() == spv::Op::OpGroupMemberDecorate) dead = false; }); return dead; @@ -197,7 +196,7 @@ void AggressiveDCEPass::ProcessLoad(Function* func, uint32_t varId) { void AggressiveDCEPass::AddBranch(uint32_t labelId, BasicBlock* bp) { std::unique_ptr newBranch( - new Instruction(context(), SpvOpBranch, 0, 0, + new Instruction(context(), spv::Op::OpBranch, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {labelId}}})); context()->AnalyzeDefUse(&*newBranch); context()->set_instr_block(&*newBranch, bp); @@ -206,8 +205,8 @@ void AggressiveDCEPass::AddBranch(uint32_t labelId, BasicBlock* bp) { void AggressiveDCEPass::AddBreaksAndContinuesToWorklist( Instruction* mergeInst) { - assert(mergeInst->opcode() == SpvOpSelectionMerge || - mergeInst->opcode() == SpvOpLoopMerge); + assert(mergeInst->opcode() == spv::Op::OpSelectionMerge || + mergeInst->opcode() == spv::Op::OpLoopMerge); BasicBlock* header = context()->get_instr_block(mergeInst); const uint32_t mergeId = mergeInst->GetSingleWordInOperand(0); @@ -223,7 +222,7 @@ void AggressiveDCEPass::AddBreaksAndContinuesToWorklist( } }); - if (mergeInst->opcode() != SpvOpLoopMerge) { + if (mergeInst->opcode() != spv::Op::OpLoopMerge) { return; } @@ -231,26 +230,27 @@ void AggressiveDCEPass::AddBreaksAndContinuesToWorklist( const uint32_t contId = mergeInst->GetSingleWordInOperand(kLoopMergeContinueBlockIdInIdx); get_def_use_mgr()->ForEachUser(contId, [&contId, this](Instruction* user) { - SpvOp op = user->opcode(); - if (op == SpvOpBranchConditional || op == SpvOpSwitch) { + spv::Op op = user->opcode(); + if (op == spv::Op::OpBranchConditional || op == spv::Op::OpSwitch) { // A conditional branch or switch can only be a continue if it does not // have a merge instruction or its merge block is not the continue block. Instruction* hdrMerge = GetMergeInstruction(user); - if (hdrMerge != nullptr && hdrMerge->opcode() == SpvOpSelectionMerge) { + if (hdrMerge != nullptr && + hdrMerge->opcode() == spv::Op::OpSelectionMerge) { uint32_t hdrMergeId = hdrMerge->GetSingleWordInOperand(kSelectionMergeMergeBlockIdInIdx); if (hdrMergeId == contId) return; // Need to mark merge instruction too AddToWorklist(hdrMerge); } - } else if (op == SpvOpBranch) { + } else if (op == spv::Op::OpBranch) { // An unconditional branch can only be a continue if it is not // branching to its own merge block. BasicBlock* blk = context()->get_instr_block(user); Instruction* hdrBranch = GetHeaderBranch(blk); if (hdrBranch == nullptr) return; Instruction* hdrMerge = GetMergeInstruction(hdrBranch); - if (hdrMerge->opcode() == SpvOpLoopMerge) return; + if (hdrMerge->opcode() == spv::Op::OpLoopMerge) return; uint32_t hdrMergeId = hdrMerge->GetSingleWordInOperand(kSelectionMergeMergeBlockIdInIdx); if (contId == hdrMergeId) return; @@ -277,11 +277,11 @@ bool AggressiveDCEPass::KillDeadInstructions( uint32_t merge_block_id = 0; (*bi)->ForEachInst([this, &modified, &merge_block_id](Instruction* inst) { if (IsLive(inst)) return; - if (inst->opcode() == SpvOpLabel) return; + if (inst->opcode() == spv::Op::OpLabel) return; // If dead instruction is selection merge, remember merge block // for new branch at end of block - if (inst->opcode() == SpvOpSelectionMerge || - inst->opcode() == SpvOpLoopMerge) + if (inst->opcode() == spv::Op::OpSelectionMerge || + inst->opcode() == spv::Op::OpLoopMerge) merge_block_id = inst->GetSingleWordInOperand(0); to_kill_.push_back(inst); modified = true; @@ -295,19 +295,19 @@ bool AggressiveDCEPass::KillDeadInstructions( } auto merge_terminator = (*bi)->terminator(); - if (merge_terminator->opcode() == SpvOpUnreachable) { + if (merge_terminator->opcode() == spv::Op::OpUnreachable) { // The merge was unreachable. This is undefined behaviour so just // return (or return an undef). Then mark the new return as live. auto func_ret_type_inst = get_def_use_mgr()->GetDef(func->type_id()); - if (func_ret_type_inst->opcode() == SpvOpTypeVoid) { - merge_terminator->SetOpcode(SpvOpReturn); + if (func_ret_type_inst->opcode() == spv::Op::OpTypeVoid) { + merge_terminator->SetOpcode(spv::Op::OpReturn); } else { // Find an undef for the return value and make sure it gets kept by // the pass. auto undef_id = Type2Undef(func->type_id()); auto undef = get_def_use_mgr()->GetDef(undef_id); live_insts_.Set(undef->unique_id()); - merge_terminator->SetOpcode(SpvOpReturnValue); + merge_terminator->SetOpcode(spv::Op::OpReturnValue); merge_terminator->SetInOperands({{SPV_OPERAND_TYPE_ID, {undef_id}}}); get_def_use_mgr()->AnalyzeInstUse(merge_terminator); } @@ -369,11 +369,11 @@ void AggressiveDCEPass::AddDecorationsToWorkList(const Instruction* inst) { // We only care about OpDecorateId instructions because the are the only // decorations that will reference an id that will have to be kept live // because of that use. - if (dec->opcode() != SpvOpDecorateId) { + if (dec->opcode() != spv::Op::OpDecorateId) { continue; } - if (dec->GetSingleWordInOperand(1) == - SpvDecorationHlslCounterBufferGOOGLE) { + if (spv::Decoration(dec->GetSingleWordInOperand(1)) == + spv::Decoration::HlslCounterBufferGOOGLE) { // These decorations should not force the use id to be live. It will be // removed if either the target or the in operand are dead. continue; @@ -391,7 +391,7 @@ void AggressiveDCEPass::MarkLoadedVariablesAsLive(Function* func, } std::vector AggressiveDCEPass::GetLoadedVariables(Instruction* inst) { - if (inst->opcode() == SpvOpFunctionCall) { + if (inst->opcode() == spv::Op::OpFunctionCall) { return GetLoadedVariablesFromFunctionCall(inst); } uint32_t var_id = GetLoadedVariableFromNonFunctionCalls(inst); @@ -409,11 +409,11 @@ uint32_t AggressiveDCEPass::GetLoadedVariableFromNonFunctionCalls( } switch (inst->opcode()) { - case SpvOpLoad: - case SpvOpImageTexelPointer: + case spv::Op::OpLoad: + case spv::Op::OpImageTexelPointer: return GetVariableId(inst->GetSingleWordInOperand(kLoadSourceAddrInIdx)); - case SpvOpCopyMemory: - case SpvOpCopyMemorySized: + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyMemorySized: return GetVariableId( inst->GetSingleWordInOperand(kCopyMemorySourceAddrInIdx)); default: @@ -436,8 +436,11 @@ uint32_t AggressiveDCEPass::GetLoadedVariableFromNonFunctionCalls( std::vector AggressiveDCEPass::GetLoadedVariablesFromFunctionCall( const Instruction* inst) { - assert(inst->opcode() == SpvOpFunctionCall); + assert(inst->opcode() == spv::Op::OpFunctionCall); std::vector live_variables; + // NOTE: we should only be checking function call parameters here, not the + // function itself, however, `IsPtr` will trivially return false for + // OpFunction inst->ForEachInId([this, &live_variables](const uint32_t* operand_id) { if (!IsPtr(*operand_id)) return; uint32_t var_id = GetVariableId(*operand_id); @@ -481,7 +484,7 @@ void AggressiveDCEPass::MarkBlockAsLive(Instruction* inst) { // the loop, so the loop construct must be live. We exclude the label because // it does not matter how many times it is executed. This could be extended // to more instructions, but we will need it for now. - if (inst->opcode() != SpvOpLabel) + if (inst->opcode() != spv::Op::OpLabel) MarkLoopConstructAsLiveIfLoopHeader(basic_block); Instruction* next_branch_inst = GetBranchForNextHeader(basic_block); @@ -491,8 +494,8 @@ void AggressiveDCEPass::MarkBlockAsLive(Instruction* inst) { AddToWorklist(mergeInst); } - if (inst->opcode() == SpvOpLoopMerge || - inst->opcode() == SpvOpSelectionMerge) { + if (inst->opcode() == spv::Op::OpLoopMerge || + inst->opcode() == spv::Op::OpSelectionMerge) { AddBreaksAndContinuesToWorklist(inst); } } @@ -529,27 +532,27 @@ void AggressiveDCEPass::InitializeWorkList( // cleaned up. for (auto& bi : structured_order) { for (auto ii = bi->begin(); ii != bi->end(); ++ii) { - SpvOp op = ii->opcode(); + spv::Op op = ii->opcode(); if (ii->IsBranch()) { continue; } switch (op) { - case SpvOpStore: { + case spv::Op::OpStore: { uint32_t var_id = 0; (void)GetPtr(&*ii, &var_id); if (!IsLocalVar(var_id, func)) AddToWorklist(&*ii); } break; - case SpvOpCopyMemory: - case SpvOpCopyMemorySized: { + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyMemorySized: { uint32_t var_id = 0; uint32_t target_addr_id = ii->GetSingleWordInOperand(kCopyMemoryTargetAddrInIdx); (void)GetPtr(target_addr_id, &var_id); if (!IsLocalVar(var_id, func)) AddToWorklist(&*ii); } break; - case SpvOpLoopMerge: - case SpvOpSelectionMerge: - case SpvOpUnreachable: + case spv::Op::OpLoopMerge: + case spv::Op::OpSelectionMerge: + case spv::Op::OpUnreachable: break; default: { // Function calls, atomics, function params, function returns, etc. @@ -578,8 +581,10 @@ void AggressiveDCEPass::InitializeModuleScopeLiveInstructions() { auto* var = get_def_use_mgr()->GetDef(entry.GetSingleWordInOperand(i)); auto storage_class = var->GetSingleWordInOperand(0u); // Vulkan support outputs without an associated input, but not inputs - // without an associated output. - if (storage_class == SpvStorageClassOutput) { + // without an associated output. Don't remove outputs unless explicitly + // allowed. + if (!remove_outputs_ && + spv::StorageClass(storage_class) == spv::StorageClass::Output) { AddToWorklist(var); } } @@ -588,24 +593,29 @@ void AggressiveDCEPass::InitializeModuleScopeLiveInstructions() { } } for (auto& anno : get_module()->annotations()) { - if (anno.opcode() == SpvOpDecorate) { + if (anno.opcode() == spv::Op::OpDecorate) { // Keep workgroup size. - if (anno.GetSingleWordInOperand(1u) == SpvDecorationBuiltIn && - anno.GetSingleWordInOperand(2u) == SpvBuiltInWorkgroupSize) { + if (spv::Decoration(anno.GetSingleWordInOperand(1u)) == + spv::Decoration::BuiltIn && + spv::BuiltIn(anno.GetSingleWordInOperand(2u)) == + spv::BuiltIn::WorkgroupSize) { AddToWorklist(&anno); } if (context()->preserve_bindings()) { // Keep all bindings. - if ((anno.GetSingleWordInOperand(1u) == SpvDecorationDescriptorSet) || - (anno.GetSingleWordInOperand(1u) == SpvDecorationBinding)) { + if ((spv::Decoration(anno.GetSingleWordInOperand(1u)) == + spv::Decoration::DescriptorSet) || + (spv::Decoration(anno.GetSingleWordInOperand(1u)) == + spv::Decoration::Binding)) { AddToWorklist(&anno); } } if (context()->preserve_spec_constants()) { // Keep all specialization constant instructions - if (anno.GetSingleWordInOperand(1u) == SpvDecorationSpecId) { + if (spv::Decoration(anno.GetSingleWordInOperand(1u)) == + spv::Decoration::SpecId) { AddToWorklist(&anno); } } @@ -624,7 +634,7 @@ void AggressiveDCEPass::InitializeModuleScopeLiveInstructions() { debug_global_seen = true; dbg.ForEachInId([this](const uint32_t* iid) { Instruction* in_inst = get_def_use_mgr()->GetDef(*iid); - if (in_inst->opcode() == SpvOpVariable) return; + if (in_inst->opcode() == spv::Op::OpVariable) return; AddToWorklist(in_inst); }); } @@ -647,19 +657,19 @@ void AggressiveDCEPass::InitializeModuleScopeLiveInstructions() { Pass::Status AggressiveDCEPass::ProcessImpl() { // Current functionality assumes shader capability // TODO(greg-lunarg): Handle additional capabilities - if (!context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) + if (!context()->get_feature_mgr()->HasCapability(spv::Capability::Shader)) return Status::SuccessWithoutChange; // Current functionality assumes relaxed logical addressing (see // instruction.h) // TODO(greg-lunarg): Handle non-logical addressing - if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses)) + if (context()->get_feature_mgr()->HasCapability(spv::Capability::Addresses)) return Status::SuccessWithoutChange; // The variable pointer extension is no longer needed to use the capability, // so we have to look for the capability. if (context()->get_feature_mgr()->HasCapability( - SpvCapabilityVariablePointersStorageBuffer)) + spv::Capability::VariablePointersStorageBuffer)) return Status::SuccessWithoutChange; // If any extensions in the module are not explicitly supported, @@ -743,7 +753,7 @@ bool AggressiveDCEPass::ProcessGlobalValues() { bool modified = false; Instruction* instruction = &*get_module()->debug2_begin(); while (instruction) { - if (instruction->opcode() != SpvOpName) { + if (instruction->opcode() != spv::Op::OpName) { instruction = instruction->NextNode(); continue; } @@ -764,22 +774,22 @@ bool AggressiveDCEPass::ProcessGlobalValues() { std::sort(annotations.begin(), annotations.end(), DecorationLess()); for (auto annotation : annotations) { switch (annotation->opcode()) { - case SpvOpDecorate: - case SpvOpMemberDecorate: - case SpvOpDecorateStringGOOGLE: - case SpvOpMemberDecorateStringGOOGLE: + case spv::Op::OpDecorate: + case spv::Op::OpMemberDecorate: + case spv::Op::OpDecorateStringGOOGLE: + case spv::Op::OpMemberDecorateStringGOOGLE: if (IsTargetDead(annotation)) { context()->KillInst(annotation); modified = true; } break; - case SpvOpDecorateId: + case spv::Op::OpDecorateId: if (IsTargetDead(annotation)) { context()->KillInst(annotation); modified = true; } else { - if (annotation->GetSingleWordInOperand(1) == - SpvDecorationHlslCounterBufferGOOGLE) { + if (spv::Decoration(annotation->GetSingleWordInOperand(1)) == + spv::Decoration::HlslCounterBufferGOOGLE) { // HlslCounterBuffer will reference an id other than the target. // If that id is dead, then the decoration can be removed as well. uint32_t counter_buffer_id = annotation->GetSingleWordInOperand(2); @@ -792,7 +802,7 @@ bool AggressiveDCEPass::ProcessGlobalValues() { } } break; - case SpvOpGroupDecorate: { + case spv::Op::OpGroupDecorate: { // Go through the targets of this group decorate. Remove each dead // target. If all targets are dead, remove this decoration. bool dead = true; @@ -818,7 +828,7 @@ bool AggressiveDCEPass::ProcessGlobalValues() { } break; } - case SpvOpGroupMemberDecorate: { + case spv::Op::OpGroupMemberDecorate: { // Go through the targets of this group member decorate. Remove each // dead target (and member index). If all targets are dead, remove this // decoration. @@ -846,7 +856,7 @@ bool AggressiveDCEPass::ProcessGlobalValues() { } break; } - case SpvOpDecorationGroup: + case spv::Op::OpDecorationGroup: // By the time we hit decoration groups we've checked everything that // can target them. So if they have no uses they must be dead. if (get_def_use_mgr()->NumUsers(annotation) == 0) { @@ -887,7 +897,7 @@ bool AggressiveDCEPass::ProcessGlobalValues() { // this live as it does not have a result id. This is a little too // conservative since it is not known if the structure type that needed // it is still live. TODO(greg-lunarg): Only save if needed. - if (val.opcode() == SpvOpTypeForwardPointer) { + if (val.opcode() == spv::Op::OpTypeForwardPointer) { uint32_t ptr_ty_id = val.GetSingleWordInOperand(0); Instruction* ptr_ty_inst = get_def_use_mgr()->GetDef(ptr_ty_id); if (IsLive(ptr_ty_inst)) continue; @@ -987,6 +997,8 @@ void AggressiveDCEPass::InitExtensions() { "SPV_KHR_non_semantic_info", "SPV_KHR_uniform_group_instructions", "SPV_KHR_fragment_shader_barycentric", + "SPV_NV_bindless_texture", + "SPV_EXT_shader_atomic_float_add", }); } @@ -1083,8 +1095,9 @@ bool AggressiveDCEPass::IsEntryPoint(Function* func) { } bool AggressiveDCEPass::HasCall(Function* func) { - return !func->WhileEachInst( - [](Instruction* inst) { return inst->opcode() != SpvOpFunctionCall; }); + return !func->WhileEachInst([](Instruction* inst) { + return inst->opcode() != spv::Op::OpFunctionCall; + }); } void AggressiveDCEPass::MarkFirstBlockAsLive(Function* func) { diff --git a/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h index c1291dc4..fbe08ad0 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h @@ -44,8 +44,10 @@ class AggressiveDCEPass : public MemPass { using GetBlocksFunction = std::function*(const BasicBlock*)>; - AggressiveDCEPass(bool preserve_interface = false) - : preserve_interface_(preserve_interface) {} + AggressiveDCEPass(bool preserve_interface = false, + bool remove_outputs = false) + : preserve_interface_(preserve_interface), + remove_outputs_(remove_outputs) {} const char* name() const override { return "eliminate-dead-code-aggressive"; } Status Process() override; @@ -63,9 +65,14 @@ class AggressiveDCEPass : public MemPass { // is not allowed. bool preserve_interface_; + // Output variables can be removed from the interface if this is true. + // This is safe if the caller knows that the corresponding input variable + // in the following shader has been removed. It is false by default. + bool remove_outputs_; + // Return true if |varId| is a variable of |storageClass|. |varId| must either // be 0 or the result of an instruction. - bool IsVarOfStorage(uint32_t varId, uint32_t storageClass); + bool IsVarOfStorage(uint32_t varId, spv::StorageClass storageClass); // Return true if the instance of the variable |varId| can only be access in // |func|. For example, a function scope variable, or a private variable diff --git a/bgfx/3rdparty/spirv-tools/source/opt/amd_ext_to_khr.cpp b/bgfx/3rdparty/spirv-tools/source/opt/amd_ext_to_khr.cpp index dd9bafda..a314567f 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/amd_ext_to_khr.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/amd_ext_to_khr.cpp @@ -24,7 +24,6 @@ namespace spvtools { namespace opt { - namespace { enum AmdShaderBallotExtOpcodes { @@ -136,19 +135,19 @@ bool ReplaceTrinaryMid(IRContext* ctx, Instruction* inst, // Returns a folding rule that will replace the opcode with |opcode| and add // the capabilities required. The folding rule assumes it is folding an // OpGroup*NonUniformAMD instruction from the SPV_AMD_shader_ballot extension. -template +template bool ReplaceGroupNonuniformOperationOpCode( IRContext* ctx, Instruction* inst, const std::vector&) { switch (new_opcode) { - case SpvOpGroupNonUniformIAdd: - case SpvOpGroupNonUniformFAdd: - case SpvOpGroupNonUniformUMin: - case SpvOpGroupNonUniformSMin: - case SpvOpGroupNonUniformFMin: - case SpvOpGroupNonUniformUMax: - case SpvOpGroupNonUniformSMax: - case SpvOpGroupNonUniformFMax: + case spv::Op::OpGroupNonUniformIAdd: + case spv::Op::OpGroupNonUniformFAdd: + case spv::Op::OpGroupNonUniformUMin: + case spv::Op::OpGroupNonUniformSMin: + case spv::Op::OpGroupNonUniformFMin: + case spv::Op::OpGroupNonUniformUMax: + case spv::Op::OpGroupNonUniformSMax: + case spv::Op::OpGroupNonUniformFMax: break; default: assert( @@ -157,21 +156,21 @@ bool ReplaceGroupNonuniformOperationOpCode( } switch (inst->opcode()) { - case SpvOpGroupIAddNonUniformAMD: - case SpvOpGroupFAddNonUniformAMD: - case SpvOpGroupUMinNonUniformAMD: - case SpvOpGroupSMinNonUniformAMD: - case SpvOpGroupFMinNonUniformAMD: - case SpvOpGroupUMaxNonUniformAMD: - case SpvOpGroupSMaxNonUniformAMD: - case SpvOpGroupFMaxNonUniformAMD: + case spv::Op::OpGroupIAddNonUniformAMD: + case spv::Op::OpGroupFAddNonUniformAMD: + case spv::Op::OpGroupUMinNonUniformAMD: + case spv::Op::OpGroupSMinNonUniformAMD: + case spv::Op::OpGroupFMinNonUniformAMD: + case spv::Op::OpGroupUMaxNonUniformAMD: + case spv::Op::OpGroupSMaxNonUniformAMD: + case spv::Op::OpGroupFMaxNonUniformAMD: break; default: assert(false && "Should be replacing a group non uniform arithmetic operation."); } - ctx->AddCapability(SpvCapabilityGroupNonUniformArithmetic); + ctx->AddCapability(spv::Capability::GroupNonUniformArithmetic); inst->SetOpcode(new_opcode); return true; } @@ -215,8 +214,8 @@ bool ReplaceSwizzleInvocations(IRContext* ctx, Instruction* inst, analysis::ConstantManager* const_mgr = ctx->get_constant_mgr(); ctx->AddExtension("SPV_KHR_shader_ballot"); - ctx->AddCapability(SpvCapabilityGroupNonUniformBallot); - ctx->AddCapability(SpvCapabilityGroupNonUniformShuffle); + ctx->AddCapability(spv::Capability::GroupNonUniformBallot); + ctx->AddCapability(spv::Capability::GroupNonUniformShuffle); InstructionBuilder ir_builder( ctx, inst, @@ -226,8 +225,8 @@ bool ReplaceSwizzleInvocations(IRContext* ctx, Instruction* inst, uint32_t offset_id = inst->GetSingleWordInOperand(3); // Get the subgroup invocation id. - uint32_t var_id = - ctx->GetBuiltinInputVarId(SpvBuiltInSubgroupLocalInvocationId); + uint32_t var_id = ctx->GetBuiltinInputVarId( + uint32_t(spv::BuiltIn::SubgroupLocalInvocationId)); assert(var_id != 0 && "Could not get SubgroupLocalInvocationId variable."); Instruction* var_inst = ctx->get_def_use_mgr()->GetDef(var_id); Instruction* var_ptr_type = @@ -239,35 +238,38 @@ bool ReplaceSwizzleInvocations(IRContext* ctx, Instruction* inst, uint32_t quad_mask = ir_builder.GetUintConstantId(3); // This gives the offset in the group of 4 of this invocation. - Instruction* quad_idx = ir_builder.AddBinaryOp(uint_type_id, SpvOpBitwiseAnd, - id->result_id(), quad_mask); + Instruction* quad_idx = ir_builder.AddBinaryOp( + uint_type_id, spv::Op::OpBitwiseAnd, id->result_id(), quad_mask); // Get the invocation id of the first invocation in the group of 4. - Instruction* quad_ldr = ir_builder.AddBinaryOp( - uint_type_id, SpvOpBitwiseXor, id->result_id(), quad_idx->result_id()); + Instruction* quad_ldr = + ir_builder.AddBinaryOp(uint_type_id, spv::Op::OpBitwiseXor, + id->result_id(), quad_idx->result_id()); // Get the offset of the target invocation from the offset vector. Instruction* my_offset = - ir_builder.AddBinaryOp(uint_type_id, SpvOpVectorExtractDynamic, offset_id, - quad_idx->result_id()); + ir_builder.AddBinaryOp(uint_type_id, spv::Op::OpVectorExtractDynamic, + offset_id, quad_idx->result_id()); // Determine the index of the invocation to read from. - Instruction* target_inv = ir_builder.AddBinaryOp( - uint_type_id, SpvOpIAdd, quad_ldr->result_id(), my_offset->result_id()); + Instruction* target_inv = + ir_builder.AddBinaryOp(uint_type_id, spv::Op::OpIAdd, + quad_ldr->result_id(), my_offset->result_id()); // Do the group operations uint32_t uint_max_id = ir_builder.GetUintConstantId(0xFFFFFFFF); - uint32_t subgroup_scope = ir_builder.GetUintConstantId(SpvScopeSubgroup); + uint32_t subgroup_scope = + ir_builder.GetUintConstantId(uint32_t(spv::Scope::Subgroup)); const auto* ballot_value_const = const_mgr->GetConstant( type_mgr->GetUIntVectorType(4), {uint_max_id, uint_max_id, uint_max_id, uint_max_id}); Instruction* ballot_value = const_mgr->GetDefiningInstruction(ballot_value_const); Instruction* is_active = ir_builder.AddNaryOp( - type_mgr->GetBoolTypeId(), SpvOpGroupNonUniformBallotBitExtract, + type_mgr->GetBoolTypeId(), spv::Op::OpGroupNonUniformBallotBitExtract, {subgroup_scope, ballot_value->result_id(), target_inv->result_id()}); Instruction* shuffle = - ir_builder.AddNaryOp(inst->type_id(), SpvOpGroupNonUniformShuffle, + ir_builder.AddNaryOp(inst->type_id(), spv::Op::OpGroupNonUniformShuffle, {subgroup_scope, data_id, target_inv->result_id()}); // Create the null constant to use in the select. @@ -276,7 +278,7 @@ bool ReplaceSwizzleInvocations(IRContext* ctx, Instruction* inst, Instruction* null_inst = const_mgr->GetDefiningInstruction(null); // Build the select. - inst->SetOpcode(SpvOpSelect); + inst->SetOpcode(spv::Op::OpSelect); Instruction::OperandList new_operands; new_operands.push_back({SPV_OPERAND_TYPE_ID, {is_active->result_id()}}); new_operands.push_back({SPV_OPERAND_TYPE_ID, {shuffle->result_id()}}); @@ -327,8 +329,8 @@ bool ReplaceSwizzleInvocationsMasked( analysis::DefUseManager* def_use_mgr = ctx->get_def_use_mgr(); analysis::ConstantManager* const_mgr = ctx->get_constant_mgr(); - ctx->AddCapability(SpvCapabilityGroupNonUniformBallot); - ctx->AddCapability(SpvCapabilityGroupNonUniformShuffle); + ctx->AddCapability(spv::Capability::GroupNonUniformBallot); + ctx->AddCapability(spv::Capability::GroupNonUniformShuffle); InstructionBuilder ir_builder( ctx, inst, @@ -338,7 +340,7 @@ bool ReplaceSwizzleInvocationsMasked( uint32_t data_id = inst->GetSingleWordInOperand(2); Instruction* mask_inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(3)); - assert(mask_inst->opcode() == SpvOpConstantComposite && + assert(mask_inst->opcode() == spv::Op::OpConstantComposite && "The mask is suppose to be a vector constant."); assert(mask_inst->NumInOperands() == 3 && "The mask is suppose to have 3 components."); @@ -348,8 +350,8 @@ bool ReplaceSwizzleInvocationsMasked( uint32_t uint_z = mask_inst->GetSingleWordInOperand(2); // Get the subgroup invocation id. - uint32_t var_id = - ctx->GetBuiltinInputVarId(SpvBuiltInSubgroupLocalInvocationId); + uint32_t var_id = ctx->GetBuiltinInputVarId( + uint32_t(spv::BuiltIn::SubgroupLocalInvocationId)); ctx->AddExtension("SPV_KHR_shader_ballot"); assert(var_id != 0 && "Could not get SubgroupLocalInvocationId variable."); Instruction* var_inst = ctx->get_def_use_mgr()->GetDef(var_id); @@ -361,28 +363,30 @@ bool ReplaceSwizzleInvocationsMasked( // Do the bitwise operations. uint32_t mask_extended = ir_builder.GetUintConstantId(0xFFFFFFE0); - Instruction* and_mask = ir_builder.AddBinaryOp(uint_type_id, SpvOpBitwiseOr, - uint_x, mask_extended); - Instruction* and_result = ir_builder.AddBinaryOp( - uint_type_id, SpvOpBitwiseAnd, id->result_id(), and_mask->result_id()); + Instruction* and_mask = ir_builder.AddBinaryOp( + uint_type_id, spv::Op::OpBitwiseOr, uint_x, mask_extended); + Instruction* and_result = + ir_builder.AddBinaryOp(uint_type_id, spv::Op::OpBitwiseAnd, + id->result_id(), and_mask->result_id()); Instruction* or_result = ir_builder.AddBinaryOp( - uint_type_id, SpvOpBitwiseOr, and_result->result_id(), uint_y); + uint_type_id, spv::Op::OpBitwiseOr, and_result->result_id(), uint_y); Instruction* target_inv = ir_builder.AddBinaryOp( - uint_type_id, SpvOpBitwiseXor, or_result->result_id(), uint_z); + uint_type_id, spv::Op::OpBitwiseXor, or_result->result_id(), uint_z); // Do the group operations uint32_t uint_max_id = ir_builder.GetUintConstantId(0xFFFFFFFF); - uint32_t subgroup_scope = ir_builder.GetUintConstantId(SpvScopeSubgroup); + uint32_t subgroup_scope = + ir_builder.GetUintConstantId(uint32_t(spv::Scope::Subgroup)); const auto* ballot_value_const = const_mgr->GetConstant( type_mgr->GetUIntVectorType(4), {uint_max_id, uint_max_id, uint_max_id, uint_max_id}); Instruction* ballot_value = const_mgr->GetDefiningInstruction(ballot_value_const); Instruction* is_active = ir_builder.AddNaryOp( - type_mgr->GetBoolTypeId(), SpvOpGroupNonUniformBallotBitExtract, + type_mgr->GetBoolTypeId(), spv::Op::OpGroupNonUniformBallotBitExtract, {subgroup_scope, ballot_value->result_id(), target_inv->result_id()}); Instruction* shuffle = - ir_builder.AddNaryOp(inst->type_id(), SpvOpGroupNonUniformShuffle, + ir_builder.AddNaryOp(inst->type_id(), spv::Op::OpGroupNonUniformShuffle, {subgroup_scope, data_id, target_inv->result_id()}); // Create the null constant to use in the select. @@ -391,7 +395,7 @@ bool ReplaceSwizzleInvocationsMasked( Instruction* null_inst = const_mgr->GetDefiningInstruction(null); // Build the select. - inst->SetOpcode(SpvOpSelect); + inst->SetOpcode(spv::Op::OpSelect); Instruction::OperandList new_operands; new_operands.push_back({SPV_OPERAND_TYPE_ID, {is_active->result_id()}}); new_operands.push_back({SPV_OPERAND_TYPE_ID, {shuffle->result_id()}}); @@ -420,9 +424,9 @@ bool ReplaceSwizzleInvocationsMasked( // Also adding the capabilities and builtins that are needed. bool ReplaceWriteInvocation(IRContext* ctx, Instruction* inst, const std::vector&) { - uint32_t var_id = - ctx->GetBuiltinInputVarId(SpvBuiltInSubgroupLocalInvocationId); - ctx->AddCapability(SpvCapabilitySubgroupBallotKHR); + uint32_t var_id = ctx->GetBuiltinInputVarId( + uint32_t(spv::BuiltIn::SubgroupLocalInvocationId)); + ctx->AddCapability(spv::Capability::SubgroupBallotKHR); ctx->AddExtension("SPV_KHR_shader_ballot"); assert(var_id != 0 && "Could not get SubgroupLocalInvocationId variable."); Instruction* var_inst = ctx->get_def_use_mgr()->GetDef(var_id); @@ -437,11 +441,11 @@ bool ReplaceWriteInvocation(IRContext* ctx, Instruction* inst, analysis::Bool bool_type; uint32_t bool_type_id = ctx->get_type_mgr()->GetTypeInstruction(&bool_type); Instruction* cmp = - ir_builder.AddBinaryOp(bool_type_id, SpvOpIEqual, t->result_id(), + ir_builder.AddBinaryOp(bool_type_id, spv::Op::OpIEqual, t->result_id(), inst->GetSingleWordInOperand(4)); // Build a select. - inst->SetOpcode(SpvOpSelect); + inst->SetOpcode(spv::Op::OpSelect); Instruction::OperandList new_operands; new_operands.push_back({SPV_OPERAND_TYPE_ID, {cmp->result_id()}}); new_operands.push_back(inst->GetInOperand(3)); @@ -479,14 +483,15 @@ bool ReplaceMbcnt(IRContext* context, Instruction* inst, analysis::TypeManager* type_mgr = context->get_type_mgr(); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); - uint32_t var_id = context->GetBuiltinInputVarId(SpvBuiltInSubgroupLtMask); + uint32_t var_id = + context->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::SubgroupLtMask)); assert(var_id != 0 && "Could not get SubgroupLtMask variable."); - context->AddCapability(SpvCapabilityGroupNonUniformBallot); + context->AddCapability(spv::Capability::GroupNonUniformBallot); Instruction* var_inst = def_use_mgr->GetDef(var_id); Instruction* var_ptr_type = def_use_mgr->GetDef(var_inst->type_id()); Instruction* var_type = def_use_mgr->GetDef(var_ptr_type->GetSingleWordInOperand(1)); - assert(var_type->opcode() == SpvOpTypeVector && + assert(var_type->opcode() == spv::Op::OpTypeVector && "Variable is suppose to be a vector of 4 ints"); // Get the type for the shuffle. @@ -509,11 +514,12 @@ bool ReplaceMbcnt(IRContext* context, Instruction* inst, Instruction* shuffle = ir_builder.AddVectorShuffle( shuffle_type_id, load->result_id(), load->result_id(), {0, 1}); Instruction* bitcast = ir_builder.AddUnaryOp( - mask_inst->type_id(), SpvOpBitcast, shuffle->result_id()); - Instruction* t = ir_builder.AddBinaryOp(mask_inst->type_id(), SpvOpBitwiseAnd, - bitcast->result_id(), mask_id); + mask_inst->type_id(), spv::Op::OpBitcast, shuffle->result_id()); + Instruction* t = + ir_builder.AddBinaryOp(mask_inst->type_id(), spv::Op::OpBitwiseAnd, + bitcast->result_id(), mask_id); - inst->SetOpcode(SpvOpBitCount); + inst->SetOpcode(spv::Op::OpBitCount); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {t->result_id()}}}); context->UpdateDefUse(inst); return true; @@ -599,11 +605,11 @@ bool ReplaceCubeFaceCoord(IRContext* ctx, Instruction* inst, // Negate the input values. Instruction* nx = - ir_builder.AddUnaryOp(float_type_id, SpvOpFNegate, x->result_id()); + ir_builder.AddUnaryOp(float_type_id, spv::Op::OpFNegate, x->result_id()); Instruction* ny = - ir_builder.AddUnaryOp(float_type_id, SpvOpFNegate, y->result_id()); + ir_builder.AddUnaryOp(float_type_id, spv::Op::OpFNegate, y->result_id()); Instruction* nz = - ir_builder.AddUnaryOp(float_type_id, SpvOpFNegate, z->result_id()); + ir_builder.AddUnaryOp(float_type_id, spv::Op::OpFNegate, z->result_id()); // Get the abolsute values of the inputs. Instruction* ax = ir_builder.AddNaryExtendedInstruction( @@ -614,12 +620,12 @@ bool ReplaceCubeFaceCoord(IRContext* ctx, Instruction* inst, float_type_id, glsl405_ext_inst_id, GLSLstd450FAbs, {z->result_id()}); // Find which values are negative. Used in later computations. - Instruction* is_z_neg = ir_builder.AddBinaryOp(bool_id, SpvOpFOrdLessThan, - z->result_id(), f0_const_id); - Instruction* is_y_neg = ir_builder.AddBinaryOp(bool_id, SpvOpFOrdLessThan, - y->result_id(), f0_const_id); - Instruction* is_x_neg = ir_builder.AddBinaryOp(bool_id, SpvOpFOrdLessThan, - x->result_id(), f0_const_id); + Instruction* is_z_neg = ir_builder.AddBinaryOp( + bool_id, spv::Op::OpFOrdLessThan, z->result_id(), f0_const_id); + Instruction* is_y_neg = ir_builder.AddBinaryOp( + bool_id, spv::Op::OpFOrdLessThan, y->result_id(), f0_const_id); + Instruction* is_x_neg = ir_builder.AddBinaryOp( + bool_id, spv::Op::OpFOrdLessThan, x->result_id(), f0_const_id); // Compute cubema Instruction* amax_x_y = ir_builder.AddNaryExtendedInstruction( @@ -628,19 +634,21 @@ bool ReplaceCubeFaceCoord(IRContext* ctx, Instruction* inst, Instruction* amax = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FMax, {az->result_id(), amax_x_y->result_id()}); - Instruction* cubema = ir_builder.AddBinaryOp(float_type_id, SpvOpFMul, + Instruction* cubema = ir_builder.AddBinaryOp(float_type_id, spv::Op::OpFMul, f2_const_id, amax->result_id()); // Do the comparisons needed for computing cubesc and cubetc. Instruction* is_z_max = - ir_builder.AddBinaryOp(bool_id, SpvOpFOrdGreaterThanEqual, + ir_builder.AddBinaryOp(bool_id, spv::Op::OpFOrdGreaterThanEqual, az->result_id(), amax_x_y->result_id()); - Instruction* not_is_z_max = - ir_builder.AddUnaryOp(bool_id, SpvOpLogicalNot, is_z_max->result_id()); - Instruction* y_gr_x = ir_builder.AddBinaryOp( - bool_id, SpvOpFOrdGreaterThanEqual, ay->result_id(), ax->result_id()); - Instruction* is_y_max = ir_builder.AddBinaryOp( - bool_id, SpvOpLogicalAnd, not_is_z_max->result_id(), y_gr_x->result_id()); + Instruction* not_is_z_max = ir_builder.AddUnaryOp( + bool_id, spv::Op::OpLogicalNot, is_z_max->result_id()); + Instruction* y_gr_x = + ir_builder.AddBinaryOp(bool_id, spv::Op::OpFOrdGreaterThanEqual, + ay->result_id(), ax->result_id()); + Instruction* is_y_max = + ir_builder.AddBinaryOp(bool_id, spv::Op::OpLogicalAnd, + not_is_z_max->result_id(), y_gr_x->result_id()); // Select the correct value for cubesc. Instruction* cubesc_case_1 = ir_builder.AddSelect( @@ -667,10 +675,10 @@ bool ReplaceCubeFaceCoord(IRContext* ctx, Instruction* inst, Instruction* denom = ir_builder.AddCompositeConstruct( v2_float_type_id, {cubema->result_id(), cubema->result_id()}); Instruction* div = ir_builder.AddBinaryOp( - v2_float_type_id, SpvOpFDiv, cube->result_id(), denom->result_id()); + v2_float_type_id, spv::Op::OpFDiv, cube->result_id(), denom->result_id()); // Get the final result by adding 0.5 to |div|. - inst->SetOpcode(SpvOpFAdd); + inst->SetOpcode(spv::Op::OpFAdd); Instruction::OperandList new_operands; new_operands.push_back({SPV_OPERAND_TYPE_ID, {div->result_id()}}); new_operands.push_back({SPV_OPERAND_TYPE_ID, {vec_const_id}}); @@ -752,22 +760,23 @@ bool ReplaceCubeFaceIndex(IRContext* ctx, Instruction* inst, float_type_id, glsl405_ext_inst_id, GLSLstd450FAbs, {z->result_id()}); // Find which values are negative. Used in later computations. - Instruction* is_z_neg = ir_builder.AddBinaryOp(bool_id, SpvOpFOrdLessThan, - z->result_id(), f0_const_id); - Instruction* is_y_neg = ir_builder.AddBinaryOp(bool_id, SpvOpFOrdLessThan, - y->result_id(), f0_const_id); - Instruction* is_x_neg = ir_builder.AddBinaryOp(bool_id, SpvOpFOrdLessThan, - x->result_id(), f0_const_id); + Instruction* is_z_neg = ir_builder.AddBinaryOp( + bool_id, spv::Op::OpFOrdLessThan, z->result_id(), f0_const_id); + Instruction* is_y_neg = ir_builder.AddBinaryOp( + bool_id, spv::Op::OpFOrdLessThan, y->result_id(), f0_const_id); + Instruction* is_x_neg = ir_builder.AddBinaryOp( + bool_id, spv::Op::OpFOrdLessThan, x->result_id(), f0_const_id); // Find the max value. Instruction* amax_x_y = ir_builder.AddNaryExtendedInstruction( float_type_id, glsl405_ext_inst_id, GLSLstd450FMax, {ax->result_id(), ay->result_id()}); Instruction* is_z_max = - ir_builder.AddBinaryOp(bool_id, SpvOpFOrdGreaterThanEqual, + ir_builder.AddBinaryOp(bool_id, spv::Op::OpFOrdGreaterThanEqual, az->result_id(), amax_x_y->result_id()); - Instruction* y_gr_x = ir_builder.AddBinaryOp( - bool_id, SpvOpFOrdGreaterThanEqual, ay->result_id(), ax->result_id()); + Instruction* y_gr_x = + ir_builder.AddBinaryOp(bool_id, spv::Op::OpFOrdGreaterThanEqual, + ay->result_id(), ax->result_id()); // Get the value for each case. Instruction* case_z = ir_builder.AddSelect( @@ -783,7 +792,7 @@ bool ReplaceCubeFaceIndex(IRContext* ctx, Instruction* inst, case_y->result_id(), case_x->result_id()); // Get the final result by adding 0.5 to |div|. - inst->SetOpcode(SpvOpSelect); + inst->SetOpcode(spv::Op::OpSelect); Instruction::OperandList new_operands; new_operands.push_back({SPV_OPERAND_TYPE_ID, {is_z_max->result_id()}}); new_operands.push_back({SPV_OPERAND_TYPE_ID, {case_z->result_id()}}); @@ -813,11 +822,12 @@ bool ReplaceTimeAMD(IRContext* ctx, Instruction* inst, ctx, inst, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); ctx->AddExtension("SPV_KHR_shader_clock"); - ctx->AddCapability(SpvCapabilityShaderClockKHR); + ctx->AddCapability(spv::Capability::ShaderClockKHR); - inst->SetOpcode(SpvOpReadClockKHR); + inst->SetOpcode(spv::Op::OpReadClockKHR); Instruction::OperandList args; - uint32_t subgroup_scope_id = ir_builder.GetUintConstantId(SpvScopeSubgroup); + uint32_t subgroup_scope_id = + ir_builder.GetUintConstantId(uint32_t(spv::Scope::Subgroup)); args.push_back({SPV_OPERAND_TYPE_ID, {subgroup_scope_id}}); inst->SetInOperands(std::move(args)); ctx->UpdateDefUse(inst); @@ -831,22 +841,22 @@ class AmdExtFoldingRules : public FoldingRules { protected: virtual void AddFoldingRules() override { - rules_[SpvOpGroupIAddNonUniformAMD].push_back( - ReplaceGroupNonuniformOperationOpCode); - rules_[SpvOpGroupFAddNonUniformAMD].push_back( - ReplaceGroupNonuniformOperationOpCode); - rules_[SpvOpGroupUMinNonUniformAMD].push_back( - ReplaceGroupNonuniformOperationOpCode); - rules_[SpvOpGroupSMinNonUniformAMD].push_back( - ReplaceGroupNonuniformOperationOpCode); - rules_[SpvOpGroupFMinNonUniformAMD].push_back( - ReplaceGroupNonuniformOperationOpCode); - rules_[SpvOpGroupUMaxNonUniformAMD].push_back( - ReplaceGroupNonuniformOperationOpCode); - rules_[SpvOpGroupSMaxNonUniformAMD].push_back( - ReplaceGroupNonuniformOperationOpCode); - rules_[SpvOpGroupFMaxNonUniformAMD].push_back( - ReplaceGroupNonuniformOperationOpCode); + rules_[spv::Op::OpGroupIAddNonUniformAMD].push_back( + ReplaceGroupNonuniformOperationOpCode); + rules_[spv::Op::OpGroupFAddNonUniformAMD].push_back( + ReplaceGroupNonuniformOperationOpCode); + rules_[spv::Op::OpGroupUMinNonUniformAMD].push_back( + ReplaceGroupNonuniformOperationOpCode); + rules_[spv::Op::OpGroupSMinNonUniformAMD].push_back( + ReplaceGroupNonuniformOperationOpCode); + rules_[spv::Op::OpGroupFMinNonUniformAMD].push_back( + ReplaceGroupNonuniformOperationOpCode); + rules_[spv::Op::OpGroupUMaxNonUniformAMD].push_back( + ReplaceGroupNonuniformOperationOpCode); + rules_[spv::Op::OpGroupSMaxNonUniformAMD].push_back( + ReplaceGroupNonuniformOperationOpCode); + rules_[spv::Op::OpGroupFMaxNonUniformAMD].push_back( + ReplaceGroupNonuniformOperationOpCode); uint32_t extension_id = context()->module()->GetExtInstImportId("SPV_AMD_shader_ballot"); @@ -934,7 +944,7 @@ Pass::Status AmdExtensionToKhrPass::Process() { std::vector to_be_killed; for (Instruction& inst : context()->module()->extensions()) { - if (inst.opcode() == SpvOpExtension) { + if (inst.opcode() == spv::Op::OpExtension) { if (ext_to_remove.count(inst.GetInOperand(0).AsString()) != 0) { to_be_killed.push_back(&inst); } @@ -942,7 +952,7 @@ Pass::Status AmdExtensionToKhrPass::Process() { } for (Instruction& inst : context()->ext_inst_imports()) { - if (inst.opcode() == SpvOpExtInstImport) { + if (inst.opcode() == spv::Op::OpExtInstImport) { if (ext_to_remove.count(inst.GetInOperand(0).AsString()) != 0) { to_be_killed.push_back(&inst); } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/analyze_live_input_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/analyze_live_input_pass.cpp new file mode 100644 index 00000000..529e6846 --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/analyze_live_input_pass.cpp @@ -0,0 +1,45 @@ +// Copyright (c) 2022 The Khronos Group Inc. +// Copyright (c) 2022 LunarG Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/opt/analyze_live_input_pass.h" + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +Pass::Status AnalyzeLiveInputPass::Process() { + // Current functionality assumes shader capability + if (!context()->get_feature_mgr()->HasCapability(spv::Capability::Shader)) + return Status::SuccessWithoutChange; + Pass::Status status = DoLiveInputAnalysis(); + return status; +} + +Pass::Status AnalyzeLiveInputPass::DoLiveInputAnalysis() { + // Current functionality only supports frag, tesc, tese or geom shaders. + // Report failure for any other stage. + auto stage = context()->GetStage(); + if (stage != spv::ExecutionModel::Fragment && + stage != spv::ExecutionModel::TessellationControl && + stage != spv::ExecutionModel::TessellationEvaluation && + stage != spv::ExecutionModel::Geometry) + return Status::Failure; + context()->get_liveness_mgr()->GetLiveness(live_locs_, live_builtins_); + return Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/analyze_live_input_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/analyze_live_input_pass.h new file mode 100644 index 00000000..ab292eff --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/analyze_live_input_pass.h @@ -0,0 +1,57 @@ +// Copyright (c) 2022 The Khronos Group Inc. +// Copyright (c) 2022 LunarG Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SOURCE_OPT_ANALYZE_LIVE_INPUT_H_ +#define SOURCE_OPT_ANALYZE_LIVE_INPUT_H_ + +#include + +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class AnalyzeLiveInputPass : public Pass { + public: + explicit AnalyzeLiveInputPass(std::unordered_set* live_locs, + std::unordered_set* live_builtins) + : live_locs_(live_locs), live_builtins_(live_builtins) {} + + const char* name() const override { return "analyze-live-input"; } + Status Process() override; + + // Return the mask of preserved Analyses. + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisCombinators | IRContext::kAnalysisCFG | + IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisNameMap | + IRContext::kAnalysisConstants | IRContext::kAnalysisTypes; + } + + private: + // Do live input analysis + Status DoLiveInputAnalysis(); + + std::unordered_set* live_locs_; + std::unordered_set* live_builtins_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_ANALYZE_LIVE_INPUT_H_ diff --git a/bgfx/3rdparty/spirv-tools/source/opt/basic_block.cpp b/bgfx/3rdparty/spirv-tools/source/opt/basic_block.cpp index e82a744a..a9fc8e2f 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/basic_block.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/basic_block.cpp @@ -16,20 +16,16 @@ #include -#include "source/opt/function.h" #include "source/opt/ir_context.h" -#include "source/opt/module.h" #include "source/opt/reflect.h" #include "source/util/make_unique.h" namespace spvtools { namespace opt { namespace { - -const uint32_t kLoopMergeContinueBlockIdInIdx = 1; -const uint32_t kLoopMergeMergeBlockIdInIdx = 0; -const uint32_t kSelectionMergeMergeBlockIdInIdx = 0; - +constexpr uint32_t kLoopMergeContinueBlockIdInIdx = 1; +constexpr uint32_t kLoopMergeMergeBlockIdInIdx = 0; +constexpr uint32_t kSelectionMergeMergeBlockIdInIdx = 0; } // namespace BasicBlock* BasicBlock::Clone(IRContext* context) const { @@ -58,7 +54,7 @@ const Instruction* BasicBlock::GetMergeInst() const { if (iter != cbegin()) { --iter; const auto opcode = iter->opcode(); - if (opcode == SpvOpLoopMerge || opcode == SpvOpSelectionMerge) { + if (opcode == spv::Op::OpLoopMerge || opcode == spv::Op::OpSelectionMerge) { result = &*iter; } } @@ -73,7 +69,7 @@ Instruction* BasicBlock::GetMergeInst() { if (iter != begin()) { --iter; const auto opcode = iter->opcode(); - if (opcode == SpvOpLoopMerge || opcode == SpvOpSelectionMerge) { + if (opcode == spv::Op::OpLoopMerge || opcode == spv::Op::OpSelectionMerge) { result = &*iter; } } @@ -82,7 +78,7 @@ Instruction* BasicBlock::GetMergeInst() { const Instruction* BasicBlock::GetLoopMergeInst() const { if (auto* merge = GetMergeInst()) { - if (merge->opcode() == SpvOpLoopMerge) { + if (merge->opcode() == spv::Op::OpLoopMerge) { return merge; } } @@ -91,7 +87,7 @@ const Instruction* BasicBlock::GetLoopMergeInst() const { Instruction* BasicBlock::GetLoopMergeInst() { if (auto* merge = GetMergeInst()) { - if (merge->opcode() == SpvOpLoopMerge) { + if (merge->opcode() == spv::Op::OpLoopMerge) { return merge; } } @@ -100,7 +96,7 @@ Instruction* BasicBlock::GetLoopMergeInst() { void BasicBlock::KillAllInsts(bool killLabel) { ForEachInst([killLabel](Instruction* ip) { - if (killLabel || ip->opcode() != SpvOpLabel) { + if (killLabel || ip->opcode() != spv::Op::OpLabel) { ip->context()->KillInst(ip); } }); @@ -118,10 +114,10 @@ bool BasicBlock::WhileEachSuccessorLabel( const std::function& f) const { const auto br = &insts_.back(); switch (br->opcode()) { - case SpvOpBranch: + case spv::Op::OpBranch: return f(br->GetOperand(0).words[0]); - case SpvOpBranchConditional: - case SpvOpSwitch: { + case spv::Op::OpBranchConditional: + case spv::Op::OpSwitch: { bool is_first = true; return br->WhileEachInId([&is_first, &f](const uint32_t* idp) { if (!is_first) return f(*idp); @@ -138,13 +134,13 @@ void BasicBlock::ForEachSuccessorLabel( const std::function& f) { auto br = &insts_.back(); switch (br->opcode()) { - case SpvOpBranch: { + case spv::Op::OpBranch: { uint32_t tmp_id = br->GetOperand(0).words[0]; f(&tmp_id); if (tmp_id != br->GetOperand(0).words[0]) br->SetOperand(0, {tmp_id}); } break; - case SpvOpBranchConditional: - case SpvOpSwitch: { + case spv::Op::OpBranchConditional: + case spv::Op::OpSwitch: { bool is_first = true; br->ForEachInId([&is_first, &f](uint32_t* idp) { if (!is_first) f(idp); @@ -171,7 +167,8 @@ void BasicBlock::ForMergeAndContinueLabel( --ii; if (ii == insts_.begin()) return; --ii; - if (ii->opcode() == SpvOpSelectionMerge || ii->opcode() == SpvOpLoopMerge) { + if (ii->opcode() == spv::Op::OpSelectionMerge || + ii->opcode() == spv::Op::OpLoopMerge) { ii->ForEachInId([&f](const uint32_t* idp) { f(*idp); }); } } @@ -182,9 +179,9 @@ uint32_t BasicBlock::MergeBlockIdIfAny() const { uint32_t mbid = 0; if (merge_ii != cbegin()) { --merge_ii; - if (merge_ii->opcode() == SpvOpLoopMerge) { + if (merge_ii->opcode() == spv::Op::OpLoopMerge) { mbid = merge_ii->GetSingleWordInOperand(kLoopMergeMergeBlockIdInIdx); - } else if (merge_ii->opcode() == SpvOpSelectionMerge) { + } else if (merge_ii->opcode() == spv::Op::OpSelectionMerge) { mbid = merge_ii->GetSingleWordInOperand(kSelectionMergeMergeBlockIdInIdx); } } @@ -204,7 +201,7 @@ uint32_t BasicBlock::ContinueBlockIdIfAny() const { uint32_t cbid = 0; if (merge_ii != cbegin()) { --merge_ii; - if (merge_ii->opcode() == SpvOpLoopMerge) { + if (merge_ii->opcode() == spv::Op::OpLoopMerge) { cbid = merge_ii->GetSingleWordInOperand(kLoopMergeContinueBlockIdInIdx); } } @@ -241,9 +238,9 @@ BasicBlock* BasicBlock::SplitBasicBlock(IRContext* context, uint32_t label_id, iterator iter) { assert(!insts_.empty()); - std::unique_ptr new_block_temp = - MakeUnique(MakeUnique( - context, SpvOpLabel, 0, label_id, std::initializer_list{})); + std::unique_ptr new_block_temp = MakeUnique( + MakeUnique(context, spv::Op::OpLabel, 0, label_id, + std::initializer_list{})); BasicBlock* new_block = new_block_temp.get(); function_->InsertBasicBlockAfter(std::move(new_block_temp), this); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/basic_block.h b/bgfx/3rdparty/spirv-tools/source/opt/basic_block.h index dd3b2e28..24d5fceb 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/basic_block.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/basic_block.h @@ -319,7 +319,7 @@ inline bool BasicBlock::WhileEachPhiInst( Instruction* inst = &insts_.front(); while (inst != nullptr) { Instruction* next_instruction = inst->NextNode(); - if (inst->opcode() != SpvOpPhi) break; + if (inst->opcode() != spv::Op::OpPhi) break; if (!inst->WhileEachInst(f, run_on_debug_line_insts)) return false; inst = next_instruction; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/block_merge_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/block_merge_pass.cpp index ef7f31fe..d6c33e52 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/block_merge_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/block_merge_pass.cpp @@ -16,11 +16,8 @@ #include "source/opt/block_merge_pass.h" -#include - #include "source/opt/block_merge_util.h" #include "source/opt/ir_context.h" -#include "source/opt/iterator.h" namespace spvtools { namespace opt { diff --git a/bgfx/3rdparty/spirv-tools/source/opt/block_merge_util.cpp b/bgfx/3rdparty/spirv-tools/source/opt/block_merge_util.cpp index 8ae8020a..fe23e36f 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/block_merge_util.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/block_merge_util.cpp @@ -20,7 +20,6 @@ namespace spvtools { namespace opt { namespace blockmergeutil { - namespace { // Returns true if |block| contains a merge instruction. @@ -34,14 +33,15 @@ bool IsHeader(IRContext* context, uint32_t id) { // Returns true if |id| is the merge target of a merge instruction. bool IsMerge(IRContext* context, uint32_t id) { - return !context->get_def_use_mgr()->WhileEachUse(id, [](Instruction* user, - uint32_t index) { - SpvOp op = user->opcode(); - if ((op == SpvOpLoopMerge || op == SpvOpSelectionMerge) && index == 0u) { - return false; - } - return true; - }); + return !context->get_def_use_mgr()->WhileEachUse( + id, [](Instruction* user, uint32_t index) { + spv::Op op = user->opcode(); + if ((op == spv::Op::OpLoopMerge || op == spv::Op::OpSelectionMerge) && + index == 0u) { + return false; + } + return true; + }); } // Returns true if |block| is the merge target of a merge instruction. @@ -53,8 +53,8 @@ bool IsMerge(IRContext* context, BasicBlock* block) { bool IsContinue(IRContext* context, uint32_t id) { return !context->get_def_use_mgr()->WhileEachUse( id, [](Instruction* user, uint32_t index) { - SpvOp op = user->opcode(); - if (op == SpvOpLoopMerge && index == 1u) { + spv::Op op = user->opcode(); + if (op == spv::Op::OpLoopMerge && index == 1u) { return false; } return true; @@ -82,7 +82,7 @@ bool CanMergeWithSuccessor(IRContext* context, BasicBlock* block) { auto ii = block->end(); --ii; Instruction* br = &*ii; - if (br->opcode() != SpvOpBranch) { + if (br->opcode() != spv::Op::OpBranch) { return false; } @@ -119,12 +119,33 @@ bool CanMergeWithSuccessor(IRContext* context, BasicBlock* block) { // The merge must be a loop merge because a selection merge cannot be // followed by an unconditional branch. BasicBlock* succ_block = context->get_instr_block(lab_id); - SpvOp succ_term_op = succ_block->terminator()->opcode(); - assert(merge_inst->opcode() == SpvOpLoopMerge); - if (succ_term_op != SpvOpBranch && succ_term_op != SpvOpBranchConditional) { + spv::Op succ_term_op = succ_block->terminator()->opcode(); + assert(merge_inst->opcode() == spv::Op::OpLoopMerge); + if (succ_term_op != spv::Op::OpBranch && + succ_term_op != spv::Op::OpBranchConditional) { return false; } } + + if (succ_is_merge || IsContinue(context, lab_id)) { + auto* struct_cfg = context->GetStructuredCFGAnalysis(); + auto switch_block_id = struct_cfg->ContainingSwitch(block->id()); + if (switch_block_id) { + auto switch_merge_id = struct_cfg->SwitchMergeBlock(switch_block_id); + const auto* switch_inst = + &*block->GetParent()->FindBlock(switch_block_id)->tail(); + for (uint32_t i = 1; i < switch_inst->NumInOperands(); i += 2) { + auto target_id = switch_inst->GetSingleWordInOperand(i); + if (target_id == block->id() && target_id != switch_merge_id) { + // Case constructs must be structurally dominated by the OpSwitch. + // Since the successor is the merge/continue for another construct, + // merging the blocks would break that requirement. + return false; + } + } + } + } + return true; } @@ -150,6 +171,11 @@ void MergeWithSuccessor(IRContext* context, Function* func, // sbi must follow bi in func's ordering. assert(sbi != func->end()); + if (sbi->tail()->opcode() == spv::Op::OpSwitch && + sbi->MergeBlockIdIfAny() != 0) { + context->InvalidateAnalyses(IRContext::Analysis::kAnalysisStructuredCFG); + } + // Update the inst-to-block mapping for the instructions in sbi. for (auto& inst : *sbi) { context->set_instr_block(&inst, &*bi); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/ccp_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/ccp_pass.cpp index 5f855027..46bfc907 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/ccp_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/ccp_pass.cpp @@ -24,19 +24,15 @@ #include "source/opt/fold.h" #include "source/opt/function.h" -#include "source/opt/module.h" #include "source/opt/propagator.h" namespace spvtools { namespace opt { - namespace { - // This SSA id is never defined nor referenced in the IR. It is a special ID // which represents varying values. When an ID is found to have a varying // value, its entry in the |values_| table maps to kVaryingSSAId. -const uint32_t kVaryingSSAId = std::numeric_limits::max(); - +constexpr uint32_t kVaryingSSAId = std::numeric_limits::max(); } // namespace bool CCPPass::IsVaryingValue(uint32_t id) const { return id == kVaryingSSAId; } @@ -136,7 +132,7 @@ SSAPropagator::PropStatus CCPPass::VisitAssignment(Instruction* instr) { // If this is a copy operation, and the RHS is a known constant, assign its // value to the LHS. - if (instr->opcode() == SpvOpCopyObject) { + if (instr->opcode() == spv::Op::OpCopyObject) { uint32_t rhs_id = instr->GetSingleWordInOperand(0); auto it = values_.find(rhs_id); if (it != values_.end()) { @@ -211,10 +207,10 @@ SSAPropagator::PropStatus CCPPass::VisitBranch(Instruction* instr, *dest_bb = nullptr; uint32_t dest_label = 0; - if (instr->opcode() == SpvOpBranch) { + if (instr->opcode() == spv::Op::OpBranch) { // An unconditional jump always goes to its unique destination. dest_label = instr->GetSingleWordInOperand(0); - } else if (instr->opcode() == SpvOpBranchConditional) { + } else if (instr->opcode() == spv::Op::OpBranchConditional) { // For a conditional branch, determine whether the predicate selector has a // known value in |values_|. If it does, set the destination block // according to the selector's boolean value. @@ -243,7 +239,7 @@ SSAPropagator::PropStatus CCPPass::VisitBranch(Instruction* instr, // For an OpSwitch, extract the value taken by the switch selector and check // which of the target literals it matches. The branch associated with that // literal is the taken branch. - assert(instr->opcode() == SpvOpSwitch); + assert(instr->opcode() == spv::Op::OpSwitch); if (instr->GetOperand(0).words.size() != 1) { // If the selector is wider than 32-bits, return varying. TODO(dnovillo): // Add support for wider constants. @@ -290,7 +286,7 @@ SSAPropagator::PropStatus CCPPass::VisitBranch(Instruction* instr, SSAPropagator::PropStatus CCPPass::VisitInstruction(Instruction* instr, BasicBlock** dest_bb) { *dest_bb = nullptr; - if (instr->opcode() == SpvOpPhi) { + if (instr->opcode() == spv::Op::OpPhi) { return VisitPhi(instr); } else if (instr->IsBranch()) { return VisitBranch(instr, dest_bb); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/cfg.cpp b/bgfx/3rdparty/spirv-tools/source/opt/cfg.cpp index a0248d54..4c4bb256 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/cfg.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/cfg.cpp @@ -29,16 +29,16 @@ namespace { using cbb_ptr = const opt::BasicBlock*; // Universal Limit of ResultID + 1 -const int kMaxResultId = 0x400000; +constexpr int kMaxResultId = 0x400000; } // namespace CFG::CFG(Module* module) : module_(module), pseudo_entry_block_(std::unique_ptr( - new Instruction(module->context(), SpvOpLabel, 0, 0, {}))), + new Instruction(module->context(), spv::Op::OpLabel, 0, 0, {}))), pseudo_exit_block_(std::unique_ptr(new Instruction( - module->context(), SpvOpLabel, 0, kMaxResultId, {}))) { + module->context(), spv::Op::OpLabel, 0, kMaxResultId, {}))) { for (auto& fn : *module) { for (auto& blk : fn) { RegisterBlock(&blk); @@ -81,7 +81,7 @@ void CFG::ComputeStructuredOrder(Function* func, BasicBlock* root, BasicBlock* end, std::list* order) { assert(module_->context()->get_feature_mgr()->HasCapability( - SpvCapabilityShader) && + spv::Capability::Shader) && "This only works on structured control flow"); // Compute structured successors and do DFS. @@ -228,7 +228,7 @@ BasicBlock* CFG::SplitLoopHeader(BasicBlock* bb) { // Create the new header bb basic bb. // Leave the phi instructions behind. auto iter = bb->begin(); - while (iter->opcode() == SpvOpPhi) { + while (iter->opcode() == spv::Op::OpPhi) { ++iter; } @@ -304,7 +304,7 @@ BasicBlock* CFG::SplitLoopHeader(BasicBlock* bb) { context, bb, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); bb->AddInstruction( - MakeUnique(context, SpvOpBranch, 0, 0, + MakeUnique(context, spv::Op::OpBranch, 0, 0, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {new_header->id()}}})); context->AnalyzeUses(bb->terminator()); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/cfg_cleanup_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/cfg_cleanup_pass.cpp index 6d48637a..26fed89f 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/cfg_cleanup_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/cfg_cleanup_pass.cpp @@ -16,13 +16,9 @@ // constructs (e.g., unreachable basic blocks, empty control flow structures, // etc) -#include -#include - #include "source/opt/cfg_cleanup_pass.h" #include "source/opt/function.h" -#include "source/opt/module.h" namespace spvtools { namespace opt { diff --git a/bgfx/3rdparty/spirv-tools/source/opt/code_sink.cpp b/bgfx/3rdparty/spirv-tools/source/opt/code_sink.cpp index cd777974..90231791 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/code_sink.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/code_sink.cpp @@ -14,11 +14,9 @@ #include "code_sink.h" -#include #include #include "source/opt/instruction.h" -#include "source/opt/ir_builder.h" #include "source/opt/ir_context.h" #include "source/util/bit_vector.h" @@ -50,7 +48,8 @@ bool CodeSinkingPass::SinkInstructionsInBB(BasicBlock* bb) { } bool CodeSinkingPass::SinkInstruction(Instruction* inst) { - if (inst->opcode() != SpvOpLoad && inst->opcode() != SpvOpAccessChain) { + if (inst->opcode() != spv::Op::OpLoad && + inst->opcode() != spv::Op::OpAccessChain) { return false; } @@ -60,7 +59,7 @@ bool CodeSinkingPass::SinkInstruction(Instruction* inst) { if (BasicBlock* target_bb = FindNewBasicBlockFor(inst)) { Instruction* pos = &*target_bb->begin(); - while (pos->opcode() == SpvOpPhi) { + while (pos->opcode() == spv::Op::OpPhi) { pos = pos->NextNode(); } @@ -79,7 +78,7 @@ BasicBlock* CodeSinkingPass::FindNewBasicBlockFor(Instruction* inst) { std::unordered_set bbs_with_uses; get_def_use_mgr()->ForEachUse( inst, [&bbs_with_uses, this](Instruction* use, uint32_t idx) { - if (use->opcode() != SpvOpPhi) { + if (use->opcode() != spv::Op::OpPhi) { BasicBlock* use_bb = context()->get_instr_block(use); if (use_bb) { bbs_with_uses.insert(use_bb->id()); @@ -99,7 +98,7 @@ BasicBlock* CodeSinkingPass::FindNewBasicBlockFor(Instruction* inst) { // of succ_bb, then |inst| can be moved to succ_bb. If succ_bb, has move // then one predecessor, then moving |inst| into succ_bb could cause it to // be executed more often, so the search has to stop. - if (bb->terminator()->opcode() == SpvOpBranch) { + if (bb->terminator()->opcode() == spv::Op::OpBranch) { uint32_t succ_bb_id = bb->terminator()->GetSingleWordInOperand(0); if (cfg()->preds(succ_bb_id).size() == 1) { bb = context()->get_instr_block(succ_bb_id); @@ -113,7 +112,8 @@ BasicBlock* CodeSinkingPass::FindNewBasicBlockFor(Instruction* inst) { // instruction or an OpLoopMerge, then it is a break or continue. We could // figure it out, but not worth doing it now. Instruction* merge_inst = bb->GetMergeInst(); - if (merge_inst == nullptr || merge_inst->opcode() != SpvOpSelectionMerge) { + if (merge_inst == nullptr || + merge_inst->opcode() != spv::Op::OpSelectionMerge) { break; } @@ -173,7 +173,7 @@ bool CodeSinkingPass::ReferencesMutableMemory(Instruction* inst) { } Instruction* base_ptr = inst->GetBaseAddress(); - if (base_ptr->opcode() != SpvOpVariable) { + if (base_ptr->opcode() != spv::Op::OpVariable) { return true; } @@ -185,7 +185,8 @@ bool CodeSinkingPass::ReferencesMutableMemory(Instruction* inst) { return true; } - if (base_ptr->GetSingleWordInOperand(0) != SpvStorageClassUniform) { + if (spv::StorageClass(base_ptr->GetSingleWordInOperand(0)) != + spv::StorageClass::Uniform) { return true; } @@ -200,41 +201,41 @@ bool CodeSinkingPass::HasUniformMemorySync() { bool has_sync = false; get_module()->ForEachInst([this, &has_sync](Instruction* inst) { switch (inst->opcode()) { - case SpvOpMemoryBarrier: { + case spv::Op::OpMemoryBarrier: { uint32_t mem_semantics_id = inst->GetSingleWordInOperand(1); if (IsSyncOnUniform(mem_semantics_id)) { has_sync = true; } break; } - case SpvOpControlBarrier: - case SpvOpAtomicLoad: - case SpvOpAtomicStore: - case SpvOpAtomicExchange: - case SpvOpAtomicIIncrement: - case SpvOpAtomicIDecrement: - case SpvOpAtomicIAdd: - case SpvOpAtomicFAddEXT: - case SpvOpAtomicISub: - case SpvOpAtomicSMin: - case SpvOpAtomicUMin: - case SpvOpAtomicFMinEXT: - case SpvOpAtomicSMax: - case SpvOpAtomicUMax: - case SpvOpAtomicFMaxEXT: - case SpvOpAtomicAnd: - case SpvOpAtomicOr: - case SpvOpAtomicXor: - case SpvOpAtomicFlagTestAndSet: - case SpvOpAtomicFlagClear: { + case spv::Op::OpControlBarrier: + case spv::Op::OpAtomicLoad: + case spv::Op::OpAtomicStore: + case spv::Op::OpAtomicExchange: + case spv::Op::OpAtomicIIncrement: + case spv::Op::OpAtomicIDecrement: + case spv::Op::OpAtomicIAdd: + case spv::Op::OpAtomicFAddEXT: + case spv::Op::OpAtomicISub: + case spv::Op::OpAtomicSMin: + case spv::Op::OpAtomicUMin: + case spv::Op::OpAtomicFMinEXT: + case spv::Op::OpAtomicSMax: + case spv::Op::OpAtomicUMax: + case spv::Op::OpAtomicFMaxEXT: + case spv::Op::OpAtomicAnd: + case spv::Op::OpAtomicOr: + case spv::Op::OpAtomicXor: + case spv::Op::OpAtomicFlagTestAndSet: + case spv::Op::OpAtomicFlagClear: { uint32_t mem_semantics_id = inst->GetSingleWordInOperand(2); if (IsSyncOnUniform(mem_semantics_id)) { has_sync = true; } break; } - case SpvOpAtomicCompareExchange: - case SpvOpAtomicCompareExchangeWeak: + case spv::Op::OpAtomicCompareExchange: + case spv::Op::OpAtomicCompareExchangeWeak: if (IsSyncOnUniform(inst->GetSingleWordInOperand(2)) || IsSyncOnUniform(inst->GetSingleWordInOperand(3))) { has_sync = true; @@ -259,28 +260,30 @@ bool CodeSinkingPass::IsSyncOnUniform(uint32_t mem_semantics_id) const { // If it does not affect uniform memory, then it is does not apply to uniform // memory. - if ((mem_semantics_int & SpvMemorySemanticsUniformMemoryMask) == 0) { + if ((mem_semantics_int & uint32_t(spv::MemorySemanticsMask::UniformMemory)) == + 0) { return false; } // Check if there is an acquire or release. If so not, this it does not add // any memory constraints. - return (mem_semantics_int & (SpvMemorySemanticsAcquireMask | - SpvMemorySemanticsAcquireReleaseMask | - SpvMemorySemanticsReleaseMask)) != 0; + return (mem_semantics_int & + uint32_t(spv::MemorySemanticsMask::Acquire | + spv::MemorySemanticsMask::AcquireRelease | + spv::MemorySemanticsMask::Release)) != 0; } bool CodeSinkingPass::HasPossibleStore(Instruction* var_inst) { - assert(var_inst->opcode() == SpvOpVariable || - var_inst->opcode() == SpvOpAccessChain || - var_inst->opcode() == SpvOpPtrAccessChain); + assert(var_inst->opcode() == spv::Op::OpVariable || + var_inst->opcode() == spv::Op::OpAccessChain || + var_inst->opcode() == spv::Op::OpPtrAccessChain); return get_def_use_mgr()->WhileEachUser(var_inst, [this](Instruction* use) { switch (use->opcode()) { - case SpvOpStore: + case spv::Op::OpStore: return true; - case SpvOpAccessChain: - case SpvOpPtrAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpPtrAccessChain: return HasPossibleStore(use); default: return false; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.cpp b/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.cpp index 142897a2..99ec7962 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.cpp @@ -44,10 +44,10 @@ bool CombineAccessChains::ProcessFunction(Function& function) { function.entry().get(), [&modified, this](BasicBlock* block) { block->ForEachInst([&modified, this](Instruction* inst) { switch (inst->opcode()) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: modified |= CombineAccessChain(inst); break; default: @@ -76,10 +76,10 @@ uint32_t CombineAccessChains::GetConstantValue( uint32_t CombineAccessChains::GetArrayStride(const Instruction* inst) { uint32_t array_stride = 0; context()->get_decoration_mgr()->WhileEachDecoration( - inst->type_id(), SpvDecorationArrayStride, + inst->type_id(), uint32_t(spv::Decoration::ArrayStride), [&array_stride](const Instruction& decoration) { - assert(decoration.opcode() != SpvOpDecorateId); - if (decoration.opcode() == SpvOpDecorate) { + assert(decoration.opcode() != spv::Op::OpDecorateId); + if (decoration.opcode() == spv::Op::OpDecorate) { array_stride = decoration.GetSingleWordInOperand(1); } else { array_stride = decoration.GetSingleWordInOperand(2); @@ -200,18 +200,18 @@ bool CombineAccessChains::CreateNewInputOperands( } bool CombineAccessChains::CombineAccessChain(Instruction* inst) { - assert((inst->opcode() == SpvOpPtrAccessChain || - inst->opcode() == SpvOpAccessChain || - inst->opcode() == SpvOpInBoundsAccessChain || - inst->opcode() == SpvOpInBoundsPtrAccessChain) && + assert((inst->opcode() == spv::Op::OpPtrAccessChain || + inst->opcode() == spv::Op::OpAccessChain || + inst->opcode() == spv::Op::OpInBoundsAccessChain || + inst->opcode() == spv::Op::OpInBoundsPtrAccessChain) && "Wrong opcode. Expected an access chain."); Instruction* ptr_input = context()->get_def_use_mgr()->GetDef(inst->GetSingleWordInOperand(0)); - if (ptr_input->opcode() != SpvOpAccessChain && - ptr_input->opcode() != SpvOpInBoundsAccessChain && - ptr_input->opcode() != SpvOpPtrAccessChain && - ptr_input->opcode() != SpvOpInBoundsPtrAccessChain) { + if (ptr_input->opcode() != spv::Op::OpAccessChain && + ptr_input->opcode() != spv::Op::OpInBoundsAccessChain && + ptr_input->opcode() != spv::Op::OpPtrAccessChain && + ptr_input->opcode() != spv::Op::OpInBoundsPtrAccessChain) { return false; } @@ -246,7 +246,7 @@ bool CombineAccessChains::CombineAccessChain(Instruction* inst) { } else if (inst->NumInOperands() == 1) { // |inst| is a no-op, change it to a copy. Instruction simplification will // clean it up. - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); } else { std::vector new_operands; if (!CreateNewInputOperands(ptr_input, inst, &new_operands)) return false; @@ -259,23 +259,25 @@ bool CombineAccessChains::CombineAccessChain(Instruction* inst) { return true; } -SpvOp CombineAccessChains::UpdateOpcode(SpvOp base_opcode, SpvOp input_opcode) { - auto IsInBounds = [](SpvOp opcode) { - return opcode == SpvOpInBoundsPtrAccessChain || - opcode == SpvOpInBoundsAccessChain; +spv::Op CombineAccessChains::UpdateOpcode(spv::Op base_opcode, + spv::Op input_opcode) { + auto IsInBounds = [](spv::Op opcode) { + return opcode == spv::Op::OpInBoundsPtrAccessChain || + opcode == spv::Op::OpInBoundsAccessChain; }; - if (input_opcode == SpvOpInBoundsPtrAccessChain) { - if (!IsInBounds(base_opcode)) return SpvOpPtrAccessChain; - } else if (input_opcode == SpvOpInBoundsAccessChain) { - if (!IsInBounds(base_opcode)) return SpvOpAccessChain; + if (input_opcode == spv::Op::OpInBoundsPtrAccessChain) { + if (!IsInBounds(base_opcode)) return spv::Op::OpPtrAccessChain; + } else if (input_opcode == spv::Op::OpInBoundsAccessChain) { + if (!IsInBounds(base_opcode)) return spv::Op::OpAccessChain; } return input_opcode; } -bool CombineAccessChains::IsPtrAccessChain(SpvOp opcode) { - return opcode == SpvOpPtrAccessChain || opcode == SpvOpInBoundsPtrAccessChain; +bool CombineAccessChains::IsPtrAccessChain(spv::Op opcode) { + return opcode == spv::Op::OpPtrAccessChain || + opcode == spv::Op::OpInBoundsPtrAccessChain; } bool CombineAccessChains::Has64BitIndices(Instruction* inst) { diff --git a/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.h b/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.h index 531209ec..32ee50d3 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.h @@ -68,10 +68,10 @@ class CombineAccessChains : public Pass { std::vector* new_operands); // Returns the opcode to use for the combined access chain. - SpvOp UpdateOpcode(SpvOp base_opcode, SpvOp input_opcode); + spv::Op UpdateOpcode(spv::Op base_opcode, spv::Op input_opcode); // Returns true if |opcode| is a pointer access chain. - bool IsPtrAccessChain(SpvOp opcode); + bool IsPtrAccessChain(spv::Op opcode); // Returns true if |inst| (an access chain) has 64-bit indices. bool Has64BitIndices(Instruction* inst); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.cpp b/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.cpp index 0ad755c9..e676974c 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.cpp @@ -19,8 +19,7 @@ namespace spvtools { namespace opt { namespace { - -const uint32_t kExtractCompositeIdInIdx = 0; +constexpr uint32_t kExtractCompositeIdInIdx = 0; // Returns a constants with the value NaN of the given type. Only works for // 32-bit and 64-bit float point types. Returns |nullptr| if an error occurs. @@ -89,6 +88,22 @@ const analysis::Constant* NegateFPConst(const analysis::Type* result_type, return nullptr; } +// Returns a constants with the value |-val| of the given type. +const analysis::Constant* NegateIntConst(const analysis::Type* result_type, + const analysis::Constant* val, + analysis::ConstantManager* const_mgr) { + const analysis::Integer* int_type = result_type->AsInteger(); + assert(int_type != nullptr); + + if (val->AsNullConstant()) { + return val; + } + + uint64_t new_value = static_cast(-val->GetSignExtendedValue()); + return const_mgr->GetIntConst(new_value, int_type->width(), + int_type->IsSigned()); +} + // Folds an OpcompositeExtract where input is a composite constant. ConstantFoldingRule FoldExtractWithConstants() { return [](IRContext* context, Instruction* inst, @@ -120,11 +135,102 @@ ConstantFoldingRule FoldExtractWithConstants() { }; } +// Folds an OpcompositeInsert where input is a composite constant. +ConstantFoldingRule FoldInsertWithConstants() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Constant* object = constants[0]; + const analysis::Constant* composite = constants[1]; + if (object == nullptr || composite == nullptr) { + return nullptr; + } + + // If there is more than 1 index, then each additional constant used by the + // index will need to be recreated to use the inserted object. + std::vector chain; + std::vector components; + const analysis::Type* type = nullptr; + const uint32_t final_index = (inst->NumInOperands() - 1); + + // Work down hierarchy of all indexes + for (uint32_t i = 2; i < inst->NumInOperands(); ++i) { + type = composite->type(); + + if (composite->AsNullConstant()) { + // Make new composite so it can be inserted in the index with the + // non-null value + if (const auto new_composite = + const_mgr->GetNullCompositeConstant(type)) { + // Keep track of any indexes along the way to last index + if (i != final_index) { + chain.push_back(new_composite); + } + components = new_composite->AsCompositeConstant()->GetComponents(); + } else { + // Unsupported input type (such as structs) + return nullptr; + } + } else { + // Keep track of any indexes along the way to last index + if (i != final_index) { + chain.push_back(composite); + } + components = composite->AsCompositeConstant()->GetComponents(); + } + const uint32_t index = inst->GetSingleWordInOperand(i); + composite = components[index]; + } + + // Final index in hierarchy is inserted with new object. + const uint32_t final_operand = inst->GetSingleWordInOperand(final_index); + std::vector ids; + for (size_t i = 0; i < components.size(); i++) { + const analysis::Constant* constant = + (i == final_operand) ? object : components[i]; + Instruction* member_inst = const_mgr->GetDefiningInstruction(constant); + ids.push_back(member_inst->result_id()); + } + const analysis::Constant* new_constant = const_mgr->GetConstant(type, ids); + + // Work backwards up the chain and replace each index with new constant. + for (size_t i = chain.size(); i > 0; i--) { + // Need to insert any previous instruction into the module first. + // Can't just insert in types_values_begin() because it will move above + // where the types are declared. + // Can't compare with location of inst because not all new added + // instructions are added to types_values_ + auto iter = context->types_values_end(); + Module::inst_iterator* pos = &iter; + const_mgr->BuildInstructionAndAddToModule(new_constant, pos); + + composite = chain[i - 1]; + components = composite->AsCompositeConstant()->GetComponents(); + type = composite->type(); + ids.clear(); + for (size_t k = 0; k < components.size(); k++) { + const uint32_t index = + inst->GetSingleWordInOperand(1 + static_cast(i)); + const analysis::Constant* constant = + (k == index) ? new_constant : components[k]; + const uint32_t constant_id = + const_mgr->FindDeclaredConstant(constant, 0); + ids.push_back(constant_id); + } + new_constant = const_mgr->GetConstant(type, ids); + } + + // If multiple constants were created, only need to return the top index. + return new_constant; + }; +} + ConstantFoldingRule FoldVectorShuffleWithConstants() { return [](IRContext* context, Instruction* inst, const std::vector& constants) -> const analysis::Constant* { - assert(inst->opcode() == SpvOpVectorShuffle); + assert(inst->opcode() == spv::Op::OpVectorShuffle); const analysis::Constant* c1 = constants[0]; const analysis::Constant* c2 = constants[1]; if (c1 == nullptr || c2 == nullptr) { @@ -180,7 +286,7 @@ ConstantFoldingRule FoldVectorTimesScalar() { return [](IRContext* context, Instruction* inst, const std::vector& constants) -> const analysis::Constant* { - assert(inst->opcode() == SpvOpVectorTimesScalar); + assert(inst->opcode() == spv::Op::OpVectorTimesScalar); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); analysis::TypeManager* type_mgr = context->get_type_mgr(); @@ -251,11 +357,74 @@ ConstantFoldingRule FoldVectorTimesScalar() { }; } +// Returns to the constant that results from tranposing |matrix|. The result +// will have type |result_type|, and |matrix| must exist in |context|. The +// result constant will also exist in |context|. +const analysis::Constant* TransposeMatrix(const analysis::Constant* matrix, + analysis::Matrix* result_type, + IRContext* context) { + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + if (matrix->AsNullConstant() != nullptr) { + return const_mgr->GetNullCompositeConstant(result_type); + } + + const auto& columns = matrix->AsMatrixConstant()->GetComponents(); + uint32_t number_of_rows = columns[0]->type()->AsVector()->element_count(); + + // Collect the ids of the elements in their new positions. + std::vector> result_elements(number_of_rows); + for (const analysis::Constant* column : columns) { + if (column->AsNullConstant()) { + column = const_mgr->GetNullCompositeConstant(column->type()); + } + const auto& column_components = column->AsVectorConstant()->GetComponents(); + + for (uint32_t row = 0; row < number_of_rows; ++row) { + result_elements[row].push_back( + const_mgr->GetDefiningInstruction(column_components[row]) + ->result_id()); + } + } + + // Create the constant for each row in the result, and collect the ids. + std::vector result_columns(number_of_rows); + for (uint32_t col = 0; col < number_of_rows; ++col) { + auto* element = const_mgr->GetConstant(result_type->element_type(), + result_elements[col]); + result_columns[col] = + const_mgr->GetDefiningInstruction(element)->result_id(); + } + + // Create the matrix constant from the row ids, and return it. + return const_mgr->GetConstant(result_type, result_columns); +} + +const analysis::Constant* FoldTranspose( + IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == spv::Op::OpTranspose); + + analysis::TypeManager* type_mgr = context->get_type_mgr(); + if (!inst->IsFloatingPointFoldingAllowed()) { + if (HasFloatingPoint(type_mgr->GetType(inst->type_id()))) { + return nullptr; + } + } + + const analysis::Constant* matrix = constants[0]; + if (matrix == nullptr) { + return nullptr; + } + + auto* result_type = type_mgr->GetType(inst->type_id()); + return TransposeMatrix(matrix, result_type->AsMatrix(), context); +} + ConstantFoldingRule FoldVectorTimesMatrix() { return [](IRContext* context, Instruction* inst, const std::vector& constants) -> const analysis::Constant* { - assert(inst->opcode() == SpvOpVectorTimesMatrix); + assert(inst->opcode() == spv::Op::OpVectorTimesMatrix); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); analysis::TypeManager* type_mgr = context->get_type_mgr(); @@ -286,13 +455,7 @@ ConstantFoldingRule FoldVectorTimesMatrix() { assert(c1->type()->AsVector()->element_type() == element_type && c2->type()->AsMatrix()->element_type() == vector_type); - // Get a float vector that is the result of vector-times-matrix. - std::vector c1_components = - c1->GetVectorComponents(const_mgr); - std::vector c2_components = - c2->AsMatrixConstant()->GetComponents(); uint32_t resultVectorSize = result_type->AsVector()->element_count(); - std::vector ids; if ((c1 && c1->IsZero()) || (c2 && c2->IsZero())) { @@ -305,15 +468,23 @@ ConstantFoldingRule FoldVectorTimesMatrix() { return const_mgr->GetConstant(vector_type, ids); } + // Get a float vector that is the result of vector-times-matrix. + std::vector c1_components = + c1->GetVectorComponents(const_mgr); + std::vector c2_components = + c2->AsMatrixConstant()->GetComponents(); + if (float_type->width() == 32) { for (uint32_t i = 0; i < resultVectorSize; ++i) { float result_scalar = 0.0f; - const analysis::VectorConstant* c2_vec = - c2_components[i]->AsVectorConstant(); - for (uint32_t j = 0; j < c2_vec->GetComponents().size(); ++j) { - float c1_scalar = c1_components[j]->GetFloat(); - float c2_scalar = c2_vec->GetComponents()[j]->GetFloat(); - result_scalar += c1_scalar * c2_scalar; + if (!c2_components[i]->AsNullConstant()) { + const analysis::VectorConstant* c2_vec = + c2_components[i]->AsVectorConstant(); + for (uint32_t j = 0; j < c2_vec->GetComponents().size(); ++j) { + float c1_scalar = c1_components[j]->GetFloat(); + float c2_scalar = c2_vec->GetComponents()[j]->GetFloat(); + result_scalar += c1_scalar * c2_scalar; + } } utils::FloatProxy result(result_scalar); std::vector words = result.GetWords(); @@ -325,12 +496,14 @@ ConstantFoldingRule FoldVectorTimesMatrix() { } else if (float_type->width() == 64) { for (uint32_t i = 0; i < c2_components.size(); ++i) { double result_scalar = 0.0; - const analysis::VectorConstant* c2_vec = - c2_components[i]->AsVectorConstant(); - for (uint32_t j = 0; j < c2_vec->GetComponents().size(); ++j) { - double c1_scalar = c1_components[j]->GetDouble(); - double c2_scalar = c2_vec->GetComponents()[j]->GetDouble(); - result_scalar += c1_scalar * c2_scalar; + if (!c2_components[i]->AsNullConstant()) { + const analysis::VectorConstant* c2_vec = + c2_components[i]->AsVectorConstant(); + for (uint32_t j = 0; j < c2_vec->GetComponents().size(); ++j) { + double c1_scalar = c1_components[j]->GetDouble(); + double c2_scalar = c2_vec->GetComponents()[j]->GetDouble(); + result_scalar += c1_scalar * c2_scalar; + } } utils::FloatProxy result(result_scalar); std::vector words = result.GetWords(); @@ -348,7 +521,7 @@ ConstantFoldingRule FoldMatrixTimesVector() { return [](IRContext* context, Instruction* inst, const std::vector& constants) -> const analysis::Constant* { - assert(inst->opcode() == SpvOpMatrixTimesVector); + assert(inst->opcode() == spv::Op::OpMatrixTimesVector); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); analysis::TypeManager* type_mgr = context->get_type_mgr(); @@ -378,13 +551,7 @@ ConstantFoldingRule FoldMatrixTimesVector() { assert(c1->type()->AsMatrix()->element_type() == vector_type); assert(c2->type()->AsVector()->element_type() == element_type); - // Get a float vector that is the result of matrix-times-vector. - std::vector c1_components = - c1->AsMatrixConstant()->GetComponents(); - std::vector c2_components = - c2->GetVectorComponents(const_mgr); uint32_t resultVectorSize = result_type->AsVector()->element_count(); - std::vector ids; if ((c1 && c1->IsZero()) || (c2 && c2->IsZero())) { @@ -397,16 +564,24 @@ ConstantFoldingRule FoldMatrixTimesVector() { return const_mgr->GetConstant(vector_type, ids); } + // Get a float vector that is the result of matrix-times-vector. + std::vector c1_components = + c1->AsMatrixConstant()->GetComponents(); + std::vector c2_components = + c2->GetVectorComponents(const_mgr); + if (float_type->width() == 32) { for (uint32_t i = 0; i < resultVectorSize; ++i) { float result_scalar = 0.0f; for (uint32_t j = 0; j < c1_components.size(); ++j) { - float c1_scalar = c1_components[j] - ->AsVectorConstant() - ->GetComponents()[i] - ->GetFloat(); - float c2_scalar = c2_components[j]->GetFloat(); - result_scalar += c1_scalar * c2_scalar; + if (!c1_components[j]->AsNullConstant()) { + float c1_scalar = c1_components[j] + ->AsVectorConstant() + ->GetComponents()[i] + ->GetFloat(); + float c2_scalar = c2_components[j]->GetFloat(); + result_scalar += c1_scalar * c2_scalar; + } } utils::FloatProxy result(result_scalar); std::vector words = result.GetWords(); @@ -419,12 +594,14 @@ ConstantFoldingRule FoldMatrixTimesVector() { for (uint32_t i = 0; i < resultVectorSize; ++i) { double result_scalar = 0.0; for (uint32_t j = 0; j < c1_components.size(); ++j) { - double c1_scalar = c1_components[j] - ->AsVectorConstant() - ->GetComponents()[i] - ->GetDouble(); - double c2_scalar = c2_components[j]->GetDouble(); - result_scalar += c1_scalar * c2_scalar; + if (!c1_components[j]->AsNullConstant()) { + double c1_scalar = c1_components[j] + ->AsVectorConstant() + ->GetComponents()[i] + ->GetDouble(); + double c2_scalar = c2_components[j]->GetDouble(); + result_scalar += c1_scalar * c2_scalar; + } } utils::FloatProxy result(result_scalar); std::vector words = result.GetWords(); @@ -458,9 +635,9 @@ ConstantFoldingRule FoldCompositeWithConstants() { } uint32_t component_type_id = 0; - if (type_inst->opcode() == SpvOpTypeStruct) { + if (type_inst->opcode() == spv::Op::OpTypeStruct) { component_type_id = type_inst->GetSingleWordInOperand(i); - } else if (type_inst->opcode() == SpvOpTypeArray) { + } else if (type_inst->opcode() == spv::Op::OpTypeArray) { component_type_id = type_inst->GetSingleWordInOperand(0); } @@ -489,27 +666,24 @@ using BinaryScalarFoldingRule = std::function; -// Returns a |ConstantFoldingRule| that folds unary floating point scalar ops -// using |scalar_rule| and unary float point vectors ops by applying +// Returns a |ConstantFoldingRule| that folds unary scalar ops +// using |scalar_rule| and unary vectors ops by applying // |scalar_rule| to the elements of the vector. The |ConstantFoldingRule| // that is returned assumes that |constants| contains 1 entry. If they are // not |nullptr|, then their type is either |Float| or |Integer| or a |Vector| // whose element type is |Float| or |Integer|. -ConstantFoldingRule FoldFPUnaryOp(UnaryScalarFoldingRule scalar_rule) { +ConstantFoldingRule FoldUnaryOp(UnaryScalarFoldingRule scalar_rule) { return [scalar_rule](IRContext* context, Instruction* inst, const std::vector& constants) -> const analysis::Constant* { + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); analysis::TypeManager* type_mgr = context->get_type_mgr(); const analysis::Type* result_type = type_mgr->GetType(inst->type_id()); const analysis::Vector* vector_type = result_type->AsVector(); - if (!inst->IsFloatingPointFoldingAllowed()) { - return nullptr; - } - const analysis::Constant* arg = - (inst->opcode() == SpvOpExtInst) ? constants[1] : constants[0]; + (inst->opcode() == spv::Op::OpExtInst) ? constants[1] : constants[0]; if (arg == nullptr) { return nullptr; @@ -542,6 +716,25 @@ ConstantFoldingRule FoldFPUnaryOp(UnaryScalarFoldingRule scalar_rule) { }; } +// Returns a |ConstantFoldingRule| that folds unary floating point scalar ops +// using |scalar_rule| and unary float point vectors ops by applying +// |scalar_rule| to the elements of the vector. The |ConstantFoldingRule| +// that is returned assumes that |constants| contains 1 entry. If they are +// not |nullptr|, then their type is either |Float| or |Integer| or a |Vector| +// whose element type is |Float| or |Integer|. +ConstantFoldingRule FoldFPUnaryOp(UnaryScalarFoldingRule scalar_rule) { + auto folding_rule = FoldUnaryOp(scalar_rule); + return [folding_rule](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + if (!inst->IsFloatingPointFoldingAllowed()) { + return nullptr; + } + + return folding_rule(context, inst, constants); + }; +} + // Returns the result of folding the constants in |constants| according the // |scalar_rule|. If |result_type| is a vector, then |scalar_rule| is applied // per component. @@ -599,7 +792,7 @@ ConstantFoldingRule FoldFPBinaryOp(BinaryScalarFoldingRule scalar_rule) { if (!inst->IsFloatingPointFoldingAllowed()) { return nullptr; } - if (inst->opcode() == SpvOpExtInst) { + if (inst->opcode() == spv::Op::OpExtInst) { return FoldFPBinaryOp(scalar_rule, inst->type_id(), {constants[1], constants[2]}, context); } @@ -774,6 +967,11 @@ const analysis::Constant* FoldScalarFPDivide( return FoldFPScalarDivideByZero(result_type, numerator, const_mgr); } + uint32_t width = denominator->type()->AsFloat()->width(); + if (width != 32 && width != 64) { + return nullptr; + } + const analysis::FloatConstant* denominator_float = denominator->AsFloatConstant(); if (denominator_float && denominator->GetValueAsDouble() == -0.0) { @@ -944,20 +1142,10 @@ ConstantFoldingRule FoldOpDotWithConstants() { }; } -// This function defines a |UnaryScalarFoldingRule| that subtracts the constant -// from zero. -UnaryScalarFoldingRule FoldFNegateOp() { - return [](const analysis::Type* result_type, const analysis::Constant* a, - analysis::ConstantManager* const_mgr) -> const analysis::Constant* { - assert(result_type != nullptr && a != nullptr); - assert(result_type == a->type()); - return NegateFPConst(result_type, a, const_mgr); - }; -} - -ConstantFoldingRule FoldFNegate() { return FoldFPUnaryOp(FoldFNegateOp()); } +ConstantFoldingRule FoldFNegate() { return FoldFPUnaryOp(NegateFPConst); } +ConstantFoldingRule FoldSNegate() { return FoldUnaryOp(NegateIntConst); } -ConstantFoldingRule FoldFClampFeedingCompare(uint32_t cmp_opcode) { +ConstantFoldingRule FoldFClampFeedingCompare(spv::Op cmp_opcode) { return [cmp_opcode](IRContext* context, Instruction* inst, const std::vector& constants) -> const analysis::Constant* { @@ -985,7 +1173,7 @@ ConstantFoldingRule FoldFClampFeedingCompare(uint32_t cmp_opcode) { return nullptr; } - if (operand_inst->opcode() != SpvOpExtInst) { + if (operand_inst->opcode() != spv::Op::OpExtInst) { return nullptr; } @@ -1009,25 +1197,25 @@ ConstantFoldingRule FoldFClampFeedingCompare(uint32_t cmp_opcode) { bool result = false; switch (cmp_opcode) { - case SpvOpFOrdLessThan: - case SpvOpFUnordLessThan: - case SpvOpFOrdGreaterThanEqual: - case SpvOpFUnordGreaterThanEqual: + case spv::Op::OpFOrdLessThan: + case spv::Op::OpFUnordLessThan: + case spv::Op::OpFOrdGreaterThanEqual: + case spv::Op::OpFUnordGreaterThanEqual: if (constants[0]) { if (min_const) { if (constants[0]->GetValueAsDouble() < min_const->GetValueAsDouble()) { found_result = true; - result = (cmp_opcode == SpvOpFOrdLessThan || - cmp_opcode == SpvOpFUnordLessThan); + result = (cmp_opcode == spv::Op::OpFOrdLessThan || + cmp_opcode == spv::Op::OpFUnordLessThan); } } if (max_const) { if (constants[0]->GetValueAsDouble() >= max_const->GetValueAsDouble()) { found_result = true; - result = !(cmp_opcode == SpvOpFOrdLessThan || - cmp_opcode == SpvOpFUnordLessThan); + result = !(cmp_opcode == spv::Op::OpFOrdLessThan || + cmp_opcode == spv::Op::OpFUnordLessThan); } } } @@ -1037,8 +1225,8 @@ ConstantFoldingRule FoldFClampFeedingCompare(uint32_t cmp_opcode) { if (max_const->GetValueAsDouble() < constants[1]->GetValueAsDouble()) { found_result = true; - result = (cmp_opcode == SpvOpFOrdLessThan || - cmp_opcode == SpvOpFUnordLessThan); + result = (cmp_opcode == spv::Op::OpFOrdLessThan || + cmp_opcode == spv::Op::OpFUnordLessThan); } } @@ -1046,31 +1234,31 @@ ConstantFoldingRule FoldFClampFeedingCompare(uint32_t cmp_opcode) { if (min_const->GetValueAsDouble() >= constants[1]->GetValueAsDouble()) { found_result = true; - result = !(cmp_opcode == SpvOpFOrdLessThan || - cmp_opcode == SpvOpFUnordLessThan); + result = !(cmp_opcode == spv::Op::OpFOrdLessThan || + cmp_opcode == spv::Op::OpFUnordLessThan); } } } break; - case SpvOpFOrdGreaterThan: - case SpvOpFUnordGreaterThan: - case SpvOpFOrdLessThanEqual: - case SpvOpFUnordLessThanEqual: + case spv::Op::OpFOrdGreaterThan: + case spv::Op::OpFUnordGreaterThan: + case spv::Op::OpFOrdLessThanEqual: + case spv::Op::OpFUnordLessThanEqual: if (constants[0]) { if (min_const) { if (constants[0]->GetValueAsDouble() <= min_const->GetValueAsDouble()) { found_result = true; - result = (cmp_opcode == SpvOpFOrdLessThanEqual || - cmp_opcode == SpvOpFUnordLessThanEqual); + result = (cmp_opcode == spv::Op::OpFOrdLessThanEqual || + cmp_opcode == spv::Op::OpFUnordLessThanEqual); } } if (max_const) { if (constants[0]->GetValueAsDouble() > max_const->GetValueAsDouble()) { found_result = true; - result = !(cmp_opcode == SpvOpFOrdLessThanEqual || - cmp_opcode == SpvOpFUnordLessThanEqual); + result = !(cmp_opcode == spv::Op::OpFOrdLessThanEqual || + cmp_opcode == spv::Op::OpFUnordLessThanEqual); } } } @@ -1080,8 +1268,8 @@ ConstantFoldingRule FoldFClampFeedingCompare(uint32_t cmp_opcode) { if (max_const->GetValueAsDouble() <= constants[1]->GetValueAsDouble()) { found_result = true; - result = (cmp_opcode == SpvOpFOrdLessThanEqual || - cmp_opcode == SpvOpFUnordLessThanEqual); + result = (cmp_opcode == spv::Op::OpFOrdLessThanEqual || + cmp_opcode == spv::Op::OpFUnordLessThanEqual); } } @@ -1089,8 +1277,8 @@ ConstantFoldingRule FoldFClampFeedingCompare(uint32_t cmp_opcode) { if (min_const->GetValueAsDouble() > constants[1]->GetValueAsDouble()) { found_result = true; - result = !(cmp_opcode == SpvOpFOrdLessThanEqual || - cmp_opcode == SpvOpFUnordLessThanEqual); + result = !(cmp_opcode == spv::Op::OpFOrdLessThanEqual || + cmp_opcode == spv::Op::OpFUnordLessThanEqual); } } } @@ -1117,7 +1305,7 @@ ConstantFoldingRule FoldFMix() { const std::vector& constants) -> const analysis::Constant* { analysis::ConstantManager* const_mgr = context->get_constant_mgr(); - assert(inst->opcode() == SpvOpExtInst && + assert(inst->opcode() == spv::Op::OpExtInst && "Expecting an extended instruction."); assert(inst->GetSingleWordInOperand(0) == context->get_feature_mgr()->GetExtInstImportId_GLSLstd450() && @@ -1267,7 +1455,7 @@ const analysis::Constant* FoldMax(const analysis::Type* result_type, const analysis::Constant* FoldClamp1( IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpExtInst && + assert(inst->opcode() == spv::Op::OpExtInst && "Expecting an extended instruction."); assert(inst->GetSingleWordInOperand(0) == context->get_feature_mgr()->GetExtInstImportId_GLSLstd450() && @@ -1293,7 +1481,7 @@ const analysis::Constant* FoldClamp1( const analysis::Constant* FoldClamp2( IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpExtInst && + assert(inst->opcode() == spv::Op::OpExtInst && "Expecting an extended instruction."); assert(inst->GetSingleWordInOperand(0) == context->get_feature_mgr()->GetExtInstImportId_GLSLstd450() && @@ -1321,7 +1509,7 @@ const analysis::Constant* FoldClamp2( const analysis::Constant* FoldClamp3( IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpExtInst && + assert(inst->opcode() == spv::Op::OpExtInst && "Expecting an extended instruction."); assert(inst->GetSingleWordInOperand(0) == context->get_feature_mgr()->GetExtInstImportId_GLSLstd450() && @@ -1407,68 +1595,72 @@ void ConstantFoldingRules::AddFoldingRules() { // applies to the instruction, the rest of the rules will not be attempted. // Take that into consideration. - rules_[SpvOpCompositeConstruct].push_back(FoldCompositeWithConstants()); + rules_[spv::Op::OpCompositeConstruct].push_back(FoldCompositeWithConstants()); - rules_[SpvOpCompositeExtract].push_back(FoldExtractWithConstants()); + rules_[spv::Op::OpCompositeExtract].push_back(FoldExtractWithConstants()); + rules_[spv::Op::OpCompositeInsert].push_back(FoldInsertWithConstants()); - rules_[SpvOpConvertFToS].push_back(FoldFToI()); - rules_[SpvOpConvertFToU].push_back(FoldFToI()); - rules_[SpvOpConvertSToF].push_back(FoldIToF()); - rules_[SpvOpConvertUToF].push_back(FoldIToF()); + rules_[spv::Op::OpConvertFToS].push_back(FoldFToI()); + rules_[spv::Op::OpConvertFToU].push_back(FoldFToI()); + rules_[spv::Op::OpConvertSToF].push_back(FoldIToF()); + rules_[spv::Op::OpConvertUToF].push_back(FoldIToF()); - rules_[SpvOpDot].push_back(FoldOpDotWithConstants()); - rules_[SpvOpFAdd].push_back(FoldFAdd()); - rules_[SpvOpFDiv].push_back(FoldFDiv()); - rules_[SpvOpFMul].push_back(FoldFMul()); - rules_[SpvOpFSub].push_back(FoldFSub()); + rules_[spv::Op::OpDot].push_back(FoldOpDotWithConstants()); + rules_[spv::Op::OpFAdd].push_back(FoldFAdd()); + rules_[spv::Op::OpFDiv].push_back(FoldFDiv()); + rules_[spv::Op::OpFMul].push_back(FoldFMul()); + rules_[spv::Op::OpFSub].push_back(FoldFSub()); - rules_[SpvOpFOrdEqual].push_back(FoldFOrdEqual()); + rules_[spv::Op::OpFOrdEqual].push_back(FoldFOrdEqual()); - rules_[SpvOpFUnordEqual].push_back(FoldFUnordEqual()); + rules_[spv::Op::OpFUnordEqual].push_back(FoldFUnordEqual()); - rules_[SpvOpFOrdNotEqual].push_back(FoldFOrdNotEqual()); + rules_[spv::Op::OpFOrdNotEqual].push_back(FoldFOrdNotEqual()); - rules_[SpvOpFUnordNotEqual].push_back(FoldFUnordNotEqual()); + rules_[spv::Op::OpFUnordNotEqual].push_back(FoldFUnordNotEqual()); - rules_[SpvOpFOrdLessThan].push_back(FoldFOrdLessThan()); - rules_[SpvOpFOrdLessThan].push_back( - FoldFClampFeedingCompare(SpvOpFOrdLessThan)); + rules_[spv::Op::OpFOrdLessThan].push_back(FoldFOrdLessThan()); + rules_[spv::Op::OpFOrdLessThan].push_back( + FoldFClampFeedingCompare(spv::Op::OpFOrdLessThan)); - rules_[SpvOpFUnordLessThan].push_back(FoldFUnordLessThan()); - rules_[SpvOpFUnordLessThan].push_back( - FoldFClampFeedingCompare(SpvOpFUnordLessThan)); + rules_[spv::Op::OpFUnordLessThan].push_back(FoldFUnordLessThan()); + rules_[spv::Op::OpFUnordLessThan].push_back( + FoldFClampFeedingCompare(spv::Op::OpFUnordLessThan)); - rules_[SpvOpFOrdGreaterThan].push_back(FoldFOrdGreaterThan()); - rules_[SpvOpFOrdGreaterThan].push_back( - FoldFClampFeedingCompare(SpvOpFOrdGreaterThan)); + rules_[spv::Op::OpFOrdGreaterThan].push_back(FoldFOrdGreaterThan()); + rules_[spv::Op::OpFOrdGreaterThan].push_back( + FoldFClampFeedingCompare(spv::Op::OpFOrdGreaterThan)); - rules_[SpvOpFUnordGreaterThan].push_back(FoldFUnordGreaterThan()); - rules_[SpvOpFUnordGreaterThan].push_back( - FoldFClampFeedingCompare(SpvOpFUnordGreaterThan)); + rules_[spv::Op::OpFUnordGreaterThan].push_back(FoldFUnordGreaterThan()); + rules_[spv::Op::OpFUnordGreaterThan].push_back( + FoldFClampFeedingCompare(spv::Op::OpFUnordGreaterThan)); - rules_[SpvOpFOrdLessThanEqual].push_back(FoldFOrdLessThanEqual()); - rules_[SpvOpFOrdLessThanEqual].push_back( - FoldFClampFeedingCompare(SpvOpFOrdLessThanEqual)); + rules_[spv::Op::OpFOrdLessThanEqual].push_back(FoldFOrdLessThanEqual()); + rules_[spv::Op::OpFOrdLessThanEqual].push_back( + FoldFClampFeedingCompare(spv::Op::OpFOrdLessThanEqual)); - rules_[SpvOpFUnordLessThanEqual].push_back(FoldFUnordLessThanEqual()); - rules_[SpvOpFUnordLessThanEqual].push_back( - FoldFClampFeedingCompare(SpvOpFUnordLessThanEqual)); + rules_[spv::Op::OpFUnordLessThanEqual].push_back(FoldFUnordLessThanEqual()); + rules_[spv::Op::OpFUnordLessThanEqual].push_back( + FoldFClampFeedingCompare(spv::Op::OpFUnordLessThanEqual)); - rules_[SpvOpFOrdGreaterThanEqual].push_back(FoldFOrdGreaterThanEqual()); - rules_[SpvOpFOrdGreaterThanEqual].push_back( - FoldFClampFeedingCompare(SpvOpFOrdGreaterThanEqual)); + rules_[spv::Op::OpFOrdGreaterThanEqual].push_back(FoldFOrdGreaterThanEqual()); + rules_[spv::Op::OpFOrdGreaterThanEqual].push_back( + FoldFClampFeedingCompare(spv::Op::OpFOrdGreaterThanEqual)); - rules_[SpvOpFUnordGreaterThanEqual].push_back(FoldFUnordGreaterThanEqual()); - rules_[SpvOpFUnordGreaterThanEqual].push_back( - FoldFClampFeedingCompare(SpvOpFUnordGreaterThanEqual)); + rules_[spv::Op::OpFUnordGreaterThanEqual].push_back( + FoldFUnordGreaterThanEqual()); + rules_[spv::Op::OpFUnordGreaterThanEqual].push_back( + FoldFClampFeedingCompare(spv::Op::OpFUnordGreaterThanEqual)); - rules_[SpvOpVectorShuffle].push_back(FoldVectorShuffleWithConstants()); - rules_[SpvOpVectorTimesScalar].push_back(FoldVectorTimesScalar()); - rules_[SpvOpVectorTimesMatrix].push_back(FoldVectorTimesMatrix()); - rules_[SpvOpMatrixTimesVector].push_back(FoldMatrixTimesVector()); + rules_[spv::Op::OpVectorShuffle].push_back(FoldVectorShuffleWithConstants()); + rules_[spv::Op::OpVectorTimesScalar].push_back(FoldVectorTimesScalar()); + rules_[spv::Op::OpVectorTimesMatrix].push_back(FoldVectorTimesMatrix()); + rules_[spv::Op::OpMatrixTimesVector].push_back(FoldMatrixTimesVector()); + rules_[spv::Op::OpTranspose].push_back(FoldTranspose); - rules_[SpvOpFNegate].push_back(FoldFNegate()); - rules_[SpvOpQuantizeToF16].push_back(FoldQuantizeToF16()); + rules_[spv::Op::OpFNegate].push_back(FoldFNegate()); + rules_[spv::Op::OpSNegate].push_back(FoldSNegate()); + rules_[spv::Op::OpQuantizeToF16].push_back(FoldQuantizeToF16()); // Add rules for GLSLstd450 FeatureManager* feature_manager = context_->get_feature_mgr(); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.h b/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.h index 41ee2aa2..fa345321 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.h @@ -88,7 +88,7 @@ class ConstantFoldingRules { // Returns true if there is at least 1 folding rule for |inst|. const std::vector& GetRulesForInstruction( const Instruction* inst) const { - if (inst->opcode() != SpvOpExtInst) { + if (inst->opcode() != spv::Op::OpExtInst) { auto it = rules_.find(inst->opcode()); if (it != rules_.end()) { return it->second.value; @@ -108,9 +108,15 @@ class ConstantFoldingRules { virtual void AddFoldingRules(); protected: + struct hasher { + size_t operator()(const spv::Op& op) const noexcept { + return std::hash()(uint32_t(op)); + } + }; + // |rules[opcode]| is the set of rules that can be applied to instructions // with |opcode| as the opcode. - std::unordered_map rules_; + std::unordered_map rules_; // The folding rules for extended instructions. std::map ext_rules_; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/constants.cpp b/bgfx/3rdparty/spirv-tools/source/opt/constants.cpp index bcff08c1..a487a45b 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/constants.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/constants.cpp @@ -14,7 +14,6 @@ #include "source/opt/constants.h" -#include #include #include "source/opt/ir_context.h" @@ -306,16 +305,16 @@ const Constant* ConstantManager::GetConstantFromInst(const Instruction* inst) { switch (inst->opcode()) { // OpConstant{True|False} have the value embedded in the opcode. So they // are not handled by the for-loop above. Here we add the value explicitly. - case SpvOp::SpvOpConstantTrue: + case spv::Op::OpConstantTrue: literal_words_or_ids.push_back(true); break; - case SpvOp::SpvOpConstantFalse: + case spv::Op::OpConstantFalse: literal_words_or_ids.push_back(false); break; - case SpvOp::SpvOpConstantNull: - case SpvOp::SpvOpConstant: - case SpvOp::SpvOpConstantComposite: - case SpvOp::SpvOpSpecConstantComposite: + case spv::Op::OpConstantNull: + case spv::Op::OpConstant: + case spv::Op::OpConstantComposite: + case spv::Op::OpSpecConstantComposite: break; default: return nullptr; @@ -329,22 +328,22 @@ std::unique_ptr ConstantManager::CreateInstruction( uint32_t type = (type_id == 0) ? context()->get_type_mgr()->GetId(c->type()) : type_id; if (c->AsNullConstant()) { - return MakeUnique(context(), SpvOp::SpvOpConstantNull, type, - id, std::initializer_list{}); + return MakeUnique(context(), spv::Op::OpConstantNull, type, id, + std::initializer_list{}); } else if (const BoolConstant* bc = c->AsBoolConstant()) { return MakeUnique( context(), - bc->value() ? SpvOp::SpvOpConstantTrue : SpvOp::SpvOpConstantFalse, - type, id, std::initializer_list{}); + bc->value() ? spv::Op::OpConstantTrue : spv::Op::OpConstantFalse, type, + id, std::initializer_list{}); } else if (const IntConstant* ic = c->AsIntConstant()) { return MakeUnique( - context(), SpvOp::SpvOpConstant, type, id, + context(), spv::Op::OpConstant, type, id, std::initializer_list{ Operand(spv_operand_type_t::SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, ic->words())}); } else if (const FloatConstant* fc = c->AsFloatConstant()) { return MakeUnique( - context(), SpvOp::SpvOpConstant, type, id, + context(), spv::Op::OpConstant, type, id, std::initializer_list{ Operand(spv_operand_type_t::SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, fc->words())}); @@ -362,9 +361,9 @@ std::unique_ptr ConstantManager::CreateCompositeInstruction( uint32_t component_index = 0; for (const Constant* component_const : cc->GetComponents()) { uint32_t component_type_id = 0; - if (type_inst && type_inst->opcode() == SpvOpTypeStruct) { + if (type_inst && type_inst->opcode() == spv::Op::OpTypeStruct) { component_type_id = type_inst->GetSingleWordInOperand(component_index); - } else if (type_inst && type_inst->opcode() == SpvOpTypeArray) { + } else if (type_inst && type_inst->opcode() == spv::Op::OpTypeArray) { component_type_id = type_inst->GetSingleWordInOperand(0); } uint32_t id = FindDeclaredConstant(component_const, component_type_id); @@ -381,7 +380,7 @@ std::unique_ptr ConstantManager::CreateCompositeInstruction( } uint32_t type = (type_id == 0) ? context()->get_type_mgr()->GetId(cc->type()) : type_id; - return MakeUnique(context(), SpvOp::SpvOpConstantComposite, type, + return MakeUnique(context(), spv::Op::OpConstantComposite, type, result_id, std::move(operands)); } @@ -391,6 +390,43 @@ const Constant* ConstantManager::GetConstant( return cst ? RegisterConstant(std::move(cst)) : nullptr; } +const Constant* ConstantManager::GetNullCompositeConstant(const Type* type) { + std::vector literal_words_or_id; + + if (type->AsVector()) { + const Type* element_type = type->AsVector()->element_type(); + const uint32_t null_id = GetNullConstId(element_type); + const uint32_t element_count = type->AsVector()->element_count(); + for (uint32_t i = 0; i < element_count; i++) { + literal_words_or_id.push_back(null_id); + } + } else if (type->AsMatrix()) { + const Type* element_type = type->AsMatrix()->element_type(); + const uint32_t null_id = GetNullConstId(element_type); + const uint32_t element_count = type->AsMatrix()->element_count(); + for (uint32_t i = 0; i < element_count; i++) { + literal_words_or_id.push_back(null_id); + } + } else if (type->AsStruct()) { + // TODO (sfricke-lunarg) add proper struct support + return nullptr; + } else if (type->AsArray()) { + const Type* element_type = type->AsArray()->element_type(); + const uint32_t null_id = GetNullConstId(element_type); + assert(type->AsArray()->length_info().words[0] == + analysis::Array::LengthInfo::kConstant && + "unexpected array length"); + const uint32_t element_count = type->AsArray()->length_info().words[0]; + for (uint32_t i = 0; i < element_count; i++) { + literal_words_or_id.push_back(null_id); + } + } else { + return nullptr; + } + + return GetConstant(type, literal_words_or_id); +} + const Constant* ConstantManager::GetNumericVectorConstantWithWords( const Vector* type, const std::vector& literal_words) { const auto* element_type = type->element_type(); @@ -399,6 +435,8 @@ const Constant* ConstantManager::GetNumericVectorConstantWithWords( words_per_element = float_type->width() / 32; else if (const auto* int_type = element_type->AsInteger()) words_per_element = int_type->width() / 32; + else if (element_type->AsBool() != nullptr) + words_per_element = 1; if (words_per_element != 1 && words_per_element != 2) return nullptr; @@ -445,18 +483,48 @@ const Constant* ConstantManager::GetDoubleConst(double val) { return c; } -uint32_t ConstantManager::GetSIntConst(int32_t val) { +uint32_t ConstantManager::GetSIntConstId(int32_t val) { Type* sint_type = context()->get_type_mgr()->GetSIntType(); const Constant* c = GetConstant(sint_type, {static_cast(val)}); return GetDefiningInstruction(c)->result_id(); } -uint32_t ConstantManager::GetUIntConst(uint32_t val) { +const Constant* ConstantManager::GetIntConst(uint64_t val, int32_t bitWidth, + bool isSigned) { + Type* int_type = context()->get_type_mgr()->GetIntType(bitWidth, isSigned); + + if (isSigned) { + // Sign extend the value. + int32_t num_of_bit_to_ignore = 64 - bitWidth; + val = static_cast(val << num_of_bit_to_ignore) >> + num_of_bit_to_ignore; + } else { + // Clear the upper bit that are not used. + uint64_t mask = ((1ull << bitWidth) - 1); + val &= mask; + } + + if (bitWidth <= 32) { + return GetConstant(int_type, {static_cast(val)}); + } + + // If the value is more than 32-bit, we need to split the operands into two + // 32-bit integers. + return GetConstant( + int_type, {static_cast(val >> 32), static_cast(val)}); +} + +uint32_t ConstantManager::GetUIntConstId(uint32_t val) { Type* uint_type = context()->get_type_mgr()->GetUIntType(); const Constant* c = GetConstant(uint_type, {val}); return GetDefiningInstruction(c)->result_id(); } +uint32_t ConstantManager::GetNullConstId(const Type* type) { + const Constant* c = GetConstant(type, {}); + return GetDefiningInstruction(c)->result_id(); +} + std::vector Constant::GetVectorComponents( analysis::ConstantManager* const_mgr) const { std::vector components; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/constants.h b/bgfx/3rdparty/spirv-tools/source/opt/constants.h index d496d073..adc76ba2 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/constants.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/constants.h @@ -163,6 +163,21 @@ class ScalarConstant : public Constant { return is_zero; } + uint32_t GetU32BitValue() const { + // Relies on unsigned values smaller than 32-bit being zero extended. See + // section 2.2.1 of the SPIR-V spec. + assert(words().size() == 1); + return words()[0]; + } + + uint64_t GetU64BitValue() const { + // Relies on unsigned values smaller than 64-bit being zero extended. See + // section 2.2.1 of the SPIR-V spec. + assert(words().size() == 2); + return static_cast(words()[1]) << 32 | + static_cast(words()[0]); + } + protected: ScalarConstant(const Type* ty, const std::vector& w) : Constant(ty), words_(w) {} @@ -189,13 +204,6 @@ class IntConstant : public ScalarConstant { return words()[0]; } - uint32_t GetU32BitValue() const { - // Relies on unsigned values smaller than 32-bit being zero extended. See - // section 2.2.1 of the SPIR-V spec. - assert(words().size() == 1); - return words()[0]; - } - int64_t GetS64BitValue() const { // Relies on unsigned values smaller than 64-bit being sign extended. See // section 2.2.1 of the SPIR-V spec. @@ -204,14 +212,6 @@ class IntConstant : public ScalarConstant { static_cast(words()[0]); } - uint64_t GetU64BitValue() const { - // Relies on unsigned values smaller than 64-bit being zero extended. See - // section 2.2.1 of the SPIR-V spec. - assert(words().size() == 2); - return static_cast(words()[1]) << 32 | - static_cast(words()[0]); - } - // Make a copy of this IntConstant instance. std::unique_ptr CopyIntConstant() const { return MakeUnique(type_->AsInteger(), words_); @@ -520,6 +520,14 @@ class ConstantManager { literal_words_or_ids.end())); } + // Takes a type and creates a OpConstantComposite + // This allows a + // OpConstantNull %composite_type + // to become a + // OpConstantComposite %composite_type %null %null ... etc + // Assumes type is a Composite already, otherwise returns null + const Constant* GetNullCompositeConstant(const Type* type); + // Gets or creates a unique Constant instance of Vector type |type| with // numeric elements and a vector of constant defining words |literal_words|. // If a Constant instance existed already in the constant pool, it returns a @@ -649,10 +657,19 @@ class ConstantManager { const Constant* GetDoubleConst(double val); // Returns the id of a 32-bit signed integer constant with value |val|. - uint32_t GetSIntConst(int32_t val); + uint32_t GetSIntConstId(int32_t val); + + // Returns an integer constant with `bitWidth` and value |val|. If `isSigned` + // is true, the constant will be a signed integer. Otherwise it will be + // unsigned. Only the `bitWidth` lower order bits of |val| will be used. The + // rest will be ignored. + const Constant* GetIntConst(uint64_t val, int32_t bitWidth, bool isSigned); // Returns the id of a 32-bit unsigned integer constant with value |val|. - uint32_t GetUIntConst(uint32_t val); + uint32_t GetUIntConstId(uint32_t val); + + // Returns the id of a OpConstantNull with type of |type|. + uint32_t GetNullConstId(const Type* type); private: // Creates a Constant instance with the given type and a vector of constant diff --git a/bgfx/3rdparty/spirv-tools/source/opt/control_dependence.cpp b/bgfx/3rdparty/spirv-tools/source/opt/control_dependence.cpp index f4879e0f..3d481396 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/control_dependence.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/control_dependence.cpp @@ -16,15 +16,12 @@ #include #include -#include -#include #include "source/opt/basic_block.h" #include "source/opt/cfg.h" #include "source/opt/dominator_analysis.h" #include "source/opt/function.h" #include "source/opt/instruction.h" -#include "spirv/unified1/spirv.h" // Computes the control dependence graph (CDG) using the algorithm in Cytron // 1991, "Efficiently Computing Static Single Assignment Form and the Control @@ -49,8 +46,8 @@ uint32_t ControlDependence::GetConditionID(const CFG& cfg) const { } const BasicBlock* source_bb = cfg.block(source_bb_id()); const Instruction* branch = source_bb->terminator(); - assert((branch->opcode() == SpvOpBranchConditional || - branch->opcode() == SpvOpSwitch) && + assert((branch->opcode() == spv::Op::OpBranchConditional || + branch->opcode() == spv::Op::OpSwitch) && "invalid control dependence; last instruction must be conditional " "branch or switch"); return branch->GetSingleWordInOperand(0); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/convert_to_half_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/convert_to_half_pass.cpp index 4086e31a..cb0065d2 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/convert_to_half_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/convert_to_half_pass.cpp @@ -18,19 +18,16 @@ #include "source/opt/ir_builder.h" -namespace { - -// Indices of operands in SPIR-V instructions -static const int kImageSampleDrefIdInIdx = 2; - -} // anonymous namespace - namespace spvtools { namespace opt { +namespace { +// Indices of operands in SPIR-V instructions +constexpr int kImageSampleDrefIdInIdx = 2; +} // namespace bool ConvertToHalfPass::IsArithmetic(Instruction* inst) { return target_ops_core_.count(inst->opcode()) != 0 || - (inst->opcode() == SpvOpExtInst && + (inst->opcode() == spv::Op::OpExtInst && inst->GetSingleWordInOperand(0) == context()->get_feature_mgr()->GetExtInstImportId_GLSLstd450() && target_ops_450_.count(inst->GetSingleWordInOperand(1)) != 0); @@ -42,12 +39,21 @@ bool ConvertToHalfPass::IsFloat(Instruction* inst, uint32_t width) { return Pass::IsFloat(ty_id, width); } +bool ConvertToHalfPass::IsStruct(Instruction* inst) { + uint32_t ty_id = inst->type_id(); + if (ty_id == 0) return false; + Instruction* ty_inst = Pass::GetBaseType(ty_id); + return (ty_inst->opcode() == spv::Op::OpTypeStruct); +} + bool ConvertToHalfPass::IsDecoratedRelaxed(Instruction* inst) { uint32_t r_id = inst->result_id(); for (auto r_inst : get_decoration_mgr()->GetDecorationsFor(r_id, false)) - if (r_inst->opcode() == SpvOpDecorate && - r_inst->GetSingleWordInOperand(1) == SpvDecorationRelaxedPrecision) + if (r_inst->opcode() == spv::Op::OpDecorate && + spv::Decoration(r_inst->GetSingleWordInOperand(1)) == + spv::Decoration::RelaxedPrecision) { return true; + } return false; } @@ -57,6 +63,10 @@ bool ConvertToHalfPass::IsRelaxed(uint32_t id) { void ConvertToHalfPass::AddRelaxed(uint32_t id) { relaxed_ids_set_.insert(id); } +bool ConvertToHalfPass::CanRelaxOpOperands(Instruction* inst) { + return image_ops_.count(inst->opcode()) == 0; +} + analysis::Type* ConvertToHalfPass::FloatScalarType(uint32_t width) { analysis::Float float_ty(width); return context()->get_type_mgr()->GetRegisteredType(&float_ty); @@ -82,12 +92,12 @@ analysis::Type* ConvertToHalfPass::FloatMatrixType(uint32_t v_cnt, uint32_t ConvertToHalfPass::EquivFloatTypeId(uint32_t ty_id, uint32_t width) { analysis::Type* reg_equiv_ty; Instruction* ty_inst = get_def_use_mgr()->GetDef(ty_id); - if (ty_inst->opcode() == SpvOpTypeMatrix) + if (ty_inst->opcode() == spv::Op::OpTypeMatrix) reg_equiv_ty = FloatMatrixType(ty_inst->GetSingleWordInOperand(1), ty_inst->GetSingleWordInOperand(0), width); - else if (ty_inst->opcode() == SpvOpTypeVector) + else if (ty_inst->opcode() == spv::Op::OpTypeVector) reg_equiv_ty = FloatVectorType(ty_inst->GetSingleWordInOperand(1), width); - else // SpvOpTypeFloat + else // spv::Op::OpTypeFloat reg_equiv_ty = FloatScalarType(width); return context()->get_type_mgr()->GetTypeInstruction(reg_equiv_ty); } @@ -102,18 +112,18 @@ void ConvertToHalfPass::GenConvert(uint32_t* val_idp, uint32_t width, InstructionBuilder builder( context(), inst, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); - if (val_inst->opcode() == SpvOpUndef) - cvt_inst = builder.AddNullaryOp(nty_id, SpvOpUndef); + if (val_inst->opcode() == spv::Op::OpUndef) + cvt_inst = builder.AddNullaryOp(nty_id, spv::Op::OpUndef); else - cvt_inst = builder.AddUnaryOp(nty_id, SpvOpFConvert, *val_idp); + cvt_inst = builder.AddUnaryOp(nty_id, spv::Op::OpFConvert, *val_idp); *val_idp = cvt_inst->result_id(); } bool ConvertToHalfPass::MatConvertCleanup(Instruction* inst) { - if (inst->opcode() != SpvOpFConvert) return false; + if (inst->opcode() != spv::Op::OpFConvert) return false; uint32_t mty_id = inst->type_id(); Instruction* mty_inst = get_def_use_mgr()->GetDef(mty_id); - if (mty_inst->opcode() != SpvOpTypeMatrix) return false; + if (mty_inst->opcode() != spv::Op::OpTypeMatrix) return false; uint32_t vty_id = mty_inst->GetSingleWordInOperand(0); uint32_t v_cnt = mty_inst->GetSingleWordInOperand(1); Instruction* vty_inst = get_def_use_mgr()->GetDef(vty_id); @@ -130,18 +140,18 @@ bool ConvertToHalfPass::MatConvertCleanup(Instruction* inst) { std::vector opnds = {}; for (uint32_t vidx = 0; vidx < v_cnt; ++vidx) { Instruction* ext_inst = builder.AddIdLiteralOp( - orig_vty_id, SpvOpCompositeExtract, orig_mat_id, vidx); + orig_vty_id, spv::Op::OpCompositeExtract, orig_mat_id, vidx); Instruction* cvt_inst = - builder.AddUnaryOp(vty_id, SpvOpFConvert, ext_inst->result_id()); + builder.AddUnaryOp(vty_id, spv::Op::OpFConvert, ext_inst->result_id()); opnds.push_back({SPV_OPERAND_TYPE_ID, {cvt_inst->result_id()}}); } uint32_t mat_id = TakeNextId(); std::unique_ptr mat_inst(new Instruction( - context(), SpvOpCompositeConstruct, mty_id, mat_id, opnds)); + context(), spv::Op::OpCompositeConstruct, mty_id, mat_id, opnds)); (void)builder.AddInstruction(std::move(mat_inst)); context()->ReplaceAllUsesWith(inst->result_id(), mat_id); // Turn original instruction into copy so it is valid. - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetResultType(EquivFloatTypeId(mty_id, orig_width)); get_def_use_mgr()->AnalyzeInstUse(inst); return true; @@ -150,10 +160,11 @@ bool ConvertToHalfPass::MatConvertCleanup(Instruction* inst) { bool ConvertToHalfPass::RemoveRelaxedDecoration(uint32_t id) { return context()->get_decoration_mgr()->RemoveDecorationsFrom( id, [](const Instruction& dec) { - if (dec.opcode() == SpvOpDecorate && - dec.GetSingleWordInOperand(1u) == SpvDecorationRelaxedPrecision) + if (dec.opcode() == spv::Op::OpDecorate && + spv::Decoration(dec.GetSingleWordInOperand(1u)) == + spv::Decoration::RelaxedPrecision) { return true; - else + } else return false; }); } @@ -196,8 +207,8 @@ bool ConvertToHalfPass::ProcessPhi(Instruction* inst, uint32_t from_width, auto insert_before = bp->tail(); if (insert_before != bp->begin()) { --insert_before; - if (insert_before->opcode() != SpvOpSelectionMerge && - insert_before->opcode() != SpvOpLoopMerge) + if (insert_before->opcode() != spv::Op::OpSelectionMerge && + insert_before->opcode() != spv::Op::OpLoopMerge) ++insert_before; } GenConvert(prev_idp, to_width, &*insert_before); @@ -229,7 +240,8 @@ bool ConvertToHalfPass::ProcessConvert(Instruction* inst) { // changed to half. uint32_t val_id = inst->GetSingleWordInOperand(0); Instruction* val_inst = get_def_use_mgr()->GetDef(val_id); - if (inst->type_id() == val_inst->type_id()) inst->SetOpcode(SpvOpCopyObject); + if (inst->type_id() == val_inst->type_id()) + inst->SetOpcode(spv::Op::OpCopyObject); return true; // modified } @@ -251,7 +263,7 @@ bool ConvertToHalfPass::ProcessImageRef(Instruction* inst) { bool ConvertToHalfPass::ProcessDefault(Instruction* inst) { // If non-relaxed instruction has changed operands, need to convert // them back to float32 - if (inst->opcode() == SpvOpPhi) return ProcessPhi(inst, 16u, 32u); + if (inst->opcode() == spv::Op::OpPhi) return ProcessPhi(inst, 16u, 32u); bool modified = false; inst->ForEachInId([&inst, &modified, this](uint32_t* idp) { if (converted_ids_.count(*idp) == 0) return; @@ -269,9 +281,9 @@ bool ConvertToHalfPass::GenHalfInst(Instruction* inst) { bool inst_relaxed = IsRelaxed(inst->result_id()); if (IsArithmetic(inst) && inst_relaxed) modified = GenHalfArith(inst); - else if (inst->opcode() == SpvOpPhi && inst_relaxed) + else if (inst->opcode() == spv::Op::OpPhi && inst_relaxed) modified = ProcessPhi(inst, 32u, 16u); - else if (inst->opcode() == SpvOpFConvert) + else if (inst->opcode() == spv::Op::OpFConvert) modified = ProcessConvert(inst); else if (image_ops_.count(inst->opcode()) != 0) modified = ProcessImageRef(inst); @@ -293,6 +305,7 @@ bool ConvertToHalfPass::CloseRelaxInst(Instruction* inst) { bool relax = true; inst->ForEachInId([&relax, this](uint32_t* idp) { Instruction* op_inst = get_def_use_mgr()->GetDef(*idp); + if (IsStruct(op_inst)) relax = false; if (!IsFloat(op_inst, 32)) return; if (!IsRelaxed(*idp)) relax = false; }); @@ -304,7 +317,8 @@ bool ConvertToHalfPass::CloseRelaxInst(Instruction* inst) { relax = true; get_def_use_mgr()->ForEachUser(inst, [&relax, this](Instruction* uinst) { if (uinst->result_id() == 0 || !IsFloat(uinst, 32) || - (!IsDecoratedRelaxed(uinst) && !IsRelaxed(uinst->result_id()))) { + (!IsDecoratedRelaxed(uinst) && !IsRelaxed(uinst->result_id())) || + !CanRelaxOpOperands(uinst)) { relax = false; return; } @@ -350,7 +364,7 @@ Pass::Status ConvertToHalfPass::ProcessImpl() { }; bool modified = context()->ProcessReachableCallTree(pfn); // If modified, make sure module has Float16 capability - if (modified) context()->AddCapability(SpvCapabilityFloat16); + if (modified) context()->AddCapability(spv::Capability::Float16); // Remove all RelaxedPrecision decorations from instructions and globals for (auto c_id : relaxed_ids_set_) { modified |= RemoveRelaxedDecoration(c_id); @@ -371,44 +385,44 @@ Pass::Status ConvertToHalfPass::Process() { void ConvertToHalfPass::Initialize() { target_ops_core_ = { - SpvOpVectorExtractDynamic, - SpvOpVectorInsertDynamic, - SpvOpVectorShuffle, - SpvOpCompositeConstruct, - SpvOpCompositeInsert, - SpvOpCompositeExtract, - SpvOpCopyObject, - SpvOpTranspose, - SpvOpConvertSToF, - SpvOpConvertUToF, - // SpvOpFConvert, - // SpvOpQuantizeToF16, - SpvOpFNegate, - SpvOpFAdd, - SpvOpFSub, - SpvOpFMul, - SpvOpFDiv, - SpvOpFMod, - SpvOpVectorTimesScalar, - SpvOpMatrixTimesScalar, - SpvOpVectorTimesMatrix, - SpvOpMatrixTimesVector, - SpvOpMatrixTimesMatrix, - SpvOpOuterProduct, - SpvOpDot, - SpvOpSelect, - SpvOpFOrdEqual, - SpvOpFUnordEqual, - SpvOpFOrdNotEqual, - SpvOpFUnordNotEqual, - SpvOpFOrdLessThan, - SpvOpFUnordLessThan, - SpvOpFOrdGreaterThan, - SpvOpFUnordGreaterThan, - SpvOpFOrdLessThanEqual, - SpvOpFUnordLessThanEqual, - SpvOpFOrdGreaterThanEqual, - SpvOpFUnordGreaterThanEqual, + spv::Op::OpVectorExtractDynamic, + spv::Op::OpVectorInsertDynamic, + spv::Op::OpVectorShuffle, + spv::Op::OpCompositeConstruct, + spv::Op::OpCompositeInsert, + spv::Op::OpCompositeExtract, + spv::Op::OpCopyObject, + spv::Op::OpTranspose, + spv::Op::OpConvertSToF, + spv::Op::OpConvertUToF, + // spv::Op::OpFConvert, + // spv::Op::OpQuantizeToF16, + spv::Op::OpFNegate, + spv::Op::OpFAdd, + spv::Op::OpFSub, + spv::Op::OpFMul, + spv::Op::OpFDiv, + spv::Op::OpFMod, + spv::Op::OpVectorTimesScalar, + spv::Op::OpMatrixTimesScalar, + spv::Op::OpVectorTimesMatrix, + spv::Op::OpMatrixTimesVector, + spv::Op::OpMatrixTimesMatrix, + spv::Op::OpOuterProduct, + spv::Op::OpDot, + spv::Op::OpSelect, + spv::Op::OpFOrdEqual, + spv::Op::OpFUnordEqual, + spv::Op::OpFOrdNotEqual, + spv::Op::OpFUnordNotEqual, + spv::Op::OpFOrdLessThan, + spv::Op::OpFUnordLessThan, + spv::Op::OpFOrdGreaterThan, + spv::Op::OpFUnordGreaterThan, + spv::Op::OpFOrdLessThanEqual, + spv::Op::OpFUnordLessThanEqual, + spv::Op::OpFOrdGreaterThanEqual, + spv::Op::OpFUnordGreaterThanEqual, }; target_ops_450_ = { GLSLstd450Round, GLSLstd450RoundEven, GLSLstd450Trunc, GLSLstd450FAbs, @@ -427,53 +441,53 @@ void ConvertToHalfPass::Initialize() { GLSLstd450Ldexp, GLSLstd450Length, GLSLstd450Distance, GLSLstd450Cross, GLSLstd450Normalize, GLSLstd450FaceForward, GLSLstd450Reflect, GLSLstd450Refract, GLSLstd450NMin, GLSLstd450NMax, GLSLstd450NClamp}; - image_ops_ = {SpvOpImageSampleImplicitLod, - SpvOpImageSampleExplicitLod, - SpvOpImageSampleDrefImplicitLod, - SpvOpImageSampleDrefExplicitLod, - SpvOpImageSampleProjImplicitLod, - SpvOpImageSampleProjExplicitLod, - SpvOpImageSampleProjDrefImplicitLod, - SpvOpImageSampleProjDrefExplicitLod, - SpvOpImageFetch, - SpvOpImageGather, - SpvOpImageDrefGather, - SpvOpImageRead, - SpvOpImageSparseSampleImplicitLod, - SpvOpImageSparseSampleExplicitLod, - SpvOpImageSparseSampleDrefImplicitLod, - SpvOpImageSparseSampleDrefExplicitLod, - SpvOpImageSparseSampleProjImplicitLod, - SpvOpImageSparseSampleProjExplicitLod, - SpvOpImageSparseSampleProjDrefImplicitLod, - SpvOpImageSparseSampleProjDrefExplicitLod, - SpvOpImageSparseFetch, - SpvOpImageSparseGather, - SpvOpImageSparseDrefGather, - SpvOpImageSparseTexelsResident, - SpvOpImageSparseRead}; + image_ops_ = {spv::Op::OpImageSampleImplicitLod, + spv::Op::OpImageSampleExplicitLod, + spv::Op::OpImageSampleDrefImplicitLod, + spv::Op::OpImageSampleDrefExplicitLod, + spv::Op::OpImageSampleProjImplicitLod, + spv::Op::OpImageSampleProjExplicitLod, + spv::Op::OpImageSampleProjDrefImplicitLod, + spv::Op::OpImageSampleProjDrefExplicitLod, + spv::Op::OpImageFetch, + spv::Op::OpImageGather, + spv::Op::OpImageDrefGather, + spv::Op::OpImageRead, + spv::Op::OpImageSparseSampleImplicitLod, + spv::Op::OpImageSparseSampleExplicitLod, + spv::Op::OpImageSparseSampleDrefImplicitLod, + spv::Op::OpImageSparseSampleDrefExplicitLod, + spv::Op::OpImageSparseSampleProjImplicitLod, + spv::Op::OpImageSparseSampleProjExplicitLod, + spv::Op::OpImageSparseSampleProjDrefImplicitLod, + spv::Op::OpImageSparseSampleProjDrefExplicitLod, + spv::Op::OpImageSparseFetch, + spv::Op::OpImageSparseGather, + spv::Op::OpImageSparseDrefGather, + spv::Op::OpImageSparseTexelsResident, + spv::Op::OpImageSparseRead}; dref_image_ops_ = { - SpvOpImageSampleDrefImplicitLod, - SpvOpImageSampleDrefExplicitLod, - SpvOpImageSampleProjDrefImplicitLod, - SpvOpImageSampleProjDrefExplicitLod, - SpvOpImageDrefGather, - SpvOpImageSparseSampleDrefImplicitLod, - SpvOpImageSparseSampleDrefExplicitLod, - SpvOpImageSparseSampleProjDrefImplicitLod, - SpvOpImageSparseSampleProjDrefExplicitLod, - SpvOpImageSparseDrefGather, + spv::Op::OpImageSampleDrefImplicitLod, + spv::Op::OpImageSampleDrefExplicitLod, + spv::Op::OpImageSampleProjDrefImplicitLod, + spv::Op::OpImageSampleProjDrefExplicitLod, + spv::Op::OpImageDrefGather, + spv::Op::OpImageSparseSampleDrefImplicitLod, + spv::Op::OpImageSparseSampleDrefExplicitLod, + spv::Op::OpImageSparseSampleProjDrefImplicitLod, + spv::Op::OpImageSparseSampleProjDrefExplicitLod, + spv::Op::OpImageSparseDrefGather, }; closure_ops_ = { - SpvOpVectorExtractDynamic, - SpvOpVectorInsertDynamic, - SpvOpVectorShuffle, - SpvOpCompositeConstruct, - SpvOpCompositeInsert, - SpvOpCompositeExtract, - SpvOpCopyObject, - SpvOpTranspose, - SpvOpPhi, + spv::Op::OpVectorExtractDynamic, + spv::Op::OpVectorInsertDynamic, + spv::Op::OpVectorShuffle, + spv::Op::OpCompositeConstruct, + spv::Op::OpCompositeInsert, + spv::Op::OpCompositeExtract, + spv::Op::OpCopyObject, + spv::Op::OpTranspose, + spv::Op::OpPhi, }; relaxed_ids_set_.clear(); converted_ids_.clear(); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/convert_to_half_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/convert_to_half_pass.h index c6e84d1b..8e10c4fb 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/convert_to_half_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/convert_to_half_pass.h @@ -45,6 +45,7 @@ class ConvertToHalfPass : public Pass { // Return true if |inst| returns scalar, vector or matrix type with base // float and |width| bool IsFloat(Instruction* inst, uint32_t width); + bool IsStruct(Instruction* inst); // Return true if |inst| is decorated with RelaxedPrecision bool IsDecoratedRelaxed(Instruction* inst); @@ -55,6 +56,9 @@ class ConvertToHalfPass : public Pass { // Add |id| to the relaxed id set void AddRelaxed(uint32_t id); + // Return true if the instruction's operands can be relaxed + bool CanRelaxOpOperands(Instruction* inst); + // Return type id for float with |width| analysis::Type* FloatScalarType(uint32_t width); @@ -120,20 +124,26 @@ class ConvertToHalfPass : public Pass { // Initialize state for converting to half void Initialize(); + struct hasher { + size_t operator()(const spv::Op& op) const noexcept { + return std::hash()(uint32_t(op)); + } + }; + // Set of core operations to be processed - std::unordered_set target_ops_core_; + std::unordered_set target_ops_core_; // Set of 450 extension operations to be processed std::unordered_set target_ops_450_; - // Set of sample operations - std::unordered_set image_ops_; + // Set of all sample operations, including dref and non-dref operations + std::unordered_set image_ops_; - // Set of dref sample operations - std::unordered_set dref_image_ops_; + // Set of only dref sample operations + std::unordered_set dref_image_ops_; - // Set of dref sample operations - std::unordered_set closure_ops_; + // Set of operations that can be marked as relaxed + std::unordered_set closure_ops_; // Set of ids of all relaxed instructions std::unordered_set relaxed_ids_set_; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/convert_to_sampled_image_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/convert_to_sampled_image_pass.cpp index e84d3578..c82db41c 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/convert_to_sampled_image_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/convert_to_sampled_image_pass.cpp @@ -16,7 +16,6 @@ #include #include -#include #include "source/opt/ir_builder.h" #include "source/util/make_unique.h" @@ -70,7 +69,7 @@ uint32_t GetImageTypeOfSampledImage(analysis::TypeManager* type_mgr, Instruction* GetNonCopyObjectDef(analysis::DefUseManager* def_use_mgr, uint32_t inst_id) { Instruction* inst = def_use_mgr->GetDef(inst_id); - while (inst->opcode() == SpvOpCopyObject) { + while (inst->opcode() == spv::Op::OpCopyObject) { inst_id = inst->GetSingleWordInOperand(0u); inst = def_use_mgr->GetDef(inst_id); } @@ -87,8 +86,9 @@ bool ConvertToSampledImagePass::GetDescriptorSetBinding( bool found_binding_to_convert = false; for (auto decorate : decoration_manager->GetDecorationsFor(inst.result_id(), false)) { - uint32_t decoration = decorate->GetSingleWordInOperand(1u); - if (decoration == SpvDecorationDescriptorSet) { + spv::Decoration decoration = + spv::Decoration(decorate->GetSingleWordInOperand(1u)); + if (decoration == spv::Decoration::DescriptorSet) { if (found_descriptor_set_to_convert) { assert(false && "A resource has two OpDecorate for the descriptor set"); return false; @@ -96,7 +96,7 @@ bool ConvertToSampledImagePass::GetDescriptorSetBinding( descriptor_set_binding->descriptor_set = decorate->GetSingleWordInOperand(2u); found_descriptor_set_to_convert = true; - } else if (decoration == SpvDecorationBinding) { + } else if (decoration == spv::Decoration::Binding) { if (found_binding_to_convert) { assert(false && "A resource has two OpDecorate for the binding"); return false; @@ -116,7 +116,7 @@ bool ConvertToSampledImagePass::ShouldResourceBeConverted( const analysis::Type* ConvertToSampledImagePass::GetVariableType( const Instruction& variable) const { - if (variable.opcode() != SpvOpVariable) return nullptr; + if (variable.opcode() != spv::Op::OpVariable) return nullptr; auto* type = context()->get_type_mgr()->GetType(variable.type_id()); auto* pointer_type = type->AsPointer(); if (!pointer_type) return nullptr; @@ -124,12 +124,12 @@ const analysis::Type* ConvertToSampledImagePass::GetVariableType( return pointer_type->pointee_type(); } -SpvStorageClass ConvertToSampledImagePass::GetStorageClass( +spv::StorageClass ConvertToSampledImagePass::GetStorageClass( const Instruction& variable) const { - assert(variable.opcode() == SpvOpVariable); + assert(variable.opcode() == spv::Op::OpVariable); auto* type = context()->get_type_mgr()->GetType(variable.type_id()); auto* pointer_type = type->AsPointer(); - if (!pointer_type) return SpvStorageClassMax; + if (!pointer_type) return spv::StorageClass::Max; return pointer_type->storage_class(); } @@ -205,12 +205,12 @@ Pass::Status ConvertToSampledImagePass::Process() { void ConvertToSampledImagePass::FindUses(const Instruction* inst, std::vector* uses, - uint32_t user_opcode) const { + spv::Op user_opcode) const { auto* def_use_mgr = context()->get_def_use_mgr(); def_use_mgr->ForEachUser(inst, [uses, user_opcode, this](Instruction* user) { if (user->opcode() == user_opcode) { uses->push_back(user); - } else if (user->opcode() == SpvOpCopyObject) { + } else if (user->opcode() == spv::Op::OpCopyObject) { FindUses(user, uses, user_opcode); } }); @@ -221,21 +221,21 @@ void ConvertToSampledImagePass::FindUsesOfImage( auto* def_use_mgr = context()->get_def_use_mgr(); def_use_mgr->ForEachUser(image, [uses, this](Instruction* user) { switch (user->opcode()) { - case SpvOpImageFetch: - case SpvOpImageRead: - case SpvOpImageWrite: - case SpvOpImageQueryFormat: - case SpvOpImageQueryOrder: - case SpvOpImageQuerySizeLod: - case SpvOpImageQuerySize: - case SpvOpImageQueryLevels: - case SpvOpImageQuerySamples: - case SpvOpImageSparseFetch: + case spv::Op::OpImageFetch: + case spv::Op::OpImageRead: + case spv::Op::OpImageWrite: + case spv::Op::OpImageQueryFormat: + case spv::Op::OpImageQueryOrder: + case spv::Op::OpImageQuerySizeLod: + case spv::Op::OpImageQuerySize: + case spv::Op::OpImageQueryLevels: + case spv::Op::OpImageQuerySamples: + case spv::Op::OpImageSparseFetch: uses->push_back(user); default: break; } - if (user->opcode() == SpvOpCopyObject) { + if (user->opcode() == spv::Op::OpCopyObject) { FindUsesOfImage(user, uses); } }); @@ -248,7 +248,7 @@ Instruction* ConvertToSampledImagePass::CreateImageExtraction( IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); return builder.AddUnaryOp( GetImageTypeOfSampledImage(context()->get_type_mgr(), sampled_image), - SpvOpImage, sampled_image->result_id()); + spv::Op::OpImage, sampled_image->result_id()); } uint32_t ConvertToSampledImagePass::GetSampledImageTypeForImage( @@ -284,7 +284,7 @@ bool ConvertToSampledImagePass:: auto* def_use_mgr = context()->get_def_use_mgr(); uint32_t sampler_id = sampled_image_inst->GetSingleWordInOperand(1u); auto* sampler_load = def_use_mgr->GetDef(sampler_id); - if (sampler_load->opcode() != SpvOpLoad) return false; + if (sampler_load->opcode() != spv::Op::OpLoad) return false; auto* sampler = def_use_mgr->GetDef(sampler_load->GetSingleWordInOperand(0u)); DescriptorSetAndBinding sampler_descriptor_set_binding; return GetDescriptorSetBinding(*sampler, &sampler_descriptor_set_binding) && @@ -295,7 +295,7 @@ void ConvertToSampledImagePass::UpdateSampledImageUses( Instruction* image_load, Instruction* image_extraction, const DescriptorSetAndBinding& image_descriptor_set_binding) { std::vector sampled_image_users; - FindUses(image_load, &sampled_image_users, SpvOpSampledImage); + FindUses(image_load, &sampled_image_users, spv::Op::OpSampledImage); auto* def_use_mgr = context()->get_def_use_mgr(); for (auto* sampled_image_inst : sampled_image_users) { @@ -328,7 +328,7 @@ bool ConvertToSampledImagePass::ConvertImageVariableToSampledImage( context()->get_type_mgr()->GetType(sampled_image_type_id); if (sampled_image_type == nullptr) return false; auto storage_class = GetStorageClass(*image_variable); - if (storage_class == SpvStorageClassMax) return false; + if (storage_class == spv::StorageClass::Max) return false; analysis::Pointer sampled_image_pointer(sampled_image_type, storage_class); // Make sure |image_variable| is behind its type i.e., avoid the forward @@ -343,7 +343,7 @@ Pass::Status ConvertToSampledImagePass::UpdateImageVariableToSampledImage( Instruction* image_variable, const DescriptorSetAndBinding& descriptor_set_binding) { std::vector image_variable_loads; - FindUses(image_variable, &image_variable_loads, SpvOpLoad); + FindUses(image_variable, &image_variable_loads, spv::Op::OpLoad); if (image_variable_loads.empty()) return Status::SuccessWithoutChange; const uint32_t sampled_image_type_id = @@ -364,14 +364,14 @@ Pass::Status ConvertToSampledImagePass::UpdateImageVariableToSampledImage( bool ConvertToSampledImagePass::DoesSampledImageReferenceImage( Instruction* sampled_image_inst, Instruction* image_variable) { - if (sampled_image_inst->opcode() != SpvOpSampledImage) return false; + if (sampled_image_inst->opcode() != spv::Op::OpSampledImage) return false; auto* def_use_mgr = context()->get_def_use_mgr(); auto* image_load = GetNonCopyObjectDef( def_use_mgr, sampled_image_inst->GetSingleWordInOperand(0u)); - if (image_load->opcode() != SpvOpLoad) return false; + if (image_load->opcode() != spv::Op::OpLoad) return false; auto* image = GetNonCopyObjectDef(def_use_mgr, image_load->GetSingleWordInOperand(0u)); - return image->opcode() == SpvOpVariable && + return image->opcode() == spv::Op::OpVariable && image->result_id() == image_variable->result_id(); } @@ -381,10 +381,10 @@ Pass::Status ConvertToSampledImagePass::CheckUsesOfSamplerVariable( if (image_to_be_combined_with == nullptr) return Status::Failure; std::vector sampler_variable_loads; - FindUses(sampler_variable, &sampler_variable_loads, SpvOpLoad); + FindUses(sampler_variable, &sampler_variable_loads, spv::Op::OpLoad); for (auto* load : sampler_variable_loads) { std::vector sampled_image_users; - FindUses(load, &sampled_image_users, SpvOpSampledImage); + FindUses(load, &sampled_image_users, spv::Op::OpSampledImage); for (auto* sampled_image_inst : sampled_image_users) { if (!DoesSampledImageReferenceImage(sampled_image_inst, image_to_be_combined_with)) { diff --git a/bgfx/3rdparty/spirv-tools/source/opt/convert_to_sampled_image_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/convert_to_sampled_image_pass.h index d3938af7..a8b1501e 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/convert_to_sampled_image_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/convert_to_sampled_image_pass.h @@ -120,13 +120,13 @@ class ConvertToSampledImagePass : public Pass { const analysis::Type* GetVariableType(const Instruction& variable) const; // Returns the storage class of |variable|. - SpvStorageClass GetStorageClass(const Instruction& variable) const; + spv::StorageClass GetStorageClass(const Instruction& variable) const; // Finds |inst|'s users whose opcode is |user_opcode| or users of OpCopyObject // instructions of |inst| whose opcode is |user_opcode| and puts them in // |uses|. void FindUses(const Instruction* inst, std::vector* uses, - uint32_t user_opcode) const; + spv::Op user_opcode) const; // Finds OpImage* instructions using |image| or OpCopyObject instructions that // copy |image| and puts them in |uses|. diff --git a/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.cpp b/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.cpp index 0b235629..66a268fb 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.cpp @@ -22,12 +22,12 @@ namespace spvtools { namespace opt { namespace { -const uint32_t kLoadPointerInOperand = 0; -const uint32_t kStorePointerInOperand = 0; -const uint32_t kStoreObjectInOperand = 1; -const uint32_t kCompositeExtractObjectInOperand = 0; -const uint32_t kTypePointerStorageClassInIdx = 0; -const uint32_t kTypePointerPointeeInIdx = 1; +constexpr uint32_t kLoadPointerInOperand = 0; +constexpr uint32_t kStorePointerInOperand = 0; +constexpr uint32_t kStoreObjectInOperand = 1; +constexpr uint32_t kCompositeExtractObjectInOperand = 0; +constexpr uint32_t kTypePointerStorageClassInIdx = 0; +constexpr uint32_t kTypePointerPointeeInIdx = 1; bool IsDebugDeclareOrValue(Instruction* di) { auto dbg_opcode = di->GetCommonDebugOpcode(); @@ -46,8 +46,8 @@ Pass::Status CopyPropagateArrays::Process() { BasicBlock* entry_bb = &*function.begin(); - for (auto var_inst = entry_bb->begin(); var_inst->opcode() == SpvOpVariable; - ++var_inst) { + for (auto var_inst = entry_bb->begin(); + var_inst->opcode() == spv::Op::OpVariable; ++var_inst) { if (!IsPointerToArrayType(var_inst->type_id())) { continue; } @@ -76,7 +76,7 @@ Pass::Status CopyPropagateArrays::Process() { std::unique_ptr CopyPropagateArrays::FindSourceObjectIfPossible(Instruction* var_inst, Instruction* store_inst) { - assert(var_inst->opcode() == SpvOpVariable && "Expecting a variable."); + assert(var_inst->opcode() == spv::Op::OpVariable && "Expecting a variable."); // Check that the variable is a composite object where |store_inst| // dominates all of its loads. @@ -114,7 +114,7 @@ Instruction* CopyPropagateArrays::FindStoreInstruction( Instruction* store_inst = nullptr; get_def_use_mgr()->WhileEachUser( var_inst, [&store_inst, var_inst](Instruction* use) { - if (use->opcode() == SpvOpStore && + if (use->opcode() == spv::Op::OpStore && use->GetSingleWordInOperand(kStorePointerInOperand) == var_inst->result_id()) { if (store_inst == nullptr) { @@ -132,7 +132,7 @@ Instruction* CopyPropagateArrays::FindStoreInstruction( void CopyPropagateArrays::PropagateObject(Instruction* var_inst, MemoryObject* source, Instruction* insertion_point) { - assert(var_inst->opcode() == SpvOpVariable && + assert(var_inst->opcode() == spv::Op::OpVariable && "This function propagates variables."); Instruction* new_access_chain = BuildNewAccessChain(insertion_point, source); @@ -166,17 +166,17 @@ Instruction* CopyPropagateArrays::BuildNewAccessChain( bool CopyPropagateArrays::HasNoStores(Instruction* ptr_inst) { return get_def_use_mgr()->WhileEachUser(ptr_inst, [this](Instruction* use) { - if (use->opcode() == SpvOpLoad) { + if (use->opcode() == spv::Op::OpLoad) { return true; - } else if (use->opcode() == SpvOpAccessChain) { + } else if (use->opcode() == spv::Op::OpAccessChain) { return HasNoStores(use); - } else if (use->IsDecoration() || use->opcode() == SpvOpName) { + } else if (use->IsDecoration() || use->opcode() == spv::Op::OpName) { return true; - } else if (use->opcode() == SpvOpStore) { + } else if (use->opcode() == spv::Op::OpStore) { return false; - } else if (use->opcode() == SpvOpImageTexelPointer) { + } else if (use->opcode() == spv::Op::OpImageTexelPointer) { return true; - } else if (use->opcode() == SpvOpEntryPoint) { + } else if (use->opcode() == spv::Op::OpEntryPoint) { return true; } // Some other instruction. Be conservative. @@ -193,19 +193,19 @@ bool CopyPropagateArrays::HasValidReferencesOnly(Instruction* ptr_inst, return get_def_use_mgr()->WhileEachUser( ptr_inst, [this, store_inst, dominator_analysis, ptr_inst](Instruction* use) { - if (use->opcode() == SpvOpLoad || - use->opcode() == SpvOpImageTexelPointer) { + if (use->opcode() == spv::Op::OpLoad || + use->opcode() == spv::Op::OpImageTexelPointer) { // TODO: If there are many load in the same BB as |store_inst| the // time to do the multiple traverses can add up. Consider collecting // those loads and doing a single traversal. return dominator_analysis->Dominates(store_inst, use); - } else if (use->opcode() == SpvOpAccessChain) { + } else if (use->opcode() == spv::Op::OpAccessChain) { return HasValidReferencesOnly(use, store_inst); - } else if (use->IsDecoration() || use->opcode() == SpvOpName) { + } else if (use->IsDecoration() || use->opcode() == spv::Op::OpName) { return true; - } else if (use->opcode() == SpvOpStore) { + } else if (use->opcode() == spv::Op::OpStore) { // If we are storing to part of the object it is not an candidate. - return ptr_inst->opcode() == SpvOpVariable && + return ptr_inst->opcode() == spv::Op::OpVariable && store_inst->GetSingleWordInOperand(kStorePointerInOperand) == ptr_inst->result_id(); } else if (IsDebugDeclareOrValue(use)) { @@ -221,15 +221,15 @@ CopyPropagateArrays::GetSourceObjectIfAny(uint32_t result) { Instruction* result_inst = context()->get_def_use_mgr()->GetDef(result); switch (result_inst->opcode()) { - case SpvOpLoad: + case spv::Op::OpLoad: return BuildMemoryObjectFromLoad(result_inst); - case SpvOpCompositeExtract: + case spv::Op::OpCompositeExtract: return BuildMemoryObjectFromExtract(result_inst); - case SpvOpCompositeConstruct: + case spv::Op::OpCompositeConstruct: return BuildMemoryObjectFromCompositeConstruct(result_inst); - case SpvOpCopyObject: + case spv::Op::OpCopyObject: return GetSourceObjectIfAny(result_inst->GetSingleWordInOperand(0)); - case SpvOpCompositeInsert: + case spv::Op::OpCompositeInsert: return BuildMemoryObjectFromInsert(result_inst); default: return nullptr; @@ -251,7 +251,7 @@ CopyPropagateArrays::BuildMemoryObjectFromLoad(Instruction* load_inst) { // // It is built in reverse order because the different |OpAccessChain| // instructions are visited in reverse order from which they are applied. - while (current_inst->opcode() == SpvOpAccessChain) { + while (current_inst->opcode() == spv::Op::OpAccessChain) { for (uint32_t i = current_inst->NumInOperands() - 1; i >= 1; --i) { uint32_t element_index_id = current_inst->GetSingleWordInOperand(i); components_in_reverse.push_back(element_index_id); @@ -263,7 +263,7 @@ CopyPropagateArrays::BuildMemoryObjectFromLoad(Instruction* load_inst) { // instruction followed by a series of |OpAccessChain| instructions, then // return |nullptr| because we cannot identify the owner or access chain // exactly. - if (current_inst->opcode() != SpvOpVariable) { + if (current_inst->opcode() != spv::Op::OpVariable) { return nullptr; } @@ -276,7 +276,7 @@ CopyPropagateArrays::BuildMemoryObjectFromLoad(Instruction* load_inst) { std::unique_ptr CopyPropagateArrays::BuildMemoryObjectFromExtract(Instruction* extract_inst) { - assert(extract_inst->opcode() == SpvOpCompositeExtract && + assert(extract_inst->opcode() == spv::Op::OpCompositeExtract && "Expecting an OpCompositeExtract instruction."); std::unique_ptr result = GetSourceObjectIfAny( extract_inst->GetSingleWordInOperand(kCompositeExtractObjectInOperand)); @@ -297,7 +297,7 @@ CopyPropagateArrays::BuildMemoryObjectFromExtract(Instruction* extract_inst) { std::unique_ptr CopyPropagateArrays::BuildMemoryObjectFromCompositeConstruct( Instruction* conststruct_inst) { - assert(conststruct_inst->opcode() == SpvOpCompositeConstruct && + assert(conststruct_inst->opcode() == spv::Op::OpCompositeConstruct && "Expecting an OpCompositeConstruct instruction."); // If every operand in the instruction are part of the same memory object, and @@ -352,7 +352,7 @@ CopyPropagateArrays::BuildMemoryObjectFromCompositeConstruct( std::unique_ptr CopyPropagateArrays::BuildMemoryObjectFromInsert(Instruction* insert_inst) { - assert(insert_inst->opcode() == SpvOpCompositeInsert && + assert(insert_inst->opcode() == spv::Op::OpCompositeInsert && "Expecting an OpCompositeInsert instruction."); analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); @@ -407,7 +407,7 @@ CopyPropagateArrays::BuildMemoryObjectFromInsert(Instruction* insert_inst) { Instruction* current_insert = def_use_mgr->GetDef(insert_inst->GetSingleWordInOperand(1)); for (uint32_t i = number_of_elements - 1; i > 0; --i) { - if (current_insert->opcode() != SpvOpCompositeInsert) { + if (current_insert->opcode() != spv::Op::OpCompositeInsert) { return nullptr; } @@ -500,7 +500,7 @@ bool CopyPropagateArrays::CanUpdateUses(Instruction* original_ptr_inst, if (IsDebugDeclareOrValue(use)) return true; switch (use->opcode()) { - case SpvOpLoad: { + case spv::Op::OpLoad: { analysis::Pointer* pointer_type = type->AsPointer(); uint32_t new_type_id = type_mgr->GetId(pointer_type->pointee_type()); @@ -509,7 +509,7 @@ bool CopyPropagateArrays::CanUpdateUses(Instruction* original_ptr_inst, } return true; } - case SpvOpAccessChain: { + case spv::Op::OpAccessChain: { analysis::Pointer* pointer_type = type->AsPointer(); const analysis::Type* pointee_type = pointer_type->pointee_type(); @@ -547,7 +547,7 @@ bool CopyPropagateArrays::CanUpdateUses(Instruction* original_ptr_inst, } return true; } - case SpvOpCompositeExtract: { + case spv::Op::OpCompositeExtract: { std::vector access_chain; for (uint32_t i = 1; i < use->NumInOperands(); ++i) { access_chain.push_back(use->GetSingleWordInOperand(i)); @@ -565,13 +565,13 @@ bool CopyPropagateArrays::CanUpdateUses(Instruction* original_ptr_inst, } return true; } - case SpvOpStore: + case spv::Op::OpStore: // If needed, we can create an element-by-element copy to change the // type of the value being stored. This way we can always handled // stores. return true; - case SpvOpImageTexelPointer: - case SpvOpName: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpName: return true; default: return use->IsDecoration(); @@ -598,8 +598,8 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, if (use->IsCommonDebugInstr()) { switch (use->GetCommonDebugOpcode()) { case CommonDebugInfoDebugDeclare: { - if (new_ptr_inst->opcode() == SpvOpVariable || - new_ptr_inst->opcode() == SpvOpFunctionParameter) { + if (new_ptr_inst->opcode() == spv::Op::OpVariable || + new_ptr_inst->opcode() == spv::Op::OpFunctionParameter) { context()->ForgetUses(use); use->SetOperand(index, {new_ptr_inst->result_id()}); context()->AnalyzeUses(use); @@ -640,7 +640,7 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, } switch (use->opcode()) { - case SpvOpLoad: { + case spv::Op::OpLoad: { // Replace the actual use. context()->ForgetUses(use); use->SetOperand(index, {new_ptr_inst->result_id()}); @@ -658,7 +658,7 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, context()->AnalyzeUses(use); } } break; - case SpvOpAccessChain: { + case spv::Op::OpAccessChain: { // Update the actual use. context()->ForgetUses(use); use->SetOperand(index, {new_ptr_inst->result_id()}); @@ -685,7 +685,7 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, pointer_type_inst->GetSingleWordInOperand(kTypePointerPointeeInIdx), access_chain); - SpvStorageClass storage_class = static_cast( + spv::StorageClass storage_class = static_cast( pointer_type_inst->GetSingleWordInOperand( kTypePointerStorageClassInIdx)); @@ -700,7 +700,7 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, context()->AnalyzeUses(use); } } break; - case SpvOpCompositeExtract: { + case spv::Op::OpCompositeExtract: { // Update the actual use. context()->ForgetUses(use); use->SetOperand(index, {new_ptr_inst->result_id()}); @@ -721,7 +721,7 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, context()->AnalyzeUses(use); } } break; - case SpvOpStore: + case spv::Op::OpStore: // If the use is the pointer, then it is the single store to that // variable. We do not want to replace it. Instead, it will become // dead after all of the loads are removed, and ADCE will get rid of it. @@ -744,11 +744,11 @@ void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, context()->AnalyzeUses(use); } break; - case SpvOpDecorate: + case spv::Op::OpDecorate: // We treat an OpImageTexelPointer as a load. The result type should // always have the Image storage class, and should not need to be // updated. - case SpvOpImageTexelPointer: + case spv::Op::OpImageTexelPointer: // Replace the actual use. context()->ForgetUses(use); use->SetOperand(index, {new_ptr_inst->result_id()}); @@ -766,13 +766,13 @@ uint32_t CopyPropagateArrays::GetMemberTypeId( for (uint32_t element_index : access_chain) { Instruction* type_inst = get_def_use_mgr()->GetDef(id); switch (type_inst->opcode()) { - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: - case SpvOpTypeMatrix: - case SpvOpTypeVector: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeVector: id = type_inst->GetSingleWordInOperand(0); break; - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: id = type_inst->GetSingleWordInOperand(element_index); break; default: diff --git a/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.h b/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.h index 9e7641f6..7486f808 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.h @@ -134,13 +134,13 @@ class CopyPropagateArrays : public MemPass { var_pointer_inst->GetSingleWordInOperand(1), GetAccessIds()); uint32_t member_pointer_type_id = type_mgr->FindPointerToType( - member_type_id, static_cast( + member_type_id, static_cast( var_pointer_inst->GetSingleWordInOperand(0))); return member_pointer_type_id; } // Returns the storage class of the memory object. - SpvStorageClass GetStorageClass() const { + spv::StorageClass GetStorageClass() const { analysis::TypeManager* type_mgr = GetVariable()->context()->get_type_mgr(); const analysis::Pointer* pointer_type = diff --git a/bgfx/3rdparty/spirv-tools/source/opt/dataflow.cpp b/bgfx/3rdparty/spirv-tools/source/opt/dataflow.cpp index c91fad08..63737f19 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/dataflow.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/dataflow.cpp @@ -14,7 +14,6 @@ #include "source/opt/dataflow.h" -#include #include namespace spvtools { @@ -78,7 +77,7 @@ void ForwardDataFlowAnalysis::EnqueueUsers(Instruction* inst) { } void ForwardDataFlowAnalysis::EnqueueBlockSuccessors(Instruction* inst) { - if (inst->opcode() != SpvOpLabel) return; + if (inst->opcode() != spv::Op::OpLabel) return; context() .cfg() ->block(inst->result_id()) diff --git a/bgfx/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.cpp index d99b7f78..1526b9e0 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.cpp @@ -23,34 +23,30 @@ #include "source/cfa.h" #include "source/opt/ir_context.h" -#include "source/opt/iterator.h" #include "source/opt/struct_cfg_analysis.h" #include "source/util/make_unique.h" namespace spvtools { namespace opt { - namespace { - -const uint32_t kBranchCondTrueLabIdInIdx = 1; -const uint32_t kBranchCondFalseLabIdInIdx = 2; - -} // anonymous namespace +constexpr uint32_t kBranchCondTrueLabIdInIdx = 1; +constexpr uint32_t kBranchCondFalseLabIdInIdx = 2; +} // namespace bool DeadBranchElimPass::GetConstCondition(uint32_t condId, bool* condVal) { bool condIsConst; Instruction* cInst = get_def_use_mgr()->GetDef(condId); switch (cInst->opcode()) { - case SpvOpConstantNull: - case SpvOpConstantFalse: { + case spv::Op::OpConstantNull: + case spv::Op::OpConstantFalse: { *condVal = false; condIsConst = true; } break; - case SpvOpConstantTrue: { + case spv::Op::OpConstantTrue: { *condVal = true; condIsConst = true; } break; - case SpvOpLogicalNot: { + case spv::Op::OpLogicalNot: { bool negVal; condIsConst = GetConstCondition(cInst->GetSingleWordInOperand(0), &negVal); @@ -65,13 +61,13 @@ bool DeadBranchElimPass::GetConstInteger(uint32_t selId, uint32_t* selVal) { Instruction* sInst = get_def_use_mgr()->GetDef(selId); uint32_t typeId = sInst->type_id(); Instruction* typeInst = get_def_use_mgr()->GetDef(typeId); - if (!typeInst || (typeInst->opcode() != SpvOpTypeInt)) return false; + if (!typeInst || (typeInst->opcode() != spv::Op::OpTypeInt)) return false; // TODO(greg-lunarg): Support non-32 bit ints if (typeInst->GetSingleWordInOperand(0) != 32) return false; - if (sInst->opcode() == SpvOpConstant) { + if (sInst->opcode() == spv::Op::OpConstant) { *selVal = sInst->GetSingleWordInOperand(0); return true; - } else if (sInst->opcode() == SpvOpConstantNull) { + } else if (sInst->opcode() == spv::Op::OpConstantNull) { *selVal = 0; return true; } @@ -81,7 +77,7 @@ bool DeadBranchElimPass::GetConstInteger(uint32_t selId, uint32_t* selVal) { void DeadBranchElimPass::AddBranch(uint32_t labelId, BasicBlock* bp) { assert(get_def_use_mgr()->GetDef(labelId) != nullptr); std::unique_ptr newBranch( - new Instruction(context(), SpvOpBranch, 0, 0, + new Instruction(context(), spv::Op::OpBranch, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {labelId}}})); context()->AnalyzeDefUse(&*newBranch); context()->set_instr_block(&*newBranch, bp); @@ -115,13 +111,13 @@ bool DeadBranchElimPass::MarkLiveBlocks( Instruction* terminator = block->terminator(); uint32_t live_lab_id = 0; // Check if the terminator has a single valid successor. - if (terminator->opcode() == SpvOpBranchConditional) { + if (terminator->opcode() == spv::Op::OpBranchConditional) { bool condVal; if (GetConstCondition(terminator->GetSingleWordInOperand(0u), &condVal)) { live_lab_id = terminator->GetSingleWordInOperand( condVal ? kBranchCondTrueLabIdInIdx : kBranchCondFalseLabIdInIdx); } - } else if (terminator->opcode() == SpvOpSwitch) { + } else if (terminator->opcode() == spv::Op::OpSwitch) { uint32_t sel_val; if (GetConstInteger(terminator->GetSingleWordInOperand(0u), &sel_val)) { // Search switch operands for selector value, set live_lab_id to @@ -194,8 +190,8 @@ bool DeadBranchElimPass::SimplifyBranch(BasicBlock* block, uint32_t live_lab_id) { Instruction* merge_inst = block->GetMergeInst(); Instruction* terminator = block->terminator(); - if (merge_inst && merge_inst->opcode() == SpvOpSelectionMerge) { - if (merge_inst->NextNode()->opcode() == SpvOpSwitch && + if (merge_inst && merge_inst->opcode() == spv::Op::OpSelectionMerge) { + if (merge_inst->NextNode()->opcode() == spv::Op::OpSwitch && SwitchHasNestedBreak(block->id())) { if (terminator->NumInOperands() == 2) { // We cannot remove the branch, and it already has a single case, so no @@ -266,7 +262,7 @@ bool DeadBranchElimPass::FixPhiNodesInLiveBlocks( for (auto& block : *func) { if (live_blocks.count(&block)) { for (auto iter = block.begin(); iter != block.end();) { - if (iter->opcode() != SpvOpPhi) { + if (iter->opcode() != spv::Op::OpPhi) { break; } @@ -292,7 +288,7 @@ bool DeadBranchElimPass::FixPhiNodesInLiveBlocks( cont_iter->second == &block && inst->NumInOperands() > 4) { if (get_def_use_mgr() ->GetDef(inst->GetSingleWordInOperand(i - 1)) - ->opcode() == SpvOpUndef) { + ->opcode() == spv::Op::OpUndef) { // Already undef incoming value, no change necessary. operands.push_back(inst->GetInOperand(i - 1)); operands.push_back(inst->GetInOperand(i)); @@ -378,14 +374,14 @@ bool DeadBranchElimPass::EraseDeadBlocks( if (unreachable_continues.count(&*ebi)) { uint32_t cont_id = unreachable_continues.find(&*ebi)->second->id(); if (ebi->begin() != ebi->tail() || - ebi->terminator()->opcode() != SpvOpBranch || + ebi->terminator()->opcode() != spv::Op::OpBranch || ebi->terminator()->GetSingleWordInOperand(0u) != cont_id) { // Make unreachable, but leave the label. KillAllInsts(&*ebi, false); // Add unconditional branch to header. assert(unreachable_continues.count(&*ebi)); ebi->AddInstruction(MakeUnique( - context(), SpvOpBranch, 0, 0, + context(), spv::Op::OpBranch, 0, 0, std::initializer_list{{SPV_OPERAND_TYPE_ID, {cont_id}}})); get_def_use_mgr()->AnalyzeInstUse(&*ebi->tail()); context()->set_instr_block(&*ebi->tail(), &*ebi); @@ -394,12 +390,12 @@ bool DeadBranchElimPass::EraseDeadBlocks( ++ebi; } else if (unreachable_merges.count(&*ebi)) { if (ebi->begin() != ebi->tail() || - ebi->terminator()->opcode() != SpvOpUnreachable) { + ebi->terminator()->opcode() != spv::Op::OpUnreachable) { // Make unreachable, but leave the label. KillAllInsts(&*ebi, false); // Add unreachable terminator. ebi->AddInstruction( - MakeUnique(context(), SpvOpUnreachable, 0, 0, + MakeUnique(context(), spv::Op::OpUnreachable, 0, 0, std::initializer_list{})); context()->AnalyzeUses(ebi->terminator()); context()->set_instr_block(ebi->terminator(), &*ebi); @@ -465,7 +461,7 @@ void DeadBranchElimPass::FixBlockOrder() { }; // Structured order is more intuitive so use it where possible. - if (context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) { + if (context()->get_feature_mgr()->HasCapability(spv::Capability::Shader)) { context()->ProcessReachableCallTree(reorder_structured); } else { context()->ProcessReachableCallTree(reorder_dominators); @@ -477,7 +473,8 @@ Pass::Status DeadBranchElimPass::Process() { // support required in KillNamesAndDecorates(). // TODO(greg-lunarg): Add support for OpGroupDecorate for (auto& ai : get_module()->annotations()) - if (ai.opcode() == SpvOpGroupDecorate) return Status::SuccessWithoutChange; + if (ai.opcode() == spv::Op::OpGroupDecorate) + return Status::SuccessWithoutChange; // Process all entry point functions ProcessFunction pfn = [this](Function* fp) { return EliminateDeadBranches(fp); @@ -501,7 +498,7 @@ Instruction* DeadBranchElimPass::FindFirstExitFromSelectionMerge( Instruction* branch = start_block->terminator(); uint32_t next_block_id = 0; switch (branch->opcode()) { - case SpvOpBranchConditional: + case spv::Op::OpBranchConditional: next_block_id = start_block->MergeBlockIdIfAny(); if (next_block_id == 0) { // If a possible target is the |loop_merge_id| or |loop_continue_id|, @@ -530,7 +527,7 @@ Instruction* DeadBranchElimPass::FindFirstExitFromSelectionMerge( } } break; - case SpvOpSwitch: + case spv::Op::OpSwitch: next_block_id = start_block->MergeBlockIdIfAny(); if (next_block_id == 0) { // A switch with no merge instructions can have at most 5 targets: @@ -578,7 +575,7 @@ Instruction* DeadBranchElimPass::FindFirstExitFromSelectionMerge( // The fall through is case 3. } break; - case SpvOpBranch: + case spv::Op::OpBranch: // Need to check if this is the header of a loop nested in the // selection construct. next_block_id = start_block->MergeBlockIdIfAny(); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/dead_insert_elim_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/dead_insert_elim_pass.cpp index d877f0f9..a4869037 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/dead_insert_elim_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/dead_insert_elim_pass.cpp @@ -23,32 +23,29 @@ namespace spvtools { namespace opt { - namespace { - -const uint32_t kTypeVectorCountInIdx = 1; -const uint32_t kTypeMatrixCountInIdx = 1; -const uint32_t kTypeArrayLengthIdInIdx = 1; -const uint32_t kTypeIntWidthInIdx = 0; -const uint32_t kConstantValueInIdx = 0; -const uint32_t kInsertObjectIdInIdx = 0; -const uint32_t kInsertCompositeIdInIdx = 1; - -} // anonymous namespace +constexpr uint32_t kTypeVectorCountInIdx = 1; +constexpr uint32_t kTypeMatrixCountInIdx = 1; +constexpr uint32_t kTypeArrayLengthIdInIdx = 1; +constexpr uint32_t kTypeIntWidthInIdx = 0; +constexpr uint32_t kConstantValueInIdx = 0; +constexpr uint32_t kInsertObjectIdInIdx = 0; +constexpr uint32_t kInsertCompositeIdInIdx = 1; +} // namespace uint32_t DeadInsertElimPass::NumComponents(Instruction* typeInst) { switch (typeInst->opcode()) { - case SpvOpTypeVector: { + case spv::Op::OpTypeVector: { return typeInst->GetSingleWordInOperand(kTypeVectorCountInIdx); } break; - case SpvOpTypeMatrix: { + case spv::Op::OpTypeMatrix: { return typeInst->GetSingleWordInOperand(kTypeMatrixCountInIdx); } break; - case SpvOpTypeArray: { + case spv::Op::OpTypeArray: { uint32_t lenId = typeInst->GetSingleWordInOperand(kTypeArrayLengthIdInIdx); Instruction* lenInst = get_def_use_mgr()->GetDef(lenId); - if (lenInst->opcode() != SpvOpConstant) return 0; + if (lenInst->opcode() != spv::Op::OpConstant) return 0; uint32_t lenTypeId = lenInst->type_id(); Instruction* lenTypeInst = get_def_use_mgr()->GetDef(lenTypeId); // TODO(greg-lunarg): Support non-32-bit array length @@ -56,7 +53,7 @@ uint32_t DeadInsertElimPass::NumComponents(Instruction* typeInst) { return 0; return lenInst->GetSingleWordInOperand(kConstantValueInIdx); } break; - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { return typeInst->NumInOperands(); } break; default: { return 0; } break; @@ -68,10 +65,10 @@ void DeadInsertElimPass::MarkInsertChain( uint32_t extOffset, std::unordered_set* visited_phis) { // Not currently optimizing array inserts. Instruction* typeInst = get_def_use_mgr()->GetDef(insertChain->type_id()); - if (typeInst->opcode() == SpvOpTypeArray) return; + if (typeInst->opcode() == spv::Op::OpTypeArray) return; // Insert chains are only composed of inserts and phis - if (insertChain->opcode() != SpvOpCompositeInsert && - insertChain->opcode() != SpvOpPhi) + if (insertChain->opcode() != spv::Op::OpCompositeInsert && + insertChain->opcode() != spv::Op::OpPhi) return; // If extract indices are empty, mark all subcomponents if type // is constant length. @@ -89,7 +86,7 @@ void DeadInsertElimPass::MarkInsertChain( } } Instruction* insInst = insertChain; - while (insInst->opcode() == SpvOpCompositeInsert) { + while (insInst->opcode() == spv::Op::OpCompositeInsert) { // If no extract indices, mark insert and inserted object (which might // also be an insert chain) and continue up the chain though the input // composite. @@ -139,7 +136,7 @@ void DeadInsertElimPass::MarkInsertChain( insInst = get_def_use_mgr()->GetDef(compId); } // If insert chain ended with phi, do recursive call on each operand - if (insInst->opcode() != SpvOpPhi) return; + if (insInst->opcode() != spv::Op::OpPhi) return; // Mark phi visited to prevent potential infinite loop. If phi is already // visited, return to avoid infinite loop. if (visited_phis->count(insInst->result_id()) != 0) return; @@ -179,17 +176,17 @@ bool DeadInsertElimPass::EliminateDeadInsertsOnePass(Function* func) { for (auto bi = func->begin(); bi != func->end(); ++bi) { for (auto ii = bi->begin(); ii != bi->end(); ++ii) { // Only process Inserts and composite Phis - SpvOp op = ii->opcode(); + spv::Op op = ii->opcode(); Instruction* typeInst = get_def_use_mgr()->GetDef(ii->type_id()); - if (op != SpvOpCompositeInsert && - (op != SpvOpPhi || !spvOpcodeIsComposite(typeInst->opcode()))) + if (op != spv::Op::OpCompositeInsert && + (op != spv::Op::OpPhi || !spvOpcodeIsComposite(typeInst->opcode()))) continue; // The marking algorithm can be expensive for large arrays and the // efficacy of eliminating dead inserts into arrays is questionable. // Skip optimizing array inserts for now. Just mark them live. // TODO(greg-lunarg): Eliminate dead array inserts - if (op == SpvOpCompositeInsert) { - if (typeInst->opcode() == SpvOpTypeArray) { + if (op == spv::Op::OpCompositeInsert) { + if (typeInst->opcode() == spv::Op::OpTypeArray) { liveInserts_.insert(ii->result_id()); continue; } @@ -198,11 +195,11 @@ bool DeadInsertElimPass::EliminateDeadInsertsOnePass(Function* func) { get_def_use_mgr()->ForEachUser(id, [&ii, this](Instruction* user) { if (user->IsCommonDebugInstr()) return; switch (user->opcode()) { - case SpvOpCompositeInsert: - case SpvOpPhi: + case spv::Op::OpCompositeInsert: + case spv::Op::OpPhi: // Use by insert or phi does not initiate marking break; - case SpvOpCompositeExtract: { + case spv::Op::OpCompositeExtract: { // Capture extract indices std::vector extIndices; uint32_t icnt = 0; @@ -226,7 +223,7 @@ bool DeadInsertElimPass::EliminateDeadInsertsOnePass(Function* func) { std::vector dead_instructions; for (auto bi = func->begin(); bi != func->end(); ++bi) { for (auto ii = bi->begin(); ii != bi->end(); ++ii) { - if (ii->opcode() != SpvOpCompositeInsert) continue; + if (ii->opcode() != spv::Op::OpCompositeInsert) continue; const uint32_t id = ii->result_id(); if (liveInserts_.find(id) != liveInserts_.end()) continue; const uint32_t replId = diff --git a/bgfx/3rdparty/spirv-tools/source/opt/dead_variable_elimination.cpp b/bgfx/3rdparty/spirv-tools/source/opt/dead_variable_elimination.cpp index 28371068..e39132c2 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/dead_variable_elimination.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/dead_variable_elimination.cpp @@ -33,7 +33,7 @@ Pass::Status DeadVariableElimination::Process() { // Get the reference count for all of the global OpVariable instructions. for (auto& inst : context()->types_values()) { - if (inst.opcode() != SpvOp::SpvOpVariable) { + if (inst.opcode() != spv::Op::OpVariable) { continue; } @@ -43,11 +43,11 @@ Pass::Status DeadVariableElimination::Process() { // Check the linkage. If it is exported, it could be reference somewhere // else, so we must keep the variable around. get_decoration_mgr()->ForEachDecoration( - result_id, SpvDecorationLinkageAttributes, + result_id, uint32_t(spv::Decoration::LinkageAttributes), [&count](const Instruction& linkage_instruction) { uint32_t last_operand = linkage_instruction.NumOperands() - 1; - if (linkage_instruction.GetSingleWordOperand(last_operand) == - SpvLinkageTypeExport) { + if (spv::LinkageType(linkage_instruction.GetSingleWordOperand( + last_operand)) == spv::LinkageType::Export) { count = kMustKeep; } }); @@ -57,7 +57,8 @@ Pass::Status DeadVariableElimination::Process() { // at the uses and count the number of real references. count = 0; get_def_use_mgr()->ForEachUser(result_id, [&count](Instruction* user) { - if (!IsAnnotationInst(user->opcode()) && user->opcode() != SpvOpName) { + if (!IsAnnotationInst(user->opcode()) && + user->opcode() != spv::Op::OpName) { ++count; } }); @@ -81,7 +82,7 @@ Pass::Status DeadVariableElimination::Process() { void DeadVariableElimination::DeleteVariable(uint32_t result_id) { Instruction* inst = get_def_use_mgr()->GetDef(result_id); - assert(inst->opcode() == SpvOpVariable && + assert(inst->opcode() == spv::Op::OpVariable && "Should not be trying to delete anything other than an OpVariable."); // Look for an initializer that references another variable. We need to know @@ -93,7 +94,7 @@ void DeadVariableElimination::DeleteVariable(uint32_t result_id) { // TODO: Handle OpSpecConstantOP which might be defined in terms of other // variables. Will probably require a unified dead code pass that does all // instruction types. (Issue 906) - if (initializer->opcode() == SpvOpVariable) { + if (initializer->opcode() == spv::Op::OpVariable) { uint32_t initializer_id = initializer->result_id(); size_t& count = reference_count_[initializer_id]; if (count != kMustKeep) { diff --git a/bgfx/3rdparty/spirv-tools/source/opt/debug_info_manager.cpp b/bgfx/3rdparty/spirv-tools/source/opt/debug_info_manager.cpp index 3585186f..1e614c6f 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/debug_info_manager.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/debug_info_manager.cpp @@ -22,32 +22,31 @@ // Constants for OpenCL.DebugInfo.100 & NonSemantic.Shader.DebugInfo.100 // extension instructions. -static const uint32_t kOpLineOperandLineIndex = 1; -static const uint32_t kLineOperandIndexDebugFunction = 7; -static const uint32_t kLineOperandIndexDebugLexicalBlock = 5; -static const uint32_t kLineOperandIndexDebugLine = 5; -static const uint32_t kDebugFunctionOperandFunctionIndex = 13; -static const uint32_t kDebugFunctionDefinitionOperandDebugFunctionIndex = 4; -static const uint32_t kDebugFunctionDefinitionOperandOpFunctionIndex = 5; -static const uint32_t kDebugFunctionOperandParentIndex = 9; -static const uint32_t kDebugTypeCompositeOperandParentIndex = 9; -static const uint32_t kDebugLexicalBlockOperandParentIndex = 7; -static const uint32_t kDebugInlinedAtOperandInlinedIndex = 6; -static const uint32_t kDebugExpressOperandOperationIndex = 4; -static const uint32_t kDebugDeclareOperandLocalVariableIndex = 4; -static const uint32_t kDebugDeclareOperandVariableIndex = 5; -static const uint32_t kDebugValueOperandExpressionIndex = 6; -static const uint32_t kDebugOperationOperandOperationIndex = 4; -static const uint32_t kOpVariableOperandStorageClassIndex = 2; -static const uint32_t kDebugLocalVariableOperandParentIndex = 9; -static const uint32_t kExtInstInstructionInIdx = 1; -static const uint32_t kDebugGlobalVariableOperandFlagsIndex = 12; -static const uint32_t kDebugLocalVariableOperandFlagsIndex = 10; - namespace spvtools { namespace opt { namespace analysis { namespace { +constexpr uint32_t kOpLineOperandLineIndex = 1; +constexpr uint32_t kLineOperandIndexDebugFunction = 7; +constexpr uint32_t kLineOperandIndexDebugLexicalBlock = 5; +constexpr uint32_t kLineOperandIndexDebugLine = 5; +constexpr uint32_t kDebugFunctionOperandFunctionIndex = 13; +constexpr uint32_t kDebugFunctionDefinitionOperandDebugFunctionIndex = 4; +constexpr uint32_t kDebugFunctionDefinitionOperandOpFunctionIndex = 5; +constexpr uint32_t kDebugFunctionOperandParentIndex = 9; +constexpr uint32_t kDebugTypeCompositeOperandParentIndex = 9; +constexpr uint32_t kDebugLexicalBlockOperandParentIndex = 7; +constexpr uint32_t kDebugInlinedAtOperandInlinedIndex = 6; +constexpr uint32_t kDebugExpressOperandOperationIndex = 4; +constexpr uint32_t kDebugDeclareOperandLocalVariableIndex = 4; +constexpr uint32_t kDebugDeclareOperandVariableIndex = 5; +constexpr uint32_t kDebugValueOperandExpressionIndex = 6; +constexpr uint32_t kDebugOperationOperandOperationIndex = 4; +constexpr uint32_t kOpVariableOperandStorageClassIndex = 2; +constexpr uint32_t kDebugLocalVariableOperandParentIndex = 9; +constexpr uint32_t kExtInstInstructionInIdx = 1; +constexpr uint32_t kDebugGlobalVariableOperandFlagsIndex = 12; +constexpr uint32_t kDebugLocalVariableOperandFlagsIndex = 10; void SetInlinedOperand(Instruction* dbg_inlined_at, uint32_t inlined_operand) { assert(dbg_inlined_at); @@ -156,7 +155,8 @@ void DebugInfoManager::RegisterDbgDeclare(uint32_t var_id, uint32_t AddNewConstInGlobals(IRContext* context, uint32_t const_value) { uint32_t id = context->TakeNextId(); std::unique_ptr new_const(new Instruction( - context, SpvOpConstant, context->get_type_mgr()->GetUIntTypeId(), id, + context, spv::Op::OpConstant, context->get_type_mgr()->GetUIntTypeId(), + id, { {spv_operand_type_t::SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, {const_value}}, @@ -212,7 +212,7 @@ uint32_t DebugInfoManager::CreateDebugInlinedAt(const Instruction* line, break; } } else { - if (line->opcode() == SpvOpLine) { + if (line->opcode() == spv::Op::OpLine) { line_number = line->GetSingleWordOperand(kOpLineOperandLineIndex); } else if (line->GetShader100DebugOpcode() == NonSemanticShaderDebugInfo100DebugLine) { @@ -230,18 +230,19 @@ uint32_t DebugInfoManager::CreateDebugInlinedAt(const Instruction* line, // constants that may be generated here is likely not significant // and will likely be cleaned up in later passes. if (line_number_type == spv_operand_type_t::SPV_OPERAND_TYPE_ID && - line->opcode() == SpvOpLine) { + line->opcode() == spv::Op::OpLine) { if (!context()->AreAnalysesValid(IRContext::Analysis::kAnalysisDefUse) || !context()->AreAnalysesValid(IRContext::Analysis::kAnalysisConstants)) line_number = AddNewConstInGlobals(context(), line_number); else - line_number = context()->get_constant_mgr()->GetUIntConst(line_number); + line_number = + context()->get_constant_mgr()->GetUIntConstId(line_number); } } uint32_t result_id = context()->TakeNextId(); std::unique_ptr inlined_at(new Instruction( - context(), SpvOpExtInst, context()->get_type_mgr()->GetVoidTypeId(), + context(), spv::Op::OpExtInst, context()->get_type_mgr()->GetVoidTypeId(), result_id, { {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {setId}}, @@ -334,8 +335,8 @@ Instruction* DebugInfoManager::GetDebugOperationWithDeref() { if (context()->get_feature_mgr()->GetExtInstImportId_OpenCL100DebugInfo()) { deref_operation = std::unique_ptr(new Instruction( - context(), SpvOpExtInst, context()->get_type_mgr()->GetVoidTypeId(), - result_id, + context(), spv::Op::OpExtInst, + context()->get_type_mgr()->GetVoidTypeId(), result_id, { {SPV_OPERAND_TYPE_ID, {GetDbgSetImportId()}}, {SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER, @@ -344,11 +345,11 @@ Instruction* DebugInfoManager::GetDebugOperationWithDeref() { {static_cast(OpenCLDebugInfo100Deref)}}, })); } else { - uint32_t deref_id = context()->get_constant_mgr()->GetUIntConst( + uint32_t deref_id = context()->get_constant_mgr()->GetUIntConstId( NonSemanticShaderDebugInfo100Deref); deref_operation = std::unique_ptr( - new Instruction(context(), SpvOpExtInst, + new Instruction(context(), spv::Op::OpExtInst, context()->get_type_mgr()->GetVoidTypeId(), result_id, { {SPV_OPERAND_TYPE_ID, {GetDbgSetImportId()}}, @@ -390,7 +391,7 @@ Instruction* DebugInfoManager::GetDebugInfoNone() { uint32_t result_id = context()->TakeNextId(); std::unique_ptr dbg_info_none_inst(new Instruction( - context(), SpvOpExtInst, context()->get_type_mgr()->GetVoidTypeId(), + context(), spv::Op::OpExtInst, context()->get_type_mgr()->GetVoidTypeId(), result_id, { {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {GetDbgSetImportId()}}, @@ -414,7 +415,7 @@ Instruction* DebugInfoManager::GetEmptyDebugExpression() { uint32_t result_id = context()->TakeNextId(); std::unique_ptr empty_debug_expr(new Instruction( - context(), SpvOpExtInst, context()->get_type_mgr()->GetVoidTypeId(), + context(), spv::Op::OpExtInst, context()->get_type_mgr()->GetVoidTypeId(), result_id, { {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {GetDbgSetImportId()}}, @@ -527,7 +528,7 @@ bool DebugInfoManager::IsDeclareVisibleToInstr(Instruction* dbg_declare, assert(scope != nullptr); std::vector scope_ids; - if (scope->opcode() == SpvOpPhi) { + if (scope->opcode() == spv::Op::OpPhi) { scope_ids.push_back(scope->GetDebugScope().GetLexicalScope()); for (uint32_t i = 0; i < scope->NumInOperands(); i += 2) { auto* value = context()->get_def_use_mgr()->GetDef( @@ -571,8 +572,8 @@ bool DebugInfoManager::AddDebugValueForVariable(Instruction* scope_and_line, // Avoid inserting the new DebugValue between OpPhi or OpVariable // instructions. Instruction* insert_before = insert_pos->NextNode(); - while (insert_before->opcode() == SpvOpPhi || - insert_before->opcode() == SpvOpVariable) { + while (insert_before->opcode() == spv::Op::OpPhi || + insert_before->opcode() == spv::Op::OpVariable) { insert_before = insert_before->NextNode(); } modified |= AddDebugValueForDecl(dbg_decl_or_val, value_id, insert_before, @@ -653,9 +654,10 @@ uint32_t DebugInfoManager::GetVariableIdOfDebugValueUsedForDeclare( } auto* var = context()->get_def_use_mgr()->GetDef(var_id); - if (var->opcode() == SpvOpVariable && - SpvStorageClass(var->GetSingleWordOperand( - kOpVariableOperandStorageClassIndex)) == SpvStorageClassFunction) { + if (var->opcode() == spv::Op::OpVariable && + spv::StorageClass( + var->GetSingleWordOperand(kOpVariableOperandStorageClassIndex)) == + spv::StorageClass::Function) { return var_id; } return 0; @@ -762,8 +764,8 @@ void DebugInfoManager::ConvertDebugGlobalToLocalVariable( CommonDebugInfoDebugGlobalVariable) { return; } - assert(local_var->opcode() == SpvOpVariable || - local_var->opcode() == SpvOpFunctionParameter); + assert(local_var->opcode() == spv::Op::OpVariable || + local_var->opcode() == spv::Op::OpFunctionParameter); // Convert |dbg_global_var| to DebugLocalVariable dbg_global_var->SetInOperand(kExtInstInstructionInIdx, @@ -780,7 +782,7 @@ void DebugInfoManager::ConvertDebugGlobalToLocalVariable( // Create a DebugDeclare std::unique_ptr new_dbg_decl(new Instruction( - context(), SpvOpExtInst, context()->get_type_mgr()->GetVoidTypeId(), + context(), spv::Op::OpExtInst, context()->get_type_mgr()->GetVoidTypeId(), context()->TakeNextId(), { {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {GetDbgSetImportId()}}, @@ -794,7 +796,7 @@ void DebugInfoManager::ConvertDebugGlobalToLocalVariable( })); // Must insert after all OpVariables in block Instruction* insert_before = local_var; - while (insert_before->opcode() == SpvOpVariable) + while (insert_before->opcode() == spv::Op::OpVariable) insert_before = insert_before->NextNode(); auto* added_dbg_decl = insert_before->InsertBefore(std::move(new_dbg_decl)); if (context()->AreAnalysesValid(IRContext::Analysis::kAnalysisDefUse)) diff --git a/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.cpp b/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.cpp index 2146c359..3e95dbc3 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.cpp @@ -22,6 +22,9 @@ #include "source/opt/ir_context.h" +namespace spvtools { +namespace opt { +namespace analysis { namespace { using InstructionVector = std::vector; using DecorationSet = std::set; @@ -49,10 +52,6 @@ bool IsSubset(const DecorationSet& a, const DecorationSet& b) { } } // namespace -namespace spvtools { -namespace opt { -namespace analysis { - bool DecorationManager::RemoveDecorationsFrom( uint32_t id, std::function pred) { bool was_modified = false; @@ -76,8 +75,8 @@ bool DecorationManager::RemoveDecorationsFrom( // applying the group. std::unordered_set indirect_decorations_to_remove; for (Instruction* inst : decorations_info.indirect_decorations) { - assert(inst->opcode() == SpvOpGroupDecorate || - inst->opcode() == SpvOpGroupMemberDecorate); + assert(inst->opcode() == spv::Op::OpGroupDecorate || + inst->opcode() == spv::Op::OpGroupMemberDecorate); std::vector group_decorations_to_keep; const uint32_t group_id = inst->GetSingleWordInOperand(0u); @@ -99,7 +98,8 @@ bool DecorationManager::RemoveDecorationsFrom( } // Otherwise, remove |id| from the targets of |group_id| - const uint32_t stride = inst->opcode() == SpvOpGroupDecorate ? 1u : 2u; + const uint32_t stride = + inst->opcode() == spv::Op::OpGroupDecorate ? 1u : 2u; for (uint32_t i = 1u; i < inst->NumInOperands();) { if (inst->GetSingleWordInOperand(i) != id) { i += stride; @@ -212,16 +212,16 @@ bool DecorationManager::HaveTheSameDecorations(uint32_t id1, } switch (inst->opcode()) { - case SpvOpDecorate: + case spv::Op::OpDecorate: decorate_set->emplace(std::move(decoration_payload)); break; - case SpvOpMemberDecorate: + case spv::Op::OpMemberDecorate: member_decorate_set->emplace(std::move(decoration_payload)); break; - case SpvOpDecorateId: + case spv::Op::OpDecorateId: decorate_id_set->emplace(std::move(decoration_payload)); break; - case SpvOpDecorateStringGOOGLE: + case spv::Op::OpDecorateStringGOOGLE: decorate_string_set->emplace(std::move(decoration_payload)); break; default: @@ -278,16 +278,16 @@ bool DecorationManager::HaveSubsetOfDecorations(uint32_t id1, } switch (inst->opcode()) { - case SpvOpDecorate: + case spv::Op::OpDecorate: decorate_set->emplace(std::move(decoration_payload)); break; - case SpvOpMemberDecorate: + case spv::Op::OpMemberDecorate: member_decorate_set->emplace(std::move(decoration_payload)); break; - case SpvOpDecorateId: + case spv::Op::OpDecorateId: decorate_id_set->emplace(std::move(decoration_payload)); break; - case SpvOpDecorateStringGOOGLE: + case spv::Op::OpDecorateStringGOOGLE: decorate_string_set->emplace(std::move(decoration_payload)); break; default: @@ -328,10 +328,10 @@ bool DecorationManager::AreDecorationsTheSame(const Instruction* inst1, const Instruction* inst2, bool ignore_target) const { switch (inst1->opcode()) { - case SpvOpDecorate: - case SpvOpMemberDecorate: - case SpvOpDecorateId: - case SpvOpDecorateStringGOOGLE: + case spv::Op::OpDecorate: + case spv::Op::OpMemberDecorate: + case spv::Op::OpDecorateId: + case spv::Op::OpDecorateStringGOOGLE: break; default: return false; @@ -358,17 +358,18 @@ void DecorationManager::AnalyzeDecorations() { void DecorationManager::AddDecoration(Instruction* inst) { switch (inst->opcode()) { - case SpvOpDecorate: - case SpvOpDecorateId: - case SpvOpDecorateStringGOOGLE: - case SpvOpMemberDecorate: { + case spv::Op::OpDecorate: + case spv::Op::OpDecorateId: + case spv::Op::OpDecorateStringGOOGLE: + case spv::Op::OpMemberDecorate: { const auto target_id = inst->GetSingleWordInOperand(0u); id_to_decoration_insts_[target_id].direct_decorations.push_back(inst); break; } - case SpvOpGroupDecorate: - case SpvOpGroupMemberDecorate: { - const uint32_t start = inst->opcode() == SpvOpGroupDecorate ? 1u : 2u; + case spv::Op::OpGroupDecorate: + case spv::Op::OpGroupMemberDecorate: { + const uint32_t start = + inst->opcode() == spv::Op::OpGroupDecorate ? 1u : 2u; const uint32_t stride = start; for (uint32_t i = start; i < inst->NumInOperands(); i += stride) { const auto target_id = inst->GetSingleWordInOperand(i); @@ -384,7 +385,7 @@ void DecorationManager::AddDecoration(Instruction* inst) { } } -void DecorationManager::AddDecoration(SpvOp opcode, +void DecorationManager::AddDecoration(spv::Op opcode, std::vector opnds) { IRContext* ctx = module_->context(); std::unique_ptr newDecoOp( @@ -394,7 +395,7 @@ void DecorationManager::AddDecoration(SpvOp opcode, void DecorationManager::AddDecoration(uint32_t inst_id, uint32_t decoration) { AddDecoration( - SpvOpDecorate, + spv::Op::OpDecorate, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {inst_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, {decoration}}}); } @@ -402,7 +403,7 @@ void DecorationManager::AddDecoration(uint32_t inst_id, uint32_t decoration) { void DecorationManager::AddDecorationVal(uint32_t inst_id, uint32_t decoration, uint32_t decoration_value) { AddDecoration( - SpvOpDecorate, + spv::Op::OpDecorate, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {inst_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, {decoration}}, {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, @@ -413,7 +414,7 @@ void DecorationManager::AddMemberDecoration(uint32_t inst_id, uint32_t member, uint32_t decoration, uint32_t decoration_value) { AddDecoration( - SpvOpMemberDecorate, + spv::Op::OpMemberDecorate, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {inst_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, {member}}, {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, {decoration}}, @@ -436,9 +437,10 @@ std::vector DecorationManager::InternalGetDecorationsFor( [include_linkage, &decorations](const std::vector& direct_decorations) { for (Instruction* inst : direct_decorations) { - const bool is_linkage = inst->opcode() == SpvOpDecorate && - inst->GetSingleWordInOperand(1u) == - SpvDecorationLinkageAttributes; + const bool is_linkage = + inst->opcode() == spv::Op::OpDecorate && + spv::Decoration(inst->GetSingleWordInOperand(1u)) == + spv::Decoration::LinkageAttributes; if (include_linkage || !is_linkage) decorations.push_back(inst); } }; @@ -459,17 +461,17 @@ std::vector DecorationManager::InternalGetDecorationsFor( bool DecorationManager::WhileEachDecoration( uint32_t id, uint32_t decoration, - std::function f) { + std::function f) const { for (const Instruction* inst : GetDecorationsFor(id, true)) { switch (inst->opcode()) { - case SpvOpMemberDecorate: + case spv::Op::OpMemberDecorate: if (inst->GetSingleWordInOperand(2) == decoration) { if (!f(*inst)) return false; } break; - case SpvOpDecorate: - case SpvOpDecorateId: - case SpvOpDecorateStringGOOGLE: + case spv::Op::OpDecorate: + case spv::Op::OpDecorateId: + case spv::Op::OpDecorateStringGOOGLE: if (inst->GetSingleWordInOperand(1) == decoration) { if (!f(*inst)) return false; } @@ -483,14 +485,19 @@ bool DecorationManager::WhileEachDecoration( void DecorationManager::ForEachDecoration( uint32_t id, uint32_t decoration, - std::function f) { + std::function f) const { WhileEachDecoration(id, decoration, [&f](const Instruction& inst) { f(inst); return true; }); } -bool DecorationManager::HasDecoration(uint32_t id, uint32_t decoration) { +bool DecorationManager::HasDecoration(uint32_t id, + spv::Decoration decoration) const { + return HasDecoration(id, static_cast(decoration)); +} + +bool DecorationManager::HasDecoration(uint32_t id, uint32_t decoration) const { bool has_decoration = false; ForEachDecoration(id, decoration, [&has_decoration](const Instruction&) { has_decoration = true; @@ -523,14 +530,14 @@ void DecorationManager::CloneDecorations(uint32_t from, uint32_t to) { decoration_list->second.indirect_decorations; for (Instruction* inst : indirect_decorations) { switch (inst->opcode()) { - case SpvOpGroupDecorate: + case spv::Op::OpGroupDecorate: context->ForgetUses(inst); // add |to| to list of decorated id's inst->AddOperand( Operand(spv_operand_type_t::SPV_OPERAND_TYPE_ID, {to})); context->AnalyzeUses(inst); break; - case SpvOpGroupMemberDecorate: { + case spv::Op::OpGroupMemberDecorate: { context->ForgetUses(inst); // for each (id == from), add (to, literal) as operands const uint32_t num_operands = inst->NumOperands(); @@ -554,13 +561,13 @@ void DecorationManager::CloneDecorations(uint32_t from, uint32_t to) { void DecorationManager::CloneDecorations( uint32_t from, uint32_t to, - const std::vector& decorations_to_copy) { + const std::vector& decorations_to_copy) { const auto decoration_list = id_to_decoration_insts_.find(from); if (decoration_list == id_to_decoration_insts_.end()) return; auto context = module_->context(); for (Instruction* inst : decoration_list->second.direct_decorations) { if (std::find(decorations_to_copy.begin(), decorations_to_copy.end(), - inst->GetSingleWordInOperand(1)) == + spv::Decoration(inst->GetSingleWordInOperand(1))) == decorations_to_copy.end()) { continue; } @@ -579,11 +586,11 @@ void DecorationManager::CloneDecorations( decoration_list->second.indirect_decorations; for (Instruction* inst : indirect_decorations) { switch (inst->opcode()) { - case SpvOpGroupDecorate: + case spv::Op::OpGroupDecorate: CloneDecorations(inst->GetSingleWordInOperand(0), to, decorations_to_copy); break; - case SpvOpGroupMemberDecorate: { + case spv::Op::OpGroupMemberDecorate: { assert(false && "The source id is not suppose to be a type."); break; } @@ -599,18 +606,19 @@ void DecorationManager::RemoveDecoration(Instruction* inst) { }; switch (inst->opcode()) { - case SpvOpDecorate: - case SpvOpDecorateId: - case SpvOpDecorateStringGOOGLE: - case SpvOpMemberDecorate: { + case spv::Op::OpDecorate: + case spv::Op::OpDecorateId: + case spv::Op::OpDecorateStringGOOGLE: + case spv::Op::OpMemberDecorate: { const auto target_id = inst->GetSingleWordInOperand(0u); auto const iter = id_to_decoration_insts_.find(target_id); if (iter == id_to_decoration_insts_.end()) return; remove_from_container(iter->second.direct_decorations); } break; - case SpvOpGroupDecorate: - case SpvOpGroupMemberDecorate: { - const uint32_t stride = inst->opcode() == SpvOpGroupDecorate ? 1u : 2u; + case spv::Op::OpGroupDecorate: + case spv::Op::OpGroupMemberDecorate: { + const uint32_t stride = + inst->opcode() == spv::Op::OpGroupDecorate ? 1u : 2u; for (uint32_t i = 1u; i < inst->NumInOperands(); i += stride) { const auto target_id = inst->GetSingleWordInOperand(i); auto const iter = id_to_decoration_insts_.find(target_id); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.h b/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.h index fe78f2ce..08cb2f34 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.h @@ -71,14 +71,14 @@ class DecorationManager { bool include_linkage); std::vector GetDecorationsFor(uint32_t id, bool include_linkage) const; - // Returns whether two IDs have the same decorations. Two SpvOpGroupDecorate - // instructions that apply the same decorations but to different IDs, still - // count as being the same. + // Returns whether two IDs have the same decorations. Two + // spv::Op::OpGroupDecorate instructions that apply the same decorations but + // to different IDs, still count as being the same. bool HaveTheSameDecorations(uint32_t id1, uint32_t id2) const; - // Returns whether two IDs have the same decorations. Two SpvOpGroupDecorate - // instructions that apply the same decorations but to different IDs, still - // count as being the same. + // Returns whether two IDs have the same decorations. Two + // spv::Op::OpGroupDecorate instructions that apply the same decorations but + // to different IDs, still count as being the same. bool HaveSubsetOfDecorations(uint32_t id1, uint32_t id2) const; // Returns whether the two decorations instructions are the same and are @@ -92,20 +92,21 @@ class DecorationManager { // Returns whether a decoration instruction for |id| with decoration // |decoration| exists or not. - bool HasDecoration(uint32_t id, uint32_t decoration); + bool HasDecoration(uint32_t id, uint32_t decoration) const; + bool HasDecoration(uint32_t id, spv::Decoration decoration) const; // |f| is run on each decoration instruction for |id| with decoration // |decoration|. Processed are all decorations which target |id| either // directly or indirectly by Decoration Groups. void ForEachDecoration(uint32_t id, uint32_t decoration, - std::function f); + std::function f) const; // |f| is run on each decoration instruction for |id| with decoration // |decoration|. Processes all decoration which target |id| either directly or // indirectly through decoration groups. If |f| returns false, iteration is // terminated and this function returns false. bool WhileEachDecoration(uint32_t id, uint32_t decoration, - std::function f); + std::function f) const; // |f| is run on each decoration instruction for |id| with decoration // |decoration|. Processes all decoration which target |id| either directly or @@ -123,14 +124,15 @@ class DecorationManager { // Same as above, but only clone the decoration if the decoration operand is // in |decorations_to_copy|. This function has the extra restriction that // |from| and |to| must not be an object, not a type. - void CloneDecorations(uint32_t from, uint32_t to, - const std::vector& decorations_to_copy); + void CloneDecorations( + uint32_t from, uint32_t to, + const std::vector& decorations_to_copy); // Informs the decoration manager of a new decoration that it needs to track. void AddDecoration(Instruction* inst); // Add decoration with |opcode| and operands |opnds|. - void AddDecoration(SpvOp opcode, const std::vector opnds); + void AddDecoration(spv::Op opcode, const std::vector opnds); // Add |decoration| of |inst_id| to module. void AddDecoration(uint32_t inst_id, uint32_t decoration); @@ -195,9 +197,9 @@ class DecorationManager { // Mapping from ids to the instructions applying a decoration to those ids. // In other words, for each id you get all decoration instructions - // referencing that id, be it directly (SpvOpDecorate, SpvOpMemberDecorate - // and SpvOpDecorateId), or indirectly (SpvOpGroupDecorate, - // SpvOpMemberGroupDecorate). + // referencing that id, be it directly (spv::Op::OpDecorate, + // spv::Op::OpMemberDecorate and spv::Op::OpDecorateId), or indirectly + // (spv::Op::OpGroupDecorate, spv::Op::OpMemberGroupDecorate). std::unordered_map id_to_decoration_insts_; // The enclosing module. Module* module_; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/desc_sroa.cpp b/bgfx/3rdparty/spirv-tools/source/opt/desc_sroa.cpp index b130ca80..8da0c864 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/desc_sroa.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/desc_sroa.cpp @@ -22,8 +22,9 @@ namespace opt { namespace { bool IsDecorationBinding(Instruction* inst) { - if (inst->opcode() != SpvOpDecorate) return false; - return inst->GetSingleWordInOperand(1u) == SpvDecorationBinding; + if (inst->opcode() != spv::Op::OpDecorate) return false; + return spv::Decoration(inst->GetSingleWordInOperand(1u)) == + spv::Decoration::Binding; } } // namespace @@ -56,7 +57,7 @@ bool DescriptorScalarReplacement::ReplaceCandidate(Instruction* var) { bool failed = !get_def_use_mgr()->WhileEachUser( var->result_id(), [this, &access_chain_work_list, &load_work_list](Instruction* use) { - if (use->opcode() == SpvOpName) { + if (use->opcode() == spv::Op::OpName) { return true; } @@ -65,11 +66,11 @@ bool DescriptorScalarReplacement::ReplaceCandidate(Instruction* var) { } switch (use->opcode()) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: access_chain_work_list.push_back(use); return true; - case SpvOpLoad: + case spv::Op::OpLoad: load_work_list.push_back(use); return true; default: @@ -184,7 +185,7 @@ void DescriptorScalarReplacement::CopyDecorationsForNewVariable( // Handle OpMemberDecorate instructions. for (auto old_decoration : get_decoration_mgr()->GetDecorationsFor( old_var_type->result_id(), true)) { - assert(old_decoration->opcode() == SpvOpMemberDecorate); + assert(old_decoration->opcode() == spv::Op::OpMemberDecorate); if (old_decoration->GetSingleWordInOperand(1u) != index) continue; CreateNewDecorationForMemberDecorate(old_decoration, new_var_id); } @@ -212,8 +213,8 @@ uint32_t DescriptorScalarReplacement::GetNewBindingForElement( void DescriptorScalarReplacement::CreateNewDecorationForNewVariable( Instruction* old_decoration, uint32_t new_var_id, uint32_t new_binding) { - assert(old_decoration->opcode() == SpvOpDecorate || - old_decoration->opcode() == SpvOpDecorateString); + assert(old_decoration->opcode() == spv::Op::OpDecorate || + old_decoration->opcode() == spv::Op::OpDecorateString); std::unique_ptr new_decoration(old_decoration->Clone(context())); new_decoration->SetInOperand(0, {new_var_id}); @@ -231,25 +232,25 @@ void DescriptorScalarReplacement::CreateNewDecorationForMemberDecorate( auto new_decorate_operand_end = old_member_decoration->end(); operands.insert(operands.end(), new_decorate_operand_begin, new_decorate_operand_end); - get_decoration_mgr()->AddDecoration(SpvOpDecorate, std::move(operands)); + get_decoration_mgr()->AddDecoration(spv::Op::OpDecorate, std::move(operands)); } uint32_t DescriptorScalarReplacement::CreateReplacementVariable( Instruction* var, uint32_t idx) { // The storage class for the new variable is the same as the original. - SpvStorageClass storage_class = - static_cast(var->GetSingleWordInOperand(0)); + spv::StorageClass storage_class = + static_cast(var->GetSingleWordInOperand(0)); // The type for the new variable will be a pointer to type of the elements of // the array. uint32_t ptr_type_id = var->type_id(); Instruction* ptr_type_inst = get_def_use_mgr()->GetDef(ptr_type_id); - assert(ptr_type_inst->opcode() == SpvOpTypePointer && + assert(ptr_type_inst->opcode() == spv::Op::OpTypePointer && "Variable should be a pointer to an array or structure."); uint32_t pointee_type_id = ptr_type_inst->GetSingleWordInOperand(1); Instruction* pointee_type_inst = get_def_use_mgr()->GetDef(pointee_type_id); - const bool is_array = pointee_type_inst->opcode() == SpvOpTypeArray; - const bool is_struct = pointee_type_inst->opcode() == SpvOpTypeStruct; + const bool is_array = pointee_type_inst->opcode() == spv::Op::OpTypeArray; + const bool is_struct = pointee_type_inst->opcode() == spv::Op::OpTypeStruct; assert((is_array || is_struct) && "Variable should be a pointer to an array or structure."); @@ -263,7 +264,7 @@ uint32_t DescriptorScalarReplacement::CreateReplacementVariable( // Create the variable. uint32_t id = TakeNextId(); std::unique_ptr variable( - new Instruction(context(), SpvOpVariable, ptr_element_type_id, id, + new Instruction(context(), spv::Op::OpVariable, ptr_element_type_id, id, std::initializer_list{ {SPV_OPERAND_TYPE_STORAGE_CLASS, {static_cast(storage_class)}}})); @@ -293,7 +294,7 @@ uint32_t DescriptorScalarReplacement::CreateReplacementVariable( } std::unique_ptr new_name(new Instruction( - context(), SpvOpName, 0, 0, + context(), spv::Op::OpName, 0, 0, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {id}}, {SPV_OPERAND_TYPE_LITERAL_STRING, utils::MakeVector(name_str)}})); @@ -315,14 +316,14 @@ uint32_t DescriptorScalarReplacement::GetNumBindingsUsedByType( Instruction* type_inst = get_def_use_mgr()->GetDef(type_id); // If it's a pointer, look at the underlying type. - if (type_inst->opcode() == SpvOpTypePointer) { + if (type_inst->opcode() == spv::Op::OpTypePointer) { type_id = type_inst->GetSingleWordInOperand(1); type_inst = get_def_use_mgr()->GetDef(type_id); } // Arrays consume N*M binding numbers where N is the array length, and M is // the number of bindings used by each array element. - if (type_inst->opcode() == SpvOpTypeArray) { + if (type_inst->opcode() == spv::Op::OpTypeArray) { uint32_t element_type_id = type_inst->GetSingleWordInOperand(0); uint32_t length_id = type_inst->GetSingleWordInOperand(1); const analysis::Constant* length_const = @@ -335,7 +336,7 @@ uint32_t DescriptorScalarReplacement::GetNumBindingsUsedByType( // The number of bindings consumed by a structure is the sum of the bindings // used by its members. - if (type_inst->opcode() == SpvOpTypeStruct && + if (type_inst->opcode() == spv::Op::OpTypeStruct && !descsroautil::IsTypeOfStructuredBuffer(context(), type_inst)) { uint32_t sum = 0; for (uint32_t i = 0; i < type_inst->NumInOperands(); i++) @@ -353,12 +354,12 @@ bool DescriptorScalarReplacement::ReplaceLoadedValue(Instruction* var, // |value| is the OpLoad instruction that has loaded |var|. // The function expects all users of |value| to be OpCompositeExtract // instructions. Otherwise the function returns false with an error message. - assert(value->opcode() == SpvOpLoad); + assert(value->opcode() == spv::Op::OpLoad); assert(value->GetSingleWordInOperand(0) == var->result_id()); std::vector work_list; bool failed = !get_def_use_mgr()->WhileEachUser( value->result_id(), [this, &work_list](Instruction* use) { - if (use->opcode() != SpvOpCompositeExtract) { + if (use->opcode() != spv::Op::OpCompositeExtract) { context()->EmitErrorMessage( "Variable cannot be replaced: invalid instruction", use); return false; @@ -384,7 +385,7 @@ bool DescriptorScalarReplacement::ReplaceLoadedValue(Instruction* var, bool DescriptorScalarReplacement::ReplaceCompositeExtract( Instruction* var, Instruction* extract) { - assert(extract->opcode() == SpvOpCompositeExtract); + assert(extract->opcode() == spv::Op::OpCompositeExtract); // We're currently only supporting extractions of one index at a time. If we // need to, we can handle cases with multiple indexes in the future. if (extract->NumInOperands() != 2) { @@ -400,7 +401,7 @@ bool DescriptorScalarReplacement::ReplaceCompositeExtract( // OpCompositeExtract. uint32_t load_id = TakeNextId(); std::unique_ptr load( - new Instruction(context(), SpvOpLoad, extract->type_id(), load_id, + new Instruction(context(), spv::Op::OpLoad, extract->type_id(), load_id, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {replacement_var}}})); Instruction* load_instr = load.get(); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/desc_sroa_util.cpp b/bgfx/3rdparty/spirv-tools/source/opt/desc_sroa_util.cpp index 1954e2cc..dba3de9c 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/desc_sroa_util.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/desc_sroa_util.cpp @@ -17,12 +17,11 @@ namespace spvtools { namespace opt { namespace { - -const uint32_t kOpAccessChainInOperandIndexes = 1; +constexpr uint32_t kOpAccessChainInOperandIndexes = 1; // Returns the length of array type |type|. uint32_t GetLengthOfArrayType(IRContext* context, Instruction* type) { - assert(type->opcode() == SpvOpTypeArray && "type must be array"); + assert(type->opcode() == spv::Op::OpTypeArray && "type must be array"); uint32_t length_id = type->GetSingleWordInOperand(1); const analysis::Constant* length_const = context->get_constant_mgr()->FindDeclaredConstant(length_id); @@ -35,20 +34,20 @@ uint32_t GetLengthOfArrayType(IRContext* context, Instruction* type) { namespace descsroautil { bool IsDescriptorArray(IRContext* context, Instruction* var) { - if (var->opcode() != SpvOpVariable) { + if (var->opcode() != spv::Op::OpVariable) { return false; } uint32_t ptr_type_id = var->type_id(); Instruction* ptr_type_inst = context->get_def_use_mgr()->GetDef(ptr_type_id); - if (ptr_type_inst->opcode() != SpvOpTypePointer) { + if (ptr_type_inst->opcode() != spv::Op::OpTypePointer) { return false; } uint32_t var_type_id = ptr_type_inst->GetSingleWordInOperand(1); Instruction* var_type_inst = context->get_def_use_mgr()->GetDef(var_type_id); - if (var_type_inst->opcode() != SpvOpTypeArray && - var_type_inst->opcode() != SpvOpTypeStruct) { + if (var_type_inst->opcode() != spv::Op::OpTypeArray && + var_type_inst->opcode() != spv::Op::OpTypeStruct) { return false; } @@ -59,23 +58,23 @@ bool IsDescriptorArray(IRContext* context, Instruction* var) { } if (!context->get_decoration_mgr()->HasDecoration( - var->result_id(), SpvDecorationDescriptorSet)) { + var->result_id(), uint32_t(spv::Decoration::DescriptorSet))) { return false; } - return context->get_decoration_mgr()->HasDecoration(var->result_id(), - SpvDecorationBinding); + return context->get_decoration_mgr()->HasDecoration( + var->result_id(), uint32_t(spv::Decoration::Binding)); } bool IsTypeOfStructuredBuffer(IRContext* context, const Instruction* type) { - if (type->opcode() != SpvOpTypeStruct) { + if (type->opcode() != spv::Op::OpTypeStruct) { return false; } // All buffers have offset decorations for members of their structure types. // This is how we distinguish it from a structure of descriptors. - return context->get_decoration_mgr()->HasDecoration(type->result_id(), - SpvDecorationOffset); + return context->get_decoration_mgr()->HasDecoration( + type->result_id(), uint32_t(spv::Decoration::Offset)); } const analysis::Constant* GetAccessChainIndexAsConst( @@ -99,15 +98,15 @@ uint32_t GetNumberOfElementsForArrayOrStruct(IRContext* context, Instruction* var) { uint32_t ptr_type_id = var->type_id(); Instruction* ptr_type_inst = context->get_def_use_mgr()->GetDef(ptr_type_id); - assert(ptr_type_inst->opcode() == SpvOpTypePointer && + assert(ptr_type_inst->opcode() == spv::Op::OpTypePointer && "Variable should be a pointer to an array or structure."); uint32_t pointee_type_id = ptr_type_inst->GetSingleWordInOperand(1); Instruction* pointee_type_inst = context->get_def_use_mgr()->GetDef(pointee_type_id); - if (pointee_type_inst->opcode() == SpvOpTypeArray) { + if (pointee_type_inst->opcode() == spv::Op::OpTypeArray) { return GetLengthOfArrayType(context, pointee_type_inst); } - assert(pointee_type_inst->opcode() == SpvOpTypeStruct && + assert(pointee_type_inst->opcode() == spv::Op::OpTypeStruct && "Variable should be a pointer to an array or structure."); return pointee_type_inst->NumInOperands(); } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/dominator_analysis.cpp b/bgfx/3rdparty/spirv-tools/source/opt/dominator_analysis.cpp index b692d26a..eb6dfc9e 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/dominator_analysis.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/dominator_analysis.cpp @@ -64,7 +64,7 @@ bool DominatorAnalysisBase::Dominates(Instruction* a, Instruction* b) const { // We handle OpLabel instructions explicitly since they are not stored in the // instruction list. - if (current->opcode() == SpvOpLabel) { + if (current->opcode() == spv::Op::OpLabel) { return true; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/dominator_tree.cpp b/bgfx/3rdparty/spirv-tools/source/opt/dominator_tree.cpp index 2680be2a..3c161a9b 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/dominator_tree.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/dominator_tree.cpp @@ -55,8 +55,8 @@ namespace { // called on each node traversed BEFORE their children. template -static void DepthFirstSearch(const BBType* bb, SuccessorLambda successors, - PreLambda pre, PostLambda post) { +void DepthFirstSearch(const BBType* bb, SuccessorLambda successors, + PreLambda pre, PostLambda post) { auto no_terminal_blocks = [](const BBType*) { return false; }; CFA::DepthFirstTraversal(bb, successors, pre, post, no_terminal_blocks); @@ -73,9 +73,8 @@ static void DepthFirstSearch(const BBType* bb, SuccessorLambda successors, // PostLambda - Lamdba matching the signature of 'void (const BBType*)' will be // called on each node traversed after their children. template -static void DepthFirstSearchPostOrder(const BBType* bb, - SuccessorLambda successors, - PostLambda post) { +void DepthFirstSearchPostOrder(const BBType* bb, SuccessorLambda successors, + PostLambda post) { // Ignore preorder operation. auto nop_preorder = [](const BBType*) {}; DepthFirstSearch(bb, successors, nop_preorder, post); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp index d368bd14..500fd8af 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp @@ -20,7 +20,6 @@ #include #include "source/opt/def_use_manager.h" -#include "source/opt/ir_context.h" #include "source/opt/log.h" #include "source/opt/reflect.h" @@ -40,7 +39,7 @@ Pass::Status EliminateDeadConstantPass::Process() { context()->get_def_use_mgr()->ForEachUse( const_id, [&count](Instruction* user, uint32_t index) { (void)index; - SpvOp op = user->opcode(); + spv::Op op = user->opcode(); if (!(IsAnnotationInst(op) || IsDebug1Inst(op) || IsDebug2Inst(op) || IsDebug3Inst(op))) { ++count; @@ -59,9 +58,9 @@ Pass::Status EliminateDeadConstantPass::Process() { Instruction* inst = *working_list.begin(); // Back propagate if the instruction contains IDs in its operands. switch (inst->opcode()) { - case SpvOp::SpvOpConstantComposite: - case SpvOp::SpvOpSpecConstantComposite: - case SpvOp::SpvOpSpecConstantOp: + case spv::Op::OpConstantComposite: + case spv::Op::OpSpecConstantComposite: + case spv::Op::OpSpecConstantOp: for (uint32_t i = 0; i < inst->NumInOperands(); i++) { // SpecConstantOp instruction contains 'opcode' as its operand. Need // to exclude such operands when decreasing uses. diff --git a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_functions_util.cpp b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_functions_util.cpp index 1379120f..e95b7f6a 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_functions_util.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_functions_util.cpp @@ -28,16 +28,18 @@ Module::iterator EliminateFunction(IRContext* context, ->ForEachInst( [context, first_func, func_iter, &seen_func_end, &to_kill](Instruction* inst) { - if (inst->opcode() == SpvOpFunctionEnd) { + if (inst->opcode() == spv::Op::OpFunctionEnd) { seen_func_end = true; } // Move non-semantic instructions to the previous function or // global values if this is the first function. - if (seen_func_end && inst->opcode() == SpvOpExtInst) { + if (seen_func_end && inst->opcode() == spv::Op::OpExtInst) { assert(inst->IsNonSemanticInstruction()); if (to_kill.find(inst) != to_kill.end()) return; std::unique_ptr clone(inst->Clone(context)); - context->ForgetUses(inst); + // Clear uses of "inst" to in case this moves a dependent chain of + // instructions. + context->get_def_use_mgr()->ClearInst(inst); context->AnalyzeDefUse(clone.get()); if (first_func) { context->AddGlobalValue(std::move(clone)); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_input_components_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_input_components_pass.cpp deleted file mode 100644 index aa2776bb..00000000 --- a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_input_components_pass.cpp +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) 2022 The Khronos Group Inc. -// Copyright (c) 2022 LunarG Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "source/opt/eliminate_dead_input_components_pass.h" - -#include -#include - -#include "source/opt/instruction.h" -#include "source/opt/ir_builder.h" -#include "source/opt/ir_context.h" -#include "source/util/bit_vector.h" - -namespace { - -const uint32_t kAccessChainBaseInIdx = 0; -const uint32_t kAccessChainIndex0InIdx = 1; -const uint32_t kConstantValueInIdx = 0; -const uint32_t kVariableStorageClassInIdx = 0; - -} // namespace - -namespace spvtools { -namespace opt { - -Pass::Status EliminateDeadInputComponentsPass::Process() { - // Current functionality assumes shader capability - if (!context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) - return Status::SuccessWithoutChange; - analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); - analysis::TypeManager* type_mgr = context()->get_type_mgr(); - bool modified = false; - std::vector> arrays_to_change; - for (auto& var : context()->types_values()) { - if (var.opcode() != SpvOpVariable) { - continue; - } - analysis::Type* var_type = type_mgr->GetType(var.type_id()); - analysis::Pointer* ptr_type = var_type->AsPointer(); - if (ptr_type == nullptr) { - continue; - } - if (ptr_type->storage_class() != SpvStorageClassInput) { - continue; - } - const analysis::Array* arr_type = ptr_type->pointee_type()->AsArray(); - if (arr_type != nullptr) { - unsigned arr_len_id = arr_type->LengthId(); - Instruction* arr_len_inst = def_use_mgr->GetDef(arr_len_id); - if (arr_len_inst->opcode() != SpvOpConstant) { - continue; - } - // SPIR-V requires array size is >= 1, so this works for signed or - // unsigned size - unsigned original_max = - arr_len_inst->GetSingleWordInOperand(kConstantValueInIdx) - 1; - unsigned max_idx = FindMaxIndex(var, original_max); - if (max_idx != original_max) { - ChangeArrayLength(var, max_idx + 1); - modified = true; - } - continue; - } - const analysis::Struct* struct_type = ptr_type->pointee_type()->AsStruct(); - if (struct_type == nullptr) continue; - const auto elt_types = struct_type->element_types(); - unsigned original_max = static_cast(elt_types.size()) - 1; - unsigned max_idx = FindMaxIndex(var, original_max); - if (max_idx != original_max) { - ChangeStructLength(var, max_idx + 1); - modified = true; - } - } - - return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; -} - -unsigned EliminateDeadInputComponentsPass::FindMaxIndex(Instruction& var, - unsigned original_max) { - unsigned max = 0; - bool seen_non_const_ac = false; - assert(var.opcode() == SpvOpVariable && "must be variable"); - context()->get_def_use_mgr()->WhileEachUser( - var.result_id(), [&max, &seen_non_const_ac, var, this](Instruction* use) { - auto use_opcode = use->opcode(); - if (use_opcode == SpvOpLoad || use_opcode == SpvOpCopyMemory || - use_opcode == SpvOpCopyMemorySized || - use_opcode == SpvOpCopyObject) { - seen_non_const_ac = true; - return false; - } - if (use->opcode() != SpvOpAccessChain && - use->opcode() != SpvOpInBoundsAccessChain) { - return true; - } - // OpAccessChain with no indices currently not optimized - if (use->NumInOperands() == 1) { - seen_non_const_ac = true; - return false; - } - unsigned base_id = use->GetSingleWordInOperand(kAccessChainBaseInIdx); - USE_ASSERT(base_id == var.result_id() && "unexpected base"); - unsigned idx_id = use->GetSingleWordInOperand(kAccessChainIndex0InIdx); - Instruction* idx_inst = context()->get_def_use_mgr()->GetDef(idx_id); - if (idx_inst->opcode() != SpvOpConstant) { - seen_non_const_ac = true; - return false; - } - unsigned value = idx_inst->GetSingleWordInOperand(kConstantValueInIdx); - if (value > max) max = value; - return true; - }); - return seen_non_const_ac ? original_max : max; -} - -void EliminateDeadInputComponentsPass::ChangeArrayLength(Instruction& arr_var, - unsigned length) { - analysis::TypeManager* type_mgr = context()->get_type_mgr(); - analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); - analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); - analysis::Pointer* ptr_type = - type_mgr->GetType(arr_var.type_id())->AsPointer(); - const analysis::Array* arr_ty = ptr_type->pointee_type()->AsArray(); - assert(arr_ty && "expecting array type"); - uint32_t length_id = const_mgr->GetUIntConst(length); - analysis::Array new_arr_ty(arr_ty->element_type(), - arr_ty->GetConstantLengthInfo(length_id, length)); - analysis::Type* reg_new_arr_ty = type_mgr->GetRegisteredType(&new_arr_ty); - analysis::Pointer new_ptr_ty(reg_new_arr_ty, SpvStorageClassInput); - analysis::Type* reg_new_ptr_ty = type_mgr->GetRegisteredType(&new_ptr_ty); - uint32_t new_ptr_ty_id = type_mgr->GetTypeInstruction(reg_new_ptr_ty); - arr_var.SetResultType(new_ptr_ty_id); - def_use_mgr->AnalyzeInstUse(&arr_var); - // Move arr_var after its new type to preserve order - USE_ASSERT(arr_var.GetSingleWordInOperand(kVariableStorageClassInIdx) != - SpvStorageClassFunction && - "cannot move Function variable"); - Instruction* new_ptr_ty_inst = def_use_mgr->GetDef(new_ptr_ty_id); - arr_var.RemoveFromList(); - arr_var.InsertAfter(new_ptr_ty_inst); -} - -void EliminateDeadInputComponentsPass::ChangeStructLength( - Instruction& struct_var, unsigned length) { - analysis::TypeManager* type_mgr = context()->get_type_mgr(); - analysis::Pointer* ptr_type = - type_mgr->GetType(struct_var.type_id())->AsPointer(); - const analysis::Struct* struct_ty = ptr_type->pointee_type()->AsStruct(); - assert(struct_ty && "expecting struct type"); - const auto orig_elt_types = struct_ty->element_types(); - std::vector new_elt_types; - for (unsigned u = 0; u < length; ++u) - new_elt_types.push_back(orig_elt_types[u]); - analysis::Struct new_struct_ty(new_elt_types); - analysis::Type* reg_new_struct_ty = - type_mgr->GetRegisteredType(&new_struct_ty); - uint32_t new_struct_ty_id = type_mgr->GetTypeInstruction(reg_new_struct_ty); - uint32_t old_struct_ty_id = type_mgr->GetTypeInstruction(struct_ty); - analysis::DecorationManager* deco_mgr = context()->get_decoration_mgr(); - deco_mgr->CloneDecorations(old_struct_ty_id, new_struct_ty_id); - analysis::Pointer new_ptr_ty(reg_new_struct_ty, SpvStorageClassInput); - analysis::Type* reg_new_ptr_ty = type_mgr->GetRegisteredType(&new_ptr_ty); - uint32_t new_ptr_ty_id = type_mgr->GetTypeInstruction(reg_new_ptr_ty); - struct_var.SetResultType(new_ptr_ty_id); - analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); - def_use_mgr->AnalyzeInstUse(&struct_var); - // Move struct_var after its new type to preserve order - USE_ASSERT(struct_var.GetSingleWordInOperand(kVariableStorageClassInIdx) != - SpvStorageClassFunction && - "cannot move Function variable"); - Instruction* new_ptr_ty_inst = def_use_mgr->GetDef(new_ptr_ty_id); - struct_var.RemoveFromList(); - struct_var.InsertAfter(new_ptr_ty_inst); -} - -} // namespace opt -} // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_io_components_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_io_components_pass.cpp new file mode 100644 index 00000000..5553a336 --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_io_components_pass.cpp @@ -0,0 +1,256 @@ +// Copyright (c) 2022 The Khronos Group Inc. +// Copyright (c) 2022 LunarG Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/opt/eliminate_dead_io_components_pass.h" + +#include + +#include "source/opt/instruction.h" +#include "source/opt/ir_context.h" +#include "source/util/bit_vector.h" + +namespace spvtools { +namespace opt { +namespace { +constexpr uint32_t kAccessChainBaseInIdx = 0; +constexpr uint32_t kAccessChainIndex0InIdx = 1; +constexpr uint32_t kAccessChainIndex1InIdx = 2; +constexpr uint32_t kConstantValueInIdx = 0; +} // namespace + +Pass::Status EliminateDeadIOComponentsPass::Process() { + // Only process input and output variables + if (elim_sclass_ != spv::StorageClass::Input && + elim_sclass_ != spv::StorageClass::Output) { + if (consumer()) { + std::string message = + "EliminateDeadIOComponentsPass only valid for input and output " + "variables."; + consumer()(SPV_MSG_ERROR, 0, {0, 0, 0}, message.c_str()); + } + return Status::Failure; + } + // If safe mode, only process Input variables in vertex shader + const auto stage = context()->GetStage(); + if (safe_mode_ && !(stage == spv::ExecutionModel::Vertex && + elim_sclass_ == spv::StorageClass::Input)) + return Status::SuccessWithoutChange; + // Current functionality assumes shader capability. + if (!context()->get_feature_mgr()->HasCapability(spv::Capability::Shader)) + return Status::SuccessWithoutChange; + // Current functionality assumes vert, frag, tesc, tese or geom shader. + // TODO(issue #4988): Add GLCompute. + if (stage != spv::ExecutionModel::Vertex && + stage != spv::ExecutionModel::Fragment && + stage != spv::ExecutionModel::TessellationControl && + stage != spv::ExecutionModel::TessellationEvaluation && + stage != spv::ExecutionModel::Geometry) + return Status::SuccessWithoutChange; + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + bool modified = false; + std::vector vars_to_move; + for (auto& var : context()->types_values()) { + if (var.opcode() != spv::Op::OpVariable) { + continue; + } + analysis::Type* var_type = type_mgr->GetType(var.type_id()); + analysis::Pointer* ptr_type = var_type->AsPointer(); + if (ptr_type == nullptr) { + continue; + } + const auto sclass = ptr_type->storage_class(); + if (sclass != elim_sclass_) { + continue; + } + // For tesc, or input variables in tese or geom shaders, + // there is a outer per-vertex-array that must be ignored + // for the purposes of this analysis/optimization. Do the + // analysis on the inner type in these cases. + bool skip_first_index = false; + auto core_type = ptr_type->pointee_type(); + if (stage == spv::ExecutionModel::TessellationControl || + (sclass == spv::StorageClass::Input && + (stage == spv::ExecutionModel::TessellationEvaluation || + stage == spv::ExecutionModel::Geometry))) { + auto arr_type = core_type->AsArray(); + if (!arr_type) continue; + core_type = arr_type->element_type(); + skip_first_index = true; + } + const analysis::Array* arr_type = core_type->AsArray(); + if (arr_type != nullptr) { + // Only process array if input of vertex shader, or output of + // fragment shader. Otherwise, if one shader has a runtime index and the + // other does not, interface incompatibility can occur. + if (!((sclass == spv::StorageClass::Input && + stage == spv::ExecutionModel::Vertex) || + (sclass == spv::StorageClass::Output && + stage == spv::ExecutionModel::Fragment))) + continue; + unsigned arr_len_id = arr_type->LengthId(); + Instruction* arr_len_inst = def_use_mgr->GetDef(arr_len_id); + if (arr_len_inst->opcode() != spv::Op::OpConstant) { + continue; + } + // SPIR-V requires array size is >= 1, so this works for signed or + // unsigned size. + unsigned original_max = + arr_len_inst->GetSingleWordInOperand(kConstantValueInIdx) - 1; + unsigned max_idx = FindMaxIndex(var, original_max); + if (max_idx != original_max) { + ChangeArrayLength(var, max_idx + 1); + vars_to_move.push_back(&var); + modified = true; + } + continue; + } + const analysis::Struct* struct_type = core_type->AsStruct(); + if (struct_type == nullptr) continue; + const auto elt_types = struct_type->element_types(); + unsigned original_max = static_cast(elt_types.size()) - 1; + unsigned max_idx = FindMaxIndex(var, original_max, skip_first_index); + if (max_idx != original_max) { + ChangeIOVarStructLength(var, max_idx + 1); + vars_to_move.push_back(&var); + modified = true; + } + } + + // Move changed vars after their new type instruction to preserve backward + // referencing. + for (auto var : vars_to_move) { + auto type_id = var->type_id(); + auto type_inst = def_use_mgr->GetDef(type_id); + var->RemoveFromList(); + var->InsertAfter(type_inst); + } + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +unsigned EliminateDeadIOComponentsPass::FindMaxIndex( + const Instruction& var, const unsigned original_max, + const bool skip_first_index) { + unsigned max = 0; + bool seen_non_const_ac = false; + assert(var.opcode() == spv::Op::OpVariable && "must be variable"); + context()->get_def_use_mgr()->WhileEachUser( + var.result_id(), [&max, &seen_non_const_ac, var, skip_first_index, + this](Instruction* use) { + auto use_opcode = use->opcode(); + if (use_opcode == spv::Op::OpLoad || use_opcode == spv::Op::OpStore || + use_opcode == spv::Op::OpCopyMemory || + use_opcode == spv::Op::OpCopyMemorySized || + use_opcode == spv::Op::OpCopyObject) { + seen_non_const_ac = true; + return false; + } + if (use->opcode() != spv::Op::OpAccessChain && + use->opcode() != spv::Op::OpInBoundsAccessChain) { + return true; + } + // OpAccessChain with no indices currently not optimized + if (use->NumInOperands() == 1 || + (skip_first_index && use->NumInOperands() == 2)) { + seen_non_const_ac = true; + return false; + } + const unsigned base_id = + use->GetSingleWordInOperand(kAccessChainBaseInIdx); + USE_ASSERT(base_id == var.result_id() && "unexpected base"); + const unsigned in_idx = skip_first_index ? kAccessChainIndex1InIdx + : kAccessChainIndex0InIdx; + const unsigned idx_id = use->GetSingleWordInOperand(in_idx); + Instruction* idx_inst = context()->get_def_use_mgr()->GetDef(idx_id); + if (idx_inst->opcode() != spv::Op::OpConstant) { + seen_non_const_ac = true; + return false; + } + unsigned value = idx_inst->GetSingleWordInOperand(kConstantValueInIdx); + if (value > max) max = value; + return true; + }); + return seen_non_const_ac ? original_max : max; +} + +void EliminateDeadIOComponentsPass::ChangeArrayLength(Instruction& arr_var, + unsigned length) { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + analysis::Pointer* ptr_type = + type_mgr->GetType(arr_var.type_id())->AsPointer(); + const analysis::Array* arr_ty = ptr_type->pointee_type()->AsArray(); + assert(arr_ty && "expecting array type"); + uint32_t length_id = const_mgr->GetUIntConstId(length); + analysis::Array new_arr_ty(arr_ty->element_type(), + arr_ty->GetConstantLengthInfo(length_id, length)); + analysis::Type* reg_new_arr_ty = type_mgr->GetRegisteredType(&new_arr_ty); + analysis::Pointer new_ptr_ty(reg_new_arr_ty, ptr_type->storage_class()); + analysis::Type* reg_new_ptr_ty = type_mgr->GetRegisteredType(&new_ptr_ty); + uint32_t new_ptr_ty_id = type_mgr->GetTypeInstruction(reg_new_ptr_ty); + arr_var.SetResultType(new_ptr_ty_id); + def_use_mgr->AnalyzeInstUse(&arr_var); +} + +void EliminateDeadIOComponentsPass::ChangeIOVarStructLength(Instruction& io_var, + unsigned length) { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::Pointer* ptr_type = + type_mgr->GetType(io_var.type_id())->AsPointer(); + auto core_type = ptr_type->pointee_type(); + // Check for per-vertex-array of struct from tesc, tese and geom and grab + // embedded struct type. + const auto arr_type = core_type->AsArray(); + if (arr_type) core_type = arr_type->element_type(); + const analysis::Struct* struct_ty = core_type->AsStruct(); + assert(struct_ty && "expecting struct type"); + const auto orig_elt_types = struct_ty->element_types(); + std::vector new_elt_types; + for (unsigned u = 0; u < length; ++u) + new_elt_types.push_back(orig_elt_types[u]); + analysis::Struct new_struct_ty(new_elt_types); + uint32_t old_struct_ty_id = type_mgr->GetTypeInstruction(struct_ty); + std::vector decorations = + context()->get_decoration_mgr()->GetDecorationsFor(old_struct_ty_id, + true); + for (auto dec : decorations) { + if (dec->opcode() == spv::Op::OpMemberDecorate) { + uint32_t midx = dec->GetSingleWordInOperand(1); + if (midx >= length) continue; + } + type_mgr->AttachDecoration(*dec, &new_struct_ty); + } + // Clone name instructions for new struct type + analysis::Type* reg_new_str_ty = type_mgr->GetRegisteredType(&new_struct_ty); + uint32_t new_struct_ty_id = type_mgr->GetTypeInstruction(reg_new_str_ty); + context()->CloneNames(old_struct_ty_id, new_struct_ty_id, length); + // Attach new type to var + analysis::Type* reg_new_var_ty = reg_new_str_ty; + if (arr_type) { + analysis::Array new_arr_ty(reg_new_var_ty, arr_type->length_info()); + reg_new_var_ty = type_mgr->GetRegisteredType(&new_arr_ty); + } + analysis::Pointer new_ptr_ty(reg_new_var_ty, elim_sclass_); + analysis::Type* reg_new_ptr_ty = type_mgr->GetRegisteredType(&new_ptr_ty); + uint32_t new_ptr_ty_id = type_mgr->GetTypeInstruction(reg_new_ptr_ty); + io_var.SetResultType(new_ptr_ty_id); + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + def_use_mgr->AnalyzeInstUse(&io_var); +} + +} // namespace opt +} // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_input_components_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_io_components_pass.h similarity index 69% rename from bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_input_components_pass.h rename to bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_io_components_pass.h index a3a133c2..ef4dfb71 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_input_components_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_io_components_pass.h @@ -26,14 +26,15 @@ namespace spvtools { namespace opt { // See optimizer.hpp for documentation. -class EliminateDeadInputComponentsPass : public Pass { +class EliminateDeadIOComponentsPass : public Pass { public: - explicit EliminateDeadInputComponentsPass() {} + explicit EliminateDeadIOComponentsPass(spv::StorageClass elim_sclass, + bool safe_mode = true) + : elim_sclass_(elim_sclass), safe_mode_(safe_mode) {} const char* name() const override { return "eliminate-dead-input-components"; } - Status Process() override; // Return the mask of preserved Analyses. @@ -50,13 +51,22 @@ class EliminateDeadInputComponentsPass : public Pass { // Find the max constant used to index the variable declared by |var| // through OpAccessChain or OpInBoundsAccessChain. If any non-constant // indices or non-Op*AccessChain use of |var|, return |original_max|. - unsigned FindMaxIndex(Instruction& var, unsigned original_max); + unsigned FindMaxIndex(const Instruction& var, const unsigned original_max, + const bool skip_first_index = false); // Change the length of the array |inst| to |length| void ChangeArrayLength(Instruction& inst, unsigned length); - // Change the length of the struct |struct_var| to |length| - void ChangeStructLength(Instruction& struct_var, unsigned length); + // Change the length of the struct in |io_var| to |length|. |io_var| + // is either the struct or a per-vertex-array of the struct. + void ChangeIOVarStructLength(Instruction& io_var, unsigned length); + + // Storage class to be optimized. Must be Input or Output. + spv::StorageClass elim_sclass_; + + // Only make changes that will not cause interface incompatibility if done + // standalone. Currently this is only Input variables in vertex shaders. + bool safe_mode_; }; } // namespace opt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_members_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_members_pass.cpp index 52aca525..1c98502e 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_members_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_members_pass.cpp @@ -17,17 +17,16 @@ #include "ir_builder.h" #include "source/opt/ir_context.h" +namespace spvtools { +namespace opt { namespace { -const uint32_t kRemovedMember = 0xFFFFFFFF; -const uint32_t kSpecConstOpOpcodeIdx = 0; +constexpr uint32_t kRemovedMember = 0xFFFFFFFF; +constexpr uint32_t kSpecConstOpOpcodeIdx = 0; constexpr uint32_t kArrayElementTypeIdx = 0; } // namespace -namespace spvtools { -namespace opt { - Pass::Status EliminateDeadMembersPass::Process() { - if (!context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) + if (!context()->get_feature_mgr()->HasCapability(spv::Capability::Shader)) return Status::SuccessWithoutChange; FindLiveMembers(); @@ -41,27 +40,27 @@ void EliminateDeadMembersPass::FindLiveMembers() { // Until we have implemented the rewriting of OpSpecConsantOp instructions, // we have to mark them as fully used just to be safe. for (auto& inst : get_module()->types_values()) { - if (inst.opcode() == SpvOpSpecConstantOp) { - switch (inst.GetSingleWordInOperand(kSpecConstOpOpcodeIdx)) { - case SpvOpCompositeExtract: + if (inst.opcode() == spv::Op::OpSpecConstantOp) { + switch (spv::Op(inst.GetSingleWordInOperand(kSpecConstOpOpcodeIdx))) { + case spv::Op::OpCompositeExtract: MarkMembersAsLiveForExtract(&inst); break; - case SpvOpCompositeInsert: + case spv::Op::OpCompositeInsert: // Nothing specific to do. break; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: assert(false && "Not implemented yet."); break; default: break; } - } else if (inst.opcode() == SpvOpVariable) { - switch (inst.GetSingleWordInOperand(0)) { - case SpvStorageClassInput: - case SpvStorageClassOutput: + } else if (inst.opcode() == spv::Op::OpVariable) { + switch (spv::StorageClass(inst.GetSingleWordInOperand(0))) { + case spv::StorageClass::Input: + case spv::StorageClass::Output: MarkPointeeTypeAsFullUsed(inst.type_id()); break; default: @@ -86,34 +85,34 @@ void EliminateDeadMembersPass::FindLiveMembers(const Function& function) { void EliminateDeadMembersPass::FindLiveMembers(const Instruction* inst) { switch (inst->opcode()) { - case SpvOpStore: + case spv::Op::OpStore: MarkMembersAsLiveForStore(inst); break; - case SpvOpCopyMemory: - case SpvOpCopyMemorySized: + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyMemorySized: MarkMembersAsLiveForCopyMemory(inst); break; - case SpvOpCompositeExtract: + case spv::Op::OpCompositeExtract: MarkMembersAsLiveForExtract(inst); break; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: MarkMembersAsLiveForAccessChain(inst); break; - case SpvOpReturnValue: + case spv::Op::OpReturnValue: // This should be an issue only if we are returning from the entry point. // However, for now I will keep it more conservative because functions are // often inlined leaving only the entry points. MarkOperandTypeAsFullyUsed(inst, 0); break; - case SpvOpArrayLength: + case spv::Op::OpArrayLength: MarkMembersAsLiveForArrayLength(inst); break; - case SpvOpLoad: - case SpvOpCompositeInsert: - case SpvOpCompositeConstruct: + case spv::Op::OpLoad: + case spv::Op::OpCompositeInsert: + case spv::Op::OpCompositeConstruct: break; default: // This path is here for safety. All instructions that can reference @@ -131,7 +130,7 @@ void EliminateDeadMembersPass::MarkMembersAsLiveForStore( // memory that is read outside of the shader. Other passes can remove all // store to memory that is not visible outside of the shader, so we do not // complicate the code for now. - assert(inst->opcode() == SpvOpStore); + assert(inst->opcode() == spv::Op::OpStore); uint32_t object_id = inst->GetSingleWordInOperand(1); Instruction* object_inst = context()->get_def_use_mgr()->GetDef(object_id); uint32_t object_type_id = object_inst->type_id(); @@ -143,15 +142,15 @@ void EliminateDeadMembersPass::MarkTypeAsFullyUsed(uint32_t type_id) { assert(type_inst != nullptr); switch (type_inst->opcode()) { - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: // Mark every member and its type as fully used. for (uint32_t i = 0; i < type_inst->NumInOperands(); ++i) { used_members_[type_id].insert(i); MarkTypeAsFullyUsed(type_inst->GetSingleWordInOperand(i)); } break; - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: MarkTypeAsFullyUsed( type_inst->GetSingleWordInOperand(kArrayElementTypeIdx)); break; @@ -162,7 +161,7 @@ void EliminateDeadMembersPass::MarkTypeAsFullyUsed(uint32_t type_id) { void EliminateDeadMembersPass::MarkPointeeTypeAsFullUsed(uint32_t ptr_type_id) { Instruction* ptr_type_inst = get_def_use_mgr()->GetDef(ptr_type_id); - assert(ptr_type_inst->opcode() == SpvOpTypePointer); + assert(ptr_type_inst->opcode() == spv::Op::OpTypePointer); MarkTypeAsFullyUsed(ptr_type_inst->GetSingleWordInOperand(1)); } @@ -178,12 +177,13 @@ void EliminateDeadMembersPass::MarkMembersAsLiveForCopyMemory( void EliminateDeadMembersPass::MarkMembersAsLiveForExtract( const Instruction* inst) { - assert(inst->opcode() == SpvOpCompositeExtract || - (inst->opcode() == SpvOpSpecConstantOp && - inst->GetSingleWordInOperand(kSpecConstOpOpcodeIdx) == - SpvOpCompositeExtract)); + assert(inst->opcode() == spv::Op::OpCompositeExtract || + (inst->opcode() == spv::Op::OpSpecConstantOp && + spv::Op(inst->GetSingleWordInOperand(kSpecConstOpOpcodeIdx)) == + spv::Op::OpCompositeExtract)); - uint32_t first_operand = (inst->opcode() == SpvOpSpecConstantOp ? 1 : 0); + uint32_t first_operand = + (inst->opcode() == spv::Op::OpSpecConstantOp ? 1 : 0); uint32_t composite_id = inst->GetSingleWordInOperand(first_operand); Instruction* composite_inst = get_def_use_mgr()->GetDef(composite_id); uint32_t type_id = composite_inst->type_id(); @@ -192,14 +192,14 @@ void EliminateDeadMembersPass::MarkMembersAsLiveForExtract( Instruction* type_inst = get_def_use_mgr()->GetDef(type_id); uint32_t member_idx = inst->GetSingleWordInOperand(i); switch (type_inst->opcode()) { - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: used_members_[type_id].insert(member_idx); type_id = type_inst->GetSingleWordInOperand(member_idx); break; - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: - case SpvOpTypeVector: - case SpvOpTypeMatrix: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: type_id = type_inst->GetSingleWordInOperand(0); break; default: @@ -210,10 +210,10 @@ void EliminateDeadMembersPass::MarkMembersAsLiveForExtract( void EliminateDeadMembersPass::MarkMembersAsLiveForAccessChain( const Instruction* inst) { - assert(inst->opcode() == SpvOpAccessChain || - inst->opcode() == SpvOpInBoundsAccessChain || - inst->opcode() == SpvOpPtrAccessChain || - inst->opcode() == SpvOpInBoundsPtrAccessChain); + assert(inst->opcode() == spv::Op::OpAccessChain || + inst->opcode() == spv::Op::OpInBoundsAccessChain || + inst->opcode() == spv::Op::OpPtrAccessChain || + inst->opcode() == spv::Op::OpInBoundsPtrAccessChain); uint32_t pointer_id = inst->GetSingleWordInOperand(0); Instruction* pointer_inst = get_def_use_mgr()->GetDef(pointer_id); @@ -225,14 +225,14 @@ void EliminateDeadMembersPass::MarkMembersAsLiveForAccessChain( // For a pointer access chain, we need to skip the |element| index. It is not // a reference to the member of a struct, and it does not change the type. - uint32_t i = (inst->opcode() == SpvOpAccessChain || - inst->opcode() == SpvOpInBoundsAccessChain + uint32_t i = (inst->opcode() == spv::Op::OpAccessChain || + inst->opcode() == spv::Op::OpInBoundsAccessChain ? 1 : 2); for (; i < inst->NumInOperands(); ++i) { Instruction* type_inst = get_def_use_mgr()->GetDef(type_id); switch (type_inst->opcode()) { - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { const analysis::IntConstant* member_idx = const_mgr->FindDeclaredConstant(inst->GetSingleWordInOperand(i)) ->AsIntConstant(); @@ -242,10 +242,10 @@ void EliminateDeadMembersPass::MarkMembersAsLiveForAccessChain( used_members_[type_id].insert(index); type_id = type_inst->GetSingleWordInOperand(index); } break; - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: - case SpvOpTypeVector: - case SpvOpTypeMatrix: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: type_id = type_inst->GetSingleWordInOperand(0); break; default: @@ -263,7 +263,7 @@ void EliminateDeadMembersPass::MarkOperandTypeAsFullyUsed( void EliminateDeadMembersPass::MarkMembersAsLiveForArrayLength( const Instruction* inst) { - assert(inst->opcode() == SpvOpArrayLength); + assert(inst->opcode() == spv::Op::OpArrayLength); uint32_t object_id = inst->GetSingleWordInOperand(0); Instruction* object_inst = get_def_use_mgr()->GetDef(object_id); uint32_t pointer_type_id = object_inst->type_id(); @@ -278,7 +278,7 @@ bool EliminateDeadMembersPass::RemoveDeadMembers() { // First update all of the OpTypeStruct instructions. get_module()->ForEachInst([&modified, this](Instruction* inst) { switch (inst->opcode()) { - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: modified |= UpdateOpTypeStruct(inst); break; default: @@ -289,47 +289,47 @@ bool EliminateDeadMembersPass::RemoveDeadMembers() { // Now update all of the instructions that reference the OpTypeStructs. get_module()->ForEachInst([&modified, this](Instruction* inst) { switch (inst->opcode()) { - case SpvOpMemberName: + case spv::Op::OpMemberName: modified |= UpdateOpMemberNameOrDecorate(inst); break; - case SpvOpMemberDecorate: + case spv::Op::OpMemberDecorate: modified |= UpdateOpMemberNameOrDecorate(inst); break; - case SpvOpGroupMemberDecorate: + case spv::Op::OpGroupMemberDecorate: modified |= UpdateOpGroupMemberDecorate(inst); break; - case SpvOpSpecConstantComposite: - case SpvOpConstantComposite: - case SpvOpCompositeConstruct: + case spv::Op::OpSpecConstantComposite: + case spv::Op::OpConstantComposite: + case spv::Op::OpCompositeConstruct: modified |= UpdateConstantComposite(inst); break; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: modified |= UpdateAccessChain(inst); break; - case SpvOpCompositeExtract: + case spv::Op::OpCompositeExtract: modified |= UpdateCompsiteExtract(inst); break; - case SpvOpCompositeInsert: + case spv::Op::OpCompositeInsert: modified |= UpdateCompositeInsert(inst); break; - case SpvOpArrayLength: + case spv::Op::OpArrayLength: modified |= UpdateOpArrayLength(inst); break; - case SpvOpSpecConstantOp: - switch (inst->GetSingleWordInOperand(kSpecConstOpOpcodeIdx)) { - case SpvOpCompositeExtract: + case spv::Op::OpSpecConstantOp: + switch (spv::Op(inst->GetSingleWordInOperand(kSpecConstOpOpcodeIdx))) { + case spv::Op::OpCompositeExtract: modified |= UpdateCompsiteExtract(inst); break; - case SpvOpCompositeInsert: + case spv::Op::OpCompositeInsert: modified |= UpdateCompositeInsert(inst); break; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: assert(false && "Not implemented yet."); break; default: @@ -344,7 +344,7 @@ bool EliminateDeadMembersPass::RemoveDeadMembers() { } bool EliminateDeadMembersPass::UpdateOpTypeStruct(Instruction* inst) { - assert(inst->opcode() == SpvOpTypeStruct); + assert(inst->opcode() == spv::Op::OpTypeStruct); const auto& live_members = used_members_[inst->result_id()]; if (live_members.size() == inst->NumInOperands()) { @@ -362,8 +362,8 @@ bool EliminateDeadMembersPass::UpdateOpTypeStruct(Instruction* inst) { } bool EliminateDeadMembersPass::UpdateOpMemberNameOrDecorate(Instruction* inst) { - assert(inst->opcode() == SpvOpMemberName || - inst->opcode() == SpvOpMemberDecorate); + assert(inst->opcode() == spv::Op::OpMemberName || + inst->opcode() == spv::Op::OpMemberDecorate); uint32_t type_id = inst->GetSingleWordInOperand(0); auto live_members = used_members_.find(type_id); @@ -388,7 +388,7 @@ bool EliminateDeadMembersPass::UpdateOpMemberNameOrDecorate(Instruction* inst) { } bool EliminateDeadMembersPass::UpdateOpGroupMemberDecorate(Instruction* inst) { - assert(inst->opcode() == SpvOpGroupMemberDecorate); + assert(inst->opcode() == spv::Op::OpGroupMemberDecorate); bool modified = false; @@ -429,9 +429,9 @@ bool EliminateDeadMembersPass::UpdateOpGroupMemberDecorate(Instruction* inst) { } bool EliminateDeadMembersPass::UpdateConstantComposite(Instruction* inst) { - assert(inst->opcode() == SpvOpSpecConstantComposite || - inst->opcode() == SpvOpConstantComposite || - inst->opcode() == SpvOpCompositeConstruct); + assert(inst->opcode() == spv::Op::OpSpecConstantComposite || + inst->opcode() == spv::Op::OpConstantComposite || + inst->opcode() == spv::Op::OpCompositeConstruct); uint32_t type_id = inst->type_id(); bool modified = false; @@ -450,10 +450,10 @@ bool EliminateDeadMembersPass::UpdateConstantComposite(Instruction* inst) { } bool EliminateDeadMembersPass::UpdateAccessChain(Instruction* inst) { - assert(inst->opcode() == SpvOpAccessChain || - inst->opcode() == SpvOpInBoundsAccessChain || - inst->opcode() == SpvOpPtrAccessChain || - inst->opcode() == SpvOpInBoundsPtrAccessChain); + assert(inst->opcode() == spv::Op::OpAccessChain || + inst->opcode() == spv::Op::OpInBoundsAccessChain || + inst->opcode() == spv::Op::OpPtrAccessChain || + inst->opcode() == spv::Op::OpInBoundsPtrAccessChain); uint32_t pointer_id = inst->GetSingleWordInOperand(0); Instruction* pointer_inst = get_def_use_mgr()->GetDef(pointer_id); @@ -467,8 +467,8 @@ bool EliminateDeadMembersPass::UpdateAccessChain(Instruction* inst) { new_operands.emplace_back(inst->GetInOperand(0)); // For pointer access chains we want to copy the element operand. - if (inst->opcode() == SpvOpPtrAccessChain || - inst->opcode() == SpvOpInBoundsPtrAccessChain) { + if (inst->opcode() == spv::Op::OpPtrAccessChain || + inst->opcode() == spv::Op::OpInBoundsPtrAccessChain) { new_operands.emplace_back(inst->GetInOperand(1)); } @@ -476,7 +476,7 @@ bool EliminateDeadMembersPass::UpdateAccessChain(Instruction* inst) { i < inst->NumInOperands(); ++i) { Instruction* type_inst = get_def_use_mgr()->GetDef(type_id); switch (type_inst->opcode()) { - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { const analysis::IntConstant* member_idx = const_mgr->FindDeclaredConstant(inst->GetSingleWordInOperand(i)) ->AsIntConstant(); @@ -501,10 +501,10 @@ bool EliminateDeadMembersPass::UpdateAccessChain(Instruction* inst) { // index. type_id = type_inst->GetSingleWordInOperand(new_member_idx); } break; - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: - case SpvOpTypeVector: - case SpvOpTypeMatrix: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: new_operands.emplace_back(inst->GetInOperand(i)); type_id = type_inst->GetSingleWordInOperand(0); break; @@ -539,13 +539,13 @@ uint32_t EliminateDeadMembersPass::GetNewMemberIndex(uint32_t type_id, } bool EliminateDeadMembersPass::UpdateCompsiteExtract(Instruction* inst) { - assert(inst->opcode() == SpvOpCompositeExtract || - (inst->opcode() == SpvOpSpecConstantOp && - inst->GetSingleWordInOperand(kSpecConstOpOpcodeIdx) == - SpvOpCompositeExtract)); + assert(inst->opcode() == spv::Op::OpCompositeExtract || + (inst->opcode() == spv::Op::OpSpecConstantOp && + spv::Op(inst->GetSingleWordInOperand(kSpecConstOpOpcodeIdx)) == + spv::Op::OpCompositeExtract)); uint32_t first_operand = 0; - if (inst->opcode() == SpvOpSpecConstantOp) { + if (inst->opcode() == spv::Op::OpSpecConstantOp) { first_operand = 1; } uint32_t object_id = inst->GetSingleWordInOperand(first_operand); @@ -569,15 +569,15 @@ bool EliminateDeadMembersPass::UpdateCompsiteExtract(Instruction* inst) { Instruction* type_inst = get_def_use_mgr()->GetDef(type_id); switch (type_inst->opcode()) { - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: // The type will have already been rewritten, so use the new member // index. type_id = type_inst->GetSingleWordInOperand(new_member_idx); break; - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: - case SpvOpTypeVector: - case SpvOpTypeMatrix: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: type_id = type_inst->GetSingleWordInOperand(0); break; default: @@ -594,13 +594,13 @@ bool EliminateDeadMembersPass::UpdateCompsiteExtract(Instruction* inst) { } bool EliminateDeadMembersPass::UpdateCompositeInsert(Instruction* inst) { - assert(inst->opcode() == SpvOpCompositeInsert || - (inst->opcode() == SpvOpSpecConstantOp && - inst->GetSingleWordInOperand(kSpecConstOpOpcodeIdx) == - SpvOpCompositeInsert)); + assert(inst->opcode() == spv::Op::OpCompositeInsert || + (inst->opcode() == spv::Op::OpSpecConstantOp && + spv::Op(inst->GetSingleWordInOperand(kSpecConstOpOpcodeIdx)) == + spv::Op::OpCompositeInsert)); uint32_t first_operand = 0; - if (inst->opcode() == SpvOpSpecConstantOp) { + if (inst->opcode() == spv::Op::OpSpecConstantOp) { first_operand = 1; } @@ -630,15 +630,15 @@ bool EliminateDeadMembersPass::UpdateCompositeInsert(Instruction* inst) { Instruction* type_inst = get_def_use_mgr()->GetDef(type_id); switch (type_inst->opcode()) { - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: // The type will have already been rewritten, so use the new member // index. type_id = type_inst->GetSingleWordInOperand(new_member_idx); break; - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: - case SpvOpTypeVector: - case SpvOpTypeMatrix: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: type_id = type_inst->GetSingleWordInOperand(0); break; default: diff --git a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_output_stores_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_output_stores_pass.cpp new file mode 100644 index 00000000..99711a16 --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_output_stores_pass.cpp @@ -0,0 +1,237 @@ +// Copyright (c) 2022 The Khronos Group Inc. +// Copyright (c) 2022 LunarG Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/opt/eliminate_dead_output_stores_pass.h" + +#include "source/opt/instruction.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace { +constexpr uint32_t kDecorationLocationInIdx = 2; +constexpr uint32_t kOpDecorateMemberMemberInIdx = 1; +constexpr uint32_t kOpDecorateBuiltInLiteralInIdx = 2; +constexpr uint32_t kOpDecorateMemberBuiltInLiteralInIdx = 3; +constexpr uint32_t kOpAccessChainIdx0InIdx = 1; +constexpr uint32_t kOpConstantValueInIdx = 0; +} // namespace + +Pass::Status EliminateDeadOutputStoresPass::Process() { + // Current functionality assumes shader capability + if (!context()->get_feature_mgr()->HasCapability(spv::Capability::Shader)) + return Status::SuccessWithoutChange; + Pass::Status status = DoDeadOutputStoreElimination(); + return status; +} + +void EliminateDeadOutputStoresPass::InitializeElimination() { + kill_list_.clear(); +} + +bool EliminateDeadOutputStoresPass::IsLiveBuiltin(uint32_t bi) { + return live_builtins_->find(bi) != live_builtins_->end(); +} + +bool EliminateDeadOutputStoresPass::AnyLocsAreLive(uint32_t start, + uint32_t count) { + auto finish = start + count; + for (uint32_t u = start; u < finish; ++u) { + if (live_locs_->find(u) != live_locs_->end()) return true; + } + return false; +} + +void EliminateDeadOutputStoresPass::KillAllStoresOfRef(Instruction* ref) { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + if (ref->opcode() == spv::Op::OpStore) { + kill_list_.push_back(ref); + return; + } + assert((ref->opcode() == spv::Op::OpAccessChain || + ref->opcode() == spv::Op::OpInBoundsAccessChain) && + "unexpected use of output variable"); + def_use_mgr->ForEachUser(ref, [this](Instruction* user) { + if (user->opcode() == spv::Op::OpStore) kill_list_.push_back(user); + }); +} + +void EliminateDeadOutputStoresPass::KillAllDeadStoresOfLocRef( + Instruction* ref, Instruction* var) { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::DecorationManager* deco_mgr = context()->get_decoration_mgr(); + analysis::LivenessManager* live_mgr = context()->get_liveness_mgr(); + // Find variable location if present. + uint32_t start_loc = 0; + auto var_id = var->result_id(); + bool no_loc = deco_mgr->WhileEachDecoration( + var_id, uint32_t(spv::Decoration::Location), + [&start_loc](const Instruction& deco) { + assert(deco.opcode() == spv::Op::OpDecorate && "unexpected decoration"); + start_loc = deco.GetSingleWordInOperand(kDecorationLocationInIdx); + return false; + }); + // Find patch decoration if present + bool is_patch = !deco_mgr->WhileEachDecoration( + var_id, uint32_t(spv::Decoration::Patch), [](const Instruction& deco) { + if (deco.opcode() != spv::Op::OpDecorate) + assert(false && "unexpected decoration"); + return false; + }); + // Compute offset and final type of reference. If no location found + // or any stored locations are live, return without removing stores. + auto ptr_type = type_mgr->GetType(var->type_id())->AsPointer(); + assert(ptr_type && "unexpected var type"); + auto var_type = ptr_type->pointee_type(); + uint32_t ref_loc = start_loc; + auto curr_type = var_type; + if (ref->opcode() == spv::Op::OpAccessChain || + ref->opcode() == spv::Op::OpInBoundsAccessChain) { + live_mgr->AnalyzeAccessChainLoc(ref, &curr_type, &ref_loc, &no_loc, + is_patch, /* input */ false); + } + if (no_loc || AnyLocsAreLive(ref_loc, live_mgr->GetLocSize(curr_type))) + return; + // Kill all stores based on this reference + KillAllStoresOfRef(ref); +} + +void EliminateDeadOutputStoresPass::KillAllDeadStoresOfBuiltinRef( + Instruction* ref, Instruction* var) { + auto deco_mgr = context()->get_decoration_mgr(); + auto def_use_mgr = context()->get_def_use_mgr(); + auto type_mgr = context()->get_type_mgr(); + auto live_mgr = context()->get_liveness_mgr(); + // Search for builtin decoration of base variable + uint32_t builtin = uint32_t(spv::BuiltIn::Max); + auto var_id = var->result_id(); + (void)deco_mgr->WhileEachDecoration( + var_id, uint32_t(spv::Decoration::BuiltIn), + [&builtin](const Instruction& deco) { + assert(deco.opcode() == spv::Op::OpDecorate && "unexpected decoration"); + builtin = deco.GetSingleWordInOperand(kOpDecorateBuiltInLiteralInIdx); + return false; + }); + // If analyzed builtin and not live, kill stores. + if (builtin != uint32_t(spv::BuiltIn::Max)) { + if (live_mgr->IsAnalyzedBuiltin(builtin) && !IsLiveBuiltin(builtin)) + KillAllStoresOfRef(ref); + return; + } + // Search for builtin decoration on indexed member + auto ref_op = ref->opcode(); + if (ref_op != spv::Op::OpAccessChain && + ref_op != spv::Op::OpInBoundsAccessChain) { + return; + } + uint32_t in_idx = kOpAccessChainIdx0InIdx; + analysis::Type* var_type = type_mgr->GetType(var->type_id()); + analysis::Pointer* ptr_type = var_type->AsPointer(); + auto curr_type = ptr_type->pointee_type(); + auto arr_type = curr_type->AsArray(); + if (arr_type) { + curr_type = arr_type->element_type(); + ++in_idx; + } + auto str_type = curr_type->AsStruct(); + auto str_type_id = type_mgr->GetId(str_type); + auto member_idx_id = ref->GetSingleWordInOperand(in_idx); + auto member_idx_inst = def_use_mgr->GetDef(member_idx_id); + assert(member_idx_inst->opcode() == spv::Op::OpConstant && + "unexpected non-constant index"); + auto ac_idx = member_idx_inst->GetSingleWordInOperand(kOpConstantValueInIdx); + (void)deco_mgr->WhileEachDecoration( + str_type_id, uint32_t(spv::Decoration::BuiltIn), + [ac_idx, &builtin](const Instruction& deco) { + assert(deco.opcode() == spv::Op::OpMemberDecorate && + "unexpected decoration"); + auto deco_idx = + deco.GetSingleWordInOperand(kOpDecorateMemberMemberInIdx); + if (deco_idx == ac_idx) { + builtin = + deco.GetSingleWordInOperand(kOpDecorateMemberBuiltInLiteralInIdx); + return false; + } + return true; + }); + assert(builtin != uint32_t(spv::BuiltIn::Max) && "builtin not found"); + // If analyzed builtin and not live, kill stores. + if (live_mgr->IsAnalyzedBuiltin(builtin) && !IsLiveBuiltin(builtin)) + KillAllStoresOfRef(ref); +} + +Pass::Status EliminateDeadOutputStoresPass::DoDeadOutputStoreElimination() { + // Current implementation only supports vert, tesc, tese, geom shaders + auto stage = context()->GetStage(); + if (stage != spv::ExecutionModel::Vertex && + stage != spv::ExecutionModel::TessellationControl && + stage != spv::ExecutionModel::TessellationEvaluation && + stage != spv::ExecutionModel::Geometry) + return Status::Failure; + InitializeElimination(); + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::DecorationManager* deco_mgr = context()->get_decoration_mgr(); + // Process all output variables + for (auto& var : context()->types_values()) { + if (var.opcode() != spv::Op::OpVariable) { + continue; + } + analysis::Type* var_type = type_mgr->GetType(var.type_id()); + analysis::Pointer* ptr_type = var_type->AsPointer(); + if (ptr_type->storage_class() != spv::StorageClass::Output) { + continue; + } + // If builtin decoration on variable, process as builtin. + auto var_id = var.result_id(); + bool is_builtin = false; + if (deco_mgr->HasDecoration(var_id, uint32_t(spv::Decoration::BuiltIn))) { + is_builtin = true; + } else { + // If interface block with builtin members, process as builtin. + // Strip off outer array type if present. + auto curr_type = ptr_type->pointee_type(); + auto arr_type = curr_type->AsArray(); + if (arr_type) curr_type = arr_type->element_type(); + auto str_type = curr_type->AsStruct(); + if (str_type) { + auto str_type_id = type_mgr->GetId(str_type); + if (deco_mgr->HasDecoration(str_type_id, + uint32_t(spv::Decoration::BuiltIn))) + is_builtin = true; + } + } + // For each store or access chain using var, if dead builtin or all its + // locations are dead, kill store or all access chain's stores + def_use_mgr->ForEachUser( + var_id, [this, &var, is_builtin](Instruction* user) { + auto op = user->opcode(); + if (op == spv::Op::OpEntryPoint || op == spv::Op::OpName || + op == spv::Op::OpDecorate || user->IsNonSemanticInstruction()) + return; + if (is_builtin) + KillAllDeadStoresOfBuiltinRef(user, &var); + else + KillAllDeadStoresOfLocRef(user, &var); + }); + } + for (auto& kinst : kill_list_) context()->KillInst(kinst); + + return kill_list_.empty() ? Status::SuccessWithoutChange + : Status::SuccessWithChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_output_stores_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_output_stores_pass.h new file mode 100644 index 00000000..676d4f4f --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_output_stores_pass.h @@ -0,0 +1,81 @@ +// Copyright (c) 2022 The Khronos Group Inc. +// Copyright (c) 2022 LunarG Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SOURCE_OPT_ELIMINATE_DEAD_OUTPUT_STORES_H_ +#define SOURCE_OPT_ELIMINATE_DEAD_OUTPUT_STORES_H_ + +#include + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class EliminateDeadOutputStoresPass : public Pass { + public: + explicit EliminateDeadOutputStoresPass( + std::unordered_set* live_locs, + std::unordered_set* live_builtins) + : live_locs_(live_locs), live_builtins_(live_builtins) {} + + const char* name() const override { return "eliminate-dead-output-stores"; } + Status Process() override; + + // Return the mask of preserved Analyses. + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisCombinators | IRContext::kAnalysisCFG | + IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisNameMap | + IRContext::kAnalysisConstants | IRContext::kAnalysisTypes; + } + + private: + // Initialize elimination + void InitializeElimination(); + + // Do dead output store analysis + Status DoDeadOutputStoreElimination(); + + // Kill all stores resulting from |ref|. + void KillAllStoresOfRef(Instruction* ref); + + // Kill all dead stores resulting from |user| of loc-based |var|. + void KillAllDeadStoresOfLocRef(Instruction* user, Instruction* var); + + // Kill all dead stores resulting from |user| of builtin |var|. + void KillAllDeadStoresOfBuiltinRef(Instruction* user, Instruction* var); + + // Return true if any of |count| locations starting at location |start| are + // live. + bool AnyLocsAreLive(uint32_t start, uint32_t count); + + // Return true if builtin |bi| is live. + bool IsLiveBuiltin(uint32_t bi); + + std::unordered_set* live_locs_; + std::unordered_set* live_builtins_; + + std::vector kill_list_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_ELIMINATE_DEAD_OUTPUT_STORES_H_ diff --git a/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.cpp b/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.cpp index a5902716..51883706 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.cpp @@ -14,8 +14,6 @@ #include "source/opt/feature_manager.h" -#include -#include #include #include "source/enum_string_mapping.h" @@ -36,42 +34,44 @@ void FeatureManager::AddExtensions(Module* module) { } void FeatureManager::AddExtension(Instruction* ext) { - assert(ext->opcode() == SpvOpExtension && + assert(ext->opcode() == spv::Op::OpExtension && "Expecting an extension instruction."); const std::string name = ext->GetInOperand(0u).AsString(); Extension extension; if (GetExtensionFromString(name.c_str(), &extension)) { - extensions_.Add(extension); + extensions_.insert(extension); } } void FeatureManager::RemoveExtension(Extension ext) { - if (!extensions_.Contains(ext)) return; - extensions_.Remove(ext); + if (!extensions_.contains(ext)) return; + extensions_.erase(ext); } -void FeatureManager::AddCapability(SpvCapability cap) { - if (capabilities_.Contains(cap)) return; +void FeatureManager::AddCapability(spv::Capability cap) { + if (capabilities_.contains(cap)) return; - capabilities_.Add(cap); + capabilities_.insert(cap); spv_operand_desc desc = {}; - if (SPV_SUCCESS == - grammar_.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, cap, &desc)) { - CapabilitySet(desc->numCapabilities, desc->capabilities) - .ForEach([this](SpvCapability c) { AddCapability(c); }); + if (SPV_SUCCESS == grammar_.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, + uint32_t(cap), &desc)) { + for (auto capability : + CapabilitySet(desc->numCapabilities, desc->capabilities)) { + AddCapability(capability); + } } } -void FeatureManager::RemoveCapability(SpvCapability cap) { - if (!capabilities_.Contains(cap)) return; - capabilities_.Remove(cap); +void FeatureManager::RemoveCapability(spv::Capability cap) { + if (!capabilities_.contains(cap)) return; + capabilities_.erase(cap); } void FeatureManager::AddCapabilities(Module* module) { for (Instruction& inst : module->capabilities()) { - AddCapability(static_cast(inst.GetSingleWordInOperand(0))); + AddCapability(static_cast(inst.GetSingleWordInOperand(0))); } } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.h b/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.h index 68c8e9a2..d150a2fa 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.h @@ -25,27 +25,19 @@ namespace opt { // Tracks features enabled by a module. The IRContext has a FeatureManager. class FeatureManager { public: - explicit FeatureManager(const AssemblyGrammar& grammar) : grammar_(grammar) {} - // Returns true if |ext| is an enabled extension in the module. - bool HasExtension(Extension ext) const { return extensions_.Contains(ext); } - - // Removes the given |extension| from the current FeatureManager. - void RemoveExtension(Extension extension); + bool HasExtension(Extension ext) const { return extensions_.contains(ext); } // Returns true if |cap| is an enabled capability in the module. - bool HasCapability(SpvCapability cap) const { - return capabilities_.Contains(cap); + bool HasCapability(spv::Capability cap) const { + return capabilities_.contains(cap); } - // Removes the given |capability| from the current FeatureManager. - void RemoveCapability(SpvCapability capability); - - // Analyzes |module| and records enabled extensions and capabilities. - void Analyze(Module* module); + // Returns the capabilities the module declares. + inline const CapabilitySet& GetCapabilities() const { return capabilities_; } - CapabilitySet* GetCapabilities() { return &capabilities_; } - const CapabilitySet* GetCapabilities() const { return &capabilities_; } + // Returns the extensions the module imports. + inline const ExtensionSet& GetExtensions() const { return extensions_; } uint32_t GetExtInstImportId_GLSLstd450() const { return extinst_importid_GLSLstd450_; @@ -64,23 +56,34 @@ class FeatureManager { return !(a == b); } - // Adds the given |capability| and all implied capabilities into the current - // FeatureManager. - void AddCapability(SpvCapability capability); + private: + explicit FeatureManager(const AssemblyGrammar& grammar) : grammar_(grammar) {} + + // Analyzes |module| and records enabled extensions and capabilities. + void Analyze(Module* module); // Add the extension |ext| to the feature manager. void AddExtension(Instruction* ext); - // Analyzes |module| and records imported external instruction sets. - void AddExtInstImportIds(Module* module); - - private: // Analyzes |module| and records enabled extensions. void AddExtensions(Module* module); + // Removes the given |extension| from the current FeatureManager. + void RemoveExtension(Extension extension); + + // Adds the given |capability| and all implied capabilities into the current + // FeatureManager. + void AddCapability(spv::Capability capability); + // Analyzes |module| and records enabled capabilities. void AddCapabilities(Module* module); + // Removes the given |capability| from the current FeatureManager. + void RemoveCapability(spv::Capability capability); + + // Analyzes |module| and records imported external instruction sets. + void AddExtInstImportIds(Module* module); + // Auxiliary object for querying SPIR-V grammar facts. const AssemblyGrammar& grammar_; @@ -100,6 +103,8 @@ class FeatureManager { // Common NonSemanticShader100DebugInfo external instruction import ids, // cached for performance. uint32_t extinst_importid_Shader100DebugInfo_ = 0; + + friend class IRContext; }; } // namespace opt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/fix_func_call_arguments.cpp b/bgfx/3rdparty/spirv-tools/source/opt/fix_func_call_arguments.cpp index d140fb4b..f3486bed 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/fix_func_call_arguments.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/fix_func_call_arguments.cpp @@ -29,7 +29,7 @@ Pass::Status FixFuncCallArgumentsPass::Process() { if (ModuleHasASingleFunction()) return Status::SuccessWithoutChange; for (auto& func : *get_module()) { func.ForEachInst([this, &modified](Instruction* inst) { - if (inst->opcode() == SpvOpFunctionCall) { + if (inst->opcode() == spv::Op::OpFunctionCall) { modified |= FixFuncCallArguments(inst); } }); @@ -44,7 +44,7 @@ bool FixFuncCallArgumentsPass::FixFuncCallArguments( Operand& op = func_call_inst->GetInOperand(i); if (op.type != SPV_OPERAND_TYPE_ID) continue; Instruction* operand_inst = get_def_use_mgr()->GetDef(op.AsId()); - if (operand_inst->opcode() == SpvOpAccessChain) { + if (operand_inst->opcode() == spv::Op::OpAccessChain) { uint32_t var_id = ReplaceAccessChainFuncCallArguments(func_call_inst, operand_inst); func_call_inst->SetInOperand(i, {var_id}); @@ -71,10 +71,11 @@ uint32_t FixFuncCallArgumentsPass::ReplaceAccessChainFuncCallArguments( Instruction* op_type = get_def_use_mgr()->GetDef(op_ptr_type->GetSingleWordInOperand(1)); uint32_t varType = context()->get_type_mgr()->FindPointerToType( - op_type->result_id(), SpvStorageClassFunction); + op_type->result_id(), spv::StorageClass::Function); // Create new variable builder.SetInsertPoint(variable_insertion_point); - Instruction* var = builder.AddVariable(varType, SpvStorageClassFunction); + Instruction* var = + builder.AddVariable(varType, uint32_t(spv::StorageClass::Function)); // Load access chain to the new variable before function call builder.SetInsertPoint(func_call_inst); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/fix_storage_class.cpp b/bgfx/3rdparty/spirv-tools/source/opt/fix_storage_class.cpp index 04eb1326..5597e825 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/fix_storage_class.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/fix_storage_class.cpp @@ -26,7 +26,7 @@ Pass::Status FixStorageClass::Process() { bool modified = false; get_module()->ForEachInst([this, &modified](Instruction* inst) { - if (inst->opcode() == SpvOpVariable) { + if (inst->opcode() == spv::Op::OpVariable) { std::set seen; std::vector> uses; get_def_use_mgr()->ForEachUse(inst, @@ -37,7 +37,7 @@ Pass::Status FixStorageClass::Process() { for (auto& use : uses) { modified |= PropagateStorageClass( use.first, - static_cast(inst->GetSingleWordInOperand(0)), + static_cast(inst->GetSingleWordInOperand(0)), &seen); assert(seen.empty() && "Seen was not properly reset."); modified |= @@ -50,14 +50,14 @@ Pass::Status FixStorageClass::Process() { } bool FixStorageClass::PropagateStorageClass(Instruction* inst, - SpvStorageClass storage_class, + spv::StorageClass storage_class, std::set* seen) { if (!IsPointerResultType(inst)) { return false; } if (IsPointerToStorageClass(inst, storage_class)) { - if (inst->opcode() == SpvOpPhi) { + if (inst->opcode() == spv::Op::OpPhi) { if (!seen->insert(inst->result_id()).second) { return false; } @@ -71,34 +71,34 @@ bool FixStorageClass::PropagateStorageClass(Instruction* inst, modified |= PropagateStorageClass(use, storage_class, seen); } - if (inst->opcode() == SpvOpPhi) { + if (inst->opcode() == spv::Op::OpPhi) { seen->erase(inst->result_id()); } return modified; } switch (inst->opcode()) { - case SpvOpAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpCopyObject: - case SpvOpPhi: - case SpvOpSelect: + case spv::Op::OpAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpCopyObject: + case spv::Op::OpPhi: + case spv::Op::OpSelect: FixInstructionStorageClass(inst, storage_class, seen); return true; - case SpvOpFunctionCall: + case spv::Op::OpFunctionCall: // We cannot be sure of the actual connection between the storage class // of the parameter and the storage class of the result, so we should not // do anything. If the result type needs to be fixed, the function call // should be inlined. return false; - case SpvOpImageTexelPointer: - case SpvOpLoad: - case SpvOpStore: - case SpvOpCopyMemory: - case SpvOpCopyMemorySized: - case SpvOpVariable: - case SpvOpBitcast: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpLoad: + case spv::Op::OpStore: + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyMemorySized: + case spv::Op::OpVariable: + case spv::Op::OpBitcast: // Nothing to change for these opcode. The result type is the same // regardless of the storage class of the operand. return false; @@ -109,9 +109,9 @@ bool FixStorageClass::PropagateStorageClass(Instruction* inst, } } -void FixStorageClass::FixInstructionStorageClass(Instruction* inst, - SpvStorageClass storage_class, - std::set* seen) { +void FixStorageClass::FixInstructionStorageClass( + Instruction* inst, spv::StorageClass storage_class, + std::set* seen) { assert(IsPointerResultType(inst) && "The result type of the instruction must be a pointer."); @@ -126,10 +126,10 @@ void FixStorageClass::FixInstructionStorageClass(Instruction* inst, } void FixStorageClass::ChangeResultStorageClass( - Instruction* inst, SpvStorageClass storage_class) const { + Instruction* inst, spv::StorageClass storage_class) const { analysis::TypeManager* type_mgr = context()->get_type_mgr(); Instruction* result_type_inst = get_def_use_mgr()->GetDef(inst->type_id()); - assert(result_type_inst->opcode() == SpvOpTypePointer); + assert(result_type_inst->opcode() == spv::Op::OpTypePointer); uint32_t pointee_type_id = result_type_inst->GetSingleWordInOperand(1); uint32_t new_result_type_id = type_mgr->FindPointerToType(pointee_type_id, storage_class); @@ -147,7 +147,7 @@ bool FixStorageClass::IsPointerResultType(Instruction* inst) { } bool FixStorageClass::IsPointerToStorageClass(Instruction* inst, - SpvStorageClass storage_class) { + spv::StorageClass storage_class) { analysis::TypeManager* type_mgr = context()->get_type_mgr(); analysis::Type* pType = type_mgr->GetType(inst->type_id()); const analysis::Pointer* result_type = pType->AsPointer(); @@ -180,39 +180,39 @@ bool FixStorageClass::PropagateType(Instruction* inst, uint32_t type_id, // particular type, then we want find that type. uint32_t new_type_id = 0; switch (inst->opcode()) { - case SpvOpAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpInBoundsPtrAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: if (op_idx == 2) { new_type_id = WalkAccessChainType(inst, type_id); } break; - case SpvOpCopyObject: + case spv::Op::OpCopyObject: new_type_id = type_id; break; - case SpvOpPhi: + case spv::Op::OpPhi: if (seen->insert(inst->result_id()).second) { new_type_id = type_id; } break; - case SpvOpSelect: + case spv::Op::OpSelect: if (op_idx > 2) { new_type_id = type_id; } break; - case SpvOpFunctionCall: + case spv::Op::OpFunctionCall: // We cannot be sure of the actual connection between the type // of the parameter and the type of the result, so we should not // do anything. If the result type needs to be fixed, the function call // should be inlined. return false; - case SpvOpLoad: { + case spv::Op::OpLoad: { Instruction* type_inst = get_def_use_mgr()->GetDef(type_id); new_type_id = type_inst->GetSingleWordInOperand(1); break; } - case SpvOpStore: { + case spv::Op::OpStore: { uint32_t obj_id = inst->GetSingleWordInOperand(1); Instruction* obj_inst = get_def_use_mgr()->GetDef(obj_id); uint32_t obj_type_id = obj_inst->type_id(); @@ -237,18 +237,18 @@ bool FixStorageClass::PropagateType(Instruction* inst, uint32_t type_id, context()->UpdateDefUse(inst); } } break; - case SpvOpCopyMemory: - case SpvOpCopyMemorySized: + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyMemorySized: // TODO: May need to expand the copy as we do with the stores. break; - case SpvOpCompositeConstruct: - case SpvOpCompositeExtract: - case SpvOpCompositeInsert: + case spv::Op::OpCompositeConstruct: + case spv::Op::OpCompositeExtract: + case spv::Op::OpCompositeInsert: // TODO: DXC does not seem to generate code that will require changes to // these opcode. The can be implemented when they come up. break; - case SpvOpImageTexelPointer: - case SpvOpBitcast: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpBitcast: // Nothing to change for these opcode. The result type is the same // regardless of the type of the operand. return false; @@ -278,7 +278,7 @@ bool FixStorageClass::PropagateType(Instruction* inst, uint32_t type_id, PropagateType(use.first, new_type_id, use.second, seen); } - if (inst->opcode() == SpvOpPhi) { + if (inst->opcode() == spv::Op::OpPhi) { seen->erase(inst->result_id()); } } @@ -288,12 +288,12 @@ bool FixStorageClass::PropagateType(Instruction* inst, uint32_t type_id, uint32_t FixStorageClass::WalkAccessChainType(Instruction* inst, uint32_t id) { uint32_t start_idx = 0; switch (inst->opcode()) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: start_idx = 1; break; - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: start_idx = 2; break; default: @@ -302,19 +302,19 @@ uint32_t FixStorageClass::WalkAccessChainType(Instruction* inst, uint32_t id) { } Instruction* orig_type_inst = get_def_use_mgr()->GetDef(id); - assert(orig_type_inst->opcode() == SpvOpTypePointer); + assert(orig_type_inst->opcode() == spv::Op::OpTypePointer); id = orig_type_inst->GetSingleWordInOperand(1); for (uint32_t i = start_idx; i < inst->NumInOperands(); ++i) { Instruction* type_inst = get_def_use_mgr()->GetDef(id); switch (type_inst->opcode()) { - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: - case SpvOpTypeMatrix: - case SpvOpTypeVector: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeVector: id = type_inst->GetSingleWordInOperand(0); break; - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { const analysis::Constant* index_const = context()->get_constant_mgr()->FindDeclaredConstant( inst->GetSingleWordInOperand(i)); @@ -330,8 +330,8 @@ uint32_t FixStorageClass::WalkAccessChainType(Instruction* inst, uint32_t id) { } return context()->get_type_mgr()->FindPointerToType( - id, - static_cast(orig_type_inst->GetSingleWordInOperand(0))); + id, static_cast( + orig_type_inst->GetSingleWordInOperand(0))); } // namespace opt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/fix_storage_class.h b/bgfx/3rdparty/spirv-tools/source/opt/fix_storage_class.h index e72e864a..6c67acd3 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/fix_storage_class.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/fix_storage_class.h @@ -48,7 +48,7 @@ class FixStorageClass : public Pass { // appropriate, and propagates the change to the users of |inst| as well. // Returns true of any changes were made. // |seen| is used to track OpPhi instructions that should not be processed. - bool PropagateStorageClass(Instruction* inst, SpvStorageClass storage_class, + bool PropagateStorageClass(Instruction* inst, spv::StorageClass storage_class, std::set* seen); // Changes the storage class of the result of |inst| to |storage_class|. @@ -58,13 +58,13 @@ class FixStorageClass : public Pass { // |seen| is used to track OpPhi instructions that should not be processed by // |PropagateStorageClass| void FixInstructionStorageClass(Instruction* inst, - SpvStorageClass storage_class, + spv::StorageClass storage_class, std::set* seen); // Changes the storage class of the result of |inst| to |storage_class|. The // result type of |inst| must be a pointer. void ChangeResultStorageClass(Instruction* inst, - SpvStorageClass storage_class) const; + spv::StorageClass storage_class) const; // Returns true if the result type of |inst| is a pointer. bool IsPointerResultType(Instruction* inst); @@ -72,7 +72,7 @@ class FixStorageClass : public Pass { // Returns true if the result of |inst| is a pointer to storage class // |storage_class|. bool IsPointerToStorageClass(Instruction* inst, - SpvStorageClass storage_class); + spv::StorageClass storage_class); // Change |inst| to match that operand |op_idx| now has type |type_id|, and // adjust any uses of |inst| accordingly. Returns true if the code changed. diff --git a/bgfx/3rdparty/spirv-tools/source/opt/flatten_decoration_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/flatten_decoration_pass.cpp index f4de9116..c878c097 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/flatten_decoration_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/flatten_decoration_pass.cpp @@ -49,16 +49,16 @@ Pass::Status FlattenDecorationPass::Process() { // Rely on unordered_map::operator[] to create its entries on first access. for (const auto& inst : annotations) { switch (inst.opcode()) { - case SpvOp::SpvOpDecorationGroup: + case spv::Op::OpDecorationGroup: group_ids.insert(inst.result_id()); break; - case SpvOp::SpvOpGroupDecorate: { + case spv::Op::OpGroupDecorate: { Words& words = normal_uses[inst.GetSingleWordInOperand(0)]; for (uint32_t i = 1; i < inst.NumInOperandWords(); i++) { words.push_back(inst.GetSingleWordInOperand(i)); } } break; - case SpvOp::SpvOpGroupMemberDecorate: { + case spv::Op::OpGroupMemberDecorate: { Words& words = member_uses[inst.GetSingleWordInOperand(0)]; for (uint32_t i = 1; i < inst.NumInOperandWords(); i++) { words.push_back(inst.GetSingleWordInOperand(i)); @@ -77,12 +77,12 @@ Pass::Status FlattenDecorationPass::Process() { // Should we replace this instruction? bool replace = false; switch (inst_iter->opcode()) { - case SpvOp::SpvOpDecorationGroup: - case SpvOp::SpvOpGroupDecorate: - case SpvOp::SpvOpGroupMemberDecorate: + case spv::Op::OpDecorationGroup: + case spv::Op::OpGroupDecorate: + case spv::Op::OpGroupMemberDecorate: replace = true; break; - case SpvOp::SpvOpDecorate: { + case spv::Op::OpDecorate: { // If this decoration targets a group, then replace it // by sets of normal and member decorations. const uint32_t group = inst_iter->GetSingleWordOperand(0); @@ -115,7 +115,7 @@ Pass::Status FlattenDecorationPass::Process() { operands.insert(operands.end(), decoration_operands_iter, inst_iter->end()); std::unique_ptr new_inst(new Instruction( - context(), SpvOp::SpvOpMemberDecorate, 0, 0, operands)); + context(), spv::Op::OpMemberDecorate, 0, 0, operands)); inst_iter = inst_iter.InsertBefore(std::move(new_inst)); ++inst_iter; replace = true; @@ -146,7 +146,7 @@ Pass::Status FlattenDecorationPass::Process() { if (!group_ids.empty()) { for (auto debug_inst_iter = context()->debug2_begin(); debug_inst_iter != context()->debug2_end();) { - if (debug_inst_iter->opcode() == SpvOp::SpvOpName) { + if (debug_inst_iter->opcode() == spv::Op::OpName) { const uint32_t target = debug_inst_iter->GetSingleWordOperand(0); if (group_ids.count(target)) { debug_inst_iter = debug_inst_iter.Erase(); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/fold.cpp b/bgfx/3rdparty/spirv-tools/source/opt/fold.cpp index 315741ad..c2a97b6e 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/fold.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/fold.cpp @@ -21,7 +21,6 @@ #include "source/opt/const_folding_rules.h" #include "source/opt/def_use_manager.h" #include "source/opt/folding_rules.h" -#include "source/opt/ir_builder.h" #include "source/opt/ir_context.h" namespace spvtools { @@ -42,23 +41,24 @@ namespace { } // namespace -uint32_t InstructionFolder::UnaryOperate(SpvOp opcode, uint32_t operand) const { +uint32_t InstructionFolder::UnaryOperate(spv::Op opcode, + uint32_t operand) const { switch (opcode) { // Arthimetics - case SpvOp::SpvOpSNegate: { + case spv::Op::OpSNegate: { int32_t s_operand = static_cast(operand); if (s_operand == std::numeric_limits::min()) { return s_operand; } return -s_operand; } - case SpvOp::SpvOpNot: + case spv::Op::OpNot: return ~operand; - case SpvOp::SpvOpLogicalNot: + case spv::Op::OpLogicalNot: return !static_cast(operand); - case SpvOp::SpvOpUConvert: + case spv::Op::OpUConvert: return operand; - case SpvOp::SpvOpSConvert: + case spv::Op::OpSConvert: return operand; default: assert(false && @@ -67,31 +67,31 @@ uint32_t InstructionFolder::UnaryOperate(SpvOp opcode, uint32_t operand) const { } } -uint32_t InstructionFolder::BinaryOperate(SpvOp opcode, uint32_t a, +uint32_t InstructionFolder::BinaryOperate(spv::Op opcode, uint32_t a, uint32_t b) const { switch (opcode) { // Arthimetics - case SpvOp::SpvOpIAdd: + case spv::Op::OpIAdd: return a + b; - case SpvOp::SpvOpISub: + case spv::Op::OpISub: return a - b; - case SpvOp::SpvOpIMul: + case spv::Op::OpIMul: return a * b; - case SpvOp::SpvOpUDiv: + case spv::Op::OpUDiv: if (b != 0) { return a / b; } else { // Dividing by 0 is undefined, so we will just pick 0. return 0; } - case SpvOp::SpvOpSDiv: + case spv::Op::OpSDiv: if (b != 0u) { return (static_cast(a)) / (static_cast(b)); } else { // Dividing by 0 is undefined, so we will just pick 0. return 0; } - case SpvOp::SpvOpSRem: { + case spv::Op::OpSRem: { // The sign of non-zero result comes from the first operand: a. This is // guaranteed by C++11 rules for integer division operator. The division // result is rounded toward zero, so the result of '%' has the sign of @@ -103,10 +103,10 @@ uint32_t InstructionFolder::BinaryOperate(SpvOp opcode, uint32_t a, return 0; } } - case SpvOp::SpvOpSMod: { + case spv::Op::OpSMod: { // The sign of non-zero result comes from the second operand: b if (b != 0u) { - int32_t rem = BinaryOperate(SpvOp::SpvOpSRem, a, b); + int32_t rem = BinaryOperate(spv::Op::OpSRem, a, b); int32_t b_prim = static_cast(b); return (rem + b_prim) % b_prim; } else { @@ -114,7 +114,7 @@ uint32_t InstructionFolder::BinaryOperate(SpvOp opcode, uint32_t a, return 0; } } - case SpvOp::SpvOpUMod: + case spv::Op::OpUMod: if (b != 0u) { return (a % b); } else { @@ -123,7 +123,7 @@ uint32_t InstructionFolder::BinaryOperate(SpvOp opcode, uint32_t a, } // Shifting - case SpvOp::SpvOpShiftRightLogical: + case spv::Op::OpShiftRightLogical: if (b >= 32) { // This is undefined behaviour when |b| > 32. Choose 0 for consistency. // When |b| == 32, doing the shift in C++ in undefined, but the result @@ -131,7 +131,7 @@ uint32_t InstructionFolder::BinaryOperate(SpvOp opcode, uint32_t a, return 0; } return a >> b; - case SpvOp::SpvOpShiftRightArithmetic: + case spv::Op::OpShiftRightArithmetic: if (b > 32) { // This is undefined behaviour. Choose 0 for consistency. return 0; @@ -146,7 +146,7 @@ uint32_t InstructionFolder::BinaryOperate(SpvOp opcode, uint32_t a, } } return (static_cast(a)) >> b; - case SpvOp::SpvOpShiftLeftLogical: + case spv::Op::OpShiftLeftLogical: if (b >= 32) { // This is undefined behaviour when |b| > 32. Choose 0 for consistency. // When |b| == 32, doing the shift in C++ in undefined, but the result @@ -156,43 +156,43 @@ uint32_t InstructionFolder::BinaryOperate(SpvOp opcode, uint32_t a, return a << b; // Bitwise operations - case SpvOp::SpvOpBitwiseOr: + case spv::Op::OpBitwiseOr: return a | b; - case SpvOp::SpvOpBitwiseAnd: + case spv::Op::OpBitwiseAnd: return a & b; - case SpvOp::SpvOpBitwiseXor: + case spv::Op::OpBitwiseXor: return a ^ b; // Logical - case SpvOp::SpvOpLogicalEqual: + case spv::Op::OpLogicalEqual: return (static_cast(a)) == (static_cast(b)); - case SpvOp::SpvOpLogicalNotEqual: + case spv::Op::OpLogicalNotEqual: return (static_cast(a)) != (static_cast(b)); - case SpvOp::SpvOpLogicalOr: + case spv::Op::OpLogicalOr: return (static_cast(a)) || (static_cast(b)); - case SpvOp::SpvOpLogicalAnd: + case spv::Op::OpLogicalAnd: return (static_cast(a)) && (static_cast(b)); // Comparison - case SpvOp::SpvOpIEqual: + case spv::Op::OpIEqual: return a == b; - case SpvOp::SpvOpINotEqual: + case spv::Op::OpINotEqual: return a != b; - case SpvOp::SpvOpULessThan: + case spv::Op::OpULessThan: return a < b; - case SpvOp::SpvOpSLessThan: + case spv::Op::OpSLessThan: return (static_cast(a)) < (static_cast(b)); - case SpvOp::SpvOpUGreaterThan: + case spv::Op::OpUGreaterThan: return a > b; - case SpvOp::SpvOpSGreaterThan: + case spv::Op::OpSGreaterThan: return (static_cast(a)) > (static_cast(b)); - case SpvOp::SpvOpULessThanEqual: + case spv::Op::OpULessThanEqual: return a <= b; - case SpvOp::SpvOpSLessThanEqual: + case spv::Op::OpSLessThanEqual: return (static_cast(a)) <= (static_cast(b)); - case SpvOp::SpvOpUGreaterThanEqual: + case spv::Op::OpUGreaterThanEqual: return a >= b; - case SpvOp::SpvOpSGreaterThanEqual: + case spv::Op::OpSGreaterThanEqual: return (static_cast(a)) >= (static_cast(b)); default: assert(false && @@ -201,10 +201,10 @@ uint32_t InstructionFolder::BinaryOperate(SpvOp opcode, uint32_t a, } } -uint32_t InstructionFolder::TernaryOperate(SpvOp opcode, uint32_t a, uint32_t b, - uint32_t c) const { +uint32_t InstructionFolder::TernaryOperate(spv::Op opcode, uint32_t a, + uint32_t b, uint32_t c) const { switch (opcode) { - case SpvOp::SpvOpSelect: + case spv::Op::OpSelect: return (static_cast(a)) ? b : c; default: assert(false && @@ -214,7 +214,7 @@ uint32_t InstructionFolder::TernaryOperate(SpvOp opcode, uint32_t a, uint32_t b, } uint32_t InstructionFolder::OperateWords( - SpvOp opcode, const std::vector& operand_words) const { + spv::Op opcode, const std::vector& operand_words) const { switch (operand_words.size()) { case 1: return UnaryOperate(opcode, operand_words.front()); @@ -233,7 +233,7 @@ bool InstructionFolder::FoldInstructionInternal(Instruction* inst) const { auto identity_map = [](uint32_t id) { return id; }; Instruction* folded_inst = FoldInstructionToConstant(inst, identity_map); if (folded_inst != nullptr) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {folded_inst->result_id()}}}); return true; } @@ -256,7 +256,7 @@ bool InstructionFolder::FoldInstructionInternal(Instruction* inst) const { // result in 32 bit word. Scalar constants with longer than 32-bit width are // not accepted in this function. uint32_t InstructionFolder::FoldScalars( - SpvOp opcode, + spv::Op opcode, const std::vector& operands) const { assert(IsFoldableOpcode(opcode) && "Unhandled instruction opcode in FoldScalars"); @@ -282,7 +282,7 @@ uint32_t InstructionFolder::FoldScalars( bool InstructionFolder::FoldBinaryIntegerOpToConstant( Instruction* inst, const std::function& id_map, uint32_t* result) const { - SpvOp opcode = inst->opcode(); + spv::Op opcode = inst->opcode(); analysis::ConstantManager* const_manger = context_->get_constant_mgr(); uint32_t ids[2]; @@ -300,7 +300,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( switch (opcode) { // Arthimetics - case SpvOp::SpvOpIMul: + case spv::Op::OpIMul: for (uint32_t i = 0; i < 2; i++) { if (constants[i] != nullptr && constants[i]->IsZero()) { *result = 0; @@ -308,11 +308,11 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( } } break; - case SpvOp::SpvOpUDiv: - case SpvOp::SpvOpSDiv: - case SpvOp::SpvOpSRem: - case SpvOp::SpvOpSMod: - case SpvOp::SpvOpUMod: + case spv::Op::OpUDiv: + case spv::Op::OpSDiv: + case spv::Op::OpSRem: + case spv::Op::OpSMod: + case spv::Op::OpUMod: // This changes undefined behaviour (ie divide by 0) into a 0. for (uint32_t i = 0; i < 2; i++) { if (constants[i] != nullptr && constants[i]->IsZero()) { @@ -323,8 +323,8 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( break; // Shifting - case SpvOp::SpvOpShiftRightLogical: - case SpvOp::SpvOpShiftLeftLogical: + case spv::Op::OpShiftRightLogical: + case spv::Op::OpShiftLeftLogical: if (constants[1] != nullptr) { // When shifting by a value larger than the size of the result, the // result is undefined. We are setting the undefined behaviour to a @@ -339,7 +339,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( break; // Bitwise operations - case SpvOp::SpvOpBitwiseOr: + case spv::Op::OpBitwiseOr: for (uint32_t i = 0; i < 2; i++) { if (constants[i] != nullptr) { // TODO: Change the mask against a value based on the bit width of the @@ -353,7 +353,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( } } break; - case SpvOp::SpvOpBitwiseAnd: + case spv::Op::OpBitwiseAnd: for (uint32_t i = 0; i < 2; i++) { if (constants[i] != nullptr) { if (constants[i]->IsZero()) { @@ -365,7 +365,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( break; // Comparison - case SpvOp::SpvOpULessThan: + case spv::Op::OpULessThan: if (constants[0] != nullptr && constants[0]->GetU32BitValue() == UINT32_MAX) { *result = false; @@ -376,7 +376,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( return true; } break; - case SpvOp::SpvOpSLessThan: + case spv::Op::OpSLessThan: if (constants[0] != nullptr && constants[0]->GetS32BitValue() == INT32_MAX) { *result = false; @@ -388,7 +388,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( return true; } break; - case SpvOp::SpvOpUGreaterThan: + case spv::Op::OpUGreaterThan: if (constants[0] != nullptr && constants[0]->IsZero()) { *result = false; return true; @@ -399,7 +399,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( return true; } break; - case SpvOp::SpvOpSGreaterThan: + case spv::Op::OpSGreaterThan: if (constants[0] != nullptr && constants[0]->GetS32BitValue() == INT32_MIN) { *result = false; @@ -411,7 +411,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( return true; } break; - case SpvOp::SpvOpULessThanEqual: + case spv::Op::OpULessThanEqual: if (constants[0] != nullptr && constants[0]->IsZero()) { *result = true; return true; @@ -422,7 +422,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( return true; } break; - case SpvOp::SpvOpSLessThanEqual: + case spv::Op::OpSLessThanEqual: if (constants[0] != nullptr && constants[0]->GetS32BitValue() == INT32_MIN) { *result = true; @@ -434,7 +434,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( return true; } break; - case SpvOp::SpvOpUGreaterThanEqual: + case spv::Op::OpUGreaterThanEqual: if (constants[0] != nullptr && constants[0]->GetU32BitValue() == UINT32_MAX) { *result = true; @@ -445,7 +445,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( return true; } break; - case SpvOp::SpvOpSGreaterThanEqual: + case spv::Op::OpSGreaterThanEqual: if (constants[0] != nullptr && constants[0]->GetS32BitValue() == INT32_MAX) { *result = true; @@ -466,7 +466,7 @@ bool InstructionFolder::FoldBinaryIntegerOpToConstant( bool InstructionFolder::FoldBinaryBooleanOpToConstant( Instruction* inst, const std::function& id_map, uint32_t* result) const { - SpvOp opcode = inst->opcode(); + spv::Op opcode = inst->opcode(); analysis::ConstantManager* const_manger = context_->get_constant_mgr(); uint32_t ids[2]; @@ -484,7 +484,7 @@ bool InstructionFolder::FoldBinaryBooleanOpToConstant( switch (opcode) { // Logical - case SpvOp::SpvOpLogicalOr: + case spv::Op::OpLogicalOr: for (uint32_t i = 0; i < 2; i++) { if (constants[i] != nullptr) { if (constants[i]->value()) { @@ -494,7 +494,7 @@ bool InstructionFolder::FoldBinaryBooleanOpToConstant( } } break; - case SpvOp::SpvOpLogicalAnd: + case spv::Op::OpLogicalAnd: for (uint32_t i = 0; i < 2; i++) { if (constants[i] != nullptr) { if (!constants[i]->value()) { @@ -526,7 +526,7 @@ bool InstructionFolder::FoldIntegerOpToConstant( } std::vector InstructionFolder::FoldVectors( - SpvOp opcode, uint32_t num_dims, + spv::Op opcode, uint32_t num_dims, const std::vector& operands) const { assert(IsFoldableOpcode(opcode) && "Unhandled instruction opcode in FoldVectors"); @@ -570,44 +570,44 @@ std::vector InstructionFolder::FoldVectors( return result; } -bool InstructionFolder::IsFoldableOpcode(SpvOp opcode) const { +bool InstructionFolder::IsFoldableOpcode(spv::Op opcode) const { // NOTE: Extend to more opcodes as new cases are handled in the folder // functions. switch (opcode) { - case SpvOp::SpvOpBitwiseAnd: - case SpvOp::SpvOpBitwiseOr: - case SpvOp::SpvOpBitwiseXor: - case SpvOp::SpvOpIAdd: - case SpvOp::SpvOpIEqual: - case SpvOp::SpvOpIMul: - case SpvOp::SpvOpINotEqual: - case SpvOp::SpvOpISub: - case SpvOp::SpvOpLogicalAnd: - case SpvOp::SpvOpLogicalEqual: - case SpvOp::SpvOpLogicalNot: - case SpvOp::SpvOpLogicalNotEqual: - case SpvOp::SpvOpLogicalOr: - case SpvOp::SpvOpNot: - case SpvOp::SpvOpSDiv: - case SpvOp::SpvOpSelect: - case SpvOp::SpvOpSGreaterThan: - case SpvOp::SpvOpSGreaterThanEqual: - case SpvOp::SpvOpShiftLeftLogical: - case SpvOp::SpvOpShiftRightArithmetic: - case SpvOp::SpvOpShiftRightLogical: - case SpvOp::SpvOpSLessThan: - case SpvOp::SpvOpSLessThanEqual: - case SpvOp::SpvOpSMod: - case SpvOp::SpvOpSNegate: - case SpvOp::SpvOpSRem: - case SpvOp::SpvOpSConvert: - case SpvOp::SpvOpUConvert: - case SpvOp::SpvOpUDiv: - case SpvOp::SpvOpUGreaterThan: - case SpvOp::SpvOpUGreaterThanEqual: - case SpvOp::SpvOpULessThan: - case SpvOp::SpvOpULessThanEqual: - case SpvOp::SpvOpUMod: + case spv::Op::OpBitwiseAnd: + case spv::Op::OpBitwiseOr: + case spv::Op::OpBitwiseXor: + case spv::Op::OpIAdd: + case spv::Op::OpIEqual: + case spv::Op::OpIMul: + case spv::Op::OpINotEqual: + case spv::Op::OpISub: + case spv::Op::OpLogicalAnd: + case spv::Op::OpLogicalEqual: + case spv::Op::OpLogicalNot: + case spv::Op::OpLogicalNotEqual: + case spv::Op::OpLogicalOr: + case spv::Op::OpNot: + case spv::Op::OpSDiv: + case spv::Op::OpSelect: + case spv::Op::OpSGreaterThan: + case spv::Op::OpSGreaterThanEqual: + case spv::Op::OpShiftLeftLogical: + case spv::Op::OpShiftRightArithmetic: + case spv::Op::OpShiftRightLogical: + case spv::Op::OpSLessThan: + case spv::Op::OpSLessThanEqual: + case spv::Op::OpSMod: + case spv::Op::OpSNegate: + case spv::Op::OpSRem: + case spv::Op::OpSConvert: + case spv::Op::OpUConvert: + case spv::Op::OpUDiv: + case spv::Op::OpUGreaterThan: + case spv::Op::OpUGreaterThanEqual: + case spv::Op::OpULessThan: + case spv::Op::OpULessThanEqual: + case spv::Op::OpUMod: return true; default: return false; @@ -627,7 +627,8 @@ Instruction* InstructionFolder::FoldInstructionToConstant( Instruction* inst, std::function id_map) const { analysis::ConstantManager* const_mgr = context_->get_constant_mgr(); - if (!inst->IsFoldableByFoldScalar() && !HasConstFoldingRule(inst)) { + if (!inst->IsFoldableByFoldScalar() && !inst->IsFoldableByFoldVector() && + !GetConstantFoldingRules().HasFoldingRule(inst)) { return nullptr; } // Collect the values of the constant parameters. @@ -661,45 +662,87 @@ Instruction* InstructionFolder::FoldInstructionToConstant( } } - uint32_t result_val = 0; bool successful = false; + // If all parameters are constant, fold the instruction to a constant. - if (!missing_constants && inst->IsFoldableByFoldScalar()) { - result_val = FoldScalars(inst->opcode(), constants); - successful = true; - } + if (inst->IsFoldableByFoldScalar()) { + uint32_t result_val = 0; - if (!successful && inst->IsFoldableByFoldScalar()) { - successful = FoldIntegerOpToConstant(inst, id_map, &result_val); - } + if (!missing_constants) { + result_val = FoldScalars(inst->opcode(), constants); + successful = true; + } + + if (!successful) { + successful = FoldIntegerOpToConstant(inst, id_map, &result_val); + } + + if (successful) { + const analysis::Constant* result_const = + const_mgr->GetConstant(const_mgr->GetType(inst), {result_val}); + Instruction* folded_inst = + const_mgr->GetDefiningInstruction(result_const, inst->type_id()); + return folded_inst; + } + } else if (inst->IsFoldableByFoldVector()) { + std::vector result_val; + + if (!missing_constants) { + if (Instruction* inst_type = + context_->get_def_use_mgr()->GetDef(inst->type_id())) { + result_val = FoldVectors( + inst->opcode(), inst_type->GetSingleWordInOperand(1), constants); + successful = true; + } + } - if (successful) { - const analysis::Constant* result_const = - const_mgr->GetConstant(const_mgr->GetType(inst), {result_val}); - Instruction* folded_inst = - const_mgr->GetDefiningInstruction(result_const, inst->type_id()); - return folded_inst; + if (successful) { + const analysis::Constant* result_const = + const_mgr->GetNumericVectorConstantWithWords( + const_mgr->GetType(inst)->AsVector(), result_val); + Instruction* folded_inst = + const_mgr->GetDefiningInstruction(result_const, inst->type_id()); + return folded_inst; + } } + return nullptr; } bool InstructionFolder::IsFoldableType(Instruction* type_inst) const { + return IsFoldableScalarType(type_inst) || IsFoldableVectorType(type_inst); +} + +bool InstructionFolder::IsFoldableScalarType(Instruction* type_inst) const { // Support 32-bit integers. - if (type_inst->opcode() == SpvOpTypeInt) { + if (type_inst->opcode() == spv::Op::OpTypeInt) { return type_inst->GetSingleWordInOperand(0) == 32; } // Support booleans. - if (type_inst->opcode() == SpvOpTypeBool) { + if (type_inst->opcode() == spv::Op::OpTypeBool) { return true; } // Nothing else yet. return false; } +bool InstructionFolder::IsFoldableVectorType(Instruction* type_inst) const { + // Support vectors with foldable components + if (type_inst->opcode() == spv::Op::OpTypeVector) { + uint32_t component_type_id = type_inst->GetSingleWordInOperand(0); + Instruction* def_component_type = + context_->get_def_use_mgr()->GetDef(component_type_id); + return def_component_type != nullptr && + IsFoldableScalarType(def_component_type); + } + // Nothing else yet. + return false; +} + bool InstructionFolder::FoldInstruction(Instruction* inst) const { bool modified = false; Instruction* folded_inst(inst); - while (folded_inst->opcode() != SpvOpCopyObject && + while (folded_inst->opcode() != spv::Op::OpCopyObject && FoldInstructionInternal(&*folded_inst)) { modified = true; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/fold.h b/bgfx/3rdparty/spirv-tools/source/opt/fold.h index 9e7c4705..42da65e4 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/fold.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/fold.h @@ -55,7 +55,7 @@ class InstructionFolder { // IsFoldableOpcode test. If any error occurs during folding, the folder will // fail with a call to assert. uint32_t FoldScalars( - SpvOp opcode, + spv::Op opcode, const std::vector& operands) const; // Returns the result of performing an operation with the given |opcode| over @@ -72,12 +72,12 @@ class InstructionFolder { // IsFoldableOpcode test. If any error occurs during folding, the folder will // fail with a call to assert. std::vector FoldVectors( - SpvOp opcode, uint32_t num_dims, + spv::Op opcode, uint32_t num_dims, const std::vector& operands) const; // Returns true if |opcode| represents an operation handled by FoldScalars or // FoldVectors. - bool IsFoldableOpcode(SpvOp opcode) const; + bool IsFoldableOpcode(spv::Op opcode) const; // Returns true if |cst| is supported by FoldScalars and FoldVectors. bool IsFoldableConstant(const analysis::Constant* cst) const; @@ -86,6 +86,14 @@ class InstructionFolder { // result type is |type_inst|. bool IsFoldableType(Instruction* type_inst) const; + // Returns true if |FoldInstructionToConstant| could fold an instruction whose + // result type is |type_inst|. + bool IsFoldableScalarType(Instruction* type_inst) const; + + // Returns true if |FoldInstructionToConstant| could fold an instruction whose + // result type is |type_inst|. + bool IsFoldableVectorType(Instruction* type_inst) const; + // Tries to fold |inst| to a single constant, when the input ids to |inst| // have been substituted using |id_map|. Returns a pointer to the OpConstant* // instruction if successful. If necessary, a new constant instruction is @@ -126,22 +134,22 @@ class InstructionFolder { // Returns the single-word result from performing the given unary operation on // the operand value which is passed in as a 32-bit word. - uint32_t UnaryOperate(SpvOp opcode, uint32_t operand) const; + uint32_t UnaryOperate(spv::Op opcode, uint32_t operand) const; // Returns the single-word result from performing the given binary operation // on the operand values which are passed in as two 32-bit word. - uint32_t BinaryOperate(SpvOp opcode, uint32_t a, uint32_t b) const; + uint32_t BinaryOperate(spv::Op opcode, uint32_t a, uint32_t b) const; // Returns the single-word result from performing the given ternary operation // on the operand values which are passed in as three 32-bit word. - uint32_t TernaryOperate(SpvOp opcode, uint32_t a, uint32_t b, + uint32_t TernaryOperate(spv::Op opcode, uint32_t a, uint32_t b, uint32_t c) const; // Returns the single-word result from performing the given operation on the // operand words. This only works with 32-bit operations and uses boolean // convention that 0u is false, and anything else is boolean true. // TODO(qining): Support operands other than 32-bit wide. - uint32_t OperateWords(SpvOp opcode, + uint32_t OperateWords(spv::Op opcode, const std::vector& operand_words) const; bool FoldInstructionInternal(Instruction* inst) const; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp index 7a518701..f6d61554 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp @@ -15,12 +15,9 @@ #include "source/opt/fold_spec_constant_op_and_composite_pass.h" #include -#include #include #include "source/opt/constants.h" -#include "source/opt/fold.h" -#include "source/opt/ir_context.h" #include "source/util/make_unique.h" namespace spvtools { @@ -66,14 +63,14 @@ Pass::Status FoldSpecConstantOpAndCompositePass::Process() { if (const_mgr->GetType(inst) && !const_mgr->GetType(inst)->decoration_empty()) continue; - switch (SpvOp opcode = inst->opcode()) { + switch (spv::Op opcode = inst->opcode()) { // Records the values of Normal Constants. - case SpvOp::SpvOpConstantTrue: - case SpvOp::SpvOpConstantFalse: - case SpvOp::SpvOpConstant: - case SpvOp::SpvOpConstantNull: - case SpvOp::SpvOpConstantComposite: - case SpvOp::SpvOpSpecConstantComposite: { + case spv::Op::OpConstantTrue: + case spv::Op::OpConstantFalse: + case spv::Op::OpConstant: + case spv::Op::OpConstantNull: + case spv::Op::OpConstantComposite: + case spv::Op::OpSpecConstantComposite: { // A Constant instance will be created if the given instruction is a // Normal Constant whose value(s) are fixed. Note that for a composite // Spec Constant defined with OpSpecConstantComposite instruction, if @@ -84,8 +81,8 @@ Pass::Status FoldSpecConstantOpAndCompositePass::Process() { if (auto const_value = const_mgr->GetConstantFromInst(inst)) { // Need to replace the OpSpecConstantComposite instruction with a // corresponding OpConstantComposite instruction. - if (opcode == SpvOp::SpvOpSpecConstantComposite) { - inst->SetOpcode(SpvOp::SpvOpConstantComposite); + if (opcode == spv::Op::OpSpecConstantComposite) { + inst->SetOpcode(spv::Op::OpConstantComposite); modified = true; } const_mgr->MapConstantToInst(const_value, inst); @@ -99,7 +96,7 @@ Pass::Status FoldSpecConstantOpAndCompositePass::Process() { // Constants will be added to id_to_const_val_ and const_val_to_id_ so // that we can use the new Normal Constants when folding following Spec // Constants. - case SpvOp::SpvOpSpecConstantOp: + case spv::Op::OpSpecConstantOp: modified |= ProcessOpSpecConstantOp(&inst_iter); break; default: @@ -118,11 +115,11 @@ bool FoldSpecConstantOpAndCompositePass::ProcessOpSpecConstantOp( "The first in-operand of OpSpecConstantOp instruction must be of " "SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER type"); - switch (static_cast(inst->GetSingleWordInOperand(0))) { - case SpvOp::SpvOpCompositeExtract: - case SpvOp::SpvOpVectorShuffle: - case SpvOp::SpvOpCompositeInsert: - case SpvOp::SpvOpQuantizeToF16: + switch (static_cast(inst->GetSingleWordInOperand(0))) { + case spv::Op::OpCompositeExtract: + case spv::Op::OpVectorShuffle: + case spv::Op::OpCompositeInsert: + case spv::Op::OpQuantizeToF16: folded_inst = FoldWithInstructionFolder(pos); break; default: @@ -165,7 +162,7 @@ Instruction* FoldSpecConstantOpAndCompositePass::FoldWithInstructionFolder( // instruction and pass it to the instruction folder. std::unique_ptr inst((*inst_iter_ptr)->Clone(context())); inst->SetOpcode( - static_cast((*inst_iter_ptr)->GetSingleWordInOperand(0))); + static_cast((*inst_iter_ptr)->GetSingleWordInOperand(0))); inst->RemoveOperand(2); // We want the current instruction to be replaced by an |OpConstant*| @@ -289,7 +286,7 @@ Instruction* FoldSpecConstantOpAndCompositePass::DoComponentWiseOperation( const Instruction* inst = &**pos; analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); const analysis::Type* result_type = const_mgr->GetType(inst); - SpvOp spec_opcode = static_cast(inst->GetSingleWordInOperand(0)); + spv::Op spec_opcode = static_cast(inst->GetSingleWordInOperand(0)); // Check and collect operands. std::vector operands; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.cpp b/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.cpp index 3f10bd00..293236d9 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.cpp @@ -14,7 +14,6 @@ #include "source/opt/folding_rules.h" -#include #include #include #include @@ -27,15 +26,15 @@ namespace spvtools { namespace opt { namespace { -const uint32_t kExtractCompositeIdInIdx = 0; -const uint32_t kInsertObjectIdInIdx = 0; -const uint32_t kInsertCompositeIdInIdx = 1; -const uint32_t kExtInstSetIdInIdx = 0; -const uint32_t kExtInstInstructionInIdx = 1; -const uint32_t kFMixXIdInIdx = 2; -const uint32_t kFMixYIdInIdx = 3; -const uint32_t kFMixAIdInIdx = 4; -const uint32_t kStoreObjectInIdx = 1; +constexpr uint32_t kExtractCompositeIdInIdx = 0; +constexpr uint32_t kInsertObjectIdInIdx = 0; +constexpr uint32_t kInsertCompositeIdInIdx = 1; +constexpr uint32_t kExtInstSetIdInIdx = 0; +constexpr uint32_t kExtInstInstructionInIdx = 1; +constexpr uint32_t kFMixXIdInIdx = 2; +constexpr uint32_t kFMixYIdInIdx = 3; +constexpr uint32_t kFMixAIdInIdx = 4; +constexpr uint32_t kStoreObjectInIdx = 1; // Some image instructions may contain an "image operands" argument. // Returns the operand index for the "image operands". @@ -43,33 +42,33 @@ const uint32_t kStoreObjectInIdx = 1; int32_t ImageOperandsMaskInOperandIndex(Instruction* inst) { const auto opcode = inst->opcode(); switch (opcode) { - case SpvOpImageSampleImplicitLod: - case SpvOpImageSampleExplicitLod: - case SpvOpImageSampleProjImplicitLod: - case SpvOpImageSampleProjExplicitLod: - case SpvOpImageFetch: - case SpvOpImageRead: - case SpvOpImageSparseSampleImplicitLod: - case SpvOpImageSparseSampleExplicitLod: - case SpvOpImageSparseSampleProjImplicitLod: - case SpvOpImageSparseSampleProjExplicitLod: - case SpvOpImageSparseFetch: - case SpvOpImageSparseRead: + case spv::Op::OpImageSampleImplicitLod: + case spv::Op::OpImageSampleExplicitLod: + case spv::Op::OpImageSampleProjImplicitLod: + case spv::Op::OpImageSampleProjExplicitLod: + case spv::Op::OpImageFetch: + case spv::Op::OpImageRead: + case spv::Op::OpImageSparseSampleImplicitLod: + case spv::Op::OpImageSparseSampleExplicitLod: + case spv::Op::OpImageSparseSampleProjImplicitLod: + case spv::Op::OpImageSparseSampleProjExplicitLod: + case spv::Op::OpImageSparseFetch: + case spv::Op::OpImageSparseRead: return inst->NumOperands() > 4 ? 2 : -1; - case SpvOpImageSampleDrefImplicitLod: - case SpvOpImageSampleDrefExplicitLod: - case SpvOpImageSampleProjDrefImplicitLod: - case SpvOpImageSampleProjDrefExplicitLod: - case SpvOpImageGather: - case SpvOpImageDrefGather: - case SpvOpImageSparseSampleDrefImplicitLod: - case SpvOpImageSparseSampleDrefExplicitLod: - case SpvOpImageSparseSampleProjDrefImplicitLod: - case SpvOpImageSparseSampleProjDrefExplicitLod: - case SpvOpImageSparseGather: - case SpvOpImageSparseDrefGather: + case spv::Op::OpImageSampleDrefImplicitLod: + case spv::Op::OpImageSampleDrefExplicitLod: + case spv::Op::OpImageSampleProjDrefImplicitLod: + case spv::Op::OpImageSampleProjDrefExplicitLod: + case spv::Op::OpImageGather: + case spv::Op::OpImageDrefGather: + case spv::Op::OpImageSparseSampleDrefImplicitLod: + case spv::Op::OpImageSparseSampleDrefExplicitLod: + case spv::Op::OpImageSparseSampleProjDrefImplicitLod: + case spv::Op::OpImageSparseSampleProjDrefExplicitLod: + case spv::Op::OpImageSparseGather: + case spv::Op::OpImageSparseDrefGather: return inst->NumOperands() > 5 ? 3 : -1; - case SpvOpImageWrite: + case spv::Op::OpImageWrite: return inst->NumOperands() > 3 ? 3 : -1; default: return -1; @@ -136,25 +135,28 @@ std::vector GetWordsFromScalarIntConstant( const analysis::IntConstant* c) { assert(c != nullptr); uint32_t width = c->type()->AsInteger()->width(); - assert(width == 32 || width == 64); + assert(width == 8 || width == 16 || width == 32 || width == 64); if (width == 64) { uint64_t uval = static_cast(c->GetU64()); return ExtractInts(uval); } - return {c->GetU32()}; + // Section 2.2.1 of the SPIR-V spec guarantees that all integer types + // smaller than 32-bits are automatically zero or sign extended to 32-bits. + return {c->GetU32BitValue()}; } std::vector GetWordsFromScalarFloatConstant( const analysis::FloatConstant* c) { assert(c != nullptr); uint32_t width = c->type()->AsFloat()->width(); - assert(width == 32 || width == 64); + assert(width == 16 || width == 32 || width == 64); if (width == 64) { utils::FloatProxy result(c->GetDouble()); return result.GetWords(); } - utils::FloatProxy result(c->GetFloat()); - return result.GetWords(); + // Section 2.2.1 of the SPIR-V spec guarantees that all floating-point types + // smaller than 32-bits are automatically zero extended to 32-bits. + return {c->GetU32BitValue()}; } std::vector GetWordsFromNumericScalarOrVectorConstant( @@ -301,7 +303,7 @@ uint32_t Reciprocal(analysis::ConstantManager* const_mgr, FoldingRule ReciprocalFDiv() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFDiv); + assert(inst->opcode() == spv::Op::OpFDiv); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); @@ -330,7 +332,7 @@ FoldingRule ReciprocalFDiv() { // Don't fold a null constant. return false; } - inst->SetOpcode(SpvOpFMul); + inst->SetOpcode(spv::Op::OpFMul); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(0u)}}, {SPV_OPERAND_TYPE_ID, {id}}}); @@ -345,7 +347,8 @@ FoldingRule ReciprocalFDiv() { FoldingRule MergeNegateArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFNegate || inst->opcode() == SpvOpSNegate); + assert(inst->opcode() == spv::Op::OpFNegate || + inst->opcode() == spv::Op::OpSNegate); (void)constants; const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); @@ -359,7 +362,7 @@ FoldingRule MergeNegateArithmetic() { if (op_inst->opcode() == inst->opcode()) { // Elide negates. - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {op_inst->GetSingleWordInOperand(0u)}}}); return true; @@ -379,7 +382,8 @@ FoldingRule MergeNegateArithmetic() { FoldingRule MergeNegateMulDivArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFNegate || inst->opcode() == SpvOpSNegate); + assert(inst->opcode() == spv::Op::OpFNegate || + inst->opcode() == spv::Op::OpSNegate); (void)constants; analysis::ConstantManager* const_mgr = context->get_constant_mgr(); const analysis::Type* type = @@ -395,9 +399,10 @@ FoldingRule MergeNegateMulDivArithmetic() { uint32_t width = ElementWidth(type); if (width != 32 && width != 64) return false; - SpvOp opcode = op_inst->opcode(); - if (opcode == SpvOpFMul || opcode == SpvOpFDiv || opcode == SpvOpIMul || - opcode == SpvOpSDiv || opcode == SpvOpUDiv) { + spv::Op opcode = op_inst->opcode(); + if (opcode == spv::Op::OpFMul || opcode == spv::Op::OpFDiv || + opcode == spv::Op::OpIMul || opcode == spv::Op::OpSDiv || + opcode == spv::Op::OpUDiv) { std::vector op_constants = const_mgr->GetOperandConstants(op_inst); // Merge negate into mul or div if one operand is constant. @@ -410,7 +415,8 @@ FoldingRule MergeNegateMulDivArithmetic() { : op_inst->GetSingleWordInOperand(1u); // Change this instruction to a mul/div. inst->SetOpcode(op_inst->opcode()); - if (opcode == SpvOpFDiv || opcode == SpvOpUDiv || opcode == SpvOpSDiv) { + if (opcode == spv::Op::OpFDiv || opcode == spv::Op::OpUDiv || + opcode == spv::Op::OpSDiv) { uint32_t op0 = zero_is_variable ? non_const_id : neg_id; uint32_t op1 = zero_is_variable ? neg_id : non_const_id; inst->SetInOperands( @@ -437,7 +443,8 @@ FoldingRule MergeNegateMulDivArithmetic() { FoldingRule MergeNegateAddSubArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFNegate || inst->opcode() == SpvOpSNegate); + assert(inst->opcode() == spv::Op::OpFNegate || + inst->opcode() == spv::Op::OpSNegate); (void)constants; analysis::ConstantManager* const_mgr = context->get_constant_mgr(); const analysis::Type* type = @@ -453,14 +460,16 @@ FoldingRule MergeNegateAddSubArithmetic() { uint32_t width = ElementWidth(type); if (width != 32 && width != 64) return false; - if (op_inst->opcode() == SpvOpFAdd || op_inst->opcode() == SpvOpFSub || - op_inst->opcode() == SpvOpIAdd || op_inst->opcode() == SpvOpISub) { + if (op_inst->opcode() == spv::Op::OpFAdd || + op_inst->opcode() == spv::Op::OpFSub || + op_inst->opcode() == spv::Op::OpIAdd || + op_inst->opcode() == spv::Op::OpISub) { std::vector op_constants = const_mgr->GetOperandConstants(op_inst); if (op_constants[0] || op_constants[1]) { bool zero_is_variable = op_constants[0] == nullptr; - bool is_add = (op_inst->opcode() == SpvOpFAdd) || - (op_inst->opcode() == SpvOpIAdd); + bool is_add = (op_inst->opcode() == spv::Op::OpFAdd) || + (op_inst->opcode() == spv::Op::OpIAdd); bool swap_operands = !is_add || zero_is_variable; bool negate_const = is_add; const analysis::Constant* c = ConstInput(op_constants); @@ -478,7 +487,8 @@ FoldingRule MergeNegateAddSubArithmetic() { uint32_t op1 = zero_is_variable ? const_id : op_inst->GetSingleWordInOperand(1u); if (swap_operands) std::swap(op0, op1); - inst->SetOpcode(HasFloatingPoint(type) ? SpvOpFSub : SpvOpISub); + inst->SetOpcode(HasFloatingPoint(type) ? spv::Op::OpFSub + : spv::Op::OpISub); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {op0}}, {SPV_OPERAND_TYPE_ID, {op1}}}); return true; @@ -509,7 +519,7 @@ bool HasZero(const analysis::Constant* c) { // id. Returns 0 if the result is not a valid value. The input types must be // Float. uint32_t PerformFloatingPointOperation(analysis::ConstantManager* const_mgr, - SpvOp opcode, + spv::Op opcode, const analysis::Constant* input1, const analysis::Constant* input2) { const analysis::Type* type = input1->type(); @@ -532,17 +542,17 @@ uint32_t PerformFloatingPointOperation(analysis::ConstantManager* const_mgr, } \ static_assert(true, "require extra semicolon") switch (opcode) { - case SpvOpFMul: + case spv::Op::OpFMul: FOLD_OP(*); break; - case SpvOpFDiv: + case spv::Op::OpFDiv: if (HasZero(input2)) return 0; FOLD_OP(/); break; - case SpvOpFAdd: + case spv::Op::OpFAdd: FOLD_OP(+); break; - case SpvOpFSub: + case spv::Op::OpFSub: FOLD_OP(-); break; default: @@ -558,7 +568,8 @@ uint32_t PerformFloatingPointOperation(analysis::ConstantManager* const_mgr, // id. Returns 0 if the result is not a valid value. The input types must be // Integers. uint32_t PerformIntegerOperation(analysis::ConstantManager* const_mgr, - SpvOp opcode, const analysis::Constant* input1, + spv::Op opcode, + const analysis::Constant* input1, const analysis::Constant* input2) { assert(input1->type()->AsInteger()); const analysis::Integer* type = input1->type()->AsInteger(); @@ -579,17 +590,17 @@ uint32_t PerformIntegerOperation(analysis::ConstantManager* const_mgr, } \ static_assert(true, "require extra semicolon") switch (opcode) { - case SpvOpIMul: + case spv::Op::OpIMul: FOLD_OP(*); break; - case SpvOpSDiv: - case SpvOpUDiv: + case spv::Op::OpSDiv: + case spv::Op::OpUDiv: assert(false && "Should not merge integer division"); break; - case SpvOpIAdd: + case spv::Op::OpIAdd: FOLD_OP(+); break; - case SpvOpISub: + case spv::Op::OpISub: FOLD_OP(-); break; default: @@ -604,7 +615,7 @@ uint32_t PerformIntegerOperation(analysis::ConstantManager* const_mgr, // Performs |input1| |opcode| |input2| and returns the merged constant result // id. Returns 0 if the result is not a valid value. The input types must be // Integers, Floats or Vectors of such. -uint32_t PerformOperation(analysis::ConstantManager* const_mgr, SpvOp opcode, +uint32_t PerformOperation(analysis::ConstantManager* const_mgr, spv::Op opcode, const analysis::Constant* input1, const analysis::Constant* input2) { assert(input1 && input2); @@ -664,7 +675,8 @@ uint32_t PerformOperation(analysis::ConstantManager* const_mgr, SpvOp opcode, FoldingRule MergeMulMulArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFMul || inst->opcode() == SpvOpIMul); + assert(inst->opcode() == spv::Op::OpFMul || + inst->opcode() == spv::Op::OpIMul); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); @@ -716,7 +728,7 @@ FoldingRule MergeMulMulArithmetic() { FoldingRule MergeMulDivArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFMul); + assert(inst->opcode() == spv::Op::OpFMul); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); @@ -730,10 +742,10 @@ FoldingRule MergeMulDivArithmetic() { for (uint32_t i = 0; i < 2; i++) { uint32_t op_id = inst->GetSingleWordInOperand(i); Instruction* op_inst = def_use_mgr->GetDef(op_id); - if (op_inst->opcode() == SpvOpFDiv) { + if (op_inst->opcode() == spv::Op::OpFDiv) { if (op_inst->GetSingleWordInOperand(1) == inst->GetSingleWordInOperand(1 - i)) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {op_inst->GetSingleWordInOperand(0)}}}); return true; @@ -746,7 +758,7 @@ FoldingRule MergeMulDivArithmetic() { Instruction* other_inst = NonConstInput(context, constants[0], inst); if (!other_inst->IsFloatingPointFoldingAllowed()) return false; - if (other_inst->opcode() == SpvOpFDiv) { + if (other_inst->opcode() == spv::Op::OpFDiv) { std::vector other_constants = const_mgr->GetOperandConstants(other_inst); const analysis::Constant* const_input2 = ConstInput(other_constants); @@ -790,7 +802,8 @@ FoldingRule MergeMulDivArithmetic() { FoldingRule MergeMulNegateArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFMul || inst->opcode() == SpvOpIMul); + assert(inst->opcode() == spv::Op::OpFMul || + inst->opcode() == spv::Op::OpIMul); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); @@ -806,8 +819,8 @@ FoldingRule MergeMulNegateArithmetic() { if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) return false; - if (other_inst->opcode() == SpvOpFNegate || - other_inst->opcode() == SpvOpSNegate) { + if (other_inst->opcode() == spv::Op::OpFNegate || + other_inst->opcode() == spv::Op::OpSNegate) { uint32_t neg_id = NegateConstant(const_mgr, const_input1); inst->SetInOperands( @@ -830,7 +843,7 @@ FoldingRule MergeMulNegateArithmetic() { FoldingRule MergeDivDivArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFDiv); + assert(inst->opcode() == spv::Op::OpFDiv); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); @@ -853,10 +866,10 @@ FoldingRule MergeDivDivArithmetic() { bool other_first_is_variable = other_constants[0] == nullptr; - SpvOp merge_op = inst->opcode(); + spv::Op merge_op = inst->opcode(); if (other_first_is_variable) { // Constants magnify. - merge_op = SpvOpFMul; + merge_op = spv::Op::OpFMul; } // This is an x / (*) case. Swap the inputs. Doesn't harm multiply @@ -870,10 +883,10 @@ FoldingRule MergeDivDivArithmetic() { ? other_inst->GetSingleWordInOperand(0u) : other_inst->GetSingleWordInOperand(1u); - SpvOp op = inst->opcode(); + spv::Op op = inst->opcode(); if (!first_is_variable && !other_first_is_variable) { // Effectively div of 1/x, so change to multiply. - op = SpvOpFMul; + op = spv::Op::OpFMul; } uint32_t op1 = merged_id; @@ -901,7 +914,7 @@ FoldingRule MergeDivDivArithmetic() { FoldingRule MergeDivMulArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFDiv); + assert(inst->opcode() == spv::Op::OpFDiv); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); @@ -915,11 +928,11 @@ FoldingRule MergeDivMulArithmetic() { uint32_t op_id = inst->GetSingleWordInOperand(0); Instruction* op_inst = def_use_mgr->GetDef(op_id); - if (op_inst->opcode() == SpvOpFMul) { + if (op_inst->opcode() == spv::Op::OpFMul) { for (uint32_t i = 0; i < 2; i++) { if (op_inst->GetSingleWordInOperand(i) == inst->GetSingleWordInOperand(1)) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {op_inst->GetSingleWordInOperand(1 - i)}}}); return true; @@ -933,7 +946,7 @@ FoldingRule MergeDivMulArithmetic() { if (!other_inst->IsFloatingPointFoldingAllowed()) return false; bool first_is_variable = constants[0] == nullptr; - if (other_inst->opcode() == SpvOpFMul) { + if (other_inst->opcode() == spv::Op::OpFMul) { std::vector other_constants = const_mgr->GetOperandConstants(other_inst); const analysis::Constant* const_input2 = ConstInput(other_constants); @@ -973,7 +986,7 @@ FoldingRule MergeDivMulArithmetic() { FoldingRule MergeDivNegateArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFDiv); + assert(inst->opcode() == spv::Op::OpFDiv); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); if (!inst->IsFloatingPointFoldingAllowed()) return false; @@ -983,7 +996,7 @@ FoldingRule MergeDivNegateArithmetic() { if (!other_inst->IsFloatingPointFoldingAllowed()) return false; bool first_is_variable = constants[0] == nullptr; - if (other_inst->opcode() == SpvOpFNegate) { + if (other_inst->opcode() == spv::Op::OpFNegate) { uint32_t neg_id = NegateConstant(const_mgr, const_input1); if (first_is_variable) { @@ -1009,7 +1022,8 @@ FoldingRule MergeDivNegateArithmetic() { FoldingRule MergeAddNegateArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFAdd || inst->opcode() == SpvOpIAdd); + assert(inst->opcode() == spv::Op::OpFAdd || + inst->opcode() == spv::Op::OpIAdd); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); bool uses_float = HasFloatingPoint(type); @@ -1021,9 +1035,10 @@ FoldingRule MergeAddNegateArithmetic() { if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) return false; - if (other_inst->opcode() == SpvOpSNegate || - other_inst->opcode() == SpvOpFNegate) { - inst->SetOpcode(HasFloatingPoint(type) ? SpvOpFSub : SpvOpISub); + if (other_inst->opcode() == spv::Op::OpSNegate || + other_inst->opcode() == spv::Op::OpFNegate) { + inst->SetOpcode(HasFloatingPoint(type) ? spv::Op::OpFSub + : spv::Op::OpISub); uint32_t const_id = constants[0] ? inst->GetSingleWordInOperand(0u) : inst->GetSingleWordInOperand(1u); inst->SetInOperands( @@ -1042,7 +1057,8 @@ FoldingRule MergeAddNegateArithmetic() { FoldingRule MergeSubNegateArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFSub || inst->opcode() == SpvOpISub); + assert(inst->opcode() == spv::Op::OpFSub || + inst->opcode() == spv::Op::OpISub); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); @@ -1058,15 +1074,15 @@ FoldingRule MergeSubNegateArithmetic() { if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) return false; - if (other_inst->opcode() == SpvOpSNegate || - other_inst->opcode() == SpvOpFNegate) { + if (other_inst->opcode() == spv::Op::OpSNegate || + other_inst->opcode() == spv::Op::OpFNegate) { uint32_t op1 = 0; uint32_t op2 = 0; - SpvOp opcode = inst->opcode(); + spv::Op opcode = inst->opcode(); if (constants[0] != nullptr) { op1 = other_inst->GetSingleWordInOperand(0u); op2 = inst->GetSingleWordInOperand(0u); - opcode = HasFloatingPoint(type) ? SpvOpFAdd : SpvOpIAdd; + opcode = HasFloatingPoint(type) ? spv::Op::OpFAdd : spv::Op::OpIAdd; } else { op1 = NegateConstant(const_mgr, const_input1); op2 = other_inst->GetSingleWordInOperand(0u); @@ -1090,7 +1106,8 @@ FoldingRule MergeSubNegateArithmetic() { FoldingRule MergeAddAddArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFAdd || inst->opcode() == SpvOpIAdd); + assert(inst->opcode() == spv::Op::OpFAdd || + inst->opcode() == spv::Op::OpIAdd); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); @@ -1106,8 +1123,8 @@ FoldingRule MergeAddAddArithmetic() { if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) return false; - if (other_inst->opcode() == SpvOpFAdd || - other_inst->opcode() == SpvOpIAdd) { + if (other_inst->opcode() == spv::Op::OpFAdd || + other_inst->opcode() == spv::Op::OpIAdd) { std::vector other_constants = const_mgr->GetOperandConstants(other_inst); const analysis::Constant* const_input2 = ConstInput(other_constants); @@ -1137,7 +1154,8 @@ FoldingRule MergeAddAddArithmetic() { FoldingRule MergeAddSubArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFAdd || inst->opcode() == SpvOpIAdd); + assert(inst->opcode() == spv::Op::OpFAdd || + inst->opcode() == spv::Op::OpIAdd); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); @@ -1153,15 +1171,15 @@ FoldingRule MergeAddSubArithmetic() { if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) return false; - if (other_inst->opcode() == SpvOpFSub || - other_inst->opcode() == SpvOpISub) { + if (other_inst->opcode() == spv::Op::OpFSub || + other_inst->opcode() == spv::Op::OpISub) { std::vector other_constants = const_mgr->GetOperandConstants(other_inst); const analysis::Constant* const_input2 = ConstInput(other_constants); if (!const_input2) return false; bool first_is_variable = other_constants[0] == nullptr; - SpvOp op = inst->opcode(); + spv::Op op = inst->opcode(); uint32_t op1 = 0; uint32_t op2 = 0; if (first_is_variable) { @@ -1196,7 +1214,8 @@ FoldingRule MergeAddSubArithmetic() { FoldingRule MergeSubAddArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFSub || inst->opcode() == SpvOpISub); + assert(inst->opcode() == spv::Op::OpFSub || + inst->opcode() == spv::Op::OpISub); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); @@ -1212,8 +1231,8 @@ FoldingRule MergeSubAddArithmetic() { if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) return false; - if (other_inst->opcode() == SpvOpFAdd || - other_inst->opcode() == SpvOpIAdd) { + if (other_inst->opcode() == spv::Op::OpFAdd || + other_inst->opcode() == spv::Op::OpIAdd) { std::vector other_constants = const_mgr->GetOperandConstants(other_inst); const analysis::Constant* const_input2 = ConstInput(other_constants); @@ -1228,7 +1247,7 @@ FoldingRule MergeSubAddArithmetic() { // Subtract the constants. uint32_t merged_id = PerformOperation(const_mgr, inst->opcode(), const_input1, const_input2); - SpvOp op = inst->opcode(); + spv::Op op = inst->opcode(); uint32_t op1 = 0; uint32_t op2 = 0; if (constants[0] == nullptr) { @@ -1261,7 +1280,8 @@ FoldingRule MergeSubAddArithmetic() { FoldingRule MergeSubSubArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFSub || inst->opcode() == SpvOpISub); + assert(inst->opcode() == spv::Op::OpFSub || + inst->opcode() == spv::Op::OpISub); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); @@ -1277,8 +1297,8 @@ FoldingRule MergeSubSubArithmetic() { if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) return false; - if (other_inst->opcode() == SpvOpFSub || - other_inst->opcode() == SpvOpISub) { + if (other_inst->opcode() == spv::Op::OpFSub || + other_inst->opcode() == spv::Op::OpISub) { std::vector other_constants = const_mgr->GetOperandConstants(other_inst); const analysis::Constant* const_input2 = ConstInput(other_constants); @@ -1289,9 +1309,9 @@ FoldingRule MergeSubSubArithmetic() { // Merge the constants. uint32_t merged_id = 0; - SpvOp merge_op = inst->opcode(); + spv::Op merge_op = inst->opcode(); if (other_constants[0] == nullptr) { - merge_op = uses_float ? SpvOpFAdd : SpvOpIAdd; + merge_op = uses_float ? spv::Op::OpFAdd : spv::Op::OpIAdd; } else if (constants[0] == nullptr) { std::swap(const_input1, const_input2); } @@ -1299,10 +1319,10 @@ FoldingRule MergeSubSubArithmetic() { PerformOperation(const_mgr, merge_op, const_input1, const_input2); if (merged_id == 0) return false; - SpvOp op = inst->opcode(); + spv::Op op = inst->opcode(); if (constants[0] != nullptr && other_constants[0] != nullptr) { // Change the operation. - op = uses_float ? SpvOpFAdd : SpvOpIAdd; + op = uses_float ? spv::Op::OpFAdd : spv::Op::OpIAdd; } uint32_t op1 = 0; @@ -1330,13 +1350,14 @@ bool MergeGenericAddendSub(uint32_t addend, uint32_t sub, Instruction* inst) { IRContext* context = inst->context(); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); Instruction* sub_inst = def_use_mgr->GetDef(sub); - if (sub_inst->opcode() != SpvOpFSub && sub_inst->opcode() != SpvOpISub) + if (sub_inst->opcode() != spv::Op::OpFSub && + sub_inst->opcode() != spv::Op::OpISub) return false; - if (sub_inst->opcode() == SpvOpFSub && + if (sub_inst->opcode() == spv::Op::OpFSub && !sub_inst->IsFloatingPointFoldingAllowed()) return false; if (addend != sub_inst->GetSingleWordInOperand(1)) return false; - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {sub_inst->GetSingleWordInOperand(0)}}}); context->UpdateDefUse(inst); @@ -1352,7 +1373,8 @@ bool MergeGenericAddendSub(uint32_t addend, uint32_t sub, Instruction* inst) { FoldingRule MergeGenericAddSubArithmetic() { return [](IRContext* context, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpFAdd || inst->opcode() == SpvOpIAdd); + assert(inst->opcode() == spv::Op::OpFAdd || + inst->opcode() == spv::Op::OpIAdd); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); bool uses_float = HasFloatingPoint(type); @@ -1380,7 +1402,8 @@ bool FactorAddMulsOpnds(uint32_t factor0_0, uint32_t factor0_1, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); Instruction* new_add_inst = ir_builder.AddBinaryOp( inst->type_id(), inst->opcode(), factor0_1, factor1_1); - inst->SetOpcode(inst->opcode() == SpvOpFAdd ? SpvOpFMul : SpvOpIMul); + inst->SetOpcode(inst->opcode() == spv::Op::OpFAdd ? spv::Op::OpFMul + : spv::Op::OpIMul); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {factor0_0}}, {SPV_OPERAND_TYPE_ID, {new_add_inst->result_id()}}}); context->UpdateDefUse(inst); @@ -1392,7 +1415,8 @@ bool FactorAddMulsOpnds(uint32_t factor0_0, uint32_t factor0_1, FoldingRule FactorAddMuls() { return [](IRContext* context, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpFAdd || inst->opcode() == SpvOpIAdd); + assert(inst->opcode() == spv::Op::OpFAdd || + inst->opcode() == spv::Op::OpIAdd); const analysis::Type* type = context->get_type_mgr()->GetType(inst->type_id()); bool uses_float = HasFloatingPoint(type); @@ -1401,13 +1425,13 @@ FoldingRule FactorAddMuls() { analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); uint32_t add_op0 = inst->GetSingleWordInOperand(0); Instruction* add_op0_inst = def_use_mgr->GetDef(add_op0); - if (add_op0_inst->opcode() != SpvOpFMul && - add_op0_inst->opcode() != SpvOpIMul) + if (add_op0_inst->opcode() != spv::Op::OpFMul && + add_op0_inst->opcode() != spv::Op::OpIMul) return false; uint32_t add_op1 = inst->GetSingleWordInOperand(1); Instruction* add_op1_inst = def_use_mgr->GetDef(add_op1); - if (add_op1_inst->opcode() != SpvOpFMul && - add_op1_inst->opcode() != SpvOpIMul) + if (add_op1_inst->opcode() != spv::Op::OpFMul && + add_op1_inst->opcode() != spv::Op::OpIMul) return false; // Only perform this optimization if both of the muls only have one use. @@ -1415,7 +1439,7 @@ FoldingRule FactorAddMuls() { if (def_use_mgr->NumUses(add_op0_inst) > 1) return false; if (def_use_mgr->NumUses(add_op1_inst) > 1) return false; - if (add_op0_inst->opcode() == SpvOpFMul && + if (add_op0_inst->opcode() == spv::Op::OpFMul && (!add_op0_inst->IsFloatingPointFoldingAllowed() || !add_op1_inst->IsFloatingPointFoldingAllowed())) return false; @@ -1454,7 +1478,7 @@ void ReplaceWithFma(Instruction* inst, uint32_t x, uint32_t y, uint32_t a) { operands.push_back({SPV_OPERAND_TYPE_ID, {y}}); operands.push_back({SPV_OPERAND_TYPE_ID, {a}}); - inst->SetOpcode(SpvOpExtInst); + inst->SetOpcode(spv::Op::OpExtInst); inst->SetInOperands(std::move(operands)); } @@ -1465,7 +1489,7 @@ void ReplaceWithFma(Instruction* inst, uint32_t x, uint32_t y, uint32_t a) { // a + (x * y) = Fma x y a bool MergeMulAddArithmetic(IRContext* context, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpFAdd); + assert(inst->opcode() == spv::Op::OpFAdd); if (!inst->IsFloatingPointFoldingAllowed()) { return false; @@ -1476,7 +1500,7 @@ bool MergeMulAddArithmetic(IRContext* context, Instruction* inst, uint32_t op_id = inst->GetSingleWordInOperand(i); Instruction* op_inst = def_use_mgr->GetDef(op_id); - if (op_inst->opcode() != SpvOpFMul) { + if (op_inst->opcode() != spv::Op::OpFMul) { continue; } @@ -1511,7 +1535,7 @@ void ReplaceWithFmaAndNegate(Instruction* sub, uint32_t x, uint32_t y, sub->context(), sub, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); - Instruction* neg = ir_builder.AddUnaryOp(sub->type_id(), SpvOpFNegate, + Instruction* neg = ir_builder.AddUnaryOp(sub->type_id(), spv::Op::OpFNegate, negate_addition ? a : x); uint32_t neg_op = neg->result_id(); // -a : -x @@ -1522,7 +1546,7 @@ void ReplaceWithFmaAndNegate(Instruction* sub, uint32_t x, uint32_t y, operands.push_back({SPV_OPERAND_TYPE_ID, {y}}); operands.push_back({SPV_OPERAND_TYPE_ID, {negate_addition ? neg_op : a}}); - sub->SetOpcode(SpvOpExtInst); + sub->SetOpcode(spv::Op::OpExtInst); sub->SetInOperands(std::move(operands)); } @@ -1533,7 +1557,7 @@ void ReplaceWithFmaAndNegate(Instruction* sub, uint32_t x, uint32_t y, // a - (x * y) = Fma -x y a bool MergeMulSubArithmetic(IRContext* context, Instruction* sub, const std::vector&) { - assert(sub->opcode() == SpvOpFSub); + assert(sub->opcode() == spv::Op::OpFSub); if (!sub->IsFloatingPointFoldingAllowed()) { return false; @@ -1544,7 +1568,7 @@ bool MergeMulSubArithmetic(IRContext* context, Instruction* sub, uint32_t op_id = sub->GetSingleWordInOperand(i); Instruction* mul = def_use_mgr->GetDef(op_id); - if (mul->opcode() != SpvOpFMul) { + if (mul->opcode() != spv::Op::OpFMul) { continue; } @@ -1564,7 +1588,8 @@ bool MergeMulSubArithmetic(IRContext* context, Instruction* sub, FoldingRule IntMultipleBy1() { return [](IRContext*, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpIMul && "Wrong opcode. Should be OpIMul."); + assert(inst->opcode() == spv::Op::OpIMul && + "Wrong opcode. Should be OpIMul."); for (uint32_t i = 0; i < 2; i++) { if (constants[i] == nullptr) { continue; @@ -1576,7 +1601,7 @@ FoldingRule IntMultipleBy1() { bool is_one = (width == 32) ? int_constant->GetU32BitValue() == 1u : int_constant->GetU64BitValue() == 1ull; if (is_one) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(1 - i)}}}); return true; @@ -1593,7 +1618,7 @@ FoldingRule IntMultipleBy1() { uint32_t GetNumOfElementsContributedByOperand(IRContext* context, const Instruction* inst, uint32_t index) { - assert(inst->opcode() == SpvOpCompositeConstruct); + assert(inst->opcode() == spv::Op::OpCompositeConstruct); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); analysis::TypeManager* type_mgr = context->get_type_mgr(); @@ -1624,14 +1649,17 @@ uint32_t GetNumOfElementsContributedByOperand(IRContext* context, // out-of-bounds. |inst| must be an |OpCompositeConstruct| instruction. std::vector GetExtractOperandsForElementOfCompositeConstruct( IRContext* context, const Instruction* inst, uint32_t result_index) { - assert(inst->opcode() == SpvOpCompositeConstruct); + assert(inst->opcode() == spv::Op::OpCompositeConstruct); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); analysis::TypeManager* type_mgr = context->get_type_mgr(); analysis::Type* result_type = type_mgr->GetType(inst->type_id()); if (result_type->AsVector() == nullptr) { - uint32_t id = inst->GetSingleWordInOperand(result_index); - return {Operand(SPV_OPERAND_TYPE_ID, {id})}; + if (result_index < inst->NumInOperands()) { + uint32_t id = inst->GetSingleWordInOperand(result_index); + return {Operand(SPV_OPERAND_TYPE_ID, {id})}; + } + return {}; } // If the result type is a vector, then vector operands are concatenated. @@ -1663,7 +1691,7 @@ bool CompositeConstructFeedingExtract( const std::vector&) { // If the input to an OpCompositeExtract is an OpCompositeConstruct, // then we can simply use the appropriate element in the construction. - assert(inst->opcode() == SpvOpCompositeExtract && + assert(inst->opcode() == spv::Op::OpCompositeExtract && "Wrong opcode. Should be OpCompositeExtract."); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); @@ -1675,7 +1703,7 @@ bool CompositeConstructFeedingExtract( uint32_t cid = inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); Instruction* cinst = def_use_mgr->GetDef(cid); - if (cinst->opcode() != SpvOpCompositeConstruct) { + if (cinst->opcode() != spv::Op::OpCompositeConstruct) { return false; } @@ -1697,7 +1725,7 @@ bool CompositeConstructFeedingExtract( if (operands.size() == 1) { // If there were no extra indices, then we have the final object. No need // to extract any more. - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); } inst->SetInOperands(std::move(operands)); @@ -1735,8 +1763,8 @@ const analysis::Type* GetElementType(uint32_t type_id, bool HaveSameIndexesExceptForLast(Instruction* inst_1, Instruction* inst_2) { assert(inst_1->opcode() == inst_2->opcode() && "Expecting the opcodes to be the same."); - assert((inst_1->opcode() == SpvOpCompositeInsert || - inst_1->opcode() == SpvOpCompositeExtract) && + assert((inst_1->opcode() == spv::Op::OpCompositeInsert || + inst_1->opcode() == spv::Op::OpCompositeExtract) && "Instructions must be OpCompositeInsert or OpCompositeExtract."); if (inst_1->NumInOperands() != inst_2->NumInOperands()) { @@ -1744,7 +1772,7 @@ bool HaveSameIndexesExceptForLast(Instruction* inst_1, Instruction* inst_2) { } uint32_t first_index_position = - (inst_1->opcode() == SpvOpCompositeInsert ? 2 : 1); + (inst_1->opcode() == spv::Op::OpCompositeInsert ? 2 : 1); for (uint32_t i = first_index_position; i < inst_1->NumInOperands() - 1; i++) { if (inst_1->GetSingleWordInOperand(i) != @@ -1763,7 +1791,7 @@ bool HaveSameIndexesExceptForLast(Instruction* inst_1, Instruction* inst_2) { bool CompositeExtractFeedingConstruct( IRContext* context, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpCompositeConstruct && + assert(inst->opcode() == spv::Op::OpCompositeConstruct && "Wrong opcode. Should be OpCompositeConstruct."); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); uint32_t original_id = 0; @@ -1785,7 +1813,7 @@ bool CompositeExtractFeedingConstruct( first_element_inst = element_inst; } - if (element_inst->opcode() != SpvOpCompositeExtract) { + if (element_inst->opcode() != spv::Op::OpCompositeExtract) { return false; } @@ -1825,14 +1853,14 @@ bool CompositeExtractFeedingConstruct( if (first_element_inst->NumInOperands() == 2) { // Simplify by using the original object. - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {original_id}}}); return true; } // Copies the original id and all indexes except for the last to the new // extract instruction. - inst->SetOpcode(SpvOpCompositeExtract); + inst->SetOpcode(spv::Op::OpCompositeExtract); inst->SetInOperands(std::vector(first_element_inst->begin() + 2, first_element_inst->end() - 1)); return true; @@ -1841,13 +1869,13 @@ bool CompositeExtractFeedingConstruct( FoldingRule InsertFeedingExtract() { return [](IRContext* context, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpCompositeExtract && + assert(inst->opcode() == spv::Op::OpCompositeExtract && "Wrong opcode. Should be OpCompositeExtract."); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); uint32_t cid = inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); Instruction* cinst = def_use_mgr->GetDef(cid); - if (cinst->opcode() != SpvOpCompositeInsert) { + if (cinst->opcode() != spv::Op::OpCompositeInsert) { return false; } @@ -1867,7 +1895,7 @@ FoldingRule InsertFeedingExtract() { // We are extracting the element that was inserted. if (i == inst->NumInOperands() && i + 1 == cinst->NumInOperands()) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {cinst->GetSingleWordInOperand(kInsertObjectIdInIdx)}}}); @@ -1916,14 +1944,14 @@ FoldingRule InsertFeedingExtract() { FoldingRule VectorShuffleFeedingExtract() { return [](IRContext* context, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpCompositeExtract && + assert(inst->opcode() == spv::Op::OpCompositeExtract && "Wrong opcode. Should be OpCompositeExtract."); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); analysis::TypeManager* type_mgr = context->get_type_mgr(); uint32_t cid = inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); Instruction* cinst = def_use_mgr->GetDef(cid); - if (cinst->opcode() != SpvOpVectorShuffle) { + if (cinst->opcode() != spv::Op::OpVectorShuffle) { return false; } @@ -1944,7 +1972,7 @@ FoldingRule VectorShuffleFeedingExtract() { // Extracting an undefined value so fold this extract into an undef. const uint32_t undef_literal_value = 0xffffffff; if (new_index == undef_literal_value) { - inst->SetOpcode(SpvOpUndef); + inst->SetOpcode(spv::Op::OpUndef); inst->SetInOperands({}); return true; } @@ -1972,7 +2000,7 @@ FoldingRule VectorShuffleFeedingExtract() { FoldingRule FMixFeedingExtract() { return [](IRContext* context, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpCompositeExtract && + assert(inst->opcode() == spv::Op::OpCompositeExtract && "Wrong opcode. Should be OpCompositeExtract."); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); @@ -1981,7 +2009,7 @@ FoldingRule FMixFeedingExtract() { inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); Instruction* composite_inst = def_use_mgr->GetDef(composite_id); - if (composite_inst->opcode() != SpvOpExtInst) { + if (composite_inst->opcode() != spv::Op::OpExtInst) { return false; } @@ -2001,7 +2029,7 @@ FoldingRule FMixFeedingExtract() { a->SetInOperand(kExtractCompositeIdInIdx, {a_id}); context->get_instruction_folder().FoldInstruction(a.get()); - if (a->opcode() != SpvOpCopyObject) { + if (a->opcode() != spv::Op::OpCopyObject) { return false; } @@ -2063,7 +2091,7 @@ std::map GetInsertedValues(Instruction* inst) { analysis::DefUseManager* def_use_mgr = inst->context()->get_def_use_mgr(); std::map values_inserted; Instruction* current_inst = inst; - while (current_inst->opcode() == SpvOpCompositeInsert) { + while (current_inst->opcode() == spv::Op::OpCompositeInsert) { if (current_inst->NumInOperands() > inst->NumInOperands()) { // This is the catch the case // %2 = OpCompositeInsert %m2x2int %v2int_1_0 %m2x2int_undef 0 @@ -2105,7 +2133,7 @@ bool DoInsertedValuesCoverEntireObject( // Returns the type of the element that immediately contains the element being // inserted by the OpCompositeInsert instruction |inst|. const analysis::Type* GetContainerType(Instruction* inst) { - assert(inst->opcode() == SpvOpCompositeInsert); + assert(inst->opcode() == spv::Op::OpCompositeInsert); analysis::TypeManager* type_mgr = inst->context()->get_type_mgr(); return GetElementType(inst->type_id(), inst->begin() + 4, inst->end() - 1, type_mgr); @@ -2137,7 +2165,7 @@ Instruction* BuildCompositeConstruct( // instruction is replaced with an OpCopyObject instead. void InsertConstructedObject(Instruction* inst, const Instruction* construct) { if (inst->NumInOperands() == 3) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {construct->result_id()}}}); } else { inst->SetInOperand(kInsertObjectIdInIdx, {construct->result_id()}); @@ -2150,7 +2178,7 @@ void InsertConstructedObject(Instruction* inst, const Instruction* construct) { bool CompositeInsertToCompositeConstruct( IRContext* context, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpCompositeInsert && + assert(inst->opcode() == spv::Op::OpCompositeInsert && "Wrong opcode. Should be OpCompositeInsert."); if (inst->NumInOperands() < 3) return false; @@ -2176,7 +2204,8 @@ FoldingRule RedundantPhi() { // itself, can be replaced by the value itself. return [](IRContext*, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpPhi && "Wrong opcode. Should be OpPhi."); + assert(inst->opcode() == spv::Op::OpPhi && + "Wrong opcode. Should be OpPhi."); uint32_t incoming_value = 0; @@ -2200,7 +2229,7 @@ FoldingRule RedundantPhi() { } // We have a single incoming value. Simplify using that value. - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {incoming_value}}}); return true; }; @@ -2209,7 +2238,7 @@ FoldingRule RedundantPhi() { FoldingRule BitCastScalarOrVector() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpBitcast && constants.size() == 1); + assert(inst->opcode() == spv::Op::OpBitcast && constants.size() == 1); if (constants[0] == nullptr) return false; const analysis::Type* type = @@ -2229,7 +2258,7 @@ FoldingRule BitCastScalarOrVector() { auto new_feeder_id = const_mgr->GetDefiningInstruction(bitcasted_constant, inst->type_id()) ->result_id(); - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {new_feeder_id}}}); return true; }; @@ -2240,7 +2269,7 @@ FoldingRule RedundantSelect() { // constant can be replaced by one of the values return [](IRContext*, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpSelect && + assert(inst->opcode() == spv::Op::OpSelect && "Wrong opcode. Should be OpSelect."); assert(inst->NumInOperands() == 3); assert(constants.size() == 3); @@ -2250,14 +2279,14 @@ FoldingRule RedundantSelect() { if (true_id == false_id) { // Both results are the same, condition doesn't matter - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {true_id}}}); return true; } else if (constants[0]) { const analysis::Type* type = constants[0]->type(); if (type->AsBool()) { // Scalar constant value, select the corresponding value. - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); if (constants[0]->AsNullConstant() || !constants[0]->AsBoolConstant()->value()) { inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {false_id}}}); @@ -2269,7 +2298,7 @@ FoldingRule RedundantSelect() { assert(type->AsVector()); if (constants[0]->AsNullConstant()) { // All values come from false id. - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {false_id}}}); return true; } else { @@ -2296,7 +2325,7 @@ FoldingRule RedundantSelect() { } } - inst->SetOpcode(SpvOpVectorShuffle); + inst->SetOpcode(spv::Op::OpVectorShuffle); inst->SetInOperands(std::move(ops)); return true; } @@ -2356,7 +2385,8 @@ FloatConstantKind getFloatConstantKind(const analysis::Constant* constant) { FoldingRule RedundantFAdd() { return [](IRContext*, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFAdd && "Wrong opcode. Should be OpFAdd."); + assert(inst->opcode() == spv::Op::OpFAdd && + "Wrong opcode. Should be OpFAdd."); assert(constants.size() == 2); if (!inst->IsFloatingPointFoldingAllowed()) { @@ -2367,7 +2397,7 @@ FoldingRule RedundantFAdd() { FloatConstantKind kind1 = getFloatConstantKind(constants[1]); if (kind0 == FloatConstantKind::Zero || kind1 == FloatConstantKind::Zero) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand( kind0 == FloatConstantKind::Zero ? 1 : 0)}}}); @@ -2381,7 +2411,8 @@ FoldingRule RedundantFAdd() { FoldingRule RedundantFSub() { return [](IRContext*, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFSub && "Wrong opcode. Should be OpFSub."); + assert(inst->opcode() == spv::Op::OpFSub && + "Wrong opcode. Should be OpFSub."); assert(constants.size() == 2); if (!inst->IsFloatingPointFoldingAllowed()) { @@ -2392,14 +2423,14 @@ FoldingRule RedundantFSub() { FloatConstantKind kind1 = getFloatConstantKind(constants[1]); if (kind0 == FloatConstantKind::Zero) { - inst->SetOpcode(SpvOpFNegate); + inst->SetOpcode(spv::Op::OpFNegate); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(1)}}}); return true; } if (kind1 == FloatConstantKind::Zero) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(0)}}}); return true; @@ -2412,7 +2443,8 @@ FoldingRule RedundantFSub() { FoldingRule RedundantFMul() { return [](IRContext*, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFMul && "Wrong opcode. Should be OpFMul."); + assert(inst->opcode() == spv::Op::OpFMul && + "Wrong opcode. Should be OpFMul."); assert(constants.size() == 2); if (!inst->IsFloatingPointFoldingAllowed()) { @@ -2423,7 +2455,7 @@ FoldingRule RedundantFMul() { FloatConstantKind kind1 = getFloatConstantKind(constants[1]); if (kind0 == FloatConstantKind::Zero || kind1 == FloatConstantKind::Zero) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand( kind0 == FloatConstantKind::Zero ? 0 : 1)}}}); @@ -2431,7 +2463,7 @@ FoldingRule RedundantFMul() { } if (kind0 == FloatConstantKind::One || kind1 == FloatConstantKind::One) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand( kind0 == FloatConstantKind::One ? 1 : 0)}}}); @@ -2445,7 +2477,8 @@ FoldingRule RedundantFMul() { FoldingRule RedundantFDiv() { return [](IRContext*, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpFDiv && "Wrong opcode. Should be OpFDiv."); + assert(inst->opcode() == spv::Op::OpFDiv && + "Wrong opcode. Should be OpFDiv."); assert(constants.size() == 2); if (!inst->IsFloatingPointFoldingAllowed()) { @@ -2456,14 +2489,14 @@ FoldingRule RedundantFDiv() { FloatConstantKind kind1 = getFloatConstantKind(constants[1]); if (kind0 == FloatConstantKind::Zero) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(0)}}}); return true; } if (kind1 == FloatConstantKind::One) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(0)}}}); return true; @@ -2476,7 +2509,7 @@ FoldingRule RedundantFDiv() { FoldingRule RedundantFMix() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpExtInst && + assert(inst->opcode() == spv::Op::OpExtInst && "Wrong opcode. Should be OpExtInst."); if (!inst->IsFloatingPointFoldingAllowed()) { @@ -2494,7 +2527,7 @@ FoldingRule RedundantFMix() { FloatConstantKind kind4 = getFloatConstantKind(constants[4]); if (kind4 == FloatConstantKind::Zero || kind4 == FloatConstantKind::One) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); inst->SetInOperands( {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(kind4 == FloatConstantKind::Zero @@ -2512,7 +2545,8 @@ FoldingRule RedundantFMix() { FoldingRule RedundantIAdd() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpIAdd && "Wrong opcode. Should be OpIAdd."); + assert(inst->opcode() == spv::Op::OpIAdd && + "Wrong opcode. Should be OpIAdd."); uint32_t operand = std::numeric_limits::max(); const analysis::Type* operand_type = nullptr; @@ -2528,9 +2562,9 @@ FoldingRule RedundantIAdd() { const analysis::Type* inst_type = context->get_type_mgr()->GetType(inst->type_id()); if (inst_type->IsSame(operand_type)) { - inst->SetOpcode(SpvOpCopyObject); + inst->SetOpcode(spv::Op::OpCopyObject); } else { - inst->SetOpcode(SpvOpBitcast); + inst->SetOpcode(spv::Op::OpBitcast); } inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {operand}}}); return true; @@ -2544,7 +2578,8 @@ FoldingRule RedundantIAdd() { FoldingRule DotProductDoingExtract() { return [](IRContext* context, Instruction* inst, const std::vector& constants) { - assert(inst->opcode() == SpvOpDot && "Wrong opcode. Should be OpDot."); + assert(inst->opcode() == spv::Op::OpDot && + "Wrong opcode. Should be OpDot."); analysis::ConstantManager* const_mgr = context->get_constant_mgr(); @@ -2570,7 +2605,7 @@ FoldingRule DotProductDoingExtract() { std::vector components; components = constants[i]->GetVectorComponents(const_mgr); - const uint32_t kNotFound = std::numeric_limits::max(); + constexpr uint32_t kNotFound = std::numeric_limits::max(); uint32_t component_with_one = kNotFound; bool all_others_zero = true; @@ -2603,7 +2638,7 @@ FoldingRule DotProductDoingExtract() { operands.push_back( {SPV_OPERAND_TYPE_LITERAL_INTEGER, {component_with_one}}); - inst->SetOpcode(SpvOpCompositeExtract); + inst->SetOpcode(spv::Op::OpCompositeExtract); inst->SetInOperands(std::move(operands)); return true; } @@ -2618,20 +2653,22 @@ FoldingRule DotProductDoingExtract() { FoldingRule StoringUndef() { return [](IRContext* context, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpStore && "Wrong opcode. Should be OpStore."); + assert(inst->opcode() == spv::Op::OpStore && + "Wrong opcode. Should be OpStore."); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); // If this is a volatile store, the store cannot be removed. if (inst->NumInOperands() == 3) { - if (inst->GetSingleWordInOperand(2) & SpvMemoryAccessVolatileMask) { + if (inst->GetSingleWordInOperand(2) & + uint32_t(spv::MemoryAccessMask::Volatile)) { return false; } } uint32_t object_id = inst->GetSingleWordInOperand(kStoreObjectInIdx); Instruction* object_inst = def_use_mgr->GetDef(object_id); - if (object_inst->opcode() == SpvOpUndef) { + if (object_inst->opcode() == spv::Op::OpUndef) { inst->ToNop(); return true; } @@ -2642,7 +2679,7 @@ FoldingRule StoringUndef() { FoldingRule VectorShuffleFeedingShuffle() { return [](IRContext* context, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpVectorShuffle && + assert(inst->opcode() == spv::Op::OpVectorShuffle && "Wrong opcode. Should be OpVectorShuffle."); analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); @@ -2655,13 +2692,13 @@ FoldingRule VectorShuffleFeedingShuffle() { uint32_t op0_length = op0_type->element_count(); bool feeder_is_op0 = true; - if (feeding_shuffle_inst->opcode() != SpvOpVectorShuffle) { + if (feeding_shuffle_inst->opcode() != spv::Op::OpVectorShuffle) { feeding_shuffle_inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(1)); feeder_is_op0 = false; } - if (feeding_shuffle_inst->opcode() != SpvOpVectorShuffle) { + if (feeding_shuffle_inst->opcode() != spv::Op::OpVectorShuffle) { return false; } @@ -2772,7 +2809,7 @@ FoldingRule VectorShuffleFeedingShuffle() { FoldingRule RemoveRedundantOperands() { return [](IRContext*, Instruction* inst, const std::vector&) { - assert(inst->opcode() == SpvOpEntryPoint && + assert(inst->opcode() == spv::Op::OpEntryPoint && "Wrong opcode. Should be OpEntryPoint."); bool has_redundant_operand = false; std::unordered_set seen_operands; @@ -2805,46 +2842,56 @@ FoldingRule UpdateImageOperands() { const std::vector& constants) { const auto opcode = inst->opcode(); (void)opcode; - assert((opcode == SpvOpImageSampleImplicitLod || - opcode == SpvOpImageSampleExplicitLod || - opcode == SpvOpImageSampleDrefImplicitLod || - opcode == SpvOpImageSampleDrefExplicitLod || - opcode == SpvOpImageSampleProjImplicitLod || - opcode == SpvOpImageSampleProjExplicitLod || - opcode == SpvOpImageSampleProjDrefImplicitLod || - opcode == SpvOpImageSampleProjDrefExplicitLod || - opcode == SpvOpImageFetch || opcode == SpvOpImageGather || - opcode == SpvOpImageDrefGather || opcode == SpvOpImageRead || - opcode == SpvOpImageWrite || - opcode == SpvOpImageSparseSampleImplicitLod || - opcode == SpvOpImageSparseSampleExplicitLod || - opcode == SpvOpImageSparseSampleDrefImplicitLod || - opcode == SpvOpImageSparseSampleDrefExplicitLod || - opcode == SpvOpImageSparseSampleProjImplicitLod || - opcode == SpvOpImageSparseSampleProjExplicitLod || - opcode == SpvOpImageSparseSampleProjDrefImplicitLod || - opcode == SpvOpImageSparseSampleProjDrefExplicitLod || - opcode == SpvOpImageSparseFetch || - opcode == SpvOpImageSparseGather || - opcode == SpvOpImageSparseDrefGather || - opcode == SpvOpImageSparseRead) && + assert((opcode == spv::Op::OpImageSampleImplicitLod || + opcode == spv::Op::OpImageSampleExplicitLod || + opcode == spv::Op::OpImageSampleDrefImplicitLod || + opcode == spv::Op::OpImageSampleDrefExplicitLod || + opcode == spv::Op::OpImageSampleProjImplicitLod || + opcode == spv::Op::OpImageSampleProjExplicitLod || + opcode == spv::Op::OpImageSampleProjDrefImplicitLod || + opcode == spv::Op::OpImageSampleProjDrefExplicitLod || + opcode == spv::Op::OpImageFetch || + opcode == spv::Op::OpImageGather || + opcode == spv::Op::OpImageDrefGather || + opcode == spv::Op::OpImageRead || opcode == spv::Op::OpImageWrite || + opcode == spv::Op::OpImageSparseSampleImplicitLod || + opcode == spv::Op::OpImageSparseSampleExplicitLod || + opcode == spv::Op::OpImageSparseSampleDrefImplicitLod || + opcode == spv::Op::OpImageSparseSampleDrefExplicitLod || + opcode == spv::Op::OpImageSparseSampleProjImplicitLod || + opcode == spv::Op::OpImageSparseSampleProjExplicitLod || + opcode == spv::Op::OpImageSparseSampleProjDrefImplicitLod || + opcode == spv::Op::OpImageSparseSampleProjDrefExplicitLod || + opcode == spv::Op::OpImageSparseFetch || + opcode == spv::Op::OpImageSparseGather || + opcode == spv::Op::OpImageSparseDrefGather || + opcode == spv::Op::OpImageSparseRead) && "Wrong opcode. Should be an image instruction."); int32_t operand_index = ImageOperandsMaskInOperandIndex(inst); if (operand_index >= 0) { auto image_operands = inst->GetSingleWordInOperand(operand_index); - if (image_operands & SpvImageOperandsOffsetMask) { + if (image_operands & uint32_t(spv::ImageOperandsMask::Offset)) { uint32_t offset_operand_index = operand_index + 1; - if (image_operands & SpvImageOperandsBiasMask) offset_operand_index++; - if (image_operands & SpvImageOperandsLodMask) offset_operand_index++; - if (image_operands & SpvImageOperandsGradMask) + if (image_operands & uint32_t(spv::ImageOperandsMask::Bias)) + offset_operand_index++; + if (image_operands & uint32_t(spv::ImageOperandsMask::Lod)) + offset_operand_index++; + if (image_operands & uint32_t(spv::ImageOperandsMask::Grad)) offset_operand_index += 2; - assert(((image_operands & SpvImageOperandsConstOffsetMask) == 0) && + assert(((image_operands & + uint32_t(spv::ImageOperandsMask::ConstOffset)) == 0) && "Offset and ConstOffset may not be used together"); if (offset_operand_index < inst->NumOperands()) { if (constants[offset_operand_index]) { - image_operands = image_operands | SpvImageOperandsConstOffsetMask; - image_operands = image_operands & ~SpvImageOperandsOffsetMask; + if (constants[offset_operand_index]->IsZero()) { + inst->RemoveInOperand(offset_operand_index); + } else { + image_operands = image_operands | + uint32_t(spv::ImageOperandsMask::ConstOffset); + } + image_operands = + image_operands & ~uint32_t(spv::ImageOperandsMask::Offset); inst->SetInOperand(operand_index, {image_operands}); return true; } @@ -2863,108 +2910,119 @@ void FoldingRules::AddFoldingRules() { // Note that the order in which rules are added to the list matters. If a rule // applies to the instruction, the rest of the rules will not be attempted. // Take that into consideration. - rules_[SpvOpBitcast].push_back(BitCastScalarOrVector()); - - rules_[SpvOpCompositeConstruct].push_back(CompositeExtractFeedingConstruct); - - rules_[SpvOpCompositeExtract].push_back(InsertFeedingExtract()); - rules_[SpvOpCompositeExtract].push_back(CompositeConstructFeedingExtract); - rules_[SpvOpCompositeExtract].push_back(VectorShuffleFeedingExtract()); - rules_[SpvOpCompositeExtract].push_back(FMixFeedingExtract()); - - rules_[SpvOpCompositeInsert].push_back(CompositeInsertToCompositeConstruct); - - rules_[SpvOpDot].push_back(DotProductDoingExtract()); - - rules_[SpvOpEntryPoint].push_back(RemoveRedundantOperands()); - - rules_[SpvOpFAdd].push_back(RedundantFAdd()); - rules_[SpvOpFAdd].push_back(MergeAddNegateArithmetic()); - rules_[SpvOpFAdd].push_back(MergeAddAddArithmetic()); - rules_[SpvOpFAdd].push_back(MergeAddSubArithmetic()); - rules_[SpvOpFAdd].push_back(MergeGenericAddSubArithmetic()); - rules_[SpvOpFAdd].push_back(FactorAddMuls()); - rules_[SpvOpFAdd].push_back(MergeMulAddArithmetic); - - rules_[SpvOpFDiv].push_back(RedundantFDiv()); - rules_[SpvOpFDiv].push_back(ReciprocalFDiv()); - rules_[SpvOpFDiv].push_back(MergeDivDivArithmetic()); - rules_[SpvOpFDiv].push_back(MergeDivMulArithmetic()); - rules_[SpvOpFDiv].push_back(MergeDivNegateArithmetic()); - - rules_[SpvOpFMul].push_back(RedundantFMul()); - rules_[SpvOpFMul].push_back(MergeMulMulArithmetic()); - rules_[SpvOpFMul].push_back(MergeMulDivArithmetic()); - rules_[SpvOpFMul].push_back(MergeMulNegateArithmetic()); - - rules_[SpvOpFNegate].push_back(MergeNegateArithmetic()); - rules_[SpvOpFNegate].push_back(MergeNegateAddSubArithmetic()); - rules_[SpvOpFNegate].push_back(MergeNegateMulDivArithmetic()); - - rules_[SpvOpFSub].push_back(RedundantFSub()); - rules_[SpvOpFSub].push_back(MergeSubNegateArithmetic()); - rules_[SpvOpFSub].push_back(MergeSubAddArithmetic()); - rules_[SpvOpFSub].push_back(MergeSubSubArithmetic()); - rules_[SpvOpFSub].push_back(MergeMulSubArithmetic); - - rules_[SpvOpIAdd].push_back(RedundantIAdd()); - rules_[SpvOpIAdd].push_back(MergeAddNegateArithmetic()); - rules_[SpvOpIAdd].push_back(MergeAddAddArithmetic()); - rules_[SpvOpIAdd].push_back(MergeAddSubArithmetic()); - rules_[SpvOpIAdd].push_back(MergeGenericAddSubArithmetic()); - rules_[SpvOpIAdd].push_back(FactorAddMuls()); - - rules_[SpvOpIMul].push_back(IntMultipleBy1()); - rules_[SpvOpIMul].push_back(MergeMulMulArithmetic()); - rules_[SpvOpIMul].push_back(MergeMulNegateArithmetic()); - - rules_[SpvOpISub].push_back(MergeSubNegateArithmetic()); - rules_[SpvOpISub].push_back(MergeSubAddArithmetic()); - rules_[SpvOpISub].push_back(MergeSubSubArithmetic()); - - rules_[SpvOpPhi].push_back(RedundantPhi()); - - rules_[SpvOpSNegate].push_back(MergeNegateArithmetic()); - rules_[SpvOpSNegate].push_back(MergeNegateMulDivArithmetic()); - rules_[SpvOpSNegate].push_back(MergeNegateAddSubArithmetic()); - - rules_[SpvOpSelect].push_back(RedundantSelect()); - - rules_[SpvOpStore].push_back(StoringUndef()); - - rules_[SpvOpVectorShuffle].push_back(VectorShuffleFeedingShuffle()); - - rules_[SpvOpImageSampleImplicitLod].push_back(UpdateImageOperands()); - rules_[SpvOpImageSampleExplicitLod].push_back(UpdateImageOperands()); - rules_[SpvOpImageSampleDrefImplicitLod].push_back(UpdateImageOperands()); - rules_[SpvOpImageSampleDrefExplicitLod].push_back(UpdateImageOperands()); - rules_[SpvOpImageSampleProjImplicitLod].push_back(UpdateImageOperands()); - rules_[SpvOpImageSampleProjExplicitLod].push_back(UpdateImageOperands()); - rules_[SpvOpImageSampleProjDrefImplicitLod].push_back(UpdateImageOperands()); - rules_[SpvOpImageSampleProjDrefExplicitLod].push_back(UpdateImageOperands()); - rules_[SpvOpImageFetch].push_back(UpdateImageOperands()); - rules_[SpvOpImageGather].push_back(UpdateImageOperands()); - rules_[SpvOpImageDrefGather].push_back(UpdateImageOperands()); - rules_[SpvOpImageRead].push_back(UpdateImageOperands()); - rules_[SpvOpImageWrite].push_back(UpdateImageOperands()); - rules_[SpvOpImageSparseSampleImplicitLod].push_back(UpdateImageOperands()); - rules_[SpvOpImageSparseSampleExplicitLod].push_back(UpdateImageOperands()); - rules_[SpvOpImageSparseSampleDrefImplicitLod].push_back( + rules_[spv::Op::OpBitcast].push_back(BitCastScalarOrVector()); + + rules_[spv::Op::OpCompositeConstruct].push_back( + CompositeExtractFeedingConstruct); + + rules_[spv::Op::OpCompositeExtract].push_back(InsertFeedingExtract()); + rules_[spv::Op::OpCompositeExtract].push_back( + CompositeConstructFeedingExtract); + rules_[spv::Op::OpCompositeExtract].push_back(VectorShuffleFeedingExtract()); + rules_[spv::Op::OpCompositeExtract].push_back(FMixFeedingExtract()); + + rules_[spv::Op::OpCompositeInsert].push_back( + CompositeInsertToCompositeConstruct); + + rules_[spv::Op::OpDot].push_back(DotProductDoingExtract()); + + rules_[spv::Op::OpEntryPoint].push_back(RemoveRedundantOperands()); + + rules_[spv::Op::OpFAdd].push_back(RedundantFAdd()); + rules_[spv::Op::OpFAdd].push_back(MergeAddNegateArithmetic()); + rules_[spv::Op::OpFAdd].push_back(MergeAddAddArithmetic()); + rules_[spv::Op::OpFAdd].push_back(MergeAddSubArithmetic()); + rules_[spv::Op::OpFAdd].push_back(MergeGenericAddSubArithmetic()); + rules_[spv::Op::OpFAdd].push_back(FactorAddMuls()); + rules_[spv::Op::OpFAdd].push_back(MergeMulAddArithmetic); + + rules_[spv::Op::OpFDiv].push_back(RedundantFDiv()); + rules_[spv::Op::OpFDiv].push_back(ReciprocalFDiv()); + rules_[spv::Op::OpFDiv].push_back(MergeDivDivArithmetic()); + rules_[spv::Op::OpFDiv].push_back(MergeDivMulArithmetic()); + rules_[spv::Op::OpFDiv].push_back(MergeDivNegateArithmetic()); + + rules_[spv::Op::OpFMul].push_back(RedundantFMul()); + rules_[spv::Op::OpFMul].push_back(MergeMulMulArithmetic()); + rules_[spv::Op::OpFMul].push_back(MergeMulDivArithmetic()); + rules_[spv::Op::OpFMul].push_back(MergeMulNegateArithmetic()); + + rules_[spv::Op::OpFNegate].push_back(MergeNegateArithmetic()); + rules_[spv::Op::OpFNegate].push_back(MergeNegateAddSubArithmetic()); + rules_[spv::Op::OpFNegate].push_back(MergeNegateMulDivArithmetic()); + + rules_[spv::Op::OpFSub].push_back(RedundantFSub()); + rules_[spv::Op::OpFSub].push_back(MergeSubNegateArithmetic()); + rules_[spv::Op::OpFSub].push_back(MergeSubAddArithmetic()); + rules_[spv::Op::OpFSub].push_back(MergeSubSubArithmetic()); + rules_[spv::Op::OpFSub].push_back(MergeMulSubArithmetic); + + rules_[spv::Op::OpIAdd].push_back(RedundantIAdd()); + rules_[spv::Op::OpIAdd].push_back(MergeAddNegateArithmetic()); + rules_[spv::Op::OpIAdd].push_back(MergeAddAddArithmetic()); + rules_[spv::Op::OpIAdd].push_back(MergeAddSubArithmetic()); + rules_[spv::Op::OpIAdd].push_back(MergeGenericAddSubArithmetic()); + rules_[spv::Op::OpIAdd].push_back(FactorAddMuls()); + + rules_[spv::Op::OpIMul].push_back(IntMultipleBy1()); + rules_[spv::Op::OpIMul].push_back(MergeMulMulArithmetic()); + rules_[spv::Op::OpIMul].push_back(MergeMulNegateArithmetic()); + + rules_[spv::Op::OpISub].push_back(MergeSubNegateArithmetic()); + rules_[spv::Op::OpISub].push_back(MergeSubAddArithmetic()); + rules_[spv::Op::OpISub].push_back(MergeSubSubArithmetic()); + + rules_[spv::Op::OpPhi].push_back(RedundantPhi()); + + rules_[spv::Op::OpSNegate].push_back(MergeNegateArithmetic()); + rules_[spv::Op::OpSNegate].push_back(MergeNegateMulDivArithmetic()); + rules_[spv::Op::OpSNegate].push_back(MergeNegateAddSubArithmetic()); + + rules_[spv::Op::OpSelect].push_back(RedundantSelect()); + + rules_[spv::Op::OpStore].push_back(StoringUndef()); + + rules_[spv::Op::OpVectorShuffle].push_back(VectorShuffleFeedingShuffle()); + + rules_[spv::Op::OpImageSampleImplicitLod].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageSampleExplicitLod].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageSampleDrefImplicitLod].push_back( + UpdateImageOperands()); + rules_[spv::Op::OpImageSampleDrefExplicitLod].push_back( + UpdateImageOperands()); + rules_[spv::Op::OpImageSampleProjImplicitLod].push_back( + UpdateImageOperands()); + rules_[spv::Op::OpImageSampleProjExplicitLod].push_back( + UpdateImageOperands()); + rules_[spv::Op::OpImageSampleProjDrefImplicitLod].push_back( + UpdateImageOperands()); + rules_[spv::Op::OpImageSampleProjDrefExplicitLod].push_back( + UpdateImageOperands()); + rules_[spv::Op::OpImageFetch].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageGather].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageDrefGather].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageRead].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageWrite].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageSparseSampleImplicitLod].push_back( + UpdateImageOperands()); + rules_[spv::Op::OpImageSparseSampleExplicitLod].push_back( + UpdateImageOperands()); + rules_[spv::Op::OpImageSparseSampleDrefImplicitLod].push_back( UpdateImageOperands()); - rules_[SpvOpImageSparseSampleDrefExplicitLod].push_back( + rules_[spv::Op::OpImageSparseSampleDrefExplicitLod].push_back( UpdateImageOperands()); - rules_[SpvOpImageSparseSampleProjImplicitLod].push_back( + rules_[spv::Op::OpImageSparseSampleProjImplicitLod].push_back( UpdateImageOperands()); - rules_[SpvOpImageSparseSampleProjExplicitLod].push_back( + rules_[spv::Op::OpImageSparseSampleProjExplicitLod].push_back( UpdateImageOperands()); - rules_[SpvOpImageSparseSampleProjDrefImplicitLod].push_back( + rules_[spv::Op::OpImageSparseSampleProjDrefImplicitLod].push_back( UpdateImageOperands()); - rules_[SpvOpImageSparseSampleProjDrefExplicitLod].push_back( + rules_[spv::Op::OpImageSparseSampleProjDrefExplicitLod].push_back( UpdateImageOperands()); - rules_[SpvOpImageSparseFetch].push_back(UpdateImageOperands()); - rules_[SpvOpImageSparseGather].push_back(UpdateImageOperands()); - rules_[SpvOpImageSparseDrefGather].push_back(UpdateImageOperands()); - rules_[SpvOpImageSparseRead].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageSparseFetch].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageSparseGather].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageSparseDrefGather].push_back(UpdateImageOperands()); + rules_[spv::Op::OpImageSparseRead].push_back(UpdateImageOperands()); FeatureManager* feature_manager = context_->get_feature_mgr(); // Add rules for GLSLstd450 diff --git a/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.h b/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.h index f1a86395..b51e0ce4 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.h @@ -64,7 +64,7 @@ class FoldingRules { virtual ~FoldingRules() = default; const FoldingRuleSet& GetRulesForInstruction(Instruction* inst) const { - if (inst->opcode() != SpvOpExtInst) { + if (inst->opcode() != spv::Op::OpExtInst) { auto it = rules_.find(inst->opcode()); if (it != rules_.end()) { return it->second; @@ -86,8 +86,14 @@ class FoldingRules { virtual void AddFoldingRules(); protected: + struct hasher { + size_t operator()(const spv::Op& op) const noexcept { + return std::hash()(uint32_t(op)); + } + }; + // The folding rules for core instructions. - std::unordered_map rules_; + std::unordered_map rules_; // The folding rules for extended instructions. struct Key { diff --git a/bgfx/3rdparty/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp index 10e98fd8..3f89e56c 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp @@ -23,21 +23,21 @@ Pass::Status FreezeSpecConstantValuePass::Process() { auto ctx = context(); ctx->module()->ForEachInst([&modified, ctx](Instruction* inst) { switch (inst->opcode()) { - case SpvOp::SpvOpSpecConstant: - inst->SetOpcode(SpvOp::SpvOpConstant); + case spv::Op::OpSpecConstant: + inst->SetOpcode(spv::Op::OpConstant); modified = true; break; - case SpvOp::SpvOpSpecConstantTrue: - inst->SetOpcode(SpvOp::SpvOpConstantTrue); + case spv::Op::OpSpecConstantTrue: + inst->SetOpcode(spv::Op::OpConstantTrue); modified = true; break; - case SpvOp::SpvOpSpecConstantFalse: - inst->SetOpcode(SpvOp::SpvOpConstantFalse); + case spv::Op::OpSpecConstantFalse: + inst->SetOpcode(spv::Op::OpConstantFalse); modified = true; break; - case SpvOp::SpvOpDecorate: - if (inst->GetSingleWordInOperand(1) == - SpvDecoration::SpvDecorationSpecId) { + case spv::Op::OpDecorate: + if (spv::Decoration(inst->GetSingleWordInOperand(1)) == + spv::Decoration::SpecId) { ctx->KillInst(inst); modified = true; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/function.cpp b/bgfx/3rdparty/spirv-tools/source/opt/function.cpp index bb51df3f..2ee88eca 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/function.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/function.cpp @@ -15,9 +15,7 @@ #include "source/opt/function.h" #include -#include -#include "function.h" #include "ir_context.h" #include "source/util/bit_vector.h" @@ -264,7 +262,7 @@ std::string Function::PrettyPrint(uint32_t options) const { std::ostringstream str; ForEachInst([&str, options](const Instruction* inst) { str << inst->PrettyPrint(options); - if (inst->opcode() != SpvOpFunctionEnd) { + if (inst->opcode() != spv::Op::OpFunctionEnd) { str << std::endl; } }); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/function.h b/bgfx/3rdparty/spirv-tools/source/opt/function.h index 146cbe34..8c0472cd 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/function.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/function.h @@ -253,7 +253,7 @@ inline void Function::RemoveEmptyBlocks() { auto first_empty = std::remove_if(std::begin(blocks_), std::end(blocks_), [](const std::unique_ptr& bb) -> bool { - return bb->GetLabelInst()->opcode() == SpvOpNop; + return bb->GetLabelInst()->opcode() == spv::Op::OpNop; }); blocks_.erase(first_empty, std::end(blocks_)); } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/graphics_robust_access_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/graphics_robust_access_pass.cpp index 4652d72d..e765c397 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/graphics_robust_access_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/graphics_robust_access_pass.cpp @@ -141,24 +141,17 @@ #include "graphics_robust_access_pass.h" -#include -#include #include #include -#include #include -#include "constants.h" -#include "def_use_manager.h" #include "function.h" #include "ir_context.h" -#include "module.h" #include "pass.h" #include "source/diagnostic.h" #include "source/util/make_unique.h" #include "spirv-tools/libspirv.h" #include "spirv/unified1/GLSL.std.450.h" -#include "spirv/unified1/spirv.h" #include "type_manager.h" #include "types.h" @@ -194,14 +187,15 @@ spvtools::DiagnosticStream GraphicsRobustAccessPass::Fail() { spv_result_t GraphicsRobustAccessPass::IsCompatibleModule() { auto* feature_mgr = context()->get_feature_mgr(); - if (!feature_mgr->HasCapability(SpvCapabilityShader)) + if (!feature_mgr->HasCapability(spv::Capability::Shader)) return Fail() << "Can only process Shader modules"; - if (feature_mgr->HasCapability(SpvCapabilityVariablePointers)) + if (feature_mgr->HasCapability(spv::Capability::VariablePointers)) return Fail() << "Can't process modules with VariablePointers capability"; - if (feature_mgr->HasCapability(SpvCapabilityVariablePointersStorageBuffer)) + if (feature_mgr->HasCapability( + spv::Capability::VariablePointersStorageBuffer)) return Fail() << "Can't process modules with VariablePointersStorageBuffer " "capability"; - if (feature_mgr->HasCapability(SpvCapabilityRuntimeDescriptorArrayEXT)) { + if (feature_mgr->HasCapability(spv::Capability::RuntimeDescriptorArrayEXT)) { // These have a RuntimeArray outside of Block-decorated struct. There // is no way to compute the array length from within SPIR-V. return Fail() << "Can't process modules with RuntimeDescriptorArrayEXT " @@ -210,8 +204,9 @@ spv_result_t GraphicsRobustAccessPass::IsCompatibleModule() { { auto* inst = context()->module()->GetMemoryModel(); - const auto addressing_model = inst->GetSingleWordOperand(0); - if (addressing_model != SpvAddressingModelLogical) + const auto addressing_model = + spv::AddressingModel(inst->GetSingleWordOperand(0)); + if (addressing_model != spv::AddressingModel::Logical) return Fail() << "Addressing model must be Logical. Found " << inst->PrettyPrint(); } @@ -237,11 +232,11 @@ bool GraphicsRobustAccessPass::ProcessAFunction(opt::Function* function) { for (auto& block : *function) { for (auto& inst : block) { switch (inst.opcode()) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: access_chains.push_back(&inst); break; - case SpvOpImageTexelPointer: + case spv::Op::OpImageTexelPointer: image_texel_pointers.push_back(&inst); break; default: @@ -268,7 +263,7 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( auto* def_use_mgr = context()->get_def_use_mgr(); auto* type_mgr = context()->get_type_mgr(); const bool have_int64_cap = - context()->get_feature_mgr()->HasCapability(SpvCapabilityInt64); + context()->get_feature_mgr()->HasCapability(spv::Capability::Int64); // Replaces one of the OpAccessChain index operands with a new value. // Updates def-use analysis. @@ -451,7 +446,7 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( // It doesn't matter if 1 is signed or unsigned. auto* one = GetValueForType(1, wider_type); auto* count_minus_1 = InsertInst( - &inst, SpvOpISub, type_mgr->GetId(wider_type), TakeNextId(), + &inst, spv::Op::OpISub, type_mgr->GetId(wider_type), TakeNextId(), {{SPV_OPERAND_TYPE_ID, {count_inst->result_id()}}, {SPV_OPERAND_TYPE_ID, {one->result_id()}}}); auto* zero = GetValueForType(0, wider_type); @@ -486,15 +481,15 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( Instruction* index_inst = GetDef(index_id); switch (pointee_type->opcode()) { - case SpvOpTypeMatrix: // Use column count - case SpvOpTypeVector: // Use component count + case spv::Op::OpTypeMatrix: // Use column count + case spv::Op::OpTypeVector: // Use component count { const uint32_t count = pointee_type->GetSingleWordOperand(2); clamp_to_literal_count(idx, count); pointee_type = GetDef(pointee_type->GetSingleWordOperand(1)); } break; - case SpvOpTypeArray: { + case spv::Op::OpTypeArray: { // The array length can be a spec constant, so go through the general // case. Instruction* array_len = GetDef(pointee_type->GetSingleWordOperand(2)); @@ -502,11 +497,11 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( pointee_type = GetDef(pointee_type->GetSingleWordOperand(1)); } break; - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { // SPIR-V requires the index to be an OpConstant. // We need to know the index literal value so we can compute the next // pointee type. - if (index_inst->opcode() != SpvOpConstant || + if (index_inst->opcode() != spv::Op::OpConstant || !constant_mgr->GetConstantFromInst(index_inst) ->type() ->AsInteger()) { @@ -537,7 +532,7 @@ void GraphicsRobustAccessPass::ClampIndicesForAccessChain( // No need to clamp this index. We just checked that it's valid. } break; - case SpvOpTypeRuntimeArray: { + case spv::Op::OpTypeRuntimeArray: { auto* array_len = MakeRuntimeArrayLengthInst(&inst, idx); if (!array_len) { // We've already signaled an error. return; @@ -571,16 +566,16 @@ uint32_t GraphicsRobustAccessPass::GetGlslInsts() { module_status_.glsl_insts_id = TakeNextId(); std::vector words = spvtools::utils::MakeVector(glsl); auto import_inst = MakeUnique( - context(), SpvOpExtInstImport, 0, module_status_.glsl_insts_id, + context(), spv::Op::OpExtInstImport, 0, module_status_.glsl_insts_id, std::initializer_list{ Operand{SPV_OPERAND_TYPE_LITERAL_STRING, std::move(words)}}); Instruction* inst = import_inst.get(); context()->module()->AddExtInstImport(std::move(import_inst)); module_status_.modified = true; context()->AnalyzeDefUse(inst); - // Reanalyze the feature list, since we added an extended instruction - // set improt. - context()->get_feature_mgr()->Analyze(context()->module()); + // Invalidates the feature manager, since we added an extended instruction + // set import. + context()->ResetFeatureManager(); } } return module_status_.glsl_insts_id; @@ -609,8 +604,8 @@ opt::Instruction* opt::GraphicsRobustAccessPass::WidenInteger( auto type_id = context()->get_type_mgr()->GetId(unsigned_type); auto conversion_id = TakeNextId(); auto* conversion = InsertInst( - before_inst, (sign_extend ? SpvOpSConvert : SpvOpUConvert), type_id, - conversion_id, {{SPV_OPERAND_TYPE_ID, {value->result_id()}}}); + before_inst, (sign_extend ? spv::Op::OpSConvert : spv::Op::OpUConvert), + type_id, conversion_id, {{SPV_OPERAND_TYPE_ID, {value->result_id()}}}); return conversion; } @@ -628,7 +623,7 @@ Instruction* GraphicsRobustAccessPass::MakeUMinInst( (void)xwidth; (void)ywidth; auto* smin_inst = InsertInst( - where, SpvOpExtInst, x->type_id(), smin_id, + where, spv::Op::OpExtInst, x->type_id(), smin_id, { {SPV_OPERAND_TYPE_ID, {glsl_insts_id}}, {SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER, {GLSLstd450UMin}}, @@ -655,7 +650,7 @@ Instruction* GraphicsRobustAccessPass::MakeSClampInst( (void)minwidth; (void)maxwidth; auto* clamp_inst = InsertInst( - where, SpvOpExtInst, x->type_id(), clamp_id, + where, spv::Op::OpExtInst, x->type_id(), clamp_id, { {SPV_OPERAND_TYPE_ID, {glsl_insts_id}}, {SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER, {GLSLstd450SClamp}}, @@ -689,13 +684,13 @@ Instruction* GraphicsRobustAccessPass::MakeRuntimeArrayLengthInst( Instruction* pointer_to_containing_struct = nullptr; while (steps_remaining > 0) { switch (current_access_chain->opcode()) { - case SpvOpCopyObject: + case spv::Op::OpCopyObject: // Whoops. Walk right through this one. current_access_chain = GetDef(current_access_chain->GetSingleWordInOperand(0)); break; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: { + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: { const int first_index_operand = 3; // How many indices in this access chain contribute to getting us // to an element in the runtime array? @@ -793,7 +788,8 @@ Instruction* GraphicsRobustAccessPass::MakeRuntimeArrayLengthInst( analysis::Integer uint_type_for_query(32, false); auto* uint_type = type_mgr->GetRegisteredType(&uint_type_for_query); auto* array_len = InsertInst( - access_chain, SpvOpArrayLength, type_mgr->GetId(uint_type), array_len_id, + access_chain, spv::Op::OpArrayLength, type_mgr->GetId(uint_type), + array_len_id, {{SPV_OPERAND_TYPE_ID, {pointer_to_containing_struct->result_id()}}, {SPV_OPERAND_TYPE_LITERAL_INTEGER, {member_index_of_runtime_array}}}); return array_len; @@ -839,11 +835,11 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( // Declare the ImageQuery capability if the module doesn't already have it. auto* feature_mgr = context()->get_feature_mgr(); - if (!feature_mgr->HasCapability(SpvCapabilityImageQuery)) { + if (!feature_mgr->HasCapability(spv::Capability::ImageQuery)) { auto cap = MakeUnique( - context(), SpvOpCapability, 0, 0, + context(), spv::Op::OpCapability, 0, 0, std::initializer_list{ - {SPV_OPERAND_TYPE_CAPABILITY, {SpvCapabilityImageQuery}}}); + {SPV_OPERAND_TYPE_CAPABILITY, {spv::Capability::ImageQuery}}}); def_use_mgr->AnalyzeInstDefUse(cap.get()); context()->AddCapability(std::move(cap)); feature_mgr->Analyze(context()->module()); @@ -890,21 +886,21 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( const int arrayness_bonus = arrayed ? 1 : 0; int num_coords = 0; switch (dim) { - case SpvDimBuffer: + case spv::Dim::Buffer: case SpvDim1D: num_coords = 1; break; - case SpvDimCube: + case spv::Dim::Cube: // For cube, we need bounds for x, y, but not face. - case SpvDimRect: + case spv::Dim::Rect: case SpvDim2D: num_coords = 2; break; case SpvDim3D: num_coords = 3; break; - case SpvDimSubpassData: - case SpvDimMax: + case spv::Dim::SubpassData: + case spv::Dim::Max: return Fail() << "Invalid image dimension for OpImageTexelPointer: " << int(dim); break; @@ -941,12 +937,12 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( const uint32_t image_id = TakeNextId(); auto* image = - InsertInst(image_texel_pointer, SpvOpLoad, image_type_id, image_id, + InsertInst(image_texel_pointer, spv::Op::OpLoad, image_type_id, image_id, {{SPV_OPERAND_TYPE_ID, {image_ptr->result_id()}}}); const uint32_t query_size_id = TakeNextId(); auto* query_size = - InsertInst(image_texel_pointer, SpvOpImageQuerySize, + InsertInst(image_texel_pointer, spv::Op::OpImageQuerySize, type_mgr->GetTypeInstruction(query_size_type), query_size_id, {{SPV_OPERAND_TYPE_ID, {image->result_id()}}}); @@ -962,7 +958,7 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( // in the face index ranging from 0 through 5. The inclusive upper bound // on the third coordinate therefore is multiplied by 6. auto* query_size_including_faces = query_size; - if (arrayed && (dim == SpvDimCube)) { + if (arrayed && (dim == spv::Dim::Cube)) { // Multiply the last coordinate by 6. auto* component_6 = constant_mgr->GetConstant(coord_component_type, {6}); const uint32_t component_6_id = @@ -974,7 +970,7 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( constant_mgr->GetDefiningInstruction(multiplicand); const auto query_size_including_faces_id = TakeNextId(); query_size_including_faces = InsertInst( - image_texel_pointer, SpvOpIMul, + image_texel_pointer, spv::Op::OpIMul, type_mgr->GetTypeInstruction(query_size_type), query_size_including_faces_id, {{SPV_OPERAND_TYPE_ID, {query_size_including_faces->result_id()}}, @@ -998,7 +994,7 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( const uint32_t query_max_including_faces_id = TakeNextId(); auto* query_max_including_faces = InsertInst( - image_texel_pointer, SpvOpISub, + image_texel_pointer, spv::Op::OpISub, type_mgr->GetTypeInstruction(query_size_type), query_max_including_faces_id, {{SPV_OPERAND_TYPE_ID, {query_size_including_faces->result_id()}}, @@ -1016,12 +1012,12 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( // Get the sample count via OpImageQuerySamples const auto query_samples_id = TakeNextId(); auto* query_samples = InsertInst( - image_texel_pointer, SpvOpImageQuerySamples, + image_texel_pointer, spv::Op::OpImageQuerySamples, constant_mgr->GetDefiningInstruction(component_0)->type_id(), query_samples_id, {{SPV_OPERAND_TYPE_ID, {image->result_id()}}}); const auto max_samples_id = TakeNextId(); - auto* max_samples = InsertInst(image_texel_pointer, SpvOpImageQuerySamples, + auto* max_samples = InsertInst(image_texel_pointer, spv::Op::OpImageQuerySamples, query_samples->type_id(), max_samples_id, {{SPV_OPERAND_TYPE_ID, {query_samples_id}}, {SPV_OPERAND_TYPE_ID, {component_1_id}}}); @@ -1043,7 +1039,7 @@ spv_result_t GraphicsRobustAccessPass::ClampCoordinateForImageTexelPointer( } opt::Instruction* GraphicsRobustAccessPass::InsertInst( - opt::Instruction* where_inst, SpvOp opcode, uint32_t type_id, + opt::Instruction* where_inst, spv::Op opcode, uint32_t type_id, uint32_t result_id, const Instruction::OperandList& operands) { module_status_.modified = true; auto* result = where_inst->InsertBefore( diff --git a/bgfx/3rdparty/spirv-tools/source/opt/graphics_robust_access_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/graphics_robust_access_pass.h index 8f4c9dc7..a7ffe115 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/graphics_robust_access_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/graphics_robust_access_pass.h @@ -133,7 +133,7 @@ class GraphicsRobustAccessPass : public Pass { // Returns a new instruction inserted before |where_inst|, and created from // the remaining arguments. Registers the definitions and uses of the new // instruction and also records its block. - opt::Instruction* InsertInst(opt::Instruction* where_inst, SpvOp opcode, + opt::Instruction* InsertInst(opt::Instruction* where_inst, spv::Op opcode, uint32_t type_id, uint32_t result_id, const Instruction::OperandList& operands); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/if_conversion.cpp b/bgfx/3rdparty/spirv-tools/source/opt/if_conversion.cpp index 1232796e..5912cf12 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/if_conversion.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/if_conversion.cpp @@ -23,7 +23,7 @@ namespace spvtools { namespace opt { Pass::Status IfConversion::Process() { - if (!context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) { + if (!context()->get_feature_mgr()->HasCapability(spv::Capability::Shader)) { return Status::SuccessWithoutChange; } @@ -40,7 +40,7 @@ Pass::Status IfConversion::Process() { // Get an insertion point. auto iter = block.begin(); - while (iter != block.end() && iter->opcode() == SpvOpPhi) { + while (iter != block.end() && iter->opcode() == spv::Op::OpPhi) { ++iter; } @@ -171,23 +171,26 @@ bool IfConversion::CheckBlock(BasicBlock* block, DominatorAnalysis* dominators, *common = dominators->CommonDominator(inc0, inc1); if (!*common || cfg()->IsPseudoEntryBlock(*common)) return false; Instruction* branch = (*common)->terminator(); - if (branch->opcode() != SpvOpBranchConditional) return false; + if (branch->opcode() != spv::Op::OpBranchConditional) return false; auto merge = (*common)->GetMergeInst(); - if (!merge || merge->opcode() != SpvOpSelectionMerge) return false; - if (merge->GetSingleWordInOperand(1) == SpvSelectionControlDontFlattenMask) + if (!merge || merge->opcode() != spv::Op::OpSelectionMerge) return false; + if (spv::SelectionControlMask(merge->GetSingleWordInOperand(1)) == + spv::SelectionControlMask::DontFlatten) { return false; + } if ((*common)->MergeBlockIdIfAny() != block->id()) return false; return true; } bool IfConversion::CheckPhiUsers(Instruction* phi, BasicBlock* block) { - return get_def_use_mgr()->WhileEachUser(phi, [block, - this](Instruction* user) { - if (user->opcode() == SpvOpPhi && context()->get_instr_block(user) == block) - return false; - return true; - }); + return get_def_use_mgr()->WhileEachUser( + phi, [block, this](Instruction* user) { + if (user->opcode() == spv::Op::OpPhi && + context()->get_instr_block(user) == block) + return false; + return true; + }); } uint32_t IfConversion::SplatCondition(analysis::Vector* vec_data_ty, @@ -207,9 +210,9 @@ uint32_t IfConversion::SplatCondition(analysis::Vector* vec_data_ty, bool IfConversion::CheckType(uint32_t id) { Instruction* type = get_def_use_mgr()->GetDef(id); - SpvOp op = type->opcode(); - if (spvOpcodeIsScalarType(op) || op == SpvOpTypePointer || - op == SpvOpTypeVector) + spv::Op op = type->opcode(); + if (spvOpcodeIsScalarType(op) || op == spv::Op::OpTypePointer || + op == spv::Op::OpTypeVector) return true; return false; } @@ -255,7 +258,7 @@ void IfConversion::HoistInstruction(Instruction* inst, BasicBlock* target_block, }); Instruction* insertion_pos = target_block->terminator(); - if ((insertion_pos)->PreviousNode()->opcode() == SpvOpSelectionMerge) { + if ((insertion_pos)->PreviousNode()->opcode() == spv::Op::OpSelectionMerge) { insertion_pos = insertion_pos->PreviousNode(); } inst->RemoveFromList(); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/inline_opaque_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/inline_opaque_pass.cpp index fe9c6799..90a4c224 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/inline_opaque_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/inline_opaque_pass.cpp @@ -21,26 +21,24 @@ namespace spvtools { namespace opt { namespace { - -const uint32_t kTypePointerTypeIdInIdx = 1; - -} // anonymous namespace +constexpr uint32_t kTypePointerTypeIdInIdx = 1; +} // namespace bool InlineOpaquePass::IsOpaqueType(uint32_t typeId) { const Instruction* typeInst = get_def_use_mgr()->GetDef(typeId); switch (typeInst->opcode()) { - case SpvOpTypeSampler: - case SpvOpTypeImage: - case SpvOpTypeSampledImage: + case spv::Op::OpTypeSampler: + case spv::Op::OpTypeImage: + case spv::Op::OpTypeSampledImage: return true; - case SpvOpTypePointer: + case spv::Op::OpTypePointer: return IsOpaqueType( typeInst->GetSingleWordInOperand(kTypePointerTypeIdInIdx)); default: break; } // TODO(greg-lunarg): Handle arrays containing opaque type - if (typeInst->opcode() != SpvOpTypeStruct) return false; + if (typeInst->opcode() != spv::Op::OpTypeStruct) return false; // Return true if any member is opaque return !typeInst->WhileEachInId([this](const uint32_t* tid) { if (IsOpaqueType(*tid)) return false; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.cpp index e14516f7..3f160b24 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.cpp @@ -23,24 +23,24 @@ #include "source/opt/reflect.h" #include "source/util/make_unique.h" -// Indices of operands in SPIR-V instructions - -static const int kSpvFunctionCallFunctionId = 2; -static const int kSpvFunctionCallArgumentId = 3; -static const int kSpvReturnValueId = 0; - namespace spvtools { namespace opt { +namespace { +// Indices of operands in SPIR-V instructions +constexpr int kSpvFunctionCallFunctionId = 2; +constexpr int kSpvFunctionCallArgumentId = 3; +constexpr int kSpvReturnValueId = 0; +} // namespace uint32_t InlinePass::AddPointerToType(uint32_t type_id, - SpvStorageClass storage_class) { + spv::StorageClass storage_class) { uint32_t resultId = context()->TakeNextId(); if (resultId == 0) { return resultId; } std::unique_ptr type_inst( - new Instruction(context(), SpvOpTypePointer, 0, resultId, + new Instruction(context(), spv::Op::OpTypePointer, 0, resultId, {{spv_operand_type_t::SPV_OPERAND_TYPE_STORAGE_CLASS, {uint32_t(storage_class)}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {type_id}}})); @@ -48,8 +48,8 @@ uint32_t InlinePass::AddPointerToType(uint32_t type_id, analysis::Type* pointeeTy; std::unique_ptr pointerTy; std::tie(pointeeTy, pointerTy) = - context()->get_type_mgr()->GetTypeAndPointerType(type_id, - SpvStorageClassFunction); + context()->get_type_mgr()->GetTypeAndPointerType( + type_id, spv::StorageClass::Function); context()->get_type_mgr()->RegisterType(resultId, *pointerTy); return resultId; } @@ -57,7 +57,7 @@ uint32_t InlinePass::AddPointerToType(uint32_t type_id, void InlinePass::AddBranch(uint32_t label_id, std::unique_ptr* block_ptr) { std::unique_ptr newBranch( - new Instruction(context(), SpvOpBranch, 0, 0, + new Instruction(context(), spv::Op::OpBranch, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {label_id}}})); (*block_ptr)->AddInstruction(std::move(newBranch)); } @@ -66,7 +66,7 @@ void InlinePass::AddBranchCond(uint32_t cond_id, uint32_t true_id, uint32_t false_id, std::unique_ptr* block_ptr) { std::unique_ptr newBranch( - new Instruction(context(), SpvOpBranchConditional, 0, 0, + new Instruction(context(), spv::Op::OpBranchConditional, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {cond_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {true_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {false_id}}})); @@ -76,7 +76,7 @@ void InlinePass::AddBranchCond(uint32_t cond_id, uint32_t true_id, void InlinePass::AddLoopMerge(uint32_t merge_id, uint32_t continue_id, std::unique_ptr* block_ptr) { std::unique_ptr newLoopMerge(new Instruction( - context(), SpvOpLoopMerge, 0, 0, + context(), spv::Op::OpLoopMerge, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {merge_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {continue_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_LOOP_CONTROL, {0}}})); @@ -88,7 +88,7 @@ void InlinePass::AddStore(uint32_t ptr_id, uint32_t val_id, const Instruction* line_inst, const DebugScope& dbg_scope) { std::unique_ptr newStore( - new Instruction(context(), SpvOpStore, 0, 0, + new Instruction(context(), spv::Op::OpStore, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ptr_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {val_id}}})); if (line_inst != nullptr) { @@ -103,7 +103,7 @@ void InlinePass::AddLoad(uint32_t type_id, uint32_t resultId, uint32_t ptr_id, const Instruction* line_inst, const DebugScope& dbg_scope) { std::unique_ptr newLoad( - new Instruction(context(), SpvOpLoad, type_id, resultId, + new Instruction(context(), spv::Op::OpLoad, type_id, resultId, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ptr_id}}})); if (line_inst != nullptr) { newLoad->AddDebugLine(line_inst); @@ -114,27 +114,27 @@ void InlinePass::AddLoad(uint32_t type_id, uint32_t resultId, uint32_t ptr_id, std::unique_ptr InlinePass::NewLabel(uint32_t label_id) { std::unique_ptr newLabel( - new Instruction(context(), SpvOpLabel, 0, label_id, {})); + new Instruction(context(), spv::Op::OpLabel, 0, label_id, {})); return newLabel; } uint32_t InlinePass::GetFalseId() { if (false_id_ != 0) return false_id_; - false_id_ = get_module()->GetGlobalValue(SpvOpConstantFalse); + false_id_ = get_module()->GetGlobalValue(spv::Op::OpConstantFalse); if (false_id_ != 0) return false_id_; - uint32_t boolId = get_module()->GetGlobalValue(SpvOpTypeBool); + uint32_t boolId = get_module()->GetGlobalValue(spv::Op::OpTypeBool); if (boolId == 0) { boolId = context()->TakeNextId(); if (boolId == 0) { return 0; } - get_module()->AddGlobalValue(SpvOpTypeBool, boolId, 0); + get_module()->AddGlobalValue(spv::Op::OpTypeBool, boolId, 0); } false_id_ = context()->TakeNextId(); if (false_id_ == 0) { return 0; } - get_module()->AddGlobalValue(SpvOpConstantFalse, false_id_, boolId); + get_module()->AddGlobalValue(spv::Op::OpConstantFalse, false_id_, boolId); return false_id_; } @@ -157,10 +157,10 @@ bool InlinePass::CloneAndMapLocals( analysis::DebugInlinedAtContext* inlined_at_ctx) { auto callee_block_itr = calleeFn->begin(); auto callee_var_itr = callee_block_itr->begin(); - while (callee_var_itr->opcode() == SpvOp::SpvOpVariable || + while (callee_var_itr->opcode() == spv::Op::OpVariable || callee_var_itr->GetCommonDebugOpcode() == CommonDebugInfoDebugDeclare) { - if (callee_var_itr->opcode() != SpvOp::SpvOpVariable) { + if (callee_var_itr->opcode() != spv::Op::OpVariable) { ++callee_var_itr; continue; } @@ -191,10 +191,11 @@ uint32_t InlinePass::CreateReturnVar( "Cannot create a return variable of type void."); // Find or create ptr to callee return type. uint32_t returnVarTypeId = - type_mgr->FindPointerToType(calleeTypeId, SpvStorageClassFunction); + type_mgr->FindPointerToType(calleeTypeId, spv::StorageClass::Function); if (returnVarTypeId == 0) { - returnVarTypeId = AddPointerToType(calleeTypeId, SpvStorageClassFunction); + returnVarTypeId = + AddPointerToType(calleeTypeId, spv::StorageClass::Function); if (returnVarTypeId == 0) { return 0; } @@ -206,17 +207,18 @@ uint32_t InlinePass::CreateReturnVar( return 0; } - std::unique_ptr var_inst( - new Instruction(context(), SpvOpVariable, returnVarTypeId, returnVarId, - {{spv_operand_type_t::SPV_OPERAND_TYPE_STORAGE_CLASS, - {SpvStorageClassFunction}}})); + std::unique_ptr var_inst(new Instruction( + context(), spv::Op::OpVariable, returnVarTypeId, returnVarId, + {{spv_operand_type_t::SPV_OPERAND_TYPE_STORAGE_CLASS, + {(uint32_t)spv::StorageClass::Function}}})); new_vars->push_back(std::move(var_inst)); get_decoration_mgr()->CloneDecorations(calleeFn->result_id(), returnVarId); return returnVarId; } bool InlinePass::IsSameBlockOp(const Instruction* inst) const { - return inst->opcode() == SpvOpSampledImage || inst->opcode() == SpvOpImage; + return inst->opcode() == spv::Op::OpSampledImage || + inst->opcode() == spv::Op::OpImage; } bool InlinePass::CloneSameBlockOps( @@ -299,9 +301,9 @@ InstructionList::iterator InlinePass::AddStoresForVariableInitializers( std::unique_ptr* new_blk_ptr, UptrVectorIterator callee_first_block_itr) { auto callee_itr = callee_first_block_itr->begin(); - while (callee_itr->opcode() == SpvOp::SpvOpVariable || + while (callee_itr->opcode() == spv::Op::OpVariable || callee_itr->GetCommonDebugOpcode() == CommonDebugInfoDebugDeclare) { - if (callee_itr->opcode() == SpvOp::SpvOpVariable && + if (callee_itr->opcode() == spv::Op::OpVariable && callee_itr->NumInOperands() == 2) { assert(callee2caller.count(callee_itr->result_id()) && "Expected the variable to have already been mapped."); @@ -330,7 +332,8 @@ bool InlinePass::InlineSingleInstruction( BasicBlock* new_blk_ptr, const Instruction* inst, uint32_t dbg_inlined_at) { // If we have return, it must be at the end of the callee. We will handle // it at the end. - if (inst->opcode() == SpvOpReturnValue || inst->opcode() == SpvOpReturn) + if (inst->opcode() == spv::Op::OpReturnValue || + inst->opcode() == spv::Op::OpReturn) return true; // Copy callee instruction and remap all input Ids. @@ -366,7 +369,7 @@ std::unique_ptr InlinePass::InlineReturn( analysis::DebugInlinedAtContext* inlined_at_ctx, Function* calleeFn, const Instruction* inst, uint32_t returnVarId) { // Store return value to return variable. - if (inst->opcode() == SpvOpReturnValue) { + if (inst->opcode() == spv::Op::OpReturnValue) { assert(returnVarId != 0); uint32_t valId = inst->GetInOperand(kSpvReturnValueId).words[0]; const auto mapItr = callee2caller.find(valId); @@ -388,7 +391,8 @@ std::unique_ptr InlinePass::InlineReturn( } if (returnLabelId == 0) return new_blk_ptr; - if (inst->opcode() == SpvOpReturn || inst->opcode() == SpvOpReturnValue) + if (inst->opcode() == spv::Op::OpReturn || + inst->opcode() == spv::Op::OpReturnValue) AddBranch(returnLabelId, &new_blk_ptr); new_blocks->push_back(std::move(new_blk_ptr)); return MakeUnique(NewLabel(returnLabelId)); @@ -499,7 +503,7 @@ void InlinePass::MoveLoopMergeInstToFirstBlock( // Insert a modified copy of the loop merge into the first block. auto loop_merge_itr = last->tail(); --loop_merge_itr; - assert(loop_merge_itr->opcode() == SpvOpLoopMerge); + assert(loop_merge_itr->opcode() == spv::Op::OpLoopMerge); std::unique_ptr cp_inst(loop_merge_itr->Clone(context())); first->tail().InsertBefore(std::move(cp_inst)); @@ -696,7 +700,7 @@ bool InlinePass::GenInlineCode( } bool InlinePass::IsInlinableFunctionCall(const Instruction* inst) { - if (inst->opcode() != SpvOp::SpvOpFunctionCall) return false; + if (inst->opcode() != spv::Op::OpFunctionCall) return false; const uint32_t calleeFnId = inst->GetSingleWordOperand(kSpvFunctionCallFunctionId); const auto ci = inlinable_.find(calleeFnId); @@ -738,7 +742,7 @@ void InlinePass::UpdateSucceedingPhis( bool InlinePass::HasNoReturnInLoop(Function* func) { // If control not structured, do not do loop/return analysis // TODO: Analyze returns in non-structured control flow - if (!context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) + if (!context()->get_feature_mgr()->HasCapability(spv::Capability::Shader)) return false; const auto structured_analysis = context()->GetStructuredCFGAnalysis(); // Search for returns in structured construct. @@ -776,7 +780,7 @@ bool InlinePass::IsInlinableFunction(Function* func) { if (func->cbegin() == func->cend()) return false; // Do not inline functions with DontInline flag. - if (func->control_mask() & SpvFunctionControlDontInlineMask) { + if (func->control_mask() & uint32_t(spv::FunctionControlMask::DontInline)) { return false; } @@ -811,7 +815,7 @@ bool InlinePass::IsInlinableFunction(Function* func) { bool InlinePass::ContainsAbortOtherThanUnreachable(Function* func) const { return !func->WhileEachInst([](Instruction* inst) { - return inst->opcode() == SpvOpUnreachable || + return inst->opcode() == spv::Op::OpUnreachable || !spvOpcodeIsAbort(inst->opcode()); }); } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.h index d29c1e07..1c9d60e3 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.h @@ -44,7 +44,7 @@ class InlinePass : public Pass { // Add pointer to type to module and return resultId. Returns 0 if the type // could not be created. - uint32_t AddPointerToType(uint32_t type_id, SpvStorageClass storage_class); + uint32_t AddPointerToType(uint32_t type_id, spv::StorageClass storage_class); // Add unconditional branch to labelId to end of block block_ptr. void AddBranch(uint32_t labelId, std::unique_ptr* block_ptr); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/inst_bindless_check_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/inst_bindless_check_pass.cpp index c2c5d6cb..339fb1b6 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/inst_bindless_check_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/inst_bindless_check_pass.cpp @@ -16,88 +16,689 @@ #include "inst_bindless_check_pass.h" -namespace { - -// Input Operand Indices -static const int kSpvImageSampleImageIdInIdx = 0; -static const int kSpvSampledImageImageIdInIdx = 0; -static const int kSpvSampledImageSamplerIdInIdx = 1; -static const int kSpvImageSampledImageIdInIdx = 0; -static const int kSpvCopyObjectOperandIdInIdx = 0; -static const int kSpvLoadPtrIdInIdx = 0; -static const int kSpvAccessChainBaseIdInIdx = 0; -static const int kSpvAccessChainIndex0IdInIdx = 1; -static const int kSpvTypeArrayTypeIdInIdx = 0; -static const int kSpvTypeArrayLengthIdInIdx = 1; -static const int kSpvConstantValueInIdx = 0; -static const int kSpvVariableStorageClassInIdx = 0; -static const int kSpvTypePtrTypeIdInIdx = 1; -static const int kSpvTypeImageDim = 1; -static const int kSpvTypeImageDepth = 2; -static const int kSpvTypeImageArrayed = 3; -static const int kSpvTypeImageMS = 4; -static const int kSpvTypeImageSampled = 5; -} // anonymous namespace +#include "source/spirv_constant.h" namespace spvtools { namespace opt { +namespace { +// Input Operand Indices +constexpr int kSpvImageSampleImageIdInIdx = 0; +constexpr int kSpvSampledImageImageIdInIdx = 0; +constexpr int kSpvSampledImageSamplerIdInIdx = 1; +constexpr int kSpvImageSampledImageIdInIdx = 0; +constexpr int kSpvCopyObjectOperandIdInIdx = 0; +constexpr int kSpvLoadPtrIdInIdx = 0; +constexpr int kSpvAccessChainBaseIdInIdx = 0; +constexpr int kSpvAccessChainIndex0IdInIdx = 1; +constexpr int kSpvTypeArrayTypeIdInIdx = 0; +constexpr int kSpvVariableStorageClassInIdx = 0; +constexpr int kSpvTypePtrTypeIdInIdx = 1; +constexpr int kSpvTypeImageDim = 1; +constexpr int kSpvTypeImageDepth = 2; +constexpr int kSpvTypeImageArrayed = 3; +constexpr int kSpvTypeImageMS = 4; +} // namespace + +void InstBindlessCheckPass::SetupInputBufferIds() { + if (input_buffer_id_ != 0) { + return; + } + AddStorageBufferExt(); + if (!get_feature_mgr()->HasExtension(kSPV_KHR_physical_storage_buffer)) { + context()->AddExtension("SPV_KHR_physical_storage_buffer"); + } + context()->AddCapability(spv::Capability::PhysicalStorageBufferAddresses); + Instruction* memory_model = get_module()->GetMemoryModel(); + // TODO should this be just Physical64? + memory_model->SetInOperand( + 0u, {uint32_t(spv::AddressingModel::PhysicalStorageBuffer64)}); + + analysis::DecorationManager* deco_mgr = get_decoration_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + constexpr uint32_t width = 32u; + + // declare the DescriptorSetData struct + analysis::Struct* desc_set_struct = + GetStruct({type_mgr->GetUIntType(), GetUintRuntimeArrayType(width)}); + desc_set_type_id_ = type_mgr->GetTypeInstruction(desc_set_struct); + // By the Vulkan spec, a pre-existing struct containing a RuntimeArray + // must be a block, and will therefore be decorated with Block. Therefore + // the undecorated type returned here will not be pre-existing and can + // safely be decorated. Since this type is now decorated, it is out of + // sync with the TypeManager and therefore the TypeManager must be + // invalidated after this pass. + assert(context()->get_def_use_mgr()->NumUses(desc_set_type_id_) == 0 && + "used struct type returned"); + deco_mgr->AddDecoration(desc_set_type_id_, uint32_t(spv::Decoration::Block)); + deco_mgr->AddMemberDecoration(desc_set_type_id_, 0, + uint32_t(spv::Decoration::Offset), 0); + deco_mgr->AddMemberDecoration(desc_set_type_id_, 1, + uint32_t(spv::Decoration::Offset), 4); + context()->AddDebug2Inst( + NewGlobalName(desc_set_type_id_, "DescriptorSetData")); + context()->AddDebug2Inst(NewMemberName(desc_set_type_id_, 0, "num_bindings")); + context()->AddDebug2Inst(NewMemberName(desc_set_type_id_, 1, "data")); + + // declare buffer address reference to DescriptorSetData + desc_set_ptr_id_ = type_mgr->FindPointerToType( + desc_set_type_id_, spv::StorageClass::PhysicalStorageBuffer); + // runtime array of buffer addresses + analysis::Type* rarr_ty = GetArray(type_mgr->GetType(desc_set_ptr_id_), + kDebugInputBindlessMaxDescSets); + deco_mgr->AddDecorationVal(type_mgr->GetId(rarr_ty), + uint32_t(spv::Decoration::ArrayStride), 8u); -uint32_t InstBindlessCheckPass::GenDebugReadLength( - uint32_t var_id, InstructionBuilder* builder) { - uint32_t desc_set_idx = - var2desc_set_[var_id] + kDebugInputBindlessOffsetLengths; - uint32_t desc_set_idx_id = builder->GetUintConstantId(desc_set_idx); - uint32_t binding_idx_id = builder->GetUintConstantId(var2binding_[var_id]); - return GenDebugDirectRead({desc_set_idx_id, binding_idx_id}, builder); + // declare the InputBuffer type, a struct wrapper around the runtime array + analysis::Struct* input_buffer_struct = GetStruct({rarr_ty}); + input_buffer_struct_id_ = type_mgr->GetTypeInstruction(input_buffer_struct); + deco_mgr->AddDecoration(input_buffer_struct_id_, + uint32_t(spv::Decoration::Block)); + deco_mgr->AddMemberDecoration(input_buffer_struct_id_, 0, + uint32_t(spv::Decoration::Offset), 0); + context()->AddDebug2Inst( + NewGlobalName(input_buffer_struct_id_, "InputBuffer")); + context()->AddDebug2Inst( + NewMemberName(input_buffer_struct_id_, 0, "desc_sets")); + + input_buffer_ptr_id_ = type_mgr->FindPointerToType( + input_buffer_struct_id_, spv::StorageClass::StorageBuffer); + + // declare the input_buffer global variable + input_buffer_id_ = TakeNextId(); + + const std::vector var_operands = { + {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, + {uint32_t(spv::StorageClass::StorageBuffer)}}, + }; + auto new_var_op = spvtools::MakeUnique( + context(), spv::Op::OpVariable, input_buffer_ptr_id_, input_buffer_id_, + var_operands); + + context()->AddGlobalValue(std::move(new_var_op)); + context()->AddDebug2Inst(NewGlobalName(input_buffer_id_, "input_buffer")); + deco_mgr->AddDecorationVal( + input_buffer_id_, uint32_t(spv::Decoration::DescriptorSet), desc_set_); + deco_mgr->AddDecorationVal(input_buffer_id_, + uint32_t(spv::Decoration::Binding), + GetInputBufferBinding()); + if (get_module()->version() >= SPV_SPIRV_VERSION_WORD(1, 4)) { + // Add the new buffer to all entry points. + for (auto& entry : get_module()->entry_points()) { + entry.AddOperand({SPV_OPERAND_TYPE_ID, {input_buffer_id_}}); + context()->AnalyzeUses(&entry); + } + } } -uint32_t InstBindlessCheckPass::GenDebugReadInit(uint32_t var_id, - uint32_t desc_idx_id, - InstructionBuilder* builder) { - uint32_t binding_idx_id = builder->GetUintConstantId(var2binding_[var_id]); - uint32_t u_desc_idx_id = GenUintCastCode(desc_idx_id, builder); - // If desc index checking is not enabled, we know the offset of initialization - // entries is 1, so we can avoid loading this value and just add 1 to the - // descriptor set. - if (!desc_idx_enabled_) { - uint32_t desc_set_idx_id = - builder->GetUintConstantId(var2desc_set_[var_id] + 1); - return GenDebugDirectRead({desc_set_idx_id, binding_idx_id, u_desc_idx_id}, - builder); - } else { - uint32_t desc_set_base_id = - builder->GetUintConstantId(kDebugInputBindlessInitOffset); - uint32_t desc_set_idx_id = - builder->GetUintConstantId(var2desc_set_[var_id]); - return GenDebugDirectRead( - {desc_set_base_id, desc_set_idx_id, binding_idx_id, u_desc_idx_id}, - builder); +// clang-format off +// GLSL: +//bool inst_bindless_check_desc(uint shader_id, uint inst_num, uvec4 stage_info, uint desc_set, uint binding, uint desc_index, +// uint byte_offset) +//{ +// uint error = 0u; +// uint param5 = 0u; +// uint param6 = 0u; +// uint num_bindings = 0u; +// uint init_state = 0u; +// if (desc_set >= 32u) { +// error = 1u; +// } +// inst_bindless_DescriptorSetData set_data; +// if (error == 0u) { +// set_data = inst_bindless_input_buffer.desc_sets[desc_set]; +// uvec2 ptr_vec = uvec2(set_data); +// if ((ptr_vec.x == 0u) && (ptr_vec.y == 0u)) { +// error = 1u; +// } +// } +// if (error == 0u) { +// num_bindings = set_data.num_bindings; +// if (binding >= num_bindings) { +// error = 1u; +// } +// } +// if (error == 0u) { +// if (desc_index >= set_data.data[binding]) { +// error = 1u; +// param5 = set_data.data[binding]; +// } +// } +// if (0u == error) { +// uint state_index = set_data.data[num_bindings + binding] + desc_index; +// init_state = set_data.data[state_index]; +// if (init_state == 0u) { +// error = 2u; +// } +// } +// if (error == 0u) { +// if (byte_offset >= init_state) { +// error = 4u; +// param5 = byte_offset; +// param6 = init_state; +// } +// } +// if (0u != error) { +// inst_bindless_stream_write_6(shader_id, inst_num, stage_info, error, desc_set, binding, desc_index, param5, param6); +// return false; +// } +// return true; +//} +// clang-format on +uint32_t InstBindlessCheckPass::GenDescCheckFunctionId() { + enum { + kShaderId = 0, + kInstructionIndex = 1, + kStageInfo = 2, + kDescSet = 3, + kDescBinding = 4, + kDescIndex = 5, + kByteOffset = 6, + kNumArgs + }; + if (desc_check_func_id_ != 0) { + return desc_check_func_id_; + } + + SetupInputBufferIds(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + const analysis::Integer* uint_type = GetInteger(32, false); + const analysis::Vector v4uint(uint_type, 4); + const analysis::Type* v4uint_type = type_mgr->GetRegisteredType(&v4uint); + std::vector param_types(kNumArgs, uint_type); + param_types[2] = v4uint_type; + + const uint32_t func_id = TakeNextId(); + std::unique_ptr func = + StartFunction(func_id, type_mgr->GetBoolType(), param_types); + + const std::vector param_ids = AddParameters(*func, param_types); + + const uint32_t func_uint_ptr = + type_mgr->FindPointerToType(GetUintId(), spv::StorageClass::Function); + // Create block + auto new_blk_ptr = MakeUnique(NewLabel(TakeNextId())); + InstructionBuilder builder( + context(), new_blk_ptr.get(), + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + Instruction* inst; + const uint32_t zero_id = builder.GetUintConstantId(0); + const uint32_t false_id = builder.GetBoolConstantId(false); + const uint32_t true_id = builder.GetBoolConstantId(true); + const uint32_t uint_ptr = type_mgr->FindPointerToType( + GetUintId(), spv::StorageClass::PhysicalStorageBuffer); + + inst = builder.AddBinaryOp(func_uint_ptr, spv::Op::OpVariable, + uint32_t(spv::StorageClass::Function), zero_id); + const uint32_t error_var = inst->result_id(); + + inst = builder.AddBinaryOp(func_uint_ptr, spv::Op::OpVariable, + uint32_t(spv::StorageClass::Function), zero_id); + const uint32_t param5_var = inst->result_id(); + + inst = builder.AddBinaryOp(func_uint_ptr, spv::Op::OpVariable, + uint32_t(spv::StorageClass::Function), zero_id); + const uint32_t param6_var = inst->result_id(); + + inst = builder.AddBinaryOp(func_uint_ptr, spv::Op::OpVariable, + uint32_t(spv::StorageClass::Function), zero_id); + const uint32_t num_bindings_var = inst->result_id(); + inst = builder.AddBinaryOp(func_uint_ptr, spv::Op::OpVariable, + uint32_t(spv::StorageClass::Function), zero_id); + const uint32_t init_status_var = inst->result_id(); + + const uint32_t desc_set_ptr_ptr = type_mgr->FindPointerToType( + desc_set_ptr_id_, spv::StorageClass::Function); + + inst = builder.AddUnaryOp(desc_set_ptr_ptr, spv::Op::OpVariable, + uint32_t(spv::StorageClass::Function)); + const uint32_t desc_set_ptr_var = inst->result_id(); + get_decoration_mgr()->AddDecoration( + desc_set_ptr_var, uint32_t(spv::Decoration::AliasedPointer)); + + uint32_t check_label_id = TakeNextId(); + auto check_label = NewLabel(check_label_id); + uint32_t skip_label_id = TakeNextId(); + auto skip_label = NewLabel(skip_label_id); + inst = builder.AddBinaryOp( + GetBoolId(), spv::Op::OpUGreaterThanEqual, param_ids[kDescSet], + builder.GetUintConstantId(kDebugInputBindlessMaxDescSets)); + const uint32_t desc_cmp_id = inst->result_id(); + + (void)builder.AddConditionalBranch(desc_cmp_id, check_label_id, skip_label_id, + skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + // set error + new_blk_ptr = MakeUnique(std::move(check_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddStore(error_var, + builder.GetUintConstantId(kInstErrorBindlessBounds)); + builder.AddBranch(skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + // check descriptor set table entry is non-null + new_blk_ptr = MakeUnique(std::move(skip_label)); + builder.SetInsertPoint(&*new_blk_ptr); + + check_label_id = TakeNextId(); + check_label = NewLabel(check_label_id); + skip_label_id = TakeNextId(); + skip_label = NewLabel(skip_label_id); + inst = builder.AddLoad(GetUintId(), error_var); + uint32_t error_val_id = inst->result_id(); + + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpIEqual, error_val_id, + zero_id); + uint32_t no_error_id = inst->result_id(); + (void)builder.AddConditionalBranch(no_error_id, check_label_id, skip_label_id, + skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + new_blk_ptr = MakeUnique(std::move(check_label)); + builder.SetInsertPoint(&*new_blk_ptr); + + { + const uint32_t desc_set_ptr_ptr_sb = type_mgr->FindPointerToType( + desc_set_ptr_id_, spv::StorageClass::StorageBuffer); + + inst = builder.AddAccessChain(desc_set_ptr_ptr_sb, input_buffer_id_, + {zero_id, param_ids[kDescSet]}); + const uint32_t set_access_chain_id = inst->result_id(); + + inst = builder.AddLoad(desc_set_ptr_id_, set_access_chain_id); + const uint32_t desc_set_ptr_id = inst->result_id(); + + builder.AddStore(desc_set_ptr_var, desc_set_ptr_id); + + inst = builder.AddUnaryOp(GetVecUintId(2), spv::Op::OpBitcast, + desc_set_ptr_id); + const uint32_t ptr_as_uvec_id = inst->result_id(); + + inst = builder.AddCompositeExtract(GetUintId(), ptr_as_uvec_id, {0}); + const uint32_t uvec_x = inst->result_id(); + + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpIEqual, uvec_x, zero_id); + const uint32_t x_is_zero_id = inst->result_id(); + + inst = builder.AddCompositeExtract(GetUintId(), ptr_as_uvec_id, {1}); + const uint32_t uvec_y = inst->result_id(); + + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpIEqual, uvec_y, zero_id); + const uint32_t y_is_zero_id = inst->result_id(); + + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpLogicalAnd, x_is_zero_id, + y_is_zero_id); + const uint32_t is_null_id = inst->result_id(); + + const uint32_t error_label_id = TakeNextId(); + auto error_label = NewLabel(error_label_id); + const uint32_t merge_label_id = TakeNextId(); + auto merge_label = NewLabel(merge_label_id); + (void)builder.AddConditionalBranch(is_null_id, error_label_id, + merge_label_id, merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + // set error + new_blk_ptr = MakeUnique(std::move(error_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddStore(error_var, + builder.GetUintConstantId(kInstErrorBindlessBounds)); + builder.AddBranch(merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + new_blk_ptr = MakeUnique(std::move(merge_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddBranch(skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + } + + new_blk_ptr = MakeUnique(std::move(skip_label)); + builder.SetInsertPoint(&*new_blk_ptr); + + check_label_id = TakeNextId(); + check_label = NewLabel(check_label_id); + skip_label_id = TakeNextId(); + skip_label = NewLabel(skip_label_id); + + inst = builder.AddLoad(GetUintId(), error_var); + error_val_id = inst->result_id(); + + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpIEqual, error_val_id, + zero_id); + no_error_id = inst->result_id(); + (void)builder.AddConditionalBranch(no_error_id, check_label_id, skip_label_id, + skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + // check binding is in range + new_blk_ptr = MakeUnique(std::move(check_label)); + builder.SetInsertPoint(&*new_blk_ptr); + { + inst = builder.AddLoad(desc_set_ptr_id_, desc_set_ptr_var); + const uint32_t desc_set_ptr_id = inst->result_id(); + + inst = builder.AddAccessChain(uint_ptr, desc_set_ptr_id, {zero_id}); + const uint32_t binding_access_chain_id = inst->result_id(); + + inst = builder.AddLoad(GetUintId(), binding_access_chain_id, 8); + const uint32_t num_bindings_id = inst->result_id(); + + builder.AddStore(num_bindings_var, num_bindings_id); + + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpUGreaterThanEqual, + param_ids[kDescBinding], num_bindings_id); + const uint32_t bindings_cmp_id = inst->result_id(); + + const uint32_t error_label_id = TakeNextId(); + auto error_label = NewLabel(error_label_id); + const uint32_t merge_label_id = TakeNextId(); + auto merge_label = NewLabel(merge_label_id); + (void)builder.AddConditionalBranch(bindings_cmp_id, error_label_id, + merge_label_id, merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + // set error + new_blk_ptr = MakeUnique(std::move(error_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddStore(error_var, + builder.GetUintConstantId(kInstErrorBindlessBounds)); + builder.AddBranch(merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + new_blk_ptr = MakeUnique(std::move(merge_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddBranch(skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + } + + // read binding length + new_blk_ptr = MakeUnique(std::move(skip_label)); + builder.SetInsertPoint(&*new_blk_ptr); + + check_label_id = TakeNextId(); + check_label = NewLabel(check_label_id); + skip_label_id = TakeNextId(); + skip_label = NewLabel(skip_label_id); + + inst = builder.AddLoad(GetUintId(), error_var); + error_val_id = inst->result_id(); + + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpIEqual, error_val_id, + zero_id); + no_error_id = inst->result_id(); + (void)builder.AddConditionalBranch(no_error_id, check_label_id, skip_label_id, + skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + new_blk_ptr = MakeUnique(std::move(check_label)); + builder.SetInsertPoint(&*new_blk_ptr); + { + inst = builder.AddLoad(desc_set_ptr_id_, desc_set_ptr_var); + const uint32_t desc_set_ptr_id = inst->result_id(); + + inst = builder.AddAccessChain( + uint_ptr, desc_set_ptr_id, + {{builder.GetUintConstantId(1), param_ids[kDescBinding]}}); + const uint32_t length_ac_id = inst->result_id(); + + inst = builder.AddLoad(GetUintId(), length_ac_id, sizeof(uint32_t)); + const uint32_t length_id = inst->result_id(); + + // Check descriptor index in bounds + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpUGreaterThanEqual, + param_ids[kDescIndex], length_id); + const uint32_t desc_idx_range_id = inst->result_id(); + + const uint32_t error_label_id = TakeNextId(); + auto error_label = NewLabel(error_label_id); + const uint32_t merge_label_id = TakeNextId(); + auto merge_label = NewLabel(merge_label_id); + (void)builder.AddConditionalBranch(desc_idx_range_id, error_label_id, + merge_label_id, merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + // set error + new_blk_ptr = MakeUnique(std::move(error_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddStore(error_var, + builder.GetUintConstantId(kInstErrorBindlessBounds)); + builder.AddStore(param5_var, length_id); + builder.AddBranch(merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + new_blk_ptr = MakeUnique(std::move(merge_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddBranch(skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + } + + new_blk_ptr = MakeUnique(std::move(skip_label)); + builder.SetInsertPoint(&*new_blk_ptr); + inst = builder.AddLoad(GetUintId(), error_var); + error_val_id = inst->result_id(); + + check_label_id = TakeNextId(); + check_label = NewLabel(check_label_id); + skip_label_id = TakeNextId(); + skip_label = NewLabel(skip_label_id); + + inst = builder.AddLoad(GetUintId(), error_var); + error_val_id = inst->result_id(); + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpIEqual, zero_id, + error_val_id); + no_error_id = inst->result_id(); + + (void)builder.AddConditionalBranch(no_error_id, check_label_id, skip_label_id, + skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + // Read descriptor init status + new_blk_ptr = MakeUnique(std::move(check_label)); + builder.SetInsertPoint(&*new_blk_ptr); + { + inst = builder.AddLoad(desc_set_ptr_id_, desc_set_ptr_var); + const uint32_t desc_set_ptr_id = inst->result_id(); + + inst = builder.AddLoad(GetUintId(), num_bindings_var); + const uint32_t num_bindings_id = inst->result_id(); + + inst = + builder.AddIAdd(GetUintId(), num_bindings_id, param_ids[kDescBinding]); + const uint32_t state_offset_id = inst->result_id(); + + inst = builder.AddAccessChain( + uint_ptr, desc_set_ptr_id, + {{builder.GetUintConstantId(1), state_offset_id}}); + const uint32_t state_start_ac_id = inst->result_id(); + + inst = builder.AddLoad(GetUintId(), state_start_ac_id, sizeof(uint32_t)); + const uint32_t state_start_id = inst->result_id(); + + inst = builder.AddIAdd(GetUintId(), state_start_id, param_ids[kDescIndex]); + const uint32_t state_entry_id = inst->result_id(); + + // Note: length starts from the beginning of the buffer, not the beginning + // of the data array + inst = builder.AddAccessChain( + uint_ptr, desc_set_ptr_id, + {{builder.GetUintConstantId(1), state_entry_id}}); + const uint32_t init_ac_id = inst->result_id(); + + inst = builder.AddLoad(GetUintId(), init_ac_id, sizeof(uint32_t)); + const uint32_t init_status_id = inst->result_id(); + + builder.AddStore(init_status_var, init_status_id); + + // Check for uninitialized descriptor + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpIEqual, init_status_id, + zero_id); + const uint32_t uninit_check_id = inst->result_id(); + const uint32_t error_label_id = TakeNextId(); + auto error_label = NewLabel(error_label_id); + const uint32_t merge_label_id = TakeNextId(); + auto merge_label = NewLabel(merge_label_id); + (void)builder.AddConditionalBranch(uninit_check_id, error_label_id, + merge_label_id, merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + new_blk_ptr = MakeUnique(std::move(error_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddStore(error_var, + builder.GetUintConstantId(kInstErrorBindlessUninit)); + builder.AddBranch(merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + new_blk_ptr = MakeUnique(std::move(merge_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddBranch(skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + } + + // Check for OOB. + new_blk_ptr = MakeUnique(std::move(skip_label)); + builder.SetInsertPoint(&*new_blk_ptr); + + check_label_id = TakeNextId(); + check_label = NewLabel(check_label_id); + skip_label_id = TakeNextId(); + skip_label = NewLabel(skip_label_id); + + inst = builder.AddLoad(GetUintId(), error_var); + error_val_id = inst->result_id(); + + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpIEqual, error_val_id, + zero_id); + no_error_id = inst->result_id(); + (void)builder.AddConditionalBranch(no_error_id, check_label_id, skip_label_id, + skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + new_blk_ptr = MakeUnique(std::move(check_label)); + builder.SetInsertPoint(&*new_blk_ptr); + { + inst = builder.AddLoad(GetUintId(), init_status_var); + const uint32_t init_status_id = inst->result_id(); + + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpUGreaterThanEqual, + param_ids[kByteOffset], init_status_id); + const uint32_t buf_offset_range_id = inst->result_id(); + + const uint32_t error_label_id = TakeNextId(); + const uint32_t merge_label_id = TakeNextId(); + auto error_label = NewLabel(error_label_id); + auto merge_label = NewLabel(merge_label_id); + (void)builder.AddConditionalBranch(buf_offset_range_id, error_label_id, + merge_label_id, merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + // set error + new_blk_ptr = MakeUnique(std::move(error_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddStore(error_var, builder.GetUintConstantId(kInstErrorOOB)); + builder.AddStore(param5_var, param_ids[kByteOffset]); + builder.AddStore(param6_var, init_status_id); + builder.AddBranch(merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + new_blk_ptr = MakeUnique(std::move(merge_label)); + builder.SetInsertPoint(&*new_blk_ptr); + builder.AddBranch(skip_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); } + + // check for error + new_blk_ptr = MakeUnique(std::move(skip_label)); + builder.SetInsertPoint(&*new_blk_ptr); + inst = builder.AddLoad(GetUintId(), error_var); + error_val_id = inst->result_id(); + + inst = builder.AddBinaryOp(GetBoolId(), spv::Op::OpINotEqual, zero_id, + error_val_id); + const uint32_t is_error_id = inst->result_id(); + + const uint32_t error_label_id = TakeNextId(); + auto error_label = NewLabel(error_label_id); + const uint32_t merge_label_id = TakeNextId(); + auto merge_label = NewLabel(merge_label_id); + (void)builder.AddConditionalBranch(is_error_id, error_label_id, + merge_label_id, merge_label_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + new_blk_ptr = MakeUnique(std::move(error_label)); + builder.SetInsertPoint(&*new_blk_ptr); + + // error output + inst = builder.AddLoad(GetUintId(), param5_var); + const uint32_t param5_val_id = inst->result_id(); + + inst = builder.AddLoad(GetUintId(), param6_var); + const uint32_t param6_val_id = inst->result_id(); + + GenDebugStreamWrite( + param_ids[kShaderId], param_ids[kInstructionIndex], param_ids[kStageInfo], + {error_val_id, param_ids[kDescSet], param_ids[kDescBinding], + param_ids[kDescIndex], param5_val_id, param6_val_id}, + &builder); + (void)builder.AddUnaryOp(0, spv::Op::OpReturnValue, false_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + // Success return + new_blk_ptr = MakeUnique(std::move(merge_label)); + builder.SetInsertPoint(&*new_blk_ptr); + (void)builder.AddUnaryOp(0, spv::Op::OpReturnValue, true_id); + func->AddBasicBlock(std::move(new_blk_ptr)); + + func->SetFunctionEnd(EndFunction()); + + context()->AddFunction(std::move(func)); + context()->AddDebug2Inst(NewGlobalName(func_id, "desc_check")); + + desc_check_func_id_ = func_id; + // Make sure function doesn't get processed by + // InstrumentPass::InstProcessCallTreeFromRoots() + param2output_func_id_[3] = func_id; + return desc_check_func_id_; +} + +// clang-format off +// GLSL: +// result = inst_bindless_desc_check(shader_id, inst_idx, stage_info, desc_set, binding, desc_idx, offset); +// +// clang-format on +uint32_t InstBindlessCheckPass::GenDescCheckCall( + uint32_t inst_idx, uint32_t stage_idx, uint32_t var_id, + uint32_t desc_idx_id, uint32_t offset_id, InstructionBuilder* builder) { + const uint32_t func_id = GenDescCheckFunctionId(); + const std::vector args = { + builder->GetUintConstantId(shader_id_), + builder->GetUintConstantId(inst_idx), + GenStageInfo(stage_idx, builder), + builder->GetUintConstantId(var2desc_set_[var_id]), + builder->GetUintConstantId(var2binding_[var_id]), + GenUintCastCode(desc_idx_id, builder), + offset_id}; + return GenReadFunctionCall(GetBoolId(), func_id, args, builder); } uint32_t InstBindlessCheckPass::CloneOriginalImage( uint32_t old_image_id, InstructionBuilder* builder) { Instruction* new_image_inst; Instruction* old_image_inst = get_def_use_mgr()->GetDef(old_image_id); - if (old_image_inst->opcode() == SpvOpLoad) { + if (old_image_inst->opcode() == spv::Op::OpLoad) { new_image_inst = builder->AddLoad( old_image_inst->type_id(), old_image_inst->GetSingleWordInOperand(kSpvLoadPtrIdInIdx)); - } else if (old_image_inst->opcode() == SpvOp::SpvOpSampledImage) { + } else if (old_image_inst->opcode() == spv::Op::OpSampledImage) { uint32_t clone_id = CloneOriginalImage( old_image_inst->GetSingleWordInOperand(kSpvSampledImageImageIdInIdx), builder); new_image_inst = builder->AddBinaryOp( - old_image_inst->type_id(), SpvOpSampledImage, clone_id, + old_image_inst->type_id(), spv::Op::OpSampledImage, clone_id, old_image_inst->GetSingleWordInOperand(kSpvSampledImageSamplerIdInIdx)); - } else if (old_image_inst->opcode() == SpvOp::SpvOpImage) { + } else if (old_image_inst->opcode() == spv::Op::OpImage) { uint32_t clone_id = CloneOriginalImage( old_image_inst->GetSingleWordInOperand(kSpvImageSampledImageIdInIdx), builder); - new_image_inst = - builder->AddUnaryOp(old_image_inst->type_id(), SpvOpImage, clone_id); + new_image_inst = builder->AddUnaryOp(old_image_inst->type_id(), + spv::Op::OpImage, clone_id); } else { - assert(old_image_inst->opcode() == SpvOp::SpvOpCopyObject && + assert(old_image_inst->opcode() == spv::Op::OpCopyObject && "expecting OpCopyObject"); uint32_t clone_id = CloneOriginalImage( old_image_inst->GetSingleWordInOperand(kSpvCopyObjectOperandIdInIdx), @@ -143,38 +744,38 @@ uint32_t InstBindlessCheckPass::CloneOriginalReference( uint32_t InstBindlessCheckPass::GetImageId(Instruction* inst) { switch (inst->opcode()) { - case SpvOp::SpvOpImageSampleImplicitLod: - case SpvOp::SpvOpImageSampleExplicitLod: - case SpvOp::SpvOpImageSampleDrefImplicitLod: - case SpvOp::SpvOpImageSampleDrefExplicitLod: - case SpvOp::SpvOpImageSampleProjImplicitLod: - case SpvOp::SpvOpImageSampleProjExplicitLod: - case SpvOp::SpvOpImageSampleProjDrefImplicitLod: - case SpvOp::SpvOpImageSampleProjDrefExplicitLod: - case SpvOp::SpvOpImageGather: - case SpvOp::SpvOpImageDrefGather: - case SpvOp::SpvOpImageQueryLod: - case SpvOp::SpvOpImageSparseSampleImplicitLod: - case SpvOp::SpvOpImageSparseSampleExplicitLod: - case SpvOp::SpvOpImageSparseSampleDrefImplicitLod: - case SpvOp::SpvOpImageSparseSampleDrefExplicitLod: - case SpvOp::SpvOpImageSparseSampleProjImplicitLod: - case SpvOp::SpvOpImageSparseSampleProjExplicitLod: - case SpvOp::SpvOpImageSparseSampleProjDrefImplicitLod: - case SpvOp::SpvOpImageSparseSampleProjDrefExplicitLod: - case SpvOp::SpvOpImageSparseGather: - case SpvOp::SpvOpImageSparseDrefGather: - case SpvOp::SpvOpImageFetch: - case SpvOp::SpvOpImageRead: - case SpvOp::SpvOpImageQueryFormat: - case SpvOp::SpvOpImageQueryOrder: - case SpvOp::SpvOpImageQuerySizeLod: - case SpvOp::SpvOpImageQuerySize: - case SpvOp::SpvOpImageQueryLevels: - case SpvOp::SpvOpImageQuerySamples: - case SpvOp::SpvOpImageSparseFetch: - case SpvOp::SpvOpImageSparseRead: - case SpvOp::SpvOpImageWrite: + case spv::Op::OpImageSampleImplicitLod: + case spv::Op::OpImageSampleExplicitLod: + case spv::Op::OpImageSampleDrefImplicitLod: + case spv::Op::OpImageSampleDrefExplicitLod: + case spv::Op::OpImageSampleProjImplicitLod: + case spv::Op::OpImageSampleProjExplicitLod: + case spv::Op::OpImageSampleProjDrefImplicitLod: + case spv::Op::OpImageSampleProjDrefExplicitLod: + case spv::Op::OpImageGather: + case spv::Op::OpImageDrefGather: + case spv::Op::OpImageQueryLod: + case spv::Op::OpImageSparseSampleImplicitLod: + case spv::Op::OpImageSparseSampleExplicitLod: + case spv::Op::OpImageSparseSampleDrefImplicitLod: + case spv::Op::OpImageSparseSampleDrefExplicitLod: + case spv::Op::OpImageSparseSampleProjImplicitLod: + case spv::Op::OpImageSparseSampleProjExplicitLod: + case spv::Op::OpImageSparseSampleProjDrefImplicitLod: + case spv::Op::OpImageSparseSampleProjDrefExplicitLod: + case spv::Op::OpImageSparseGather: + case spv::Op::OpImageSparseDrefGather: + case spv::Op::OpImageFetch: + case spv::Op::OpImageRead: + case spv::Op::OpImageQueryFormat: + case spv::Op::OpImageQueryOrder: + case spv::Op::OpImageQuerySizeLod: + case spv::Op::OpImageQuerySize: + case spv::Op::OpImageQueryLevels: + case spv::Op::OpImageQuerySamples: + case spv::Op::OpImageSparseFetch: + case spv::Op::OpImageSparseRead: + case spv::Op::OpImageWrite: return inst->GetSingleWordInOperand(kSpvImageSampleImageIdInIdx); default: break; @@ -190,56 +791,58 @@ Instruction* InstBindlessCheckPass::GetPointeeTypeInst(Instruction* ptr_inst) { bool InstBindlessCheckPass::AnalyzeDescriptorReference(Instruction* ref_inst, RefAnalysis* ref) { ref->ref_inst = ref_inst; - if (ref_inst->opcode() == SpvOpLoad || ref_inst->opcode() == SpvOpStore) { + if (ref_inst->opcode() == spv::Op::OpLoad || + ref_inst->opcode() == spv::Op::OpStore) { ref->desc_load_id = 0; ref->ptr_id = ref_inst->GetSingleWordInOperand(kSpvLoadPtrIdInIdx); Instruction* ptr_inst = get_def_use_mgr()->GetDef(ref->ptr_id); - if (ptr_inst->opcode() != SpvOp::SpvOpAccessChain) return false; + if (ptr_inst->opcode() != spv::Op::OpAccessChain) return false; ref->var_id = ptr_inst->GetSingleWordInOperand(kSpvAccessChainBaseIdInIdx); Instruction* var_inst = get_def_use_mgr()->GetDef(ref->var_id); - if (var_inst->opcode() != SpvOp::SpvOpVariable) return false; - uint32_t storage_class = - var_inst->GetSingleWordInOperand(kSpvVariableStorageClassInIdx); + if (var_inst->opcode() != spv::Op::OpVariable) return false; + spv::StorageClass storage_class = spv::StorageClass( + var_inst->GetSingleWordInOperand(kSpvVariableStorageClassInIdx)); switch (storage_class) { - case SpvStorageClassUniform: - case SpvStorageClassStorageBuffer: + case spv::StorageClass::Uniform: + case spv::StorageClass::StorageBuffer: break; default: return false; break; } // Check for deprecated storage block form - if (storage_class == SpvStorageClassUniform) { + if (storage_class == spv::StorageClass::Uniform) { uint32_t var_ty_id = var_inst->type_id(); Instruction* var_ty_inst = get_def_use_mgr()->GetDef(var_ty_id); uint32_t ptr_ty_id = var_ty_inst->GetSingleWordInOperand(kSpvTypePtrTypeIdInIdx); Instruction* ptr_ty_inst = get_def_use_mgr()->GetDef(ptr_ty_id); - SpvOp ptr_ty_op = ptr_ty_inst->opcode(); + spv::Op ptr_ty_op = ptr_ty_inst->opcode(); uint32_t block_ty_id = - (ptr_ty_op == SpvOpTypeArray || ptr_ty_op == SpvOpTypeRuntimeArray) + (ptr_ty_op == spv::Op::OpTypeArray || + ptr_ty_op == spv::Op::OpTypeRuntimeArray) ? ptr_ty_inst->GetSingleWordInOperand(kSpvTypeArrayTypeIdInIdx) : ptr_ty_id; assert(get_def_use_mgr()->GetDef(block_ty_id)->opcode() == - SpvOpTypeStruct && + spv::Op::OpTypeStruct && "unexpected block type"); bool block_found = get_decoration_mgr()->FindDecoration( - block_ty_id, SpvDecorationBlock, + block_ty_id, uint32_t(spv::Decoration::Block), [](const Instruction&) { return true; }); if (!block_found) { // If block decoration not found, verify deprecated form of SSBO bool buffer_block_found = get_decoration_mgr()->FindDecoration( - block_ty_id, SpvDecorationBufferBlock, + block_ty_id, uint32_t(spv::Decoration::BufferBlock), [](const Instruction&) { return true; }); USE_ASSERT(buffer_block_found && "block decoration not found"); - storage_class = SpvStorageClassStorageBuffer; + storage_class = spv::StorageClass::StorageBuffer; } } - ref->strg_class = storage_class; + ref->strg_class = uint32_t(storage_class); Instruction* desc_type_inst = GetPointeeTypeInst(var_inst); switch (desc_type_inst->opcode()) { - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: // A load through a descriptor array will have at least 3 operands. We // do not want to instrument loads of descriptors here which are part of // an image-based reference. @@ -248,9 +851,18 @@ bool InstBindlessCheckPass::AnalyzeDescriptorReference(Instruction* ref_inst, ptr_inst->GetSingleWordInOperand(kSpvAccessChainIndex0IdInIdx); break; default: - ref->desc_idx_id = 0; break; } + auto decos = + context()->get_decoration_mgr()->GetDecorationsFor(ref->var_id, false); + for (const auto& deco : decos) { + spv::Decoration d = spv::Decoration(deco->GetSingleWordInOperand(1u)); + if (d == spv::Decoration::DescriptorSet) { + ref->set = deco->GetSingleWordInOperand(2u); + } else if (d == spv::Decoration::Binding) { + ref->binding = deco->GetSingleWordInOperand(2u); + } + } return true; } // Reference is not load or store. If not an image-based reference, return. @@ -261,29 +873,29 @@ bool InstBindlessCheckPass::AnalyzeDescriptorReference(Instruction* ref_inst, Instruction* desc_load_inst; for (;;) { desc_load_inst = get_def_use_mgr()->GetDef(desc_load_id); - if (desc_load_inst->opcode() == SpvOp::SpvOpSampledImage) + if (desc_load_inst->opcode() == spv::Op::OpSampledImage) desc_load_id = desc_load_inst->GetSingleWordInOperand(kSpvSampledImageImageIdInIdx); - else if (desc_load_inst->opcode() == SpvOp::SpvOpImage) + else if (desc_load_inst->opcode() == spv::Op::OpImage) desc_load_id = desc_load_inst->GetSingleWordInOperand(kSpvImageSampledImageIdInIdx); - else if (desc_load_inst->opcode() == SpvOp::SpvOpCopyObject) + else if (desc_load_inst->opcode() == spv::Op::OpCopyObject) desc_load_id = desc_load_inst->GetSingleWordInOperand(kSpvCopyObjectOperandIdInIdx); else break; } - if (desc_load_inst->opcode() != SpvOp::SpvOpLoad) { + if (desc_load_inst->opcode() != spv::Op::OpLoad) { // TODO(greg-lunarg): Handle additional possibilities? return false; } ref->desc_load_id = desc_load_id; ref->ptr_id = desc_load_inst->GetSingleWordInOperand(kSpvLoadPtrIdInIdx); Instruction* ptr_inst = get_def_use_mgr()->GetDef(ref->ptr_id); - if (ptr_inst->opcode() == SpvOp::SpvOpVariable) { + if (ptr_inst->opcode() == spv::Op::OpVariable) { ref->desc_idx_id = 0; ref->var_id = ref->ptr_id; - } else if (ptr_inst->opcode() == SpvOp::SpvOpAccessChain) { + } else if (ptr_inst->opcode() == spv::Op::OpAccessChain) { if (ptr_inst->NumInOperands() != 2) { assert(false && "unexpected bindless index number"); return false; @@ -292,7 +904,7 @@ bool InstBindlessCheckPass::AnalyzeDescriptorReference(Instruction* ref_inst, ptr_inst->GetSingleWordInOperand(kSpvAccessChainIndex0IdInIdx); ref->var_id = ptr_inst->GetSingleWordInOperand(kSpvAccessChainBaseIdInIdx); Instruction* var_inst = get_def_use_mgr()->GetDef(ref->var_id); - if (var_inst->opcode() != SpvOpVariable) { + if (var_inst->opcode() != spv::Op::OpVariable) { assert(false && "unexpected bindless base"); return false; } @@ -300,6 +912,16 @@ bool InstBindlessCheckPass::AnalyzeDescriptorReference(Instruction* ref_inst, // TODO(greg-lunarg): Handle additional possibilities? return false; } + auto decos = + context()->get_decoration_mgr()->GetDecorationsFor(ref->var_id, false); + for (const auto& deco : decos) { + spv::Decoration d = spv::Decoration(deco->GetSingleWordInOperand(1u)); + if (d == spv::Decoration::DescriptorSet) { + ref->set = deco->GetSingleWordInOperand(2u); + } else if (d == spv::Decoration::Binding) { + ref->binding = deco->GetSingleWordInOperand(2u); + } + } return true; } @@ -369,13 +991,13 @@ uint32_t InstBindlessCheckPass::GenLastByteIdx(RefAnalysis* ref, uint32_t buff_ty_id; uint32_t ac_in_idx = 1; switch (desc_ty_inst->opcode()) { - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: buff_ty_id = desc_ty_inst->GetSingleWordInOperand(0); ++ac_in_idx; break; default: - assert(desc_ty_inst->opcode() == SpvOpTypeStruct && + assert(desc_ty_inst->opcode() == spv::Op::OpTypeStruct && "unexpected descriptor type"); buff_ty_id = desc_ty_inst->result_id(); break; @@ -393,19 +1015,20 @@ uint32_t InstBindlessCheckPass::GenLastByteIdx(RefAnalysis* ref, Instruction* curr_ty_inst = get_def_use_mgr()->GetDef(curr_ty_id); uint32_t curr_offset_id = 0; switch (curr_ty_inst->opcode()) { - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: { + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: { // Get array stride and multiply by current index - uint32_t arr_stride = FindStride(curr_ty_id, SpvDecorationArrayStride); + uint32_t arr_stride = + FindStride(curr_ty_id, uint32_t(spv::Decoration::ArrayStride)); uint32_t arr_stride_id = builder->GetUintConstantId(arr_stride); uint32_t curr_idx_32b_id = Gen32BitCvtCode(curr_idx_id, builder); Instruction* curr_offset_inst = builder->AddBinaryOp( - GetUintId(), SpvOpIMul, arr_stride_id, curr_idx_32b_id); + GetUintId(), spv::Op::OpIMul, arr_stride_id, curr_idx_32b_id); curr_offset_id = curr_offset_inst->result_id(); // Get element type for next step curr_ty_id = curr_ty_inst->GetSingleWordInOperand(0); } break; - case SpvOpTypeMatrix: { + case spv::Op::OpTypeMatrix: { assert(matrix_stride != 0 && "missing matrix stride"); matrix_stride_id = builder->GetUintConstantId(matrix_stride); uint32_t vec_ty_id = curr_ty_inst->GetSingleWordInOperand(0); @@ -423,40 +1046,40 @@ uint32_t InstBindlessCheckPass::GenLastByteIdx(RefAnalysis* ref, } uint32_t curr_idx_32b_id = Gen32BitCvtCode(curr_idx_id, builder); Instruction* curr_offset_inst = builder->AddBinaryOp( - GetUintId(), SpvOpIMul, col_stride_id, curr_idx_32b_id); + GetUintId(), spv::Op::OpIMul, col_stride_id, curr_idx_32b_id); curr_offset_id = curr_offset_inst->result_id(); // Get element type for next step curr_ty_id = vec_ty_id; in_matrix = true; } break; - case SpvOpTypeVector: { + case spv::Op::OpTypeVector: { // If inside a row major matrix type, multiply index by matrix stride, // else multiply by component size uint32_t comp_ty_id = curr_ty_inst->GetSingleWordInOperand(0u); uint32_t curr_idx_32b_id = Gen32BitCvtCode(curr_idx_id, builder); if (in_matrix && !col_major) { Instruction* curr_offset_inst = builder->AddBinaryOp( - GetUintId(), SpvOpIMul, matrix_stride_id, curr_idx_32b_id); + GetUintId(), spv::Op::OpIMul, matrix_stride_id, curr_idx_32b_id); curr_offset_id = curr_offset_inst->result_id(); } else { uint32_t comp_ty_sz = ByteSize(comp_ty_id, 0u, false, false); uint32_t comp_ty_sz_id = builder->GetUintConstantId(comp_ty_sz); Instruction* curr_offset_inst = builder->AddBinaryOp( - GetUintId(), SpvOpIMul, comp_ty_sz_id, curr_idx_32b_id); + GetUintId(), spv::Op::OpIMul, comp_ty_sz_id, curr_idx_32b_id); curr_offset_id = curr_offset_inst->result_id(); } // Get element type for next step curr_ty_id = comp_ty_id; } break; - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { // Get buffer byte offset for the referenced member Instruction* curr_idx_inst = get_def_use_mgr()->GetDef(curr_idx_id); - assert(curr_idx_inst->opcode() == SpvOpConstant && + assert(curr_idx_inst->opcode() == spv::Op::OpConstant && "unexpected struct index"); uint32_t member_idx = curr_idx_inst->GetSingleWordInOperand(0); uint32_t member_offset = 0xdeadbeef; bool found = get_decoration_mgr()->FindDecoration( - curr_ty_id, SpvDecorationOffset, + curr_ty_id, uint32_t(spv::Decoration::Offset), [&member_idx, &member_offset](const Instruction& deco_inst) { if (deco_inst.GetSingleWordInOperand(1u) != member_idx) return false; @@ -470,7 +1093,7 @@ uint32_t InstBindlessCheckPass::GenLastByteIdx(RefAnalysis* ref, // enclosing struct type at the member index. If none found, reset // stride to 0. found = get_decoration_mgr()->FindDecoration( - curr_ty_id, SpvDecorationMatrixStride, + curr_ty_id, uint32_t(spv::Decoration::MatrixStride), [&member_idx, &matrix_stride](const Instruction& deco_inst) { if (deco_inst.GetSingleWordInOperand(1u) != member_idx) return false; @@ -480,7 +1103,7 @@ uint32_t InstBindlessCheckPass::GenLastByteIdx(RefAnalysis* ref, if (!found) matrix_stride = 0; // Look for column major decoration found = get_decoration_mgr()->FindDecoration( - curr_ty_id, SpvDecorationColMajor, + curr_ty_id, uint32_t(spv::Decoration::ColMajor), [&member_idx, &col_major](const Instruction& deco_inst) { if (deco_inst.GetSingleWordInOperand(1u) != member_idx) return false; @@ -497,7 +1120,7 @@ uint32_t InstBindlessCheckPass::GenLastByteIdx(RefAnalysis* ref, sum_id = curr_offset_id; else { Instruction* sum_inst = - builder->AddBinaryOp(GetUintId(), SpvOpIAdd, sum_id, curr_offset_id); + builder->AddIAdd(GetUintId(), sum_id, curr_offset_id); sum_id = sum_inst->result_id(); } ++ac_in_idx; @@ -506,8 +1129,7 @@ uint32_t InstBindlessCheckPass::GenLastByteIdx(RefAnalysis* ref, uint32_t bsize = ByteSize(curr_ty_id, matrix_stride, col_major, in_matrix); uint32_t last = bsize - 1; uint32_t last_id = builder->GetUintConstantId(last); - Instruction* sum_inst = - builder->AddBinaryOp(GetUintId(), SpvOpIAdd, sum_id, last_id); + Instruction* sum_inst = builder->AddIAdd(GetUintId(), sum_id, last_id); return sum_inst->result_id(); } @@ -527,44 +1149,63 @@ void InstBindlessCheckPass::GenCheckCode( std::unique_ptr merge_label(NewLabel(merge_blk_id)); std::unique_ptr valid_label(NewLabel(valid_blk_id)); std::unique_ptr invalid_label(NewLabel(invalid_blk_id)); - (void)builder.AddConditionalBranch(check_id, valid_blk_id, invalid_blk_id, - merge_blk_id, SpvSelectionControlMaskNone); + (void)builder.AddConditionalBranch( + check_id, valid_blk_id, invalid_blk_id, merge_blk_id, + uint32_t(spv::SelectionControlMask::MaskNone)); // Gen valid bounds branch std::unique_ptr new_blk_ptr( new BasicBlock(std::move(valid_label))); builder.SetInsertPoint(&*new_blk_ptr); uint32_t new_ref_id = CloneOriginalReference(ref, &builder); + uint32_t null_id = 0; + uint32_t ref_type_id = ref->ref_inst->type_id(); (void)builder.AddBranch(merge_blk_id); new_blocks->push_back(std::move(new_blk_ptr)); // Gen invalid block new_blk_ptr.reset(new BasicBlock(std::move(invalid_label))); builder.SetInsertPoint(&*new_blk_ptr); - uint32_t u_index_id = GenUintCastCode(ref->desc_idx_id, &builder); - if (offset_id != 0) { - // Buffer OOB - uint32_t u_offset_id = GenUintCastCode(offset_id, &builder); - uint32_t u_length_id = GenUintCastCode(length_id, &builder); - GenDebugStreamWrite(uid2offset_[ref->ref_inst->unique_id()], stage_idx, - {error_id, u_index_id, u_offset_id, u_length_id}, - &builder); - } else if (buffer_bounds_enabled_ || texel_buffer_enabled_) { - // Uninitialized Descriptor - Return additional unused zero so all error - // modes will use same debug stream write function - uint32_t u_length_id = GenUintCastCode(length_id, &builder); - GenDebugStreamWrite( - uid2offset_[ref->ref_inst->unique_id()], stage_idx, - {error_id, u_index_id, u_length_id, builder.GetUintConstantId(0)}, - &builder); - } else { - // Uninitialized Descriptor - Normal error return - uint32_t u_length_id = GenUintCastCode(length_id, &builder); - GenDebugStreamWrite(uid2offset_[ref->ref_inst->unique_id()], stage_idx, - {error_id, u_index_id, u_length_id}, &builder); + if (error_id != 0) { + const uint32_t u_shader_id = builder.GetUintConstantId(shader_id_); + const uint32_t u_inst_id = + builder.GetUintConstantId(ref->ref_inst->unique_id()); + const uint32_t shader_info_id = GenStageInfo(stage_idx, &builder); + const uint32_t u_set_id = builder.GetUintConstantId(ref->set); + const uint32_t u_binding_id = builder.GetUintConstantId(ref->binding); + const uint32_t u_index_id = GenUintCastCode(ref->desc_idx_id, &builder); + const uint32_t u_length_id = GenUintCastCode(length_id, &builder); + if (offset_id != 0) { + const uint32_t u_offset_id = GenUintCastCode(offset_id, &builder); + // Buffer OOB + GenDebugStreamWrite(u_shader_id, u_inst_id, shader_info_id, + {error_id, u_set_id, u_binding_id, u_index_id, + u_offset_id, u_length_id}, + &builder); + } else { + // Uninitialized Descriptor - Return additional unused zero so all error + // modes will use same debug stream write function + GenDebugStreamWrite(u_shader_id, u_inst_id, shader_info_id, + {error_id, u_set_id, u_binding_id, u_index_id, + u_length_id, builder.GetUintConstantId(0)}, + &builder); + } + } + // Generate a ConstantNull, converting to uint64 if the type cannot be a null. + if (new_ref_id != 0) { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::Type* ref_type = type_mgr->GetType(ref_type_id); + if (ref_type->AsPointer() != nullptr) { + context()->AddCapability(spv::Capability::Int64); + uint32_t null_u64_id = GetNullId(GetUint64Id()); + Instruction* null_ptr_inst = builder.AddUnaryOp( + ref_type_id, spv::Op::OpConvertUToPtr, null_u64_id); + null_id = null_ptr_inst->result_id(); + } else { + null_id = GetNullId(ref_type_id); + } } // Remember last invalid block id uint32_t last_invalid_blk_id = new_blk_ptr->GetLabelInst()->result_id(); // Gen zero for invalid reference - uint32_t ref_type_id = ref->ref_inst->type_id(); (void)builder.AddBranch(merge_blk_id); new_blocks->push_back(std::move(new_blk_ptr)); // Gen merge block @@ -575,8 +1216,7 @@ void InstBindlessCheckPass::GenCheckCode( // reference. if (new_ref_id != 0) { Instruction* phi_inst = builder.AddPhi( - ref_type_id, {new_ref_id, valid_blk_id, GetNullId(ref_type_id), - last_invalid_blk_id}); + ref_type_id, {new_ref_id, valid_blk_id, null_id, last_invalid_blk_id}); context()->ReplaceAllUsesWith(ref->ref_inst->result_id(), phi_inst->result_id()); } @@ -584,186 +1224,67 @@ void InstBindlessCheckPass::GenCheckCode( context()->KillInst(ref->ref_inst); } -void InstBindlessCheckPass::GenDescIdxCheckCode( +void InstBindlessCheckPass::GenDescCheckCode( BasicBlock::iterator ref_inst_itr, UptrVectorIterator ref_block_itr, uint32_t stage_idx, std::vector>* new_blocks) { - // Look for reference through indexed descriptor. If found, analyze and - // save components. If not, return. + // Look for reference through descriptor. If not, return. RefAnalysis ref; if (!AnalyzeDescriptorReference(&*ref_inst_itr, &ref)) return; - Instruction* ptr_inst = get_def_use_mgr()->GetDef(ref.ptr_id); - if (ptr_inst->opcode() != SpvOp::SpvOpAccessChain) return; - // If index and bound both compile-time constants and index < bound, - // return without changing - Instruction* var_inst = get_def_use_mgr()->GetDef(ref.var_id); - Instruction* desc_type_inst = GetPointeeTypeInst(var_inst); - uint32_t length_id = 0; - if (desc_type_inst->opcode() == SpvOpTypeArray) { - length_id = - desc_type_inst->GetSingleWordInOperand(kSpvTypeArrayLengthIdInIdx); - Instruction* index_inst = get_def_use_mgr()->GetDef(ref.desc_idx_id); - Instruction* length_inst = get_def_use_mgr()->GetDef(length_id); - if (index_inst->opcode() == SpvOpConstant && - length_inst->opcode() == SpvOpConstant && - index_inst->GetSingleWordInOperand(kSpvConstantValueInIdx) < - length_inst->GetSingleWordInOperand(kSpvConstantValueInIdx)) - return; - } else if (!desc_idx_enabled_ || - desc_type_inst->opcode() != SpvOpTypeRuntimeArray) { - return; - } - // Move original block's preceding instructions into first new block std::unique_ptr new_blk_ptr; + // Move original block's preceding instructions into first new block MovePreludeCode(ref_inst_itr, ref_block_itr, &new_blk_ptr); InstructionBuilder builder( context(), &*new_blk_ptr, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); new_blocks->push_back(std::move(new_blk_ptr)); - uint32_t error_id = builder.GetUintConstantId(kInstErrorBindlessBounds); - // If length id not yet set, descriptor array is runtime size so - // generate load of length from stage's debug input buffer. - if (length_id == 0) { - assert(desc_type_inst->opcode() == SpvOpTypeRuntimeArray && - "unexpected bindless type"); - length_id = GenDebugReadLength(ref.var_id, &builder); - } - // Generate full runtime bounds test code with true branch - // being full reference and false branch being debug output and zero - // for the referenced value. - uint32_t desc_idx_32b_id = Gen32BitCvtCode(ref.desc_idx_id, &builder); - uint32_t length_32b_id = Gen32BitCvtCode(length_id, &builder); - Instruction* ult_inst = builder.AddBinaryOp(GetBoolId(), SpvOpULessThan, - desc_idx_32b_id, length_32b_id); - ref.desc_idx_id = desc_idx_32b_id; - GenCheckCode(ult_inst->result_id(), error_id, 0u, length_id, stage_idx, &ref, - new_blocks); - // Move original block's remaining code into remainder/merge block and add - // to new blocks - BasicBlock* back_blk_ptr = &*new_blocks->back(); - MovePostludeCode(ref_block_itr, back_blk_ptr); -} - -void InstBindlessCheckPass::GenDescInitCheckCode( - BasicBlock::iterator ref_inst_itr, - UptrVectorIterator ref_block_itr, uint32_t stage_idx, - std::vector>* new_blocks) { - // Look for reference through descriptor. If not, return. - RefAnalysis ref; - if (!AnalyzeDescriptorReference(&*ref_inst_itr, &ref)) return; // Determine if we can only do initialization check - bool init_check = false; - if (ref.desc_load_id != 0 || !buffer_bounds_enabled_) { - init_check = true; + uint32_t ref_id = builder.GetUintConstantId(0u); + spv::Op op = ref.ref_inst->opcode(); + if (ref.desc_load_id != 0) { + uint32_t num_in_oprnds = ref.ref_inst->NumInOperands(); + if ((op == spv::Op::OpImageRead && num_in_oprnds == 2) || + (op == spv::Op::OpImageFetch && num_in_oprnds == 2) || + (op == spv::Op::OpImageWrite && num_in_oprnds == 3)) { + Instruction* image_inst = get_def_use_mgr()->GetDef(ref.image_id); + uint32_t image_ty_id = image_inst->type_id(); + Instruction* image_ty_inst = get_def_use_mgr()->GetDef(image_ty_id); + if (spv::Dim(image_ty_inst->GetSingleWordInOperand(kSpvTypeImageDim)) == + spv::Dim::Buffer) { + if ((image_ty_inst->GetSingleWordInOperand(kSpvTypeImageDepth) == 0) && + (image_ty_inst->GetSingleWordInOperand(kSpvTypeImageArrayed) == + 0) && + (image_ty_inst->GetSingleWordInOperand(kSpvTypeImageMS) == 0)) { + ref_id = GenUintCastCode(ref.ref_inst->GetSingleWordInOperand(1), + &builder); + } + } + } } else { // For now, only do bounds check for non-aggregate types. Otherwise // just do descriptor initialization check. // TODO(greg-lunarg): Do bounds check for aggregate loads and stores Instruction* ref_ptr_inst = get_def_use_mgr()->GetDef(ref.ptr_id); Instruction* pte_type_inst = GetPointeeTypeInst(ref_ptr_inst); - uint32_t pte_type_op = pte_type_inst->opcode(); - if (pte_type_op == SpvOpTypeArray || pte_type_op == SpvOpTypeRuntimeArray || - pte_type_op == SpvOpTypeStruct) - init_check = true; + spv::Op pte_type_op = pte_type_inst->opcode(); + if (pte_type_op != spv::Op::OpTypeArray && + pte_type_op != spv::Op::OpTypeRuntimeArray && + pte_type_op != spv::Op::OpTypeStruct) { + ref_id = GenLastByteIdx(&ref, &builder); + } } - // If initialization check and not enabled, return - if (init_check && !desc_init_enabled_) return; - // Move original block's preceding instructions into first new block - std::unique_ptr new_blk_ptr; - MovePreludeCode(ref_inst_itr, ref_block_itr, &new_blk_ptr); - InstructionBuilder builder( - context(), &*new_blk_ptr, - IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); - new_blocks->push_back(std::move(new_blk_ptr)); - // If initialization check, use reference value of zero. - // Else use the index of the last byte referenced. - uint32_t ref_id = init_check ? builder.GetUintConstantId(0u) - : GenLastByteIdx(&ref, &builder); // Read initialization/bounds from debug input buffer. If index id not yet // set, binding is single descriptor, so set index to constant 0. if (ref.desc_idx_id == 0) ref.desc_idx_id = builder.GetUintConstantId(0u); - uint32_t init_id = GenDebugReadInit(ref.var_id, ref.desc_idx_id, &builder); - // Generate runtime initialization/bounds test code with true branch - // being full reference and false branch being debug output and zero - // for the referenced value. - Instruction* ult_inst = - builder.AddBinaryOp(GetBoolId(), SpvOpULessThan, ref_id, init_id); - uint32_t error = init_check ? kInstErrorBindlessUninit - : (ref.strg_class == SpvStorageClassUniform - ? kInstErrorBuffOOBUniform - : kInstErrorBuffOOBStorage); - uint32_t error_id = builder.GetUintConstantId(error); - GenCheckCode(ult_inst->result_id(), error_id, init_check ? 0 : ref_id, - init_check ? builder.GetUintConstantId(0u) : init_id, stage_idx, - &ref, new_blocks); - // Move original block's remaining code into remainder/merge block and add - // to new blocks - BasicBlock* back_blk_ptr = &*new_blocks->back(); - MovePostludeCode(ref_block_itr, back_blk_ptr); -} + uint32_t check_id = + GenDescCheckCall(ref.ref_inst->unique_id(), stage_idx, ref.var_id, + ref.desc_idx_id, ref_id, &builder); -void InstBindlessCheckPass::GenTexBuffCheckCode( - BasicBlock::iterator ref_inst_itr, - UptrVectorIterator ref_block_itr, uint32_t stage_idx, - std::vector>* new_blocks) { - // Only process OpImageRead and OpImageWrite with no optional operands - Instruction* ref_inst = &*ref_inst_itr; - SpvOp op = ref_inst->opcode(); - uint32_t num_in_oprnds = ref_inst->NumInOperands(); - if (!((op == SpvOpImageRead && num_in_oprnds == 2) || - (op == SpvOpImageFetch && num_in_oprnds == 2) || - (op == SpvOpImageWrite && num_in_oprnds == 3))) - return; - // Pull components from descriptor reference - RefAnalysis ref; - if (!AnalyzeDescriptorReference(ref_inst, &ref)) return; - // Only process if image is texel buffer - Instruction* image_inst = get_def_use_mgr()->GetDef(ref.image_id); - uint32_t image_ty_id = image_inst->type_id(); - Instruction* image_ty_inst = get_def_use_mgr()->GetDef(image_ty_id); - if (image_ty_inst->GetSingleWordInOperand(kSpvTypeImageDim) != SpvDimBuffer) - return; - if (image_ty_inst->GetSingleWordInOperand(kSpvTypeImageDepth) != 0) return; - if (image_ty_inst->GetSingleWordInOperand(kSpvTypeImageArrayed) != 0) return; - if (image_ty_inst->GetSingleWordInOperand(kSpvTypeImageMS) != 0) return; - // Enable ImageQuery Capability if not yet enabled - if (!get_feature_mgr()->HasCapability(SpvCapabilityImageQuery)) { - std::unique_ptr cap_image_query_inst(new Instruction( - context(), SpvOpCapability, 0, 0, - std::initializer_list{ - {SPV_OPERAND_TYPE_CAPABILITY, {SpvCapabilityImageQuery}}})); - get_def_use_mgr()->AnalyzeInstDefUse(&*cap_image_query_inst); - context()->AddCapability(std::move(cap_image_query_inst)); - } - // Move original block's preceding instructions into first new block - std::unique_ptr new_blk_ptr; - MovePreludeCode(ref_inst_itr, ref_block_itr, &new_blk_ptr); - InstructionBuilder builder( - context(), &*new_blk_ptr, - IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); - new_blocks->push_back(std::move(new_blk_ptr)); - // Get texel coordinate - uint32_t coord_id = - GenUintCastCode(ref_inst->GetSingleWordInOperand(1), &builder); - // If index id not yet set, binding is single descriptor, so set index to - // constant 0. - if (ref.desc_idx_id == 0) ref.desc_idx_id = builder.GetUintConstantId(0u); - // Get texel buffer size. - Instruction* size_inst = - builder.AddUnaryOp(GetUintId(), SpvOpImageQuerySize, ref.image_id); - uint32_t size_id = size_inst->result_id(); // Generate runtime initialization/bounds test code with true branch - // being full reference and false branch being debug output and zero + // being full reference and false branch being zero // for the referenced value. - Instruction* ult_inst = - builder.AddBinaryOp(GetBoolId(), SpvOpULessThan, coord_id, size_id); - uint32_t error = - (image_ty_inst->GetSingleWordInOperand(kSpvTypeImageSampled) == 2) - ? kInstErrorBuffOOBStorageTexel - : kInstErrorBuffOOBUniformTexel; - uint32_t error_id = builder.GetUintConstantId(error); - GenCheckCode(ult_inst->result_id(), error_id, coord_id, size_id, stage_idx, - &ref, new_blocks); + GenCheckCode(check_id, 0, 0, 0, stage_idx, &ref, new_blocks); + // Move original block's remaining code into remainder/merge block and add // to new blocks BasicBlock* back_blk_ptr = &*new_blocks->back(); @@ -773,55 +1294,32 @@ void InstBindlessCheckPass::GenTexBuffCheckCode( void InstBindlessCheckPass::InitializeInstBindlessCheck() { // Initialize base class InitializeInstrument(); - // If runtime array length support or buffer bounds checking are enabled, - // create variable mappings. Length support is always enabled if descriptor - // init check is enabled. - if (desc_idx_enabled_ || buffer_bounds_enabled_ || texel_buffer_enabled_) - for (auto& anno : get_module()->annotations()) - if (anno.opcode() == SpvOpDecorate) { - if (anno.GetSingleWordInOperand(1u) == SpvDecorationDescriptorSet) - var2desc_set_[anno.GetSingleWordInOperand(0u)] = - anno.GetSingleWordInOperand(2u); - else if (anno.GetSingleWordInOperand(1u) == SpvDecorationBinding) - var2binding_[anno.GetSingleWordInOperand(0u)] = - anno.GetSingleWordInOperand(2u); + for (auto& anno : get_module()->annotations()) { + if (anno.opcode() == spv::Op::OpDecorate) { + if (spv::Decoration(anno.GetSingleWordInOperand(1u)) == + spv::Decoration::DescriptorSet) { + var2desc_set_[anno.GetSingleWordInOperand(0u)] = + anno.GetSingleWordInOperand(2u); + } else if (spv::Decoration(anno.GetSingleWordInOperand(1u)) == + spv::Decoration::Binding) { + var2binding_[anno.GetSingleWordInOperand(0u)] = + anno.GetSingleWordInOperand(2u); } + } + } } Pass::Status InstBindlessCheckPass::ProcessImpl() { - // Perform bindless bounds check on each entry point function in module + bool modified = false; InstProcessFunction pfn = [this](BasicBlock::iterator ref_inst_itr, UptrVectorIterator ref_block_itr, uint32_t stage_idx, std::vector>* new_blocks) { - return GenDescIdxCheckCode(ref_inst_itr, ref_block_itr, stage_idx, - new_blocks); + return GenDescCheckCode(ref_inst_itr, ref_block_itr, stage_idx, + new_blocks); }; - bool modified = InstProcessEntryPointCallTree(pfn); - if (desc_init_enabled_ || buffer_bounds_enabled_) { - // Perform descriptor initialization and/or buffer bounds check on each - // entry point function in module - pfn = [this](BasicBlock::iterator ref_inst_itr, - UptrVectorIterator ref_block_itr, - uint32_t stage_idx, - std::vector>* new_blocks) { - return GenDescInitCheckCode(ref_inst_itr, ref_block_itr, stage_idx, - new_blocks); - }; - modified |= InstProcessEntryPointCallTree(pfn); - } - if (texel_buffer_enabled_) { - // Perform texel buffer bounds check on each entry point function in - // module. Generate after descriptor bounds and initialization checks. - pfn = [this](BasicBlock::iterator ref_inst_itr, - UptrVectorIterator ref_block_itr, - uint32_t stage_idx, - std::vector>* new_blocks) { - return GenTexBuffCheckCode(ref_inst_itr, ref_block_itr, stage_idx, - new_blocks); - }; - modified |= InstProcessEntryPointCallTree(pfn); - } + + modified = InstProcessEntryPointCallTree(pfn); return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/inst_bindless_check_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/inst_bindless_check_pass.h index e6e6ef4f..289f02f1 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/inst_bindless_check_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/inst_bindless_check_pass.h @@ -28,16 +28,8 @@ namespace opt { // external design may change as the layer evolves. class InstBindlessCheckPass : public InstrumentPass { public: - InstBindlessCheckPass(uint32_t desc_set, uint32_t shader_id, - bool desc_idx_enable, bool desc_init_enable, - bool buffer_bounds_enable, bool texel_buffer_enable, - bool opt_direct_reads) - : InstrumentPass(desc_set, shader_id, kInstValidationIdBindless, - opt_direct_reads), - desc_idx_enabled_(desc_idx_enable), - desc_init_enabled_(desc_init_enable), - buffer_bounds_enabled_(buffer_bounds_enable), - texel_buffer_enabled_(texel_buffer_enable) {} + InstBindlessCheckPass(uint32_t desc_set, uint32_t shader_id) + : InstrumentPass(desc_set, shader_id, kInstValidationIdBindless, true) {} ~InstBindlessCheckPass() override = default; @@ -47,91 +39,33 @@ class InstBindlessCheckPass : public InstrumentPass { const char* name() const override { return "inst-bindless-check-pass"; } private: - // These functions do bindless checking instrumentation on a single - // instruction which references through a descriptor (ie references into an - // image or buffer). Refer to Vulkan API for further information on - // descriptors. GenDescIdxCheckCode checks that an index into a descriptor - // array (array of images or buffers) is in-bounds. GenDescInitCheckCode - // checks that the referenced descriptor has been initialized, if the - // SPV_EXT_descriptor_indexing extension is enabled, and initialized large - // enough to handle the reference, if RobustBufferAccess is disabled. - // GenDescInitCheckCode checks for uniform and storage buffer overrun. - // GenTexBuffCheckCode checks for texel buffer overrun and should be - // run after GenDescInitCheckCode to first make sure that the descriptor - // is initialized because it uses OpImageQuerySize on the descriptor. - // - // The functions are designed to be passed to - // InstrumentPass::InstProcessEntryPointCallTree(), which applies the - // function to each instruction in a module and replaces the instruction - // if warranted. - // - // If |ref_inst_itr| is a bindless reference, return in |new_blocks| the - // result of instrumenting it with validation code within its block at - // |ref_block_itr|. The validation code first executes a check for the - // specific condition called for. If the check passes, it executes - // the remainder of the reference, otherwise writes a record to the debug - // output buffer stream including |function_idx, instruction_idx, stage_idx| - // and replaces the reference with the null value of the original type. The - // block at |ref_block_itr| can just be replaced with the blocks in - // |new_blocks|, which will contain at least two blocks. The last block will - // comprise all instructions following |ref_inst_itr|, - // preceded by a phi instruction. - // - // These instrumentation functions utilize GenDebugDirectRead() to read data - // from the debug input buffer, specifically the lengths of variable length - // descriptor arrays, and the initialization status of each descriptor. - // The format of the debug input buffer is documented in instrument.hpp. - // - // These instrumentation functions utilize GenDebugStreamWrite() to write its - // error records. The validation-specific part of the error record will - // have the format: - // - // Validation Error Code (=kInstErrorBindlessBounds) - // Descriptor Index - // Descriptor Array Size - // - // The Descriptor Index is the index which has been determined to be - // out-of-bounds. - // - // The Descriptor Array Size is the size of the descriptor array which was - // indexed. - void GenDescIdxCheckCode( - BasicBlock::iterator ref_inst_itr, - UptrVectorIterator ref_block_itr, uint32_t stage_idx, - std::vector>* new_blocks); - - void GenDescInitCheckCode( - BasicBlock::iterator ref_inst_itr, - UptrVectorIterator ref_block_itr, uint32_t stage_idx, - std::vector>* new_blocks); - - void GenTexBuffCheckCode( - BasicBlock::iterator ref_inst_itr, - UptrVectorIterator ref_block_itr, uint32_t stage_idx, - std::vector>* new_blocks); - - // Generate instructions into |builder| to read length of runtime descriptor - // array |var_id| from debug input buffer and return id of value. - uint32_t GenDebugReadLength(uint32_t var_id, InstructionBuilder* builder); - - // Generate instructions into |builder| to read initialization status of - // descriptor array |image_id| at |index_id| from debug input buffer and - // return id of value. - uint32_t GenDebugReadInit(uint32_t image_id, uint32_t index_id, - InstructionBuilder* builder); + void GenDescCheckCode(BasicBlock::iterator ref_inst_itr, + UptrVectorIterator ref_block_itr, + uint32_t stage_idx, + std::vector>* new_blocks); + + void SetupInputBufferIds(); + + uint32_t GenDescCheckFunctionId(); + + uint32_t GenDescCheckCall(uint32_t inst_idx, uint32_t stage_idx, + uint32_t var_id, uint32_t index_id, + uint32_t byte_offset, InstructionBuilder* builder); // Analysis data for descriptor reference components, generated by // AnalyzeDescriptorReference. It is necessary and sufficient for further // analysis and regeneration of the reference. typedef struct RefAnalysis { - uint32_t desc_load_id; - uint32_t image_id; - uint32_t load_id; - uint32_t ptr_id; - uint32_t var_id; - uint32_t desc_idx_id; - uint32_t strg_class; - Instruction* ref_inst; + uint32_t desc_load_id{0}; + uint32_t image_id{0}; + uint32_t load_id{0}; + uint32_t ptr_id{0}; + uint32_t var_id{0}; + uint32_t set{0}; + uint32_t binding{0}; + uint32_t desc_idx_id{0}; + uint32_t strg_class{0}; + Instruction* ref_inst{nullptr}; } RefAnalysis; // Return size of type |ty_id| in bytes. Use |matrix_stride| and |col_major| @@ -184,23 +118,17 @@ class InstBindlessCheckPass : public InstrumentPass { // GenDescInitCheckCode to every instruction in module. Pass::Status ProcessImpl(); - // Enable instrumentation of runtime array length checking - bool desc_idx_enabled_; - - // Enable instrumentation of descriptor initialization checking - bool desc_init_enabled_; - - // Enable instrumentation of uniform and storage buffer overrun checking - bool buffer_bounds_enabled_; - - // Enable instrumentation of texel buffer overrun checking - bool texel_buffer_enabled_; - // Mapping from variable to descriptor set std::unordered_map var2desc_set_; // Mapping from variable to binding std::unordered_map var2binding_; + + uint32_t desc_check_func_id_{0}; + uint32_t desc_set_type_id_{0}; + uint32_t desc_set_ptr_id_{0}; + uint32_t input_buffer_struct_id_{0}; + uint32_t input_buffer_ptr_id_{0}; }; } // namespace opt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/inst_buff_addr_check_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/inst_buff_addr_check_pass.cpp index 3318f88f..6b90e588 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/inst_buff_addr_check_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/inst_buff_addr_check_pass.cpp @@ -19,12 +19,30 @@ namespace spvtools { namespace opt { +bool InstBuffAddrCheckPass::InstrumentFunction(Function* func, + uint32_t stage_idx, + InstProcessFunction& pfn) { + // The bindless instrumentation pass adds functions that use + // BufferDeviceAddress They should not be instrumented by this pass. + Instruction* func_name_inst = + context()->GetNames(func->DefInst().result_id()).begin()->second; + if (func_name_inst) { + static const std::string kPrefix{"inst_bindless_"}; + std::string func_name = func_name_inst->GetOperand(1).AsString(); + if (func_name.size() >= kPrefix.size() && + func_name.compare(0, kPrefix.size(), kPrefix) == 0) { + return false; + } + } + return InstrumentPass::InstrumentFunction(func, stage_idx, pfn); +} + uint32_t InstBuffAddrCheckPass::CloneOriginalReference( Instruction* ref_inst, InstructionBuilder* builder) { // Clone original ref with new result id (if load) - assert( - (ref_inst->opcode() == SpvOpLoad || ref_inst->opcode() == SpvOpStore) && - "unexpected ref"); + assert((ref_inst->opcode() == spv::Op::OpLoad || + ref_inst->opcode() == spv::Op::OpStore) && + "unexpected ref"); std::unique_ptr new_ref_inst(ref_inst->Clone(context())); uint32_t ref_result_id = ref_inst->result_id(); uint32_t new_ref_id = 0; @@ -41,16 +59,17 @@ uint32_t InstBuffAddrCheckPass::CloneOriginalReference( } bool InstBuffAddrCheckPass::IsPhysicalBuffAddrReference(Instruction* ref_inst) { - if (ref_inst->opcode() != SpvOpLoad && ref_inst->opcode() != SpvOpStore) + if (ref_inst->opcode() != spv::Op::OpLoad && + ref_inst->opcode() != spv::Op::OpStore) return false; uint32_t ptr_id = ref_inst->GetSingleWordInOperand(0); analysis::DefUseManager* du_mgr = get_def_use_mgr(); Instruction* ptr_inst = du_mgr->GetDef(ptr_id); - if (ptr_inst->opcode() != SpvOpAccessChain) return false; + if (ptr_inst->opcode() != spv::Op::OpAccessChain) return false; uint32_t ptr_ty_id = ptr_inst->type_id(); Instruction* ptr_ty_inst = du_mgr->GetDef(ptr_ty_id); - if (ptr_ty_inst->GetSingleWordInOperand(0) != - SpvStorageClassPhysicalStorageBufferEXT) + if (spv::StorageClass(ptr_ty_inst->GetSingleWordInOperand(0)) != + spv::StorageClass::PhysicalStorageBufferEXT) return false; return true; } @@ -72,8 +91,9 @@ void InstBuffAddrCheckPass::GenCheckCode( std::unique_ptr merge_label(NewLabel(merge_blk_id)); std::unique_ptr valid_label(NewLabel(valid_blk_id)); std::unique_ptr invalid_label(NewLabel(invalid_blk_id)); - (void)builder.AddConditionalBranch(check_id, valid_blk_id, invalid_blk_id, - merge_blk_id, SpvSelectionControlMaskNone); + (void)builder.AddConditionalBranch( + check_id, valid_blk_id, invalid_blk_id, merge_blk_id, + uint32_t(spv::SelectionControlMask::MaskNone)); // Gen valid branch std::unique_ptr new_blk_ptr( new BasicBlock(std::move(valid_label))); @@ -86,14 +106,16 @@ void InstBuffAddrCheckPass::GenCheckCode( builder.SetInsertPoint(&*new_blk_ptr); // Convert uptr from uint64 to 2 uint32 Instruction* lo_uptr_inst = - builder.AddUnaryOp(GetUintId(), SpvOpUConvert, ref_uptr_id); + builder.AddUnaryOp(GetUintId(), spv::Op::OpUConvert, ref_uptr_id); Instruction* rshift_uptr_inst = - builder.AddBinaryOp(GetUint64Id(), SpvOpShiftRightLogical, ref_uptr_id, - builder.GetUintConstantId(32)); - Instruction* hi_uptr_inst = builder.AddUnaryOp(GetUintId(), SpvOpUConvert, - rshift_uptr_inst->result_id()); + builder.AddBinaryOp(GetUint64Id(), spv::Op::OpShiftRightLogical, + ref_uptr_id, builder.GetUintConstantId(32)); + Instruction* hi_uptr_inst = builder.AddUnaryOp( + GetUintId(), spv::Op::OpUConvert, rshift_uptr_inst->result_id()); GenDebugStreamWrite( - uid2offset_[ref_inst->unique_id()], stage_idx, + builder.GetUintConstantId(shader_id_), + builder.GetUintConstantId(uid2offset_[ref_inst->unique_id()]), + GenStageInfo(stage_idx, &builder), {error_id, lo_uptr_inst->result_id(), hi_uptr_inst->result_id()}, &builder); // Gen zero for invalid load. If pointer type, need to convert uint64 @@ -105,8 +127,8 @@ void InstBuffAddrCheckPass::GenCheckCode( analysis::Type* ref_type = type_mgr->GetType(ref_type_id); if (ref_type->AsPointer() != nullptr) { uint32_t null_u64_id = GetNullId(GetUint64Id()); - Instruction* null_ptr_inst = - builder.AddUnaryOp(ref_type_id, SpvOpConvertUToPtr, null_u64_id); + Instruction* null_ptr_inst = builder.AddUnaryOp( + ref_type_id, spv::Op::OpConvertUToPtr, null_u64_id); null_id = null_ptr_inst->result_id(); } else { null_id = GetNullId(ref_type_id); @@ -130,77 +152,43 @@ void InstBuffAddrCheckPass::GenCheckCode( context()->KillInst(ref_inst); } -uint32_t InstBuffAddrCheckPass::GetTypeAlignment(uint32_t type_id) { - Instruction* type_inst = get_def_use_mgr()->GetDef(type_id); - switch (type_inst->opcode()) { - case SpvOpTypeFloat: - case SpvOpTypeInt: - case SpvOpTypeVector: - return GetTypeLength(type_id); - case SpvOpTypeMatrix: - return GetTypeAlignment(type_inst->GetSingleWordInOperand(0)); - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: - return GetTypeAlignment(type_inst->GetSingleWordInOperand(0)); - case SpvOpTypeStruct: { - uint32_t max = 0; - type_inst->ForEachInId([&max, this](const uint32_t* iid) { - uint32_t alignment = GetTypeAlignment(*iid); - max = (alignment > max) ? alignment : max; - }); - return max; - } - case SpvOpTypePointer: - assert(type_inst->GetSingleWordInOperand(0) == - SpvStorageClassPhysicalStorageBufferEXT && - "unexpected pointer type"); - return 8u; - default: - assert(false && "unexpected type"); - return 0; - } -} - uint32_t InstBuffAddrCheckPass::GetTypeLength(uint32_t type_id) { Instruction* type_inst = get_def_use_mgr()->GetDef(type_id); switch (type_inst->opcode()) { - case SpvOpTypeFloat: - case SpvOpTypeInt: + case spv::Op::OpTypeFloat: + case spv::Op::OpTypeInt: return type_inst->GetSingleWordInOperand(0) / 8u; - case SpvOpTypeVector: { - uint32_t raw_cnt = type_inst->GetSingleWordInOperand(1); - uint32_t adj_cnt = (raw_cnt == 3u) ? 4u : raw_cnt; - return adj_cnt * GetTypeLength(type_inst->GetSingleWordInOperand(0)); - } - case SpvOpTypeMatrix: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: return type_inst->GetSingleWordInOperand(1) * GetTypeLength(type_inst->GetSingleWordInOperand(0)); - case SpvOpTypePointer: - assert(type_inst->GetSingleWordInOperand(0) == - SpvStorageClassPhysicalStorageBufferEXT && + case spv::Op::OpTypePointer: + assert(spv::StorageClass(type_inst->GetSingleWordInOperand(0)) == + spv::StorageClass::PhysicalStorageBufferEXT && "unexpected pointer type"); return 8u; - case SpvOpTypeArray: { + case spv::Op::OpTypeArray: { uint32_t const_id = type_inst->GetSingleWordInOperand(1); Instruction* const_inst = get_def_use_mgr()->GetDef(const_id); uint32_t cnt = const_inst->GetSingleWordInOperand(0); return cnt * GetTypeLength(type_inst->GetSingleWordInOperand(0)); } - case SpvOpTypeStruct: { - uint32_t len = 0; - type_inst->ForEachInId([&len, this](const uint32_t* iid) { - // Align struct length - uint32_t alignment = GetTypeAlignment(*iid); - uint32_t mod = len % alignment; - uint32_t diff = (mod != 0) ? alignment - mod : 0; - len += diff; - // Increment struct length by component length - uint32_t comp_len = GetTypeLength(*iid); - len += comp_len; + case spv::Op::OpTypeStruct: { + // Figure out the location of the last byte of the last member of the + // structure. + uint32_t last_offset = 0, last_len = 0; + + get_decoration_mgr()->ForEachDecoration( + type_id, uint32_t(spv::Decoration::Offset), + [&last_offset](const Instruction& deco_inst) { + last_offset = deco_inst.GetSingleWordInOperand(3); + }); + type_inst->ForEachInId([&last_len, this](const uint32_t* iid) { + last_len = GetTypeLength(*iid); }); - return len; + return last_offset + last_len; } - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeRuntimeArray: default: assert(false && "unexpected type"); return 0; @@ -213,7 +201,7 @@ void InstBuffAddrCheckPass::AddParam(uint32_t type_id, uint32_t pid = TakeNextId(); param_vec->push_back(pid); std::unique_ptr param_inst(new Instruction( - get_module()->context(), SpvOpFunctionParameter, type_id, pid, {})); + get_module()->context(), spv::Op::OpFunctionParameter, type_id, pid, {})); get_def_use_mgr()->AnalyzeInstDefUse(&*param_inst); (*input_func)->AddParameter(std::move(param_inst)); } @@ -231,10 +219,10 @@ uint32_t InstBuffAddrCheckPass::GetSearchAndTestFuncId() { analysis::Function func_ty(type_mgr->GetType(GetBoolId()), param_types); analysis::Type* reg_func_ty = type_mgr->GetRegisteredType(&func_ty); std::unique_ptr func_inst( - new Instruction(get_module()->context(), SpvOpFunction, GetBoolId(), - search_test_func_id_, + new Instruction(get_module()->context(), spv::Op::OpFunction, + GetBoolId(), search_test_func_id_, {{spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, - {SpvFunctionControlMaskNone}}, + {uint32_t(spv::FunctionControlMask::MaskNone)}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {type_mgr->GetTypeInstruction(reg_func_ty)}}})); get_def_use_mgr()->AnalyzeInstDefUse(&*func_inst); @@ -255,9 +243,7 @@ uint32_t InstBuffAddrCheckPass::GetSearchAndTestFuncId() { uint32_t hdr_blk_id = TakeNextId(); // Branch to search loop header std::unique_ptr hdr_blk_label(NewLabel(hdr_blk_id)); - (void)builder.AddInstruction(MakeUnique( - context(), SpvOpBranch, 0, 0, - std::initializer_list{{SPV_OPERAND_TYPE_ID, {hdr_blk_id}}})); + (void)builder.AddBranch(hdr_blk_id); input_func->AddBasicBlock(std::move(first_blk_ptr)); // Linear search loop header block // TODO(greg-lunarg): Implement binary search @@ -273,12 +259,12 @@ uint32_t InstBuffAddrCheckPass::GetSearchAndTestFuncId() { uint32_t idx_phi_id = TakeNextId(); uint32_t idx_inc_id = TakeNextId(); std::unique_ptr idx_inc_inst(new Instruction( - context(), SpvOpIAdd, GetUintId(), idx_inc_id, + context(), spv::Op::OpIAdd, GetUintId(), idx_inc_id, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {idx_phi_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {builder.GetUintConstantId(1u)}}})); std::unique_ptr idx_phi_inst(new Instruction( - context(), SpvOpPhi, GetUintId(), idx_phi_id, + context(), spv::Op::OpPhi, GetUintId(), idx_phi_id, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {builder.GetUintConstantId(1u)}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {first_blk_id}}, @@ -291,16 +277,10 @@ uint32_t InstBuffAddrCheckPass::GetSearchAndTestFuncId() { uint32_t bound_test_blk_id = TakeNextId(); std::unique_ptr bound_test_blk_label( NewLabel(bound_test_blk_id)); - (void)builder.AddInstruction(MakeUnique( - context(), SpvOpLoopMerge, 0, 0, - std::initializer_list{ - {SPV_OPERAND_TYPE_ID, {bound_test_blk_id}}, - {SPV_OPERAND_TYPE_ID, {cont_blk_id}}, - {SPV_OPERAND_TYPE_LITERAL_INTEGER, {SpvLoopControlMaskNone}}})); + (void)builder.AddLoopMerge(bound_test_blk_id, cont_blk_id, + uint32_t(spv::LoopControlMask::MaskNone)); // Branch to continue/work block - (void)builder.AddInstruction(MakeUnique( - context(), SpvOpBranch, 0, 0, - std::initializer_list{{SPV_OPERAND_TYPE_ID, {cont_blk_id}}})); + (void)builder.AddBranch(cont_blk_id); input_func->AddBasicBlock(std::move(hdr_blk_ptr)); // Continue/Work Block. Read next buffer pointer and break if greater // than ref_ptr arg. @@ -313,19 +293,19 @@ uint32_t InstBuffAddrCheckPass::GetSearchAndTestFuncId() { uint32_t ibuf_id = GetInputBufferId(); uint32_t ibuf_ptr_id = GetInputBufferPtrId(); Instruction* uptr_ac_inst = builder.AddTernaryOp( - ibuf_ptr_id, SpvOpAccessChain, ibuf_id, + ibuf_ptr_id, spv::Op::OpAccessChain, ibuf_id, builder.GetUintConstantId(kDebugInputDataOffset), idx_inc_id); uint32_t ibuf_type_id = GetInputBufferTypeId(); - Instruction* uptr_load_inst = - builder.AddUnaryOp(ibuf_type_id, SpvOpLoad, uptr_ac_inst->result_id()); + Instruction* uptr_load_inst = builder.AddUnaryOp( + ibuf_type_id, spv::Op::OpLoad, uptr_ac_inst->result_id()); // If loaded address greater than ref_ptr arg, break, else branch back to // loop header Instruction* uptr_test_inst = - builder.AddBinaryOp(GetBoolId(), SpvOpUGreaterThan, + builder.AddBinaryOp(GetBoolId(), spv::Op::OpUGreaterThan, uptr_load_inst->result_id(), param_vec[0]); - (void)builder.AddConditionalBranch(uptr_test_inst->result_id(), - bound_test_blk_id, hdr_blk_id, - kInvalidId, SpvSelectionControlMaskNone); + (void)builder.AddConditionalBranch( + uptr_test_inst->result_id(), bound_test_blk_id, hdr_blk_id, kInvalidId, + uint32_t(spv::SelectionControlMask::MaskNone)); input_func->AddBasicBlock(std::move(cont_blk_ptr)); // Bounds test block. Read length of selected buffer and test that // all len arg bytes are in buffer. @@ -333,63 +313,63 @@ uint32_t InstBuffAddrCheckPass::GetSearchAndTestFuncId() { MakeUnique(std::move(bound_test_blk_label)); builder.SetInsertPoint(&*bound_test_blk_ptr); // Decrement index to point to previous/candidate buffer address - Instruction* cand_idx_inst = builder.AddBinaryOp( - GetUintId(), SpvOpISub, idx_inc_id, builder.GetUintConstantId(1u)); + Instruction* cand_idx_inst = + builder.AddBinaryOp(GetUintId(), spv::Op::OpISub, idx_inc_id, + builder.GetUintConstantId(1u)); // Load candidate buffer address Instruction* cand_ac_inst = - builder.AddTernaryOp(ibuf_ptr_id, SpvOpAccessChain, ibuf_id, + builder.AddTernaryOp(ibuf_ptr_id, spv::Op::OpAccessChain, ibuf_id, builder.GetUintConstantId(kDebugInputDataOffset), cand_idx_inst->result_id()); - Instruction* cand_load_inst = - builder.AddUnaryOp(ibuf_type_id, SpvOpLoad, cand_ac_inst->result_id()); + Instruction* cand_load_inst = builder.AddUnaryOp( + ibuf_type_id, spv::Op::OpLoad, cand_ac_inst->result_id()); // Compute offset of ref_ptr from candidate buffer address - Instruction* offset_inst = builder.AddBinaryOp( - ibuf_type_id, SpvOpISub, param_vec[0], cand_load_inst->result_id()); + Instruction* offset_inst = + builder.AddBinaryOp(ibuf_type_id, spv::Op::OpISub, param_vec[0], + cand_load_inst->result_id()); // Convert ref length to uint64 Instruction* ref_len_64_inst = - builder.AddUnaryOp(ibuf_type_id, SpvOpUConvert, param_vec[1]); + builder.AddUnaryOp(ibuf_type_id, spv::Op::OpUConvert, param_vec[1]); // Add ref length to ref offset to compute end of reference - Instruction* ref_end_inst = - builder.AddBinaryOp(ibuf_type_id, SpvOpIAdd, offset_inst->result_id(), - ref_len_64_inst->result_id()); + Instruction* ref_end_inst = builder.AddBinaryOp( + ibuf_type_id, spv::Op::OpIAdd, offset_inst->result_id(), + ref_len_64_inst->result_id()); // Load starting index of lengths in input buffer and convert to uint32 Instruction* len_start_ac_inst = - builder.AddTernaryOp(ibuf_ptr_id, SpvOpAccessChain, ibuf_id, + builder.AddTernaryOp(ibuf_ptr_id, spv::Op::OpAccessChain, ibuf_id, builder.GetUintConstantId(kDebugInputDataOffset), builder.GetUintConstantId(0u)); Instruction* len_start_load_inst = builder.AddUnaryOp( - ibuf_type_id, SpvOpLoad, len_start_ac_inst->result_id()); + ibuf_type_id, spv::Op::OpLoad, len_start_ac_inst->result_id()); Instruction* len_start_32_inst = builder.AddUnaryOp( - GetUintId(), SpvOpUConvert, len_start_load_inst->result_id()); + GetUintId(), spv::Op::OpUConvert, len_start_load_inst->result_id()); // Decrement search index to get candidate buffer length index - Instruction* cand_len_idx_inst = - builder.AddBinaryOp(GetUintId(), SpvOpISub, cand_idx_inst->result_id(), - builder.GetUintConstantId(1u)); + Instruction* cand_len_idx_inst = builder.AddBinaryOp( + GetUintId(), spv::Op::OpISub, cand_idx_inst->result_id(), + builder.GetUintConstantId(1u)); // Add candidate length index to start index Instruction* len_idx_inst = builder.AddBinaryOp( - GetUintId(), SpvOpIAdd, cand_len_idx_inst->result_id(), + GetUintId(), spv::Op::OpIAdd, cand_len_idx_inst->result_id(), len_start_32_inst->result_id()); // Load candidate buffer length Instruction* len_ac_inst = - builder.AddTernaryOp(ibuf_ptr_id, SpvOpAccessChain, ibuf_id, + builder.AddTernaryOp(ibuf_ptr_id, spv::Op::OpAccessChain, ibuf_id, builder.GetUintConstantId(kDebugInputDataOffset), len_idx_inst->result_id()); - Instruction* len_load_inst = - builder.AddUnaryOp(ibuf_type_id, SpvOpLoad, len_ac_inst->result_id()); + Instruction* len_load_inst = builder.AddUnaryOp( + ibuf_type_id, spv::Op::OpLoad, len_ac_inst->result_id()); // Test if reference end within candidate buffer length Instruction* len_test_inst = builder.AddBinaryOp( - GetBoolId(), SpvOpULessThanEqual, ref_end_inst->result_id(), + GetBoolId(), spv::Op::OpULessThanEqual, ref_end_inst->result_id(), len_load_inst->result_id()); // Return test result - (void)builder.AddInstruction(MakeUnique( - context(), SpvOpReturnValue, 0, 0, - std::initializer_list{ - {SPV_OPERAND_TYPE_ID, {len_test_inst->result_id()}}})); + (void)builder.AddUnaryOp(0, spv::Op::OpReturnValue, + len_test_inst->result_id()); // Close block input_func->AddBasicBlock(std::move(bound_test_blk_ptr)); // Close function and add function to module - std::unique_ptr func_end_inst( - new Instruction(get_module()->context(), SpvOpFunctionEnd, 0, 0, {})); + std::unique_ptr func_end_inst(new Instruction( + get_module()->context(), spv::Op::OpFunctionEnd, 0, 0, {})); get_def_use_mgr()->AnalyzeInstDefUse(&*func_end_inst); input_func->SetFunctionEnd(std::move(func_end_inst)); context()->AddFunction(std::move(input_func)); @@ -403,18 +383,11 @@ uint32_t InstBuffAddrCheckPass::GenSearchAndTest(Instruction* ref_inst, InstructionBuilder* builder, uint32_t* ref_uptr_id) { // Enable Int64 if necessary - if (!get_feature_mgr()->HasCapability(SpvCapabilityInt64)) { - std::unique_ptr cap_int64_inst(new Instruction( - context(), SpvOpCapability, 0, 0, - std::initializer_list{ - {SPV_OPERAND_TYPE_CAPABILITY, {SpvCapabilityInt64}}})); - get_def_use_mgr()->AnalyzeInstDefUse(&*cap_int64_inst); - context()->AddCapability(std::move(cap_int64_inst)); - } + context()->AddCapability(spv::Capability::Int64); // Convert reference pointer to uint64 uint32_t ref_ptr_id = ref_inst->GetSingleWordInOperand(0); Instruction* ref_uptr_inst = - builder->AddUnaryOp(GetUint64Id(), SpvOpConvertPtrToU, ref_ptr_id); + builder->AddUnaryOp(GetUint64Id(), spv::Op::OpConvertPtrToU, ref_ptr_id); *ref_uptr_id = ref_uptr_inst->result_id(); // Compute reference length in bytes analysis::DefUseManager* du_mgr = get_def_use_mgr(); @@ -424,10 +397,8 @@ uint32_t InstBuffAddrCheckPass::GenSearchAndTest(Instruction* ref_inst, uint32_t ref_len = GetTypeLength(ref_ptr_ty_inst->GetSingleWordInOperand(1)); uint32_t ref_len_id = builder->GetUintConstantId(ref_len); // Gen call to search and test function - const std::vector args = {GetSearchAndTestFuncId(), *ref_uptr_id, - ref_len_id}; - Instruction* call_inst = - builder->AddNaryOp(GetBoolId(), SpvOpFunctionCall, args); + Instruction* call_inst = builder->AddFunctionCall( + GetBoolId(), GetSearchAndTestFuncId(), {*ref_uptr_id, ref_len_id}); uint32_t retval = call_inst->result_id(); return retval; } @@ -485,7 +456,7 @@ Pass::Status InstBuffAddrCheckPass::ProcessImpl() { Pass::Status InstBuffAddrCheckPass::Process() { if (!get_feature_mgr()->HasCapability( - SpvCapabilityPhysicalStorageBufferAddressesEXT)) + spv::Capability::PhysicalStorageBufferAddressesEXT)) return Status::SuccessWithoutChange; InitInstBuffAddrCheck(); return ProcessImpl(); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/inst_buff_addr_check_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/inst_buff_addr_check_pass.h index fb43c397..9c4b3ed9 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/inst_buff_addr_check_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/inst_buff_addr_check_pass.h @@ -41,11 +41,10 @@ class InstBuffAddrCheckPass : public InstrumentPass { const char* name() const override { return "inst-buff-addr-check-pass"; } - private: - // Return byte alignment of type |type_id|. Must be int, float, vector, - // matrix, struct, array or physical pointer. Uses std430 alignment. - uint32_t GetTypeAlignment(uint32_t type_id); + bool InstrumentFunction(Function* func, uint32_t stage_idx, + InstProcessFunction& pfn) override; + private: // Return byte length of type |type_id|. Must be int, float, vector, matrix, // struct, array or physical pointer. Uses std430 alignment and sizes. uint32_t GetTypeLength(uint32_t type_id); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/inst_debug_printf_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/inst_debug_printf_pass.cpp index 4218138f..f7c22745 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/inst_debug_printf_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/inst_debug_printf_pass.cpp @@ -34,8 +34,8 @@ void InstDebugPrintfPass::GenOutputValues(Instruction* val_inst, const analysis::Type* c_ty = v_ty->element_type(); uint32_t c_ty_id = type_mgr->GetId(c_ty); for (uint32_t c = 0; c < v_ty->element_count(); ++c) { - Instruction* c_inst = builder->AddIdLiteralOp( - c_ty_id, SpvOpCompositeExtract, val_inst->result_id(), c); + Instruction* c_inst = + builder->AddCompositeExtract(c_ty_id, val_inst->result_id(), {c}); GenOutputValues(c_inst, val_ids, builder); } return; @@ -44,8 +44,8 @@ void InstDebugPrintfPass::GenOutputValues(Instruction* val_inst, // Select between uint32 zero or one uint32_t zero_id = builder->GetUintConstantId(0); uint32_t one_id = builder->GetUintConstantId(1); - Instruction* sel_inst = builder->AddTernaryOp( - GetUintId(), SpvOpSelect, val_inst->result_id(), one_id, zero_id); + Instruction* sel_inst = builder->AddSelect( + GetUintId(), val_inst->result_id(), one_id, zero_id); val_ids->push_back(sel_inst->result_id()); return; } @@ -55,21 +55,21 @@ void InstDebugPrintfPass::GenOutputValues(Instruction* val_inst, case 16: { // Convert float16 to float32 and recurse Instruction* f32_inst = builder->AddUnaryOp( - GetFloatId(), SpvOpFConvert, val_inst->result_id()); + GetFloatId(), spv::Op::OpFConvert, val_inst->result_id()); GenOutputValues(f32_inst, val_ids, builder); return; } case 64: { // Bitcast float64 to uint64 and recurse Instruction* ui64_inst = builder->AddUnaryOp( - GetUint64Id(), SpvOpBitcast, val_inst->result_id()); + GetUint64Id(), spv::Op::OpBitcast, val_inst->result_id()); GenOutputValues(ui64_inst, val_ids, builder); return; } case 32: { // Bitcase float32 to uint32 - Instruction* bc_inst = builder->AddUnaryOp(GetUintId(), SpvOpBitcast, - val_inst->result_id()); + Instruction* bc_inst = builder->AddUnaryOp( + GetUintId(), spv::Op::OpBitcast, val_inst->result_id()); val_ids->push_back(bc_inst->result_id()); return; } @@ -85,17 +85,17 @@ void InstDebugPrintfPass::GenOutputValues(Instruction* val_inst, Instruction* ui64_inst = val_inst; if (i_ty->IsSigned()) { // Bitcast sint64 to uint64 - ui64_inst = builder->AddUnaryOp(GetUint64Id(), SpvOpBitcast, + ui64_inst = builder->AddUnaryOp(GetUint64Id(), spv::Op::OpBitcast, val_inst->result_id()); } // Break uint64 into 2x uint32 Instruction* lo_ui64_inst = builder->AddUnaryOp( - GetUintId(), SpvOpUConvert, ui64_inst->result_id()); + GetUintId(), spv::Op::OpUConvert, ui64_inst->result_id()); Instruction* rshift_ui64_inst = builder->AddBinaryOp( - GetUint64Id(), SpvOpShiftRightLogical, ui64_inst->result_id(), - builder->GetUintConstantId(32)); + GetUint64Id(), spv::Op::OpShiftRightLogical, + ui64_inst->result_id(), builder->GetUintConstantId(32)); Instruction* hi_ui64_inst = builder->AddUnaryOp( - GetUintId(), SpvOpUConvert, rshift_ui64_inst->result_id()); + GetUintId(), spv::Op::OpUConvert, rshift_ui64_inst->result_id()); val_ids->push_back(lo_ui64_inst->result_id()); val_ids->push_back(hi_ui64_inst->result_id()); return; @@ -104,12 +104,12 @@ void InstDebugPrintfPass::GenOutputValues(Instruction* val_inst, Instruction* ui8_inst = val_inst; if (i_ty->IsSigned()) { // Bitcast sint8 to uint8 - ui8_inst = builder->AddUnaryOp(GetUint8Id(), SpvOpBitcast, + ui8_inst = builder->AddUnaryOp(GetUint8Id(), spv::Op::OpBitcast, val_inst->result_id()); } // Convert uint8 to uint32 Instruction* ui32_inst = builder->AddUnaryOp( - GetUintId(), SpvOpUConvert, ui8_inst->result_id()); + GetUintId(), spv::Op::OpUConvert, ui8_inst->result_id()); val_ids->push_back(ui32_inst->result_id()); return; } @@ -117,7 +117,7 @@ void InstDebugPrintfPass::GenOutputValues(Instruction* val_inst, Instruction* ui32_inst = val_inst; if (i_ty->IsSigned()) { // Bitcast sint32 to uint32 - ui32_inst = builder->AddUnaryOp(GetUintId(), SpvOpBitcast, + ui32_inst = builder->AddUnaryOp(GetUintId(), spv::Op::OpBitcast, val_inst->result_id()); } // uint32 needs no further processing @@ -158,15 +158,17 @@ void InstDebugPrintfPass::GenOutputCode( return; } Instruction* opnd_inst = get_def_use_mgr()->GetDef(*iid); - if (opnd_inst->opcode() == SpvOpString) { + if (opnd_inst->opcode() == spv::Op::OpString) { uint32_t string_id_id = builder.GetUintConstantId(*iid); val_ids.push_back(string_id_id); } else { GenOutputValues(opnd_inst, &val_ids, &builder); } }); - GenDebugStreamWrite(uid2offset_[printf_inst->unique_id()], stage_idx, val_ids, - &builder); + GenDebugStreamWrite( + builder.GetUintConstantId(shader_id_), + builder.GetUintConstantId(uid2offset_[printf_inst->unique_id()]), + GenStageInfo(stage_idx, &builder), val_ids, &builder); context()->KillInst(printf_inst); } @@ -176,7 +178,7 @@ void InstDebugPrintfPass::GenDebugPrintfCode( std::vector>* new_blocks) { // If not DebugPrintf OpExtInst, return. Instruction* printf_inst = &*ref_inst_itr; - if (printf_inst->opcode() != SpvOpExtInst) return; + if (printf_inst->opcode() != spv::Op::OpExtInst) return; if (printf_inst->GetSingleWordInOperand(0) != ext_inst_printf_id_) return; if (printf_inst->GetSingleWordInOperand(1) != NonSemanticDebugPrintfDebugPrintf) @@ -239,15 +241,7 @@ Pass::Status InstDebugPrintfPass::ProcessImpl() { } } if (!non_sem_set_seen) { - for (auto c_itr = context()->module()->extension_begin(); - c_itr != context()->module()->extension_end(); ++c_itr) { - const std::string ext_name = c_itr->GetInOperand(0).AsString(); - if (ext_name == "SPV_KHR_non_semantic_info") { - context()->KillInst(&*c_itr); - break; - } - } - context()->get_feature_mgr()->RemoveExtension(kSPV_KHR_non_semantic_info); + context()->RemoveExtension(kSPV_KHR_non_semantic_info); } return Status::SuccessWithChange; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/instruction.cpp b/bgfx/3rdparty/spirv-tools/source/opt/instruction.cpp index e775a992..aa4ae26b 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/instruction.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/instruction.cpp @@ -24,38 +24,37 @@ namespace spvtools { namespace opt { - namespace { // Indices used to get particular operands out of instructions using InOperand. -const uint32_t kTypeImageDimIndex = 1; -const uint32_t kLoadBaseIndex = 0; -const uint32_t kPointerTypeStorageClassIndex = 0; -const uint32_t kVariableStorageClassIndex = 0; -const uint32_t kTypeImageSampledIndex = 5; +constexpr uint32_t kTypeImageDimIndex = 1; +constexpr uint32_t kLoadBaseIndex = 0; +constexpr uint32_t kPointerTypeStorageClassIndex = 0; +constexpr uint32_t kVariableStorageClassIndex = 0; +constexpr uint32_t kTypeImageSampledIndex = 5; // Constants for OpenCL.DebugInfo.100 / NonSemantic.Shader.DebugInfo.100 // extension instructions. -const uint32_t kExtInstSetIdInIdx = 0; -const uint32_t kExtInstInstructionInIdx = 1; -const uint32_t kDebugScopeNumWords = 7; -const uint32_t kDebugScopeNumWordsWithoutInlinedAt = 6; -const uint32_t kDebugNoScopeNumWords = 5; +constexpr uint32_t kExtInstSetIdInIdx = 0; +constexpr uint32_t kExtInstInstructionInIdx = 1; +constexpr uint32_t kDebugScopeNumWords = 7; +constexpr uint32_t kDebugScopeNumWordsWithoutInlinedAt = 6; +constexpr uint32_t kDebugNoScopeNumWords = 5; // Number of operands of an OpBranchConditional instruction // with weights. -const uint32_t kOpBranchConditionalWithWeightsNumOperands = 5; +constexpr uint32_t kOpBranchConditionalWithWeightsNumOperands = 5; } // namespace Instruction::Instruction(IRContext* c) : utils::IntrusiveNodeBase(), context_(c), - opcode_(SpvOpNop), + opcode_(spv::Op::OpNop), has_type_id_(false), has_result_id_(false), unique_id_(c->TakeNextUniqueId()), dbg_scope_(kNoDebugScope, kNoInlinedAt) {} -Instruction::Instruction(IRContext* c, SpvOp op) +Instruction::Instruction(IRContext* c, spv::Op op) : utils::IntrusiveNodeBase(), context_(c), opcode_(op), @@ -68,12 +67,13 @@ Instruction::Instruction(IRContext* c, const spv_parsed_instruction_t& inst, std::vector&& dbg_line) : utils::IntrusiveNodeBase(), context_(c), - opcode_(static_cast(inst.opcode)), + opcode_(static_cast(inst.opcode)), has_type_id_(inst.type_id != 0), has_result_id_(inst.result_id != 0), unique_id_(c->TakeNextUniqueId()), dbg_line_insts_(std::move(dbg_line)), dbg_scope_(kNoDebugScope, kNoInlinedAt) { + operands_.reserve(inst.num_operands); for (uint32_t i = 0; i < inst.num_operands; ++i) { const auto& current_payload = inst.operands[i]; operands_.emplace_back( @@ -88,11 +88,12 @@ Instruction::Instruction(IRContext* c, const spv_parsed_instruction_t& inst, const DebugScope& dbg_scope) : utils::IntrusiveNodeBase(), context_(c), - opcode_(static_cast(inst.opcode)), + opcode_(static_cast(inst.opcode)), has_type_id_(inst.type_id != 0), has_result_id_(inst.result_id != 0), unique_id_(c->TakeNextUniqueId()), dbg_scope_(dbg_scope) { + operands_.reserve(inst.num_operands); for (uint32_t i = 0; i < inst.num_operands; ++i) { const auto& current_payload = inst.operands[i]; operands_.emplace_back( @@ -101,7 +102,7 @@ Instruction::Instruction(IRContext* c, const spv_parsed_instruction_t& inst, } } -Instruction::Instruction(IRContext* c, SpvOp op, uint32_t ty_id, +Instruction::Instruction(IRContext* c, spv::Op op, uint32_t ty_id, uint32_t res_id, const OperandList& in_operands) : utils::IntrusiveNodeBase(), context_(c), @@ -111,6 +112,14 @@ Instruction::Instruction(IRContext* c, SpvOp op, uint32_t ty_id, unique_id_(c->TakeNextUniqueId()), operands_(), dbg_scope_(kNoDebugScope, kNoInlinedAt) { + size_t operands_size = in_operands.size(); + if (has_type_id_) { + operands_size++; + } + if (has_result_id_) { + operands_size++; + } + operands_.reserve(operands_size); if (has_type_id_) { operands_.emplace_back(spv_operand_type_t::SPV_OPERAND_TYPE_TYPE_ID, std::initializer_list{ty_id}); @@ -179,7 +188,7 @@ uint32_t Instruction::NumInOperandWords() const { } bool Instruction::HasBranchWeights() const { - if (opcode_ == SpvOpBranchConditional && + if (opcode_ == spv::Op::OpBranchConditional && NumOperands() == kOpBranchConditionalWithWeightsNumOperands) { return true; } @@ -208,13 +217,13 @@ bool Instruction::IsReadOnlyLoad() const { return false; } - if (address_def->opcode() == SpvOpVariable) { + if (address_def->opcode() == spv::Op::OpVariable) { if (address_def->IsReadOnlyPointer()) { return true; } } - if (address_def->opcode() == SpvOpLoad) { + if (address_def->opcode() == spv::Op::OpLoad) { const analysis::Type* address_type = context()->get_type_mgr()->GetType(address_def->type_id()); if (address_type->AsSampledImage() != nullptr) { @@ -235,12 +244,12 @@ Instruction* Instruction::GetBaseAddress() const { bool done = false; while (!done) { switch (base_inst->opcode()) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: - case SpvOpImageTexelPointer: - case SpvOpCopyObject: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpCopyObject: // All of these instructions have the base pointer use a base pointer // in in-operand 0. base = base_inst->GetSingleWordInOperand(0); @@ -255,20 +264,20 @@ Instruction* Instruction::GetBaseAddress() const { } bool Instruction::IsReadOnlyPointer() const { - if (context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) + if (context()->get_feature_mgr()->HasCapability(spv::Capability::Shader)) return IsReadOnlyPointerShaders(); else return IsReadOnlyPointerKernel(); } bool Instruction::IsVulkanStorageImage() const { - if (opcode() != SpvOpTypePointer) { + if (opcode() != spv::Op::OpTypePointer) { return false; } - uint32_t storage_class = - GetSingleWordInOperand(kPointerTypeStorageClassIndex); - if (storage_class != SpvStorageClassUniformConstant) { + spv::StorageClass storage_class = + spv::StorageClass(GetSingleWordInOperand(kPointerTypeStorageClassIndex)); + if (storage_class != spv::StorageClass::UniformConstant) { return false; } @@ -276,17 +285,18 @@ bool Instruction::IsVulkanStorageImage() const { context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); // Unpack the optional layer of arraying. - if (base_type->opcode() == SpvOpTypeArray || - base_type->opcode() == SpvOpTypeRuntimeArray) { + if (base_type->opcode() == spv::Op::OpTypeArray || + base_type->opcode() == spv::Op::OpTypeRuntimeArray) { base_type = context()->get_def_use_mgr()->GetDef( base_type->GetSingleWordInOperand(0)); } - if (base_type->opcode() != SpvOpTypeImage) { + if (base_type->opcode() != spv::Op::OpTypeImage) { return false; } - if (base_type->GetSingleWordInOperand(kTypeImageDimIndex) == SpvDimBuffer) { + if (spv::Dim(base_type->GetSingleWordInOperand(kTypeImageDimIndex)) == + spv::Dim::Buffer) { return false; } @@ -296,13 +306,13 @@ bool Instruction::IsVulkanStorageImage() const { } bool Instruction::IsVulkanSampledImage() const { - if (opcode() != SpvOpTypePointer) { + if (opcode() != spv::Op::OpTypePointer) { return false; } - uint32_t storage_class = - GetSingleWordInOperand(kPointerTypeStorageClassIndex); - if (storage_class != SpvStorageClassUniformConstant) { + spv::StorageClass storage_class = + spv::StorageClass(GetSingleWordInOperand(kPointerTypeStorageClassIndex)); + if (storage_class != spv::StorageClass::UniformConstant) { return false; } @@ -310,17 +320,18 @@ bool Instruction::IsVulkanSampledImage() const { context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); // Unpack the optional layer of arraying. - if (base_type->opcode() == SpvOpTypeArray || - base_type->opcode() == SpvOpTypeRuntimeArray) { + if (base_type->opcode() == spv::Op::OpTypeArray || + base_type->opcode() == spv::Op::OpTypeRuntimeArray) { base_type = context()->get_def_use_mgr()->GetDef( base_type->GetSingleWordInOperand(0)); } - if (base_type->opcode() != SpvOpTypeImage) { + if (base_type->opcode() != spv::Op::OpTypeImage) { return false; } - if (base_type->GetSingleWordInOperand(kTypeImageDimIndex) == SpvDimBuffer) { + if (spv::Dim(base_type->GetSingleWordInOperand(kTypeImageDimIndex)) == + spv::Dim::Buffer) { return false; } @@ -330,13 +341,13 @@ bool Instruction::IsVulkanSampledImage() const { } bool Instruction::IsVulkanStorageTexelBuffer() const { - if (opcode() != SpvOpTypePointer) { + if (opcode() != spv::Op::OpTypePointer) { return false; } - uint32_t storage_class = - GetSingleWordInOperand(kPointerTypeStorageClassIndex); - if (storage_class != SpvStorageClassUniformConstant) { + spv::StorageClass storage_class = + spv::StorageClass(GetSingleWordInOperand(kPointerTypeStorageClassIndex)); + if (storage_class != spv::StorageClass::UniformConstant) { return false; } @@ -344,17 +355,18 @@ bool Instruction::IsVulkanStorageTexelBuffer() const { context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); // Unpack the optional layer of arraying. - if (base_type->opcode() == SpvOpTypeArray || - base_type->opcode() == SpvOpTypeRuntimeArray) { + if (base_type->opcode() == spv::Op::OpTypeArray || + base_type->opcode() == spv::Op::OpTypeRuntimeArray) { base_type = context()->get_def_use_mgr()->GetDef( base_type->GetSingleWordInOperand(0)); } - if (base_type->opcode() != SpvOpTypeImage) { + if (base_type->opcode() != spv::Op::OpTypeImage) { return false; } - if (base_type->GetSingleWordInOperand(kTypeImageDimIndex) != SpvDimBuffer) { + if (spv::Dim(base_type->GetSingleWordInOperand(kTypeImageDimIndex)) != + spv::Dim::Buffer) { return false; } @@ -366,7 +378,7 @@ bool Instruction::IsVulkanStorageTexelBuffer() const { bool Instruction::IsVulkanStorageBuffer() const { // Is there a difference between a "Storage buffer" and a "dynamic storage // buffer" in SPIR-V and do we care about the difference? - if (opcode() != SpvOpTypePointer) { + if (opcode() != spv::Op::OpTypePointer) { return false; } @@ -374,28 +386,28 @@ bool Instruction::IsVulkanStorageBuffer() const { context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); // Unpack the optional layer of arraying. - if (base_type->opcode() == SpvOpTypeArray || - base_type->opcode() == SpvOpTypeRuntimeArray) { + if (base_type->opcode() == spv::Op::OpTypeArray || + base_type->opcode() == spv::Op::OpTypeRuntimeArray) { base_type = context()->get_def_use_mgr()->GetDef( base_type->GetSingleWordInOperand(0)); } - if (base_type->opcode() != SpvOpTypeStruct) { + if (base_type->opcode() != spv::Op::OpTypeStruct) { return false; } - uint32_t storage_class = - GetSingleWordInOperand(kPointerTypeStorageClassIndex); - if (storage_class == SpvStorageClassUniform) { + spv::StorageClass storage_class = + spv::StorageClass(GetSingleWordInOperand(kPointerTypeStorageClassIndex)); + if (storage_class == spv::StorageClass::Uniform) { bool is_buffer_block = false; context()->get_decoration_mgr()->ForEachDecoration( - base_type->result_id(), SpvDecorationBufferBlock, + base_type->result_id(), uint32_t(spv::Decoration::BufferBlock), [&is_buffer_block](const Instruction&) { is_buffer_block = true; }); return is_buffer_block; - } else if (storage_class == SpvStorageClassStorageBuffer) { + } else if (storage_class == spv::StorageClass::StorageBuffer) { bool is_block = false; context()->get_decoration_mgr()->ForEachDecoration( - base_type->result_id(), SpvDecorationBlock, + base_type->result_id(), uint32_t(spv::Decoration::Block), [&is_block](const Instruction&) { is_block = true; }); return is_block; } @@ -403,13 +415,14 @@ bool Instruction::IsVulkanStorageBuffer() const { } bool Instruction::IsVulkanStorageBufferVariable() const { - if (opcode() != SpvOpVariable) { + if (opcode() != spv::Op::OpVariable) { return false; } - uint32_t storage_class = GetSingleWordInOperand(kVariableStorageClassIndex); - if (storage_class == SpvStorageClassStorageBuffer || - storage_class == SpvStorageClassUniform) { + spv::StorageClass storage_class = + spv::StorageClass(GetSingleWordInOperand(kVariableStorageClassIndex)); + if (storage_class == spv::StorageClass::StorageBuffer || + storage_class == spv::StorageClass::Uniform) { Instruction* var_type = context()->get_def_use_mgr()->GetDef(type_id()); return var_type != nullptr && var_type->IsVulkanStorageBuffer(); } @@ -418,13 +431,13 @@ bool Instruction::IsVulkanStorageBufferVariable() const { } bool Instruction::IsVulkanUniformBuffer() const { - if (opcode() != SpvOpTypePointer) { + if (opcode() != spv::Op::OpTypePointer) { return false; } - uint32_t storage_class = - GetSingleWordInOperand(kPointerTypeStorageClassIndex); - if (storage_class != SpvStorageClassUniform) { + spv::StorageClass storage_class = + spv::StorageClass(GetSingleWordInOperand(kPointerTypeStorageClassIndex)); + if (storage_class != spv::StorageClass::Uniform) { return false; } @@ -432,19 +445,19 @@ bool Instruction::IsVulkanUniformBuffer() const { context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); // Unpack the optional layer of arraying. - if (base_type->opcode() == SpvOpTypeArray || - base_type->opcode() == SpvOpTypeRuntimeArray) { + if (base_type->opcode() == spv::Op::OpTypeArray || + base_type->opcode() == spv::Op::OpTypeRuntimeArray) { base_type = context()->get_def_use_mgr()->GetDef( base_type->GetSingleWordInOperand(0)); } - if (base_type->opcode() != SpvOpTypeStruct) { + if (base_type->opcode() != spv::Op::OpTypeStruct) { return false; } bool is_block = false; context()->get_decoration_mgr()->ForEachDecoration( - base_type->result_id(), SpvDecorationBlock, + base_type->result_id(), uint32_t(spv::Decoration::Block), [&is_block](const Instruction&) { is_block = true; }); return is_block; } @@ -455,27 +468,27 @@ bool Instruction::IsReadOnlyPointerShaders() const { } Instruction* type_def = context()->get_def_use_mgr()->GetDef(type_id()); - if (type_def->opcode() != SpvOpTypePointer) { + if (type_def->opcode() != spv::Op::OpTypePointer) { return false; } - uint32_t storage_class = - type_def->GetSingleWordInOperand(kPointerTypeStorageClassIndex); + spv::StorageClass storage_class = spv::StorageClass( + type_def->GetSingleWordInOperand(kPointerTypeStorageClassIndex)); switch (storage_class) { - case SpvStorageClassUniformConstant: + case spv::StorageClass::UniformConstant: if (!type_def->IsVulkanStorageImage() && !type_def->IsVulkanStorageTexelBuffer()) { return true; } break; - case SpvStorageClassUniform: + case spv::StorageClass::Uniform: if (!type_def->IsVulkanStorageBuffer()) { return true; } break; - case SpvStorageClassPushConstant: - case SpvStorageClassInput: + case spv::StorageClass::PushConstant: + case spv::StorageClass::Input: return true; default: break; @@ -483,7 +496,7 @@ bool Instruction::IsReadOnlyPointerShaders() const { bool is_nonwritable = false; context()->get_decoration_mgr()->ForEachDecoration( - result_id(), SpvDecorationNonWritable, + result_id(), uint32_t(spv::Decoration::NonWritable), [&is_nonwritable](const Instruction&) { is_nonwritable = true; }); return is_nonwritable; } @@ -494,14 +507,14 @@ bool Instruction::IsReadOnlyPointerKernel() const { } Instruction* type_def = context()->get_def_use_mgr()->GetDef(type_id()); - if (type_def->opcode() != SpvOpTypePointer) { + if (type_def->opcode() != spv::Op::OpTypePointer) { return false; } - uint32_t storage_class = - type_def->GetSingleWordInOperand(kPointerTypeStorageClassIndex); + spv::StorageClass storage_class = spv::StorageClass( + type_def->GetSingleWordInOperand(kPointerTypeStorageClassIndex)); - return storage_class == SpvStorageClassUniformConstant; + return storage_class == spv::StorageClass::UniformConstant; } void Instruction::UpdateLexicalScope(uint32_t scope) { @@ -564,13 +577,13 @@ bool Instruction::IsDebugLineInst() const { bool Instruction::IsLineInst() const { return IsLine() || IsNoLine(); } bool Instruction::IsLine() const { - if (opcode() == SpvOpLine) return true; + if (opcode() == spv::Op::OpLine) return true; NonSemanticShaderDebugInfo100Instructions ext_opt = GetShader100DebugOpcode(); return ext_opt == NonSemanticShaderDebugInfo100DebugLine; } bool Instruction::IsNoLine() const { - if (opcode() == SpvOpNoLine) return true; + if (opcode() == spv::Op::OpNoLine) return true; NonSemanticShaderDebugInfo100Instructions ext_opt = GetShader100DebugOpcode(); return ext_opt == NonSemanticShaderDebugInfo100DebugNoLine; } @@ -597,33 +610,35 @@ bool Instruction::IsValidBasePointer() const { } Instruction* type = context()->get_def_use_mgr()->GetDef(tid); - if (type->opcode() != SpvOpTypePointer) { + if (type->opcode() != spv::Op::OpTypePointer) { return false; } auto feature_mgr = context()->get_feature_mgr(); - if (feature_mgr->HasCapability(SpvCapabilityAddresses)) { + if (feature_mgr->HasCapability(spv::Capability::Addresses)) { // TODO: The rules here could be more restrictive. return true; } - if (opcode() == SpvOpVariable || opcode() == SpvOpFunctionParameter) { + if (opcode() == spv::Op::OpVariable || + opcode() == spv::Op::OpFunctionParameter) { return true; } // With variable pointers, there are more valid base pointer objects. // Variable pointers implicitly declares Variable pointers storage buffer. - SpvStorageClass storage_class = - static_cast(type->GetSingleWordInOperand(0)); - if ((feature_mgr->HasCapability(SpvCapabilityVariablePointersStorageBuffer) && - storage_class == SpvStorageClassStorageBuffer) || - (feature_mgr->HasCapability(SpvCapabilityVariablePointers) && - storage_class == SpvStorageClassWorkgroup)) { + spv::StorageClass storage_class = + static_cast(type->GetSingleWordInOperand(0)); + if ((feature_mgr->HasCapability( + spv::Capability::VariablePointersStorageBuffer) && + storage_class == spv::StorageClass::StorageBuffer) || + (feature_mgr->HasCapability(spv::Capability::VariablePointers) && + storage_class == spv::StorageClass::Workgroup)) { switch (opcode()) { - case SpvOpPhi: - case SpvOpSelect: - case SpvOpFunctionCall: - case SpvOpConstantNull: + case spv::Op::OpPhi: + case spv::Op::OpSelect: + case spv::Op::OpFunctionCall: + case spv::Op::OpConstantNull: return true; default: break; @@ -641,7 +656,7 @@ bool Instruction::IsValidBasePointer() const { } OpenCLDebugInfo100Instructions Instruction::GetOpenCL100DebugOpcode() const { - if (opcode() != SpvOpExtInst) { + if (opcode() != spv::Op::OpExtInst) { return OpenCLDebugInfo100InstructionsMax; } @@ -660,7 +675,7 @@ OpenCLDebugInfo100Instructions Instruction::GetOpenCL100DebugOpcode() const { NonSemanticShaderDebugInfo100Instructions Instruction::GetShader100DebugOpcode() const { - if (opcode() != SpvOpExtInst) { + if (opcode() != spv::Op::OpExtInst) { return NonSemanticShaderDebugInfo100InstructionsMax; } @@ -682,7 +697,7 @@ NonSemanticShaderDebugInfo100Instructions Instruction::GetShader100DebugOpcode() } CommonDebugInfoInstructions Instruction::GetCommonDebugOpcode() const { - if (opcode() != SpvOpExtInst) { + if (opcode() != spv::Op::OpExtInst) { return CommonDebugInfoInstructionsMax; } @@ -712,31 +727,31 @@ bool Instruction::IsValidBaseImage() const { } Instruction* type = context()->get_def_use_mgr()->GetDef(tid); - return (type->opcode() == SpvOpTypeImage || - type->opcode() == SpvOpTypeSampledImage); + return (type->opcode() == spv::Op::OpTypeImage || + type->opcode() == spv::Op::OpTypeSampledImage); } bool Instruction::IsOpaqueType() const { - if (opcode() == SpvOpTypeStruct) { + if (opcode() == spv::Op::OpTypeStruct) { bool is_opaque = false; ForEachInOperand([&is_opaque, this](const uint32_t* op_id) { Instruction* type_inst = context()->get_def_use_mgr()->GetDef(*op_id); is_opaque |= type_inst->IsOpaqueType(); }); return is_opaque; - } else if (opcode() == SpvOpTypeArray) { + } else if (opcode() == spv::Op::OpTypeArray) { uint32_t sub_type_id = GetSingleWordInOperand(0); Instruction* sub_type_inst = context()->get_def_use_mgr()->GetDef(sub_type_id); return sub_type_inst->IsOpaqueType(); } else { - return opcode() == SpvOpTypeRuntimeArray || + return opcode() == spv::Op::OpTypeRuntimeArray || spvOpcodeIsBaseOpaqueType(opcode()); } } bool Instruction::IsFoldable() const { - return IsFoldableByFoldScalar() || + return IsFoldableByFoldScalar() || IsFoldableByFoldVector() || context()->get_instruction_folder().HasConstFoldingRule(this); } @@ -747,7 +762,7 @@ bool Instruction::IsFoldableByFoldScalar() const { } Instruction* type = context()->get_def_use_mgr()->GetDef(type_id()); - if (!folder.IsFoldableType(type)) { + if (!folder.IsFoldableScalarType(type)) { return false; } @@ -758,29 +773,52 @@ bool Instruction::IsFoldableByFoldScalar() const { Instruction* def_inst = context()->get_def_use_mgr()->GetDef(*op_id); Instruction* def_inst_type = context()->get_def_use_mgr()->GetDef(def_inst->type_id()); - return folder.IsFoldableType(def_inst_type); + return folder.IsFoldableScalarType(def_inst_type); + }); +} + +bool Instruction::IsFoldableByFoldVector() const { + const InstructionFolder& folder = context()->get_instruction_folder(); + if (!folder.IsFoldableOpcode(opcode())) { + return false; + } + + Instruction* type = context()->get_def_use_mgr()->GetDef(type_id()); + if (!folder.IsFoldableVectorType(type)) { + return false; + } + + // Even if the type of the instruction is foldable, its operands may not be + // foldable (e.g., comparisons of 64bit types). Check that all operand types + // are foldable before accepting the instruction. + return WhileEachInOperand([&folder, this](const uint32_t* op_id) { + Instruction* def_inst = context()->get_def_use_mgr()->GetDef(*op_id); + Instruction* def_inst_type = + context()->get_def_use_mgr()->GetDef(def_inst->type_id()); + return folder.IsFoldableVectorType(def_inst_type); }); } bool Instruction::IsFloatingPointFoldingAllowed() const { // TODO: Add the rules for kernels. For now it will be pessimistic. // For now, do not support capabilities introduced by SPV_KHR_float_controls. - if (!context_->get_feature_mgr()->HasCapability(SpvCapabilityShader) || - context_->get_feature_mgr()->HasCapability(SpvCapabilityDenormPreserve) || + if (!context_->get_feature_mgr()->HasCapability(spv::Capability::Shader) || + context_->get_feature_mgr()->HasCapability( + spv::Capability::DenormPreserve) || context_->get_feature_mgr()->HasCapability( - SpvCapabilityDenormFlushToZero) || + spv::Capability::DenormFlushToZero) || context_->get_feature_mgr()->HasCapability( - SpvCapabilitySignedZeroInfNanPreserve) || + spv::Capability::SignedZeroInfNanPreserve) || context_->get_feature_mgr()->HasCapability( - SpvCapabilityRoundingModeRTZ) || + spv::Capability::RoundingModeRTZ) || context_->get_feature_mgr()->HasCapability( - SpvCapabilityRoundingModeRTE)) { + spv::Capability::RoundingModeRTE)) { return false; } bool is_nocontract = false; context_->get_decoration_mgr()->WhileEachDecoration( - result_id(), SpvDecorationNoContraction, + result_id(), uint32_t(spv::Decoration::NoContraction), [&is_nocontract](const Instruction&) { is_nocontract = true; return false; @@ -816,101 +854,101 @@ void Instruction::Dump() const { bool Instruction::IsOpcodeCodeMotionSafe() const { switch (opcode_) { - case SpvOpNop: - case SpvOpUndef: - case SpvOpLoad: - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpArrayLength: - case SpvOpVectorExtractDynamic: - case SpvOpVectorInsertDynamic: - case SpvOpVectorShuffle: - case SpvOpCompositeConstruct: - case SpvOpCompositeExtract: - case SpvOpCompositeInsert: - case SpvOpCopyObject: - case SpvOpTranspose: - case SpvOpConvertFToU: - case SpvOpConvertFToS: - case SpvOpConvertSToF: - case SpvOpConvertUToF: - case SpvOpUConvert: - case SpvOpSConvert: - case SpvOpFConvert: - case SpvOpQuantizeToF16: - case SpvOpBitcast: - case SpvOpSNegate: - case SpvOpFNegate: - case SpvOpIAdd: - case SpvOpFAdd: - case SpvOpISub: - case SpvOpFSub: - case SpvOpIMul: - case SpvOpFMul: - case SpvOpUDiv: - case SpvOpSDiv: - case SpvOpFDiv: - case SpvOpUMod: - case SpvOpSRem: - case SpvOpSMod: - case SpvOpFRem: - case SpvOpFMod: - case SpvOpVectorTimesScalar: - case SpvOpMatrixTimesScalar: - case SpvOpVectorTimesMatrix: - case SpvOpMatrixTimesVector: - case SpvOpMatrixTimesMatrix: - case SpvOpOuterProduct: - case SpvOpDot: - case SpvOpIAddCarry: - case SpvOpISubBorrow: - case SpvOpUMulExtended: - case SpvOpSMulExtended: - case SpvOpAny: - case SpvOpAll: - case SpvOpIsNan: - case SpvOpIsInf: - case SpvOpLogicalEqual: - case SpvOpLogicalNotEqual: - case SpvOpLogicalOr: - case SpvOpLogicalAnd: - case SpvOpLogicalNot: - case SpvOpSelect: - case SpvOpIEqual: - case SpvOpINotEqual: - case SpvOpUGreaterThan: - case SpvOpSGreaterThan: - case SpvOpUGreaterThanEqual: - case SpvOpSGreaterThanEqual: - case SpvOpULessThan: - case SpvOpSLessThan: - case SpvOpULessThanEqual: - case SpvOpSLessThanEqual: - case SpvOpFOrdEqual: - case SpvOpFUnordEqual: - case SpvOpFOrdNotEqual: - case SpvOpFUnordNotEqual: - case SpvOpFOrdLessThan: - case SpvOpFUnordLessThan: - case SpvOpFOrdGreaterThan: - case SpvOpFUnordGreaterThan: - case SpvOpFOrdLessThanEqual: - case SpvOpFUnordLessThanEqual: - case SpvOpFOrdGreaterThanEqual: - case SpvOpFUnordGreaterThanEqual: - case SpvOpShiftRightLogical: - case SpvOpShiftRightArithmetic: - case SpvOpShiftLeftLogical: - case SpvOpBitwiseOr: - case SpvOpBitwiseXor: - case SpvOpBitwiseAnd: - case SpvOpNot: - case SpvOpBitFieldInsert: - case SpvOpBitFieldSExtract: - case SpvOpBitFieldUExtract: - case SpvOpBitReverse: - case SpvOpBitCount: - case SpvOpSizeOf: + case spv::Op::OpNop: + case spv::Op::OpUndef: + case spv::Op::OpLoad: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpArrayLength: + case spv::Op::OpVectorExtractDynamic: + case spv::Op::OpVectorInsertDynamic: + case spv::Op::OpVectorShuffle: + case spv::Op::OpCompositeConstruct: + case spv::Op::OpCompositeExtract: + case spv::Op::OpCompositeInsert: + case spv::Op::OpCopyObject: + case spv::Op::OpTranspose: + case spv::Op::OpConvertFToU: + case spv::Op::OpConvertFToS: + case spv::Op::OpConvertSToF: + case spv::Op::OpConvertUToF: + case spv::Op::OpUConvert: + case spv::Op::OpSConvert: + case spv::Op::OpFConvert: + case spv::Op::OpQuantizeToF16: + case spv::Op::OpBitcast: + case spv::Op::OpSNegate: + case spv::Op::OpFNegate: + case spv::Op::OpIAdd: + case spv::Op::OpFAdd: + case spv::Op::OpISub: + case spv::Op::OpFSub: + case spv::Op::OpIMul: + case spv::Op::OpFMul: + case spv::Op::OpUDiv: + case spv::Op::OpSDiv: + case spv::Op::OpFDiv: + case spv::Op::OpUMod: + case spv::Op::OpSRem: + case spv::Op::OpSMod: + case spv::Op::OpFRem: + case spv::Op::OpFMod: + case spv::Op::OpVectorTimesScalar: + case spv::Op::OpMatrixTimesScalar: + case spv::Op::OpVectorTimesMatrix: + case spv::Op::OpMatrixTimesVector: + case spv::Op::OpMatrixTimesMatrix: + case spv::Op::OpOuterProduct: + case spv::Op::OpDot: + case spv::Op::OpIAddCarry: + case spv::Op::OpISubBorrow: + case spv::Op::OpUMulExtended: + case spv::Op::OpSMulExtended: + case spv::Op::OpAny: + case spv::Op::OpAll: + case spv::Op::OpIsNan: + case spv::Op::OpIsInf: + case spv::Op::OpLogicalEqual: + case spv::Op::OpLogicalNotEqual: + case spv::Op::OpLogicalOr: + case spv::Op::OpLogicalAnd: + case spv::Op::OpLogicalNot: + case spv::Op::OpSelect: + case spv::Op::OpIEqual: + case spv::Op::OpINotEqual: + case spv::Op::OpUGreaterThan: + case spv::Op::OpSGreaterThan: + case spv::Op::OpUGreaterThanEqual: + case spv::Op::OpSGreaterThanEqual: + case spv::Op::OpULessThan: + case spv::Op::OpSLessThan: + case spv::Op::OpULessThanEqual: + case spv::Op::OpSLessThanEqual: + case spv::Op::OpFOrdEqual: + case spv::Op::OpFUnordEqual: + case spv::Op::OpFOrdNotEqual: + case spv::Op::OpFUnordNotEqual: + case spv::Op::OpFOrdLessThan: + case spv::Op::OpFUnordLessThan: + case spv::Op::OpFOrdGreaterThan: + case spv::Op::OpFUnordGreaterThan: + case spv::Op::OpFOrdLessThanEqual: + case spv::Op::OpFUnordLessThanEqual: + case spv::Op::OpFOrdGreaterThanEqual: + case spv::Op::OpFUnordGreaterThanEqual: + case spv::Op::OpShiftRightLogical: + case spv::Op::OpShiftRightArithmetic: + case spv::Op::OpShiftLeftLogical: + case spv::Op::OpBitwiseOr: + case spv::Op::OpBitwiseXor: + case spv::Op::OpBitwiseAnd: + case spv::Op::OpNot: + case spv::Op::OpBitFieldInsert: + case spv::Op::OpBitFieldSExtract: + case spv::Op::OpBitFieldUExtract: + case spv::Op::OpBitReverse: + case spv::Op::OpBitCount: + case spv::Op::OpSizeOf: return true; default: return false; @@ -922,7 +960,7 @@ bool Instruction::IsScalarizable() const { return true; } - if (opcode() == SpvOpExtInst) { + if (opcode() == spv::Op::OpExtInst) { uint32_t instSetId = context()->get_feature_mgr()->GetExtInstImportId_GLSLstd450(); @@ -997,16 +1035,16 @@ bool Instruction::IsOpcodeSafeToDelete() const { } switch (opcode()) { - case SpvOpDPdx: - case SpvOpDPdy: - case SpvOpFwidth: - case SpvOpDPdxFine: - case SpvOpDPdyFine: - case SpvOpFwidthFine: - case SpvOpDPdxCoarse: - case SpvOpDPdyCoarse: - case SpvOpFwidthCoarse: - case SpvOpImageQueryLod: + case spv::Op::OpDPdx: + case spv::Op::OpDPdy: + case spv::Op::OpFwidth: + case spv::Op::OpDPdxFine: + case spv::Op::OpDPdyFine: + case spv::Op::OpFwidthFine: + case spv::Op::OpDPdxCoarse: + case spv::Op::OpDPdyCoarse: + case spv::Op::OpFwidthCoarse: + case spv::Op::OpImageQueryLod: return true; default: return false; @@ -1015,7 +1053,7 @@ bool Instruction::IsOpcodeSafeToDelete() const { bool Instruction::IsNonSemanticInstruction() const { if (!HasResultId()) return false; - if (opcode() != SpvOpExtInst) return false; + if (opcode() != spv::Op::OpExtInst) return false; auto import_inst = context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(0)); @@ -1035,7 +1073,7 @@ void DebugScope::ToBinary(uint32_t type_id, uint32_t result_id, num_words = kDebugScopeNumWordsWithoutInlinedAt; } std::vector operands = { - (num_words << 16) | static_cast(SpvOpExtInst), + (num_words << 16) | static_cast(spv::Op::OpExtInst), type_id, result_id, ext_set, diff --git a/bgfx/3rdparty/spirv-tools/source/opt/instruction.h b/bgfx/3rdparty/spirv-tools/source/opt/instruction.h index e79c6289..c2617fba 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/instruction.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/instruction.h @@ -36,8 +36,8 @@ #include "source/util/string_utils.h" #include "spirv-tools/libspirv.h" -const uint32_t kNoDebugScope = 0; -const uint32_t kNoInlinedAt = 0; +constexpr uint32_t kNoDebugScope = 0; +constexpr uint32_t kNoInlinedAt = 0; namespace spvtools { namespace opt { @@ -190,7 +190,7 @@ class Instruction : public utils::IntrusiveNodeBase { Instruction() : utils::IntrusiveNodeBase(), context_(nullptr), - opcode_(SpvOpNop), + opcode_(spv::Op::OpNop), has_type_id_(false), has_result_id_(false), unique_id_(0), @@ -200,7 +200,7 @@ class Instruction : public utils::IntrusiveNodeBase { Instruction(IRContext*); // Creates an instruction with the given opcode |op| and no additional logical // operands. - Instruction(IRContext*, SpvOp); + Instruction(IRContext*, spv::Op); // Creates an instruction using the given spv_parsed_instruction_t |inst|. All // the data inside |inst| will be copied and owned in this instance. And keep // record of line-related debug instructions |dbg_line| ahead of this @@ -213,7 +213,7 @@ class Instruction : public utils::IntrusiveNodeBase { // Creates an instruction with the given opcode |op|, type id: |ty_id|, // result id: |res_id| and input operands: |in_operands|. - Instruction(IRContext* c, SpvOp op, uint32_t ty_id, uint32_t res_id, + Instruction(IRContext* c, spv::Op op, uint32_t ty_id, uint32_t res_id, const OperandList& in_operands); // TODO: I will want to remove these, but will first have to remove the use of @@ -235,12 +235,12 @@ class Instruction : public utils::IntrusiveNodeBase { IRContext* context() const { return context_; } - SpvOp opcode() const { return opcode_; } + spv::Op opcode() const { return opcode_; } // Sets the opcode of this instruction to a specific opcode. Note this may // invalidate the instruction. // TODO(qining): Remove this function when instruction building and insertion // is well implemented. - void SetOpcode(SpvOp op) { opcode_ = op; } + void SetOpcode(spv::Op op) { opcode_ = op; } uint32_t type_id() const { return has_type_id_ ? GetSingleWordOperand(0) : 0; } @@ -294,6 +294,8 @@ class Instruction : public utils::IntrusiveNodeBase { // It is the responsibility of the caller to make sure // that the instruction remains valid. inline void AddOperand(Operand&& operand); + // Adds a copy of |operand| to the list of operands of this instruction. + inline void AddOperand(const Operand& operand); // Gets the |index|-th logical operand as a single SPIR-V word. This method is // not expected to be used with logical operands consisting of multiple SPIR-V // words. @@ -522,6 +524,10 @@ class Instruction : public utils::IntrusiveNodeBase { // constant value by |FoldScalar|. bool IsFoldableByFoldScalar() const; + // Returns true if |this| is an instruction which could be folded into a + // constant value by |FoldVector|. + bool IsFoldableByFoldVector() const; + // Returns true if we are allowed to fold or otherwise manipulate the // instruction that defines |id| in the given context. This includes not // handling NaN values. @@ -625,7 +631,7 @@ class Instruction : public utils::IntrusiveNodeBase { bool IsValidBaseImage() const; IRContext* context_; // IR Context - SpvOp opcode_; // Opcode + spv::Op opcode_; // Opcode bool has_type_id_; // True if the instruction has a type id bool has_result_id_; // True if the instruction has a result id uint32_t unique_id_; // Unique instruction id @@ -676,6 +682,10 @@ inline void Instruction::AddOperand(Operand&& operand) { operands_.push_back(std::move(operand)); } +inline void Instruction::AddOperand(const Operand& operand) { + operands_.push_back(operand); +} + inline void Instruction::SetInOperand(uint32_t index, Operand::OperandData&& data) { SetOperand(index + TypeResultIdCount(), std::move(data)); @@ -732,12 +742,12 @@ inline void Instruction::SetResultType(uint32_t ty_id) { } inline bool Instruction::IsNop() const { - return opcode_ == SpvOpNop && !has_type_id_ && !has_result_id_ && + return opcode_ == spv::Op::OpNop && !has_type_id_ && !has_result_id_ && operands_.empty(); } inline void Instruction::ToNop() { - opcode_ = SpvOpNop; + opcode_ = spv::Op::OpNop; has_type_id_ = false; has_result_id_ = false; operands_.clear(); @@ -879,12 +889,12 @@ inline void Instruction::ForEachInOperand( inline bool Instruction::HasLabels() const { switch (opcode_) { - case SpvOpSelectionMerge: - case SpvOpBranch: - case SpvOpLoopMerge: - case SpvOpBranchConditional: - case SpvOpSwitch: - case SpvOpPhi: + case spv::Op::OpSelectionMerge: + case spv::Op::OpBranch: + case spv::Op::OpLoopMerge: + case spv::Op::OpBranchConditional: + case spv::Op::OpSwitch: + case spv::Op::OpPhi: return true; break; default: @@ -906,7 +916,7 @@ bool Instruction::IsAtomicWithLoad() const { bool Instruction::IsAtomicOp() const { return spvOpcodeIsAtomicOp(opcode()); } bool Instruction::IsConstant() const { - return IsCompileTimeConstantInst(opcode()); + return IsConstantInst(opcode()) && !IsSpecConstantInst(opcode()); } } // namespace opt } // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/instrument_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/instrument_pass.cpp index d143d595..bd01ee64 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/instrument_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/instrument_pass.cpp @@ -19,20 +19,12 @@ #include "source/cfa.h" #include "source/spirv_constant.h" -namespace { - -// Common Parameter Positions -static const int kInstCommonParamInstIdx = 0; -static const int kInstCommonParamCnt = 1; - -// Indices of operands in SPIR-V instructions -static const int kEntryPointExecutionModelInIdx = 0; -static const int kEntryPointFunctionIdInIdx = 1; - -} // anonymous namespace - namespace spvtools { namespace opt { +namespace { +// Indices of operands in SPIR-V instructions +constexpr int kEntryPointFunctionIdInIdx = 1; +} // namespace void InstrumentPass::MovePreludeCode( BasicBlock::iterator ref_inst_itr, @@ -59,7 +51,6 @@ void InstrumentPass::MovePreludeCode( void InstrumentPass::MovePostludeCode( UptrVectorIterator ref_block_itr, BasicBlock* new_blk_ptr) { - // new_blk_ptr->reset(new BasicBlock(NewLabel(ref_block_itr->id()))); // Move contents of original ref block. for (auto cii = ref_block_itr->begin(); cii != ref_block_itr->end(); cii = ref_block_itr->begin()) { @@ -82,21 +73,62 @@ void InstrumentPass::MovePostludeCode( } std::unique_ptr InstrumentPass::NewLabel(uint32_t label_id) { - std::unique_ptr newLabel( - new Instruction(context(), SpvOpLabel, 0, label_id, {})); - get_def_use_mgr()->AnalyzeInstDefUse(&*newLabel); - return newLabel; + auto new_label = + MakeUnique(context(), spv::Op::OpLabel, 0, label_id, + std::initializer_list{}); + get_def_use_mgr()->AnalyzeInstDefUse(&*new_label); + return new_label; +} + +std::unique_ptr InstrumentPass::StartFunction( + uint32_t func_id, const analysis::Type* return_type, + const std::vector& param_types) { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::Function* func_type = GetFunction(return_type, param_types); + + const std::vector operands{ + {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, + {uint32_t(spv::FunctionControlMask::MaskNone)}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {type_mgr->GetId(func_type)}}, + }; + auto func_inst = + MakeUnique(context(), spv::Op::OpFunction, + type_mgr->GetId(return_type), func_id, operands); + get_def_use_mgr()->AnalyzeInstDefUse(&*func_inst); + return MakeUnique(std::move(func_inst)); +} + +std::unique_ptr InstrumentPass::EndFunction() { + auto end = MakeUnique(context(), spv::Op::OpFunctionEnd, 0, 0, + std::initializer_list{}); + get_def_use_mgr()->AnalyzeInstDefUse(end.get()); + return end; +} + +std::vector InstrumentPass::AddParameters( + Function& func, const std::vector& param_types) { + std::vector param_ids; + param_ids.reserve(param_types.size()); + for (const analysis::Type* param : param_types) { + uint32_t pid = TakeNextId(); + param_ids.push_back(pid); + auto param_inst = + MakeUnique(context(), spv::Op::OpFunctionParameter, + context()->get_type_mgr()->GetId(param), pid, + std::initializer_list{}); + get_def_use_mgr()->AnalyzeInstDefUse(param_inst.get()); + func.AddParameter(std::move(param_inst)); + } + return param_ids; } std::unique_ptr InstrumentPass::NewName( uint32_t id, const std::string& name_str) { - std::unique_ptr new_name(new Instruction( - context(), SpvOpName, 0, 0, + return MakeUnique( + context(), spv::Op::OpName, 0, 0, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {id}}, - {SPV_OPERAND_TYPE_LITERAL_STRING, utils::MakeVector(name_str)}})); - - return new_name; + {SPV_OPERAND_TYPE_LITERAL_STRING, utils::MakeVector(name_str)}}); } std::unique_ptr InstrumentPass::NewGlobalName( @@ -123,14 +155,12 @@ std::unique_ptr InstrumentPass::NewGlobalName( std::unique_ptr InstrumentPass::NewMemberName( uint32_t id, uint32_t member_index, const std::string& name_str) { - std::unique_ptr new_name(new Instruction( - context(), SpvOpMemberName, 0, 0, + return MakeUnique( + context(), spv::Op::OpMemberName, 0, 0, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {id}}, {SPV_OPERAND_TYPE_LITERAL_INTEGER, {member_index}}, - {SPV_OPERAND_TYPE_LITERAL_STRING, utils::MakeVector(name_str)}})); - - return new_name; + {SPV_OPERAND_TYPE_LITERAL_STRING, utils::MakeVector(name_str)}}); } uint32_t InstrumentPass::Gen32BitCvtCode(uint32_t val_id, @@ -145,10 +175,10 @@ uint32_t InstrumentPass::Gen32BitCvtCode(uint32_t val_id, analysis::Type* val_32b_reg_ty = type_mgr->GetRegisteredType(&val_32b_ty); uint32_t val_32b_reg_ty_id = type_mgr->GetId(val_32b_reg_ty); if (is_signed) - return builder->AddUnaryOp(val_32b_reg_ty_id, SpvOpSConvert, val_id) + return builder->AddUnaryOp(val_32b_reg_ty_id, spv::Op::OpSConvert, val_id) ->result_id(); else - return builder->AddUnaryOp(val_32b_reg_ty_id, SpvOpUConvert, val_id) + return builder->AddUnaryOp(val_32b_reg_ty_id, spv::Op::OpUConvert, val_id) ->result_id(); } @@ -161,7 +191,7 @@ uint32_t InstrumentPass::GenUintCastCode(uint32_t val_id, uint32_t val_ty_id = get_def_use_mgr()->GetDef(val_32b_id)->type_id(); analysis::Integer* val_ty = type_mgr->GetType(val_ty_id)->AsInteger(); if (!val_ty->IsSigned()) return val_32b_id; - return builder->AddUnaryOp(GetUintId(), SpvOpBitcast, val_32b_id) + return builder->AddUnaryOp(GetUintId(), spv::Op::OpBitcast, val_32b_id) ->result_id(); } @@ -172,184 +202,143 @@ void InstrumentPass::GenDebugOutputFieldCode(uint32_t base_offset_id, // Cast value to 32-bit unsigned if necessary uint32_t val_id = GenUintCastCode(field_value_id, builder); // Store value - Instruction* data_idx_inst = - builder->AddBinaryOp(GetUintId(), SpvOpIAdd, base_offset_id, - builder->GetUintConstantId(field_offset)); + Instruction* data_idx_inst = builder->AddIAdd( + GetUintId(), base_offset_id, builder->GetUintConstantId(field_offset)); uint32_t buf_id = GetOutputBufferId(); uint32_t buf_uint_ptr_id = GetOutputBufferPtrId(); - Instruction* achain_inst = - builder->AddTernaryOp(buf_uint_ptr_id, SpvOpAccessChain, buf_id, - builder->GetUintConstantId(kDebugOutputDataOffset), - data_idx_inst->result_id()); - (void)builder->AddBinaryOp(0, SpvOpStore, achain_inst->result_id(), val_id); -} - -void InstrumentPass::GenCommonStreamWriteCode(uint32_t record_sz, - uint32_t inst_id, - uint32_t stage_idx, - uint32_t base_offset_id, - InstructionBuilder* builder) { - // Store record size - GenDebugOutputFieldCode(base_offset_id, kInstCommonOutSize, - builder->GetUintConstantId(record_sz), builder); - // Store Shader Id - GenDebugOutputFieldCode(base_offset_id, kInstCommonOutShaderId, - builder->GetUintConstantId(shader_id_), builder); - // Store Instruction Idx - GenDebugOutputFieldCode(base_offset_id, kInstCommonOutInstructionIdx, inst_id, - builder); - // Store Stage Idx - GenDebugOutputFieldCode(base_offset_id, kInstCommonOutStageIdx, - builder->GetUintConstantId(stage_idx), builder); -} - -void InstrumentPass::GenFragCoordEltDebugOutputCode( - uint32_t base_offset_id, uint32_t uint_frag_coord_id, uint32_t element, - InstructionBuilder* builder) { - Instruction* element_val_inst = builder->AddIdLiteralOp( - GetUintId(), SpvOpCompositeExtract, uint_frag_coord_id, element); - GenDebugOutputFieldCode(base_offset_id, kInstFragOutFragCoordX + element, - element_val_inst->result_id(), builder); + Instruction* achain_inst = builder->AddAccessChain( + buf_uint_ptr_id, buf_id, + {builder->GetUintConstantId(kDebugOutputDataOffset), + data_idx_inst->result_id()}); + (void)builder->AddStore(achain_inst->result_id(), val_id); } uint32_t InstrumentPass::GenVarLoad(uint32_t var_id, InstructionBuilder* builder) { Instruction* var_inst = get_def_use_mgr()->GetDef(var_id); uint32_t type_id = GetPointeeTypeId(var_inst); - Instruction* load_inst = builder->AddUnaryOp(type_id, SpvOpLoad, var_id); + Instruction* load_inst = builder->AddLoad(type_id, var_id); return load_inst->result_id(); } -void InstrumentPass::GenBuiltinOutputCode(uint32_t builtin_id, - uint32_t builtin_off, - uint32_t base_offset_id, - InstructionBuilder* builder) { - // Load and store builtin - uint32_t load_id = GenVarLoad(builtin_id, builder); - GenDebugOutputFieldCode(base_offset_id, builtin_off, load_id, builder); -} - -void InstrumentPass::GenStageStreamWriteCode(uint32_t stage_idx, - uint32_t base_offset_id, - InstructionBuilder* builder) { +uint32_t InstrumentPass::GenStageInfo(uint32_t stage_idx, + InstructionBuilder* builder) { + std::vector ids(4, builder->GetUintConstantId(0)); + ids[0] = builder->GetUintConstantId(stage_idx); + // %289 = OpCompositeConstruct %v4uint %uint_0 %285 %288 %uint_0 // TODO(greg-lunarg): Add support for all stages - switch (stage_idx) { - case SpvExecutionModelVertex: { + switch (spv::ExecutionModel(stage_idx)) { + case spv::ExecutionModel::Vertex: { // Load and store VertexId and InstanceId - GenBuiltinOutputCode( - context()->GetBuiltinInputVarId(SpvBuiltInVertexIndex), - kInstVertOutVertexIndex, base_offset_id, builder); - GenBuiltinOutputCode( - context()->GetBuiltinInputVarId(SpvBuiltInInstanceIndex), - kInstVertOutInstanceIndex, base_offset_id, builder); - } break; - case SpvExecutionModelGLCompute: - case SpvExecutionModelTaskNV: - case SpvExecutionModelMeshNV: - case SpvExecutionModelTaskEXT: - case SpvExecutionModelMeshEXT: { - // Load and store GlobalInvocationId. uint32_t load_id = GenVarLoad( - context()->GetBuiltinInputVarId(SpvBuiltInGlobalInvocationId), + context()->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::VertexIndex)), builder); - Instruction* x_inst = builder->AddIdLiteralOp( - GetUintId(), SpvOpCompositeExtract, load_id, 0); - Instruction* y_inst = builder->AddIdLiteralOp( - GetUintId(), SpvOpCompositeExtract, load_id, 1); - Instruction* z_inst = builder->AddIdLiteralOp( - GetUintId(), SpvOpCompositeExtract, load_id, 2); - GenDebugOutputFieldCode(base_offset_id, kInstCompOutGlobalInvocationIdX, - x_inst->result_id(), builder); - GenDebugOutputFieldCode(base_offset_id, kInstCompOutGlobalInvocationIdY, - y_inst->result_id(), builder); - GenDebugOutputFieldCode(base_offset_id, kInstCompOutGlobalInvocationIdZ, - z_inst->result_id(), builder); + ids[1] = GenUintCastCode(load_id, builder); + + load_id = GenVarLoad(context()->GetBuiltinInputVarId( + uint32_t(spv::BuiltIn::InstanceIndex)), + builder); + ids[2] = GenUintCastCode(load_id, builder); + } break; + case spv::ExecutionModel::GLCompute: + case spv::ExecutionModel::TaskNV: + case spv::ExecutionModel::MeshNV: + case spv::ExecutionModel::TaskEXT: + case spv::ExecutionModel::MeshEXT: { + // Load and store GlobalInvocationId. + uint32_t load_id = GenVarLoad(context()->GetBuiltinInputVarId(uint32_t( + spv::BuiltIn::GlobalInvocationId)), + builder); + for (uint32_t u = 0; u < 3u; ++u) { + ids[u + 1] = builder->AddCompositeExtract(GetUintId(), load_id, {u}) + ->result_id(); + } } break; - case SpvExecutionModelGeometry: { + case spv::ExecutionModel::Geometry: { // Load and store PrimitiveId and InvocationId. - GenBuiltinOutputCode( - context()->GetBuiltinInputVarId(SpvBuiltInPrimitiveId), - kInstGeomOutPrimitiveId, base_offset_id, builder); - GenBuiltinOutputCode( - context()->GetBuiltinInputVarId(SpvBuiltInInvocationId), - kInstGeomOutInvocationId, base_offset_id, builder); + uint32_t load_id = GenVarLoad( + context()->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::PrimitiveId)), + builder); + ids[1] = load_id; + load_id = GenVarLoad( + context()->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::InvocationId)), + builder); + ids[2] = load_id; } break; - case SpvExecutionModelTessellationControl: { + case spv::ExecutionModel::TessellationControl: { // Load and store InvocationId and PrimitiveId - GenBuiltinOutputCode( - context()->GetBuiltinInputVarId(SpvBuiltInInvocationId), - kInstTessCtlOutInvocationId, base_offset_id, builder); - GenBuiltinOutputCode( - context()->GetBuiltinInputVarId(SpvBuiltInPrimitiveId), - kInstTessCtlOutPrimitiveId, base_offset_id, builder); + uint32_t load_id = GenVarLoad( + context()->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::InvocationId)), + builder); + ids[1] = load_id; + load_id = GenVarLoad( + context()->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::PrimitiveId)), + builder); + ids[2] = load_id; } break; - case SpvExecutionModelTessellationEvaluation: { + case spv::ExecutionModel::TessellationEvaluation: { // Load and store PrimitiveId and TessCoord.uv - GenBuiltinOutputCode( - context()->GetBuiltinInputVarId(SpvBuiltInPrimitiveId), - kInstTessEvalOutPrimitiveId, base_offset_id, builder); uint32_t load_id = GenVarLoad( - context()->GetBuiltinInputVarId(SpvBuiltInTessCoord), builder); + context()->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::PrimitiveId)), + builder); + ids[1] = load_id; + load_id = GenVarLoad( + context()->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::TessCoord)), + builder); Instruction* uvec3_cast_inst = - builder->AddUnaryOp(GetVec3UintId(), SpvOpBitcast, load_id); + builder->AddUnaryOp(GetVec3UintId(), spv::Op::OpBitcast, load_id); uint32_t uvec3_cast_id = uvec3_cast_inst->result_id(); - Instruction* u_inst = builder->AddIdLiteralOp( - GetUintId(), SpvOpCompositeExtract, uvec3_cast_id, 0); - Instruction* v_inst = builder->AddIdLiteralOp( - GetUintId(), SpvOpCompositeExtract, uvec3_cast_id, 1); - GenDebugOutputFieldCode(base_offset_id, kInstTessEvalOutTessCoordU, - u_inst->result_id(), builder); - GenDebugOutputFieldCode(base_offset_id, kInstTessEvalOutTessCoordV, - v_inst->result_id(), builder); + for (uint32_t u = 0; u < 2u; ++u) { + ids[u + 2] = + builder->AddCompositeExtract(GetUintId(), uvec3_cast_id, {u}) + ->result_id(); + } } break; - case SpvExecutionModelFragment: { + case spv::ExecutionModel::Fragment: { // Load FragCoord and convert to Uint - Instruction* frag_coord_inst = builder->AddUnaryOp( - GetVec4FloatId(), SpvOpLoad, - context()->GetBuiltinInputVarId(SpvBuiltInFragCoord)); + Instruction* frag_coord_inst = builder->AddLoad( + GetVec4FloatId(), + context()->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::FragCoord))); Instruction* uint_frag_coord_inst = builder->AddUnaryOp( - GetVec4UintId(), SpvOpBitcast, frag_coord_inst->result_id()); - for (uint32_t u = 0; u < 2u; ++u) - GenFragCoordEltDebugOutputCode( - base_offset_id, uint_frag_coord_inst->result_id(), u, builder); + GetVec4UintId(), spv::Op::OpBitcast, frag_coord_inst->result_id()); + for (uint32_t u = 0; u < 2u; ++u) { + ids[u + 1] = + builder + ->AddCompositeExtract(GetUintId(), + uint_frag_coord_inst->result_id(), {u}) + ->result_id(); + } } break; - case SpvExecutionModelRayGenerationNV: - case SpvExecutionModelIntersectionNV: - case SpvExecutionModelAnyHitNV: - case SpvExecutionModelClosestHitNV: - case SpvExecutionModelMissNV: - case SpvExecutionModelCallableNV: { + case spv::ExecutionModel::RayGenerationNV: + case spv::ExecutionModel::IntersectionNV: + case spv::ExecutionModel::AnyHitNV: + case spv::ExecutionModel::ClosestHitNV: + case spv::ExecutionModel::MissNV: + case spv::ExecutionModel::CallableNV: { // Load and store LaunchIdNV. uint32_t launch_id = GenVarLoad( - context()->GetBuiltinInputVarId(SpvBuiltInLaunchIdNV), builder); - Instruction* x_launch_inst = builder->AddIdLiteralOp( - GetUintId(), SpvOpCompositeExtract, launch_id, 0); - Instruction* y_launch_inst = builder->AddIdLiteralOp( - GetUintId(), SpvOpCompositeExtract, launch_id, 1); - Instruction* z_launch_inst = builder->AddIdLiteralOp( - GetUintId(), SpvOpCompositeExtract, launch_id, 2); - GenDebugOutputFieldCode(base_offset_id, kInstRayTracingOutLaunchIdX, - x_launch_inst->result_id(), builder); - GenDebugOutputFieldCode(base_offset_id, kInstRayTracingOutLaunchIdY, - y_launch_inst->result_id(), builder); - GenDebugOutputFieldCode(base_offset_id, kInstRayTracingOutLaunchIdZ, - z_launch_inst->result_id(), builder); + context()->GetBuiltinInputVarId(uint32_t(spv::BuiltIn::LaunchIdNV)), + builder); + for (uint32_t u = 0; u < 3u; ++u) { + ids[u + 1] = builder->AddCompositeExtract(GetUintId(), launch_id, {u}) + ->result_id(); + } } break; default: { assert(false && "unsupported stage"); } break; } + return builder->AddCompositeConstruct(GetVec4UintId(), ids)->result_id(); } void InstrumentPass::GenDebugStreamWrite( - uint32_t instruction_idx, uint32_t stage_idx, + uint32_t shader_id, uint32_t instruction_idx_id, uint32_t stage_info_id, const std::vector& validation_ids, InstructionBuilder* builder) { // Call debug output function. Pass func_idx, instruction_idx and // validation ids as args. uint32_t val_id_cnt = static_cast(validation_ids.size()); - uint32_t output_func_id = GetStreamWriteFunctionId(stage_idx, val_id_cnt); - std::vector args = {output_func_id, - builder->GetUintConstantId(instruction_idx)}; + std::vector args = {shader_id, instruction_idx_id, stage_info_id}; (void)args.insert(args.end(), validation_ids.begin(), validation_ids.end()); - (void)builder->AddNaryOp(GetVoidId(), SpvOpFunctionCall, args); + (void)builder->AddFunctionCall(GetVoidId(), + GetStreamWriteFunctionId(val_id_cnt), args); } bool InstrumentPass::AllConstant(const std::vector& ids) { @@ -361,37 +350,44 @@ bool InstrumentPass::AllConstant(const std::vector& ids) { } uint32_t InstrumentPass::GenDebugDirectRead( - const std::vector& offset_ids, InstructionBuilder* ref_builder) { + const std::vector& offset_ids, InstructionBuilder* builder) { // Call debug input function. Pass func_idx and offset ids as args. - uint32_t off_id_cnt = static_cast(offset_ids.size()); - uint32_t input_func_id = GetDirectReadFunctionId(off_id_cnt); - std::vector args = {input_func_id}; - (void)args.insert(args.end(), offset_ids.begin(), offset_ids.end()); + const uint32_t off_id_cnt = static_cast(offset_ids.size()); + const uint32_t input_func_id = GetDirectReadFunctionId(off_id_cnt); + return GenReadFunctionCall(GetUintId(), input_func_id, offset_ids, builder); +} + +uint32_t InstrumentPass::GenReadFunctionCall( + uint32_t return_id, uint32_t func_id, + const std::vector& func_call_args, + InstructionBuilder* ref_builder) { // If optimizing direct reads and the call has already been generated, // use its result if (opt_direct_reads_) { - uint32_t res_id = call2id_[args]; + uint32_t res_id = call2id_[func_call_args]; if (res_id != 0) return res_id; } - // If the offsets are all constants, the call can be moved to the first block - // of the function where its result can be reused. One example where this is - // profitable is for uniform buffer references, of which there are often many. + // If the function arguments are all constants, the call can be moved to the + // first block of the function where its result can be reused. One example + // where this is profitable is for uniform buffer references, of which there + // are often many. InstructionBuilder builder(ref_builder->GetContext(), &*ref_builder->GetInsertPoint(), ref_builder->GetPreservedAnalysis()); - bool insert_in_first_block = opt_direct_reads_ && AllConstant(offset_ids); + bool insert_in_first_block = opt_direct_reads_ && AllConstant(func_call_args); if (insert_in_first_block) { Instruction* insert_before = &*curr_func_->begin()->tail(); builder.SetInsertPoint(insert_before); } uint32_t res_id = - builder.AddNaryOp(GetUintId(), SpvOpFunctionCall, args)->result_id(); - if (insert_in_first_block) call2id_[args] = res_id; + builder.AddFunctionCall(return_id, func_id, func_call_args)->result_id(); + if (insert_in_first_block) call2id_[func_call_args] = res_id; return res_id; } bool InstrumentPass::IsSameBlockOp(const Instruction* inst) const { - return inst->opcode() == SpvOpSampledImage || inst->opcode() == SpvOpImage; + return inst->opcode() == spv::Op::OpSampledImage || + inst->opcode() == spv::Op::OpImage; } void InstrumentPass::CloneSameBlockOps( @@ -457,7 +453,7 @@ void InstrumentPass::UpdateSucceedingPhis( uint32_t InstrumentPass::GetOutputBufferPtrId() { if (output_buffer_ptr_id_ == 0) { output_buffer_ptr_id_ = context()->get_type_mgr()->FindPointerToType( - GetUintId(), SpvStorageClassStorageBuffer); + GetUintId(), spv::StorageClass::StorageBuffer); } return output_buffer_ptr_id_; } @@ -470,7 +466,7 @@ uint32_t InstrumentPass::GetInputBufferTypeId() { uint32_t InstrumentPass::GetInputBufferPtrId() { if (input_buffer_ptr_id_ == 0) { input_buffer_ptr_id_ = context()->get_type_mgr()->FindPointerToType( - GetInputBufferTypeId(), SpvStorageClassStorageBuffer); + GetInputBufferTypeId(), spv::StorageClass::StorageBuffer); } return input_buffer_ptr_id_; } @@ -501,32 +497,74 @@ uint32_t InstrumentPass::GetInputBufferBinding() { return 0; } -analysis::Type* InstrumentPass::GetUintXRuntimeArrayType( - uint32_t width, analysis::Type** rarr_ty) { +analysis::Integer* InstrumentPass::GetInteger(uint32_t width, bool is_signed) { + analysis::Integer i(width, is_signed); + analysis::Type* type = context()->get_type_mgr()->GetRegisteredType(&i); + assert(type && type->AsInteger()); + return type->AsInteger(); +} + +analysis::Struct* InstrumentPass::GetStruct( + const std::vector& fields) { + analysis::Struct s(fields); + analysis::Type* type = context()->get_type_mgr()->GetRegisteredType(&s); + assert(type && type->AsStruct()); + return type->AsStruct(); +} + +analysis::RuntimeArray* InstrumentPass::GetRuntimeArray( + const analysis::Type* element) { + analysis::RuntimeArray r(element); + analysis::Type* type = context()->get_type_mgr()->GetRegisteredType(&r); + assert(type && type->AsRuntimeArray()); + return type->AsRuntimeArray(); +} + +analysis::Array* InstrumentPass::GetArray(const analysis::Type* element, + uint32_t length) { + uint32_t length_id = context()->get_constant_mgr()->GetUIntConstId(length); + analysis::Array::LengthInfo length_info{ + length_id, {analysis::Array::LengthInfo::Case::kConstant, length}}; + + analysis::Array r(element, length_info); + + analysis::Type* type = context()->get_type_mgr()->GetRegisteredType(&r); + assert(type && type->AsArray()); + return type->AsArray(); +} + +analysis::Function* InstrumentPass::GetFunction( + const analysis::Type* return_val, + const std::vector& args) { + analysis::Function func(return_val, args); + analysis::Type* type = context()->get_type_mgr()->GetRegisteredType(&func); + assert(type && type->AsFunction()); + return type->AsFunction(); +} + +analysis::RuntimeArray* InstrumentPass::GetUintXRuntimeArrayType( + uint32_t width, analysis::RuntimeArray** rarr_ty) { if (*rarr_ty == nullptr) { - analysis::DecorationManager* deco_mgr = get_decoration_mgr(); - analysis::TypeManager* type_mgr = context()->get_type_mgr(); - analysis::Integer uint_ty(width, false); - analysis::Type* reg_uint_ty = type_mgr->GetRegisteredType(&uint_ty); - analysis::RuntimeArray uint_rarr_ty_tmp(reg_uint_ty); - *rarr_ty = type_mgr->GetRegisteredType(&uint_rarr_ty_tmp); - uint32_t uint_arr_ty_id = type_mgr->GetTypeInstruction(*rarr_ty); + *rarr_ty = GetRuntimeArray(GetInteger(width, false)); + uint32_t uint_arr_ty_id = + context()->get_type_mgr()->GetTypeInstruction(*rarr_ty); // By the Vulkan spec, a pre-existing RuntimeArray of uint must be part of // a block, and will therefore be decorated with an ArrayStride. Therefore // the undecorated type returned here will not be pre-existing and can // safely be decorated. Since this type is now decorated, it is out of // sync with the TypeManager and therefore the TypeManager must be // invalidated after this pass. - assert(context()->get_def_use_mgr()->NumUses(uint_arr_ty_id) == 0 && + assert(get_def_use_mgr()->NumUses(uint_arr_ty_id) == 0 && "used RuntimeArray type returned"); - deco_mgr->AddDecorationVal(uint_arr_ty_id, SpvDecorationArrayStride, - width / 8u); + get_decoration_mgr()->AddDecorationVal( + uint_arr_ty_id, uint32_t(spv::Decoration::ArrayStride), width / 8u); } return *rarr_ty; } -analysis::Type* InstrumentPass::GetUintRuntimeArrayType(uint32_t width) { - analysis::Type** rarr_ty = +analysis::RuntimeArray* InstrumentPass::GetUintRuntimeArrayType( + uint32_t width) { + analysis::RuntimeArray** rarr_ty = (width == 64) ? &uint64_rarr_ty_ : &uint32_rarr_ty_; return GetUintXRuntimeArrayType(width, rarr_ty); } @@ -545,11 +583,10 @@ uint32_t InstrumentPass::GetOutputBufferId() { // If not created yet, create one analysis::DecorationManager* deco_mgr = get_decoration_mgr(); analysis::TypeManager* type_mgr = context()->get_type_mgr(); - analysis::Type* reg_uint_rarr_ty = GetUintRuntimeArrayType(32); - analysis::Integer uint_ty(32, false); - analysis::Type* reg_uint_ty = type_mgr->GetRegisteredType(&uint_ty); - analysis::Struct buf_ty({reg_uint_ty, reg_uint_rarr_ty}); - analysis::Type* reg_buf_ty = type_mgr->GetRegisteredType(&buf_ty); + analysis::RuntimeArray* reg_uint_rarr_ty = GetUintRuntimeArrayType(32); + analysis::Integer* reg_uint_ty = GetInteger(32, false); + analysis::Type* reg_buf_ty = + GetStruct({reg_uint_ty, reg_uint_ty, reg_uint_rarr_ty}); uint32_t obufTyId = type_mgr->GetTypeInstruction(reg_buf_ty); // By the Vulkan spec, a pre-existing struct containing a RuntimeArray // must be a block, and will therefore be decorated with Block. Therefore @@ -559,26 +596,30 @@ uint32_t InstrumentPass::GetOutputBufferId() { // invalidated after this pass. assert(context()->get_def_use_mgr()->NumUses(obufTyId) == 0 && "used struct type returned"); - deco_mgr->AddDecoration(obufTyId, SpvDecorationBlock); + deco_mgr->AddDecoration(obufTyId, uint32_t(spv::Decoration::Block)); + deco_mgr->AddMemberDecoration(obufTyId, kDebugOutputFlagsOffset, + uint32_t(spv::Decoration::Offset), 0); deco_mgr->AddMemberDecoration(obufTyId, kDebugOutputSizeOffset, - SpvDecorationOffset, 0); + uint32_t(spv::Decoration::Offset), 4); deco_mgr->AddMemberDecoration(obufTyId, kDebugOutputDataOffset, - SpvDecorationOffset, 4); + uint32_t(spv::Decoration::Offset), 8); uint32_t obufTyPtrId_ = - type_mgr->FindPointerToType(obufTyId, SpvStorageClassStorageBuffer); + type_mgr->FindPointerToType(obufTyId, spv::StorageClass::StorageBuffer); output_buffer_id_ = TakeNextId(); std::unique_ptr newVarOp(new Instruction( - context(), SpvOpVariable, obufTyPtrId_, output_buffer_id_, + context(), spv::Op::OpVariable, obufTyPtrId_, output_buffer_id_, {{spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, - {SpvStorageClassStorageBuffer}}})); + {uint32_t(spv::StorageClass::StorageBuffer)}}})); context()->AddGlobalValue(std::move(newVarOp)); context()->AddDebug2Inst(NewGlobalName(obufTyId, "OutputBuffer")); - context()->AddDebug2Inst(NewMemberName(obufTyId, 0, "written_count")); - context()->AddDebug2Inst(NewMemberName(obufTyId, 1, "data")); + context()->AddDebug2Inst(NewMemberName(obufTyId, 0, "flags")); + context()->AddDebug2Inst(NewMemberName(obufTyId, 1, "written_count")); + context()->AddDebug2Inst(NewMemberName(obufTyId, 2, "data")); context()->AddDebug2Inst(NewGlobalName(output_buffer_id_, "output_buffer")); - deco_mgr->AddDecorationVal(output_buffer_id_, SpvDecorationDescriptorSet, - desc_set_); - deco_mgr->AddDecorationVal(output_buffer_id_, SpvDecorationBinding, + deco_mgr->AddDecorationVal( + output_buffer_id_, uint32_t(spv::Decoration::DescriptorSet), desc_set_); + deco_mgr->AddDecorationVal(output_buffer_id_, + uint32_t(spv::Decoration::Binding), GetOutputBufferBinding()); AddStorageBufferExt(); if (get_module()->version() >= SPV_SPIRV_VERSION_WORD(1, 4)) { @@ -599,8 +640,7 @@ uint32_t InstrumentPass::GetInputBufferId() { analysis::TypeManager* type_mgr = context()->get_type_mgr(); uint32_t width = (validation_id_ == kInstValidationIdBuffAddr) ? 64u : 32u; analysis::Type* reg_uint_rarr_ty = GetUintRuntimeArrayType(width); - analysis::Struct buf_ty({reg_uint_rarr_ty}); - analysis::Type* reg_buf_ty = type_mgr->GetRegisteredType(&buf_ty); + analysis::Struct* reg_buf_ty = GetStruct({reg_uint_rarr_ty}); uint32_t ibufTyId = type_mgr->GetTypeInstruction(reg_buf_ty); // By the Vulkan spec, a pre-existing struct containing a RuntimeArray // must be a block, and will therefore be decorated with Block. Therefore @@ -610,22 +650,24 @@ uint32_t InstrumentPass::GetInputBufferId() { // invalidated after this pass. assert(context()->get_def_use_mgr()->NumUses(ibufTyId) == 0 && "used struct type returned"); - deco_mgr->AddDecoration(ibufTyId, SpvDecorationBlock); - deco_mgr->AddMemberDecoration(ibufTyId, 0, SpvDecorationOffset, 0); + deco_mgr->AddDecoration(ibufTyId, uint32_t(spv::Decoration::Block)); + deco_mgr->AddMemberDecoration(ibufTyId, 0, + uint32_t(spv::Decoration::Offset), 0); uint32_t ibufTyPtrId_ = - type_mgr->FindPointerToType(ibufTyId, SpvStorageClassStorageBuffer); + type_mgr->FindPointerToType(ibufTyId, spv::StorageClass::StorageBuffer); input_buffer_id_ = TakeNextId(); std::unique_ptr newVarOp(new Instruction( - context(), SpvOpVariable, ibufTyPtrId_, input_buffer_id_, + context(), spv::Op::OpVariable, ibufTyPtrId_, input_buffer_id_, {{spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, - {SpvStorageClassStorageBuffer}}})); + {uint32_t(spv::StorageClass::StorageBuffer)}}})); context()->AddGlobalValue(std::move(newVarOp)); context()->AddDebug2Inst(NewGlobalName(ibufTyId, "InputBuffer")); context()->AddDebug2Inst(NewMemberName(ibufTyId, 0, "data")); context()->AddDebug2Inst(NewGlobalName(input_buffer_id_, "input_buffer")); - deco_mgr->AddDecorationVal(input_buffer_id_, SpvDecorationDescriptorSet, - desc_set_); - deco_mgr->AddDecorationVal(input_buffer_id_, SpvDecorationBinding, + deco_mgr->AddDecorationVal( + input_buffer_id_, uint32_t(spv::Decoration::DescriptorSet), desc_set_); + deco_mgr->AddDecorationVal(input_buffer_id_, + uint32_t(spv::Decoration::Binding), GetInputBufferBinding()); AddStorageBufferExt(); if (get_module()->version() >= SPV_SPIRV_VERSION_WORD(1, 4)) { @@ -731,98 +773,102 @@ uint32_t InstrumentPass::GetVoidId() { return void_id_; } -uint32_t InstrumentPass::GetStreamWriteFunctionId(uint32_t stage_idx, - uint32_t val_spec_param_cnt) { +uint32_t InstrumentPass::GetStreamWriteFunctionId(uint32_t param_cnt) { + enum { + kShaderId = 0, + kInstructionIndex = 1, + kStageInfo = 2, + kFirstParam = 3, + }; // Total param count is common params plus validation-specific // params - uint32_t param_cnt = kInstCommonParamCnt + val_spec_param_cnt; if (param2output_func_id_[param_cnt] == 0) { // Create function param2output_func_id_[param_cnt] = TakeNextId(); analysis::TypeManager* type_mgr = context()->get_type_mgr(); - std::vector param_types; - for (uint32_t c = 0; c < param_cnt; ++c) - param_types.push_back(type_mgr->GetType(GetUintId())); - analysis::Function func_ty(type_mgr->GetType(GetVoidId()), param_types); - analysis::Type* reg_func_ty = type_mgr->GetRegisteredType(&func_ty); - std::unique_ptr func_inst( - new Instruction(get_module()->context(), SpvOpFunction, GetVoidId(), - param2output_func_id_[param_cnt], - {{spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, - {SpvFunctionControlMaskNone}}, - {spv_operand_type_t::SPV_OPERAND_TYPE_ID, - {type_mgr->GetTypeInstruction(reg_func_ty)}}})); - get_def_use_mgr()->AnalyzeInstDefUse(&*func_inst); - std::unique_ptr output_func = - MakeUnique(std::move(func_inst)); - // Add parameters - std::vector param_vec; - for (uint32_t c = 0; c < param_cnt; ++c) { - uint32_t pid = TakeNextId(); - param_vec.push_back(pid); - std::unique_ptr param_inst( - new Instruction(get_module()->context(), SpvOpFunctionParameter, - GetUintId(), pid, {})); - get_def_use_mgr()->AnalyzeInstDefUse(&*param_inst); - output_func->AddParameter(std::move(param_inst)); - } + + const analysis::Type* uint_type = GetInteger(32, false); + const analysis::Vector v4uint(uint_type, 4); + const analysis::Type* v4uint_type = type_mgr->GetRegisteredType(&v4uint); + + std::vector param_types(kFirstParam + param_cnt, + uint_type); + param_types[kStageInfo] = v4uint_type; + std::unique_ptr output_func = StartFunction( + param2output_func_id_[param_cnt], type_mgr->GetVoidType(), param_types); + + std::vector param_ids = AddParameters(*output_func, param_types); + // Create first block - uint32_t test_blk_id = TakeNextId(); - std::unique_ptr test_label(NewLabel(test_blk_id)); - std::unique_ptr new_blk_ptr = - MakeUnique(std::move(test_label)); + auto new_blk_ptr = MakeUnique(NewLabel(TakeNextId())); + InstructionBuilder builder( context(), &*new_blk_ptr, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); // Gen test if debug output buffer size will not be exceeded. - uint32_t val_spec_offset = kInstStageOutCnt; - uint32_t obuf_record_sz = val_spec_offset + val_spec_param_cnt; - uint32_t buf_id = GetOutputBufferId(); - uint32_t buf_uint_ptr_id = GetOutputBufferPtrId(); - Instruction* obuf_curr_sz_ac_inst = - builder.AddBinaryOp(buf_uint_ptr_id, SpvOpAccessChain, buf_id, - builder.GetUintConstantId(kDebugOutputSizeOffset)); + const uint32_t val_spec_offset = kInstStageOutCnt; + const uint32_t obuf_record_sz = val_spec_offset + param_cnt; + const uint32_t buf_id = GetOutputBufferId(); + const uint32_t buf_uint_ptr_id = GetOutputBufferPtrId(); + Instruction* obuf_curr_sz_ac_inst = builder.AddAccessChain( + buf_uint_ptr_id, buf_id, + {builder.GetUintConstantId(kDebugOutputSizeOffset)}); // Fetch the current debug buffer written size atomically, adding the // size of the record to be written. uint32_t obuf_record_sz_id = builder.GetUintConstantId(obuf_record_sz); - uint32_t mask_none_id = builder.GetUintConstantId(SpvMemoryAccessMaskNone); - uint32_t scope_invok_id = builder.GetUintConstantId(SpvScopeInvocation); + uint32_t mask_none_id = + builder.GetUintConstantId(uint32_t(spv::MemoryAccessMask::MaskNone)); + uint32_t scope_invok_id = + builder.GetUintConstantId(uint32_t(spv::Scope::Invocation)); Instruction* obuf_curr_sz_inst = builder.AddQuadOp( - GetUintId(), SpvOpAtomicIAdd, obuf_curr_sz_ac_inst->result_id(), + GetUintId(), spv::Op::OpAtomicIAdd, obuf_curr_sz_ac_inst->result_id(), scope_invok_id, mask_none_id, obuf_record_sz_id); uint32_t obuf_curr_sz_id = obuf_curr_sz_inst->result_id(); // Compute new written size Instruction* obuf_new_sz_inst = - builder.AddBinaryOp(GetUintId(), SpvOpIAdd, obuf_curr_sz_id, - builder.GetUintConstantId(obuf_record_sz)); + builder.AddIAdd(GetUintId(), obuf_curr_sz_id, + builder.GetUintConstantId(obuf_record_sz)); // Fetch the data bound Instruction* obuf_bnd_inst = - builder.AddIdLiteralOp(GetUintId(), SpvOpArrayLength, + builder.AddIdLiteralOp(GetUintId(), spv::Op::OpArrayLength, GetOutputBufferId(), kDebugOutputDataOffset); // Test that new written size is less than or equal to debug output // data bound Instruction* obuf_safe_inst = builder.AddBinaryOp( - GetBoolId(), SpvOpULessThanEqual, obuf_new_sz_inst->result_id(), + GetBoolId(), spv::Op::OpULessThanEqual, obuf_new_sz_inst->result_id(), obuf_bnd_inst->result_id()); uint32_t merge_blk_id = TakeNextId(); uint32_t write_blk_id = TakeNextId(); std::unique_ptr merge_label(NewLabel(merge_blk_id)); std::unique_ptr write_label(NewLabel(write_blk_id)); - (void)builder.AddConditionalBranch(obuf_safe_inst->result_id(), - write_blk_id, merge_blk_id, merge_blk_id, - SpvSelectionControlMaskNone); + (void)builder.AddConditionalBranch( + obuf_safe_inst->result_id(), write_blk_id, merge_blk_id, merge_blk_id, + uint32_t(spv::SelectionControlMask::MaskNone)); // Close safety test block and gen write block output_func->AddBasicBlock(std::move(new_blk_ptr)); new_blk_ptr = MakeUnique(std::move(write_label)); builder.SetInsertPoint(&*new_blk_ptr); // Generate common and stage-specific debug record members - GenCommonStreamWriteCode(obuf_record_sz, param_vec[kInstCommonParamInstIdx], - stage_idx, obuf_curr_sz_id, &builder); - GenStageStreamWriteCode(stage_idx, obuf_curr_sz_id, &builder); + GenDebugOutputFieldCode(obuf_curr_sz_id, kInstCommonOutSize, + builder.GetUintConstantId(obuf_record_sz), + &builder); + // Store Shader Id + GenDebugOutputFieldCode(obuf_curr_sz_id, kInstCommonOutShaderId, + param_ids[kShaderId], &builder); + // Store Instruction Idx + GenDebugOutputFieldCode(obuf_curr_sz_id, kInstCommonOutInstructionIdx, + param_ids[kInstructionIndex], &builder); + // Store stage info. Stage Idx + 3 words of stage-specific data. + for (uint32_t i = 0; i < 4; ++i) { + Instruction* field = + builder.AddCompositeExtract(GetUintId(), param_ids[kStageInfo], {i}); + GenDebugOutputFieldCode(obuf_curr_sz_id, kInstCommonOutStageIdx + i, + field->result_id(), &builder); + } // Gen writes of validation specific data - for (uint32_t i = 0; i < val_spec_param_cnt; ++i) { + for (uint32_t i = 0; i < param_cnt; ++i) { GenDebugOutputFieldCode(obuf_curr_sz_id, val_spec_offset + i, - param_vec[kInstCommonParamCnt + i], &builder); + param_ids[kFirstParam + i], &builder); } // Close write block and gen merge block (void)builder.AddBranch(merge_blk_id); @@ -830,12 +876,10 @@ uint32_t InstrumentPass::GetStreamWriteFunctionId(uint32_t stage_idx, new_blk_ptr = MakeUnique(std::move(merge_label)); builder.SetInsertPoint(&*new_blk_ptr); // Close merge block and function and add function to module - (void)builder.AddNullaryOp(0, SpvOpReturn); + (void)builder.AddNullaryOp(0, spv::Op::OpReturn); + output_func->AddBasicBlock(std::move(new_blk_ptr)); - std::unique_ptr func_end_inst( - new Instruction(get_module()->context(), SpvOpFunctionEnd, 0, 0, {})); - get_def_use_mgr()->AnalyzeInstDefUse(&*func_end_inst); - output_func->SetFunctionEnd(std::move(func_end_inst)); + output_func->SetFunctionEnd(EndFunction()); context()->AddFunction(std::move(output_func)); std::string name("stream_write_"); @@ -852,76 +896,48 @@ uint32_t InstrumentPass::GetDirectReadFunctionId(uint32_t param_cnt) { if (func_id != 0) return func_id; // Create input function for param_cnt. func_id = TakeNextId(); - analysis::TypeManager* type_mgr = context()->get_type_mgr(); - std::vector param_types; - for (uint32_t c = 0; c < param_cnt; ++c) - param_types.push_back(type_mgr->GetType(GetUintId())); - uint32_t ibuf_type_id = GetInputBufferTypeId(); - analysis::Function func_ty(type_mgr->GetType(ibuf_type_id), param_types); - analysis::Type* reg_func_ty = type_mgr->GetRegisteredType(&func_ty); - std::unique_ptr func_inst(new Instruction( - get_module()->context(), SpvOpFunction, ibuf_type_id, func_id, - {{spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, - {SpvFunctionControlMaskNone}}, - {spv_operand_type_t::SPV_OPERAND_TYPE_ID, - {type_mgr->GetTypeInstruction(reg_func_ty)}}})); - get_def_use_mgr()->AnalyzeInstDefUse(&*func_inst); + analysis::Integer* uint_type = GetInteger(32, false); + std::vector param_types(param_cnt, uint_type); + std::unique_ptr input_func = - MakeUnique(std::move(func_inst)); - // Add parameters - std::vector param_vec; - for (uint32_t c = 0; c < param_cnt; ++c) { - uint32_t pid = TakeNextId(); - param_vec.push_back(pid); - std::unique_ptr param_inst(new Instruction( - get_module()->context(), SpvOpFunctionParameter, GetUintId(), pid, {})); - get_def_use_mgr()->AnalyzeInstDefUse(&*param_inst); - input_func->AddParameter(std::move(param_inst)); - } + StartFunction(func_id, uint_type, param_types); + std::vector param_ids = AddParameters(*input_func, param_types); + // Create block - uint32_t blk_id = TakeNextId(); - std::unique_ptr blk_label(NewLabel(blk_id)); - std::unique_ptr new_blk_ptr = - MakeUnique(std::move(blk_label)); + auto new_blk_ptr = MakeUnique(NewLabel(TakeNextId())); InstructionBuilder builder( context(), &*new_blk_ptr, IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); // For each offset parameter, generate new offset with parameter, adding last // loaded value if it exists, and load value from input buffer at new offset. // Return last loaded value. + uint32_t ibuf_type_id = GetInputBufferTypeId(); uint32_t buf_id = GetInputBufferId(); uint32_t buf_ptr_id = GetInputBufferPtrId(); uint32_t last_value_id = 0; for (uint32_t p = 0; p < param_cnt; ++p) { uint32_t offset_id; if (p == 0) { - offset_id = param_vec[0]; + offset_id = param_ids[0]; } else { if (ibuf_type_id != GetUintId()) { - Instruction* ucvt_inst = - builder.AddUnaryOp(GetUintId(), SpvOpUConvert, last_value_id); - last_value_id = ucvt_inst->result_id(); + last_value_id = + builder.AddUnaryOp(GetUintId(), spv::Op::OpUConvert, last_value_id) + ->result_id(); } - Instruction* offset_inst = builder.AddBinaryOp( - GetUintId(), SpvOpIAdd, last_value_id, param_vec[p]); - offset_id = offset_inst->result_id(); + offset_id = builder.AddIAdd(GetUintId(), last_value_id, param_ids[p]) + ->result_id(); } - Instruction* ac_inst = builder.AddTernaryOp( - buf_ptr_id, SpvOpAccessChain, buf_id, - builder.GetUintConstantId(kDebugInputDataOffset), offset_id); - Instruction* load_inst = - builder.AddUnaryOp(ibuf_type_id, SpvOpLoad, ac_inst->result_id()); - last_value_id = load_inst->result_id(); + Instruction* ac_inst = builder.AddAccessChain( + buf_ptr_id, buf_id, + {builder.GetUintConstantId(kDebugInputDataOffset), offset_id}); + last_value_id = + builder.AddLoad(ibuf_type_id, ac_inst->result_id())->result_id(); } - (void)builder.AddInstruction(MakeUnique( - context(), SpvOpReturnValue, 0, 0, - std::initializer_list{{SPV_OPERAND_TYPE_ID, {last_value_id}}})); + (void)builder.AddUnaryOp(0, spv::Op::OpReturnValue, last_value_id); // Close block and function and add function to module input_func->AddBasicBlock(std::move(new_blk_ptr)); - std::unique_ptr func_end_inst( - new Instruction(get_module()->context(), SpvOpFunctionEnd, 0, 0, {})); - get_def_use_mgr()->AnalyzeInstDefUse(&*func_end_inst); - input_func->SetFunctionEnd(std::move(func_end_inst)); + input_func->SetFunctionEnd(EndFunction()); context()->AddFunction(std::move(input_func)); std::string name("direct_read_"); @@ -970,7 +986,7 @@ bool InstrumentPass::InstrumentFunction(Function* func, uint32_t stage_idx, // block. This will allow function calls to be inserted into the first // block without interfering with the instrumentation algorithm. if (opt_direct_reads_ && !first_block_split) { - if (ii->opcode() != SpvOpVariable) { + if (ii->opcode() != spv::Op::OpVariable) { SplitBlock(ii, bi, &new_blks); first_block_split = true; } @@ -1001,7 +1017,9 @@ bool InstrumentPass::InstrumentFunction(Function* func, uint32_t stage_idx, // Restart instrumenting at beginning of last new block, // but skip over any new phi or copy instruction. ii = bi->begin(); - if (ii->opcode() == SpvOpPhi || ii->opcode() == SpvOpCopyObject) ++ii; + if (ii->opcode() == spv::Op::OpPhi || + ii->opcode() == spv::Op::OpCopyObject) + ++ii; new_blks.clear(); } } @@ -1039,35 +1057,24 @@ bool InstrumentPass::InstProcessEntryPointCallTree(InstProcessFunction& pfn) { // one model per module. In such cases we will need // to clone any functions which are in the call trees of entrypoints // with differing execution models. - uint32_t ecnt = 0; - uint32_t stage = SpvExecutionModelMax; - for (auto& e : get_module()->entry_points()) { - if (ecnt == 0) - stage = e.GetSingleWordInOperand(kEntryPointExecutionModelInIdx); - else if (e.GetSingleWordInOperand(kEntryPointExecutionModelInIdx) != - stage) { - if (consumer()) { - std::string message = "Mixed stage shader module not supported"; - consumer()(SPV_MSG_ERROR, 0, {0, 0, 0}, message.c_str()); - } - return false; - } - ++ecnt; - } + spv::ExecutionModel stage = context()->GetStage(); // Check for supported stages - if (stage != SpvExecutionModelVertex && stage != SpvExecutionModelFragment && - stage != SpvExecutionModelGeometry && - stage != SpvExecutionModelGLCompute && - stage != SpvExecutionModelTessellationControl && - stage != SpvExecutionModelTessellationEvaluation && - stage != SpvExecutionModelTaskNV && stage != SpvExecutionModelMeshNV && - stage != SpvExecutionModelRayGenerationNV && - stage != SpvExecutionModelIntersectionNV && - stage != SpvExecutionModelAnyHitNV && - stage != SpvExecutionModelClosestHitNV && - stage != SpvExecutionModelMissNV && - stage != SpvExecutionModelCallableNV && - stage != SpvExecutionModelTaskEXT && stage != SpvExecutionModelMeshEXT) { + if (stage != spv::ExecutionModel::Vertex && + stage != spv::ExecutionModel::Fragment && + stage != spv::ExecutionModel::Geometry && + stage != spv::ExecutionModel::GLCompute && + stage != spv::ExecutionModel::TessellationControl && + stage != spv::ExecutionModel::TessellationEvaluation && + stage != spv::ExecutionModel::TaskNV && + stage != spv::ExecutionModel::MeshNV && + stage != spv::ExecutionModel::RayGenerationNV && + stage != spv::ExecutionModel::IntersectionNV && + stage != spv::ExecutionModel::AnyHitNV && + stage != spv::ExecutionModel::ClosestHitNV && + stage != spv::ExecutionModel::MissNV && + stage != spv::ExecutionModel::CallableNV && + stage != spv::ExecutionModel::TaskEXT && + stage != spv::ExecutionModel::MeshEXT) { if (consumer()) { std::string message = "Stage not supported by instrumentation"; consumer()(SPV_MSG_ERROR, 0, {0, 0, 0}, message.c_str()); @@ -1079,7 +1086,7 @@ bool InstrumentPass::InstProcessEntryPointCallTree(InstProcessFunction& pfn) { for (auto& e : get_module()->entry_points()) { roots.push(e.GetSingleWordInOperand(kEntryPointFunctionIdInIdx)); } - bool modified = InstProcessCallTreeFromRoots(pfn, &roots, stage); + bool modified = InstProcessCallTreeFromRoots(pfn, &roots, uint32_t(stage)); return modified; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/instrument_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/instrument_pass.h index 215b0263..092b361d 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/instrument_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/instrument_pass.h @@ -55,13 +55,14 @@ namespace spvtools { namespace opt { - +namespace { // Validation Ids // These are used to identify the general validation being done and map to // its output buffers. -static const uint32_t kInstValidationIdBindless = 0; -static const uint32_t kInstValidationIdBuffAddr = 1; -static const uint32_t kInstValidationIdDebugPrintf = 2; +constexpr uint32_t kInstValidationIdBindless = 0; +constexpr uint32_t kInstValidationIdBuffAddr = 1; +constexpr uint32_t kInstValidationIdDebugPrintf = 2; +} // namespace class InstrumentPass : public Pass { using cbb_ptr = const BasicBlock*; @@ -195,7 +196,8 @@ class InstrumentPass : public Pass { // Because the code that is generated checks against the size of the buffer // before writing, the size of the debug out buffer can be used by the // validation layer to control the number of error records that are written. - void GenDebugStreamWrite(uint32_t instruction_idx, uint32_t stage_idx, + void GenDebugStreamWrite(uint32_t shader_id, uint32_t instruction_idx_id, + uint32_t stage_info_id, const std::vector& validation_ids, InstructionBuilder* builder); @@ -213,6 +215,10 @@ class InstrumentPass : public Pass { uint32_t GenDebugDirectRead(const std::vector& offset_ids, InstructionBuilder* builder); + uint32_t GenReadFunctionCall(uint32_t return_id, uint32_t func_id, + const std::vector& args, + InstructionBuilder* builder); + // Generate code to convert integer |value_id| to 32bit, if needed. Return // an id to the 32bit equivalent. uint32_t Gen32BitCvtCode(uint32_t value_id, InstructionBuilder* builder); @@ -221,6 +227,15 @@ class InstrumentPass : public Pass { // Return an id to the Uint equivalent. uint32_t GenUintCastCode(uint32_t value_id, InstructionBuilder* builder); + std::unique_ptr StartFunction( + uint32_t func_id, const analysis::Type* return_type, + const std::vector& param_types); + + std::vector AddParameters( + Function& func, const std::vector& param_types); + + std::unique_ptr EndFunction(); + // Return new label. std::unique_ptr NewLabel(uint32_t label_id); @@ -252,12 +267,21 @@ class InstrumentPass : public Pass { // Return id for void type uint32_t GetVoidId(); + // Get registered type structures + analysis::Integer* GetInteger(uint32_t width, bool is_signed); + analysis::Struct* GetStruct(const std::vector& fields); + analysis::RuntimeArray* GetRuntimeArray(const analysis::Type* element); + analysis::Array* GetArray(const analysis::Type* element, uint32_t size); + analysis::Function* GetFunction( + const analysis::Type* return_val, + const std::vector& args); + // Return pointer to type for runtime array of uint - analysis::Type* GetUintXRuntimeArrayType(uint32_t width, - analysis::Type** rarr_ty); + analysis::RuntimeArray* GetUintXRuntimeArrayType( + uint32_t width, analysis::RuntimeArray** rarr_ty); // Return pointer to type for runtime array of uint - analysis::Type* GetUintRuntimeArrayType(uint32_t width); + analysis::RuntimeArray* GetUintRuntimeArrayType(uint32_t width); // Return id for buffer uint type uint32_t GetOutputBufferPtrId(); @@ -300,8 +324,7 @@ class InstrumentPass : public Pass { // Return id for output function. Define if it doesn't exist with // |val_spec_param_cnt| validation-specific uint32 parameters. - uint32_t GetStreamWriteFunctionId(uint32_t stage_idx, - uint32_t val_spec_param_cnt); + uint32_t GetStreamWriteFunctionId(uint32_t val_spec_param_cnt); // Return id for input function taking |param_cnt| uint32 parameters. Define // if it doesn't exist. @@ -317,8 +340,8 @@ class InstrumentPass : public Pass { // If code is generated for an instruction, replace the instruction's // block with the new blocks that are generated. Continue processing at the // top of the last new block. - bool InstrumentFunction(Function* func, uint32_t stage_idx, - InstProcessFunction& pfn); + virtual bool InstrumentFunction(Function* func, uint32_t stage_idx, + InstProcessFunction& pfn); // Call |pfn| on all functions in the call tree of the function // ids in |roots|. @@ -332,34 +355,11 @@ class InstrumentPass : public Pass { uint32_t field_value_id, InstructionBuilder* builder); - // Generate instructions into |builder| which will write the members - // of the debug output record common for all stages and validations at - // |base_off|. - void GenCommonStreamWriteCode(uint32_t record_sz, uint32_t instruction_idx, - uint32_t stage_idx, uint32_t base_off, - InstructionBuilder* builder); - - // Generate instructions into |builder| which will write - // |uint_frag_coord_id| at |component| of the record at |base_offset_id| of - // the debug output buffer . - void GenFragCoordEltDebugOutputCode(uint32_t base_offset_id, - uint32_t uint_frag_coord_id, - uint32_t component, - InstructionBuilder* builder); - // Generate instructions into |builder| which will load |var_id| and return // its result id. uint32_t GenVarLoad(uint32_t var_id, InstructionBuilder* builder); - // Generate instructions into |builder| which will load the uint |builtin_id| - // and write it into the debug output buffer at |base_off| + |builtin_off|. - void GenBuiltinOutputCode(uint32_t builtin_id, uint32_t builtin_off, - uint32_t base_off, InstructionBuilder* builder); - - // Generate instructions into |builder| which will write the |stage_idx|- - // specific members of the debug output stream at |base_off|. - void GenStageStreamWriteCode(uint32_t stage_idx, uint32_t base_off, - InstructionBuilder* builder); + uint32_t GenStageInfo(uint32_t stage_idx, InstructionBuilder* builder); // Return true if instruction must be in the same block that its result // is used. @@ -447,10 +447,10 @@ class InstrumentPass : public Pass { bool storage_buffer_ext_defined_; // runtime array of uint type - analysis::Type* uint64_rarr_ty_; + analysis::RuntimeArray* uint64_rarr_ty_; // runtime array of uint type - analysis::Type* uint32_rarr_ty_; + analysis::RuntimeArray* uint32_rarr_ty_; // Pre-instrumentation same-block insts std::unordered_map same_block_pre_; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/interface_var_sroa.cpp b/bgfx/3rdparty/spirv-tools/source/opt/interface_var_sroa.cpp index 1b2cb363..08477cbd 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/interface_var_sroa.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/interface_var_sroa.cpp @@ -23,29 +23,28 @@ #include "source/opt/type_manager.h" #include "source/util/make_unique.h" -const static uint32_t kOpDecorateDecorationInOperandIndex = 1; -const static uint32_t kOpDecorateLiteralInOperandIndex = 2; -const static uint32_t kOpEntryPointInOperandInterface = 3; -const static uint32_t kOpVariableStorageClassInOperandIndex = 0; -const static uint32_t kOpTypeArrayElemTypeInOperandIndex = 0; -const static uint32_t kOpTypeArrayLengthInOperandIndex = 1; -const static uint32_t kOpTypeMatrixColCountInOperandIndex = 1; -const static uint32_t kOpTypeMatrixColTypeInOperandIndex = 0; -const static uint32_t kOpTypePtrTypeInOperandIndex = 1; -const static uint32_t kOpConstantValueInOperandIndex = 0; - namespace spvtools { namespace opt { namespace { +constexpr uint32_t kOpDecorateDecorationInOperandIndex = 1; +constexpr uint32_t kOpDecorateLiteralInOperandIndex = 2; +constexpr uint32_t kOpEntryPointInOperandInterface = 3; +constexpr uint32_t kOpVariableStorageClassInOperandIndex = 0; +constexpr uint32_t kOpTypeArrayElemTypeInOperandIndex = 0; +constexpr uint32_t kOpTypeArrayLengthInOperandIndex = 1; +constexpr uint32_t kOpTypeMatrixColCountInOperandIndex = 1; +constexpr uint32_t kOpTypeMatrixColTypeInOperandIndex = 0; +constexpr uint32_t kOpTypePtrTypeInOperandIndex = 1; +constexpr uint32_t kOpConstantValueInOperandIndex = 0; // Get the length of the OpTypeArray |array_type|. uint32_t GetArrayLength(analysis::DefUseManager* def_use_mgr, Instruction* array_type) { - assert(array_type->opcode() == SpvOpTypeArray); + assert(array_type->opcode() == spv::Op::OpTypeArray); uint32_t const_int_id = array_type->GetSingleWordInOperand(kOpTypeArrayLengthInOperandIndex); Instruction* array_length_inst = def_use_mgr->GetDef(const_int_id); - assert(array_length_inst->opcode() == SpvOpConstant); + assert(array_length_inst->opcode() == spv::Op::OpConstant); return array_length_inst->GetSingleWordInOperand( kOpConstantValueInOperandIndex); } @@ -53,7 +52,7 @@ uint32_t GetArrayLength(analysis::DefUseManager* def_use_mgr, // Get the element type instruction of the OpTypeArray |array_type|. Instruction* GetArrayElementType(analysis::DefUseManager* def_use_mgr, Instruction* array_type) { - assert(array_type->opcode() == SpvOpTypeArray); + assert(array_type->opcode() == spv::Op::OpTypeArray); uint32_t elem_type_id = array_type->GetSingleWordInOperand(kOpTypeArrayElemTypeInOperandIndex); return def_use_mgr->GetDef(elem_type_id); @@ -62,7 +61,7 @@ Instruction* GetArrayElementType(analysis::DefUseManager* def_use_mgr, // Get the column type instruction of the OpTypeMatrix |matrix_type|. Instruction* GetMatrixColumnType(analysis::DefUseManager* def_use_mgr, Instruction* matrix_type) { - assert(matrix_type->opcode() == SpvOpTypeMatrix); + assert(matrix_type->opcode() == spv::Op::OpTypeMatrix); uint32_t column_type_id = matrix_type->GetSingleWordInOperand(kOpTypeMatrixColTypeInOperandIndex); return def_use_mgr->GetDef(column_type_id); @@ -77,14 +76,14 @@ uint32_t GetComponentTypeOfArrayMatrix(analysis::DefUseManager* def_use_mgr, if (depth_to_component == 0) return type_id; Instruction* type_inst = def_use_mgr->GetDef(type_id); - if (type_inst->opcode() == SpvOpTypeArray) { + if (type_inst->opcode() == spv::Op::OpTypeArray) { uint32_t elem_type_id = type_inst->GetSingleWordInOperand(kOpTypeArrayElemTypeInOperandIndex); return GetComponentTypeOfArrayMatrix(def_use_mgr, elem_type_id, depth_to_component - 1); } - assert(type_inst->opcode() == SpvOpTypeMatrix); + assert(type_inst->opcode() == spv::Op::OpTypeMatrix); uint32_t column_type_id = type_inst->GetSingleWordInOperand(kOpTypeMatrixColTypeInOperandIndex); return GetComponentTypeOfArrayMatrix(def_use_mgr, column_type_id, @@ -94,7 +93,7 @@ uint32_t GetComponentTypeOfArrayMatrix(analysis::DefUseManager* def_use_mgr, // Creates an OpDecorate instruction whose Target is |var_id| and Decoration is // |decoration|. Adds |literal| as an extra operand of the instruction. void CreateDecoration(analysis::DecorationManager* decoration_mgr, - uint32_t var_id, SpvDecoration decoration, + uint32_t var_id, spv::Decoration decoration, uint32_t literal) { std::vector operands({ {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {var_id}}, @@ -102,7 +101,7 @@ void CreateDecoration(analysis::DecorationManager* decoration_mgr, {static_cast(decoration)}}, {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, {literal}}, }); - decoration_mgr->AddDecoration(SpvOpDecorate, std::move(operands)); + decoration_mgr->AddDecoration(spv::Op::OpDecorate, std::move(operands)); } // Replaces load instructions with composite construct instructions in all the @@ -128,8 +127,8 @@ void ReplaceLoadWithCompositeConstruct( } // Returns the storage class of the instruction |var|. -SpvStorageClass GetStorageClass(Instruction* var) { - return static_cast( +spv::StorageClass GetStorageClass(Instruction* var) { + return static_cast( var->GetSingleWordInOperand(kOpVariableStorageClassInOperandIndex)); } @@ -137,16 +136,17 @@ SpvStorageClass GetStorageClass(Instruction* var) { bool InterfaceVariableScalarReplacement::HasExtraArrayness( Instruction& entry_point, Instruction* var) { - SpvExecutionModel execution_model = - static_cast(entry_point.GetSingleWordInOperand(0)); - if (execution_model != SpvExecutionModelTessellationEvaluation && - execution_model != SpvExecutionModelTessellationControl) { + spv::ExecutionModel execution_model = + static_cast(entry_point.GetSingleWordInOperand(0)); + if (execution_model != spv::ExecutionModel::TessellationEvaluation && + execution_model != spv::ExecutionModel::TessellationControl) { return false; } - if (!context()->get_decoration_mgr()->HasDecoration(var->result_id(), - SpvDecorationPatch)) { - if (execution_model == SpvExecutionModelTessellationControl) return true; - return GetStorageClass(var) != SpvStorageClassOutput; + if (!context()->get_decoration_mgr()->HasDecoration( + var->result_id(), uint32_t(spv::Decoration::Patch))) { + if (execution_model == spv::ExecutionModel::TessellationControl) + return true; + return GetStorageClass(var) != spv::StorageClass::Output; } return false; } @@ -163,7 +163,7 @@ bool InterfaceVariableScalarReplacement:: bool InterfaceVariableScalarReplacement::GetVariableLocation( Instruction* var, uint32_t* location) { return !context()->get_decoration_mgr()->WhileEachDecoration( - var->result_id(), SpvDecorationLocation, + var->result_id(), uint32_t(spv::Decoration::Location), [location](const Instruction& inst) { *location = inst.GetSingleWordInOperand(kOpDecorateLiteralInOperandIndex); @@ -174,7 +174,7 @@ bool InterfaceVariableScalarReplacement::GetVariableLocation( bool InterfaceVariableScalarReplacement::GetVariableComponent( Instruction* var, uint32_t* component) { return !context()->get_decoration_mgr()->WhileEachDecoration( - var->result_id(), SpvDecorationComponent, + var->result_id(), uint32_t(spv::Decoration::Component), [component](const Instruction& inst) { *component = inst.GetSingleWordInOperand(kOpDecorateLiteralInOperandIndex); @@ -190,11 +190,11 @@ InterfaceVariableScalarReplacement::CollectInterfaceVariables( i < entry_point.NumInOperands(); ++i) { Instruction* interface_var = context()->get_def_use_mgr()->GetDef( entry_point.GetSingleWordInOperand(i)); - assert(interface_var->opcode() == SpvOpVariable); + assert(interface_var->opcode() == spv::Op::OpVariable); - SpvStorageClass storage_class = GetStorageClass(interface_var); - if (storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { + spv::StorageClass storage_class = GetStorageClass(interface_var); + if (storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { continue; } @@ -205,10 +205,10 @@ InterfaceVariableScalarReplacement::CollectInterfaceVariables( void InterfaceVariableScalarReplacement::KillInstructionAndUsers( Instruction* inst) { - if (inst->opcode() == SpvOpEntryPoint) { + if (inst->opcode() == spv::Op::OpEntryPoint) { return; } - if (inst->opcode() != SpvOpAccessChain) { + if (inst->opcode() != spv::Op::OpAccessChain) { context()->KillInst(inst); return; } @@ -232,10 +232,10 @@ void InterfaceVariableScalarReplacement::KillLocationAndComponentDecorations( uint32_t var_id) { context()->get_decoration_mgr()->RemoveDecorationsFrom( var_id, [](const Instruction& inst) { - uint32_t decoration = - inst.GetSingleWordInOperand(kOpDecorateDecorationInOperandIndex); - return decoration == SpvDecorationLocation || - decoration == SpvDecorationComponent; + spv::Decoration decoration = spv::Decoration( + inst.GetSingleWordInOperand(kOpDecorateDecorationInOperandIndex)); + return decoration == spv::Decoration::Location || + decoration == spv::Decoration::Component; }); } @@ -307,9 +307,9 @@ void InterfaceVariableScalarReplacement::AddLocationAndComponentDecorations( if (!vars.HasMultipleComponents()) { uint32_t var_id = vars.GetComponentVariable()->result_id(); CreateDecoration(context()->get_decoration_mgr(), var_id, - SpvDecorationLocation, *location); + spv::Decoration::Location, *location); CreateDecoration(context()->get_decoration_mgr(), var_id, - SpvDecorationComponent, component); + spv::Decoration::Component, component); ++(*location); return; } @@ -389,15 +389,15 @@ bool InterfaceVariableScalarReplacement::ReplaceComponentOfInterfaceVarWith( std::unordered_map* loads_to_component_values, std::unordered_map* loads_for_access_chain_to_component_values) { - SpvOp opcode = interface_var_user->opcode(); - if (opcode == SpvOpStore) { + spv::Op opcode = interface_var_user->opcode(); + if (opcode == spv::Op::OpStore) { uint32_t value_id = interface_var_user->GetSingleWordInOperand(1); StoreComponentOfValueToScalarVar(value_id, interface_var_component_indices, scalar_var, extra_array_index, interface_var_user); return true; } - if (opcode == SpvOpLoad) { + if (opcode == spv::Op::OpLoad) { Instruction* scalar_load = LoadScalarVar(scalar_var, extra_array_index, interface_var_user); loads_to_component_values->insert({interface_var_user, scalar_load}); @@ -408,25 +408,25 @@ bool InterfaceVariableScalarReplacement::ReplaceComponentOfInterfaceVarWith( // them only for the first element of the extra array. if (extra_array_index && *extra_array_index != 0) return true; - if (opcode == SpvOpDecorateId || opcode == SpvOpDecorateString || - opcode == SpvOpDecorate) { + if (opcode == spv::Op::OpDecorateId || opcode == spv::Op::OpDecorateString || + opcode == spv::Op::OpDecorate) { CloneAnnotationForVariable(interface_var_user, scalar_var->result_id()); return true; } - if (opcode == SpvOpName) { + if (opcode == spv::Op::OpName) { std::unique_ptr new_inst(interface_var_user->Clone(context())); new_inst->SetInOperand(0, {scalar_var->result_id()}); context()->AddDebug2Inst(std::move(new_inst)); return true; } - if (opcode == SpvOpEntryPoint) { + if (opcode == spv::Op::OpEntryPoint) { return ReplaceInterfaceVarInEntryPoint(interface_var, interface_var_user, scalar_var->result_id()); } - if (opcode == SpvOpAccessChain) { + if (opcode == spv::Op::OpAccessChain) { ReplaceAccessChainWith(interface_var_user, interface_var_component_indices, scalar_var, loads_for_access_chain_to_component_values); @@ -445,8 +445,8 @@ bool InterfaceVariableScalarReplacement::ReplaceComponentOfInterfaceVarWith( void InterfaceVariableScalarReplacement::UseBaseAccessChainForAccessChain( Instruction* access_chain, Instruction* base_access_chain) { - assert(base_access_chain->opcode() == SpvOpAccessChain && - access_chain->opcode() == SpvOpAccessChain && + assert(base_access_chain->opcode() == spv::Op::OpAccessChain && + access_chain->opcode() == spv::Op::OpAccessChain && access_chain->GetSingleWordInOperand(0) == base_access_chain->result_id()); Instruction::OperandList new_operands; @@ -470,10 +470,10 @@ Instruction* InterfaceVariableScalarReplacement::CreateAccessChainToVar( uint32_t ptr_type_id = GetPointerType(*component_type_id, GetStorageClass(var)); - std::unique_ptr new_access_chain( - new Instruction(context(), SpvOpAccessChain, ptr_type_id, TakeNextId(), - std::initializer_list{ - {SPV_OPERAND_TYPE_ID, {var->result_id()}}})); + std::unique_ptr new_access_chain(new Instruction( + context(), spv::Op::OpAccessChain, ptr_type_id, TakeNextId(), + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {var->result_id()}}})); for (uint32_t index_id : index_ids) { new_access_chain->AddOperand({SPV_OPERAND_TYPE_ID, {index_id}}); } @@ -489,13 +489,13 @@ Instruction* InterfaceVariableScalarReplacement::CreateAccessChainWithIndex( Instruction* insert_before) { uint32_t ptr_type_id = GetPointerType(component_type_id, GetStorageClass(var)); - uint32_t index_id = context()->get_constant_mgr()->GetUIntConst(index); - std::unique_ptr new_access_chain( - new Instruction(context(), SpvOpAccessChain, ptr_type_id, TakeNextId(), - std::initializer_list{ - {SPV_OPERAND_TYPE_ID, {var->result_id()}}, - {SPV_OPERAND_TYPE_ID, {index_id}}, - })); + uint32_t index_id = context()->get_constant_mgr()->GetUIntConstId(index); + std::unique_ptr new_access_chain(new Instruction( + context(), spv::Op::OpAccessChain, ptr_type_id, TakeNextId(), + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {var->result_id()}}, + {SPV_OPERAND_TYPE_ID, {index_id}}, + })); Instruction* inst = new_access_chain.get(); context()->get_def_use_mgr()->AnalyzeInstDefUse(inst); insert_before->InsertBefore(std::move(new_access_chain)); @@ -519,20 +519,20 @@ void InterfaceVariableScalarReplacement::ReplaceAccessChainWith( [this, access_chain, &indexes, &interface_var_component_indices, scalar_var, loads_to_component_values](Instruction* user) { switch (user->opcode()) { - case SpvOpAccessChain: { + case spv::Op::OpAccessChain: { UseBaseAccessChainForAccessChain(user, access_chain); ReplaceAccessChainWith(user, interface_var_component_indices, scalar_var, loads_to_component_values); return; } - case SpvOpStore: { + case spv::Op::OpStore: { uint32_t value_id = user->GetSingleWordInOperand(1); StoreComponentOfValueToAccessChainToScalarVar( value_id, interface_var_component_indices, scalar_var, indexes, user); return; } - case SpvOpLoad: { + case spv::Op::OpLoad: { Instruction* value = LoadAccessChainToVar(scalar_var, indexes, user); loads_to_component_values->insert({user, value}); @@ -546,9 +546,9 @@ void InterfaceVariableScalarReplacement::ReplaceAccessChainWith( void InterfaceVariableScalarReplacement::CloneAnnotationForVariable( Instruction* annotation_inst, uint32_t var_id) { - assert(annotation_inst->opcode() == SpvOpDecorate || - annotation_inst->opcode() == SpvOpDecorateId || - annotation_inst->opcode() == SpvOpDecorateString); + assert(annotation_inst->opcode() == spv::Op::OpDecorate || + annotation_inst->opcode() == spv::Op::OpDecorateId || + annotation_inst->opcode() == spv::Op::OpDecorateString); std::unique_ptr new_inst(annotation_inst->Clone(context())); new_inst->SetInOperand(0, {var_id}); context()->AddAnnotationInst(std::move(new_inst)); @@ -593,13 +593,13 @@ bool InterfaceVariableScalarReplacement::ReplaceInterfaceVarInEntryPoint( uint32_t InterfaceVariableScalarReplacement::GetPointeeTypeIdOfVar( Instruction* var) { - assert(var->opcode() == SpvOpVariable); + assert(var->opcode() == spv::Op::OpVariable); uint32_t ptr_type_id = var->type_id(); analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); Instruction* ptr_type_inst = def_use_mgr->GetDef(ptr_type_id); - assert(ptr_type_inst->opcode() == SpvOpTypePointer && + assert(ptr_type_inst->opcode() == spv::Op::OpTypePointer && "Variable must have a pointer type."); return ptr_type_inst->GetSingleWordInOperand(kOpTypePtrTypeInOperandIndex); } @@ -643,7 +643,7 @@ Instruction* InterfaceVariableScalarReplacement::LoadScalarVar( Instruction* InterfaceVariableScalarReplacement::CreateLoad( uint32_t type_id, Instruction* ptr, Instruction* insert_before) { std::unique_ptr load( - new Instruction(context(), SpvOpLoad, type_id, TakeNextId(), + new Instruction(context(), spv::Op::OpLoad, type_id, TakeNextId(), std::initializer_list{ {SPV_OPERAND_TYPE_ID, {ptr->result_id()}}})); Instruction* load_inst = load.get(); @@ -660,7 +660,7 @@ void InterfaceVariableScalarReplacement::StoreComponentOfValueTo( component_type_id, value_id, component_indices, extra_array_index)); std::unique_ptr new_store( - new Instruction(context(), SpvOpStore)); + new Instruction(context(), spv::Op::OpStore)); new_store->AddOperand({SPV_OPERAND_TYPE_ID, {ptr->result_id()}}); new_store->AddOperand( {SPV_OPERAND_TYPE_ID, {composite_extract->result_id()}}); @@ -678,7 +678,7 @@ Instruction* InterfaceVariableScalarReplacement::CreateCompositeExtract( const std::vector& indexes, const uint32_t* extra_first_index) { uint32_t component_id = TakeNextId(); Instruction* composite_extract = new Instruction( - context(), SpvOpCompositeExtract, type_id, component_id, + context(), spv::Op::OpCompositeExtract, type_id, component_id, std::initializer_list{{SPV_OPERAND_TYPE_ID, {composite_id}}}); if (extra_first_index) { composite_extract->AddOperand( @@ -731,8 +731,8 @@ InterfaceVariableScalarReplacement::CreateCompositeConstructForComponentOfLoad( depth_to_component); } uint32_t new_id = context()->TakeNextId(); - std::unique_ptr new_composite_construct( - new Instruction(context(), SpvOpCompositeConstruct, type_id, new_id, {})); + std::unique_ptr new_composite_construct(new Instruction( + context(), spv::Op::OpCompositeConstruct, type_id, new_id, {})); Instruction* composite_construct = new_composite_construct.get(); def_use_mgr->AnalyzeInstDefUse(composite_construct); @@ -781,7 +781,7 @@ uint32_t InterfaceVariableScalarReplacement::GetArrayType( uint32_t elem_type_id, uint32_t array_length) { analysis::Type* elem_type = context()->get_type_mgr()->GetType(elem_type_id); uint32_t array_length_id = - context()->get_constant_mgr()->GetUIntConst(array_length); + context()->get_constant_mgr()->GetUIntConstId(array_length); analysis::Array array_type( elem_type, analysis::Array::LengthInfo{array_length_id, {0, array_length}}); @@ -789,7 +789,7 @@ uint32_t InterfaceVariableScalarReplacement::GetArrayType( } uint32_t InterfaceVariableScalarReplacement::GetPointerType( - uint32_t type_id, SpvStorageClass storage_class) { + uint32_t type_id, spv::StorageClass storage_class) { analysis::Type* type = context()->get_type_mgr()->GetType(type_id); analysis::Pointer ptr_type(type, storage_class); return context()->get_type_mgr()->GetTypeInstruction(&ptr_type); @@ -797,9 +797,9 @@ uint32_t InterfaceVariableScalarReplacement::GetPointerType( InterfaceVariableScalarReplacement::NestedCompositeComponents InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForArray( - Instruction* interface_var_type, SpvStorageClass storage_class, + Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length) { - assert(interface_var_type->opcode() == SpvOpTypeArray); + assert(interface_var_type->opcode() == spv::Op::OpTypeArray); analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); uint32_t array_length = GetArrayLength(def_use_mgr, interface_var_type); @@ -818,9 +818,9 @@ InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForArray( InterfaceVariableScalarReplacement::NestedCompositeComponents InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForMatrix( - Instruction* interface_var_type, SpvStorageClass storage_class, + Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length) { - assert(interface_var_type->opcode() == SpvOpTypeMatrix); + assert(interface_var_type->opcode() == spv::Op::OpTypeMatrix); analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); uint32_t column_count = interface_var_type->GetSingleWordInOperand( @@ -841,16 +841,16 @@ InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForMatrix( InterfaceVariableScalarReplacement::NestedCompositeComponents InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForReplacement( - Instruction* interface_var_type, SpvStorageClass storage_class, + Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length) { // Handle array case. - if (interface_var_type->opcode() == SpvOpTypeArray) { + if (interface_var_type->opcode() == spv::Op::OpTypeArray) { return CreateScalarInterfaceVarsForArray(interface_var_type, storage_class, extra_array_length); } // Handle matrix case. - if (interface_var_type->opcode() == SpvOpTypeMatrix) { + if (interface_var_type->opcode() == spv::Op::OpTypeMatrix) { return CreateScalarInterfaceVarsForMatrix(interface_var_type, storage_class, extra_array_length); } @@ -865,7 +865,7 @@ InterfaceVariableScalarReplacement::CreateScalarInterfaceVarsForReplacement( context()->get_type_mgr()->FindPointerToType(type_id, storage_class); uint32_t id = TakeNextId(); std::unique_ptr variable( - new Instruction(context(), SpvOpVariable, ptr_type_id, id, + new Instruction(context(), spv::Op::OpVariable, ptr_type_id, id, std::initializer_list{ {SPV_OPERAND_TYPE_STORAGE_CLASS, {static_cast(storage_class)}}})); @@ -948,8 +948,8 @@ InterfaceVariableScalarReplacement::ReplaceInterfaceVarsWithScalars( return Pass::Status::Failure; } - if (interface_var_type->opcode() != SpvOpTypeArray && - interface_var_type->opcode() != SpvOpTypeMatrix) { + if (interface_var_type->opcode() != spv::Op::OpTypeArray && + interface_var_type->opcode() != spv::Op::OpTypeMatrix) { continue; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/interface_var_sroa.h b/bgfx/3rdparty/spirv-tools/source/opt/interface_var_sroa.h index 23baad0a..45ed3717 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/interface_var_sroa.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/interface_var_sroa.h @@ -90,10 +90,6 @@ class InterfaceVariableScalarReplacement : public Pass { // |component|. Returns true whether the component exists or not. bool GetVariableComponent(Instruction* var, uint32_t* component); - // Returns the interface variable instruction whose result id is - // |interface_var_id|. - Instruction* GetInterfaceVariable(uint32_t interface_var_id); - // Returns the type of |var| as an instruction. Instruction* GetTypeOfVariable(Instruction* var); @@ -115,7 +111,7 @@ class InterfaceVariableScalarReplacement : public Pass { // |extra_array_length| is not zero, adds the extra arrayness to the created // scalar variables. NestedCompositeComponents CreateScalarInterfaceVarsForReplacement( - Instruction* interface_var_type, SpvStorageClass storage_class, + Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length); // Creates scalar variables with the storage classe |storage_class| to replace @@ -123,7 +119,7 @@ class InterfaceVariableScalarReplacement : public Pass { // If |extra_array_length| is not zero, adds the extra arrayness to all the // scalar variables. NestedCompositeComponents CreateScalarInterfaceVarsForArray( - Instruction* interface_var_type, SpvStorageClass storage_class, + Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length); // Creates scalar variables with the storage classe |storage_class| to replace @@ -131,7 +127,7 @@ class InterfaceVariableScalarReplacement : public Pass { // with. If |extra_array_length| is not zero, adds the extra arrayness to all // the scalar variables. NestedCompositeComponents CreateScalarInterfaceVarsForMatrix( - Instruction* interface_var_type, SpvStorageClass storage_class, + Instruction* interface_var_type, spv::StorageClass storage_class, uint32_t extra_array_length); // Recursively adds Location and Component decorations to variables in @@ -345,7 +341,7 @@ class InterfaceVariableScalarReplacement : public Pass { // Returns the result id of OpTypePointer instrunction whose Type // operand is |type_id| and Storage Class operand is |storage_class|. - uint32_t GetPointerType(uint32_t type_id, SpvStorageClass storage_class); + uint32_t GetPointerType(uint32_t type_id, spv::StorageClass storage_class); // Kills an instrunction |inst| and its users. void KillInstructionAndUsers(Instruction* inst); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/interp_fixup_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/interp_fixup_pass.cpp index e8cdd99f..2ec2147d 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/interp_fixup_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/interp_fixup_pass.cpp @@ -19,17 +19,15 @@ #include #include -#include "ir_builder.h" #include "source/opt/ir_context.h" #include "type_manager.h" namespace spvtools { namespace opt { - namespace { // Input Operand Indices -static const int kSpvVariableStorageClassInIdx = 0; +constexpr int kSpvVariableStorageClassInIdx = 0; // Folding rule function which attempts to replace |op(OpLoad(a),...)| // by |op(a,...)|, where |op| is one of the GLSLstd450 InterpolateAt* @@ -45,12 +43,12 @@ bool ReplaceInternalInterpolate(IRContext* ctx, Instruction* inst, uint32_t op1_id = inst->GetSingleWordInOperand(2); Instruction* load_inst = ctx->get_def_use_mgr()->GetDef(op1_id); - if (load_inst->opcode() != SpvOpLoad) return false; + if (load_inst->opcode() != spv::Op::OpLoad) return false; Instruction* base_inst = load_inst->GetBaseAddress(); - USE_ASSERT(base_inst->opcode() == SpvOpVariable && - base_inst->GetSingleWordInOperand(kSpvVariableStorageClassInIdx) == - SpvStorageClassInput && + USE_ASSERT(base_inst->opcode() == spv::Op::OpVariable && + spv::StorageClass(base_inst->GetSingleWordInOperand( + kSpvVariableStorageClassInIdx)) == spv::StorageClass::Input && "unexpected interpolant in InterpolateAt*"); uint32_t ptr_id = load_inst->GetSingleWordInOperand(0); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/ir_builder.h b/bgfx/3rdparty/spirv-tools/source/opt/ir_builder.h index 9d4fa8fe..f3e0afce 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/ir_builder.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/ir_builder.h @@ -30,7 +30,7 @@ namespace opt { // In SPIR-V, ids are encoded as uint16_t, this id is guaranteed to be always // invalid. -const uint32_t kInvalidId = std::numeric_limits::max(); +constexpr uint32_t kInvalidId = std::numeric_limits::max(); // Helper class to abstract instruction construction and insertion. // The instruction builder can preserve the following analyses (specified via @@ -58,7 +58,7 @@ class InstructionBuilder { : InstructionBuilder(context, parent_block, parent_block->end(), preserved_analyses) {} - Instruction* AddNullaryOp(uint32_t type_id, SpvOp opcode) { + Instruction* AddNullaryOp(uint32_t type_id, spv::Op opcode) { uint32_t result_id = 0; if (type_id != 0) { result_id = GetContext()->TakeNextId(); @@ -71,7 +71,7 @@ class InstructionBuilder { return AddInstruction(std::move(new_inst)); } - Instruction* AddUnaryOp(uint32_t type_id, SpvOp opcode, uint32_t operand1) { + Instruction* AddUnaryOp(uint32_t type_id, spv::Op opcode, uint32_t operand1) { uint32_t result_id = 0; if (type_id != 0) { result_id = GetContext()->TakeNextId(); @@ -85,7 +85,7 @@ class InstructionBuilder { return AddInstruction(std::move(newUnOp)); } - Instruction* AddBinaryOp(uint32_t type_id, SpvOp opcode, uint32_t operand1, + Instruction* AddBinaryOp(uint32_t type_id, spv::Op opcode, uint32_t operand1, uint32_t operand2) { uint32_t result_id = 0; if (type_id != 0) { @@ -95,13 +95,14 @@ class InstructionBuilder { } } std::unique_ptr newBinOp(new Instruction( - GetContext(), opcode, type_id, opcode == SpvOpStore ? 0 : result_id, + GetContext(), opcode, type_id, + opcode == spv::Op::OpStore ? 0 : result_id, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {operand1}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {operand2}}})); return AddInstruction(std::move(newBinOp)); } - Instruction* AddTernaryOp(uint32_t type_id, SpvOp opcode, uint32_t operand1, + Instruction* AddTernaryOp(uint32_t type_id, spv::Op opcode, uint32_t operand1, uint32_t operand2, uint32_t operand3) { uint32_t result_id = 0; if (type_id != 0) { @@ -118,7 +119,7 @@ class InstructionBuilder { return AddInstruction(std::move(newTernOp)); } - Instruction* AddQuadOp(uint32_t type_id, SpvOp opcode, uint32_t operand1, + Instruction* AddQuadOp(uint32_t type_id, spv::Op opcode, uint32_t operand1, uint32_t operand2, uint32_t operand3, uint32_t operand4) { uint32_t result_id = 0; @@ -137,7 +138,7 @@ class InstructionBuilder { return AddInstruction(std::move(newQuadOp)); } - Instruction* AddIdLiteralOp(uint32_t type_id, SpvOp opcode, uint32_t id, + Instruction* AddIdLiteralOp(uint32_t type_id, spv::Op opcode, uint32_t id, uint32_t uliteral) { uint32_t result_id = 0; if (type_id != 0) { @@ -157,7 +158,7 @@ class InstructionBuilder { // |typid| must be the id of the instruction's type. // |operands| must be a sequence of operand ids. // Use |result| for the result id if non-zero. - Instruction* AddNaryOp(uint32_t type_id, SpvOp opcode, + Instruction* AddNaryOp(uint32_t type_id, spv::Op opcode, const std::vector& operands, uint32_t result = 0) { std::vector ops; @@ -174,10 +175,10 @@ class InstructionBuilder { // Creates a new selection merge instruction. // The id |merge_id| is the merge basic block id. Instruction* AddSelectionMerge( - uint32_t merge_id, - uint32_t selection_control = SpvSelectionControlMaskNone) { + uint32_t merge_id, uint32_t selection_control = static_cast( + spv::SelectionControlMask::MaskNone)) { std::unique_ptr new_branch_merge(new Instruction( - GetContext(), SpvOpSelectionMerge, 0, 0, + GetContext(), spv::Op::OpSelectionMerge, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {merge_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_SELECTION_CONTROL, {selection_control}}})); @@ -189,9 +190,10 @@ class InstructionBuilder { // |continue_id| is the id of the continue block. // |loop_control| are the loop control flags to be added to the instruction. Instruction* AddLoopMerge(uint32_t merge_id, uint32_t continue_id, - uint32_t loop_control = SpvLoopControlMaskNone) { + uint32_t loop_control = static_cast( + spv::LoopControlMask::MaskNone)) { std::unique_ptr new_branch_merge(new Instruction( - GetContext(), SpvOpLoopMerge, 0, 0, + GetContext(), spv::Op::OpLoopMerge, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {merge_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {continue_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_LOOP_CONTROL, {loop_control}}})); @@ -203,7 +205,7 @@ class InstructionBuilder { // well formed. Instruction* AddBranch(uint32_t label_id) { std::unique_ptr new_branch(new Instruction( - GetContext(), SpvOpBranch, 0, 0, + GetContext(), spv::Op::OpBranch, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {label_id}}})); return AddInstruction(std::move(new_branch)); } @@ -226,12 +228,13 @@ class InstructionBuilder { Instruction* AddConditionalBranch( uint32_t cond_id, uint32_t true_id, uint32_t false_id, uint32_t merge_id = kInvalidId, - uint32_t selection_control = SpvSelectionControlMaskNone) { + uint32_t selection_control = + static_cast(spv::SelectionControlMask::MaskNone)) { if (merge_id != kInvalidId) { AddSelectionMerge(merge_id, selection_control); } std::unique_ptr new_branch(new Instruction( - GetContext(), SpvOpBranchConditional, 0, 0, + GetContext(), spv::Op::OpBranchConditional, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {cond_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {true_id}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {false_id}}})); @@ -255,7 +258,8 @@ class InstructionBuilder { uint32_t selector_id, uint32_t default_id, const std::vector>& targets, uint32_t merge_id = kInvalidId, - uint32_t selection_control = SpvSelectionControlMaskNone) { + uint32_t selection_control = + static_cast(spv::SelectionControlMask::MaskNone)) { if (merge_id != kInvalidId) { AddSelectionMerge(merge_id, selection_control); } @@ -272,7 +276,7 @@ class InstructionBuilder { Operand{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {target.second}}); } std::unique_ptr new_switch( - new Instruction(GetContext(), SpvOpSwitch, 0, 0, operands)); + new Instruction(GetContext(), spv::Op::OpSwitch, 0, 0, operands)); return AddInstruction(std::move(new_switch)); } @@ -283,7 +287,7 @@ class InstructionBuilder { Instruction* AddPhi(uint32_t type, const std::vector& incomings, uint32_t result = 0) { assert(incomings.size() % 2 == 0 && "A sequence of pairs is expected"); - return AddNaryOp(type, SpvOpPhi, incomings, result); + return AddNaryOp(type, spv::Op::OpPhi, incomings, result); } // Creates an addition instruction. @@ -294,7 +298,7 @@ class InstructionBuilder { Instruction* AddIAdd(uint32_t type, uint32_t op1, uint32_t op2) { // TODO(1841): Handle id overflow. std::unique_ptr inst(new Instruction( - GetContext(), SpvOpIAdd, type, GetContext()->TakeNextId(), + GetContext(), spv::Op::OpIAdd, type, GetContext()->TakeNextId(), {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}})); return AddInstruction(std::move(inst)); } @@ -308,7 +312,7 @@ class InstructionBuilder { uint32_t type = GetContext()->get_type_mgr()->GetId(&bool_type); // TODO(1841): Handle id overflow. std::unique_ptr inst(new Instruction( - GetContext(), SpvOpULessThan, type, GetContext()->TakeNextId(), + GetContext(), spv::Op::OpULessThan, type, GetContext()->TakeNextId(), {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}})); return AddInstruction(std::move(inst)); } @@ -322,7 +326,7 @@ class InstructionBuilder { uint32_t type = GetContext()->get_type_mgr()->GetId(&bool_type); // TODO(1841): Handle id overflow. std::unique_ptr inst(new Instruction( - GetContext(), SpvOpSLessThan, type, GetContext()->TakeNextId(), + GetContext(), spv::Op::OpSLessThan, type, GetContext()->TakeNextId(), {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}})); return AddInstruction(std::move(inst)); } @@ -352,7 +356,7 @@ class InstructionBuilder { uint32_t false_value) { // TODO(1841): Handle id overflow. std::unique_ptr select(new Instruction( - GetContext(), SpvOpSelect, type, GetContext()->TakeNextId(), + GetContext(), spv::Op::OpSelect, type, GetContext()->TakeNextId(), std::initializer_list{{SPV_OPERAND_TYPE_ID, {cond}}, {SPV_OPERAND_TYPE_ID, {true_value}}, {SPV_OPERAND_TYPE_ID, {false_value}}})); @@ -378,7 +382,7 @@ class InstructionBuilder { } // TODO(1841): Handle id overflow. std::unique_ptr construct( - new Instruction(GetContext(), SpvOpCompositeConstruct, type, + new Instruction(GetContext(), spv::Op::OpCompositeConstruct, type, GetContext()->TakeNextId(), ops)); return AddInstruction(std::move(construct)); } @@ -436,6 +440,22 @@ class InstructionBuilder { return GetContext()->get_constant_mgr()->GetDefiningInstruction(constant); } + Instruction* GetBoolConstant(bool value) { + analysis::Bool type; + uint32_t type_id = GetContext()->get_type_mgr()->GetTypeInstruction(&type); + analysis::Type* rebuilt_type = + GetContext()->get_type_mgr()->GetType(type_id); + uint32_t word = value; + const analysis::Constant* constant = + GetContext()->get_constant_mgr()->GetConstant(rebuilt_type, {word}); + return GetContext()->get_constant_mgr()->GetDefiningInstruction(constant); + } + + uint32_t GetBoolConstantId(bool value) { + Instruction* inst = GetBoolConstant(value); + return (inst != nullptr ? inst->result_id() : 0); + } + Instruction* AddCompositeExtract(uint32_t type, uint32_t id_of_composite, const std::vector& index_list) { std::vector operands; @@ -447,7 +467,7 @@ class InstructionBuilder { // TODO(1841): Handle id overflow. std::unique_ptr new_inst( - new Instruction(GetContext(), SpvOpCompositeExtract, type, + new Instruction(GetContext(), spv::Op::OpCompositeExtract, type, GetContext()->TakeNextId(), operands)); return AddInstruction(std::move(new_inst)); } @@ -455,7 +475,7 @@ class InstructionBuilder { // Creates an unreachable instruction. Instruction* AddUnreachable() { std::unique_ptr select( - new Instruction(GetContext(), SpvOpUnreachable, 0, 0, + new Instruction(GetContext(), spv::Op::OpUnreachable, 0, 0, std::initializer_list{})); return AddInstruction(std::move(select)); } @@ -471,18 +491,25 @@ class InstructionBuilder { // TODO(1841): Handle id overflow. std::unique_ptr new_inst( - new Instruction(GetContext(), SpvOpAccessChain, type_id, + new Instruction(GetContext(), spv::Op::OpAccessChain, type_id, GetContext()->TakeNextId(), operands)); return AddInstruction(std::move(new_inst)); } - Instruction* AddLoad(uint32_t type_id, uint32_t base_ptr_id) { + Instruction* AddLoad(uint32_t type_id, uint32_t base_ptr_id, + uint32_t alignment = 0) { std::vector operands; operands.push_back({SPV_OPERAND_TYPE_ID, {base_ptr_id}}); + if (alignment != 0) { + operands.push_back( + {SPV_OPERAND_TYPE_MEMORY_ACCESS, + {static_cast(spv::MemoryAccessMask::Aligned)}}); + operands.push_back({SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, {alignment}}); + } // TODO(1841): Handle id overflow. std::unique_ptr new_inst( - new Instruction(GetContext(), SpvOpLoad, type_id, + new Instruction(GetContext(), spv::Op::OpLoad, type_id, GetContext()->TakeNextId(), operands)); return AddInstruction(std::move(new_inst)); } @@ -491,7 +518,7 @@ class InstructionBuilder { std::vector operands; operands.push_back({SPV_OPERAND_TYPE_ID, {storage_class}}); std::unique_ptr new_inst( - new Instruction(GetContext(), SpvOpVariable, type_id, + new Instruction(GetContext(), spv::Op::OpVariable, type_id, GetContext()->TakeNextId(), operands)); return AddInstruction(std::move(new_inst)); } @@ -502,7 +529,7 @@ class InstructionBuilder { operands.push_back({SPV_OPERAND_TYPE_ID, {obj_id}}); std::unique_ptr new_inst( - new Instruction(GetContext(), SpvOpStore, 0, 0, operands)); + new Instruction(GetContext(), spv::Op::OpStore, 0, 0, operands)); return AddInstruction(std::move(new_inst)); } @@ -518,8 +545,9 @@ class InstructionBuilder { if (result_id == 0) { return nullptr; } - std::unique_ptr new_inst(new Instruction( - GetContext(), SpvOpFunctionCall, result_type, result_id, operands)); + std::unique_ptr new_inst( + new Instruction(GetContext(), spv::Op::OpFunctionCall, result_type, + result_id, operands)); return AddInstruction(std::move(new_inst)); } @@ -538,8 +566,9 @@ class InstructionBuilder { return nullptr; } - std::unique_ptr new_inst(new Instruction( - GetContext(), SpvOpVectorShuffle, result_type, result_id, operands)); + std::unique_ptr new_inst( + new Instruction(GetContext(), spv::Op::OpVectorShuffle, result_type, + result_id, operands)); return AddInstruction(std::move(new_inst)); } @@ -560,7 +589,7 @@ class InstructionBuilder { } std::unique_ptr new_inst(new Instruction( - GetContext(), SpvOpExtInst, result_type, result_id, operands)); + GetContext(), spv::Op::OpExtInst, result_type, result_id, operands)); return AddInstruction(std::move(new_inst)); } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/ir_context.cpp b/bgfx/3rdparty/spirv-tools/source/opt/ir_context.cpp index c9c3f1b5..239d316c 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/ir_context.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/ir_context.cpp @@ -19,26 +19,23 @@ #include "OpenCLDebugInfo100.h" #include "source/latest_version_glsl_std_450_header.h" #include "source/opt/log.h" -#include "source/opt/mem_pass.h" #include "source/opt/reflect.h" +namespace spvtools { +namespace opt { namespace { - -static const int kSpvDecorateTargetIdInIdx = 0; -static const int kSpvDecorateDecorationInIdx = 1; -static const int kSpvDecorateBuiltinInIdx = 2; -static const int kEntryPointInterfaceInIdx = 3; -static const int kEntryPointFunctionIdInIdx = 1; +constexpr int kSpvDecorateTargetIdInIdx = 0; +constexpr int kSpvDecorateDecorationInIdx = 1; +constexpr int kSpvDecorateBuiltinInIdx = 2; +constexpr int kEntryPointInterfaceInIdx = 3; +constexpr int kEntryPointFunctionIdInIdx = 1; +constexpr int kEntryPointExecutionModelInIdx = 0; // Constants for OpenCL.DebugInfo.100 / NonSemantic.Shader.DebugInfo.100 // extension instructions. -static const uint32_t kDebugFunctionOperandFunctionIndex = 13; -static const uint32_t kDebugGlobalVariableOperandVariableIndex = 11; - -} // anonymous namespace - -namespace spvtools { -namespace opt { +constexpr uint32_t kDebugFunctionOperandFunctionIndex = 13; +constexpr uint32_t kDebugGlobalVariableOperandVariableIndex = 11; +} // namespace void IRContext::BuildInvalidAnalyses(IRContext::Analysis set) { set = Analysis(set & ~valid_analyses_); @@ -152,6 +149,9 @@ void IRContext::InvalidateAnalyses(IRContext::Analysis analyses_to_invalidate) { if (analyses_to_invalidate & kAnalysisConstants) { constant_mgr_.reset(nullptr); } + if (analyses_to_invalidate & kAnalysisLiveness) { + liveness_mgr_.reset(nullptr); + } if (analyses_to_invalidate & kAnalysisTypes) { type_mgr_.reset(nullptr); } @@ -195,7 +195,8 @@ Instruction* IRContext::KillInst(Instruction* inst) { if (constant_mgr_ && IsConstantInst(inst->opcode())) { constant_mgr_->RemoveId(inst->result_id()); } - if (inst->opcode() == SpvOpCapability || inst->opcode() == SpvOpExtension) { + if (inst->opcode() == spv::Op::OpCapability || + inst->opcode() == spv::Op::OpExtension) { // We reset the feature manager, instead of updating it, because it is just // as much work. We would have to remove all capabilities implied by this // capability that are not also implied by the remaining OpCapability @@ -219,6 +220,28 @@ Instruction* IRContext::KillInst(Instruction* inst) { return next_instruction; } +bool IRContext::KillInstructionIf(Module::inst_iterator begin, + Module::inst_iterator end, + std::function condition) { + bool removed = false; + for (auto it = begin; it != end;) { + if (!condition(&*it)) { + ++it; + continue; + } + + removed = true; + // `it` is an iterator on an intrusive list. Next is invalidated on the + // current node when an instruction is killed. The iterator must be moved + // forward before deleting the node. + auto instruction = &*it; + ++it; + KillInst(instruction); + } + + return removed; +} + void IRContext::CollectNonSemanticTree( Instruction* inst, std::unordered_set* to_kill) { if (!inst->HasResultId()) return; @@ -250,6 +273,36 @@ bool IRContext::KillDef(uint32_t id) { return false; } +bool IRContext::RemoveCapability(spv::Capability capability) { + const bool removed = KillInstructionIf( + module()->capability_begin(), module()->capability_end(), + [capability](Instruction* inst) { + return static_cast(inst->GetSingleWordOperand(0)) == + capability; + }); + + if (removed && feature_mgr_ != nullptr) { + feature_mgr_->RemoveCapability(capability); + } + + return removed; +} + +bool IRContext::RemoveExtension(Extension extension) { + const std::string_view extensionName = ExtensionToString(extension); + const bool removed = KillInstructionIf( + module()->extension_begin(), module()->extension_end(), + [&extensionName](Instruction* inst) { + return inst->GetOperand(0).AsString() == extensionName; + }); + + if (removed && feature_mgr_ != nullptr) { + feature_mgr_->RemoveExtension(extension); + } + + return removed; +} + bool IRContext::ReplaceAllUsesWith(uint32_t before, uint32_t after) { return ReplaceAllUsesWithPredicate(before, after, [](Instruction*) { return true; }); @@ -398,8 +451,8 @@ void IRContext::AnalyzeUses(Instruction* inst) { if (AreAnalysesValid(kAnalysisDebugInfo)) { get_debug_info_mgr()->AnalyzeDebugInst(inst); } - if (id_to_name_ && - (inst->opcode() == SpvOpName || inst->opcode() == SpvOpMemberName)) { + if (id_to_name_ && (inst->opcode() == spv::Op::OpName || + inst->opcode() == spv::Op::OpMemberName)) { id_to_name_->insert({inst->GetSingleWordInOperand(0), inst}); } } @@ -427,7 +480,7 @@ void IRContext::KillOperandFromDebugInstructions(Instruction* inst) { const auto opcode = inst->opcode(); const uint32_t id = inst->result_id(); // Kill id of OpFunction from DebugFunction. - if (opcode == SpvOpFunction) { + if (opcode == spv::Op::OpFunction) { for (auto it = module()->ext_inst_debuginfo_begin(); it != module()->ext_inst_debuginfo_end(); ++it) { if (it->GetOpenCL100DebugOpcode() != OpenCLDebugInfo100DebugFunction) @@ -441,7 +494,7 @@ void IRContext::KillOperandFromDebugInstructions(Instruction* inst) { } } // Kill id of OpVariable for global variable from DebugGlobalVariable. - if (opcode == SpvOpVariable || IsConstantInst(opcode)) { + if (opcode == spv::Op::OpVariable || IsConstantInst(opcode)) { for (auto it = module()->ext_inst_debuginfo_begin(); it != module()->ext_inst_debuginfo_end(); ++it) { if (it->GetCommonDebugOpcode() != CommonDebugInfoDebugGlobalVariable) @@ -457,255 +510,259 @@ void IRContext::KillOperandFromDebugInstructions(Instruction* inst) { } void IRContext::AddCombinatorsForCapability(uint32_t capability) { - if (capability == SpvCapabilityShader) { - combinator_ops_[0].insert({SpvOpNop, - SpvOpUndef, - SpvOpConstant, - SpvOpConstantTrue, - SpvOpConstantFalse, - SpvOpConstantComposite, - SpvOpConstantSampler, - SpvOpConstantNull, - SpvOpTypeVoid, - SpvOpTypeBool, - SpvOpTypeInt, - SpvOpTypeFloat, - SpvOpTypeVector, - SpvOpTypeMatrix, - SpvOpTypeImage, - SpvOpTypeSampler, - SpvOpTypeSampledImage, - SpvOpTypeAccelerationStructureNV, - SpvOpTypeAccelerationStructureKHR, - SpvOpTypeRayQueryKHR, - SpvOpTypeArray, - SpvOpTypeRuntimeArray, - SpvOpTypeStruct, - SpvOpTypeOpaque, - SpvOpTypePointer, - SpvOpTypeFunction, - SpvOpTypeEvent, - SpvOpTypeDeviceEvent, - SpvOpTypeReserveId, - SpvOpTypeQueue, - SpvOpTypePipe, - SpvOpTypeForwardPointer, - SpvOpVariable, - SpvOpImageTexelPointer, - SpvOpLoad, - SpvOpAccessChain, - SpvOpInBoundsAccessChain, - SpvOpArrayLength, - SpvOpVectorExtractDynamic, - SpvOpVectorInsertDynamic, - SpvOpVectorShuffle, - SpvOpCompositeConstruct, - SpvOpCompositeExtract, - SpvOpCompositeInsert, - SpvOpCopyObject, - SpvOpTranspose, - SpvOpSampledImage, - SpvOpImageSampleImplicitLod, - SpvOpImageSampleExplicitLod, - SpvOpImageSampleDrefImplicitLod, - SpvOpImageSampleDrefExplicitLod, - SpvOpImageSampleProjImplicitLod, - SpvOpImageSampleProjExplicitLod, - SpvOpImageSampleProjDrefImplicitLod, - SpvOpImageSampleProjDrefExplicitLod, - SpvOpImageFetch, - SpvOpImageGather, - SpvOpImageDrefGather, - SpvOpImageRead, - SpvOpImage, - SpvOpImageQueryFormat, - SpvOpImageQueryOrder, - SpvOpImageQuerySizeLod, - SpvOpImageQuerySize, - SpvOpImageQueryLevels, - SpvOpImageQuerySamples, - SpvOpConvertFToU, - SpvOpConvertFToS, - SpvOpConvertSToF, - SpvOpConvertUToF, - SpvOpUConvert, - SpvOpSConvert, - SpvOpFConvert, - SpvOpQuantizeToF16, - SpvOpBitcast, - SpvOpSNegate, - SpvOpFNegate, - SpvOpIAdd, - SpvOpFAdd, - SpvOpISub, - SpvOpFSub, - SpvOpIMul, - SpvOpFMul, - SpvOpUDiv, - SpvOpSDiv, - SpvOpFDiv, - SpvOpUMod, - SpvOpSRem, - SpvOpSMod, - SpvOpFRem, - SpvOpFMod, - SpvOpVectorTimesScalar, - SpvOpMatrixTimesScalar, - SpvOpVectorTimesMatrix, - SpvOpMatrixTimesVector, - SpvOpMatrixTimesMatrix, - SpvOpOuterProduct, - SpvOpDot, - SpvOpIAddCarry, - SpvOpISubBorrow, - SpvOpUMulExtended, - SpvOpSMulExtended, - SpvOpAny, - SpvOpAll, - SpvOpIsNan, - SpvOpIsInf, - SpvOpLogicalEqual, - SpvOpLogicalNotEqual, - SpvOpLogicalOr, - SpvOpLogicalAnd, - SpvOpLogicalNot, - SpvOpSelect, - SpvOpIEqual, - SpvOpINotEqual, - SpvOpUGreaterThan, - SpvOpSGreaterThan, - SpvOpUGreaterThanEqual, - SpvOpSGreaterThanEqual, - SpvOpULessThan, - SpvOpSLessThan, - SpvOpULessThanEqual, - SpvOpSLessThanEqual, - SpvOpFOrdEqual, - SpvOpFUnordEqual, - SpvOpFOrdNotEqual, - SpvOpFUnordNotEqual, - SpvOpFOrdLessThan, - SpvOpFUnordLessThan, - SpvOpFOrdGreaterThan, - SpvOpFUnordGreaterThan, - SpvOpFOrdLessThanEqual, - SpvOpFUnordLessThanEqual, - SpvOpFOrdGreaterThanEqual, - SpvOpFUnordGreaterThanEqual, - SpvOpShiftRightLogical, - SpvOpShiftRightArithmetic, - SpvOpShiftLeftLogical, - SpvOpBitwiseOr, - SpvOpBitwiseXor, - SpvOpBitwiseAnd, - SpvOpNot, - SpvOpBitFieldInsert, - SpvOpBitFieldSExtract, - SpvOpBitFieldUExtract, - SpvOpBitReverse, - SpvOpBitCount, - SpvOpPhi, - SpvOpImageSparseSampleImplicitLod, - SpvOpImageSparseSampleExplicitLod, - SpvOpImageSparseSampleDrefImplicitLod, - SpvOpImageSparseSampleDrefExplicitLod, - SpvOpImageSparseSampleProjImplicitLod, - SpvOpImageSparseSampleProjExplicitLod, - SpvOpImageSparseSampleProjDrefImplicitLod, - SpvOpImageSparseSampleProjDrefExplicitLod, - SpvOpImageSparseFetch, - SpvOpImageSparseGather, - SpvOpImageSparseDrefGather, - SpvOpImageSparseTexelsResident, - SpvOpImageSparseRead, - SpvOpSizeOf}); + spv::Capability cap = spv::Capability(capability); + if (cap == spv::Capability::Shader) { + combinator_ops_[0].insert( + {(uint32_t)spv::Op::OpNop, + (uint32_t)spv::Op::OpUndef, + (uint32_t)spv::Op::OpConstant, + (uint32_t)spv::Op::OpConstantTrue, + (uint32_t)spv::Op::OpConstantFalse, + (uint32_t)spv::Op::OpConstantComposite, + (uint32_t)spv::Op::OpConstantSampler, + (uint32_t)spv::Op::OpConstantNull, + (uint32_t)spv::Op::OpTypeVoid, + (uint32_t)spv::Op::OpTypeBool, + (uint32_t)spv::Op::OpTypeInt, + (uint32_t)spv::Op::OpTypeFloat, + (uint32_t)spv::Op::OpTypeVector, + (uint32_t)spv::Op::OpTypeMatrix, + (uint32_t)spv::Op::OpTypeImage, + (uint32_t)spv::Op::OpTypeSampler, + (uint32_t)spv::Op::OpTypeSampledImage, + (uint32_t)spv::Op::OpTypeAccelerationStructureNV, + (uint32_t)spv::Op::OpTypeAccelerationStructureKHR, + (uint32_t)spv::Op::OpTypeRayQueryKHR, + (uint32_t)spv::Op::OpTypeHitObjectNV, + (uint32_t)spv::Op::OpTypeArray, + (uint32_t)spv::Op::OpTypeRuntimeArray, + (uint32_t)spv::Op::OpTypeStruct, + (uint32_t)spv::Op::OpTypeOpaque, + (uint32_t)spv::Op::OpTypePointer, + (uint32_t)spv::Op::OpTypeFunction, + (uint32_t)spv::Op::OpTypeEvent, + (uint32_t)spv::Op::OpTypeDeviceEvent, + (uint32_t)spv::Op::OpTypeReserveId, + (uint32_t)spv::Op::OpTypeQueue, + (uint32_t)spv::Op::OpTypePipe, + (uint32_t)spv::Op::OpTypeForwardPointer, + (uint32_t)spv::Op::OpVariable, + (uint32_t)spv::Op::OpImageTexelPointer, + (uint32_t)spv::Op::OpLoad, + (uint32_t)spv::Op::OpAccessChain, + (uint32_t)spv::Op::OpInBoundsAccessChain, + (uint32_t)spv::Op::OpArrayLength, + (uint32_t)spv::Op::OpVectorExtractDynamic, + (uint32_t)spv::Op::OpVectorInsertDynamic, + (uint32_t)spv::Op::OpVectorShuffle, + (uint32_t)spv::Op::OpCompositeConstruct, + (uint32_t)spv::Op::OpCompositeExtract, + (uint32_t)spv::Op::OpCompositeInsert, + (uint32_t)spv::Op::OpCopyObject, + (uint32_t)spv::Op::OpTranspose, + (uint32_t)spv::Op::OpSampledImage, + (uint32_t)spv::Op::OpImageSampleImplicitLod, + (uint32_t)spv::Op::OpImageSampleExplicitLod, + (uint32_t)spv::Op::OpImageSampleDrefImplicitLod, + (uint32_t)spv::Op::OpImageSampleDrefExplicitLod, + (uint32_t)spv::Op::OpImageSampleProjImplicitLod, + (uint32_t)spv::Op::OpImageSampleProjExplicitLod, + (uint32_t)spv::Op::OpImageSampleProjDrefImplicitLod, + (uint32_t)spv::Op::OpImageSampleProjDrefExplicitLod, + (uint32_t)spv::Op::OpImageFetch, + (uint32_t)spv::Op::OpImageGather, + (uint32_t)spv::Op::OpImageDrefGather, + (uint32_t)spv::Op::OpImageRead, + (uint32_t)spv::Op::OpImage, + (uint32_t)spv::Op::OpImageQueryFormat, + (uint32_t)spv::Op::OpImageQueryOrder, + (uint32_t)spv::Op::OpImageQuerySizeLod, + (uint32_t)spv::Op::OpImageQuerySize, + (uint32_t)spv::Op::OpImageQueryLevels, + (uint32_t)spv::Op::OpImageQuerySamples, + (uint32_t)spv::Op::OpConvertFToU, + (uint32_t)spv::Op::OpConvertFToS, + (uint32_t)spv::Op::OpConvertSToF, + (uint32_t)spv::Op::OpConvertUToF, + (uint32_t)spv::Op::OpUConvert, + (uint32_t)spv::Op::OpSConvert, + (uint32_t)spv::Op::OpFConvert, + (uint32_t)spv::Op::OpQuantizeToF16, + (uint32_t)spv::Op::OpBitcast, + (uint32_t)spv::Op::OpSNegate, + (uint32_t)spv::Op::OpFNegate, + (uint32_t)spv::Op::OpIAdd, + (uint32_t)spv::Op::OpFAdd, + (uint32_t)spv::Op::OpISub, + (uint32_t)spv::Op::OpFSub, + (uint32_t)spv::Op::OpIMul, + (uint32_t)spv::Op::OpFMul, + (uint32_t)spv::Op::OpUDiv, + (uint32_t)spv::Op::OpSDiv, + (uint32_t)spv::Op::OpFDiv, + (uint32_t)spv::Op::OpUMod, + (uint32_t)spv::Op::OpSRem, + (uint32_t)spv::Op::OpSMod, + (uint32_t)spv::Op::OpFRem, + (uint32_t)spv::Op::OpFMod, + (uint32_t)spv::Op::OpVectorTimesScalar, + (uint32_t)spv::Op::OpMatrixTimesScalar, + (uint32_t)spv::Op::OpVectorTimesMatrix, + (uint32_t)spv::Op::OpMatrixTimesVector, + (uint32_t)spv::Op::OpMatrixTimesMatrix, + (uint32_t)spv::Op::OpOuterProduct, + (uint32_t)spv::Op::OpDot, + (uint32_t)spv::Op::OpIAddCarry, + (uint32_t)spv::Op::OpISubBorrow, + (uint32_t)spv::Op::OpUMulExtended, + (uint32_t)spv::Op::OpSMulExtended, + (uint32_t)spv::Op::OpAny, + (uint32_t)spv::Op::OpAll, + (uint32_t)spv::Op::OpIsNan, + (uint32_t)spv::Op::OpIsInf, + (uint32_t)spv::Op::OpLogicalEqual, + (uint32_t)spv::Op::OpLogicalNotEqual, + (uint32_t)spv::Op::OpLogicalOr, + (uint32_t)spv::Op::OpLogicalAnd, + (uint32_t)spv::Op::OpLogicalNot, + (uint32_t)spv::Op::OpSelect, + (uint32_t)spv::Op::OpIEqual, + (uint32_t)spv::Op::OpINotEqual, + (uint32_t)spv::Op::OpUGreaterThan, + (uint32_t)spv::Op::OpSGreaterThan, + (uint32_t)spv::Op::OpUGreaterThanEqual, + (uint32_t)spv::Op::OpSGreaterThanEqual, + (uint32_t)spv::Op::OpULessThan, + (uint32_t)spv::Op::OpSLessThan, + (uint32_t)spv::Op::OpULessThanEqual, + (uint32_t)spv::Op::OpSLessThanEqual, + (uint32_t)spv::Op::OpFOrdEqual, + (uint32_t)spv::Op::OpFUnordEqual, + (uint32_t)spv::Op::OpFOrdNotEqual, + (uint32_t)spv::Op::OpFUnordNotEqual, + (uint32_t)spv::Op::OpFOrdLessThan, + (uint32_t)spv::Op::OpFUnordLessThan, + (uint32_t)spv::Op::OpFOrdGreaterThan, + (uint32_t)spv::Op::OpFUnordGreaterThan, + (uint32_t)spv::Op::OpFOrdLessThanEqual, + (uint32_t)spv::Op::OpFUnordLessThanEqual, + (uint32_t)spv::Op::OpFOrdGreaterThanEqual, + (uint32_t)spv::Op::OpFUnordGreaterThanEqual, + (uint32_t)spv::Op::OpShiftRightLogical, + (uint32_t)spv::Op::OpShiftRightArithmetic, + (uint32_t)spv::Op::OpShiftLeftLogical, + (uint32_t)spv::Op::OpBitwiseOr, + (uint32_t)spv::Op::OpBitwiseXor, + (uint32_t)spv::Op::OpBitwiseAnd, + (uint32_t)spv::Op::OpNot, + (uint32_t)spv::Op::OpBitFieldInsert, + (uint32_t)spv::Op::OpBitFieldSExtract, + (uint32_t)spv::Op::OpBitFieldUExtract, + (uint32_t)spv::Op::OpBitReverse, + (uint32_t)spv::Op::OpBitCount, + (uint32_t)spv::Op::OpPhi, + (uint32_t)spv::Op::OpImageSparseSampleImplicitLod, + (uint32_t)spv::Op::OpImageSparseSampleExplicitLod, + (uint32_t)spv::Op::OpImageSparseSampleDrefImplicitLod, + (uint32_t)spv::Op::OpImageSparseSampleDrefExplicitLod, + (uint32_t)spv::Op::OpImageSparseSampleProjImplicitLod, + (uint32_t)spv::Op::OpImageSparseSampleProjExplicitLod, + (uint32_t)spv::Op::OpImageSparseSampleProjDrefImplicitLod, + (uint32_t)spv::Op::OpImageSparseSampleProjDrefExplicitLod, + (uint32_t)spv::Op::OpImageSparseFetch, + (uint32_t)spv::Op::OpImageSparseGather, + (uint32_t)spv::Op::OpImageSparseDrefGather, + (uint32_t)spv::Op::OpImageSparseTexelsResident, + (uint32_t)spv::Op::OpImageSparseRead, + (uint32_t)spv::Op::OpSizeOf}); } } void IRContext::AddCombinatorsForExtension(Instruction* extension) { - assert(extension->opcode() == SpvOpExtInstImport && + assert(extension->opcode() == spv::Op::OpExtInstImport && "Expecting an import of an extension's instruction set."); const std::string extension_name = extension->GetInOperand(0).AsString(); if (extension_name == "GLSL.std.450") { - combinator_ops_[extension->result_id()] = {GLSLstd450Round, - GLSLstd450RoundEven, - GLSLstd450Trunc, - GLSLstd450FAbs, - GLSLstd450SAbs, - GLSLstd450FSign, - GLSLstd450SSign, - GLSLstd450Floor, - GLSLstd450Ceil, - GLSLstd450Fract, - GLSLstd450Radians, - GLSLstd450Degrees, - GLSLstd450Sin, - GLSLstd450Cos, - GLSLstd450Tan, - GLSLstd450Asin, - GLSLstd450Acos, - GLSLstd450Atan, - GLSLstd450Sinh, - GLSLstd450Cosh, - GLSLstd450Tanh, - GLSLstd450Asinh, - GLSLstd450Acosh, - GLSLstd450Atanh, - GLSLstd450Atan2, - GLSLstd450Pow, - GLSLstd450Exp, - GLSLstd450Log, - GLSLstd450Exp2, - GLSLstd450Log2, - GLSLstd450Sqrt, - GLSLstd450InverseSqrt, - GLSLstd450Determinant, - GLSLstd450MatrixInverse, - GLSLstd450ModfStruct, - GLSLstd450FMin, - GLSLstd450UMin, - GLSLstd450SMin, - GLSLstd450FMax, - GLSLstd450UMax, - GLSLstd450SMax, - GLSLstd450FClamp, - GLSLstd450UClamp, - GLSLstd450SClamp, - GLSLstd450FMix, - GLSLstd450IMix, - GLSLstd450Step, - GLSLstd450SmoothStep, - GLSLstd450Fma, - GLSLstd450FrexpStruct, - GLSLstd450Ldexp, - GLSLstd450PackSnorm4x8, - GLSLstd450PackUnorm4x8, - GLSLstd450PackSnorm2x16, - GLSLstd450PackUnorm2x16, - GLSLstd450PackHalf2x16, - GLSLstd450PackDouble2x32, - GLSLstd450UnpackSnorm2x16, - GLSLstd450UnpackUnorm2x16, - GLSLstd450UnpackHalf2x16, - GLSLstd450UnpackSnorm4x8, - GLSLstd450UnpackUnorm4x8, - GLSLstd450UnpackDouble2x32, - GLSLstd450Length, - GLSLstd450Distance, - GLSLstd450Cross, - GLSLstd450Normalize, - GLSLstd450FaceForward, - GLSLstd450Reflect, - GLSLstd450Refract, - GLSLstd450FindILsb, - GLSLstd450FindSMsb, - GLSLstd450FindUMsb, - GLSLstd450InterpolateAtCentroid, - GLSLstd450InterpolateAtSample, - GLSLstd450InterpolateAtOffset, - GLSLstd450NMin, - GLSLstd450NMax, - GLSLstd450NClamp}; + combinator_ops_[extension->result_id()] = { + (uint32_t)GLSLstd450Round, + (uint32_t)GLSLstd450RoundEven, + (uint32_t)GLSLstd450Trunc, + (uint32_t)GLSLstd450FAbs, + (uint32_t)GLSLstd450SAbs, + (uint32_t)GLSLstd450FSign, + (uint32_t)GLSLstd450SSign, + (uint32_t)GLSLstd450Floor, + (uint32_t)GLSLstd450Ceil, + (uint32_t)GLSLstd450Fract, + (uint32_t)GLSLstd450Radians, + (uint32_t)GLSLstd450Degrees, + (uint32_t)GLSLstd450Sin, + (uint32_t)GLSLstd450Cos, + (uint32_t)GLSLstd450Tan, + (uint32_t)GLSLstd450Asin, + (uint32_t)GLSLstd450Acos, + (uint32_t)GLSLstd450Atan, + (uint32_t)GLSLstd450Sinh, + (uint32_t)GLSLstd450Cosh, + (uint32_t)GLSLstd450Tanh, + (uint32_t)GLSLstd450Asinh, + (uint32_t)GLSLstd450Acosh, + (uint32_t)GLSLstd450Atanh, + (uint32_t)GLSLstd450Atan2, + (uint32_t)GLSLstd450Pow, + (uint32_t)GLSLstd450Exp, + (uint32_t)GLSLstd450Log, + (uint32_t)GLSLstd450Exp2, + (uint32_t)GLSLstd450Log2, + (uint32_t)GLSLstd450Sqrt, + (uint32_t)GLSLstd450InverseSqrt, + (uint32_t)GLSLstd450Determinant, + (uint32_t)GLSLstd450MatrixInverse, + (uint32_t)GLSLstd450ModfStruct, + (uint32_t)GLSLstd450FMin, + (uint32_t)GLSLstd450UMin, + (uint32_t)GLSLstd450SMin, + (uint32_t)GLSLstd450FMax, + (uint32_t)GLSLstd450UMax, + (uint32_t)GLSLstd450SMax, + (uint32_t)GLSLstd450FClamp, + (uint32_t)GLSLstd450UClamp, + (uint32_t)GLSLstd450SClamp, + (uint32_t)GLSLstd450FMix, + (uint32_t)GLSLstd450IMix, + (uint32_t)GLSLstd450Step, + (uint32_t)GLSLstd450SmoothStep, + (uint32_t)GLSLstd450Fma, + (uint32_t)GLSLstd450FrexpStruct, + (uint32_t)GLSLstd450Ldexp, + (uint32_t)GLSLstd450PackSnorm4x8, + (uint32_t)GLSLstd450PackUnorm4x8, + (uint32_t)GLSLstd450PackSnorm2x16, + (uint32_t)GLSLstd450PackUnorm2x16, + (uint32_t)GLSLstd450PackHalf2x16, + (uint32_t)GLSLstd450PackDouble2x32, + (uint32_t)GLSLstd450UnpackSnorm2x16, + (uint32_t)GLSLstd450UnpackUnorm2x16, + (uint32_t)GLSLstd450UnpackHalf2x16, + (uint32_t)GLSLstd450UnpackSnorm4x8, + (uint32_t)GLSLstd450UnpackUnorm4x8, + (uint32_t)GLSLstd450UnpackDouble2x32, + (uint32_t)GLSLstd450Length, + (uint32_t)GLSLstd450Distance, + (uint32_t)GLSLstd450Cross, + (uint32_t)GLSLstd450Normalize, + (uint32_t)GLSLstd450FaceForward, + (uint32_t)GLSLstd450Reflect, + (uint32_t)GLSLstd450Refract, + (uint32_t)GLSLstd450FindILsb, + (uint32_t)GLSLstd450FindSMsb, + (uint32_t)GLSLstd450FindUMsb, + (uint32_t)GLSLstd450InterpolateAtCentroid, + (uint32_t)GLSLstd450InterpolateAtSample, + (uint32_t)GLSLstd450InterpolateAtOffset, + (uint32_t)GLSLstd450NMin, + (uint32_t)GLSLstd450NMax, + (uint32_t)GLSLstd450NClamp}; } else { // Map the result id to the empty set. combinator_ops_[extension->result_id()]; @@ -713,8 +770,9 @@ void IRContext::AddCombinatorsForExtension(Instruction* extension) { } void IRContext::InitializeCombinators() { - get_feature_mgr()->GetCapabilities()->ForEach( - [this](SpvCapability cap) { AddCombinatorsForCapability(cap); }); + for (auto capability : get_feature_mgr()->GetCapabilities()) { + AddCombinatorsForCapability(uint32_t(capability)); + } for (auto& extension : module()->ext_inst_imports()) { AddCombinatorsForExtension(&extension); @@ -724,8 +782,8 @@ void IRContext::InitializeCombinators() { } void IRContext::RemoveFromIdToName(const Instruction* inst) { - if (id_to_name_ && - (inst->opcode() == SpvOpName || inst->opcode() == SpvOpMemberName)) { + if (id_to_name_ && (inst->opcode() == spv::Op::OpName || + inst->opcode() == spv::Op::OpMemberName)) { auto range = id_to_name_->equal_range(inst->GetSingleWordInOperand(0)); for (auto it = range.first; it != range.second; ++it) { if (it->second == inst) { @@ -754,15 +812,17 @@ LoopDescriptor* IRContext::GetLoopDescriptor(const Function* f) { uint32_t IRContext::FindBuiltinInputVar(uint32_t builtin) { for (auto& a : module_->annotations()) { - if (a.opcode() != SpvOpDecorate) continue; - if (a.GetSingleWordInOperand(kSpvDecorateDecorationInIdx) != - SpvDecorationBuiltIn) + if (spv::Op(a.opcode()) != spv::Op::OpDecorate) continue; + if (spv::Decoration(a.GetSingleWordInOperand( + kSpvDecorateDecorationInIdx)) != spv::Decoration::BuiltIn) continue; if (a.GetSingleWordInOperand(kSpvDecorateBuiltinInIdx) != builtin) continue; uint32_t target_id = a.GetSingleWordInOperand(kSpvDecorateTargetIdInIdx); Instruction* b_var = get_def_use_mgr()->GetDef(target_id); - if (b_var->opcode() != SpvOpVariable) continue; - if (b_var->GetSingleWordInOperand(0) != SpvStorageClassInput) continue; + if (b_var->opcode() != spv::Op::OpVariable) continue; + if (spv::StorageClass(b_var->GetSingleWordInOperand(0)) != + spv::StorageClass::Input) + continue; return target_id; } return 0; @@ -798,39 +858,39 @@ uint32_t IRContext::GetBuiltinInputVarId(uint32_t builtin) { // TODO(greg-lunarg): Add support for all builtins analysis::TypeManager* type_mgr = get_type_mgr(); analysis::Type* reg_type; - switch (builtin) { - case SpvBuiltInFragCoord: { + switch (spv::BuiltIn(builtin)) { + case spv::BuiltIn::FragCoord: { analysis::Float float_ty(32); analysis::Type* reg_float_ty = type_mgr->GetRegisteredType(&float_ty); analysis::Vector v4float_ty(reg_float_ty, 4); reg_type = type_mgr->GetRegisteredType(&v4float_ty); break; } - case SpvBuiltInVertexIndex: - case SpvBuiltInInstanceIndex: - case SpvBuiltInPrimitiveId: - case SpvBuiltInInvocationId: - case SpvBuiltInSubgroupLocalInvocationId: { + case spv::BuiltIn::VertexIndex: + case spv::BuiltIn::InstanceIndex: + case spv::BuiltIn::PrimitiveId: + case spv::BuiltIn::InvocationId: + case spv::BuiltIn::SubgroupLocalInvocationId: { analysis::Integer uint_ty(32, false); reg_type = type_mgr->GetRegisteredType(&uint_ty); break; } - case SpvBuiltInGlobalInvocationId: - case SpvBuiltInLaunchIdNV: { + case spv::BuiltIn::GlobalInvocationId: + case spv::BuiltIn::LaunchIdNV: { analysis::Integer uint_ty(32, false); analysis::Type* reg_uint_ty = type_mgr->GetRegisteredType(&uint_ty); analysis::Vector v3uint_ty(reg_uint_ty, 3); reg_type = type_mgr->GetRegisteredType(&v3uint_ty); break; } - case SpvBuiltInTessCoord: { + case spv::BuiltIn::TessCoord: { analysis::Float float_ty(32); analysis::Type* reg_float_ty = type_mgr->GetRegisteredType(&float_ty); analysis::Vector v3float_ty(reg_float_ty, 3); reg_type = type_mgr->GetRegisteredType(&v3float_ty); break; } - case SpvBuiltInSubgroupLtMask: { + case spv::BuiltIn::SubgroupLtMask: { analysis::Integer uint_ty(32, false); analysis::Type* reg_uint_ty = type_mgr->GetRegisteredType(&uint_ty); analysis::Vector v4uint_ty(reg_uint_ty, 4); @@ -844,17 +904,17 @@ uint32_t IRContext::GetBuiltinInputVarId(uint32_t builtin) { } uint32_t type_id = type_mgr->GetTypeInstruction(reg_type); uint32_t varTyPtrId = - type_mgr->FindPointerToType(type_id, SpvStorageClassInput); + type_mgr->FindPointerToType(type_id, spv::StorageClass::Input); // TODO(1841): Handle id overflow. var_id = TakeNextId(); std::unique_ptr newVarOp( - new Instruction(this, SpvOpVariable, varTyPtrId, var_id, + new Instruction(this, spv::Op::OpVariable, varTyPtrId, var_id, {{spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, - {SpvStorageClassInput}}})); + {uint32_t(spv::StorageClass::Input)}}})); get_def_use_mgr()->AnalyzeInstDefUse(&*newVarOp); module()->AddGlobalValue(std::move(newVarOp)); - get_decoration_mgr()->AddDecorationVal(var_id, SpvDecorationBuiltIn, - builtin); + get_decoration_mgr()->AddDecorationVal( + var_id, uint32_t(spv::Decoration::BuiltIn), builtin); AddVarToEntryPoints(var_id); } builtin_var_id_map_[builtin] = var_id; @@ -864,7 +924,7 @@ uint32_t IRContext::GetBuiltinInputVarId(uint32_t builtin) { void IRContext::AddCalls(const Function* func, std::queue* todo) { for (auto bi = func->begin(); bi != func->end(); ++bi) for (auto ii = bi->begin(); ii != bi->end(); ++ii) - if (ii->opcode() == SpvOpFunctionCall) + if (ii->opcode() == spv::Op::OpFunctionCall) todo->push(ii->GetSingleWordInOperand(0)); } @@ -889,12 +949,12 @@ bool IRContext::ProcessReachableCallTree(ProcessFunction& pfn) { for (auto& a : annotations()) { // TODO: Handle group decorations as well. Currently not generate by any // front-end, but could be coming. - if (a.opcode() == SpvOp::SpvOpDecorate) { - if (a.GetSingleWordOperand(1) == - SpvDecoration::SpvDecorationLinkageAttributes) { + if (a.opcode() == spv::Op::OpDecorate) { + if (spv::Decoration(a.GetSingleWordOperand(1)) == + spv::Decoration::LinkageAttributes) { uint32_t lastOperand = a.NumOperands() - 1; - if (a.GetSingleWordOperand(lastOperand) == - SpvLinkageType::SpvLinkageTypeExport) { + if (spv::LinkageType(a.GetSingleWordOperand(lastOperand)) == + spv::LinkageType::Export) { uint32_t id = a.GetSingleWordOperand(0); if (GetFunction(id)) { roots.push(id); @@ -1058,5 +1118,26 @@ bool IRContext::IsReachable(const opt::BasicBlock& bb) { return GetDominatorAnalysis(enclosing_function) ->Dominates(enclosing_function->entry().get(), &bb); } + +spv::ExecutionModel IRContext::GetStage() { + const auto& entry_points = module()->entry_points(); + if (entry_points.empty()) { + return spv::ExecutionModel::Max; + } + + uint32_t stage = entry_points.begin()->GetSingleWordInOperand( + kEntryPointExecutionModelInIdx); + auto it = std::find_if( + entry_points.begin(), entry_points.end(), [stage](const Instruction& x) { + return x.GetSingleWordInOperand(kEntryPointExecutionModelInIdx) != + stage; + }); + if (it != entry_points.end()) { + EmitErrorMessage("Mixed stage shader module not supported", &(*it)); + } + + return static_cast(stage); +} + } // namespace opt } // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/ir_context.h b/bgfx/3rdparty/spirv-tools/source/opt/ir_context.h index 2f27942b..7ff411a1 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/ir_context.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/ir_context.h @@ -27,6 +27,7 @@ #include #include "source/assembly_grammar.h" +#include "source/enum_string_mapping.h" #include "source/opt/cfg.h" #include "source/opt/constants.h" #include "source/opt/debug_info_manager.h" @@ -35,6 +36,7 @@ #include "source/opt/dominator_analysis.h" #include "source/opt/feature_manager.h" #include "source/opt/fold.h" +#include "source/opt/liveness.h" #include "source/opt/loop_descriptor.h" #include "source/opt/module.h" #include "source/opt/register_pressure.h" @@ -81,6 +83,7 @@ class IRContext { kAnalysisConstants = 1 << 14, kAnalysisTypes = 1 << 15, kAnalysisDebugInfo = 1 << 16, + kAnalysisLiveness = 1 << 17, kAnalysisEnd = 1 << 17 }; @@ -151,13 +154,19 @@ class IRContext { inline IteratorRange capabilities(); inline IteratorRange capabilities() const; + // Iterators for extensions instructions contained in this module. + inline Module::inst_iterator extension_begin(); + inline Module::inst_iterator extension_end(); + inline IteratorRange extensions(); + inline IteratorRange extensions() const; + // Iterators for types, constants and global variables instructions. inline Module::inst_iterator types_values_begin(); inline Module::inst_iterator types_values_end(); inline IteratorRange types_values(); inline IteratorRange types_values() const; - // Iterators for extension instructions contained in this module. + // Iterators for ext_inst import instructions contained in this module. inline Module::inst_iterator ext_inst_import_begin(); inline Module::inst_iterator ext_inst_import_end(); inline IteratorRange ext_inst_imports(); @@ -201,13 +210,20 @@ class IRContext { inline IteratorRange ext_inst_debuginfo() const; // Add |capability| to the module, if it is not already enabled. - inline void AddCapability(SpvCapability capability); - + inline void AddCapability(spv::Capability capability); // Appends a capability instruction to this module. inline void AddCapability(std::unique_ptr&& c); + // Removes instruction declaring `capability` from this module. + // Returns true if the capability was removed, false otherwise. + bool RemoveCapability(spv::Capability capability); + // Appends an extension instruction to this module. inline void AddExtension(const std::string& ext_name); inline void AddExtension(std::unique_ptr&& e); + // Removes instruction declaring `extension` from this module. + // Returns true if the extension was removed, false otherwise. + bool RemoveExtension(Extension extension); + // Appends an extended instruction set instruction to this module. inline void AddExtInstImport(const std::string& name); inline void AddExtInstImport(std::unique_ptr&& e); @@ -248,6 +264,15 @@ class IRContext { return def_use_mgr_.get(); } + // Returns a pointer to a liveness manager. If the liveness manager is + // invalid, it is rebuilt first. + analysis::LivenessManager* get_liveness_mgr() { + if (!AreAnalysesValid(kAnalysisLiveness)) { + BuildLivenessManager(); + } + return liveness_mgr_.get(); + } + // Returns a pointer to a value number table. If the liveness analysis is // invalid, it is rebuilt first. ValueNumberTable* GetValueNumberTable() { @@ -367,6 +392,11 @@ class IRContext { // having more than one name. This method returns the first one it finds. inline Instruction* GetMemberName(uint32_t struct_type_id, uint32_t index); + // Copy names from |old_id| to |new_id|. Only copy member name if index is + // less than |max_member_index|. + inline void CloneNames(const uint32_t old_id, const uint32_t new_id, + const uint32_t max_member_index = UINT32_MAX); + // Sets the message consumer to the given |consumer|. |consumer| which will be // invoked every time there is a message to be communicated to the outside. void SetMessageConsumer(MessageConsumer c) { consumer_ = std::move(c); } @@ -406,6 +436,15 @@ class IRContext { // instruction exists. Instruction* KillInst(Instruction* inst); + // Deletes all the instruction in the range [`begin`; `end`[, for which the + // unary predicate `condition` returned true. + // Returns true if at least one instruction was removed, false otherwise. + // + // Pointer and iterator pointing to the deleted instructions become invalid. + // However other pointers and iterators are still valid. + bool KillInstructionIf(Module::inst_iterator begin, Module::inst_iterator end, + std::function condition); + // Collects the non-semantic instruction tree that uses |inst|'s result id // to be killed later. void CollectNonSemanticTree(Instruction* inst, @@ -475,14 +514,14 @@ class IRContext { if (!AreAnalysesValid(kAnalysisCombinators)) { InitializeCombinators(); } - const uint32_t kExtInstSetIdInIndx = 0; - const uint32_t kExtInstInstructionInIndx = 1; + constexpr uint32_t kExtInstSetIdInIndx = 0; + constexpr uint32_t kExtInstInstructionInIndx = 1; - if (inst->opcode() != SpvOpExtInst) { - return combinator_ops_[0].count(inst->opcode()) != 0; + if (inst->opcode() != spv::Op::OpExtInst) { + return combinator_ops_[0].count(uint32_t(inst->opcode())) != 0; } else { uint32_t set = inst->GetSingleWordInOperand(kExtInstSetIdInIndx); - uint32_t op = inst->GetSingleWordInOperand(kExtInstInstructionInIndx); + auto op = inst->GetSingleWordInOperand(kExtInstInstructionInIndx); return combinator_ops_[set].count(op) != 0; } } @@ -591,7 +630,7 @@ class IRContext { } Function* GetFunction(Instruction* inst) { - if (inst->opcode() != SpvOpFunction) { + if (inst->opcode() != spv::Op::OpFunction) { return nullptr; } return GetFunction(inst->result_id()); @@ -625,6 +664,21 @@ class IRContext { // the function that contains |bb|. bool IsReachable(const opt::BasicBlock& bb); + // Return the stage of the module. Will generate error if entry points don't + // all have the same stage. + spv::ExecutionModel GetStage(); + + // Returns true of the current target environment is at least that of the + // given environment. + bool IsTargetEnvAtLeast(spv_target_env env) { + // A bit of a hack. We assume that the target environments are appended to + // the enum, so that there is an appropriate order. + return syntax_context_->target_env >= env; + } + + // Return the target environment for the current context. + spv_target_env GetTargetEnv() const { return syntax_context_->target_env; } + private: // Builds the def-use manager from scratch, even if it was already valid. void BuildDefUseManager() { @@ -632,6 +686,12 @@ class IRContext { valid_analyses_ = valid_analyses_ | kAnalysisDefUse; } + // Builds the liveness manager from scratch, even if it was already valid. + void BuildLivenessManager() { + liveness_mgr_ = MakeUnique(this); + valid_analyses_ = valid_analyses_ | kAnalysisLiveness; + } + // Builds the instruction-block map for the whole module. void BuildInstrToBlockMapping() { instr_to_block_.clear(); @@ -735,7 +795,8 @@ class IRContext { // Analyzes the features in the owned module. Builds the manager if required. void AnalyzeFeatures() { - feature_mgr_ = MakeUnique(grammar_); + feature_mgr_ = + std::unique_ptr(new FeatureManager(grammar_)); feature_mgr_->Analyze(module()); } @@ -852,6 +913,9 @@ class IRContext { std::unique_ptr struct_cfg_analysis_; + // The liveness manager for |module_|. + std::unique_ptr liveness_mgr_; + // The maximum legal value for the id bound. uint32_t max_id_bound_; @@ -924,6 +988,22 @@ IteratorRange IRContext::capabilities() const { return ((const Module*)module())->capabilities(); } +Module::inst_iterator IRContext::extension_begin() { + return module()->extension_begin(); +} + +Module::inst_iterator IRContext::extension_end() { + return module()->extension_end(); +} + +IteratorRange IRContext::extensions() { + return module()->extensions(); +} + +IteratorRange IRContext::extensions() const { + return ((const Module*)module())->extensions(); +} + Module::inst_iterator IRContext::types_values_begin() { return module()->types_values_begin(); } @@ -1014,10 +1094,10 @@ IteratorRange IRContext::ext_inst_debuginfo() return ((const Module*)module_.get())->ext_inst_debuginfo(); } -void IRContext::AddCapability(SpvCapability capability) { +void IRContext::AddCapability(spv::Capability capability) { if (!get_feature_mgr()->HasCapability(capability)) { std::unique_ptr capability_inst(new Instruction( - this, SpvOpCapability, 0, 0, + this, spv::Op::OpCapability, 0, 0, {{SPV_OPERAND_TYPE_CAPABILITY, {static_cast(capability)}}})); AddCapability(std::move(capability_inst)); } @@ -1027,7 +1107,7 @@ void IRContext::AddCapability(std::unique_ptr&& c) { AddCombinatorsForCapability(c->GetSingleWordInOperand(0)); if (feature_mgr_ != nullptr) { feature_mgr_->AddCapability( - static_cast(c->GetSingleWordInOperand(0))); + static_cast(c->GetSingleWordInOperand(0))); } if (AreAnalysesValid(kAnalysisDefUse)) { get_def_use_mgr()->AnalyzeInstDefUse(c.get()); @@ -1038,7 +1118,7 @@ void IRContext::AddCapability(std::unique_ptr&& c) { void IRContext::AddExtension(const std::string& ext_name) { std::vector ext_words = spvtools::utils::MakeVector(ext_name); AddExtension(std::unique_ptr( - new Instruction(this, SpvOpExtension, 0u, 0u, + new Instruction(this, spv::Op::OpExtension, 0u, 0u, {{SPV_OPERAND_TYPE_LITERAL_STRING, ext_words}}))); } @@ -1055,7 +1135,7 @@ void IRContext::AddExtension(std::unique_ptr&& e) { void IRContext::AddExtInstImport(const std::string& name) { std::vector ext_words = spvtools::utils::MakeVector(name); AddExtInstImport(std::unique_ptr( - new Instruction(this, SpvOpExtInstImport, 0u, TakeNextId(), + new Instruction(this, spv::Op::OpExtInstImport, 0u, TakeNextId(), {{SPV_OPERAND_TYPE_LITERAL_STRING, ext_words}}))); } @@ -1088,7 +1168,8 @@ void IRContext::AddDebug1Inst(std::unique_ptr&& d) { void IRContext::AddDebug2Inst(std::unique_ptr&& d) { if (AreAnalysesValid(kAnalysisNameMap)) { - if (d->opcode() == SpvOpName || d->opcode() == SpvOpMemberName) { + if (d->opcode() == spv::Op::OpName || + d->opcode() == spv::Op::OpMemberName) { // OpName and OpMemberName do not have result-ids. The target of the // instruction is at InOperand index 0. id_to_name_->insert({d->GetSingleWordInOperand(0), d.get()}); @@ -1151,8 +1232,8 @@ void IRContext::UpdateDefUse(Instruction* inst) { void IRContext::BuildIdToNameMap() { id_to_name_ = MakeUnique>(); for (Instruction& debug_inst : debugs2()) { - if (debug_inst.opcode() == SpvOpMemberName || - debug_inst.opcode() == SpvOpName) { + if (debug_inst.opcode() == spv::Op::OpMemberName || + debug_inst.opcode() == spv::Op::OpName) { id_to_name_->insert({debug_inst.GetSingleWordInOperand(0), &debug_inst}); } } @@ -1175,7 +1256,7 @@ Instruction* IRContext::GetMemberName(uint32_t struct_type_id, uint32_t index) { auto result = id_to_name_->equal_range(struct_type_id); for (auto i = result.first; i != result.second; ++i) { auto* name_instr = i->second; - if (name_instr->opcode() == SpvOpMemberName && + if (name_instr->opcode() == spv::Op::OpMemberName && name_instr->GetSingleWordInOperand(1) == index) { return name_instr; } @@ -1183,6 +1264,25 @@ Instruction* IRContext::GetMemberName(uint32_t struct_type_id, uint32_t index) { return nullptr; } +void IRContext::CloneNames(const uint32_t old_id, const uint32_t new_id, + const uint32_t max_member_index) { + std::vector> names_to_add; + auto names = GetNames(old_id); + for (auto n : names) { + Instruction* old_name_inst = n.second; + if (old_name_inst->opcode() == spv::Op::OpMemberName) { + auto midx = old_name_inst->GetSingleWordInOperand(1); + if (midx >= max_member_index) continue; + } + std::unique_ptr new_name_inst(old_name_inst->Clone(this)); + new_name_inst->SetInOperand(0, {new_id}); + names_to_add.push_back(std::move(new_name_inst)); + } + // We can't add the new names when we are iterating over name range above. + // We can add all the new names now. + for (auto& new_name : names_to_add) AddDebug2Inst(std::move(new_name)); +} + } // namespace opt } // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/ir_loader.cpp b/bgfx/3rdparty/spirv-tools/source/opt/ir_loader.cpp index 734ad554..e9b7bbfc 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/ir_loader.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/ir_loader.cpp @@ -24,12 +24,13 @@ #include "source/opt/reflect.h" #include "source/util/make_unique.h" -static const uint32_t kExtInstSetIndex = 4; -static const uint32_t kLexicalScopeIndex = 5; -static const uint32_t kInlinedAtIndex = 6; - namespace spvtools { namespace opt { +namespace { +constexpr uint32_t kExtInstSetIndex = 4; +constexpr uint32_t kLexicalScopeIndex = 5; +constexpr uint32_t kInlinedAtIndex = 6; +} // namespace IrLoader::IrLoader(const MessageConsumer& consumer, Module* m) : consumer_(consumer), @@ -39,9 +40,9 @@ IrLoader::IrLoader(const MessageConsumer& consumer, Module* m) last_dbg_scope_(kNoDebugScope, kNoInlinedAt) {} bool IsLineInst(const spv_parsed_instruction_t* inst) { - const auto opcode = static_cast(inst->opcode); + const auto opcode = static_cast(inst->opcode); if (IsOpLineInst(opcode)) return true; - if (opcode != SpvOpExtInst) return false; + if (opcode != spv::Op::OpExtInst) return false; if (inst->ext_inst_type != SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100) return false; const uint32_t ext_inst_index = inst->words[kExtInstSetIndex]; @@ -63,8 +64,9 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { // If it is a DebugScope or DebugNoScope of debug extension, we do not // create a new instruction, but simply keep the information in // struct DebugScope. - const auto opcode = static_cast(inst->opcode); - if (opcode == SpvOpExtInst && spvExtInstIsDebugInfo(inst->ext_inst_type)) { + const auto opcode = static_cast(inst->opcode); + if (opcode == spv::Op::OpExtInst && + spvExtInstIsDebugInfo(inst->ext_inst_type)) { const uint32_t ext_inst_index = inst->words[kExtInstSetIndex]; if (inst->ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100 || inst->ext_inst_type == @@ -130,13 +132,13 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { // Handle function and basic block boundaries first, then normal // instructions. - if (opcode == SpvOpFunction) { + if (opcode == spv::Op::OpFunction) { if (function_ != nullptr) { Error(consumer_, src, loc, "function inside function"); return false; } function_ = MakeUnique(std::move(spv_inst)); - } else if (opcode == SpvOpFunctionEnd) { + } else if (opcode == spv::Op::OpFunctionEnd) { if (function_ == nullptr) { Error(consumer_, src, loc, "OpFunctionEnd without corresponding OpFunction"); @@ -149,7 +151,7 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { function_->SetFunctionEnd(std::move(spv_inst)); module_->AddFunction(std::move(function_)); function_ = nullptr; - } else if (opcode == SpvOpLabel) { + } else if (opcode == spv::Op::OpLabel) { if (function_ == nullptr) { Error(consumer_, src, loc, "OpLabel outside function"); return false; @@ -179,20 +181,20 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { } else { if (function_ == nullptr) { // Outside function definition SPIRV_ASSERT(consumer_, block_ == nullptr); - if (opcode == SpvOpCapability) { + if (opcode == spv::Op::OpCapability) { module_->AddCapability(std::move(spv_inst)); - } else if (opcode == SpvOpExtension) { + } else if (opcode == spv::Op::OpExtension) { module_->AddExtension(std::move(spv_inst)); - } else if (opcode == SpvOpExtInstImport) { + } else if (opcode == spv::Op::OpExtInstImport) { module_->AddExtInstImport(std::move(spv_inst)); - } else if (opcode == SpvOpMemoryModel) { + } else if (opcode == spv::Op::OpMemoryModel) { module_->SetMemoryModel(std::move(spv_inst)); - } else if (opcode == SpvOpSamplerImageAddressingModeNV) { + } else if (opcode == spv::Op::OpSamplerImageAddressingModeNV) { module_->SetSampledImageAddressMode(std::move(spv_inst)); - } else if (opcode == SpvOpEntryPoint) { + } else if (opcode == spv::Op::OpEntryPoint) { module_->AddEntryPoint(std::move(spv_inst)); - } else if (opcode == SpvOpExecutionMode || - opcode == SpvOpExecutionModeId) { + } else if (opcode == spv::Op::OpExecutionMode || + opcode == spv::Op::OpExecutionModeId) { module_->AddExecutionMode(std::move(spv_inst)); } else if (IsDebug1Inst(opcode)) { module_->AddDebug1Inst(std::move(spv_inst)); @@ -204,13 +206,13 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { module_->AddAnnotationInst(std::move(spv_inst)); } else if (IsTypeInst(opcode)) { module_->AddType(std::move(spv_inst)); - } else if (IsConstantInst(opcode) || opcode == SpvOpVariable || - opcode == SpvOpUndef) { + } else if (IsConstantInst(opcode) || opcode == spv::Op::OpVariable || + opcode == spv::Op::OpUndef) { module_->AddGlobalValue(std::move(spv_inst)); - } else if (opcode == SpvOpExtInst && + } else if (opcode == spv::Op::OpExtInst && spvExtInstIsDebugInfo(inst->ext_inst_type)) { module_->AddExtInstDebugInfo(std::move(spv_inst)); - } else if (opcode == SpvOpExtInst && + } else if (opcode == spv::Op::OpExtInst && spvExtInstIsNonSemantic(inst->ext_inst_type)) { // If there are no functions, add the non-semantic instructions to the // global values. Otherwise append it to the list of the last function. @@ -229,11 +231,11 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { return false; } } else { - if (opcode == SpvOpLoopMerge || opcode == SpvOpSelectionMerge) + if (opcode == spv::Op::OpLoopMerge || opcode == spv::Op::OpSelectionMerge) last_dbg_scope_ = DebugScope(kNoDebugScope, kNoInlinedAt); if (last_dbg_scope_.GetLexicalScope() != kNoDebugScope) spv_inst->SetDebugScope(last_dbg_scope_); - if (opcode == SpvOpExtInst && + if (opcode == spv::Op::OpExtInst && spvExtInstIsDebugInfo(inst->ext_inst_type)) { const uint32_t ext_inst_index = inst->words[kExtInstSetIndex]; if (inst->ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100) { @@ -322,7 +324,7 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { } } else { if (block_ == nullptr) { // Inside function but outside blocks - if (opcode != SpvOpFunctionParameter) { + if (opcode != spv::Op::OpFunctionParameter) { Errorf(consumer_, src, loc, "Non-OpFunctionParameter (opcode: %d) found inside " "function but outside basic block", diff --git a/bgfx/3rdparty/spirv-tools/source/opt/licm_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/licm_pass.cpp index 82851fd2..f2a6e4df 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/licm_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/licm_pass.cpp @@ -15,7 +15,6 @@ #include "source/opt/licm_pass.h" #include -#include #include "source/opt/module.h" #include "source/opt/pass.h" @@ -85,7 +84,7 @@ Pass::Status LICMPass::AnalyseAndHoistFromBB( bool modified = false; std::function hoist_inst = [this, &loop, &modified](Instruction* inst) { - if (loop->ShouldHoistInstruction(this->context(), inst)) { + if (loop->ShouldHoistInstruction(*inst)) { if (!HoistInstruction(loop, inst)) { return false; } @@ -126,8 +125,8 @@ bool LICMPass::HoistInstruction(Loop* loop, Instruction* inst) { } Instruction* insertion_point = &*pre_header_bb->tail(); Instruction* previous_node = insertion_point->PreviousNode(); - if (previous_node && (previous_node->opcode() == SpvOpLoopMerge || - previous_node->opcode() == SpvOpSelectionMerge)) { + if (previous_node && (previous_node->opcode() == spv::Op::OpLoopMerge || + previous_node->opcode() == spv::Op::OpSelectionMerge)) { insertion_point = previous_node; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/liveness.cpp b/bgfx/3rdparty/spirv-tools/source/opt/liveness.cpp new file mode 100644 index 00000000..336f3ae5 --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/liveness.cpp @@ -0,0 +1,332 @@ +// Copyright (c) 2022 The Khronos Group Inc. +// Copyright (c) 2022 LunarG Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/opt/liveness.h" + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace analysis { +namespace { +constexpr uint32_t kDecorationLocationInIdx = 2; +constexpr uint32_t kOpDecorateMemberMemberInIdx = 1; +constexpr uint32_t kOpDecorateMemberLocationInIdx = 3; +constexpr uint32_t kOpDecorateBuiltInLiteralInIdx = 2; +constexpr uint32_t kOpDecorateMemberBuiltInLiteralInIdx = 3; +} // namespace + +LivenessManager::LivenessManager(IRContext* ctx) : ctx_(ctx), computed_(false) { + // Liveness sets computed when queried +} + +void LivenessManager::InitializeAnalysis() { + live_locs_.clear(); + live_builtins_.clear(); + // Mark all builtins live for frag shader. + if (context()->GetStage() == spv::ExecutionModel::Fragment) { + live_builtins_.insert(uint32_t(spv::BuiltIn::PointSize)); + live_builtins_.insert(uint32_t(spv::BuiltIn::ClipDistance)); + live_builtins_.insert(uint32_t(spv::BuiltIn::CullDistance)); + } +} + +bool LivenessManager::IsAnalyzedBuiltin(uint32_t bi) { + // There are only three builtins that can be analyzed and removed between + // two stages: PointSize, ClipDistance and CullDistance. All others are + // always consumed implicitly by the downstream stage. + const auto builtin = spv::BuiltIn(bi); + return builtin == spv::BuiltIn::PointSize || + builtin == spv::BuiltIn::ClipDistance || + builtin == spv::BuiltIn::CullDistance; +} + +bool LivenessManager::AnalyzeBuiltIn(uint32_t id) { + auto deco_mgr = context()->get_decoration_mgr(); + bool saw_builtin = false; + // Analyze all builtin decorations of |id|. + (void)deco_mgr->ForEachDecoration( + id, uint32_t(spv::Decoration::BuiltIn), + [this, &saw_builtin](const Instruction& deco_inst) { + saw_builtin = true; + // No need to process builtins in frag shader. All assumed used. + if (context()->GetStage() == spv::ExecutionModel::Fragment) return; + uint32_t builtin = uint32_t(spv::BuiltIn::Max); + if (deco_inst.opcode() == spv::Op::OpDecorate) + builtin = + deco_inst.GetSingleWordInOperand(kOpDecorateBuiltInLiteralInIdx); + else if (deco_inst.opcode() == spv::Op::OpMemberDecorate) + builtin = deco_inst.GetSingleWordInOperand( + kOpDecorateMemberBuiltInLiteralInIdx); + else + assert(false && "unexpected decoration"); + if (IsAnalyzedBuiltin(builtin)) live_builtins_.insert(builtin); + }); + return saw_builtin; +} + +void LivenessManager::MarkLocsLive(uint32_t start, uint32_t count) { + auto finish = start + count; + for (uint32_t u = start; u < finish; ++u) { + live_locs_.insert(u); + } +} + +uint32_t LivenessManager::GetLocSize(const analysis::Type* type) const { + auto arr_type = type->AsArray(); + if (arr_type) { + auto comp_type = arr_type->element_type(); + auto len_info = arr_type->length_info(); + assert(len_info.words[0] == analysis::Array::LengthInfo::kConstant && + "unexpected array length"); + auto comp_len = len_info.words[1]; + return comp_len * GetLocSize(comp_type); + } + auto struct_type = type->AsStruct(); + if (struct_type) { + uint32_t size = 0u; + for (auto& el_type : struct_type->element_types()) + size += GetLocSize(el_type); + return size; + } + auto mat_type = type->AsMatrix(); + if (mat_type) { + auto cnt = mat_type->element_count(); + auto comp_type = mat_type->element_type(); + return cnt * GetLocSize(comp_type); + } + auto vec_type = type->AsVector(); + if (vec_type) { + auto comp_type = vec_type->element_type(); + if (comp_type->AsInteger()) return 1; + auto float_type = comp_type->AsFloat(); + assert(float_type && "unexpected vector component type"); + auto width = float_type->width(); + if (width == 32 || width == 16) return 1; + assert(width == 64 && "unexpected float type width"); + auto comp_cnt = vec_type->element_count(); + return (comp_cnt > 2) ? 2 : 1; + } + assert((type->AsInteger() || type->AsFloat()) && "unexpected input type"); + return 1; +} + +const analysis::Type* LivenessManager::GetComponentType( + uint32_t index, const analysis::Type* agg_type) const { + auto arr_type = agg_type->AsArray(); + if (arr_type) return arr_type->element_type(); + auto struct_type = agg_type->AsStruct(); + if (struct_type) return struct_type->element_types()[index]; + auto mat_type = agg_type->AsMatrix(); + if (mat_type) return mat_type->element_type(); + auto vec_type = agg_type->AsVector(); + assert(vec_type && "unexpected non-aggregate type"); + return vec_type->element_type(); +} + +uint32_t LivenessManager::GetLocOffset(uint32_t index, + const analysis::Type* agg_type) const { + auto arr_type = agg_type->AsArray(); + if (arr_type) return index * GetLocSize(arr_type->element_type()); + auto struct_type = agg_type->AsStruct(); + if (struct_type) { + uint32_t offset = 0u; + uint32_t cnt = 0u; + for (auto& el_type : struct_type->element_types()) { + if (cnt == index) break; + offset += GetLocSize(el_type); + ++cnt; + } + return offset; + } + auto mat_type = agg_type->AsMatrix(); + if (mat_type) return index * GetLocSize(mat_type->element_type()); + auto vec_type = agg_type->AsVector(); + assert(vec_type && "unexpected non-aggregate type"); + auto comp_type = vec_type->element_type(); + auto flt_type = comp_type->AsFloat(); + if (flt_type && flt_type->width() == 64u && index >= 2u) return 1; + return 0; +} + +void LivenessManager::AnalyzeAccessChainLoc(const Instruction* ac, + const analysis::Type** curr_type, + uint32_t* offset, bool* no_loc, + bool is_patch, bool input) { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::DecorationManager* deco_mgr = context()->get_decoration_mgr(); + // For tesc, tese and geom input variables, and tesc output variables, + // first array index does not contribute to offset. + auto stage = context()->GetStage(); + bool skip_first_index = false; + if ((input && (stage == spv::ExecutionModel::TessellationControl || + stage == spv::ExecutionModel::TessellationEvaluation || + stage == spv::ExecutionModel::Geometry)) || + (!input && stage == spv::ExecutionModel::TessellationControl)) + skip_first_index = !is_patch; + uint32_t ocnt = 0; + ac->WhileEachInOperand([this, &ocnt, def_use_mgr, type_mgr, deco_mgr, + curr_type, offset, no_loc, + skip_first_index](const uint32_t* opnd) { + if (ocnt >= 1) { + // Skip first index's contribution to offset if indicated + if (ocnt == 1 && skip_first_index) { + auto arr_type = (*curr_type)->AsArray(); + assert(arr_type && "unexpected wrapper type"); + *curr_type = arr_type->element_type(); + ocnt++; + return true; + } + // If any non-constant index, mark the entire current object and return. + auto idx_inst = def_use_mgr->GetDef(*opnd); + if (idx_inst->opcode() != spv::Op::OpConstant) return false; + // If current type is struct, look for location decoration on member and + // reset offset if found. + auto index = idx_inst->GetSingleWordInOperand(0); + auto str_type = (*curr_type)->AsStruct(); + if (str_type) { + uint32_t loc = 0; + auto str_type_id = type_mgr->GetId(str_type); + bool no_mem_loc = deco_mgr->WhileEachDecoration( + str_type_id, uint32_t(spv::Decoration::Location), + [&loc, index, no_loc](const Instruction& deco) { + assert(deco.opcode() == spv::Op::OpMemberDecorate && + "unexpected decoration"); + if (deco.GetSingleWordInOperand(kOpDecorateMemberMemberInIdx) == + index) { + loc = + deco.GetSingleWordInOperand(kOpDecorateMemberLocationInIdx); + *no_loc = false; + return false; + } + return true; + }); + if (!no_mem_loc) { + *offset = loc; + *curr_type = GetComponentType(index, *curr_type); + ocnt++; + return true; + } + } + + // Update offset and current type based on constant index. + *offset += GetLocOffset(index, *curr_type); + *curr_type = GetComponentType(index, *curr_type); + } + ocnt++; + return true; + }); +} + +void LivenessManager::MarkRefLive(const Instruction* ref, Instruction* var) { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::DecorationManager* deco_mgr = context()->get_decoration_mgr(); + // Find variable location if present. + uint32_t loc = 0; + auto var_id = var->result_id(); + bool no_loc = deco_mgr->WhileEachDecoration( + var_id, uint32_t(spv::Decoration::Location), + [&loc](const Instruction& deco) { + assert(deco.opcode() == spv::Op::OpDecorate && "unexpected decoration"); + loc = deco.GetSingleWordInOperand(kDecorationLocationInIdx); + return false; + }); + // Find patch decoration if present + bool is_patch = !deco_mgr->WhileEachDecoration( + var_id, uint32_t(spv::Decoration::Patch), [](const Instruction& deco) { + if (deco.opcode() != spv::Op::OpDecorate) + assert(false && "unexpected decoration"); + return false; + }); + // If use is a load, mark all locations of var + auto ptr_type = type_mgr->GetType(var->type_id())->AsPointer(); + assert(ptr_type && "unexpected var type"); + auto var_type = ptr_type->pointee_type(); + if (ref->opcode() == spv::Op::OpLoad) { + assert(!no_loc && "missing input variable location"); + MarkLocsLive(loc, GetLocSize(var_type)); + return; + } + // Mark just those locations indicated by access chain + assert((ref->opcode() == spv::Op::OpAccessChain || + ref->opcode() == spv::Op::OpInBoundsAccessChain) && + "unexpected use of input variable"); + // Traverse access chain, compute location offset and type of reference + // through constant indices and mark those locs live. Assert if no location + // found. + uint32_t offset = loc; + auto curr_type = var_type; + AnalyzeAccessChainLoc(ref, &curr_type, &offset, &no_loc, is_patch); + assert(!no_loc && "missing input variable location"); + MarkLocsLive(offset, GetLocSize(curr_type)); +} + +void LivenessManager::ComputeLiveness() { + InitializeAnalysis(); + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + // Process all input variables + for (auto& var : context()->types_values()) { + if (var.opcode() != spv::Op::OpVariable) { + continue; + } + analysis::Type* var_type = type_mgr->GetType(var.type_id()); + analysis::Pointer* ptr_type = var_type->AsPointer(); + if (ptr_type->storage_class() != spv::StorageClass::Input) { + continue; + } + // If var is builtin, mark live if analyzed and continue to next variable + auto var_id = var.result_id(); + if (AnalyzeBuiltIn(var_id)) continue; + // If interface block with builtin members, mark live if analyzed and + // continue to next variable. Input interface blocks will only appear + // in tesc, tese and geom shaders. Will need to strip off one level of + // arrayness to get to block type. + auto pte_type = ptr_type->pointee_type(); + auto arr_type = pte_type->AsArray(); + if (arr_type) { + auto elt_type = arr_type->element_type(); + auto str_type = elt_type->AsStruct(); + if (str_type) { + auto str_type_id = type_mgr->GetId(str_type); + if (AnalyzeBuiltIn(str_type_id)) continue; + } + } + // Mark all used locations of var live + def_use_mgr->ForEachUser(var_id, [this, &var](Instruction* user) { + auto op = user->opcode(); + if (op == spv::Op::OpEntryPoint || op == spv::Op::OpName || + op == spv::Op::OpDecorate || user->IsNonSemanticInstruction()) { + return; + } + MarkRefLive(user, &var); + }); + } +} + +void LivenessManager::GetLiveness(std::unordered_set* live_locs, + std::unordered_set* live_builtins) { + if (!computed_) { + ComputeLiveness(); + computed_ = true; + } + *live_locs = live_locs_; + *live_builtins = live_builtins_; +} + +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/liveness.h b/bgfx/3rdparty/spirv-tools/source/opt/liveness.h new file mode 100644 index 00000000..7d8a9fb4 --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/liveness.h @@ -0,0 +1,99 @@ +// Copyright (c) 2022 The Khronos Group Inc. +// Copyright (c) 2022 LunarG Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SOURCE_OPT_LIVENESS_H_ +#define SOURCE_OPT_LIVENESS_H_ + +#include +#include + +namespace spvtools { +namespace opt { + +class IRContext; +class Instruction; + +namespace analysis { + +class Type; + +// This class represents the liveness of the input variables of a module +class LivenessManager { + public: + LivenessManager(IRContext* ctx); + + // Copy liveness info into |live_locs| and |builtin_locs|. + void GetLiveness(std::unordered_set* live_locs, + std::unordered_set* live_builtins); + + // Return true if builtin |bi| is being analyzed. + bool IsAnalyzedBuiltin(uint32_t bi); + + // Determine starting loc |offset| and the type |cur_type| of + // access chain |ac|. Set |no_loc| to true if no loc found. + // |is_patch| indicates if patch variable. |input| is true + // if input variable, otherwise output variable. + void AnalyzeAccessChainLoc(const Instruction* ac, + const analysis::Type** curr_type, uint32_t* offset, + bool* no_loc, bool is_patch, bool input = true); + + // Return size of |type_id| in units of locations + uint32_t GetLocSize(const analysis::Type* type) const; + + private: + IRContext* context() const { return ctx_; } + + // Initialize analysis + void InitializeAnalysis(); + + // Analyze |id| for builtin var and struct members. Return true if builtins + // found. + bool AnalyzeBuiltIn(uint32_t id); + + // Mark all live locations resulting from |user| of |var| at |loc|. + void MarkRefLive(const Instruction* user, Instruction* var); + + // Mark |count| locations starting at location |start|. + void MarkLocsLive(uint32_t start, uint32_t count); + + // Return type of component of aggregate type |agg_type| at |index| + const analysis::Type* GetComponentType(uint32_t index, + const analysis::Type* agg_type) const; + + // Return offset of |index| into aggregate type |agg_type| in units of + // input locations + uint32_t GetLocOffset(uint32_t index, const analysis::Type* agg_type) const; + + // Populate live_locs_ and live_builtins_ + void ComputeLiveness(); + + // IR context that owns this liveness manager. + IRContext* ctx_; + + // True if live_locs_ and live_builtins_ are computed + bool computed_; + + // Live locations + std::unordered_set live_locs_; + + // Live builtins + std::unordered_set live_builtins_; +}; + +} // namespace analysis +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LIVENESS_H_ diff --git a/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.cpp index d11682f3..d024af60 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.cpp @@ -16,23 +16,19 @@ #include "source/opt/local_access_chain_convert_pass.h" -#include "ir_builder.h" #include "ir_context.h" #include "iterator.h" #include "source/util/string_utils.h" namespace spvtools { namespace opt { - namespace { - -const uint32_t kStoreValIdInIdx = 1; -const uint32_t kAccessChainPtrIdInIdx = 0; - -} // anonymous namespace +constexpr uint32_t kStoreValIdInIdx = 1; +constexpr uint32_t kAccessChainPtrIdInIdx = 0; +} // namespace void LocalAccessChainConvertPass::BuildAndAppendInst( - SpvOp opcode, uint32_t typeId, uint32_t resultId, + spv::Op opcode, uint32_t typeId, uint32_t resultId, const std::vector& in_opnds, std::vector>* newInsts) { std::unique_ptr newInst( @@ -51,9 +47,9 @@ uint32_t LocalAccessChainConvertPass::BuildAndAppendVarLoad( *varId = ptrInst->GetSingleWordInOperand(kAccessChainPtrIdInIdx); const Instruction* varInst = get_def_use_mgr()->GetDef(*varId); - assert(varInst->opcode() == SpvOpVariable); + assert(varInst->opcode() == spv::Op::OpVariable); *varPteTypeId = GetPointeeTypeId(varInst); - BuildAndAppendInst(SpvOpLoad, *varPteTypeId, ldResultId, + BuildAndAppendInst(spv::Op::OpLoad, *varPteTypeId, ldResultId, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {*varId}}}, newInsts); return ldResultId; @@ -108,7 +104,8 @@ bool LocalAccessChainConvertPass::ReplaceAccessChainLoad( new_inst[0]->UpdateDebugInfoFrom(original_load); context()->get_decoration_mgr()->CloneDecorations( - original_load->result_id(), ldResultId, {SpvDecorationRelaxedPrecision}); + original_load->result_id(), ldResultId, + {spv::Decoration::RelaxedPrecision}); original_load->InsertBefore(std::move(new_inst)); context()->get_debug_info_mgr()->AnalyzeDebugInst( original_load->PreviousNode()); @@ -123,7 +120,7 @@ bool LocalAccessChainConvertPass::ReplaceAccessChainLoad( new_operands.emplace_back( Operand({spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ldResultId}})); AppendConstantOperands(address_inst, &new_operands); - original_load->SetOpcode(SpvOpCompositeExtract); + original_load->SetOpcode(spv::Op::OpCompositeExtract); original_load->ReplaceOperands(new_operands); context()->UpdateDefUse(original_load); return true; @@ -136,7 +133,7 @@ bool LocalAccessChainConvertPass::GenAccessChainStoreReplacement( // An access chain with no indices is essentially a copy. However, we still // have to create a new store because the old ones will be deleted. BuildAndAppendInst( - SpvOpStore, 0, 0, + spv::Op::OpStore, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ptrInst->GetSingleWordInOperand(kAccessChainPtrIdInIdx)}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {valId}}}, @@ -154,7 +151,7 @@ bool LocalAccessChainConvertPass::GenAccessChainStoreReplacement( } context()->get_decoration_mgr()->CloneDecorations( - varId, ldResultId, {SpvDecorationRelaxedPrecision}); + varId, ldResultId, {spv::Decoration::RelaxedPrecision}); // Build and append Insert const uint32_t insResultId = TakeNextId(); @@ -165,14 +162,14 @@ bool LocalAccessChainConvertPass::GenAccessChainStoreReplacement( {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {valId}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ldResultId}}}; AppendConstantOperands(ptrInst, &ins_in_opnds); - BuildAndAppendInst(SpvOpCompositeInsert, varPteTypeId, insResultId, + BuildAndAppendInst(spv::Op::OpCompositeInsert, varPteTypeId, insResultId, ins_in_opnds, newInsts); context()->get_decoration_mgr()->CloneDecorations( - varId, insResultId, {SpvDecorationRelaxedPrecision}); + varId, insResultId, {spv::Decoration::RelaxedPrecision}); // Build and append Store - BuildAndAppendInst(SpvOpStore, 0, 0, + BuildAndAppendInst(spv::Op::OpStore, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {varId}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {insResultId}}}, newInsts); @@ -185,7 +182,7 @@ bool LocalAccessChainConvertPass::Is32BitConstantIndexAccessChain( return acp->WhileEachInId([&inIdx, this](const uint32_t* tid) { if (inIdx > 0) { Instruction* opInst = get_def_use_mgr()->GetDef(*tid); - if (opInst->opcode() != SpvOpConstant) return false; + if (opInst->opcode() != spv::Op::OpConstant) return false; const auto* index = context()->get_constant_mgr()->GetConstantFromInst(opInst); int64_t index_value = index->GetSignExtendedValue(); @@ -204,13 +201,13 @@ bool LocalAccessChainConvertPass::HasOnlySupportedRefs(uint32_t ptrId) { user->GetCommonDebugOpcode() == CommonDebugInfoDebugDeclare) { return true; } - SpvOp op = user->opcode(); - if (IsNonPtrAccessChain(op) || op == SpvOpCopyObject) { + spv::Op op = user->opcode(); + if (IsNonPtrAccessChain(op) || op == spv::Op::OpCopyObject) { if (!HasOnlySupportedRefs(user->result_id())) { return false; } - } else if (op != SpvOpStore && op != SpvOpLoad && op != SpvOpName && - !IsNonTypeDecorate(op)) { + } else if (op != spv::Op::OpStore && op != spv::Op::OpLoad && + op != spv::Op::OpName && !IsNonTypeDecorate(op)) { return false; } return true; @@ -225,12 +222,12 @@ void LocalAccessChainConvertPass::FindTargetVars(Function* func) { for (auto bi = func->begin(); bi != func->end(); ++bi) { for (auto ii = bi->begin(); ii != bi->end(); ++ii) { switch (ii->opcode()) { - case SpvOpStore: - case SpvOpLoad: { + case spv::Op::OpStore: + case spv::Op::OpLoad: { uint32_t varId; Instruction* ptrInst = GetPtr(&*ii, &varId); if (!IsTargetVar(varId)) break; - const SpvOp op = ptrInst->opcode(); + const spv::Op op = ptrInst->opcode(); // Rule out variables with non-supported refs eg function calls if (!HasOnlySupportedRefs(varId)) { seen_non_target_vars_.insert(varId); @@ -276,7 +273,7 @@ Pass::Status LocalAccessChainConvertPass::ConvertLocalAccessChains( std::vector dead_instructions; for (auto ii = bi->begin(); ii != bi->end(); ++ii) { switch (ii->opcode()) { - case SpvOpLoad: { + case spv::Op::OpLoad: { uint32_t varId; Instruction* ptrInst = GetPtr(&*ii, &varId); if (!IsNonPtrAccessChain(ptrInst->opcode())) break; @@ -286,7 +283,7 @@ Pass::Status LocalAccessChainConvertPass::ConvertLocalAccessChains( } modified = true; } break; - case SpvOpStore: { + case spv::Op::OpStore: { uint32_t varId; Instruction* store = &*ii; Instruction* ptrInst = GetPtr(store, &varId); @@ -347,7 +344,7 @@ bool LocalAccessChainConvertPass::AllExtensionsSupported() const { // for the capability. This pass is only looking at function scope symbols, // so we do not care if there are variable pointers on storage buffers. if (context()->get_feature_mgr()->HasCapability( - SpvCapabilityVariablePointers)) + spv::Capability::VariablePointers)) return false; // If any extension not in allowlist, return false for (auto& ei : get_module()->extensions()) { @@ -359,7 +356,7 @@ bool LocalAccessChainConvertPass::AllExtensionsSupported() const { // around unknown extended // instruction sets even if they are non-semantic for (auto& inst : context()->module()->ext_inst_imports()) { - assert(inst.opcode() == SpvOpExtInstImport && + assert(inst.opcode() == spv::Op::OpExtInstImport && "Expecting an import of an extension's instruction set."); const std::string extension_name = inst.GetInOperand(0).AsString(); if (spvtools::utils::starts_with(extension_name, "NonSemantic.") && @@ -375,7 +372,8 @@ Pass::Status LocalAccessChainConvertPass::ProcessImpl() { // support required in KillNamesAndDecorates(). // TODO(greg-lunarg): Add support for OpGroupDecorate for (auto& ai : get_module()->annotations()) - if (ai.opcode() == SpvOpGroupDecorate) return Status::SuccessWithoutChange; + if (ai.opcode() == spv::Op::OpGroupDecorate) + return Status::SuccessWithoutChange; // Do not process if any disallowed extensions are enabled if (!AllExtensionsSupported()) return Status::SuccessWithoutChange; @@ -399,60 +397,37 @@ Pass::Status LocalAccessChainConvertPass::Process() { void LocalAccessChainConvertPass::InitExtensions() { extensions_allowlist_.clear(); - extensions_allowlist_.insert({ - "SPV_AMD_shader_explicit_vertex_parameter", - "SPV_AMD_shader_trinary_minmax", - "SPV_AMD_gcn_shader", - "SPV_KHR_shader_ballot", - "SPV_AMD_shader_ballot", - "SPV_AMD_gpu_shader_half_float", - "SPV_KHR_shader_draw_parameters", - "SPV_KHR_subgroup_vote", - "SPV_KHR_8bit_storage", - "SPV_KHR_16bit_storage", - "SPV_KHR_device_group", - "SPV_KHR_multiview", - "SPV_NVX_multiview_per_view_attributes", - "SPV_NV_viewport_array2", - "SPV_NV_stereo_view_rendering", - "SPV_NV_sample_mask_override_coverage", - "SPV_NV_geometry_shader_passthrough", - "SPV_AMD_texture_gather_bias_lod", - "SPV_KHR_storage_buffer_storage_class", - // SPV_KHR_variable_pointers - // Currently do not support extended pointer expressions - "SPV_AMD_gpu_shader_int16", - "SPV_KHR_post_depth_coverage", - "SPV_KHR_shader_atomic_counter_ops", - "SPV_EXT_shader_stencil_export", - "SPV_EXT_shader_viewport_index_layer", - "SPV_AMD_shader_image_load_store_lod", - "SPV_AMD_shader_fragment_mask", - "SPV_EXT_fragment_fully_covered", - "SPV_AMD_gpu_shader_half_float_fetch", - "SPV_GOOGLE_decorate_string", - "SPV_GOOGLE_hlsl_functionality1", - "SPV_GOOGLE_user_type", - "SPV_NV_shader_subgroup_partitioned", - "SPV_EXT_demote_to_helper_invocation", - "SPV_EXT_descriptor_indexing", - "SPV_NV_fragment_shader_barycentric", - "SPV_NV_compute_shader_derivatives", - "SPV_NV_shader_image_footprint", - "SPV_NV_shading_rate", - "SPV_NV_mesh_shader", - "SPV_NV_ray_tracing", - "SPV_KHR_ray_tracing", - "SPV_KHR_ray_query", - "SPV_EXT_fragment_invocation_density", - "SPV_KHR_terminate_invocation", - "SPV_KHR_subgroup_uniform_control_flow", - "SPV_KHR_integer_dot_product", - "SPV_EXT_shader_image_int64", - "SPV_KHR_non_semantic_info", - "SPV_KHR_uniform_group_instructions", - "SPV_KHR_fragment_shader_barycentric", - }); + extensions_allowlist_.insert( + {"SPV_AMD_shader_explicit_vertex_parameter", + "SPV_AMD_shader_trinary_minmax", "SPV_AMD_gcn_shader", + "SPV_KHR_shader_ballot", "SPV_AMD_shader_ballot", + "SPV_AMD_gpu_shader_half_float", "SPV_KHR_shader_draw_parameters", + "SPV_KHR_subgroup_vote", "SPV_KHR_8bit_storage", "SPV_KHR_16bit_storage", + "SPV_KHR_device_group", "SPV_KHR_multiview", + "SPV_NVX_multiview_per_view_attributes", "SPV_NV_viewport_array2", + "SPV_NV_stereo_view_rendering", "SPV_NV_sample_mask_override_coverage", + "SPV_NV_geometry_shader_passthrough", "SPV_AMD_texture_gather_bias_lod", + "SPV_KHR_storage_buffer_storage_class", + // SPV_KHR_variable_pointers + // Currently do not support extended pointer expressions + "SPV_AMD_gpu_shader_int16", "SPV_KHR_post_depth_coverage", + "SPV_KHR_shader_atomic_counter_ops", "SPV_EXT_shader_stencil_export", + "SPV_EXT_shader_viewport_index_layer", + "SPV_AMD_shader_image_load_store_lod", "SPV_AMD_shader_fragment_mask", + "SPV_EXT_fragment_fully_covered", "SPV_AMD_gpu_shader_half_float_fetch", + "SPV_GOOGLE_decorate_string", "SPV_GOOGLE_hlsl_functionality1", + "SPV_GOOGLE_user_type", "SPV_NV_shader_subgroup_partitioned", + "SPV_EXT_demote_to_helper_invocation", "SPV_EXT_descriptor_indexing", + "SPV_NV_fragment_shader_barycentric", + "SPV_NV_compute_shader_derivatives", "SPV_NV_shader_image_footprint", + "SPV_NV_shading_rate", "SPV_NV_mesh_shader", "SPV_NV_ray_tracing", + "SPV_KHR_ray_tracing", "SPV_KHR_ray_query", + "SPV_EXT_fragment_invocation_density", "SPV_KHR_terminate_invocation", + "SPV_KHR_subgroup_uniform_control_flow", "SPV_KHR_integer_dot_product", + "SPV_EXT_shader_image_int64", "SPV_KHR_non_semantic_info", + "SPV_KHR_uniform_group_instructions", + "SPV_KHR_fragment_shader_barycentric", "SPV_KHR_vulkan_memory_model", + "SPV_NV_bindless_texture", "SPV_EXT_shader_atomic_float_add"}); } bool LocalAccessChainConvertPass::AnyIndexIsOutOfBounds( diff --git a/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.h index c3731b1c..0cda196f 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.h @@ -64,7 +64,7 @@ class LocalAccessChainConvertPass : public MemPass { // Build instruction from |opcode|, |typeId|, |resultId|, and |in_opnds|. // Append to |newInsts|. - void BuildAndAppendInst(SpvOp opcode, uint32_t typeId, uint32_t resultId, + void BuildAndAppendInst(spv::Op opcode, uint32_t typeId, uint32_t resultId, const std::vector& in_opnds, std::vector>* newInsts); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/local_single_block_elim_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/local_single_block_elim_pass.cpp index a58e8e4c..5e524c45 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/local_single_block_elim_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/local_single_block_elim_pass.cpp @@ -18,16 +18,13 @@ #include -#include "source/opt/iterator.h" #include "source/util/string_utils.h" namespace spvtools { namespace opt { namespace { - -const uint32_t kStoreValIdInIdx = 1; - -} // anonymous namespace +constexpr uint32_t kStoreValIdInIdx = 1; +} // namespace bool LocalSingleBlockLoadStoreElimPass::HasOnlySupportedRefs(uint32_t ptrId) { if (supported_ref_ptrs_.find(ptrId) != supported_ref_ptrs_.end()) return true; @@ -37,13 +34,13 @@ bool LocalSingleBlockLoadStoreElimPass::HasOnlySupportedRefs(uint32_t ptrId) { dbg_op == CommonDebugInfoDebugValue) { return true; } - SpvOp op = user->opcode(); - if (IsNonPtrAccessChain(op) || op == SpvOpCopyObject) { + spv::Op op = user->opcode(); + if (IsNonPtrAccessChain(op) || op == spv::Op::OpCopyObject) { if (!HasOnlySupportedRefs(user->result_id())) { return false; } - } else if (op != SpvOpStore && op != SpvOpLoad && op != SpvOpName && - !IsNonTypeDecorate(op)) { + } else if (op != spv::Op::OpStore && op != spv::Op::OpLoad && + op != spv::Op::OpName && !IsNonTypeDecorate(op)) { return false; } return true; @@ -68,7 +65,7 @@ bool LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElim( for (auto ii = next; ii != bi->end(); ii = next) { ++next; switch (ii->opcode()) { - case SpvOpStore: { + case spv::Op::OpStore: { // Verify store variable is target type uint32_t varId; Instruction* ptrInst = GetPtr(&*ii, &varId); @@ -77,7 +74,7 @@ bool LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElim( // If a store to the whole variable, remember it for succeeding // loads and stores. Otherwise forget any previous store to that // variable. - if (ptrInst->opcode() == SpvOpVariable) { + if (ptrInst->opcode() == spv::Op::OpVariable) { // If a previous store to same variable, mark the store // for deletion if not still used. Don't delete store // if debugging; let ssa-rewrite and DCE handle it @@ -114,14 +111,14 @@ bool LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElim( var2load_.erase(varId); } } break; - case SpvOpLoad: { + case spv::Op::OpLoad: { // Verify store variable is target type uint32_t varId; Instruction* ptrInst = GetPtr(&*ii, &varId); if (!IsTargetVar(varId)) continue; if (!HasOnlySupportedRefs(varId)) continue; uint32_t replId = 0; - if (ptrInst->opcode() == SpvOpVariable) { + if (ptrInst->opcode() == spv::Op::OpVariable) { // If a load from a variable, look for a previous store or // load from that variable and use its value. auto si = var2store_.find(varId); @@ -146,11 +143,11 @@ bool LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElim( instructions_to_kill.push_back(&*ii); modified = true; } else { - if (ptrInst->opcode() == SpvOpVariable) + if (ptrInst->opcode() == spv::Op::OpVariable) var2load_[varId] = &*ii; // register load } } break; - case SpvOpFunctionCall: { + case spv::Op::OpFunctionCall: { // Conservatively assume all locals are redefined for now. // TODO(): Handle more optimally var2store_.clear(); @@ -192,7 +189,7 @@ bool LocalSingleBlockLoadStoreElimPass::AllExtensionsSupported() const { // around unknown extended // instruction sets even if they are non-semantic for (auto& inst : context()->module()->ext_inst_imports()) { - assert(inst.opcode() == SpvOpExtInstImport && + assert(inst.opcode() == spv::Op::OpExtInstImport && "Expecting an import of an extension's instruction set."); const std::string extension_name = inst.GetInOperand(0).AsString(); if (spvtools::utils::starts_with(extension_name, "NonSemantic.") && @@ -205,14 +202,15 @@ bool LocalSingleBlockLoadStoreElimPass::AllExtensionsSupported() const { Pass::Status LocalSingleBlockLoadStoreElimPass::ProcessImpl() { // Assumes relaxed logical addressing only (see instruction.h). - if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses)) + if (context()->get_feature_mgr()->HasCapability(spv::Capability::Addresses)) return Status::SuccessWithoutChange; // Do not process if module contains OpGroupDecorate. Additional // support required in KillNamesAndDecorates(). // TODO(greg-lunarg): Add support for OpGroupDecorate for (auto& ai : get_module()->annotations()) - if (ai.opcode() == SpvOpGroupDecorate) return Status::SuccessWithoutChange; + if (ai.opcode() == spv::Op::OpGroupDecorate) + return Status::SuccessWithoutChange; // If any extensions in the module are not explicitly supported, // return unmodified. if (!AllExtensionsSupported()) return Status::SuccessWithoutChange; @@ -235,60 +233,61 @@ Pass::Status LocalSingleBlockLoadStoreElimPass::Process() { void LocalSingleBlockLoadStoreElimPass::InitExtensions() { extensions_allowlist_.clear(); - extensions_allowlist_.insert({ - "SPV_AMD_shader_explicit_vertex_parameter", - "SPV_AMD_shader_trinary_minmax", - "SPV_AMD_gcn_shader", - "SPV_KHR_shader_ballot", - "SPV_AMD_shader_ballot", - "SPV_AMD_gpu_shader_half_float", - "SPV_KHR_shader_draw_parameters", - "SPV_KHR_subgroup_vote", - "SPV_KHR_8bit_storage", - "SPV_KHR_16bit_storage", - "SPV_KHR_device_group", - "SPV_KHR_multiview", - "SPV_NVX_multiview_per_view_attributes", - "SPV_NV_viewport_array2", - "SPV_NV_stereo_view_rendering", - "SPV_NV_sample_mask_override_coverage", - "SPV_NV_geometry_shader_passthrough", - "SPV_AMD_texture_gather_bias_lod", - "SPV_KHR_storage_buffer_storage_class", - "SPV_KHR_variable_pointers", - "SPV_AMD_gpu_shader_int16", - "SPV_KHR_post_depth_coverage", - "SPV_KHR_shader_atomic_counter_ops", - "SPV_EXT_shader_stencil_export", - "SPV_EXT_shader_viewport_index_layer", - "SPV_AMD_shader_image_load_store_lod", - "SPV_AMD_shader_fragment_mask", - "SPV_EXT_fragment_fully_covered", - "SPV_AMD_gpu_shader_half_float_fetch", - "SPV_GOOGLE_decorate_string", - "SPV_GOOGLE_hlsl_functionality1", - "SPV_GOOGLE_user_type", - "SPV_NV_shader_subgroup_partitioned", - "SPV_EXT_demote_to_helper_invocation", - "SPV_EXT_descriptor_indexing", - "SPV_NV_fragment_shader_barycentric", - "SPV_NV_compute_shader_derivatives", - "SPV_NV_shader_image_footprint", - "SPV_NV_shading_rate", - "SPV_NV_mesh_shader", - "SPV_NV_ray_tracing", - "SPV_KHR_ray_tracing", - "SPV_KHR_ray_query", - "SPV_EXT_fragment_invocation_density", - "SPV_EXT_physical_storage_buffer", - "SPV_KHR_terminate_invocation", - "SPV_KHR_subgroup_uniform_control_flow", - "SPV_KHR_integer_dot_product", - "SPV_EXT_shader_image_int64", - "SPV_KHR_non_semantic_info", - "SPV_KHR_uniform_group_instructions", - "SPV_KHR_fragment_shader_barycentric", - }); + extensions_allowlist_.insert({"SPV_AMD_shader_explicit_vertex_parameter", + "SPV_AMD_shader_trinary_minmax", + "SPV_AMD_gcn_shader", + "SPV_KHR_shader_ballot", + "SPV_AMD_shader_ballot", + "SPV_AMD_gpu_shader_half_float", + "SPV_KHR_shader_draw_parameters", + "SPV_KHR_subgroup_vote", + "SPV_KHR_8bit_storage", + "SPV_KHR_16bit_storage", + "SPV_KHR_device_group", + "SPV_KHR_multiview", + "SPV_NVX_multiview_per_view_attributes", + "SPV_NV_viewport_array2", + "SPV_NV_stereo_view_rendering", + "SPV_NV_sample_mask_override_coverage", + "SPV_NV_geometry_shader_passthrough", + "SPV_AMD_texture_gather_bias_lod", + "SPV_KHR_storage_buffer_storage_class", + "SPV_KHR_variable_pointers", + "SPV_AMD_gpu_shader_int16", + "SPV_KHR_post_depth_coverage", + "SPV_KHR_shader_atomic_counter_ops", + "SPV_EXT_shader_stencil_export", + "SPV_EXT_shader_viewport_index_layer", + "SPV_AMD_shader_image_load_store_lod", + "SPV_AMD_shader_fragment_mask", + "SPV_EXT_fragment_fully_covered", + "SPV_AMD_gpu_shader_half_float_fetch", + "SPV_GOOGLE_decorate_string", + "SPV_GOOGLE_hlsl_functionality1", + "SPV_GOOGLE_user_type", + "SPV_NV_shader_subgroup_partitioned", + "SPV_EXT_demote_to_helper_invocation", + "SPV_EXT_descriptor_indexing", + "SPV_NV_fragment_shader_barycentric", + "SPV_NV_compute_shader_derivatives", + "SPV_NV_shader_image_footprint", + "SPV_NV_shading_rate", + "SPV_NV_mesh_shader", + "SPV_NV_ray_tracing", + "SPV_KHR_ray_tracing", + "SPV_KHR_ray_query", + "SPV_EXT_fragment_invocation_density", + "SPV_EXT_physical_storage_buffer", + "SPV_KHR_terminate_invocation", + "SPV_KHR_subgroup_uniform_control_flow", + "SPV_KHR_integer_dot_product", + "SPV_EXT_shader_image_int64", + "SPV_KHR_non_semantic_info", + "SPV_KHR_uniform_group_instructions", + "SPV_KHR_fragment_shader_barycentric", + "SPV_KHR_vulkan_memory_model", + "SPV_NV_bindless_texture", + "SPV_EXT_shader_atomic_float_add"}); } } // namespace opt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/local_single_store_elim_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/local_single_store_elim_pass.cpp index 81648c7b..fefe2ce9 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/local_single_store_elim_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/local_single_store_elim_pass.cpp @@ -17,19 +17,14 @@ #include "source/opt/local_single_store_elim_pass.h" #include "source/cfa.h" -#include "source/latest_version_glsl_std_450_header.h" -#include "source/opt/iterator.h" #include "source/util/string_utils.h" namespace spvtools { namespace opt { - namespace { - -const uint32_t kStoreValIdInIdx = 1; -const uint32_t kVariableInitIdInIdx = 1; - -} // anonymous namespace +constexpr uint32_t kStoreValIdInIdx = 1; +constexpr uint32_t kVariableInitIdInIdx = 1; +} // namespace bool LocalSingleStoreElimPass::LocalSingleStoreElim(Function* func) { bool modified = false; @@ -37,7 +32,7 @@ bool LocalSingleStoreElimPass::LocalSingleStoreElim(Function* func) { // Check all function scope variables in |func|. BasicBlock* entry_block = &*func->begin(); for (Instruction& inst : *entry_block) { - if (inst.opcode() != SpvOpVariable) { + if (inst.opcode() != spv::Op::OpVariable) { break; } @@ -57,7 +52,7 @@ bool LocalSingleStoreElimPass::AllExtensionsSupported() const { // around unknown extended // instruction sets even if they are non-semantic for (auto& inst : context()->module()->ext_inst_imports()) { - assert(inst.opcode() == SpvOpExtInstImport && + assert(inst.opcode() == spv::Op::OpExtInstImport && "Expecting an import of an extension's instruction set."); const std::string extension_name = inst.GetInOperand(0).AsString(); if (spvtools::utils::starts_with(extension_name, "NonSemantic.") && @@ -70,7 +65,7 @@ bool LocalSingleStoreElimPass::AllExtensionsSupported() const { Pass::Status LocalSingleStoreElimPass::ProcessImpl() { // Assumes relaxed logical addressing only (see instruction.h) - if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses)) + if (context()->get_feature_mgr()->HasCapability(spv::Capability::Addresses)) return Status::SuccessWithoutChange; // Do not process if any disallowed extensions are enabled @@ -91,57 +86,58 @@ Pass::Status LocalSingleStoreElimPass::Process() { } void LocalSingleStoreElimPass::InitExtensionAllowList() { - extensions_allowlist_.insert({ - "SPV_AMD_shader_explicit_vertex_parameter", - "SPV_AMD_shader_trinary_minmax", - "SPV_AMD_gcn_shader", - "SPV_KHR_shader_ballot", - "SPV_AMD_shader_ballot", - "SPV_AMD_gpu_shader_half_float", - "SPV_KHR_shader_draw_parameters", - "SPV_KHR_subgroup_vote", - "SPV_KHR_8bit_storage", - "SPV_KHR_16bit_storage", - "SPV_KHR_device_group", - "SPV_KHR_multiview", - "SPV_NVX_multiview_per_view_attributes", - "SPV_NV_viewport_array2", - "SPV_NV_stereo_view_rendering", - "SPV_NV_sample_mask_override_coverage", - "SPV_NV_geometry_shader_passthrough", - "SPV_AMD_texture_gather_bias_lod", - "SPV_KHR_storage_buffer_storage_class", - "SPV_KHR_variable_pointers", - "SPV_AMD_gpu_shader_int16", - "SPV_KHR_post_depth_coverage", - "SPV_KHR_shader_atomic_counter_ops", - "SPV_EXT_shader_stencil_export", - "SPV_EXT_shader_viewport_index_layer", - "SPV_AMD_shader_image_load_store_lod", - "SPV_AMD_shader_fragment_mask", - "SPV_EXT_fragment_fully_covered", - "SPV_AMD_gpu_shader_half_float_fetch", - "SPV_GOOGLE_decorate_string", - "SPV_GOOGLE_hlsl_functionality1", - "SPV_NV_shader_subgroup_partitioned", - "SPV_EXT_descriptor_indexing", - "SPV_NV_fragment_shader_barycentric", - "SPV_NV_compute_shader_derivatives", - "SPV_NV_shader_image_footprint", - "SPV_NV_shading_rate", - "SPV_NV_mesh_shader", - "SPV_NV_ray_tracing", - "SPV_KHR_ray_query", - "SPV_EXT_fragment_invocation_density", - "SPV_EXT_physical_storage_buffer", - "SPV_KHR_terminate_invocation", - "SPV_KHR_subgroup_uniform_control_flow", - "SPV_KHR_integer_dot_product", - "SPV_EXT_shader_image_int64", - "SPV_KHR_non_semantic_info", - "SPV_KHR_uniform_group_instructions", - "SPV_KHR_fragment_shader_barycentric", - }); + extensions_allowlist_.insert({"SPV_AMD_shader_explicit_vertex_parameter", + "SPV_AMD_shader_trinary_minmax", + "SPV_AMD_gcn_shader", + "SPV_KHR_shader_ballot", + "SPV_AMD_shader_ballot", + "SPV_AMD_gpu_shader_half_float", + "SPV_KHR_shader_draw_parameters", + "SPV_KHR_subgroup_vote", + "SPV_KHR_8bit_storage", + "SPV_KHR_16bit_storage", + "SPV_KHR_device_group", + "SPV_KHR_multiview", + "SPV_NVX_multiview_per_view_attributes", + "SPV_NV_viewport_array2", + "SPV_NV_stereo_view_rendering", + "SPV_NV_sample_mask_override_coverage", + "SPV_NV_geometry_shader_passthrough", + "SPV_AMD_texture_gather_bias_lod", + "SPV_KHR_storage_buffer_storage_class", + "SPV_KHR_variable_pointers", + "SPV_AMD_gpu_shader_int16", + "SPV_KHR_post_depth_coverage", + "SPV_KHR_shader_atomic_counter_ops", + "SPV_EXT_shader_stencil_export", + "SPV_EXT_shader_viewport_index_layer", + "SPV_AMD_shader_image_load_store_lod", + "SPV_AMD_shader_fragment_mask", + "SPV_EXT_fragment_fully_covered", + "SPV_AMD_gpu_shader_half_float_fetch", + "SPV_GOOGLE_decorate_string", + "SPV_GOOGLE_hlsl_functionality1", + "SPV_NV_shader_subgroup_partitioned", + "SPV_EXT_descriptor_indexing", + "SPV_NV_fragment_shader_barycentric", + "SPV_NV_compute_shader_derivatives", + "SPV_NV_shader_image_footprint", + "SPV_NV_shading_rate", + "SPV_NV_mesh_shader", + "SPV_NV_ray_tracing", + "SPV_KHR_ray_query", + "SPV_EXT_fragment_invocation_density", + "SPV_EXT_physical_storage_buffer", + "SPV_KHR_terminate_invocation", + "SPV_KHR_subgroup_uniform_control_flow", + "SPV_KHR_integer_dot_product", + "SPV_EXT_shader_image_int64", + "SPV_KHR_non_semantic_info", + "SPV_KHR_uniform_group_instructions", + "SPV_KHR_fragment_shader_barycentric", + "SPV_KHR_vulkan_memory_model", + "SPV_NV_bindless_texture", + "SPV_EXT_shader_atomic_float_add"}); } bool LocalSingleStoreElimPass::ProcessVariable(Instruction* var_inst) { std::vector users; @@ -194,7 +190,7 @@ Instruction* LocalSingleStoreElimPass::FindSingleStoreAndCheckUses( for (Instruction* user : users) { switch (user->opcode()) { - case SpvOpStore: + case spv::Op::OpStore: // Since we are in the relaxed addressing mode, the use has to be the // base address of the store, and not the value being store. Otherwise, // we would have a pointer to a pointer to function scope memory, which @@ -206,19 +202,19 @@ Instruction* LocalSingleStoreElimPass::FindSingleStoreAndCheckUses( return nullptr; } break; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: if (FeedsAStore(user)) { // Has a partial store. Cannot propagate that. return nullptr; } break; - case SpvOpLoad: - case SpvOpImageTexelPointer: - case SpvOpName: - case SpvOpCopyObject: + case spv::Op::OpLoad: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpName: + case spv::Op::OpCopyObject: break; - case SpvOpExtInst: { + case spv::Op::OpExtInst: { auto dbg_op = user->GetCommonDebugOpcode(); if (dbg_op == CommonDebugInfoDebugDeclare || dbg_op == CommonDebugInfoDebugValue) { @@ -243,7 +239,7 @@ void LocalSingleStoreElimPass::FindUses( analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); def_use_mgr->ForEachUser(var_inst, [users, this](Instruction* user) { users->push_back(user); - if (user->opcode() == SpvOpCopyObject) { + if (user->opcode() == spv::Op::OpCopyObject) { FindUses(user, users); } }); @@ -253,15 +249,15 @@ bool LocalSingleStoreElimPass::FeedsAStore(Instruction* inst) const { analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); return !def_use_mgr->WhileEachUser(inst, [this](Instruction* user) { switch (user->opcode()) { - case SpvOpStore: + case spv::Op::OpStore: return false; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpCopyObject: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpCopyObject: return !FeedsAStore(user); - case SpvOpLoad: - case SpvOpImageTexelPointer: - case SpvOpName: + case spv::Op::OpLoad: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpName: return true; default: // Don't know if this instruction modifies the variable. @@ -279,7 +275,7 @@ bool LocalSingleStoreElimPass::RewriteLoads( context()->GetDominatorAnalysis(store_block->GetParent()); uint32_t stored_id; - if (store_inst->opcode() == SpvOpStore) + if (store_inst->opcode() == spv::Op::OpStore) stored_id = store_inst->GetSingleWordInOperand(kStoreValIdInIdx); else stored_id = store_inst->GetSingleWordInOperand(kVariableInitIdInIdx); @@ -287,12 +283,12 @@ bool LocalSingleStoreElimPass::RewriteLoads( *all_rewritten = true; bool modified = false; for (Instruction* use : uses) { - if (use->opcode() == SpvOpStore) continue; + if (use->opcode() == spv::Op::OpStore) continue; auto dbg_op = use->GetCommonDebugOpcode(); if (dbg_op == CommonDebugInfoDebugDeclare || dbg_op == CommonDebugInfoDebugValue) continue; - if (use->opcode() == SpvOpLoad && + if (use->opcode() == spv::Op::OpLoad && dominator_analysis->Dominates(store_inst, use)) { modified = true; context()->KillNamesAndDecorates(use->result_id()); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence.cpp b/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence.cpp index d8de699b..e41c044a 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence.cpp @@ -15,14 +15,12 @@ #include "source/opt/loop_dependence.h" #include -#include #include #include #include #include #include "source/opt/instruction.h" -#include "source/opt/scalar_analysis.h" #include "source/opt/scalar_analysis_nodes.h" namespace spvtools { @@ -192,8 +190,8 @@ bool LoopDependenceAnalysis::GetDependence(const Instruction* source, Instruction* destination_access_chain = GetOperandDefinition(destination, 0); auto num_access_chains = - (source_access_chain->opcode() == SpvOpAccessChain) + - (destination_access_chain->opcode() == SpvOpAccessChain); + (source_access_chain->opcode() == spv::Op::OpAccessChain) + + (destination_access_chain->opcode() == spv::Op::OpAccessChain); // If neither is an access chain, then they are load/store to a variable. if (num_access_chains == 0) { @@ -211,7 +209,8 @@ bool LoopDependenceAnalysis::GetDependence(const Instruction* source, // If only one is an access chain, it could be accessing a part of a struct if (num_access_chains == 1) { - auto source_is_chain = source_access_chain->opcode() == SpvOpAccessChain; + auto source_is_chain = + source_access_chain->opcode() == spv::Op::OpAccessChain; auto access_chain = source_is_chain ? source_access_chain : destination_access_chain; auto variable = @@ -238,8 +237,8 @@ bool LoopDependenceAnalysis::GetDependence(const Instruction* source, GetOperandDefinition(destination_access_chain, 0); // Nested access chains are not supported yet, bail out. - if (source_array->opcode() == SpvOpAccessChain || - destination_array->opcode() == SpvOpAccessChain) { + if (source_array->opcode() == spv::Op::OpAccessChain || + destination_array->opcode() == spv::Op::OpAccessChain) { for (auto& entry : distance_vector->GetEntries()) { entry = DistanceEntry(); } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence_helpers.cpp b/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence_helpers.cpp index de27a0a7..5d7d9940 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence_helpers.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence_helpers.cpp @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/opt/loop_dependence.h" - #include #include #include @@ -23,7 +21,7 @@ #include "source/opt/basic_block.h" #include "source/opt/instruction.h" -#include "source/opt/scalar_analysis.h" +#include "source/opt/loop_dependence.h" #include "source/opt/scalar_analysis_nodes.h" namespace spvtools { @@ -54,20 +52,20 @@ SENode* LoopDependenceAnalysis::GetLowerBound(const Loop* loop) { } Instruction* lower_inst = GetOperandDefinition(cond_inst, 0); switch (cond_inst->opcode()) { - case SpvOpULessThan: - case SpvOpSLessThan: - case SpvOpULessThanEqual: - case SpvOpSLessThanEqual: - case SpvOpUGreaterThan: - case SpvOpSGreaterThan: - case SpvOpUGreaterThanEqual: - case SpvOpSGreaterThanEqual: { + case spv::Op::OpULessThan: + case spv::Op::OpSLessThan: + case spv::Op::OpULessThanEqual: + case spv::Op::OpSLessThanEqual: + case spv::Op::OpUGreaterThan: + case spv::Op::OpSGreaterThan: + case spv::Op::OpUGreaterThanEqual: + case spv::Op::OpSGreaterThanEqual: { // If we have a phi we are looking at the induction variable. We look // through the phi to the initial value of the phi upon entering the loop. - if (lower_inst->opcode() == SpvOpPhi) { + if (lower_inst->opcode() == spv::Op::OpPhi) { lower_inst = GetOperandDefinition(lower_inst, 0); // We don't handle looking through multiple phis. - if (lower_inst->opcode() == SpvOpPhi) { + if (lower_inst->opcode() == spv::Op::OpPhi) { return nullptr; } } @@ -86,8 +84,8 @@ SENode* LoopDependenceAnalysis::GetUpperBound(const Loop* loop) { } Instruction* upper_inst = GetOperandDefinition(cond_inst, 1); switch (cond_inst->opcode()) { - case SpvOpULessThan: - case SpvOpSLessThan: { + case spv::Op::OpULessThan: + case spv::Op::OpSLessThan: { // When we have a < condition we must subtract 1 from the analyzed upper // instruction. SENode* upper_bound = scalar_evolution_.SimplifyExpression( @@ -96,8 +94,8 @@ SENode* LoopDependenceAnalysis::GetUpperBound(const Loop* loop) { scalar_evolution_.CreateConstant(1))); return upper_bound; } - case SpvOpUGreaterThan: - case SpvOpSGreaterThan: { + case spv::Op::OpUGreaterThan: + case spv::Op::OpSGreaterThan: { // When we have a > condition we must add 1 to the analyzed upper // instruction. SENode* upper_bound = @@ -106,10 +104,10 @@ SENode* LoopDependenceAnalysis::GetUpperBound(const Loop* loop) { scalar_evolution_.CreateConstant(1))); return upper_bound; } - case SpvOpULessThanEqual: - case SpvOpSLessThanEqual: - case SpvOpUGreaterThanEqual: - case SpvOpSGreaterThanEqual: { + case spv::Op::OpULessThanEqual: + case spv::Op::OpSLessThanEqual: + case spv::Op::OpUGreaterThanEqual: + case spv::Op::OpSGreaterThanEqual: { // We don't need to modify the results of analyzing when we have <= or >=. SENode* upper_bound = scalar_evolution_.SimplifyExpression( scalar_evolution_.AnalyzeInstruction(upper_inst)); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.cpp b/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.cpp index 13982d18..cbfc2e75 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.cpp @@ -15,17 +15,14 @@ #include "source/opt/loop_descriptor.h" #include -#include #include #include -#include #include #include #include "source/opt/cfg.h" #include "source/opt/constants.h" #include "source/opt/dominator_tree.h" -#include "source/opt/ir_builder.h" #include "source/opt/ir_context.h" #include "source/opt/iterator.h" #include "source/opt/tree_iterator.h" @@ -39,7 +36,7 @@ namespace opt { Instruction* Loop::GetInductionStepOperation( const Instruction* induction) const { // Induction must be a phi instruction. - assert(induction->opcode() == SpvOpPhi); + assert(induction->opcode() == spv::Op::OpPhi); Instruction* step = nullptr; @@ -75,8 +72,8 @@ Instruction* Loop::GetInductionStepOperation( return nullptr; } - if (def_use_manager->GetDef(lhs)->opcode() != SpvOp::SpvOpConstant && - def_use_manager->GetDef(rhs)->opcode() != SpvOp::SpvOpConstant) { + if (def_use_manager->GetDef(lhs)->opcode() != spv::Op::OpConstant && + def_use_manager->GetDef(rhs)->opcode() != spv::Op::OpConstant) { return nullptr; } @@ -85,31 +82,31 @@ Instruction* Loop::GetInductionStepOperation( // Returns true if the |step| operation is an induction variable step operation // which is currently handled. -bool Loop::IsSupportedStepOp(SpvOp step) const { +bool Loop::IsSupportedStepOp(spv::Op step) const { switch (step) { - case SpvOp::SpvOpISub: - case SpvOp::SpvOpIAdd: + case spv::Op::OpISub: + case spv::Op::OpIAdd: return true; default: return false; } } -bool Loop::IsSupportedCondition(SpvOp condition) const { +bool Loop::IsSupportedCondition(spv::Op condition) const { switch (condition) { // < - case SpvOp::SpvOpULessThan: - case SpvOp::SpvOpSLessThan: + case spv::Op::OpULessThan: + case spv::Op::OpSLessThan: // > - case SpvOp::SpvOpUGreaterThan: - case SpvOp::SpvOpSGreaterThan: + case spv::Op::OpUGreaterThan: + case spv::Op::OpSGreaterThan: // >= - case SpvOp::SpvOpSGreaterThanEqual: - case SpvOp::SpvOpUGreaterThanEqual: + case spv::Op::OpSGreaterThanEqual: + case spv::Op::OpUGreaterThanEqual: // <= - case SpvOp::SpvOpSLessThanEqual: - case SpvOp::SpvOpULessThanEqual: + case spv::Op::OpSLessThanEqual: + case spv::Op::OpULessThanEqual: return true; default: @@ -117,7 +114,8 @@ bool Loop::IsSupportedCondition(SpvOp condition) const { } } -int64_t Loop::GetResidualConditionValue(SpvOp condition, int64_t initial_value, +int64_t Loop::GetResidualConditionValue(spv::Op condition, + int64_t initial_value, int64_t step_value, size_t number_of_iterations, size_t factor) { @@ -128,13 +126,13 @@ int64_t Loop::GetResidualConditionValue(SpvOp condition, int64_t initial_value, // loop where just less than or greater than. Adding or subtracting one should // give a functionally equivalent value. switch (condition) { - case SpvOp::SpvOpSGreaterThanEqual: - case SpvOp::SpvOpUGreaterThanEqual: { + case spv::Op::OpSGreaterThanEqual: + case spv::Op::OpUGreaterThanEqual: { remainder -= 1; break; } - case SpvOp::SpvOpSLessThanEqual: - case SpvOp::SpvOpULessThanEqual: { + case spv::Op::OpSLessThanEqual: + case spv::Op::OpULessThanEqual: { remainder += 1; break; } @@ -152,7 +150,7 @@ Instruction* Loop::GetConditionInst() const { } Instruction* branch_conditional = &*condition_block->tail(); if (!branch_conditional || - branch_conditional->opcode() != SpvOpBranchConditional) { + branch_conditional->opcode() != spv::Op::OpBranchConditional) { return nullptr; } Instruction* condition_inst = context_->get_def_use_mgr()->GetDef( @@ -318,7 +316,7 @@ void Loop::SetMergeBlock(BasicBlock* merge) { void Loop::SetPreHeaderBlock(BasicBlock* preheader) { if (preheader) { assert(!IsInsideLoop(preheader) && "The preheader block is in the loop"); - assert(preheader->tail()->opcode() == SpvOpBranch && + assert(preheader->tail()->opcode() == spv::Op::OpBranch && "The preheader block does not unconditionally branch to the header " "block"); assert(preheader->tail()->GetSingleWordOperand(0) == @@ -387,7 +385,7 @@ void Loop::GetMergingBlocks( namespace { -static inline bool IsBasicBlockSafeToClone(IRContext* context, BasicBlock* bb) { +inline bool IsBasicBlockSafeToClone(IRContext* context, BasicBlock* bb) { for (Instruction& inst : *bb) { if (!inst.IsBranch() && !context->IsCombinatorInstruction(&inst)) return false; @@ -443,7 +441,7 @@ bool Loop::IsLCSSA() const { BasicBlock* parent = ir_context->get_instr_block(use); assert(parent && "Invalid analysis"); if (IsInsideLoop(parent)) return true; - if (use->opcode() != SpvOpPhi) return false; + if (use->opcode() != spv::Op::OpPhi) return false; return exit_blocks.count(parent->id()); })) return false; @@ -452,25 +450,20 @@ bool Loop::IsLCSSA() const { return true; } -bool Loop::ShouldHoistInstruction(IRContext* context, Instruction* inst) { - return AreAllOperandsOutsideLoop(context, inst) && - inst->IsOpcodeCodeMotionSafe(); +bool Loop::ShouldHoistInstruction(const Instruction& inst) const { + return inst.IsOpcodeCodeMotionSafe() && AreAllOperandsOutsideLoop(inst) && + (!inst.IsLoad() || inst.IsReadOnlyLoad()); } -bool Loop::AreAllOperandsOutsideLoop(IRContext* context, Instruction* inst) { - analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); - bool all_outside_loop = true; +bool Loop::AreAllOperandsOutsideLoop(const Instruction& inst) const { + analysis::DefUseManager* def_use_mgr = GetContext()->get_def_use_mgr(); - const std::function operand_outside_loop = - [this, &def_use_mgr, &all_outside_loop](uint32_t* id) { - if (this->IsInsideLoop(def_use_mgr->GetDef(*id))) { - all_outside_loop = false; - return; - } + const std::function operand_outside_loop = + [this, &def_use_mgr](const uint32_t* id) { + return !this->IsInsideLoop(def_use_mgr->GetDef(*id)); }; - inst->ForEachInId(operand_outside_loop); - return all_outside_loop; + return inst.WhileEachInId(operand_outside_loop); } void Loop::ComputeLoopStructuredOrder( @@ -486,7 +479,7 @@ void Loop::ComputeLoopStructuredOrder( ordered_loop_blocks->push_back(loop_preheader_); bool is_shader = - context_->get_feature_mgr()->HasCapability(SpvCapabilityShader); + context_->get_feature_mgr()->HasCapability(spv::Capability::Shader); if (!is_shader) { cfg.ForEachBlockInReversePostOrder( loop_header_, [ordered_loop_blocks, this](BasicBlock* bb) { @@ -647,7 +640,7 @@ BasicBlock* Loop::FindConditionBlock() const { const Instruction& branch = *bb->ctail(); // Make sure the branch is a conditional branch. - if (branch.opcode() != SpvOpBranchConditional) return nullptr; + if (branch.opcode() != spv::Op::OpBranchConditional) return nullptr; // Make sure one of the two possible branches is to the merge block. if (branch.GetSingleWordInOperand(1) == loop_merge_->id() || @@ -716,7 +709,7 @@ bool Loop::FindNumberOfIterations(const Instruction* induction, } // If this is a subtraction step we should negate the step value. - if (step_inst->opcode() == SpvOp::SpvOpISub) { + if (step_inst->opcode() == spv::Op::OpISub) { step_value = -step_value; } @@ -753,7 +746,7 @@ bool Loop::FindNumberOfIterations(const Instruction* induction, // |step_value| where diff is calculated differently according to the // |condition| and uses the |condition_value| and |init_value|. If diff / // |step_value| is NOT cleanly divisible then we add one to the sum. -int64_t Loop::GetIterations(SpvOp condition, int64_t condition_value, +int64_t Loop::GetIterations(spv::Op condition, int64_t condition_value, int64_t init_value, int64_t step_value) const { if (step_value == 0) { return 0; @@ -762,8 +755,8 @@ int64_t Loop::GetIterations(SpvOp condition, int64_t condition_value, int64_t diff = 0; switch (condition) { - case SpvOp::SpvOpSLessThan: - case SpvOp::SpvOpULessThan: { + case spv::Op::OpSLessThan: + case spv::Op::OpULessThan: { // If the condition is not met to begin with the loop will never iterate. if (!(init_value < condition_value)) return 0; @@ -778,8 +771,8 @@ int64_t Loop::GetIterations(SpvOp condition, int64_t condition_value, break; } - case SpvOp::SpvOpSGreaterThan: - case SpvOp::SpvOpUGreaterThan: { + case spv::Op::OpSGreaterThan: + case spv::Op::OpUGreaterThan: { // If the condition is not met to begin with the loop will never iterate. if (!(init_value > condition_value)) return 0; @@ -795,12 +788,12 @@ int64_t Loop::GetIterations(SpvOp condition, int64_t condition_value, break; } - case SpvOp::SpvOpSGreaterThanEqual: - case SpvOp::SpvOpUGreaterThanEqual: { + case spv::Op::OpSGreaterThanEqual: + case spv::Op::OpUGreaterThanEqual: { // If the condition is not met to begin with the loop will never iterate. if (!(init_value >= condition_value)) return 0; - // We subtract one to make it the same as SpvOpGreaterThan as it is + // We subtract one to make it the same as spv::Op::OpGreaterThan as it is // functionally equivalent. diff = init_value - (condition_value - 1); @@ -814,13 +807,13 @@ int64_t Loop::GetIterations(SpvOp condition, int64_t condition_value, break; } - case SpvOp::SpvOpSLessThanEqual: - case SpvOp::SpvOpULessThanEqual: { + case spv::Op::OpSLessThanEqual: + case spv::Op::OpULessThanEqual: { // If the condition is not met to begin with the loop will never iterate. if (!(init_value <= condition_value)) return 0; - // We add one to make it the same as SpvOpLessThan as it is functionally - // equivalent. + // We add one to make it the same as spv::Op::OpLessThan as it is + // functionally equivalent. diff = (condition_value + 1) - init_value; // If the operation is a less than operation then the diff and step must @@ -854,7 +847,7 @@ int64_t Loop::GetIterations(SpvOp condition, int64_t condition_value, void Loop::GetInductionVariables( std::vector& induction_variables) const { for (Instruction& inst : *loop_header_) { - if (inst.opcode() == SpvOp::SpvOpPhi) { + if (inst.opcode() == spv::Op::OpPhi) { induction_variables.push_back(&inst); } } @@ -867,7 +860,7 @@ Instruction* Loop::FindConditionVariable( Instruction* induction = nullptr; // Verify that the branch instruction is a conditional branch. - if (branch_inst.opcode() == SpvOp::SpvOpBranchConditional) { + if (branch_inst.opcode() == spv::Op::OpBranchConditional) { // From the branch instruction find the branch condition. analysis::DefUseManager* def_use_manager = context_->get_def_use_mgr(); @@ -883,7 +876,8 @@ Instruction* Loop::FindConditionVariable( def_use_manager->GetDef(condition->GetSingleWordOperand(2)); // Make sure the variable instruction used is a phi. - if (!variable_inst || variable_inst->opcode() != SpvOpPhi) return nullptr; + if (!variable_inst || variable_inst->opcode() != spv::Op::OpPhi) + return nullptr; // Make sure the phi instruction only has two incoming blocks. Each // incoming block will be represented by two in operands in the phi diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.h b/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.h index df012274..d451496e 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.h @@ -296,12 +296,12 @@ class Loop { // as a nested child loop. inline void SetParent(Loop* parent) { parent_ = parent; } - // Returns true is the instruction is invariant and safe to move wrt loop - bool ShouldHoistInstruction(IRContext* context, Instruction* inst); + // Returns true is the instruction is invariant and safe to move wrt loop. + bool ShouldHoistInstruction(const Instruction& inst) const; // Returns true if all operands of inst are in basic blocks not contained in - // loop - bool AreAllOperandsOutsideLoop(IRContext* context, Instruction* inst); + // loop. + bool AreAllOperandsOutsideLoop(const Instruction& inst) const; // Extract the initial value from the |induction| variable and store it in // |value|. If the function couldn't find the initial value of |induction| @@ -316,12 +316,12 @@ class Loop { // Returns true if we can deduce the number of loop iterations in the step // operation |step|. IsSupportedCondition must also be true for the condition // instruction. - bool IsSupportedStepOp(SpvOp step) const; + bool IsSupportedStepOp(spv::Op step) const; // Returns true if we can deduce the number of loop iterations in the // condition operation |condition|. IsSupportedStepOp must also be true for // the step instruction. - bool IsSupportedCondition(SpvOp condition) const; + bool IsSupportedCondition(spv::Op condition) const; // Creates the list of the loop's basic block in structured order and store // the result in |ordered_loop_blocks|. If |include_pre_header| is true, the @@ -335,7 +335,7 @@ class Loop { // Given the loop |condition|, |initial_value|, |step_value|, the trip count // |number_of_iterations|, and the |unroll_factor| requested, get the new // condition value for the residual loop. - static int64_t GetResidualConditionValue(SpvOp condition, + static int64_t GetResidualConditionValue(spv::Op condition, int64_t initial_value, int64_t step_value, size_t number_of_iterations, @@ -400,7 +400,7 @@ class Loop { // the induction variable. This method will return the number of iterations in // a loop with those values for a given |condition|. Returns 0 if the number // of iterations could not be computed. - int64_t GetIterations(SpvOp condition, int64_t condition_value, + int64_t GetIterations(spv::Op condition, int64_t condition_value, int64_t init_value, int64_t step_value) const; // This is to allow for loops to be removed mid iteration without invalidating diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_fission.cpp b/bgfx/3rdparty/spirv-tools/source/opt/loop_fission.cpp index b4df8c62..2ae05c3c 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_fission.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_fission.cpp @@ -110,10 +110,10 @@ class LoopFissionImpl { }; bool LoopFissionImpl::MovableInstruction(const Instruction& inst) const { - return inst.opcode() == SpvOp::SpvOpLoad || - inst.opcode() == SpvOp::SpvOpStore || - inst.opcode() == SpvOp::SpvOpSelectionMerge || - inst.opcode() == SpvOp::SpvOpPhi || inst.IsOpcodeCodeMotionSafe(); + return inst.opcode() == spv::Op::OpLoad || + inst.opcode() == spv::Op::OpStore || + inst.opcode() == spv::Op::OpSelectionMerge || + inst.opcode() == spv::Op::OpPhi || inst.IsOpcodeCodeMotionSafe(); } void LoopFissionImpl::TraverseUseDef(Instruction* inst, @@ -143,14 +143,14 @@ void LoopFissionImpl::TraverseUseDef(Instruction* inst, // same labels (i.e phis). We already preempt the inclusion of // OpSelectionMerge by adding related instructions to the seen_instructions_ // set. - if (user->opcode() == SpvOp::SpvOpLoopMerge || - user->opcode() == SpvOp::SpvOpLabel) + if (user->opcode() == spv::Op::OpLoopMerge || + user->opcode() == spv::Op::OpLabel) return; // If the |report_loads| flag is set, set the class field // load_used_in_condition_ to false. This is used to check that none of the // condition checks in the loop rely on loads. - if (user->opcode() == SpvOp::SpvOpLoad && report_loads) { + if (user->opcode() == spv::Op::OpLoad && report_loads) { load_used_in_condition_ = true; } @@ -167,7 +167,7 @@ void LoopFissionImpl::TraverseUseDef(Instruction* inst, user->ForEachInOperand(traverse_operand); // For the first traversal we want to ignore the users of the phi. - if (ignore_phi_users && user->opcode() == SpvOp::SpvOpPhi) return; + if (ignore_phi_users && user->opcode() == spv::Op::OpPhi) return; // Traverse each user with this lambda. def_use->ForEachUser(user, traverser_functor); @@ -214,7 +214,7 @@ bool LoopFissionImpl::GroupInstructionsByUseDef() { for (Instruction& inst : block) { // Ignore all instructions related to control flow. - if (inst.opcode() == SpvOp::SpvOpSelectionMerge || inst.IsBranch()) { + if (inst.opcode() == spv::Op::OpSelectionMerge || inst.IsBranch()) { TraverseUseDef(&inst, &instructions_to_ignore, true, true); } } @@ -229,8 +229,8 @@ bool LoopFissionImpl::GroupInstructionsByUseDef() { for (Instruction& inst : block) { // Record the order that each load/store is seen. - if (inst.opcode() == SpvOp::SpvOpLoad || - inst.opcode() == SpvOp::SpvOpStore) { + if (inst.opcode() == spv::Op::OpLoad || + inst.opcode() == spv::Op::OpStore) { instruction_order_[&inst] = instruction_order_.size(); } @@ -292,9 +292,9 @@ bool LoopFissionImpl::CanPerformSplit() { // Populate the above lists. for (Instruction* inst : cloned_loop_instructions_) { - if (inst->opcode() == SpvOp::SpvOpStore) { + if (inst->opcode() == spv::Op::OpStore) { set_one_stores.push_back(inst); - } else if (inst->opcode() == SpvOp::SpvOpLoad) { + } else if (inst->opcode() == spv::Op::OpLoad) { set_one_loads.push_back(inst); } @@ -316,7 +316,7 @@ bool LoopFissionImpl::CanPerformSplit() { // Look at the dependency between the loads in the original and stores in // the cloned loops. - if (inst->opcode() == SpvOp::SpvOpLoad) { + if (inst->opcode() == spv::Op::OpLoad) { for (Instruction* store : set_one_stores) { DistanceVector vec{loop_depth}; @@ -334,7 +334,7 @@ bool LoopFissionImpl::CanPerformSplit() { } } } - } else if (inst->opcode() == SpvOp::SpvOpStore) { + } else if (inst->opcode() == spv::Op::OpStore) { for (Instruction* load : set_one_loads) { DistanceVector vec{loop_depth}; @@ -387,7 +387,7 @@ Loop* LoopFissionImpl::SplitLoop() { if (cloned_loop_instructions_.count(&inst) == 1 && original_loop_instructions_.count(&inst) == 0) { instructions_to_kill.push_back(&inst); - if (inst.opcode() == SpvOp::SpvOpPhi) { + if (inst.opcode() == spv::Op::OpPhi) { context_->ReplaceAllUsesWith( inst.result_id(), clone_results.value_map_[inst.result_id()]); } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion.cpp b/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion.cpp index f3aab283..dc635530 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion.cpp @@ -23,7 +23,6 @@ namespace spvtools { namespace opt { - namespace { // Append all the loops nested in |loop| to |loops|. @@ -193,14 +192,15 @@ bool LoopFusion::AreCompatible() { // in LCSSA form. for (auto block : block_to_check) { for (auto& inst : *block) { - if (inst.opcode() == SpvOpStore) { + if (inst.opcode() == spv::Op::OpStore) { // Get the definition of the target to check it's function scope so // there are no observable side effects. auto variable = context_->get_def_use_mgr()->GetDef(inst.GetSingleWordInOperand(0)); - if (variable->opcode() != SpvOpVariable || - variable->GetSingleWordInOperand(0) != SpvStorageClassFunction) { + if (variable->opcode() != spv::Op::OpVariable || + spv::StorageClass(variable->GetSingleWordInOperand(0)) != + spv::StorageClass::Function) { return false; } @@ -209,7 +209,7 @@ bool LoopFusion::AreCompatible() { context_->get_def_use_mgr()->ForEachUse( inst.GetSingleWordInOperand(0), [&is_used](Instruction* use_inst, uint32_t) { - if (use_inst->opcode() == SpvOpLoad) { + if (use_inst->opcode() == spv::Op::OpLoad) { is_used = true; } }); @@ -217,11 +217,11 @@ bool LoopFusion::AreCompatible() { if (is_used) { return false; } - } else if (inst.opcode() == SpvOpPhi) { + } else if (inst.opcode() == spv::Op::OpPhi) { if (inst.NumInOperands() != 2) { return false; } - } else if (inst.opcode() != SpvOpBranch) { + } else if (inst.opcode() != spv::Op::OpBranch) { return false; } } @@ -234,10 +234,12 @@ bool LoopFusion::ContainsBarriersOrFunctionCalls(Loop* loop) { for (const auto& block : loop->GetBlocks()) { for (const auto& inst : *containing_function_->FindBlock(block)) { auto opcode = inst.opcode(); - if (opcode == SpvOpFunctionCall || opcode == SpvOpControlBarrier || - opcode == SpvOpMemoryBarrier || opcode == SpvOpTypeNamedBarrier || - opcode == SpvOpNamedBarrierInitialize || - opcode == SpvOpMemoryNamedBarrier) { + if (opcode == spv::Op::OpFunctionCall || + opcode == spv::Op::OpControlBarrier || + opcode == spv::Op::OpMemoryBarrier || + opcode == spv::Op::OpTypeNamedBarrier || + opcode == spv::Op::OpNamedBarrierInitialize || + opcode == spv::Op::OpMemoryNamedBarrier) { return true; } } @@ -344,7 +346,7 @@ std::map> LoopFusion::LocationToMemOps( auto access_location = context_->get_def_use_mgr()->GetDef( instruction->GetSingleWordInOperand(0)); - while (access_location->opcode() == SpvOpAccessChain) { + while (access_location->opcode() == spv::Op::OpAccessChain) { access_location = context_->get_def_use_mgr()->GetDef( access_location->GetSingleWordInOperand(0)); } @@ -366,9 +368,9 @@ LoopFusion::GetLoadsAndStoresInLoop(Loop* loop) { } for (auto& instruction : *containing_function_->FindBlock(block_id)) { - if (instruction.opcode() == SpvOpLoad) { + if (instruction.opcode() == spv::Op::OpLoad) { loads.push_back(&instruction); - } else if (instruction.opcode() == SpvOpStore) { + } else if (instruction.opcode() == spv::Op::OpStore) { stores.push_back(&instruction); } } @@ -556,7 +558,7 @@ void LoopFusion::Fuse() { // Update merge block id in the header of |loop_0_| to the merge block of // |loop_1_|. loop_0_->GetHeaderBlock()->ForEachInst([this](Instruction* inst) { - if (inst->opcode() == SpvOpLoopMerge) { + if (inst->opcode() == spv::Op::OpLoopMerge) { inst->SetInOperand(0, {loop_1_->GetMergeBlock()->id()}); } }); @@ -564,7 +566,7 @@ void LoopFusion::Fuse() { // Update condition branch target in |loop_0_| to the merge block of // |loop_1_|. condition_block_of_0->ForEachInst([this](Instruction* inst) { - if (inst->opcode() == SpvOpBranchConditional) { + if (inst->opcode() == spv::Op::OpBranchConditional) { auto loop_0_merge_block_id = loop_0_->GetMergeBlock()->id(); if (inst->GetSingleWordInOperand(1) == loop_0_merge_block_id) { @@ -579,7 +581,8 @@ void LoopFusion::Fuse() { // the header of |loop_1_| to the header of |loop_0_|. std::vector instructions_to_move{}; for (auto& instruction : *loop_1_->GetHeaderBlock()) { - if (instruction.opcode() == SpvOpPhi && &instruction != induction_1_) { + if (instruction.opcode() == spv::Op::OpPhi && + &instruction != induction_1_) { instructions_to_move.push_back(&instruction); } } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion_pass.cpp index bd8444ae..097430fc 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion_pass.cpp @@ -14,7 +14,6 @@ #include "source/opt/loop_fusion_pass.h" -#include "source/opt/ir_context.h" #include "source/opt/loop_descriptor.h" #include "source/opt/loop_fusion.h" #include "source/opt/register_pressure.h" diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_peeling.cpp b/bgfx/3rdparty/spirv-tools/source/opt/loop_peeling.cpp index 34f0a8d2..25c6db12 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_peeling.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_peeling.cpp @@ -12,23 +12,37 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include "source/opt/loop_peeling.h" + #include #include -#include #include #include #include "source/opt/ir_builder.h" #include "source/opt/ir_context.h" #include "source/opt/loop_descriptor.h" -#include "source/opt/loop_peeling.h" #include "source/opt/loop_utils.h" #include "source/opt/scalar_analysis.h" #include "source/opt/scalar_analysis_nodes.h" namespace spvtools { namespace opt { +namespace { +// Gather the set of blocks for all the path from |entry| to |root|. +void GetBlocksInPath(uint32_t block, uint32_t entry, + std::unordered_set* blocks_in_path, + const CFG& cfg) { + for (uint32_t pid : cfg.preds(block)) { + if (blocks_in_path->insert(pid).second) { + if (pid != entry) { + GetBlocksInPath(pid, entry, blocks_in_path, cfg); + } + } + } +} +} // namespace + size_t LoopPeelingPass::code_grow_threshold_ = 1000; void LoopPeeling::DuplicateAndConnectLoop( @@ -186,7 +200,7 @@ void LoopPeeling::GetIteratorUpdateOperations( operations->insert(iterator); iterator->ForEachInId([def_use_mgr, loop, operations, this](uint32_t* id) { Instruction* insn = def_use_mgr->GetDef(*id); - if (insn->opcode() == SpvOpLabel) { + if (insn->opcode() == spv::Op::OpLabel) { return; } if (operations->count(insn)) { @@ -199,19 +213,6 @@ void LoopPeeling::GetIteratorUpdateOperations( }); } -// Gather the set of blocks for all the path from |entry| to |root|. -static void GetBlocksInPath(uint32_t block, uint32_t entry, - std::unordered_set* blocks_in_path, - const CFG& cfg) { - for (uint32_t pid : cfg.preds(block)) { - if (blocks_in_path->insert(pid).second) { - if (pid != entry) { - GetBlocksInPath(pid, entry, blocks_in_path, cfg); - } - } - } -} - bool LoopPeeling::IsConditionCheckSideEffectFree() const { CFG& cfg = *context_->cfg(); @@ -231,9 +232,9 @@ bool LoopPeeling::IsConditionCheckSideEffectFree() const { if (!bb->WhileEachInst([this](Instruction* insn) { if (insn->IsBranch()) return true; switch (insn->opcode()) { - case SpvOpLabel: - case SpvOpSelectionMerge: - case SpvOpLoopMerge: + case spv::Op::OpLabel: + case spv::Op::OpSelectionMerge: + case spv::Op::OpLoopMerge: return true; default: break; @@ -322,7 +323,7 @@ void LoopPeeling::FixExitCondition( BasicBlock* condition_block = cfg.block(condition_block_id); Instruction* exit_condition = condition_block->terminator(); - assert(exit_condition->opcode() == SpvOpBranchConditional); + assert(exit_condition->opcode() == spv::Op::OpBranchConditional); BasicBlock::iterator insert_point = condition_block->tail(); if (condition_block->GetMergeInst()) { --insert_point; @@ -350,7 +351,7 @@ BasicBlock* LoopPeeling::CreateBlockBefore(BasicBlock* bb) { // TODO(1841): Handle id overflow. std::unique_ptr new_bb = MakeUnique(std::unique_ptr(new Instruction( - context_, SpvOpLabel, 0, context_->TakeNextId(), {}))); + context_, spv::Op::OpLabel, 0, context_->TakeNextId(), {}))); // Update the loop descriptor. Loop* in_loop = (*loop_utils_.GetLoopDescriptor())[bb]; if (in_loop) { @@ -791,18 +792,18 @@ uint32_t LoopPeelingPass::LoopPeelingInfo::GetFirstNonLoopInvariantOperand( return 0; } -static bool IsHandledCondition(SpvOp opcode) { +static bool IsHandledCondition(spv::Op opcode) { switch (opcode) { - case SpvOpIEqual: - case SpvOpINotEqual: - case SpvOpUGreaterThan: - case SpvOpSGreaterThan: - case SpvOpUGreaterThanEqual: - case SpvOpSGreaterThanEqual: - case SpvOpULessThan: - case SpvOpSLessThan: - case SpvOpULessThanEqual: - case SpvOpSLessThanEqual: + case spv::Op::OpIEqual: + case spv::Op::OpINotEqual: + case spv::Op::OpUGreaterThan: + case spv::Op::OpSGreaterThan: + case spv::Op::OpUGreaterThanEqual: + case spv::Op::OpSGreaterThanEqual: + case spv::Op::OpULessThan: + case spv::Op::OpSLessThan: + case spv::Op::OpULessThanEqual: + case spv::Op::OpSLessThanEqual: return true; default: return false; @@ -811,7 +812,7 @@ static bool IsHandledCondition(SpvOp opcode) { LoopPeelingPass::LoopPeelingInfo::Direction LoopPeelingPass::LoopPeelingInfo::GetPeelingInfo(BasicBlock* bb) const { - if (bb->terminator()->opcode() != SpvOpBranchConditional) { + if (bb->terminator()->opcode() != spv::Op::OpBranchConditional) { return GetNoneDirection(); } @@ -886,27 +887,27 @@ LoopPeelingPass::LoopPeelingInfo::GetPeelingInfo(BasicBlock* bb) const { switch (condition->opcode()) { default: return GetNoneDirection(); - case SpvOpIEqual: - case SpvOpINotEqual: + case spv::Op::OpIEqual: + case spv::Op::OpINotEqual: return HandleEquality(lhs, rhs); - case SpvOpUGreaterThan: - case SpvOpSGreaterThan: { + case spv::Op::OpUGreaterThan: + case spv::Op::OpSGreaterThan: { cmp_operator = CmpOperator::kGT; break; } - case SpvOpULessThan: - case SpvOpSLessThan: { + case spv::Op::OpULessThan: + case spv::Op::OpSLessThan: { cmp_operator = CmpOperator::kLT; break; } // We add one to transform >= into > and <= into <. - case SpvOpUGreaterThanEqual: - case SpvOpSGreaterThanEqual: { + case spv::Op::OpUGreaterThanEqual: + case spv::Op::OpSGreaterThanEqual: { cmp_operator = CmpOperator::kGE; break; } - case SpvOpULessThanEqual: - case SpvOpSLessThanEqual: { + case spv::Op::OpULessThanEqual: + case spv::Op::OpSLessThanEqual: { cmp_operator = CmpOperator::kLE; break; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_unroller.cpp b/bgfx/3rdparty/spirv-tools/source/opt/loop_unroller.cpp index 6f4e6f41..d9e34f24 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_unroller.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_unroller.cpp @@ -15,7 +15,6 @@ #include "source/opt/loop_unroller.h" #include -#include #include #include #include @@ -68,10 +67,10 @@ namespace opt { namespace { // Loop control constant value for DontUnroll flag. -static const uint32_t kLoopControlDontUnrollIndex = 2; +constexpr uint32_t kLoopControlDontUnrollIndex = 2; // Operand index of the loop control parameter of the OpLoopMerge. -static const uint32_t kLoopControlIndex = 2; +constexpr uint32_t kLoopControlIndex = 2; // This utility class encapsulates some of the state we need to maintain between // loop unrolls. Specifically it maintains key blocks and the induction variable @@ -336,8 +335,7 @@ class LoopUnrollerUtilsImpl { // Retrieve the index of the OpPhi instruction |phi| which corresponds to the // incoming |block| id. -static uint32_t GetPhiIndexFromLabel(const BasicBlock* block, - const Instruction* phi) { +uint32_t GetPhiIndexFromLabel(const BasicBlock* block, const Instruction* phi) { for (uint32_t i = 1; i < phi->NumInOperands(); i += 2) { if (block->id() == phi->GetSingleWordInOperand(i)) { return i; @@ -382,7 +380,7 @@ void LoopUnrollerUtilsImpl::PartiallyUnrollResidualFactor(Loop* loop, size_t factor) { // TODO(1841): Handle id overflow. std::unique_ptr new_label{new Instruction( - context_, SpvOp::SpvOpLabel, 0, context_->TakeNextId(), {})}; + context_, spv::Op::OpLabel, 0, context_->TakeNextId(), {})}; std::unique_ptr new_exit_bb{new BasicBlock(std::move(new_label))}; new_exit_bb->SetParent(&function_); @@ -991,7 +989,7 @@ bool LoopUtils::CanPerformUnroll() { // Check that we can find and process the induction variable. const Instruction* induction = loop_->FindConditionVariable(condition); - if (!induction || induction->opcode() != SpvOpPhi) return false; + if (!induction || induction->opcode() != spv::Op::OpPhi) return false; // Check that we can find the number of loop iterations. if (!loop_->FindNumberOfIterations(induction, &*condition->ctail(), nullptr)) @@ -1002,7 +1000,7 @@ bool LoopUtils::CanPerformUnroll() { // iteration counts. This can cause timeouts and memouts during fuzzing that // are not classed as bugs. To avoid this noise, loop unrolling is not applied // to loops with large iteration counts when fuzzing. - const size_t kFuzzerIterationLimit = 100; + constexpr size_t kFuzzerIterationLimit = 100; size_t num_iterations; loop_->FindNumberOfIterations(induction, &*condition->ctail(), &num_iterations); @@ -1015,7 +1013,7 @@ bool LoopUtils::CanPerformUnroll() { // block. const Instruction& branch = *loop_->GetLatchBlock()->ctail(); bool branching_assumption = - branch.opcode() == SpvOpBranch && + branch.opcode() == spv::Op::OpBranch && branch.GetSingleWordInOperand(0) == loop_->GetHeaderBlock()->id(); if (!branching_assumption) { return false; @@ -1043,10 +1041,10 @@ bool LoopUtils::CanPerformUnroll() { // exit the loop. for (uint32_t label_id : loop_->GetBlocks()) { const BasicBlock* block = context_->cfg()->block(label_id); - if (block->ctail()->opcode() == SpvOp::SpvOpKill || - block->ctail()->opcode() == SpvOp::SpvOpReturn || - block->ctail()->opcode() == SpvOp::SpvOpReturnValue || - block->ctail()->opcode() == SpvOp::SpvOpTerminateInvocation) { + if (block->ctail()->opcode() == spv::Op::OpKill || + block->ctail()->opcode() == spv::Op::OpReturn || + block->ctail()->opcode() == spv::Op::OpReturnValue || + block->ctail()->opcode() == spv::Op::OpTerminateInvocation) { return false; } } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_unswitch_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/loop_unswitch_pass.cpp index 1ee7e5e2..41f1a804 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_unswitch_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_unswitch_pass.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -31,18 +30,12 @@ #include "source/opt/ir_builder.h" #include "source/opt/ir_context.h" #include "source/opt/loop_descriptor.h" - #include "source/opt/loop_utils.h" namespace spvtools { namespace opt { namespace { - -static const uint32_t kTypePointerStorageClassInIdx = 0; - -} // anonymous namespace - -namespace { +constexpr uint32_t kTypePointerStorageClassInIdx = 0; // This class handle the unswitch procedure for a given loop. // The unswitch will not happen if: @@ -77,7 +70,7 @@ class LoopUnswitch { } if (bb->terminator()->IsBranch() && - bb->terminator()->opcode() != SpvOpBranch) { + bb->terminator()->opcode() != spv::Op::OpBranch) { if (IsConditionNonConstantLoopInvariant(bb->terminator())) { switch_block_ = bb; break; @@ -104,7 +97,7 @@ class LoopUnswitch { // TODO(1841): Handle id overflow. BasicBlock* bb = &*ip.InsertBefore(std::unique_ptr( new BasicBlock(std::unique_ptr(new Instruction( - context_, SpvOpLabel, 0, context_->TakeNextId(), {}))))); + context_, spv::Op::OpLabel, 0, context_->TakeNextId(), {}))))); bb->SetParent(function_); def_use_mgr->AnalyzeInstDef(bb->GetLabelInst()); context_->set_instr_block(bb->GetLabelInst(), bb); @@ -113,7 +106,7 @@ class LoopUnswitch { } Instruction* GetValueForDefaultPathForSwitch(Instruction* switch_inst) { - assert(switch_inst->opcode() == SpvOpSwitch && + assert(switch_inst->opcode() == spv::Op::OpSwitch && "The given instructoin must be an OpSwitch."); // Find a value that can be used to select the default path. @@ -291,7 +284,7 @@ class LoopUnswitch { ///////////////////////////// Instruction* iv_condition = &*switch_block_->tail(); - SpvOp iv_opcode = iv_condition->opcode(); + spv::Op iv_opcode = iv_condition->opcode(); Instruction* condition = def_use_mgr->GetDef(iv_condition->GetOperand(0).words[0]); @@ -304,7 +297,7 @@ class LoopUnswitch { std::vector> constant_branch; // Special case for the original loop Instruction* original_loop_constant_value; - if (iv_opcode == SpvOpBranchConditional) { + if (iv_opcode == spv::Op::OpBranchConditional) { constant_branch.emplace_back( cst_mgr->GetDefiningInstruction(cst_mgr->GetConstant(cond_type, {0})), nullptr); @@ -401,7 +394,7 @@ class LoopUnswitch { // Delete the old jump context_->KillInst(&*if_block->tail()); InstructionBuilder builder(context_, if_block); - if (iv_opcode == SpvOpBranchConditional) { + if (iv_opcode == spv::Op::OpBranchConditional) { assert(constant_branch.size() == 1); builder.AddConditionalBranch( condition->result_id(), original_loop_target->id(), @@ -509,7 +502,8 @@ class LoopUnswitch { bool& is_uniform = dynamically_uniform_[var->result_id()]; is_uniform = false; - dec_mgr->WhileEachDecoration(var->result_id(), SpvDecorationUniform, + dec_mgr->WhileEachDecoration(var->result_id(), + uint32_t(spv::Decoration::Uniform), [&is_uniform](const Instruction&) { is_uniform = true; return false; @@ -526,14 +520,14 @@ class LoopUnswitch { if (!post_dom_tree.Dominates(parent->id(), entry->id())) { return is_uniform = false; } - if (var->opcode() == SpvOpLoad) { + if (var->opcode() == spv::Op::OpLoad) { const uint32_t PtrTypeId = def_use_mgr->GetDef(var->GetSingleWordInOperand(0))->type_id(); const Instruction* PtrTypeInst = def_use_mgr->GetDef(PtrTypeId); - uint32_t storage_class = - PtrTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx); - if (storage_class != SpvStorageClassUniform && - storage_class != SpvStorageClassUniformConstant) { + auto storage_class = spv::StorageClass( + PtrTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx)); + if (storage_class != spv::StorageClass::Uniform && + storage_class != spv::StorageClass::UniformConstant) { return is_uniform = false; } } else { @@ -553,7 +547,7 @@ class LoopUnswitch { // dynamically uniform. bool IsConditionNonConstantLoopInvariant(Instruction* insn) { assert(insn->IsBranch()); - assert(insn->opcode() != SpvOpBranch); + assert(insn->opcode() != spv::Op::OpBranch); analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); Instruction* condition = def_use_mgr->GetDef(insn->GetOperand(0).words[0]); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/loop_utils.cpp b/bgfx/3rdparty/spirv-tools/source/opt/loop_utils.cpp index 8c6d355d..20494e12 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/loop_utils.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/loop_utils.cpp @@ -28,12 +28,11 @@ namespace spvtools { namespace opt { - namespace { // Return true if |bb| is dominated by at least one block in |exits| -static inline bool DominatesAnExit(BasicBlock* bb, - const std::unordered_set& exits, - const DominatorTree& dom_tree) { +inline bool DominatesAnExit(BasicBlock* bb, + const std::unordered_set& exits, + const DominatorTree& dom_tree) { for (BasicBlock* e_bb : exits) if (dom_tree.Dominates(bb, e_bb)) return true; return false; @@ -71,10 +70,10 @@ class LCSSARewriter { // UpdateManagers. void RewriteUse(BasicBlock* bb, Instruction* user, uint32_t operand_index) { assert( - (user->opcode() != SpvOpPhi || bb != GetParent(user)) && + (user->opcode() != spv::Op::OpPhi || bb != GetParent(user)) && "The root basic block must be the incoming edge if |user| is a phi " "instruction"); - assert((user->opcode() == SpvOpPhi || bb == GetParent(user)) && + assert((user->opcode() == spv::Op::OpPhi || bb == GetParent(user)) && "The root basic block must be the instruction parent if |user| is " "not " "phi instruction"); @@ -293,7 +292,7 @@ inline void MakeSetClosedSSA(IRContext* context, Function* function, assert(use_parent); if (blocks.count(use_parent->id())) return; - if (use->opcode() == SpvOpPhi) { + if (use->opcode() == spv::Op::OpPhi) { // If the use is a Phi instruction and the incoming block is // coming from the loop, then that's consistent with LCSSA form. if (exit_bb.count(use_parent)) { @@ -355,7 +354,7 @@ void LoopUtils::CreateLoopDedicatedExits() { // TODO(1841): Handle id overflow. BasicBlock& exit = *insert_pt.InsertBefore(std::unique_ptr( new BasicBlock(std::unique_ptr(new Instruction( - context_, SpvOpLabel, 0, context_->TakeNextId(), {}))))); + context_, spv::Op::OpLabel, 0, context_->TakeNextId(), {}))))); exit.SetParent(function); // Redirect in loop predecessors to |exit| block. @@ -494,7 +493,7 @@ Loop* LoopUtils::CloneAndAttachLoopToHeader(LoopCloningResult* cloning_result) { // Create a new exit block/label for the new loop. // TODO(1841): Handle id overflow. std::unique_ptr new_label{new Instruction( - context_, SpvOp::SpvOpLabel, 0, context_->TakeNextId(), {})}; + context_, spv::Op::OpLabel, 0, context_->TakeNextId(), {})}; std::unique_ptr new_exit_bb{new BasicBlock(std::move(new_label))}; new_exit_bb->SetParent(loop_->GetMergeBlock()->GetParent()); @@ -680,9 +679,9 @@ void CodeMetrics::Analyze(const Loop& loop) { const BasicBlock* bb = cfg.block(id); size_t bb_size = 0; bb->ForEachInst([&bb_size](const Instruction* insn) { - if (insn->opcode() == SpvOpLabel) return; + if (insn->opcode() == spv::Op::OpLabel) return; if (insn->IsNop()) return; - if (insn->opcode() == SpvOpPhi) return; + if (insn->opcode() == spv::Op::OpPhi) return; bb_size++; }); block_sizes_[bb->id()] = bb_size; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.cpp index ca4889b7..9972c4f7 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.cpp @@ -22,32 +22,27 @@ #include "source/cfa.h" #include "source/opt/basic_block.h" -#include "source/opt/dominator_analysis.h" #include "source/opt/ir_context.h" -#include "source/opt/iterator.h" namespace spvtools { namespace opt { - namespace { - -const uint32_t kCopyObjectOperandInIdx = 0; -const uint32_t kTypePointerStorageClassInIdx = 0; -const uint32_t kTypePointerTypeIdInIdx = 1; - +constexpr uint32_t kCopyObjectOperandInIdx = 0; +constexpr uint32_t kTypePointerStorageClassInIdx = 0; +constexpr uint32_t kTypePointerTypeIdInIdx = 1; } // namespace bool MemPass::IsBaseTargetType(const Instruction* typeInst) const { switch (typeInst->opcode()) { - case SpvOpTypeInt: - case SpvOpTypeFloat: - case SpvOpTypeBool: - case SpvOpTypeVector: - case SpvOpTypeMatrix: - case SpvOpTypeImage: - case SpvOpTypeSampler: - case SpvOpTypeSampledImage: - case SpvOpTypePointer: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: + case spv::Op::OpTypeBool: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeImage: + case spv::Op::OpTypeSampler: + case spv::Op::OpTypeSampledImage: + case spv::Op::OpTypePointer: return true; default: break; @@ -57,14 +52,14 @@ bool MemPass::IsBaseTargetType(const Instruction* typeInst) const { bool MemPass::IsTargetType(const Instruction* typeInst) const { if (IsBaseTargetType(typeInst)) return true; - if (typeInst->opcode() == SpvOpTypeArray) { + if (typeInst->opcode() == spv::Op::OpTypeArray) { if (!IsTargetType( get_def_use_mgr()->GetDef(typeInst->GetSingleWordOperand(1)))) { return false; } return true; } - if (typeInst->opcode() != SpvOpTypeStruct) return false; + if (typeInst->opcode() != spv::Op::OpTypeStruct) return false; // All struct members must be math type return typeInst->WhileEachInId([this](const uint32_t* tid) { Instruction* compTypeInst = get_def_use_mgr()->GetDef(*tid); @@ -73,23 +68,29 @@ bool MemPass::IsTargetType(const Instruction* typeInst) const { }); } -bool MemPass::IsNonPtrAccessChain(const SpvOp opcode) const { - return opcode == SpvOpAccessChain || opcode == SpvOpInBoundsAccessChain; +bool MemPass::IsNonPtrAccessChain(const spv::Op opcode) const { + return opcode == spv::Op::OpAccessChain || + opcode == spv::Op::OpInBoundsAccessChain; } bool MemPass::IsPtr(uint32_t ptrId) { uint32_t varId = ptrId; Instruction* ptrInst = get_def_use_mgr()->GetDef(varId); - while (ptrInst->opcode() == SpvOpCopyObject) { + if (ptrInst->opcode() == spv::Op::OpFunction) { + // A function is not a pointer, but it's return type could be, which will + // erroneously lead to this function returning true later on + return false; + } + while (ptrInst->opcode() == spv::Op::OpCopyObject) { varId = ptrInst->GetSingleWordInOperand(kCopyObjectOperandInIdx); ptrInst = get_def_use_mgr()->GetDef(varId); } - const SpvOp op = ptrInst->opcode(); - if (op == SpvOpVariable || IsNonPtrAccessChain(op)) return true; + const spv::Op op = ptrInst->opcode(); + if (op == spv::Op::OpVariable || IsNonPtrAccessChain(op)) return true; const uint32_t varTypeId = ptrInst->type_id(); if (varTypeId == 0) return false; const Instruction* varTypeInst = get_def_use_mgr()->GetDef(varTypeId); - return varTypeInst->opcode() == SpvOpTypePointer; + return varTypeInst->opcode() == spv::Op::OpTypePointer; } Instruction* MemPass::GetPtr(uint32_t ptrId, uint32_t* varId) { @@ -97,24 +98,24 @@ Instruction* MemPass::GetPtr(uint32_t ptrId, uint32_t* varId) { Instruction* ptrInst = get_def_use_mgr()->GetDef(*varId); Instruction* varInst; - if (ptrInst->opcode() == SpvOpConstantNull) { + if (ptrInst->opcode() == spv::Op::OpConstantNull) { *varId = 0; return ptrInst; } - if (ptrInst->opcode() != SpvOpVariable && - ptrInst->opcode() != SpvOpFunctionParameter) { + if (ptrInst->opcode() != spv::Op::OpVariable && + ptrInst->opcode() != spv::Op::OpFunctionParameter) { varInst = ptrInst->GetBaseAddress(); } else { varInst = ptrInst; } - if (varInst->opcode() == SpvOpVariable) { + if (varInst->opcode() == spv::Op::OpVariable) { *varId = varInst->result_id(); } else { *varId = 0; } - while (ptrInst->opcode() == SpvOpCopyObject) { + while (ptrInst->opcode() == spv::Op::OpCopyObject) { uint32_t temp = ptrInst->GetSingleWordInOperand(0); ptrInst = get_def_use_mgr()->GetDef(temp); } @@ -123,8 +124,9 @@ Instruction* MemPass::GetPtr(uint32_t ptrId, uint32_t* varId) { } Instruction* MemPass::GetPtr(Instruction* ip, uint32_t* varId) { - assert(ip->opcode() == SpvOpStore || ip->opcode() == SpvOpLoad || - ip->opcode() == SpvOpImageTexelPointer || ip->IsAtomicWithLoad()); + assert(ip->opcode() == spv::Op::OpStore || ip->opcode() == spv::Op::OpLoad || + ip->opcode() == spv::Op::OpImageTexelPointer || + ip->IsAtomicWithLoad()); // All of these opcode place the pointer in position 0. const uint32_t ptrId = ip->GetSingleWordInOperand(0); @@ -133,8 +135,8 @@ Instruction* MemPass::GetPtr(Instruction* ip, uint32_t* varId) { bool MemPass::HasOnlyNamesAndDecorates(uint32_t id) const { return get_def_use_mgr()->WhileEachUser(id, [this](Instruction* user) { - SpvOp op = user->opcode(); - if (op != SpvOpName && !IsNonTypeDecorate(op)) { + spv::Op op = user->opcode(); + if (op != spv::Op::OpName && !IsNonTypeDecorate(op)) { return false; } return true; @@ -147,14 +149,15 @@ void MemPass::KillAllInsts(BasicBlock* bp, bool killLabel) { bool MemPass::HasLoads(uint32_t varId) const { return !get_def_use_mgr()->WhileEachUser(varId, [this](Instruction* user) { - SpvOp op = user->opcode(); + spv::Op op = user->opcode(); // TODO(): The following is slightly conservative. Could be // better handling of non-store/name. - if (IsNonPtrAccessChain(op) || op == SpvOpCopyObject) { + if (IsNonPtrAccessChain(op) || op == spv::Op::OpCopyObject) { if (HasLoads(user->result_id())) { return false; } - } else if (op != SpvOpStore && op != SpvOpName && !IsNonTypeDecorate(op)) { + } else if (op != spv::Op::OpStore && op != spv::Op::OpName && + !IsNonTypeDecorate(op)) { return false; } return true; @@ -164,12 +167,12 @@ bool MemPass::HasLoads(uint32_t varId) const { bool MemPass::IsLiveVar(uint32_t varId) const { const Instruction* varInst = get_def_use_mgr()->GetDef(varId); // assume live if not a variable eg. function parameter - if (varInst->opcode() != SpvOpVariable) return true; + if (varInst->opcode() != spv::Op::OpVariable) return true; // non-function scope vars are live const uint32_t varTypeId = varInst->type_id(); const Instruction* varTypeInst = get_def_use_mgr()->GetDef(varTypeId); - if (varTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx) != - SpvStorageClassFunction) + if (spv::StorageClass(varTypeInst->GetSingleWordInOperand( + kTypePointerStorageClassInIdx)) != spv::StorageClass::Function) return true; // test if variable is loaded from return HasLoads(varId); @@ -177,10 +180,10 @@ bool MemPass::IsLiveVar(uint32_t varId) const { void MemPass::AddStores(uint32_t ptr_id, std::queue* insts) { get_def_use_mgr()->ForEachUser(ptr_id, [this, insts](Instruction* user) { - SpvOp op = user->opcode(); + spv::Op op = user->opcode(); if (IsNonPtrAccessChain(op)) { AddStores(user->result_id(), insts); - } else if (op == SpvOpStore) { + } else if (op == spv::Op::OpStore) { insts->push(user); } }); @@ -193,7 +196,7 @@ void MemPass::DCEInst(Instruction* inst, while (!deadInsts.empty()) { Instruction* di = deadInsts.front(); // Don't delete labels - if (di->opcode() == SpvOpLabel) { + if (di->opcode() == spv::Op::OpLabel) { deadInsts.pop(); continue; } @@ -202,7 +205,7 @@ void MemPass::DCEInst(Instruction* inst, di->ForEachInId([&ids](uint32_t* iid) { ids.insert(*iid); }); uint32_t varId = 0; // Remember variable if dead load - if (di->opcode() == SpvOpLoad) (void)GetPtr(di, &varId); + if (di->opcode() == spv::Op::OpLoad) (void)GetPtr(di, &varId); if (call_back) { call_back(di); } @@ -230,9 +233,9 @@ bool MemPass::HasOnlySupportedRefs(uint32_t varId) { dbg_op == CommonDebugInfoDebugValue) { return true; } - SpvOp op = user->opcode(); - if (op != SpvOpStore && op != SpvOpLoad && op != SpvOpName && - !IsNonTypeDecorate(op)) { + spv::Op op = user->opcode(); + if (op != spv::Op::OpStore && op != spv::Op::OpLoad && + op != spv::Op::OpName && !IsNonTypeDecorate(op)) { return false; } return true; @@ -248,7 +251,7 @@ uint32_t MemPass::Type2Undef(uint32_t type_id) { } std::unique_ptr undef_inst( - new Instruction(context(), SpvOpUndef, type_id, undefId, {})); + new Instruction(context(), spv::Op::OpUndef, type_id, undefId, {})); get_def_use_mgr()->AnalyzeInstDefUse(&*undef_inst); get_module()->AddGlobalValue(std::move(undef_inst)); type2undefs_[type_id] = undefId; @@ -264,11 +267,11 @@ bool MemPass::IsTargetVar(uint32_t varId) { return false; if (seen_target_vars_.find(varId) != seen_target_vars_.end()) return true; const Instruction* varInst = get_def_use_mgr()->GetDef(varId); - if (varInst->opcode() != SpvOpVariable) return false; + if (varInst->opcode() != spv::Op::OpVariable) return false; const uint32_t varTypeId = varInst->type_id(); const Instruction* varTypeInst = get_def_use_mgr()->GetDef(varTypeId); - if (varTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx) != - SpvStorageClassFunction) { + if (spv::StorageClass(varTypeInst->GetSingleWordInOperand( + kTypePointerStorageClassInIdx)) != spv::StorageClass::Function) { seen_non_target_vars_.insert(varId); return false; } @@ -489,8 +492,8 @@ void MemPass::CollectTargetVars(Function* func) { for (auto& blk : *func) { for (auto& inst : blk) { switch (inst.opcode()) { - case SpvOpStore: - case SpvOpLoad: { + case spv::Op::OpStore: + case spv::Op::OpLoad: { uint32_t varId; (void)GetPtr(&inst, &varId); if (!IsTargetVar(varId)) break; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.h index 5a77670d..aef9e5ff 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.h @@ -80,7 +80,7 @@ class MemPass : public Pass { bool IsTargetType(const Instruction* typeInst) const; // Returns true if |opcode| is a non-ptr access chain op - bool IsNonPtrAccessChain(const SpvOp opcode) const; + bool IsNonPtrAccessChain(const spv::Op opcode) const; // Given the id |ptrId|, return true if the top-most non-CopyObj is // a variable, a non-ptr access chain or a parameter of pointer type. @@ -117,8 +117,8 @@ class MemPass : public Pass { bool CFGCleanup(Function* func); // Return true if |op| is supported decorate. - inline bool IsNonTypeDecorate(uint32_t op) const { - return (op == SpvOpDecorate || op == SpvOpDecorateId); + inline bool IsNonTypeDecorate(spv::Op op) const { + return (op == spv::Op::OpDecorate || op == spv::Op::OpDecorateId); } // Return the id of an undef value with type |type_id|. Create and insert an diff --git a/bgfx/3rdparty/spirv-tools/source/opt/merge_return_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/merge_return_pass.cpp index 7710deae..c262ea07 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/merge_return_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/merge_return_pass.cpp @@ -30,7 +30,7 @@ namespace opt { Pass::Status MergeReturnPass::Process() { bool is_shader = - context()->get_feature_mgr()->HasCapability(SpvCapabilityShader); + context()->get_feature_mgr()->HasCapability(spv::Capability::Shader); bool failed = false; ProcessFunction pfn = [&failed, is_shader, this](Function* function) { @@ -74,16 +74,16 @@ Pass::Status MergeReturnPass::Process() { void MergeReturnPass::GenerateState(BasicBlock* block) { if (Instruction* mergeInst = block->GetMergeInst()) { - if (mergeInst->opcode() == SpvOpLoopMerge) { + if (mergeInst->opcode() == spv::Op::OpLoopMerge) { // If new loop, break to this loop merge block state_.emplace_back(mergeInst, mergeInst); } else { auto branchInst = mergeInst->NextNode(); - if (branchInst->opcode() == SpvOpSwitch) { + if (branchInst->opcode() == spv::Op::OpSwitch) { // If switch inside of loop, break to innermost loop merge block. // Otherwise need to break to this switch merge block. auto lastMergeInst = state_.back().BreakMergeInst(); - if (lastMergeInst && lastMergeInst->opcode() == SpvOpLoopMerge) + if (lastMergeInst && lastMergeInst->opcode() == spv::Op::OpLoopMerge) state_.emplace_back(lastMergeInst, mergeInst); else state_.emplace_back(mergeInst, mergeInst); @@ -174,7 +174,7 @@ bool MergeReturnPass::ProcessStructured( void MergeReturnPass::CreateReturnBlock() { // Create a label for the new return block std::unique_ptr return_label( - new Instruction(context(), SpvOpLabel, 0u, TakeNextId(), {})); + new Instruction(context(), spv::Op::OpLabel, 0u, TakeNextId(), {})); // Create the new basic block std::unique_ptr return_block( @@ -195,37 +195,41 @@ void MergeReturnPass::CreateReturn(BasicBlock* block) { // Load and return the final return value uint32_t loadId = TakeNextId(); block->AddInstruction(MakeUnique( - context(), SpvOpLoad, function_->type_id(), loadId, + context(), spv::Op::OpLoad, function_->type_id(), loadId, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {return_value_->result_id()}}})); Instruction* var_inst = block->terminator(); context()->AnalyzeDefUse(var_inst); context()->set_instr_block(var_inst, block); context()->get_decoration_mgr()->CloneDecorations( - return_value_->result_id(), loadId, {SpvDecorationRelaxedPrecision}); + return_value_->result_id(), loadId, + {spv::Decoration::RelaxedPrecision}); block->AddInstruction(MakeUnique( - context(), SpvOpReturnValue, 0, 0, + context(), spv::Op::OpReturnValue, 0, 0, std::initializer_list{{SPV_OPERAND_TYPE_ID, {loadId}}})); context()->AnalyzeDefUse(block->terminator()); context()->set_instr_block(block->terminator(), block); } else { - block->AddInstruction(MakeUnique(context(), SpvOpReturn)); + block->AddInstruction( + MakeUnique(context(), spv::Op::OpReturn)); context()->AnalyzeDefUse(block->terminator()); context()->set_instr_block(block->terminator(), block); } } void MergeReturnPass::ProcessStructuredBlock(BasicBlock* block) { - SpvOp tail_opcode = block->tail()->opcode(); - if (tail_opcode == SpvOpReturn || tail_opcode == SpvOpReturnValue) { + spv::Op tail_opcode = block->tail()->opcode(); + if (tail_opcode == spv::Op::OpReturn || + tail_opcode == spv::Op::OpReturnValue) { if (!return_flag_) { AddReturnFlag(); } } - if (tail_opcode == SpvOpReturn || tail_opcode == SpvOpReturnValue || - tail_opcode == SpvOpUnreachable) { + if (tail_opcode == spv::Op::OpReturn || + tail_opcode == spv::Op::OpReturnValue || + tail_opcode == spv::Op::OpUnreachable) { assert(CurrentState().InBreakable() && "Should be in the placeholder construct."); BranchToBlock(block, CurrentState().BreakMergeId()); @@ -234,8 +238,8 @@ void MergeReturnPass::ProcessStructuredBlock(BasicBlock* block) { } void MergeReturnPass::BranchToBlock(BasicBlock* block, uint32_t target) { - if (block->tail()->opcode() == SpvOpReturn || - block->tail()->opcode() == SpvOpReturnValue) { + if (block->tail()->opcode() == spv::Op::OpReturn || + block->tail()->opcode() == spv::Op::OpReturnValue) { RecordReturned(block); RecordReturnValue(block); } @@ -247,7 +251,7 @@ void MergeReturnPass::BranchToBlock(BasicBlock* block, uint32_t target) { UpdatePhiNodes(block, target_block); Instruction* return_inst = block->terminator(); - return_inst->SetOpcode(SpvOpBranch); + return_inst->SetOpcode(spv::Op::OpBranch); return_inst->ReplaceOperands({{SPV_OPERAND_TYPE_ID, {target}}}); context()->get_def_use_mgr()->AnalyzeInstDefUse(return_inst); new_edges_[target_block].insert(block->id()); @@ -276,7 +280,7 @@ void MergeReturnPass::CreatePhiNodesForInst(BasicBlock* merge_block, &inst, [&users_to_update, &dom_tree, &inst, inst_bb, this](Instruction* user) { BasicBlock* user_bb = nullptr; - if (user->opcode() != SpvOpPhi) { + if (user->opcode() != spv::Op::OpPhi) { user_bb = context()->get_instr_block(user); } else { // For OpPhi, the use should be considered to be in the predecessor. @@ -325,15 +329,16 @@ void MergeReturnPass::CreatePhiNodesForInst(BasicBlock* merge_block, // instruction. If not, the Spir-V will be invalid. Instruction* inst_type = get_def_use_mgr()->GetDef(inst.type_id()); bool regenerateInstruction = false; - if (inst_type->opcode() == SpvOpTypePointer) { + if (inst_type->opcode() == spv::Op::OpTypePointer) { if (!context()->get_feature_mgr()->HasCapability( - SpvCapabilityVariablePointers)) { + spv::Capability::VariablePointers)) { regenerateInstruction = true; } - uint32_t storage_class = inst_type->GetSingleWordInOperand(0); - if (storage_class != SpvStorageClassWorkgroup && - storage_class != SpvStorageClassStorageBuffer) { + auto storage_class = + spv::StorageClass(inst_type->GetSingleWordInOperand(0)); + if (storage_class != spv::StorageClass::Workgroup && + storage_class != spv::StorageClass::StorageBuffer) { regenerateInstruction = true; } } @@ -343,7 +348,7 @@ void MergeReturnPass::CreatePhiNodesForInst(BasicBlock* merge_block, uint32_t new_id = TakeNextId(); regen_inst->SetResultId(new_id); Instruction* insert_pos = &*merge_block->begin(); - while (insert_pos->opcode() == SpvOpPhi) { + while (insert_pos->opcode() == spv::Op::OpPhi) { insert_pos = insert_pos->NextNode(); } new_phi = insert_pos->InsertBefore(std::move(regen_inst)); @@ -459,7 +464,7 @@ bool MergeReturnPass::BreakFromConstruct( // Leave the phi instructions behind. auto iter = block->begin(); - while (iter->opcode() == SpvOpPhi) { + while (iter->opcode() == spv::Op::OpPhi) { ++iter; } @@ -478,7 +483,7 @@ bool MergeReturnPass::BreakFromConstruct( // If |block| was a continue target for a loop |old_body| is now the correct // continue target. - if (break_merge_inst->opcode() == SpvOpLoopMerge && + if (break_merge_inst->opcode() == spv::Op::OpLoopMerge && break_merge_inst->GetSingleWordInOperand(1) == block->id()) { break_merge_inst->SetInOperand(1, {old_body->id()}); context()->UpdateDefUse(break_merge_inst); @@ -531,8 +536,8 @@ bool MergeReturnPass::BreakFromConstruct( } void MergeReturnPass::RecordReturned(BasicBlock* block) { - if (block->tail()->opcode() != SpvOpReturn && - block->tail()->opcode() != SpvOpReturnValue) + if (block->tail()->opcode() != spv::Op::OpReturn && + block->tail()->opcode() != spv::Op::OpReturnValue) return; assert(return_flag_ && "Did not generate the return flag variable."); @@ -550,7 +555,7 @@ void MergeReturnPass::RecordReturned(BasicBlock* block) { } std::unique_ptr return_store(new Instruction( - context(), SpvOpStore, 0, 0, + context(), spv::Op::OpStore, 0, 0, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {return_flag_->result_id()}}, {SPV_OPERAND_TYPE_ID, {constant_true_->result_id()}}})); @@ -563,7 +568,7 @@ void MergeReturnPass::RecordReturned(BasicBlock* block) { void MergeReturnPass::RecordReturnValue(BasicBlock* block) { auto terminator = *block->tail(); - if (terminator.opcode() != SpvOpReturnValue) { + if (terminator.opcode() != spv::Op::OpReturnValue) { return; } @@ -571,7 +576,7 @@ void MergeReturnPass::RecordReturnValue(BasicBlock* block) { "Did not generate the variable to hold the return value."); std::unique_ptr value_store(new Instruction( - context(), SpvOpStore, 0, 0, + context(), spv::Op::OpStore, 0, 0, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {return_value_->result_id()}}, {SPV_OPERAND_TYPE_ID, {terminator.GetSingleWordInOperand(0u)}}})); @@ -586,17 +591,19 @@ void MergeReturnPass::AddReturnValue() { if (return_value_) return; uint32_t return_type_id = function_->type_id(); - if (get_def_use_mgr()->GetDef(return_type_id)->opcode() == SpvOpTypeVoid) + if (get_def_use_mgr()->GetDef(return_type_id)->opcode() == + spv::Op::OpTypeVoid) return; uint32_t return_ptr_type = context()->get_type_mgr()->FindPointerToType( - return_type_id, SpvStorageClassFunction); + return_type_id, spv::StorageClass::Function); uint32_t var_id = TakeNextId(); - std::unique_ptr returnValue(new Instruction( - context(), SpvOpVariable, return_ptr_type, var_id, - std::initializer_list{ - {SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}})); + std::unique_ptr returnValue( + new Instruction(context(), spv::Op::OpVariable, return_ptr_type, var_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_STORAGE_CLASS, + {uint32_t(spv::StorageClass::Function)}}})); auto insert_iter = function_->begin()->begin(); insert_iter.InsertBefore(std::move(returnValue)); @@ -606,7 +613,7 @@ void MergeReturnPass::AddReturnValue() { context()->set_instr_block(return_value_, entry_block); context()->get_decoration_mgr()->CloneDecorations( - function_->result_id(), var_id, {SpvDecorationRelaxedPrecision}); + function_->result_id(), var_id, {spv::Decoration::RelaxedPrecision}); } void MergeReturnPass::AddReturnFlag() { @@ -625,14 +632,14 @@ void MergeReturnPass::AddReturnFlag() { const_mgr->GetDefiningInstruction(false_const)->result_id(); uint32_t bool_ptr_id = - type_mgr->FindPointerToType(bool_id, SpvStorageClassFunction); + type_mgr->FindPointerToType(bool_id, spv::StorageClass::Function); uint32_t var_id = TakeNextId(); std::unique_ptr returnFlag(new Instruction( - context(), SpvOpVariable, bool_ptr_id, var_id, - std::initializer_list{ - {SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}, - {SPV_OPERAND_TYPE_ID, {const_false_id}}})); + context(), spv::Op::OpVariable, bool_ptr_id, var_id, + std::initializer_list{{SPV_OPERAND_TYPE_STORAGE_CLASS, + {uint32_t(spv::StorageClass::Function)}}, + {SPV_OPERAND_TYPE_ID, {const_false_id}}})); auto insert_iter = function_->begin()->begin(); @@ -648,8 +655,8 @@ std::vector MergeReturnPass::CollectReturnBlocks( std::vector return_blocks; for (auto& block : *function) { Instruction& terminator = *block.tail(); - if (terminator.opcode() == SpvOpReturn || - terminator.opcode() == SpvOpReturnValue) { + if (terminator.opcode() == spv::Op::OpReturn || + terminator.opcode() == spv::Op::OpReturnValue) { return_blocks.push_back(&block); } } @@ -670,7 +677,7 @@ void MergeReturnPass::MergeReturnBlocks( // Create new return. std::vector phi_ops; for (auto block : return_blocks) { - if (block->tail()->opcode() == SpvOpReturnValue) { + if (block->tail()->opcode() == spv::Op::OpReturnValue) { phi_ops.push_back( {SPV_OPERAND_TYPE_ID, {block->tail()->GetSingleWordInOperand(0u)}}); phi_ops.push_back({SPV_OPERAND_TYPE_ID, {block->id()}}); @@ -682,12 +689,12 @@ void MergeReturnPass::MergeReturnBlocks( uint32_t phi_result_id = TakeNextId(); uint32_t phi_type_id = function->type_id(); std::unique_ptr phi_inst(new Instruction( - context(), SpvOpPhi, phi_type_id, phi_result_id, phi_ops)); + context(), spv::Op::OpPhi, phi_type_id, phi_result_id, phi_ops)); ret_block_iter->AddInstruction(std::move(phi_inst)); BasicBlock::iterator phiIter = ret_block_iter->tail(); std::unique_ptr return_inst( - new Instruction(context(), SpvOpReturnValue, 0u, 0u, + new Instruction(context(), spv::Op::OpReturnValue, 0u, 0u, {{SPV_OPERAND_TYPE_ID, {phi_result_id}}})); ret_block_iter->AddInstruction(std::move(return_inst)); BasicBlock::iterator ret = ret_block_iter->tail(); @@ -697,14 +704,14 @@ void MergeReturnPass::MergeReturnBlocks( get_def_use_mgr()->AnalyzeInstDef(&*ret); } else { std::unique_ptr return_inst( - new Instruction(context(), SpvOpReturn)); + new Instruction(context(), spv::Op::OpReturn)); ret_block_iter->AddInstruction(std::move(return_inst)); } // Replace returns with branches for (auto block : return_blocks) { context()->ForgetUses(block->terminator()); - block->tail()->SetOpcode(SpvOpBranch); + block->tail()->SetOpcode(spv::Op::OpBranch); block->tail()->ReplaceOperands({{SPV_OPERAND_TYPE_ID, {return_id}}}); get_def_use_mgr()->AnalyzeInstUse(block->terminator()); get_def_use_mgr()->AnalyzeInstUse(block->GetLabelInst()); @@ -789,7 +796,7 @@ bool MergeReturnPass::AddSingleCaseSwitchAroundFunction() { BasicBlock* MergeReturnPass::CreateContinueTarget(uint32_t header_label_id) { std::unique_ptr label( - new Instruction(context(), SpvOpLabel, 0u, TakeNextId(), {})); + new Instruction(context(), spv::Op::OpLabel, 0u, TakeNextId(), {})); // Create the new basic block std::unique_ptr block(new BasicBlock(std::move(label))); @@ -824,7 +831,7 @@ bool MergeReturnPass::CreateSingleCaseSwitch(BasicBlock* merge_target) { // block to make sure the OpVariable instructions remain in the entry block. BasicBlock* start_block = &*function_->begin(); auto split_pos = start_block->begin(); - while (split_pos->opcode() == SpvOpVariable) { + while (split_pos->opcode() == spv::Op::OpVariable) { ++split_pos; } @@ -865,7 +872,7 @@ bool MergeReturnPass::HasNontrivialUnreachableBlocks(Function* function) { if (struct_cfg_analysis->IsContinueBlock(bb.id())) { // |bb| must be an empty block ending with a branch to the header. Instruction* inst = &*bb.begin(); - if (inst->opcode() != SpvOpBranch) { + if (inst->opcode() != spv::Op::OpBranch) { return true; } @@ -875,7 +882,7 @@ bool MergeReturnPass::HasNontrivialUnreachableBlocks(Function* function) { } } else if (struct_cfg_analysis->IsMergeBlock(bb.id())) { // |bb| must be an empty block ending with OpUnreachable. - if (bb.begin()->opcode() != SpvOpUnreachable) { + if (bb.begin()->opcode() != spv::Op::OpUnreachable) { return true; } } else { diff --git a/bgfx/3rdparty/spirv-tools/source/opt/module.cpp b/bgfx/3rdparty/spirv-tools/source/opt/module.cpp index c98af8f5..a9710c6a 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/module.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/module.cpp @@ -69,14 +69,14 @@ std::vector Module::GetConstants() const { return const_insts; } -uint32_t Module::GetGlobalValue(SpvOp opcode) const { +uint32_t Module::GetGlobalValue(spv::Op opcode) const { for (auto& inst : types_values_) { if (inst.opcode() == opcode) return inst.result_id(); } return 0; } -void Module::AddGlobalValue(SpvOp opcode, uint32_t result_id, +void Module::AddGlobalValue(spv::Op opcode, uint32_t result_id, uint32_t type_id) { std::unique_ptr newGlobal( new Instruction(context(), opcode, type_id, result_id, {})); @@ -159,7 +159,6 @@ void Module::ToBinary(std::vector* binary, bool skip_nop) const { if (between_merge_and_branch && i->IsLineInst()) { return; } - between_merge_and_branch = false; if (last_line_inst != nullptr) { // If the current instruction is OpLine or DebugLine and it is the same // as the last line instruction that is still effective (can be applied @@ -181,28 +180,30 @@ void Module::ToBinary(std::vector* binary, bool skip_nop) const { ->get_feature_mgr() ->GetExtInstImportId_Shader100DebugInfo(); if (shader_set_id != 0) { - binary->push_back((5 << 16) | static_cast(SpvOpExtInst)); + binary->push_back((5 << 16) | + static_cast(spv::Op::OpExtInst)); binary->push_back(context()->get_type_mgr()->GetVoidTypeId()); binary->push_back(context()->TakeNextId()); binary->push_back(shader_set_id); binary->push_back(NonSemanticShaderDebugInfo100DebugNoLine); } else { - binary->push_back((1 << 16) | static_cast(SpvOpNoLine)); + binary->push_back((1 << 16) | + static_cast(spv::Op::OpNoLine)); } last_line_inst = nullptr; } } - if (opcode == SpvOpLabel) { + if (opcode == spv::Op::OpLabel) { between_label_and_phi_var = true; - } else if (opcode != SpvOpVariable && opcode != SpvOpPhi && + } else if (opcode != spv::Op::OpVariable && opcode != spv::Op::OpPhi && !spvtools::opt::IsOpLineInst(opcode)) { between_label_and_phi_var = false; } if (!(skip_nop && i->IsNop())) { const auto& scope = i->GetDebugScope(); - if (scope != last_scope) { + if (scope != last_scope && !between_merge_and_branch) { // Can only emit nonsemantic instructions after all phi instructions // in a block so don't emit scope instructions before phi instructions // for NonSemantic.Shader.DebugInfo.100. @@ -221,9 +222,11 @@ void Module::ToBinary(std::vector* binary, bool skip_nop) const { i->ToBinaryWithoutAttachedDebugInsts(binary); } // Update the last line instruction. + between_merge_and_branch = false; if (spvOpcodeIsBlockTerminator(opcode) || i->IsNoLine()) { last_line_inst = nullptr; - } else if (opcode == SpvOpLoopMerge || opcode == SpvOpSelectionMerge) { + } else if (opcode == spv::Op::OpLoopMerge || + opcode == spv::Op::OpSelectionMerge) { between_merge_and_branch = true; last_line_inst = nullptr; } else if (i->IsLine()) { @@ -272,7 +275,7 @@ uint32_t Module::GetExtInstImportId(const char* extstr) { std::ostream& operator<<(std::ostream& str, const Module& module) { module.ForEachInst([&str](const Instruction* inst) { str << *inst; - if (inst->opcode() != SpvOpFunctionEnd) { + if (inst->opcode() != spv::Op::OpFunctionEnd) { str << std::endl; } }); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/module.h b/bgfx/3rdparty/spirv-tools/source/opt/module.h index 7a6be460..b9d69129 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/module.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/module.h @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -136,10 +137,10 @@ class Module { std::vector GetConstants() const; // Return result id of global value with |opcode|, 0 if not present. - uint32_t GetGlobalValue(SpvOp opcode) const; + uint32_t GetGlobalValue(spv::Op opcode) const; // Add global value with |opcode|, |result_id| and |type_id| - void AddGlobalValue(SpvOp opcode, uint32_t result_id, uint32_t type_id); + void AddGlobalValue(spv::Op opcode, uint32_t result_id, uint32_t type_id); inline uint32_t id_bound() const { return header_.bound; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/optimizer.cpp b/bgfx/3rdparty/spirv-tools/source/opt/optimizer.cpp index 381589b5..b8f52834 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/optimizer.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/optimizer.cpp @@ -15,6 +15,7 @@ #include "spirv-tools/optimizer.hpp" #include +#include #include #include #include @@ -60,6 +61,7 @@ struct Optimizer::Impl { spv_target_env target_env; // Target environment. opt::PassManager pass_manager; // Internal implementation pass manager. + std::unordered_set live_locs; // Arg to debug dead output passes }; Optimizer::Optimizer(spv_target_env env) : impl_(new Impl(env)) { @@ -108,7 +110,7 @@ Optimizer& Optimizer::RegisterPass(PassToken&& p) { // The legalization problem is essentially a very general copy propagation // problem. The optimization we use are all used to either do copy propagation // or enable more copy propagation. -Optimizer& Optimizer::RegisterLegalizationPasses() { +Optimizer& Optimizer::RegisterLegalizationPasses(bool preserve_interface) { return // Wrap OpKill instructions so all other code can be inlined. RegisterPass(CreateWrapOpKillPass()) @@ -128,16 +130,16 @@ Optimizer& Optimizer::RegisterLegalizationPasses() { // Propagate the value stored to the loads in very simple cases. .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) .RegisterPass(CreateLocalSingleStoreElimPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) // Split up aggregates so they are easier to deal with. .RegisterPass(CreateScalarReplacementPass(0)) // Remove loads and stores so everything is in intermediate values. // Takes care of copy propagation of non-members. .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) .RegisterPass(CreateLocalSingleStoreElimPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateLocalMultiStoreElimPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) // Propagate constants to get as many constant conditions on branches // as possible. .RegisterPass(CreateCCPPass()) @@ -146,7 +148,7 @@ Optimizer& Optimizer::RegisterLegalizationPasses() { // Copy propagate members. Cleans up code sequences generated by // scalar replacement. Also important for removing OpPhi nodes. .RegisterPass(CreateSimplificationPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateCopyPropagateArraysPass()) // May need loop unrolling here see // https://github.com/Microsoft/DirectXShaderCompiler/pull/930 @@ -155,30 +157,34 @@ Optimizer& Optimizer::RegisterLegalizationPasses() { .RegisterPass(CreateVectorDCEPass()) .RegisterPass(CreateDeadInsertElimPass()) .RegisterPass(CreateReduceLoadSizePass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateInterpolateFixupPass()); } -Optimizer& Optimizer::RegisterPerformancePasses() { +Optimizer& Optimizer::RegisterLegalizationPasses() { + return RegisterLegalizationPasses(false); +} + +Optimizer& Optimizer::RegisterPerformancePasses(bool preserve_interface) { return RegisterPass(CreateWrapOpKillPass()) .RegisterPass(CreateDeadBranchElimPass()) .RegisterPass(CreateMergeReturnPass()) .RegisterPass(CreateInlineExhaustivePass()) .RegisterPass(CreateEliminateDeadFunctionsPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreatePrivateToLocalPass()) .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) .RegisterPass(CreateLocalSingleStoreElimPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateScalarReplacementPass()) .RegisterPass(CreateLocalAccessChainConvertPass()) .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) .RegisterPass(CreateLocalSingleStoreElimPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateLocalMultiStoreElimPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateCCPPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateLoopUnrollPass(true)) .RegisterPass(CreateDeadBranchElimPass()) .RegisterPass(CreateRedundancyEliminationPass()) @@ -188,9 +194,9 @@ Optimizer& Optimizer::RegisterPerformancePasses() { .RegisterPass(CreateLocalAccessChainConvertPass()) .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) .RegisterPass(CreateLocalSingleStoreElimPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateSSARewritePass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateVectorDCEPass()) .RegisterPass(CreateDeadInsertElimPass()) .RegisterPass(CreateDeadBranchElimPass()) @@ -198,7 +204,7 @@ Optimizer& Optimizer::RegisterPerformancePasses() { .RegisterPass(CreateIfConversionPass()) .RegisterPass(CreateCopyPropagateArraysPass()) .RegisterPass(CreateReduceLoadSizePass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateBlockMergePass()) .RegisterPass(CreateRedundancyEliminationPass()) .RegisterPass(CreateDeadBranchElimPass()) @@ -206,7 +212,11 @@ Optimizer& Optimizer::RegisterPerformancePasses() { .RegisterPass(CreateSimplificationPass()); } -Optimizer& Optimizer::RegisterSizePasses() { +Optimizer& Optimizer::RegisterPerformancePasses() { + return RegisterPerformancePasses(false); +} + +Optimizer& Optimizer::RegisterSizePasses(bool preserve_interface) { return RegisterPass(CreateWrapOpKillPass()) .RegisterPass(CreateDeadBranchElimPass()) .RegisterPass(CreateMergeReturnPass()) @@ -223,12 +233,12 @@ Optimizer& Optimizer::RegisterSizePasses() { .RegisterPass(CreateLocalSingleStoreElimPass()) .RegisterPass(CreateIfConversionPass()) .RegisterPass(CreateSimplificationPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateDeadBranchElimPass()) .RegisterPass(CreateBlockMergePass()) .RegisterPass(CreateLocalAccessChainConvertPass()) .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateCopyPropagateArraysPass()) .RegisterPass(CreateVectorDCEPass()) .RegisterPass(CreateDeadInsertElimPass()) @@ -238,10 +248,12 @@ Optimizer& Optimizer::RegisterSizePasses() { .RegisterPass(CreateLocalMultiStoreElimPass()) .RegisterPass(CreateRedundancyEliminationPass()) .RegisterPass(CreateSimplificationPass()) - .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateAggressiveDCEPass(preserve_interface)) .RegisterPass(CreateCFGCleanupPass()); } +Optimizer& Optimizer::RegisterSizePasses() { return RegisterSizePasses(false); } + bool Optimizer::RegisterPassesFromFlags(const std::vector& flags) { for (const auto& flag : flags) { if (!RegisterPassFromFlag(flag)) { @@ -418,20 +430,11 @@ bool Optimizer::RegisterPassFromFlag(const std::string& flag) { RegisterPass(CreateWorkaround1209Pass()); } else if (pass_name == "replace-invalid-opcode") { RegisterPass(CreateReplaceInvalidOpcodePass()); - } else if (pass_name == "inst-bindless-check") { - RegisterPass(CreateInstBindlessCheckPass(7, 23, false, false)); - RegisterPass(CreateSimplificationPass()); - RegisterPass(CreateDeadBranchElimPass()); - RegisterPass(CreateBlockMergePass()); - RegisterPass(CreateAggressiveDCEPass(true)); - } else if (pass_name == "inst-desc-idx-check") { - RegisterPass(CreateInstBindlessCheckPass(7, 23, true, true)); - RegisterPass(CreateSimplificationPass()); - RegisterPass(CreateDeadBranchElimPass()); - RegisterPass(CreateBlockMergePass()); - RegisterPass(CreateAggressiveDCEPass(true)); - } else if (pass_name == "inst-buff-oob-check") { - RegisterPass(CreateInstBindlessCheckPass(7, 23, false, false, true, true)); + } else if (pass_name == "inst-bindless-check" || + pass_name == "inst-desc-idx-check" || + pass_name == "inst-buff-oob-check") { + // preserve legacy names + RegisterPass(CreateInstBindlessCheckPass(7, 23)); RegisterPass(CreateSimplificationPass()); RegisterPass(CreateDeadBranchElimPass()); RegisterPass(CreateBlockMergePass()); @@ -524,7 +527,7 @@ bool Optimizer::RegisterPassFromFlag(const std::string& flag) { } else if (pass_name == "remove-dont-inline") { RegisterPass(CreateRemoveDontInlinePass()); } else if (pass_name == "eliminate-dead-input-components") { - RegisterPass(CreateEliminateDeadInputComponentsPass()); + RegisterPass(CreateEliminateDeadInputComponentsSafePass()); } else if (pass_name == "fix-func-call-param") { RegisterPass(CreateFixFuncCallArgumentsPass()); } else if (pass_name == "convert-to-sampled-image") { @@ -547,6 +550,39 @@ bool Optimizer::RegisterPassFromFlag(const std::string& flag) { pass_args.c_str()); return false; } + } else if (pass_name == "switch-descriptorset") { + if (pass_args.size() == 0) { + Error(consumer(), nullptr, {}, + "--switch-descriptorset requires a from:to argument."); + return false; + } + uint32_t from_set, to_set; + const char* start = pass_args.data(); + const char* end = pass_args.data() + pass_args.size(); + + auto result = std::from_chars(start, end, from_set); + if (result.ec != std::errc()) { + Errorf(consumer(), nullptr, {}, + "Invalid argument for --switch-descriptorset: %s", + pass_args.c_str()); + return false; + } + start = result.ptr; + if (start[0] != ':') { + Errorf(consumer(), nullptr, {}, + "Invalid argument for --switch-descriptorset: %s", + pass_args.c_str()); + return false; + } + start++; + result = std::from_chars(start, end, to_set); + if (result.ec != std::errc() || result.ptr != end) { + Errorf(consumer(), nullptr, {}, + "Invalid argument for --switch-descriptorset: %s", + pass_args.c_str()); + return false; + } + RegisterPass(CreateSwitchDescriptorSetPass(from_set, to_set)); } else { Errorf(consumer(), nullptr, {}, "Unknown flag '--%s'. Use --help for a list of valid flags", @@ -786,12 +822,18 @@ Optimizer::PassToken CreateLocalMultiStoreElimPass() { Optimizer::PassToken CreateAggressiveDCEPass() { return MakeUnique( - MakeUnique(false)); + MakeUnique(false, false)); } Optimizer::PassToken CreateAggressiveDCEPass(bool preserve_interface) { return MakeUnique( - MakeUnique(preserve_interface)); + MakeUnique(preserve_interface, false)); +} + +Optimizer::PassToken CreateAggressiveDCEPass(bool preserve_interface, + bool remove_outputs) { + return MakeUnique( + MakeUnique(preserve_interface, remove_outputs)); } Optimizer::PassToken CreateRemoveUnusedInterfaceVariablesPass() { @@ -938,14 +980,10 @@ Optimizer::PassToken CreateUpgradeMemoryModelPass() { MakeUnique()); } -Optimizer::PassToken CreateInstBindlessCheckPass( - uint32_t desc_set, uint32_t shader_id, bool desc_length_enable, - bool desc_init_enable, bool buff_oob_enable, bool texbuff_oob_enable) { +Optimizer::PassToken CreateInstBindlessCheckPass(uint32_t desc_set, + uint32_t shader_id) { return MakeUnique( - MakeUnique( - desc_set, shader_id, desc_length_enable, desc_init_enable, - buff_oob_enable, texbuff_oob_enable, - desc_length_enable || desc_init_enable || buff_oob_enable)); + MakeUnique(desc_set, shader_id)); } Optimizer::PassToken CreateInstDebugPrintfPass(uint32_t desc_set, @@ -1016,7 +1054,34 @@ Optimizer::PassToken CreateInterpolateFixupPass() { Optimizer::PassToken CreateEliminateDeadInputComponentsPass() { return MakeUnique( - MakeUnique()); + MakeUnique(spv::StorageClass::Input, + /* safe_mode */ false)); +} + +Optimizer::PassToken CreateEliminateDeadOutputComponentsPass() { + return MakeUnique( + MakeUnique(spv::StorageClass::Output, + /* safe_mode */ false)); +} + +Optimizer::PassToken CreateEliminateDeadInputComponentsSafePass() { + return MakeUnique( + MakeUnique(spv::StorageClass::Input, + /* safe_mode */ true)); +} + +Optimizer::PassToken CreateAnalyzeLiveInputPass( + std::unordered_set* live_locs, + std::unordered_set* live_builtins) { + return MakeUnique( + MakeUnique(live_locs, live_builtins)); +} + +Optimizer::PassToken CreateEliminateDeadOutputStoresPass( + std::unordered_set* live_locs, + std::unordered_set* live_builtins) { + return MakeUnique( + MakeUnique(live_locs, live_builtins)); } Optimizer::PassToken CreateConvertToSampledImagePass( @@ -1040,4 +1105,106 @@ Optimizer::PassToken CreateFixFuncCallArgumentsPass() { return MakeUnique( MakeUnique()); } + +Optimizer::PassToken CreateTrimCapabilitiesPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateSwitchDescriptorSetPass(uint32_t from, uint32_t to) { + return MakeUnique( + MakeUnique(from, to)); +} } // namespace spvtools + +extern "C" { + +SPIRV_TOOLS_EXPORT spv_optimizer_t* spvOptimizerCreate(spv_target_env env) { + return reinterpret_cast(new spvtools::Optimizer(env)); +} + +SPIRV_TOOLS_EXPORT void spvOptimizerDestroy(spv_optimizer_t* optimizer) { + delete reinterpret_cast(optimizer); +} + +SPIRV_TOOLS_EXPORT void spvOptimizerSetMessageConsumer( + spv_optimizer_t* optimizer, spv_message_consumer consumer) { + reinterpret_cast(optimizer)-> + SetMessageConsumer( + [consumer](spv_message_level_t level, const char* source, + const spv_position_t& position, const char* message) { + return consumer(level, source, &position, message); + }); +} + +SPIRV_TOOLS_EXPORT void spvOptimizerRegisterLegalizationPasses( + spv_optimizer_t* optimizer) { + reinterpret_cast(optimizer)-> + RegisterLegalizationPasses(); +} + +SPIRV_TOOLS_EXPORT void spvOptimizerRegisterPerformancePasses( + spv_optimizer_t* optimizer) { + reinterpret_cast(optimizer)-> + RegisterPerformancePasses(); +} + +SPIRV_TOOLS_EXPORT void spvOptimizerRegisterSizePasses( + spv_optimizer_t* optimizer) { + reinterpret_cast(optimizer)->RegisterSizePasses(); +} + +SPIRV_TOOLS_EXPORT bool spvOptimizerRegisterPassFromFlag( + spv_optimizer_t* optimizer, const char* flag) +{ + return reinterpret_cast(optimizer)-> + RegisterPassFromFlag(flag); +} + +SPIRV_TOOLS_EXPORT bool spvOptimizerRegisterPassesFromFlags( + spv_optimizer_t* optimizer, const char** flags, const size_t flag_count) { + std::vector opt_flags; + for (uint32_t i = 0; i < flag_count; i++) { + opt_flags.emplace_back(flags[i]); + } + + return reinterpret_cast(optimizer)-> + RegisterPassesFromFlags(opt_flags); +} + +SPIRV_TOOLS_EXPORT +spv_result_t spvOptimizerRun(spv_optimizer_t* optimizer, + const uint32_t* binary, + const size_t word_count, + spv_binary* optimized_binary, + const spv_optimizer_options options) { + std::vector optimized; + + if (!reinterpret_cast(optimizer)-> + Run(binary, word_count, &optimized, options)) { + return SPV_ERROR_INTERNAL; + } + + auto result_binary = new spv_binary_t(); + if (!result_binary) { + *optimized_binary = nullptr; + return SPV_ERROR_OUT_OF_MEMORY; + } + + result_binary->code = new uint32_t[optimized.size()]; + if (!result_binary->code) { + delete result_binary; + *optimized_binary = nullptr; + return SPV_ERROR_OUT_OF_MEMORY; + } + result_binary->wordCount = optimized.size(); + + memcpy(result_binary->code, optimized.data(), + optimized.size() * sizeof(uint32_t)); + + *optimized_binary = result_binary; + + return SPV_SUCCESS; +} + +} // extern "C" diff --git a/bgfx/3rdparty/spirv-tools/source/opt/pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/pass.cpp index 017aad10..75c37407 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/pass.cpp @@ -21,11 +21,8 @@ namespace spvtools { namespace opt { - namespace { - -const uint32_t kTypePointerTypeIdInIdx = 1; - +constexpr uint32_t kTypePointerTypeIdInIdx = 1; } // namespace Pass::Pass() : consumer_(nullptr), context_(nullptr), already_run_(false) {} @@ -56,11 +53,11 @@ uint32_t Pass::GetPointeeTypeId(const Instruction* ptrInst) const { Instruction* Pass::GetBaseType(uint32_t ty_id) { Instruction* ty_inst = get_def_use_mgr()->GetDef(ty_id); - if (ty_inst->opcode() == SpvOpTypeMatrix) { + if (ty_inst->opcode() == spv::Op::OpTypeMatrix) { uint32_t vty_id = ty_inst->GetSingleWordInOperand(0); ty_inst = get_def_use_mgr()->GetDef(vty_id); } - if (ty_inst->opcode() == SpvOpTypeVector) { + if (ty_inst->opcode() == spv::Op::OpTypeVector) { uint32_t cty_id = ty_inst->GetSingleWordInOperand(0); ty_inst = get_def_use_mgr()->GetDef(cty_id); } @@ -69,12 +66,12 @@ Instruction* Pass::GetBaseType(uint32_t ty_id) { bool Pass::IsFloat(uint32_t ty_id, uint32_t width) { Instruction* ty_inst = GetBaseType(ty_id); - if (ty_inst->opcode() != SpvOpTypeFloat) return false; + if (ty_inst->opcode() != spv::Op::OpTypeFloat) return false; return ty_inst->GetSingleWordInOperand(0) == width; } uint32_t Pass::GetNullId(uint32_t type_id) { - if (IsFloat(type_id, 16)) context()->AddCapability(SpvCapabilityFloat16); + if (IsFloat(type_id, 16)) context()->AddCapability(spv::Capability::Float16); analysis::TypeManager* type_mgr = context()->get_type_mgr(); analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); const analysis::Type* type = type_mgr->GetType(type_id); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/passes.h b/bgfx/3rdparty/spirv-tools/source/opt/passes.h index 21354c77..83caa4a7 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/passes.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/passes.h @@ -19,6 +19,7 @@ #include "source/opt/aggressive_dead_code_elim_pass.h" #include "source/opt/amd_ext_to_khr.h" +#include "source/opt/analyze_live_input_pass.h" #include "source/opt/block_merge_pass.h" #include "source/opt/ccp_pass.h" #include "source/opt/cfg_cleanup_pass.h" @@ -34,8 +35,9 @@ #include "source/opt/desc_sroa.h" #include "source/opt/eliminate_dead_constant_pass.h" #include "source/opt/eliminate_dead_functions_pass.h" -#include "source/opt/eliminate_dead_input_components_pass.h" +#include "source/opt/eliminate_dead_io_components_pass.h" #include "source/opt/eliminate_dead_members_pass.h" +#include "source/opt/eliminate_dead_output_stores_pass.h" #include "source/opt/empty_pass.h" #include "source/opt/fix_func_call_arguments.h" #include "source/opt/fix_storage_class.h" @@ -80,6 +82,8 @@ #include "source/opt/strength_reduction_pass.h" #include "source/opt/strip_debug_info_pass.h" #include "source/opt/strip_nonsemantic_info_pass.h" +#include "source/opt/switch_descriptorset_pass.h" +#include "source/opt/trim_capabilities_pass.h" #include "source/opt/unify_const_pass.h" #include "source/opt/upgrade_memory_model.h" #include "source/opt/vector_dce.h" diff --git a/bgfx/3rdparty/spirv-tools/source/opt/private_to_local_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/private_to_local_pass.cpp index 80fb4c53..4904e058 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/private_to_local_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/private_to_local_pass.cpp @@ -24,10 +24,8 @@ namespace spvtools { namespace opt { namespace { - -const uint32_t kVariableStorageClassInIdx = 0; -const uint32_t kSpvTypePointerTypeIdInIdx = 1; - +constexpr uint32_t kVariableStorageClassInIdx = 0; +constexpr uint32_t kSpvTypePointerTypeIdInIdx = 1; } // namespace Pass::Status PrivateToLocalPass::Process() { @@ -35,18 +33,18 @@ Pass::Status PrivateToLocalPass::Process() { // Private variables require the shader capability. If this is not a shader, // there is no work to do. - if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses)) + if (context()->get_feature_mgr()->HasCapability(spv::Capability::Addresses)) return Status::SuccessWithoutChange; std::vector> variables_to_move; std::unordered_set localized_variables; for (auto& inst : context()->types_values()) { - if (inst.opcode() != SpvOpVariable) { + if (inst.opcode() != spv::Op::OpVariable) { continue; } - if (inst.GetSingleWordInOperand(kVariableStorageClassInIdx) != - SpvStorageClassPrivate) { + if (spv::StorageClass(inst.GetSingleWordInOperand( + kVariableStorageClassInIdx)) != spv::StorageClass::Private) { continue; } @@ -123,7 +121,8 @@ bool PrivateToLocalPass::MoveVariable(Instruction* variable, context()->ForgetUses(variable); // Update the storage class of the variable. - variable->SetInOperand(kVariableStorageClassInIdx, {SpvStorageClassFunction}); + variable->SetInOperand(kVariableStorageClassInIdx, + {uint32_t(spv::StorageClass::Function)}); // Update the type as well. uint32_t new_type_id = GetNewType(variable->type_id()); @@ -147,7 +146,7 @@ uint32_t PrivateToLocalPass::GetNewType(uint32_t old_type_id) { uint32_t pointee_type_id = old_type_inst->GetSingleWordInOperand(kSpvTypePointerTypeIdInIdx); uint32_t new_type_id = - type_mgr->FindPointerToType(pointee_type_id, SpvStorageClassFunction); + type_mgr->FindPointerToType(pointee_type_id, spv::StorageClass::Function); if (new_type_id != 0) { context()->UpdateDefUse(context()->get_def_use_mgr()->GetDef(new_type_id)); } @@ -161,17 +160,17 @@ bool PrivateToLocalPass::IsValidUse(const Instruction* inst) const { return true; } switch (inst->opcode()) { - case SpvOpLoad: - case SpvOpStore: - case SpvOpImageTexelPointer: // Treat like a load + case spv::Op::OpLoad: + case spv::Op::OpStore: + case spv::Op::OpImageTexelPointer: // Treat like a load return true; - case SpvOpAccessChain: + case spv::Op::OpAccessChain: return context()->get_def_use_mgr()->WhileEachUser( inst, [this](const Instruction* user) { if (!IsValidUse(user)) return false; return true; }); - case SpvOpName: + case spv::Op::OpName: return true; default: return spvOpcodeIsDecoration(inst->opcode()); @@ -188,13 +187,13 @@ bool PrivateToLocalPass::UpdateUse(Instruction* inst, Instruction* user) { return true; } switch (inst->opcode()) { - case SpvOpLoad: - case SpvOpStore: - case SpvOpImageTexelPointer: // Treat like a load + case spv::Op::OpLoad: + case spv::Op::OpStore: + case spv::Op::OpImageTexelPointer: // Treat like a load // The type is fine because it is the type pointed to, and that does not // change. break; - case SpvOpAccessChain: { + case spv::Op::OpAccessChain: { context()->ForgetUses(inst); uint32_t new_type_id = GetNewType(inst->type_id()); if (new_type_id == 0) { @@ -208,8 +207,8 @@ bool PrivateToLocalPass::UpdateUse(Instruction* inst, Instruction* user) { return false; } } break; - case SpvOpName: - case SpvOpEntryPoint: // entry points will be updated separately. + case spv::Op::OpName: + case spv::Op::OpEntryPoint: // entry points will be updated separately. break; default: assert(spvOpcodeIsDecoration(inst->opcode()) && diff --git a/bgfx/3rdparty/spirv-tools/source/opt/propagator.cpp b/bgfx/3rdparty/spirv-tools/source/opt/propagator.cpp index 6a1f1aaf..9cd6174c 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/propagator.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/propagator.cpp @@ -134,7 +134,7 @@ bool SSAPropagator::Simulate(Instruction* instr) { // defined at an instruction D that should be simulated again, then the output // of D might affect |instr|, so we should simulate |instr| again. bool has_operands_to_simulate = false; - if (instr->opcode() == SpvOpPhi) { + if (instr->opcode() == spv::Op::OpPhi) { // For Phi instructions, an operand causes the Phi to be simulated again if // the operand comes from an edge that has not yet been traversed or if its // definition should be simulated again. @@ -189,7 +189,7 @@ bool SSAPropagator::Simulate(BasicBlock* block) { // statement in it. if (!BlockHasBeenSimulated(block)) { block->ForEachInst([this, &changed](Instruction* instr) { - if (instr->opcode() != SpvOpPhi) { + if (instr->opcode() != spv::Op::OpPhi) { changed |= Simulate(instr); } }); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/propagator.h b/bgfx/3rdparty/spirv-tools/source/opt/propagator.h index ac7c0e7e..71212c96 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/propagator.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/propagator.h @@ -153,10 +153,10 @@ struct Edge { // std::map values; // const auto visit_fn = [&ctx, &values](Instruction* instr, // BasicBlock** dest_bb) { -// if (instr->opcode() == SpvOpStore) { +// if (instr->opcode() == spv::Op::OpStore) { // uint32_t rhs_id = instr->GetSingleWordOperand(1); // Instruction* rhs_def = ctx->get_def_use_mgr()->GetDef(rhs_id); -// if (rhs_def->opcode() == SpvOpConstant) { +// if (rhs_def->opcode() == spv::Op::OpConstant) { // uint32_t val = rhs_def->GetSingleWordOperand(2); // values[rhs_id] = val; // return SSAPropagator::kInteresting; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp b/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp index 56491b2f..73a90f06 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp @@ -22,23 +22,20 @@ #include "source/opt/ir_context.h" #include "source/util/bit_vector.h" -namespace { - -const uint32_t kExtractCompositeIdInIdx = 0; -const uint32_t kVariableStorageClassInIdx = 0; -const uint32_t kLoadPointerInIdx = 0; - -} // namespace - namespace spvtools { namespace opt { +namespace { +constexpr uint32_t kExtractCompositeIdInIdx = 0; +constexpr uint32_t kVariableStorageClassInIdx = 0; +constexpr uint32_t kLoadPointerInIdx = 0; +} // namespace Pass::Status ReduceLoadSize::Process() { bool modified = false; for (auto& func : *get_module()) { func.ForEachInst([&modified, this](Instruction* inst) { - if (inst->opcode() == SpvOpCompositeExtract) { + if (inst->opcode() == spv::Op::OpCompositeExtract) { if (ShouldReplaceExtract(inst)) { modified |= ReplaceExtract(inst); } @@ -50,7 +47,7 @@ Pass::Status ReduceLoadSize::Process() { } bool ReduceLoadSize::ReplaceExtract(Instruction* inst) { - assert(inst->opcode() == SpvOpCompositeExtract && + assert(inst->opcode() == spv::Op::OpCompositeExtract && "Wrong opcode. Should be OpCompositeExtract."); analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); analysis::TypeManager* type_mgr = context()->get_type_mgr(); @@ -60,7 +57,7 @@ bool ReduceLoadSize::ReplaceExtract(Instruction* inst) { inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); Instruction* composite_inst = def_use_mgr->GetDef(composite_id); - if (composite_inst->opcode() != SpvOpLoad) { + if (composite_inst->opcode() != spv::Op::OpLoad) { return false; } @@ -71,16 +68,16 @@ bool ReduceLoadSize::ReplaceExtract(Instruction* inst) { } Instruction* var = composite_inst->GetBaseAddress(); - if (var == nullptr || var->opcode() != SpvOpVariable) { + if (var == nullptr || var->opcode() != spv::Op::OpVariable) { return false; } - SpvStorageClass storage_class = static_cast( + spv::StorageClass storage_class = static_cast( var->GetSingleWordInOperand(kVariableStorageClassInIdx)); switch (storage_class) { - case SpvStorageClassUniform: - case SpvStorageClassUniformConstant: - case SpvStorageClassInput: + case spv::StorageClass::Uniform: + case spv::StorageClass::UniformConstant: + case spv::StorageClass::Input: break; default: return false; @@ -124,7 +121,7 @@ bool ReduceLoadSize::ShouldReplaceExtract(Instruction* inst) { Instruction* op_inst = def_use_mgr->GetDef( inst->GetSingleWordInOperand(kExtractCompositeIdInIdx)); - if (op_inst->opcode() != SpvOpLoad) { + if (op_inst->opcode() != spv::Op::OpLoad) { return false; } @@ -139,7 +136,7 @@ bool ReduceLoadSize::ShouldReplaceExtract(Instruction* inst) { all_elements_used = !def_use_mgr->WhileEachUser(op_inst, [&elements_used](Instruction* use) { if (use->IsCommonDebugInstr()) return true; - if (use->opcode() != SpvOpCompositeExtract || + if (use->opcode() != spv::Op::OpCompositeExtract || use->NumInOperands() == 1) { return false; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/reflect.h b/bgfx/3rdparty/spirv-tools/source/opt/reflect.h index c2ffb0be..ec7c2dd0 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/reflect.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/reflect.h @@ -16,6 +16,7 @@ #define SOURCE_OPT_REFLECT_H_ #include "source/latest_version_spirv_header.h" +#include "source/opcode.h" namespace spvtools { namespace opt { @@ -24,41 +25,36 @@ namespace opt { // following functions tend to be outdated and should be updated when SPIR-V // version bumps. -inline bool IsDebug1Inst(SpvOp opcode) { - return (opcode >= SpvOpSourceContinued && opcode <= SpvOpSourceExtension) || - opcode == SpvOpString; +inline bool IsDebug1Inst(spv::Op opcode) { + return (opcode >= spv::Op::OpSourceContinued && + opcode <= spv::Op::OpSourceExtension) || + opcode == spv::Op::OpString; } -inline bool IsDebug2Inst(SpvOp opcode) { - return opcode == SpvOpName || opcode == SpvOpMemberName; +inline bool IsDebug2Inst(spv::Op opcode) { + return opcode == spv::Op::OpName || opcode == spv::Op::OpMemberName; } -inline bool IsDebug3Inst(SpvOp opcode) { - return opcode == SpvOpModuleProcessed; +inline bool IsDebug3Inst(spv::Op opcode) { + return opcode == spv::Op::OpModuleProcessed; } -inline bool IsOpLineInst(SpvOp opcode) { - return opcode == SpvOpLine || opcode == SpvOpNoLine; +inline bool IsOpLineInst(spv::Op opcode) { + return opcode == spv::Op::OpLine || opcode == spv::Op::OpNoLine; } -inline bool IsAnnotationInst(SpvOp opcode) { - return (opcode >= SpvOpDecorate && opcode <= SpvOpGroupMemberDecorate) || - opcode == SpvOpDecorateId || opcode == SpvOpDecorateStringGOOGLE || - opcode == SpvOpMemberDecorateStringGOOGLE; +inline bool IsAnnotationInst(spv::Op opcode) { + return (opcode >= spv::Op::OpDecorate && + opcode <= spv::Op::OpGroupMemberDecorate) || + opcode == spv::Op::OpDecorateId || + opcode == spv::Op::OpDecorateStringGOOGLE || + opcode == spv::Op::OpMemberDecorateStringGOOGLE; } -inline bool IsTypeInst(SpvOp opcode) { - return (opcode >= SpvOpTypeVoid && opcode <= SpvOpTypeForwardPointer) || - opcode == SpvOpTypePipeStorage || opcode == SpvOpTypeNamedBarrier || - opcode == SpvOpTypeAccelerationStructureNV || - opcode == SpvOpTypeAccelerationStructureKHR || - opcode == SpvOpTypeRayQueryKHR || - opcode == SpvOpTypeCooperativeMatrixNV; +inline bool IsTypeInst(spv::Op opcode) { + return spvOpcodeGeneratesType(opcode) || + opcode == spv::Op::OpTypeForwardPointer; } -inline bool IsConstantInst(SpvOp opcode) { - return (opcode >= SpvOpConstantTrue && opcode <= SpvOpSpecConstantOp) || - opcode == SpvOpConstantFunctionPointerINTEL; +inline bool IsConstantInst(spv::Op opcode) { + return spvOpcodeIsConstant(opcode); } -inline bool IsCompileTimeConstantInst(SpvOp opcode) { - return opcode >= SpvOpConstantTrue && opcode <= SpvOpConstantNull; -} -inline bool IsSpecConstantInst(SpvOp opcode) { - return opcode >= SpvOpSpecConstantTrue && opcode <= SpvOpSpecConstantOp; +inline bool IsSpecConstantInst(spv::Op opcode) { + return spvOpcodeIsSpecConstant(opcode); } } // namespace opt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/register_pressure.cpp b/bgfx/3rdparty/spirv-tools/source/opt/register_pressure.cpp index 1ad33738..34a8ba3e 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/register_pressure.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/register_pressure.cpp @@ -26,7 +26,6 @@ namespace spvtools { namespace opt { - namespace { // Predicate for the FilterIterator to only consider instructions that are not // phi instructions defined in the basic block |bb|. @@ -36,7 +35,7 @@ class ExcludePhiDefinedInBlock { : context_(context), bb_(bb) {} bool operator()(Instruction* insn) const { - return !(insn->opcode() == SpvOpPhi && + return !(insn->opcode() == spv::Op::OpPhi && context_->get_instr_block(insn) == bb_); } @@ -49,9 +48,9 @@ class ExcludePhiDefinedInBlock { // physical register. bool CreatesRegisterUsage(Instruction* insn) { if (!insn->HasResultId()) return false; - if (insn->opcode() == SpvOpUndef) return false; + if (insn->opcode() == spv::Op::OpUndef) return false; if (IsConstantInst(insn->opcode())) return false; - if (insn->opcode() == SpvOpLabel) return false; + if (insn->opcode() == spv::Op::OpLabel) return false; return true; } @@ -147,7 +146,7 @@ class ComputeRegisterLiveness { live_inout->live_in_ = live_inout->live_out_; for (Instruction& insn : make_range(bb->rbegin(), bb->rend())) { - if (insn.opcode() == SpvOpPhi) { + if (insn.opcode() == spv::Op::OpPhi) { live_inout->live_in_.insert(&insn); break; } @@ -224,7 +223,7 @@ class ComputeRegisterLiveness { for (Instruction& insn : make_range(bb.rbegin(), bb.rend())) { // If it is a phi instruction, the register pressure will not change // anymore. - if (insn.opcode() == SpvOpPhi) { + if (insn.opcode() == spv::Op::OpPhi) { break; } @@ -271,7 +270,7 @@ void RegisterLiveness::RegionRegisterLiveness::AddRegisterClass( RegisterLiveness::RegisterClass reg_class{type, false}; insn->context()->get_decoration_mgr()->WhileEachDecoration( - insn->result_id(), SpvDecorationUniform, + insn->result_id(), uint32_t(spv::Decoration::Uniform), [®_class](const Instruction&) { reg_class.is_uniform_ = true; return false; @@ -325,7 +324,7 @@ void RegisterLiveness::ComputeLoopRegisterPressure( loop_reg_pressure->used_registers_, live_inout->used_registers_); for (Instruction& insn : *bb) { - if (insn.opcode() == SpvOpPhi || !CreatesRegisterUsage(&insn) || + if (insn.opcode() == spv::Op::OpPhi || !CreatesRegisterUsage(&insn) || seen_insn.count(insn.result_id())) { continue; } @@ -386,7 +385,7 @@ void RegisterLiveness::SimulateFusion( [&l1, &l2](Instruction* insn) { BasicBlock* bb = insn->context()->get_instr_block(insn); return insn->HasResultId() && - !(insn->opcode() == SpvOpPhi && + !(insn->opcode() == spv::Op::OpPhi && (bb == l1.GetHeaderBlock() || bb == l2.GetHeaderBlock())); }); @@ -403,7 +402,7 @@ void RegisterLiveness::SimulateFusion( live_inout_info->live_out_.size()); for (Instruction& insn : *bb) { - if (insn.opcode() == SpvOpPhi || !CreatesRegisterUsage(&insn) || + if (insn.opcode() == spv::Op::OpPhi || !CreatesRegisterUsage(&insn) || seen_insn.count(insn.result_id())) { continue; } @@ -434,7 +433,7 @@ void RegisterLiveness::SimulateFusion( live_inout_info->live_out_.size()); for (Instruction& insn : *bb) { - if (insn.opcode() == SpvOpPhi || !CreatesRegisterUsage(&insn) || + if (insn.opcode() == spv::Op::OpPhi || !CreatesRegisterUsage(&insn) || seen_insn.count(insn.result_id())) { continue; } @@ -532,7 +531,7 @@ void RegisterLiveness::SimulateFission( std::unordered_set die_in_block; for (Instruction& insn : make_range(bb->rbegin(), bb->rend())) { - if (insn.opcode() == SpvOpPhi) { + if (insn.opcode() == spv::Op::OpPhi) { break; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/relax_float_ops_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/relax_float_ops_pass.cpp index 3fcf8795..df925a25 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/relax_float_ops_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/relax_float_ops_pass.cpp @@ -25,7 +25,7 @@ bool RelaxFloatOpsPass::IsRelaxable(Instruction* inst) { return target_ops_core_f_rslt_.count(inst->opcode()) != 0 || target_ops_core_f_opnd_.count(inst->opcode()) != 0 || sample_ops_.count(inst->opcode()) != 0 || - (inst->opcode() == SpvOpExtInst && + (inst->opcode() == spv::Op::OpExtInst && inst->GetSingleWordInOperand(0) == context()->get_feature_mgr()->GetExtInstImportId_GLSLstd450() && target_ops_450_.count(inst->GetSingleWordInOperand(1)) != 0); @@ -46,8 +46,9 @@ bool RelaxFloatOpsPass::IsFloat32(Instruction* inst) { bool RelaxFloatOpsPass::IsRelaxed(uint32_t r_id) { for (auto r_inst : get_decoration_mgr()->GetDecorationsFor(r_id, false)) - if (r_inst->opcode() == SpvOpDecorate && - r_inst->GetSingleWordInOperand(1) == SpvDecorationRelaxedPrecision) + if (r_inst->opcode() == spv::Op::OpDecorate && + spv::Decoration(r_inst->GetSingleWordInOperand(1)) == + spv::Decoration::RelaxedPrecision) return true; return false; } @@ -58,7 +59,8 @@ bool RelaxFloatOpsPass::ProcessInst(Instruction* r_inst) { if (!IsFloat32(r_inst)) return false; if (IsRelaxed(r_id)) return false; if (!IsRelaxable(r_inst)) return false; - get_decoration_mgr()->AddDecoration(r_id, SpvDecorationRelaxedPrecision); + get_decoration_mgr()->AddDecoration( + r_id, uint32_t(spv::Decoration::RelaxedPrecision)); return true; } @@ -87,48 +89,48 @@ Pass::Status RelaxFloatOpsPass::Process() { void RelaxFloatOpsPass::Initialize() { target_ops_core_f_rslt_ = { - SpvOpLoad, - SpvOpPhi, - SpvOpVectorExtractDynamic, - SpvOpVectorInsertDynamic, - SpvOpVectorShuffle, - SpvOpCompositeExtract, - SpvOpCompositeConstruct, - SpvOpCompositeInsert, - SpvOpCopyObject, - SpvOpTranspose, - SpvOpConvertSToF, - SpvOpConvertUToF, - SpvOpFConvert, - // SpvOpQuantizeToF16, - SpvOpFNegate, - SpvOpFAdd, - SpvOpFSub, - SpvOpFMul, - SpvOpFDiv, - SpvOpFMod, - SpvOpVectorTimesScalar, - SpvOpMatrixTimesScalar, - SpvOpVectorTimesMatrix, - SpvOpMatrixTimesVector, - SpvOpMatrixTimesMatrix, - SpvOpOuterProduct, - SpvOpDot, - SpvOpSelect, + spv::Op::OpLoad, + spv::Op::OpPhi, + spv::Op::OpVectorExtractDynamic, + spv::Op::OpVectorInsertDynamic, + spv::Op::OpVectorShuffle, + spv::Op::OpCompositeExtract, + spv::Op::OpCompositeConstruct, + spv::Op::OpCompositeInsert, + spv::Op::OpCopyObject, + spv::Op::OpTranspose, + spv::Op::OpConvertSToF, + spv::Op::OpConvertUToF, + spv::Op::OpFConvert, + // spv::Op::OpQuantizeToF16, + spv::Op::OpFNegate, + spv::Op::OpFAdd, + spv::Op::OpFSub, + spv::Op::OpFMul, + spv::Op::OpFDiv, + spv::Op::OpFMod, + spv::Op::OpVectorTimesScalar, + spv::Op::OpMatrixTimesScalar, + spv::Op::OpVectorTimesMatrix, + spv::Op::OpMatrixTimesVector, + spv::Op::OpMatrixTimesMatrix, + spv::Op::OpOuterProduct, + spv::Op::OpDot, + spv::Op::OpSelect, }; target_ops_core_f_opnd_ = { - SpvOpFOrdEqual, - SpvOpFUnordEqual, - SpvOpFOrdNotEqual, - SpvOpFUnordNotEqual, - SpvOpFOrdLessThan, - SpvOpFUnordLessThan, - SpvOpFOrdGreaterThan, - SpvOpFUnordGreaterThan, - SpvOpFOrdLessThanEqual, - SpvOpFUnordLessThanEqual, - SpvOpFOrdGreaterThanEqual, - SpvOpFUnordGreaterThanEqual, + spv::Op::OpFOrdEqual, + spv::Op::OpFUnordEqual, + spv::Op::OpFOrdNotEqual, + spv::Op::OpFUnordNotEqual, + spv::Op::OpFOrdLessThan, + spv::Op::OpFUnordLessThan, + spv::Op::OpFOrdGreaterThan, + spv::Op::OpFUnordGreaterThan, + spv::Op::OpFOrdLessThanEqual, + spv::Op::OpFUnordLessThanEqual, + spv::Op::OpFOrdGreaterThanEqual, + spv::Op::OpFUnordGreaterThanEqual, }; target_ops_450_ = { GLSLstd450Round, GLSLstd450RoundEven, GLSLstd450Trunc, GLSLstd450FAbs, @@ -147,31 +149,31 @@ void RelaxFloatOpsPass::Initialize() { GLSLstd450Ldexp, GLSLstd450Length, GLSLstd450Distance, GLSLstd450Cross, GLSLstd450Normalize, GLSLstd450FaceForward, GLSLstd450Reflect, GLSLstd450Refract, GLSLstd450NMin, GLSLstd450NMax, GLSLstd450NClamp}; - sample_ops_ = {SpvOpImageSampleImplicitLod, - SpvOpImageSampleExplicitLod, - SpvOpImageSampleDrefImplicitLod, - SpvOpImageSampleDrefExplicitLod, - SpvOpImageSampleProjImplicitLod, - SpvOpImageSampleProjExplicitLod, - SpvOpImageSampleProjDrefImplicitLod, - SpvOpImageSampleProjDrefExplicitLod, - SpvOpImageFetch, - SpvOpImageGather, - SpvOpImageDrefGather, - SpvOpImageRead, - SpvOpImageSparseSampleImplicitLod, - SpvOpImageSparseSampleExplicitLod, - SpvOpImageSparseSampleDrefImplicitLod, - SpvOpImageSparseSampleDrefExplicitLod, - SpvOpImageSparseSampleProjImplicitLod, - SpvOpImageSparseSampleProjExplicitLod, - SpvOpImageSparseSampleProjDrefImplicitLod, - SpvOpImageSparseSampleProjDrefExplicitLod, - SpvOpImageSparseFetch, - SpvOpImageSparseGather, - SpvOpImageSparseDrefGather, - SpvOpImageSparseTexelsResident, - SpvOpImageSparseRead}; + sample_ops_ = {spv::Op::OpImageSampleImplicitLod, + spv::Op::OpImageSampleExplicitLod, + spv::Op::OpImageSampleDrefImplicitLod, + spv::Op::OpImageSampleDrefExplicitLod, + spv::Op::OpImageSampleProjImplicitLod, + spv::Op::OpImageSampleProjExplicitLod, + spv::Op::OpImageSampleProjDrefImplicitLod, + spv::Op::OpImageSampleProjDrefExplicitLod, + spv::Op::OpImageFetch, + spv::Op::OpImageGather, + spv::Op::OpImageDrefGather, + spv::Op::OpImageRead, + spv::Op::OpImageSparseSampleImplicitLod, + spv::Op::OpImageSparseSampleExplicitLod, + spv::Op::OpImageSparseSampleDrefImplicitLod, + spv::Op::OpImageSparseSampleDrefExplicitLod, + spv::Op::OpImageSparseSampleProjImplicitLod, + spv::Op::OpImageSparseSampleProjExplicitLod, + spv::Op::OpImageSparseSampleProjDrefImplicitLod, + spv::Op::OpImageSparseSampleProjDrefExplicitLod, + spv::Op::OpImageSparseFetch, + spv::Op::OpImageSparseGather, + spv::Op::OpImageSparseDrefGather, + spv::Op::OpImageSparseTexelsResident, + spv::Op::OpImageSparseRead}; } } // namespace opt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/relax_float_ops_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/relax_float_ops_pass.h index 5ee3d73c..9e4606f8 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/relax_float_ops_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/relax_float_ops_pass.h @@ -61,17 +61,23 @@ class RelaxFloatOpsPass : public Pass { // Initialize state for converting to half void Initialize(); + struct hasher { + size_t operator()(const spv::Op& op) const noexcept { + return std::hash()(uint32_t(op)); + } + }; + // Set of float result core operations to be processed - std::unordered_set target_ops_core_f_rslt_; + std::unordered_set target_ops_core_f_rslt_; // Set of float operand core operations to be processed - std::unordered_set target_ops_core_f_opnd_; + std::unordered_set target_ops_core_f_opnd_; // Set of 450 extension operations to be processed std::unordered_set target_ops_450_; // Set of sample operations - std::unordered_set sample_ops_; + std::unordered_set sample_ops_; }; } // namespace opt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/remove_dontinline_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/remove_dontinline_pass.cpp index 4dd1cd4f..3750bc1f 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/remove_dontinline_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/remove_dontinline_pass.cpp @@ -37,10 +37,11 @@ bool RemoveDontInline::ClearDontInlineFunctionControl(Function* function) { uint32_t function_control = function_inst->GetSingleWordInOperand(kFunctionControlInOperandIdx); - if ((function_control & SpvFunctionControlDontInlineMask) == 0) { + if ((function_control & uint32_t(spv::FunctionControlMask::DontInline)) == + 0) { return false; } - function_control &= ~SpvFunctionControlDontInlineMask; + function_control &= ~uint32_t(spv::FunctionControlMask::DontInline); function_inst->SetInOperand(kFunctionControlInOperandIdx, {function_control}); return true; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/remove_duplicates_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/remove_duplicates_pass.cpp index 1ed8e2a0..0df559b3 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/remove_duplicates_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/remove_duplicates_pass.cpp @@ -15,8 +15,6 @@ #include "source/opt/remove_duplicates_pass.h" #include -#include -#include #include #include #include @@ -25,7 +23,6 @@ #include "source/opcode.h" #include "source/opt/decoration_manager.h" #include "source/opt/ir_context.h" -#include "source/opt/reflect.h" namespace spvtools { namespace opt { @@ -70,7 +67,7 @@ bool RemoveDuplicatesPass::RemoveDuplicatesExtInstImports() const { return modified; } - std::unordered_map ext_inst_imports; + std::unordered_map ext_inst_imports; for (auto* i = &*context()->ext_inst_import_begin(); i;) { auto res = ext_inst_imports.emplace(i->GetInOperand(0u).AsString(), i->result_id()); @@ -101,7 +98,8 @@ bool RemoveDuplicatesPass::RemoveDuplicateTypes() const { std::vector visited_forward_pointers; std::vector to_delete; for (auto* i = &*context()->types_values_begin(); i; i = i->NextNode()) { - const bool is_i_forward_pointer = i->opcode() == SpvOpTypeForwardPointer; + const bool is_i_forward_pointer = + i->opcode() == spv::Op::OpTypeForwardPointer; // We only care about types. if (!spvOpcodeGeneratesType(i->opcode()) && !is_i_forward_pointer) { @@ -110,7 +108,7 @@ bool RemoveDuplicatesPass::RemoveDuplicateTypes() const { if (!is_i_forward_pointer) { // Is the current type equal to one of the types we have already visited? - SpvId id_to_keep = 0u; + spv::Id id_to_keep = 0u; analysis::Type* i_type = type_manager.GetType(i->result_id()); assert(i_type); // TODO(dneto0): Use a trie to avoid quadratic behaviour? Extract the @@ -137,7 +135,7 @@ bool RemoveDuplicatesPass::RemoveDuplicateTypes() const { } else { analysis::ForwardPointer i_type( i->GetSingleWordInOperand(0u), - (SpvStorageClass)i->GetSingleWordInOperand(1u)); + (spv::StorageClass)i->GetSingleWordInOperand(1u)); i_type.SetTargetPointer( type_manager.GetType(i_type.target_id())->AsPointer()); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/remove_unused_interface_variables_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/remove_unused_interface_variables_pass.cpp index 31e87bd4..d4df1b2e 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/remove_unused_interface_variables_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/remove_unused_interface_variables_pass.cpp @@ -31,13 +31,14 @@ class RemoveUnusedInterfaceVariablesContext { instruction.ForEachInId([&](const uint32_t* id) { if (used_variables_.count(*id)) return; auto* var = parent_.get_def_use_mgr()->GetDef(*id); - if (!var || var->opcode() != SpvOpVariable) return; - auto storage_class = var->GetSingleWordInOperand(0); - if (storage_class != SpvStorageClassFunction && + if (!var || var->opcode() != spv::Op::OpVariable) return; + auto storage_class = + spv::StorageClass(var->GetSingleWordInOperand(0)); + if (storage_class != spv::StorageClass::Function && (parent_.get_module()->version() >= SPV_SPIRV_VERSION_WORD(1, 4) || - storage_class == SpvStorageClassInput || - storage_class == SpvStorageClassOutput)) + storage_class == spv::StorageClass::Input || + storage_class == spv::StorageClass::Output)) used_variables_.insert(*id); }); return false; @@ -90,4 +91,4 @@ RemoveUnusedInterfaceVariablesPass::Process() { return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); } } // namespace opt -} // namespace spvtools \ No newline at end of file +} // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/remove_unused_interface_variables_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/remove_unused_interface_variables_pass.h index 7f11187c..a4cb1085 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/remove_unused_interface_variables_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/remove_unused_interface_variables_pass.h @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#ifndef SOURCE_OPT_REMOVE_UNUSED_INTERFACE_VARIABLES_PASS_H_ +#define SOURCE_OPT_REMOVE_UNUSED_INTERFACE_VARIABLES_PASS_H_ + #include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -23,4 +26,6 @@ class RemoveUnusedInterfaceVariablesPass : public Pass { Status Process() override; }; } // namespace opt -} // namespace spvtools \ No newline at end of file +} // namespace spvtools + +#endif // SOURCE_OPT_REMOVE_UNUSED_INTERFACE_VARIABLES_PASS_H_ \ No newline at end of file diff --git a/bgfx/3rdparty/spirv-tools/source/opt/replace_desc_array_access_using_var_index.cpp b/bgfx/3rdparty/spirv-tools/source/opt/replace_desc_array_access_using_var_index.cpp index e97593ef..59745e12 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/replace_desc_array_access_using_var_index.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/replace_desc_array_access_using_var_index.cpp @@ -21,11 +21,10 @@ namespace spvtools { namespace opt { namespace { - -const uint32_t kOpAccessChainInOperandIndexes = 1; -const uint32_t kOpTypePointerInOperandType = 1; -const uint32_t kOpTypeArrayInOperandType = 0; -const uint32_t kOpTypeStructInOperandMember = 0; +constexpr uint32_t kOpAccessChainInOperandIndexes = 1; +constexpr uint32_t kOpTypePointerInOperandType = 1; +constexpr uint32_t kOpTypeArrayInOperandType = 0; +constexpr uint32_t kOpTypeStructInOperandMember = 0; IRContext::Analysis kAnalysisDefUseAndInstrToBlockMapping = IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping; @@ -54,8 +53,8 @@ bool ReplaceDescArrayAccessUsingVarIndex:: std::vector work_list; get_def_use_mgr()->ForEachUser(var, [&work_list](Instruction* use) { switch (use->opcode()) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: work_list.push_back(use); break; default: @@ -132,8 +131,8 @@ ReplaceDescArrayAccessUsingVarIndex::CollectRequiredImageAndAccessInsts( Instruction* operand = get_def_use_mgr()->GetDef(*idp); if (context()->get_instr_block(operand) != nullptr && (HasImageOrImagePtrType(operand) || - operand->opcode() == SpvOpAccessChain || - operand->opcode() == SpvOpInBoundsAccessChain)) { + operand->opcode() == spv::Op::OpAccessChain || + operand->opcode() == spv::Op::OpInBoundsAccessChain)) { work_list.push(operand); } }; @@ -158,22 +157,22 @@ bool ReplaceDescArrayAccessUsingVarIndex::HasImageOrImagePtrType( bool ReplaceDescArrayAccessUsingVarIndex::IsImageOrImagePtrType( const Instruction* type_inst) const { - if (type_inst->opcode() == SpvOpTypeImage || - type_inst->opcode() == SpvOpTypeSampler || - type_inst->opcode() == SpvOpTypeSampledImage) { + if (type_inst->opcode() == spv::Op::OpTypeImage || + type_inst->opcode() == spv::Op::OpTypeSampler || + type_inst->opcode() == spv::Op::OpTypeSampledImage) { return true; } - if (type_inst->opcode() == SpvOpTypePointer) { + if (type_inst->opcode() == spv::Op::OpTypePointer) { Instruction* pointee_type_inst = get_def_use_mgr()->GetDef( type_inst->GetSingleWordInOperand(kOpTypePointerInOperandType)); return IsImageOrImagePtrType(pointee_type_inst); } - if (type_inst->opcode() == SpvOpTypeArray) { + if (type_inst->opcode() == spv::Op::OpTypeArray) { Instruction* element_type_inst = get_def_use_mgr()->GetDef( type_inst->GetSingleWordInOperand(kOpTypeArrayInOperandType)); return IsImageOrImagePtrType(element_type_inst); } - if (type_inst->opcode() != SpvOpTypeStruct) return false; + if (type_inst->opcode() != spv::Op::OpTypeStruct) return false; for (uint32_t in_operand_idx = kOpTypeStructInOperandMember; in_operand_idx < type_inst->NumInOperands(); ++in_operand_idx) { Instruction* member_type_inst = get_def_use_mgr()->GetDef( @@ -186,16 +185,16 @@ bool ReplaceDescArrayAccessUsingVarIndex::IsImageOrImagePtrType( bool ReplaceDescArrayAccessUsingVarIndex::IsConcreteType( uint32_t type_id) const { Instruction* type_inst = get_def_use_mgr()->GetDef(type_id); - if (type_inst->opcode() == SpvOpTypeInt || - type_inst->opcode() == SpvOpTypeFloat) { + if (type_inst->opcode() == spv::Op::OpTypeInt || + type_inst->opcode() == spv::Op::OpTypeFloat) { return true; } - if (type_inst->opcode() == SpvOpTypeVector || - type_inst->opcode() == SpvOpTypeMatrix || - type_inst->opcode() == SpvOpTypeArray) { + if (type_inst->opcode() == spv::Op::OpTypeVector || + type_inst->opcode() == spv::Op::OpTypeMatrix || + type_inst->opcode() == spv::Op::OpTypeArray) { return IsConcreteType(type_inst->GetSingleWordInOperand(0)); } - if (type_inst->opcode() == SpvOpTypeStruct) { + if (type_inst->opcode() == spv::Op::OpTypeStruct) { for (uint32_t i = 0; i < type_inst->NumInOperands(); ++i) { if (!IsConcreteType(type_inst->GetSingleWordInOperand(i))) return false; } @@ -322,8 +321,8 @@ ReplaceDescArrayAccessUsingVarIndex::SeparateInstructionsIntoNewBlock( } BasicBlock* ReplaceDescArrayAccessUsingVarIndex::CreateNewBlock() const { - auto* new_block = new BasicBlock(std::unique_ptr( - new Instruction(context(), SpvOpLabel, 0, context()->TakeNextId(), {}))); + auto* new_block = new BasicBlock(std::unique_ptr(new Instruction( + context(), spv::Op::OpLabel, 0, context()->TakeNextId(), {}))); get_def_use_mgr()->AnalyzeInstDefUse(new_block->GetLabelInst()); context()->set_instr_block(new_block->GetLabelInst(), new_block); return new_block; @@ -332,7 +331,7 @@ BasicBlock* ReplaceDescArrayAccessUsingVarIndex::CreateNewBlock() const { void ReplaceDescArrayAccessUsingVarIndex::UseConstIndexForAccessChain( Instruction* access_chain, uint32_t const_element_idx) const { uint32_t const_element_idx_id = - context()->get_constant_mgr()->GetUIntConst(const_element_idx); + context()->get_constant_mgr()->GetUIntConstId(const_element_idx); access_chain->SetInOperand(kOpAccessChainInOperandIndexes, {const_element_idx_id}); } @@ -422,7 +421,7 @@ void ReplaceDescArrayAccessUsingVarIndex::ReplacePhiIncomingBlock( uint32_t old_incoming_block_id, uint32_t new_incoming_block_id) const { context()->ReplaceAllUsesWithPredicate( old_incoming_block_id, new_incoming_block_id, - [](Instruction* use) { return use->opcode() == SpvOpPhi; }); + [](Instruction* use) { return use->opcode() == spv::Op::OpPhi; }); } } // namespace opt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.cpp b/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.cpp index 1dcd06f5..1b97c0e8 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.cpp @@ -23,16 +23,16 @@ namespace opt { Pass::Status ReplaceInvalidOpcodePass::Process() { bool modified = false; - if (context()->get_feature_mgr()->HasCapability(SpvCapabilityLinkage)) { + if (context()->get_feature_mgr()->HasCapability(spv::Capability::Linkage)) { return Status::SuccessWithoutChange; } - SpvExecutionModel execution_model = GetExecutionModel(); - if (execution_model == SpvExecutionModelKernel) { + spv::ExecutionModel execution_model = GetExecutionModel(); + if (execution_model == spv::ExecutionModel::Kernel) { // We do not handle kernels. return Status::SuccessWithoutChange; } - if (execution_model == SpvExecutionModelMax) { + if (execution_model == spv::ExecutionModel::Max) { // Mixed execution models for the entry points. This case is not currently // handled. return Status::SuccessWithoutChange; @@ -44,19 +44,19 @@ Pass::Status ReplaceInvalidOpcodePass::Process() { return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); } -SpvExecutionModel ReplaceInvalidOpcodePass::GetExecutionModel() { - SpvExecutionModel result = SpvExecutionModelMax; +spv::ExecutionModel ReplaceInvalidOpcodePass::GetExecutionModel() { + spv::ExecutionModel result = spv::ExecutionModel::Max; bool first = true; for (Instruction& entry_point : get_module()->entry_points()) { if (first) { - result = - static_cast(entry_point.GetSingleWordInOperand(0)); + result = static_cast( + entry_point.GetSingleWordInOperand(0)); first = false; } else { - SpvExecutionModel current_model = - static_cast(entry_point.GetSingleWordInOperand(0)); + spv::ExecutionModel current_model = static_cast( + entry_point.GetSingleWordInOperand(0)); if (current_model != result) { - result = SpvExecutionModelMax; + result = spv::ExecutionModel::Max; break; } } @@ -65,13 +65,13 @@ SpvExecutionModel ReplaceInvalidOpcodePass::GetExecutionModel() { } bool ReplaceInvalidOpcodePass::RewriteFunction(Function* function, - SpvExecutionModel model) { + spv::ExecutionModel model) { bool modified = false; Instruction* last_line_dbg_inst = nullptr; function->ForEachInst( [model, &modified, &last_line_dbg_inst, this](Instruction* inst) { // Track the debug information so we can have a meaningful message. - if (inst->opcode() == SpvOpLabel || inst->IsNoLine()) { + if (inst->opcode() == spv::Op::OpLabel || inst->IsNoLine()) { last_line_dbg_inst = nullptr; return; } else if (inst->IsLine()) { @@ -80,15 +80,16 @@ bool ReplaceInvalidOpcodePass::RewriteFunction(Function* function, } bool replace = false; - if (model != SpvExecutionModelFragment && + if (model != spv::ExecutionModel::Fragment && IsFragmentShaderOnlyInstruction(inst)) { replace = true; } - if (model != SpvExecutionModelTessellationControl && - model != SpvExecutionModelGLCompute) { - if (inst->opcode() == SpvOpControlBarrier) { - assert(model != SpvExecutionModelKernel && + if (model != spv::ExecutionModel::TessellationControl && + model != spv::ExecutionModel::GLCompute && + !context()->IsTargetEnvAtLeast(SPV_ENV_UNIVERSAL_1_3)) { + if (inst->opcode() == spv::Op::OpControlBarrier) { + assert(model != spv::ExecutionModel::Kernel && "Expecting to be working on a shader module."); replace = true; } @@ -101,7 +102,7 @@ bool ReplaceInvalidOpcodePass::RewriteFunction(Function* function, } else { // Get the name of the source file. uint32_t file_name_id = 0; - if (last_line_dbg_inst->opcode() == SpvOpLine) { + if (last_line_dbg_inst->opcode() == spv::Op::OpLine) { file_name_id = last_line_dbg_inst->GetSingleWordInOperand(0); } else { // Shader100::DebugLine uint32_t debug_source_id = @@ -131,26 +132,26 @@ bool ReplaceInvalidOpcodePass::RewriteFunction(Function* function, bool ReplaceInvalidOpcodePass::IsFragmentShaderOnlyInstruction( Instruction* inst) { switch (inst->opcode()) { - case SpvOpDPdx: - case SpvOpDPdy: - case SpvOpFwidth: - case SpvOpDPdxFine: - case SpvOpDPdyFine: - case SpvOpFwidthFine: - case SpvOpDPdxCoarse: - case SpvOpDPdyCoarse: - case SpvOpFwidthCoarse: - case SpvOpImageSampleImplicitLod: - case SpvOpImageSampleDrefImplicitLod: - case SpvOpImageSampleProjImplicitLod: - case SpvOpImageSampleProjDrefImplicitLod: - case SpvOpImageSparseSampleImplicitLod: - case SpvOpImageSparseSampleDrefImplicitLod: - case SpvOpImageQueryLod: + case spv::Op::OpDPdx: + case spv::Op::OpDPdy: + case spv::Op::OpFwidth: + case spv::Op::OpDPdxFine: + case spv::Op::OpDPdyFine: + case spv::Op::OpFwidthFine: + case spv::Op::OpDPdxCoarse: + case spv::Op::OpDPdyCoarse: + case spv::Op::OpFwidthCoarse: + case spv::Op::OpImageSampleImplicitLod: + case spv::Op::OpImageSampleDrefImplicitLod: + case spv::Op::OpImageSampleProjImplicitLod: + case spv::Op::OpImageSampleProjDrefImplicitLod: + case spv::Op::OpImageSparseSampleImplicitLod: + case spv::Op::OpImageSparseSampleDrefImplicitLod: + case spv::Op::OpImageQueryLod: // TODO: Teach |ReplaceInstruction| to handle block terminators. Then // uncomment the OpKill case. - // case SpvOpKill: - // case SpvOpTerminateInstruction: + // case spv::Op::OpKill: + // case spv::Op::OpTerminateInstruction: return true; default: return false; @@ -183,7 +184,7 @@ uint32_t ReplaceInvalidOpcodePass::GetSpecialConstant(uint32_t type_id) { analysis::TypeManager* type_mgr = context()->get_type_mgr(); Instruction* type = context()->get_def_use_mgr()->GetDef(type_id); - if (type->opcode() == SpvOpTypeVector) { + if (type->opcode() == spv::Op::OpTypeVector) { uint32_t component_const = GetSpecialConstant(type->GetSingleWordInOperand(0)); std::vector ids; @@ -192,7 +193,8 @@ uint32_t ReplaceInvalidOpcodePass::GetSpecialConstant(uint32_t type_id) { } special_const = const_mgr->GetConstant(type_mgr->GetType(type_id), ids); } else { - assert(type->opcode() == SpvOpTypeInt || type->opcode() == SpvOpTypeFloat); + assert(type->opcode() == spv::Op::OpTypeInt || + type->opcode() == spv::Op::OpTypeFloat); std::vector literal_words; for (uint32_t i = 0; i < type->GetSingleWordInOperand(0); i += 32) { literal_words.push_back(0xDEADBEEF); @@ -204,7 +206,7 @@ uint32_t ReplaceInvalidOpcodePass::GetSpecialConstant(uint32_t type_id) { return const_mgr->GetDefiningInstruction(special_const)->result_id(); } -std::string ReplaceInvalidOpcodePass::BuildWarningMessage(SpvOp opcode) { +std::string ReplaceInvalidOpcodePass::BuildWarningMessage(spv::Op opcode) { spv_opcode_desc opcode_info; context()->grammar().lookupOpcode(opcode, &opcode_info); std::string message = "Removing "; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.h b/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.h index 426bcac5..3f0d16bb 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.h @@ -34,13 +34,13 @@ class ReplaceInvalidOpcodePass : public Pass { private: // Returns the execution model that is used by every entry point in the // module. If more than one execution model is used in the module, then the - // return value is SpvExecutionModelMax. - SpvExecutionModel GetExecutionModel(); + // return value is spv::ExecutionModel::Max. + spv::ExecutionModel GetExecutionModel(); // Replaces all instructions in |function| that are invalid with execution // model |mode|, but valid for another shader model, with a special constant // value. See |GetSpecialConstant|. - bool RewriteFunction(Function* function, SpvExecutionModel mode); + bool RewriteFunction(Function* function, spv::ExecutionModel mode); // Returns true if |inst| is valid for fragment shaders only. bool IsFragmentShaderOnlyInstruction(Instruction* inst); @@ -58,7 +58,7 @@ class ReplaceInvalidOpcodePass : public Pass { // width of the type has been reached. For a vector, each element of the // constant will be constructed the same way. uint32_t GetSpecialConstant(uint32_t type_id); - std::string BuildWarningMessage(SpvOp opcode); + std::string BuildWarningMessage(spv::Op opcode); }; } // namespace opt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis.cpp b/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis.cpp index 2b0a824c..26cc8b30 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis.cpp @@ -14,7 +14,6 @@ #include "source/opt/scalar_analysis.h" -#include #include #include #include @@ -97,7 +96,7 @@ SENode* ScalarEvolutionAnalysis::CreateRecurrentExpression( SENode* ScalarEvolutionAnalysis::AnalyzeMultiplyOp( const Instruction* multiply) { - assert(multiply->opcode() == SpvOp::SpvOpIMul && + assert(multiply->opcode() == spv::Op::OpIMul && "Multiply node did not come from a multiply instruction"); analysis::DefUseManager* def_use = context_->get_def_use_mgr(); @@ -168,21 +167,21 @@ SENode* ScalarEvolutionAnalysis::AnalyzeInstruction(const Instruction* inst) { SENode* output = nullptr; switch (inst->opcode()) { - case SpvOp::SpvOpPhi: { + case spv::Op::OpPhi: { output = AnalyzePhiInstruction(inst); break; } - case SpvOp::SpvOpConstant: - case SpvOp::SpvOpConstantNull: { + case spv::Op::OpConstant: + case spv::Op::OpConstantNull: { output = AnalyzeConstant(inst); break; } - case SpvOp::SpvOpISub: - case SpvOp::SpvOpIAdd: { + case spv::Op::OpISub: + case spv::Op::OpIAdd: { output = AnalyzeAddOp(inst); break; } - case SpvOp::SpvOpIMul: { + case spv::Op::OpIMul: { output = AnalyzeMultiplyOp(inst); break; } @@ -196,9 +195,9 @@ SENode* ScalarEvolutionAnalysis::AnalyzeInstruction(const Instruction* inst) { } SENode* ScalarEvolutionAnalysis::AnalyzeConstant(const Instruction* inst) { - if (inst->opcode() == SpvOp::SpvOpConstantNull) return CreateConstant(0); + if (inst->opcode() == spv::Op::OpConstantNull) return CreateConstant(0); - assert(inst->opcode() == SpvOp::SpvOpConstant); + assert(inst->opcode() == spv::Op::OpConstant); assert(inst->NumInOperands() == 1); int64_t value = 0; @@ -226,8 +225,8 @@ SENode* ScalarEvolutionAnalysis::AnalyzeConstant(const Instruction* inst) { // Handles both addition and subtraction. If the |sub| flag is set then the // addition will be op1+(-op2) otherwise op1+op2. SENode* ScalarEvolutionAnalysis::AnalyzeAddOp(const Instruction* inst) { - assert((inst->opcode() == SpvOp::SpvOpIAdd || - inst->opcode() == SpvOp::SpvOpISub) && + assert((inst->opcode() == spv::Op::OpIAdd || + inst->opcode() == spv::Op::OpISub) && "Add node must be created from a OpIAdd or OpISub instruction"); analysis::DefUseManager* def_use = context_->get_def_use_mgr(); @@ -239,7 +238,7 @@ SENode* ScalarEvolutionAnalysis::AnalyzeAddOp(const Instruction* inst) { AnalyzeInstruction(def_use->GetDef(inst->GetSingleWordInOperand(1))); // To handle subtraction we wrap the second operand in a unary negation node. - if (inst->opcode() == SpvOp::SpvOpISub) { + if (inst->opcode() == spv::Op::OpISub) { op2 = CreateNegation(op2); } @@ -573,7 +572,7 @@ struct PushToStringImpl { }; template -static void PushToString(T id, std::u32string* str) { +void PushToString(T id, std::u32string* str) { PushToStringImpl{}(id, str); } @@ -928,8 +927,8 @@ namespace { // Remove |node| from the |mul| chain (of the form A * ... * |node| * ... * Z), // if |node| is not in the chain, returns the original chain. -static SENode* RemoveOneNodeFromMultiplyChain(SEMultiplyNode* mul, - const SENode* node) { +SENode* RemoveOneNodeFromMultiplyChain(SEMultiplyNode* mul, + const SENode* node) { SENode* lhs = mul->GetChildren()[0]; SENode* rhs = mul->GetChildren()[1]; if (lhs == node) { diff --git a/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp b/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp index 3c1ecc08..3c0947cd 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp @@ -12,16 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/opt/scalar_analysis.h" - #include #include #include #include -#include #include #include +#include "source/opt/scalar_analysis.h" + // Simplifies scalar analysis DAGs. // // 1. Given a node passed to SimplifyExpression we first simplify the graph by diff --git a/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.cpp index e27c828b..38c8aecc 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.cpp @@ -19,19 +19,18 @@ #include #include -#include "source/enum_string_mapping.h" #include "source/extensions.h" #include "source/opt/reflect.h" #include "source/opt/types.h" #include "source/util/make_unique.h" -#include "types.h" - -static const uint32_t kDebugValueOperandValueIndex = 5; -static const uint32_t kDebugValueOperandExpressionIndex = 6; -static const uint32_t kDebugDeclareOperandVariableIndex = 5; namespace spvtools { namespace opt { +namespace { +constexpr uint32_t kDebugValueOperandValueIndex = 5; +constexpr uint32_t kDebugValueOperandExpressionIndex = 6; +constexpr uint32_t kDebugDeclareOperandVariableIndex = 5; +} // namespace Pass::Status ScalarReplacementPass::Process() { Status status = Status::SuccessWithoutChange; @@ -56,7 +55,7 @@ Pass::Status ScalarReplacementPass::ProcessFunction(Function* function) { for (auto iter = entry.begin(); iter != entry.end(); ++iter) { // Function storage class OpVariables must appear as the first instructions // of the entry block. - if (iter->opcode() != SpvOpVariable) break; + if (iter->opcode() != spv::Op::OpVariable) break; Instruction* varInst = &*iter; if (CanReplaceVariable(varInst)) { @@ -105,29 +104,29 @@ Pass::Status ScalarReplacementPass::ReplaceVariable( } if (!IsAnnotationInst(user->opcode())) { switch (user->opcode()) { - case SpvOpLoad: + case spv::Op::OpLoad: if (ReplaceWholeLoad(user, replacements)) { dead.push_back(user); } else { return false; } break; - case SpvOpStore: + case spv::Op::OpStore: if (ReplaceWholeStore(user, replacements)) { dead.push_back(user); } else { return false; } break; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: if (ReplaceAccessChain(user, replacements)) dead.push_back(user); else return false; break; - case SpvOpName: - case SpvOpMemberName: + case spv::Op::OpName: + case spv::Op::OpMemberName: break; default: assert(false && "Unexpected opcode"); @@ -155,7 +154,7 @@ Pass::Status ScalarReplacementPass::ReplaceVariable( // Attempt to further scalarize. for (auto var : replacements) { - if (var->opcode() == SpvOpVariable) { + if (var->opcode() == spv::Op::OpVariable) { if (get_def_use_mgr()->NumUsers(var) == 0) { context()->KillInst(var); } else if (CanReplaceVariable(var)) { @@ -179,7 +178,7 @@ bool ScalarReplacementPass::ReplaceWholeDebugDeclare( int32_t idx = 0; for (const auto* var : replacements) { Instruction* insert_before = var->NextNode(); - while (insert_before->opcode() == SpvOpVariable) + while (insert_before->opcode() == spv::Op::OpVariable) insert_before = insert_before->NextNode(); assert(insert_before != nullptr && "unexpected end of list"); Instruction* added_dbg_value = @@ -190,7 +189,7 @@ bool ScalarReplacementPass::ReplaceWholeDebugDeclare( if (added_dbg_value == nullptr) return false; added_dbg_value->AddOperand( {SPV_OPERAND_TYPE_ID, - {context()->get_constant_mgr()->GetSIntConst(idx)}}); + {context()->get_constant_mgr()->GetSIntConstId(idx)}}); added_dbg_value->SetOperand(kDebugValueOperandExpressionIndex, {deref_expr->result_id()}); if (context()->AreAnalysesValid(IRContext::Analysis::kAnalysisDefUse)) { @@ -216,7 +215,7 @@ bool ScalarReplacementPass::ReplaceWholeDebugValue( // Append 'Indexes' operand. new_dbg_value->AddOperand( {SPV_OPERAND_TYPE_ID, - {context()->get_constant_mgr()->GetSIntConst(idx)}}); + {context()->get_constant_mgr()->GetSIntConstId(idx)}}); // Insert the new DebugValue to the basic block. auto* added_instr = dbg_value->InsertBefore(std::move(new_dbg_value)); get_def_use_mgr()->AnalyzeInstDefUse(added_instr); @@ -236,7 +235,7 @@ bool ScalarReplacementPass::ReplaceWholeLoad( BasicBlock::iterator where(load); for (auto var : replacements) { // Create a load of each replacement variable. - if (var->opcode() != SpvOpVariable) { + if (var->opcode() != spv::Op::OpVariable) { loads.push_back(var); continue; } @@ -247,7 +246,7 @@ bool ScalarReplacementPass::ReplaceWholeLoad( return false; } std::unique_ptr newLoad( - new Instruction(context(), SpvOpLoad, type->result_id(), loadId, + new Instruction(context(), spv::Op::OpLoad, type->result_id(), loadId, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {var->result_id()}}})); // Copy memory access attributes which start at index 1. Index 0 is the @@ -269,8 +268,9 @@ bool ScalarReplacementPass::ReplaceWholeLoad( return false; } where = load; - std::unique_ptr compositeConstruct(new Instruction( - context(), SpvOpCompositeConstruct, load->type_id(), compositeId, {})); + std::unique_ptr compositeConstruct( + new Instruction(context(), spv::Op::OpCompositeConstruct, load->type_id(), + compositeId, {})); for (auto l : loads) { Operand op(SPV_OPERAND_TYPE_ID, std::initializer_list{l->result_id()}); @@ -294,7 +294,7 @@ bool ScalarReplacementPass::ReplaceWholeStore( uint32_t elementIndex = 0; for (auto var : replacements) { // Create the extract. - if (var->opcode() != SpvOpVariable) { + if (var->opcode() != spv::Op::OpVariable) { elementIndex++; continue; } @@ -305,7 +305,7 @@ bool ScalarReplacementPass::ReplaceWholeStore( return false; } std::unique_ptr extract(new Instruction( - context(), SpvOpCompositeExtract, type->result_id(), extractId, + context(), spv::Op::OpCompositeExtract, type->result_id(), extractId, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {storeInput}}, {SPV_OPERAND_TYPE_LITERAL_INTEGER, {elementIndex++}}})); @@ -316,7 +316,7 @@ bool ScalarReplacementPass::ReplaceWholeStore( // Create the store. std::unique_ptr newStore( - new Instruction(context(), SpvOpStore, 0, 0, + new Instruction(context(), spv::Op::OpStore, 0, 0, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {var->result_id()}}, {SPV_OPERAND_TYPE_ID, {extractId}}})); @@ -390,7 +390,7 @@ bool ScalarReplacementPass::CreateReplacementVariables( uint32_t elem = 0; switch (type->opcode()) { - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: type->ForEachInOperand( [this, inst, &elem, replacements, &components_used](uint32_t* id) { if (!components_used || components_used->count(elem)) { @@ -401,7 +401,7 @@ bool ScalarReplacementPass::CreateReplacementVariables( elem++; }); break; - case SpvOpTypeArray: + case spv::Op::OpTypeArray: for (uint32_t i = 0; i != GetArrayLength(type); ++i) { if (!components_used || components_used->count(i)) { CreateVariable(type->GetSingleWordInOperand(0u), inst, i, @@ -413,8 +413,8 @@ bool ScalarReplacementPass::CreateReplacementVariables( } break; - case SpvOpTypeMatrix: - case SpvOpTypeVector: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeVector: for (uint32_t i = 0; i != GetNumElements(type); ++i) { CreateVariable(type->GetSingleWordInOperand(0u), inst, i, replacements); } @@ -440,20 +440,20 @@ void ScalarReplacementPass::TransferAnnotations( // no type or member decorations that are necessary to transfer. for (auto inst : get_decoration_mgr()->GetDecorationsFor(source->result_id(), false)) { - assert(inst->opcode() == SpvOpDecorate); - uint32_t decoration = inst->GetSingleWordInOperand(1u); - if (decoration == SpvDecorationInvariant || - decoration == SpvDecorationRestrict) { + assert(inst->opcode() == spv::Op::OpDecorate); + auto decoration = spv::Decoration(inst->GetSingleWordInOperand(1u)); + if (decoration == spv::Decoration::Invariant || + decoration == spv::Decoration::Restrict) { for (auto var : *replacements) { if (var == nullptr) { continue; } - std::unique_ptr annotation( - new Instruction(context(), SpvOpDecorate, 0, 0, - std::initializer_list{ - {SPV_OPERAND_TYPE_ID, {var->result_id()}}, - {SPV_OPERAND_TYPE_DECORATION, {decoration}}})); + std::unique_ptr annotation(new Instruction( + context(), spv::Op::OpDecorate, 0, 0, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {var->result_id()}}, + {SPV_OPERAND_TYPE_DECORATION, {uint32_t(decoration)}}})); for (uint32_t i = 2; i < inst->NumInOperands(); ++i) { Operand copy(inst->GetInOperand(i)); annotation->AddOperand(std::move(copy)); @@ -466,60 +466,32 @@ void ScalarReplacementPass::TransferAnnotations( } void ScalarReplacementPass::CreateVariable( - uint32_t typeId, Instruction* varInst, uint32_t index, + uint32_t type_id, Instruction* var_inst, uint32_t index, std::vector* replacements) { - uint32_t ptrId = GetOrCreatePointerType(typeId); + uint32_t ptr_id = GetOrCreatePointerType(type_id); uint32_t id = TakeNextId(); if (id == 0) { replacements->push_back(nullptr); } - std::unique_ptr variable(new Instruction( - context(), SpvOpVariable, ptrId, id, - std::initializer_list{ - {SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}})); + std::unique_ptr variable( + new Instruction(context(), spv::Op::OpVariable, ptr_id, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_STORAGE_CLASS, + {uint32_t(spv::StorageClass::Function)}}})); - BasicBlock* block = context()->get_instr_block(varInst); + BasicBlock* block = context()->get_instr_block(var_inst); block->begin().InsertBefore(std::move(variable)); Instruction* inst = &*block->begin(); // If varInst was initialized, make sure to initialize its replacement. - GetOrCreateInitialValue(varInst, index, inst); + GetOrCreateInitialValue(var_inst, index, inst); get_def_use_mgr()->AnalyzeInstDefUse(inst); context()->set_instr_block(inst, block); - // Copy decorations from the member to the new variable. - Instruction* typeInst = GetStorageType(varInst); - for (auto dec_inst : - get_decoration_mgr()->GetDecorationsFor(typeInst->result_id(), false)) { - uint32_t decoration; - if (dec_inst->opcode() != SpvOpMemberDecorate) { - continue; - } - - if (dec_inst->GetSingleWordInOperand(1) != index) { - continue; - } - - decoration = dec_inst->GetSingleWordInOperand(2u); - switch (decoration) { - case SpvDecorationRelaxedPrecision: { - std::unique_ptr new_dec_inst( - new Instruction(context(), SpvOpDecorate, 0, 0, {})); - new_dec_inst->AddOperand(Operand(SPV_OPERAND_TYPE_ID, {id})); - for (uint32_t i = 2; i < dec_inst->NumInOperandWords(); ++i) { - new_dec_inst->AddOperand(Operand(dec_inst->GetInOperand(i))); - } - context()->AddAnnotationInst(std::move(new_dec_inst)); - } break; - default: - break; - } - } - - // Update the DebugInfo debug information. - inst->UpdateDebugInfoFrom(varInst); + CopyDecorationsToVariable(var_inst, inst, index); + inst->UpdateDebugInfoFrom(var_inst); replacements->push_back(inst); } @@ -528,57 +500,17 @@ uint32_t ScalarReplacementPass::GetOrCreatePointerType(uint32_t id) { auto iter = pointee_to_pointer_.find(id); if (iter != pointee_to_pointer_.end()) return iter->second; - analysis::Type* pointeeTy; - std::unique_ptr pointerTy; - std::tie(pointeeTy, pointerTy) = - context()->get_type_mgr()->GetTypeAndPointerType(id, - SpvStorageClassFunction); - uint32_t ptrId = 0; - if (pointeeTy->IsUniqueType()) { - // Non-ambiguous type, just ask the type manager for an id. - ptrId = context()->get_type_mgr()->GetTypeInstruction(pointerTy.get()); - pointee_to_pointer_[id] = ptrId; - return ptrId; - } - - // Ambiguous type. We must perform a linear search to try and find the right - // type. - for (auto global : context()->types_values()) { - if (global.opcode() == SpvOpTypePointer && - global.GetSingleWordInOperand(0u) == SpvStorageClassFunction && - global.GetSingleWordInOperand(1u) == id) { - if (get_decoration_mgr()->GetDecorationsFor(id, false).empty()) { - // Only reuse a decoration-less pointer of the correct type. - ptrId = global.result_id(); - break; - } - } - } - - if (ptrId != 0) { - pointee_to_pointer_[id] = ptrId; - return ptrId; - } - - ptrId = TakeNextId(); - context()->AddType(MakeUnique( - context(), SpvOpTypePointer, 0, ptrId, - std::initializer_list{ - {SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}, - {SPV_OPERAND_TYPE_ID, {id}}})); - Instruction* ptr = &*--context()->types_values_end(); - get_def_use_mgr()->AnalyzeInstDefUse(ptr); - pointee_to_pointer_[id] = ptrId; - // Register with the type manager if necessary. - context()->get_type_mgr()->RegisterType(ptrId, *pointerTy); - - return ptrId; + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + uint32_t ptr_type_id = + type_mgr->FindPointerToType(id, spv::StorageClass::Function); + pointee_to_pointer_[id] = ptr_type_id; + return ptr_type_id; } void ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source, uint32_t index, Instruction* newVar) { - assert(source->opcode() == SpvOpVariable); + assert(source->opcode() == spv::Op::OpVariable); if (source->NumInOperands() < 2) return; uint32_t initId = source->GetSingleWordInOperand(1u); @@ -586,14 +518,14 @@ void ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source, Instruction* init = get_def_use_mgr()->GetDef(initId); uint32_t newInitId = 0; // TODO(dnovillo): Refactor this with constant propagation. - if (init->opcode() == SpvOpConstantNull) { + if (init->opcode() == spv::Op::OpConstantNull) { // Initialize to appropriate NULL. auto iter = type_to_null_.find(storageId); if (iter == type_to_null_.end()) { newInitId = TakeNextId(); type_to_null_[storageId] = newInitId; context()->AddGlobalValue( - MakeUnique(context(), SpvOpConstantNull, storageId, + MakeUnique(context(), spv::Op::OpConstantNull, storageId, newInitId, std::initializer_list{})); Instruction* newNull = &*--context()->types_values_end(); get_def_use_mgr()->AnalyzeInstDefUse(newNull); @@ -604,18 +536,19 @@ void ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source, // Create a new constant extract. newInitId = TakeNextId(); context()->AddGlobalValue(MakeUnique( - context(), SpvOpSpecConstantOp, storageId, newInitId, + context(), spv::Op::OpSpecConstantOp, storageId, newInitId, std::initializer_list{ - {SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER, {SpvOpCompositeExtract}}, + {SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER, + {uint32_t(spv::Op::OpCompositeExtract)}}, {SPV_OPERAND_TYPE_ID, {init->result_id()}}, {SPV_OPERAND_TYPE_LITERAL_INTEGER, {index}}})); Instruction* newSpecConst = &*--context()->types_values_end(); get_def_use_mgr()->AnalyzeInstDefUse(newSpecConst); - } else if (init->opcode() == SpvOpConstantComposite) { + } else if (init->opcode() == spv::Op::OpConstantComposite) { // Get the appropriate index constant. newInitId = init->GetSingleWordInOperand(index); Instruction* element = get_def_use_mgr()->GetDef(newInitId); - if (element->opcode() == SpvOpUndef) { + if (element->opcode() == spv::Op::OpUndef) { // Undef is not a valid initializer for a variable. newInitId = 0; } @@ -630,7 +563,7 @@ void ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source, uint64_t ScalarReplacementPass::GetArrayLength( const Instruction* arrayType) const { - assert(arrayType->opcode() == SpvOpTypeArray); + assert(arrayType->opcode() == spv::Op::OpTypeArray); const Instruction* length = get_def_use_mgr()->GetDef(arrayType->GetSingleWordInOperand(1u)); return context() @@ -640,8 +573,8 @@ uint64_t ScalarReplacementPass::GetArrayLength( } uint64_t ScalarReplacementPass::GetNumElements(const Instruction* type) const { - assert(type->opcode() == SpvOpTypeVector || - type->opcode() == SpvOpTypeMatrix); + assert(type->opcode() == spv::Op::OpTypeVector || + type->opcode() == spv::Op::OpTypeMatrix); const Operand& op = type->GetInOperand(1u); assert(op.words.size() <= 2); uint64_t len = 0; @@ -659,7 +592,7 @@ bool ScalarReplacementPass::IsSpecConstant(uint32_t id) const { Instruction* ScalarReplacementPass::GetStorageType( const Instruction* inst) const { - assert(inst->opcode() == SpvOpVariable); + assert(inst->opcode() == spv::Op::OpVariable); uint32_t ptrTypeId = inst->type_id(); uint32_t typeId = @@ -669,10 +602,11 @@ Instruction* ScalarReplacementPass::GetStorageType( bool ScalarReplacementPass::CanReplaceVariable( const Instruction* varInst) const { - assert(varInst->opcode() == SpvOpVariable); + assert(varInst->opcode() == spv::Op::OpVariable); // Can only replace function scope variables. - if (varInst->GetSingleWordInOperand(0u) != SpvStorageClassFunction) { + if (spv::StorageClass(varInst->GetSingleWordInOperand(0u)) != + spv::StorageClass::Function) { return false; } @@ -702,14 +636,14 @@ bool ScalarReplacementPass::CheckType(const Instruction* typeInst) const { } switch (typeInst->opcode()) { - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: // Don't bother with empty structs or very large structs. if (typeInst->NumInOperands() == 0 || IsLargerThanSizeLimit(typeInst->NumInOperands())) { return false; } return true; - case SpvOpTypeArray: + case spv::Op::OpTypeArray: if (IsSpecConstant(typeInst->GetSingleWordInOperand(1u))) { return false; } @@ -721,12 +655,12 @@ bool ScalarReplacementPass::CheckType(const Instruction* typeInst) const { // re-enabled. //// Specifically including matrix and vector in an attempt to reduce the //// number of vector registers required. - // case SpvOpTypeMatrix: - // case SpvOpTypeVector: + // case spv::Op::OpTypeMatrix: + // case spv::Op::OpTypeVector: // if (IsLargerThanSizeLimit(GetNumElements(typeInst))) return false; // return true; - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeRuntimeArray: default: return false; } @@ -737,26 +671,28 @@ bool ScalarReplacementPass::CheckTypeAnnotations( for (auto inst : get_decoration_mgr()->GetDecorationsFor(typeInst->result_id(), false)) { uint32_t decoration; - if (inst->opcode() == SpvOpDecorate) { + if (inst->opcode() == spv::Op::OpDecorate) { decoration = inst->GetSingleWordInOperand(1u); } else { - assert(inst->opcode() == SpvOpMemberDecorate); + assert(inst->opcode() == spv::Op::OpMemberDecorate); decoration = inst->GetSingleWordInOperand(2u); } - switch (decoration) { - case SpvDecorationRowMajor: - case SpvDecorationColMajor: - case SpvDecorationArrayStride: - case SpvDecorationMatrixStride: - case SpvDecorationCPacked: - case SpvDecorationInvariant: - case SpvDecorationRestrict: - case SpvDecorationOffset: - case SpvDecorationAlignment: - case SpvDecorationAlignmentId: - case SpvDecorationMaxByteOffset: - case SpvDecorationRelaxedPrecision: + switch (spv::Decoration(decoration)) { + case spv::Decoration::RowMajor: + case spv::Decoration::ColMajor: + case spv::Decoration::ArrayStride: + case spv::Decoration::MatrixStride: + case spv::Decoration::CPacked: + case spv::Decoration::Invariant: + case spv::Decoration::Restrict: + case spv::Decoration::Offset: + case spv::Decoration::Alignment: + case spv::Decoration::AlignmentId: + case spv::Decoration::MaxByteOffset: + case spv::Decoration::RelaxedPrecision: + case spv::Decoration::AliasedPointer: + case spv::Decoration::RestrictPointer: break; default: return false; @@ -769,14 +705,16 @@ bool ScalarReplacementPass::CheckTypeAnnotations( bool ScalarReplacementPass::CheckAnnotations(const Instruction* varInst) const { for (auto inst : get_decoration_mgr()->GetDecorationsFor(varInst->result_id(), false)) { - assert(inst->opcode() == SpvOpDecorate); - uint32_t decoration = inst->GetSingleWordInOperand(1u); + assert(inst->opcode() == spv::Op::OpDecorate); + auto decoration = spv::Decoration(inst->GetSingleWordInOperand(1u)); switch (decoration) { - case SpvDecorationInvariant: - case SpvDecorationRestrict: - case SpvDecorationAlignment: - case SpvDecorationAlignmentId: - case SpvDecorationMaxByteOffset: + case spv::Decoration::Invariant: + case spv::Decoration::Restrict: + case spv::Decoration::Alignment: + case spv::Decoration::AlignmentId: + case spv::Decoration::MaxByteOffset: + case spv::Decoration::AliasedPointer: + case spv::Decoration::RestrictPointer: break; default: return false; @@ -816,8 +754,8 @@ bool ScalarReplacementPass::CheckUses(const Instruction* inst, // Annotations are check as a group separately. if (!IsAnnotationInst(user->opcode())) { switch (user->opcode()) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: if (index == 2u && user->NumInOperands() > 1) { uint32_t id = user->GetSingleWordInOperand(1u); const Instruction* opInst = get_def_use_mgr()->GetDef(id); @@ -835,16 +773,16 @@ bool ScalarReplacementPass::CheckUses(const Instruction* inst, ok = false; } break; - case SpvOpLoad: + case spv::Op::OpLoad: if (!CheckLoad(user, index)) ok = false; stats->num_full_accesses++; break; - case SpvOpStore: + case spv::Op::OpStore: if (!CheckStore(user, index)) ok = false; stats->num_full_accesses++; break; - case SpvOpName: - case SpvOpMemberName: + case spv::Op::OpName: + case spv::Op::OpMemberName: break; default: ok = false; @@ -861,24 +799,24 @@ bool ScalarReplacementPass::CheckUsesRelaxed(const Instruction* inst) const { get_def_use_mgr()->ForEachUse( inst, [this, &ok](const Instruction* user, uint32_t index) { switch (user->opcode()) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: if (index != 2u) { ok = false; } else { if (!CheckUsesRelaxed(user)) ok = false; } break; - case SpvOpLoad: + case spv::Op::OpLoad: if (!CheckLoad(user, index)) ok = false; break; - case SpvOpStore: + case spv::Op::OpStore: if (!CheckStore(user, index)) ok = false; break; - case SpvOpImageTexelPointer: + case spv::Op::OpImageTexelPointer: if (!CheckImageTexelPointer(index)) ok = false; break; - case SpvOpExtInst: + case spv::Op::OpExtInst: if (user->GetCommonDebugOpcode() != CommonDebugInfoDebugDeclare || !CheckDebugDeclare(index)) ok = false; @@ -900,7 +838,8 @@ bool ScalarReplacementPass::CheckLoad(const Instruction* inst, uint32_t index) const { if (index != 2u) return false; if (inst->NumInOperands() >= 2 && - inst->GetSingleWordInOperand(1u) & SpvMemoryAccessVolatileMask) + inst->GetSingleWordInOperand(1u) & + uint32_t(spv::MemoryAccessMask::Volatile)) return false; return true; } @@ -909,7 +848,8 @@ bool ScalarReplacementPass::CheckStore(const Instruction* inst, uint32_t index) const { if (index != 0u) return false; if (inst->NumInOperands() >= 3 && - inst->GetSingleWordInOperand(2u) & SpvMemoryAccessVolatileMask) + inst->GetSingleWordInOperand(2u) & + uint32_t(spv::MemoryAccessMask::Volatile)) return false; return true; } @@ -936,11 +876,11 @@ ScalarReplacementPass::GetUsedComponents(Instruction* inst) { def_use_mgr->WhileEachUser(inst, [&result, def_use_mgr, this](Instruction* use) { switch (use->opcode()) { - case SpvOpLoad: { + case spv::Op::OpLoad: { // Look for extract from the load. std::vector t; if (def_use_mgr->WhileEachUser(use, [&t](Instruction* use2) { - if (use2->opcode() != SpvOpCompositeExtract || + if (use2->opcode() != spv::Op::OpCompositeExtract || use2->NumInOperands() <= 1) { return false; } @@ -954,13 +894,13 @@ ScalarReplacementPass::GetUsedComponents(Instruction* inst) { return false; } } - case SpvOpName: - case SpvOpMemberName: - case SpvOpStore: + case spv::Op::OpName: + case spv::Op::OpMemberName: + case spv::Op::OpStore: // No components are used. return true; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: { + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: { // Add the first index it if is a constant. // TODO: Could be improved by checking if the address is used in a load. analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); @@ -988,16 +928,16 @@ ScalarReplacementPass::GetUsedComponents(Instruction* inst) { uint64_t ScalarReplacementPass::GetMaxLegalIndex( const Instruction* var_inst) const { - assert(var_inst->opcode() == SpvOpVariable && + assert(var_inst->opcode() == spv::Op::OpVariable && "|var_inst| must be a variable instruction."); Instruction* type = GetStorageType(var_inst); switch (type->opcode()) { - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: return type->NumInOperands(); - case SpvOpTypeArray: + case spv::Op::OpTypeArray: return GetArrayLength(type); - case SpvOpTypeMatrix: - case SpvOpTypeVector: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeVector: return GetNumElements(type); default: return 0; @@ -1005,5 +945,69 @@ uint64_t ScalarReplacementPass::GetMaxLegalIndex( return 0; } +void ScalarReplacementPass::CopyDecorationsToVariable(Instruction* from, + Instruction* to, + uint32_t member_index) { + CopyPointerDecorationsToVariable(from, to); + CopyNecessaryMemberDecorationsToVariable(from, to, member_index); +} + +void ScalarReplacementPass::CopyPointerDecorationsToVariable(Instruction* from, + Instruction* to) { + // The RestrictPointer and AliasedPointer decorations are copied to all + // members even if the new variable does not contain a pointer. It does + // not hurt to do so. + for (auto dec_inst : + get_decoration_mgr()->GetDecorationsFor(from->result_id(), false)) { + uint32_t decoration; + decoration = dec_inst->GetSingleWordInOperand(1u); + switch (spv::Decoration(decoration)) { + case spv::Decoration::AliasedPointer: + case spv::Decoration::RestrictPointer: { + std::unique_ptr new_dec_inst(dec_inst->Clone(context())); + new_dec_inst->SetInOperand(0, {to->result_id()}); + context()->AddAnnotationInst(std::move(new_dec_inst)); + } break; + default: + break; + } + } +} + +void ScalarReplacementPass::CopyNecessaryMemberDecorationsToVariable( + Instruction* from, Instruction* to, uint32_t member_index) { + Instruction* type_inst = GetStorageType(from); + for (auto dec_inst : + get_decoration_mgr()->GetDecorationsFor(type_inst->result_id(), false)) { + uint32_t decoration; + if (dec_inst->opcode() == spv::Op::OpMemberDecorate) { + if (dec_inst->GetSingleWordInOperand(1) != member_index) { + continue; + } + + decoration = dec_inst->GetSingleWordInOperand(2u); + switch (spv::Decoration(decoration)) { + case spv::Decoration::ArrayStride: + case spv::Decoration::Alignment: + case spv::Decoration::AlignmentId: + case spv::Decoration::MaxByteOffset: + case spv::Decoration::MaxByteOffsetId: + case spv::Decoration::RelaxedPrecision: { + std::unique_ptr new_dec_inst( + new Instruction(context(), spv::Op::OpDecorate, 0, 0, {})); + new_dec_inst->AddOperand( + Operand(SPV_OPERAND_TYPE_ID, {to->result_id()})); + for (uint32_t i = 2; i < dec_inst->NumInOperandWords(); ++i) { + new_dec_inst->AddOperand(Operand(dec_inst->GetInOperand(i))); + } + context()->AddAnnotationInst(std::move(new_dec_inst)); + } break; + default: + break; + } + } + } +} + } // namespace opt } // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.h index 6a66dfb8..c73ecfd9 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.h @@ -33,7 +33,7 @@ namespace opt { // Documented in optimizer.hpp class ScalarReplacementPass : public MemPass { private: - static const uint32_t kDefaultLimit = 100; + static constexpr uint32_t kDefaultLimit = 100; public: ScalarReplacementPass(uint32_t limit = kDefaultLimit) @@ -104,10 +104,10 @@ class ScalarReplacementPass : public MemPass { // Returns true if the uses of |inst| are acceptable for scalarization. // // Recursively checks all the uses of |inst|. For |inst| specifically, only - // allows SpvOpAccessChain, SpvOpInBoundsAccessChain, SpvOpLoad and - // SpvOpStore. Access chains must have the first index be a compile-time - // constant. Subsequent uses of access chains (including other access chains) - // are checked in a more relaxed manner. + // allows spv::Op::OpAccessChain, spv::Op::OpInBoundsAccessChain, + // spv::Op::OpLoad and spv::Op::OpStore. Access chains must have the first + // index be a compile-time constant. Subsequent uses of access chains + // (including other access chains) are checked in a more relaxed manner. bool CheckUses(const Instruction* inst) const; // Helper function for the above |CheckUses|. @@ -262,9 +262,26 @@ class ScalarReplacementPass : public MemPass { // that we will be willing to split. bool IsLargerThanSizeLimit(uint64_t length) const; + // Copies all relevant decorations from `from` to `to`. This includes + // decorations applied to the variable, and to the members of the type. + // It is assumed that `to` is a variable that is intended to replace the + // `member_index`th member of `from`. + void CopyDecorationsToVariable(Instruction* from, Instruction* to, + uint32_t member_index); + + // Copies pointer related decoration from `from` to `to` if they exist. + void CopyPointerDecorationsToVariable(Instruction* from, Instruction* to); + + // Copies decorations that are needed from the `member_index` of `from` to + // `to, if there was one. + void CopyNecessaryMemberDecorationsToVariable(Instruction* from, + Instruction* to, + uint32_t member_index); + // Limit on the number of members in an object that will be replaced. // 0 means there is no limit. uint32_t max_num_elements_; + // This has to be big enough to fit "scalar-replacement=" followed by a // uint32_t number written in decimal (so 10 digits), and then a // terminating nul. diff --git a/bgfx/3rdparty/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp index 4def2b09..d2aa9b1d 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp @@ -21,8 +21,6 @@ #include #include "source/opt/def_use_manager.h" -#include "source/opt/ir_context.h" -#include "source/opt/type_manager.h" #include "source/opt/types.h" #include "source/util/make_unique.h" #include "source/util/parse_number.h" @@ -30,7 +28,6 @@ namespace spvtools { namespace opt { - namespace { using utils::EncodeNumberStatus; using utils::NumberType; @@ -139,9 +136,9 @@ std::vector ParseDefaultValueBitPattern( // decoration. bool CanHaveSpecIdDecoration(const Instruction& inst) { switch (inst.opcode()) { - case SpvOp::SpvOpSpecConstant: - case SpvOp::SpvOpSpecConstantFalse: - case SpvOp::SpvOpSpecConstantTrue: + case spv::Op::OpSpecConstant: + case spv::Op::OpSpecConstantFalse: + case spv::Op::OpSpecConstantTrue: return true; default: return false; @@ -165,7 +162,7 @@ Instruction* GetSpecIdTargetFromDecorationGroup( if (def_use_mgr->WhileEachUser(&decoration_group_defining_inst, [&group_decorate_inst](Instruction* user) { if (user->opcode() == - SpvOp::SpvOpGroupDecorate) { + spv::Op::OpGroupDecorate) { group_decorate_inst = user; return false; } @@ -217,16 +214,16 @@ Instruction* GetSpecIdTargetFromDecorationGroup( Pass::Status SetSpecConstantDefaultValuePass::Process() { // The operand index of decoration target in an OpDecorate instruction. - const uint32_t kTargetIdOperandIndex = 0; + constexpr uint32_t kTargetIdOperandIndex = 0; // The operand index of the decoration literal in an OpDecorate instruction. - const uint32_t kDecorationOperandIndex = 1; + constexpr uint32_t kDecorationOperandIndex = 1; // The operand index of Spec id literal value in an OpDecorate SpecId // instruction. - const uint32_t kSpecIdLiteralOperandIndex = 2; + constexpr uint32_t kSpecIdLiteralOperandIndex = 2; // The number of operands in an OpDecorate SpecId instruction. - const uint32_t kOpDecorateSpecIdNumOperands = 3; + constexpr uint32_t kOpDecorateSpecIdNumOperands = 3; // The in-operand index of the default value in a OpSpecConstant instruction. - const uint32_t kOpSpecConstantLiteralInOperandIndex = 0; + constexpr uint32_t kOpSpecConstantLiteralInOperandIndex = 0; bool modified = false; // Scan through all the annotation instructions to find 'OpDecorate SpecId' @@ -240,10 +237,10 @@ Pass::Status SetSpecConstantDefaultValuePass::Process() { // default value of the target spec constant. for (Instruction& inst : context()->annotations()) { // Only process 'OpDecorate SpecId' instructions - if (inst.opcode() != SpvOp::SpvOpDecorate) continue; + if (inst.opcode() != spv::Op::OpDecorate) continue; if (inst.NumOperands() != kOpDecorateSpecIdNumOperands) continue; if (inst.GetSingleWordInOperand(kDecorationOperandIndex) != - uint32_t(SpvDecoration::SpvDecorationSpecId)) { + uint32_t(spv::Decoration::SpecId)) { continue; } @@ -255,7 +252,7 @@ Pass::Status SetSpecConstantDefaultValuePass::Process() { // target_id might be a decoration group id. Instruction* spec_inst = nullptr; if (Instruction* target_inst = get_def_use_mgr()->GetDef(target_id)) { - if (target_inst->opcode() == SpvOp::SpvOpDecorationGroup) { + if (target_inst->opcode() == spv::Op::OpDecorationGroup) { spec_inst = GetSpecIdTargetFromDecorationGroup(*target_inst, get_def_use_mgr()); } else { @@ -301,7 +298,7 @@ Pass::Status SetSpecConstantDefaultValuePass::Process() { // Update the operand bit patterns of the spec constant defining // instruction. switch (spec_inst->opcode()) { - case SpvOp::SpvOpSpecConstant: + case spv::Op::OpSpecConstant: // If the new value is the same with the original value, no // need to do anything. Otherwise update the operand words. if (spec_inst->GetInOperand(kOpSpecConstantLiteralInOperandIndex) @@ -311,19 +308,19 @@ Pass::Status SetSpecConstantDefaultValuePass::Process() { modified = true; } break; - case SpvOp::SpvOpSpecConstantTrue: + case spv::Op::OpSpecConstantTrue: // If the new value is also 'true', no need to change anything. // Otherwise, set the opcode to OpSpecConstantFalse; if (!static_cast(bit_pattern.front())) { - spec_inst->SetOpcode(SpvOp::SpvOpSpecConstantFalse); + spec_inst->SetOpcode(spv::Op::OpSpecConstantFalse); modified = true; } break; - case SpvOp::SpvOpSpecConstantFalse: + case spv::Op::OpSpecConstantFalse: // If the new value is also 'false', no need to change anything. // Otherwise, set the opcode to OpSpecConstantTrue; if (static_cast(bit_pattern.front())) { - spec_inst->SetOpcode(SpvOp::SpvOpSpecConstantTrue); + spec_inst->SetOpcode(spv::Op::OpSpecConstantTrue); modified = true; } break; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/simplification_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/simplification_pass.cpp index 43ec15f8..f8ffc03c 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/simplification_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/simplification_pass.cpp @@ -14,7 +14,6 @@ #include "source/opt/simplification_pass.h" -#include #include #include @@ -69,12 +68,12 @@ bool SimplificationPass::SimplifyFunction(Function* function) { &folder, &inst_seen, this](BasicBlock* bb) { for (Instruction* inst = &*bb->begin(); inst; inst = inst->NextNode()) { inst_seen.insert(inst); - if (inst->opcode() == SpvOpPhi) { + if (inst->opcode() == spv::Op::OpPhi) { process_phis.insert(inst); } bool is_foldable_copy = - inst->opcode() == SpvOpCopyObject && + inst->opcode() == spv::Op::OpCopyObject && context()->get_decoration_mgr()->HaveSubsetOfDecorations( inst->result_id(), inst->GetSingleWordInOperand(0)); @@ -91,7 +90,7 @@ bool SimplificationPass::SimplifyFunction(Function* function) { AddNewOperands(inst, &inst_seen, &work_list); - if (inst->opcode() == SpvOpCopyObject) { + if (inst->opcode() == spv::Op::OpCopyObject) { context()->ReplaceAllUsesWithPredicate( inst->result_id(), inst->GetSingleWordInOperand(0), [](Instruction* user) { @@ -104,7 +103,7 @@ bool SimplificationPass::SimplifyFunction(Function* function) { }); inst_to_kill.insert(inst); in_work_list.insert(inst); - } else if (inst->opcode() == SpvOpNop) { + } else if (inst->opcode() == spv::Op::OpNop) { inst_to_kill.insert(inst); in_work_list.insert(inst); } @@ -121,7 +120,7 @@ bool SimplificationPass::SimplifyFunction(Function* function) { inst_seen.insert(inst); bool is_foldable_copy = - inst->opcode() == SpvOpCopyObject && + inst->opcode() == spv::Op::OpCopyObject && context()->get_decoration_mgr()->HaveSubsetOfDecorations( inst->result_id(), inst->GetSingleWordInOperand(0)); @@ -130,7 +129,7 @@ bool SimplificationPass::SimplifyFunction(Function* function) { context()->AnalyzeUses(inst); get_def_use_mgr()->ForEachUser( inst, [&work_list, &in_work_list](Instruction* use) { - if (!use->IsDecoration() && use->opcode() != SpvOpName && + if (!use->IsDecoration() && use->opcode() != spv::Op::OpName && in_work_list.insert(use).second) { work_list.push_back(use); } @@ -138,7 +137,7 @@ bool SimplificationPass::SimplifyFunction(Function* function) { AddNewOperands(inst, &inst_seen, &work_list); - if (inst->opcode() == SpvOpCopyObject) { + if (inst->opcode() == spv::Op::OpCopyObject) { context()->ReplaceAllUsesWithPredicate( inst->result_id(), inst->GetSingleWordInOperand(0), [](Instruction* user) { @@ -150,7 +149,7 @@ bool SimplificationPass::SimplifyFunction(Function* function) { }); inst_to_kill.insert(inst); in_work_list.insert(inst); - } else if (inst->opcode() == SpvOpNop) { + } else if (inst->opcode() == spv::Op::OpNop) { inst_to_kill.insert(inst); in_work_list.insert(inst); } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/spread_volatile_semantics.cpp b/bgfx/3rdparty/spirv-tools/source/opt/spread_volatile_semantics.cpp index b61fd0f4..e552ba5e 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/spread_volatile_semantics.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/spread_volatile_semantics.cpp @@ -15,38 +15,37 @@ #include "source/opt/spread_volatile_semantics.h" #include "source/opt/decoration_manager.h" -#include "source/opt/ir_builder.h" #include "source/spirv_constant.h" namespace spvtools { namespace opt { namespace { - -const uint32_t kOpDecorateInOperandBuiltinDecoration = 2u; -const uint32_t kOpLoadInOperandMemoryOperands = 1u; -const uint32_t kOpEntryPointInOperandEntryPoint = 1u; -const uint32_t kOpEntryPointInOperandInterface = 3u; +constexpr uint32_t kOpDecorateInOperandBuiltinDecoration = 2u; +constexpr uint32_t kOpLoadInOperandMemoryOperands = 1u; +constexpr uint32_t kOpEntryPointInOperandEntryPoint = 1u; +constexpr uint32_t kOpEntryPointInOperandInterface = 3u; bool HasBuiltinDecoration(analysis::DecorationManager* decoration_manager, uint32_t var_id, uint32_t built_in) { return decoration_manager->FindDecoration( - var_id, SpvDecorationBuiltIn, [built_in](const Instruction& inst) { + var_id, uint32_t(spv::Decoration::BuiltIn), + [built_in](const Instruction& inst) { return built_in == inst.GetSingleWordInOperand( kOpDecorateInOperandBuiltinDecoration); }); } -bool IsBuiltInForRayTracingVolatileSemantics(uint32_t built_in) { +bool IsBuiltInForRayTracingVolatileSemantics(spv::BuiltIn built_in) { switch (built_in) { - case SpvBuiltInSMIDNV: - case SpvBuiltInWarpIDNV: - case SpvBuiltInSubgroupSize: - case SpvBuiltInSubgroupLocalInvocationId: - case SpvBuiltInSubgroupEqMask: - case SpvBuiltInSubgroupGeMask: - case SpvBuiltInSubgroupGtMask: - case SpvBuiltInSubgroupLeMask: - case SpvBuiltInSubgroupLtMask: + case spv::BuiltIn::SMIDNV: + case spv::BuiltIn::WarpIDNV: + case spv::BuiltIn::SubgroupSize: + case spv::BuiltIn::SubgroupLocalInvocationId: + case spv::BuiltIn::SubgroupEqMask: + case spv::BuiltIn::SubgroupGeMask: + case spv::BuiltIn::SubgroupGtMask: + case spv::BuiltIn::SubgroupLeMask: + case spv::BuiltIn::SubgroupLtMask: return true; default: return false; @@ -56,16 +55,17 @@ bool IsBuiltInForRayTracingVolatileSemantics(uint32_t built_in) { bool HasBuiltinForRayTracingVolatileSemantics( analysis::DecorationManager* decoration_manager, uint32_t var_id) { return decoration_manager->FindDecoration( - var_id, SpvDecorationBuiltIn, [](const Instruction& inst) { - uint32_t built_in = - inst.GetSingleWordInOperand(kOpDecorateInOperandBuiltinDecoration); + var_id, uint32_t(spv::Decoration::BuiltIn), [](const Instruction& inst) { + spv::BuiltIn built_in = spv::BuiltIn( + inst.GetSingleWordInOperand(kOpDecorateInOperandBuiltinDecoration)); return IsBuiltInForRayTracingVolatileSemantics(built_in); }); } bool HasVolatileDecoration(analysis::DecorationManager* decoration_manager, uint32_t var_id) { - return decoration_manager->HasDecoration(var_id, SpvDecorationVolatile); + return decoration_manager->HasDecoration(var_id, + uint32_t(spv::Decoration::Volatile)); } } // namespace @@ -76,7 +76,7 @@ Pass::Status SpreadVolatileSemantics::Process() { } const bool is_vk_memory_model_enabled = context()->get_feature_mgr()->HasCapability( - SpvCapabilityVulkanMemoryModel); + spv::Capability::VulkanMemoryModel); CollectTargetsForVolatileSemantics(is_vk_memory_model_enabled); // If VulkanMemoryModel capability is not enabled, we have to set Volatile @@ -128,15 +128,16 @@ bool SpreadVolatileSemantics::IsTargetUsedByNonVolatileLoadInEntryPoint( } uint32_t memory_operands = load->GetSingleWordInOperand(kOpLoadInOperandMemoryOperands); - return (memory_operands & SpvMemoryAccessVolatileMask) != 0; + return (memory_operands & uint32_t(spv::MemoryAccessMask::Volatile)) != + 0; }, funcs); } bool SpreadVolatileSemantics::HasInterfaceInConflictOfVolatileSemantics() { for (Instruction& entry_point : get_module()->entry_points()) { - SpvExecutionModel execution_model = - static_cast(entry_point.GetSingleWordInOperand(0)); + spv::ExecutionModel execution_model = + static_cast(entry_point.GetSingleWordInOperand(0)); for (uint32_t operand_index = kOpEntryPointInOperandInterface; operand_index < entry_point.NumInOperands(); ++operand_index) { uint32_t var_id = entry_point.GetSingleWordInOperand(operand_index); @@ -170,8 +171,8 @@ void SpreadVolatileSemantics::MarkVolatileSemanticsForVariable( void SpreadVolatileSemantics::CollectTargetsForVolatileSemantics( const bool is_vk_memory_model_enabled) { for (Instruction& entry_point : get_module()->entry_points()) { - SpvExecutionModel execution_model = - static_cast(entry_point.GetSingleWordInOperand(0)); + spv::ExecutionModel execution_model = + static_cast(entry_point.GetSingleWordInOperand(0)); for (uint32_t operand_index = kOpEntryPointInOperandInterface; operand_index < entry_point.NumInOperands(); ++operand_index) { uint32_t var_id = entry_point.GetSingleWordInOperand(operand_index); @@ -194,9 +195,10 @@ void SpreadVolatileSemantics::DecorateVarWithVolatile(Instruction* var) { return; } get_decoration_mgr()->AddDecoration( - SpvOpDecorate, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {var_id}}, - {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, - {SpvDecorationVolatile}}}); + spv::Op::OpDecorate, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {var_id}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, + {uint32_t(spv::Decoration::Volatile)}}}); } bool SpreadVolatileSemantics::VisitLoadsOfPointersToVariableInEntries( @@ -217,17 +219,17 @@ bool SpreadVolatileSemantics::VisitLoadsOfPointersToVariableInEntries( return true; } - if (user->opcode() == SpvOpAccessChain || - user->opcode() == SpvOpInBoundsAccessChain || - user->opcode() == SpvOpPtrAccessChain || - user->opcode() == SpvOpInBoundsPtrAccessChain || - user->opcode() == SpvOpCopyObject) { + if (user->opcode() == spv::Op::OpAccessChain || + user->opcode() == spv::Op::OpInBoundsAccessChain || + user->opcode() == spv::Op::OpPtrAccessChain || + user->opcode() == spv::Op::OpInBoundsPtrAccessChain || + user->opcode() == spv::Op::OpCopyObject) { if (ptr_id == user->GetSingleWordInOperand(0)) worklist.push_back(user->result_id()); return true; } - if (user->opcode() != SpvOpLoad) { + if (user->opcode() != spv::Op::OpLoad) { return true; } @@ -250,12 +252,12 @@ void SpreadVolatileSemantics::SetVolatileForLoadsInEntries( [](Instruction* load) { if (load->NumInOperands() <= kOpLoadInOperandMemoryOperands) { load->AddOperand({SPV_OPERAND_TYPE_MEMORY_ACCESS, - {SpvMemoryAccessVolatileMask}}); + {uint32_t(spv::MemoryAccessMask::Volatile)}}); return true; } uint32_t memory_operands = load->GetSingleWordInOperand(kOpLoadInOperandMemoryOperands); - memory_operands |= SpvMemoryAccessVolatileMask; + memory_operands |= uint32_t(spv::MemoryAccessMask::Volatile); load->SetInOperand(kOpLoadInOperandMemoryOperands, {memory_operands}); return true; }, @@ -264,29 +266,29 @@ void SpreadVolatileSemantics::SetVolatileForLoadsInEntries( } bool SpreadVolatileSemantics::IsTargetForVolatileSemantics( - uint32_t var_id, SpvExecutionModel execution_model) { + uint32_t var_id, spv::ExecutionModel execution_model) { analysis::DecorationManager* decoration_manager = context()->get_decoration_mgr(); - if (execution_model == SpvExecutionModelFragment) { + if (execution_model == spv::ExecutionModel::Fragment) { return get_module()->version() >= SPV_SPIRV_VERSION_WORD(1, 6) && HasBuiltinDecoration(decoration_manager, var_id, - SpvBuiltInHelperInvocation); + uint32_t(spv::BuiltIn::HelperInvocation)); } - if (execution_model == SpvExecutionModelIntersectionKHR || - execution_model == SpvExecutionModelIntersectionNV) { + if (execution_model == spv::ExecutionModel::IntersectionKHR || + execution_model == spv::ExecutionModel::IntersectionNV) { if (HasBuiltinDecoration(decoration_manager, var_id, - SpvBuiltInRayTmaxKHR)) { + uint32_t(spv::BuiltIn::RayTmaxKHR))) { return true; } } switch (execution_model) { - case SpvExecutionModelRayGenerationKHR: - case SpvExecutionModelClosestHitKHR: - case SpvExecutionModelMissKHR: - case SpvExecutionModelCallableKHR: - case SpvExecutionModelIntersectionKHR: + case spv::ExecutionModel::RayGenerationKHR: + case spv::ExecutionModel::ClosestHitKHR: + case spv::ExecutionModel::MissKHR: + case spv::ExecutionModel::CallableKHR: + case spv::ExecutionModel::IntersectionKHR: return HasBuiltinForRayTracingVolatileSemantics(decoration_manager, var_id); default: diff --git a/bgfx/3rdparty/spirv-tools/source/opt/spread_volatile_semantics.h b/bgfx/3rdparty/spirv-tools/source/opt/spread_volatile_semantics.h index 014858d3..4cbb526f 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/spread_volatile_semantics.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/spread_volatile_semantics.h @@ -39,7 +39,8 @@ class SpreadVolatileSemantics : public Pass { // have an execution model. bool HasNoExecutionModel() { return get_module()->entry_points().empty() && - context()->get_feature_mgr()->HasCapability(SpvCapabilityLinkage); + context()->get_feature_mgr()->HasCapability( + spv::Capability::Linkage); } // Iterates interface variables and spreads the Volatile semantics if it has @@ -52,7 +53,7 @@ class SpreadVolatileSemantics : public Pass { // VUID-StandaloneSpirv-VulkanMemoryModel-04678 or // VUID-StandaloneSpirv-VulkanMemoryModel-04679. bool IsTargetForVolatileSemantics(uint32_t var_id, - SpvExecutionModel execution_model); + spv::ExecutionModel execution_model); // Collects interface variables that need the volatile semantics. // |is_vk_memory_model_enabled| is true if VulkanMemoryModel capability is diff --git a/bgfx/3rdparty/spirv-tools/source/opt/ssa_rewrite_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/ssa_rewrite_pass.cpp index 22d81104..3eb4ec3f 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/ssa_rewrite_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/ssa_rewrite_pass.cpp @@ -48,7 +48,6 @@ #include "source/opt/cfg.h" #include "source/opt/mem_pass.h" #include "source/opt/types.h" -#include "source/util/make_unique.h" // Debug logging (0: Off, 1-N: Verbosity level). Replace this with the // implementation done for @@ -63,10 +62,9 @@ namespace spvtools { namespace opt { - namespace { -const uint32_t kStoreValIdInIdx = 1; -const uint32_t kVariableInitIdInIdx = 1; +constexpr uint32_t kStoreValIdInIdx = 1; +constexpr uint32_t kVariableInitIdInIdx = 1; } // namespace std::string SSARewriter::PhiCandidate::PrettyPrint(const CFG* cfg) const { @@ -300,12 +298,12 @@ void SSARewriter::SealBlock(BasicBlock* bb) { void SSARewriter::ProcessStore(Instruction* inst, BasicBlock* bb) { auto opcode = inst->opcode(); - assert((opcode == SpvOpStore || opcode == SpvOpVariable) && + assert((opcode == spv::Op::OpStore || opcode == spv::Op::OpVariable) && "Expecting a store or a variable definition instruction."); uint32_t var_id = 0; uint32_t val_id = 0; - if (opcode == SpvOpStore) { + if (opcode == spv::Op::OpStore) { (void)pass_->GetPtr(inst, &var_id); val_id = inst->GetSingleWordInOperand(kStoreValIdInIdx); } else if (inst->NumInOperands() >= 2) { @@ -443,9 +441,9 @@ bool SSARewriter::GenerateSSAReplacements(BasicBlock* bb) { for (auto& inst : *bb) { auto opcode = inst.opcode(); - if (opcode == SpvOpStore || opcode == SpvOpVariable) { + if (opcode == spv::Op::OpStore || opcode == spv::Op::OpVariable) { ProcessStore(&inst, bb); - } else if (inst.opcode() == SpvOpLoad) { + } else if (inst.opcode() == spv::Op::OpLoad) { if (!ProcessLoad(&inst, bb)) { return false; } @@ -545,7 +543,7 @@ bool SSARewriter::ApplyReplacements() { // Generate a new OpPhi instruction and insert it in its basic // block. std::unique_ptr phi_inst( - new Instruction(pass_->context(), SpvOpPhi, type_id, + new Instruction(pass_->context(), spv::Op::OpPhi, type_id, phi_candidate->result_id(), phi_operands)); generated_phis.push_back(phi_inst.get()); pass_->get_def_use_mgr()->AnalyzeInstDef(&*phi_inst); @@ -554,7 +552,7 @@ bool SSARewriter::ApplyReplacements() { insert_it = insert_it.InsertBefore(std::move(phi_inst)); pass_->context()->get_decoration_mgr()->CloneDecorations( phi_candidate->var_id(), phi_candidate->result_id(), - {SpvDecorationRelaxedPrecision}); + {spv::Decoration::RelaxedPrecision}); // Add DebugValue for the new OpPhi instruction. insert_it->SetDebugScope(local_var->GetDebugScope()); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/strength_reduction_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/strength_reduction_pass.cpp index ab7c4eb8..16a7869e 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/strength_reduction_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/strength_reduction_pass.cpp @@ -14,12 +14,8 @@ #include "source/opt/strength_reduction_pass.h" -#include -#include #include #include -#include -#include #include #include @@ -28,6 +24,8 @@ #include "source/opt/log.h" #include "source/opt/reflect.h" +namespace spvtools { +namespace opt { namespace { // Count the number of trailing zeros in the binary representation of // |constVal|. @@ -53,9 +51,6 @@ bool IsPowerOf2(uint32_t val) { } // namespace -namespace spvtools { -namespace opt { - Pass::Status StrengthReductionPass::Process() { // Initialize the member variables on a per module basis. bool modified = false; @@ -70,7 +65,7 @@ Pass::Status StrengthReductionPass::Process() { bool StrengthReductionPass::ReplaceMultiplyByPowerOf2( BasicBlock::iterator* inst) { - assert((*inst)->opcode() == SpvOp::SpvOpIMul && + assert((*inst)->opcode() == spv::Op::OpIMul && "Only works for multiplication of integers."); bool modified = false; @@ -84,7 +79,7 @@ bool StrengthReductionPass::ReplaceMultiplyByPowerOf2( for (int i = 0; i < 2; i++) { uint32_t opId = (*inst)->GetSingleWordInOperand(i); Instruction* opInst = get_def_use_mgr()->GetDef(opId); - if (opInst->opcode() == SpvOp::SpvOpConstant) { + if (opInst->opcode() == spv::Op::OpConstant) { // We found a constant operand. uint32_t constVal = opInst->GetSingleWordOperand(2); @@ -101,7 +96,7 @@ bool StrengthReductionPass::ReplaceMultiplyByPowerOf2( {shiftConstResultId}); newOperands.push_back(shiftOperand); std::unique_ptr newInstruction( - new Instruction(context(), SpvOp::SpvOpShiftLeftLogical, + new Instruction(context(), spv::Op::OpShiftLeftLogical, (*inst)->type_id(), newResultId, newOperands)); // Insert the new instruction and update the data structures. @@ -133,7 +128,7 @@ void StrengthReductionPass::FindIntTypesAndConstants() { for (auto iter = get_module()->types_values_begin(); iter != get_module()->types_values_end(); ++iter) { switch (iter->opcode()) { - case SpvOp::SpvOpConstant: + case spv::Op::OpConstant: if (iter->type_id() == uint32_type_id_) { uint32_t value = iter->GetSingleWordOperand(2); if (value <= 32) constant_ids_[value] = iter->result_id(); @@ -159,9 +154,8 @@ uint32_t StrengthReductionPass::GetConstantId(uint32_t val) { uint32_t resultId = TakeNextId(); Operand constant(spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, {val}); - std::unique_ptr newConstant( - new Instruction(context(), SpvOp::SpvOpConstant, uint32_type_id_, - resultId, {constant})); + std::unique_ptr newConstant(new Instruction( + context(), spv::Op::OpConstant, uint32_type_id_, resultId, {constant})); get_module()->AddGlobalValue(std::move(newConstant)); // Notify the DefUseManager about this constant. @@ -184,7 +178,7 @@ bool StrengthReductionPass::ScanFunctions() { for (auto& bb : func) { for (auto inst = bb.begin(); inst != bb.end(); ++inst) { switch (inst->opcode()) { - case SpvOp::SpvOpIMul: + case spv::Op::OpIMul: if (ReplaceMultiplyByPowerOf2(&inst)) modified = true; break; default: diff --git a/bgfx/3rdparty/spirv-tools/source/opt/strip_debug_info_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/strip_debug_info_pass.cpp index 6a0ebf24..f81bced5 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/strip_debug_info_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/strip_debug_info_pass.cpp @@ -37,13 +37,13 @@ Pass::Status StripDebugInfoPass::Process() { if (uses_non_semantic_info) { for (auto& inst : context()->module()->debugs1()) { switch (inst.opcode()) { - case SpvOpString: { + case spv::Op::OpString: { analysis::DefUseManager* def_use = context()->get_def_use_mgr(); // see if this string is used anywhere by a non-semantic instruction bool no_nonsemantic_use = def_use->WhileEachUser(&inst, [def_use](Instruction* use) { - if (use->opcode() == SpvOpExtInst) { + if (use->opcode() == spv::Op::OpExtInst) { auto ext_inst_set = def_use->GetDef(use->GetSingleWordInOperand(0u)); const std::string extension_name = @@ -83,7 +83,8 @@ Pass::Status StripDebugInfoPass::Process() { // when that instruction is killed, which will lead to a double kill. std::sort(to_kill.begin(), to_kill.end(), [](Instruction* lhs, Instruction* rhs) -> bool { - if (lhs->opcode() == SpvOpName && rhs->opcode() != SpvOpName) + if (lhs->opcode() == spv::Op::OpName && + rhs->opcode() != spv::Op::OpName) return true; return false; }); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/strip_nonsemantic_info_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/strip_nonsemantic_info_pass.cpp index cd1fbb63..3886835a 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/strip_nonsemantic_info_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/strip_nonsemantic_info_pass.cpp @@ -14,7 +14,6 @@ #include "source/opt/strip_nonsemantic_info_pass.h" -#include #include #include "source/opt/instruction.h" @@ -32,27 +31,31 @@ Pass::Status StripNonSemanticInfoPass::Process() { bool other_uses_for_decorate_string = false; for (auto& inst : context()->module()->annotations()) { switch (inst.opcode()) { - case SpvOpDecorateStringGOOGLE: - if (inst.GetSingleWordInOperand(1) == SpvDecorationHlslSemanticGOOGLE || - inst.GetSingleWordInOperand(1) == SpvDecorationUserTypeGOOGLE) { + case spv::Op::OpDecorateStringGOOGLE: + if (spv::Decoration(inst.GetSingleWordInOperand(1)) == + spv::Decoration::HlslSemanticGOOGLE || + spv::Decoration(inst.GetSingleWordInOperand(1)) == + spv::Decoration::UserTypeGOOGLE) { to_remove.push_back(&inst); } else { other_uses_for_decorate_string = true; } break; - case SpvOpMemberDecorateStringGOOGLE: - if (inst.GetSingleWordInOperand(2) == SpvDecorationHlslSemanticGOOGLE || - inst.GetSingleWordInOperand(2) == SpvDecorationUserTypeGOOGLE) { + case spv::Op::OpMemberDecorateStringGOOGLE: + if (spv::Decoration(inst.GetSingleWordInOperand(2)) == + spv::Decoration::HlslSemanticGOOGLE || + spv::Decoration(inst.GetSingleWordInOperand(2)) == + spv::Decoration::UserTypeGOOGLE) { to_remove.push_back(&inst); } else { other_uses_for_decorate_string = true; } break; - case SpvOpDecorateId: - if (inst.GetSingleWordInOperand(1) == - SpvDecorationHlslCounterBufferGOOGLE) { + case spv::Op::OpDecorateId: + if (spv::Decoration(inst.GetSingleWordInOperand(1)) == + spv::Decoration::HlslCounterBufferGOOGLE) { to_remove.push_back(&inst); } break; @@ -79,7 +82,7 @@ Pass::Status StripNonSemanticInfoPass::Process() { // remove any extended inst imports that are non semantic std::unordered_set non_semantic_sets; for (auto& inst : context()->module()->ext_inst_imports()) { - assert(inst.opcode() == SpvOpExtInstImport && + assert(inst.opcode() == spv::Op::OpExtInstImport && "Expecting an import of an extension's instruction set."); const std::string extension_name = inst.GetInOperand(0).AsString(); if (spvtools::utils::starts_with(extension_name, "NonSemantic.")) { @@ -93,7 +96,7 @@ Pass::Status StripNonSemanticInfoPass::Process() { if (!non_semantic_sets.empty()) { context()->module()->ForEachInst( [&non_semantic_sets, &to_remove](Instruction* inst) { - if (inst->opcode() == SpvOpExtInst) { + if (inst->opcode() == spv::Op::OpExtInst) { if (non_semantic_sets.find(inst->GetSingleWordInOperand(0)) != non_semantic_sets.end()) { to_remove.push_back(inst); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/struct_cfg_analysis.cpp b/bgfx/3rdparty/spirv-tools/source/opt/struct_cfg_analysis.cpp index 203db87d..290b4bf4 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/struct_cfg_analysis.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/struct_cfg_analysis.cpp @@ -16,18 +16,17 @@ #include "source/opt/ir_context.h" -namespace { -const uint32_t kMergeNodeIndex = 0; -const uint32_t kContinueNodeIndex = 1; -} // namespace - namespace spvtools { namespace opt { +namespace { +constexpr uint32_t kMergeNodeIndex = 0; +constexpr uint32_t kContinueNodeIndex = 1; +} // namespace StructuredCFGAnalysis::StructuredCFGAnalysis(IRContext* ctx) : context_(ctx) { // If this is not a shader, there are no merge instructions, and not // structured CFG to analyze. - if (!context_->get_feature_mgr()->HasCapability(SpvCapabilityShader)) { + if (!context_->get_feature_mgr()->HasCapability(spv::Capability::Shader)) { return; } @@ -82,7 +81,7 @@ void StructuredCFGAnalysis::AddBlocksInFunction(Function* func) { merge_inst->GetSingleWordInOperand(kMergeNodeIndex); new_state.cinfo.containing_construct = block->id(); - if (merge_inst->opcode() == SpvOpLoopMerge) { + if (merge_inst->opcode() == spv::Op::OpLoopMerge) { new_state.cinfo.containing_loop = block->id(); new_state.cinfo.containing_switch = 0; new_state.continue_node = @@ -98,7 +97,7 @@ void StructuredCFGAnalysis::AddBlocksInFunction(Function* func) { new_state.cinfo.in_continue = state.back().cinfo.in_continue; new_state.continue_node = state.back().continue_node; - if (merge_inst->NextNode()->opcode() == SpvOpSwitch) { + if (merge_inst->NextNode()->opcode() == spv::Op::OpSwitch) { new_state.cinfo.containing_switch = block->id(); } else { new_state.cinfo.containing_switch = @@ -226,7 +225,7 @@ StructuredCFGAnalysis::FindFuncsCalledFromContinue() { for (auto& bb : func) { if (IsInContainingLoopsContinueConstruct(bb.id())) { for (const Instruction& inst : bb) { - if (inst.opcode() == SpvOpFunctionCall) { + if (inst.opcode() == spv::Op::OpFunctionCall) { funcs_to_process.push(inst.GetSingleWordInOperand(0)); } } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/switch_descriptorset_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/switch_descriptorset_pass.cpp new file mode 100644 index 00000000..f07c9175 --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/switch_descriptorset_pass.cpp @@ -0,0 +1,46 @@ +// Copyright (c) 2023 LunarG Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/opt/switch_descriptorset_pass.h" + +#include "source/opt/ir_builder.h" +#include "source/util/string_utils.h" + +namespace spvtools { +namespace opt { + +Pass::Status SwitchDescriptorSetPass::Process() { + Status status = Status::SuccessWithoutChange; + auto* deco_mgr = context()->get_decoration_mgr(); + + for (Instruction& var : context()->types_values()) { + if (var.opcode() != spv::Op::OpVariable) { + continue; + } + auto decos = deco_mgr->GetDecorationsFor(var.result_id(), false); + for (const auto& deco : decos) { + spv::Decoration d = spv::Decoration(deco->GetSingleWordInOperand(1u)); + if (d == spv::Decoration::DescriptorSet && + deco->GetSingleWordInOperand(2u) == ds_from_) { + deco->SetInOperand(2u, {ds_to_}); + status = Status::SuccessWithChange; + break; + } + } + } + return status; +} + +} // namespace opt +} // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/switch_descriptorset_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/switch_descriptorset_pass.h new file mode 100644 index 00000000..2084e9cd --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/switch_descriptorset_pass.h @@ -0,0 +1,52 @@ +// Copyright (c) 2023 LunarG Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class SwitchDescriptorSetPass : public Pass { + public: + SwitchDescriptorSetPass(uint32_t ds_from, uint32_t ds_to) + : ds_from_(ds_from), ds_to_(ds_to) {} + + const char* name() const override { return "switch-descriptorset"; } + + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + // this pass preserves everything except decorations + uint32_t mask = ((IRContext::kAnalysisEnd << 1) - 1); + mask &= ~static_cast(IRContext::kAnalysisDecorations); + return static_cast(mask); + } + + private: + uint32_t ds_from_; + uint32_t ds_to_; +}; + +} // namespace opt +} // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/trim_capabilities_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/trim_capabilities_pass.cpp new file mode 100644 index 00000000..f8e4d818 --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/trim_capabilities_pass.cpp @@ -0,0 +1,525 @@ +// Copyright (c) 2023 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/opt/trim_capabilities_pass.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/enum_set.h" +#include "source/enum_string_mapping.h" +#include "source/opt/ir_context.h" +#include "source/opt/reflect.h" +#include "source/spirv_target_env.h" +#include "source/util/string_utils.h" + +namespace spvtools { +namespace opt { + +namespace { +constexpr uint32_t kOpTypePointerStorageClassIndex = 0; +constexpr uint32_t kTypeArrayTypeIndex = 0; +constexpr uint32_t kOpTypeScalarBitWidthIndex = 0; +constexpr uint32_t kTypePointerTypeIdInIdx = 1; + +// DFS visit of the type defined by `instruction`. +// If `condition` is true, children of the current node are visited. +// If `condition` is false, the children of the current node are ignored. +template +static void DFSWhile(const Instruction* instruction, UnaryPredicate condition) { + std::stack instructions_to_visit; + instructions_to_visit.push(instruction->result_id()); + const auto* def_use_mgr = instruction->context()->get_def_use_mgr(); + + while (!instructions_to_visit.empty()) { + const Instruction* item = def_use_mgr->GetDef(instructions_to_visit.top()); + instructions_to_visit.pop(); + + if (!condition(item)) { + continue; + } + + if (item->opcode() == spv::Op::OpTypePointer) { + instructions_to_visit.push( + item->GetSingleWordInOperand(kTypePointerTypeIdInIdx)); + continue; + } + + if (item->opcode() == spv::Op::OpTypeMatrix || + item->opcode() == spv::Op::OpTypeVector || + item->opcode() == spv::Op::OpTypeArray || + item->opcode() == spv::Op::OpTypeRuntimeArray) { + instructions_to_visit.push( + item->GetSingleWordInOperand(kTypeArrayTypeIndex)); + continue; + } + + if (item->opcode() == spv::Op::OpTypeStruct) { + item->ForEachInOperand([&instructions_to_visit](const uint32_t* op_id) { + instructions_to_visit.push(*op_id); + }); + continue; + } + } +} + +// Walks the type defined by `instruction` (OpType* only). +// Returns `true` if any call to `predicate` with the type/subtype returns true. +template +static bool AnyTypeOf(const Instruction* instruction, + UnaryPredicate predicate) { + assert(IsTypeInst(instruction->opcode()) && + "AnyTypeOf called with a non-type instruction."); + + bool found_one = false; + DFSWhile(instruction, [&found_one, predicate](const Instruction* node) { + if (found_one || predicate(node)) { + found_one = true; + return false; + } + + return true; + }); + return found_one; +} + +static bool is16bitType(const Instruction* instruction) { + if (instruction->opcode() != spv::Op::OpTypeInt && + instruction->opcode() != spv::Op::OpTypeFloat) { + return false; + } + + return instruction->GetSingleWordInOperand(kOpTypeScalarBitWidthIndex) == 16; +} + +static bool Has16BitCapability(const FeatureManager* feature_manager) { + const CapabilitySet& capabilities = feature_manager->GetCapabilities(); + return capabilities.contains(spv::Capability::Float16) || + capabilities.contains(spv::Capability::Int16); +} + +} // namespace + +// ============== Begin opcode handler implementations. ======================= +// +// Adding support for a new capability should only require adding a new handler, +// and updating the +// kSupportedCapabilities/kUntouchableCapabilities/kFordiddenCapabilities lists. +// +// Handler names follow the following convention: +// Handler__() + +static std::optional +Handler_OpTypePointer_StorageInputOutput16(const Instruction* instruction) { + assert(instruction->opcode() == spv::Op::OpTypePointer && + "This handler only support OpTypePointer opcodes."); + + // This capability is only required if the variable has an Input/Output + // storage class. + spv::StorageClass storage_class = spv::StorageClass( + instruction->GetSingleWordInOperand(kOpTypePointerStorageClassIndex)); + if (storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { + return std::nullopt; + } + + if (!Has16BitCapability(instruction->context()->get_feature_mgr())) { + return std::nullopt; + } + + return AnyTypeOf(instruction, is16bitType) + ? std::optional(spv::Capability::StorageInputOutput16) + : std::nullopt; +} + +static std::optional +Handler_OpTypePointer_StoragePushConstant16(const Instruction* instruction) { + assert(instruction->opcode() == spv::Op::OpTypePointer && + "This handler only support OpTypePointer opcodes."); + + // This capability is only required if the variable has a PushConstant storage + // class. + spv::StorageClass storage_class = spv::StorageClass( + instruction->GetSingleWordInOperand(kOpTypePointerStorageClassIndex)); + if (storage_class != spv::StorageClass::PushConstant) { + return std::nullopt; + } + + if (!Has16BitCapability(instruction->context()->get_feature_mgr())) { + return std::nullopt; + } + + return AnyTypeOf(instruction, is16bitType) + ? std::optional(spv::Capability::StoragePushConstant16) + : std::nullopt; +} + +static std::optional +Handler_OpTypePointer_StorageUniformBufferBlock16( + const Instruction* instruction) { + assert(instruction->opcode() == spv::Op::OpTypePointer && + "This handler only support OpTypePointer opcodes."); + + // This capability is only required if the variable has a Uniform storage + // class. + spv::StorageClass storage_class = spv::StorageClass( + instruction->GetSingleWordInOperand(kOpTypePointerStorageClassIndex)); + if (storage_class != spv::StorageClass::Uniform) { + return std::nullopt; + } + + if (!Has16BitCapability(instruction->context()->get_feature_mgr())) { + return std::nullopt; + } + + const auto* decoration_mgr = instruction->context()->get_decoration_mgr(); + const bool matchesCondition = + AnyTypeOf(instruction, [decoration_mgr](const Instruction* item) { + if (!decoration_mgr->HasDecoration(item->result_id(), + spv::Decoration::BufferBlock)) { + return false; + } + + return AnyTypeOf(item, is16bitType); + }); + + return matchesCondition + ? std::optional(spv::Capability::StorageUniformBufferBlock16) + : std::nullopt; +} + +static std::optional Handler_OpTypePointer_StorageUniform16( + const Instruction* instruction) { + assert(instruction->opcode() == spv::Op::OpTypePointer && + "This handler only support OpTypePointer opcodes."); + + // This capability is only required if the variable has a Uniform storage + // class. + spv::StorageClass storage_class = spv::StorageClass( + instruction->GetSingleWordInOperand(kOpTypePointerStorageClassIndex)); + if (storage_class != spv::StorageClass::Uniform) { + return std::nullopt; + } + + const auto* feature_manager = instruction->context()->get_feature_mgr(); + if (!Has16BitCapability(feature_manager)) { + return std::nullopt; + } + + const bool hasBufferBlockCapability = + feature_manager->GetCapabilities().contains( + spv::Capability::StorageUniformBufferBlock16); + const auto* decoration_mgr = instruction->context()->get_decoration_mgr(); + bool found16bitType = false; + + DFSWhile(instruction, [decoration_mgr, hasBufferBlockCapability, + &found16bitType](const Instruction* item) { + if (found16bitType) { + return false; + } + + if (hasBufferBlockCapability && + decoration_mgr->HasDecoration(item->result_id(), + spv::Decoration::BufferBlock)) { + return false; + } + + if (is16bitType(item)) { + found16bitType = true; + return false; + } + + return true; + }); + + return found16bitType ? std::optional(spv::Capability::StorageUniform16) + : std::nullopt; +} + +// Opcode of interest to determine capabilities requirements. +constexpr std::array, 4> kOpcodeHandlers{{ + // clang-format off + {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageInputOutput16}, + {spv::Op::OpTypePointer, Handler_OpTypePointer_StoragePushConstant16}, + {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageUniformBufferBlock16}, + {spv::Op::OpTypePointer, Handler_OpTypePointer_StorageUniform16} + // clang-format on +}}; + +// ============== End opcode handler implementations. ======================= + +namespace { +ExtensionSet getExtensionsRelatedTo(const CapabilitySet& capabilities, + const AssemblyGrammar& grammar) { + ExtensionSet output; + const spv_operand_desc_t* desc = nullptr; + for (auto capability : capabilities) { + if (SPV_SUCCESS != grammar.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, + static_cast(capability), + &desc)) { + continue; + } + + for (uint32_t i = 0; i < desc->numExtensions; ++i) { + output.insert(desc->extensions[i]); + } + } + + return output; +} +} // namespace + +TrimCapabilitiesPass::TrimCapabilitiesPass() + : supportedCapabilities_( + TrimCapabilitiesPass::kSupportedCapabilities.cbegin(), + TrimCapabilitiesPass::kSupportedCapabilities.cend()), + forbiddenCapabilities_( + TrimCapabilitiesPass::kForbiddenCapabilities.cbegin(), + TrimCapabilitiesPass::kForbiddenCapabilities.cend()), + untouchableCapabilities_( + TrimCapabilitiesPass::kUntouchableCapabilities.cbegin(), + TrimCapabilitiesPass::kUntouchableCapabilities.cend()), + opcodeHandlers_(kOpcodeHandlers.cbegin(), kOpcodeHandlers.cend()) {} + +void TrimCapabilitiesPass::addInstructionRequirementsForOpcode( + spv::Op opcode, CapabilitySet* capabilities, + ExtensionSet* extensions) const { + // Ignoring OpBeginInvocationInterlockEXT and OpEndInvocationInterlockEXT + // because they have three possible capabilities, only one of which is needed + if (opcode == spv::Op::OpBeginInvocationInterlockEXT || + opcode == spv::Op::OpEndInvocationInterlockEXT) { + return; + } + + const spv_opcode_desc_t* desc = {}; + auto result = context()->grammar().lookupOpcode(opcode, &desc); + if (result != SPV_SUCCESS) { + return; + } + + addSupportedCapabilitiesToSet(desc, capabilities); + addSupportedExtensionsToSet(desc, extensions); +} + +void TrimCapabilitiesPass::addInstructionRequirementsForOperand( + const Operand& operand, CapabilitySet* capabilities, + ExtensionSet* extensions) const { + // No supported capability relies on a 2+-word operand. + if (operand.words.size() != 1) { + return; + } + + // No supported capability relies on a literal string operand or an ID. + if (operand.type == SPV_OPERAND_TYPE_LITERAL_STRING || + operand.type == SPV_OPERAND_TYPE_ID || + operand.type == SPV_OPERAND_TYPE_RESULT_ID) { + return; + } + + // case 1: Operand is a single value, can directly lookup. + if (!spvOperandIsConcreteMask(operand.type)) { + const spv_operand_desc_t* desc = {}; + auto result = context()->grammar().lookupOperand(operand.type, + operand.words[0], &desc); + if (result != SPV_SUCCESS) { + return; + } + addSupportedCapabilitiesToSet(desc, capabilities); + addSupportedExtensionsToSet(desc, extensions); + return; + } + + // case 2: operand can be a bitmask, we need to decompose the lookup. + for (uint32_t i = 0; i < 32; i++) { + const uint32_t mask = (1 << i) & operand.words[0]; + if (!mask) { + continue; + } + + const spv_operand_desc_t* desc = {}; + auto result = context()->grammar().lookupOperand(operand.type, mask, &desc); + if (result != SPV_SUCCESS) { + continue; + } + + addSupportedCapabilitiesToSet(desc, capabilities); + addSupportedExtensionsToSet(desc, extensions); + } +} + +void TrimCapabilitiesPass::addInstructionRequirements( + Instruction* instruction, CapabilitySet* capabilities, + ExtensionSet* extensions) const { + // Ignoring OpCapability and OpExtension instructions. + if (instruction->opcode() == spv::Op::OpCapability || + instruction->opcode() == spv::Op::OpExtension) { + return; + } + + addInstructionRequirementsForOpcode(instruction->opcode(), capabilities, + extensions); + + // Second case: one of the opcode operand is gated by a capability. + const uint32_t operandCount = instruction->NumOperands(); + for (uint32_t i = 0; i < operandCount; i++) { + addInstructionRequirementsForOperand(instruction->GetOperand(i), + capabilities, extensions); + } + + // Last case: some complex logic needs to be run to determine capabilities. + auto[begin, end] = opcodeHandlers_.equal_range(instruction->opcode()); + for (auto it = begin; it != end; it++) { + const OpcodeHandler handler = it->second; + auto result = handler(instruction); + if (!result.has_value()) { + continue; + } + + capabilities->insert(*result); + } +} + +void TrimCapabilitiesPass::AddExtensionsForOperand( + const spv_operand_type_t type, const uint32_t value, + ExtensionSet* extensions) const { + const spv_operand_desc_t* desc = nullptr; + spv_result_t result = context()->grammar().lookupOperand(type, value, &desc); + if (result != SPV_SUCCESS) { + return; + } + addSupportedExtensionsToSet(desc, extensions); +} + +std::pair +TrimCapabilitiesPass::DetermineRequiredCapabilitiesAndExtensions() const { + CapabilitySet required_capabilities; + ExtensionSet required_extensions; + + get_module()->ForEachInst([&](Instruction* instruction) { + addInstructionRequirements(instruction, &required_capabilities, + &required_extensions); + }); + + for (auto capability : required_capabilities) { + AddExtensionsForOperand(SPV_OPERAND_TYPE_CAPABILITY, + static_cast(capability), + &required_extensions); + } + +#if !defined(NDEBUG) + // Debug only. We check the outputted required capabilities against the + // supported capabilities list. The supported capabilities list is useful for + // API users to quickly determine if they can use the pass or not. But this + // list has to remain up-to-date with the pass code. If we can detect a + // capability as required, but it's not listed, it means the list is + // out-of-sync. This method is not ideal, but should cover most cases. + { + for (auto capability : required_capabilities) { + assert(supportedCapabilities_.contains(capability) && + "Module is using a capability that is not listed as supported."); + } + } +#endif + + return std::make_pair(std::move(required_capabilities), + std::move(required_extensions)); +} + +Pass::Status TrimCapabilitiesPass::TrimUnrequiredCapabilities( + const CapabilitySet& required_capabilities) const { + const FeatureManager* feature_manager = context()->get_feature_mgr(); + CapabilitySet capabilities_to_trim; + for (auto capability : feature_manager->GetCapabilities()) { + // Some capabilities cannot be safely removed. Leaving them untouched. + if (untouchableCapabilities_.contains(capability)) { + continue; + } + + // If the capability is unsupported, don't trim it. + if (!supportedCapabilities_.contains(capability)) { + continue; + } + + if (required_capabilities.contains(capability)) { + continue; + } + + capabilities_to_trim.insert(capability); + } + + for (auto capability : capabilities_to_trim) { + context()->RemoveCapability(capability); + } + + return capabilities_to_trim.size() == 0 ? Pass::Status::SuccessWithoutChange + : Pass::Status::SuccessWithChange; +} + +Pass::Status TrimCapabilitiesPass::TrimUnrequiredExtensions( + const ExtensionSet& required_extensions) const { + const auto supported_extensions = + getExtensionsRelatedTo(supportedCapabilities_, context()->grammar()); + + bool modified_module = false; + for (auto extension : supported_extensions) { + if (required_extensions.contains(extension)) { + continue; + } + + if (context()->RemoveExtension(extension)) { + modified_module = true; + } + } + + return modified_module ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; +} + +bool TrimCapabilitiesPass::HasForbiddenCapabilities() const { + // EnumSet.HasAnyOf returns `true` if the given set is empty. + if (forbiddenCapabilities_.size() == 0) { + return false; + } + + const auto& capabilities = context()->get_feature_mgr()->GetCapabilities(); + return capabilities.HasAnyOf(forbiddenCapabilities_); +} + +Pass::Status TrimCapabilitiesPass::Process() { + if (HasForbiddenCapabilities()) { + return Status::SuccessWithoutChange; + } + + auto[required_capabilities, required_extensions] = + DetermineRequiredCapabilitiesAndExtensions(); + + Pass::Status capStatus = TrimUnrequiredCapabilities(required_capabilities); + Pass::Status extStatus = TrimUnrequiredExtensions(required_extensions); + + return capStatus == Pass::Status::SuccessWithChange || + extStatus == Pass::Status::SuccessWithChange + ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/trim_capabilities_pass.h b/bgfx/3rdparty/spirv-tools/source/opt/trim_capabilities_pass.h new file mode 100644 index 00000000..16b5781a --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/opt/trim_capabilities_pass.h @@ -0,0 +1,191 @@ +// Copyright (c) 2023 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SOURCE_OPT_TRIM_CAPABILITIES_PASS_H_ +#define SOURCE_OPT_TRIM_CAPABILITIES_PASS_H_ + +#include +#include +#include +#include +#include +#include + +#include "source/enum_set.h" +#include "source/extensions.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" +#include "source/spirv_target_env.h" + +namespace spvtools { +namespace opt { + +// This is required for NDK build. The unordered_set/unordered_map +// implementation don't work with class enums. +struct ClassEnumHash { + std::size_t operator()(spv::Capability value) const { + using StoringType = typename std::underlying_type_t; + return std::hash{}(static_cast(value)); + } + + std::size_t operator()(spv::Op value) const { + using StoringType = typename std::underlying_type_t; + return std::hash{}(static_cast(value)); + } +}; + +// An opcode handler is a function which, given an instruction, returns either +// the required capability, or nothing. +// Each handler checks one case for a capability requirement. +// +// Example: +// - `OpTypeImage` can have operand `A` operand which requires capability 1 +// - `OpTypeImage` can also have operand `B` which requires capability 2. +// -> We have 2 handlers: `Handler_OpTypeImage_1` and +// `Handler_OpTypeImage_2`. +using OpcodeHandler = + std::optional (*)(const Instruction* instruction); + +// This pass tried to remove superfluous capabilities declared in the module. +// - If all the capabilities listed by an extension are removed, the extension +// is also trimmed. +// - If the module countains any capability listed in `kForbiddenCapabilities`, +// the module is left untouched. +// - No capabilities listed in `kUntouchableCapabilities` are trimmed, even when +// not used. +// - Only capabilitied listed in `kSupportedCapabilities` are supported. +// - If the module contains unsupported capabilities, results might be +// incorrect. +class TrimCapabilitiesPass : public Pass { + private: + // All the capabilities supported by this optimization pass. If your module + // contains unsupported instruction, the pass could yield bad results. + static constexpr std::array kSupportedCapabilities{ + // clang-format off + spv::Capability::FragmentShaderPixelInterlockEXT, + spv::Capability::FragmentShaderSampleInterlockEXT, + spv::Capability::FragmentShaderShadingRateInterlockEXT, + spv::Capability::Groups, + spv::Capability::Linkage, + spv::Capability::MinLod, + spv::Capability::Shader, + spv::Capability::ShaderClockKHR, + spv::Capability::StorageInputOutput16, + spv::Capability::StoragePushConstant16, + spv::Capability::StorageUniform16, + spv::Capability::StorageUniformBufferBlock16 + // clang-format on + }; + + // Those capabilities disable all transformation of the module. + static constexpr std::array kForbiddenCapabilities{ + spv::Capability::Linkage, + }; + + // Those capabilities are never removed from a module because we cannot + // guess from the SPIR-V only if they are required or not. + static constexpr std::array kUntouchableCapabilities{ + spv::Capability::Shader, + }; + + public: + TrimCapabilitiesPass(); + TrimCapabilitiesPass(const TrimCapabilitiesPass&) = delete; + TrimCapabilitiesPass(TrimCapabilitiesPass&&) = delete; + + private: + // Inserts every capability listed by `descriptor` this pass supports into + // `output`. Expects a Descriptor like `spv_opcode_desc_t` or + // `spv_operand_desc_t`. + template + inline void addSupportedCapabilitiesToSet(const Descriptor* const descriptor, + CapabilitySet* output) const { + const uint32_t capabilityCount = descriptor->numCapabilities; + for (uint32_t i = 0; i < capabilityCount; ++i) { + const auto capability = descriptor->capabilities[i]; + if (supportedCapabilities_.contains(capability)) { + output->insert(capability); + } + } + } + + // Inserts every extension listed by `descriptor` required by the module into + // `output`. Expects a Descriptor like `spv_opcode_desc_t` or + // `spv_operand_desc_t`. + template + inline void addSupportedExtensionsToSet(const Descriptor* const descriptor, + ExtensionSet* output) const { + if (descriptor->minVersion <= + spvVersionForTargetEnv(context()->GetTargetEnv())) { + return; + } + output->insert(descriptor->extensions, + descriptor->extensions + descriptor->numExtensions); + } + + void addInstructionRequirementsForOpcode(spv::Op opcode, + CapabilitySet* capabilities, + ExtensionSet* extensions) const; + void addInstructionRequirementsForOperand(const Operand& operand, + CapabilitySet* capabilities, + ExtensionSet* extensions) const; + + // Given an `instruction`, determines the capabilities it requires, and output + // them in `capabilities`. The returned capabilities form a subset of + // kSupportedCapabilities. + void addInstructionRequirements(Instruction* instruction, + CapabilitySet* capabilities, + ExtensionSet* extensions) const; + + // Given an operand `type` and `value`, adds the extensions it would require + // to `extensions`. + void AddExtensionsForOperand(const spv_operand_type_t type, + const uint32_t value, + ExtensionSet* extensions) const; + + // Returns the list of required capabilities and extensions for the module. + // The returned capabilities form a subset of kSupportedCapabilities. + std::pair + DetermineRequiredCapabilitiesAndExtensions() const; + + // Trims capabilities not listed in `required_capabilities` if possible. + // Returns whether or not the module was modified. + Pass::Status TrimUnrequiredCapabilities( + const CapabilitySet& required_capabilities) const; + + // Trims extensions not listed in `required_extensions` if supported by this + // pass. An extensions is considered supported as soon as one capability this + // pass support requires it. + Pass::Status TrimUnrequiredExtensions( + const ExtensionSet& required_extensions) const; + + // Returns if the analyzed module contains any forbidden capability. + bool HasForbiddenCapabilities() const; + + public: + const char* name() const override { return "trim-capabilities"; } + Status Process() override; + + private: + const CapabilitySet supportedCapabilities_; + const CapabilitySet forbiddenCapabilities_; + const CapabilitySet untouchableCapabilities_; + const std::unordered_multimap + opcodeHandlers_; +}; + +} // namespace opt +} // namespace spvtools +#endif // SOURCE_OPT_TRIM_CAPABILITIES_H_ diff --git a/bgfx/3rdparty/spirv-tools/source/opt/type_manager.cpp b/bgfx/3rdparty/spirv-tools/source/opt/type_manager.cpp index a0006f55..2dcc2594 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/type_manager.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/type_manager.cpp @@ -29,10 +29,8 @@ namespace spvtools { namespace opt { namespace analysis { namespace { - -const int kSpvTypePointerStorageClass = 1; -const int kSpvTypePointerTypeIdInIdx = 2; - +constexpr int kSpvTypePointerStorageClass = 1; +constexpr int kSpvTypePointerTypeIdInIdx = 2; } // namespace TypeManager::TypeManager(const MessageConsumer& consumer, IRContext* c) @@ -49,7 +47,7 @@ Type* TypeManager::GetType(uint32_t id) const { } std::pair> TypeManager::GetTypeAndPointerType( - uint32_t id, SpvStorageClass sc) const { + uint32_t id, spv::StorageClass sc) const { Type* type = GetType(id); if (type) { return std::make_pair(type, MakeUnique(type, sc)); @@ -180,7 +178,7 @@ void TypeManager::RemoveId(uint32_t id) { if (iter == id_to_type_.end()) return; auto& type = iter->second; - if (!type->IsUniqueType(true)) { + if (!type->IsUniqueType()) { auto tIter = type_to_id_.find(type); if (tIter != type_to_id_.end() && tIter->second == id) { // |type| currently maps to |id|. @@ -220,10 +218,10 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { RegisterType(id, *type); switch (type->kind()) { -#define DefineParameterlessCase(kind) \ - case Type::k##kind: \ - typeInst = MakeUnique(context(), SpvOpType##kind, 0, id, \ - std::initializer_list{}); \ +#define DefineParameterlessCase(kind) \ + case Type::k##kind: \ + typeInst = MakeUnique(context(), spv::Op::OpType##kind, 0, \ + id, std::initializer_list{}); \ break DefineParameterlessCase(Void); DefineParameterlessCase(Bool); @@ -236,10 +234,11 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { DefineParameterlessCase(NamedBarrier); DefineParameterlessCase(AccelerationStructureNV); DefineParameterlessCase(RayQueryKHR); + DefineParameterlessCase(HitObjectNV); #undef DefineParameterlessCase case Type::kInteger: typeInst = MakeUnique( - context(), SpvOpTypeInt, 0, id, + context(), spv::Op::OpTypeInt, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_LITERAL_INTEGER, {type->AsInteger()->width()}}, {SPV_OPERAND_TYPE_LITERAL_INTEGER, @@ -247,7 +246,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { break; case Type::kFloat: typeInst = MakeUnique( - context(), SpvOpTypeFloat, 0, id, + context(), spv::Op::OpTypeFloat, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_LITERAL_INTEGER, {type->AsFloat()->width()}}}); break; @@ -257,7 +256,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { return 0; } typeInst = - MakeUnique(context(), SpvOpTypeVector, 0, id, + MakeUnique(context(), spv::Op::OpTypeVector, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {subtype}}, {SPV_OPERAND_TYPE_LITERAL_INTEGER, @@ -270,7 +269,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { return 0; } typeInst = - MakeUnique(context(), SpvOpTypeMatrix, 0, id, + MakeUnique(context(), spv::Op::OpTypeMatrix, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {subtype}}, {SPV_OPERAND_TYPE_LITERAL_INTEGER, @@ -284,7 +283,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { return 0; } typeInst = MakeUnique( - context(), SpvOpTypeImage, 0, id, + context(), spv::Op::OpTypeImage, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {subtype}}, {SPV_OPERAND_TYPE_DIMENSIONALITY, @@ -308,7 +307,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { return 0; } typeInst = MakeUnique( - context(), SpvOpTypeSampledImage, 0, id, + context(), spv::Op::OpTypeSampledImage, 0, id, std::initializer_list{{SPV_OPERAND_TYPE_ID, {subtype}}}); break; } @@ -318,7 +317,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { return 0; } typeInst = MakeUnique( - context(), SpvOpTypeArray, 0, id, + context(), spv::Op::OpTypeArray, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {subtype}}, {SPV_OPERAND_TYPE_ID, {type->AsArray()->LengthId()}}}); @@ -331,7 +330,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { return 0; } typeInst = MakeUnique( - context(), SpvOpTypeRuntimeArray, 0, id, + context(), spv::Op::OpTypeRuntimeArray, 0, id, std::initializer_list{{SPV_OPERAND_TYPE_ID, {subtype}}}); break; } @@ -346,7 +345,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { ops.push_back(Operand(SPV_OPERAND_TYPE_ID, {member_type_id})); } typeInst = - MakeUnique(context(), SpvOpTypeStruct, 0, id, ops); + MakeUnique(context(), spv::Op::OpTypeStruct, 0, id, ops); break; } case Type::kOpaque: { @@ -354,7 +353,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { // Convert to null-terminated packed UTF-8 string. std::vector words = spvtools::utils::MakeVector(opaque->name()); typeInst = MakeUnique( - context(), SpvOpTypeOpaque, 0, id, + context(), spv::Op::OpTypeOpaque, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_LITERAL_STRING, words}}); break; @@ -366,7 +365,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { return 0; } typeInst = MakeUnique( - context(), SpvOpTypePointer, 0, id, + context(), spv::Op::OpTypePointer, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_STORAGE_CLASS, {static_cast(pointer->storage_class())}}, @@ -388,20 +387,20 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { } ops.push_back(Operand(SPV_OPERAND_TYPE_ID, {paramater_type_id})); } - typeInst = - MakeUnique(context(), SpvOpTypeFunction, 0, id, ops); + typeInst = MakeUnique(context(), spv::Op::OpTypeFunction, 0, + id, ops); break; } case Type::kPipe: typeInst = MakeUnique( - context(), SpvOpTypePipe, 0, id, + context(), spv::Op::OpTypePipe, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_ACCESS_QUALIFIER, {static_cast(type->AsPipe()->access_qualifier())}}}); break; case Type::kForwardPointer: typeInst = MakeUnique( - context(), SpvOpTypeForwardPointer, 0, 0, + context(), spv::Op::OpTypeForwardPointer, 0, 0, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {type->AsForwardPointer()->target_id()}}, {SPV_OPERAND_TYPE_STORAGE_CLASS, @@ -416,7 +415,7 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { return 0; } typeInst = MakeUnique( - context(), SpvOpTypeCooperativeMatrixNV, 0, id, + context(), spv::Op::OpTypeCooperativeMatrixNV, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {component_type}}, {SPV_OPERAND_TYPE_SCOPE_ID, {coop_mat->scope_id()}}, @@ -424,6 +423,23 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { {SPV_OPERAND_TYPE_ID, {coop_mat->columns_id()}}}); break; } + case Type::kCooperativeMatrixKHR: { + auto coop_mat = type->AsCooperativeMatrixKHR(); + uint32_t const component_type = + GetTypeInstruction(coop_mat->component_type()); + if (component_type == 0) { + return 0; + } + typeInst = MakeUnique( + context(), spv::Op::OpTypeCooperativeMatrixKHR, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {component_type}}, + {SPV_OPERAND_TYPE_SCOPE_ID, {coop_mat->scope_id()}}, + {SPV_OPERAND_TYPE_ID, {coop_mat->rows_id()}}, + {SPV_OPERAND_TYPE_ID, {coop_mat->columns_id()}}, + {SPV_OPERAND_TYPE_ID, {coop_mat->use_id()}}}); + break; + } default: assert(false && "Unexpected type"); break; @@ -435,10 +451,10 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { } uint32_t TypeManager::FindPointerToType(uint32_t type_id, - SpvStorageClass storage_class) { + spv::StorageClass storage_class) { Type* pointeeTy = GetType(type_id); Pointer pointerTy(pointeeTy, storage_class); - if (pointeeTy->IsUniqueType(true)) { + if (pointeeTy->IsUniqueType()) { // Non-ambiguous type. Get the pointer type through the type manager. return GetTypeInstruction(&pointerTy); } @@ -447,11 +463,11 @@ uint32_t TypeManager::FindPointerToType(uint32_t type_id, Module::inst_iterator type_itr = context()->module()->types_values_begin(); for (; type_itr != context()->module()->types_values_end(); ++type_itr) { const Instruction* type_inst = &*type_itr; - if (type_inst->opcode() == SpvOpTypePointer && + if (type_inst->opcode() == spv::Op::OpTypePointer && type_inst->GetSingleWordOperand(kSpvTypePointerTypeIdInIdx) == type_id && - type_inst->GetSingleWordOperand(kSpvTypePointerStorageClass) == - storage_class) + spv::StorageClass(type_inst->GetSingleWordOperand( + kSpvTypePointerStorageClass)) == storage_class) return type_inst->result_id(); } @@ -459,7 +475,7 @@ uint32_t TypeManager::FindPointerToType(uint32_t type_id, // TODO(1841): Handle id overflow. uint32_t resultId = context()->TakeNextId(); std::unique_ptr type_inst( - new Instruction(context(), SpvOpTypePointer, 0, resultId, + new Instruction(context(), spv::Op::OpTypePointer, 0, resultId, {{spv_operand_type_t::SPV_OPERAND_TYPE_STORAGE_CLASS, {uint32_t(storage_class)}}, {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {type_id}}})); @@ -476,7 +492,7 @@ void TypeManager::AttachDecorations(uint32_t id, const Type* type) { for (auto pair : structTy->element_decorations()) { uint32_t element = pair.first; for (auto vec : pair.second) { - CreateDecoration(id, vec, element); + CreateDecoration(id, vec, /* is_member */ true, element); } } } @@ -484,10 +500,10 @@ void TypeManager::AttachDecorations(uint32_t id, const Type* type) { void TypeManager::CreateDecoration(uint32_t target, const std::vector& decoration, - uint32_t element) { + bool is_member, uint32_t element) { std::vector ops; ops.push_back(Operand(SPV_OPERAND_TYPE_ID, {target})); - if (element != 0) { + if (is_member) { ops.push_back(Operand(SPV_OPERAND_TYPE_LITERAL_INTEGER, {element})); } ops.push_back(Operand(SPV_OPERAND_TYPE_DECORATION, {decoration[0]})); @@ -495,8 +511,8 @@ void TypeManager::CreateDecoration(uint32_t target, ops.push_back(Operand(SPV_OPERAND_TYPE_LITERAL_INTEGER, {decoration[i]})); } context()->AddAnnotationInst(MakeUnique( - context(), (element == 0 ? SpvOpDecorate : SpvOpMemberDecorate), 0, 0, - ops)); + context(), (is_member ? spv::Op::OpMemberDecorate : spv::Op::OpDecorate), + 0, 0, ops)); Instruction* inst = &*--context()->annotation_end(); context()->get_def_use_mgr()->AnalyzeInstUse(inst); } @@ -529,6 +545,7 @@ Type* TypeManager::RebuildType(const Type& type) { DefineNoSubtypeCase(NamedBarrier); DefineNoSubtypeCase(AccelerationStructureNV); DefineNoSubtypeCase(RayQueryKHR); + DefineNoSubtypeCase(HitObjectNV); #undef DefineNoSubtypeCase case Type::kVector: { const Vector* vec_ty = type.AsVector(); @@ -628,6 +645,14 @@ Type* TypeManager::RebuildType(const Type& type) { cm_type->columns_id()); break; } + case Type::kCooperativeMatrixKHR: { + const CooperativeMatrixKHR* cm_type = type.AsCooperativeMatrixKHR(); + const Type* component_type = cm_type->component_type(); + rebuilt_ty = MakeUnique( + RebuildType(*component_type), cm_type->scope_id(), cm_type->rows_id(), + cm_type->columns_id(), cm_type->use_id()); + break; + } default: assert(false && "Unhandled type"); return nullptr; @@ -665,46 +690,47 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { Type* type = nullptr; switch (inst.opcode()) { - case SpvOpTypeVoid: + case spv::Op::OpTypeVoid: type = new Void(); break; - case SpvOpTypeBool: + case spv::Op::OpTypeBool: type = new Bool(); break; - case SpvOpTypeInt: + case spv::Op::OpTypeInt: type = new Integer(inst.GetSingleWordInOperand(0), inst.GetSingleWordInOperand(1)); break; - case SpvOpTypeFloat: + case spv::Op::OpTypeFloat: type = new Float(inst.GetSingleWordInOperand(0)); break; - case SpvOpTypeVector: + case spv::Op::OpTypeVector: type = new Vector(GetType(inst.GetSingleWordInOperand(0)), inst.GetSingleWordInOperand(1)); break; - case SpvOpTypeMatrix: + case spv::Op::OpTypeMatrix: type = new Matrix(GetType(inst.GetSingleWordInOperand(0)), inst.GetSingleWordInOperand(1)); break; - case SpvOpTypeImage: { - const SpvAccessQualifier access = - inst.NumInOperands() < 8 - ? SpvAccessQualifierReadOnly - : static_cast(inst.GetSingleWordInOperand(7)); + case spv::Op::OpTypeImage: { + const spv::AccessQualifier access = + inst.NumInOperands() < 8 ? spv::AccessQualifier::ReadOnly + : static_cast( + inst.GetSingleWordInOperand(7)); type = new Image( GetType(inst.GetSingleWordInOperand(0)), - static_cast(inst.GetSingleWordInOperand(1)), + static_cast(inst.GetSingleWordInOperand(1)), inst.GetSingleWordInOperand(2), inst.GetSingleWordInOperand(3) == 1, inst.GetSingleWordInOperand(4) == 1, inst.GetSingleWordInOperand(5), - static_cast(inst.GetSingleWordInOperand(6)), access); + static_cast(inst.GetSingleWordInOperand(6)), + access); } break; - case SpvOpTypeSampler: + case spv::Op::OpTypeSampler: type = new Sampler(); break; - case SpvOpTypeSampledImage: + case spv::Op::OpTypeSampledImage: type = new SampledImage(GetType(inst.GetSingleWordInOperand(0))); break; - case SpvOpTypeArray: { + case spv::Op::OpTypeArray: { const uint32_t length_id = inst.GetSingleWordInOperand(1); const Instruction* length_constant_inst = id_to_constant_inst_[length_id]; assert(length_constant_inst); @@ -717,11 +743,11 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { // Only OpSpecConstant has a SpecId. uint32_t spec_id = 0u; bool has_spec_id = false; - if (length_constant_inst->opcode() == SpvOpSpecConstant) { + if (length_constant_inst->opcode() == spv::Op::OpSpecConstant) { context()->get_decoration_mgr()->ForEachDecoration( - length_id, SpvDecorationSpecId, + length_id, uint32_t(spv::Decoration::SpecId), [&spec_id, &has_spec_id](const Instruction& decoration) { - assert(decoration.opcode() == SpvOpDecorate); + assert(decoration.opcode() == spv::Op::OpDecorate); spec_id = decoration.GetSingleWordOperand(2u); has_spec_id = true; }); @@ -730,7 +756,8 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { if (has_spec_id) { extra_words.push_back(spec_id); } - if ((opcode == SpvOpConstant) || (opcode == SpvOpSpecConstant)) { + if ((opcode == spv::Op::OpConstant) || + (opcode == spv::Op::OpSpecConstant)) { // Always include the literal constant words. In the spec constant // case, the constant might not be overridden, so it's still // significant. @@ -754,7 +781,7 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { return type; } } break; - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeRuntimeArray: type = new RuntimeArray(GetType(inst.GetSingleWordInOperand(0))); if (id_to_incomplete_type_.count(inst.GetSingleWordInOperand(0))) { incomplete_types_.emplace_back(inst.result_id(), type); @@ -762,7 +789,7 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { return type; } break; - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { std::vector element_types; bool incomplete_type = false; for (uint32_t i = 0; i < inst.NumInOperands(); ++i) { @@ -780,14 +807,14 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { return type; } } break; - case SpvOpTypeOpaque: { + case spv::Op::OpTypeOpaque: { type = new Opaque(inst.GetInOperand(0).AsString()); } break; - case SpvOpTypePointer: { + case spv::Op::OpTypePointer: { uint32_t pointee_type_id = inst.GetSingleWordInOperand(1); type = new Pointer( GetType(pointee_type_id), - static_cast(inst.GetSingleWordInOperand(0))); + static_cast(inst.GetSingleWordInOperand(0))); if (id_to_incomplete_type_.count(pointee_type_id)) { incomplete_types_.emplace_back(inst.result_id(), type); @@ -797,7 +824,7 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { id_to_incomplete_type_.erase(inst.result_id()); } break; - case SpvOpTypeFunction: { + case spv::Op::OpTypeFunction: { bool incomplete_type = false; uint32_t return_type_id = inst.GetSingleWordInOperand(0); if (id_to_incomplete_type_.count(return_type_id)) { @@ -821,49 +848,58 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { return type; } } break; - case SpvOpTypeEvent: + case spv::Op::OpTypeEvent: type = new Event(); break; - case SpvOpTypeDeviceEvent: + case spv::Op::OpTypeDeviceEvent: type = new DeviceEvent(); break; - case SpvOpTypeReserveId: + case spv::Op::OpTypeReserveId: type = new ReserveId(); break; - case SpvOpTypeQueue: + case spv::Op::OpTypeQueue: type = new Queue(); break; - case SpvOpTypePipe: + case spv::Op::OpTypePipe: type = new Pipe( - static_cast(inst.GetSingleWordInOperand(0))); + static_cast(inst.GetSingleWordInOperand(0))); break; - case SpvOpTypeForwardPointer: { + case spv::Op::OpTypeForwardPointer: { // Handling of forward pointers is different from the other types. uint32_t target_id = inst.GetSingleWordInOperand(0); - type = new ForwardPointer(target_id, static_cast( + type = new ForwardPointer(target_id, static_cast( inst.GetSingleWordInOperand(1))); incomplete_types_.emplace_back(target_id, type); id_to_incomplete_type_[target_id] = type; return type; } - case SpvOpTypePipeStorage: + case spv::Op::OpTypePipeStorage: type = new PipeStorage(); break; - case SpvOpTypeNamedBarrier: + case spv::Op::OpTypeNamedBarrier: type = new NamedBarrier(); break; - case SpvOpTypeAccelerationStructureNV: + case spv::Op::OpTypeAccelerationStructureNV: type = new AccelerationStructureNV(); break; - case SpvOpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixNV: type = new CooperativeMatrixNV(GetType(inst.GetSingleWordInOperand(0)), inst.GetSingleWordInOperand(1), inst.GetSingleWordInOperand(2), inst.GetSingleWordInOperand(3)); break; - case SpvOpTypeRayQueryKHR: + case spv::Op::OpTypeCooperativeMatrixKHR: + type = new CooperativeMatrixKHR( + GetType(inst.GetSingleWordInOperand(0)), + inst.GetSingleWordInOperand(1), inst.GetSingleWordInOperand(2), + inst.GetSingleWordInOperand(3), inst.GetSingleWordInOperand(4)); + break; + case spv::Op::OpTypeRayQueryKHR: type = new RayQueryKHR(); break; + case spv::Op::OpTypeHitObjectNV: + type = new HitObjectNV(); + break; default: SPIRV_UNIMPLEMENTED(consumer_, "unhandled type"); break; @@ -886,11 +922,11 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { } void TypeManager::AttachDecoration(const Instruction& inst, Type* type) { - const SpvOp opcode = inst.opcode(); + const spv::Op opcode = inst.opcode(); if (!IsAnnotationInst(opcode)) return; switch (opcode) { - case SpvOpDecorate: { + case spv::Op::OpDecorate: { const auto count = inst.NumOperands(); std::vector data; for (uint32_t i = 1; i < count; ++i) { @@ -898,7 +934,7 @@ void TypeManager::AttachDecoration(const Instruction& inst, Type* type) { } type->AddDecoration(std::move(data)); } break; - case SpvOpMemberDecorate: { + case spv::Op::OpMemberDecorate: { const auto count = inst.NumOperands(); const uint32_t index = inst.GetSingleWordOperand(1); std::vector data; diff --git a/bgfx/3rdparty/spirv-tools/source/opt/type_manager.h b/bgfx/3rdparty/spirv-tools/source/opt/type_manager.h index 72e37f48..a70c371d 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/type_manager.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/type_manager.h @@ -99,7 +99,7 @@ class TypeManager { // // |id| must be a registered type. std::pair> GetTypeAndPointerType( - uint32_t id, SpvStorageClass sc) const; + uint32_t id, spv::StorageClass sc) const; // Returns an id for a declaration representing |type|. Returns 0 if the type // does not exists, and could not be generated. @@ -112,7 +112,7 @@ class TypeManager { // Find pointer to type and storage in module, return its resultId. If it is // not found, a new type is created, and its id is returned. Returns 0 if the // type could not be created. - uint32_t FindPointerToType(uint32_t type_id, SpvStorageClass storage_class); + uint32_t FindPointerToType(uint32_t type_id, spv::StorageClass storage_class); // Registers |id| to |type|. // @@ -139,18 +139,22 @@ class TypeManager { const Type* GetMemberType(const Type* parent_type, const std::vector& access_chain); - Type* GetUIntType() { - Integer int_type(32, false); - return GetRegisteredType(&int_type); - } + // Attaches the decoration encoded in |inst| to |type|. Does nothing if the + // given instruction is not a decoration instruction. Assumes the target is + // |type| (e.g. should be called in loop of |type|'s decorations). + void AttachDecoration(const Instruction& inst, Type* type); + + Type* GetUIntType() { return GetIntType(32, false); } uint32_t GetUIntTypeId() { return GetTypeInstruction(GetUIntType()); } - Type* GetSIntType() { - Integer int_type(32, true); + Type* GetIntType(int32_t bitWidth, bool isSigned) { + Integer int_type(bitWidth, isSigned); return GetRegisteredType(&int_type); } + Type* GetSIntType() { return GetIntType(32, true); } + uint32_t GetSIntTypeId() { return GetTypeInstruction(GetSIntType()); } Type* GetFloatType() { @@ -243,19 +247,15 @@ class TypeManager { // Create the annotation instruction. // - // If |element| is zero, an OpDecorate is created, other an OpMemberDecorate - // is created. The annotation is registered with the DefUseManager and the - // DecorationManager. + // If |is_member| is false, an OpDecorate of |decoration| on |id| is created, + // otherwise an OpMemberDecorate is created at |element|. The annotation is + // registered with the DefUseManager and the DecorationManager. void CreateDecoration(uint32_t id, const std::vector& decoration, - uint32_t element = 0); + bool is_member = false, uint32_t element = 0); // Creates and returns a type from the given SPIR-V |inst|. Returns nullptr if // the given instruction is not for defining a type. Type* RecordIfTypeDefinition(const Instruction& inst); - // Attaches the decoration encoded in |inst| to |type|. Does nothing if the - // given instruction is not a decoration instruction. Assumes the target is - // |type| (e.g. should be called in loop of |type|'s decorations). - void AttachDecoration(const Instruction& inst, Type* type); // Returns an equivalent pointer to |type| built in terms of pointers owned by // |type_pool_|. For example, if |type| is a vec3 of bool, it will be rebuilt diff --git a/bgfx/3rdparty/spirv-tools/source/opt/types.cpp b/bgfx/3rdparty/spirv-tools/source/opt/types.cpp index 056acebb..b18b8cb1 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/types.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/types.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include #include @@ -24,7 +23,6 @@ #include "source/util/hash_combine.h" #include "source/util/make_unique.h" -#include "spirv/unified1/spirv.h" namespace spvtools { namespace opt { @@ -65,7 +63,7 @@ bool CompareTwoVectors(const U32VecVec a, const U32VecVec b) { return true; } -} // anonymous namespace +} // namespace std::string Type::GetDecorationStr() const { std::ostringstream oss; @@ -86,10 +84,9 @@ bool Type::HasSameDecorations(const Type* that) const { return CompareTwoVectors(decorations_, that->decorations_); } -bool Type::IsUniqueType(bool allowVariablePointers) const { +bool Type::IsUniqueType() const { switch (kind_) { case kPointer: - return !allowVariablePointers; case kStruct: case kArray: case kRuntimeArray: @@ -131,7 +128,9 @@ std::unique_ptr Type::Clone() const { DeclareKindCase(NamedBarrier); DeclareKindCase(AccelerationStructureNV); DeclareKindCase(CooperativeMatrixNV); + DeclareKindCase(CooperativeMatrixKHR); DeclareKindCase(RayQueryKHR); + DeclareKindCase(HitObjectNV); #undef DeclareKindCase default: assert(false && "Unhandled type"); @@ -177,7 +176,9 @@ bool Type::operator==(const Type& other) const { DeclareKindCase(NamedBarrier); DeclareKindCase(AccelerationStructureNV); DeclareKindCase(CooperativeMatrixNV); + DeclareKindCase(CooperativeMatrixKHR); DeclareKindCase(RayQueryKHR); + DeclareKindCase(HitObjectNV); #undef DeclareKindCase default: assert(false && "Unhandled type"); @@ -231,7 +232,9 @@ size_t Type::ComputeHashValue(size_t hash, SeenTypes* seen) const { DeclareKindCase(NamedBarrier); DeclareKindCase(AccelerationStructureNV); DeclareKindCase(CooperativeMatrixNV); + DeclareKindCase(CooperativeMatrixKHR); DeclareKindCase(RayQueryKHR); + DeclareKindCase(HitObjectNV); #undef DeclareKindCase default: assert(false && "Unhandled type"); @@ -357,8 +360,9 @@ size_t Matrix::ComputeExtraStateHash(size_t hash, SeenTypes* seen) const { return element_type_->ComputeHashValue(hash, seen); } -Image::Image(Type* type, SpvDim dimen, uint32_t d, bool array, bool multisample, - uint32_t sampling, SpvImageFormat f, SpvAccessQualifier qualifier) +Image::Image(Type* type, spv::Dim dimen, uint32_t d, bool array, + bool multisample, uint32_t sampling, spv::ImageFormat f, + spv::AccessQualifier qualifier) : Type(kImage), sampled_type_(type), dim_(dimen), @@ -383,9 +387,9 @@ bool Image::IsSameImpl(const Type* that, IsSameCache* seen) const { std::string Image::str() const { std::ostringstream oss; - oss << "image(" << sampled_type_->str() << ", " << dim_ << ", " << depth_ - << ", " << arrayed_ << ", " << ms_ << ", " << sampled_ << ", " << format_ - << ", " << access_qualifier_ << ")"; + oss << "image(" << sampled_type_->str() << ", " << uint32_t(dim_) << ", " + << depth_ << ", " << arrayed_ << ", " << ms_ << ", " << sampled_ << ", " + << uint32_t(format_) << ", " << uint32_t(access_qualifier_) << ")"; return oss.str(); } @@ -557,7 +561,7 @@ size_t Opaque::ComputeExtraStateHash(size_t hash, SeenTypes*) const { return hash_combine(hash, name_); } -Pointer::Pointer(const Type* type, SpvStorageClass sc) +Pointer::Pointer(const Type* type, spv::StorageClass sc) : Type(kPointer), pointee_type_(type), storage_class_(sc) {} bool Pointer::IsSameImpl(const Type* that, IsSameCache* seen) const { @@ -636,7 +640,7 @@ bool Pipe::IsSameImpl(const Type* that, IsSameCache*) const { std::string Pipe::str() const { std::ostringstream oss; - oss << "pipe(" << access_qualifier_ << ")"; + oss << "pipe(" << uint32_t(access_qualifier_) << ")"; return oss.str(); } @@ -707,6 +711,45 @@ bool CooperativeMatrixNV::IsSameImpl(const Type* that, columns_id_ == mt->columns_id_ && HasSameDecorations(that); } +CooperativeMatrixKHR::CooperativeMatrixKHR(const Type* type, + const uint32_t scope, + const uint32_t rows, + const uint32_t columns, + const uint32_t use) + : Type(kCooperativeMatrixKHR), + component_type_(type), + scope_id_(scope), + rows_id_(rows), + columns_id_(columns), + use_id_(use) { + assert(type != nullptr); + assert(scope != 0); + assert(rows != 0); + assert(columns != 0); +} + +std::string CooperativeMatrixKHR::str() const { + std::ostringstream oss; + oss << "<" << component_type_->str() << ", " << scope_id_ << ", " << rows_id_ + << ", " << columns_id_ << ", " << use_id_ << ">"; + return oss.str(); +} + +size_t CooperativeMatrixKHR::ComputeExtraStateHash(size_t hash, + SeenTypes* seen) const { + hash = hash_combine(hash, scope_id_, rows_id_, columns_id_, use_id_); + return component_type_->ComputeHashValue(hash, seen); +} + +bool CooperativeMatrixKHR::IsSameImpl(const Type* that, + IsSameCache* seen) const { + const CooperativeMatrixKHR* mt = that->AsCooperativeMatrixKHR(); + if (!mt) return false; + return component_type_->IsSameImpl(mt->component_type_, seen) && + scope_id_ == mt->scope_id_ && rows_id_ == mt->rows_id_ && + columns_id_ == mt->columns_id_ && HasSameDecorations(that); +} + } // namespace analysis } // namespace opt } // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/opt/types.h b/bgfx/3rdparty/spirv-tools/source/opt/types.h index a92669e9..16a948ce 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/types.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/types.h @@ -60,7 +60,9 @@ class PipeStorage; class NamedBarrier; class AccelerationStructureNV; class CooperativeMatrixNV; +class CooperativeMatrixKHR; class RayQueryKHR; +class HitObjectNV; // Abstract class for a SPIR-V type. It has a bunch of As() methods, // which is used as a way to probe the actual . @@ -99,7 +101,9 @@ class Type { kNamedBarrier, kAccelerationStructureNV, kCooperativeMatrixNV, + kCooperativeMatrixKHR, kRayQueryKHR, + kHitObjectNV, kLast }; @@ -146,12 +150,16 @@ class Type { // Returns a clone of |this| minus any decorations. std::unique_ptr RemoveDecorations() const; - // Returns true if this type must be unique. + // Returns true if this cannot hash to the same value as another type in the + // module. For example, structs are not unique types because the module could + // have two types // - // If variable pointers are allowed, then pointers are not required to be - // unique. - // TODO(alanbaker): Update this if variable pointers become a core feature. - bool IsUniqueType(bool allowVariablePointers = false) const; + // %1 = OpTypeStruct %int + // %2 = OpTypeStruct %int + // + // The only way to distinguish these types is the result id. The type manager + // will hash them to the same value. + bool IsUniqueType() const; bool operator==(const Type& other) const; @@ -195,7 +203,9 @@ class Type { DeclareCastMethod(NamedBarrier) DeclareCastMethod(AccelerationStructureNV) DeclareCastMethod(CooperativeMatrixNV) + DeclareCastMethod(CooperativeMatrixKHR) DeclareCastMethod(RayQueryKHR) + DeclareCastMethod(HitObjectNV) #undef DeclareCastMethod protected: @@ -302,9 +312,9 @@ class Matrix : public Type { class Image : public Type { public: - Image(Type* type, SpvDim dimen, uint32_t d, bool array, bool multisample, - uint32_t sampling, SpvImageFormat f, - SpvAccessQualifier qualifier = SpvAccessQualifierReadOnly); + Image(Type* type, spv::Dim dimen, uint32_t d, bool array, bool multisample, + uint32_t sampling, spv::ImageFormat f, + spv::AccessQualifier qualifier = spv::AccessQualifier::ReadOnly); Image(const Image&) = default; std::string str() const override; @@ -313,13 +323,13 @@ class Image : public Type { const Image* AsImage() const override { return this; } const Type* sampled_type() const { return sampled_type_; } - SpvDim dim() const { return dim_; } + spv::Dim dim() const { return dim_; } uint32_t depth() const { return depth_; } bool is_arrayed() const { return arrayed_; } bool is_multisampled() const { return ms_; } uint32_t sampled() const { return sampled_; } - SpvImageFormat format() const { return format_; } - SpvAccessQualifier access_qualifier() const { return access_qualifier_; } + spv::ImageFormat format() const { return format_; } + spv::AccessQualifier access_qualifier() const { return access_qualifier_; } size_t ComputeExtraStateHash(size_t hash, SeenTypes* seen) const override; @@ -327,13 +337,13 @@ class Image : public Type { bool IsSameImpl(const Type* that, IsSameCache*) const override; Type* sampled_type_; - SpvDim dim_; + spv::Dim dim_; uint32_t depth_; bool arrayed_; bool ms_; uint32_t sampled_; - SpvImageFormat format_; - SpvAccessQualifier access_qualifier_; + spv::ImageFormat format_; + spv::AccessQualifier access_qualifier_; }; class SampledImage : public Type { @@ -491,12 +501,12 @@ class Opaque : public Type { class Pointer : public Type { public: - Pointer(const Type* pointee, SpvStorageClass sc); + Pointer(const Type* pointee, spv::StorageClass sc); Pointer(const Pointer&) = default; std::string str() const override; const Type* pointee_type() const { return pointee_type_; } - SpvStorageClass storage_class() const { return storage_class_; } + spv::StorageClass storage_class() const { return storage_class_; } Pointer* AsPointer() override { return this; } const Pointer* AsPointer() const override { return this; } @@ -509,7 +519,7 @@ class Pointer : public Type { bool IsSameImpl(const Type* that, IsSameCache*) const override; const Type* pointee_type_; - SpvStorageClass storage_class_; + spv::StorageClass storage_class_; }; class Function : public Type { @@ -540,7 +550,7 @@ class Function : public Type { class Pipe : public Type { public: - Pipe(SpvAccessQualifier qualifier) + Pipe(spv::AccessQualifier qualifier) : Type(kPipe), access_qualifier_(qualifier) {} Pipe(const Pipe&) = default; @@ -549,19 +559,19 @@ class Pipe : public Type { Pipe* AsPipe() override { return this; } const Pipe* AsPipe() const override { return this; } - SpvAccessQualifier access_qualifier() const { return access_qualifier_; } + spv::AccessQualifier access_qualifier() const { return access_qualifier_; } size_t ComputeExtraStateHash(size_t hash, SeenTypes* seen) const override; private: bool IsSameImpl(const Type* that, IsSameCache*) const override; - SpvAccessQualifier access_qualifier_; + spv::AccessQualifier access_qualifier_; }; class ForwardPointer : public Type { public: - ForwardPointer(uint32_t id, SpvStorageClass sc) + ForwardPointer(uint32_t id, spv::StorageClass sc) : Type(kForwardPointer), target_id_(id), storage_class_(sc), @@ -570,7 +580,7 @@ class ForwardPointer : public Type { uint32_t target_id() const { return target_id_; } void SetTargetPointer(const Pointer* pointer) { pointer_ = pointer; } - SpvStorageClass storage_class() const { return storage_class_; } + spv::StorageClass storage_class() const { return storage_class_; } const Pointer* target_pointer() const { return pointer_; } std::string str() const override; @@ -584,7 +594,7 @@ class ForwardPointer : public Type { bool IsSameImpl(const Type* that, IsSameCache*) const override; uint32_t target_id_; - SpvStorageClass storage_class_; + spv::StorageClass storage_class_; const Pointer* pointer_; }; @@ -617,6 +627,38 @@ class CooperativeMatrixNV : public Type { const uint32_t columns_id_; }; +class CooperativeMatrixKHR : public Type { + public: + CooperativeMatrixKHR(const Type* type, const uint32_t scope, + const uint32_t rows, const uint32_t columns, + const uint32_t use); + CooperativeMatrixKHR(const CooperativeMatrixKHR&) = default; + + std::string str() const override; + + CooperativeMatrixKHR* AsCooperativeMatrixKHR() override { return this; } + const CooperativeMatrixKHR* AsCooperativeMatrixKHR() const override { + return this; + } + + size_t ComputeExtraStateHash(size_t hash, SeenTypes* seen) const override; + + const Type* component_type() const { return component_type_; } + uint32_t scope_id() const { return scope_id_; } + uint32_t rows_id() const { return rows_id_; } + uint32_t columns_id() const { return columns_id_; } + uint32_t use_id() const { return use_id_; } + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + const Type* component_type_; + const uint32_t scope_id_; + const uint32_t rows_id_; + const uint32_t columns_id_; + const uint32_t use_id_; +}; + #define DefineParameterlessType(type, name) \ class type : public Type { \ public: \ @@ -648,6 +690,7 @@ DefineParameterlessType(PipeStorage, pipe_storage); DefineParameterlessType(NamedBarrier, named_barrier); DefineParameterlessType(AccelerationStructureNV, accelerationStructureNV); DefineParameterlessType(RayQueryKHR, rayQueryKHR); +DefineParameterlessType(HitObjectNV, hitObjectNV); #undef DefineParameterlessType } // namespace analysis diff --git a/bgfx/3rdparty/spirv-tools/source/opt/unify_const_pass.cpp b/bgfx/3rdparty/spirv-tools/source/opt/unify_const_pass.cpp index 6bfa11a5..83dd438b 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/unify_const_pass.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/unify_const_pass.cpp @@ -20,12 +20,10 @@ #include #include "source/opt/def_use_manager.h" -#include "source/opt/ir_context.h" #include "source/util/make_unique.h" namespace spvtools { namespace opt { - namespace { // The trie that stores a bunch of result ids and, for a given instruction, @@ -103,7 +101,7 @@ class ResultIdTrie { std::unique_ptr root_; // The root node of the trie. }; -} // anonymous namespace +} // namespace Pass::Status UnifyConstantPass::Process() { bool modified = false; @@ -139,12 +137,12 @@ Pass::Status UnifyConstantPass::Process() { // processing is up to a descendant. This makes comparing the key array // always valid for judging duplication. switch (inst->opcode()) { - case SpvOp::SpvOpConstantTrue: - case SpvOp::SpvOpConstantFalse: - case SpvOp::SpvOpConstant: - case SpvOp::SpvOpConstantNull: - case SpvOp::SpvOpConstantSampler: - case SpvOp::SpvOpConstantComposite: + case spv::Op::OpConstantTrue: + case spv::Op::OpConstantFalse: + case spv::Op::OpConstant: + case spv::Op::OpConstantNull: + case spv::Op::OpConstantSampler: + case spv::Op::OpConstantComposite: // Only spec constants defined with OpSpecConstantOp and // OpSpecConstantComposite should be processed in this pass. Spec // constants defined with OpSpecConstant{|True|False} are decorated with @@ -154,8 +152,8 @@ Pass::Status UnifyConstantPass::Process() { // unique. When all the operands/components are the same between two // OpSpecConstant{Op|Composite} results, their result values must be the // same so are unifiable. - case SpvOp::SpvOpSpecConstantOp: - case SpvOp::SpvOpSpecConstantComposite: { + case spv::Op::OpSpecConstantOp: + case spv::Op::OpSpecConstantComposite: { uint32_t id = defined_constants.LookupEquivalentResultFor(*inst); if (id != inst->result_id()) { // The constant is a duplicated one, use the cached constant to diff --git a/bgfx/3rdparty/spirv-tools/source/opt/upgrade_memory_model.cpp b/bgfx/3rdparty/spirv-tools/source/opt/upgrade_memory_model.cpp index 9d6a5bce..1b439a6e 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/upgrade_memory_model.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/upgrade_memory_model.cpp @@ -28,14 +28,16 @@ namespace opt { Pass::Status UpgradeMemoryModel::Process() { // TODO: This pass needs changes to support cooperative matrices. if (context()->get_feature_mgr()->HasCapability( - SpvCapabilityCooperativeMatrixNV)) { + spv::Capability::CooperativeMatrixNV)) { return Pass::Status::SuccessWithoutChange; } // Only update Logical GLSL450 to Logical VulkanKHR. Instruction* memory_model = get_module()->GetMemoryModel(); - if (memory_model->GetSingleWordInOperand(0u) != SpvAddressingModelLogical || - memory_model->GetSingleWordInOperand(1u) != SpvMemoryModelGLSL450) { + if (memory_model->GetSingleWordInOperand(0u) != + uint32_t(spv::AddressingModel::Logical) || + memory_model->GetSingleWordInOperand(1u) != + uint32_t(spv::MemoryModel::GLSL450)) { return Pass::Status::SuccessWithoutChange; } @@ -55,16 +57,17 @@ void UpgradeMemoryModel::UpgradeMemoryModelInstruction() { // 3. Modify the memory model. Instruction* memory_model = get_module()->GetMemoryModel(); context()->AddCapability(MakeUnique( - context(), SpvOpCapability, 0, 0, + context(), spv::Op::OpCapability, 0, 0, std::initializer_list{ - {SPV_OPERAND_TYPE_CAPABILITY, {SpvCapabilityVulkanMemoryModelKHR}}})); + {SPV_OPERAND_TYPE_CAPABILITY, + {uint32_t(spv::Capability::VulkanMemoryModelKHR)}}})); const std::string extension = "SPV_KHR_vulkan_memory_model"; std::vector words = spvtools::utils::MakeVector(extension); context()->AddExtension( - MakeUnique(context(), SpvOpExtension, 0, 0, + MakeUnique(context(), spv::Op::OpExtension, 0, 0, std::initializer_list{ {SPV_OPERAND_TYPE_LITERAL_STRING, words}})); - memory_model->SetInOperand(1u, {SpvMemoryModelVulkanKHR}); + memory_model->SetInOperand(1u, {uint32_t(spv::MemoryModel::VulkanKHR)}); } void UpgradeMemoryModel::UpgradeInstructions() { @@ -79,7 +82,7 @@ void UpgradeMemoryModel::UpgradeInstructions() { // In SPIR-V 1.4 or later, normalize OpCopyMemory* access operands. for (auto& func : *get_module()) { func.ForEachInst([this](Instruction* inst) { - if (inst->opcode() == SpvOpExtInst) { + if (inst->opcode() == spv::Op::OpExtInst) { auto ext_inst = inst->GetSingleWordInOperand(1u); if (ext_inst == GLSLstd450Modf || ext_inst == GLSLstd450Frexp) { auto import = @@ -89,9 +92,10 @@ void UpgradeMemoryModel::UpgradeInstructions() { } } } else if (get_module()->version() >= SPV_SPIRV_VERSION_WORD(1, 4)) { - if (inst->opcode() == SpvOpCopyMemory || - inst->opcode() == SpvOpCopyMemorySized) { - uint32_t start_operand = inst->opcode() == SpvOpCopyMemory ? 2u : 3u; + if (inst->opcode() == spv::Op::OpCopyMemory || + inst->opcode() == spv::Op::OpCopyMemorySized) { + uint32_t start_operand = + inst->opcode() == spv::Op::OpCopyMemory ? 2u : 3u; if (inst->NumInOperands() > start_operand) { auto num_access_words = MemoryAccessNumWords( inst->GetSingleWordInOperand(start_operand)); @@ -105,10 +109,10 @@ void UpgradeMemoryModel::UpgradeInstructions() { } } else { // Add two memory access operands. - inst->AddOperand( - {SPV_OPERAND_TYPE_MEMORY_ACCESS, {SpvMemoryAccessMaskNone}}); - inst->AddOperand( - {SPV_OPERAND_TYPE_MEMORY_ACCESS, {SpvMemoryAccessMaskNone}}); + inst->AddOperand({SPV_OPERAND_TYPE_MEMORY_ACCESS, + {uint32_t(spv::MemoryAccessMask::MaskNone)}}); + inst->AddOperand({SPV_OPERAND_TYPE_MEMORY_ACCESS, + {uint32_t(spv::MemoryAccessMask::MaskNone)}}); } } } @@ -129,23 +133,23 @@ void UpgradeMemoryModel::UpgradeMemoryAndImages() { bool dst_coherent = false; bool dst_volatile = false; uint32_t start_operand = 0u; - SpvScope scope = SpvScopeQueueFamilyKHR; - SpvScope src_scope = SpvScopeQueueFamilyKHR; - SpvScope dst_scope = SpvScopeQueueFamilyKHR; + spv::Scope scope = spv::Scope::QueueFamilyKHR; + spv::Scope src_scope = spv::Scope::QueueFamilyKHR; + spv::Scope dst_scope = spv::Scope::QueueFamilyKHR; switch (inst->opcode()) { - case SpvOpLoad: - case SpvOpStore: + case spv::Op::OpLoad: + case spv::Op::OpStore: std::tie(is_coherent, is_volatile, scope) = GetInstructionAttributes(inst->GetSingleWordInOperand(0u)); break; - case SpvOpImageRead: - case SpvOpImageSparseRead: - case SpvOpImageWrite: + case spv::Op::OpImageRead: + case spv::Op::OpImageSparseRead: + case spv::Op::OpImageWrite: std::tie(is_coherent, is_volatile, scope) = GetInstructionAttributes(inst->GetSingleWordInOperand(0u)); break; - case SpvOpCopyMemory: - case SpvOpCopyMemorySized: + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyMemorySized: std::tie(dst_coherent, dst_volatile, dst_scope) = GetInstructionAttributes(inst->GetSingleWordInOperand(0u)); std::tie(src_coherent, src_volatile, src_scope) = @@ -156,17 +160,17 @@ void UpgradeMemoryModel::UpgradeMemoryAndImages() { } switch (inst->opcode()) { - case SpvOpLoad: + case spv::Op::OpLoad: UpgradeFlags(inst, 1u, is_coherent, is_volatile, kVisibility, kMemory); break; - case SpvOpStore: + case spv::Op::OpStore: UpgradeFlags(inst, 2u, is_coherent, is_volatile, kAvailability, kMemory); break; - case SpvOpCopyMemory: - case SpvOpCopyMemorySized: - start_operand = inst->opcode() == SpvOpCopyMemory ? 2u : 3u; + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyMemorySized: + start_operand = inst->opcode() == spv::Op::OpCopyMemory ? 2u : 3u; if (get_module()->version() >= SPV_SPIRV_VERSION_WORD(1, 4)) { // There are guaranteed to be two memory access operands at this // point so treat source and target separately. @@ -183,11 +187,11 @@ void UpgradeMemoryModel::UpgradeMemoryAndImages() { kVisibility, kMemory); } break; - case SpvOpImageRead: - case SpvOpImageSparseRead: + case spv::Op::OpImageRead: + case spv::Op::OpImageSparseRead: UpgradeFlags(inst, 2u, is_coherent, is_volatile, kVisibility, kImage); break; - case SpvOpImageWrite: + case spv::Op::OpImageWrite: UpgradeFlags(inst, 3u, is_coherent, is_volatile, kAvailability, kImage); break; @@ -205,7 +209,7 @@ void UpgradeMemoryModel::UpgradeMemoryAndImages() { // There are two memory access operands. The first is for the target and // the second is for the source. if (dst_coherent || src_coherent) { - start_operand = inst->opcode() == SpvOpCopyMemory ? 2u : 3u; + start_operand = inst->opcode() == spv::Op::OpCopyMemory ? 2u : 3u; std::vector new_operands; uint32_t num_access_words = MemoryAccessNumWords(inst->GetSingleWordInOperand(start_operand)); @@ -255,13 +259,13 @@ void UpgradeMemoryModel::UpgradeAtomics() { if (spvOpcodeIsAtomicOp(inst->opcode())) { bool unused_coherent = false; bool is_volatile = false; - SpvScope unused_scope = SpvScopeQueueFamilyKHR; + spv::Scope unused_scope = spv::Scope::QueueFamilyKHR; std::tie(unused_coherent, is_volatile, unused_scope) = GetInstructionAttributes(inst->GetSingleWordInOperand(0)); UpgradeSemantics(inst, 2u, is_volatile); - if (inst->opcode() == SpvOpAtomicCompareExchange || - inst->opcode() == SpvOpAtomicCompareExchangeWeak) { + if (inst->opcode() == spv::Op::OpAtomicCompareExchange || + inst->opcode() == spv::Op::OpAtomicCompareExchangeWeak) { UpgradeSemantics(inst, 3u, is_volatile); } } @@ -286,14 +290,14 @@ void UpgradeMemoryModel::UpgradeSemantics(Instruction* inst, value = constant->GetU32(); } - value |= SpvMemorySemanticsVolatileMask; + value |= uint32_t(spv::MemorySemanticsMask::Volatile); auto new_constant = context()->get_constant_mgr()->GetConstant(type, {value}); auto new_semantics = context()->get_constant_mgr()->GetDefiningInstruction(new_constant); inst->SetInOperand(in_operand, {new_semantics->result_id()}); } -std::tuple UpgradeMemoryModel::GetInstructionAttributes( +std::tuple UpgradeMemoryModel::GetInstructionAttributes( uint32_t id) { // |id| is a pointer used in a memory/image instruction. Need to determine if // that pointer points to volatile or coherent memory. Workgroup storage @@ -302,8 +306,8 @@ std::tuple UpgradeMemoryModel::GetInstructionAttributes( Instruction* inst = context()->get_def_use_mgr()->GetDef(id); analysis::Type* type = context()->get_type_mgr()->GetType(inst->type_id()); if (type->AsPointer() && - type->AsPointer()->storage_class() == SpvStorageClassWorkgroup) { - return std::make_tuple(true, false, SpvScopeWorkgroup); + type->AsPointer()->storage_class() == spv::StorageClass::Workgroup) { + return std::make_tuple(true, false, spv::Scope::Workgroup); } bool is_coherent = false; @@ -313,7 +317,7 @@ std::tuple UpgradeMemoryModel::GetInstructionAttributes( TraceInstruction(context()->get_def_use_mgr()->GetDef(id), std::vector(), &visited); - return std::make_tuple(is_coherent, is_volatile, SpvScopeQueueFamilyKHR); + return std::make_tuple(is_coherent, is_volatile, spv::Scope::QueueFamilyKHR); } std::pair UpgradeMemoryModel::TraceInstruction( @@ -336,10 +340,10 @@ std::pair UpgradeMemoryModel::TraceInstruction( bool is_coherent = false; bool is_volatile = false; switch (inst->opcode()) { - case SpvOpVariable: - case SpvOpFunctionParameter: - is_coherent |= HasDecoration(inst, 0, SpvDecorationCoherent); - is_volatile |= HasDecoration(inst, 0, SpvDecorationVolatile); + case spv::Op::OpVariable: + case spv::Op::OpFunctionParameter: + is_coherent |= HasDecoration(inst, 0, spv::Decoration::Coherent); + is_volatile |= HasDecoration(inst, 0, spv::Decoration::Volatile); if (!is_coherent || !is_volatile) { bool type_coherent = false; bool type_volatile = false; @@ -349,14 +353,14 @@ std::pair UpgradeMemoryModel::TraceInstruction( is_volatile |= type_volatile; } break; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: // Store indices in reverse order. for (uint32_t i = inst->NumInOperands() - 1; i > 0; --i) { indices.push_back(inst->GetSingleWordInOperand(i)); } break; - case SpvOpPtrAccessChain: + case spv::Op::OpPtrAccessChain: // Store indices in reverse order. Skip the |Element| operand. for (uint32_t i = inst->NumInOperands() - 1; i > 1; --i) { indices.push_back(inst->GetSingleWordInOperand(i)); @@ -375,8 +379,8 @@ std::pair UpgradeMemoryModel::TraceInstruction( // Variables and function parameters are sources. Continue searching until we // reach them. - if (inst->opcode() != SpvOpVariable && - inst->opcode() != SpvOpFunctionParameter) { + if (inst->opcode() != spv::Op::OpVariable && + inst->opcode() != spv::Op::OpFunctionParameter) { inst->ForEachInId([this, &is_coherent, &is_volatile, &indices, &visited](const uint32_t* id_ptr) { Instruction* op_inst = context()->get_def_use_mgr()->GetDef(*id_ptr); @@ -404,24 +408,24 @@ std::pair UpgradeMemoryModel::CheckType( bool is_coherent = false; bool is_volatile = false; Instruction* type_inst = context()->get_def_use_mgr()->GetDef(type_id); - assert(type_inst->opcode() == SpvOpTypePointer); + assert(type_inst->opcode() == spv::Op::OpTypePointer); Instruction* element_inst = context()->get_def_use_mgr()->GetDef( type_inst->GetSingleWordInOperand(1u)); for (int i = (int)indices.size() - 1; i >= 0; --i) { if (is_coherent && is_volatile) break; - if (element_inst->opcode() == SpvOpTypePointer) { + if (element_inst->opcode() == spv::Op::OpTypePointer) { element_inst = context()->get_def_use_mgr()->GetDef( element_inst->GetSingleWordInOperand(1u)); - } else if (element_inst->opcode() == SpvOpTypeStruct) { + } else if (element_inst->opcode() == spv::Op::OpTypeStruct) { uint32_t index = indices.at(i); Instruction* index_inst = context()->get_def_use_mgr()->GetDef(index); - assert(index_inst->opcode() == SpvOpConstant); + assert(index_inst->opcode() == spv::Op::OpConstant); uint64_t value = GetIndexValue(index_inst); is_coherent |= HasDecoration(element_inst, static_cast(value), - SpvDecorationCoherent); + spv::Decoration::Coherent); is_volatile |= HasDecoration(element_inst, static_cast(value), - SpvDecorationVolatile); + spv::Decoration::Volatile); element_inst = context()->get_def_use_mgr()->GetDef( element_inst->GetSingleWordInOperand(static_cast(value))); } else { @@ -457,13 +461,13 @@ std::pair UpgradeMemoryModel::CheckAllTypes( if (!visited.insert(def).second) continue; - if (def->opcode() == SpvOpTypeStruct) { + if (def->opcode() == spv::Op::OpTypeStruct) { // Any member decorated with coherent and/or volatile is enough to have // the related operation be flagged as coherent and/or volatile. is_coherent |= HasDecoration(def, std::numeric_limits::max(), - SpvDecorationCoherent); + spv::Decoration::Coherent); is_volatile |= HasDecoration(def, std::numeric_limits::max(), - SpvDecorationVolatile); + spv::Decoration::Volatile); if (is_coherent && is_volatile) return std::make_pair(is_coherent, is_volatile); @@ -475,7 +479,7 @@ std::pair UpgradeMemoryModel::CheckAllTypes( } else if (spvOpcodeIsComposite(def->opcode())) { stack.push_back(context()->get_def_use_mgr()->GetDef( def->GetSingleWordInOperand(0u))); - } else if (def->opcode() == SpvOpTypePointer) { + } else if (def->opcode() == spv::Op::OpTypePointer) { stack.push_back(context()->get_def_use_mgr()->GetDef( def->GetSingleWordInOperand(1u))); } @@ -504,14 +508,15 @@ uint64_t UpgradeMemoryModel::GetIndexValue(Instruction* index_inst) { } bool UpgradeMemoryModel::HasDecoration(const Instruction* inst, uint32_t value, - SpvDecoration decoration) { + spv::Decoration decoration) { // If the iteration was terminated early then an appropriate decoration was // found. return !context()->get_decoration_mgr()->WhileEachDecoration( - inst->result_id(), decoration, [value](const Instruction& i) { - if (i.opcode() == SpvOpDecorate || i.opcode() == SpvOpDecorateId) { + inst->result_id(), (uint32_t)decoration, [value](const Instruction& i) { + if (i.opcode() == spv::Op::OpDecorate || + i.opcode() == spv::Op::OpDecorateId) { return false; - } else if (i.opcode() == SpvOpMemberDecorate) { + } else if (i.opcode() == spv::Op::OpMemberDecorate) { if (value == i.GetSingleWordInOperand(1u) || value == std::numeric_limits::max()) return false; @@ -533,27 +538,27 @@ void UpgradeMemoryModel::UpgradeFlags(Instruction* inst, uint32_t in_operand, } if (is_coherent) { if (inst_type == kMemory) { - flags |= SpvMemoryAccessNonPrivatePointerKHRMask; + flags |= uint32_t(spv::MemoryAccessMask::NonPrivatePointerKHR); if (operation_type == kVisibility) { - flags |= SpvMemoryAccessMakePointerVisibleKHRMask; + flags |= uint32_t(spv::MemoryAccessMask::MakePointerVisibleKHR); } else { - flags |= SpvMemoryAccessMakePointerAvailableKHRMask; + flags |= uint32_t(spv::MemoryAccessMask::MakePointerAvailableKHR); } } else { - flags |= SpvImageOperandsNonPrivateTexelKHRMask; + flags |= uint32_t(spv::ImageOperandsMask::NonPrivateTexelKHR); if (operation_type == kVisibility) { - flags |= SpvImageOperandsMakeTexelVisibleKHRMask; + flags |= uint32_t(spv::ImageOperandsMask::MakeTexelVisibleKHR); } else { - flags |= SpvImageOperandsMakeTexelAvailableKHRMask; + flags |= uint32_t(spv::ImageOperandsMask::MakeTexelAvailableKHR); } } } if (is_volatile) { if (inst_type == kMemory) { - flags |= SpvMemoryAccessVolatileMask; + flags |= uint32_t(spv::MemoryAccessMask::Volatile); } else { - flags |= SpvImageOperandsVolatileTexelKHRMask; + flags |= uint32_t(spv::ImageOperandsMask::VolatileTexelKHR); } } @@ -566,7 +571,7 @@ void UpgradeMemoryModel::UpgradeFlags(Instruction* inst, uint32_t in_operand, } } -uint32_t UpgradeMemoryModel::GetScopeConstant(SpvScope scope) { +uint32_t UpgradeMemoryModel::GetScopeConstant(spv::Scope scope) { analysis::Integer int_ty(32, false); uint32_t int_id = context()->get_type_mgr()->GetTypeInstruction(&int_ty); const analysis::Constant* constant = @@ -587,15 +592,19 @@ void UpgradeMemoryModel::CleanupDecorations() { context()->get_decoration_mgr()->RemoveDecorationsFrom( inst->result_id(), [](const Instruction& dec) { switch (dec.opcode()) { - case SpvOpDecorate: - case SpvOpDecorateId: - if (dec.GetSingleWordInOperand(1u) == SpvDecorationCoherent || - dec.GetSingleWordInOperand(1u) == SpvDecorationVolatile) + case spv::Op::OpDecorate: + case spv::Op::OpDecorateId: + if (spv::Decoration(dec.GetSingleWordInOperand(1u)) == + spv::Decoration::Coherent || + spv::Decoration(dec.GetSingleWordInOperand(1u)) == + spv::Decoration::Volatile) return true; break; - case SpvOpMemberDecorate: - if (dec.GetSingleWordInOperand(2u) == SpvDecorationCoherent || - dec.GetSingleWordInOperand(2u) == SpvDecorationVolatile) + case spv::Op::OpMemberDecorate: + if (spv::Decoration(dec.GetSingleWordInOperand(2u)) == + spv::Decoration::Coherent || + spv::Decoration(dec.GetSingleWordInOperand(2u)) == + spv::Decoration::Volatile) return true; break; default: @@ -616,7 +625,7 @@ void UpgradeMemoryModel::UpgradeBarriers() { for (auto& block : *function) { block.ForEachInst([this, &barriers, &operates_on_output](Instruction* inst) { - if (inst->opcode() == SpvOpControlBarrier) { + if (inst->opcode() == spv::Op::OpControlBarrier) { barriers.push_back(inst); } else if (!operates_on_output) { // This instruction operates on output storage class if it is a @@ -625,7 +634,7 @@ void UpgradeMemoryModel::UpgradeBarriers() { analysis::Type* type = context()->get_type_mgr()->GetType(inst->type_id()); if (type && type->AsPointer() && - type->AsPointer()->storage_class() == SpvStorageClassOutput) { + type->AsPointer()->storage_class() == spv::StorageClass::Output) { operates_on_output = true; return; } @@ -635,7 +644,8 @@ void UpgradeMemoryModel::UpgradeBarriers() { analysis::Type* op_type = context()->get_type_mgr()->GetType(op_inst->type_id()); if (op_type && op_type->AsPointer() && - op_type->AsPointer()->storage_class() == SpvStorageClassOutput) + op_type->AsPointer()->storage_class() == + spv::StorageClass::Output) operates_on_output = true; }); } @@ -646,7 +656,8 @@ void UpgradeMemoryModel::UpgradeBarriers() { std::queue roots; for (auto& e : get_module()->entry_points()) - if (e.GetSingleWordInOperand(0u) == SpvExecutionModelTessellationControl) { + if (spv::ExecutionModel(e.GetSingleWordInOperand(0u)) == + spv::ExecutionModel::TessellationControl) { roots.push(e.GetSingleWordInOperand(1u)); if (context()->ProcessCallTreeFromRoots(CollectBarriers, &roots)) { for (auto barrier : barriers) { @@ -659,8 +670,9 @@ void UpgradeMemoryModel::UpgradeBarriers() { uint64_t semantics_value = GetIndexValue(semantics_inst); const analysis::Constant* constant = context()->get_constant_mgr()->GetConstant( - semantics_type, {static_cast(semantics_value) | - SpvMemorySemanticsOutputMemoryKHRMask}); + semantics_type, + {static_cast(semantics_value) | + uint32_t(spv::MemorySemanticsMask::OutputMemoryKHR)}); barrier->SetInOperand(2u, {context() ->get_constant_mgr() ->GetDefiningInstruction(constant) @@ -680,15 +692,15 @@ void UpgradeMemoryModel::UpgradeMemoryScope() { // * Workgroup ops (e.g. async_copy) have at most workgroup scope. if (spvOpcodeIsAtomicOp(inst->opcode())) { if (IsDeviceScope(inst->GetSingleWordInOperand(1))) { - inst->SetInOperand(1, {GetScopeConstant(SpvScopeQueueFamilyKHR)}); + inst->SetInOperand(1, {GetScopeConstant(spv::Scope::QueueFamilyKHR)}); } - } else if (inst->opcode() == SpvOpControlBarrier) { + } else if (inst->opcode() == spv::Op::OpControlBarrier) { if (IsDeviceScope(inst->GetSingleWordInOperand(1))) { - inst->SetInOperand(1, {GetScopeConstant(SpvScopeQueueFamilyKHR)}); + inst->SetInOperand(1, {GetScopeConstant(spv::Scope::QueueFamilyKHR)}); } - } else if (inst->opcode() == SpvOpMemoryBarrier) { + } else if (inst->opcode() == spv::Op::OpMemoryBarrier) { if (IsDeviceScope(inst->GetSingleWordInOperand(0))) { - inst->SetInOperand(0, {GetScopeConstant(SpvScopeQueueFamilyKHR)}); + inst->SetInOperand(0, {GetScopeConstant(spv::Scope::QueueFamilyKHR)}); } } }); @@ -704,14 +716,14 @@ bool UpgradeMemoryModel::IsDeviceScope(uint32_t scope_id) { assert(type->width() == 32 || type->width() == 64); if (type->width() == 32) { if (type->IsSigned()) - return static_cast(constant->GetS32()) == SpvScopeDevice; + return static_cast(constant->GetS32()) == spv::Scope::Device; else - return static_cast(constant->GetU32()) == SpvScopeDevice; + return static_cast(constant->GetU32()) == spv::Scope::Device; } else { if (type->IsSigned()) - return static_cast(constant->GetS64()) == SpvScopeDevice; + return static_cast(constant->GetS64()) == spv::Scope::Device; else - return static_cast(constant->GetU64()) == SpvScopeDevice; + return static_cast(constant->GetU64()) == spv::Scope::Device; } assert(false); @@ -758,9 +770,9 @@ void UpgradeMemoryModel::UpgradeExtInst(Instruction* ext_inst) { uint32_t UpgradeMemoryModel::MemoryAccessNumWords(uint32_t mask) { uint32_t result = 1; - if (mask & SpvMemoryAccessAlignedMask) ++result; - if (mask & SpvMemoryAccessMakePointerAvailableKHRMask) ++result; - if (mask & SpvMemoryAccessMakePointerVisibleKHRMask) ++result; + if (mask & uint32_t(spv::MemoryAccessMask::Aligned)) ++result; + if (mask & uint32_t(spv::MemoryAccessMask::MakePointerAvailableKHR)) ++result; + if (mask & uint32_t(spv::MemoryAccessMask::MakePointerVisibleKHR)) ++result; return result; } diff --git a/bgfx/3rdparty/spirv-tools/source/opt/upgrade_memory_model.h b/bgfx/3rdparty/spirv-tools/source/opt/upgrade_memory_model.h index f75304ed..489436b6 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/upgrade_memory_model.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/upgrade_memory_model.h @@ -71,7 +71,7 @@ class UpgradeMemoryModel : public Pass { void UpgradeAtomics(); // Returns whether |id| is coherent and/or volatile. - std::tuple GetInstructionAttributes(uint32_t id); + std::tuple GetInstructionAttributes(uint32_t id); // Traces |inst| to determine if it is coherent and/or volatile. // |indices| tracks the access chain indices seen so far. @@ -84,7 +84,7 @@ class UpgradeMemoryModel : public Pass { // match the index or |value| must be a maximum allowable value. The max // value allows any element to match. bool HasDecoration(const Instruction* inst, uint32_t value, - SpvDecoration decoration); + spv::Decoration decoration); // Returns whether |type_id| indexed via |indices| is coherent and/or // volatile. @@ -108,7 +108,7 @@ class UpgradeMemoryModel : public Pass { bool is_volatile); // Returns the result id for a constant for |scope|. - uint32_t GetScopeConstant(SpvScope scope); + uint32_t GetScopeConstant(spv::Scope scope); // Returns the value of |index_inst|. |index_inst| must be an OpConstant of // integer type.g @@ -127,7 +127,7 @@ class UpgradeMemoryModel : public Pass { // scope. void UpgradeMemoryScope(); - // Returns true if |scope_id| is SpvScopeDevice. + // Returns true if |scope_id| is spv::Scope::Device. bool IsDeviceScope(uint32_t scope_id); // Upgrades GLSL.std.450 modf and frexp. Both instructions are replaced with diff --git a/bgfx/3rdparty/spirv-tools/source/opt/value_number_table.cpp b/bgfx/3rdparty/spirv-tools/source/opt/value_number_table.cpp index 5271e3fe..743dc52b 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/value_number_table.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/value_number_table.cpp @@ -57,9 +57,9 @@ uint32_t ValueNumberTable::AssignValueNumber(Instruction* inst) { } switch (inst->opcode()) { - case SpvOpSampledImage: - case SpvOpImage: - case SpvOpVariable: + case spv::Op::OpSampledImage: + case spv::Op::OpImage: + case spv::Op::OpVariable: value = TakeNextValueNumber(); id_to_value_[inst->result_id()] = value; return value; @@ -82,7 +82,7 @@ uint32_t ValueNumberTable::AssignValueNumber(Instruction* inst) { analysis::DecorationManager* dec_mgr = context()->get_decoration_mgr(); // When we copy an object, the value numbers should be the same. - if (inst->opcode() == SpvOpCopyObject && + if (inst->opcode() == spv::Op::OpCopyObject && dec_mgr->HaveTheSameDecorations(inst->result_id(), inst->GetSingleWordInOperand(0))) { value = GetValueNumber(inst->GetSingleWordInOperand(0)); @@ -94,7 +94,7 @@ uint32_t ValueNumberTable::AssignValueNumber(Instruction* inst) { // Phi nodes are a type of copy. If all of the inputs have the same value // number, then we can assign the result of the phi the same value number. - if (inst->opcode() == SpvOpPhi && inst->NumInOperands() > 0 && + if (inst->opcode() == spv::Op::OpPhi && inst->NumInOperands() > 0 && dec_mgr->HaveTheSameDecorations(inst->result_id(), inst->GetSingleWordInOperand(0))) { value = GetValueNumber(inst->GetSingleWordInOperand(0)); @@ -226,7 +226,7 @@ std::size_t ValueTableHash::operator()(const Instruction& inst) const { // instructions that are the same except for the result to hash to the // same value. std::u32string h; - h.push_back(inst.opcode()); + h.push_back(uint32_t(inst.opcode())); h.push_back(inst.type_id()); for (uint32_t i = 0; i < inst.NumInOperands(); ++i) { const auto& opnd = inst.GetInOperand(i); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/vector_dce.cpp b/bgfx/3rdparty/spirv-tools/source/opt/vector_dce.cpp index 28d94a07..1e8d255d 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/vector_dce.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/vector_dce.cpp @@ -19,11 +19,9 @@ namespace spvtools { namespace opt { namespace { - -const uint32_t kExtractCompositeIdInIdx = 0; -const uint32_t kInsertObjectIdInIdx = 0; -const uint32_t kInsertCompositeIdInIdx = 1; - +constexpr uint32_t kExtractCompositeIdInIdx = 0; +constexpr uint32_t kInsertObjectIdInIdx = 0; +constexpr uint32_t kInsertCompositeIdInIdx = 1; } // namespace Pass::Status VectorDCE::Process() { @@ -68,17 +66,17 @@ void VectorDCE::FindLiveComponents(Function* function, Instruction* current_inst = current_item.instruction; switch (current_inst->opcode()) { - case SpvOpCompositeExtract: + case spv::Op::OpCompositeExtract: MarkExtractUseAsLive(current_inst, current_item.components, live_components, &work_list); break; - case SpvOpCompositeInsert: + case spv::Op::OpCompositeInsert: MarkInsertUsesAsLive(current_item, live_components, &work_list); break; - case SpvOpVectorShuffle: + case spv::Op::OpVectorShuffle: MarkVectorShuffleUsesAsLive(current_item, live_components, &work_list); break; - case SpvOpCompositeConstruct: + case spv::Op::OpCompositeConstruct: MarkCompositeContructUsesAsLive(current_item, live_components, &work_list); break; @@ -347,11 +345,11 @@ bool VectorDCE::RewriteInstructions( } switch (current_inst->opcode()) { - case SpvOpCompositeInsert: + case spv::Op::OpCompositeInsert: modified |= RewriteInsertInstruction( current_inst, live_component->second, &dead_dbg_value); break; - case SpvOpCompositeConstruct: + case spv::Op::OpCompositeConstruct: // TODO: The members that are not live can be replaced by an undef // or constant. This will remove uses of those values, and possibly // create opportunities for ADCE. diff --git a/bgfx/3rdparty/spirv-tools/source/opt/workaround1209.cpp b/bgfx/3rdparty/spirv-tools/source/opt/workaround1209.cpp index d6e9d2cf..0cf954af 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/workaround1209.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/workaround1209.cpp @@ -43,13 +43,13 @@ bool Workaround1209::RemoveOpUnreachableInLoops() { loop_merges.pop(); } - if (bb->tail()->opcode() == SpvOpUnreachable) { + if (bb->tail()->opcode() == spv::Op::OpUnreachable) { if (!loop_merges.empty()) { // We found an OpUnreachable inside a loop. // Replace it with an unconditional branch to the loop merge. context()->KillInst(&*bb->tail()); std::unique_ptr new_branch( - new Instruction(context(), SpvOpBranch, 0, 0, + new Instruction(context(), spv::Op::OpBranch, 0, 0, {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {loop_merges.top()}}})); context()->AnalyzeDefUse(&*new_branch); diff --git a/bgfx/3rdparty/spirv-tools/source/opt/wrap_opkill.cpp b/bgfx/3rdparty/spirv-tools/source/opt/wrap_opkill.cpp index 51432a73..c0c6d622 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/wrap_opkill.cpp +++ b/bgfx/3rdparty/spirv-tools/source/opt/wrap_opkill.cpp @@ -28,7 +28,8 @@ Pass::Status WrapOpKill::Process() { Function* func = context()->GetFunction(func_id); bool successful = func->WhileEachInst([this, &modified](Instruction* inst) { const auto opcode = inst->opcode(); - if ((opcode == SpvOpKill) || (opcode == SpvOpTerminateInvocation)) { + if ((opcode == spv::Op::OpKill) || + (opcode == spv::Op::OpTerminateInvocation)) { modified = true; if (!ReplaceWithFunctionCall(inst)) { return false; @@ -56,8 +57,8 @@ Pass::Status WrapOpKill::Process() { } bool WrapOpKill::ReplaceWithFunctionCall(Instruction* inst) { - assert((inst->opcode() == SpvOpKill || - inst->opcode() == SpvOpTerminateInvocation) && + assert((inst->opcode() == spv::Op::OpKill || + inst->opcode() == spv::Op::OpTerminateInvocation) && "|inst| must be an OpKill or OpTerminateInvocation instruction."); InstructionBuilder ir_builder( context(), inst, @@ -76,14 +77,15 @@ bool WrapOpKill::ReplaceWithFunctionCall(Instruction* inst) { Instruction* return_inst = nullptr; uint32_t return_type_id = GetOwningFunctionsReturnType(inst); if (return_type_id != GetVoidTypeId()) { - Instruction* undef = ir_builder.AddNullaryOp(return_type_id, SpvOpUndef); + Instruction* undef = + ir_builder.AddNullaryOp(return_type_id, spv::Op::OpUndef); if (undef == nullptr) { return false; } return_inst = - ir_builder.AddUnaryOp(0, SpvOpReturnValue, undef->result_id()); + ir_builder.AddUnaryOp(0, spv::Op::OpReturnValue, undef->result_id()); } else { - return_inst = ir_builder.AddNullaryOp(0, SpvOpReturn); + return_inst = ir_builder.AddNullaryOp(0, spv::Op::OpReturn); } if (return_inst == nullptr) { @@ -115,13 +117,13 @@ uint32_t WrapOpKill::GetVoidFunctionTypeId() { return type_mgr->GetTypeInstruction(&func_type); } -uint32_t WrapOpKill::GetKillingFuncId(SpvOp opcode) { +uint32_t WrapOpKill::GetKillingFuncId(spv::Op opcode) { // Parameterize by opcode - assert(opcode == SpvOpKill || opcode == SpvOpTerminateInvocation); + assert(opcode == spv::Op::OpKill || opcode == spv::Op::OpTerminateInvocation); std::unique_ptr* const killing_func = - (opcode == SpvOpKill) ? &opkill_function_ - : &opterminateinvocation_function_; + (opcode == spv::Op::OpKill) ? &opkill_function_ + : &opterminateinvocation_function_; if (*killing_func != nullptr) { return (*killing_func)->result_id(); @@ -139,14 +141,14 @@ uint32_t WrapOpKill::GetKillingFuncId(SpvOp opcode) { // Generate the function start instruction std::unique_ptr func_start(new Instruction( - context(), SpvOpFunction, void_type_id, killing_func_id, {})); + context(), spv::Op::OpFunction, void_type_id, killing_func_id, {})); func_start->AddOperand({SPV_OPERAND_TYPE_FUNCTION_CONTROL, {0}}); func_start->AddOperand({SPV_OPERAND_TYPE_ID, {GetVoidFunctionTypeId()}}); (*killing_func).reset(new Function(std::move(func_start))); // Generate the function end instruction std::unique_ptr func_end( - new Instruction(context(), SpvOpFunctionEnd, 0, 0, {})); + new Instruction(context(), spv::Op::OpFunctionEnd, 0, 0, {})); (*killing_func)->SetFunctionEnd(std::move(func_end)); // Create the one basic block for the function. @@ -155,7 +157,7 @@ uint32_t WrapOpKill::GetKillingFuncId(SpvOp opcode) { return 0; } std::unique_ptr label_inst( - new Instruction(context(), SpvOpLabel, 0, lab_id, {})); + new Instruction(context(), spv::Op::OpLabel, 0, lab_id, {})); std::unique_ptr bb(new BasicBlock(std::move(label_inst))); // Add the OpKill to the basic block diff --git a/bgfx/3rdparty/spirv-tools/source/opt/wrap_opkill.h b/bgfx/3rdparty/spirv-tools/source/opt/wrap_opkill.h index 7e43ca6c..c9eb8887 100644 --- a/bgfx/3rdparty/spirv-tools/source/opt/wrap_opkill.h +++ b/bgfx/3rdparty/spirv-tools/source/opt/wrap_opkill.h @@ -53,7 +53,7 @@ class WrapOpKill : public Pass { // Return the id of a function that has return type void, has no parameters, // and contains a single instruction, which is |opcode|, either OpKill or // OpTerminateInvocation. Returns 0 if the function could not be generated. - uint32_t GetKillingFuncId(SpvOp opcode); + uint32_t GetKillingFuncId(spv::Op opcode); // Returns the id of the return type for the function that contains |inst|. // Returns 0 if |inst| is not in a function. diff --git a/bgfx/3rdparty/spirv-tools/source/parsed_operand.cpp b/bgfx/3rdparty/spirv-tools/source/parsed_operand.cpp index 5f8e94db..cc33f8ba 100644 --- a/bgfx/3rdparty/spirv-tools/source/parsed_operand.cpp +++ b/bgfx/3rdparty/spirv-tools/source/parsed_operand.cpp @@ -24,6 +24,7 @@ namespace spvtools { void EmitNumericLiteral(std::ostream* out, const spv_parsed_instruction_t& inst, const spv_parsed_operand_t& operand) { if (operand.type != SPV_OPERAND_TYPE_LITERAL_INTEGER && + operand.type != SPV_OPERAND_TYPE_LITERAL_FLOAT && operand.type != SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER && operand.type != SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER && operand.type != SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER) diff --git a/bgfx/3rdparty/spirv-tools/source/print.cpp b/bgfx/3rdparty/spirv-tools/source/print.cpp index 6c94e2b7..f36812ef 100644 --- a/bgfx/3rdparty/spirv-tools/source/print.cpp +++ b/bgfx/3rdparty/spirv-tools/source/print.cpp @@ -17,7 +17,7 @@ #if defined(SPIRV_ANDROID) || defined(SPIRV_LINUX) || defined(SPIRV_MAC) || \ defined(SPIRV_IOS) || defined(SPIRV_TVOS) || defined(SPIRV_FREEBSD) || \ defined(SPIRV_OPENBSD) || defined(SPIRV_EMSCRIPTEN) || \ - defined(SPIRV_FUCHSIA) || defined(SPIRV_GNU) + defined(SPIRV_FUCHSIA) || defined(SPIRV_GNU) || defined(SPIRV_QNX) namespace spvtools { clr::reset::operator const char*() { return "\x1b[0m"; } diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp index 2cd779a2..93b51a11 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp @@ -36,9 +36,9 @@ ConditionalBranchToSimpleConditionalBranchOpportunityFinder:: for (auto* function : GetTargetFunctions(context, target_function)) { // Consider every block in the function. for (auto& block : *function) { - // The terminator must be SpvOpBranchConditional. + // The terminator must be spv::Op::OpBranchConditional. opt::Instruction* terminator = block.terminator(); - if (terminator->opcode() != SpvOpBranchConditional) { + if (terminator->opcode() != spv::Op::OpBranchConditional) { continue; } diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.cpp index a2c3b40a..e626d60b 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.cpp @@ -23,7 +23,7 @@ namespace reduce { MergeBlocksReductionOpportunity::MergeBlocksReductionOpportunity( opt::IRContext* context, opt::Function* function, opt::BasicBlock* block) { // Precondition: the terminator has to be OpBranch. - assert(block->terminator()->opcode() == SpvOpBranch); + assert(block->terminator()->opcode() == spv::Op::OpBranch); context_ = context; function_ = function; // Get the successor block associated with the OpBranch. diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/operand_to_const_reduction_opportunity_finder.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/operand_to_const_reduction_opportunity_finder.cpp index eb7498ad..c6196f36 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/operand_to_const_reduction_opportunity_finder.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/operand_to_const_reduction_opportunity_finder.cpp @@ -50,7 +50,7 @@ OperandToConstReductionOpportunityFinder::GetAvailableOpportunities( // The argument is already a constant. continue; } - if (def->opcode() == SpvOpFunction) { + if (def->opcode() == spv::Op::OpFunction) { // The argument refers to a function, e.g. the function called // by OpFunctionCall; avoid replacing this with a constant of // the function's return type. diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/operand_to_undef_reduction_opportunity_finder.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/operand_to_undef_reduction_opportunity_finder.cpp index 06bf9550..c7bc1213 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/operand_to_undef_reduction_opportunity_finder.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/operand_to_undef_reduction_opportunity_finder.cpp @@ -32,7 +32,7 @@ OperandToUndefReductionOpportunityFinder::GetAvailableOpportunities( auto type_id = inst.type_id(); if (type_id) { auto type_id_def = context->get_def_use_mgr()->GetDef(type_id); - if (type_id_def->opcode() == SpvOpTypePointer) { + if (type_id_def->opcode() == spv::Op::OpTypePointer) { continue; } } @@ -57,7 +57,7 @@ OperandToUndefReductionOpportunityFinder::GetAvailableOpportunities( } // Don't replace function operands with undef. - if (operand_id_def->opcode() == SpvOpFunction) { + if (operand_id_def->opcode() == spv::Op::OpFunction) { continue; } @@ -68,7 +68,7 @@ OperandToUndefReductionOpportunityFinder::GetAvailableOpportunities( context->get_def_use_mgr()->GetDef(operand_type_id); // Skip pointer operands. - if (operand_type_id_def->opcode() == SpvOpTypePointer) { + if (operand_type_id_def->opcode() == spv::Op::OpTypePointer) { continue; } diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/reduction_util.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/reduction_util.cpp index 511f4323..c9882d5e 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/reduction_util.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/reduction_util.cpp @@ -26,7 +26,7 @@ const uint32_t kFalseBranchOperandIndex = 2; uint32_t FindOrCreateGlobalVariable(opt::IRContext* context, uint32_t pointer_type_id) { for (auto& inst : context->module()->types_values()) { - if (inst.opcode() != SpvOpVariable) { + if (inst.opcode() != spv::Op::OpVariable) { continue; } if (inst.type_id() == pointer_type_id) { @@ -35,7 +35,7 @@ uint32_t FindOrCreateGlobalVariable(opt::IRContext* context, } const uint32_t variable_id = context->TakeNextId(); auto variable_inst = MakeUnique( - context, SpvOpVariable, pointer_type_id, variable_id, + context, spv::Op::OpVariable, pointer_type_id, variable_id, opt::Instruction::OperandList( {{SPV_OPERAND_TYPE_STORAGE_CLASS, {static_cast(context->get_type_mgr() @@ -53,7 +53,7 @@ uint32_t FindOrCreateFunctionVariable(opt::IRContext* context, assert(context->get_type_mgr() ->GetType(pointer_type_id) ->AsPointer() - ->storage_class() == SpvStorageClassFunction); + ->storage_class() == spv::StorageClass::Function); // Go through the instructions in the function's first block until we find a // suitable variable, or go past all the variables. @@ -62,7 +62,7 @@ uint32_t FindOrCreateFunctionVariable(opt::IRContext* context, // We will either find a suitable variable, or find a non-variable // instruction; we won't exhaust all instructions. assert(iter != function->begin()->end()); - if (iter->opcode() != SpvOpVariable) { + if (iter->opcode() != spv::Op::OpVariable) { // If we see a non-variable, we have gone through all the variables. break; } @@ -74,16 +74,17 @@ uint32_t FindOrCreateFunctionVariable(opt::IRContext* context, // function's entry block. const uint32_t variable_id = context->TakeNextId(); auto variable_inst = MakeUnique( - context, SpvOpVariable, pointer_type_id, variable_id, + context, spv::Op::OpVariable, pointer_type_id, variable_id, opt::Instruction::OperandList( - {{SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}})); + {{SPV_OPERAND_TYPE_STORAGE_CLASS, + {uint32_t(spv::StorageClass::Function)}}})); iter->InsertBefore(std::move(variable_inst)); return variable_id; } uint32_t FindOrCreateGlobalUndef(opt::IRContext* context, uint32_t type_id) { for (auto& inst : context->module()->types_values()) { - if (inst.opcode() != SpvOpUndef) { + if (inst.opcode() != spv::Op::OpUndef) { continue; } if (inst.type_id() == type_id) { @@ -91,8 +92,9 @@ uint32_t FindOrCreateGlobalUndef(opt::IRContext* context, uint32_t type_id) { } } const uint32_t undef_id = context->TakeNextId(); - auto undef_inst = MakeUnique( - context, SpvOpUndef, type_id, undef_id, opt::Instruction::OperandList()); + auto undef_inst = + MakeUnique(context, spv::Op::OpUndef, type_id, undef_id, + opt::Instruction::OperandList()); assert(undef_id == undef_inst->result_id()); context->module()->AddGlobalValue(std::move(undef_inst)); return undef_id; diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/remove_selection_reduction_opportunity_finder.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/remove_selection_reduction_opportunity_finder.cpp index 74df1b8d..6abadf2a 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/remove_selection_reduction_opportunity_finder.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/remove_selection_reduction_opportunity_finder.cpp @@ -36,7 +36,7 @@ RemoveSelectionReductionOpportunityFinder::GetAvailableOpportunities( for (auto* function : GetTargetFunctions(context, target_function)) { for (auto& block : *function) { if (auto merge_instruction = block.GetMergeInst()) { - if (merge_instruction->opcode() == SpvOpLoopMerge) { + if (merge_instruction->opcode() == spv::Op::OpLoopMerge) { uint32_t merge_block_id = merge_instruction->GetSingleWordOperand(kMergeNodeIndex); uint32_t continue_block_id = @@ -54,7 +54,7 @@ RemoveSelectionReductionOpportunityFinder::GetAvailableOpportunities( for (auto& function : *context->module()) { for (auto& block : function) { if (auto merge_instruction = block.GetMergeInst()) { - if (merge_instruction->opcode() == SpvOpSelectionMerge) { + if (merge_instruction->opcode() == spv::Op::OpSelectionMerge) { if (CanOpSelectionMergeBeRemoved( context, block, merge_instruction, merge_and_continue_blocks_from_loops)) { diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/remove_struct_member_reduction_opportunity.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/remove_struct_member_reduction_opportunity.cpp index e72ed351..3309fd09 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/remove_struct_member_reduction_opportunity.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/remove_struct_member_reduction_opportunity.cpp @@ -36,14 +36,14 @@ void RemoveStructMemberReductionOpportunity::Apply() { struct_type_, [this, &decorations_to_kill](opt::Instruction* user, uint32_t /*operand_index*/) { switch (user->opcode()) { - case SpvOpCompositeConstruct: - case SpvOpConstantComposite: + case spv::Op::OpCompositeConstruct: + case spv::Op::OpConstantComposite: // This use is constructing a composite of the struct type, so we // must remove the id that was provided for the member we are // removing. user->RemoveInOperand(member_index_); break; - case SpvOpMemberDecorate: + case spv::Op::OpMemberDecorate: // This use is decorating a member of the struct. if (user->GetSingleWordInOperand(1) == member_index_) { // The member we are removing is being decorated, so we record @@ -78,8 +78,8 @@ void RemoveStructMemberReductionOpportunity::Apply() { for (auto& block : function) { for (auto& inst : block) { switch (inst.opcode()) { - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: { + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: { // These access chain instructions take sequences of ids for // indexing, starting from input operand 1. auto composite_type_id = @@ -90,8 +90,8 @@ void RemoveStructMemberReductionOpportunity::Apply() { ->GetSingleWordInOperand(1); AdjustAccessedIndices(composite_type_id, 1, false, context, &inst); } break; - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: { + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: { // These access chain instructions take sequences of ids for // indexing, starting from input operand 2. auto composite_type_id = @@ -102,7 +102,7 @@ void RemoveStructMemberReductionOpportunity::Apply() { ->GetSingleWordInOperand(1); AdjustAccessedIndices(composite_type_id, 2, false, context, &inst); } break; - case SpvOpCompositeExtract: { + case spv::Op::OpCompositeExtract: { // OpCompositeExtract uses literals for indexing, starting at input // operand 1. auto composite_type_id = @@ -111,7 +111,7 @@ void RemoveStructMemberReductionOpportunity::Apply() { ->type_id(); AdjustAccessedIndices(composite_type_id, 1, true, context, &inst); } break; - case SpvOpCompositeInsert: { + case spv::Op::OpCompositeInsert: { // OpCompositeInsert uses literals for indexing, starting at input // operand 2. auto composite_type_id = @@ -146,13 +146,13 @@ void RemoveStructMemberReductionOpportunity::AdjustAccessedIndices( i < composite_access_instruction->NumInOperands(); i++) { auto type_inst = context->get_def_use_mgr()->GetDef(next_type); switch (type_inst->opcode()) { - case SpvOpTypeArray: - case SpvOpTypeMatrix: - case SpvOpTypeRuntimeArray: - case SpvOpTypeVector: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeVector: next_type = type_inst->GetSingleWordInOperand(0); break; - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { // Struct types are special because (a) we may need to adjust the index // being used, if the struct type is the one from which we are removing // a member, and (b) the type encountered by following the current index diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/remove_unused_instruction_reduction_opportunity_finder.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/remove_unused_instruction_reduction_opportunity_finder.cpp index d7bb3a82..fbbeb346 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/remove_unused_instruction_reduction_opportunity_finder.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/remove_unused_instruction_reduction_opportunity_finder.cpp @@ -103,8 +103,8 @@ RemoveUnusedInstructionReductionOpportunityFinder::GetAvailableOpportunities( continue; } if (spvOpcodeIsBlockTerminator(inst.opcode()) || - inst.opcode() == SpvOpSelectionMerge || - inst.opcode() == SpvOpLoopMerge) { + inst.opcode() == spv::Op::OpSelectionMerge || + inst.opcode() == spv::Op::OpLoopMerge) { // In this reduction pass we do not want to affect static // control flow. continue; @@ -133,7 +133,7 @@ bool RemoveUnusedInstructionReductionOpportunityFinder:: &inst, [this](opt::Instruction* user, uint32_t use_index) -> bool { return (user->IsDecoration() && !IsIndependentlyRemovableDecoration(*user)) || - (user->opcode() == SpvOpEntryPoint && use_index > 2); + (user->opcode() == spv::Op::OpEntryPoint && use_index > 2); }); } @@ -141,13 +141,13 @@ bool RemoveUnusedInstructionReductionOpportunityFinder:: IsIndependentlyRemovableDecoration(const opt::Instruction& inst) const { uint32_t decoration; switch (inst.opcode()) { - case SpvOpDecorate: - case SpvOpDecorateId: - case SpvOpDecorateString: + case spv::Op::OpDecorate: + case spv::Op::OpDecorateId: + case spv::Op::OpDecorateString: decoration = inst.GetSingleWordInOperand(1u); break; - case SpvOpMemberDecorate: - case SpvOpMemberDecorateString: + case spv::Op::OpMemberDecorate: + case spv::Op::OpMemberDecorateString: decoration = inst.GetSingleWordInOperand(2u); break; default: @@ -160,12 +160,12 @@ bool RemoveUnusedInstructionReductionOpportunityFinder:: // not change the shader interface, will not make the shader invalid, will // actually be found in practice, etc. - switch (decoration) { - case SpvDecorationRelaxedPrecision: - case SpvDecorationNoSignedWrap: - case SpvDecorationNoContraction: - case SpvDecorationNoUnsignedWrap: - case SpvDecorationUserSemantic: + switch (spv::Decoration(decoration)) { + case spv::Decoration::RelaxedPrecision: + case spv::Decoration::NoSignedWrap: + case spv::Decoration::NoContraction: + case spv::Decoration::NoUnsignedWrap: + case spv::Decoration::UserSemantic: return true; default: return false; diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/remove_unused_struct_member_reduction_opportunity_finder.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/remove_unused_struct_member_reduction_opportunity_finder.cpp index cd0c4e4d..db381e0f 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/remove_unused_struct_member_reduction_opportunity_finder.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/remove_unused_struct_member_reduction_opportunity_finder.cpp @@ -43,7 +43,7 @@ RemoveUnusedStructMemberReductionOpportunityFinder::GetAvailableOpportunities( // Consider every struct type in the module. for (auto& type_or_value : context->types_values()) { - if (type_or_value.opcode() != SpvOpTypeStruct) { + if (type_or_value.opcode() != spv::Op::OpTypeStruct) { continue; } @@ -60,7 +60,7 @@ RemoveUnusedStructMemberReductionOpportunityFinder::GetAvailableOpportunities( &type_or_value, [&unused_members](opt::Instruction* user, uint32_t /*operand_index*/) { switch (user->opcode()) { - case SpvOpMemberName: + case spv::Op::OpMemberName: unused_members.erase(user->GetSingleWordInOperand(1)); break; default: @@ -91,8 +91,8 @@ RemoveUnusedStructMemberReductionOpportunityFinder::GetAvailableOpportunities( // The way the helper is invoked depends on whether the instruction // uses literal or id indices, and the offset into the instruction's // input operands from which index operands are provided. - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: { + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: { auto composite_type_id = context->get_def_use_mgr() ->GetDef(context->get_def_use_mgr() @@ -102,8 +102,8 @@ RemoveUnusedStructMemberReductionOpportunityFinder::GetAvailableOpportunities( MarkAccessedMembersAsUsed(context, composite_type_id, 1, false, inst, &unused_member_to_structs); } break; - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: { + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: { auto composite_type_id = context->get_def_use_mgr() ->GetDef(context->get_def_use_mgr() @@ -113,7 +113,7 @@ RemoveUnusedStructMemberReductionOpportunityFinder::GetAvailableOpportunities( MarkAccessedMembersAsUsed(context, composite_type_id, 2, false, inst, &unused_member_to_structs); } break; - case SpvOpCompositeExtract: { + case spv::Op::OpCompositeExtract: { auto composite_type_id = context->get_def_use_mgr() ->GetDef(inst.GetSingleWordInOperand(0)) @@ -121,7 +121,7 @@ RemoveUnusedStructMemberReductionOpportunityFinder::GetAvailableOpportunities( MarkAccessedMembersAsUsed(context, composite_type_id, 1, true, inst, &unused_member_to_structs); } break; - case SpvOpCompositeInsert: { + case spv::Op::OpCompositeInsert: { auto composite_type_id = context->get_def_use_mgr() ->GetDef(inst.GetSingleWordInOperand(1)) @@ -163,13 +163,13 @@ void RemoveUnusedStructMemberReductionOpportunityFinder:: i < composite_access_instruction.NumInOperands(); i++) { auto type_inst = context->get_def_use_mgr()->GetDef(next_type); switch (type_inst->opcode()) { - case SpvOpTypeArray: - case SpvOpTypeMatrix: - case SpvOpTypeRuntimeArray: - case SpvOpTypeVector: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeVector: next_type = type_inst->GetSingleWordInOperand(0); break; - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { uint32_t index_operand = composite_access_instruction.GetSingleWordInOperand(i); uint32_t member = literal_indices ? index_operand diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/simple_conditional_branch_to_branch_opportunity_finder.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/simple_conditional_branch_to_branch_opportunity_finder.cpp index d867c3ad..9637f0f1 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/simple_conditional_branch_to_branch_opportunity_finder.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/simple_conditional_branch_to_branch_opportunity_finder.cpp @@ -29,15 +29,15 @@ SimpleConditionalBranchToBranchOpportunityFinder::GetAvailableOpportunities( for (auto* function : GetTargetFunctions(context, target_function)) { // Consider every block in the function. for (auto& block : *function) { - // The terminator must be SpvOpBranchConditional. + // The terminator must be spv::Op::OpBranchConditional. opt::Instruction* terminator = block.terminator(); - if (terminator->opcode() != SpvOpBranchConditional) { + if (terminator->opcode() != spv::Op::OpBranchConditional) { continue; } // It must not be a selection header, as these cannot be followed by // OpBranch. if (block.GetMergeInst() && - block.GetMergeInst()->opcode() == SpvOpSelectionMerge) { + block.GetMergeInst()->opcode() == spv::Op::OpSelectionMerge) { continue; } // The conditional branch must be simplified. diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/simple_conditional_branch_to_branch_reduction_opportunity.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/simple_conditional_branch_to_branch_reduction_opportunity.cpp index a2be0c4d..6d772b59 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/simple_conditional_branch_to_branch_reduction_opportunity.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/simple_conditional_branch_to_branch_reduction_opportunity.cpp @@ -31,7 +31,8 @@ bool SimpleConditionalBranchToBranchReductionOpportunity::PreconditionHolds() { } void SimpleConditionalBranchToBranchReductionOpportunity::Apply() { - assert(conditional_branch_instruction_->opcode() == SpvOpBranchConditional && + assert(conditional_branch_instruction_->opcode() == + spv::Op::OpBranchConditional && "SimpleConditionalBranchToBranchReductionOpportunity: branch was not " "a conditional branch"); @@ -46,7 +47,7 @@ void SimpleConditionalBranchToBranchReductionOpportunity::Apply() { // -> // OpBranch %block_id - conditional_branch_instruction_->SetOpcode(SpvOpBranch); + conditional_branch_instruction_->SetOpcode(spv::Op::OpBranch); conditional_branch_instruction_->ReplaceOperands( {{SPV_OPERAND_TYPE_ID, {conditional_branch_instruction_->GetSingleWordInOperand( diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/structured_construct_to_block_reduction_opportunity.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/structured_construct_to_block_reduction_opportunity.cpp index ed738411..cc5ffe3c 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/structured_construct_to_block_reduction_opportunity.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/structured_construct_to_block_reduction_opportunity.cpp @@ -55,7 +55,7 @@ void StructuredConstructToBlockReductionOpportunity::Apply() { // The terminator for the header block is changed to be an unconditional // branch to the merge block. - header_block->terminator()->SetOpcode(SpvOpBranch); + header_block->terminator()->SetOpcode(spv::Op::OpBranch); header_block->terminator()->SetInOperands( {{SPV_OPERAND_TYPE_ID, {merge_block->id()}}}); diff --git a/bgfx/3rdparty/spirv-tools/source/reduce/structured_loop_to_selection_reduction_opportunity.cpp b/bgfx/3rdparty/spirv-tools/source/reduce/structured_loop_to_selection_reduction_opportunity.cpp index 850af456..45b95285 100644 --- a/bgfx/3rdparty/spirv-tools/source/reduce/structured_loop_to_selection_reduction_opportunity.cpp +++ b/bgfx/3rdparty/spirv-tools/source/reduce/structured_loop_to_selection_reduction_opportunity.cpp @@ -129,12 +129,12 @@ void StructuredLoopToSelectionReductionOpportunity::RedirectEdge( // Figure out which operands of the terminator need to be considered for // redirection. std::vector operand_indices; - if (terminator->opcode() == SpvOpBranch) { + if (terminator->opcode() == spv::Op::OpBranch) { operand_indices = {0}; - } else if (terminator->opcode() == SpvOpBranchConditional) { + } else if (terminator->opcode() == spv::Op::OpBranchConditional) { operand_indices = {1, 2}; } else { - assert(terminator->opcode() == SpvOpSwitch); + assert(terminator->opcode() == spv::Op::OpSwitch); for (uint32_t label_index = 1; label_index < terminator->NumOperands(); label_index += 2) { operand_indices.push_back(label_index); @@ -179,18 +179,19 @@ void StructuredLoopToSelectionReductionOpportunity::ChangeLoopToSelection() { auto loop_merge_inst = loop_construct_header_->GetLoopMergeInst(); auto const loop_merge_block_id = loop_merge_inst->GetSingleWordOperand(kMergeNodeIndex); - loop_merge_inst->SetOpcode(SpvOpSelectionMerge); + loop_merge_inst->SetOpcode(spv::Op::OpSelectionMerge); loop_merge_inst->ReplaceOperands( {{loop_merge_inst->GetOperand(kMergeNodeIndex).type, {loop_merge_block_id}}, - {SPV_OPERAND_TYPE_SELECTION_CONTROL, {SpvSelectionControlMaskNone}}}); + {SPV_OPERAND_TYPE_SELECTION_CONTROL, + {uint32_t(spv::SelectionControlMask::MaskNone)}}}); // The loop header either finishes with OpBranch or OpBranchConditional. // The latter is fine for a selection. In the former case we need to turn // it into OpBranchConditional. We use "true" as the condition, and make // the "else" branch be the merge block. auto terminator = loop_construct_header_->terminator(); - if (terminator->opcode() == SpvOpBranch) { + if (terminator->opcode() == spv::Op::OpBranch) { opt::analysis::Bool temp; const opt::analysis::Bool* bool_type = context_->get_type_mgr()->GetRegisteredType(&temp)->AsBool(); @@ -199,7 +200,7 @@ void StructuredLoopToSelectionReductionOpportunity::ChangeLoopToSelection() { auto true_const_result_id = const_mgr->GetDefiningInstruction(true_const)->result_id(); auto original_branch_id = terminator->GetSingleWordOperand(0); - terminator->SetOpcode(SpvOpBranchConditional); + terminator->SetOpcode(spv::Op::OpBranchConditional); terminator->ReplaceOperands({{SPV_OPERAND_TYPE_ID, {true_const_result_id}}, {SPV_OPERAND_TYPE_ID, {original_branch_id}}, {SPV_OPERAND_TYPE_ID, {loop_merge_block_id}}}); @@ -215,7 +216,7 @@ void StructuredLoopToSelectionReductionOpportunity::FixNonDominatedIdUses() { // Consider each instruction in the function. for (auto& block : *loop_construct_header_->GetParent()) { for (auto& def : block) { - if (def.opcode() == SpvOpVariable) { + if (def.opcode() == spv::Op::OpVariable) { // Variables are defined at the start of the function, and can be // accessed by all blocks, even by unreachable blocks that have no // dominators, so we do not need to worry about them. @@ -233,11 +234,11 @@ void StructuredLoopToSelectionReductionOpportunity::FixNonDominatedIdUses() { // access chain, in which case replace it with some (possibly fresh) // variable (as we cannot load from / store to OpUndef). if (!DefinitionSufficientlyDominatesUse(&def, use, index, block)) { - if (def.opcode() == SpvOpAccessChain) { + if (def.opcode() == spv::Op::OpAccessChain) { auto pointer_type = context_->get_type_mgr()->GetType(def.type_id())->AsPointer(); switch (pointer_type->storage_class()) { - case SpvStorageClassFunction: + case spv::StorageClass::Function: use->SetOperand( index, {FindOrCreateFunctionVariable( context_, loop_construct_header_->GetParent(), @@ -270,7 +271,7 @@ bool StructuredLoopToSelectionReductionOpportunity:: opt::Instruction* use, uint32_t use_index, opt::BasicBlock& def_block) { - if (use->opcode() == SpvOpPhi) { + if (use->opcode() == spv::Op::OpPhi) { // A use in a phi doesn't need to be dominated by its definition, but the // associated parent block does need to be dominated by the definition. return context_->GetDominatorAnalysis(loop_construct_header_->GetParent()) diff --git a/bgfx/3rdparty/spirv-tools/source/spirv_target_env.cpp b/bgfx/3rdparty/spirv-tools/source/spirv_target_env.cpp index 9a038174..585f8b65 100644 --- a/bgfx/3rdparty/spirv-tools/source/spirv_target_env.cpp +++ b/bgfx/3rdparty/spirv-tools/source/spirv_target_env.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "source/spirv_constant.h" #include "spirv-tools/libspirv.h" diff --git a/bgfx/3rdparty/spirv-tools/source/table.h b/bgfx/3rdparty/spirv-tools/source/table.h index 5adf04a4..8097f13f 100644 --- a/bgfx/3rdparty/spirv-tools/source/table.h +++ b/bgfx/3rdparty/spirv-tools/source/table.h @@ -21,9 +21,9 @@ typedef struct spv_opcode_desc_t { const char* name; - const SpvOp opcode; + const spv::Op opcode; const uint32_t numCapabilities; - const SpvCapability* capabilities; + const spv::Capability* capabilities; // operandTypes[0..numTypes-1] describe logical operands for the instruction. // The operand types include result id and result-type id, followed by // the types of arguments. @@ -48,7 +48,7 @@ typedef struct spv_operand_desc_t { const char* name; const uint32_t value; const uint32_t numCapabilities; - const SpvCapability* capabilities; + const spv::Capability* capabilities; // A set of extensions that enable this feature. If empty then this operand // value is in core and its availability is subject to minVersion. The // assembler, binary parser, and disassembler ignore this rule, so you can @@ -73,7 +73,7 @@ typedef struct spv_ext_inst_desc_t { const char* name; const uint32_t ext_inst; const uint32_t numCapabilities; - const SpvCapability* capabilities; + const spv::Capability* capabilities; const spv_operand_type_t operandTypes[16]; // TODO: Smaller/larger? } spv_ext_inst_desc_t; diff --git a/bgfx/3rdparty/spirv-tools/source/text.cpp b/bgfx/3rdparty/spirv-tools/source/text.cpp index 90f69c52..737c223b 100644 --- a/bgfx/3rdparty/spirv-tools/source/text.cpp +++ b/bgfx/3rdparty/spirv-tools/source/text.cpp @@ -227,7 +227,8 @@ spv_result_t spvTextEncodeOperand(const spvtools::AssemblyGrammar& grammar, // Set the extended instruction type. // The import set id is the 3rd operand of OpExtInst. - if (pInst->opcode == SpvOpExtInst && pInst->words.size() == 4) { + if (spv::Op(pInst->opcode) == spv::Op::OpExtInst && + pInst->words.size() == 4) { auto ext_inst_type = context->getExtInstTypeForId(pInst->words[3]); if (ext_inst_type == SPV_EXT_INST_TYPE_NONE) { return context->diagnostic() @@ -279,7 +280,7 @@ spv_result_t spvTextEncodeOperand(const spvtools::AssemblyGrammar& grammar, // The assembler accepts the symbolic name for the opcode, but without // the "Op" prefix. For example, "IAdd" is accepted. The number // of the opcode is emitted. - SpvOp opcode; + spv::Op opcode; if (grammar.lookupSpecConstantOpcode(textValue, &opcode)) { return context->diagnostic() << "Invalid " << spvOperandTypeStr(type) << " '" << textValue << "'."; @@ -311,6 +312,17 @@ spv_result_t spvTextEncodeOperand(const spvtools::AssemblyGrammar& grammar, } } break; + case SPV_OPERAND_TYPE_LITERAL_FLOAT: { + // The current operand is a 32-bit float. + // That's just how the grammar works. + spvtools::IdType expected_type = { + 32, false, spvtools::IdTypeClass::kScalarFloatType}; + if (auto error = context->binaryEncodeNumericLiteral( + textValue, error_code_for_literals, expected_type, pInst)) { + return error; + } + } break; + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_NUMBER: // This is a context-independent literal number which can be a 32-bit // number of floating point value. @@ -327,8 +339,8 @@ spv_result_t spvTextEncodeOperand(const spvtools::AssemblyGrammar& grammar, // The encoding for OpConstant, OpSpecConstant and OpSwitch all // depend on either their own result-id or the result-id of // one of their parameters. - if (SpvOpConstant == pInst->opcode || - SpvOpSpecConstant == pInst->opcode) { + if (spv::Op::OpConstant == pInst->opcode || + spv::Op::OpSpecConstant == pInst->opcode) { // The type of the literal is determined by the type Id of the // instruction. expected_type = @@ -344,7 +356,7 @@ spv_result_t spvTextEncodeOperand(const spvtools::AssemblyGrammar& grammar, << "Type for " << opcode_name << " must be a scalar floating point or integer type"; } - } else if (pInst->opcode == SpvOpSwitch) { + } else if (pInst->opcode == spv::Op::OpSwitch) { // The type of the literal is the same as the type of the selector. expected_type = context->getTypeOfValueInstruction(pInst->words[1]); if (!spvtools::isScalarIntegral(expected_type)) { @@ -375,7 +387,7 @@ spv_result_t spvTextEncodeOperand(const spvtools::AssemblyGrammar& grammar, } // NOTE: Special case for extended instruction library import - if (SpvOpExtInstImport == pInst->opcode) { + if (spv::Op::OpExtInstImport == pInst->opcode) { const spv_ext_inst_type_t ext_inst_type = spvExtInstImportTypeGet(literal.str.c_str()); if (SPV_EXT_INST_TYPE_NONE == ext_inst_type) { @@ -401,7 +413,8 @@ spv_result_t spvTextEncodeOperand(const spvtools::AssemblyGrammar& grammar, case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: case SPV_OPERAND_TYPE_SELECTION_CONTROL: case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS: - case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_INFO_FLAGS: { + case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_INFO_FLAGS: + case SPV_OPERAND_TYPE_OPTIONAL_COOPERATIVE_MATRIX_OPERANDS: { uint32_t value; if (auto error = grammar.parseMaskOperand(type, textValue, &value)) { return context->diagnostic(error) @@ -543,7 +556,8 @@ spv_result_t spvTextEncodeOpcode(const spvtools::AssemblyGrammar& grammar, std::string equal_sign; error = context->getWord(&equal_sign, &nextPosition); if ("=" != equal_sign) - return context->diagnostic() << "'=' expected after result id."; + return context->diagnostic() << "'=' expected after result id but found '" + << equal_sign << "'."; // The after the '=' sign. context->setPosition(nextPosition); @@ -688,7 +702,7 @@ spv_result_t SetHeader(spv_target_env env, const uint32_t bound, uint32_t* header) { if (!header) return SPV_ERROR_INVALID_BINARY; - header[SPV_INDEX_MAGIC_NUMBER] = SpvMagicNumber; + header[SPV_INDEX_MAGIC_NUMBER] = spv::MagicNumber; header[SPV_INDEX_VERSION_NUMBER] = spvVersionForTargetEnv(env); header[SPV_INDEX_GENERATOR_NUMBER] = SPV_GENERATOR_WORD(SPV_GENERATOR_KHRONOS_ASSEMBLER, kAssemblerVersion); @@ -722,7 +736,7 @@ spv_result_t GetNumericIds(const spvtools::AssemblyGrammar& grammar, // being parsed. A malformed input might feature such an operand *before* // the opcode is known. To guard against accessing an uninitialized opcode, // the instruction's opcode is initialized to a default value. - inst.opcode = SpvOpMax; + inst.opcode = spv::Op::Max; if (spvTextEncodeOpcode(grammar, &context, &inst)) { return SPV_ERROR_INVALID_TEXT; diff --git a/bgfx/3rdparty/spirv-tools/source/text_handler.cpp b/bgfx/3rdparty/spirv-tools/source/text_handler.cpp index 15c1741f..35c4b83c 100644 --- a/bgfx/3rdparty/spirv-tools/source/text_handler.cpp +++ b/bgfx/3rdparty/spirv-tools/source/text_handler.cpp @@ -323,12 +323,12 @@ spv_result_t AssemblyContext::recordTypeDefinition( << " has already been used to generate a type"; } - if (pInst->opcode == SpvOpTypeInt) { + if (pInst->opcode == spv::Op::OpTypeInt) { if (pInst->words.size() != 4) return diagnostic() << "Invalid OpTypeInt instruction"; types_[value] = {pInst->words[2], pInst->words[3] != 0, IdTypeClass::kScalarIntegerType}; - } else if (pInst->opcode == SpvOpTypeFloat) { + } else if (pInst->opcode == spv::Op::OpTypeFloat) { if (pInst->words.size() != 3) return diagnostic() << "Invalid OpTypeFloat instruction"; types_[value] = {pInst->words[2], false, IdTypeClass::kScalarFloatType}; diff --git a/bgfx/3rdparty/spirv-tools/source/util/hex_float.h b/bgfx/3rdparty/spirv-tools/source/util/hex_float.h index 06e3c575..98353a4a 100644 --- a/bgfx/3rdparty/spirv-tools/source/util/hex_float.h +++ b/bgfx/3rdparty/spirv-tools/source/util/hex_float.h @@ -896,6 +896,47 @@ ParseNormalFloat, HexFloatTraits>>( return is; } +namespace detail { + +// Returns a new value formed from 'value' by setting 'bit' that is the +// 'n'th most significant bit (where 0 is the most significant bit). +// If 'bit' is zero or 'n' is more than the number of bits in the integer +// type, then return the original value. +template +UINT_TYPE set_nth_most_significant_bit(UINT_TYPE value, UINT_TYPE bit, + UINT_TYPE n) { + constexpr UINT_TYPE max_position = std::numeric_limits::digits - 1; + if ((bit != 0) && (n <= max_position)) { + return static_cast(value | (bit << (max_position - n))); + } + return value; +} + +// Attempts to increment the argument. +// If it does not overflow, then increments the argument and returns true. +// If it would overflow, returns false. +template +bool saturated_inc(INT_TYPE& value) { + if (value == std::numeric_limits::max()) { + return false; + } + value++; + return true; +} + +// Attempts to decrement the argument. +// If it does not underflow, then decrements the argument and returns true. +// If it would overflow, returns false. +template +bool saturated_dec(INT_TYPE& value) { + if (value == std::numeric_limits::min()) { + return false; + } + value--; + return true; +} +} // namespace detail + // Reads a HexFloat from the given stream. // If the float is not encoded as a hex-float then it will be parsed // as a regular float. @@ -997,13 +1038,16 @@ std::istream& operator>>(std::istream& is, HexFloat& value) { if (bits_written) { // If we are here the bits represented belong in the fractional // part of the float, and we have to adjust the exponent accordingly. - fraction = static_cast( - fraction | - static_cast( - write_bit << (HF::top_bit_left_shift - fraction_index++))); - // TODO(dneto): Avoid overflow. Testing would require - // parameterization. - exponent = static_cast(exponent + 1); + fraction = detail::set_nth_most_significant_bit(fraction, write_bit, + fraction_index); + // Increment the fraction index. If the input has bizarrely many + // significant digits, then silently drop them. + detail::saturated_inc(fraction_index); + if (!detail::saturated_inc(exponent)) { + // Overflow failure + is.setstate(std::ios::failbit); + return is; + } } // Since this updated after setting fraction bits, this effectively // drops the leading 1 bit. @@ -1034,14 +1078,17 @@ std::istream& operator>>(std::istream& is, HexFloat& value) { // Handle modifying the exponent here this way we can handle // an arbitrary number of hex values without overflowing our // integer. - // TODO(dneto): Handle underflow. Testing would require extra - // parameterization. - exponent = static_cast(exponent - 1); + if (!detail::saturated_dec(exponent)) { + // Overflow failure + is.setstate(std::ios::failbit); + return is; + } } else { - fraction = static_cast( - fraction | - static_cast( - write_bit << (HF::top_bit_left_shift - fraction_index++))); + fraction = detail::set_nth_most_significant_bit(fraction, write_bit, + fraction_index); + // Increment the fraction index. If the input has bizarrely many + // significant digits, then silently drop them. + detail::saturated_inc(fraction_index); } } } else { diff --git a/bgfx/3rdparty/spirv-tools/source/util/small_vector.h b/bgfx/3rdparty/spirv-tools/source/util/small_vector.h index 648a3482..1351475b 100644 --- a/bgfx/3rdparty/spirv-tools/source/util/small_vector.h +++ b/bgfx/3rdparty/spirv-tools/source/util/small_vector.h @@ -15,7 +15,9 @@ #ifndef SOURCE_UTIL_SMALL_VECTOR_H_ #define SOURCE_UTIL_SMALL_VECTOR_H_ +#include #include +#include #include #include #include @@ -461,14 +463,18 @@ class SmallVector { // The number of elements in |small_data_| that have been constructed. size_t size_; - // The pointed used to access the array of elements when the number of - // elements is small. - T* small_data_; + // A type with the same alignment and size as T, but will is POD. + struct alignas(T) PodType { + std::array data; + }; // The actual data used to store the array elements. It must never be used // directly, but must only be accessed through |small_data_|. - typename std::aligned_storage::value>::type - buffer[small_size]; + PodType buffer[small_size]; + + // The pointed used to access the array of elements when the number of + // elements is small. + T* small_data_; // A pointer to a vector that is used to store the elements of the vector when // this size exceeds |small_size|. If |large_data_| is nullptr, then the data diff --git a/bgfx/3rdparty/spirv-tools/source/val/basic_block.cpp b/bgfx/3rdparty/spirv-tools/source/val/basic_block.cpp index da05db3a..9a358fcb 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/basic_block.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/basic_block.cpp @@ -15,7 +15,6 @@ #include "source/val/basic_block.h" #include -#include #include namespace spvtools { diff --git a/bgfx/3rdparty/spirv-tools/source/val/construct.cpp b/bgfx/3rdparty/spirv-tools/source/val/construct.cpp index 52e61d55..10af155d 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/construct.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/construct.cpp @@ -16,7 +16,6 @@ #include #include -#include #include "source/val/function.h" #include "source/val/validation_state.h" @@ -164,10 +163,12 @@ bool Construct::IsStructuredExit(ValidationState_t& _, BasicBlock* dest) const { // ii. The immediate dominator of |block|. auto NextBlock = [](const BasicBlock* block) -> const BasicBlock* { for (auto& use : block->label()->uses()) { - if ((use.first->opcode() == SpvOpLoopMerge || - use.first->opcode() == SpvOpSelectionMerge) && + if ((use.first->opcode() == spv::Op::OpLoopMerge || + use.first->opcode() == spv::Op::OpSelectionMerge) && use.second == 1 && - use.first->block()->structurally_dominates(*block)) { + use.first->block()->structurally_dominates(*block) && + // A header likely declared itself as its merge. + use.first->block() != block) { return use.first->block(); } } @@ -181,10 +182,10 @@ bool Construct::IsStructuredExit(ValidationState_t& _, BasicBlock* dest) const { auto terminator = block->terminator(); auto index = terminator - &_.ordered_instructions()[0]; auto merge_inst = &_.ordered_instructions()[index - 1]; - if (merge_inst->opcode() == SpvOpLoopMerge || - (header->terminator()->opcode() != SpvOpSwitch && - merge_inst->opcode() == SpvOpSelectionMerge && - terminator->opcode() == SpvOpSwitch)) { + if (merge_inst->opcode() == spv::Op::OpLoopMerge || + (header->terminator()->opcode() != spv::Op::OpSwitch && + merge_inst->opcode() == spv::Op::OpSelectionMerge && + terminator->opcode() == spv::Op::OpSwitch)) { auto merge_target = merge_inst->GetOperandAs(0u); auto merge_block = merge_inst->function()->GetBlock(merge_target).first; if (merge_block->structurally_dominates(*header)) { @@ -192,22 +193,22 @@ bool Construct::IsStructuredExit(ValidationState_t& _, BasicBlock* dest) const { continue; } - if ((!seen_switch || merge_inst->opcode() == SpvOpLoopMerge) && + if ((!seen_switch || merge_inst->opcode() == spv::Op::OpLoopMerge) && dest->id() == merge_target) { return true; - } else if (merge_inst->opcode() == SpvOpLoopMerge) { + } else if (merge_inst->opcode() == spv::Op::OpLoopMerge) { auto continue_target = merge_inst->GetOperandAs(1u); if (dest->id() == continue_target) { return true; } } - if (terminator->opcode() == SpvOpSwitch) { + if (terminator->opcode() == spv::Op::OpSwitch) { seen_switch = true; } // Hit an enclosing loop and didn't break or continue. - if (merge_inst->opcode() == SpvOpLoopMerge) return false; + if (merge_inst->opcode() == spv::Op::OpLoopMerge) return false; } block = NextBlock(block); diff --git a/bgfx/3rdparty/spirv-tools/source/val/decoration.h b/bgfx/3rdparty/spirv-tools/source/val/decoration.h index 4f53f207..384cc575 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/decoration.h +++ b/bgfx/3rdparty/spirv-tools/source/val/decoration.h @@ -39,33 +39,33 @@ namespace val { // // Example 1: Decoration for an object with no parameters: // OpDecorate %obj Flat -// dec_type_ = SpvDecorationFlat +// dec_type_ = spv::Decoration::Flat // params_ = empty vector // struct_member_index_ = kInvalidMember // // Example 2: Decoration for an object with two parameters: // OpDecorate %obj LinkageAttributes "link" Import -// dec_type_ = SpvDecorationLinkageAttributes +// dec_type_ = spv::Decoration::LinkageAttributes // params_ = vector { link, Import } // struct_member_index_ = kInvalidMember // // Example 3: Decoration for a member of a structure with one parameter: // OpMemberDecorate %struct 2 Offset 2 -// dec_type_ = SpvDecorationOffset +// dec_type_ = spv::Decoration::Offset // params_ = vector { 2 } // struct_member_index_ = 2 // class Decoration { public: enum { kInvalidMember = -1 }; - Decoration(SpvDecoration t, + Decoration(spv::Decoration t, const std::vector& parameters = std::vector(), uint32_t member_index = kInvalidMember) : dec_type_(t), params_(parameters), struct_member_index_(member_index) {} void set_struct_member_index(uint32_t index) { struct_member_index_ = index; } int struct_member_index() const { return struct_member_index_; } - SpvDecoration dec_type() const { return dec_type_; } + spv::Decoration dec_type() const { return dec_type_; } std::vector& params() { return params_; } const std::vector& params() const { return params_; } @@ -84,7 +84,7 @@ class Decoration { } private: - SpvDecoration dec_type_; + spv::Decoration dec_type_; std::vector params_; // If the decoration applies to a member of a structure type, then the index diff --git a/bgfx/3rdparty/spirv-tools/source/val/function.cpp b/bgfx/3rdparty/spirv-tools/source/val/function.cpp index fc7ccd06..290574b8 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/function.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/function.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include "source/cfa.h" @@ -33,7 +32,7 @@ namespace val { static const uint32_t kInvalidId = 0x400000; Function::Function(uint32_t function_id, uint32_t result_type_id, - SpvFunctionControlMask function_control, + spv::FunctionControlMask function_control, uint32_t function_type_id) : id_(function_id), function_type_id_(function_type_id), @@ -371,10 +370,10 @@ int Function::GetBlockDepth(BasicBlock* bb) { return block_depth_[bb]; } -void Function::RegisterExecutionModelLimitation(SpvExecutionModel model, +void Function::RegisterExecutionModelLimitation(spv::ExecutionModel model, const std::string& message) { execution_model_limitations_.push_back( - [model, message](SpvExecutionModel in_model, std::string* out_message) { + [model, message](spv::ExecutionModel in_model, std::string* out_message) { if (model != in_model) { if (out_message) { *out_message = message; @@ -385,7 +384,7 @@ void Function::RegisterExecutionModelLimitation(SpvExecutionModel model, }); } -bool Function::IsCompatibleWithExecutionModel(SpvExecutionModel model, +bool Function::IsCompatibleWithExecutionModel(spv::ExecutionModel model, std::string* reason) const { bool return_value = true; std::stringstream ss_reason; diff --git a/bgfx/3rdparty/spirv-tools/source/val/function.h b/bgfx/3rdparty/spirv-tools/source/val/function.h index 126b1dc7..48117944 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/function.h +++ b/bgfx/3rdparty/spirv-tools/source/val/function.h @@ -55,7 +55,8 @@ enum class FunctionDecl { class Function { public: Function(uint32_t id, uint32_t result_type_id, - SpvFunctionControlMask function_control, uint32_t function_type_id); + spv::FunctionControlMask function_control, + uint32_t function_type_id); /// Registers a function parameter in the current function /// @return Returns SPV_SUCCESS if the call was successful @@ -80,7 +81,8 @@ class Function { /// /// @return Returns SPV_SUCCESS if the call was successful spv_result_t RegisterBlockVariable(uint32_t type_id, uint32_t id, - SpvStorageClass storage, uint32_t init_id); + spv::StorageClass storage, + uint32_t init_id); /// Registers a loop merge construct in the function /// @@ -205,12 +207,12 @@ class Function { /// Registers execution model limitation such as "Feature X is only available /// with Execution Model Y". - void RegisterExecutionModelLimitation(SpvExecutionModel model, + void RegisterExecutionModelLimitation(spv::ExecutionModel model, const std::string& message); /// Registers execution model limitation with an |is_compatible| functor. void RegisterExecutionModelLimitation( - std::function is_compatible) { + std::function is_compatible) { execution_model_limitations_.push_back(is_compatible); } @@ -227,7 +229,7 @@ class Function { /// Returns true if the given execution model passes the limitations stored in /// execution_model_limitations_. Returns false otherwise and fills optional /// |reason| parameter. - bool IsCompatibleWithExecutionModel(SpvExecutionModel model, + bool IsCompatibleWithExecutionModel(spv::ExecutionModel model, std::string* reason = nullptr) const; // Inserts id to the set of functions called from this function. @@ -286,7 +288,7 @@ class Function { uint32_t result_type_id_; /// The control fo the function - SpvFunctionControlMask function_control_; + spv::FunctionControlMask function_control_; /// The type of declaration of each function FunctionDecl declaration_type_; @@ -381,7 +383,7 @@ class Function { /// function. The functor stored in the list return true if execution model /// is compatible, false otherwise. If the functor returns false, it can also /// optionally fill the string parameter with the reason for incompatibility. - std::list> + std::list> execution_model_limitations_; /// Stores limitations imposed by instructions used within the function. diff --git a/bgfx/3rdparty/spirv-tools/source/val/instruction.h b/bgfx/3rdparty/spirv-tools/source/val/instruction.h index 6d1f9f4f..c524bd37 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/instruction.h +++ b/bgfx/3rdparty/spirv-tools/source/val/instruction.h @@ -42,7 +42,7 @@ class Instruction { uint32_t id() const { return inst_.result_id; } uint32_t type_id() const { return inst_.type_id; } - SpvOp opcode() const { return static_cast(inst_.opcode); } + spv::Op opcode() const { return static_cast(inst_.opcode); } /// Returns the Function where the instruction was defined. nullptr if it was /// defined outside of a Function @@ -87,13 +87,13 @@ class Instruction { } bool IsNonSemantic() const { - return opcode() == SpvOp::SpvOpExtInst && + return opcode() == spv::Op::OpExtInst && spvExtInstIsNonSemantic(inst_.ext_inst_type); } /// True if this is an OpExtInst for debug info extension. bool IsDebugInfo() const { - return opcode() == SpvOp::SpvOpExtInst && + return opcode() == spv::Op::OpExtInst && spvExtInstIsDebugInfo(inst_.ext_inst_type); } diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate.cpp index efb9225e..a5f320b9 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate.cpp @@ -14,13 +14,9 @@ #include "source/val/validate.h" -#include -#include -#include #include #include #include -#include #include #include @@ -28,15 +24,11 @@ #include "source/diagnostic.h" #include "source/enum_string_mapping.h" #include "source/extensions.h" -#include "source/instruction.h" #include "source/opcode.h" -#include "source/operand.h" #include "source/spirv_constant.h" #include "source/spirv_endian.h" #include "source/spirv_target_env.h" -#include "source/spirv_validator_options.h" #include "source/val/construct.h" -#include "source/val/function.h" #include "source/val/instruction.h" #include "source/val/validation_state.h" #include "spirv-tools/libspirv.h" @@ -66,15 +58,15 @@ void RegisterExtension(ValidationState_t& _, // Parses the beginning of the module searching for OpExtension instructions. // Registers extensions if recognized. Returns SPV_REQUESTED_TERMINATION -// once an instruction which is not SpvOpCapability and SpvOpExtension is -// encountered. According to the SPIR-V spec extensions are declared after -// capabilities and before everything else. +// once an instruction which is not spv::Op::OpCapability and +// spv::Op::OpExtension is encountered. According to the SPIR-V spec extensions +// are declared after capabilities and before everything else. spv_result_t ProcessExtensions(void* user_data, const spv_parsed_instruction_t* inst) { - const SpvOp opcode = static_cast(inst->opcode); - if (opcode == SpvOpCapability) return SPV_SUCCESS; + const spv::Op opcode = static_cast(inst->opcode); + if (opcode == spv::Op::OpCapability) return SPV_SUCCESS; - if (opcode == SpvOpExtension) { + if (opcode == spv::Op::OpExtension) { ValidationState_t& _ = *(reinterpret_cast(user_data)); RegisterExtension(_, inst); return SPV_SUCCESS; @@ -123,7 +115,7 @@ spv_result_t ValidateEntryPoints(ValidationState_t& _) { _.ComputeFunctionToEntryPointMapping(); _.ComputeRecursiveEntryPoints(); - if (_.entry_points().empty() && !_.HasCapability(SpvCapabilityLinkage)) { + if (_.entry_points().empty() && !_.HasCapability(spv::Capability::Linkage)) { return _.diag(SPV_ERROR_INVALID_BINARY, nullptr) << "No OpEntryPoint instruction was found. This is only allowed if " "the Linkage capability is being used."; @@ -218,9 +210,9 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( // able to, briefly, de-const the instruction. Instruction* inst = const_cast(&instruction); - if (inst->opcode() == SpvOpEntryPoint) { + if (inst->opcode() == spv::Op::OpEntryPoint) { const auto entry_point = inst->GetOperandAs(1); - const auto execution_model = inst->GetOperandAs(0); + const auto execution_model = inst->GetOperandAs(0); const std::string desc_name = inst->GetOperandAs(2); ValidationState_t::EntryPointDescription desc; @@ -236,7 +228,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( if (visited_entry_points.size() > 0) { for (const Instruction* check_inst : visited_entry_points) { const auto check_execution_model = - check_inst->GetOperandAs(0); + check_inst->GetOperandAs(0); const std::string check_name = check_inst->GetOperandAs(2); @@ -250,12 +242,12 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( } visited_entry_points.push_back(inst); - has_mask_task_nv |= (execution_model == SpvExecutionModelTaskNV || - execution_model == SpvExecutionModelMeshNV); - has_mask_task_ext |= (execution_model == SpvExecutionModelTaskEXT || - execution_model == SpvExecutionModelMeshEXT); + has_mask_task_nv |= (execution_model == spv::ExecutionModel::TaskNV || + execution_model == spv::ExecutionModel::MeshNV); + has_mask_task_ext |= (execution_model == spv::ExecutionModel::TaskEXT || + execution_model == spv::ExecutionModel::MeshEXT); } - if (inst->opcode() == SpvOpFunctionCall) { + if (inst->opcode() == spv::Op::OpFunctionCall) { if (!vstate->in_function_body()) { return vstate->diag(SPV_ERROR_INVALID_LAYOUT, &instruction) << "A FunctionCall must happen within a function body."; @@ -286,7 +278,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( { Instruction* inst = const_cast(&instruction); vstate->RegisterInstruction(inst); - if (inst->opcode() == SpvOpTypeForwardPointer) { + if (inst->opcode() == spv::Op::OpTypeForwardPointer) { vstate->RegisterForwardPointer(inst->GetOperandAs(0)); } } @@ -300,7 +292,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( return vstate->diag(SPV_ERROR_INVALID_LAYOUT, nullptr) << "Missing OpFunctionEnd at end of module."; - if (vstate->HasCapability(SpvCapabilityBindlessTextureNV) && + if (vstate->HasCapability(spv::Capability::BindlessTextureNV) && !vstate->has_samplerimage_variable_address_mode_specified()) return vstate->diag(SPV_ERROR_INVALID_LAYOUT, nullptr) << "Missing required OpSamplerImageAddressingModeNV instruction."; @@ -365,11 +357,13 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( if (auto error = LiteralsPass(*vstate, &instruction)) return error; if (auto error = RayQueryPass(*vstate, &instruction)) return error; if (auto error = RayTracingPass(*vstate, &instruction)) return error; + if (auto error = RayReorderNVPass(*vstate, &instruction)) return error; if (auto error = MeshShadingPass(*vstate, &instruction)) return error; } - // Validate the preconditions involving adjacent instructions. e.g. SpvOpPhi - // must only be preceded by SpvOpLabel, SpvOpPhi, or SpvOpLine. + // Validate the preconditions involving adjacent instructions. e.g. + // spv::Op::OpPhi must only be preceded by spv::Op::OpLabel, spv::Op::OpPhi, + // or spv::Op::OpLine. if (auto error = ValidateAdjacency(*vstate)) return error; if (auto error = ValidateEntryPoints(*vstate)) return error; @@ -387,6 +381,8 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( for (const auto& inst : vstate->ordered_instructions()) { if (auto error = ValidateExecutionLimitations(*vstate, &inst)) return error; if (auto error = ValidateSmallTypeUses(*vstate, &inst)) return error; + if (auto error = ValidateQCOMImageProcessingTextureUsages(*vstate, &inst)) + return error; } return SPV_SUCCESS; diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate.h b/bgfx/3rdparty/spirv-tools/source/val/validate.h index 4b953ba3..6b7d7cda 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate.h +++ b/bgfx/3rdparty/spirv-tools/source/val/validate.h @@ -31,11 +31,6 @@ class ValidationState_t; class BasicBlock; class Instruction; -/// A function that returns a vector of BasicBlocks given a BasicBlock. Used to -/// get the successor and predecessor nodes of a CFG block -using get_blocks_func = - std::function*(const BasicBlock*)>; - /// @brief Performs the Control Flow Graph checks /// /// @param[in] _ the validation state of the module @@ -69,8 +64,8 @@ spv_result_t CheckIdDefinitionDominateUse(ValidationState_t& _); /// instructions. /// /// This function will iterate over all instructions and check for any required -/// predecessor and/or successor instructions. e.g. SpvOpPhi must only be -/// preceded by SpvOpLabel, SpvOpPhi, or SpvOpLine. +/// predecessor and/or successor instructions. e.g. spv::Op::OpPhi must only be +/// preceded by spv::Op::OpLabel, spv::Op::OpPhi, or spv::Op::OpLine. /// /// @param[in] _ the validation state of the module /// @@ -203,6 +198,9 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst); /// Validates correctness of ray tracing instructions. spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst); +/// Validates correctness of shader execution reorder instructions. +spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst); + /// Validates correctness of mesh shading instructions. spv_result_t MeshShadingPass(ValidationState_t& _, const Instruction* inst); @@ -222,6 +220,14 @@ spv_result_t ValidateExecutionLimitations(ValidationState_t& _, spv_result_t ValidateSmallTypeUses(ValidationState_t& _, const Instruction* inst); +/// Validates restricted uses of QCOM decorated textures +/// +/// The textures that are decorated with some of QCOM image processing +/// decorations must be used in the specified QCOM image processing built-in +/// functions and not used in any other image functions. +spv_result_t ValidateQCOMImageProcessingTextureUsages(ValidationState_t& _, + const Instruction* inst); + /// @brief Validate the ID's within a SPIR-V binary /// /// @param[in] pInstructions array of instructions diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_adjacency.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_adjacency.cpp index 8e6c373e..7e371c2f 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_adjacency.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_adjacency.cpp @@ -15,13 +15,10 @@ // Validates correctness of the intra-block preconditions of SPIR-V // instructions. -#include "source/val/validate.h" - #include -#include "source/diagnostic.h" -#include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools { @@ -46,15 +43,15 @@ spv_result_t ValidateAdjacency(ValidationState_t& _) { for (size_t i = 0; i < instructions.size(); ++i) { const auto& inst = instructions[i]; switch (inst.opcode()) { - case SpvOpFunction: - case SpvOpFunctionParameter: + case spv::Op::OpFunction: + case spv::Op::OpFunctionParameter: adjacency_status = IN_NEW_FUNCTION; break; - case SpvOpLabel: + case spv::Op::OpLabel: adjacency_status = adjacency_status == IN_NEW_FUNCTION ? IN_ENTRY_BLOCK : PHI_VALID; break; - case SpvOpExtInst: + case spv::Op::OpExtInst: // If it is a debug info instruction, we do not change the status to // allow debug info instructions before OpVariable in a function. // TODO(https://gitlab.khronos.org/spirv/SPIR-V/issues/533): We need @@ -67,7 +64,7 @@ spv_result_t ValidateAdjacency(ValidationState_t& _) { adjacency_status = PHI_AND_VAR_INVALID; } break; - case SpvOpPhi: + case spv::Op::OpPhi: if (adjacency_status != PHI_VALID) { return _.diag(SPV_ERROR_INVALID_DATA, &inst) << "OpPhi must appear within a non-entry block before all " @@ -75,15 +72,15 @@ spv_result_t ValidateAdjacency(ValidationState_t& _) { << "(except for OpLine, which can be mixed with OpPhi)."; } break; - case SpvOpLine: - case SpvOpNoLine: + case spv::Op::OpLine: + case spv::Op::OpNoLine: break; - case SpvOpLoopMerge: + case spv::Op::OpLoopMerge: adjacency_status = PHI_AND_VAR_INVALID; if (i != (instructions.size() - 1)) { switch (instructions[i + 1].opcode()) { - case SpvOpBranch: - case SpvOpBranchConditional: + case spv::Op::OpBranch: + case spv::Op::OpBranchConditional: break; default: return _.diag(SPV_ERROR_INVALID_DATA, &inst) @@ -94,12 +91,12 @@ spv_result_t ValidateAdjacency(ValidationState_t& _) { } } break; - case SpvOpSelectionMerge: + case spv::Op::OpSelectionMerge: adjacency_status = PHI_AND_VAR_INVALID; if (i != (instructions.size() - 1)) { switch (instructions[i + 1].opcode()) { - case SpvOpBranchConditional: - case SpvOpSwitch: + case spv::Op::OpBranchConditional: + case spv::Op::OpSwitch: break; default: return _.diag(SPV_ERROR_INVALID_DATA, &inst) @@ -110,8 +107,9 @@ spv_result_t ValidateAdjacency(ValidationState_t& _) { } } break; - case SpvOpVariable: - if (inst.GetOperandAs(2) == SpvStorageClassFunction && + case spv::Op::OpVariable: + if (inst.GetOperandAs(2) == + spv::StorageClass::Function && adjacency_status != IN_ENTRY_BLOCK) { return _.diag(SPV_ERROR_INVALID_DATA, &inst) << "All OpVariable instructions in a function must be the " diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_annotation.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_annotation.cpp index 21f999b0..73d0285a 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_annotation.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_annotation.cpp @@ -24,12 +24,12 @@ namespace { // Returns true if the decoration takes ID parameters. // TODO(dneto): This can be generated from the grammar. -bool DecorationTakesIdParameters(SpvDecoration type) { +bool DecorationTakesIdParameters(spv::Decoration type) { switch (type) { - case SpvDecorationUniformId: - case SpvDecorationAlignmentId: - case SpvDecorationMaxByteOffsetId: - case SpvDecorationHlslCounterBufferGOOGLE: + case spv::Decoration::UniformId: + case spv::Decoration::AlignmentId: + case spv::Decoration::MaxByteOffsetId: + case spv::Decoration::HlslCounterBufferGOOGLE: return true; default: break; @@ -37,14 +37,14 @@ bool DecorationTakesIdParameters(SpvDecoration type) { return false; } -bool IsMemberDecorationOnly(SpvDecoration dec) { +bool IsMemberDecorationOnly(spv::Decoration dec) { switch (dec) { - case SpvDecorationRowMajor: - case SpvDecorationColMajor: - case SpvDecorationMatrixStride: + case spv::Decoration::RowMajor: + case spv::Decoration::ColMajor: + case spv::Decoration::MatrixStride: // SPIR-V spec bug? Offset is generated on variables when dealing with // transform feedback. - // case SpvDecorationOffset: + // case spv::Decoration::Offset: return true; default: break; @@ -52,42 +52,42 @@ bool IsMemberDecorationOnly(SpvDecoration dec) { return false; } -bool IsNotMemberDecoration(SpvDecoration dec) { +bool IsNotMemberDecoration(spv::Decoration dec) { switch (dec) { - case SpvDecorationSpecId: - case SpvDecorationBlock: - case SpvDecorationBufferBlock: - case SpvDecorationArrayStride: - case SpvDecorationGLSLShared: - case SpvDecorationGLSLPacked: - case SpvDecorationCPacked: + case spv::Decoration::SpecId: + case spv::Decoration::Block: + case spv::Decoration::BufferBlock: + case spv::Decoration::ArrayStride: + case spv::Decoration::GLSLShared: + case spv::Decoration::GLSLPacked: + case spv::Decoration::CPacked: // TODO: https://github.com/KhronosGroup/glslang/issues/703: // glslang applies Restrict to structure members. - // case SpvDecorationRestrict: - case SpvDecorationAliased: - case SpvDecorationConstant: - case SpvDecorationUniform: - case SpvDecorationUniformId: - case SpvDecorationSaturatedConversion: - case SpvDecorationIndex: - case SpvDecorationBinding: - case SpvDecorationDescriptorSet: - case SpvDecorationFuncParamAttr: - case SpvDecorationFPRoundingMode: - case SpvDecorationFPFastMathMode: - case SpvDecorationLinkageAttributes: - case SpvDecorationNoContraction: - case SpvDecorationInputAttachmentIndex: - case SpvDecorationAlignment: - case SpvDecorationMaxByteOffset: - case SpvDecorationAlignmentId: - case SpvDecorationMaxByteOffsetId: - case SpvDecorationNoSignedWrap: - case SpvDecorationNoUnsignedWrap: - case SpvDecorationNonUniform: - case SpvDecorationRestrictPointer: - case SpvDecorationAliasedPointer: - case SpvDecorationCounterBuffer: + // case spv::Decoration::Restrict: + case spv::Decoration::Aliased: + case spv::Decoration::Constant: + case spv::Decoration::Uniform: + case spv::Decoration::UniformId: + case spv::Decoration::SaturatedConversion: + case spv::Decoration::Index: + case spv::Decoration::Binding: + case spv::Decoration::DescriptorSet: + case spv::Decoration::FuncParamAttr: + case spv::Decoration::FPRoundingMode: + case spv::Decoration::FPFastMathMode: + case spv::Decoration::LinkageAttributes: + case spv::Decoration::NoContraction: + case spv::Decoration::InputAttachmentIndex: + case spv::Decoration::Alignment: + case spv::Decoration::MaxByteOffset: + case spv::Decoration::AlignmentId: + case spv::Decoration::MaxByteOffsetId: + case spv::Decoration::NoSignedWrap: + case spv::Decoration::NoUnsignedWrap: + case spv::Decoration::NonUniform: + case spv::Decoration::RestrictPointer: + case spv::Decoration::AliasedPointer: + case spv::Decoration::CounterBuffer: return true; default: break; @@ -95,7 +95,7 @@ bool IsNotMemberDecoration(SpvDecoration dec) { return false; } -spv_result_t ValidateDecorationTarget(ValidationState_t& _, SpvDecoration dec, +spv_result_t ValidateDecorationTarget(ValidationState_t& _, spv::Decoration dec, const Instruction* inst, const Instruction* target) { auto fail = [&_, dec, inst, target](uint32_t vuid) -> DiagnosticStream { @@ -106,76 +106,76 @@ spv_result_t ValidateDecorationTarget(ValidationState_t& _, SpvDecoration dec, return ds; }; switch (dec) { - case SpvDecorationSpecId: + case spv::Decoration::SpecId: if (!spvOpcodeIsScalarSpecConstant(target->opcode())) { return fail(0) << "must be a scalar specialization constant"; } break; - case SpvDecorationBlock: - case SpvDecorationBufferBlock: - case SpvDecorationGLSLShared: - case SpvDecorationGLSLPacked: - case SpvDecorationCPacked: - if (target->opcode() != SpvOpTypeStruct) { + case spv::Decoration::Block: + case spv::Decoration::BufferBlock: + case spv::Decoration::GLSLShared: + case spv::Decoration::GLSLPacked: + case spv::Decoration::CPacked: + if (target->opcode() != spv::Op::OpTypeStruct) { return fail(0) << "must be a structure type"; } break; - case SpvDecorationArrayStride: - if (target->opcode() != SpvOpTypeArray && - target->opcode() != SpvOpTypeRuntimeArray && - target->opcode() != SpvOpTypePointer) { + case spv::Decoration::ArrayStride: + if (target->opcode() != spv::Op::OpTypeArray && + target->opcode() != spv::Op::OpTypeRuntimeArray && + target->opcode() != spv::Op::OpTypePointer) { return fail(0) << "must be an array or pointer type"; } break; - case SpvDecorationBuiltIn: - if (target->opcode() != SpvOpVariable && + case spv::Decoration::BuiltIn: + if (target->opcode() != spv::Op::OpVariable && !spvOpcodeIsConstant(target->opcode())) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "BuiltIns can only target variables, structure members or " "constants"; } - if (_.HasCapability(SpvCapabilityShader) && - inst->GetOperandAs(2) == SpvBuiltInWorkgroupSize) { + if (_.HasCapability(spv::Capability::Shader) && + inst->GetOperandAs(2) == spv::BuiltIn::WorkgroupSize) { if (!spvOpcodeIsConstant(target->opcode())) { return fail(0) << "must be a constant for WorkgroupSize"; } - } else if (target->opcode() != SpvOpVariable) { + } else if (target->opcode() != spv::Op::OpVariable) { return fail(0) << "must be a variable"; } break; - case SpvDecorationNoPerspective: - case SpvDecorationFlat: - case SpvDecorationPatch: - case SpvDecorationCentroid: - case SpvDecorationSample: - case SpvDecorationRestrict: - case SpvDecorationAliased: - case SpvDecorationVolatile: - case SpvDecorationCoherent: - case SpvDecorationNonWritable: - case SpvDecorationNonReadable: - case SpvDecorationXfbBuffer: - case SpvDecorationXfbStride: - case SpvDecorationComponent: - case SpvDecorationStream: - case SpvDecorationRestrictPointer: - case SpvDecorationAliasedPointer: - if (target->opcode() != SpvOpVariable && - target->opcode() != SpvOpFunctionParameter) { + case spv::Decoration::NoPerspective: + case spv::Decoration::Flat: + case spv::Decoration::Patch: + case spv::Decoration::Centroid: + case spv::Decoration::Sample: + case spv::Decoration::Restrict: + case spv::Decoration::Aliased: + case spv::Decoration::Volatile: + case spv::Decoration::Coherent: + case spv::Decoration::NonWritable: + case spv::Decoration::NonReadable: + case spv::Decoration::XfbBuffer: + case spv::Decoration::XfbStride: + case spv::Decoration::Component: + case spv::Decoration::Stream: + case spv::Decoration::RestrictPointer: + case spv::Decoration::AliasedPointer: + if (target->opcode() != spv::Op::OpVariable && + target->opcode() != spv::Op::OpFunctionParameter) { return fail(0) << "must be a memory object declaration"; } - if (_.GetIdOpcode(target->type_id()) != SpvOpTypePointer) { + if (_.GetIdOpcode(target->type_id()) != spv::Op::OpTypePointer) { return fail(0) << "must be a pointer type"; } break; - case SpvDecorationInvariant: - case SpvDecorationConstant: - case SpvDecorationLocation: - case SpvDecorationIndex: - case SpvDecorationBinding: - case SpvDecorationDescriptorSet: - case SpvDecorationInputAttachmentIndex: - if (target->opcode() != SpvOpVariable) { + case spv::Decoration::Invariant: + case spv::Decoration::Constant: + case spv::Decoration::Location: + case spv::Decoration::Index: + case spv::Decoration::Binding: + case spv::Decoration::DescriptorSet: + case spv::Decoration::InputAttachmentIndex: + if (target->opcode() != spv::Op::OpVariable) { return fail(0) << "must be a variable"; } break; @@ -185,57 +185,60 @@ spv_result_t ValidateDecorationTarget(ValidationState_t& _, SpvDecoration dec, if (spvIsVulkanEnv(_.context()->target_env)) { // The following were all checked as pointer types above. - SpvStorageClass sc = SpvStorageClassUniform; + spv::StorageClass sc = spv::StorageClass::Uniform; const auto type = _.FindDef(target->type_id()); if (type && type->operands().size() > 2) { - sc = type->GetOperandAs(1); + sc = type->GetOperandAs(1); } switch (dec) { - case SpvDecorationLocation: - case SpvDecorationComponent: - // Location is used for input, output and ray tracing stages. - if (sc != SpvStorageClassInput && sc != SpvStorageClassOutput && - sc != SpvStorageClassRayPayloadKHR && - sc != SpvStorageClassIncomingRayPayloadKHR && - sc != SpvStorageClassHitAttributeKHR && - sc != SpvStorageClassCallableDataKHR && - sc != SpvStorageClassIncomingCallableDataKHR && - sc != SpvStorageClassShaderRecordBufferKHR) { + case spv::Decoration::Location: + case spv::Decoration::Component: + // Location is used for input, output, tile image, and ray tracing + // stages. + if (sc != spv::StorageClass::Input && sc != spv::StorageClass::Output && + sc != spv::StorageClass::RayPayloadKHR && + sc != spv::StorageClass::IncomingRayPayloadKHR && + sc != spv::StorageClass::HitAttributeKHR && + sc != spv::StorageClass::CallableDataKHR && + sc != spv::StorageClass::IncomingCallableDataKHR && + sc != spv::StorageClass::ShaderRecordBufferKHR && + sc != spv::StorageClass::HitObjectAttributeNV && + sc != spv::StorageClass::TileImageEXT) { return _.diag(SPV_ERROR_INVALID_ID, target) << _.VkErrorID(6672) << _.SpvDecorationString(dec) << " decoration must not be applied to this storage class"; } break; - case SpvDecorationIndex: + case spv::Decoration::Index: // Langauge from SPIR-V definition of Index - if (sc != SpvStorageClassOutput) { + if (sc != spv::StorageClass::Output) { return fail(0) << "must be in the Output storage class"; } break; - case SpvDecorationBinding: - case SpvDecorationDescriptorSet: - if (sc != SpvStorageClassStorageBuffer && - sc != SpvStorageClassUniform && - sc != SpvStorageClassUniformConstant) { + case spv::Decoration::Binding: + case spv::Decoration::DescriptorSet: + if (sc != spv::StorageClass::StorageBuffer && + sc != spv::StorageClass::Uniform && + sc != spv::StorageClass::UniformConstant) { return fail(6491) << "must be in the StorageBuffer, Uniform, or " "UniformConstant storage class"; } break; - case SpvDecorationInputAttachmentIndex: - if (sc != SpvStorageClassUniformConstant) { + case spv::Decoration::InputAttachmentIndex: + if (sc != spv::StorageClass::UniformConstant) { return fail(6678) << "must be in the UniformConstant storage class"; } break; - case SpvDecorationFlat: - case SpvDecorationNoPerspective: - case SpvDecorationCentroid: - case SpvDecorationSample: - if (sc != SpvStorageClassInput && sc != SpvStorageClassOutput) { + case spv::Decoration::Flat: + case spv::Decoration::NoPerspective: + case spv::Decoration::Centroid: + case spv::Decoration::Sample: + if (sc != spv::StorageClass::Input && sc != spv::StorageClass::Output) { return fail(4670) << "storage class must be Input or Output"; } break; - case SpvDecorationPerVertexKHR: - if (sc != SpvStorageClassInput) { + case spv::Decoration::PerVertexKHR: + if (sc != spv::StorageClass::Input) { return fail(6777) << "storage class must be Input"; } break; @@ -247,7 +250,7 @@ spv_result_t ValidateDecorationTarget(ValidationState_t& _, SpvDecoration dec, } spv_result_t ValidateDecorate(ValidationState_t& _, const Instruction* inst) { - const auto decoration = inst->GetOperandAs(1); + const auto decoration = inst->GetOperandAs(1); const auto target_id = inst->GetOperandAs(0); const auto target = _.FindDef(target_id); if (!target) { @@ -255,8 +258,8 @@ spv_result_t ValidateDecorate(ValidationState_t& _, const Instruction* inst) { } if (spvIsVulkanEnv(_.context()->target_env)) { - if ((decoration == SpvDecorationGLSLShared) || - (decoration == SpvDecorationGLSLPacked)) { + if ((decoration == spv::Decoration::GLSLShared) || + (decoration == spv::Decoration::GLSLPacked)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4669) << "OpDecorate decoration '" << _.SpvDecorationString(decoration) @@ -270,7 +273,7 @@ spv_result_t ValidateDecorate(ValidationState_t& _, const Instruction* inst) { "OpDecorateId"; } - if (target->opcode() != SpvOpDecorationGroup) { + if (target->opcode() != spv::Op::OpDecorationGroup) { if (IsMemberDecorationOnly(decoration)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.SpvDecorationString(decoration) @@ -287,7 +290,7 @@ spv_result_t ValidateDecorate(ValidationState_t& _, const Instruction* inst) { } spv_result_t ValidateDecorateId(ValidationState_t& _, const Instruction* inst) { - const auto decoration = inst->GetOperandAs(1); + const auto decoration = inst->GetOperandAs(1); if (!DecorationTakesIdParameters(decoration)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Decorations that don't take ID parameters may not be used with " @@ -306,7 +309,7 @@ spv_result_t ValidateMemberDecorate(ValidationState_t& _, const Instruction* inst) { const auto struct_type_id = inst->GetOperandAs(0); const auto struct_type = _.FindDef(struct_type_id); - if (!struct_type || SpvOpTypeStruct != struct_type->opcode()) { + if (!struct_type || spv::Op::OpTypeStruct != struct_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpMemberDecorate Structure type " << _.getIdName(struct_type_id) << " is not a struct type."; @@ -323,7 +326,7 @@ spv_result_t ValidateMemberDecorate(ValidationState_t& _, << " members. Largest valid index is " << member_count - 1 << "."; } - const auto decoration = inst->GetOperandAs(2); + const auto decoration = inst->GetOperandAs(2); if (IsNotMemberDecoration(decoration)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.SpvDecorationString(decoration) @@ -339,10 +342,11 @@ spv_result_t ValidateDecorationGroup(ValidationState_t& _, const auto decoration_group = _.FindDef(decoration_group_id); for (auto pair : decoration_group->uses()) { auto use = pair.first; - if (use->opcode() != SpvOpDecorate && use->opcode() != SpvOpGroupDecorate && - use->opcode() != SpvOpGroupMemberDecorate && - use->opcode() != SpvOpName && use->opcode() != SpvOpDecorateId && - !use->IsNonSemantic()) { + if (use->opcode() != spv::Op::OpDecorate && + use->opcode() != spv::Op::OpGroupDecorate && + use->opcode() != spv::Op::OpGroupMemberDecorate && + use->opcode() != spv::Op::OpName && + use->opcode() != spv::Op::OpDecorateId && !use->IsNonSemantic()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Result id of OpDecorationGroup can only " << "be targeted by OpName, OpGroupDecorate, " @@ -356,7 +360,8 @@ spv_result_t ValidateGroupDecorate(ValidationState_t& _, const Instruction* inst) { const auto decoration_group_id = inst->GetOperandAs(0); auto decoration_group = _.FindDef(decoration_group_id); - if (!decoration_group || SpvOpDecorationGroup != decoration_group->opcode()) { + if (!decoration_group || + spv::Op::OpDecorationGroup != decoration_group->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpGroupDecorate Decoration group " << _.getIdName(decoration_group_id) << " is not a decoration group."; @@ -364,7 +369,7 @@ spv_result_t ValidateGroupDecorate(ValidationState_t& _, for (unsigned i = 1; i < inst->operands().size(); ++i) { auto target_id = inst->GetOperandAs(i); auto target = _.FindDef(target_id); - if (!target || target->opcode() == SpvOpDecorationGroup) { + if (!target || target->opcode() == spv::Op::OpDecorationGroup) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpGroupDecorate may not target OpDecorationGroup " << _.getIdName(target_id); @@ -377,7 +382,8 @@ spv_result_t ValidateGroupMemberDecorate(ValidationState_t& _, const Instruction* inst) { const auto decoration_group_id = inst->GetOperandAs(0); const auto decoration_group = _.FindDef(decoration_group_id); - if (!decoration_group || SpvOpDecorationGroup != decoration_group->opcode()) { + if (!decoration_group || + spv::Op::OpDecorationGroup != decoration_group->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpGroupMemberDecorate Decoration group " << _.getIdName(decoration_group_id) << " is not a decoration group."; @@ -388,7 +394,7 @@ spv_result_t ValidateGroupMemberDecorate(ValidationState_t& _, const uint32_t struct_id = inst->GetOperandAs(i); const uint32_t index = inst->GetOperandAs(i + 1); auto struct_instr = _.FindDef(struct_id); - if (!struct_instr || SpvOpTypeStruct != struct_instr->opcode()) { + if (!struct_instr || spv::Op::OpTypeStruct != struct_instr->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpGroupMemberDecorate Structure type " << _.getIdName(struct_id) << " is not a struct type."; @@ -413,10 +419,11 @@ spv_result_t ValidateGroupMemberDecorate(ValidationState_t& _, spv_result_t RegisterDecorations(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { - case SpvOpDecorate: - case SpvOpDecorateId: { + case spv::Op::OpDecorate: + case spv::Op::OpDecorateId: { const uint32_t target_id = inst->word(1); - const SpvDecoration dec_type = static_cast(inst->word(2)); + const spv::Decoration dec_type = + static_cast(inst->word(2)); std::vector dec_params; if (inst->words().size() > 3) { dec_params.insert(dec_params.end(), inst->words().begin() + 3, @@ -425,10 +432,11 @@ spv_result_t RegisterDecorations(ValidationState_t& _, _.RegisterDecorationForId(target_id, Decoration(dec_type, dec_params)); break; } - case SpvOpMemberDecorate: { + case spv::Op::OpMemberDecorate: { const uint32_t struct_id = inst->word(1); const uint32_t index = inst->word(2); - const SpvDecoration dec_type = static_cast(inst->word(3)); + const spv::Decoration dec_type = + static_cast(inst->word(3)); std::vector dec_params; if (inst->words().size() > 4) { dec_params.insert(dec_params.end(), inst->words().begin() + 4, @@ -438,12 +446,12 @@ spv_result_t RegisterDecorations(ValidationState_t& _, Decoration(dec_type, dec_params, index)); break; } - case SpvOpDecorationGroup: { + case spv::Op::OpDecorationGroup: { // We don't need to do anything right now. Assigning decorations to groups // will be taken care of via OpGroupDecorate. break; } - case SpvOpGroupDecorate: { + case spv::Op::OpGroupDecorate: { // Word 1 is the group . All subsequent words are target s that // are going to be decorated with the decorations. const uint32_t decoration_group_id = inst->word(1); @@ -456,7 +464,7 @@ spv_result_t RegisterDecorations(ValidationState_t& _, } break; } - case SpvOpGroupMemberDecorate: { + case spv::Op::OpGroupMemberDecorate: { // Word 1 is the Decoration Group followed by (struct,literal) // pairs. All decorations of the group should be applied to all the struct // members that are specified in the instructions. @@ -486,24 +494,24 @@ spv_result_t RegisterDecorations(ValidationState_t& _, spv_result_t AnnotationPass(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { - case SpvOpDecorate: + case spv::Op::OpDecorate: if (auto error = ValidateDecorate(_, inst)) return error; break; - case SpvOpDecorateId: + case spv::Op::OpDecorateId: if (auto error = ValidateDecorateId(_, inst)) return error; break; - // TODO(dneto): SpvOpDecorateStringGOOGLE + // TODO(dneto): spv::Op::OpDecorateStringGOOGLE // See https://github.com/KhronosGroup/SPIRV-Tools/issues/2253 - case SpvOpMemberDecorate: + case spv::Op::OpMemberDecorate: if (auto error = ValidateMemberDecorate(_, inst)) return error; break; - case SpvOpDecorationGroup: + case spv::Op::OpDecorationGroup: if (auto error = ValidateDecorationGroup(_, inst)) return error; break; - case SpvOpGroupDecorate: + case spv::Op::OpGroupDecorate: if (auto error = ValidateGroupDecorate(_, inst)) return error; break; - case SpvOpGroupMemberDecorate: + case spv::Op::OpGroupMemberDecorate: if (auto error = ValidateGroupMemberDecorate(_, inst)) return error; break; default: diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_arithmetics.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_arithmetics.cpp index bae9b5dc..b608a859 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_arithmetics.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_arithmetics.cpp @@ -14,13 +14,11 @@ // Performs validation of arithmetic instructions. -#include "source/val/validate.h" - #include -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools { @@ -28,29 +26,45 @@ namespace val { // Validates correctness of arithmetic instructions. spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); const uint32_t result_type = inst->type_id(); switch (opcode) { - case SpvOpFAdd: - case SpvOpFSub: - case SpvOpFMul: - case SpvOpFDiv: - case SpvOpFRem: - case SpvOpFMod: - case SpvOpFNegate: { + case spv::Op::OpFAdd: + case spv::Op::OpFSub: + case spv::Op::OpFMul: + case spv::Op::OpFDiv: + case spv::Op::OpFRem: + case spv::Op::OpFMod: + case spv::Op::OpFNegate: { bool supportsCoopMat = - (opcode != SpvOpFMul && opcode != SpvOpFRem && opcode != SpvOpFMod); + (opcode != spv::Op::OpFMul && opcode != spv::Op::OpFRem && + opcode != spv::Op::OpFMod); if (!_.IsFloatScalarType(result_type) && !_.IsFloatVectorType(result_type) && - !(supportsCoopMat && _.IsFloatCooperativeMatrixType(result_type))) + !(supportsCoopMat && _.IsFloatCooperativeMatrixType(result_type)) && + !(opcode == spv::Op::OpFMul && + _.IsCooperativeMatrixKHRType(result_type) && + _.IsFloatCooperativeMatrixType(result_type))) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected floating scalar or vector type as Result Type: " << spvOpcodeString(opcode); for (size_t operand_index = 2; operand_index < inst->operands().size(); ++operand_index) { - if (_.GetOperandTypeId(inst, operand_index) != result_type) + if (supportsCoopMat && _.IsCooperativeMatrixKHRType(result_type)) { + const uint32_t type_id = _.GetOperandTypeId(inst, operand_index); + if (!_.IsCooperativeMatrixKHRType(type_id) || + !_.IsFloatCooperativeMatrixType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected arithmetic operands to be of Result Type: " + << spvOpcodeString(opcode) << " operand index " + << operand_index; + } + spv_result_t ret = + _.CooperativeMatrixShapesMatch(inst, type_id, result_type); + if (ret != SPV_SUCCESS) return ret; + } else if (_.GetOperandTypeId(inst, operand_index) != result_type) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected arithmetic operands to be of Result Type: " << spvOpcodeString(opcode) << " operand index " @@ -59,9 +73,9 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpUDiv: - case SpvOpUMod: { - bool supportsCoopMat = (opcode == SpvOpUDiv); + case spv::Op::OpUDiv: + case spv::Op::OpUMod: { + bool supportsCoopMat = (opcode == spv::Op::OpUDiv); if (!_.IsUnsignedIntScalarType(result_type) && !_.IsUnsignedIntVectorType(result_type) && !(supportsCoopMat && @@ -72,7 +86,19 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { for (size_t operand_index = 2; operand_index < inst->operands().size(); ++operand_index) { - if (_.GetOperandTypeId(inst, operand_index) != result_type) + if (supportsCoopMat && _.IsCooperativeMatrixKHRType(result_type)) { + const uint32_t type_id = _.GetOperandTypeId(inst, operand_index); + if (!_.IsCooperativeMatrixKHRType(type_id) || + !_.IsUnsignedIntCooperativeMatrixType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected arithmetic operands to be of Result Type: " + << spvOpcodeString(opcode) << " operand index " + << operand_index; + } + spv_result_t ret = + _.CooperativeMatrixShapesMatch(inst, type_id, result_type); + if (ret != SPV_SUCCESS) return ret; + } else if (_.GetOperandTypeId(inst, operand_index) != result_type) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected arithmetic operands to be of Result Type: " << spvOpcodeString(opcode) << " operand index " @@ -81,17 +107,21 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpISub: - case SpvOpIAdd: - case SpvOpIMul: - case SpvOpSDiv: - case SpvOpSMod: - case SpvOpSRem: - case SpvOpSNegate: { + case spv::Op::OpISub: + case spv::Op::OpIAdd: + case spv::Op::OpIMul: + case spv::Op::OpSDiv: + case spv::Op::OpSMod: + case spv::Op::OpSRem: + case spv::Op::OpSNegate: { bool supportsCoopMat = - (opcode != SpvOpIMul && opcode != SpvOpSRem && opcode != SpvOpSMod); + (opcode != spv::Op::OpIMul && opcode != spv::Op::OpSRem && + opcode != spv::Op::OpSMod); if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type) && - !(supportsCoopMat && _.IsIntCooperativeMatrixType(result_type))) + !(supportsCoopMat && _.IsIntCooperativeMatrixType(result_type)) && + !(opcode == spv::Op::OpIMul && + _.IsCooperativeMatrixKHRType(result_type) && + _.IsIntCooperativeMatrixType(result_type))) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected int scalar or vector type as Result Type: " << spvOpcodeString(opcode); @@ -102,9 +132,26 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { for (size_t operand_index = 2; operand_index < inst->operands().size(); ++operand_index) { const uint32_t type_id = _.GetOperandTypeId(inst, operand_index); + + if (supportsCoopMat && _.IsCooperativeMatrixKHRType(result_type)) { + if (!_.IsCooperativeMatrixKHRType(type_id) || + !_.IsIntCooperativeMatrixType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected arithmetic operands to be of Result Type: " + << spvOpcodeString(opcode) << " operand index " + << operand_index; + } + spv_result_t ret = + _.CooperativeMatrixShapesMatch(inst, type_id, result_type); + if (ret != SPV_SUCCESS) return ret; + } + if (!type_id || (!_.IsIntScalarType(type_id) && !_.IsIntVectorType(type_id) && - !(supportsCoopMat && _.IsIntCooperativeMatrixType(result_type)))) + !(supportsCoopMat && _.IsIntCooperativeMatrixType(result_type)) && + !(opcode == spv::Op::OpIMul && + _.IsCooperativeMatrixKHRType(result_type) && + _.IsIntCooperativeMatrixType(result_type)))) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected int scalar or vector type as operand: " << spvOpcodeString(opcode) << " operand index " @@ -125,7 +172,7 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpDot: { + case spv::Op::OpDot: { if (!_.IsFloatScalarType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected float scalar type as Result Type: " @@ -162,7 +209,7 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpVectorTimesScalar: { + case spv::Op::OpVectorTimesScalar: { if (!_.IsFloatVectorType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected float vector type as Result Type: " @@ -185,9 +232,9 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpMatrixTimesScalar: { + case spv::Op::OpMatrixTimesScalar: { if (!_.IsFloatMatrixType(result_type) && - !_.IsCooperativeMatrixType(result_type)) + !(_.IsCooperativeMatrixType(result_type))) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected float matrix type as Result Type: " << spvOpcodeString(opcode); @@ -209,7 +256,7 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpVectorTimesMatrix: { + case spv::Op::OpVectorTimesMatrix: { const uint32_t vector_type_id = _.GetOperandTypeId(inst, 2); const uint32_t matrix_type_id = _.GetOperandTypeId(inst, 3); @@ -259,7 +306,7 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpMatrixTimesVector: { + case spv::Op::OpMatrixTimesVector: { const uint32_t matrix_type_id = _.GetOperandTypeId(inst, 2); const uint32_t vector_type_id = _.GetOperandTypeId(inst, 3); @@ -303,7 +350,7 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpMatrixTimesMatrix: { + case spv::Op::OpMatrixTimesMatrix: { const uint32_t left_type_id = _.GetOperandTypeId(inst, 2); const uint32_t right_type_id = _.GetOperandTypeId(inst, 3); @@ -369,7 +416,7 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpOuterProduct: { + case spv::Op::OpOuterProduct: { const uint32_t left_type_id = _.GetOperandTypeId(inst, 2); const uint32_t right_type_id = _.GetOperandTypeId(inst, 3); @@ -407,10 +454,10 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpIAddCarry: - case SpvOpISubBorrow: - case SpvOpUMulExtended: - case SpvOpSMulExtended: { + case spv::Op::OpIAddCarry: + case spv::Op::OpISubBorrow: + case spv::Op::OpUMulExtended: + case spv::Op::OpSMulExtended: { std::vector result_types; if (!_.GetStructMemberTypes(result_type, &result_types)) return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -422,7 +469,7 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { << "Expected Result Type struct to have two members: " << spvOpcodeString(opcode); - if (opcode == SpvOpSMulExtended) { + if (opcode == spv::Op::OpSMulExtended) { if (!_.IsIntScalarType(result_types[0]) && !_.IsIntVectorType(result_types[0])) return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -453,28 +500,114 @@ spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpCooperativeMatrixMulAddNV: { + case spv::Op::OpCooperativeMatrixMulAddNV: { const uint32_t D_type_id = _.GetOperandTypeId(inst, 1); const uint32_t A_type_id = _.GetOperandTypeId(inst, 2); const uint32_t B_type_id = _.GetOperandTypeId(inst, 3); const uint32_t C_type_id = _.GetOperandTypeId(inst, 4); - if (!_.IsCooperativeMatrixType(A_type_id)) { + if (!_.IsCooperativeMatrixNVType(A_type_id)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected cooperative matrix type as A Type: " << spvOpcodeString(opcode); } - if (!_.IsCooperativeMatrixType(B_type_id)) { + if (!_.IsCooperativeMatrixNVType(B_type_id)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected cooperative matrix type as B Type: " << spvOpcodeString(opcode); } - if (!_.IsCooperativeMatrixType(C_type_id)) { + if (!_.IsCooperativeMatrixNVType(C_type_id)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected cooperative matrix type as C Type: " << spvOpcodeString(opcode); } - if (!_.IsCooperativeMatrixType(D_type_id)) { + if (!_.IsCooperativeMatrixNVType(D_type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected cooperative matrix type as Result Type: " + << spvOpcodeString(opcode); + } + + const auto A = _.FindDef(A_type_id); + const auto B = _.FindDef(B_type_id); + const auto C = _.FindDef(C_type_id); + const auto D = _.FindDef(D_type_id); + + std::tuple A_scope, B_scope, C_scope, D_scope, + A_rows, B_rows, C_rows, D_rows, A_cols, B_cols, C_cols, D_cols; + + A_scope = _.EvalInt32IfConst(A->GetOperandAs(2)); + B_scope = _.EvalInt32IfConst(B->GetOperandAs(2)); + C_scope = _.EvalInt32IfConst(C->GetOperandAs(2)); + D_scope = _.EvalInt32IfConst(D->GetOperandAs(2)); + + A_rows = _.EvalInt32IfConst(A->GetOperandAs(3)); + B_rows = _.EvalInt32IfConst(B->GetOperandAs(3)); + C_rows = _.EvalInt32IfConst(C->GetOperandAs(3)); + D_rows = _.EvalInt32IfConst(D->GetOperandAs(3)); + + A_cols = _.EvalInt32IfConst(A->GetOperandAs(4)); + B_cols = _.EvalInt32IfConst(B->GetOperandAs(4)); + C_cols = _.EvalInt32IfConst(C->GetOperandAs(4)); + D_cols = _.EvalInt32IfConst(D->GetOperandAs(4)); + + const auto notEqual = [](std::tuple X, + std::tuple Y) { + return (std::get<1>(X) && std::get<1>(Y) && + std::get<2>(X) != std::get<2>(Y)); + }; + + if (notEqual(A_scope, B_scope) || notEqual(A_scope, C_scope) || + notEqual(A_scope, D_scope) || notEqual(B_scope, C_scope) || + notEqual(B_scope, D_scope) || notEqual(C_scope, D_scope)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Cooperative matrix scopes must match: " + << spvOpcodeString(opcode); + } + + if (notEqual(A_rows, C_rows) || notEqual(A_rows, D_rows) || + notEqual(C_rows, D_rows)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Cooperative matrix 'M' mismatch: " + << spvOpcodeString(opcode); + } + + if (notEqual(B_cols, C_cols) || notEqual(B_cols, D_cols) || + notEqual(C_cols, D_cols)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Cooperative matrix 'N' mismatch: " + << spvOpcodeString(opcode); + } + + if (notEqual(A_cols, B_rows)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Cooperative matrix 'K' mismatch: " + << spvOpcodeString(opcode); + } + break; + } + + case spv::Op::OpCooperativeMatrixMulAddKHR: { + const uint32_t D_type_id = _.GetOperandTypeId(inst, 1); + const uint32_t A_type_id = _.GetOperandTypeId(inst, 2); + const uint32_t B_type_id = _.GetOperandTypeId(inst, 3); + const uint32_t C_type_id = _.GetOperandTypeId(inst, 4); + + if (!_.IsCooperativeMatrixAType(A_type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Cooperative matrix type must be A Type: " + << spvOpcodeString(opcode); + } + if (!_.IsCooperativeMatrixBType(B_type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Cooperative matrix type must be B Type: " + << spvOpcodeString(opcode); + } + if (!_.IsCooperativeMatrixAccType(C_type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Cooperative matrix type must be Accumulator Type: " + << spvOpcodeString(opcode); + } + if (!_.IsCooperativeMatrixKHRType(D_type_id)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected cooperative matrix type as Result Type: " << spvOpcodeString(opcode); diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_atomics.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_atomics.cpp index bf565c31..b745a9ec 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_atomics.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_atomics.cpp @@ -16,31 +16,29 @@ // Validates correctness of atomic SPIR-V instructions. -#include "source/val/validate.h" - -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_target_env.h" #include "source/util/bitutils.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validate_memory_semantics.h" #include "source/val/validate_scopes.h" #include "source/val/validation_state.h" namespace { -bool IsStorageClassAllowedByUniversalRules(uint32_t storage_class) { +bool IsStorageClassAllowedByUniversalRules(spv::StorageClass storage_class) { switch (storage_class) { - case SpvStorageClassUniform: - case SpvStorageClassStorageBuffer: - case SpvStorageClassWorkgroup: - case SpvStorageClassCrossWorkgroup: - case SpvStorageClassGeneric: - case SpvStorageClassAtomicCounter: - case SpvStorageClassImage: - case SpvStorageClassFunction: - case SpvStorageClassPhysicalStorageBuffer: - case SpvStorageClassTaskPayloadWorkgroupEXT: + case spv::StorageClass::Uniform: + case spv::StorageClass::StorageBuffer: + case spv::StorageClass::Workgroup: + case spv::StorageClass::CrossWorkgroup: + case spv::StorageClass::Generic: + case spv::StorageClass::AtomicCounter: + case spv::StorageClass::Image: + case spv::StorageClass::Function: + case spv::StorageClass::PhysicalStorageBuffer: + case spv::StorageClass::TaskPayloadWorkgroupEXT: return true; break; default: @@ -48,10 +46,10 @@ bool IsStorageClassAllowedByUniversalRules(uint32_t storage_class) { } } -bool HasReturnType(uint32_t opcode) { +bool HasReturnType(spv::Op opcode) { switch (opcode) { - case SpvOpAtomicStore: - case SpvOpAtomicFlagClear: + case spv::Op::OpAtomicStore: + case spv::Op::OpAtomicFlagClear: return false; break; default: @@ -59,11 +57,11 @@ bool HasReturnType(uint32_t opcode) { } } -bool HasOnlyFloatReturnType(uint32_t opcode) { +bool HasOnlyFloatReturnType(spv::Op opcode) { switch (opcode) { - case SpvOpAtomicFAddEXT: - case SpvOpAtomicFMinEXT: - case SpvOpAtomicFMaxEXT: + case spv::Op::OpAtomicFAddEXT: + case spv::Op::OpAtomicFMinEXT: + case spv::Op::OpAtomicFMaxEXT: return true; break; default: @@ -71,21 +69,21 @@ bool HasOnlyFloatReturnType(uint32_t opcode) { } } -bool HasOnlyIntReturnType(uint32_t opcode) { +bool HasOnlyIntReturnType(spv::Op opcode) { switch (opcode) { - case SpvOpAtomicCompareExchange: - case SpvOpAtomicCompareExchangeWeak: - case SpvOpAtomicIIncrement: - case SpvOpAtomicIDecrement: - case SpvOpAtomicIAdd: - case SpvOpAtomicISub: - case SpvOpAtomicSMin: - case SpvOpAtomicUMin: - case SpvOpAtomicSMax: - case SpvOpAtomicUMax: - case SpvOpAtomicAnd: - case SpvOpAtomicOr: - case SpvOpAtomicXor: + case spv::Op::OpAtomicCompareExchange: + case spv::Op::OpAtomicCompareExchangeWeak: + case spv::Op::OpAtomicIIncrement: + case spv::Op::OpAtomicIDecrement: + case spv::Op::OpAtomicIAdd: + case spv::Op::OpAtomicISub: + case spv::Op::OpAtomicSMin: + case spv::Op::OpAtomicUMin: + case spv::Op::OpAtomicSMax: + case spv::Op::OpAtomicUMax: + case spv::Op::OpAtomicAnd: + case spv::Op::OpAtomicOr: + case spv::Op::OpAtomicXor: return true; break; default: @@ -93,10 +91,10 @@ bool HasOnlyIntReturnType(uint32_t opcode) { } } -bool HasIntOrFloatReturnType(uint32_t opcode) { +bool HasIntOrFloatReturnType(spv::Op opcode) { switch (opcode) { - case SpvOpAtomicLoad: - case SpvOpAtomicExchange: + case spv::Op::OpAtomicLoad: + case spv::Op::OpAtomicExchange: return true; break; default: @@ -104,9 +102,9 @@ bool HasIntOrFloatReturnType(uint32_t opcode) { } } -bool HasOnlyBoolReturnType(uint32_t opcode) { +bool HasOnlyBoolReturnType(spv::Op opcode) { switch (opcode) { - case SpvOpAtomicFlagTestAndSet: + case spv::Op::OpAtomicFlagTestAndSet: return true; break; default: @@ -121,29 +119,29 @@ namespace val { // Validates correctness of atomic instructions. spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); switch (opcode) { - case SpvOpAtomicLoad: - case SpvOpAtomicStore: - case SpvOpAtomicExchange: - case SpvOpAtomicFAddEXT: - case SpvOpAtomicCompareExchange: - case SpvOpAtomicCompareExchangeWeak: - case SpvOpAtomicIIncrement: - case SpvOpAtomicIDecrement: - case SpvOpAtomicIAdd: - case SpvOpAtomicISub: - case SpvOpAtomicSMin: - case SpvOpAtomicUMin: - case SpvOpAtomicFMinEXT: - case SpvOpAtomicSMax: - case SpvOpAtomicUMax: - case SpvOpAtomicFMaxEXT: - case SpvOpAtomicAnd: - case SpvOpAtomicOr: - case SpvOpAtomicXor: - case SpvOpAtomicFlagTestAndSet: - case SpvOpAtomicFlagClear: { + case spv::Op::OpAtomicLoad: + case spv::Op::OpAtomicStore: + case spv::Op::OpAtomicExchange: + case spv::Op::OpAtomicFAddEXT: + case spv::Op::OpAtomicCompareExchange: + case spv::Op::OpAtomicCompareExchangeWeak: + case spv::Op::OpAtomicIIncrement: + case spv::Op::OpAtomicIDecrement: + case spv::Op::OpAtomicIAdd: + case spv::Op::OpAtomicISub: + case spv::Op::OpAtomicSMin: + case spv::Op::OpAtomicUMin: + case spv::Op::OpAtomicFMinEXT: + case spv::Op::OpAtomicSMax: + case spv::Op::OpAtomicUMax: + case spv::Op::OpAtomicFMaxEXT: + case spv::Op::OpAtomicAnd: + case spv::Op::OpAtomicOr: + case spv::Op::OpAtomicXor: + case spv::Op::OpAtomicFlagTestAndSet: + case spv::Op::OpAtomicFlagClear: { const uint32_t result_type = inst->type_id(); // All current atomics only are scalar result @@ -177,7 +175,7 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { uint32_t operand_index = HasReturnType(opcode) ? 2 : 0; const uint32_t pointer_type = _.GetOperandTypeId(inst, operand_index++); uint32_t data_type = 0; - uint32_t storage_class = 0; + spv::StorageClass storage_class; if (!_.GetPointerTypeInfo(pointer_type, &data_type, &storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) @@ -185,8 +183,8 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { } // Can't use result_type because OpAtomicStore doesn't have a result - if ( _.IsIntScalarType(data_type) &&_.GetBitWidth(data_type) == 64 && - !_.HasCapability(SpvCapabilityInt64Atomics)) { + if (_.IsIntScalarType(data_type) && _.GetBitWidth(data_type) == 64 && + !_.HasCapability(spv::Capability::Int64Atomics)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": 64-bit atomics require the Int64Atomics capability"; @@ -200,69 +198,69 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { } // Then Shader rules - if (_.HasCapability(SpvCapabilityShader)) { + if (_.HasCapability(spv::Capability::Shader)) { // Vulkan environment rule if (spvIsVulkanEnv(_.context()->target_env)) { - if ((storage_class != SpvStorageClassUniform) && - (storage_class != SpvStorageClassStorageBuffer) && - (storage_class != SpvStorageClassWorkgroup) && - (storage_class != SpvStorageClassImage) && - (storage_class != SpvStorageClassPhysicalStorageBuffer) && - (storage_class != SpvStorageClassTaskPayloadWorkgroupEXT)) { + if ((storage_class != spv::StorageClass::Uniform) && + (storage_class != spv::StorageClass::StorageBuffer) && + (storage_class != spv::StorageClass::Workgroup) && + (storage_class != spv::StorageClass::Image) && + (storage_class != spv::StorageClass::PhysicalStorageBuffer) && + (storage_class != spv::StorageClass::TaskPayloadWorkgroupEXT)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4686) << spvOpcodeString(opcode) << ": Vulkan spec only allows storage classes for atomic to " "be: Uniform, Workgroup, Image, StorageBuffer, " "PhysicalStorageBuffer or TaskPayloadWorkgroupEXT."; } - } else if (storage_class == SpvStorageClassFunction) { + } else if (storage_class == spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Function storage class forbidden when the Shader " "capability is declared."; } - if (opcode == SpvOpAtomicFAddEXT) { + if (opcode == spv::Op::OpAtomicFAddEXT) { // result type being float checked already if ((_.GetBitWidth(result_type) == 16) && - (!_.HasCapability(SpvCapabilityAtomicFloat16AddEXT))) { + (!_.HasCapability(spv::Capability::AtomicFloat16AddEXT))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": float add atomics require the AtomicFloat32AddEXT " "capability"; } if ((_.GetBitWidth(result_type) == 32) && - (!_.HasCapability(SpvCapabilityAtomicFloat32AddEXT))) { + (!_.HasCapability(spv::Capability::AtomicFloat32AddEXT))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": float add atomics require the AtomicFloat32AddEXT " "capability"; } if ((_.GetBitWidth(result_type) == 64) && - (!_.HasCapability(SpvCapabilityAtomicFloat64AddEXT))) { + (!_.HasCapability(spv::Capability::AtomicFloat64AddEXT))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": float add atomics require the AtomicFloat64AddEXT " "capability"; } - } else if (opcode == SpvOpAtomicFMinEXT || - opcode == SpvOpAtomicFMaxEXT) { + } else if (opcode == spv::Op::OpAtomicFMinEXT || + opcode == spv::Op::OpAtomicFMaxEXT) { if ((_.GetBitWidth(result_type) == 16) && - (!_.HasCapability(SpvCapabilityAtomicFloat16MinMaxEXT))) { + (!_.HasCapability(spv::Capability::AtomicFloat16MinMaxEXT))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": float min/max atomics require the " "AtomicFloat16MinMaxEXT capability"; } if ((_.GetBitWidth(result_type) == 32) && - (!_.HasCapability(SpvCapabilityAtomicFloat32MinMaxEXT))) { + (!_.HasCapability(spv::Capability::AtomicFloat32MinMaxEXT))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": float min/max atomics require the " "AtomicFloat32MinMaxEXT capability"; } if ((_.GetBitWidth(result_type) == 64) && - (!_.HasCapability(SpvCapabilityAtomicFloat64MinMaxEXT))) { + (!_.HasCapability(spv::Capability::AtomicFloat64MinMaxEXT))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": float min/max atomics require the " @@ -273,10 +271,10 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { // And finally OpenCL environment rules if (spvIsOpenCLEnv(_.context()->target_env)) { - if ((storage_class != SpvStorageClassFunction) && - (storage_class != SpvStorageClassWorkgroup) && - (storage_class != SpvStorageClassCrossWorkgroup) && - (storage_class != SpvStorageClassGeneric)) { + if ((storage_class != spv::StorageClass::Function) && + (storage_class != spv::StorageClass::Workgroup) && + (storage_class != spv::StorageClass::CrossWorkgroup) && + (storage_class != spv::StorageClass::Generic)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": storage class must be Function, Workgroup, " @@ -284,7 +282,7 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { } if (_.context()->target_env == SPV_ENV_OPENCL_1_2) { - if (storage_class == SpvStorageClassGeneric) { + if (storage_class == spv::StorageClass::Generic) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Storage class cannot be Generic in OpenCL 1.2 " "environment"; @@ -293,15 +291,15 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { } // If result and pointer type are different, need to do special check here - if (opcode == SpvOpAtomicFlagTestAndSet || - opcode == SpvOpAtomicFlagClear) { + if (opcode == spv::Op::OpAtomicFlagTestAndSet || + opcode == spv::Op::OpAtomicFlagClear) { if (!_.IsIntScalarType(data_type) || _.GetBitWidth(data_type) != 32) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Pointer to point to a value of 32-bit integer " "type"; } - } else if (opcode == SpvOpAtomicStore) { + } else if (opcode == spv::Op::OpAtomicStore) { if (!_.IsFloatScalarType(data_type) && !_.IsIntScalarType(data_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) @@ -325,8 +323,8 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { memory_scope)) return error; - if (opcode == SpvOpAtomicCompareExchange || - opcode == SpvOpAtomicCompareExchangeWeak) { + if (opcode == spv::Op::OpAtomicCompareExchange || + opcode == spv::Op::OpAtomicCompareExchangeWeak) { const auto unequal_semantics_index = operand_index++; if (auto error = ValidateMemorySemantics( _, inst, unequal_semantics_index, memory_scope)) @@ -346,15 +344,15 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { _.EvalInt32IfConst( inst->GetOperandAs(unequal_semantics_index)); if (is_equal_const && is_unequal_const && - ((equal_value & SpvMemorySemanticsVolatileMask) ^ - (unequal_value & SpvMemorySemanticsVolatileMask))) { + ((equal_value & uint32_t(spv::MemorySemanticsMask::Volatile)) ^ + (unequal_value & uint32_t(spv::MemorySemanticsMask::Volatile)))) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Volatile mask setting must match for Equal and Unequal " "memory semantics"; } } - if (opcode == SpvOpAtomicStore) { + if (opcode == spv::Op::OpAtomicStore) { const uint32_t value_type = _.GetOperandTypeId(inst, 3); if (value_type != data_type) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -362,10 +360,11 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { << ": expected Value type and the type pointed to by " "Pointer to be the same"; } - } else if (opcode != SpvOpAtomicLoad && opcode != SpvOpAtomicIIncrement && - opcode != SpvOpAtomicIDecrement && - opcode != SpvOpAtomicFlagTestAndSet && - opcode != SpvOpAtomicFlagClear) { + } else if (opcode != spv::Op::OpAtomicLoad && + opcode != spv::Op::OpAtomicIIncrement && + opcode != spv::Op::OpAtomicIDecrement && + opcode != spv::Op::OpAtomicFlagTestAndSet && + opcode != spv::Op::OpAtomicFlagClear) { const uint32_t value_type = _.GetOperandTypeId(inst, operand_index++); if (value_type != result_type) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -374,8 +373,8 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { } } - if (opcode == SpvOpAtomicCompareExchange || - opcode == SpvOpAtomicCompareExchangeWeak) { + if (opcode == spv::Op::OpAtomicCompareExchange || + opcode == spv::Op::OpAtomicCompareExchangeWeak) { const uint32_t comparator_type = _.GetOperandTypeId(inst, operand_index++); if (comparator_type != result_type) { diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_barriers.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_barriers.cpp index 03225d86..0abd5c85 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_barriers.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_barriers.cpp @@ -16,11 +16,8 @@ #include -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_constant.h" -#include "source/spirv_target_env.h" -#include "source/util/bitutils.h" #include "source/val/instruction.h" #include "source/val/validate.h" #include "source/val/validate_memory_semantics.h" @@ -32,20 +29,20 @@ namespace val { // Validates correctness of barrier instructions. spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); const uint32_t result_type = inst->type_id(); switch (opcode) { - case SpvOpControlBarrier: { + case spv::Op::OpControlBarrier: { if (_.version() < SPV_SPIRV_VERSION_WORD(1, 3)) { _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelTessellationControl && - model != SpvExecutionModelGLCompute && - model != SpvExecutionModelKernel && - model != SpvExecutionModelTaskNV && - model != SpvExecutionModelMeshNV) { + [](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::TessellationControl && + model != spv::ExecutionModel::GLCompute && + model != spv::ExecutionModel::Kernel && + model != spv::ExecutionModel::TaskNV && + model != spv::ExecutionModel::MeshNV) { if (message) { *message = "OpControlBarrier requires one of the following " @@ -76,7 +73,7 @@ spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpMemoryBarrier: { + case spv::Op::OpMemoryBarrier: { const uint32_t memory_scope = inst->word(1); if (auto error = ValidateMemoryScope(_, inst, memory_scope)) { @@ -89,8 +86,8 @@ spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpNamedBarrierInitialize: { - if (_.GetIdOpcode(result_type) != SpvOpTypeNamedBarrier) { + case spv::Op::OpNamedBarrierInitialize: { + if (_.GetIdOpcode(result_type) != spv::Op::OpTypeNamedBarrier) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Result Type to be OpTypeNamedBarrier"; @@ -106,9 +103,9 @@ spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpMemoryNamedBarrier: { + case spv::Op::OpMemoryNamedBarrier: { const uint32_t named_barrier_type = _.GetOperandTypeId(inst, 0); - if (_.GetIdOpcode(named_barrier_type) != SpvOpTypeNamedBarrier) { + if (_.GetIdOpcode(named_barrier_type) != spv::Op::OpTypeNamedBarrier) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Named Barrier to be of type OpTypeNamedBarrier"; diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_bitwise.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_bitwise.cpp index e6e97c4a..d8d99581 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_bitwise.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_bitwise.cpp @@ -14,7 +14,6 @@ // Validates correctness of bitwise instructions. -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_target_env.h" #include "source/val/instruction.h" @@ -27,7 +26,7 @@ namespace val { // Validates when base and result need to be the same type spv_result_t ValidateBaseType(ValidationState_t& _, const Instruction* inst, const uint32_t base_type) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); if (!_.IsIntScalarType(base_type) && !_.IsIntVectorType(base_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -47,7 +46,7 @@ spv_result_t ValidateBaseType(ValidationState_t& _, const Instruction* inst, } // OpBitCount just needs same number of components - if (base_type != inst->type_id() && opcode != SpvOpBitCount) { + if (base_type != inst->type_id() && opcode != spv::Op::OpBitCount) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Base Type to be equal to Result Type: " << spvOpcodeString(opcode); @@ -58,13 +57,13 @@ spv_result_t ValidateBaseType(ValidationState_t& _, const Instruction* inst, // Validates correctness of bitwise instructions. spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); const uint32_t result_type = inst->type_id(); switch (opcode) { - case SpvOpShiftRightLogical: - case SpvOpShiftRightArithmetic: - case SpvOpShiftLeftLogical: { + case spv::Op::OpShiftRightLogical: + case spv::Op::OpShiftRightArithmetic: + case spv::Op::OpShiftLeftLogical: { if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected int scalar or vector type as Result Type: " @@ -103,10 +102,10 @@ spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpBitwiseOr: - case SpvOpBitwiseXor: - case SpvOpBitwiseAnd: - case SpvOpNot: { + case spv::Op::OpBitwiseOr: + case spv::Op::OpBitwiseXor: + case spv::Op::OpBitwiseAnd: + case spv::Op::OpNot: { if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected int scalar or vector type as Result Type: " @@ -140,7 +139,7 @@ spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpBitFieldInsert: { + case spv::Op::OpBitFieldInsert: { const uint32_t base_type = _.GetOperandTypeId(inst, 2); const uint32_t insert_type = _.GetOperandTypeId(inst, 3); const uint32_t offset_type = _.GetOperandTypeId(inst, 4); @@ -167,8 +166,8 @@ spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpBitFieldSExtract: - case SpvOpBitFieldUExtract: { + case spv::Op::OpBitFieldSExtract: + case spv::Op::OpBitFieldUExtract: { const uint32_t base_type = _.GetOperandTypeId(inst, 2); const uint32_t offset_type = _.GetOperandTypeId(inst, 3); const uint32_t count_type = _.GetOperandTypeId(inst, 4); @@ -189,7 +188,7 @@ spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpBitReverse: { + case spv::Op::OpBitReverse: { const uint32_t base_type = _.GetOperandTypeId(inst, 2); if (spv_result_t error = ValidateBaseType(_, inst, base_type)) { @@ -199,20 +198,21 @@ spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpBitCount: { + case spv::Op::OpBitCount: { if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected int scalar or vector type as Result Type: " << spvOpcodeString(opcode); const uint32_t base_type = _.GetOperandTypeId(inst, 2); - const uint32_t base_dimension = _.GetDimension(base_type); - const uint32_t result_dimension = _.GetDimension(result_type); if (spv_result_t error = ValidateBaseType(_, inst, base_type)) { return error; } + const uint32_t base_dimension = _.GetDimension(base_type); + const uint32_t result_dimension = _.GetDimension(result_type); + if (base_dimension != result_dimension) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Base dimension to be equal to Result Type " diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_builtins.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_builtins.cpp index d5b89eb1..3e817125 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_builtins.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_builtins.cpp @@ -24,10 +24,8 @@ #include #include #include -#include #include -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_target_env.h" #include "source/util/bitutils.h" @@ -62,7 +60,7 @@ spv_result_t GetUnderlyingType(ValidationState_t& _, const Instruction& inst, uint32_t* underlying_type) { if (decoration.struct_member_index() != Decoration::kInvalidMember) { - if (inst.opcode() != SpvOpTypeStruct) { + if (inst.opcode() != spv::Op::OpTypeStruct) { return _.diag(SPV_ERROR_INVALID_DATA, &inst) << GetIdDesc(inst) << "Attempted to get underlying data type via member index for " @@ -72,7 +70,7 @@ spv_result_t GetUnderlyingType(ValidationState_t& _, return SPV_SUCCESS; } - if (inst.opcode() == SpvOpTypeStruct) { + if (inst.opcode() == spv::Op::OpTypeStruct) { return _.diag(SPV_ERROR_INVALID_DATA, &inst) << GetIdDesc(inst) << " did not find an member index to get underlying data type for " @@ -84,7 +82,7 @@ spv_result_t GetUnderlyingType(ValidationState_t& _, return SPV_SUCCESS; } - uint32_t storage_class = 0; + spv::StorageClass storage_class; if (!_.GetPointerTypeInfo(inst.type_id(), underlying_type, &storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, &inst) << GetIdDesc(inst) @@ -95,22 +93,22 @@ spv_result_t GetUnderlyingType(ValidationState_t& _, } // Returns Storage Class used by the instruction if applicable. -// Returns SpvStorageClassMax if not. -SpvStorageClass GetStorageClass(const Instruction& inst) { +// Returns spv::StorageClass::Max if not. +spv::StorageClass GetStorageClass(const Instruction& inst) { switch (inst.opcode()) { - case SpvOpTypePointer: - case SpvOpTypeForwardPointer: { - return SpvStorageClass(inst.word(2)); + case spv::Op::OpTypePointer: + case spv::Op::OpTypeForwardPointer: { + return spv::StorageClass(inst.word(2)); } - case SpvOpVariable: { - return SpvStorageClass(inst.word(3)); + case spv::Op::OpVariable: { + return spv::StorageClass(inst.word(3)); } - case SpvOpGenericCastToPtrExplicit: { - return SpvStorageClass(inst.word(4)); + case spv::Op::OpGenericCastToPtrExplicit: { + return spv::StorageClass(inst.word(4)); } default: { break; } } - return SpvStorageClassMax; + return spv::StorageClass::Max; } typedef enum VUIDError_ { @@ -123,52 +121,52 @@ typedef enum VUIDError_ { const static uint32_t NumVUIDBuiltins = 36; typedef struct { - SpvBuiltIn builtIn; + spv::BuiltIn builtIn; uint32_t vuid[VUIDErrorMax]; // execution mode, storage class, type VUIDs } BuiltinVUIDMapping; std::array builtinVUIDInfo = {{ // clang-format off - {SpvBuiltInSubgroupEqMask, {0, 4370, 4371}}, - {SpvBuiltInSubgroupGeMask, {0, 4372, 4373}}, - {SpvBuiltInSubgroupGtMask, {0, 4374, 4375}}, - {SpvBuiltInSubgroupLeMask, {0, 4376, 4377}}, - {SpvBuiltInSubgroupLtMask, {0, 4378, 4379}}, - {SpvBuiltInSubgroupLocalInvocationId, {0, 4380, 4381}}, - {SpvBuiltInSubgroupSize, {0, 4382, 4383}}, - {SpvBuiltInGlobalInvocationId, {4236, 4237, 4238}}, - {SpvBuiltInLocalInvocationId, {4281, 4282, 4283}}, - {SpvBuiltInNumWorkgroups, {4296, 4297, 4298}}, - {SpvBuiltInNumSubgroups, {4293, 4294, 4295}}, - {SpvBuiltInSubgroupId, {4367, 4368, 4369}}, - {SpvBuiltInWorkgroupId, {4422, 4423, 4424}}, - {SpvBuiltInHitKindKHR, {4242, 4243, 4244}}, - {SpvBuiltInHitTNV, {4245, 4246, 4247}}, - {SpvBuiltInInstanceCustomIndexKHR, {4251, 4252, 4253}}, - {SpvBuiltInInstanceId, {4254, 4255, 4256}}, - {SpvBuiltInRayGeometryIndexKHR, {4345, 4346, 4347}}, - {SpvBuiltInObjectRayDirectionKHR, {4299, 4300, 4301}}, - {SpvBuiltInObjectRayOriginKHR, {4302, 4303, 4304}}, - {SpvBuiltInObjectToWorldKHR, {4305, 4306, 4307}}, - {SpvBuiltInWorldToObjectKHR, {4434, 4435, 4436}}, - {SpvBuiltInIncomingRayFlagsKHR, {4248, 4249, 4250}}, - {SpvBuiltInRayTminKHR, {4351, 4352, 4353}}, - {SpvBuiltInRayTmaxKHR, {4348, 4349, 4350}}, - {SpvBuiltInWorldRayDirectionKHR, {4428, 4429, 4430}}, - {SpvBuiltInWorldRayOriginKHR, {4431, 4432, 4433}}, - {SpvBuiltInLaunchIdKHR, {4266, 4267, 4268}}, - {SpvBuiltInLaunchSizeKHR, {4269, 4270, 4271}}, - {SpvBuiltInFragInvocationCountEXT, {4217, 4218, 4219}}, - {SpvBuiltInFragSizeEXT, {4220, 4221, 4222}}, - {SpvBuiltInFragStencilRefEXT, {4223, 4224, 4225}}, - {SpvBuiltInFullyCoveredEXT, {4232, 4233, 4234}}, - {SpvBuiltInCullMaskKHR, {6735, 6736, 6737}}, - {SpvBuiltInBaryCoordKHR, {4154, 4155, 4156}}, - {SpvBuiltInBaryCoordNoPerspKHR, {4160, 4161, 4162}}, + {spv::BuiltIn::SubgroupEqMask, {0, 4370, 4371}}, + {spv::BuiltIn::SubgroupGeMask, {0, 4372, 4373}}, + {spv::BuiltIn::SubgroupGtMask, {0, 4374, 4375}}, + {spv::BuiltIn::SubgroupLeMask, {0, 4376, 4377}}, + {spv::BuiltIn::SubgroupLtMask, {0, 4378, 4379}}, + {spv::BuiltIn::SubgroupLocalInvocationId, {0, 4380, 4381}}, + {spv::BuiltIn::SubgroupSize, {0, 4382, 4383}}, + {spv::BuiltIn::GlobalInvocationId, {4236, 4237, 4238}}, + {spv::BuiltIn::LocalInvocationId, {4281, 4282, 4283}}, + {spv::BuiltIn::NumWorkgroups, {4296, 4297, 4298}}, + {spv::BuiltIn::NumSubgroups, {4293, 4294, 4295}}, + {spv::BuiltIn::SubgroupId, {4367, 4368, 4369}}, + {spv::BuiltIn::WorkgroupId, {4422, 4423, 4424}}, + {spv::BuiltIn::HitKindKHR, {4242, 4243, 4244}}, + {spv::BuiltIn::HitTNV, {4245, 4246, 4247}}, + {spv::BuiltIn::InstanceCustomIndexKHR, {4251, 4252, 4253}}, + {spv::BuiltIn::InstanceId, {4254, 4255, 4256}}, + {spv::BuiltIn::RayGeometryIndexKHR, {4345, 4346, 4347}}, + {spv::BuiltIn::ObjectRayDirectionKHR, {4299, 4300, 4301}}, + {spv::BuiltIn::ObjectRayOriginKHR, {4302, 4303, 4304}}, + {spv::BuiltIn::ObjectToWorldKHR, {4305, 4306, 4307}}, + {spv::BuiltIn::WorldToObjectKHR, {4434, 4435, 4436}}, + {spv::BuiltIn::IncomingRayFlagsKHR, {4248, 4249, 4250}}, + {spv::BuiltIn::RayTminKHR, {4351, 4352, 4353}}, + {spv::BuiltIn::RayTmaxKHR, {4348, 4349, 4350}}, + {spv::BuiltIn::WorldRayDirectionKHR, {4428, 4429, 4430}}, + {spv::BuiltIn::WorldRayOriginKHR, {4431, 4432, 4433}}, + {spv::BuiltIn::LaunchIdKHR, {4266, 4267, 4268}}, + {spv::BuiltIn::LaunchSizeKHR, {4269, 4270, 4271}}, + {spv::BuiltIn::FragInvocationCountEXT, {4217, 4218, 4219}}, + {spv::BuiltIn::FragSizeEXT, {4220, 4221, 4222}}, + {spv::BuiltIn::FragStencilRefEXT, {4223, 4224, 4225}}, + {spv::BuiltIn::FullyCoveredEXT, {4232, 4233, 4234}}, + {spv::BuiltIn::CullMaskKHR, {6735, 6736, 6737}}, + {spv::BuiltIn::BaryCoordKHR, {4154, 4155, 4156}}, + {spv::BuiltIn::BaryCoordNoPerspKHR, {4160, 4161, 4162}}, // clang-format off } }; -uint32_t GetVUIDForBuiltin(SpvBuiltIn builtIn, VUIDError type) { +uint32_t GetVUIDForBuiltin(spv::BuiltIn builtIn, VUIDError type) { uint32_t vuid = 0; for (const auto& iter: builtinVUIDInfo) { if (iter.builtIn == builtIn) { @@ -180,57 +178,57 @@ uint32_t GetVUIDForBuiltin(SpvBuiltIn builtIn, VUIDError type) { return vuid; } -bool IsExecutionModelValidForRtBuiltIn(SpvBuiltIn builtin, - SpvExecutionModel stage) { +bool IsExecutionModelValidForRtBuiltIn(spv::BuiltIn builtin, + spv::ExecutionModel stage) { switch (builtin) { - case SpvBuiltInHitKindKHR: - case SpvBuiltInHitTNV: - if (stage == SpvExecutionModelAnyHitKHR || - stage == SpvExecutionModelClosestHitKHR) { + case spv::BuiltIn::HitKindKHR: + case spv::BuiltIn::HitTNV: + if (stage == spv::ExecutionModel::AnyHitKHR || + stage == spv::ExecutionModel::ClosestHitKHR) { return true; } break; - case SpvBuiltInInstanceCustomIndexKHR: - case SpvBuiltInInstanceId: - case SpvBuiltInRayGeometryIndexKHR: - case SpvBuiltInObjectRayDirectionKHR: - case SpvBuiltInObjectRayOriginKHR: - case SpvBuiltInObjectToWorldKHR: - case SpvBuiltInWorldToObjectKHR: + case spv::BuiltIn::InstanceCustomIndexKHR: + case spv::BuiltIn::InstanceId: + case spv::BuiltIn::RayGeometryIndexKHR: + case spv::BuiltIn::ObjectRayDirectionKHR: + case spv::BuiltIn::ObjectRayOriginKHR: + case spv::BuiltIn::ObjectToWorldKHR: + case spv::BuiltIn::WorldToObjectKHR: switch (stage) { - case SpvExecutionModelIntersectionKHR: - case SpvExecutionModelAnyHitKHR: - case SpvExecutionModelClosestHitKHR: + case spv::ExecutionModel::IntersectionKHR: + case spv::ExecutionModel::AnyHitKHR: + case spv::ExecutionModel::ClosestHitKHR: return true; default: return false; } break; - case SpvBuiltInIncomingRayFlagsKHR: - case SpvBuiltInRayTminKHR: - case SpvBuiltInRayTmaxKHR: - case SpvBuiltInWorldRayDirectionKHR: - case SpvBuiltInWorldRayOriginKHR: - case SpvBuiltInCullMaskKHR: + case spv::BuiltIn::IncomingRayFlagsKHR: + case spv::BuiltIn::RayTminKHR: + case spv::BuiltIn::RayTmaxKHR: + case spv::BuiltIn::WorldRayDirectionKHR: + case spv::BuiltIn::WorldRayOriginKHR: + case spv::BuiltIn::CullMaskKHR: switch (stage) { - case SpvExecutionModelIntersectionKHR: - case SpvExecutionModelAnyHitKHR: - case SpvExecutionModelClosestHitKHR: - case SpvExecutionModelMissKHR: + case spv::ExecutionModel::IntersectionKHR: + case spv::ExecutionModel::AnyHitKHR: + case spv::ExecutionModel::ClosestHitKHR: + case spv::ExecutionModel::MissKHR: return true; default: return false; } break; - case SpvBuiltInLaunchIdKHR: - case SpvBuiltInLaunchSizeKHR: + case spv::BuiltIn::LaunchIdKHR: + case spv::BuiltIn::LaunchSizeKHR: switch (stage) { - case SpvExecutionModelRayGenerationKHR: - case SpvExecutionModelIntersectionKHR: - case SpvExecutionModelAnyHitKHR: - case SpvExecutionModelClosestHitKHR: - case SpvExecutionModelMissKHR: - case SpvExecutionModelCallableKHR: + case spv::ExecutionModel::RayGenerationKHR: + case spv::ExecutionModel::IntersectionKHR: + case spv::ExecutionModel::AnyHitKHR: + case spv::ExecutionModel::ClosestHitKHR: + case spv::ExecutionModel::MissKHR: + case spv::ExecutionModel::CallableKHR: return true; default: return false; @@ -333,7 +331,7 @@ class BuiltInsValidator { // Used for GlobalInvocationId, LocalInvocationId, NumWorkgroups, WorkgroupId. spv_result_t ValidateComputeShaderI32Vec3InputAtDefinition( const Decoration& decoration, const Instruction& inst); - spv_result_t ValidateSMBuiltinsAtDefinition(const Decoration& decoration, + spv_result_t ValidateNVSMOrARMCoreBuiltinsAtDefinition(const Decoration& decoration, const Instruction& inst); // Used for BaryCoord, BaryCoordNoPersp. spv_result_t ValidateFragmentShaderF32Vec3InputAtDefinition( @@ -528,7 +526,7 @@ class BuiltInsValidator { const Instruction& referenced_inst, const Instruction& referenced_from_inst); - spv_result_t ValidateSMBuiltinsAtReference( + spv_result_t ValidateNVSMOrARMCoreBuiltinsAtReference( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst); @@ -559,7 +557,7 @@ class BuiltInsValidator { // |referenced_from_inst| - instruction which references id defined by // |referenced_inst| from within a function. spv_result_t ValidateNotCalledWithExecutionModel( - int vuid, const char* comment, SpvExecutionModel execution_model, + int vuid, const char* comment, spv::ExecutionModel execution_model, const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst); @@ -642,7 +640,7 @@ class BuiltInsValidator { const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst, - SpvExecutionModel execution_model = SpvExecutionModelMax) const; + spv::ExecutionModel execution_model = spv::ExecutionModel::Max) const; // Generates strings like "ID <51> (OpTypePointer) uses storage class // UniformConstant". @@ -671,12 +669,12 @@ class BuiltInsValidator { const std::vector* entry_points_ = &no_entry_points; // Execution models with which the current function can be called. - std::set execution_models_; + std::set execution_models_; }; void BuiltInsValidator::Update(const Instruction& inst) { - const SpvOp opcode = inst.opcode(); - if (opcode == SpvOpFunction) { + const spv::Op opcode = inst.opcode(); + if (opcode == spv::Op::OpFunction) { // Entering a function. assert(function_id_ == 0); function_id_ = inst.id(); @@ -691,7 +689,7 @@ void BuiltInsValidator::Update(const Instruction& inst) { } } - if (opcode == SpvOpFunctionEnd) { + if (opcode == spv::Op::OpFunctionEnd) { // Exiting a function. assert(function_id_ != 0); function_id_ = 0; @@ -704,7 +702,7 @@ std::string BuiltInsValidator::GetDefinitionDesc( const Decoration& decoration, const Instruction& inst) const { std::ostringstream ss; if (decoration.struct_member_index() != Decoration::kInvalidMember) { - assert(inst.opcode() == SpvOpTypeStruct); + assert(inst.opcode() == spv::Op::OpTypeStruct); ss << "Member #" << decoration.struct_member_index(); ss << " of struct ID <" << inst.id() << ">"; } else { @@ -716,7 +714,7 @@ std::string BuiltInsValidator::GetDefinitionDesc( std::string BuiltInsValidator::GetReferenceDesc( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst, - SpvExecutionModel execution_model) const { + spv::ExecutionModel execution_model) const { std::ostringstream ss; ss << GetIdDesc(referenced_from_inst) << " is referencing " << GetIdDesc(referenced_inst); @@ -729,10 +727,10 @@ std::string BuiltInsValidator::GetReferenceDesc( decoration.params()[0]); if (function_id_) { ss << " in function <" << function_id_ << ">"; - if (execution_model != SpvExecutionModelMax) { + if (execution_model != spv::ExecutionModel::Max) { ss << " called with execution model "; ss << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_EXECUTION_MODEL, - execution_model); + uint32_t(execution_model)); } } ss << "."; @@ -744,7 +742,7 @@ std::string BuiltInsValidator::GetStorageClassDesc( std::ostringstream ss; ss << GetIdDesc(inst) << " uses storage class "; ss << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_STORAGE_CLASS, - GetStorageClass(inst)); + uint32_t(GetStorageClass(inst))); ss << "."; return ss.str(); } @@ -803,7 +801,7 @@ spv_result_t BuiltInsValidator::ValidateOptionalArrayedI32( } // Strip the array, if present. - if (_.GetIdOpcode(underlying_type) == SpvOpTypeArray) { + if (_.GetIdOpcode(underlying_type) == spv::Op::OpTypeArray) { underlying_type = _.FindDef(underlying_type)->word(2u); } @@ -839,7 +837,7 @@ spv_result_t BuiltInsValidator::ValidateOptionalArrayedF32( } // Strip the array, if present. - if (_.GetIdOpcode(underlying_type) == SpvOpTypeArray) { + if (_.GetIdOpcode(underlying_type) == spv::Op::OpTypeArray) { underlying_type = _.FindDef(underlying_type)->word(2u); } @@ -922,7 +920,7 @@ spv_result_t BuiltInsValidator::ValidateOptionalArrayedF32Vec( } // Strip the array, if present. - if (_.GetIdOpcode(underlying_type) == SpvOpTypeArray) { + if (_.GetIdOpcode(underlying_type) == spv::Op::OpTypeArray) { underlying_type = _.FindDef(underlying_type)->word(2u); } @@ -983,7 +981,7 @@ spv_result_t BuiltInsValidator::ValidateI32Arr( } const Instruction* const type_inst = _.FindDef(underlying_type); - if (type_inst->opcode() != SpvOpTypeArray) { + if (type_inst->opcode() != spv::Op::OpTypeArray) { return diag(GetDefinitionDesc(decoration, inst) + " is not an array."); } @@ -1029,9 +1027,9 @@ spv_result_t BuiltInsValidator::ValidateOptionalArrayedF32Arr( } // Strip an extra layer of arraying if present. - if (_.GetIdOpcode(underlying_type) == SpvOpTypeArray) { + if (_.GetIdOpcode(underlying_type) == spv::Op::OpTypeArray) { uint32_t subtype = _.FindDef(underlying_type)->word(2u); - if (_.GetIdOpcode(subtype) == SpvOpTypeArray) { + if (_.GetIdOpcode(subtype) == spv::Op::OpTypeArray) { underlying_type = subtype; } } @@ -1046,7 +1044,7 @@ spv_result_t BuiltInsValidator::ValidateF32ArrHelper( const std::function& diag, uint32_t underlying_type) { const Instruction* const type_inst = _.FindDef(underlying_type); - if (type_inst->opcode() != SpvOpTypeArray) { + if (type_inst->opcode() != spv::Op::OpTypeArray) { return diag(GetDefinitionDesc(decoration, inst) + " is not an array."); } @@ -1107,14 +1105,14 @@ spv_result_t BuiltInsValidator::ValidateF32Mat( } spv_result_t BuiltInsValidator::ValidateNotCalledWithExecutionModel( - int vuid, const char* comment, SpvExecutionModel execution_model, + int vuid, const char* comment, spv::ExecutionModel execution_model, const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (function_id_) { if (execution_models_.count(execution_model)) { const char* execution_model_str = _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_EXECUTION_MODEL, execution_model); + SPV_OPERAND_TYPE_EXECUTION_MODEL, uint32_t(execution_model)); const char* built_in_str = _.grammar().lookupOperandName( SPV_OPERAND_TYPE_BUILT_IN, decoration.params()[0]); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) @@ -1149,11 +1147,11 @@ spv_result_t BuiltInsValidator::ValidateClipOrCullDistanceAtReference( const Instruction& referenced_from_inst) { uint32_t operand = decoration.params()[0]; if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { - uint32_t vuid = (decoration.params()[0] == SpvBuiltInClipDistance) ? 4190 : 4199; + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { + uint32_t vuid = (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::ClipDistance) ? 4190 : 4199; return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -1165,54 +1163,54 @@ spv_result_t BuiltInsValidator::ValidateClipOrCullDistanceAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - if (storage_class == SpvStorageClassInput) { + if (storage_class == spv::StorageClass::Input) { assert(function_id_ == 0); - uint32_t vuid = (decoration.params()[0] == SpvBuiltInClipDistance) ? 4188 : 4197; + uint32_t vuid = (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::ClipDistance) ? 4188 : 4197; id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, vuid, "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance to be " "used for variables with Input storage class if execution model is " "Vertex.", - SpvExecutionModelVertex, decoration, built_in_inst, + spv::ExecutionModel::Vertex, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, vuid, "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance to be " "used for variables with Input storage class if execution model is " "MeshNV.", - SpvExecutionModelMeshNV, decoration, built_in_inst, + spv::ExecutionModel::MeshNV, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, vuid, "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance to be " "used for variables with Input storage class if execution model is " "MeshEXT.", - SpvExecutionModelMeshEXT, decoration, built_in_inst, + spv::ExecutionModel::MeshEXT, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); } - if (storage_class == SpvStorageClassOutput) { + if (storage_class == spv::StorageClass::Output) { assert(function_id_ == 0); - uint32_t vuid = (decoration.params()[0] == SpvBuiltInClipDistance) ? 4189 : 4198; + uint32_t vuid = (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::ClipDistance) ? 4189 : 4198; id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, vuid, "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance to be " "used for variables with Output storage class if execution model is " "Fragment.", - SpvExecutionModelFragment, decoration, built_in_inst, + spv::ExecutionModel::Fragment, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); } - for (const SpvExecutionModel execution_model : execution_models_) { + for (const spv::ExecutionModel execution_model : execution_models_) { switch (execution_model) { - case SpvExecutionModelFragment: - case SpvExecutionModelVertex: { + case spv::ExecutionModel::Fragment: + case spv::ExecutionModel::Vertex: { if (spv_result_t error = ValidateF32Arr( decoration, built_in_inst, /* Any number of components */ 0, [this, &decoration, &referenced_from_inst]( const std::string& message) -> spv_result_t { uint32_t vuid = - (decoration.params()[0] == SpvBuiltInClipDistance) + (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::ClipDistance) ? 4191 : 4200; return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) @@ -1228,11 +1226,11 @@ spv_result_t BuiltInsValidator::ValidateClipOrCullDistanceAtReference( } break; } - case SpvExecutionModelTessellationControl: - case SpvExecutionModelTessellationEvaluation: - case SpvExecutionModelGeometry: - case SpvExecutionModelMeshNV: - case SpvExecutionModelMeshEXT: { + case spv::ExecutionModel::TessellationControl: + case spv::ExecutionModel::TessellationEvaluation: + case spv::ExecutionModel::Geometry: + case spv::ExecutionModel::MeshNV: + case spv::ExecutionModel::MeshEXT: { if (decoration.struct_member_index() != Decoration::kInvalidMember) { // The outer level of array is applied on the variable. if (spv_result_t error = ValidateF32Arr( @@ -1240,7 +1238,7 @@ spv_result_t BuiltInsValidator::ValidateClipOrCullDistanceAtReference( [this, &decoration, &referenced_from_inst]( const std::string& message) -> spv_result_t { uint32_t vuid = - (decoration.params()[0] == SpvBuiltInClipDistance) + (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::ClipDistance) ? 4191 : 4200; return _.diag(SPV_ERROR_INVALID_DATA, @@ -1261,7 +1259,7 @@ spv_result_t BuiltInsValidator::ValidateClipOrCullDistanceAtReference( [this, &decoration, &referenced_from_inst]( const std::string& message) -> spv_result_t { uint32_t vuid = - (decoration.params()[0] == SpvBuiltInClipDistance) + (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::ClipDistance) ? 4191 : 4200; return _.diag(SPV_ERROR_INVALID_DATA, @@ -1282,7 +1280,7 @@ spv_result_t BuiltInsValidator::ValidateClipOrCullDistanceAtReference( default: { uint32_t vuid = - (decoration.params()[0] == SpvBuiltInClipDistance) ? 4187 : 4196; + (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::ClipDistance) ? 4187 : 4196; return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -1335,9 +1333,9 @@ spv_result_t BuiltInsValidator::ValidateFragCoordAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4211) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn FragCoord to be only used for " @@ -1347,8 +1345,8 @@ spv_result_t BuiltInsValidator::ValidateFragCoordAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4210) << spvLogStringForEnv(_.context()->target_env) @@ -1396,9 +1394,9 @@ spv_result_t BuiltInsValidator::ValidateFragDepthAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassOutput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Output) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4214) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn FragDepth to be only used for " @@ -1408,8 +1406,8 @@ spv_result_t BuiltInsValidator::ValidateFragDepthAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4213) << spvLogStringForEnv(_.context()->target_env) @@ -1424,7 +1422,7 @@ spv_result_t BuiltInsValidator::ValidateFragDepthAtReference( // Every entry point from which this function is called needs to have // Execution Mode DepthReplacing. const auto* modes = _.GetExecutionModes(entry_point); - if (!modes || !modes->count(SpvExecutionModeDepthReplacing)) { + if (!modes || !modes->count(spv::ExecutionMode::DepthReplacing)) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4216) << spvLogStringForEnv(_.context()->target_env) @@ -1472,9 +1470,9 @@ spv_result_t BuiltInsValidator::ValidateFrontFacingAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4230) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn FrontFacing to be only used for " @@ -1484,8 +1482,8 @@ spv_result_t BuiltInsValidator::ValidateFrontFacingAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4229) << spvLogStringForEnv(_.context()->target_env) @@ -1532,9 +1530,9 @@ spv_result_t BuiltInsValidator::ValidateHelperInvocationAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4240) << "Vulkan spec allows BuiltIn HelperInvocation to be only used " @@ -1544,8 +1542,8 @@ spv_result_t BuiltInsValidator::ValidateHelperInvocationAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4239) << "Vulkan spec allows BuiltIn HelperInvocation to be used only " @@ -1592,9 +1590,9 @@ spv_result_t BuiltInsValidator::ValidateInvocationIdAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4258) << "Vulkan spec allows BuiltIn InvocationId to be only used for " @@ -1604,9 +1602,9 @@ spv_result_t BuiltInsValidator::ValidateInvocationIdAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelTessellationControl && - execution_model != SpvExecutionModelGeometry) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::TessellationControl && + execution_model != spv::ExecutionModel::Geometry) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4257) << "Vulkan spec allows BuiltIn InvocationId to be used only " @@ -1653,9 +1651,9 @@ spv_result_t BuiltInsValidator::ValidateInstanceIndexAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4264) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn InstanceIndex to be only used for " @@ -1665,8 +1663,8 @@ spv_result_t BuiltInsValidator::ValidateInstanceIndexAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelVertex) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Vertex) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4263) << spvLogStringForEnv(_.context()->target_env) @@ -1713,9 +1711,9 @@ spv_result_t BuiltInsValidator::ValidatePatchVerticesAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4309) << "Vulkan spec allows BuiltIn PatchVertices to be only used for " @@ -1725,9 +1723,9 @@ spv_result_t BuiltInsValidator::ValidatePatchVerticesAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelTessellationControl && - execution_model != SpvExecutionModelTessellationEvaluation) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::TessellationControl && + execution_model != spv::ExecutionModel::TessellationEvaluation) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4308) << "Vulkan spec allows BuiltIn PatchVertices to be used only " @@ -1775,9 +1773,9 @@ spv_result_t BuiltInsValidator::ValidatePointCoordAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4312) << "Vulkan spec allows BuiltIn PointCoord to be only used for " @@ -1787,8 +1785,8 @@ spv_result_t BuiltInsValidator::ValidatePointCoordAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4311) << "Vulkan spec allows BuiltIn PointCoord to be used only with " @@ -1820,10 +1818,10 @@ spv_result_t BuiltInsValidator::ValidatePointSizeAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4316) << "Vulkan spec allows BuiltIn PointSize to be only used for " @@ -1833,20 +1831,20 @@ spv_result_t BuiltInsValidator::ValidatePointSizeAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - if (storage_class == SpvStorageClassInput) { + if (storage_class == spv::StorageClass::Input) { assert(function_id_ == 0); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4315, "Vulkan spec doesn't allow BuiltIn PointSize to be used for " "variables with Input storage class if execution model is " "Vertex.", - SpvExecutionModelVertex, decoration, built_in_inst, + spv::ExecutionModel::Vertex, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); } - for (const SpvExecutionModel execution_model : execution_models_) { + for (const spv::ExecutionModel execution_model : execution_models_) { switch (execution_model) { - case SpvExecutionModelVertex: { + case spv::ExecutionModel::Vertex: { if (spv_result_t error = ValidateF32( decoration, built_in_inst, [this, &referenced_from_inst]( @@ -1861,11 +1859,11 @@ spv_result_t BuiltInsValidator::ValidatePointSizeAtReference( } break; } - case SpvExecutionModelTessellationControl: - case SpvExecutionModelTessellationEvaluation: - case SpvExecutionModelGeometry: - case SpvExecutionModelMeshNV: - case SpvExecutionModelMeshEXT: { + case spv::ExecutionModel::TessellationControl: + case spv::ExecutionModel::TessellationEvaluation: + case spv::ExecutionModel::Geometry: + case spv::ExecutionModel::MeshNV: + case spv::ExecutionModel::MeshEXT: { // PointSize can be a per-vertex variable for tessellation control, // tessellation evaluation and geometry shader stages. In such cases // variables will have an array of 32-bit floats. @@ -1938,10 +1936,10 @@ spv_result_t BuiltInsValidator::ValidatePositionAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4320) << "Vulkan spec allows BuiltIn Position to be only used for " "variables with Input or Output storage class. " @@ -1950,34 +1948,34 @@ spv_result_t BuiltInsValidator::ValidatePositionAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - if (storage_class == SpvStorageClassInput) { + if (storage_class == spv::StorageClass::Input) { assert(function_id_ == 0); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4319, "Vulkan spec doesn't allow BuiltIn Position to be used " "for variables " "with Input storage class if execution model is Vertex.", - SpvExecutionModelVertex, decoration, built_in_inst, + spv::ExecutionModel::Vertex, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4319, "Vulkan spec doesn't allow BuiltIn Position to be used " "for variables " "with Input storage class if execution model is MeshNV.", - SpvExecutionModelMeshNV, decoration, built_in_inst, + spv::ExecutionModel::MeshNV, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4319, "Vulkan spec doesn't allow BuiltIn Position to be used " "for variables " "with Input storage class if execution model is MeshEXT.", - SpvExecutionModelMeshEXT, decoration, built_in_inst, + spv::ExecutionModel::MeshEXT, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); } - for (const SpvExecutionModel execution_model : execution_models_) { + for (const spv::ExecutionModel execution_model : execution_models_) { switch (execution_model) { - case SpvExecutionModelVertex: { + case spv::ExecutionModel::Vertex: { if (spv_result_t error = ValidateF32Vec( decoration, built_in_inst, 4, [this, &referenced_from_inst]( @@ -1993,11 +1991,11 @@ spv_result_t BuiltInsValidator::ValidatePositionAtReference( } break; } - case SpvExecutionModelGeometry: - case SpvExecutionModelTessellationControl: - case SpvExecutionModelTessellationEvaluation: - case SpvExecutionModelMeshNV: - case SpvExecutionModelMeshEXT: { + case spv::ExecutionModel::Geometry: + case spv::ExecutionModel::TessellationControl: + case spv::ExecutionModel::TessellationEvaluation: + case spv::ExecutionModel::MeshNV: + case spv::ExecutionModel::MeshEXT: { // Position can be a per-vertex variable for tessellation control, // tessellation evaluation, geometry and mesh shader stages. In such // cases variables will have an array of 4-component 32-bit float @@ -2103,10 +2101,10 @@ spv_result_t BuiltInsValidator::ValidatePrimitiveIdAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << "Vulkan spec allows BuiltIn PrimitiveId to be only used for " "variables with Input or Output storage class. " @@ -2115,63 +2113,63 @@ spv_result_t BuiltInsValidator::ValidatePrimitiveIdAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - if (storage_class == SpvStorageClassOutput) { + if (storage_class == spv::StorageClass::Output) { assert(function_id_ == 0); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4334, "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for " "variables with Output storage class if execution model is " "TessellationControl.", - SpvExecutionModelTessellationControl, decoration, built_in_inst, + spv::ExecutionModel::TessellationControl, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4334, "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for " "variables with Output storage class if execution model is " "TessellationEvaluation.", - SpvExecutionModelTessellationEvaluation, decoration, built_in_inst, + spv::ExecutionModel::TessellationEvaluation, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4334, "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for " "variables with Output storage class if execution model is " "Fragment.", - SpvExecutionModelFragment, decoration, built_in_inst, + spv::ExecutionModel::Fragment, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4334, "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for " "variables with Output storage class if execution model is " "IntersectionKHR.", - SpvExecutionModelIntersectionKHR, decoration, built_in_inst, + spv::ExecutionModel::IntersectionKHR, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4334, "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for " "variables with Output storage class if execution model is " "AnyHitKHR.", - SpvExecutionModelAnyHitKHR, decoration, built_in_inst, + spv::ExecutionModel::AnyHitKHR, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4334, "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for " "variables with Output storage class if execution model is " "ClosestHitKHR.", - SpvExecutionModelClosestHitKHR, decoration, built_in_inst, + spv::ExecutionModel::ClosestHitKHR, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); } - for (const SpvExecutionModel execution_model : execution_models_) { + for (const spv::ExecutionModel execution_model : execution_models_) { switch (execution_model) { - case SpvExecutionModelFragment: - case SpvExecutionModelTessellationControl: - case SpvExecutionModelTessellationEvaluation: - case SpvExecutionModelGeometry: - case SpvExecutionModelMeshNV: - case SpvExecutionModelMeshEXT: - case SpvExecutionModelIntersectionKHR: - case SpvExecutionModelAnyHitKHR: - case SpvExecutionModelClosestHitKHR: { + case spv::ExecutionModel::Fragment: + case spv::ExecutionModel::TessellationControl: + case spv::ExecutionModel::TessellationEvaluation: + case spv::ExecutionModel::Geometry: + case spv::ExecutionModel::MeshNV: + case spv::ExecutionModel::MeshEXT: + case spv::ExecutionModel::IntersectionKHR: + case spv::ExecutionModel::AnyHitKHR: + case spv::ExecutionModel::ClosestHitKHR: { // Ok. break; } @@ -2225,9 +2223,9 @@ spv_result_t BuiltInsValidator::ValidateSampleIdAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4355) << "Vulkan spec allows BuiltIn SampleId to be only used for " @@ -2237,8 +2235,8 @@ spv_result_t BuiltInsValidator::ValidateSampleIdAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4354) << "Vulkan spec allows BuiltIn SampleId to be used only with " @@ -2284,10 +2282,10 @@ spv_result_t BuiltInsValidator::ValidateSampleMaskAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4358) << "Vulkan spec allows BuiltIn SampleMask to be only used for " @@ -2297,8 +2295,8 @@ spv_result_t BuiltInsValidator::ValidateSampleMaskAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4357) << "Vulkan spec allows BuiltIn SampleMask to be used only " @@ -2346,9 +2344,9 @@ spv_result_t BuiltInsValidator::ValidateSamplePositionAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4361) << "Vulkan spec allows BuiltIn SamplePosition to be only used " @@ -2359,8 +2357,8 @@ spv_result_t BuiltInsValidator::ValidateSamplePositionAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4360) << "Vulkan spec allows BuiltIn SamplePosition to be used only " @@ -2408,9 +2406,9 @@ spv_result_t BuiltInsValidator::ValidateTessCoordAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4388) << "Vulkan spec allows BuiltIn TessCoord to be only used for " @@ -2420,8 +2418,8 @@ spv_result_t BuiltInsValidator::ValidateTessCoordAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelTessellationEvaluation) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::TessellationEvaluation) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4387) << "Vulkan spec allows BuiltIn TessCoord to be used only with " @@ -2490,10 +2488,10 @@ spv_result_t BuiltInsValidator::ValidateTessLevelAtReference( const Instruction& referenced_from_inst) { uint32_t operand = decoration.params()[0]; if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -2505,42 +2503,42 @@ spv_result_t BuiltInsValidator::ValidateTessLevelAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - if (storage_class == SpvStorageClassInput) { + if (storage_class == spv::StorageClass::Input) { assert(function_id_ == 0); - uint32_t vuid = (decoration.params()[0] == SpvBuiltInTessLevelOuter) ? 4391 : 4395; + uint32_t vuid = (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::TessLevelOuter) ? 4391 : 4395; id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, vuid, "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " "used " "for variables with Input storage class if execution model is " "TessellationControl.", - SpvExecutionModelTessellationControl, decoration, built_in_inst, + spv::ExecutionModel::TessellationControl, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); } - if (storage_class == SpvStorageClassOutput) { + if (storage_class == spv::StorageClass::Output) { assert(function_id_ == 0); - uint32_t vuid = (decoration.params()[0] == SpvBuiltInTessLevelOuter) ? 4392 : 4396; + uint32_t vuid = (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::TessLevelOuter) ? 4392 : 4396; id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, vuid, "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " "used " "for variables with Output storage class if execution model is " "TessellationEvaluation.", - SpvExecutionModelTessellationEvaluation, decoration, built_in_inst, + spv::ExecutionModel::TessellationEvaluation, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); } - for (const SpvExecutionModel execution_model : execution_models_) { + for (const spv::ExecutionModel execution_model : execution_models_) { switch (execution_model) { - case SpvExecutionModelTessellationControl: - case SpvExecutionModelTessellationEvaluation: { + case spv::ExecutionModel::TessellationControl: + case spv::ExecutionModel::TessellationEvaluation: { // Ok. break; } default: { - uint32_t vuid = (operand == SpvBuiltInTessLevelOuter) ? 4390 : 4394; + uint32_t vuid = (spv::BuiltIn(operand) == spv::BuiltIn::TessLevelOuter) ? 4390 : 4394; return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -2623,9 +2621,9 @@ spv_result_t BuiltInsValidator::ValidateVertexIndexAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4399) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn VertexIndex to be only used for " @@ -2635,8 +2633,8 @@ spv_result_t BuiltInsValidator::ValidateVertexIndexAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelVertex) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Vertex) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4398) << spvLogStringForEnv(_.context()->target_env) @@ -2670,7 +2668,7 @@ spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtDefinition( [this, &decoration, &inst](const std::string& message) -> spv_result_t { uint32_t vuid = - (decoration.params()[0] == SpvBuiltInLayer) ? 4276 : 4408; + (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::Layer) ? 4276 : 4408; return _.diag(SPV_ERROR_INVALID_DATA, &inst) << _.VkErrorID(vuid) << "According to the Vulkan spec BuiltIn " @@ -2687,7 +2685,7 @@ spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtDefinition( [this, &decoration, &inst](const std::string& message) -> spv_result_t { uint32_t vuid = - (decoration.params()[0] == SpvBuiltInLayer) ? 4276 : 4408; + (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::Layer) ? 4276 : 4408; return _.diag(SPV_ERROR_INVALID_DATA, &inst) << _.VkErrorID(vuid) << "According to the Vulkan spec BuiltIn " @@ -2711,10 +2709,10 @@ spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtReference( const Instruction& referenced_from_inst) { uint32_t operand = decoration.params()[0]; if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -2726,15 +2724,15 @@ spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - if (storage_class == SpvStorageClassInput) { + if (storage_class == spv::StorageClass::Input) { assert(function_id_ == 0); for (const auto em : - {SpvExecutionModelVertex, SpvExecutionModelTessellationEvaluation, - SpvExecutionModelGeometry, SpvExecutionModelMeshNV, - SpvExecutionModelMeshEXT}) { + {spv::ExecutionModel::Vertex, spv::ExecutionModel::TessellationEvaluation, + spv::ExecutionModel::Geometry, spv::ExecutionModel::MeshNV, + spv::ExecutionModel::MeshEXT}) { id_to_at_reference_checks_[referenced_from_inst.id()].push_back( std::bind(&BuiltInsValidator::ValidateNotCalledWithExecutionModel, - this, ((operand == SpvBuiltInLayer) ? 4274 : 4406), + this, ((spv::BuiltIn(operand) == spv::BuiltIn::Layer) ? 4274 : 4406), "Vulkan spec doesn't allow BuiltIn Layer and " "ViewportIndex to be " "used for variables with Input storage class if " @@ -2745,46 +2743,46 @@ spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtReference( } } - if (storage_class == SpvStorageClassOutput) { + if (storage_class == spv::StorageClass::Output) { assert(function_id_ == 0); id_to_at_reference_checks_[referenced_from_inst.id()].push_back( std::bind(&BuiltInsValidator::ValidateNotCalledWithExecutionModel, - this, ((operand == SpvBuiltInLayer) ? 4275 : 4407), + this, ((spv::BuiltIn(operand) == spv::BuiltIn::Layer) ? 4275 : 4407), "Vulkan spec doesn't allow BuiltIn Layer and " "ViewportIndex to be " "used for variables with Output storage class if " "execution model is " "Fragment.", - SpvExecutionModelFragment, decoration, built_in_inst, + spv::ExecutionModel::Fragment, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); } - for (const SpvExecutionModel execution_model : execution_models_) { + for (const spv::ExecutionModel execution_model : execution_models_) { switch (execution_model) { - case SpvExecutionModelGeometry: - case SpvExecutionModelFragment: - case SpvExecutionModelMeshNV: - case SpvExecutionModelMeshEXT: + case spv::ExecutionModel::Geometry: + case spv::ExecutionModel::Fragment: + case spv::ExecutionModel::MeshNV: + case spv::ExecutionModel::MeshEXT: // Ok. break; - case SpvExecutionModelVertex: - case SpvExecutionModelTessellationEvaluation: { - if (!_.HasCapability(SpvCapabilityShaderViewportIndexLayerEXT)) { - if (operand == SpvBuiltInViewportIndex && - _.HasCapability(SpvCapabilityShaderViewportIndex)) + case spv::ExecutionModel::Vertex: + case spv::ExecutionModel::TessellationEvaluation: { + if (!_.HasCapability(spv::Capability::ShaderViewportIndexLayerEXT)) { + if (spv::BuiltIn(operand) == spv::BuiltIn::ViewportIndex && + _.HasCapability(spv::Capability::ShaderViewportIndex)) break; // Ok - if (operand == SpvBuiltInLayer && - _.HasCapability(SpvCapabilityShaderLayer)) + if (spv::BuiltIn(operand) == spv::BuiltIn::Layer && + _.HasCapability(spv::Capability::ShaderLayer)) break; // Ok const char* capability = "ShaderViewportIndexLayerEXT"; - if (operand == SpvBuiltInViewportIndex) + if (spv::BuiltIn(operand) == spv::BuiltIn::ViewportIndex) capability = "ShaderViewportIndexLayerEXT or ShaderViewportIndex"; - if (operand == SpvBuiltInLayer) + if (spv::BuiltIn(operand) == spv::BuiltIn::Layer) capability = "ShaderViewportIndexLayerEXT or ShaderLayer"; - uint32_t vuid = (operand == SpvBuiltInLayer) ? 4273 : 4405; + uint32_t vuid = (spv::BuiltIn(operand) == spv::BuiltIn::Layer) ? 4273 : 4405; return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << "Using BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -2795,7 +2793,7 @@ spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtReference( break; } default: { - uint32_t vuid = (operand == SpvBuiltInLayer) ? 4272 : 4404; + uint32_t vuid = (spv::BuiltIn(operand) == spv::BuiltIn::Layer) ? 4272 : 4404; return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -2823,7 +2821,7 @@ spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtReference( spv_result_t BuiltInsValidator::ValidateFragmentShaderF32Vec3InputAtDefinition( const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); if (spv_result_t error = ValidateF32Vec( decoration, inst, 3, [this, &inst, builtin](const std::string& message) -> spv_result_t { @@ -2833,7 +2831,7 @@ spv_result_t BuiltInsValidator::ValidateFragmentShaderF32Vec3InputAtDefinition( << spvLogStringForEnv(_.context()->target_env) << " spec BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, - builtin) + uint32_t(builtin)) << " variable needs to be a 3-component 32-bit float " "vector. " << message; @@ -2853,29 +2851,29 @@ spv_result_t BuiltInsValidator::ValidateFragmentShaderF32Vec3InputAtReference( const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be only used for variables with Input storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be used only with Fragment execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -2897,7 +2895,7 @@ spv_result_t BuiltInsValidator::ValidateFragmentShaderF32Vec3InputAtReference( spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtDefinition( const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); if (spv_result_t error = ValidateI32Vec( decoration, inst, 3, [this, &inst, builtin](const std::string& message) -> spv_result_t { @@ -2907,7 +2905,7 @@ spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtDefinition( << spvLogStringForEnv(_.context()->target_env) << " spec BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, - builtin) + uint32_t(builtin)) << " variable needs to be a 3-component 32-bit int " "vector. " << message; @@ -2926,27 +2924,27 @@ spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be only used for variables with Input storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - bool has_vulkan_model = execution_model == SpvExecutionModelGLCompute || - execution_model == SpvExecutionModelTaskNV || - execution_model == SpvExecutionModelMeshNV || - execution_model == SpvExecutionModelTaskEXT || - execution_model == SpvExecutionModelMeshEXT; + for (const spv::ExecutionModel execution_model : execution_models_) { + bool has_vulkan_model = execution_model == spv::ExecutionModel::GLCompute || + execution_model == spv::ExecutionModel::TaskNV || + execution_model == spv::ExecutionModel::MeshNV || + execution_model == spv::ExecutionModel::TaskEXT || + execution_model == spv::ExecutionModel::MeshEXT; if (spvIsVulkanEnv(_.context()->target_env) && !has_vulkan_model) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel); @@ -2954,7 +2952,7 @@ spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference( << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be used only with GLCompute, MeshNV, TaskNV, MeshEXT or" << " TaskEXT execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, @@ -2977,11 +2975,11 @@ spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference( spv_result_t BuiltInsValidator::ValidateComputeI32InputAtDefinition( const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); if (decoration.struct_member_index() != Decoration::kInvalidMember) { return _.diag(SPV_ERROR_INVALID_DATA, &inst) << "BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " cannot be used as a member decoration "; } if (spv_result_t error = ValidateI32( @@ -2993,7 +2991,7 @@ spv_result_t BuiltInsValidator::ValidateComputeI32InputAtDefinition( << "According to the " << spvLogStringForEnv(_.context()->target_env) << " spec BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " variable needs to be a 32-bit int " "vector. " << message; @@ -3011,35 +3009,35 @@ spv_result_t BuiltInsValidator::ValidateComputeI32InputAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be only used for variables with Input storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - bool has_vulkan_model = execution_model == SpvExecutionModelGLCompute || - execution_model == SpvExecutionModelTaskNV || - execution_model == SpvExecutionModelMeshNV || - execution_model == SpvExecutionModelTaskEXT || - execution_model == SpvExecutionModelMeshEXT; + for (const spv::ExecutionModel execution_model : execution_models_) { + bool has_vulkan_model = execution_model == spv::ExecutionModel::GLCompute || + execution_model == spv::ExecutionModel::TaskNV || + execution_model == spv::ExecutionModel::MeshNV || + execution_model == spv::ExecutionModel::TaskEXT || + execution_model == spv::ExecutionModel::MeshEXT; if (spvIsVulkanEnv(_.context()->target_env) && !has_vulkan_model) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be used only with GLCompute, MeshNV, TaskNV, MeshEXT or " << "TaskEXT execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, @@ -3062,11 +3060,11 @@ spv_result_t BuiltInsValidator::ValidateComputeI32InputAtReference( spv_result_t BuiltInsValidator::ValidateI32InputAtDefinition( const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); if (decoration.struct_member_index() != Decoration::kInvalidMember) { return _.diag(SPV_ERROR_INVALID_DATA, &inst) << "BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " cannot be used as a member decoration "; } if (spv_result_t error = ValidateI32( @@ -3078,21 +3076,21 @@ spv_result_t BuiltInsValidator::ValidateI32InputAtDefinition( << "According to the " << spvLogStringForEnv(_.context()->target_env) << " spec BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " variable needs to be a 32-bit int. " << message; })) { return error; } - const SpvStorageClass storage_class = GetStorageClass(inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass); return _.diag(SPV_ERROR_INVALID_DATA, &inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be only used for variables with Input storage class. " << GetReferenceDesc(decoration, inst, inst, inst) << " " << GetStorageClassDesc(inst); @@ -3105,11 +3103,11 @@ spv_result_t BuiltInsValidator::ValidateI32InputAtDefinition( spv_result_t BuiltInsValidator::ValidateI32Vec4InputAtDefinition( const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); if (decoration.struct_member_index() != Decoration::kInvalidMember) { return _.diag(SPV_ERROR_INVALID_DATA, &inst) << "BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " cannot be used as a member decoration "; } if (spv_result_t error = ValidateI32Vec( @@ -3121,7 +3119,7 @@ spv_result_t BuiltInsValidator::ValidateI32Vec4InputAtDefinition( << "According to the " << spvLogStringForEnv(_.context()->target_env) << " spec BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " variable needs to be a 4-component 32-bit int " "vector. " << message; @@ -3129,15 +3127,15 @@ spv_result_t BuiltInsValidator::ValidateI32Vec4InputAtDefinition( return error; } - const SpvStorageClass storage_class = GetStorageClass(inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass); return _.diag(SPV_ERROR_INVALID_DATA, &inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be only used for variables with Input storage class. " << GetReferenceDesc(decoration, inst, inst, inst) << " " << GetStorageClassDesc(inst); @@ -3182,12 +3180,12 @@ spv_result_t BuiltInsValidator::ValidateWorkgroupSizeAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelGLCompute && - execution_model != SpvExecutionModelTaskNV && - execution_model != SpvExecutionModelMeshNV && - execution_model != SpvExecutionModelTaskEXT && - execution_model != SpvExecutionModelMeshEXT) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::GLCompute && + execution_model != spv::ExecutionModel::TaskNV && + execution_model != spv::ExecutionModel::MeshNV && + execution_model != spv::ExecutionModel::TaskEXT && + execution_model != spv::ExecutionModel::MeshEXT) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4425) << spvLogStringForEnv(_.context()->target_env) @@ -3219,7 +3217,7 @@ spv_result_t BuiltInsValidator::ValidateBaseInstanceOrVertexAtDefinition( decoration, inst, [this, &inst, &decoration](const std::string& message) -> spv_result_t { - uint32_t vuid = (decoration.params()[0] == SpvBuiltInBaseInstance) + uint32_t vuid = (spv::BuiltIn(decoration.params()[0]) == spv::BuiltIn::BaseInstance) ? 4183 : 4186; return _.diag(SPV_ERROR_INVALID_DATA, &inst) @@ -3243,10 +3241,10 @@ spv_result_t BuiltInsValidator::ValidateBaseInstanceOrVertexAtReference( const Instruction& referenced_from_inst) { uint32_t operand = decoration.params()[0]; if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { - uint32_t vuid = (operand == SpvBuiltInBaseInstance) ? 4182 : 4185; + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { + uint32_t vuid = (spv::BuiltIn(operand) == spv::BuiltIn::BaseInstance) ? 4182 : 4185; return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -3257,9 +3255,9 @@ spv_result_t BuiltInsValidator::ValidateBaseInstanceOrVertexAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelVertex) { - uint32_t vuid = (operand == SpvBuiltInBaseInstance) ? 4181 : 4184; + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Vertex) { + uint32_t vuid = (spv::BuiltIn(operand) == spv::BuiltIn::BaseInstance) ? 4181 : 4184; return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -3310,9 +3308,9 @@ spv_result_t BuiltInsValidator::ValidateDrawIndexAtReference( const Instruction& referenced_from_inst) { uint32_t operand = decoration.params()[0]; if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4208) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -3323,12 +3321,12 @@ spv_result_t BuiltInsValidator::ValidateDrawIndexAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelVertex && - execution_model != SpvExecutionModelMeshNV && - execution_model != SpvExecutionModelTaskNV && - execution_model != SpvExecutionModelMeshEXT && - execution_model != SpvExecutionModelTaskEXT) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Vertex && + execution_model != spv::ExecutionModel::MeshNV && + execution_model != spv::ExecutionModel::TaskNV && + execution_model != spv::ExecutionModel::MeshEXT && + execution_model != spv::ExecutionModel::TaskEXT) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4207) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -3380,9 +3378,9 @@ spv_result_t BuiltInsValidator::ValidateViewIndexAtReference( const Instruction& referenced_from_inst) { uint32_t operand = decoration.params()[0]; if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4402) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -3393,8 +3391,8 @@ spv_result_t BuiltInsValidator::ValidateViewIndexAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model == SpvExecutionModelGLCompute) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model == spv::ExecutionModel::GLCompute) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4401) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -3444,9 +3442,9 @@ spv_result_t BuiltInsValidator::ValidateDeviceIndexAtReference( const Instruction& referenced_from_inst) { uint32_t operand = decoration.params()[0]; if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4205) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -3472,7 +3470,7 @@ spv_result_t BuiltInsValidator::ValidateFragInvocationCountAtDefinition(const De const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); if (spv_result_t error = ValidateI32( decoration, inst, [this, &inst, &builtin](const std::string& message) -> spv_result_t { @@ -3482,7 +3480,7 @@ spv_result_t BuiltInsValidator::ValidateFragInvocationCountAtDefinition(const De << spvLogStringForEnv(_.context()->target_env) << " spec BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, - builtin) + uint32_t(builtin)) << " variable needs to be a 32-bit int scalar. " << message; })) { @@ -3499,29 +3497,29 @@ spv_result_t BuiltInsValidator::ValidateFragInvocationCountAtReference( const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be only used for variables with Input storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be used only with Fragment execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -3542,7 +3540,7 @@ spv_result_t BuiltInsValidator::ValidateFragInvocationCountAtReference( spv_result_t BuiltInsValidator::ValidateFragSizeAtDefinition(const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); if (spv_result_t error = ValidateI32Vec( decoration, inst, 2, [this, &inst, &builtin](const std::string& message) -> spv_result_t { @@ -3552,7 +3550,7 @@ spv_result_t BuiltInsValidator::ValidateFragSizeAtDefinition(const Decoration& d << spvLogStringForEnv(_.context()->target_env) << " spec BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, - builtin) + uint32_t(builtin)) << " variable needs to be a 2-component 32-bit int vector. " << message; })) { @@ -3569,29 +3567,29 @@ spv_result_t BuiltInsValidator::ValidateFragSizeAtReference( const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be only used for variables with Input storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be used only with Fragment execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -3612,7 +3610,7 @@ spv_result_t BuiltInsValidator::ValidateFragSizeAtReference( spv_result_t BuiltInsValidator::ValidateFragStencilRefAtDefinition(const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); if (spv_result_t error = ValidateI( decoration, inst, [this, &inst, &builtin](const std::string& message) -> spv_result_t { @@ -3622,7 +3620,7 @@ spv_result_t BuiltInsValidator::ValidateFragStencilRefAtDefinition(const Decorat << spvLogStringForEnv(_.context()->target_env) << " spec BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, - builtin) + uint32_t(builtin)) << " variable needs to be a int scalar. " << message; })) { @@ -3639,29 +3637,29 @@ spv_result_t BuiltInsValidator::ValidateFragStencilRefAtReference( const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassOutput) { + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Output) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be only used for variables with Output storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be used only with Fragment execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -3682,7 +3680,7 @@ spv_result_t BuiltInsValidator::ValidateFragStencilRefAtReference( spv_result_t BuiltInsValidator::ValidateFullyCoveredAtDefinition(const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); if (spv_result_t error = ValidateBool( decoration, inst, [this, &inst, &builtin](const std::string& message) -> spv_result_t { @@ -3692,7 +3690,7 @@ spv_result_t BuiltInsValidator::ValidateFullyCoveredAtDefinition(const Decoratio << spvLogStringForEnv(_.context()->target_env) << " spec BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, - builtin) + uint32_t(builtin)) << " variable needs to be a bool scalar. " << message; })) { @@ -3709,29 +3707,29 @@ spv_result_t BuiltInsValidator::ValidateFullyCoveredAtReference( const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be only used for variables with Input storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " - << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, builtin) + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " to be used only with Fragment execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -3749,7 +3747,7 @@ spv_result_t BuiltInsValidator::ValidateFullyCoveredAtReference( return SPV_SUCCESS; } -spv_result_t BuiltInsValidator::ValidateSMBuiltinsAtDefinition( +spv_result_t BuiltInsValidator::ValidateNVSMOrARMCoreBuiltinsAtDefinition( const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { if (spv_result_t error = ValidateI32( @@ -3770,17 +3768,17 @@ spv_result_t BuiltInsValidator::ValidateSMBuiltinsAtDefinition( } // Seed at reference checks with this built-in. - return ValidateSMBuiltinsAtReference(decoration, inst, inst, inst); + return ValidateNVSMOrARMCoreBuiltinsAtReference(decoration, inst, inst, inst); } -spv_result_t BuiltInsValidator::ValidateSMBuiltinsAtReference( +spv_result_t BuiltInsValidator::ValidateNVSMOrARMCoreBuiltinsAtReference( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << spvLogStringForEnv(_.context()->target_env) << " spec allows BuiltIn " @@ -3797,7 +3795,7 @@ spv_result_t BuiltInsValidator::ValidateSMBuiltinsAtReference( if (function_id_ == 0) { // Propagate this rule to all dependant ids in the global scope. id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( - &BuiltInsValidator::ValidateSMBuiltinsAtReference, this, decoration, + &BuiltInsValidator::ValidateNVSMOrARMCoreBuiltinsAtReference, this, decoration, built_in_inst, referenced_from_inst, std::placeholders::_1)); } @@ -3832,9 +3830,9 @@ spv_result_t BuiltInsValidator::ValidatePrimitiveShadingRateAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassOutput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Output) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4485) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -3845,12 +3843,12 @@ spv_result_t BuiltInsValidator::ValidatePrimitiveShadingRateAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { + for (const spv::ExecutionModel execution_model : execution_models_) { switch (execution_model) { - case SpvExecutionModelVertex: - case SpvExecutionModelGeometry: - case SpvExecutionModelMeshNV: - case SpvExecutionModelMeshEXT: + case spv::ExecutionModel::Vertex: + case spv::ExecutionModel::Geometry: + case spv::ExecutionModel::MeshNV: + case spv::ExecutionModel::MeshEXT: break; default: { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) @@ -3905,9 +3903,9 @@ spv_result_t BuiltInsValidator::ValidateShadingRateAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4491) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -3918,8 +3916,8 @@ spv_result_t BuiltInsValidator::ValidateShadingRateAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelFragment) { + for (const spv::ExecutionModel execution_model : execution_models_) { + if (execution_model != spv::ExecutionModel::Fragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(4490) << "Vulkan spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, @@ -3944,11 +3942,11 @@ spv_result_t BuiltInsValidator::ValidateShadingRateAtReference( spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition( const Decoration& decoration, const Instruction& inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); switch (builtin) { - case SpvBuiltInHitTNV: - case SpvBuiltInRayTminKHR: - case SpvBuiltInRayTmaxKHR: + case spv::BuiltIn::HitTNV: + case spv::BuiltIn::RayTminKHR: + case spv::BuiltIn::RayTmaxKHR: // f32 scalar if (spv_result_t error = ValidateF32( decoration, inst, @@ -3959,19 +3957,19 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition( << _.VkErrorID(vuid) << "According to the Vulkan spec BuiltIn " << _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_BUILT_IN, builtin) + SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " variable needs to be a 32-bit float scalar. " << message; })) { return error; } break; - case SpvBuiltInHitKindKHR: - case SpvBuiltInInstanceCustomIndexKHR: - case SpvBuiltInInstanceId: - case SpvBuiltInRayGeometryIndexKHR: - case SpvBuiltInIncomingRayFlagsKHR: - case SpvBuiltInCullMaskKHR: + case spv::BuiltIn::HitKindKHR: + case spv::BuiltIn::InstanceCustomIndexKHR: + case spv::BuiltIn::InstanceId: + case spv::BuiltIn::RayGeometryIndexKHR: + case spv::BuiltIn::IncomingRayFlagsKHR: + case spv::BuiltIn::CullMaskKHR: // i32 scalar if (spv_result_t error = ValidateI32( decoration, inst, @@ -3982,17 +3980,17 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition( << _.VkErrorID(vuid) << "According to the Vulkan spec BuiltIn " << _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_BUILT_IN, builtin) + SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " variable needs to be a 32-bit int scalar. " << message; })) { return error; } break; - case SpvBuiltInObjectRayDirectionKHR: - case SpvBuiltInObjectRayOriginKHR: - case SpvBuiltInWorldRayDirectionKHR: - case SpvBuiltInWorldRayOriginKHR: + case spv::BuiltIn::ObjectRayDirectionKHR: + case spv::BuiltIn::ObjectRayOriginKHR: + case spv::BuiltIn::WorldRayDirectionKHR: + case spv::BuiltIn::WorldRayOriginKHR: // f32 vec3 if (spv_result_t error = ValidateF32Vec( decoration, inst, 3, @@ -4003,7 +4001,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition( << _.VkErrorID(vuid) << "According to the Vulkan spec BuiltIn " << _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_BUILT_IN, builtin) + SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " variable needs to be a 3-component 32-bit float " "vector. " << message; @@ -4011,8 +4009,8 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition( return error; } break; - case SpvBuiltInLaunchIdKHR: - case SpvBuiltInLaunchSizeKHR: + case spv::BuiltIn::LaunchIdKHR: + case spv::BuiltIn::LaunchSizeKHR: // i32 vec3 if (spv_result_t error = ValidateI32Vec( decoration, inst, 3, @@ -4023,7 +4021,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition( << _.VkErrorID(vuid) << "According to the Vulkan spec BuiltIn " << _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_BUILT_IN, builtin) + SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " variable needs to be a 3-component 32-bit int " "vector. " << message; @@ -4031,8 +4029,8 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition( return error; } break; - case SpvBuiltInObjectToWorldKHR: - case SpvBuiltInWorldToObjectKHR: + case spv::BuiltIn::ObjectToWorldKHR: + case spv::BuiltIn::WorldToObjectKHR: // f32 mat4x3 if (spv_result_t error = ValidateF32Mat( decoration, inst, 3, 4, @@ -4043,7 +4041,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtDefinition( << _.VkErrorID(vuid) << "According to the Vulkan spec BuiltIn " << _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_BUILT_IN, builtin) + SPV_OPERAND_TYPE_BUILT_IN, uint32_t(builtin)) << " variable needs to be a matrix with" << " 4 columns of 3-component vectors of 32-bit " "floats. " @@ -4067,10 +4065,10 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtReference( const Instruction& referenced_inst, const Instruction& referenced_from_inst) { if (spvIsVulkanEnv(_.context()->target_env)) { - const SpvBuiltIn builtin = SpvBuiltIn(decoration.params()[0]); - const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); - if (storage_class != SpvStorageClassMax && - storage_class != SpvStorageClassInput) { + const spv::BuiltIn builtin = spv::BuiltIn(decoration.params()[0]); + const spv::StorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != spv::StorageClass::Max && + storage_class != spv::StorageClass::Input) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorStorageClass); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) << _.VkErrorID(vuid) << "Vulkan spec allows BuiltIn " @@ -4082,7 +4080,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtReference( << " " << GetStorageClassDesc(referenced_from_inst); } - for (const SpvExecutionModel execution_model : execution_models_) { + for (const spv::ExecutionModel execution_model : execution_models_) { if (!IsExecutionModelValidForRtBuiltIn(builtin, execution_model)) { uint32_t vuid = GetVUIDForBuiltin(builtin, VUIDErrorExecutionModel); return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) @@ -4091,7 +4089,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtReference( decoration.params()[0]) << " to be used with the execution model " << _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_EXECUTION_MODEL, execution_model) + SPV_OPERAND_TYPE_EXECUTION_MODEL, uint32_t(execution_model)) << ".\n" << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -4112,7 +4110,7 @@ spv_result_t BuiltInsValidator::ValidateRayTracingBuiltinsAtReference( spv_result_t BuiltInsValidator::ValidateSingleBuiltInAtDefinition( const Decoration& decoration, const Instruction& inst) { - const SpvBuiltIn label = SpvBuiltIn(decoration.params()[0]); + const spv::BuiltIn label = spv::BuiltIn(decoration.params()[0]); if (!spvIsVulkanEnv(_.context()->target_env)) { // Early return. All currently implemented rules are based on Vulkan spec. @@ -4129,161 +4127,166 @@ spv_result_t BuiltInsValidator::ValidateSingleBuiltInAtDefinition( // If the newly added enum has validation rules associated with it // consider leaving a TODO and/or creating an issue. switch (label) { - case SpvBuiltInClipDistance: - case SpvBuiltInCullDistance: { + case spv::BuiltIn::ClipDistance: + case spv::BuiltIn::CullDistance: { return ValidateClipOrCullDistanceAtDefinition(decoration, inst); } - case SpvBuiltInFragCoord: { + case spv::BuiltIn::FragCoord: { return ValidateFragCoordAtDefinition(decoration, inst); } - case SpvBuiltInFragDepth: { + case spv::BuiltIn::FragDepth: { return ValidateFragDepthAtDefinition(decoration, inst); } - case SpvBuiltInFrontFacing: { + case spv::BuiltIn::FrontFacing: { return ValidateFrontFacingAtDefinition(decoration, inst); } - case SpvBuiltInGlobalInvocationId: - case SpvBuiltInLocalInvocationId: - case SpvBuiltInNumWorkgroups: - case SpvBuiltInWorkgroupId: { + case spv::BuiltIn::GlobalInvocationId: + case spv::BuiltIn::LocalInvocationId: + case spv::BuiltIn::NumWorkgroups: + case spv::BuiltIn::WorkgroupId: { return ValidateComputeShaderI32Vec3InputAtDefinition(decoration, inst); } - case SpvBuiltInBaryCoordKHR: - case SpvBuiltInBaryCoordNoPerspKHR: { + case spv::BuiltIn::BaryCoordKHR: + case spv::BuiltIn::BaryCoordNoPerspKHR: { return ValidateFragmentShaderF32Vec3InputAtDefinition(decoration, inst); } - case SpvBuiltInHelperInvocation: { + case spv::BuiltIn::HelperInvocation: { return ValidateHelperInvocationAtDefinition(decoration, inst); } - case SpvBuiltInInvocationId: { + case spv::BuiltIn::InvocationId: { return ValidateInvocationIdAtDefinition(decoration, inst); } - case SpvBuiltInInstanceIndex: { + case spv::BuiltIn::InstanceIndex: { return ValidateInstanceIndexAtDefinition(decoration, inst); } - case SpvBuiltInLayer: - case SpvBuiltInViewportIndex: { + case spv::BuiltIn::Layer: + case spv::BuiltIn::ViewportIndex: { return ValidateLayerOrViewportIndexAtDefinition(decoration, inst); } - case SpvBuiltInPatchVertices: { + case spv::BuiltIn::PatchVertices: { return ValidatePatchVerticesAtDefinition(decoration, inst); } - case SpvBuiltInPointCoord: { + case spv::BuiltIn::PointCoord: { return ValidatePointCoordAtDefinition(decoration, inst); } - case SpvBuiltInPointSize: { + case spv::BuiltIn::PointSize: { return ValidatePointSizeAtDefinition(decoration, inst); } - case SpvBuiltInPosition: { + case spv::BuiltIn::Position: { return ValidatePositionAtDefinition(decoration, inst); } - case SpvBuiltInPrimitiveId: { + case spv::BuiltIn::PrimitiveId: { return ValidatePrimitiveIdAtDefinition(decoration, inst); } - case SpvBuiltInSampleId: { + case spv::BuiltIn::SampleId: { return ValidateSampleIdAtDefinition(decoration, inst); } - case SpvBuiltInSampleMask: { + case spv::BuiltIn::SampleMask: { return ValidateSampleMaskAtDefinition(decoration, inst); } - case SpvBuiltInSamplePosition: { + case spv::BuiltIn::SamplePosition: { return ValidateSamplePositionAtDefinition(decoration, inst); } - case SpvBuiltInSubgroupId: - case SpvBuiltInNumSubgroups: { + case spv::BuiltIn::SubgroupId: + case spv::BuiltIn::NumSubgroups: { return ValidateComputeI32InputAtDefinition(decoration, inst); } - case SpvBuiltInSubgroupLocalInvocationId: - case SpvBuiltInSubgroupSize: { + case spv::BuiltIn::SubgroupLocalInvocationId: + case spv::BuiltIn::SubgroupSize: { return ValidateI32InputAtDefinition(decoration, inst); } - case SpvBuiltInSubgroupEqMask: - case SpvBuiltInSubgroupGeMask: - case SpvBuiltInSubgroupGtMask: - case SpvBuiltInSubgroupLeMask: - case SpvBuiltInSubgroupLtMask: { + case spv::BuiltIn::SubgroupEqMask: + case spv::BuiltIn::SubgroupGeMask: + case spv::BuiltIn::SubgroupGtMask: + case spv::BuiltIn::SubgroupLeMask: + case spv::BuiltIn::SubgroupLtMask: { return ValidateI32Vec4InputAtDefinition(decoration, inst); } - case SpvBuiltInTessCoord: { + case spv::BuiltIn::TessCoord: { return ValidateTessCoordAtDefinition(decoration, inst); } - case SpvBuiltInTessLevelOuter: { + case spv::BuiltIn::TessLevelOuter: { return ValidateTessLevelOuterAtDefinition(decoration, inst); } - case SpvBuiltInTessLevelInner: { + case spv::BuiltIn::TessLevelInner: { return ValidateTessLevelInnerAtDefinition(decoration, inst); } - case SpvBuiltInVertexIndex: { + case spv::BuiltIn::VertexIndex: { return ValidateVertexIndexAtDefinition(decoration, inst); } - case SpvBuiltInWorkgroupSize: { + case spv::BuiltIn::WorkgroupSize: { return ValidateWorkgroupSizeAtDefinition(decoration, inst); } - case SpvBuiltInVertexId: { + case spv::BuiltIn::VertexId: { return ValidateVertexIdAtDefinition(decoration, inst); } - case SpvBuiltInLocalInvocationIndex: { + case spv::BuiltIn::LocalInvocationIndex: { return ValidateLocalInvocationIndexAtDefinition(decoration, inst); } - case SpvBuiltInWarpsPerSMNV: - case SpvBuiltInSMCountNV: - case SpvBuiltInWarpIDNV: - case SpvBuiltInSMIDNV: { - return ValidateSMBuiltinsAtDefinition(decoration, inst); - } - case SpvBuiltInBaseInstance: - case SpvBuiltInBaseVertex: { + case spv::BuiltIn::CoreIDARM: + case spv::BuiltIn::CoreCountARM: + case spv::BuiltIn::CoreMaxIDARM: + case spv::BuiltIn::WarpIDARM: + case spv::BuiltIn::WarpMaxIDARM: + case spv::BuiltIn::WarpsPerSMNV: + case spv::BuiltIn::SMCountNV: + case spv::BuiltIn::WarpIDNV: + case spv::BuiltIn::SMIDNV: { + return ValidateNVSMOrARMCoreBuiltinsAtDefinition(decoration, inst); + } + case spv::BuiltIn::BaseInstance: + case spv::BuiltIn::BaseVertex: { return ValidateBaseInstanceOrVertexAtDefinition(decoration, inst); } - case SpvBuiltInDrawIndex: { + case spv::BuiltIn::DrawIndex: { return ValidateDrawIndexAtDefinition(decoration, inst); } - case SpvBuiltInViewIndex: { + case spv::BuiltIn::ViewIndex: { return ValidateViewIndexAtDefinition(decoration, inst); } - case SpvBuiltInDeviceIndex: { + case spv::BuiltIn::DeviceIndex: { return ValidateDeviceIndexAtDefinition(decoration, inst); } - case SpvBuiltInFragInvocationCountEXT: { - // alias SpvBuiltInInvocationsPerPixelNV + case spv::BuiltIn::FragInvocationCountEXT: { + // alias spv::BuiltIn::InvocationsPerPixelNV return ValidateFragInvocationCountAtDefinition(decoration, inst); } - case SpvBuiltInFragSizeEXT: { - // alias SpvBuiltInFragmentSizeNV + case spv::BuiltIn::FragSizeEXT: { + // alias spv::BuiltIn::FragmentSizeNV return ValidateFragSizeAtDefinition(decoration, inst); } - case SpvBuiltInFragStencilRefEXT: { + case spv::BuiltIn::FragStencilRefEXT: { return ValidateFragStencilRefAtDefinition(decoration, inst); } - case SpvBuiltInFullyCoveredEXT:{ + case spv::BuiltIn::FullyCoveredEXT:{ return ValidateFullyCoveredAtDefinition(decoration, inst); } // Ray tracing builtins - case SpvBuiltInHitKindKHR: // alias SpvBuiltInHitKindNV - case SpvBuiltInHitTNV: // NOT present in KHR - case SpvBuiltInInstanceId: - case SpvBuiltInLaunchIdKHR: // alias SpvBuiltInLaunchIdNV - case SpvBuiltInLaunchSizeKHR: // alias SpvBuiltInLaunchSizeNV - case SpvBuiltInWorldRayOriginKHR: // alias SpvBuiltInWorldRayOriginNV - case SpvBuiltInWorldRayDirectionKHR: // alias SpvBuiltInWorldRayDirectionNV - case SpvBuiltInObjectRayOriginKHR: // alias SpvBuiltInObjectRayOriginNV - case SpvBuiltInObjectRayDirectionKHR: // alias - // SpvBuiltInObjectRayDirectionNV - case SpvBuiltInRayTminKHR: // alias SpvBuiltInRayTminNV - case SpvBuiltInRayTmaxKHR: // alias SpvBuiltInRayTmaxNV - case SpvBuiltInInstanceCustomIndexKHR: // alias - // SpvBuiltInInstanceCustomIndexNV - case SpvBuiltInObjectToWorldKHR: // alias SpvBuiltInObjectToWorldNV - case SpvBuiltInWorldToObjectKHR: // alias SpvBuiltInWorldToObjectNV - case SpvBuiltInIncomingRayFlagsKHR: // alias SpvBuiltInIncomingRayFlagsNV - case SpvBuiltInRayGeometryIndexKHR: // NOT present in NV - case SpvBuiltInCullMaskKHR: { + case spv::BuiltIn::HitKindKHR: // alias spv::BuiltIn::HitKindNV + case spv::BuiltIn::HitTNV: // NOT present in KHR + case spv::BuiltIn::InstanceId: + case spv::BuiltIn::LaunchIdKHR: // alias spv::BuiltIn::LaunchIdNV + case spv::BuiltIn::LaunchSizeKHR: // alias spv::BuiltIn::LaunchSizeNV + case spv::BuiltIn::WorldRayOriginKHR: // alias spv::BuiltIn::WorldRayOriginNV + case spv::BuiltIn::WorldRayDirectionKHR: // alias spv::BuiltIn::WorldRayDirectionNV + case spv::BuiltIn::ObjectRayOriginKHR: // alias spv::BuiltIn::ObjectRayOriginNV + case spv::BuiltIn::ObjectRayDirectionKHR: // alias + // spv::BuiltIn::ObjectRayDirectionNV + case spv::BuiltIn::RayTminKHR: // alias spv::BuiltIn::RayTminNV + case spv::BuiltIn::RayTmaxKHR: // alias spv::BuiltIn::RayTmaxNV + case spv::BuiltIn::InstanceCustomIndexKHR: // alias + // spv::BuiltIn::InstanceCustomIndexNV + case spv::BuiltIn::ObjectToWorldKHR: // alias spv::BuiltIn::ObjectToWorldNV + case spv::BuiltIn::WorldToObjectKHR: // alias spv::BuiltIn::WorldToObjectNV + case spv::BuiltIn::IncomingRayFlagsKHR: // alias spv::BuiltIn::IncomingRayFlagsNV + case spv::BuiltIn::RayGeometryIndexKHR: // NOT present in NV + case spv::BuiltIn::CullMaskKHR: { return ValidateRayTracingBuiltinsAtDefinition(decoration, inst); } - case SpvBuiltInPrimitiveShadingRateKHR: { + case spv::BuiltIn::PrimitiveShadingRateKHR: { return ValidatePrimitiveShadingRateAtDefinition(decoration, inst); } - case SpvBuiltInShadingRateKHR: { + case spv::BuiltIn::ShadingRateKHR: { return ValidateShadingRateAtDefinition(decoration, inst); } default: @@ -4305,7 +4308,7 @@ spv_result_t BuiltInsValidator::ValidateBuiltInsAtDefinition() { assert(inst); for (const auto& decoration : kv.second) { - if (decoration.dec_type() != SpvDecorationBuiltIn) { + if (decoration.dec_type() != spv::Decoration::BuiltIn) { continue; } diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_capability.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_capability.cpp index 8efd5542..81d2ad52 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_capability.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_capability.cpp @@ -16,9 +16,7 @@ #include #include -#include -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" #include "source/val/validate.h" @@ -29,74 +27,82 @@ namespace val { namespace { bool IsSupportGuaranteedVulkan_1_0(uint32_t capability) { - switch (capability) { - case SpvCapabilityMatrix: - case SpvCapabilityShader: - case SpvCapabilityInputAttachment: - case SpvCapabilitySampled1D: - case SpvCapabilityImage1D: - case SpvCapabilitySampledBuffer: - case SpvCapabilityImageBuffer: - case SpvCapabilityImageQuery: - case SpvCapabilityDerivativeControl: + switch (spv::Capability(capability)) { + case spv::Capability::Matrix: + case spv::Capability::Shader: + case spv::Capability::InputAttachment: + case spv::Capability::Sampled1D: + case spv::Capability::Image1D: + case spv::Capability::SampledBuffer: + case spv::Capability::ImageBuffer: + case spv::Capability::ImageQuery: + case spv::Capability::DerivativeControl: return true; + default: + break; } return false; } bool IsSupportGuaranteedVulkan_1_1(uint32_t capability) { if (IsSupportGuaranteedVulkan_1_0(capability)) return true; - switch (capability) { - case SpvCapabilityDeviceGroup: - case SpvCapabilityMultiView: + switch (spv::Capability(capability)) { + case spv::Capability::DeviceGroup: + case spv::Capability::MultiView: return true; + default: + break; } return false; } bool IsSupportGuaranteedVulkan_1_2(uint32_t capability) { if (IsSupportGuaranteedVulkan_1_1(capability)) return true; - switch (capability) { - case SpvCapabilityShaderNonUniform: + switch (spv::Capability(capability)) { + case spv::Capability::ShaderNonUniform: return true; + default: + break; } return false; } bool IsSupportOptionalVulkan_1_0(uint32_t capability) { - switch (capability) { - case SpvCapabilityGeometry: - case SpvCapabilityTessellation: - case SpvCapabilityFloat64: - case SpvCapabilityInt64: - case SpvCapabilityInt16: - case SpvCapabilityTessellationPointSize: - case SpvCapabilityGeometryPointSize: - case SpvCapabilityImageGatherExtended: - case SpvCapabilityStorageImageMultisample: - case SpvCapabilityUniformBufferArrayDynamicIndexing: - case SpvCapabilitySampledImageArrayDynamicIndexing: - case SpvCapabilityStorageBufferArrayDynamicIndexing: - case SpvCapabilityStorageImageArrayDynamicIndexing: - case SpvCapabilityClipDistance: - case SpvCapabilityCullDistance: - case SpvCapabilityImageCubeArray: - case SpvCapabilitySampleRateShading: - case SpvCapabilitySparseResidency: - case SpvCapabilityMinLod: - case SpvCapabilitySampledCubeArray: - case SpvCapabilityImageMSArray: - case SpvCapabilityStorageImageExtendedFormats: - case SpvCapabilityInterpolationFunction: - case SpvCapabilityStorageImageReadWithoutFormat: - case SpvCapabilityStorageImageWriteWithoutFormat: - case SpvCapabilityMultiViewport: - case SpvCapabilityInt64Atomics: - case SpvCapabilityTransformFeedback: - case SpvCapabilityGeometryStreams: - case SpvCapabilityFloat16: - case SpvCapabilityInt8: + switch (spv::Capability(capability)) { + case spv::Capability::Geometry: + case spv::Capability::Tessellation: + case spv::Capability::Float64: + case spv::Capability::Int64: + case spv::Capability::Int16: + case spv::Capability::TessellationPointSize: + case spv::Capability::GeometryPointSize: + case spv::Capability::ImageGatherExtended: + case spv::Capability::StorageImageMultisample: + case spv::Capability::UniformBufferArrayDynamicIndexing: + case spv::Capability::SampledImageArrayDynamicIndexing: + case spv::Capability::StorageBufferArrayDynamicIndexing: + case spv::Capability::StorageImageArrayDynamicIndexing: + case spv::Capability::ClipDistance: + case spv::Capability::CullDistance: + case spv::Capability::ImageCubeArray: + case spv::Capability::SampleRateShading: + case spv::Capability::SparseResidency: + case spv::Capability::MinLod: + case spv::Capability::SampledCubeArray: + case spv::Capability::ImageMSArray: + case spv::Capability::StorageImageExtendedFormats: + case spv::Capability::InterpolationFunction: + case spv::Capability::StorageImageReadWithoutFormat: + case spv::Capability::StorageImageWriteWithoutFormat: + case spv::Capability::MultiViewport: + case spv::Capability::Int64Atomics: + case spv::Capability::TransformFeedback: + case spv::Capability::GeometryStreams: + case spv::Capability::Float16: + case spv::Capability::Int8: return true; + default: + break; } return false; } @@ -104,27 +110,29 @@ bool IsSupportOptionalVulkan_1_0(uint32_t capability) { bool IsSupportOptionalVulkan_1_1(uint32_t capability) { if (IsSupportOptionalVulkan_1_0(capability)) return true; - switch (capability) { - case SpvCapabilityGroupNonUniform: - case SpvCapabilityGroupNonUniformVote: - case SpvCapabilityGroupNonUniformArithmetic: - case SpvCapabilityGroupNonUniformBallot: - case SpvCapabilityGroupNonUniformShuffle: - case SpvCapabilityGroupNonUniformShuffleRelative: - case SpvCapabilityGroupNonUniformClustered: - case SpvCapabilityGroupNonUniformQuad: - case SpvCapabilityDrawParameters: - // Alias SpvCapabilityStorageBuffer16BitAccess. - case SpvCapabilityStorageUniformBufferBlock16: - // Alias SpvCapabilityUniformAndStorageBuffer16BitAccess. - case SpvCapabilityStorageUniform16: - case SpvCapabilityStoragePushConstant16: - case SpvCapabilityStorageInputOutput16: - case SpvCapabilityDeviceGroup: - case SpvCapabilityMultiView: - case SpvCapabilityVariablePointersStorageBuffer: - case SpvCapabilityVariablePointers: + switch (spv::Capability(capability)) { + case spv::Capability::GroupNonUniform: + case spv::Capability::GroupNonUniformVote: + case spv::Capability::GroupNonUniformArithmetic: + case spv::Capability::GroupNonUniformBallot: + case spv::Capability::GroupNonUniformShuffle: + case spv::Capability::GroupNonUniformShuffleRelative: + case spv::Capability::GroupNonUniformClustered: + case spv::Capability::GroupNonUniformQuad: + case spv::Capability::DrawParameters: + // Alias spv::Capability::StorageBuffer16BitAccess. + case spv::Capability::StorageUniformBufferBlock16: + // Alias spv::Capability::UniformAndStorageBuffer16BitAccess. + case spv::Capability::StorageUniform16: + case spv::Capability::StoragePushConstant16: + case spv::Capability::StorageInputOutput16: + case spv::Capability::DeviceGroup: + case spv::Capability::MultiView: + case spv::Capability::VariablePointersStorageBuffer: + case spv::Capability::VariablePointers: return true; + default: + break; } return false; } @@ -132,47 +140,51 @@ bool IsSupportOptionalVulkan_1_1(uint32_t capability) { bool IsSupportOptionalVulkan_1_2(uint32_t capability) { if (IsSupportOptionalVulkan_1_1(capability)) return true; - switch (capability) { - case SpvCapabilityDenormPreserve: - case SpvCapabilityDenormFlushToZero: - case SpvCapabilitySignedZeroInfNanPreserve: - case SpvCapabilityRoundingModeRTE: - case SpvCapabilityRoundingModeRTZ: - case SpvCapabilityVulkanMemoryModel: - case SpvCapabilityVulkanMemoryModelDeviceScope: - case SpvCapabilityStorageBuffer8BitAccess: - case SpvCapabilityUniformAndStorageBuffer8BitAccess: - case SpvCapabilityStoragePushConstant8: - case SpvCapabilityShaderViewportIndex: - case SpvCapabilityShaderLayer: - case SpvCapabilityPhysicalStorageBufferAddresses: - case SpvCapabilityRuntimeDescriptorArray: - case SpvCapabilityUniformTexelBufferArrayDynamicIndexing: - case SpvCapabilityStorageTexelBufferArrayDynamicIndexing: - case SpvCapabilityUniformBufferArrayNonUniformIndexing: - case SpvCapabilitySampledImageArrayNonUniformIndexing: - case SpvCapabilityStorageBufferArrayNonUniformIndexing: - case SpvCapabilityStorageImageArrayNonUniformIndexing: - case SpvCapabilityInputAttachmentArrayNonUniformIndexing: - case SpvCapabilityUniformTexelBufferArrayNonUniformIndexing: - case SpvCapabilityStorageTexelBufferArrayNonUniformIndexing: + switch (spv::Capability(capability)) { + case spv::Capability::DenormPreserve: + case spv::Capability::DenormFlushToZero: + case spv::Capability::SignedZeroInfNanPreserve: + case spv::Capability::RoundingModeRTE: + case spv::Capability::RoundingModeRTZ: + case spv::Capability::VulkanMemoryModel: + case spv::Capability::VulkanMemoryModelDeviceScope: + case spv::Capability::StorageBuffer8BitAccess: + case spv::Capability::UniformAndStorageBuffer8BitAccess: + case spv::Capability::StoragePushConstant8: + case spv::Capability::ShaderViewportIndex: + case spv::Capability::ShaderLayer: + case spv::Capability::PhysicalStorageBufferAddresses: + case spv::Capability::RuntimeDescriptorArray: + case spv::Capability::UniformTexelBufferArrayDynamicIndexing: + case spv::Capability::StorageTexelBufferArrayDynamicIndexing: + case spv::Capability::UniformBufferArrayNonUniformIndexing: + case spv::Capability::SampledImageArrayNonUniformIndexing: + case spv::Capability::StorageBufferArrayNonUniformIndexing: + case spv::Capability::StorageImageArrayNonUniformIndexing: + case spv::Capability::InputAttachmentArrayNonUniformIndexing: + case spv::Capability::UniformTexelBufferArrayNonUniformIndexing: + case spv::Capability::StorageTexelBufferArrayNonUniformIndexing: return true; + default: + break; } return false; } bool IsSupportGuaranteedOpenCL_1_2(uint32_t capability, bool embedded_profile) { - switch (capability) { - case SpvCapabilityAddresses: - case SpvCapabilityFloat16Buffer: - case SpvCapabilityInt16: - case SpvCapabilityInt8: - case SpvCapabilityKernel: - case SpvCapabilityLinkage: - case SpvCapabilityVector16: + switch (spv::Capability(capability)) { + case spv::Capability::Addresses: + case spv::Capability::Float16Buffer: + case spv::Capability::Int16: + case spv::Capability::Int8: + case spv::Capability::Kernel: + case spv::Capability::Linkage: + case spv::Capability::Vector16: return true; - case SpvCapabilityInt64: + case spv::Capability::Int64: return !embedded_profile; + default: + break; } return false; } @@ -180,12 +192,14 @@ bool IsSupportGuaranteedOpenCL_1_2(uint32_t capability, bool embedded_profile) { bool IsSupportGuaranteedOpenCL_2_0(uint32_t capability, bool embedded_profile) { if (IsSupportGuaranteedOpenCL_1_2(capability, embedded_profile)) return true; - switch (capability) { - case SpvCapabilityDeviceEnqueue: - case SpvCapabilityGenericPointer: - case SpvCapabilityGroups: - case SpvCapabilityPipes: + switch (spv::Capability(capability)) { + case spv::Capability::DeviceEnqueue: + case spv::Capability::GenericPointer: + case spv::Capability::Groups: + case spv::Capability::Pipes: return true; + default: + break; } return false; } @@ -193,19 +207,23 @@ bool IsSupportGuaranteedOpenCL_2_0(uint32_t capability, bool embedded_profile) { bool IsSupportGuaranteedOpenCL_2_2(uint32_t capability, bool embedded_profile) { if (IsSupportGuaranteedOpenCL_2_0(capability, embedded_profile)) return true; - switch (capability) { - case SpvCapabilitySubgroupDispatch: - case SpvCapabilityPipeStorage: + switch (spv::Capability(capability)) { + case spv::Capability::SubgroupDispatch: + case spv::Capability::PipeStorage: return true; + default: + break; } return false; } bool IsSupportOptionalOpenCL_1_2(uint32_t capability) { - switch (capability) { - case SpvCapabilityImageBasic: - case SpvCapabilityFloat64: + switch (spv::Capability(capability)) { + case spv::Capability::ImageBasic: + case spv::Capability::Float64: return true; + default: + break; } return false; } @@ -222,21 +240,23 @@ bool IsEnabledByExtension(ValidationState_t& _, uint32_t capability) { ExtensionSet operand_exts(operand_desc->numExtensions, operand_desc->extensions); - if (operand_exts.IsEmpty()) return false; + if (operand_exts.empty()) return false; return _.HasAnyOfExtensions(operand_exts); } bool IsEnabledByCapabilityOpenCL_1_2(ValidationState_t& _, uint32_t capability) { - if (_.HasCapability(SpvCapabilityImageBasic)) { - switch (capability) { - case SpvCapabilityLiteralSampler: - case SpvCapabilitySampled1D: - case SpvCapabilityImage1D: - case SpvCapabilitySampledBuffer: - case SpvCapabilityImageBuffer: + if (_.HasCapability(spv::Capability::ImageBasic)) { + switch (spv::Capability(capability)) { + case spv::Capability::LiteralSampler: + case spv::Capability::Sampled1D: + case spv::Capability::Image1D: + case spv::Capability::SampledBuffer: + case spv::Capability::ImageBuffer: return true; + default: + break; } return false; } @@ -245,15 +265,17 @@ bool IsEnabledByCapabilityOpenCL_1_2(ValidationState_t& _, bool IsEnabledByCapabilityOpenCL_2_0(ValidationState_t& _, uint32_t capability) { - if (_.HasCapability(SpvCapabilityImageBasic)) { - switch (capability) { - case SpvCapabilityImageReadWrite: - case SpvCapabilityLiteralSampler: - case SpvCapabilitySampled1D: - case SpvCapabilityImage1D: - case SpvCapabilitySampledBuffer: - case SpvCapabilityImageBuffer: + if (_.HasCapability(spv::Capability::ImageBasic)) { + switch (spv::Capability(capability)) { + case spv::Capability::ImageReadWrite: + case spv::Capability::LiteralSampler: + case spv::Capability::Sampled1D: + case spv::Capability::Image1D: + case spv::Capability::SampledBuffer: + case spv::Capability::ImageBuffer: return true; + default: + break; } return false; } @@ -265,7 +287,7 @@ bool IsEnabledByCapabilityOpenCL_2_0(ValidationState_t& _, // Validates that capability declarations use operands allowed in the current // context. spv_result_t CapabilityPass(ValidationState_t& _, const Instruction* inst) { - if (inst->opcode() != SpvOpCapability) return SPV_SUCCESS; + if (inst->opcode() != spv::Op::OpCapability) return SPV_SUCCESS; assert(inst->operands().size() == 1); diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_cfg.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_cfg.cpp index cc0b999f..7b3f7480 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_cfg.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_cfg.cpp @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include #include -#include #include #include #include @@ -28,7 +26,6 @@ #include "source/cfa.h" #include "source/opcode.h" #include "source/spirv_constant.h" -#include "source/spirv_target_env.h" #include "source/spirv_validator_options.h" #include "source/val/basic_block.h" #include "source/val/construct.h" @@ -54,7 +51,7 @@ spv_result_t ValidatePhi(ValidationState_t& _, const Instruction* inst) { << "OpPhi must not have void result type"; } if (_.IsPointerType(inst->type_id()) && - _.addressing_model() == SpvAddressingModelLogical) { + _.addressing_model() == spv::AddressingModel::Logical) { if (!_.features().variable_pointers) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Using pointers with OpPhi requires capability " @@ -64,13 +61,14 @@ spv_result_t ValidatePhi(ValidationState_t& _, const Instruction* inst) { const Instruction* type_inst = _.FindDef(inst->type_id()); assert(type_inst); - const SpvOp type_opcode = type_inst->opcode(); + const spv::Op type_opcode = type_inst->opcode(); if (!_.options()->before_hlsl_legalization && - !_.HasCapability(SpvCapabilityBindlessTextureNV)) { - if (type_opcode == SpvOpTypeSampledImage || - (_.HasCapability(SpvCapabilityShader) && - (type_opcode == SpvOpTypeImage || type_opcode == SpvOpTypeSampler))) { + !_.HasCapability(spv::Capability::BindlessTextureNV)) { + if (type_opcode == spv::Op::OpTypeSampledImage || + (_.HasCapability(spv::Capability::Shader) && + (type_opcode == spv::Op::OpTypeImage || + type_opcode == spv::Op::OpTypeSampler))) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Result type cannot be Op" << spvOpcodeString(type_opcode); } @@ -108,7 +106,7 @@ spv_result_t ValidatePhi(ValidationState_t& _, const Instruction* inst) { << " type " << _.getIdName(inc_type_id) << "."; } } else { - if (_.GetIdOpcode(inc_id) != SpvOpLabel) { + if (_.GetIdOpcode(inc_id) != spv::Op::OpLabel) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpPhi's incoming basic block " << _.getIdName(inc_id) << " is not an OpLabel."; @@ -143,7 +141,7 @@ spv_result_t ValidateBranch(ValidationState_t& _, const Instruction* inst) { // target operands must be OpLabel const auto id = inst->GetOperandAs(0); const auto target = _.FindDef(id); - if (!target || SpvOpLabel != target->opcode()) { + if (!target || spv::Op::OpLabel != target->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "'Target Label' operands for OpBranch must be the ID " "of an OpLabel instruction"; @@ -178,7 +176,7 @@ spv_result_t ValidateBranchConditional(ValidationState_t& _, // PerformCfgChecks already checks for that const auto true_id = inst->GetOperandAs(1); const auto true_target = _.FindDef(true_id); - if (!true_target || SpvOpLabel != true_target->opcode()) { + if (!true_target || spv::Op::OpLabel != true_target->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "The 'True Label' operand for OpBranchConditional must be the " "ID of an OpLabel instruction"; @@ -186,7 +184,7 @@ spv_result_t ValidateBranchConditional(ValidationState_t& _, const auto false_id = inst->GetOperandAs(2); const auto false_target = _.FindDef(false_id); - if (!false_target || SpvOpLabel != false_target->opcode()) { + if (!false_target || spv::Op::OpLabel != false_target->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "The 'False Label' operand for OpBranchConditional must be the " "ID of an OpLabel instruction"; @@ -213,7 +211,7 @@ spv_result_t ValidateSwitch(ValidationState_t& _, const Instruction* inst) { } const auto default_label = _.FindDef(inst->GetOperandAs(1)); - if (default_label->opcode() != SpvOpLabel) { + if (default_label->opcode() != spv::Op::OpLabel) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Default must be an OpLabel instruction"; } @@ -223,7 +221,7 @@ spv_result_t ValidateSwitch(ValidationState_t& _, const Instruction* inst) { // literal, id const auto id = inst->GetOperandAs(i + 1); const auto target = _.FindDef(id); - if (!target || SpvOpLabel != target->opcode()) { + if (!target || spv::Op::OpLabel != target->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "'Target Label' operands for OpSwitch must be IDs of an " "OpLabel instruction"; @@ -243,14 +241,14 @@ spv_result_t ValidateReturnValue(ValidationState_t& _, << " does not represent a value."; } auto value_type = _.FindDef(value->type_id()); - if (!value_type || SpvOpTypeVoid == value_type->opcode()) { + if (!value_type || spv::Op::OpTypeVoid == value_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpReturnValue value's type " << _.getIdName(value->type_id()) << " is missing or void."; } - if (_.addressing_model() == SpvAddressingModelLogical && - SpvOpTypePointer == value_type->opcode() && + if (_.addressing_model() == spv::AddressingModel::Logical && + spv::Op::OpTypePointer == value_type->opcode() && !_.features().variable_pointers && !_.options()->relax_logical_pointer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpReturnValue value's type " @@ -270,10 +268,15 @@ spv_result_t ValidateReturnValue(ValidationState_t& _, return SPV_SUCCESS; } +uint32_t operator>>(const spv::LoopControlShift& lhs, + const spv::LoopControlShift& rhs) { + return uint32_t(lhs) >> uint32_t(rhs); +} + spv_result_t ValidateLoopMerge(ValidationState_t& _, const Instruction* inst) { const auto merge_id = inst->GetOperandAs(0); const auto merge = _.FindDef(merge_id); - if (!merge || merge->opcode() != SpvOpLabel) { + if (!merge || merge->opcode() != spv::Op::OpLabel) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Merge Block " << _.getIdName(merge_id) << " must be an OpLabel"; } @@ -284,7 +287,7 @@ spv_result_t ValidateLoopMerge(ValidationState_t& _, const Instruction* inst) { const auto continue_id = inst->GetOperandAs(1); const auto continue_target = _.FindDef(continue_id); - if (!continue_target || continue_target->opcode() != SpvOpLabel) { + if (!continue_target || continue_target->opcode() != spv::Op::OpLabel) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Continue Target " << _.getIdName(continue_id) << " must be an OpLabel"; @@ -295,36 +298,36 @@ spv_result_t ValidateLoopMerge(ValidationState_t& _, const Instruction* inst) { << "Merge Block and Continue Target must be different ids"; } - const auto loop_control = inst->GetOperandAs(2); - if ((loop_control >> SpvLoopControlUnrollShift) & 0x1 && - (loop_control >> SpvLoopControlDontUnrollShift) & 0x1) { + const auto loop_control = inst->GetOperandAs(2); + if ((loop_control >> spv::LoopControlShift::Unroll) & 0x1 && + (loop_control >> spv::LoopControlShift::DontUnroll) & 0x1) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Unroll and DontUnroll loop controls must not both be specified"; } - if ((loop_control >> SpvLoopControlDontUnrollShift) & 0x1 && - (loop_control >> SpvLoopControlPeelCountShift) & 0x1) { + if ((loop_control >> spv::LoopControlShift::DontUnroll) & 0x1 && + (loop_control >> spv::LoopControlShift::PeelCount) & 0x1) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "PeelCount and DontUnroll " "loop controls must not " "both be specified"; } - if ((loop_control >> SpvLoopControlDontUnrollShift) & 0x1 && - (loop_control >> SpvLoopControlPartialCountShift) & 0x1) { + if ((loop_control >> spv::LoopControlShift::DontUnroll) & 0x1 && + (loop_control >> spv::LoopControlShift::PartialCount) & 0x1) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "PartialCount and " "DontUnroll loop controls " "must not both be specified"; } uint32_t operand = 3; - if ((loop_control >> SpvLoopControlDependencyLengthShift) & 0x1) { + if ((loop_control >> spv::LoopControlShift::DependencyLength) & 0x1) { ++operand; } - if ((loop_control >> SpvLoopControlMinIterationsShift) & 0x1) { + if ((loop_control >> spv::LoopControlShift::MinIterations) & 0x1) { ++operand; } - if ((loop_control >> SpvLoopControlMaxIterationsShift) & 0x1) { + if ((loop_control >> spv::LoopControlShift::MaxIterations) & 0x1) { ++operand; } - if ((loop_control >> SpvLoopControlIterationMultipleShift) & 0x1) { + if ((loop_control >> spv::LoopControlShift::IterationMultiple) & 0x1) { if (inst->operands().size() < operand || inst->GetOperandAs(operand) == 0) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "IterationMultiple loop " @@ -333,10 +336,10 @@ spv_result_t ValidateLoopMerge(ValidationState_t& _, const Instruction* inst) { } ++operand; } - if ((loop_control >> SpvLoopControlPeelCountShift) & 0x1) { + if ((loop_control >> spv::LoopControlShift::PeelCount) & 0x1) { ++operand; } - if ((loop_control >> SpvLoopControlPartialCountShift) & 0x1) { + if ((loop_control >> spv::LoopControlShift::PartialCount) & 0x1) { ++operand; } @@ -554,7 +557,7 @@ spv_result_t StructuredSwitchChecks(ValidationState_t& _, Function* function, target_block->structurally_reachable() && !header->structurally_dominates(*target_block)) { return _.diag(SPV_ERROR_INVALID_CFG, header->label()) - << "Selection header " << _.getIdName(header->id()) + << "Switch header " << _.getIdName(header->id()) << " does not structurally dominate its case construct " << _.getIdName(target); } @@ -644,9 +647,9 @@ spv_result_t ValidateStructuredSelections( const auto index = terminator - &_.ordered_instructions()[0]; auto* merge = &_.ordered_instructions()[index - 1]; // Marks merges and continues as seen. - if (merge->opcode() == SpvOpSelectionMerge) { + if (merge->opcode() == spv::Op::OpSelectionMerge) { seen.insert(merge->GetOperandAs(0)); - } else if (merge->opcode() == SpvOpLoopMerge) { + } else if (merge->opcode() == spv::Op::OpLoopMerge) { seen.insert(merge->GetOperandAs(0)); seen.insert(merge->GetOperandAs(1)); } else { @@ -657,7 +660,7 @@ spv_result_t ValidateStructuredSelections( // Skip unreachable blocks. if (!block->structurally_reachable()) continue; - if (terminator->opcode() == SpvOpBranchConditional) { + if (terminator->opcode() == spv::Op::OpBranchConditional) { const auto true_label = terminator->GetOperandAs(1); const auto false_label = terminator->GetOperandAs(2); // Mark the upcoming blocks as seen now, but only error out if this block @@ -665,11 +668,12 @@ spv_result_t ValidateStructuredSelections( // previously. const bool true_label_unseen = seen.insert(true_label).second; const bool false_label_unseen = seen.insert(false_label).second; - if (!merge && true_label_unseen && false_label_unseen) { + if ((!merge || merge->opcode() == spv::Op::OpLoopMerge) && + true_label_unseen && false_label_unseen) { return _.diag(SPV_ERROR_INVALID_CFG, terminator) << "Selection must be structured"; } - } else if (terminator->opcode() == SpvOpSwitch) { + } else if (terminator->opcode() == spv::Op::OpSwitch) { if (!merge) { return _.diag(SPV_ERROR_INVALID_CFG, terminator) << "OpSwitch must be preceded by an OpSelectionMerge " @@ -746,6 +750,7 @@ spv_result_t StructuredControlFlowChecks( _.getIdName(merge->id()), "does not structurally dominate"); } + // If it's really a merge block for a selection or loop, then it must be // *strictly* structrually dominated by the header. if (construct.ExitBlockIsMergeBlock() && (header == merge)) { @@ -798,8 +803,8 @@ spv_result_t StructuredControlFlowChecks( block->is_type(BlockType::kBlockTypeLoop)) { size_t index = (block->terminator() - &_.ordered_instructions()[0]) - 1; const auto& merge_inst = _.ordered_instructions()[index]; - if (merge_inst.opcode() == SpvOpSelectionMerge || - merge_inst.opcode() == SpvOpLoopMerge) { + if (merge_inst.opcode() == spv::Op::OpSelectionMerge || + merge_inst.opcode() == spv::Op::OpLoopMerge) { uint32_t merge_id = merge_inst.GetOperandAs(0); auto merge_block = function->GetBlock(merge_id).first; if (merge_block->structurally_reachable() && @@ -854,7 +859,7 @@ spv_result_t StructuredControlFlowChecks( // Checks rules for case constructs. if (construct.type() == ConstructType::kSelection && - header->terminator()->opcode() == SpvOpSwitch) { + header->terminator()->opcode() == spv::Op::OpSwitch) { const auto terminator = header->terminator(); if (auto error = StructuredSwitchChecks(_, function, terminator, header, merge)) { @@ -928,7 +933,7 @@ spv_result_t PerformCfgChecks(ValidationState_t& _) { } // If we have structured control flow, check that no block has a control // flow nesting depth larger than the limit. - if (_.HasCapability(SpvCapabilityShader)) { + if (_.HasCapability(spv::Capability::Shader)) { const int control_flow_nesting_depth_limit = _.options()->universal_limits_.max_control_flow_nesting_depth; for (auto block = begin(blocks); block != end(blocks); ++block) { @@ -942,7 +947,7 @@ spv_result_t PerformCfgChecks(ValidationState_t& _) { } /// Structured control flow checks are only required for shader capabilities - if (_.HasCapability(SpvCapabilityShader)) { + if (_.HasCapability(spv::Capability::Shader)) { // Calculate structural dominance. postorder.clear(); std::vector postdom_postorder; @@ -998,9 +1003,9 @@ spv_result_t PerformCfgChecks(ValidationState_t& _) { } spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) { - SpvOp opcode = inst->opcode(); + spv::Op opcode = inst->opcode(); switch (opcode) { - case SpvOpLabel: + case spv::Op::OpLabel: if (auto error = _.current_function().RegisterBlock(inst->id())) return error; @@ -1009,7 +1014,7 @@ spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) { // passes the OpLabel ends up not being part of the basic block it starts. _.current_function().current_block()->set_label(inst); break; - case SpvOpLoopMerge: { + case spv::Op::OpLoopMerge: { uint32_t merge_block = inst->GetOperandAs(0); uint32_t continue_block = inst->GetOperandAs(1); CFG_ASSERT(MergeBlockAssert, merge_block); @@ -1018,20 +1023,20 @@ spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) { continue_block)) return error; } break; - case SpvOpSelectionMerge: { + case spv::Op::OpSelectionMerge: { uint32_t merge_block = inst->GetOperandAs(0); CFG_ASSERT(MergeBlockAssert, merge_block); if (auto error = _.current_function().RegisterSelectionMerge(merge_block)) return error; } break; - case SpvOpBranch: { + case spv::Op::OpBranch: { uint32_t target = inst->GetOperandAs(0); CFG_ASSERT(FirstBlockAssert, target); _.current_function().RegisterBlockEnd({target}); } break; - case SpvOpBranchConditional: { + case spv::Op::OpBranchConditional: { uint32_t tlabel = inst->GetOperandAs(1); uint32_t flabel = inst->GetOperandAs(2); CFG_ASSERT(FirstBlockAssert, tlabel); @@ -1040,7 +1045,7 @@ spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) { _.current_function().RegisterBlockEnd({tlabel, flabel}); } break; - case SpvOpSwitch: { + case spv::Op::OpSwitch: { std::vector cases; for (size_t i = 1; i < inst->operands().size(); i += 2) { uint32_t target = inst->GetOperandAs(i); @@ -1049,44 +1054,44 @@ spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) { } _.current_function().RegisterBlockEnd({cases}); } break; - case SpvOpReturn: { + case spv::Op::OpReturn: { const uint32_t return_type = _.current_function().GetResultTypeId(); const Instruction* return_type_inst = _.FindDef(return_type); assert(return_type_inst); - if (return_type_inst->opcode() != SpvOpTypeVoid) + if (return_type_inst->opcode() != spv::Op::OpTypeVoid) return _.diag(SPV_ERROR_INVALID_CFG, inst) << "OpReturn can only be called from a function with void " << "return type."; _.current_function().RegisterBlockEnd(std::vector()); break; } - case SpvOpKill: - case SpvOpReturnValue: - case SpvOpUnreachable: - case SpvOpTerminateInvocation: - case SpvOpIgnoreIntersectionKHR: - case SpvOpTerminateRayKHR: - case SpvOpEmitMeshTasksEXT: + case spv::Op::OpKill: + case spv::Op::OpReturnValue: + case spv::Op::OpUnreachable: + case spv::Op::OpTerminateInvocation: + case spv::Op::OpIgnoreIntersectionKHR: + case spv::Op::OpTerminateRayKHR: + case spv::Op::OpEmitMeshTasksEXT: _.current_function().RegisterBlockEnd(std::vector()); // Ops with dedicated passes check for the Execution Model there - if (opcode == SpvOpKill) { + if (opcode == spv::Op::OpKill) { _.current_function().RegisterExecutionModelLimitation( - SpvExecutionModelFragment, + spv::ExecutionModel::Fragment, "OpKill requires Fragment execution model"); } - if (opcode == SpvOpTerminateInvocation) { + if (opcode == spv::Op::OpTerminateInvocation) { _.current_function().RegisterExecutionModelLimitation( - SpvExecutionModelFragment, + spv::ExecutionModel::Fragment, "OpTerminateInvocation requires Fragment execution model"); } - if (opcode == SpvOpIgnoreIntersectionKHR) { + if (opcode == spv::Op::OpIgnoreIntersectionKHR) { _.current_function().RegisterExecutionModelLimitation( - SpvExecutionModelAnyHitKHR, + spv::ExecutionModel::AnyHitKHR, "OpIgnoreIntersectionKHR requires AnyHitKHR execution model"); } - if (opcode == SpvOpTerminateRayKHR) { + if (opcode == spv::Op::OpTerminateRayKHR) { _.current_function().RegisterExecutionModelLimitation( - SpvExecutionModelAnyHitKHR, + spv::ExecutionModel::AnyHitKHR, "OpTerminateRayKHR requires AnyHitKHR execution model"); } @@ -1140,22 +1145,22 @@ void ReachabilityPass(ValidationState_t& _) { spv_result_t ControlFlowPass(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { - case SpvOpPhi: + case spv::Op::OpPhi: if (auto error = ValidatePhi(_, inst)) return error; break; - case SpvOpBranch: + case spv::Op::OpBranch: if (auto error = ValidateBranch(_, inst)) return error; break; - case SpvOpBranchConditional: + case spv::Op::OpBranchConditional: if (auto error = ValidateBranchConditional(_, inst)) return error; break; - case SpvOpReturnValue: + case spv::Op::OpReturnValue: if (auto error = ValidateReturnValue(_, inst)) return error; break; - case SpvOpSwitch: + case spv::Op::OpSwitch: if (auto error = ValidateSwitch(_, inst)) return error; break; - case SpvOpLoopMerge: + case spv::Op::OpLoopMerge: if (auto error = ValidateLoopMerge(_, inst)) return error; break; default: diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_composites.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_composites.cpp index c3d948dc..ed043b68 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_composites.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_composites.cpp @@ -14,12 +14,10 @@ // Validates correctness of composite SPIR-V instructions. -#include "source/val/validate.h" - -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_target_env.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools { @@ -35,9 +33,10 @@ namespace { spv_result_t GetExtractInsertValueType(ValidationState_t& _, const Instruction* inst, uint32_t* member_type) { - const SpvOp opcode = inst->opcode(); - assert(opcode == SpvOpCompositeExtract || opcode == SpvOpCompositeInsert); - uint32_t word_index = opcode == SpvOpCompositeExtract ? 4 : 5; + const spv::Op opcode = inst->opcode(); + assert(opcode == spv::Op::OpCompositeExtract || + opcode == spv::Op::OpCompositeInsert); + uint32_t word_index = opcode == spv::Op::OpCompositeExtract ? 4 : 5; const uint32_t num_words = static_cast(inst->words().size()); const uint32_t composite_id_index = word_index - 1; const uint32_t num_indices = num_words - word_index; @@ -66,7 +65,7 @@ spv_result_t GetExtractInsertValueType(ValidationState_t& _, const Instruction* const type_inst = _.FindDef(*member_type); assert(type_inst); switch (type_inst->opcode()) { - case SpvOpTypeVector: { + case spv::Op::OpTypeVector: { *member_type = type_inst->word(2); const uint32_t vector_size = type_inst->word(3); if (component_index >= vector_size) { @@ -76,7 +75,7 @@ spv_result_t GetExtractInsertValueType(ValidationState_t& _, } break; } - case SpvOpTypeMatrix: { + case spv::Op::OpTypeMatrix: { *member_type = type_inst->word(2); const uint32_t num_cols = type_inst->word(3); if (component_index >= num_cols) { @@ -86,7 +85,7 @@ spv_result_t GetExtractInsertValueType(ValidationState_t& _, } break; } - case SpvOpTypeArray: { + case spv::Op::OpTypeArray: { uint64_t array_size = 0; auto size = _.FindDef(type_inst->word(3)); *member_type = type_inst->word(2); @@ -105,12 +104,12 @@ spv_result_t GetExtractInsertValueType(ValidationState_t& _, } break; } - case SpvOpTypeRuntimeArray: { + case spv::Op::OpTypeRuntimeArray: { *member_type = type_inst->word(2); // Array size is unknown. break; } - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { const size_t num_struct_members = type_inst->words().size() - 2; if (component_index >= num_struct_members) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -123,7 +122,8 @@ spv_result_t GetExtractInsertValueType(ValidationState_t& _, *member_type = type_inst->word(component_index + 2); break; } - case SpvOpTypeCooperativeMatrixNV: { + case spv::Op::OpTypeCooperativeMatrixKHR: + case spv::Op::OpTypeCooperativeMatrixNV: { *member_type = type_inst->word(2); break; } @@ -140,15 +140,15 @@ spv_result_t GetExtractInsertValueType(ValidationState_t& _, spv_result_t ValidateVectorExtractDynamic(ValidationState_t& _, const Instruction* inst) { const uint32_t result_type = inst->type_id(); - const SpvOp result_opcode = _.GetIdOpcode(result_type); + const spv::Op result_opcode = _.GetIdOpcode(result_type); if (!spvOpcodeIsScalarType(result_opcode)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be a scalar type"; } const uint32_t vector_type = _.GetOperandTypeId(inst, 2); - const SpvOp vector_opcode = _.GetIdOpcode(vector_type); - if (vector_opcode != SpvOpTypeVector) { + const spv::Op vector_opcode = _.GetIdOpcode(vector_type); + if (vector_opcode != spv::Op::OpTypeVector) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Vector type to be OpTypeVector"; } @@ -164,7 +164,7 @@ spv_result_t ValidateVectorExtractDynamic(ValidationState_t& _, << "Expected Index to be int scalar"; } - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cannot extract from a vector of 8- or 16-bit types"; @@ -175,8 +175,8 @@ spv_result_t ValidateVectorExtractDynamic(ValidationState_t& _, spv_result_t ValidateVectorInsertDyanmic(ValidationState_t& _, const Instruction* inst) { const uint32_t result_type = inst->type_id(); - const SpvOp result_opcode = _.GetIdOpcode(result_type); - if (result_opcode != SpvOpTypeVector) { + const spv::Op result_opcode = _.GetIdOpcode(result_type); + if (result_opcode != spv::Op::OpTypeVector) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be OpTypeVector"; } @@ -200,7 +200,7 @@ spv_result_t ValidateVectorInsertDyanmic(ValidationState_t& _, << "Expected Index to be int scalar"; } - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cannot insert into a vector of 8- or 16-bit types"; @@ -212,9 +212,9 @@ spv_result_t ValidateCompositeConstruct(ValidationState_t& _, const Instruction* inst) { const uint32_t num_operands = static_cast(inst->operands().size()); const uint32_t result_type = inst->type_id(); - const SpvOp result_opcode = _.GetIdOpcode(result_type); + const spv::Op result_opcode = _.GetIdOpcode(result_type); switch (result_opcode) { - case SpvOpTypeVector: { + case spv::Op::OpTypeVector: { const uint32_t num_result_components = _.GetDimension(result_type); const uint32_t result_component_type = _.GetComponentType(result_type); uint32_t given_component_count = 0; @@ -230,7 +230,7 @@ spv_result_t ValidateCompositeConstruct(ValidationState_t& _, if (operand_type == result_component_type) { ++given_component_count; } else { - if (_.GetIdOpcode(operand_type) != SpvOpTypeVector || + if (_.GetIdOpcode(operand_type) != spv::Op::OpTypeVector || _.GetComponentType(operand_type) != result_component_type) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Constituents to be scalars or vectors of" @@ -249,7 +249,7 @@ spv_result_t ValidateCompositeConstruct(ValidationState_t& _, break; } - case SpvOpTypeMatrix: { + case spv::Op::OpTypeMatrix: { uint32_t result_num_rows = 0; uint32_t result_num_cols = 0; uint32_t result_col_type = 0; @@ -277,10 +277,10 @@ spv_result_t ValidateCompositeConstruct(ValidationState_t& _, break; } - case SpvOpTypeArray: { + case spv::Op::OpTypeArray: { const Instruction* const array_inst = _.FindDef(result_type); assert(array_inst); - assert(array_inst->opcode() == SpvOpTypeArray); + assert(array_inst->opcode() == spv::Op::OpTypeArray); auto size = _.FindDef(array_inst->word(3)); if (spvOpcodeIsSpecConstant(size->opcode())) { @@ -312,10 +312,10 @@ spv_result_t ValidateCompositeConstruct(ValidationState_t& _, break; } - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { const Instruction* const struct_inst = _.FindDef(result_type); assert(struct_inst); - assert(struct_inst->opcode() == SpvOpTypeStruct); + assert(struct_inst->opcode() == spv::Op::OpTypeStruct); if (struct_inst->operands().size() + 1 != num_operands) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -336,7 +336,26 @@ spv_result_t ValidateCompositeConstruct(ValidationState_t& _, break; } - case SpvOpTypeCooperativeMatrixNV: { + case spv::Op::OpTypeCooperativeMatrixKHR: { + const auto result_type_inst = _.FindDef(result_type); + assert(result_type_inst); + const auto component_type_id = + result_type_inst->GetOperandAs(1); + + if (3 != num_operands) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Must be only one constituent"; + } + + const uint32_t operand_type_id = _.GetOperandTypeId(inst, 2); + + if (operand_type_id != component_type_id) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Constituent type to be equal to the component type"; + } + break; + } + case spv::Op::OpTypeCooperativeMatrixNV: { const auto result_type_inst = _.FindDef(result_type); assert(result_type_inst); const auto component_type_id = @@ -362,7 +381,7 @@ spv_result_t ValidateCompositeConstruct(ValidationState_t& _, } } - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cannot create a composite containing 8- or 16-bit types"; @@ -386,7 +405,7 @@ spv_result_t ValidateCompositeExtract(ValidationState_t& _, << spvOpcodeString(_.GetIdOpcode(member_type)) << ")."; } - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cannot extract from a composite of 8- or 16-bit types"; @@ -421,7 +440,7 @@ spv_result_t ValidateCompositeInsert(ValidationState_t& _, << spvOpcodeString(_.GetIdOpcode(member_type)) << ")."; } - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cannot insert into a composite of 8- or 16-bit types"; @@ -480,7 +499,7 @@ spv_result_t ValidateTranspose(ValidationState_t& _, const Instruction* inst) { << "to be the reverse of those of Result Type"; } - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cannot transpose matrices of 16-bit floats"; @@ -491,11 +510,12 @@ spv_result_t ValidateTranspose(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateVectorShuffle(ValidationState_t& _, const Instruction* inst) { auto resultType = _.FindDef(inst->type_id()); - if (!resultType || resultType->opcode() != SpvOpTypeVector) { + if (!resultType || resultType->opcode() != spv::Op::OpTypeVector) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "The Result Type of OpVectorShuffle must be" << " OpTypeVector. Found Op" - << spvOpcodeString(static_cast(resultType->opcode())) << "."; + << spvOpcodeString(static_cast(resultType->opcode())) + << "."; } // The number of components in Result Type must be the same as the number of @@ -515,11 +535,11 @@ spv_result_t ValidateVectorShuffle(ValidationState_t& _, auto vector1Type = _.FindDef(vector1Object->type_id()); auto vector2Object = _.FindDef(inst->GetOperandAs(3)); auto vector2Type = _.FindDef(vector2Object->type_id()); - if (!vector1Type || vector1Type->opcode() != SpvOpTypeVector) { + if (!vector1Type || vector1Type->opcode() != spv::Op::OpTypeVector) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "The type of Vector 1 must be OpTypeVector."; } - if (!vector2Type || vector2Type->opcode() != SpvOpTypeVector) { + if (!vector2Type || vector2Type->opcode() != spv::Op::OpTypeVector) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "The type of Vector 2 must be OpTypeVector."; } @@ -548,7 +568,7 @@ spv_result_t ValidateVectorShuffle(ValidationState_t& _, } } - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cannot shuffle a vector of 8- or 16-bit types"; @@ -572,7 +592,7 @@ spv_result_t ValidateCopyLogical(ValidationState_t& _, << "Result Type does not logically match the Operand type"; } - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Cannot copy composites of 8- or 16-bit types"; @@ -586,23 +606,23 @@ spv_result_t ValidateCopyLogical(ValidationState_t& _, // Validates correctness of composite instructions. spv_result_t CompositesPass(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { - case SpvOpVectorExtractDynamic: + case spv::Op::OpVectorExtractDynamic: return ValidateVectorExtractDynamic(_, inst); - case SpvOpVectorInsertDynamic: + case spv::Op::OpVectorInsertDynamic: return ValidateVectorInsertDyanmic(_, inst); - case SpvOpVectorShuffle: + case spv::Op::OpVectorShuffle: return ValidateVectorShuffle(_, inst); - case SpvOpCompositeConstruct: + case spv::Op::OpCompositeConstruct: return ValidateCompositeConstruct(_, inst); - case SpvOpCompositeExtract: + case spv::Op::OpCompositeExtract: return ValidateCompositeExtract(_, inst); - case SpvOpCompositeInsert: + case spv::Op::OpCompositeInsert: return ValidateCompositeInsert(_, inst); - case SpvOpCopyObject: + case spv::Op::OpCopyObject: return ValidateCopyObject(_, inst); - case SpvOpTranspose: + case spv::Op::OpTranspose: return ValidateTranspose(_, inst); - case SpvOpCopyLogical: + case spv::Op::OpCopyLogical: return ValidateCopyLogical(_, inst); default: break; diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_constants.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_constants.cpp index fdfaea5f..4deaa496 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_constants.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_constants.cpp @@ -24,7 +24,7 @@ namespace { spv_result_t ValidateConstantBool(ValidationState_t& _, const Instruction* inst) { auto type = _.FindDef(inst->type_id()); - if (!type || type->opcode() != SpvOpTypeBool) { + if (!type || type->opcode() != spv::Op::OpTypeBool) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Op" << spvOpcodeString(inst->opcode()) << " Result Type " << _.getIdName(inst->type_id()) << " is not a boolean type."; @@ -46,7 +46,7 @@ spv_result_t ValidateConstantComposite(ValidationState_t& _, const auto constituent_count = inst->words().size() - 3; switch (result_type->opcode()) { - case SpvOpTypeVector: { + case spv::Op::OpTypeVector: { const auto component_count = result_type->GetOperandAs(2); if (component_count != constituent_count) { // TODO: Output ID's on diagnostic @@ -76,7 +76,7 @@ spv_result_t ValidateConstantComposite(ValidationState_t& _, } const auto constituent_result_type = _.FindDef(constituent->type_id()); if (!constituent_result_type || - component_type->opcode() != constituent_result_type->opcode()) { + component_type->id() != constituent_result_type->id()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << opcode_name << " Constituent " << _.getIdName(constituent_id) @@ -85,7 +85,7 @@ spv_result_t ValidateConstantComposite(ValidationState_t& _, } } } break; - case SpvOpTypeMatrix: { + case spv::Op::OpTypeMatrix: { const auto column_count = result_type->GetOperandAs(2); if (column_count != constituent_count) { // TODO: Output ID's on diagnostic @@ -155,7 +155,7 @@ spv_result_t ValidateConstantComposite(ValidationState_t& _, } } } break; - case SpvOpTypeArray: { + case spv::Op::OpTypeArray: { auto element_type = _.FindDef(result_type->GetOperandAs(1)); if (!element_type) { return _.diag(SPV_ERROR_INVALID_ID, result_type) @@ -203,7 +203,7 @@ spv_result_t ValidateConstantComposite(ValidationState_t& _, } } } break; - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { const auto member_count = result_type->words().size() - 2; if (member_count != constituent_count) { return _.diag(SPV_ERROR_INVALID_ID, inst) @@ -243,7 +243,8 @@ spv_result_t ValidateConstantComposite(ValidationState_t& _, } } } break; - case SpvOpTypeCooperativeMatrixNV: { + case spv::Op::OpTypeCooperativeMatrixKHR: + case spv::Op::OpTypeCooperativeMatrixNV: { if (1 != constituent_count) { return _.diag(SPV_ERROR_INVALID_ID, inst) << opcode_name << " Constituent " @@ -281,7 +282,7 @@ spv_result_t ValidateConstantComposite(ValidationState_t& _, spv_result_t ValidateConstantSampler(ValidationState_t& _, const Instruction* inst) { const auto result_type = _.FindDef(inst->type_id()); - if (!result_type || result_type->opcode() != SpvOpTypeSampler) { + if (!result_type || result_type->opcode() != spv::Op::OpTypeSampler) { return _.diag(SPV_ERROR_INVALID_ID, result_type) << "OpConstantSampler Result Type " << _.getIdName(inst->type_id()) << " is not a sampler type."; @@ -298,23 +299,24 @@ bool IsTypeNullable(const std::vector& instruction, uint16_t opcode; uint16_t word_count; spvOpcodeSplit(instruction[0], &word_count, &opcode); - switch (static_cast(opcode)) { - case SpvOpTypeBool: - case SpvOpTypeInt: - case SpvOpTypeFloat: - case SpvOpTypeEvent: - case SpvOpTypeDeviceEvent: - case SpvOpTypeReserveId: - case SpvOpTypeQueue: + switch (static_cast(opcode)) { + case spv::Op::OpTypeBool: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: + case spv::Op::OpTypeEvent: + case spv::Op::OpTypeDeviceEvent: + case spv::Op::OpTypeReserveId: + case spv::Op::OpTypeQueue: return true; - case SpvOpTypeArray: - case SpvOpTypeMatrix: - case SpvOpTypeCooperativeMatrixNV: - case SpvOpTypeVector: { + case spv::Op::OpTypeArray: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixKHR: + case spv::Op::OpTypeVector: { auto base_type = _.FindDef(instruction[2]); return base_type && IsTypeNullable(base_type->words(), _); } - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { for (size_t elementIndex = 2; elementIndex < instruction.size(); ++elementIndex) { auto element = _.FindDef(instruction[elementIndex]); @@ -322,8 +324,9 @@ bool IsTypeNullable(const std::vector& instruction, } return true; } - case SpvOpTypePointer: - if (instruction[2] == SpvStorageClassPhysicalStorageBuffer) { + case spv::Op::OpTypePointer: + if (spv::StorageClass(instruction[2]) == + spv::StorageClass::PhysicalStorageBuffer) { return false; } return true; @@ -351,7 +354,8 @@ spv_result_t ValidateSpecConstant(ValidationState_t& _, auto type_id = inst->GetOperandAs(0); auto type_instruction = _.FindDef(type_id); auto type_opcode = type_instruction->opcode(); - if (type_opcode != SpvOpTypeInt && type_opcode != SpvOpTypeFloat) { + if (type_opcode != spv::Op::OpTypeInt && + type_opcode != spv::Op::OpTypeFloat) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Specialization constant " "must be an integer or " "floating-point number."; @@ -361,22 +365,22 @@ spv_result_t ValidateSpecConstant(ValidationState_t& _, spv_result_t ValidateSpecConstantOp(ValidationState_t& _, const Instruction* inst) { - const auto op = inst->GetOperandAs(2); + const auto op = inst->GetOperandAs(2); // The binary parser already ensures that the op is valid for *some* // environment. Here we check restrictions. switch (op) { - case SpvOpQuantizeToF16: - if (!_.HasCapability(SpvCapabilityShader)) { + case spv::Op::OpQuantizeToF16: + if (!_.HasCapability(spv::Capability::Shader)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Specialization constant operation " << spvOpcodeString(op) << " requires Shader capability"; } break; - case SpvOpUConvert: + case spv::Op::OpUConvert: if (!_.features().uconvert_spec_constant_op && - !_.HasCapability(SpvCapabilityKernel)) { + !_.HasCapability(spv::Capability::Kernel)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Prior to SPIR-V 1.4, specialization constant operation " "UConvert requires Kernel capability or extension " @@ -384,27 +388,27 @@ spv_result_t ValidateSpecConstantOp(ValidationState_t& _, } break; - case SpvOpConvertFToS: - case SpvOpConvertSToF: - case SpvOpConvertFToU: - case SpvOpConvertUToF: - case SpvOpConvertPtrToU: - case SpvOpConvertUToPtr: - case SpvOpGenericCastToPtr: - case SpvOpPtrCastToGeneric: - case SpvOpBitcast: - case SpvOpFNegate: - case SpvOpFAdd: - case SpvOpFSub: - case SpvOpFMul: - case SpvOpFDiv: - case SpvOpFRem: - case SpvOpFMod: - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpPtrAccessChain: - case SpvOpInBoundsPtrAccessChain: - if (!_.HasCapability(SpvCapabilityKernel)) { + case spv::Op::OpConvertFToS: + case spv::Op::OpConvertSToF: + case spv::Op::OpConvertFToU: + case spv::Op::OpConvertUToF: + case spv::Op::OpConvertPtrToU: + case spv::Op::OpConvertUToPtr: + case spv::Op::OpGenericCastToPtr: + case spv::Op::OpPtrCastToGeneric: + case spv::Op::OpBitcast: + case spv::Op::OpFNegate: + case spv::Op::OpFAdd: + case spv::Op::OpFSub: + case spv::Op::OpFMul: + case spv::Op::OpFDiv: + case spv::Op::OpFRem: + case spv::Op::OpFMod: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpPtrAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: + if (!_.HasCapability(spv::Capability::Kernel)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Specialization constant operation " << spvOpcodeString(op) << " requires Kernel capability"; @@ -423,26 +427,26 @@ spv_result_t ValidateSpecConstantOp(ValidationState_t& _, spv_result_t ConstantPass(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { - case SpvOpConstantTrue: - case SpvOpConstantFalse: - case SpvOpSpecConstantTrue: - case SpvOpSpecConstantFalse: + case spv::Op::OpConstantTrue: + case spv::Op::OpConstantFalse: + case spv::Op::OpSpecConstantTrue: + case spv::Op::OpSpecConstantFalse: if (auto error = ValidateConstantBool(_, inst)) return error; break; - case SpvOpConstantComposite: - case SpvOpSpecConstantComposite: + case spv::Op::OpConstantComposite: + case spv::Op::OpSpecConstantComposite: if (auto error = ValidateConstantComposite(_, inst)) return error; break; - case SpvOpConstantSampler: + case spv::Op::OpConstantSampler: if (auto error = ValidateConstantSampler(_, inst)) return error; break; - case SpvOpConstantNull: + case spv::Op::OpConstantNull: if (auto error = ValidateConstantNull(_, inst)) return error; break; - case SpvOpSpecConstant: + case spv::Op::OpSpecConstant: if (auto error = ValidateSpecConstant(_, inst)) return error; break; - case SpvOpSpecConstantOp: + case spv::Op::OpSpecConstantOp: if (auto error = ValidateSpecConstantOp(_, inst)) return error; break; default: @@ -452,7 +456,7 @@ spv_result_t ConstantPass(ValidationState_t& _, const Instruction* inst) { // Generally disallow creating 8- or 16-bit constants unless the full // capabilities are present. if (spvOpcodeIsConstant(inst->opcode()) && - _.HasCapability(SpvCapabilityShader) && + _.HasCapability(spv::Capability::Shader) && !_.IsPointerType(inst->type_id()) && _.ContainsLimitedUseIntOrFloatType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_ID, inst) diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_conversion.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_conversion.cpp index dc6b1517..b2892a86 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_conversion.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_conversion.cpp @@ -14,7 +14,6 @@ // Validates correctness of conversion instructions. -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_constant.h" #include "source/spirv_target_env.h" @@ -27,11 +26,11 @@ namespace val { // Validates correctness of conversion instructions. spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); const uint32_t result_type = inst->type_id(); switch (opcode) { - case SpvOpConvertFToU: { + case spv::Op::OpConvertFToU: { if (!_.IsUnsignedIntScalarType(result_type) && !_.IsUnsignedIntVectorType(result_type) && !_.IsUnsignedIntCooperativeMatrixType(result_type)) @@ -62,7 +61,7 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpConvertFToS: { + case spv::Op::OpConvertFToS: { if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type) && !_.IsIntCooperativeMatrixType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -92,8 +91,8 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpConvertSToF: - case SpvOpConvertUToF: { + case spv::Op::OpConvertSToF: + case spv::Op::OpConvertUToF: { if (!_.IsFloatScalarType(result_type) && !_.IsFloatVectorType(result_type) && !_.IsFloatCooperativeMatrixType(result_type)) @@ -124,7 +123,7 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpUConvert: { + case spv::Op::OpUConvert: { if (!_.IsUnsignedIntScalarType(result_type) && !_.IsUnsignedIntVectorType(result_type) && !_.IsUnsignedIntCooperativeMatrixType(result_type)) @@ -160,7 +159,7 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpSConvert: { + case spv::Op::OpSConvert: { if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type) && !_.IsIntCooperativeMatrixType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -195,7 +194,7 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpFConvert: { + case spv::Op::OpFConvert: { if (!_.IsFloatScalarType(result_type) && !_.IsFloatVectorType(result_type) && !_.IsFloatCooperativeMatrixType(result_type)) @@ -231,7 +230,7 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpQuantizeToF16: { + case spv::Op::OpQuantizeToF16: { if ((!_.IsFloatScalarType(result_type) && !_.IsFloatVectorType(result_type)) || _.GetBitWidth(result_type) != 32) @@ -247,7 +246,7 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpConvertPtrToU: { + case spv::Op::OpConvertPtrToU: { if (!_.IsUnsignedIntScalarType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected unsigned int scalar type as Result Type: " @@ -258,17 +257,18 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected input to be a pointer: " << spvOpcodeString(opcode); - if (_.addressing_model() == SpvAddressingModelLogical) + if (_.addressing_model() == spv::AddressingModel::Logical) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Logical addressing not supported: " << spvOpcodeString(opcode); - if (_.addressing_model() == SpvAddressingModelPhysicalStorageBuffer64) { - uint32_t input_storage_class = 0; + if (_.addressing_model() == + spv::AddressingModel::PhysicalStorageBuffer64) { + spv::StorageClass input_storage_class; uint32_t input_data_type = 0; _.GetPointerTypeInfo(input_type, &input_data_type, &input_storage_class); - if (input_storage_class != SpvStorageClassPhysicalStorageBuffer) + if (input_storage_class != spv::StorageClass::PhysicalStorageBuffer) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Pointer storage class must be PhysicalStorageBuffer: " << spvOpcodeString(opcode); @@ -286,8 +286,8 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpSatConvertSToU: - case SpvOpSatConvertUToS: { + case spv::Op::OpSatConvertSToU: + case spv::Op::OpSatConvertUToS: { if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected int scalar or vector type as Result Type: " @@ -307,7 +307,7 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpConvertUToPtr: { + case spv::Op::OpConvertUToPtr: { if (!_.IsPointerType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be a pointer: " @@ -318,17 +318,18 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected int scalar as input: " << spvOpcodeString(opcode); - if (_.addressing_model() == SpvAddressingModelLogical) + if (_.addressing_model() == spv::AddressingModel::Logical) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Logical addressing not supported: " << spvOpcodeString(opcode); - if (_.addressing_model() == SpvAddressingModelPhysicalStorageBuffer64) { - uint32_t result_storage_class = 0; + if (_.addressing_model() == + spv::AddressingModel::PhysicalStorageBuffer64) { + spv::StorageClass result_storage_class; uint32_t result_data_type = 0; _.GetPointerTypeInfo(result_type, &result_data_type, &result_storage_class); - if (result_storage_class != SpvStorageClassPhysicalStorageBuffer) + if (result_storage_class != spv::StorageClass::PhysicalStorageBuffer) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Pointer storage class must be PhysicalStorageBuffer: " << spvOpcodeString(opcode); @@ -346,8 +347,8 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpPtrCastToGeneric: { - uint32_t result_storage_class = 0; + case spv::Op::OpPtrCastToGeneric: { + spv::StorageClass result_storage_class; uint32_t result_data_type = 0; if (!_.GetPointerTypeInfo(result_type, &result_data_type, &result_storage_class)) @@ -355,22 +356,22 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { << "Expected Result Type to be a pointer: " << spvOpcodeString(opcode); - if (result_storage_class != SpvStorageClassGeneric) + if (result_storage_class != spv::StorageClass::Generic) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to have storage class Generic: " << spvOpcodeString(opcode); const uint32_t input_type = _.GetOperandTypeId(inst, 2); - uint32_t input_storage_class = 0; + spv::StorageClass input_storage_class; uint32_t input_data_type = 0; if (!_.GetPointerTypeInfo(input_type, &input_data_type, &input_storage_class)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected input to be a pointer: " << spvOpcodeString(opcode); - if (input_storage_class != SpvStorageClassWorkgroup && - input_storage_class != SpvStorageClassCrossWorkgroup && - input_storage_class != SpvStorageClassFunction) + if (input_storage_class != spv::StorageClass::Workgroup && + input_storage_class != spv::StorageClass::CrossWorkgroup && + input_storage_class != spv::StorageClass::Function) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected input to have storage class Workgroup, " << "CrossWorkgroup or Function: " << spvOpcodeString(opcode); @@ -382,8 +383,8 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpGenericCastToPtr: { - uint32_t result_storage_class = 0; + case spv::Op::OpGenericCastToPtr: { + spv::StorageClass result_storage_class; uint32_t result_data_type = 0; if (!_.GetPointerTypeInfo(result_type, &result_data_type, &result_storage_class)) @@ -391,22 +392,22 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { << "Expected Result Type to be a pointer: " << spvOpcodeString(opcode); - if (result_storage_class != SpvStorageClassWorkgroup && - result_storage_class != SpvStorageClassCrossWorkgroup && - result_storage_class != SpvStorageClassFunction) + if (result_storage_class != spv::StorageClass::Workgroup && + result_storage_class != spv::StorageClass::CrossWorkgroup && + result_storage_class != spv::StorageClass::Function) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to have storage class Workgroup, " << "CrossWorkgroup or Function: " << spvOpcodeString(opcode); const uint32_t input_type = _.GetOperandTypeId(inst, 2); - uint32_t input_storage_class = 0; + spv::StorageClass input_storage_class; uint32_t input_data_type = 0; if (!_.GetPointerTypeInfo(input_type, &input_data_type, &input_storage_class)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected input to be a pointer: " << spvOpcodeString(opcode); - if (input_storage_class != SpvStorageClassGeneric) + if (input_storage_class != spv::StorageClass::Generic) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected input to have storage class Generic: " << spvOpcodeString(opcode); @@ -418,8 +419,8 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpGenericCastToPtrExplicit: { - uint32_t result_storage_class = 0; + case spv::Op::OpGenericCastToPtrExplicit: { + spv::StorageClass result_storage_class; uint32_t result_data_type = 0; if (!_.GetPointerTypeInfo(result_type, &result_data_type, &result_storage_class)) @@ -427,21 +428,22 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { << "Expected Result Type to be a pointer: " << spvOpcodeString(opcode); - const uint32_t target_storage_class = inst->word(4); + const auto target_storage_class = + inst->GetOperandAs(3); if (result_storage_class != target_storage_class) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be of target storage class: " << spvOpcodeString(opcode); const uint32_t input_type = _.GetOperandTypeId(inst, 2); - uint32_t input_storage_class = 0; + spv::StorageClass input_storage_class; uint32_t input_data_type = 0; if (!_.GetPointerTypeInfo(input_type, &input_data_type, &input_storage_class)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected input to be a pointer: " << spvOpcodeString(opcode); - if (input_storage_class != SpvStorageClassGeneric) + if (input_storage_class != spv::StorageClass::Generic) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected input to have storage class Generic: " << spvOpcodeString(opcode); @@ -451,16 +453,16 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { << "Expected input and Result Type to point to the same type: " << spvOpcodeString(opcode); - if (target_storage_class != SpvStorageClassWorkgroup && - target_storage_class != SpvStorageClassCrossWorkgroup && - target_storage_class != SpvStorageClassFunction) + if (target_storage_class != spv::StorageClass::Workgroup && + target_storage_class != spv::StorageClass::CrossWorkgroup && + target_storage_class != spv::StorageClass::Function) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected target storage class to be Workgroup, " << "CrossWorkgroup or Function: " << spvOpcodeString(opcode); break; } - case SpvOpBitcast: { + case spv::Op::OpBitcast: { const uint32_t input_type = _.GetOperandTypeId(inst, 2); if (!input_type) return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -471,7 +473,10 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { const bool input_is_pointer = _.IsPointerType(input_type); const bool input_is_int_scalar = _.IsIntScalarType(input_type); - if (!result_is_pointer && !result_is_int_scalar && + const bool result_is_coopmat = _.IsCooperativeMatrixType(result_type); + const bool input_is_coopmat = _.IsCooperativeMatrixType(input_type); + + if (!result_is_pointer && !result_is_int_scalar && !result_is_coopmat && !_.IsIntVectorType(result_type) && !_.IsFloatScalarType(result_type) && !_.IsFloatVectorType(result_type)) @@ -479,21 +484,32 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { << "Expected Result Type to be a pointer or int or float vector " << "or scalar type: " << spvOpcodeString(opcode); - if (!input_is_pointer && !input_is_int_scalar && + if (!input_is_pointer && !input_is_int_scalar && !input_is_coopmat && !_.IsIntVectorType(input_type) && !_.IsFloatScalarType(input_type) && !_.IsFloatVectorType(input_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected input to be a pointer or int or float vector " << "or scalar: " << spvOpcodeString(opcode); + if (result_is_coopmat != input_is_coopmat) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Cooperative matrix can only be cast to another cooperative " + << "matrix: " << spvOpcodeString(opcode); + + if (result_is_coopmat) { + spv_result_t ret = + _.CooperativeMatrixShapesMatch(inst, result_type, input_type); + if (ret != SPV_SUCCESS) return ret; + } + if (_.version() >= SPV_SPIRV_VERSION_WORD(1, 5) || _.HasExtension(kSPV_KHR_physical_storage_buffer)) { const bool result_is_int_vector = _.IsIntVectorType(result_type); const bool result_has_int32 = - _.ContainsSizedIntOrFloatType(result_type, SpvOpTypeInt, 32); + _.ContainsSizedIntOrFloatType(result_type, spv::Op::OpTypeInt, 32); const bool input_is_int_vector = _.IsIntVectorType(input_type); const bool input_has_int32 = - _.ContainsSizedIntOrFloatType(input_type, SpvOpTypeInt, 32); + _.ContainsSizedIntOrFloatType(input_type, spv::Op::OpTypeInt, 32); if (result_is_pointer && !input_is_pointer && !input_is_int_scalar && !(input_is_int_vector && input_has_int32)) return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -534,7 +550,7 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpConvertUToAccelerationStructureKHR: { + case spv::Op::OpConvertUToAccelerationStructureKHR: { if (!_.IsAccelerationStructureType(result_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be a Acceleration Structure: " @@ -556,13 +572,13 @@ spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { break; } - if (_.HasCapability(SpvCapabilityShader)) { + if (_.HasCapability(spv::Capability::Shader)) { switch (inst->opcode()) { - case SpvOpConvertFToU: - case SpvOpConvertFToS: - case SpvOpConvertSToF: - case SpvOpConvertUToF: - case SpvOpBitcast: + case spv::Op::OpConvertFToU: + case spv::Op::OpConvertFToS: + case spv::Op::OpConvertSToF: + case spv::Op::OpConvertUToF: + case spv::Op::OpBitcast: if (_.ContainsLimitedUseIntOrFloatType(inst->type_id()) || _.ContainsLimitedUseIntOrFloatType(_.GetOperandTypeId(inst, 2u))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_debug.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_debug.cpp index 7ab597a1..ef537ea0 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_debug.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_debug.cpp @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/val/validate.h" - -#include "source/opcode.h" #include "source/spirv_target_env.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools { @@ -26,7 +24,7 @@ namespace { spv_result_t ValidateMemberName(ValidationState_t& _, const Instruction* inst) { const auto type_id = inst->GetOperandAs(0); const auto type = _.FindDef(type_id); - if (!type || SpvOpTypeStruct != type->opcode()) { + if (!type || spv::Op::OpTypeStruct != type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpMemberName Type " << _.getIdName(type_id) << " is not a struct type."; @@ -45,7 +43,7 @@ spv_result_t ValidateMemberName(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateLine(ValidationState_t& _, const Instruction* inst) { const auto file_id = inst->GetOperandAs(0); const auto file = _.FindDef(file_id); - if (!file || SpvOpString != file->opcode()) { + if (!file || spv::Op::OpString != file->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpLine Target " << _.getIdName(file_id) << " is not an OpString."; @@ -57,10 +55,10 @@ spv_result_t ValidateLine(ValidationState_t& _, const Instruction* inst) { spv_result_t DebugPass(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { - case SpvOpMemberName: + case spv::Op::OpMemberName: if (auto error = ValidateMemberName(_, inst)) return error; break; - case SpvOpLine: + case spv::Op::OpLine: if (auto error = ValidateLine(_, inst)) return error; break; default: diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_decorations.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_decorations.cpp index 75058501..605b79eb 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_decorations.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_decorations.cpp @@ -21,7 +21,6 @@ #include #include -#include "source/binary.h" #include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_constant.h" @@ -48,13 +47,6 @@ struct PairHash { } }; -// A functor for hashing decoration types. -struct SpvDecorationHash { - std::size_t operator()(SpvDecoration dec) const { - return static_cast(dec); - } -}; - // Struct member layout attributes that are inherited through arrays. struct LayoutConstraints { explicit LayoutConstraints( @@ -72,7 +64,7 @@ using MemberConstraints = std::unordered_map, // Returns the array stride of the given array type. uint32_t GetArrayStride(uint32_t array_id, ValidationState_t& vstate) { for (auto& decoration : vstate.id_decorations(array_id)) { - if (SpvDecorationArrayStride == decoration.dec_type()) { + if (spv::Decoration::ArrayStride == decoration.dec_type()) { return decoration.params()[0]; } } @@ -82,9 +74,10 @@ uint32_t GetArrayStride(uint32_t array_id, ValidationState_t& vstate) { // Returns true if the given variable has a BuiltIn decoration. bool isBuiltInVar(uint32_t var_id, ValidationState_t& vstate) { const auto& decorations = vstate.id_decorations(var_id); - return std::any_of( - decorations.begin(), decorations.end(), - [](const Decoration& d) { return SpvDecorationBuiltIn == d.dec_type(); }); + return std::any_of(decorations.begin(), decorations.end(), + [](const Decoration& d) { + return spv::Decoration::BuiltIn == d.dec_type(); + }); } // Returns true if the given structure type has any members with BuiltIn @@ -93,7 +86,7 @@ bool isBuiltInStruct(uint32_t struct_id, ValidationState_t& vstate) { const auto& decorations = vstate.id_decorations(struct_id); return std::any_of( decorations.begin(), decorations.end(), [](const Decoration& d) { - return SpvDecorationBuiltIn == d.dec_type() && + return spv::Decoration::BuiltIn == d.dec_type() && Decoration::kInvalidMember != d.struct_member_index(); }); } @@ -101,20 +94,21 @@ bool isBuiltInStruct(uint32_t struct_id, ValidationState_t& vstate) { // Returns true if the given structure type has a Block decoration. bool isBlock(uint32_t struct_id, ValidationState_t& vstate) { const auto& decorations = vstate.id_decorations(struct_id); - return std::any_of( - decorations.begin(), decorations.end(), - [](const Decoration& d) { return SpvDecorationBlock == d.dec_type(); }); + return std::any_of(decorations.begin(), decorations.end(), + [](const Decoration& d) { + return spv::Decoration::Block == d.dec_type(); + }); } // Returns true if the given ID has the Import LinkageAttributes decoration. bool hasImportLinkageAttribute(uint32_t id, ValidationState_t& vstate) { const auto& decorations = vstate.id_decorations(id); - return std::any_of(decorations.begin(), decorations.end(), - [](const Decoration& d) { - return SpvDecorationLinkageAttributes == d.dec_type() && - d.params().size() >= 2u && - d.params().back() == SpvLinkageTypeImport; - }); + return std::any_of( + decorations.begin(), decorations.end(), [](const Decoration& d) { + return spv::Decoration::LinkageAttributes == d.dec_type() && + d.params().size() >= 2u && + spv::LinkageType(d.params().back()) == spv::LinkageType::Import; + }); } // Returns a vector of all members of a structure. @@ -125,7 +119,7 @@ std::vector getStructMembers(uint32_t struct_id, } // Returns a vector of all members of a structure that have specific type. -std::vector getStructMembers(uint32_t struct_id, SpvOp type, +std::vector getStructMembers(uint32_t struct_id, spv::Op type, ValidationState_t& vstate) { std::vector members; for (auto id : getStructMembers(struct_id, vstate)) { @@ -142,21 +136,21 @@ bool isMissingOffsetInStruct(uint32_t struct_id, ValidationState_t& vstate) { const auto* inst = vstate.FindDef(struct_id); std::vector hasOffset; std::vector struct_members; - if (inst->opcode() == SpvOpTypeStruct) { + if (inst->opcode() == spv::Op::OpTypeStruct) { // Check offsets of member decorations. struct_members = getStructMembers(struct_id, vstate); hasOffset.resize(struct_members.size(), false); for (auto& decoration : vstate.id_decorations(struct_id)) { - if (SpvDecorationOffset == decoration.dec_type() && + if (spv::Decoration::Offset == decoration.dec_type() && Decoration::kInvalidMember != decoration.struct_member_index()) { // Offset 0xffffffff is not valid so ignore it for simplicity's sake. if (decoration.params()[0] == 0xffffffff) return true; hasOffset[decoration.struct_member_index()] = true; } } - } else if (inst->opcode() == SpvOpTypeArray || - inst->opcode() == SpvOpTypeRuntimeArray) { + } else if (inst->opcode() == spv::Op::OpTypeArray || + inst->opcode() == spv::Op::OpTypeRuntimeArray) { hasOffset.resize(1, true); struct_members.push_back(inst->GetOperandAs(1u)); } @@ -191,18 +185,18 @@ uint32_t getBaseAlignment(uint32_t member_id, bool roundUp, // Minimal alignment is byte-aligned. uint32_t baseAlignment = 1; switch (inst->opcode()) { - case SpvOpTypeSampledImage: - case SpvOpTypeSampler: - case SpvOpTypeImage: - if (vstate.HasCapability(SpvCapabilityBindlessTextureNV)) + case spv::Op::OpTypeSampledImage: + case spv::Op::OpTypeSampler: + case spv::Op::OpTypeImage: + if (vstate.HasCapability(spv::Capability::BindlessTextureNV)) return baseAlignment = vstate.samplerimage_variable_address_mode() / 8; assert(0); return 0; - case SpvOpTypeInt: - case SpvOpTypeFloat: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: baseAlignment = words[2] / 8; break; - case SpvOpTypeVector: { + case spv::Op::OpTypeVector: { const auto componentId = words[2]; const auto numComponents = words[3]; const auto componentAlignment = getBaseAlignment( @@ -211,7 +205,7 @@ uint32_t getBaseAlignment(uint32_t member_id, bool roundUp, componentAlignment * (numComponents == 3 ? 4 : numComponents); break; } - case SpvOpTypeMatrix: { + case spv::Op::OpTypeMatrix: { const auto column_type = words[2]; if (inherited.majorness == kColumnMajor) { baseAlignment = getBaseAlignment(column_type, roundUp, inherited, @@ -229,13 +223,13 @@ uint32_t getBaseAlignment(uint32_t member_id, bool roundUp, } if (roundUp) baseAlignment = align(baseAlignment, 16u); } break; - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: baseAlignment = getBaseAlignment(words[2], roundUp, inherited, constraints, vstate); if (roundUp) baseAlignment = align(baseAlignment, 16u); break; - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { const auto members = getStructMembers(member_id, vstate); for (uint32_t memberIdx = 0, numMembers = uint32_t(members.size()); memberIdx < numMembers; ++memberIdx) { @@ -249,7 +243,7 @@ uint32_t getBaseAlignment(uint32_t member_id, bool roundUp, if (roundUp) baseAlignment = align(baseAlignment, 16u); break; } - case SpvOpTypePointer: + case spv::Op::OpTypePointer: baseAlignment = vstate.pointer_size_and_alignment(); break; default: @@ -265,24 +259,24 @@ uint32_t getScalarAlignment(uint32_t type_id, ValidationState_t& vstate) { const auto inst = vstate.FindDef(type_id); const auto& words = inst->words(); switch (inst->opcode()) { - case SpvOpTypeSampledImage: - case SpvOpTypeSampler: - case SpvOpTypeImage: - if (vstate.HasCapability(SpvCapabilityBindlessTextureNV)) + case spv::Op::OpTypeSampledImage: + case spv::Op::OpTypeSampler: + case spv::Op::OpTypeImage: + if (vstate.HasCapability(spv::Capability::BindlessTextureNV)) return vstate.samplerimage_variable_address_mode() / 8; assert(0); return 0; - case SpvOpTypeInt: - case SpvOpTypeFloat: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: return words[2] / 8; - case SpvOpTypeVector: - case SpvOpTypeMatrix: - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: { + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: { const auto compositeMemberTypeId = words[2]; return getScalarAlignment(compositeMemberTypeId, vstate); } - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { const auto members = getStructMembers(type_id, vstate); uint32_t max_member_alignment = 1; for (uint32_t memberIdx = 0, numMembers = uint32_t(members.size()); @@ -295,7 +289,7 @@ uint32_t getScalarAlignment(uint32_t type_id, ValidationState_t& vstate) { } return max_member_alignment; } break; - case SpvOpTypePointer: + case spv::Op::OpTypePointer: return vstate.pointer_size_and_alignment(); default: assert(0); @@ -312,17 +306,17 @@ uint32_t getSize(uint32_t member_id, const LayoutConstraints& inherited, const auto inst = vstate.FindDef(member_id); const auto& words = inst->words(); switch (inst->opcode()) { - case SpvOpTypeSampledImage: - case SpvOpTypeSampler: - case SpvOpTypeImage: - if (vstate.HasCapability(SpvCapabilityBindlessTextureNV)) + case spv::Op::OpTypeSampledImage: + case spv::Op::OpTypeSampler: + case spv::Op::OpTypeImage: + if (vstate.HasCapability(spv::Capability::BindlessTextureNV)) return vstate.samplerimage_variable_address_mode() / 8; assert(0); return 0; - case SpvOpTypeInt: - case SpvOpTypeFloat: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: return words[2] / 8; - case SpvOpTypeVector: { + case spv::Op::OpTypeVector: { const auto componentId = words[2]; const auto numComponents = words[3]; const auto componentSize = @@ -330,10 +324,10 @@ uint32_t getSize(uint32_t member_id, const LayoutConstraints& inherited, const auto size = componentSize * numComponents; return size; } - case SpvOpTypeArray: { + case spv::Op::OpTypeArray: { const auto sizeInst = vstate.FindDef(words[3]); if (spvOpcodeIsSpecConstant(sizeInst->opcode())) return 0; - assert(SpvOpConstant == sizeInst->opcode()); + assert(spv::Op::OpConstant == sizeInst->opcode()); const uint32_t num_elem = sizeInst->words()[3]; const uint32_t elem_type = words[2]; const uint32_t elem_size = @@ -344,9 +338,9 @@ uint32_t getSize(uint32_t member_id, const LayoutConstraints& inherited, (num_elem - 1) * GetArrayStride(member_id, vstate) + elem_size; return size; } - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeRuntimeArray: return 0; - case SpvOpTypeMatrix: { + case spv::Op::OpTypeMatrix: { const auto num_columns = words[3]; if (inherited.majorness == kColumnMajor) { return num_columns * inherited.matrix_stride; @@ -362,7 +356,7 @@ uint32_t getSize(uint32_t member_id, const LayoutConstraints& inherited, num_columns * scalar_elem_size; } } - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { const auto& members = getStructMembers(member_id, vstate); if (members.empty()) return 0; const auto lastIdx = uint32_t(members.size() - 1); @@ -374,7 +368,7 @@ uint32_t getSize(uint32_t member_id, const LayoutConstraints& inherited, for (auto decoration = member_decorations.begin; decoration != member_decorations.end; ++decoration) { assert(decoration->struct_member_index() == (int)lastIdx); - if (SpvDecorationOffset == decoration->dec_type()) { + if (spv::Decoration::Offset == decoration->dec_type()) { offset = decoration->params()[0]; } } @@ -384,7 +378,7 @@ uint32_t getSize(uint32_t member_id, const LayoutConstraints& inherited, const auto& constraint = constraints[std::make_pair(lastMember, lastIdx)]; return offset + getSize(lastMember, constraint, constraints, vstate); } - case SpvOpTypePointer: + case spv::Op::OpTypePointer: return vstate.pointer_size_and_alignment(); default: assert(0); @@ -458,7 +452,16 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, return ds; }; - const auto& members = getStructMembers(struct_id, vstate); + // If we are checking physical storage buffer pointers, we may not actually + // have a struct here. Instead, pretend we have a struct with a single member + // at offset 0. + const auto& struct_type = vstate.FindDef(struct_id); + std::vector members; + if (struct_type->opcode() == spv::Op::OpTypeStruct) { + members = getStructMembers(struct_id, vstate); + } else { + members.push_back(struct_id); + } // To check for member overlaps, we want to traverse the members in // offset order. @@ -467,31 +470,38 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, uint32_t offset; }; std::vector member_offsets; - member_offsets.reserve(members.size()); - for (uint32_t memberIdx = 0, numMembers = uint32_t(members.size()); - memberIdx < numMembers; memberIdx++) { - uint32_t offset = 0xffffffff; - auto member_decorations = - vstate.id_member_decorations(struct_id, memberIdx); - for (auto decoration = member_decorations.begin; - decoration != member_decorations.end; ++decoration) { - assert(decoration->struct_member_index() == (int)memberIdx); - switch (decoration->dec_type()) { - case SpvDecorationOffset: - offset = decoration->params()[0]; - break; - default: - break; + + // With physical storage buffers, we might be checking layouts that do not + // originate from a structure. + if (struct_type->opcode() == spv::Op::OpTypeStruct) { + member_offsets.reserve(members.size()); + for (uint32_t memberIdx = 0, numMembers = uint32_t(members.size()); + memberIdx < numMembers; memberIdx++) { + uint32_t offset = 0xffffffff; + auto member_decorations = + vstate.id_member_decorations(struct_id, memberIdx); + for (auto decoration = member_decorations.begin; + decoration != member_decorations.end; ++decoration) { + assert(decoration->struct_member_index() == (int)memberIdx); + switch (decoration->dec_type()) { + case spv::Decoration::Offset: + offset = decoration->params()[0]; + break; + default: + break; + } } + member_offsets.push_back( + MemberOffsetPair{memberIdx, incoming_offset + offset}); } - member_offsets.push_back( - MemberOffsetPair{memberIdx, incoming_offset + offset}); + std::stable_sort( + member_offsets.begin(), member_offsets.end(), + [](const MemberOffsetPair& lhs, const MemberOffsetPair& rhs) { + return lhs.offset < rhs.offset; + }); + } else { + member_offsets.push_back({0, 0}); } - std::stable_sort( - member_offsets.begin(), member_offsets.end(), - [](const MemberOffsetPair& lhs, const MemberOffsetPair& rhs) { - return lhs.offset < rhs.offset; - }); // Now scan from lowest offset to highest offset. uint32_t nextValidOffset = 0; @@ -517,7 +527,7 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, if (offset == 0xffffffff) return fail(memberIdx) << "is missing an Offset decoration"; if (!scalar_block_layout && relaxed_block_layout && - opcode == SpvOpTypeVector) { + opcode == spv::Op::OpTypeVector) { // In relaxed block layout, the vector offset must be aligned to the // vector's scalar element type. const auto componentId = inst->words()[2]; @@ -541,21 +551,20 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, << nextValidOffset - 1; if (!scalar_block_layout && relaxed_block_layout) { // Check improper straddle of vectors. - if (SpvOpTypeVector == opcode && + if (spv::Op::OpTypeVector == opcode && hasImproperStraddle(id, offset, constraint, constraints, vstate)) return fail(memberIdx) << "is an improperly straddling vector at offset " << offset; } // Check struct members recursively. spv_result_t recursive_status = SPV_SUCCESS; - if (SpvOpTypeStruct == opcode && + if (spv::Op::OpTypeStruct == opcode && SPV_SUCCESS != (recursive_status = checkLayout( id, storage_class_str, decoration_str, blockRules, - scalar_block_layout, - offset, constraints, vstate))) + scalar_block_layout, offset, constraints, vstate))) return recursive_status; // Check matrix stride. - if (SpvOpTypeMatrix == opcode) { + if (spv::Op::OpTypeMatrix == opcode) { const auto stride = constraint.matrix_stride; if (!IsAlignedTo(stride, alignment)) { return fail(memberIdx) << "is a matrix with stride " << stride @@ -566,14 +575,14 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, // Check arrays and runtime arrays recursively. auto array_inst = inst; auto array_alignment = alignment; - while (array_inst->opcode() == SpvOpTypeArray || - array_inst->opcode() == SpvOpTypeRuntimeArray) { + while (array_inst->opcode() == spv::Op::OpTypeArray || + array_inst->opcode() == spv::Op::OpTypeRuntimeArray) { const auto typeId = array_inst->word(2); const auto element_inst = vstate.FindDef(typeId); // Check array stride. uint32_t array_stride = 0; for (auto& decoration : vstate.id_decorations(array_inst->id())) { - if (SpvDecorationArrayStride == decoration.dec_type()) { + if (spv::Decoration::ArrayStride == decoration.dec_type()) { array_stride = decoration.params()[0]; if (array_stride == 0) { return fail(memberIdx) << "contains an array with stride 0"; @@ -588,7 +597,7 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, bool is_int32 = false; bool is_const = false; uint32_t num_elements = 0; - if (array_inst->opcode() == SpvOpTypeArray) { + if (array_inst->opcode() == spv::Op::OpTypeArray) { std::tie(is_int32, is_const, num_elements) = vstate.EvalInt32IfConst(array_inst->word(3)); } @@ -597,7 +606,7 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, // limitation to this check if the array size is a spec constant or is a // runtime array then we will only check a single element. This means // some improper straddles might be missed. - if (SpvOpTypeStruct == element_inst->opcode()) { + if (spv::Op::OpTypeStruct == element_inst->opcode()) { std::vector seen(16, false); for (uint32_t i = 0; i < num_elements; ++i) { uint32_t next_offset = i * array_stride + offset; @@ -632,10 +641,10 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, } } nextValidOffset = offset + size; - if (!scalar_block_layout && blockRules && - (SpvOpTypeArray == opcode || SpvOpTypeStruct == opcode)) { - // Uniform block rules don't permit anything in the padding of a struct - // or array. + if (!scalar_block_layout && + (spv::Op::OpTypeArray == opcode || spv::Op::OpTypeStruct == opcode)) { + // Non-scalar block layout rules don't permit anything in the padding of + // a struct or array. nextValidOffset = align(nextValidOffset, alignment); } } @@ -644,15 +653,15 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, // Returns true if variable or structure id has given decoration. Handles also // nested structures. -bool hasDecoration(uint32_t id, SpvDecoration decoration, +bool hasDecoration(uint32_t id, spv::Decoration decoration, ValidationState_t& vstate) { for (auto& dec : vstate.id_decorations(id)) { if (decoration == dec.dec_type()) return true; } - if (SpvOpTypeStruct != vstate.FindDef(id)->opcode()) { + if (spv::Op::OpTypeStruct != vstate.FindDef(id)->opcode()) { return false; } - for (auto member_id : getStructMembers(id, SpvOpTypeStruct, vstate)) { + for (auto member_id : getStructMembers(id, spv::Op::OpTypeStruct, vstate)) { if (hasDecoration(member_id, decoration, vstate)) { return true; } @@ -662,8 +671,8 @@ bool hasDecoration(uint32_t id, SpvDecoration decoration, // Returns true if all ids of given type have a specified decoration. bool checkForRequiredDecoration(uint32_t struct_id, - std::function checker, - SpvOp type, ValidationState_t& vstate) { + std::function checker, + spv::Op type, ValidationState_t& vstate) { const auto& members = getStructMembers(struct_id, vstate); for (size_t memberIdx = 0; memberIdx < members.size(); memberIdx++) { const auto id = members[memberIdx]; @@ -682,7 +691,7 @@ bool checkForRequiredDecoration(uint32_t struct_id, return false; } } - for (auto id : getStructMembers(struct_id, SpvOpTypeStruct, vstate)) { + for (auto id : getStructMembers(struct_id, spv::Op::OpTypeStruct, vstate)) { if (!checkForRequiredDecoration(id, checker, type, vstate)) { return false; } @@ -738,8 +747,8 @@ spv_result_t CheckBuiltInVariable(uint32_t var_id, ValidationState_t& vstate) { const auto& decorations = vstate.id_decorations(var_id); for (const auto& d : decorations) { if (spvIsVulkanEnv(vstate.context()->target_env)) { - if (d.dec_type() == SpvDecorationLocation || - d.dec_type() == SpvDecorationComponent) { + if (d.dec_type() == spv::Decoration::Location || + d.dec_type() == spv::Decoration::Component) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) << vstate.VkErrorID(4915) << "A BuiltIn variable (id " << var_id << ") cannot have any Location or Component decorations"; @@ -762,18 +771,18 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { std::unordered_set seen_vars; for (auto interface : desc.interfaces) { Instruction* var_instr = vstate.FindDef(interface); - if (!var_instr || SpvOpVariable != var_instr->opcode()) { + if (!var_instr || spv::Op::OpVariable != var_instr->opcode()) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) << "Interfaces passed to OpEntryPoint must be of type " "OpTypeVariable. Found Op" << spvOpcodeString(var_instr->opcode()) << "."; } - const SpvStorageClass storage_class = - var_instr->GetOperandAs(2); + const spv::StorageClass storage_class = + var_instr->GetOperandAs(2); if (vstate.version() >= SPV_SPIRV_VERSION_WORD(1, 4)) { // Starting in 1.4, OpEntryPoint must list all global variables // it statically uses and those interfaces must be unique. - if (storage_class == SpvStorageClassFunction) { + if (storage_class == spv::StorageClass::Function) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) << "OpEntryPoint interfaces should only list global " "variables"; @@ -785,14 +794,14 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { << vstate.getIdName(interface) << " is disallowed"; } } else { - if (storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { + if (storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) << "OpEntryPoint interfaces must be OpVariables with " "Storage Class of Input(1) or Output(3). Found Storage " "Class " - << storage_class << " for Entry Point id " << entry_point - << "."; + << uint32_t(storage_class) << " for Entry Point id " + << entry_point << "."; } } @@ -803,7 +812,7 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { // to. const uint32_t type_id = ptr_instr->word(3); Instruction* type_instr = vstate.FindDef(type_id); - if (type_instr && SpvOpTypeStruct == type_instr->opcode() && + if (type_instr && spv::Op::OpTypeStruct == type_instr->opcode() && isBuiltInStruct(type_id, vstate)) { if (!isBlock(type_id, vstate)) { return vstate.diag(SPV_ERROR_INVALID_DATA, vstate.FindDef(type_id)) @@ -814,8 +823,9 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { "OpVariable with a structure type that is a block not " "decorated with Location."; } - if (storage_class == SpvStorageClassInput) ++num_builtin_block_inputs; - if (storage_class == SpvStorageClassOutput) + if (storage_class == spv::StorageClass::Input) + ++num_builtin_block_inputs; + if (storage_class == spv::StorageClass::Output) ++num_builtin_block_outputs; if (num_builtin_block_inputs > 1 || num_builtin_block_outputs > 1) break; @@ -826,12 +836,13 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { return error; } - if (storage_class == SpvStorageClassWorkgroup) { + if (storage_class == spv::StorageClass::Workgroup) { ++num_workgroup_variables; - if (type_instr && SpvOpTypeStruct == type_instr->opcode()) { - if (hasDecoration(type_id, SpvDecorationBlock, vstate)) + if (type_instr && spv::Op::OpTypeStruct == type_instr->opcode()) { + if (hasDecoration(type_id, spv::Decoration::Block, vstate)) ++num_workgroup_variables_with_block; - if (hasDecoration(var_instr->id(), SpvDecorationAliased, vstate)) + if (hasDecoration(var_instr->id(), spv::Decoration::Aliased, + vstate)) ++num_workgroup_variables_with_aliased; } } @@ -839,31 +850,32 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { if (spvIsVulkanEnv(vstate.context()->target_env)) { const auto* models = vstate.GetExecutionModels(entry_point); const bool has_frag = - models->find(SpvExecutionModelFragment) != models->end(); + models->find(spv::ExecutionModel::Fragment) != models->end(); const bool has_vert = - models->find(SpvExecutionModelVertex) != models->end(); + models->find(spv::ExecutionModel::Vertex) != models->end(); for (const auto& decoration : vstate.id_decorations(var_instr->id())) { - if (decoration == SpvDecorationFlat || - decoration == SpvDecorationNoPerspective || - decoration == SpvDecorationSample || - decoration == SpvDecorationCentroid) { + if (decoration == spv::Decoration::Flat || + decoration == spv::Decoration::NoPerspective || + decoration == spv::Decoration::Sample || + decoration == spv::Decoration::Centroid) { // VUID 04670 already validates these decorations are input/output - if (storage_class == SpvStorageClassInput && + if (storage_class == spv::StorageClass::Input && (models->size() > 1 || has_vert)) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) << vstate.VkErrorID(6202) - << "OpEntryPoint interfaces variable must not be vertex " - "execution model with an input storage class for " - "Entry Point id " + << vstate.SpvDecorationString(decoration.dec_type()) + << " decorated variable must not be used in vertex " + "execution model as an Input storage class for Entry " + "Point id " << entry_point << "."; - } else if (storage_class == SpvStorageClassOutput && + } else if (storage_class == spv::StorageClass::Output && (models->size() > 1 || has_frag)) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) << vstate.VkErrorID(6201) - << "OpEntryPoint interfaces variable must not be " - "fragment " - "execution model with an output storage class for " + << vstate.SpvDecorationString(decoration.dec_type()) + << " decorated variable must not be used in fragment " + "execution model as an Output storage class for " "Entry Point id " << entry_point << "."; } @@ -871,8 +883,9 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { } const bool has_flat = - hasDecoration(var_instr->id(), SpvDecorationFlat, vstate); - if (has_frag && storage_class == SpvStorageClassInput && !has_flat && + hasDecoration(var_instr->id(), spv::Decoration::Flat, vstate); + if (has_frag && storage_class == spv::StorageClass::Input && + !has_flat && ((vstate.IsFloatScalarType(type_id) && vstate.GetBitWidth(type_id) == 64) || vstate.IsIntScalarOrVectorType(type_id))) { @@ -897,7 +910,7 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { // The LinkageAttributes Decoration cannot be applied to functions // targeted by an OpEntryPoint instruction for (auto& decoration : vstate.id_decorations(entry_point)) { - if (SpvDecorationLinkageAttributes == decoration.dec_type()) { + if (spv::Decoration::LinkageAttributes == decoration.dec_type()) { const std::string linkage_name = spvtools::utils::MakeString(decoration.params()); return vstate.diag(SPV_ERROR_INVALID_BINARY, @@ -909,7 +922,8 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { } } - if (vstate.HasCapability(SpvCapabilityWorkgroupMemoryExplicitLayoutKHR) && + if (vstate.HasCapability( + spv::Capability::WorkgroupMemoryExplicitLayoutKHR) && num_workgroup_variables > 0 && num_workgroup_variables_with_block > 0) { if (num_workgroup_variables != num_workgroup_variables_with_block) { @@ -963,13 +977,13 @@ void ComputeMemberConstraintsForStruct(MemberConstraints* constraints, decoration != member_decorations.end; ++decoration) { assert(decoration->struct_member_index() == (int)memberIdx); switch (decoration->dec_type()) { - case SpvDecorationRowMajor: + case spv::Decoration::RowMajor: constraint.majorness = kRowMajor; break; - case SpvDecorationColMajor: + case spv::Decoration::ColMajor: constraint.majorness = kColumnMajor; break; - case SpvDecorationMatrixStride: + case spv::Decoration::MatrixStride: constraint.matrix_stride = decoration->params()[0]; break; default: @@ -982,12 +996,12 @@ void ComputeMemberConstraintsForStruct(MemberConstraints* constraints, const auto member_type_inst = vstate.FindDef(member_type_id); const auto opcode = member_type_inst->opcode(); switch (opcode) { - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: ComputeMemberConstraintsForArray(constraints, member_type_id, inherited, vstate); break; - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: ComputeMemberConstraintsForStruct(constraints, member_type_id, inherited, vstate); break; @@ -1006,12 +1020,12 @@ void ComputeMemberConstraintsForArray(MemberConstraints* constraints, const auto elem_type_inst = vstate.FindDef(elem_type_id); const auto opcode = elem_type_inst->opcode(); switch (opcode) { - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: ComputeMemberConstraintsForArray(constraints, elem_type_id, inherited, vstate); break; - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: ComputeMemberConstraintsForStruct(constraints, elem_type_id, inherited, vstate); break; @@ -1025,16 +1039,20 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { std::unordered_set uses_push_constant; for (const auto& inst : vstate.ordered_instructions()) { const auto& words = inst.words(); - if (SpvOpVariable == inst.opcode()) { + auto type_id = inst.type_id(); + const Instruction* type_inst = vstate.FindDef(type_id); + if (spv::Op::OpVariable == inst.opcode()) { const auto var_id = inst.id(); // For storage class / decoration combinations, see Vulkan 14.5.4 "Offset // and Stride Assignment". - const auto storageClass = words[3]; - const bool uniform = storageClass == SpvStorageClassUniform; + const auto storageClass = inst.GetOperandAs(2); + const bool uniform = storageClass == spv::StorageClass::Uniform; const bool uniform_constant = - storageClass == SpvStorageClassUniformConstant; - const bool push_constant = storageClass == SpvStorageClassPushConstant; - const bool storage_buffer = storageClass == SpvStorageClassStorageBuffer; + storageClass == spv::StorageClass::UniformConstant; + const bool push_constant = + storageClass == spv::StorageClass::PushConstant; + const bool storage_buffer = + storageClass == spv::StorageClass::StorageBuffer; if (spvIsVulkanEnv(vstate.context()->target_env)) { // Vulkan: There must be no more than one PushConstant block per entry @@ -1058,7 +1076,7 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { if (uniform_constant) { auto entry_points = vstate.EntryPointReferences(var_id); if (!entry_points.empty() && - !hasDecoration(var_id, SpvDecorationDescriptorSet, vstate)) { + !hasDecoration(var_id, spv::Decoration::DescriptorSet, vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) << vstate.VkErrorID(6677) << "UniformConstant id '" << var_id << "' is missing DescriptorSet decoration.\n" @@ -1067,7 +1085,7 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { "decorations specified"; } if (!entry_points.empty() && - !hasDecoration(var_id, SpvDecorationBinding, vstate)) { + !hasDecoration(var_id, spv::Decoration::Binding, vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) << vstate.VkErrorID(6677) << "UniformConstant id '" << var_id << "' is missing Binding decoration.\n" @@ -1079,14 +1097,14 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { } if (spvIsOpenGLEnv(vstate.context()->target_env)) { - bool has_block = hasDecoration(var_id, SpvDecorationBlock, vstate); + bool has_block = hasDecoration(var_id, spv::Decoration::Block, vstate); bool has_buffer_block = - hasDecoration(var_id, SpvDecorationBufferBlock, vstate); + hasDecoration(var_id, spv::Decoration::BufferBlock, vstate); if ((uniform && (has_block || has_buffer_block)) || (storage_buffer && has_block)) { auto entry_points = vstate.EntryPointReferences(var_id); if (!entry_points.empty() && - !hasDecoration(var_id, SpvDecorationBinding, vstate)) { + !hasDecoration(var_id, spv::Decoration::Binding, vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) << (uniform ? "Uniform" : "Storage Buffer") << " id '" << var_id << "' is missing Binding decoration.\n" @@ -1098,24 +1116,25 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { } const bool phys_storage_buffer = - storageClass == SpvStorageClassPhysicalStorageBuffer; + storageClass == spv::StorageClass::PhysicalStorageBuffer; const bool workgroup = - storageClass == SpvStorageClassWorkgroup && - vstate.HasCapability(SpvCapabilityWorkgroupMemoryExplicitLayoutKHR); + storageClass == spv::StorageClass::Workgroup && + vstate.HasCapability( + spv::Capability::WorkgroupMemoryExplicitLayoutKHR); if (uniform || push_constant || storage_buffer || phys_storage_buffer || workgroup) { const auto ptrInst = vstate.FindDef(words[1]); - assert(SpvOpTypePointer == ptrInst->opcode()); + assert(spv::Op::OpTypePointer == ptrInst->opcode()); auto id = ptrInst->words()[3]; auto id_inst = vstate.FindDef(id); // Jump through one level of arraying. - if (!workgroup && (id_inst->opcode() == SpvOpTypeArray || - id_inst->opcode() == SpvOpTypeRuntimeArray)) { + if (!workgroup && (id_inst->opcode() == spv::Op::OpTypeArray || + id_inst->opcode() == spv::Op::OpTypeRuntimeArray)) { id = id_inst->GetOperandAs(1u); id_inst = vstate.FindDef(id); } // Struct requirement is checked on variables so just move on here. - if (SpvOpTypeStruct != id_inst->opcode()) continue; + if (spv::Op::OpTypeStruct != id_inst->opcode()) continue; MemberConstraints constraints; ComputeMemberConstraintsForStruct(&constraints, id, LayoutConstraints(), vstate); @@ -1127,9 +1146,9 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { : "StorageBuffer")); if (spvIsVulkanEnv(vstate.context()->target_env)) { - const bool block = hasDecoration(id, SpvDecorationBlock, vstate); + const bool block = hasDecoration(id, spv::Decoration::Block, vstate); const bool buffer_block = - hasDecoration(id, SpvDecorationBufferBlock, vstate); + hasDecoration(id, spv::Decoration::BufferBlock, vstate); if (storage_buffer && buffer_block) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) << vstate.VkErrorID(6675) << "Storage buffer id '" << var_id @@ -1167,7 +1186,8 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { if (uniform || storage_buffer) { auto entry_points = vstate.EntryPointReferences(var_id); if (!entry_points.empty() && - !hasDecoration(var_id, SpvDecorationDescriptorSet, vstate)) { + !hasDecoration(var_id, spv::Decoration::DescriptorSet, + vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) << vstate.VkErrorID(6677) << sc_str << " id '" << var_id << "' is missing DescriptorSet decoration.\n" @@ -1176,7 +1196,7 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { "decorations specified"; } if (!entry_points.empty() && - !hasDecoration(var_id, SpvDecorationBinding, vstate)) { + !hasDecoration(var_id, spv::Decoration::Binding, vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) << vstate.VkErrorID(6677) << sc_str << " id '" << var_id << "' is missing Binding decoration.\n" @@ -1188,8 +1208,9 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { } for (const auto& dec : vstate.id_decorations(id)) { - const bool blockDeco = SpvDecorationBlock == dec.dec_type(); - const bool bufferDeco = SpvDecorationBufferBlock == dec.dec_type(); + const bool blockDeco = spv::Decoration::Block == dec.dec_type(); + const bool bufferDeco = + spv::Decoration::BufferBlock == dec.dec_type(); const bool blockRules = uniform && blockDeco; const bool bufferRules = (uniform && bufferDeco) || @@ -1217,79 +1238,97 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { << "Structure id " << id << " decorated as " << deco_str << " must be explicitly laid out with Offset " "decorations."; - } else if (hasDecoration(id, SpvDecorationGLSLShared, vstate)) { - return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) - << "Structure id " << id << " decorated as " << deco_str - << " must not use GLSLShared decoration."; - } else if (hasDecoration(id, SpvDecorationGLSLPacked, vstate)) { - return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) - << "Structure id " << id << " decorated as " << deco_str - << " must not use GLSLPacked decoration."; - } else if (!checkForRequiredDecoration( - id, - [](SpvDecoration d) { - return d == SpvDecorationArrayStride; - }, - SpvOpTypeArray, vstate)) { + } + + if (!checkForRequiredDecoration( + id, + [](spv::Decoration d) { + return d == spv::Decoration::ArrayStride; + }, + spv::Op::OpTypeArray, vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) << "Structure id " << id << " decorated as " << deco_str << " must be explicitly laid out with ArrayStride " "decorations."; - } else if (!checkForRequiredDecoration( - id, - [](SpvDecoration d) { - return d == SpvDecorationMatrixStride; - }, - SpvOpTypeMatrix, vstate)) { + } + + if (!checkForRequiredDecoration( + id, + [](spv::Decoration d) { + return d == spv::Decoration::MatrixStride; + }, + spv::Op::OpTypeMatrix, vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) << "Structure id " << id << " decorated as " << deco_str << " must be explicitly laid out with MatrixStride " "decorations."; - } else if (!checkForRequiredDecoration( - id, - [](SpvDecoration d) { - return d == SpvDecorationRowMajor || - d == SpvDecorationColMajor; - }, - SpvOpTypeMatrix, vstate)) { + } + + if (!checkForRequiredDecoration( + id, + [](spv::Decoration d) { + return d == spv::Decoration::RowMajor || + d == spv::Decoration::ColMajor; + }, + spv::Op::OpTypeMatrix, vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) << "Structure id " << id << " decorated as " << deco_str << " must be explicitly laid out with RowMajor or " "ColMajor decorations."; - } else if (blockRules && - (SPV_SUCCESS != - (recursive_status = checkLayout( - id, sc_str, deco_str, true, scalar_block_layout, 0, - constraints, vstate)))) { - return recursive_status; - } else if (bufferRules && - (SPV_SUCCESS != - (recursive_status = checkLayout( - id, sc_str, deco_str, false, scalar_block_layout, - 0, constraints, vstate)))) { - return recursive_status; + } + + if (spvIsVulkanEnv(vstate.context()->target_env)) { + if (blockRules && (SPV_SUCCESS != (recursive_status = checkLayout( + id, sc_str, deco_str, true, + scalar_block_layout, 0, + constraints, vstate)))) { + return recursive_status; + } else if (bufferRules && + (SPV_SUCCESS != + (recursive_status = checkLayout( + id, sc_str, deco_str, false, scalar_block_layout, + 0, constraints, vstate)))) { + return recursive_status; + } } } } } + } else if (type_inst && type_inst->opcode() == spv::Op::OpTypePointer && + type_inst->GetOperandAs(1u) == + spv::StorageClass::PhysicalStorageBuffer) { + const bool scalar_block_layout = vstate.options()->scalar_block_layout; + MemberConstraints constraints; + const bool buffer = true; + const auto data_type_id = type_inst->GetOperandAs(2u); + const auto* data_type_inst = vstate.FindDef(data_type_id); + if (data_type_inst->opcode() == spv::Op::OpTypeStruct) { + ComputeMemberConstraintsForStruct(&constraints, data_type_id, + LayoutConstraints(), vstate); + } + if (auto res = checkLayout(data_type_id, "PhysicalStorageBuffer", "Block", + !buffer, scalar_block_layout, 0, constraints, + vstate)) { + return res; + } } } return SPV_SUCCESS; } // Returns true if |decoration| cannot be applied to the same id more than once. -bool AtMostOncePerId(SpvDecoration decoration) { - return decoration == SpvDecorationArrayStride; +bool AtMostOncePerId(spv::Decoration decoration) { + return decoration == spv::Decoration::ArrayStride; } // Returns true if |decoration| cannot be applied to the same member more than // once. -bool AtMostOncePerMember(SpvDecoration decoration) { +bool AtMostOncePerMember(spv::Decoration decoration) { switch (decoration) { - case SpvDecorationOffset: - case SpvDecorationMatrixStride: - case SpvDecorationRowMajor: - case SpvDecorationColMajor: + case spv::Decoration::Offset: + case spv::Decoration::MatrixStride: + case spv::Decoration::RowMajor: + case spv::Decoration::ColMajor: return true; default: return false; @@ -1297,32 +1336,32 @@ bool AtMostOncePerMember(SpvDecoration decoration) { } spv_result_t CheckDecorationsCompatibility(ValidationState_t& vstate) { - using PerIDKey = std::tuple; - using PerMemberKey = std::tuple; + using PerIDKey = std::tuple; + using PerMemberKey = std::tuple; // An Array of pairs where the decorations in the pair cannot both be applied // to the same id. - static const SpvDecoration mutually_exclusive_per_id[][2] = { - {SpvDecorationBlock, SpvDecorationBufferBlock}, - {SpvDecorationRestrict, SpvDecorationAliased}}; + static const spv::Decoration mutually_exclusive_per_id[][2] = { + {spv::Decoration::Block, spv::Decoration::BufferBlock}, + {spv::Decoration::Restrict, spv::Decoration::Aliased}}; static const auto num_mutually_exclusive_per_id_pairs = - sizeof(mutually_exclusive_per_id) / (2 * sizeof(SpvDecoration)); + sizeof(mutually_exclusive_per_id) / (2 * sizeof(spv::Decoration)); // An Array of pairs where the decorations in the pair cannot both be applied // to the same member. - static const SpvDecoration mutually_exclusive_per_member[][2] = { - {SpvDecorationRowMajor, SpvDecorationColMajor}}; + static const spv::Decoration mutually_exclusive_per_member[][2] = { + {spv::Decoration::RowMajor, spv::Decoration::ColMajor}}; static const auto num_mutually_exclusive_per_mem_pairs = - sizeof(mutually_exclusive_per_member) / (2 * sizeof(SpvDecoration)); + sizeof(mutually_exclusive_per_member) / (2 * sizeof(spv::Decoration)); std::set seen_per_id; std::set seen_per_member; for (const auto& inst : vstate.ordered_instructions()) { const auto& words = inst.words(); - if (SpvOpDecorate == inst.opcode()) { + if (spv::Op::OpDecorate == inst.opcode()) { const auto id = words[1]; - const auto dec_type = static_cast(words[2]); + const auto dec_type = static_cast(words[2]); const auto k = PerIDKey(dec_type, id); const auto already_used = !seen_per_id.insert(k).second; if (already_used && AtMostOncePerId(dec_type)) { @@ -1335,7 +1374,7 @@ spv_result_t CheckDecorationsCompatibility(ValidationState_t& vstate) { // an ID. for (uint32_t pair_idx = 0; pair_idx < num_mutually_exclusive_per_id_pairs; ++pair_idx) { - SpvDecoration excl_dec_type = SpvDecorationMax; + spv::Decoration excl_dec_type = spv::Decoration::Max; if (mutually_exclusive_per_id[pair_idx][0] == dec_type) { excl_dec_type = mutually_exclusive_per_id[pair_idx][1]; } else if (mutually_exclusive_per_id[pair_idx][1] == dec_type) { @@ -1353,10 +1392,10 @@ spv_result_t CheckDecorationsCompatibility(ValidationState_t& vstate) { << " is not allowed."; } } - } else if (SpvOpMemberDecorate == inst.opcode()) { + } else if (spv::Op::OpMemberDecorate == inst.opcode()) { const auto id = words[1]; const auto member_id = words[2]; - const auto dec_type = static_cast(words[3]); + const auto dec_type = static_cast(words[3]); const auto k = PerMemberKey(dec_type, id, member_id); const auto already_used = !seen_per_member.insert(k).second; if (already_used && AtMostOncePerMember(dec_type)) { @@ -1369,7 +1408,7 @@ spv_result_t CheckDecorationsCompatibility(ValidationState_t& vstate) { // a (ID, member) tuple. for (uint32_t pair_idx = 0; pair_idx < num_mutually_exclusive_per_mem_pairs; ++pair_idx) { - SpvDecoration excl_dec_type = SpvDecorationMax; + spv::Decoration excl_dec_type = spv::Decoration::Max; if (mutually_exclusive_per_member[pair_idx][0] == dec_type) { excl_dec_type = mutually_exclusive_per_member[pair_idx][1]; } else if (mutually_exclusive_per_member[pair_idx][1] == dec_type) { @@ -1395,7 +1434,7 @@ spv_result_t CheckDecorationsCompatibility(ValidationState_t& vstate) { spv_result_t CheckVulkanMemoryModelDeprecatedDecorations( ValidationState_t& vstate) { - if (vstate.memory_model() != SpvMemoryModelVulkanKHR) return SPV_SUCCESS; + if (vstate.memory_model() != spv::MemoryModel::VulkanKHR) return SPV_SUCCESS; std::string msg; std::ostringstream str(msg); @@ -1404,10 +1443,10 @@ spv_result_t CheckVulkanMemoryModelDeprecatedDecorations( const auto id = inst->id(); for (const auto& dec : vstate.id_decorations(id)) { const auto member = dec.struct_member_index(); - if (dec.dec_type() == SpvDecorationCoherent || - dec.dec_type() == SpvDecorationVolatile) { - str << (dec.dec_type() == SpvDecorationCoherent ? "Coherent" - : "Volatile"); + if (dec.dec_type() == spv::Decoration::Coherent || + dec.dec_type() == spv::Decoration::Volatile) { + str << (dec.dec_type() == spv::Decoration::Coherent ? "Coherent" + : "Volatile"); str << " decoration targeting " << vstate.getIdName(id); if (member != Decoration::kInvalidMember) { str << " (member index " << member << ")"; @@ -1428,7 +1467,7 @@ spv_result_t CheckFPRoundingModeForShaders(ValidationState_t& vstate, const Decoration& decoration) { // Validates width-only conversion instruction for floating-point object // i.e., OpFConvert - if (inst.opcode() != SpvOpFConvert) { + if (inst.opcode() != spv::Op::OpFConvert) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) << "FPRoundingMode decoration can be applied only to a " "width-only conversion instruction for floating-point " @@ -1436,8 +1475,9 @@ spv_result_t CheckFPRoundingModeForShaders(ValidationState_t& vstate, } if (spvIsVulkanEnv(vstate.context()->target_env)) { - const auto mode = decoration.params()[0]; - if ((mode != SpvFPRoundingModeRTE) && (mode != SpvFPRoundingModeRTZ)) { + const auto mode = spv::FPRoundingMode(decoration.params()[0]); + if ((mode != spv::FPRoundingMode::RTE) && + (mode != spv::FPRoundingMode::RTZ)) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) << vstate.VkErrorID(4675) << "In Vulkan, the FPRoundingMode mode must only by RTE or RTZ."; @@ -1447,11 +1487,11 @@ spv_result_t CheckFPRoundingModeForShaders(ValidationState_t& vstate, // Validates Object operand of an OpStore for (const auto& use : inst.uses()) { const auto store = use.first; - if (store->opcode() == SpvOpFConvert) continue; + if (store->opcode() == spv::Op::OpFConvert) continue; if (spvOpcodeIsDebug(store->opcode())) continue; if (store->IsNonSemantic()) continue; if (spvOpcodeIsDecoration(store->opcode())) continue; - if (store->opcode() != SpvOpStore) { + if (store->opcode() != spv::Op::OpStore) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) << "FPRoundingMode decoration can be applied only to the " "Object operand of an OpStore."; @@ -1477,12 +1517,13 @@ spv_result_t CheckFPRoundingModeForShaders(ValidationState_t& vstate, } // Validates storage class of the pointer to the OpStore - const auto storage = ptr_type->GetOperandAs(1); - if (storage != SpvStorageClassStorageBuffer && - storage != SpvStorageClassUniform && - storage != SpvStorageClassPushConstant && - storage != SpvStorageClassInput && storage != SpvStorageClassOutput && - storage != SpvStorageClassPhysicalStorageBuffer) { + const auto storage = ptr_type->GetOperandAs(1); + if (storage != spv::StorageClass::StorageBuffer && + storage != spv::StorageClass::Uniform && + storage != spv::StorageClass::PushConstant && + storage != spv::StorageClass::Input && + storage != spv::StorageClass::Output && + storage != spv::StorageClass::PhysicalStorageBuffer) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) << "FPRoundingMode decoration can be applied only to the " "Object operand of an OpStore in the StorageBuffer, " @@ -1507,16 +1548,17 @@ spv_result_t CheckNonWritableDecoration(ValidationState_t& vstate, // First, it must be a variable or function parameter. const auto opcode = inst.opcode(); const auto type_id = inst.type_id(); - if (opcode != SpvOpVariable && opcode != SpvOpFunctionParameter) { + if (opcode != spv::Op::OpVariable && + opcode != spv::Op::OpFunctionParameter) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) << "Target of NonWritable decoration must be a memory object " "declaration (a variable or a function parameter)"; } - const auto var_storage_class = opcode == SpvOpVariable - ? inst.GetOperandAs(2) - : SpvStorageClassMax; - if ((var_storage_class == SpvStorageClassFunction || - var_storage_class == SpvStorageClassPrivate) && + const auto var_storage_class = opcode == spv::Op::OpVariable + ? inst.GetOperandAs(2) + : spv::StorageClass::Max; + if ((var_storage_class == spv::StorageClass::Function || + var_storage_class == spv::StorageClass::Private) && vstate.features().nonwritable_var_in_function_or_private) { // New permitted feature in SPIR-V 1.4. } else if ( @@ -1546,8 +1588,9 @@ spv_result_t CheckNonWritableDecoration(ValidationState_t& vstate, spv_result_t CheckUniformDecoration(ValidationState_t& vstate, const Instruction& inst, const Decoration& decoration) { - const char* const dec_name = - decoration.dec_type() == SpvDecorationUniform ? "Uniform" : "UniformId"; + const char* const dec_name = decoration.dec_type() == spv::Decoration::Uniform + ? "Uniform" + : "UniformId"; // Uniform or UniformId must decorate an "object" // - has a result ID @@ -1561,7 +1604,7 @@ spv_result_t CheckUniformDecoration(ValidationState_t& vstate, << dec_name << " decoration applied to a non-object"; } if (Instruction* type_inst = vstate.FindDef(inst.type_id())) { - if (type_inst->opcode() == SpvOpTypeVoid) { + if (type_inst->opcode() == spv::Op::OpTypeVoid) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) << dec_name << " decoration applied to a value with void type"; } @@ -1575,7 +1618,7 @@ spv_result_t CheckUniformDecoration(ValidationState_t& vstate, // Use of Uniform with OpDecorate is checked elsewhere. // Use of UniformId with OpDecorateId is checked elsewhere. - if (decoration.dec_type() == SpvDecorationUniformId) { + if (decoration.dec_type() == spv::Decoration::UniformId) { assert(decoration.params().size() == 1 && "Grammar ensures UniformId has one parameter"); @@ -1596,13 +1639,13 @@ spv_result_t CheckIntegerWrapDecoration(ValidationState_t& vstate, const Instruction& inst, const Decoration& decoration) { switch (inst.opcode()) { - case SpvOpIAdd: - case SpvOpISub: - case SpvOpIMul: - case SpvOpShiftLeftLogical: - case SpvOpSNegate: + case spv::Op::OpIAdd: + case spv::Op::OpISub: + case spv::Op::OpIMul: + case spv::Op::OpShiftLeftLogical: + case spv::Op::OpSNegate: return SPV_SUCCESS; - case SpvOpExtInst: + case spv::Op::OpExtInst: // TODO(dneto): Only certain extended instructions allow these // decorations. For now allow anything. return SPV_SUCCESS; @@ -1611,7 +1654,7 @@ spv_result_t CheckIntegerWrapDecoration(ValidationState_t& vstate, } return vstate.diag(SPV_ERROR_INVALID_ID, &inst) - << (decoration.dec_type() == SpvDecorationNoSignedWrap + << (decoration.dec_type() == spv::Decoration::NoSignedWrap ? "NoSignedWrap" : "NoUnsignedWrap") << " decoration may not be applied to " @@ -1625,29 +1668,32 @@ spv_result_t CheckComponentDecoration(ValidationState_t& vstate, const Instruction& inst, const Decoration& decoration) { assert(inst.id() && "Parser ensures the target of the decoration has an ID"); + assert(decoration.params().size() == 1 && + "Grammar ensures Component has one parameter"); uint32_t type_id; if (decoration.struct_member_index() == Decoration::kInvalidMember) { // The target must be a memory object declaration. const auto opcode = inst.opcode(); - if (opcode != SpvOpVariable && opcode != SpvOpFunctionParameter) { + if (opcode != spv::Op::OpVariable && + opcode != spv::Op::OpFunctionParameter) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) << "Target of Component decoration must be a memory object " "declaration (a variable or a function parameter)"; } // Only valid for the Input and Output Storage Classes. - const auto storage_class = opcode == SpvOpVariable - ? inst.GetOperandAs(2) - : SpvStorageClassMax; - if (storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput && - storage_class != SpvStorageClassMax) { + const auto storage_class = opcode == spv::Op::OpVariable + ? inst.GetOperandAs(2) + : spv::StorageClass::Max; + if (storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output && + storage_class != spv::StorageClass::Max) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) << "Target of Component decoration is invalid: must point to a " "Storage Class of Input(1) or Output(3). Found Storage " "Class " - << storage_class; + << uint32_t(storage_class); } type_id = inst.type_id(); @@ -1656,7 +1702,7 @@ spv_result_t CheckComponentDecoration(ValidationState_t& vstate, type_id = pointer->GetOperandAs(2); } } else { - if (inst.opcode() != SpvOpTypeStruct) { + if (inst.opcode() != spv::Op::OpTypeStruct) { return vstate.diag(SPV_ERROR_INVALID_DATA, &inst) << "Attempted to get underlying data type via member index for " "non-struct type."; @@ -1666,30 +1712,56 @@ spv_result_t CheckComponentDecoration(ValidationState_t& vstate, if (spvIsVulkanEnv(vstate.context()->target_env)) { // Strip the array, if present. - if (vstate.GetIdOpcode(type_id) == SpvOpTypeArray) { + if (vstate.GetIdOpcode(type_id) == spv::Op::OpTypeArray) { type_id = vstate.FindDef(type_id)->word(2u); } if (!vstate.IsIntScalarOrVectorType(type_id) && !vstate.IsFloatScalarOrVectorType(type_id)) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << vstate.VkErrorID(4924) << "Component decoration specified for type " << vstate.getIdName(type_id) << " that is not a scalar or vector"; } - // For 16-, and 32-bit types, it is invalid if this sequence of components - // gets larger than 3. + const auto component = decoration.params()[0]; + if (component > 3) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << vstate.VkErrorID(4920) + << "Component decoration value must not be greater than 3"; + } + + const auto dimension = vstate.GetDimension(type_id); const auto bit_width = vstate.GetBitWidth(type_id); if (bit_width == 16 || bit_width == 32) { - assert(decoration.params().size() == 1 && - "Grammar ensures Component has one parameter"); - - const auto component = decoration.params()[0]; - const auto last_component = component + vstate.GetDimension(type_id) - 1; - if (last_component > 3) { + const auto sum_component = component + dimension; + if (sum_component > 4) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << vstate.VkErrorID(4921) + << "Sequence of components starting with " << component + << " and ending with " << (sum_component - 1) + << " gets larger than 3"; + } + } else if (bit_width == 64) { + if (dimension > 2) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << vstate.VkErrorID(7703) + << "Component decoration only allowed on 64-bit scalar and " + "2-component vector"; + } + if (component == 1 || component == 3) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << vstate.VkErrorID(4923) + << "Component decoration value must not be 1 or 3 for 64-bit " + "data types"; + } + // 64-bit is double per component dimension + const auto sum_component = component + (2 * dimension); + if (sum_component > 4) { return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << vstate.VkErrorID(4922) << "Sequence of components starting with " << component - << " and ending with " << last_component + << " and ending with " << (sum_component - 1) << " gets larger than 3"; } } @@ -1705,9 +1777,10 @@ spv_result_t CheckBlockDecoration(ValidationState_t& vstate, const Instruction& inst, const Decoration& decoration) { assert(inst.id() && "Parser ensures the target of the decoration has an ID"); - if (inst.opcode() != SpvOpTypeStruct) { - const char* const dec_name = - decoration.dec_type() == SpvDecorationBlock ? "Block" : "BufferBlock"; + if (inst.opcode() != spv::Op::OpTypeStruct) { + const char* const dec_name = decoration.dec_type() == spv::Decoration::Block + ? "Block" + : "BufferBlock"; return vstate.diag(SPV_ERROR_INVALID_ID, &inst) << dec_name << " decoration on a non-struct type."; } @@ -1717,10 +1790,10 @@ spv_result_t CheckBlockDecoration(ValidationState_t& vstate, spv_result_t CheckLocationDecoration(ValidationState_t& vstate, const Instruction& inst, const Decoration& decoration) { - if (inst.opcode() == SpvOpVariable) return SPV_SUCCESS; + if (inst.opcode() == spv::Op::OpVariable) return SPV_SUCCESS; if (decoration.struct_member_index() != Decoration::kInvalidMember && - inst.opcode() == SpvOpTypeStruct) { + inst.opcode() == spv::Op::OpTypeStruct) { return SPV_SUCCESS; } @@ -1740,7 +1813,7 @@ spv_result_t CheckRelaxPrecisionDecoration(ValidationState_t& vstate, } if (decoration.struct_member_index() != Decoration::kInvalidMember && - inst.opcode() == SpvOpTypeStruct) { + inst.opcode() == spv::Op::OpTypeStruct) { return SPV_SUCCESS; } return vstate.diag(SPV_ERROR_INVALID_ID, &inst) @@ -1759,7 +1832,7 @@ spv_result_t CheckRelaxPrecisionDecoration(ValidationState_t& vstate, // propagated down to the group members. spv_result_t CheckDecorationsFromDecoration(ValidationState_t& vstate) { // Some rules are only checked for shaders. - const bool is_shader = vstate.HasCapability(SpvCapabilityShader); + const bool is_shader = vstate.HasCapability(spv::Capability::Shader); for (const auto& kv : vstate.id_decorations()) { const uint32_t id = kv.first; @@ -1771,37 +1844,37 @@ spv_result_t CheckDecorationsFromDecoration(ValidationState_t& vstate) { // We assume the decorations applied to a decoration group have already // been propagated down to the group members. - if (inst->opcode() == SpvOpDecorationGroup) continue; + if (inst->opcode() == spv::Op::OpDecorationGroup) continue; for (const auto& decoration : decorations) { switch (decoration.dec_type()) { - case SpvDecorationComponent: + case spv::Decoration::Component: PASS_OR_BAIL(CheckComponentDecoration(vstate, *inst, decoration)); break; - case SpvDecorationFPRoundingMode: + case spv::Decoration::FPRoundingMode: if (is_shader) PASS_OR_BAIL( CheckFPRoundingModeForShaders(vstate, *inst, decoration)); break; - case SpvDecorationNonWritable: + case spv::Decoration::NonWritable: PASS_OR_BAIL(CheckNonWritableDecoration(vstate, *inst, decoration)); break; - case SpvDecorationUniform: - case SpvDecorationUniformId: + case spv::Decoration::Uniform: + case spv::Decoration::UniformId: PASS_OR_BAIL(CheckUniformDecoration(vstate, *inst, decoration)); break; - case SpvDecorationNoSignedWrap: - case SpvDecorationNoUnsignedWrap: + case spv::Decoration::NoSignedWrap: + case spv::Decoration::NoUnsignedWrap: PASS_OR_BAIL(CheckIntegerWrapDecoration(vstate, *inst, decoration)); break; - case SpvDecorationBlock: - case SpvDecorationBufferBlock: + case spv::Decoration::Block: + case spv::Decoration::BufferBlock: PASS_OR_BAIL(CheckBlockDecoration(vstate, *inst, decoration)); break; - case SpvDecorationLocation: + case spv::Decoration::Location: PASS_OR_BAIL(CheckLocationDecoration(vstate, *inst, decoration)); break; - case SpvDecorationRelaxedPrecision: + case spv::Decoration::RelaxedPrecision: PASS_OR_BAIL( CheckRelaxPrecisionDecoration(vstate, *inst, decoration)); break; diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_derivatives.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_derivatives.cpp index 25b941ab..90cf6645 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_derivatives.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_derivatives.cpp @@ -14,13 +14,11 @@ // Validates correctness of derivative SPIR-V instructions. -#include "source/val/validate.h" - #include -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools { @@ -28,25 +26,26 @@ namespace val { // Validates correctness of derivative instructions. spv_result_t DerivativesPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); const uint32_t result_type = inst->type_id(); switch (opcode) { - case SpvOpDPdx: - case SpvOpDPdy: - case SpvOpFwidth: - case SpvOpDPdxFine: - case SpvOpDPdyFine: - case SpvOpFwidthFine: - case SpvOpDPdxCoarse: - case SpvOpDPdyCoarse: - case SpvOpFwidthCoarse: { + case spv::Op::OpDPdx: + case spv::Op::OpDPdy: + case spv::Op::OpFwidth: + case spv::Op::OpDPdxFine: + case spv::Op::OpDPdyFine: + case spv::Op::OpFwidthFine: + case spv::Op::OpDPdxCoarse: + case spv::Op::OpDPdyCoarse: + case spv::Op::OpFwidthCoarse: { if (!_.IsFloatScalarOrVectorType(result_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be float scalar or vector type: " << spvOpcodeString(opcode); } - if (!_.ContainsSizedIntOrFloatType(result_type, SpvOpTypeFloat, 32)) { + if (!_.ContainsSizedIntOrFloatType(result_type, spv::Op::OpTypeFloat, + 32)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Result type component width must be 32 bits"; } @@ -58,10 +57,10 @@ spv_result_t DerivativesPass(ValidationState_t& _, const Instruction* inst) { << spvOpcodeString(opcode); } _.function(inst->function()->id()) - ->RegisterExecutionModelLimitation([opcode](SpvExecutionModel model, + ->RegisterExecutionModelLimitation([opcode](spv::ExecutionModel model, std::string* message) { - if (model != SpvExecutionModelFragment && - model != SpvExecutionModelGLCompute) { + if (model != spv::ExecutionModel::Fragment && + model != spv::ExecutionModel::GLCompute) { if (message) { *message = std::string( @@ -80,11 +79,11 @@ spv_result_t DerivativesPass(ValidationState_t& _, const Instruction* inst) { const auto* models = state.GetExecutionModels(entry_point->id()); const auto* modes = state.GetExecutionModes(entry_point->id()); if (models && - models->find(SpvExecutionModelGLCompute) != models->end() && + models->find(spv::ExecutionModel::GLCompute) != models->end() && (!modes || - (modes->find(SpvExecutionModeDerivativeGroupLinearNV) == + (modes->find(spv::ExecutionMode::DerivativeGroupLinearNV) == modes->end() && - modes->find(SpvExecutionModeDerivativeGroupQuadsNV) == + modes->find(spv::ExecutionMode::DerivativeGroupQuadsNV) == modes->end()))) { if (message) { *message = std::string( diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_execution_limitations.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_execution_limitations.cpp index e1f4d7b0..0221d7ef 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_execution_limitations.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_execution_limitations.cpp @@ -13,8 +13,6 @@ // limitations under the License. #include "source/val/validate.h" - -#include "source/val/function.h" #include "source/val/validation_state.h" namespace spvtools { @@ -22,7 +20,7 @@ namespace val { spv_result_t ValidateExecutionLimitations(ValidationState_t& _, const Instruction* inst) { - if (inst->opcode() != SpvOpFunction) { + if (inst->opcode() != spv::Op::OpFunction) { return SPV_SUCCESS; } diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_extensions.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_extensions.cpp index 1e69cb37..0ac62bfc 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_extensions.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_extensions.cpp @@ -18,31 +18,41 @@ #include #include -#include "spirv/unified1/NonSemanticClspvReflection.h" - #include "NonSemanticShaderDebugInfo100.h" #include "OpenCLDebugInfo100.h" #include "source/common_debug_info.h" -#include "source/diagnostic.h" #include "source/enum_string_mapping.h" #include "source/extensions.h" #include "source/latest_version_glsl_std_450_header.h" #include "source/latest_version_opencl_std_header.h" -#include "source/opcode.h" #include "source/spirv_constant.h" -#include "source/spirv_target_env.h" #include "source/val/instruction.h" #include "source/val/validate.h" #include "source/val/validation_state.h" +#include "spirv/unified1/NonSemanticClspvReflection.h" namespace spvtools { namespace val { namespace { +std::string ReflectionInstructionName(ValidationState_t& _, + const Instruction* inst) { + spv_ext_inst_desc desc = nullptr; + if (_.grammar().lookupExtInst(SPV_EXT_INST_TYPE_NONSEMANTIC_CLSPVREFLECTION, + inst->word(4), &desc) != SPV_SUCCESS || + !desc) { + return std::string("Unknown ExtInst"); + } + std::ostringstream ss; + ss << desc->name; + + return ss.str(); +} + uint32_t GetSizeTBitWidth(const ValidationState_t& _) { - if (_.addressing_model() == SpvAddressingModelPhysical32) return 32; + if (_.addressing_model() == spv::AddressingModel::Physical32) return 32; - if (_.addressing_model() == SpvAddressingModelPhysical64) return 64; + if (_.addressing_model() == spv::AddressingModel::Physical64) return 64; return 0; } @@ -50,7 +60,7 @@ uint32_t GetSizeTBitWidth(const ValidationState_t& _) { bool IsIntScalar(ValidationState_t& _, uint32_t id, bool must_len32, bool must_unsigned) { auto type = _.FindDef(id); - if (!type || type->opcode() != SpvOpTypeInt) { + if (!type || type->opcode() != spv::Op::OpTypeInt) { return false; } @@ -63,7 +73,7 @@ bool IsIntScalar(ValidationState_t& _, uint32_t id, bool must_len32, bool IsUint32Constant(ValidationState_t& _, uint32_t id) { auto inst = _.FindDef(id); - if (!inst || inst->opcode() != SpvOpConstant) { + if (!inst || inst->opcode() != spv::Op::OpConstant) { return false; } @@ -79,7 +89,7 @@ uint32_t GetUint32Constant(ValidationState_t& _, uint32_t id) { // is a result id of an instruction with |expected_opcode|. spv_result_t ValidateOperandForDebugInfo( ValidationState_t& _, const std::string& operand_name, - SpvOp expected_opcode, const Instruction* inst, uint32_t word_index, + spv::Op expected_opcode, const Instruction* inst, uint32_t word_index, const std::function& ext_inst_name) { auto* operand = _.FindDef(inst->word(word_index)); if (operand->opcode() != expected_opcode) { @@ -137,7 +147,7 @@ bool DoesDebugInfoOperandMatchExpectation( const Instruction* inst, uint32_t word_index) { if (inst->words().size() <= word_index) return false; auto* debug_inst = _.FindDef(inst->word(word_index)); - if (debug_inst->opcode() != SpvOpExtInst || + if (debug_inst->opcode() != spv::Op::OpExtInst || (debug_inst->ext_inst_type() != SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100 && debug_inst->ext_inst_type() != SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100) || @@ -155,7 +165,7 @@ bool DoesDebugInfoOperandMatchExpectation( const Instruction* inst, uint32_t word_index) { if (inst->words().size() <= word_index) return false; auto* debug_inst = _.FindDef(inst->word(word_index)); - if (debug_inst->opcode() != SpvOpExtInst || + if (debug_inst->opcode() != spv::Op::OpExtInst || (debug_inst->ext_inst_type() != SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100) || !expectation( @@ -273,12 +283,14 @@ spv_result_t ValidateOperandDebugType( } spv_result_t ValidateClspvReflectionKernel(ValidationState_t& _, - const Instruction* inst) { + const Instruction* inst, + uint32_t version) { + const auto inst_name = ReflectionInstructionName(_, inst); const auto kernel_id = inst->GetOperandAs(4); const auto kernel = _.FindDef(kernel_id); - if (kernel->opcode() != SpvOpFunction) { + if (kernel->opcode() != spv::Op::OpFunction) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Kernel does not reference a function"; + << inst_name << " does not reference a function"; } bool found_kernel = false; @@ -290,23 +302,23 @@ spv_result_t ValidateClspvReflectionKernel(ValidationState_t& _, } if (!found_kernel) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Kernel does not reference an entry-point"; + << inst_name << " does not reference an entry-point"; } const auto* exec_models = _.GetExecutionModels(kernel_id); if (!exec_models || exec_models->empty()) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Kernel does not reference an entry-point"; + << inst_name << " does not reference an entry-point"; } for (auto exec_model : *exec_models) { - if (exec_model != SpvExecutionModelGLCompute) { + if (exec_model != spv::ExecutionModel::GLCompute) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "Kernel must refer only to GLCompute entry-points"; + << inst_name << " must refer only to GLCompute entry-points"; } } auto name = _.FindDef(inst->GetOperandAs(5)); - if (!name || name->opcode() != SpvOpString) { + if (!name || name->opcode() != spv::Op::OpString) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Name must be an OpString"; } @@ -323,17 +335,48 @@ spv_result_t ValidateClspvReflectionKernel(ValidationState_t& _, << "Name must match an entry-point for Kernel"; } + const auto num_operands = inst->operands().size(); + if (version < 5 && num_operands > 6) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Version " << version << " of the " << inst_name + << " instruction can only have 2 additional operands"; + } + + if (num_operands > 6) { + const auto num_args_id = inst->GetOperandAs(6); + if (!IsUint32Constant(_, num_args_id)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "NumArguments must be a 32-bit unsigned integer OpConstant"; + } + } + + if (num_operands > 7) { + const auto flags_id = inst->GetOperandAs(7); + if (!IsUint32Constant(_, flags_id)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Flags must be a 32-bit unsigned integer OpConstant"; + } + } + + if (num_operands > 8) { + const auto atts_id = inst->GetOperandAs(8); + if (_.GetIdOpcode(atts_id) != spv::Op::OpString) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Attributes must be an OpString"; + } + } + return SPV_SUCCESS; } spv_result_t ValidateClspvReflectionArgumentInfo(ValidationState_t& _, const Instruction* inst) { const auto num_operands = inst->operands().size(); - if (_.GetIdOpcode(inst->GetOperandAs(4)) != SpvOpString) { + if (_.GetIdOpcode(inst->GetOperandAs(4)) != spv::Op::OpString) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Name must be an OpString"; } if (num_operands > 5) { - if (_.GetIdOpcode(inst->GetOperandAs(5)) != SpvOpString) { + if (_.GetIdOpcode(inst->GetOperandAs(5)) != spv::Op::OpString) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "TypeName must be an OpString"; } @@ -366,7 +409,7 @@ spv_result_t ValidateClspvReflectionArgumentInfo(ValidationState_t& _, spv_result_t ValidateKernelDecl(ValidationState_t& _, const Instruction* inst) { const auto decl_id = inst->GetOperandAs(4); const auto decl = _.FindDef(decl_id); - if (!decl || decl->opcode() != SpvOpExtInst) { + if (!decl || decl->opcode() != spv::Op::OpExtInst) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Kernel must be a Kernel extended instruction"; } @@ -389,7 +432,7 @@ spv_result_t ValidateKernelDecl(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateArgInfo(ValidationState_t& _, const Instruction* inst, uint32_t info_index) { auto info = _.FindDef(inst->GetOperandAs(info_index)); - if (!info || info->opcode() != SpvOpExtInst) { + if (!info || info->opcode() != spv::Op::OpExtInst) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "ArgInfo must be an ArgumentInfo extended instruction"; } @@ -439,8 +482,8 @@ spv_result_t ValidateClspvReflectionArgumentBuffer(ValidationState_t& _, return SPV_SUCCESS; } -spv_result_t ValidateClspvReflectionArgumentPodBuffer(ValidationState_t& _, - const Instruction* inst) { +spv_result_t ValidateClspvReflectionArgumentOffsetBuffer(ValidationState_t& _, + const Instruction* inst) { const auto num_operands = inst->operands().size(); if (auto error = ValidateKernelDecl(_, inst)) { return error; @@ -480,7 +523,7 @@ spv_result_t ValidateClspvReflectionArgumentPodBuffer(ValidationState_t& _, return SPV_SUCCESS; } -spv_result_t ValidateClspvReflectionArgumentPodPushConstant( +spv_result_t ValidateClspvReflectionArgumentPushConstant( ValidationState_t& _, const Instruction* inst) { const auto num_operands = inst->operands().size(); if (auto error = ValidateKernelDecl(_, inst)) { @@ -587,8 +630,8 @@ spv_result_t ValidateClspvReflectionPushConstant(ValidationState_t& _, return SPV_SUCCESS; } -spv_result_t ValidateClspvReflectionConstantData(ValidationState_t& _, - const Instruction* inst) { +spv_result_t ValidateClspvReflectionInitializedData(ValidationState_t& _, + const Instruction* inst) { if (!IsUint32Constant(_, inst->GetOperandAs(4))) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "DescriptorSet must be a 32-bit unsigned integer OpConstant"; @@ -599,7 +642,7 @@ spv_result_t ValidateClspvReflectionConstantData(ValidationState_t& _, << "Binding must be a 32-bit unsigned integer OpConstant"; } - if (_.GetIdOpcode(inst->GetOperandAs(6)) != SpvOpString) { + if (_.GetIdOpcode(inst->GetOperandAs(6)) != spv::Op::OpString) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Data must be an OpString"; } @@ -650,18 +693,250 @@ spv_result_t ValidateClspvReflectionPropertyRequiredWorkgroupSize( return SPV_SUCCESS; } +spv_result_t ValidateClspvReflectionSubgroupMaxSize(ValidationState_t& _, + const Instruction* inst) { + const auto size_id = inst->GetOperandAs(4); + if (!IsUint32Constant(_, size_id)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Size must be a 32-bit unsigned integer OpConstant"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateClspvReflectionPointerRelocation(ValidationState_t& _, + const Instruction* inst) { + if (!IsUint32Constant(_, inst->GetOperandAs(4))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "ObjectOffset must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(5))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "PointerOffset must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(6))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "PointerSize must be a 32-bit unsigned integer OpConstant"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateClspvReflectionImageMetadataPushConstant( + ValidationState_t& _, const Instruction* inst) { + if (auto error = ValidateKernelDecl(_, inst)) { + return error; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(5))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Ordinal must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(6))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Offset must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(7))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Size must be a 32-bit unsigned integer OpConstant"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateClspvReflectionImageMetadataUniform( + ValidationState_t& _, const Instruction* inst) { + if (auto error = ValidateKernelDecl(_, inst)) { + return error; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(5))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Ordinal must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(6))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "DescriptorSet must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(7))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Binding must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(8))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Offset must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(9))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Size must be a 32-bit unsigned integer OpConstant"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateClspvReflectionPushConstantData(ValidationState_t& _, + const Instruction* inst) { + if (!IsUint32Constant(_, inst->GetOperandAs(4))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Offset must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(5))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Size must be a 32-bit unsigned integer OpConstant"; + } + + if (_.GetIdOpcode(inst->GetOperandAs(6)) != spv::Op::OpString) { + return _.diag(SPV_ERROR_INVALID_ID, inst) << "Data must be an OpString"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateClspvReflectionPrintfInfo(ValidationState_t& _, + const Instruction* inst) { + if (!IsUint32Constant(_, inst->GetOperandAs(4))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "PrintfID must be a 32-bit unsigned integer OpConstant"; + } + + if (_.GetIdOpcode(inst->GetOperandAs(5)) != spv::Op::OpString) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "FormatString must be an OpString"; + } + + for (size_t i = 6; i < inst->operands().size(); ++i) { + if (!IsUint32Constant(_, inst->GetOperandAs(i))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "ArgumentSizes must be a 32-bit unsigned integer OpConstant"; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateClspvReflectionPrintfStorageBuffer(ValidationState_t& _, + const Instruction* inst) { + if (!IsUint32Constant(_, inst->GetOperandAs(4))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "DescriptorSet must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(5))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Binding must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(6))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Size must be a 32-bit unsigned integer OpConstant"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateClspvReflectionPrintfPushConstant(ValidationState_t& _, + const Instruction* inst) { + if (!IsUint32Constant(_, inst->GetOperandAs(4))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Offset must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(5))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Size must be a 32-bit unsigned integer OpConstant"; + } + + if (!IsUint32Constant(_, inst->GetOperandAs(6))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "BufferSize must be a 32-bit unsigned integer OpConstant"; + } + + return SPV_SUCCESS; +} + spv_result_t ValidateClspvReflectionInstruction(ValidationState_t& _, const Instruction* inst, - uint32_t /*version*/) { + uint32_t version) { if (!_.IsVoidType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Return Type must be OpTypeVoid"; } - auto ext_inst = inst->GetOperandAs(3); + uint32_t required_version = 0; + const auto ext_inst = + inst->GetOperandAs(3); + switch (ext_inst) { + case NonSemanticClspvReflectionKernel: + case NonSemanticClspvReflectionArgumentInfo: + case NonSemanticClspvReflectionArgumentStorageBuffer: + case NonSemanticClspvReflectionArgumentUniform: + case NonSemanticClspvReflectionArgumentPodStorageBuffer: + case NonSemanticClspvReflectionArgumentPodUniform: + case NonSemanticClspvReflectionArgumentPodPushConstant: + case NonSemanticClspvReflectionArgumentSampledImage: + case NonSemanticClspvReflectionArgumentStorageImage: + case NonSemanticClspvReflectionArgumentSampler: + case NonSemanticClspvReflectionArgumentWorkgroup: + case NonSemanticClspvReflectionSpecConstantWorkgroupSize: + case NonSemanticClspvReflectionSpecConstantGlobalOffset: + case NonSemanticClspvReflectionSpecConstantWorkDim: + case NonSemanticClspvReflectionPushConstantGlobalOffset: + case NonSemanticClspvReflectionPushConstantEnqueuedLocalSize: + case NonSemanticClspvReflectionPushConstantGlobalSize: + case NonSemanticClspvReflectionPushConstantRegionOffset: + case NonSemanticClspvReflectionPushConstantNumWorkgroups: + case NonSemanticClspvReflectionPushConstantRegionGroupOffset: + case NonSemanticClspvReflectionConstantDataStorageBuffer: + case NonSemanticClspvReflectionConstantDataUniform: + case NonSemanticClspvReflectionLiteralSampler: + case NonSemanticClspvReflectionPropertyRequiredWorkgroupSize: + required_version = 1; + break; + case NonSemanticClspvReflectionSpecConstantSubgroupMaxSize: + required_version = 2; + break; + case NonSemanticClspvReflectionArgumentPointerPushConstant: + case NonSemanticClspvReflectionArgumentPointerUniform: + case NonSemanticClspvReflectionProgramScopeVariablesStorageBuffer: + case NonSemanticClspvReflectionProgramScopeVariablePointerRelocation: + case NonSemanticClspvReflectionImageArgumentInfoChannelOrderPushConstant: + case NonSemanticClspvReflectionImageArgumentInfoChannelDataTypePushConstant: + case NonSemanticClspvReflectionImageArgumentInfoChannelOrderUniform: + case NonSemanticClspvReflectionImageArgumentInfoChannelDataTypeUniform: + required_version = 3; + break; + case NonSemanticClspvReflectionArgumentStorageTexelBuffer: + case NonSemanticClspvReflectionArgumentUniformTexelBuffer: + required_version = 4; + break; + case NonSemanticClspvReflectionConstantDataPointerPushConstant: + case NonSemanticClspvReflectionProgramScopeVariablePointerPushConstant: + case NonSemanticClspvReflectionPrintfInfo: + case NonSemanticClspvReflectionPrintfBufferStorageBuffer: + case NonSemanticClspvReflectionPrintfBufferPointerPushConstant: + required_version = 5; + break; + default: + break; + } + if (version < required_version) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << ReflectionInstructionName(_, inst) << " requires version " + << required_version << ", but parsed version is " << version; + } + switch (ext_inst) { case NonSemanticClspvReflectionKernel: - return ValidateClspvReflectionKernel(_, inst); + return ValidateClspvReflectionKernel(_, inst, version); case NonSemanticClspvReflectionArgumentInfo: return ValidateClspvReflectionArgumentInfo(_, inst); case NonSemanticClspvReflectionArgumentStorageBuffer: @@ -669,12 +944,16 @@ spv_result_t ValidateClspvReflectionInstruction(ValidationState_t& _, case NonSemanticClspvReflectionArgumentSampledImage: case NonSemanticClspvReflectionArgumentStorageImage: case NonSemanticClspvReflectionArgumentSampler: + case NonSemanticClspvReflectionArgumentStorageTexelBuffer: + case NonSemanticClspvReflectionArgumentUniformTexelBuffer: return ValidateClspvReflectionArgumentBuffer(_, inst); case NonSemanticClspvReflectionArgumentPodStorageBuffer: case NonSemanticClspvReflectionArgumentPodUniform: - return ValidateClspvReflectionArgumentPodBuffer(_, inst); + case NonSemanticClspvReflectionArgumentPointerUniform: + return ValidateClspvReflectionArgumentOffsetBuffer(_, inst); case NonSemanticClspvReflectionArgumentPodPushConstant: - return ValidateClspvReflectionArgumentPodPushConstant(_, inst); + case NonSemanticClspvReflectionArgumentPointerPushConstant: + return ValidateClspvReflectionArgumentPushConstant(_, inst); case NonSemanticClspvReflectionArgumentWorkgroup: return ValidateClspvReflectionArgumentWorkgroup(_, inst); case NonSemanticClspvReflectionSpecConstantWorkgroupSize: @@ -691,11 +970,31 @@ spv_result_t ValidateClspvReflectionInstruction(ValidationState_t& _, return ValidateClspvReflectionPushConstant(_, inst); case NonSemanticClspvReflectionConstantDataStorageBuffer: case NonSemanticClspvReflectionConstantDataUniform: - return ValidateClspvReflectionConstantData(_, inst); + case NonSemanticClspvReflectionProgramScopeVariablesStorageBuffer: + return ValidateClspvReflectionInitializedData(_, inst); case NonSemanticClspvReflectionLiteralSampler: return ValidateClspvReflectionSampler(_, inst); case NonSemanticClspvReflectionPropertyRequiredWorkgroupSize: return ValidateClspvReflectionPropertyRequiredWorkgroupSize(_, inst); + case NonSemanticClspvReflectionSpecConstantSubgroupMaxSize: + return ValidateClspvReflectionSubgroupMaxSize(_, inst); + case NonSemanticClspvReflectionProgramScopeVariablePointerRelocation: + return ValidateClspvReflectionPointerRelocation(_, inst); + case NonSemanticClspvReflectionImageArgumentInfoChannelOrderPushConstant: + case NonSemanticClspvReflectionImageArgumentInfoChannelDataTypePushConstant: + return ValidateClspvReflectionImageMetadataPushConstant(_, inst); + case NonSemanticClspvReflectionImageArgumentInfoChannelOrderUniform: + case NonSemanticClspvReflectionImageArgumentInfoChannelDataTypeUniform: + return ValidateClspvReflectionImageMetadataUniform(_, inst); + case NonSemanticClspvReflectionConstantDataPointerPushConstant: + case NonSemanticClspvReflectionProgramScopeVariablePointerPushConstant: + return ValidateClspvReflectionPushConstantData(_, inst); + case NonSemanticClspvReflectionPrintfInfo: + return ValidateClspvReflectionPrintfInfo(_, inst); + case NonSemanticClspvReflectionPrintfBufferStorageBuffer: + return ValidateClspvReflectionPrintfStorageBuffer(_, inst); + case NonSemanticClspvReflectionPrintfBufferPointerPushConstant: + return ValidateClspvReflectionPrintfPushConstant(_, inst); default: break; } @@ -705,7 +1004,7 @@ spv_result_t ValidateClspvReflectionInstruction(ValidationState_t& _, bool IsConstIntScalarTypeWith32Or64Bits(ValidationState_t& _, Instruction* instr) { - if (instr->opcode() != SpvOpConstant) return false; + if (instr->opcode() != spv::Op::OpConstant) return false; if (!_.IsIntScalarType(instr->type_id())) return false; uint32_t size_in_bits = _.GetBitWidth(instr->type_id()); return size_in_bits == 32 || size_in_bits == 64; @@ -714,7 +1013,7 @@ bool IsConstIntScalarTypeWith32Or64Bits(ValidationState_t& _, bool IsConstWithIntScalarType(ValidationState_t& _, const Instruction* inst, uint32_t word_index) { auto* int_scalar_const = _.FindDef(inst->word(word_index)); - if (int_scalar_const->opcode() == SpvOpConstant && + if (int_scalar_const->opcode() == spv::Op::OpConstant && _.IsIntScalarType(int_scalar_const->type_id())) { return true; } @@ -757,7 +1056,8 @@ spv_result_t ValidateExtension(ValidationState_t& _, const Instruction* inst) { std::string extension = GetExtensionString(&(inst->c_inst())); if (extension == ExtensionToString(kSPV_KHR_workgroup_memory_explicit_layout) || - extension == ExtensionToString(kSPV_EXT_mesh_shader)) { + extension == ExtensionToString(kSPV_EXT_mesh_shader) || + extension == ExtensionToString(kSPV_NV_shader_invocation_reorder)) { return _.diag(SPV_ERROR_WRONG_VERSION, inst) << extension << " extension requires SPIR-V version 1.4 or later."; } @@ -1020,7 +1320,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected operand X type to be equal to Result Type"; } - uint32_t i_storage_class = 0; + spv::StorageClass i_storage_class; uint32_t i_data_type = 0; if (!_.GetPointerTypeInfo(i_type, &i_data_type, &i_storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -1075,7 +1375,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected operand X type to be equal to Result Type"; } - uint32_t exp_storage_class = 0; + spv::StorageClass exp_storage_class; uint32_t exp_data_type = 0; if (!_.GetPointerTypeInfo(exp_type, &exp_data_type, &exp_storage_class)) { @@ -1424,7 +1724,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { case GLSLstd450InterpolateAtCentroid: case GLSLstd450InterpolateAtSample: case GLSLstd450InterpolateAtOffset: { - if (!_.HasCapability(SpvCapabilityInterpolationFunction)) { + if (!_.HasCapability(spv::Capability::InterpolationFunction)) { return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) << ext_inst_name() << " requires capability InterpolationFunction"; @@ -1444,11 +1744,11 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { uint32_t interp_id = inst->GetOperandAs(4); auto* interp_inst = _.FindDef(interp_id); uint32_t interpolant_type = (_.options()->before_hlsl_legalization && - interp_inst->opcode() == SpvOpLoad) + interp_inst->opcode() == spv::Op::OpLoad) ? _.GetOperandTypeId(interp_inst, 2) : _.GetOperandTypeId(inst, 4); - uint32_t interpolant_storage_class = 0; + spv::StorageClass interpolant_storage_class; uint32_t interpolant_data_type = 0; if (!_.GetPointerTypeInfo(interpolant_type, &interpolant_data_type, &interpolant_storage_class)) { @@ -1463,7 +1763,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected Interpolant data type to be equal to Result Type"; } - if (interpolant_storage_class != SpvStorageClassInput) { + if (interpolant_storage_class != spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected Interpolant storage class to be Input"; @@ -1492,7 +1792,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - SpvExecutionModelFragment, + spv::ExecutionModel::Fragment, ext_inst_name() + std::string(" requires Fragment execution model")); break; @@ -1662,7 +1962,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { } const uint32_t p_type = _.GetOperandTypeId(inst, 5); - uint32_t p_storage_class = 0; + spv::StorageClass p_storage_class; uint32_t p_data_type = 0; if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -1670,10 +1970,10 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected the last operand to be a pointer"; } - if (p_storage_class != SpvStorageClassGeneric && - p_storage_class != SpvStorageClassCrossWorkgroup && - p_storage_class != SpvStorageClassWorkgroup && - p_storage_class != SpvStorageClassFunction) { + if (p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected storage class of the pointer to be Generic, " @@ -1724,7 +2024,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { } const uint32_t p_type = _.GetOperandTypeId(inst, operand_index++); - uint32_t p_storage_class = 0; + spv::StorageClass p_storage_class; uint32_t p_data_type = 0; if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -1732,10 +2032,10 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected the last operand to be a pointer"; } - if (p_storage_class != SpvStorageClassGeneric && - p_storage_class != SpvStorageClassCrossWorkgroup && - p_storage_class != SpvStorageClassWorkgroup && - p_storage_class != SpvStorageClassFunction) { + if (p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected storage class of the pointer to be Generic, " @@ -2254,7 +2554,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "-bit integer for the addressing model used in the module)"; } - uint32_t p_storage_class = 0; + spv::StorageClass p_storage_class; uint32_t p_data_type = 0; if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -2262,11 +2562,11 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected operand P to be a pointer"; } - if (p_storage_class != SpvStorageClassUniformConstant && - p_storage_class != SpvStorageClassGeneric && - p_storage_class != SpvStorageClassCrossWorkgroup && - p_storage_class != SpvStorageClassWorkgroup && - p_storage_class != SpvStorageClassFunction) { + if (p_storage_class != spv::StorageClass::UniformConstant && + p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected operand P storage class to be UniformConstant, " @@ -2291,7 +2591,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { } case OpenCLLIB::Vstoren: { - if (_.GetIdOpcode(result_type) != SpvOpTypeVoid) { + if (_.GetIdOpcode(result_type) != spv::Op::OpTypeVoid) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": expected Result Type to be void"; } @@ -2329,7 +2629,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "-bit integer for the addressing model used in the module)"; } - uint32_t p_storage_class = 0; + spv::StorageClass p_storage_class; uint32_t p_data_type = 0; if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -2337,10 +2637,10 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected operand P to be a pointer"; } - if (p_storage_class != SpvStorageClassGeneric && - p_storage_class != SpvStorageClassCrossWorkgroup && - p_storage_class != SpvStorageClassWorkgroup && - p_storage_class != SpvStorageClassFunction) { + if (p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected operand P storage class to be Generic, " @@ -2382,7 +2682,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "-bit integer for the addressing model used in the module)"; } - uint32_t p_storage_class = 0; + spv::StorageClass p_storage_class; uint32_t p_data_type = 0; if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -2390,11 +2690,11 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected operand P to be a pointer"; } - if (p_storage_class != SpvStorageClassUniformConstant && - p_storage_class != SpvStorageClassGeneric && - p_storage_class != SpvStorageClassCrossWorkgroup && - p_storage_class != SpvStorageClassWorkgroup && - p_storage_class != SpvStorageClassFunction) { + if (p_storage_class != spv::StorageClass::UniformConstant && + p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected operand P storage class to be UniformConstant, " @@ -2444,7 +2744,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "-bit integer for the addressing model used in the module)"; } - uint32_t p_storage_class = 0; + spv::StorageClass p_storage_class; uint32_t p_data_type = 0; if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -2452,11 +2752,11 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected operand P to be a pointer"; } - if (p_storage_class != SpvStorageClassUniformConstant && - p_storage_class != SpvStorageClassGeneric && - p_storage_class != SpvStorageClassCrossWorkgroup && - p_storage_class != SpvStorageClassWorkgroup && - p_storage_class != SpvStorageClassFunction) { + if (p_storage_class != spv::StorageClass::UniformConstant && + p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected operand P storage class to be UniformConstant, " @@ -2486,7 +2786,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { case OpenCLLIB::Vstore_halfn_r: case OpenCLLIB::Vstorea_halfn: case OpenCLLIB::Vstorea_halfn_r: { - if (_.GetIdOpcode(result_type) != SpvOpTypeVoid) { + if (_.GetIdOpcode(result_type) != spv::Op::OpTypeVoid) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": expected Result Type to be void"; } @@ -2537,7 +2837,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "-bit integer for the addressing model used in the module)"; } - uint32_t p_storage_class = 0; + spv::StorageClass p_storage_class; uint32_t p_data_type = 0; if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -2545,10 +2845,10 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected operand P to be a pointer"; } - if (p_storage_class != SpvStorageClassGeneric && - p_storage_class != SpvStorageClassCrossWorkgroup && - p_storage_class != SpvStorageClassWorkgroup && - p_storage_class != SpvStorageClassFunction) { + if (p_storage_class != spv::StorageClass::Generic && + p_storage_class != spv::StorageClass::CrossWorkgroup && + p_storage_class != spv::StorageClass::Workgroup && + p_storage_class != spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected operand P storage class to be Generic, " @@ -2653,7 +2953,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { } const uint32_t format_type = _.GetOperandTypeId(inst, 4); - uint32_t format_storage_class = 0; + spv::StorageClass format_storage_class; uint32_t format_data_type = 0; if (!_.GetPointerTypeInfo(format_type, &format_data_type, &format_storage_class)) { @@ -2662,7 +2962,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected operand Format to be a pointer"; } - if (format_storage_class != SpvStorageClassUniformConstant) { + if (format_storage_class != spv::StorageClass::UniformConstant) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected Format storage class to be UniformConstant"; @@ -2678,7 +2978,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { } case OpenCLLIB::Prefetch: { - if (_.GetIdOpcode(result_type) != SpvOpTypeVoid) { + if (_.GetIdOpcode(result_type) != spv::Op::OpTypeVoid) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": expected Result Type to be void"; } @@ -2686,7 +2986,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { const uint32_t p_type = _.GetOperandTypeId(inst, 4); const uint32_t num_elements_type = _.GetOperandTypeId(inst, 5); - uint32_t p_storage_class = 0; + spv::StorageClass p_storage_class; uint32_t p_data_type = 0; if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -2694,7 +2994,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected operand Ptr to be a pointer"; } - if (p_storage_class != SpvStorageClassCrossWorkgroup) { + if (p_storage_class != spv::StorageClass::CrossWorkgroup) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected operand Ptr storage class to be CrossWorkgroup"; @@ -2857,13 +3157,13 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { break; } case CommonDebugInfoDebugSource: { - CHECK_OPERAND("File", SpvOpString, 5); - if (num_words == 7) CHECK_OPERAND("Text", SpvOpString, 6); + CHECK_OPERAND("File", spv::Op::OpString, 5); + if (num_words == 7) CHECK_OPERAND("Text", spv::Op::OpString, 6); break; } case CommonDebugInfoDebugTypeBasic: { - CHECK_OPERAND("Name", SpvOpString, 5); - CHECK_OPERAND("Size", SpvOpConstant, 6); + CHECK_OPERAND("Name", spv::Op::OpString, 5); + CHECK_OPERAND("Size", spv::Op::OpConstant, 6); CHECK_CONST_UINT_OPERAND("Encoding", 7); break; } @@ -2966,7 +3266,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { break; } case CommonDebugInfoDebugTypedef: { - CHECK_OPERAND("Name", SpvOpString, 5); + CHECK_OPERAND("Name", spv::Op::OpString, 5); auto validate_base_type = ValidateOperandBaseType(_, inst, 6, ext_inst_name); if (validate_base_type != SPV_SUCCESS) return validate_base_type; @@ -2983,7 +3283,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { auto* return_type = _.FindDef(inst->word(6)); // TODO: We need a spec discussion that we have to allow return and // parameter types of a DebugTypeFunction to have template parameter. - if (return_type->opcode() != SpvOpTypeVoid) { + if (return_type->opcode() != spv::Op::OpTypeVoid) { auto validate_return = ValidateOperandDebugType( _, "Return Type", inst, 6, ext_inst_name, true); if (validate_return != SPV_SUCCESS) return validate_return; @@ -2996,7 +3296,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { break; } case CommonDebugInfoDebugTypeEnum: { - CHECK_OPERAND("Name", SpvOpString, 5); + CHECK_OPERAND("Name", spv::Op::OpString, 5); if (!DoesDebugInfoOperandMatchExpectation( _, [](CommonDebugInfoInstructions dbg_inst) { @@ -3014,7 +3314,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { auto validate_parent = ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name); if (validate_parent != SPV_SUCCESS) return validate_parent; - CHECK_OPERAND("Size", SpvOpConstant, 11); + CHECK_OPERAND("Size", spv::Op::OpConstant, 11); auto* size = _.FindDef(inst->word(11)); if (!_.IsIntScalarType(size->type_id()) || !size->word(3)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -3024,27 +3324,27 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { CHECK_CONST_UINT_OPERAND("Flags", 12); for (uint32_t word_index = 13; word_index + 1 < num_words; word_index += 2) { - CHECK_OPERAND("Value", SpvOpConstant, word_index); - CHECK_OPERAND("Name", SpvOpString, word_index + 1); + CHECK_OPERAND("Value", spv::Op::OpConstant, word_index); + CHECK_OPERAND("Name", spv::Op::OpString, word_index + 1); } break; } case CommonDebugInfoDebugTypeComposite: { - CHECK_OPERAND("Name", SpvOpString, 5); + CHECK_OPERAND("Name", spv::Op::OpString, 5); CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 7); CHECK_CONST_UINT_OPERAND("Line", 8); CHECK_CONST_UINT_OPERAND("Column", 9); auto validate_parent = ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name); if (validate_parent != SPV_SUCCESS) return validate_parent; - CHECK_OPERAND("Linkage Name", SpvOpString, 11); + CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); if (!DoesDebugInfoOperandMatchExpectation( _, [](CommonDebugInfoInstructions dbg_inst) { return dbg_inst == CommonDebugInfoDebugInfoNone; }, inst, 12)) { - CHECK_OPERAND("Size", SpvOpConstant, 12); + CHECK_OPERAND("Size", spv::Op::OpConstant, 12); } CHECK_CONST_UINT_OPERAND("Flags", 13); for (uint32_t word_index = 14; word_index < num_words; ++word_index) { @@ -3066,7 +3366,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { break; } case CommonDebugInfoDebugTypeMember: { - CHECK_OPERAND("Name", SpvOpString, 5); + CHECK_OPERAND("Name", spv::Op::OpString, 5); // TODO: We need a spec discussion that we have to allow member types // to have template parameter. auto validate_type = @@ -3077,17 +3377,19 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { CHECK_CONST_UINT_OPERAND("Column", 9); // NonSemantic.Shader.DebugInfo doesn't have the Parent operand if (vulkanDebugInfo) { - CHECK_OPERAND("Offset", SpvOpConstant, 10); - CHECK_OPERAND("Size", SpvOpConstant, 11); + CHECK_OPERAND("Offset", spv::Op::OpConstant, 10); + CHECK_OPERAND("Size", spv::Op::OpConstant, 11); CHECK_CONST_UINT_OPERAND("Flags", 12); - if (num_words == 14) CHECK_OPERAND("Value", SpvOpConstant, 13); + if (num_words == 14) + CHECK_OPERAND("Value", spv::Op::OpConstant, 13); } else { CHECK_DEBUG_OPERAND("Parent", CommonDebugInfoDebugTypeComposite, 10); - CHECK_OPERAND("Offset", SpvOpConstant, 11); - CHECK_OPERAND("Size", SpvOpConstant, 12); + CHECK_OPERAND("Offset", spv::Op::OpConstant, 11); + CHECK_OPERAND("Size", spv::Op::OpConstant, 12); CHECK_CONST_UINT_OPERAND("Flags", 13); - if (num_words == 15) CHECK_OPERAND("Value", SpvOpConstant, 14); + if (num_words == 15) + CHECK_OPERAND("Value", spv::Op::OpConstant, 14); } break; } @@ -3114,13 +3416,13 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { << "expected operand Parent must be class or struct debug " "type"; } - CHECK_OPERAND("Offset", SpvOpConstant, 7); - CHECK_OPERAND("Size", SpvOpConstant, 8); + CHECK_OPERAND("Offset", spv::Op::OpConstant, 7); + CHECK_OPERAND("Size", spv::Op::OpConstant, 8); CHECK_CONST_UINT_OPERAND("Flags", 9); break; } case CommonDebugInfoDebugFunction: { - CHECK_OPERAND("Name", SpvOpString, 5); + CHECK_OPERAND("Name", spv::Op::OpString, 5); auto validate_type = ValidateOperandDebugType(_, "Type", inst, 6, ext_inst_name, false); if (validate_type != SPV_SUCCESS) return validate_type; @@ -3130,7 +3432,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { auto validate_parent = ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name); if (validate_parent != SPV_SUCCESS) return validate_parent; - CHECK_OPERAND("Linkage Name", SpvOpString, 11); + CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); CHECK_CONST_UINT_OPERAND("Flags", 12); CHECK_CONST_UINT_OPERAND("Scope Line", 13); // NonSemantic.Shader.DebugInfo.100 doesn't include a reference to the @@ -3147,7 +3449,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { return dbg_inst == CommonDebugInfoDebugInfoNone; }, inst, 14)) { - CHECK_OPERAND("Function", SpvOpFunction, 14); + CHECK_OPERAND("Function", spv::Op::OpFunction, 14); } if (num_words == 16) { CHECK_DEBUG_OPERAND("Declaration", @@ -3157,7 +3459,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { break; } case CommonDebugInfoDebugFunctionDeclaration: { - CHECK_OPERAND("Name", SpvOpString, 5); + CHECK_OPERAND("Name", spv::Op::OpString, 5); auto validate_type = ValidateOperandDebugType(_, "Type", inst, 6, ext_inst_name, false); if (validate_type != SPV_SUCCESS) return validate_type; @@ -3167,7 +3469,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { auto validate_parent = ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name); if (validate_parent != SPV_SUCCESS) return validate_parent; - CHECK_OPERAND("Linkage Name", SpvOpString, 11); + CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); CHECK_CONST_UINT_OPERAND("Flags", 12); break; } @@ -3178,7 +3480,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { auto validate_parent = ValidateOperandLexicalScope(_, "Parent", inst, 8, ext_inst_name); if (validate_parent != SPV_SUCCESS) return validate_parent; - if (num_words == 10) CHECK_OPERAND("Name", SpvOpString, 9); + if (num_words == 10) CHECK_OPERAND("Name", spv::Op::OpString, 9); break; } case CommonDebugInfoDebugScope: { @@ -3191,7 +3493,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { break; } case CommonDebugInfoDebugLocalVariable: { - CHECK_OPERAND("Name", SpvOpString, 5); + CHECK_OPERAND("Name", spv::Op::OpString, 5); // TODO: We need a spec discussion that we have to allow local // variable types to have template parameter. auto validate_type = @@ -3213,8 +3515,8 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { CHECK_DEBUG_OPERAND("Local Variable", CommonDebugInfoDebugLocalVariable, 5); auto* operand = _.FindDef(inst->word(6)); - if (operand->opcode() != SpvOpVariable && - operand->opcode() != SpvOpFunctionParameter) { + if (operand->opcode() != spv::Op::OpVariable && + operand->opcode() != spv::Op::OpFunctionParameter) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected operand Variable must be a result id of " @@ -3276,7 +3578,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { break; } case CommonDebugInfoDebugTypeTemplateParameter: { - CHECK_OPERAND("Name", SpvOpString, 5); + CHECK_OPERAND("Name", spv::Op::OpString, 5); auto validate_actual_type = ValidateOperandDebugType( _, "Actual Type", inst, 6, ext_inst_name, false); if (validate_actual_type != SPV_SUCCESS) return validate_actual_type; @@ -3286,7 +3588,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { return dbg_inst == CommonDebugInfoDebugInfoNone; }, inst, 7)) { - CHECK_OPERAND("Value", SpvOpConstant, 7); + CHECK_OPERAND("Value", spv::Op::OpConstant, 7); } CHECK_DEBUG_OPERAND("Source", CommonDebugInfoDebugSource, 8); CHECK_CONST_UINT_OPERAND("Line", 9); @@ -3294,7 +3596,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { break; } case CommonDebugInfoDebugGlobalVariable: { - CHECK_OPERAND("Name", SpvOpString, 5); + CHECK_OPERAND("Name", spv::Op::OpString, 5); auto validate_type = ValidateOperandDebugType(_, "Type", inst, 6, ext_inst_name, false); if (validate_type != SPV_SUCCESS) return validate_type; @@ -3304,7 +3606,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { auto validate_scope = ValidateOperandLexicalScope(_, "Scope", inst, 10, ext_inst_name); if (validate_scope != SPV_SUCCESS) return validate_scope; - CHECK_OPERAND("Linkage Name", SpvOpString, 11); + CHECK_OPERAND("Linkage Name", spv::Op::OpString, 11); if (!DoesDebugInfoOperandMatchExpectation( _, [](CommonDebugInfoInstructions dbg_inst) { @@ -3312,8 +3614,8 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { }, inst, 12)) { auto* operand = _.FindDef(inst->word(12)); - if (operand->opcode() != SpvOpVariable && - operand->opcode() != SpvOpConstant) { + if (operand->opcode() != spv::Op::OpVariable && + operand->opcode() != spv::Op::OpConstant) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << ext_inst_name() << ": " << "expected operand Variable must be a result id of " @@ -3401,10 +3703,10 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) { } spv_result_t ExtensionPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); - if (opcode == SpvOpExtension) return ValidateExtension(_, inst); - if (opcode == SpvOpExtInstImport) return ValidateExtInstImport(_, inst); - if (opcode == SpvOpExtInst) return ValidateExtInst(_, inst); + const spv::Op opcode = inst->opcode(); + if (opcode == spv::Op::OpExtension) return ValidateExtension(_, inst); + if (opcode == spv::Op::OpExtInstImport) return ValidateExtInstImport(_, inst); + if (opcode == spv::Op::OpExtInst) return ValidateExtInst(_, inst); return SPV_SUCCESS; } diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_function.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_function.cpp index 0ccf5a9e..639817fe 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_function.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_function.cpp @@ -14,6 +14,7 @@ #include +#include "source/enum_string_mapping.h" #include "source/opcode.h" #include "source/val/instruction.h" #include "source/val/validate.h" @@ -28,7 +29,8 @@ namespace { // of the decorations that apply to |a|. bool DoPointeesLogicallyMatch(val::Instruction* a, val::Instruction* b, ValidationState_t& _) { - if (a->opcode() != SpvOpTypePointer || b->opcode() != SpvOpTypePointer) { + if (a->opcode() != spv::Op::OpTypePointer || + b->opcode() != spv::Op::OpTypePointer) { return false; } @@ -56,7 +58,7 @@ bool DoPointeesLogicallyMatch(val::Instruction* a, val::Instruction* b, spv_result_t ValidateFunction(ValidationState_t& _, const Instruction* inst) { const auto function_type_id = inst->GetOperandAs(3); const auto function_type = _.FindDef(function_type_id); - if (!function_type || SpvOpTypeFunction != function_type->opcode()) { + if (!function_type || spv::Op::OpTypeFunction != function_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpFunction Function Type " << _.getIdName(function_type_id) << " is not a function type."; @@ -70,21 +72,21 @@ spv_result_t ValidateFunction(ValidationState_t& _, const Instruction* inst) { << _.getIdName(return_id) << "."; } - const std::vector acceptable = { - SpvOpGroupDecorate, - SpvOpDecorate, - SpvOpEnqueueKernel, - SpvOpEntryPoint, - SpvOpExecutionMode, - SpvOpExecutionModeId, - SpvOpFunctionCall, - SpvOpGetKernelNDrangeSubGroupCount, - SpvOpGetKernelNDrangeMaxSubGroupSize, - SpvOpGetKernelWorkGroupSize, - SpvOpGetKernelPreferredWorkGroupSizeMultiple, - SpvOpGetKernelLocalSizeForSubgroupCount, - SpvOpGetKernelMaxNumSubgroups, - SpvOpName}; + const std::vector acceptable = { + spv::Op::OpGroupDecorate, + spv::Op::OpDecorate, + spv::Op::OpEnqueueKernel, + spv::Op::OpEntryPoint, + spv::Op::OpExecutionMode, + spv::Op::OpExecutionModeId, + spv::Op::OpFunctionCall, + spv::Op::OpGetKernelNDrangeSubGroupCount, + spv::Op::OpGetKernelNDrangeMaxSubGroupSize, + spv::Op::OpGetKernelWorkGroupSize, + spv::Op::OpGetKernelPreferredWorkGroupSizeMultiple, + spv::Op::OpGetKernelLocalSizeForSubgroupCount, + spv::Op::OpGetKernelMaxNumSubgroups, + spv::Op::OpName}; for (auto& pair : inst->uses()) { const auto* use = pair.first; if (std::find(acceptable.begin(), acceptable.end(), use->opcode()) == @@ -112,14 +114,14 @@ spv_result_t ValidateFunctionParameter(ValidationState_t& _, auto func_inst = &_.ordered_instructions()[inst_num]; while (--inst_num) { func_inst = &_.ordered_instructions()[inst_num]; - if (func_inst->opcode() == SpvOpFunction) { + if (func_inst->opcode() == spv::Op::OpFunction) { break; - } else if (func_inst->opcode() == SpvOpFunctionParameter) { + } else if (func_inst->opcode() == spv::Op::OpFunctionParameter) { ++param_index; } } - if (func_inst->opcode() != SpvOpFunction) { + if (func_inst->opcode() != spv::Op::OpFunction) { return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) << "Function parameter must be preceded by a function."; } @@ -150,25 +152,25 @@ spv_result_t ValidateFunctionParameter(ValidationState_t& _, // Validate that PhysicalStorageBuffer have one of Restrict, Aliased, // RestrictPointer, or AliasedPointer. auto param_nonarray_type_id = param_type->id(); - while (_.GetIdOpcode(param_nonarray_type_id) == SpvOpTypeArray) { + while (_.GetIdOpcode(param_nonarray_type_id) == spv::Op::OpTypeArray) { param_nonarray_type_id = _.FindDef(param_nonarray_type_id)->GetOperandAs(1u); } - if (_.GetIdOpcode(param_nonarray_type_id) == SpvOpTypePointer) { + if (_.GetIdOpcode(param_nonarray_type_id) == spv::Op::OpTypePointer) { auto param_nonarray_type = _.FindDef(param_nonarray_type_id); - if (param_nonarray_type->GetOperandAs(1u) == - SpvStorageClassPhysicalStorageBuffer) { + if (param_nonarray_type->GetOperandAs(1u) == + spv::StorageClass::PhysicalStorageBuffer) { // check for Aliased or Restrict const auto& decorations = _.id_decorations(inst->id()); bool foundAliased = std::any_of( decorations.begin(), decorations.end(), [](const Decoration& d) { - return SpvDecorationAliased == d.dec_type(); + return spv::Decoration::Aliased == d.dec_type(); }); bool foundRestrict = std::any_of( decorations.begin(), decorations.end(), [](const Decoration& d) { - return SpvDecorationRestrict == d.dec_type(); + return spv::Decoration::Restrict == d.dec_type(); }); if (!foundAliased && !foundRestrict) { @@ -187,20 +189,20 @@ spv_result_t ValidateFunctionParameter(ValidationState_t& _, const auto pointee_type_id = param_nonarray_type->GetOperandAs(2); const auto pointee_type = _.FindDef(pointee_type_id); - if (SpvOpTypePointer == pointee_type->opcode() && - pointee_type->GetOperandAs(1u) == - SpvStorageClassPhysicalStorageBuffer) { + if (spv::Op::OpTypePointer == pointee_type->opcode() && + pointee_type->GetOperandAs(1u) == + spv::StorageClass::PhysicalStorageBuffer) { // check for AliasedPointer/RestrictPointer const auto& decorations = _.id_decorations(inst->id()); bool foundAliased = std::any_of( decorations.begin(), decorations.end(), [](const Decoration& d) { - return SpvDecorationAliasedPointer == d.dec_type(); + return spv::Decoration::AliasedPointer == d.dec_type(); }); bool foundRestrict = std::any_of( decorations.begin(), decorations.end(), [](const Decoration& d) { - return SpvDecorationRestrictPointer == d.dec_type(); + return spv::Decoration::RestrictPointer == d.dec_type(); }); if (!foundAliased && !foundRestrict) { @@ -226,7 +228,7 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _, const Instruction* inst) { const auto function_id = inst->GetOperandAs(2); const auto function = _.FindDef(function_id); - if (!function || SpvOpFunction != function->opcode()) { + if (!function || spv::Op::OpFunction != function->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpFunctionCall Function " << _.getIdName(function_id) << " is not a function."; @@ -242,7 +244,7 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _, const auto function_type_id = function->GetOperandAs(3); const auto function_type = _.FindDef(function_type_id); - if (!function_type || function_type->opcode() != SpvOpTypeFunction) { + if (!function_type || function_type->opcode() != spv::Op::OpTypeFunction) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Missing function type definition."; } @@ -285,20 +287,21 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _, } } - if (_.addressing_model() == SpvAddressingModelLogical) { - if (parameter_type->opcode() == SpvOpTypePointer && + if (_.addressing_model() == spv::AddressingModel::Logical) { + if (parameter_type->opcode() == spv::Op::OpTypePointer && !_.options()->relax_logical_pointer) { - SpvStorageClass sc = parameter_type->GetOperandAs(1u); + spv::StorageClass sc = + parameter_type->GetOperandAs(1u); // Validate which storage classes can be pointer operands. switch (sc) { - case SpvStorageClassUniformConstant: - case SpvStorageClassFunction: - case SpvStorageClassPrivate: - case SpvStorageClassWorkgroup: - case SpvStorageClassAtomicCounter: + case spv::StorageClass::UniformConstant: + case spv::StorageClass::Function: + case spv::StorageClass::Private: + case spv::StorageClass::Workgroup: + case spv::StorageClass::AtomicCounter: // These are always allowed. break; - case SpvStorageClassStorageBuffer: + case spv::StorageClass::StorageBuffer: if (!_.features().variable_pointers) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "StorageBuffer pointer operand " @@ -313,13 +316,14 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _, } // Validate memory object declaration requirements. - if (argument->opcode() != SpvOpVariable && - argument->opcode() != SpvOpFunctionParameter) { + if (argument->opcode() != spv::Op::OpVariable && + argument->opcode() != spv::Op::OpFunctionParameter) { const bool ssbo_vptr = _.features().variable_pointers && - sc == SpvStorageClassStorageBuffer; - const bool wg_vptr = _.HasCapability(SpvCapabilityVariablePointers) && - sc == SpvStorageClassWorkgroup; - const bool uc_ptr = sc == SpvStorageClassUniformConstant; + sc == spv::StorageClass::StorageBuffer; + const bool wg_vptr = + _.HasCapability(spv::Capability::VariablePointers) && + sc == spv::StorageClass::Workgroup; + const bool uc_ptr = sc == spv::StorageClass::UniformConstant; if (!ssbo_vptr && !wg_vptr && !uc_ptr) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Pointer operand " << _.getIdName(argument_id) @@ -336,13 +340,13 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _, spv_result_t FunctionPass(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { - case SpvOpFunction: + case spv::Op::OpFunction: if (auto error = ValidateFunction(_, inst)) return error; break; - case SpvOpFunctionParameter: + case spv::Op::OpFunctionParameter: if (auto error = ValidateFunctionParameter(_, inst)) return error; break; - case SpvOpFunctionCall: + case spv::Op::OpFunctionCall: if (auto error = ValidateFunctionCall(_, inst)) return error; break; default: diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_id.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_id.cpp index 2bab2034..bcfeb591 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_id.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_id.cpp @@ -12,25 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/val/validate.h" - -#include - -#include -#include -#include -#include -#include #include -#include #include -#include "source/diagnostic.h" #include "source/instruction.h" #include "source/opcode.h" #include "source/operand.h" -#include "source/spirv_validator_options.h" #include "source/val/function.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" #include "spirv-tools/libspirv.h" @@ -71,7 +60,7 @@ spv_result_t CheckIdDefinitionDominateUse(ValidationState_t& _) { const Instruction* use = use_index_pair.first; if (const BasicBlock* use_block = use->block()) { if (use_block->reachable() == false) continue; - if (use->opcode() == SpvOpPhi) { + if (use->opcode() == spv::Op::OpPhi) { if (phi_ids.insert(use->id()).second) { phi_instructions.push_back(use); } @@ -131,7 +120,7 @@ spv_result_t CheckIdDefinitionDominateUse(ValidationState_t& _) { // instruction operand's ID can be forward referenced. spv_result_t IdPass(ValidationState_t& _, Instruction* inst) { auto can_have_forward_declared_ids = - inst->opcode() == SpvOpExtInst && + inst->opcode() == spv::Op::OpExtInst && spvExtInstIsDebugInfo(inst->ext_inst_type()) ? spvDbgInfoExtOperandCanBeForwardDeclaredFunction( inst->ext_inst_type(), inst->word(4)) @@ -172,23 +161,33 @@ spv_result_t IdPass(ValidationState_t& _, Instruction* inst) { if (spvOpcodeGeneratesType(def->opcode()) && !spvOpcodeGeneratesType(opcode) && !spvOpcodeIsDebug(opcode) && !inst->IsDebugInfo() && !inst->IsNonSemantic() && - !spvOpcodeIsDecoration(opcode) && opcode != SpvOpFunction && - opcode != SpvOpCooperativeMatrixLengthNV && - !(opcode == SpvOpSpecConstantOp && - inst->word(3) == SpvOpCooperativeMatrixLengthNV)) { + !spvOpcodeIsDecoration(opcode) && opcode != spv::Op::OpFunction && + opcode != spv::Op::OpCooperativeMatrixLengthNV && + opcode != spv::Op::OpCooperativeMatrixLengthKHR && + !(opcode == spv::Op::OpSpecConstantOp && + (spv::Op(inst->word(3)) == + spv::Op::OpCooperativeMatrixLengthNV || + spv::Op(inst->word(3)) == + spv::Op::OpCooperativeMatrixLengthKHR))) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Operand " << _.getIdName(operand_word) << " cannot be a type"; } else if (def->type_id() == 0 && !spvOpcodeGeneratesType(opcode) && !spvOpcodeIsDebug(opcode) && !inst->IsDebugInfo() && !inst->IsNonSemantic() && !spvOpcodeIsDecoration(opcode) && - !spvOpcodeIsBranch(opcode) && opcode != SpvOpPhi && - opcode != SpvOpExtInst && opcode != SpvOpExtInstImport && - opcode != SpvOpSelectionMerge && - opcode != SpvOpLoopMerge && opcode != SpvOpFunction && - opcode != SpvOpCooperativeMatrixLengthNV && - !(opcode == SpvOpSpecConstantOp && - inst->word(3) == SpvOpCooperativeMatrixLengthNV)) { + !spvOpcodeIsBranch(opcode) && opcode != spv::Op::OpPhi && + opcode != spv::Op::OpExtInst && + opcode != spv::Op::OpExtInstImport && + opcode != spv::Op::OpSelectionMerge && + opcode != spv::Op::OpLoopMerge && + opcode != spv::Op::OpFunction && + opcode != spv::Op::OpCooperativeMatrixLengthNV && + opcode != spv::Op::OpCooperativeMatrixLengthKHR && + !(opcode == spv::Op::OpSpecConstantOp && + (spv::Op(inst->word(3)) == + spv::Op::OpCooperativeMatrixLengthNV || + spv::Op(inst->word(3)) == + spv::Op::OpCooperativeMatrixLengthKHR))) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Operand " << _.getIdName(operand_word) << " requires a type"; diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_image.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_image.cpp index 9c7c8c1c..7c8dfee7 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_image.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_image.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Google Inc. +// Copyright (c) 2017 Google Inc. // Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights // reserved. // @@ -18,7 +18,6 @@ #include -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_constant.h" #include "source/spirv_target_env.h" @@ -32,47 +31,47 @@ namespace spvtools { namespace val { namespace { -// Performs compile time check that all SpvImageOperandsXXX cases are handled in -// this module. If SpvImageOperandsXXX list changes, this function will fail the -// build. -// For all other purposes this is a placeholder function. +// Performs compile time check that all spv::ImageOperandsMask::XXX cases are +// handled in this module. If spv::ImageOperandsMask::XXX list changes, this +// function will fail the build. For all other purposes this is a placeholder +// function. bool CheckAllImageOperandsHandled() { - SpvImageOperandsMask enum_val = SpvImageOperandsBiasMask; + spv::ImageOperandsMask enum_val = spv::ImageOperandsMask::Bias; // Some improvised code to prevent the compiler from considering enum_val // constant and optimizing the switch away. uint32_t stack_var = 0; if (reinterpret_cast(&stack_var) % 256) - enum_val = SpvImageOperandsLodMask; + enum_val = spv::ImageOperandsMask::Lod; switch (enum_val) { // Please update the validation rules in this module if you are changing // the list of image operands, and add new enum values to this switch. - case SpvImageOperandsMaskNone: + case spv::ImageOperandsMask::MaskNone: return false; - case SpvImageOperandsBiasMask: - case SpvImageOperandsLodMask: - case SpvImageOperandsGradMask: - case SpvImageOperandsConstOffsetMask: - case SpvImageOperandsOffsetMask: - case SpvImageOperandsConstOffsetsMask: - case SpvImageOperandsSampleMask: - case SpvImageOperandsMinLodMask: + case spv::ImageOperandsMask::Bias: + case spv::ImageOperandsMask::Lod: + case spv::ImageOperandsMask::Grad: + case spv::ImageOperandsMask::ConstOffset: + case spv::ImageOperandsMask::Offset: + case spv::ImageOperandsMask::ConstOffsets: + case spv::ImageOperandsMask::Sample: + case spv::ImageOperandsMask::MinLod: // TODO(dneto): Support image operands related to the Vulkan memory model. // https://gitlab.khronos.org/spirv/spirv-tools/issues/32 - case SpvImageOperandsMakeTexelAvailableKHRMask: - case SpvImageOperandsMakeTexelVisibleKHRMask: - case SpvImageOperandsNonPrivateTexelKHRMask: - case SpvImageOperandsVolatileTexelKHRMask: - case SpvImageOperandsSignExtendMask: - case SpvImageOperandsZeroExtendMask: + case spv::ImageOperandsMask::MakeTexelAvailableKHR: + case spv::ImageOperandsMask::MakeTexelVisibleKHR: + case spv::ImageOperandsMask::NonPrivateTexelKHR: + case spv::ImageOperandsMask::VolatileTexelKHR: + case spv::ImageOperandsMask::SignExtend: + case spv::ImageOperandsMask::ZeroExtend: // TODO(jaebaek): Move this line properly after handling image offsets // operand. This line temporarily fixes CI failure that // blocks other PRs. // https://github.com/KhronosGroup/SPIRV-Tools/issues/4565 - case SpvImageOperandsOffsetsMask: - case SpvImageOperandsNontemporalMask: + case spv::ImageOperandsMask::Offsets: + case spv::ImageOperandsMask::Nontemporal: return true; } return false; @@ -81,13 +80,13 @@ bool CheckAllImageOperandsHandled() { // Used by GetImageTypeInfo. See OpTypeImage spec for more information. struct ImageTypeInfo { uint32_t sampled_type = 0; - SpvDim dim = SpvDimMax; + spv::Dim dim = spv::Dim::Max; uint32_t depth = 0; uint32_t arrayed = 0; uint32_t multisampled = 0; uint32_t sampled = 0; - SpvImageFormat format = SpvImageFormatMax; - SpvAccessQualifier access_qualifier = SpvAccessQualifierMax; + spv::ImageFormat format = spv::ImageFormat::Max; + spv::AccessQualifier access_qualifier = spv::AccessQualifier::Max; }; // Provides information on image type. |id| should be object of either @@ -100,39 +99,39 @@ bool GetImageTypeInfo(const ValidationState_t& _, uint32_t id, const Instruction* inst = _.FindDef(id); assert(inst); - if (inst->opcode() == SpvOpTypeSampledImage) { + if (inst->opcode() == spv::Op::OpTypeSampledImage) { inst = _.FindDef(inst->word(2)); assert(inst); } - if (inst->opcode() != SpvOpTypeImage) return false; + if (inst->opcode() != spv::Op::OpTypeImage) return false; const size_t num_words = inst->words().size(); if (num_words != 9 && num_words != 10) return false; info->sampled_type = inst->word(2); - info->dim = static_cast(inst->word(3)); + info->dim = static_cast(inst->word(3)); info->depth = inst->word(4); info->arrayed = inst->word(5); info->multisampled = inst->word(6); info->sampled = inst->word(7); - info->format = static_cast(inst->word(8)); - info->access_qualifier = num_words < 10 - ? SpvAccessQualifierMax - : static_cast(inst->word(9)); + info->format = static_cast(inst->word(8)); + info->access_qualifier = + num_words < 10 ? spv::AccessQualifier::Max + : static_cast(inst->word(9)); return true; } -bool IsImplicitLod(SpvOp opcode) { +bool IsImplicitLod(spv::Op opcode) { switch (opcode) { - case SpvOpImageSampleImplicitLod: - case SpvOpImageSampleDrefImplicitLod: - case SpvOpImageSampleProjImplicitLod: - case SpvOpImageSampleProjDrefImplicitLod: - case SpvOpImageSparseSampleImplicitLod: - case SpvOpImageSparseSampleDrefImplicitLod: - case SpvOpImageSparseSampleProjImplicitLod: - case SpvOpImageSparseSampleProjDrefImplicitLod: + case spv::Op::OpImageSampleImplicitLod: + case spv::Op::OpImageSampleDrefImplicitLod: + case spv::Op::OpImageSampleProjImplicitLod: + case spv::Op::OpImageSampleProjDrefImplicitLod: + case spv::Op::OpImageSparseSampleImplicitLod: + case spv::Op::OpImageSparseSampleDrefImplicitLod: + case spv::Op::OpImageSparseSampleProjImplicitLod: + case spv::Op::OpImageSparseSampleProjDrefImplicitLod: return true; default: break; @@ -140,16 +139,16 @@ bool IsImplicitLod(SpvOp opcode) { return false; } -bool IsExplicitLod(SpvOp opcode) { +bool IsExplicitLod(spv::Op opcode) { switch (opcode) { - case SpvOpImageSampleExplicitLod: - case SpvOpImageSampleDrefExplicitLod: - case SpvOpImageSampleProjExplicitLod: - case SpvOpImageSampleProjDrefExplicitLod: - case SpvOpImageSparseSampleExplicitLod: - case SpvOpImageSparseSampleDrefExplicitLod: - case SpvOpImageSparseSampleProjExplicitLod: - case SpvOpImageSparseSampleProjDrefExplicitLod: + case spv::Op::OpImageSampleExplicitLod: + case spv::Op::OpImageSampleDrefExplicitLod: + case spv::Op::OpImageSampleProjExplicitLod: + case spv::Op::OpImageSampleProjDrefExplicitLod: + case spv::Op::OpImageSparseSampleExplicitLod: + case spv::Op::OpImageSparseSampleDrefExplicitLod: + case spv::Op::OpImageSparseSampleProjExplicitLod: + case spv::Op::OpImageSparseSampleProjDrefExplicitLod: return true; default: break; @@ -157,22 +156,22 @@ bool IsExplicitLod(SpvOp opcode) { return false; } -bool IsValidLodOperand(const ValidationState_t& _, SpvOp opcode) { +bool IsValidLodOperand(const ValidationState_t& _, spv::Op opcode) { switch (opcode) { - case SpvOpImageRead: - case SpvOpImageWrite: - case SpvOpImageSparseRead: - return _.HasCapability(SpvCapabilityImageReadWriteLodAMD); + case spv::Op::OpImageRead: + case spv::Op::OpImageWrite: + case spv::Op::OpImageSparseRead: + return _.HasCapability(spv::Capability::ImageReadWriteLodAMD); default: return IsExplicitLod(opcode); } } -bool IsValidGatherLodBiasAMD(const ValidationState_t& _, SpvOp opcode) { +bool IsValidGatherLodBiasAMD(const ValidationState_t& _, spv::Op opcode) { switch (opcode) { - case SpvOpImageGather: - case SpvOpImageSparseGather: - return _.HasCapability(SpvCapabilityImageGatherBiasLodAMD); + case spv::Op::OpImageGather: + case spv::Op::OpImageSparseGather: + return _.HasCapability(spv::Capability::ImageGatherBiasLodAMD); default: break; } @@ -181,16 +180,16 @@ bool IsValidGatherLodBiasAMD(const ValidationState_t& _, SpvOp opcode) { // Returns true if the opcode is a Image instruction which applies // homogenous projection to the coordinates. -bool IsProj(SpvOp opcode) { +bool IsProj(spv::Op opcode) { switch (opcode) { - case SpvOpImageSampleProjImplicitLod: - case SpvOpImageSampleProjDrefImplicitLod: - case SpvOpImageSparseSampleProjImplicitLod: - case SpvOpImageSparseSampleProjDrefImplicitLod: - case SpvOpImageSampleProjExplicitLod: - case SpvOpImageSampleProjDrefExplicitLod: - case SpvOpImageSparseSampleProjExplicitLod: - case SpvOpImageSparseSampleProjDrefExplicitLod: + case spv::Op::OpImageSampleProjImplicitLod: + case spv::Op::OpImageSampleProjDrefImplicitLod: + case spv::Op::OpImageSparseSampleProjImplicitLod: + case spv::Op::OpImageSparseSampleProjDrefImplicitLod: + case spv::Op::OpImageSampleProjExplicitLod: + case spv::Op::OpImageSampleProjDrefExplicitLod: + case spv::Op::OpImageSparseSampleProjExplicitLod: + case spv::Op::OpImageSparseSampleProjDrefExplicitLod: return true; default: break; @@ -204,21 +203,23 @@ uint32_t GetPlaneCoordSize(const ImageTypeInfo& info) { uint32_t plane_size = 0; // If this switch breaks your build, please add new values below. switch (info.dim) { - case SpvDim1D: - case SpvDimBuffer: + case spv::Dim::Dim1D: + case spv::Dim::Buffer: plane_size = 1; break; - case SpvDim2D: - case SpvDimRect: - case SpvDimSubpassData: + case spv::Dim::Dim2D: + case spv::Dim::Rect: + case spv::Dim::SubpassData: + case spv::Dim::TileImageDataEXT: plane_size = 2; break; - case SpvDim3D: - case SpvDimCube: + case spv::Dim::Dim3D: + case spv::Dim::Cube: // For Cube direction vector is used instead of UV. plane_size = 3; break; - case SpvDimMax: + case spv::Dim::Max: + default: assert(0); break; } @@ -228,10 +229,10 @@ uint32_t GetPlaneCoordSize(const ImageTypeInfo& info) { // Returns minimal number of coordinates based on image dim, arrayed and whether // the instruction uses projection coordinates. -uint32_t GetMinCoordSize(SpvOp opcode, const ImageTypeInfo& info) { - if (info.dim == SpvDimCube && - (opcode == SpvOpImageRead || opcode == SpvOpImageWrite || - opcode == SpvOpImageSparseRead)) { +uint32_t GetMinCoordSize(spv::Op opcode, const ImageTypeInfo& info) { + if (info.dim == spv::Dim::Cube && + (opcode == spv::Op::OpImageRead || opcode == spv::Op::OpImageWrite || + opcode == spv::Op::OpImageSparseRead)) { // These opcodes use UV for Cube, not direction vector. return 3; } @@ -248,7 +249,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, static const bool kAllImageOperandsHandled = CheckAllImageOperandsHandled(); (void)kAllImageOperandsHandled; - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); const size_t num_words = inst->words().size(); const bool have_explicit_mask = (word_index - 1 < num_words); @@ -257,14 +258,14 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, if (have_explicit_mask) { // NonPrivate, Volatile, SignExtend, ZeroExtend take no operand words. const uint32_t mask_bits_having_operands = - mask & ~uint32_t(SpvImageOperandsNonPrivateTexelKHRMask | - SpvImageOperandsVolatileTexelKHRMask | - SpvImageOperandsSignExtendMask | - SpvImageOperandsZeroExtendMask | - SpvImageOperandsNontemporalMask); + mask & ~uint32_t(spv::ImageOperandsMask::NonPrivateTexelKHR | + spv::ImageOperandsMask::VolatileTexelKHR | + spv::ImageOperandsMask::SignExtend | + spv::ImageOperandsMask::ZeroExtend | + spv::ImageOperandsMask::Nontemporal); size_t expected_num_image_operand_words = spvtools::utils::CountSetBits(mask_bits_having_operands); - if (mask & SpvImageOperandsGradMask) { + if (mask & uint32_t(spv::ImageOperandsMask::Grad)) { // Grad uses two words. ++expected_num_image_operand_words; } @@ -279,7 +280,8 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, << "Number of image operand ids doesn't correspond to the bit mask"; } - if (info.multisampled & (0 == (mask & SpvImageOperandsSampleMask))) { + if (info.multisampled & + (0 == (mask & uint32_t(spv::ImageOperandsMask::Sample)))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Sample is required for operation on " "multi-sampled image"; @@ -289,12 +291,12 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, // the module to be invalid. if (mask == 0) return SPV_SUCCESS; - if (spvtools::utils::CountSetBits(mask & (SpvImageOperandsOffsetMask | - SpvImageOperandsConstOffsetMask | - SpvImageOperandsConstOffsetsMask | - SpvImageOperandsOffsetsMask)) > 1) { + if (spvtools::utils::CountSetBits( + mask & uint32_t(spv::ImageOperandsMask::Offset | + spv::ImageOperandsMask::ConstOffset | + spv::ImageOperandsMask::ConstOffsets | + spv::ImageOperandsMask::Offsets)) > 1) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(4662) << "Image Operands Offset, ConstOffset, ConstOffsets, Offsets " "cannot be used together"; } @@ -306,7 +308,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, // The checks should be done in the order of definition of OperandImage. - if (mask & SpvImageOperandsBiasMask) { + if (mask & uint32_t(spv::ImageOperandsMask::Bias)) { if (!is_implicit_lod && !is_valid_gather_lod_bias_amd) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Bias can only be used with ImplicitLod opcodes"; @@ -318,8 +320,8 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, << "Expected Image Operand Bias to be float scalar"; } - if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && - info.dim != SpvDimCube) { + if (info.dim != spv::Dim::Dim1D && info.dim != spv::Dim::Dim2D && + info.dim != spv::Dim::Dim3D && info.dim != spv::Dim::Cube) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Bias requires 'Dim' parameter to be 1D, 2D, 3D " "or Cube"; @@ -328,15 +330,16 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, // Multisampled is already checked. } - if (mask & SpvImageOperandsLodMask) { - if (!is_valid_lod_operand && opcode != SpvOpImageFetch && - opcode != SpvOpImageSparseFetch && !is_valid_gather_lod_bias_amd) { + if (mask & uint32_t(spv::ImageOperandsMask::Lod)) { + if (!is_valid_lod_operand && opcode != spv::Op::OpImageFetch && + opcode != spv::Op::OpImageSparseFetch && + !is_valid_gather_lod_bias_amd) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Lod can only be used with ExplicitLod opcodes " << "and OpImageFetch"; } - if (mask & SpvImageOperandsGradMask) { + if (mask & uint32_t(spv::ImageOperandsMask::Grad)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand bits Lod and Grad cannot be set at the same " "time"; @@ -357,8 +360,8 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, } } - if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && - info.dim != SpvDimCube) { + if (info.dim != spv::Dim::Dim1D && info.dim != spv::Dim::Dim2D && + info.dim != spv::Dim::Dim3D && info.dim != spv::Dim::Cube) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Lod requires 'Dim' parameter to be 1D, 2D, 3D " "or Cube"; @@ -367,7 +370,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, // Multisampled is already checked. } - if (mask & SpvImageOperandsGradMask) { + if (mask & uint32_t(spv::ImageOperandsMask::Grad)) { if (!is_explicit_lod) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Grad can only be used with ExplicitLod opcodes"; @@ -400,8 +403,8 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, // Multisampled is already checked. } - if (mask & SpvImageOperandsConstOffsetMask) { - if (info.dim == SpvDimCube) { + if (mask & uint32_t(spv::ImageOperandsMask::ConstOffset)) { + if (info.dim == spv::Dim::Cube) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand ConstOffset cannot be used with Cube Image " "'Dim'"; @@ -429,8 +432,8 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, } } - if (mask & SpvImageOperandsOffsetMask) { - if (info.dim == SpvDimCube) { + if (mask & uint32_t(spv::ImageOperandsMask::Offset)) { + if (info.dim == spv::Dim::Cube) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Offset cannot be used with Cube Image 'Dim'"; } @@ -453,9 +456,10 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, if (!_.options()->before_hlsl_legalization && spvIsVulkanEnv(_.context()->target_env)) { - if (opcode != SpvOpImageGather && opcode != SpvOpImageDrefGather && - opcode != SpvOpImageSparseGather && - opcode != SpvOpImageSparseDrefGather) { + if (opcode != spv::Op::OpImageGather && + opcode != spv::Op::OpImageDrefGather && + opcode != spv::Op::OpImageSparseGather && + opcode != spv::Op::OpImageSparseDrefGather) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4663) << "Image Operand Offset can only be used with " @@ -464,16 +468,17 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, } } - if (mask & SpvImageOperandsConstOffsetsMask) { - if (opcode != SpvOpImageGather && opcode != SpvOpImageDrefGather && - opcode != SpvOpImageSparseGather && - opcode != SpvOpImageSparseDrefGather) { + if (mask & uint32_t(spv::ImageOperandsMask::ConstOffsets)) { + if (opcode != spv::Op::OpImageGather && + opcode != spv::Op::OpImageDrefGather && + opcode != spv::Op::OpImageSparseGather && + opcode != spv::Op::OpImageSparseDrefGather) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand ConstOffsets can only be used with " "OpImageGather and OpImageDrefGather"; } - if (info.dim == SpvDimCube) { + if (info.dim == spv::Dim::Cube) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand ConstOffsets cannot be used with Cube Image " "'Dim'"; @@ -484,7 +489,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, const Instruction* type_inst = _.FindDef(type_id); assert(type_inst); - if (type_inst->opcode() != SpvOpTypeArray) { + if (type_inst->opcode() != spv::Op::OpTypeArray) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image Operand ConstOffsets to be an array of size 4"; } @@ -513,10 +518,11 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, } } - if (mask & SpvImageOperandsSampleMask) { - if (opcode != SpvOpImageFetch && opcode != SpvOpImageRead && - opcode != SpvOpImageWrite && opcode != SpvOpImageSparseFetch && - opcode != SpvOpImageSparseRead) { + if (mask & uint32_t(spv::ImageOperandsMask::Sample)) { + if (opcode != spv::Op::OpImageFetch && opcode != spv::Op::OpImageRead && + opcode != spv::Op::OpImageWrite && + opcode != spv::Op::OpImageSparseFetch && + opcode != spv::Op::OpImageSparseRead) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Sample can only be used with OpImageFetch, " << "OpImageRead, OpImageWrite, OpImageSparseFetch and " @@ -535,8 +541,8 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, } } - if (mask & SpvImageOperandsMinLodMask) { - if (!is_implicit_lod && !(mask & SpvImageOperandsGradMask)) { + if (mask & uint32_t(spv::ImageOperandsMask::MinLod)) { + if (!is_implicit_lod && !(mask & uint32_t(spv::ImageOperandsMask::Grad))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand MinLod can only be used with ImplicitLod " << "opcodes or together with Image Operand Grad"; @@ -548,8 +554,8 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, << "Expected Image Operand MinLod to be float scalar"; } - if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && - info.dim != SpvDimCube) { + if (info.dim != spv::Dim::Dim1D && info.dim != spv::Dim::Dim2D && + info.dim != spv::Dim::Dim3D && info.dim != spv::Dim::Cube) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand MinLod requires 'Dim' parameter to be 1D, 2D, " "3D or Cube"; @@ -561,16 +567,16 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, } } - if (mask & SpvImageOperandsMakeTexelAvailableKHRMask) { + if (mask & uint32_t(spv::ImageOperandsMask::MakeTexelAvailableKHR)) { // Checked elsewhere: capability and memory model are correct. - if (opcode != SpvOpImageWrite) { + if (opcode != spv::Op::OpImageWrite) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand MakeTexelAvailableKHR can only be used with Op" - << spvOpcodeString(SpvOpImageWrite) << ": Op" + << spvOpcodeString(spv::Op::OpImageWrite) << ": Op" << spvOpcodeString(opcode); } - if (!(mask & SpvImageOperandsNonPrivateTexelKHRMask)) { + if (!(mask & uint32_t(spv::ImageOperandsMask::NonPrivateTexelKHR))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand MakeTexelAvailableKHR requires " "NonPrivateTexelKHR is also specified: Op" @@ -582,17 +588,18 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, return error; } - if (mask & SpvImageOperandsMakeTexelVisibleKHRMask) { + if (mask & uint32_t(spv::ImageOperandsMask::MakeTexelVisibleKHR)) { // Checked elsewhere: capability and memory model are correct. - if (opcode != SpvOpImageRead && opcode != SpvOpImageSparseRead) { + if (opcode != spv::Op::OpImageRead && + opcode != spv::Op::OpImageSparseRead) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand MakeTexelVisibleKHR can only be used with Op" - << spvOpcodeString(SpvOpImageRead) << " or Op" - << spvOpcodeString(SpvOpImageSparseRead) << ": Op" + << spvOpcodeString(spv::Op::OpImageRead) << " or Op" + << spvOpcodeString(spv::Op::OpImageSparseRead) << ": Op" << spvOpcodeString(opcode); } - if (!(mask & SpvImageOperandsNonPrivateTexelKHRMask)) { + if (!(mask & uint32_t(spv::ImageOperandsMask::NonPrivateTexelKHR))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand MakeTexelVisibleKHR requires NonPrivateTexelKHR " "is also specified: Op" @@ -603,7 +610,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, if (auto error = ValidateMemoryScope(_, inst, visible_scope)) return error; } - if (mask & SpvImageOperandsSignExtendMask) { + if (mask & uint32_t(spv::ImageOperandsMask::SignExtend)) { // Checked elsewhere: SPIR-V 1.4 version or later. // "The texel value is converted to the target value via sign extension. @@ -616,7 +623,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, // setup. } - if (mask & SpvImageOperandsZeroExtendMask) { + if (mask & uint32_t(spv::ImageOperandsMask::ZeroExtend)) { // Checked elsewhere: SPIR-V 1.4 version or later. // "The texel value is converted to the target value via zero extension. @@ -629,11 +636,11 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, // setup. } - if (mask & SpvImageOperandsOffsetsMask) { + if (mask & uint32_t(spv::ImageOperandsMask::Offsets)) { // TODO: add validation } - if (mask & SpvImageOperandsNontemporalMask) { + if (mask & uint32_t(spv::ImageOperandsMask::Nontemporal)) { // Checked elsewhere: SPIR-V 1.6 version or later. } @@ -643,8 +650,8 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, // Validate OpImage*Proj* instructions spv_result_t ValidateImageProj(ValidationState_t& _, const Instruction* inst, const ImageTypeInfo& info) { - if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && - info.dim != SpvDimRect) { + if (info.dim != spv::Dim::Dim1D && info.dim != spv::Dim::Dim2D && + info.dim != spv::Dim::Dim3D && info.dim != spv::Dim::Rect) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image 'Dim' parameter to be 1D, 2D, 3D or Rect"; } @@ -667,25 +674,27 @@ spv_result_t ValidateImageReadWrite(ValidationState_t& _, const Instruction* inst, const ImageTypeInfo& info) { if (info.sampled == 2) { - if (info.dim == SpvDim1D && !_.HasCapability(SpvCapabilityImage1D)) { + if (info.dim == spv::Dim::Dim1D && + !_.HasCapability(spv::Capability::Image1D)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Capability Image1D is required to access storage image"; - } else if (info.dim == SpvDimRect && - !_.HasCapability(SpvCapabilityImageRect)) { + } else if (info.dim == spv::Dim::Rect && + !_.HasCapability(spv::Capability::ImageRect)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Capability ImageRect is required to access storage image"; - } else if (info.dim == SpvDimBuffer && - !_.HasCapability(SpvCapabilityImageBuffer)) { + } else if (info.dim == spv::Dim::Buffer && + !_.HasCapability(spv::Capability::ImageBuffer)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Capability ImageBuffer is required to access storage image"; - } else if (info.dim == SpvDimCube && info.arrayed == 1 && - !_.HasCapability(SpvCapabilityImageCubeArray)) { + } else if (info.dim == spv::Dim::Cube && info.arrayed == 1 && + !_.HasCapability(spv::Capability::ImageCubeArray)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Capability ImageCubeArray is required to access " << "storage image"; } - if (info.multisampled == 1 && !_.HasCapability(SpvCapabilityImageMSArray)) { + if (info.multisampled == 1 && + !_.HasCapability(spv::Capability::ImageMSArray)) { #if 0 // TODO(atgoo@github.com) The description of this rule in the spec // is unclear and Glslang doesn't declare ImageMSArray. Need to clarify @@ -704,21 +713,21 @@ spv_result_t ValidateImageReadWrite(ValidationState_t& _, } // Returns true if opcode is *ImageSparse*, false otherwise. -bool IsSparse(SpvOp opcode) { +bool IsSparse(spv::Op opcode) { switch (opcode) { - case SpvOpImageSparseSampleImplicitLod: - case SpvOpImageSparseSampleExplicitLod: - case SpvOpImageSparseSampleDrefImplicitLod: - case SpvOpImageSparseSampleDrefExplicitLod: - case SpvOpImageSparseSampleProjImplicitLod: - case SpvOpImageSparseSampleProjExplicitLod: - case SpvOpImageSparseSampleProjDrefImplicitLod: - case SpvOpImageSparseSampleProjDrefExplicitLod: - case SpvOpImageSparseFetch: - case SpvOpImageSparseGather: - case SpvOpImageSparseDrefGather: - case SpvOpImageSparseTexelsResident: - case SpvOpImageSparseRead: { + case spv::Op::OpImageSparseSampleImplicitLod: + case spv::Op::OpImageSparseSampleExplicitLod: + case spv::Op::OpImageSparseSampleDrefImplicitLod: + case spv::Op::OpImageSparseSampleDrefExplicitLod: + case spv::Op::OpImageSparseSampleProjImplicitLod: + case spv::Op::OpImageSparseSampleProjExplicitLod: + case spv::Op::OpImageSparseSampleProjDrefImplicitLod: + case spv::Op::OpImageSparseSampleProjDrefExplicitLod: + case spv::Op::OpImageSparseFetch: + case spv::Op::OpImageSparseGather: + case spv::Op::OpImageSparseDrefGather: + case spv::Op::OpImageSparseTexelsResident: + case spv::Op::OpImageSparseRead: { return true; } @@ -733,13 +742,13 @@ bool IsSparse(SpvOp opcode) { // Not valid for sparse image opcodes which do not return a struct. spv_result_t GetActualResultType(ValidationState_t& _, const Instruction* inst, uint32_t* actual_result_type) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); if (IsSparse(opcode)) { const Instruction* const type_inst = _.FindDef(inst->type_id()); assert(type_inst); - if (!type_inst || type_inst->opcode() != SpvOpTypeStruct) { + if (!type_inst || type_inst->opcode() != spv::Op::OpTypeStruct) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be OpTypeStruct"; } @@ -761,7 +770,7 @@ spv_result_t GetActualResultType(ValidationState_t& _, const Instruction* inst, // Returns a string describing actual result type of an opcode. // Not valid for sparse image opcodes which do not return a struct. -const char* GetActualResultTypeStr(SpvOp opcode) { +const char* GetActualResultTypeStr(spv::Op opcode) { if (IsSparse(opcode)) return "Result Type's second member"; return "Result Type"; } @@ -777,7 +786,7 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { if (_.IsIntScalarType(info.sampled_type) && (64 == _.GetBitWidth(info.sampled_type)) && - !_.HasCapability(SpvCapabilityInt64ImageEXT)) { + !_.HasCapability(spv::Capability::Int64ImageEXT)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Capability Int64ImageEXT is required when using Sampled Type of " "64-bit int"; @@ -802,10 +811,10 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { << "Sampled Type must be OpTypeVoid in the OpenCL environment."; } } else { - const SpvOp sampled_type_opcode = _.GetIdOpcode(info.sampled_type); - if (sampled_type_opcode != SpvOpTypeVoid && - sampled_type_opcode != SpvOpTypeInt && - sampled_type_opcode != SpvOpTypeFloat) { + const spv::Op sampled_type_opcode = _.GetIdOpcode(info.sampled_type); + if (sampled_type_opcode != spv::Op::OpTypeVoid && + sampled_type_opcode != spv::Op::OpTypeInt && + sampled_type_opcode != spv::Op::OpTypeFloat) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Sampled Type to be either void or" << " numerical scalar type"; @@ -835,19 +844,41 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { << "Invalid Sampled " << info.sampled << " (must be 0, 1 or 2)"; } - if (info.dim == SpvDimSubpassData) { + if (info.dim == spv::Dim::SubpassData) { if (info.sampled != 2) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(6214) << "Dim SubpassData requires Sampled to be 2"; } - if (info.format != SpvImageFormatUnknown) { + if (info.format != spv::ImageFormat::Unknown) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Dim SubpassData requires format Unknown"; } + } else if (info.dim == spv::Dim::TileImageDataEXT) { + if (_.IsVoidType(info.sampled_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Dim TileImageDataEXT requires Sampled Type to be not " + "OpTypeVoid"; + } + if (info.sampled != 2) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Dim TileImageDataEXT requires Sampled to be 2"; + } + if (info.format != spv::ImageFormat::Unknown) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Dim TileImageDataEXT requires format Unknown"; + } + if (info.depth != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Dim TileImageDataEXT requires Depth to be 0"; + } + if (info.arrayed != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Dim TileImageDataEXT requires Arrayed to be 0"; + } } else { if (info.multisampled && (info.sampled == 2) && - !_.HasCapability(SpvCapabilityStorageImageMultisample)) { + !_.HasCapability(spv::Capability::StorageImageMultisample)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Capability StorageImageMultisample is required when using " "multisampled storage image"; @@ -855,8 +886,8 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { } if (spvIsOpenCLEnv(target_env)) { - if ((info.arrayed == 1) && (info.dim != SpvDim1D) && - (info.dim != SpvDim2D)) { + if ((info.arrayed == 1) && (info.dim != spv::Dim::Dim1D) && + (info.dim != spv::Dim::Dim2D)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "In the OpenCL environment, Arrayed may only be set to 1 " << "when Dim is either 1D or 2D."; @@ -872,7 +903,7 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { << "Sampled must be 0 in the OpenCL environment."; } - if (info.access_qualifier == SpvAccessQualifierMax) { + if (info.access_qualifier == spv::AccessQualifier::Max) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "In the OpenCL environment, the optional Access Qualifier" << " must be present."; @@ -886,7 +917,7 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { << "Sampled must be 1 or 2 in the Vulkan environment."; } - if (info.dim == SpvDimSubpassData && info.arrayed != 0) { + if (info.dim == spv::Dim::SubpassData && info.arrayed != 0) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(6214) << "Dim SubpassData requires Arrayed to be 0"; } @@ -898,7 +929,7 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateTypeSampledImage(ValidationState_t& _, const Instruction* inst) { const uint32_t image_type = inst->word(2); - if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image to be of type OpTypeImage"; } @@ -910,6 +941,8 @@ spv_result_t ValidateTypeSampledImage(ValidationState_t& _, } // OpenCL requires Sampled=0, checked elsewhere. // Vulkan uses the Sampled=1 case. + // If Dim is TileImageDataEXT, Sampled must be 2 and this is validated + // elsewhere. if ((info.sampled != 0) && (info.sampled != 1)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4657) @@ -918,7 +951,8 @@ spv_result_t ValidateTypeSampledImage(ValidationState_t& _, } // This covers both OpTypeSampledImage and OpSampledImage. - if (_.version() >= SPV_SPIRV_VERSION_WORD(1, 6) && info.dim == SpvDimBuffer) { + if (_.version() >= SPV_SPIRV_VERSION_WORD(1, 6) && + info.dim == spv::Dim::Buffer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "In SPIR-V 1.6 or later, sampled image dimension must not be " "Buffer"; @@ -927,31 +961,35 @@ spv_result_t ValidateTypeSampledImage(ValidationState_t& _, return SPV_SUCCESS; } -bool IsAllowedSampledImageOperand(SpvOp opcode, ValidationState_t& _) { +bool IsAllowedSampledImageOperand(spv::Op opcode, ValidationState_t& _) { switch (opcode) { - case SpvOpSampledImage: - case SpvOpImageSampleImplicitLod: - case SpvOpImageSampleExplicitLod: - case SpvOpImageSampleDrefImplicitLod: - case SpvOpImageSampleDrefExplicitLod: - case SpvOpImageSampleProjImplicitLod: - case SpvOpImageSampleProjExplicitLod: - case SpvOpImageSampleProjDrefImplicitLod: - case SpvOpImageSampleProjDrefExplicitLod: - case SpvOpImageGather: - case SpvOpImageDrefGather: - case SpvOpImage: - case SpvOpImageQueryLod: - case SpvOpImageSparseSampleImplicitLod: - case SpvOpImageSparseSampleExplicitLod: - case SpvOpImageSparseSampleDrefImplicitLod: - case SpvOpImageSparseSampleDrefExplicitLod: - case SpvOpImageSparseGather: - case SpvOpImageSparseDrefGather: - case SpvOpCopyObject: + case spv::Op::OpSampledImage: + case spv::Op::OpImageSampleImplicitLod: + case spv::Op::OpImageSampleExplicitLod: + case spv::Op::OpImageSampleDrefImplicitLod: + case spv::Op::OpImageSampleDrefExplicitLod: + case spv::Op::OpImageSampleProjImplicitLod: + case spv::Op::OpImageSampleProjExplicitLod: + case spv::Op::OpImageSampleProjDrefImplicitLod: + case spv::Op::OpImageSampleProjDrefExplicitLod: + case spv::Op::OpImageGather: + case spv::Op::OpImageDrefGather: + case spv::Op::OpImage: + case spv::Op::OpImageQueryLod: + case spv::Op::OpImageSparseSampleImplicitLod: + case spv::Op::OpImageSparseSampleExplicitLod: + case spv::Op::OpImageSparseSampleDrefImplicitLod: + case spv::Op::OpImageSparseSampleDrefExplicitLod: + case spv::Op::OpImageSparseGather: + case spv::Op::OpImageSparseDrefGather: + case spv::Op::OpCopyObject: + case spv::Op::OpImageSampleWeightedQCOM: + case spv::Op::OpImageBoxFilterQCOM: + case spv::Op::OpImageBlockMatchSSDQCOM: + case spv::Op::OpImageBlockMatchSADQCOM: return true; - case SpvOpStore: - if (_.HasCapability(SpvCapabilityBindlessTextureNV)) return true; + case spv::Op::OpStore: + if (_.HasCapability(spv::Capability::BindlessTextureNV)) return true; return false; default: return false; @@ -960,13 +998,13 @@ bool IsAllowedSampledImageOperand(SpvOp opcode, ValidationState_t& _) { spv_result_t ValidateSampledImage(ValidationState_t& _, const Instruction* inst) { - if (_.GetIdOpcode(inst->type_id()) != SpvOpTypeSampledImage) { + if (_.GetIdOpcode(inst->type_id()) != spv::Op::OpTypeSampledImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be OpTypeSampledImage."; } const uint32_t image_type = _.GetOperandTypeId(inst, 2); - if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image to be of type OpTypeImage."; } @@ -994,12 +1032,12 @@ spv_result_t ValidateSampledImage(ValidationState_t& _, } } - if (info.dim == SpvDimSubpassData) { + if (info.dim == spv::Dim::SubpassData) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image 'Dim' parameter to be not SubpassData."; } - if (_.GetIdOpcode(_.GetOperandTypeId(inst, 3)) != SpvOpTypeSampler) { + if (_.GetIdOpcode(_.GetOperandTypeId(inst, 3)) != spv::Op::OpTypeSampler) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Sampler to be of type OpTypeSampler"; } @@ -1027,12 +1065,13 @@ spv_result_t ValidateSampledImage(ValidationState_t& _, << _.getIdName(consumer_instr->id()) << "."; } - if (consumer_opcode == SpvOpPhi || consumer_opcode == SpvOpSelect) { + if (consumer_opcode == spv::Op::OpPhi || + consumer_opcode == spv::Op::OpSelect) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Result from OpSampledImage instruction must not appear " "as " "operands of Op" - << spvOpcodeString(static_cast(consumer_opcode)) << "." + << spvOpcodeString(static_cast(consumer_opcode)) << "." << " Found result " << _.getIdName(inst->id()) << " as an operand of " << _.getIdName(consumer_instr->id()) << "."; @@ -1042,7 +1081,7 @@ spv_result_t ValidateSampledImage(ValidationState_t& _, return _.diag(SPV_ERROR_INVALID_ID, inst) << "Result from OpSampledImage instruction must not appear " "as operand for Op" - << spvOpcodeString(static_cast(consumer_opcode)) + << spvOpcodeString(static_cast(consumer_opcode)) << ", since it is not specified as taking an " << "OpTypeSampledImage." << " Found result " << _.getIdName(inst->id()) @@ -1051,19 +1090,31 @@ spv_result_t ValidateSampledImage(ValidationState_t& _, } } } + + const Instruction* ld_inst; + { + int t_idx = inst->GetOperandAs(2); + ld_inst = _.FindDef(t_idx); + } + + if (ld_inst->opcode() == spv::Op::OpLoad) { + int texture_id = ld_inst->GetOperandAs(2); // variable to load + _.RegisterQCOMImageProcessingTextureConsumer(texture_id, ld_inst, inst); + } + return SPV_SUCCESS; } spv_result_t ValidateImageTexelPointer(ValidationState_t& _, const Instruction* inst) { const auto result_type = _.FindDef(inst->type_id()); - if (result_type->opcode() != SpvOpTypePointer) { + if (result_type->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be OpTypePointer"; } - const auto storage_class = result_type->GetOperandAs(1); - if (storage_class != SpvStorageClassImage) { + const auto storage_class = result_type->GetOperandAs(1); + if (storage_class != spv::StorageClass::Image) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be OpTypePointer whose Storage Class " "operand is Image"; @@ -1071,21 +1122,21 @@ spv_result_t ValidateImageTexelPointer(ValidationState_t& _, const auto ptr_type = result_type->GetOperandAs(2); const auto ptr_opcode = _.GetIdOpcode(ptr_type); - if (ptr_opcode != SpvOpTypeInt && ptr_opcode != SpvOpTypeFloat && - ptr_opcode != SpvOpTypeVoid) { + if (ptr_opcode != spv::Op::OpTypeInt && ptr_opcode != spv::Op::OpTypeFloat && + ptr_opcode != spv::Op::OpTypeVoid) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be OpTypePointer whose Type operand " "must be a scalar numerical type or OpTypeVoid"; } const auto image_ptr = _.FindDef(_.GetOperandTypeId(inst, 2)); - if (!image_ptr || image_ptr->opcode() != SpvOpTypePointer) { + if (!image_ptr || image_ptr->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image to be OpTypePointer"; } const auto image_type = image_ptr->GetOperandAs(2); - if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image to be OpTypePointer with Type OpTypeImage"; } @@ -1102,11 +1153,17 @@ spv_result_t ValidateImageTexelPointer(ValidationState_t& _, "pointed to by Result Type"; } - if (info.dim == SpvDimSubpassData) { + if (info.dim == spv::Dim::SubpassData) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Dim SubpassData cannot be used with OpImageTexelPointer"; } + if (info.dim == spv::Dim::TileImageDataEXT) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Dim TileImageDataEXT cannot be used with " + "OpImageTexelPointer"; + } + const uint32_t coord_type = _.GetOperandTypeId(inst, 3); if (!coord_type || !_.IsIntScalarOrVectorType(coord_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -1118,11 +1175,11 @@ spv_result_t ValidateImageTexelPointer(ValidationState_t& _, expected_coord_size = GetPlaneCoordSize(info); } else if (info.arrayed == 1) { switch (info.dim) { - case SpvDim1D: + case spv::Dim::Dim1D: expected_coord_size = 2; break; - case SpvDimCube: - case SpvDim2D: + case spv::Dim::Cube: + case spv::Dim::Dim2D: expected_coord_size = 3; break; default: @@ -1157,11 +1214,11 @@ spv_result_t ValidateImageTexelPointer(ValidationState_t& _, } if (spvIsVulkanEnv(_.context()->target_env)) { - if ((info.format != SpvImageFormatR64i) && - (info.format != SpvImageFormatR64ui) && - (info.format != SpvImageFormatR32f) && - (info.format != SpvImageFormatR32i) && - (info.format != SpvImageFormatR32ui)) { + if ((info.format != spv::ImageFormat::R64i) && + (info.format != spv::ImageFormat::R64ui) && + (info.format != spv::ImageFormat::R32f) && + (info.format != spv::ImageFormat::R32i) && + (info.format != spv::ImageFormat::R32ui)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4658) << "Expected the Image Format in Image to be R64i, R64ui, R32f, " @@ -1173,7 +1230,7 @@ spv_result_t ValidateImageTexelPointer(ValidationState_t& _, } spv_result_t ValidateImageLod(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); uint32_t actual_result_type = 0; if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { return error; @@ -1193,7 +1250,7 @@ spv_result_t ValidateImageLod(ValidationState_t& _, const Instruction* inst) { } const uint32_t image_type = _.GetOperandTypeId(inst, 2); - if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeSampledImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Sampled Image to be of type OpTypeSampledImage"; } @@ -1216,7 +1273,7 @@ spv_result_t ValidateImageLod(ValidationState_t& _, const Instruction* inst) { << "Sampling operation is invalid for multisample image"; } - if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { + if (_.GetIdOpcode(info.sampled_type) != spv::Op::OpTypeVoid) { const uint32_t texel_component_type = _.GetComponentType(actual_result_type); if (texel_component_type != info.sampled_type) { @@ -1227,9 +1284,9 @@ spv_result_t ValidateImageLod(ValidationState_t& _, const Instruction* inst) { } const uint32_t coord_type = _.GetOperandTypeId(inst, 3); - if ((opcode == SpvOpImageSampleExplicitLod || - opcode == SpvOpImageSparseSampleExplicitLod) && - _.HasCapability(SpvCapabilityKernel)) { + if ((opcode == spv::Op::OpImageSampleExplicitLod || + opcode == spv::Op::OpImageSparseSampleExplicitLod) && + _.HasCapability(spv::Capability::Kernel)) { if (!_.IsFloatScalarOrVectorType(coord_type) && !_.IsIntScalarOrVectorType(coord_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -1252,9 +1309,9 @@ spv_result_t ValidateImageLod(ValidationState_t& _, const Instruction* inst) { const uint32_t mask = inst->words().size() <= 5 ? 0 : inst->word(5); - if (mask & SpvImageOperandsConstOffsetMask) { + if (mask & uint32_t(spv::ImageOperandsMask::ConstOffset)) { if (spvIsOpenCLEnv(_.context()->target_env)) { - if (opcode == SpvOpImageSampleExplicitLod) { + if (opcode == spv::Op::OpImageSampleExplicitLod) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "ConstOffset image operand not allowed " << "in the OpenCL environment."; @@ -1279,7 +1336,7 @@ spv_result_t ValidateImageDref(ValidationState_t& _, const Instruction* inst, } if (spvIsVulkanEnv(_.context()->target_env)) { - if (info.dim == SpvDim3D) { + if (info.dim == spv::Dim::Dim3D) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4777) << "In Vulkan, OpImage*Dref* instructions must not use images " @@ -1292,7 +1349,7 @@ spv_result_t ValidateImageDref(ValidationState_t& _, const Instruction* inst, spv_result_t ValidateImageDrefLod(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); uint32_t actual_result_type = 0; if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { return error; @@ -1306,7 +1363,7 @@ spv_result_t ValidateImageDrefLod(ValidationState_t& _, } const uint32_t image_type = _.GetOperandTypeId(inst, 2); - if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeSampledImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Sampled Image to be of type OpTypeSampledImage"; } @@ -1364,7 +1421,7 @@ spv_result_t ValidateImageFetch(ValidationState_t& _, const Instruction* inst) { return error; } - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); if (!_.IsIntVectorType(actual_result_type) && !_.IsFloatVectorType(actual_result_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -1379,7 +1436,7 @@ spv_result_t ValidateImageFetch(ValidationState_t& _, const Instruction* inst) { } const uint32_t image_type = _.GetOperandTypeId(inst, 2); - if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image to be of type OpTypeImage"; } @@ -1390,7 +1447,7 @@ spv_result_t ValidateImageFetch(ValidationState_t& _, const Instruction* inst) { << "Corrupt image type definition"; } - if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { + if (_.GetIdOpcode(info.sampled_type) != spv::Op::OpTypeVoid) { const uint32_t result_component_type = _.GetComponentType(actual_result_type); if (result_component_type != info.sampled_type) { @@ -1400,7 +1457,7 @@ spv_result_t ValidateImageFetch(ValidationState_t& _, const Instruction* inst) { } } - if (info.dim == SpvDimCube) { + if (info.dim == spv::Dim::Cube) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' cannot be Cube"; } @@ -1436,7 +1493,7 @@ spv_result_t ValidateImageGather(ValidationState_t& _, if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) return error; - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); if (!_.IsIntVectorType(actual_result_type) && !_.IsFloatVectorType(actual_result_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -1451,7 +1508,7 @@ spv_result_t ValidateImageGather(ValidationState_t& _, } const uint32_t image_type = _.GetOperandTypeId(inst, 2); - if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeSampledImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Sampled Image to be of type OpTypeSampledImage"; } @@ -1470,8 +1527,9 @@ spv_result_t ValidateImageGather(ValidationState_t& _, << "Gather operation is invalid for multisample image"; } - if (opcode == SpvOpImageDrefGather || opcode == SpvOpImageSparseDrefGather || - _.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { + if (opcode == spv::Op::OpImageDrefGather || + opcode == spv::Op::OpImageSparseDrefGather || + _.GetIdOpcode(info.sampled_type) != spv::Op::OpTypeVoid) { const uint32_t result_component_type = _.GetComponentType(actual_result_type); if (result_component_type != info.sampled_type) { @@ -1481,8 +1539,8 @@ spv_result_t ValidateImageGather(ValidationState_t& _, } } - if (info.dim != SpvDim2D && info.dim != SpvDimCube && - info.dim != SpvDimRect) { + if (info.dim != spv::Dim::Dim2D && info.dim != spv::Dim::Cube && + info.dim != spv::Dim::Rect) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4777) << "Expected Image 'Dim' to be 2D, Cube, or Rect"; @@ -1502,7 +1560,8 @@ spv_result_t ValidateImageGather(ValidationState_t& _, << " components, but given only " << actual_coord_size; } - if (opcode == SpvOpImageGather || opcode == SpvOpImageSparseGather) { + if (opcode == spv::Op::OpImageGather || + opcode == spv::Op::OpImageSparseGather) { const uint32_t component = inst->GetOperandAs(4); const uint32_t component_index_type = _.GetTypeId(component); if (!_.IsIntScalarType(component_index_type) || @@ -1519,8 +1578,8 @@ spv_result_t ValidateImageGather(ValidationState_t& _, } } } else { - assert(opcode == SpvOpImageDrefGather || - opcode == SpvOpImageSparseDrefGather); + assert(opcode == spv::Op::OpImageDrefGather || + opcode == spv::Op::OpImageSparseDrefGather); if (spv_result_t result = ValidateImageDref(_, inst, info)) return result; } @@ -1532,7 +1591,7 @@ spv_result_t ValidateImageGather(ValidationState_t& _, } spv_result_t ValidateImageRead(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); uint32_t actual_result_type = 0; if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { return error; @@ -1557,7 +1616,7 @@ spv_result_t ValidateImageRead(ValidationState_t& _, const Instruction* inst) { } // Check OpenCL below, after we get the image info. const uint32_t image_type = _.GetOperandTypeId(inst, 2); - if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image to be of type OpTypeImage"; } @@ -1591,27 +1650,33 @@ spv_result_t ValidateImageRead(ValidationState_t& _, const Instruction* inst) { } const uint32_t mask = inst->words().size() <= 5 ? 0 : inst->word(5); - if (mask & SpvImageOperandsConstOffsetMask) { + if (mask & uint32_t(spv::ImageOperandsMask::ConstOffset)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "ConstOffset image operand not allowed " << "in the OpenCL environment."; } } - if (info.dim == SpvDimSubpassData) { - if (opcode == SpvOpImageSparseRead) { + if (info.dim == spv::Dim::SubpassData) { + if (opcode == spv::Op::OpImageSparseRead) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Dim SubpassData cannot be used with ImageSparseRead"; } _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - SpvExecutionModelFragment, + spv::ExecutionModel::Fragment, std::string("Dim SubpassData requires Fragment execution model: ") + spvOpcodeString(opcode)); } - if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { + if (info.dim == spv::Dim::TileImageDataEXT) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Dim TileImageDataEXT cannot be used with " + << spvOpcodeString(opcode); + } + + if (_.GetIdOpcode(info.sampled_type) != spv::Op::OpTypeVoid) { const uint32_t result_component_type = _.GetComponentType(actual_result_type); if (result_component_type != info.sampled_type) { @@ -1639,8 +1704,9 @@ spv_result_t ValidateImageRead(ValidationState_t& _, const Instruction* inst) { } if (spvIsVulkanEnv(_.context()->target_env)) { - if (info.format == SpvImageFormatUnknown && info.dim != SpvDimSubpassData && - !_.HasCapability(SpvCapabilityStorageImageReadWithoutFormat)) { + if (info.format == spv::ImageFormat::Unknown && + info.dim != spv::Dim::SubpassData && + !_.HasCapability(spv::Capability::StorageImageReadWithoutFormat)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Capability StorageImageReadWithoutFormat is required to " << "read storage image"; @@ -1656,7 +1722,7 @@ spv_result_t ValidateImageRead(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateImageWrite(ValidationState_t& _, const Instruction* inst) { const uint32_t image_type = _.GetOperandTypeId(inst, 0); - if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image to be of type OpTypeImage"; } @@ -1667,11 +1733,16 @@ spv_result_t ValidateImageWrite(ValidationState_t& _, const Instruction* inst) { << "Corrupt image type definition"; } - if (info.dim == SpvDimSubpassData) { + if (info.dim == spv::Dim::SubpassData) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' cannot be SubpassData"; } + if (info.dim == spv::Dim::TileImageDataEXT) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image 'Dim' cannot be TileImageDataEXT"; + } + if (spv_result_t result = ValidateImageReadWrite(_, inst, info)) return result; @@ -1697,7 +1768,7 @@ spv_result_t ValidateImageWrite(ValidationState_t& _, const Instruction* inst) { << "Expected Texel to be int or float vector or scalar"; } - if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { + if (_.GetIdOpcode(info.sampled_type) != spv::Op::OpTypeVoid) { const uint32_t texel_component_type = _.GetComponentType(texel_type); if (texel_component_type != info.sampled_type) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -1707,8 +1778,9 @@ spv_result_t ValidateImageWrite(ValidationState_t& _, const Instruction* inst) { } if (spvIsVulkanEnv(_.context()->target_env)) { - if (info.format == SpvImageFormatUnknown && info.dim != SpvDimSubpassData && - !_.HasCapability(SpvCapabilityStorageImageWriteWithoutFormat)) { + if (info.format == spv::ImageFormat::Unknown && + info.dim != spv::Dim::SubpassData && + !_.HasCapability(spv::Capability::StorageImageWriteWithoutFormat)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Capability StorageImageWriteWithoutFormat is required to " "write " @@ -1733,7 +1805,7 @@ spv_result_t ValidateImageWrite(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateImage(ValidationState_t& _, const Instruction* inst) { const uint32_t result_type = inst->type_id(); - if (_.GetIdOpcode(result_type) != SpvOpTypeImage) { + if (_.GetIdOpcode(result_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Result Type to be OpTypeImage"; } @@ -1742,7 +1814,7 @@ spv_result_t ValidateImage(ValidationState_t& _, const Instruction* inst) { const Instruction* sampled_image_type_inst = _.FindDef(sampled_image_type); assert(sampled_image_type_inst); - if (sampled_image_type_inst->opcode() != SpvOpTypeSampledImage) { + if (sampled_image_type_inst->opcode() != spv::Op::OpTypeSampledImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Sample Image to be of type OpTypeSampleImage"; } @@ -1764,7 +1836,7 @@ spv_result_t ValidateImageQuerySizeLod(ValidationState_t& _, } const uint32_t image_type = _.GetOperandTypeId(inst, 2); - if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image to be of type OpTypeImage"; } @@ -1777,14 +1849,14 @@ spv_result_t ValidateImageQuerySizeLod(ValidationState_t& _, uint32_t expected_num_components = info.arrayed; switch (info.dim) { - case SpvDim1D: + case spv::Dim::Dim1D: expected_num_components += 1; break; - case SpvDim2D: - case SpvDimCube: + case spv::Dim::Dim2D: + case spv::Dim::Cube: expected_num_components += 2; break; - case SpvDim3D: + case spv::Dim::Dim3D: expected_num_components += 3; break; default: @@ -1830,7 +1902,7 @@ spv_result_t ValidateImageQuerySize(ValidationState_t& _, } const uint32_t image_type = _.GetOperandTypeId(inst, 2); - if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image to be of type OpTypeImage"; } @@ -1843,16 +1915,16 @@ spv_result_t ValidateImageQuerySize(ValidationState_t& _, uint32_t expected_num_components = info.arrayed; switch (info.dim) { - case SpvDim1D: - case SpvDimBuffer: + case spv::Dim::Dim1D: + case spv::Dim::Buffer: expected_num_components += 1; break; - case SpvDim2D: - case SpvDimCube: - case SpvDimRect: + case spv::Dim::Dim2D: + case spv::Dim::Cube: + case spv::Dim::Rect: expected_num_components += 2; break; - case SpvDim3D: + case spv::Dim::Dim3D: expected_num_components += 3; break; default: @@ -1860,8 +1932,8 @@ spv_result_t ValidateImageQuerySize(ValidationState_t& _, << "Image 'Dim' must be 1D, Buffer, 2D, Cube, 3D or Rect"; } - if (info.dim == SpvDim1D || info.dim == SpvDim2D || info.dim == SpvDim3D || - info.dim == SpvDimCube) { + if (info.dim == spv::Dim::Dim1D || info.dim == spv::Dim::Dim2D || + info.dim == spv::Dim::Dim3D || info.dim == spv::Dim::Cube) { if (info.multisampled != 1 && info.sampled != 0 && info.sampled != 2) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image must have either 'MS'=1 or 'Sampled'=0 or 'Sampled'=2"; @@ -1885,10 +1957,22 @@ spv_result_t ValidateImageQueryFormatOrOrder(ValidationState_t& _, << "Expected Result Type to be int scalar type"; } - if (_.GetIdOpcode(_.GetOperandTypeId(inst, 2)) != SpvOpTypeImage) { + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected operand to be of type OpTypeImage"; } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + if (info.dim == spv::Dim::TileImageDataEXT) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image 'Dim' cannot be TileImageDataEXT"; + } return SPV_SUCCESS; } @@ -1896,9 +1980,9 @@ spv_result_t ValidateImageQueryLod(ValidationState_t& _, const Instruction* inst) { _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [&](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelFragment && - model != SpvExecutionModelGLCompute) { + [&](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::Fragment && + model != spv::ExecutionModel::GLCompute) { if (message) { *message = std::string( "OpImageQueryLod requires Fragment or GLCompute execution " @@ -1914,10 +1998,10 @@ spv_result_t ValidateImageQueryLod(ValidationState_t& _, std::string* message) { const auto* models = state.GetExecutionModels(entry_point->id()); const auto* modes = state.GetExecutionModes(entry_point->id()); - if (models->find(SpvExecutionModelGLCompute) != models->end() && - modes->find(SpvExecutionModeDerivativeGroupLinearNV) == + if (models->find(spv::ExecutionModel::GLCompute) != models->end() && + modes->find(spv::ExecutionMode::DerivativeGroupLinearNV) == modes->end() && - modes->find(SpvExecutionModeDerivativeGroupQuadsNV) == + modes->find(spv::ExecutionMode::DerivativeGroupQuadsNV) == modes->end()) { if (message) { *message = std::string( @@ -1942,7 +2026,7 @@ spv_result_t ValidateImageQueryLod(ValidationState_t& _, } const uint32_t image_type = _.GetOperandTypeId(inst, 2); - if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeSampledImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image operand to be of type OpTypeSampledImage"; } @@ -1953,14 +2037,14 @@ spv_result_t ValidateImageQueryLod(ValidationState_t& _, << "Corrupt image type definition"; } - if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && - info.dim != SpvDimCube) { + if (info.dim != spv::Dim::Dim1D && info.dim != spv::Dim::Dim2D && + info.dim != spv::Dim::Dim3D && info.dim != spv::Dim::Cube) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' must be 1D, 2D, 3D or Cube"; } const uint32_t coord_type = _.GetOperandTypeId(inst, 3); - if (_.HasCapability(SpvCapabilityKernel)) { + if (_.HasCapability(spv::Capability::Kernel)) { if (!_.IsFloatScalarOrVectorType(coord_type) && !_.IsIntScalarOrVectorType(coord_type)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -1981,11 +2065,11 @@ spv_result_t ValidateImageQueryLod(ValidationState_t& _, << " components, but given only " << actual_coord_size; } - // The operad is a sampled image. + // The operand is a sampled image. // The sampled image type is already checked to be parameterized by an image // type with Sampled=0 or Sampled=1. Vulkan bans Sampled=0, and so we have // Sampled=1. So the validator already enforces Vulkan VUID 4659: - // OpImageQuerySizeLod must only consume an “Image†operand whose type has + // OpImageQuerySizeLod must only consume an "Image" operand whose type has // its "Sampled" operand set to 1 return SPV_SUCCESS; } @@ -2005,7 +2089,7 @@ spv_result_t ValidateImageQueryLevelsOrSamples(ValidationState_t& _, } const uint32_t image_type = _.GetOperandTypeId(inst, 2); - if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Image to be of type OpTypeImage"; } @@ -2016,10 +2100,10 @@ spv_result_t ValidateImageQueryLevelsOrSamples(ValidationState_t& _, << "Corrupt image type definition"; } - const SpvOp opcode = inst->opcode(); - if (opcode == SpvOpImageQueryLevels) { - if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && - info.dim != SpvDimCube) { + const spv::Op opcode = inst->opcode(); + if (opcode == spv::Op::OpImageQueryLevels) { + if (info.dim != spv::Dim::Dim1D && info.dim != spv::Dim::Dim2D && + info.dim != spv::Dim::Dim3D && info.dim != spv::Dim::Cube) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' must be 1D, 2D, 3D or Cube"; } @@ -2033,8 +2117,8 @@ spv_result_t ValidateImageQueryLevelsOrSamples(ValidationState_t& _, } } } else { - assert(opcode == SpvOpImageQuerySamples); - if (info.dim != SpvDim2D) { + assert(opcode == spv::Op::OpImageQuerySamples); + if (info.dim != spv::Dim::Dim2D) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' must be 2D"; } @@ -2061,17 +2145,67 @@ spv_result_t ValidateImageSparseTexelsResident(ValidationState_t& _, return SPV_SUCCESS; } +spv_result_t ValidateImageProcessingQCOMDecoration(ValidationState_t& _, int id, + spv::Decoration decor) { + const Instruction* si_inst = nullptr; + const Instruction* ld_inst = _.FindDef(id); + if (ld_inst->opcode() == spv::Op::OpSampledImage) { + si_inst = ld_inst; + int t_idx = si_inst->GetOperandAs(2); // texture + ld_inst = _.FindDef(t_idx); + } + if (ld_inst->opcode() != spv::Op::OpLoad) { + return _.diag(SPV_ERROR_INVALID_DATA, ld_inst) << "Expect to see OpLoad"; + } + int texture_id = ld_inst->GetOperandAs(2); // variable to load + if (!_.HasDecoration(texture_id, decor)) { + return _.diag(SPV_ERROR_INVALID_DATA, ld_inst) + << "Missing decoration WeightTextureQCOM/BlockMatchTextureQCOM"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateImageProcessingQCOM(ValidationState_t& _, + const Instruction* inst) { + spv_result_t res = SPV_SUCCESS; + const spv::Op opcode = inst->opcode(); + switch (opcode) { + case spv::Op::OpImageSampleWeightedQCOM: { + int wi_idx = inst->GetOperandAs(4); // weight + res = ValidateImageProcessingQCOMDecoration( + _, wi_idx, spv::Decoration::WeightTextureQCOM); + break; + } + case spv::Op::OpImageBlockMatchSSDQCOM: + case spv::Op::OpImageBlockMatchSADQCOM: { + int tgt_idx = inst->GetOperandAs(2); // target + res = ValidateImageProcessingQCOMDecoration( + _, tgt_idx, spv::Decoration::BlockMatchTextureQCOM); + if (res != SPV_SUCCESS) break; + int ref_idx = inst->GetOperandAs(4); // reference + res = ValidateImageProcessingQCOMDecoration( + _, ref_idx, spv::Decoration::BlockMatchTextureQCOM); + break; + } + default: + break; + } + + return res; +} + } // namespace // Validates correctness of image instructions. spv_result_t ImagePass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); if (IsImplicitLod(opcode)) { _.function(inst->function()->id()) - ->RegisterExecutionModelLimitation([opcode](SpvExecutionModel model, + ->RegisterExecutionModelLimitation([opcode](spv::ExecutionModel model, std::string* message) { - if (model != SpvExecutionModelFragment && - model != SpvExecutionModelGLCompute) { + if (model != spv::ExecutionModel::Fragment && + model != spv::ExecutionModel::GLCompute) { if (message) { *message = std::string( @@ -2090,11 +2224,11 @@ spv_result_t ImagePass(ValidationState_t& _, const Instruction* inst) { const auto* models = state.GetExecutionModels(entry_point->id()); const auto* modes = state.GetExecutionModes(entry_point->id()); if (models && - models->find(SpvExecutionModelGLCompute) != models->end() && + models->find(spv::ExecutionModel::GLCompute) != models->end() && (!modes || - (modes->find(SpvExecutionModeDerivativeGroupLinearNV) == + (modes->find(spv::ExecutionMode::DerivativeGroupLinearNV) == modes->end() && - modes->find(SpvExecutionModeDerivativeGroupQuadsNV) == + modes->find(spv::ExecutionMode::DerivativeGroupQuadsNV) == modes->end()))) { if (message) { *message = @@ -2111,79 +2245,169 @@ spv_result_t ImagePass(ValidationState_t& _, const Instruction* inst) { } switch (opcode) { - case SpvOpTypeImage: + case spv::Op::OpTypeImage: return ValidateTypeImage(_, inst); - case SpvOpTypeSampledImage: + case spv::Op::OpTypeSampledImage: return ValidateTypeSampledImage(_, inst); - case SpvOpSampledImage: + case spv::Op::OpSampledImage: return ValidateSampledImage(_, inst); - case SpvOpImageTexelPointer: + case spv::Op::OpImageTexelPointer: return ValidateImageTexelPointer(_, inst); - case SpvOpImageSampleImplicitLod: - case SpvOpImageSampleExplicitLod: - case SpvOpImageSampleProjImplicitLod: - case SpvOpImageSampleProjExplicitLod: - case SpvOpImageSparseSampleImplicitLod: - case SpvOpImageSparseSampleExplicitLod: + case spv::Op::OpImageSampleImplicitLod: + case spv::Op::OpImageSampleExplicitLod: + case spv::Op::OpImageSampleProjImplicitLod: + case spv::Op::OpImageSampleProjExplicitLod: + case spv::Op::OpImageSparseSampleImplicitLod: + case spv::Op::OpImageSparseSampleExplicitLod: return ValidateImageLod(_, inst); - case SpvOpImageSampleDrefImplicitLod: - case SpvOpImageSampleDrefExplicitLod: - case SpvOpImageSampleProjDrefImplicitLod: - case SpvOpImageSampleProjDrefExplicitLod: - case SpvOpImageSparseSampleDrefImplicitLod: - case SpvOpImageSparseSampleDrefExplicitLod: + case spv::Op::OpImageSampleDrefImplicitLod: + case spv::Op::OpImageSampleDrefExplicitLod: + case spv::Op::OpImageSampleProjDrefImplicitLod: + case spv::Op::OpImageSampleProjDrefExplicitLod: + case spv::Op::OpImageSparseSampleDrefImplicitLod: + case spv::Op::OpImageSparseSampleDrefExplicitLod: return ValidateImageDrefLod(_, inst); - case SpvOpImageFetch: - case SpvOpImageSparseFetch: + case spv::Op::OpImageFetch: + case spv::Op::OpImageSparseFetch: return ValidateImageFetch(_, inst); - case SpvOpImageGather: - case SpvOpImageDrefGather: - case SpvOpImageSparseGather: - case SpvOpImageSparseDrefGather: + case spv::Op::OpImageGather: + case spv::Op::OpImageDrefGather: + case spv::Op::OpImageSparseGather: + case spv::Op::OpImageSparseDrefGather: return ValidateImageGather(_, inst); - case SpvOpImageRead: - case SpvOpImageSparseRead: + case spv::Op::OpImageRead: + case spv::Op::OpImageSparseRead: return ValidateImageRead(_, inst); - case SpvOpImageWrite: + case spv::Op::OpImageWrite: return ValidateImageWrite(_, inst); - case SpvOpImage: + case spv::Op::OpImage: return ValidateImage(_, inst); - case SpvOpImageQueryFormat: - case SpvOpImageQueryOrder: + case spv::Op::OpImageQueryFormat: + case spv::Op::OpImageQueryOrder: return ValidateImageQueryFormatOrOrder(_, inst); - case SpvOpImageQuerySizeLod: + case spv::Op::OpImageQuerySizeLod: return ValidateImageQuerySizeLod(_, inst); - case SpvOpImageQuerySize: + case spv::Op::OpImageQuerySize: return ValidateImageQuerySize(_, inst); - case SpvOpImageQueryLod: + case spv::Op::OpImageQueryLod: return ValidateImageQueryLod(_, inst); - case SpvOpImageQueryLevels: - case SpvOpImageQuerySamples: + case spv::Op::OpImageQueryLevels: + case spv::Op::OpImageQuerySamples: return ValidateImageQueryLevelsOrSamples(_, inst); - case SpvOpImageSparseSampleProjImplicitLod: - case SpvOpImageSparseSampleProjExplicitLod: - case SpvOpImageSparseSampleProjDrefImplicitLod: - case SpvOpImageSparseSampleProjDrefExplicitLod: + case spv::Op::OpImageSparseSampleProjImplicitLod: + case spv::Op::OpImageSparseSampleProjExplicitLod: + case spv::Op::OpImageSparseSampleProjDrefImplicitLod: + case spv::Op::OpImageSparseSampleProjDrefExplicitLod: return ValidateImageSparseLod(_, inst); - case SpvOpImageSparseTexelsResident: + case spv::Op::OpImageSparseTexelsResident: return ValidateImageSparseTexelsResident(_, inst); + case spv::Op::OpImageSampleWeightedQCOM: + case spv::Op::OpImageBoxFilterQCOM: + case spv::Op::OpImageBlockMatchSSDQCOM: + case spv::Op::OpImageBlockMatchSADQCOM: + return ValidateImageProcessingQCOM(_, inst); + + default: + break; + } + + return SPV_SUCCESS; +} + +bool IsImageInstruction(const spv::Op opcode) { + switch (opcode) { + case spv::Op::OpImageSampleImplicitLod: + case spv::Op::OpImageSampleDrefImplicitLod: + case spv::Op::OpImageSampleProjImplicitLod: + case spv::Op::OpImageSampleProjDrefImplicitLod: + case spv::Op::OpImageSparseSampleImplicitLod: + case spv::Op::OpImageSparseSampleDrefImplicitLod: + case spv::Op::OpImageSparseSampleProjImplicitLod: + case spv::Op::OpImageSparseSampleProjDrefImplicitLod: + + case spv::Op::OpImageSampleExplicitLod: + case spv::Op::OpImageSampleDrefExplicitLod: + case spv::Op::OpImageSampleProjExplicitLod: + case spv::Op::OpImageSampleProjDrefExplicitLod: + case spv::Op::OpImageSparseSampleExplicitLod: + case spv::Op::OpImageSparseSampleDrefExplicitLod: + case spv::Op::OpImageSparseSampleProjExplicitLod: + case spv::Op::OpImageSparseSampleProjDrefExplicitLod: + + case spv::Op::OpImage: + case spv::Op::OpImageFetch: + case spv::Op::OpImageSparseFetch: + case spv::Op::OpImageGather: + case spv::Op::OpImageDrefGather: + case spv::Op::OpImageSparseGather: + case spv::Op::OpImageSparseDrefGather: + case spv::Op::OpImageRead: + case spv::Op::OpImageSparseRead: + case spv::Op::OpImageWrite: + + case spv::Op::OpImageQueryFormat: + case spv::Op::OpImageQueryOrder: + case spv::Op::OpImageQuerySizeLod: + case spv::Op::OpImageQuerySize: + case spv::Op::OpImageQueryLod: + case spv::Op::OpImageQueryLevels: + case spv::Op::OpImageQuerySamples: + + case spv::Op::OpImageSampleWeightedQCOM: + case spv::Op::OpImageBoxFilterQCOM: + case spv::Op::OpImageBlockMatchSSDQCOM: + case spv::Op::OpImageBlockMatchSADQCOM: + return true; default: break; } + return false; +} +spv_result_t ValidateQCOMImageProcessingTextureUsages(ValidationState_t& _, + const Instruction* inst) { + const spv::Op opcode = inst->opcode(); + if (!IsImageInstruction(opcode)) return SPV_SUCCESS; + + switch (opcode) { + case spv::Op::OpImageSampleWeightedQCOM: + case spv::Op::OpImageBoxFilterQCOM: + case spv::Op::OpImageBlockMatchSSDQCOM: + case spv::Op::OpImageBlockMatchSADQCOM: + break; + default: + for (size_t i = 0; i < inst->operands().size(); ++i) { + int id = inst->GetOperandAs(i); + const Instruction* operand_inst = _.FindDef(id); + if (operand_inst == nullptr) continue; + if (operand_inst->opcode() == spv::Op::OpLoad) { + if (_.IsQCOMImageProcessingTextureConsumer(id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Illegal use of QCOM image processing decorated texture"; + } + } + if (operand_inst->opcode() == spv::Op::OpSampledImage) { + if (_.IsQCOMImageProcessingTextureConsumer(id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Illegal use of QCOM image processing decorated texture"; + } + } + } + break; + } return SPV_SUCCESS; } diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_instruction.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_instruction.cpp index 767c0cee..8710ffa4 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_instruction.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_instruction.cpp @@ -14,26 +14,20 @@ // Performs validation on instructions that appear inside of a SPIR-V block. -#include #include -#include #include #include #include -#include "source/binary.h" -#include "source/diagnostic.h" #include "source/enum_set.h" #include "source/enum_string_mapping.h" #include "source/extensions.h" #include "source/opcode.h" #include "source/operand.h" #include "source/spirv_constant.h" -#include "source/spirv_definition.h" #include "source/spirv_target_env.h" #include "source/spirv_validator_options.h" #include "source/util/string_utils.h" -#include "source/val/function.h" #include "source/val/validate.h" #include "source/val/validation_state.h" @@ -44,14 +38,14 @@ namespace { std::string ToString(const CapabilitySet& capabilities, const AssemblyGrammar& grammar) { std::stringstream ss; - capabilities.ForEach([&grammar, &ss](SpvCapability cap) { + for (auto capability : capabilities) { spv_operand_desc desc; - if (SPV_SUCCESS == - grammar.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, cap, &desc)) + if (SPV_SUCCESS == grammar.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, + uint32_t(capability), &desc)) ss << desc->name << " "; else - ss << cap << " "; - }); + ss << uint32_t(capability) << " "; + } return ss.str(); } @@ -60,18 +54,18 @@ std::string ToString(const CapabilitySet& capabilities, // the opcode may only be used if at least one of the capabilities is specified // by the module. CapabilitySet EnablingCapabilitiesForOp(const ValidationState_t& state, - SpvOp opcode) { + spv::Op opcode) { // Exceptions for SPV_AMD_shader_ballot switch (opcode) { // Normally these would require Group capability - case SpvOpGroupIAddNonUniformAMD: - case SpvOpGroupFAddNonUniformAMD: - case SpvOpGroupFMinNonUniformAMD: - case SpvOpGroupUMinNonUniformAMD: - case SpvOpGroupSMinNonUniformAMD: - case SpvOpGroupFMaxNonUniformAMD: - case SpvOpGroupUMaxNonUniformAMD: - case SpvOpGroupSMaxNonUniformAMD: + case spv::Op::OpGroupIAddNonUniformAMD: + case spv::Op::OpGroupFAddNonUniformAMD: + case spv::Op::OpGroupFMinNonUniformAMD: + case spv::Op::OpGroupUMinNonUniformAMD: + case spv::Op::OpGroupSMinNonUniformAMD: + case spv::Op::OpGroupFMaxNonUniformAMD: + case spv::Op::OpGroupUMaxNonUniformAMD: + case spv::Op::OpGroupSMaxNonUniformAMD: if (state.HasExtension(kSPV_AMD_shader_ballot)) return CapabilitySet(); break; default: @@ -151,10 +145,10 @@ spv_result_t CheckRequiredCapabilities(ValidationState_t& state, // not implemented yet. This rule is independent of target environment. // See https://github.com/KhronosGroup/SPIRV-Tools/issues/365 if (operand.type == SPV_OPERAND_TYPE_BUILT_IN) { - switch (word) { - case SpvBuiltInPointSize: - case SpvBuiltInClipDistance: - case SpvBuiltInCullDistance: + switch (spv::BuiltIn(word)) { + case spv::BuiltIn::PointSize: + case spv::BuiltIn::ClipDistance: + case spv::BuiltIn::CullDistance: return SPV_SUCCESS; default: break; @@ -166,7 +160,7 @@ spv_result_t CheckRequiredCapabilities(ValidationState_t& state, } } else if (operand.type == SPV_OPERAND_TYPE_GROUP_OPERATION && state.features().group_ops_reduce_and_scans && - (word <= uint32_t(SpvGroupOperationExclusiveScan))) { + (word <= uint32_t(spv::GroupOperation::ExclusiveScan))) { // Allow certain group operations if requested. return SPV_SUCCESS; } @@ -178,15 +172,17 @@ spv_result_t CheckRequiredCapabilities(ValidationState_t& state, if (lookup_result == SPV_SUCCESS) { // Allow FPRoundingMode decoration if requested. if (operand.type == SPV_OPERAND_TYPE_DECORATION && - operand_desc->value == SpvDecorationFPRoundingMode) { + spv::Decoration(operand_desc->value) == + spv::Decoration::FPRoundingMode) { if (state.features().free_fp_rounding_mode) return SPV_SUCCESS; // Vulkan API requires more capabilities on rounding mode. if (spvIsVulkanEnv(state.context()->target_env)) { - enabling_capabilities.Add(SpvCapabilityStorageUniformBufferBlock16); - enabling_capabilities.Add(SpvCapabilityStorageUniform16); - enabling_capabilities.Add(SpvCapabilityStoragePushConstant16); - enabling_capabilities.Add(SpvCapabilityStorageInputOutput16); + enabling_capabilities.insert( + spv::Capability::StorageUniformBufferBlock16); + enabling_capabilities.insert(spv::Capability::StorageUniform16); + enabling_capabilities.insert(spv::Capability::StoragePushConstant16); + enabling_capabilities.insert(spv::Capability::StorageInputOutput16); } } else { enabling_capabilities = state.grammar().filterCapsAgainstTargetEnv( @@ -197,10 +193,10 @@ spv_result_t CheckRequiredCapabilities(ValidationState_t& state, // registers a capability with the module *before* checking capabilities. // So in the case of an OpCapability instruction, don't bother checking // enablement by another capability. - if (inst->opcode() != SpvOpCapability) { + if (inst->opcode() != spv::Op::OpCapability) { const bool enabled_by_cap = state.HasAnyOfCapabilities(enabling_capabilities); - if (!enabling_capabilities.IsEmpty() && !enabled_by_cap) { + if (!enabling_capabilities.empty() && !enabled_by_cap) { return state.diag(SPV_ERROR_INVALID_CAPABILITY, inst) << "Operand " << which_operand << " of " << spvOpcodeString(inst->opcode()) @@ -218,14 +214,14 @@ spv_result_t CheckRequiredCapabilities(ValidationState_t& state, // is explicitly reserved in the SPIR-V core spec. Otherwise return // SPV_SUCCESS. spv_result_t ReservedCheck(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); switch (opcode) { // These instructions are enabled by a capability, but should never // be used anyway. - case SpvOpImageSparseSampleProjImplicitLod: - case SpvOpImageSparseSampleProjExplicitLod: - case SpvOpImageSparseSampleProjDrefImplicitLod: - case SpvOpImageSparseSampleProjDrefExplicitLod: { + case spv::Op::OpImageSparseSampleProjImplicitLod: + case spv::Op::OpImageSparseSampleProjExplicitLod: + case spv::Op::OpImageSparseSampleProjDrefImplicitLod: + case spv::Op::OpImageSparseSampleProjDrefExplicitLod: { spv_opcode_desc inst_desc; _.grammar().lookupOpcode(opcode, &inst_desc); return _.diag(SPV_ERROR_INVALID_BINARY, inst) @@ -241,7 +237,7 @@ spv_result_t ReservedCheck(ValidationState_t& _, const Instruction* inst) { // instruction is invalid because the required capability isn't declared // in the module. spv_result_t CapabilityCheck(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); CapabilitySet opcode_caps = EnablingCapabilitiesForOp(_, opcode); if (!_.HasAnyOfCapabilities(opcode_caps)) { return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) @@ -299,7 +295,7 @@ spv_result_t VersionCheck(ValidationState_t& _, const Instruction* inst) { // OpTerminateInvocation is special because it is enabled by Shader // capability, but also requires an extension and/or version check. const bool capability_check_is_sufficient = - inst->opcode() != SpvOpTerminateInvocation; + inst->opcode() != spv::Op::OpTerminateInvocation; if (capability_check_is_sufficient && (inst_desc->numCapabilities > 0u)) { // We already checked that the direct capability dependency has been @@ -308,7 +304,7 @@ spv_result_t VersionCheck(ValidationState_t& _, const Instruction* inst) { } ExtensionSet exts(inst_desc->numExtensions, inst_desc->extensions); - if (exts.IsEmpty()) { + if (exts.empty()) { // If no extensions can enable this instruction, then emit error // messages only concerning core SPIR-V versions if errors happen. if (min_version == ~0u) { @@ -357,7 +353,7 @@ spv_result_t LimitCheckIdBound(ValidationState_t& _, const Instruction* inst) { // Checks that the number of OpTypeStruct members is within the limit. spv_result_t LimitCheckStruct(ValidationState_t& _, const Instruction* inst) { - if (SpvOpTypeStruct != inst->opcode()) { + if (spv::Op::OpTypeStruct != inst->opcode()) { return SPV_SUCCESS; } @@ -382,7 +378,7 @@ spv_result_t LimitCheckStruct(ValidationState_t& _, const Instruction* inst) { for (size_t word_i = 2; word_i < inst->words().size(); ++word_i) { auto member = inst->word(word_i); auto memberTypeInstr = _.FindDef(member); - if (memberTypeInstr && SpvOpTypeStruct == memberTypeInstr->opcode()) { + if (memberTypeInstr && spv::Op::OpTypeStruct == memberTypeInstr->opcode()) { max_member_depth = std::max( max_member_depth, _.struct_nesting_depth(memberTypeInstr->id())); } @@ -402,7 +398,7 @@ spv_result_t LimitCheckStruct(ValidationState_t& _, const Instruction* inst) { // Checks that the number of (literal, label) pairs in OpSwitch is within // the limit. spv_result_t LimitCheckSwitch(ValidationState_t& _, const Instruction* inst) { - if (SpvOpSwitch == inst->opcode()) { + if (spv::Op::OpSwitch == inst->opcode()) { // The instruction syntax is as follows: // OpSwitch literal label literal label ... // literal,label pairs come after the first 2 operands. @@ -422,8 +418,8 @@ spv_result_t LimitCheckSwitch(ValidationState_t& _, const Instruction* inst) { // Ensure the number of variables of the given class does not exceed the // limit. spv_result_t LimitCheckNumVars(ValidationState_t& _, const uint32_t var_id, - const SpvStorageClass storage_class) { - if (SpvStorageClassFunction == storage_class) { + const spv::StorageClass storage_class) { + if (spv::StorageClass::Function == storage_class) { _.registerLocalVariable(var_id); const uint32_t num_local_vars_limit = _.options()->universal_limits_.max_local_variables; @@ -462,29 +458,29 @@ spv_result_t CheckIfKnownExtension(ValidationState_t& _, } // namespace spv_result_t InstructionPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); - if (opcode == SpvOpExtension) { + const spv::Op opcode = inst->opcode(); + if (opcode == spv::Op::OpExtension) { CheckIfKnownExtension(_, inst); - } else if (opcode == SpvOpCapability) { - _.RegisterCapability(inst->GetOperandAs(0)); - } else if (opcode == SpvOpMemoryModel) { + } else if (opcode == spv::Op::OpCapability) { + _.RegisterCapability(inst->GetOperandAs(0)); + } else if (opcode == spv::Op::OpMemoryModel) { if (_.has_memory_model_specified()) { return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) << "OpMemoryModel should only be provided once."; } - _.set_addressing_model(inst->GetOperandAs(0)); - _.set_memory_model(inst->GetOperandAs(1)); - } else if (opcode == SpvOpExecutionMode) { + _.set_addressing_model(inst->GetOperandAs(0)); + _.set_memory_model(inst->GetOperandAs(1)); + } else if (opcode == spv::Op::OpExecutionMode) { const uint32_t entry_point = inst->word(1); _.RegisterExecutionModeForEntryPoint(entry_point, - SpvExecutionMode(inst->word(2))); - } else if (opcode == SpvOpVariable) { - const auto storage_class = inst->GetOperandAs(2); + spv::ExecutionMode(inst->word(2))); + } else if (opcode == spv::Op::OpVariable) { + const auto storage_class = inst->GetOperandAs(2); if (auto error = LimitCheckNumVars(_, inst->id(), storage_class)) { return error; } - } else if (opcode == SpvOpSamplerImageAddressingModeNV) { - if (!_.HasCapability(SpvCapabilityBindlessTextureNV)) { + } else if (opcode == spv::Op::OpSamplerImageAddressingModeNV) { + if (!_.HasCapability(spv::Capability::BindlessTextureNV)) { return _.diag(SPV_ERROR_MISSING_EXTENSION, inst) << "OpSamplerImageAddressingModeNV supported only with extension " "SPV_NV_bindless_texture"; diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_interfaces.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_interfaces.cpp index 7f2d6488..291b4b82 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_interfaces.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_interfaces.cpp @@ -15,7 +15,6 @@ #include #include -#include "source/diagnostic.h" #include "source/spirv_constant.h" #include "source/spirv_target_env.h" #include "source/val/function.h" @@ -35,12 +34,15 @@ const uint32_t kMaxLocations = 4096 * 4; bool is_interface_variable(const Instruction* inst, bool is_spv_1_4) { if (is_spv_1_4) { // Starting in SPIR-V 1.4, all global variables are interface variables. - return inst->opcode() == SpvOpVariable && - inst->word(3u) != SpvStorageClassFunction; + return inst->opcode() == spv::Op::OpVariable && + inst->GetOperandAs(2u) != + spv::StorageClass::Function; } else { - return inst->opcode() == SpvOpVariable && - (inst->word(3u) == SpvStorageClassInput || - inst->word(3u) == SpvStorageClassOutput); + return inst->opcode() == spv::Op::OpVariable && + (inst->GetOperandAs(2u) == + spv::StorageClass::Input || + inst->GetOperandAs(2u) == + spv::StorageClass::Output); } } @@ -114,29 +116,30 @@ spv_result_t NumConsumedLocations(ValidationState_t& _, const Instruction* type, uint32_t* num_locations) { *num_locations = 0; switch (type->opcode()) { - case SpvOpTypeInt: - case SpvOpTypeFloat: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: // Scalars always consume a single location. *num_locations = 1; break; - case SpvOpTypeVector: + case spv::Op::OpTypeVector: // 3- and 4-component 64-bit vectors consume two locations. - if ((_.ContainsSizedIntOrFloatType(type->id(), SpvOpTypeInt, 64) || - _.ContainsSizedIntOrFloatType(type->id(), SpvOpTypeFloat, 64)) && + if ((_.ContainsSizedIntOrFloatType(type->id(), spv::Op::OpTypeInt, 64) || + _.ContainsSizedIntOrFloatType(type->id(), spv::Op::OpTypeFloat, + 64)) && (type->GetOperandAs(2) > 2)) { *num_locations = 2; } else { *num_locations = 1; } break; - case SpvOpTypeMatrix: + case spv::Op::OpTypeMatrix: // Matrices consume locations equal to the underlying vector type for // each column. NumConsumedLocations(_, _.FindDef(type->GetOperandAs(1)), num_locations); *num_locations *= type->GetOperandAs(2); break; - case SpvOpTypeArray: { + case spv::Op::OpTypeArray: { // Arrays consume locations equal to the underlying type times the number // of elements in the vector. NumConsumedLocations(_, _.FindDef(type->GetOperandAs(1)), @@ -150,9 +153,9 @@ spv_result_t NumConsumedLocations(ValidationState_t& _, const Instruction* type, if (is_int && is_const) *num_locations *= value; break; } - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { // Members cannot have location decorations at this point. - if (_.HasDecoration(type->id(), SpvDecorationLocation)) { + if (_.HasDecoration(type->id(), spv::Decoration::Location)) { return _.diag(SPV_ERROR_INVALID_DATA, type) << _.VkErrorID(4918) << "Members cannot be assigned a location"; } @@ -170,8 +173,19 @@ spv_result_t NumConsumedLocations(ValidationState_t& _, const Instruction* type, } break; } + case spv::Op::OpTypePointer: { + if (_.addressing_model() == + spv::AddressingModel::PhysicalStorageBuffer64 && + type->GetOperandAs(1) == + spv::StorageClass::PhysicalStorageBuffer) { + *num_locations = 1; + break; + } + [[fallthrough]]; + } default: - break; + return _.diag(SPV_ERROR_INVALID_DATA, type) + << "Invalid type to assign a location"; } return SPV_SUCCESS; @@ -182,8 +196,8 @@ spv_result_t NumConsumedLocations(ValidationState_t& _, const Instruction* type, uint32_t NumConsumedComponents(ValidationState_t& _, const Instruction* type) { uint32_t num_components = 0; switch (type->opcode()) { - case SpvOpTypeInt: - case SpvOpTypeFloat: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: // 64-bit types consume two components. if (type->GetOperandAs(1) == 64) { num_components = 2; @@ -191,7 +205,7 @@ uint32_t NumConsumedComponents(ValidationState_t& _, const Instruction* type) { num_components = 1; } break; - case SpvOpTypeVector: + case spv::Op::OpTypeVector: // Vectors consume components equal to the underlying type's consumption // times the number of elements in the vector. Note that 3- and 4-element // vectors cannot have a component decoration (i.e. assumed to be zero). @@ -199,10 +213,18 @@ uint32_t NumConsumedComponents(ValidationState_t& _, const Instruction* type) { NumConsumedComponents(_, _.FindDef(type->GetOperandAs(1))); num_components *= type->GetOperandAs(2); break; - case SpvOpTypeArray: + case spv::Op::OpTypeArray: // Skip the array. return NumConsumedComponents(_, _.FindDef(type->GetOperandAs(1))); + case spv::Op::OpTypePointer: + if (_.addressing_model() == + spv::AddressingModel::PhysicalStorageBuffer64 && + type->GetOperandAs(1) == + spv::StorageClass::PhysicalStorageBuffer) { + return 2; + } + break; default: // This is an error that is validated elsewhere. break; @@ -218,10 +240,10 @@ spv_result_t GetLocationsForVariable( ValidationState_t& _, const Instruction* entry_point, const Instruction* variable, std::unordered_set* locations, std::unordered_set* output_index1_locations) { - const bool is_fragment = entry_point->GetOperandAs(0) == - SpvExecutionModelFragment; + const bool is_fragment = entry_point->GetOperandAs(0) == + spv::ExecutionModel::Fragment; const bool is_output = - variable->GetOperandAs(2) == SpvStorageClassOutput; + variable->GetOperandAs(2) == spv::StorageClass::Output; auto ptr_type_id = variable->GetOperandAs(0); auto ptr_type = _.FindDef(ptr_type_id); auto type_id = ptr_type->GetOperandAs(2); @@ -240,21 +262,21 @@ spv_result_t GetLocationsForVariable( bool has_per_task_nv = false; bool has_per_vertex_khr = false; for (auto& dec : _.id_decorations(variable->id())) { - if (dec.dec_type() == SpvDecorationLocation) { + if (dec.dec_type() == spv::Decoration::Location) { if (has_location && dec.params()[0] != location) { return _.diag(SPV_ERROR_INVALID_DATA, variable) << "Variable has conflicting location decorations"; } has_location = true; location = dec.params()[0]; - } else if (dec.dec_type() == SpvDecorationComponent) { + } else if (dec.dec_type() == spv::Decoration::Component) { if (has_component && dec.params()[0] != component) { return _.diag(SPV_ERROR_INVALID_DATA, variable) << "Variable has conflicting component decorations"; } has_component = true; component = dec.params()[0]; - } else if (dec.dec_type() == SpvDecorationIndex) { + } else if (dec.dec_type() == spv::Decoration::Index) { if (!is_output || !is_fragment) { return _.diag(SPV_ERROR_INVALID_DATA, variable) << "Index can only be applied to Fragment output variables"; @@ -265,22 +287,22 @@ spv_result_t GetLocationsForVariable( } has_index = true; index = dec.params()[0]; - } else if (dec.dec_type() == SpvDecorationBuiltIn) { + } else if (dec.dec_type() == spv::Decoration::BuiltIn) { // Don't check built-ins. return SPV_SUCCESS; - } else if (dec.dec_type() == SpvDecorationPatch) { + } else if (dec.dec_type() == spv::Decoration::Patch) { has_patch = true; - } else if (dec.dec_type() == SpvDecorationPerTaskNV) { + } else if (dec.dec_type() == spv::Decoration::PerTaskNV) { has_per_task_nv = true; - } else if (dec.dec_type() == SpvDecorationPerVertexKHR) { + } else if (dec.dec_type() == spv::Decoration::PerVertexKHR) { if (!is_fragment) { return _.diag(SPV_ERROR_INVALID_DATA, variable) << _.VkErrorID(6777) << "PerVertexKHR can only be applied to Fragment Execution " "Models"; } - if (type->opcode() != SpvOpTypeArray && - type->opcode() != SpvOpTypeRuntimeArray) { + if (type->opcode() != spv::Op::OpTypeArray && + type->opcode() != spv::Op::OpTypeRuntimeArray) { return _.diag(SPV_ERROR_INVALID_DATA, variable) << _.VkErrorID(6778) << "PerVertexKHR must be declared as arrays"; @@ -293,28 +315,28 @@ spv_result_t GetLocationsForVariable( // tessellation control, evaluation and geometry per-vertex inputs have a // layer of arraying that is not included in interface matching. bool is_arrayed = false; - switch (entry_point->GetOperandAs(0)) { - case SpvExecutionModelTessellationControl: + switch (entry_point->GetOperandAs(0)) { + case spv::ExecutionModel::TessellationControl: if (!has_patch) { is_arrayed = true; } break; - case SpvExecutionModelTessellationEvaluation: + case spv::ExecutionModel::TessellationEvaluation: if (!is_output && !has_patch) { is_arrayed = true; } break; - case SpvExecutionModelGeometry: + case spv::ExecutionModel::Geometry: if (!is_output) { is_arrayed = true; } break; - case SpvExecutionModelFragment: + case spv::ExecutionModel::Fragment: if (!is_output && has_per_vertex_khr) { is_arrayed = true; } break; - case SpvExecutionModelMeshNV: + case spv::ExecutionModel::MeshNV: if (is_output && !has_per_task_nv) { is_arrayed = true; } @@ -324,21 +346,21 @@ spv_result_t GetLocationsForVariable( } // Unpack arrayness. - if (is_arrayed && (type->opcode() == SpvOpTypeArray || - type->opcode() == SpvOpTypeRuntimeArray)) { + if (is_arrayed && (type->opcode() == spv::Op::OpTypeArray || + type->opcode() == spv::Op::OpTypeRuntimeArray)) { type_id = type->GetOperandAs(1); type = _.FindDef(type_id); } - if (type->opcode() == SpvOpTypeStruct) { + if (type->opcode() == spv::Op::OpTypeStruct) { // Don't check built-ins. - if (_.HasDecoration(type_id, SpvDecorationBuiltIn)) return SPV_SUCCESS; + if (_.HasDecoration(type_id, spv::Decoration::BuiltIn)) return SPV_SUCCESS; } // Only block-decorated structs don't need a location on the variable. - const bool is_block = _.HasDecoration(type_id, SpvDecorationBlock); + const bool is_block = _.HasDecoration(type_id, spv::Decoration::Block); if (!has_location && !is_block) { - const auto vuid = (type->opcode() == SpvOpTypeStruct) ? 4917 : 4916; + const auto vuid = (type->opcode() == spv::Op::OpTypeStruct) ? 4917 : 4916; return _.diag(SPV_ERROR_INVALID_DATA, variable) << _.VkErrorID(vuid) << "Variable must be decorated with a location"; } @@ -351,7 +373,7 @@ spv_result_t GetLocationsForVariable( uint32_t array_size = 1; // If the variable is still arrayed, mark the locations/components per // index. - if (type->opcode() == SpvOpTypeArray) { + if (type->opcode() == spv::Op::OpTypeArray) { // Determine the array size if possible and get the element type. std::tie(is_int, is_const, array_size) = _.EvalInt32IfConst(type->GetOperandAs(2)); @@ -360,12 +382,12 @@ spv_result_t GetLocationsForVariable( sub_type = _.FindDef(sub_type_id); } - for (uint32_t array_idx = 0; array_idx < array_size; ++array_idx) { - uint32_t num_locations = 0; - if (auto error = NumConsumedLocations(_, sub_type, &num_locations)) - return error; + uint32_t num_locations = 0; + if (auto error = NumConsumedLocations(_, sub_type, &num_locations)) + return error; + uint32_t num_components = NumConsumedComponents(_, sub_type); - uint32_t num_components = NumConsumedComponents(_, sub_type); + for (uint32_t array_idx = 0; array_idx < array_size; ++array_idx) { uint32_t array_location = location + (num_locations * array_idx); uint32_t start = array_location * 4; if (kMaxLocations <= start) { @@ -385,6 +407,7 @@ spv_result_t GetLocationsForVariable( for (uint32_t i = start; i < end; ++i) { if (!locs->insert(i).second) { return _.diag(SPV_ERROR_INVALID_DATA, entry_point) + << (is_output ? _.VkErrorID(8722) : _.VkErrorID(8721)) << "Entry-point has conflicting " << storage_class << " location assignment at location " << i / 4 << ", component " << i % 4; @@ -399,7 +422,7 @@ spv_result_t GetLocationsForVariable( std::unordered_map member_locations; std::unordered_map member_components; for (auto& dec : _.id_decorations(type_id)) { - if (dec.dec_type() == SpvDecorationLocation) { + if (dec.dec_type() == spv::Decoration::Location) { auto where = member_locations.find(dec.struct_member_index()); if (where == member_locations.end()) { member_locations[dec.struct_member_index()] = dec.params()[0]; @@ -408,7 +431,7 @@ spv_result_t GetLocationsForVariable( << "Member index " << dec.struct_member_index() << " has conflicting location assignments"; } - } else if (dec.dec_type() == SpvDecorationComponent) { + } else if (dec.dec_type() == spv::Decoration::Component) { auto where = member_components.find(dec.struct_member_index()); if (where == member_components.end()) { member_components[dec.struct_member_index()] = dec.params()[0]; @@ -447,7 +470,7 @@ spv_result_t GetLocationsForVariable( continue; } - if (member->opcode() == SpvOpTypeArray && num_components >= 1 && + if (member->opcode() == spv::Op::OpTypeArray && num_components >= 1 && num_components < 4) { // When an array has an element that takes less than a location in // size, calculate the used locations in a strided manner. @@ -456,6 +479,7 @@ spv_result_t GetLocationsForVariable( uint32_t check = 4 * l + c; if (!locations->insert(check).second) { return _.diag(SPV_ERROR_INVALID_DATA, entry_point) + << (is_output ? _.VkErrorID(8722) : _.VkErrorID(8721)) << "Entry-point has conflicting " << storage_class << " location assignment at location " << l << ", component " << c; @@ -473,6 +497,7 @@ spv_result_t GetLocationsForVariable( for (uint32_t l = start; l < end; ++l) { if (!locations->insert(l).second) { return _.diag(SPV_ERROR_INVALID_DATA, entry_point) + << (is_output ? _.VkErrorID(8722) : _.VkErrorID(8721)) << "Entry-point has conflicting " << storage_class << " location assignment at location " << l / 4 << ", component " << l % 4; @@ -492,12 +517,12 @@ spv_result_t ValidateLocations(ValidationState_t& _, // TODO(dneto): SPV_NV_ray_tracing also uses locations on interface variables, // in other shader stages. Similarly, the *provisional* version of // SPV_KHR_ray_tracing did as well, but not the final version. - switch (entry_point->GetOperandAs(0)) { - case SpvExecutionModelVertex: - case SpvExecutionModelTessellationControl: - case SpvExecutionModelTessellationEvaluation: - case SpvExecutionModelGeometry: - case SpvExecutionModelFragment: + switch (entry_point->GetOperandAs(0)) { + case spv::ExecutionModel::Vertex: + case spv::ExecutionModel::TessellationControl: + case spv::ExecutionModel::TessellationEvaluation: + case spv::ExecutionModel::Geometry: + case spv::ExecutionModel::Fragment: break; default: return SPV_SUCCESS; @@ -511,9 +536,9 @@ spv_result_t ValidateLocations(ValidationState_t& _, for (uint32_t i = 3; i < entry_point->operands().size(); ++i) { auto interface_id = entry_point->GetOperandAs(i); auto interface_var = _.FindDef(interface_id); - auto storage_class = interface_var->GetOperandAs(2); - if (storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { + auto storage_class = interface_var->GetOperandAs(2); + if (storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { continue; } if (!seen.insert(interface_id).second) { @@ -522,7 +547,7 @@ spv_result_t ValidateLocations(ValidationState_t& _, continue; } - auto locations = (storage_class == SpvStorageClassInput) + auto locations = (storage_class == spv::StorageClass::Input) ? &input_locations : &output_locations_index0; if (auto error = GetLocationsForVariable( @@ -547,12 +572,12 @@ spv_result_t ValidateInterfaces(ValidationState_t& _) { if (spvIsVulkanEnv(_.context()->target_env)) { for (auto& inst : _.ordered_instructions()) { - if (inst.opcode() == SpvOpEntryPoint) { + if (inst.opcode() == spv::Op::OpEntryPoint) { if (auto error = ValidateLocations(_, &inst)) { return error; } } - if (inst.opcode() == SpvOpTypeVoid) break; + if (inst.opcode() == spv::Op::OpTypeVoid) break; } } diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp index 6f951352..dbc1f1e5 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp @@ -14,12 +14,9 @@ // Source code for logical layout validation as described in section 2.4 -#include - #include "DebugInfo.h" #include "NonSemanticShaderDebugInfo100.h" #include "OpenCLDebugInfo100.h" -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/operand.h" #include "source/val/function.h" @@ -35,9 +32,9 @@ namespace { // is part of the current layout section. If it is not then the next sections is // checked. spv_result_t ModuleScopedInstructions(ValidationState_t& _, - const Instruction* inst, SpvOp opcode) { + const Instruction* inst, spv::Op opcode) { switch (opcode) { - case SpvOpExtInst: + case spv::Op::OpExtInst: if (spvExtInstIsDebugInfo(inst->ext_inst_type())) { const uint32_t ext_inst_index = inst->word(4); bool local_debug_info = false; @@ -131,7 +128,7 @@ spv_result_t ModuleScopedInstructions(ValidationState_t& _, switch (_.current_layout_section()) { case kLayoutMemoryModel: - if (opcode != SpvOpMemoryModel) { + if (opcode != spv::Op::OpMemoryModel) { return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) << spvOpcodeString(opcode) << " cannot appear before the memory model instruction"; @@ -154,7 +151,8 @@ spv_result_t ModuleScopedInstructions(ValidationState_t& _, // inside of another function. This stage ends when the first label is // encountered inside of a function. spv_result_t FunctionScopedInstructions(ValidationState_t& _, - const Instruction* inst, SpvOp opcode) { + const Instruction* inst, + spv::Op opcode) { // Make sure we advance into the function definitions when we hit // non-function declaration instructions. if (_.current_layout_section() == kLayoutFunctionDeclarations && @@ -171,12 +169,12 @@ spv_result_t FunctionScopedInstructions(ValidationState_t& _, if (_.IsOpcodeInCurrentLayoutSection(opcode)) { switch (opcode) { - case SpvOpFunction: { + case spv::Op::OpFunction: { if (_.in_function_body()) { return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) << "Cannot declare a function in a function body"; } - auto control_mask = inst->GetOperandAs(2); + auto control_mask = inst->GetOperandAs(2); if (auto error = _.RegisterFunction(inst->id(), inst->type_id(), control_mask, inst->GetOperandAs(3))) @@ -188,7 +186,7 @@ spv_result_t FunctionScopedInstructions(ValidationState_t& _, } } break; - case SpvOpFunctionParameter: + case spv::Op::OpFunctionParameter: if (_.in_function_body() == false) { return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) << "Function parameter instructions must be in a " @@ -204,7 +202,7 @@ spv_result_t FunctionScopedInstructions(ValidationState_t& _, return error; break; - case SpvOpFunctionEnd: + case spv::Op::OpFunctionEnd: if (_.in_function_body() == false) { return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) << "Function end instructions must be in a function body"; @@ -227,10 +225,10 @@ spv_result_t FunctionScopedInstructions(ValidationState_t& _, if (auto error = _.RegisterFunctionEnd()) return error; break; - case SpvOpLine: - case SpvOpNoLine: + case spv::Op::OpLine: + case spv::Op::OpNoLine: break; - case SpvOpLabel: + case spv::Op::OpLabel: // If the label is encountered then the current function is a // definition so set the function to a declaration and update the // module section @@ -244,7 +242,7 @@ spv_result_t FunctionScopedInstructions(ValidationState_t& _, } break; - case SpvOpExtInst: + case spv::Op::OpExtInst: if (spvExtInstIsDebugInfo(inst->ext_inst_type())) { const uint32_t ext_inst_index = inst->word(4); bool local_debug_info = false; @@ -356,7 +354,7 @@ spv_result_t FunctionScopedInstructions(ValidationState_t& _, // NOTE: This function does not handle CFG related validation // Performs logical layout validation. See Section 2.4 spv_result_t ModuleLayoutPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); switch (_.current_layout_section()) { case kLayoutCapabilities: diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_literals.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_literals.cpp index 53aae076..15cc27a9 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_literals.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_literals.cpp @@ -14,13 +14,10 @@ // Validates literal numbers. -#include "source/val/validate.h" - #include -#include "source/diagnostic.h" -#include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools { diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_logicals.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_logicals.cpp index ec1e207b..4479e439 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_logicals.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_logicals.cpp @@ -14,11 +14,9 @@ // Validates correctness of logical SPIR-V instructions. -#include "source/val/validate.h" - -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools { @@ -26,12 +24,12 @@ namespace val { // Validates correctness of logical instructions. spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); const uint32_t result_type = inst->type_id(); switch (opcode) { - case SpvOpAny: - case SpvOpAll: { + case spv::Op::OpAny: + case spv::Op::OpAll: { if (!_.IsBoolScalarType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected bool scalar type as Result Type: " @@ -46,11 +44,11 @@ spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpIsNan: - case SpvOpIsInf: - case SpvOpIsFinite: - case SpvOpIsNormal: - case SpvOpSignBitSet: { + case spv::Op::OpIsNan: + case spv::Op::OpIsInf: + case spv::Op::OpIsFinite: + case spv::Op::OpIsNormal: + case spv::Op::OpSignBitSet: { if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected bool scalar or vector type as Result Type: " @@ -72,21 +70,21 @@ spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpFOrdEqual: - case SpvOpFUnordEqual: - case SpvOpFOrdNotEqual: - case SpvOpFUnordNotEqual: - case SpvOpFOrdLessThan: - case SpvOpFUnordLessThan: - case SpvOpFOrdGreaterThan: - case SpvOpFUnordGreaterThan: - case SpvOpFOrdLessThanEqual: - case SpvOpFUnordLessThanEqual: - case SpvOpFOrdGreaterThanEqual: - case SpvOpFUnordGreaterThanEqual: - case SpvOpLessOrGreater: - case SpvOpOrdered: - case SpvOpUnordered: { + case spv::Op::OpFOrdEqual: + case spv::Op::OpFUnordEqual: + case spv::Op::OpFOrdNotEqual: + case spv::Op::OpFUnordNotEqual: + case spv::Op::OpFOrdLessThan: + case spv::Op::OpFUnordLessThan: + case spv::Op::OpFOrdGreaterThan: + case spv::Op::OpFUnordGreaterThan: + case spv::Op::OpFOrdLessThanEqual: + case spv::Op::OpFUnordLessThanEqual: + case spv::Op::OpFOrdGreaterThanEqual: + case spv::Op::OpFUnordGreaterThanEqual: + case spv::Op::OpLessOrGreater: + case spv::Op::OpOrdered: + case spv::Op::OpUnordered: { if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected bool scalar or vector type as Result Type: " @@ -113,10 +111,10 @@ spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpLogicalEqual: - case SpvOpLogicalNotEqual: - case SpvOpLogicalOr: - case SpvOpLogicalAnd: { + case spv::Op::OpLogicalEqual: + case spv::Op::OpLogicalNotEqual: + case spv::Op::OpLogicalOr: + case spv::Op::OpLogicalAnd: { if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected bool scalar or vector type as Result Type: " @@ -131,7 +129,7 @@ spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpLogicalNot: { + case spv::Op::OpLogicalNot: { if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected bool scalar or vector type as Result Type: " @@ -145,7 +143,7 @@ spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpSelect: { + case spv::Op::OpSelect: { uint32_t dimension = 1; { const Instruction* type_inst = _.FindDef(result_type); @@ -159,10 +157,10 @@ spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { << " type as Result Type: " << spvOpcodeString(opcode); }; - const SpvOp type_opcode = type_inst->opcode(); + const spv::Op type_opcode = type_inst->opcode(); switch (type_opcode) { - case SpvOpTypePointer: { - if (_.addressing_model() == SpvAddressingModelLogical && + case spv::Op::OpTypePointer: { + if (_.addressing_model() == spv::AddressingModel::Logical && !_.features().variable_pointers) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Using pointers with OpSelect requires capability " @@ -170,31 +168,31 @@ spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpTypeSampledImage: - case SpvOpTypeImage: - case SpvOpTypeSampler: { - if (!_.HasCapability(SpvCapabilityBindlessTextureNV)) + case spv::Op::OpTypeSampledImage: + case spv::Op::OpTypeImage: + case spv::Op::OpTypeSampler: { + if (!_.HasCapability(spv::Capability::BindlessTextureNV)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Using image/sampler with OpSelect requires capability " << "BindlessTextureNV"; break; } - case SpvOpTypeVector: { + case spv::Op::OpTypeVector: { dimension = type_inst->word(3); break; } - case SpvOpTypeBool: - case SpvOpTypeInt: - case SpvOpTypeFloat: { + case spv::Op::OpTypeBool: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeFloat: { break; } // Not RuntimeArray because of other rules. - case SpvOpTypeArray: - case SpvOpTypeMatrix: - case SpvOpTypeStruct: { + case spv::Op::OpTypeArray: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeStruct: { if (!composites) return fail(); break; } @@ -235,16 +233,16 @@ spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { } } - case SpvOpIEqual: - case SpvOpINotEqual: - case SpvOpUGreaterThan: - case SpvOpUGreaterThanEqual: - case SpvOpULessThan: - case SpvOpULessThanEqual: - case SpvOpSGreaterThan: - case SpvOpSGreaterThanEqual: - case SpvOpSLessThan: - case SpvOpSLessThanEqual: { + case spv::Op::OpIEqual: + case spv::Op::OpINotEqual: + case spv::Op::OpUGreaterThan: + case spv::Op::OpUGreaterThanEqual: + case spv::Op::OpULessThan: + case spv::Op::OpULessThanEqual: + case spv::Op::OpSGreaterThan: + case spv::Op::OpSGreaterThanEqual: + case spv::Op::OpSLessThan: + case spv::Op::OpSLessThanEqual: { if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected bool scalar or vector type as Result Type: " diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_memory.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_memory.cpp index 074bdb88..5b25eeb3 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_memory.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_memory.cpp @@ -39,13 +39,13 @@ bool HasConflictingMemberOffsets(const std::set&, const std::set&); bool IsAllowedTypeOrArrayOfSame(ValidationState_t& _, const Instruction* type, - std::initializer_list allowed) { + std::initializer_list allowed) { if (std::find(allowed.begin(), allowed.end(), type->opcode()) != allowed.end()) { return true; } - if (type->opcode() == SpvOpTypeArray || - type->opcode() == SpvOpTypeRuntimeArray) { + if (type->opcode() == spv::Op::OpTypeArray || + type->opcode() == spv::Op::OpTypeRuntimeArray) { auto elem_type = _.FindDef(type->word(2)); return std::find(allowed.begin(), allowed.end(), elem_type->opcode()) != allowed.end(); @@ -57,10 +57,10 @@ bool IsAllowedTypeOrArrayOfSame(ValidationState_t& _, const Instruction* type, // validator can tell, have the exact same data layout. bool AreLayoutCompatibleStructs(ValidationState_t& _, const Instruction* type1, const Instruction* type2) { - if (type1->opcode() != SpvOpTypeStruct) { + if (type1->opcode() != spv::Op::OpTypeStruct) { return false; } - if (type2->opcode() != SpvOpTypeStruct) { + if (type2->opcode() != spv::Op::OpTypeStruct) { return false; } @@ -74,9 +74,9 @@ bool AreLayoutCompatibleStructs(ValidationState_t& _, const Instruction* type1, // be OpTypeStruct instructions. bool HaveLayoutCompatibleMembers(ValidationState_t& _, const Instruction* type1, const Instruction* type2) { - assert(type1->opcode() == SpvOpTypeStruct && + assert(type1->opcode() == spv::Op::OpTypeStruct && "type1 must be an OpTypeStruct instruction."); - assert(type2->opcode() == SpvOpTypeStruct && + assert(type2->opcode() == spv::Op::OpTypeStruct && "type2 must be an OpTypeStruct instruction."); const auto& type1_operands = type1->operands(); const auto& type2_operands = type2->operands(); @@ -101,9 +101,9 @@ bool HaveLayoutCompatibleMembers(ValidationState_t& _, const Instruction* type1, // OpTypeStruct instructions. bool HaveSameLayoutDecorations(ValidationState_t& _, const Instruction* type1, const Instruction* type2) { - assert(type1->opcode() == SpvOpTypeStruct && + assert(type1->opcode() == spv::Op::OpTypeStruct && "type1 must be an OpTypeStruct instruction."); - assert(type2->opcode() == SpvOpTypeStruct && + assert(type2->opcode() == spv::Op::OpTypeStruct && "type2 must be an OpTypeStruct instruction."); const std::set& type1_decorations = _.id_decorations(type1->id()); const std::set& type2_decorations = _.id_decorations(type2->id()); @@ -130,11 +130,11 @@ bool HasConflictingMemberOffsets( // type1_decoration. Therefore, it cannot lead to a conflict. for (const Decoration& decoration : type1_decorations) { switch (decoration.dec_type()) { - case SpvDecorationOffset: { + case spv::Decoration::Offset: { // Since these affect the layout of the struct, they must be present // in both structs. auto compare = [&decoration](const Decoration& rhs) { - if (rhs.dec_type() != SpvDecorationOffset) return false; + if (rhs.dec_type() != spv::Decoration::Offset) return false; return decoration.struct_member_index() == rhs.struct_member_index(); }; @@ -163,7 +163,7 @@ bool ContainsInvalidBool(ValidationState_t& _, const Instruction* storage, bool skip_builtin) { if (skip_builtin) { for (const Decoration& decoration : _.id_decorations(storage->id())) { - if (decoration.dec_type() == SpvDecorationBuiltIn) return false; + if (decoration.dec_type() == spv::Decoration::BuiltIn) return false; } } @@ -172,16 +172,16 @@ bool ContainsInvalidBool(ValidationState_t& _, const Instruction* storage, Instruction* elem_type; switch (storage->opcode()) { - case SpvOpTypeBool: + case spv::Op::OpTypeBool: return true; - case SpvOpTypeVector: - case SpvOpTypeMatrix: - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: elem_type_id = storage->GetOperandAs(elem_type_index); elem_type = _.FindDef(elem_type_id); return ContainsInvalidBool(_, elem_type, skip_builtin); - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: for (size_t member_type_index = 1; member_type_index < storage->operands().size(); ++member_type_index) { @@ -203,14 +203,15 @@ bool ContainsCooperativeMatrix(ValidationState_t& _, Instruction* elem_type; switch (storage->opcode()) { - case SpvOpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixKHR: return true; - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: elem_type_id = storage->GetOperandAs(elem_type_index); elem_type = _.FindDef(elem_type_id); return ContainsCooperativeMatrix(_, elem_type); - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: for (size_t member_type_index = 1; member_type_index < storage->operands().size(); ++member_type_index) { @@ -226,33 +227,35 @@ bool ContainsCooperativeMatrix(ValidationState_t& _, return false; } -std::pair GetStorageClass( +std::pair GetStorageClass( ValidationState_t& _, const Instruction* inst) { - SpvStorageClass dst_sc = SpvStorageClassMax; - SpvStorageClass src_sc = SpvStorageClassMax; + spv::StorageClass dst_sc = spv::StorageClass::Max; + spv::StorageClass src_sc = spv::StorageClass::Max; switch (inst->opcode()) { - case SpvOpCooperativeMatrixLoadNV: - case SpvOpLoad: { + case spv::Op::OpCooperativeMatrixLoadNV: + case spv::Op::OpCooperativeMatrixLoadKHR: + case spv::Op::OpLoad: { auto load_pointer = _.FindDef(inst->GetOperandAs(2)); auto load_pointer_type = _.FindDef(load_pointer->type_id()); - dst_sc = load_pointer_type->GetOperandAs(1); + dst_sc = load_pointer_type->GetOperandAs(1); break; } - case SpvOpCooperativeMatrixStoreNV: - case SpvOpStore: { + case spv::Op::OpCooperativeMatrixStoreNV: + case spv::Op::OpCooperativeMatrixStoreKHR: + case spv::Op::OpStore: { auto store_pointer = _.FindDef(inst->GetOperandAs(0)); auto store_pointer_type = _.FindDef(store_pointer->type_id()); - dst_sc = store_pointer_type->GetOperandAs(1); + dst_sc = store_pointer_type->GetOperandAs(1); break; } - case SpvOpCopyMemory: - case SpvOpCopyMemorySized: { + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyMemorySized: { auto dst = _.FindDef(inst->GetOperandAs(0)); auto dst_type = _.FindDef(dst->type_id()); - dst_sc = dst_type->GetOperandAs(1); + dst_sc = dst_type->GetOperandAs(1); auto src = _.FindDef(inst->GetOperandAs(1)); auto src_type = _.FindDef(src->type_id()); - src_sc = src_type->GetOperandAs(1); + src_sc = src_type->GetOperandAs(1); break; } default: @@ -266,9 +269,9 @@ std::pair GetStorageClass( // argument and its implied operands. int MemoryAccessNumWords(uint32_t mask) { int result = 1; // Count the mask - if (mask & SpvMemoryAccessAlignedMask) ++result; - if (mask & SpvMemoryAccessMakePointerAvailableKHRMask) ++result; - if (mask & SpvMemoryAccessMakePointerVisibleKHRMask) ++result; + if (mask & uint32_t(spv::MemoryAccessMask::Aligned)) ++result; + if (mask & uint32_t(spv::MemoryAccessMask::MakePointerAvailableKHR)) ++result; + if (mask & uint32_t(spv::MemoryAccessMask::MakePointerVisibleKHR)) ++result; return result; } @@ -279,8 +282,8 @@ int MemoryAccessNumWords(uint32_t mask) { // OpCooperativeMatrixStoreNV. uint32_t GetMakeAvailableScope(const Instruction* inst, uint32_t mask, uint32_t mask_index) { - assert(mask & SpvMemoryAccessMakePointerAvailableKHRMask); - uint32_t this_bit = uint32_t(SpvMemoryAccessMakePointerAvailableKHRMask); + assert(mask & uint32_t(spv::MemoryAccessMask::MakePointerAvailableKHR)); + uint32_t this_bit = uint32_t(spv::MemoryAccessMask::MakePointerAvailableKHR); uint32_t index = mask_index - 1 + MemoryAccessNumWords(mask & (this_bit | (this_bit - 1))); return inst->GetOperandAs(index); @@ -291,8 +294,8 @@ uint32_t GetMakeAvailableScope(const Instruction* inst, uint32_t mask, // OpCooperativeMatrixStoreNV. uint32_t GetMakeVisibleScope(const Instruction* inst, uint32_t mask, uint32_t mask_index) { - assert(mask & SpvMemoryAccessMakePointerVisibleKHRMask); - uint32_t this_bit = uint32_t(SpvMemoryAccessMakePointerVisibleKHRMask); + assert(mask & uint32_t(spv::MemoryAccessMask::MakePointerVisibleKHR)); + uint32_t this_bit = uint32_t(spv::MemoryAccessMask::MakePointerVisibleKHR); uint32_t index = mask_index - 1 + MemoryAccessNumWords(mask & (this_bit | (this_bit - 1))); return inst->GetOperandAs(index); @@ -303,19 +306,19 @@ bool DoesStructContainRTA(const ValidationState_t& _, const Instruction* inst) { ++member_index) { const auto member_id = inst->GetOperandAs(member_index); const auto member_type = _.FindDef(member_id); - if (member_type->opcode() == SpvOpTypeRuntimeArray) return true; + if (member_type->opcode() == spv::Op::OpTypeRuntimeArray) return true; } return false; } spv_result_t CheckMemoryAccess(ValidationState_t& _, const Instruction* inst, uint32_t index) { - SpvStorageClass dst_sc, src_sc; + spv::StorageClass dst_sc, src_sc; std::tie(dst_sc, src_sc) = GetStorageClass(_, inst); if (inst->operands().size() <= index) { // Cases where lack of some operand is invalid - if (src_sc == SpvStorageClassPhysicalStorageBuffer || - dst_sc == SpvStorageClassPhysicalStorageBuffer) { + if (src_sc == spv::StorageClass::PhysicalStorageBuffer || + dst_sc == spv::StorageClass::PhysicalStorageBuffer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4708) << "Memory accesses with PhysicalStorageBuffer must use Aligned."; @@ -324,14 +327,15 @@ spv_result_t CheckMemoryAccess(ValidationState_t& _, const Instruction* inst, } const uint32_t mask = inst->GetOperandAs(index); - if (mask & SpvMemoryAccessMakePointerAvailableKHRMask) { - if (inst->opcode() == SpvOpLoad || - inst->opcode() == SpvOpCooperativeMatrixLoadNV) { + if (mask & uint32_t(spv::MemoryAccessMask::MakePointerAvailableKHR)) { + if (inst->opcode() == spv::Op::OpLoad || + inst->opcode() == spv::Op::OpCooperativeMatrixLoadNV || + inst->opcode() == spv::Op::OpCooperativeMatrixLoadKHR) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "MakePointerAvailableKHR cannot be used with OpLoad."; } - if (!(mask & SpvMemoryAccessNonPrivatePointerKHRMask)) { + if (!(mask & uint32_t(spv::MemoryAccessMask::NonPrivatePointerKHR))) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "NonPrivatePointerKHR must be specified if " "MakePointerAvailableKHR is specified."; @@ -343,14 +347,14 @@ spv_result_t CheckMemoryAccess(ValidationState_t& _, const Instruction* inst, return error; } - if (mask & SpvMemoryAccessMakePointerVisibleKHRMask) { - if (inst->opcode() == SpvOpStore || - inst->opcode() == SpvOpCooperativeMatrixStoreNV) { + if (mask & uint32_t(spv::MemoryAccessMask::MakePointerVisibleKHR)) { + if (inst->opcode() == spv::Op::OpStore || + inst->opcode() == spv::Op::OpCooperativeMatrixStoreNV) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "MakePointerVisibleKHR cannot be used with OpStore."; } - if (!(mask & SpvMemoryAccessNonPrivatePointerKHRMask)) { + if (!(mask & uint32_t(spv::MemoryAccessMask::NonPrivatePointerKHR))) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "NonPrivatePointerKHR must be specified if " << "MakePointerVisibleKHR is specified."; @@ -361,24 +365,27 @@ spv_result_t CheckMemoryAccess(ValidationState_t& _, const Instruction* inst, if (auto error = ValidateMemoryScope(_, inst, visible_scope)) return error; } - if (mask & SpvMemoryAccessNonPrivatePointerKHRMask) { - if (dst_sc != SpvStorageClassUniform && - dst_sc != SpvStorageClassWorkgroup && - dst_sc != SpvStorageClassCrossWorkgroup && - dst_sc != SpvStorageClassGeneric && dst_sc != SpvStorageClassImage && - dst_sc != SpvStorageClassStorageBuffer && - dst_sc != SpvStorageClassPhysicalStorageBuffer) { + if (mask & uint32_t(spv::MemoryAccessMask::NonPrivatePointerKHR)) { + if (dst_sc != spv::StorageClass::Uniform && + dst_sc != spv::StorageClass::Workgroup && + dst_sc != spv::StorageClass::CrossWorkgroup && + dst_sc != spv::StorageClass::Generic && + dst_sc != spv::StorageClass::Image && + dst_sc != spv::StorageClass::StorageBuffer && + dst_sc != spv::StorageClass::PhysicalStorageBuffer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "NonPrivatePointerKHR requires a pointer in Uniform, " << "Workgroup, CrossWorkgroup, Generic, Image or StorageBuffer " << "storage classes."; } - if (src_sc != SpvStorageClassMax && src_sc != SpvStorageClassUniform && - src_sc != SpvStorageClassWorkgroup && - src_sc != SpvStorageClassCrossWorkgroup && - src_sc != SpvStorageClassGeneric && src_sc != SpvStorageClassImage && - src_sc != SpvStorageClassStorageBuffer && - src_sc != SpvStorageClassPhysicalStorageBuffer) { + if (src_sc != spv::StorageClass::Max && + src_sc != spv::StorageClass::Uniform && + src_sc != spv::StorageClass::Workgroup && + src_sc != spv::StorageClass::CrossWorkgroup && + src_sc != spv::StorageClass::Generic && + src_sc != spv::StorageClass::Image && + src_sc != spv::StorageClass::StorageBuffer && + src_sc != spv::StorageClass::PhysicalStorageBuffer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "NonPrivatePointerKHR requires a pointer in Uniform, " << "Workgroup, CrossWorkgroup, Generic, Image or StorageBuffer " @@ -386,9 +393,9 @@ spv_result_t CheckMemoryAccess(ValidationState_t& _, const Instruction* inst, } } - if (!(mask & SpvMemoryAccessAlignedMask)) { - if (src_sc == SpvStorageClassPhysicalStorageBuffer || - dst_sc == SpvStorageClassPhysicalStorageBuffer) { + if (!(mask & uint32_t(spv::MemoryAccessMask::Aligned))) { + if (src_sc == spv::StorageClass::PhysicalStorageBuffer || + dst_sc == spv::StorageClass::PhysicalStorageBuffer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4708) << "Memory accesses with PhysicalStorageBuffer must use Aligned."; @@ -400,7 +407,7 @@ spv_result_t CheckMemoryAccess(ValidationState_t& _, const Instruction* inst, spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { auto result_type = _.FindDef(inst->type_id()); - if (!result_type || result_type->opcode() != SpvOpTypePointer) { + if (!result_type || result_type->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpVariable Result Type " << _.getIdName(inst->type_id()) << " is not a pointer type."; @@ -416,9 +423,9 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { const auto initializer_id = inst->GetOperandAs(initializer_index); const auto initializer = _.FindDef(initializer_id); const auto is_module_scope_var = - initializer && (initializer->opcode() == SpvOpVariable) && - (initializer->GetOperandAs(storage_class_index) != - SpvStorageClassFunction); + initializer && (initializer->opcode() == spv::Op::OpVariable) && + (initializer->GetOperandAs(storage_class_index) != + spv::StorageClass::Function); const auto is_constant = initializer && spvOpcodeIsConstant(initializer->opcode()); if (!initializer || !(is_constant || is_module_scope_var)) { @@ -433,23 +440,26 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { } } - auto storage_class = inst->GetOperandAs(storage_class_index); - if (storage_class != SpvStorageClassWorkgroup && - storage_class != SpvStorageClassCrossWorkgroup && - storage_class != SpvStorageClassPrivate && - storage_class != SpvStorageClassFunction && - storage_class != SpvStorageClassRayPayloadKHR && - storage_class != SpvStorageClassIncomingRayPayloadKHR && - storage_class != SpvStorageClassHitAttributeKHR && - storage_class != SpvStorageClassCallableDataKHR && - storage_class != SpvStorageClassIncomingCallableDataKHR && - storage_class != SpvStorageClassTaskPayloadWorkgroupEXT) { - bool storage_input_or_output = storage_class == SpvStorageClassInput || - storage_class == SpvStorageClassOutput; + auto storage_class = + inst->GetOperandAs(storage_class_index); + if (storage_class != spv::StorageClass::Workgroup && + storage_class != spv::StorageClass::CrossWorkgroup && + storage_class != spv::StorageClass::Private && + storage_class != spv::StorageClass::Function && + storage_class != spv::StorageClass::UniformConstant && + storage_class != spv::StorageClass::RayPayloadKHR && + storage_class != spv::StorageClass::IncomingRayPayloadKHR && + storage_class != spv::StorageClass::HitAttributeKHR && + storage_class != spv::StorageClass::CallableDataKHR && + storage_class != spv::StorageClass::IncomingCallableDataKHR && + storage_class != spv::StorageClass::TaskPayloadWorkgroupEXT && + storage_class != spv::StorageClass::HitObjectAttributeNV) { + bool storage_input_or_output = storage_class == spv::StorageClass::Input || + storage_class == spv::StorageClass::Output; bool builtin = false; if (storage_input_or_output) { for (const Decoration& decoration : _.id_decorations(inst->id())) { - if (decoration.dec_type() == SpvDecorationBuiltIn) { + if (decoration.dec_type() == spv::Decoration::BuiltIn) { builtin = true; break; } @@ -470,8 +480,8 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { "can only be used with non-externally visible shader Storage " "Classes: Workgroup, CrossWorkgroup, Private, Function, " "Input, Output, RayPayloadKHR, IncomingRayPayloadKHR, " - "HitAttributeKHR, CallableDataKHR, or " - "IncomingCallableDataKHR"; + "HitAttributeKHR, CallableDataKHR, " + "IncomingCallableDataKHR, or UniformConstant"; } } } @@ -482,18 +492,18 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { << "Invalid storage class for target environment"; } - if (storage_class == SpvStorageClassGeneric) { + if (storage_class == spv::StorageClass::Generic) { return _.diag(SPV_ERROR_INVALID_BINARY, inst) << "OpVariable storage class cannot be Generic"; } - if (inst->function() && storage_class != SpvStorageClassFunction) { + if (inst->function() && storage_class != spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) << "Variables must have a function[7] storage class inside" " of a function"; } - if (!inst->function() && storage_class == SpvStorageClassFunction) { + if (!inst->function() && storage_class == spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) << "Variables can not have a function[7] storage class " "outside of a function"; @@ -503,7 +513,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { // storage class. const auto result_storage_class_index = 1; const auto result_storage_class = - result_type->GetOperandAs(result_storage_class_index); + result_type->GetOperandAs(result_storage_class_index); if (storage_class != result_storage_class) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "From SPIR-V spec, section 3.32.8 on OpVariable:\n" @@ -513,16 +523,16 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { // Variable pointer related restrictions. const auto pointee = _.FindDef(result_type->word(3)); - if (_.addressing_model() == SpvAddressingModelLogical && + if (_.addressing_model() == spv::AddressingModel::Logical && !_.options()->relax_logical_pointer) { // VariablePointersStorageBuffer is implied by VariablePointers. - if (pointee->opcode() == SpvOpTypePointer) { - if (!_.HasCapability(SpvCapabilityVariablePointersStorageBuffer)) { + if (pointee->opcode() == spv::Op::OpTypePointer) { + if (!_.HasCapability(spv::Capability::VariablePointersStorageBuffer)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "In Logical addressing, variables may not allocate a pointer " << "type"; - } else if (storage_class != SpvStorageClassFunction && - storage_class != SpvStorageClassPrivate) { + } else if (storage_class != spv::StorageClass::Function && + storage_class != spv::StorageClass::Private) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "In Logical addressing with variable pointers, variables " << "that allocate pointers must be in Function or Private " @@ -534,8 +544,8 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { if (spvIsVulkanEnv(_.context()->target_env)) { // Vulkan Push Constant Interface section: Check type of PushConstant // variables. - if (storage_class == SpvStorageClassPushConstant) { - if (pointee->opcode() != SpvOpTypeStruct) { + if (storage_class == spv::StorageClass::PushConstant) { + if (pointee->opcode() != spv::Op::OpTypeStruct) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(6808) << "PushConstant OpVariable " << _.getIdName(inst->id()) << " has illegal type.\n" @@ -546,11 +556,12 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { // Vulkan Descriptor Set Interface: Check type of UniformConstant and // Uniform variables. - if (storage_class == SpvStorageClassUniformConstant) { + if (storage_class == spv::StorageClass::UniformConstant) { if (!IsAllowedTypeOrArrayOfSame( _, pointee, - {SpvOpTypeImage, SpvOpTypeSampler, SpvOpTypeSampledImage, - SpvOpTypeAccelerationStructureKHR})) { + {spv::Op::OpTypeImage, spv::Op::OpTypeSampler, + spv::Op::OpTypeSampledImage, + spv::Op::OpTypeAccelerationStructureKHR})) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4655) << "UniformConstant OpVariable " << _.getIdName(inst->id()) << " has illegal type.\n" @@ -562,8 +573,8 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { } } - if (storage_class == SpvStorageClassUniform) { - if (!IsAllowedTypeOrArrayOfSame(_, pointee, {SpvOpTypeStruct})) { + if (storage_class == spv::StorageClass::Uniform) { + if (!IsAllowedTypeOrArrayOfSame(_, pointee, {spv::Op::OpTypeStruct})) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(6807) << "Uniform OpVariable " << _.getIdName(inst->id()) << " has illegal type.\n" @@ -575,8 +586,8 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { } } - if (storage_class == SpvStorageClassStorageBuffer) { - if (!IsAllowedTypeOrArrayOfSame(_, pointee, {SpvOpTypeStruct})) { + if (storage_class == spv::StorageClass::StorageBuffer) { + if (!IsAllowedTypeOrArrayOfSame(_, pointee, {spv::Op::OpTypeStruct})) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(6807) << "StorageBuffer OpVariable " << _.getIdName(inst->id()) << " has illegal type.\n" @@ -589,9 +600,9 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { } // Check for invalid use of Invariant - if (storage_class != SpvStorageClassInput && - storage_class != SpvStorageClassOutput) { - if (_.HasDecoration(inst->id(), SpvDecorationInvariant)) { + if (storage_class != spv::StorageClass::Input && + storage_class != spv::StorageClass::Output) { + if (_.HasDecoration(inst->id(), spv::Decoration::Invariant)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4677) << "Variable decorated with Invariant must only be identified " @@ -599,8 +610,8 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { "environment."; } // Need to check if only the members in a struct are decorated - if (value_type && value_type->opcode() == SpvOpTypeStruct) { - if (_.HasDecoration(value_id, SpvDecorationInvariant)) { + if (value_type && value_type->opcode() == spv::Op::OpTypeStruct) { + if (_.HasDecoration(value_id, spv::Decoration::Invariant)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4677) << "Variable struct member decorated with Invariant must only " @@ -612,10 +623,10 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { // Initializers in Vulkan are only allowed in some storage clases if (inst->operands().size() > 3) { - if (storage_class == SpvStorageClassWorkgroup) { + if (storage_class == spv::StorageClass::Workgroup) { auto init_id = inst->GetOperandAs(3); auto init = _.FindDef(init_id); - if (init->opcode() != SpvOpConstantNull) { + if (init->opcode() != spv::Op::OpConstantNull) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4734) << "OpVariable, " << _.getIdName(inst->id()) @@ -623,9 +634,9 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { "Workgroup " "storage class"; } - } else if (storage_class != SpvStorageClassOutput && - storage_class != SpvStorageClassPrivate && - storage_class != SpvStorageClassFunction) { + } else if (storage_class != spv::StorageClass::Output && + storage_class != spv::StorageClass::Private && + storage_class != spv::StorageClass::Function) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4651) << "OpVariable, " << _.getIdName(inst->id()) @@ -641,35 +652,40 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { } if (inst->operands().size() > 3) { - if (storage_class == SpvStorageClassTaskPayloadWorkgroupEXT) { + if (storage_class == spv::StorageClass::TaskPayloadWorkgroupEXT) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpVariable, " << _.getIdName(inst->id()) << ", initializer are not allowed for TaskPayloadWorkgroupEXT"; } - if (storage_class == SpvStorageClassInput) { + if (storage_class == spv::StorageClass::Input) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpVariable, " << _.getIdName(inst->id()) << ", initializer are not allowed for Input"; } + if (storage_class == spv::StorageClass::HitObjectAttributeNV) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpVariable, " << _.getIdName(inst->id()) + << ", initializer are not allowed for HitObjectAttributeNV"; + } } - if (storage_class == SpvStorageClassPhysicalStorageBuffer) { + if (storage_class == spv::StorageClass::PhysicalStorageBuffer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "PhysicalStorageBuffer must not be used with OpVariable."; } auto pointee_base = pointee; - while (pointee_base->opcode() == SpvOpTypeArray) { + while (pointee_base->opcode() == spv::Op::OpTypeArray) { pointee_base = _.FindDef(pointee_base->GetOperandAs(1u)); } - if (pointee_base->opcode() == SpvOpTypePointer) { - if (pointee_base->GetOperandAs(1u) == - SpvStorageClassPhysicalStorageBuffer) { + if (pointee_base->opcode() == spv::Op::OpTypePointer) { + if (pointee_base->GetOperandAs(1u) == + spv::StorageClass::PhysicalStorageBuffer) { // check for AliasedPointer/RestrictPointer bool foundAliased = - _.HasDecoration(inst->id(), SpvDecorationAliasedPointer); + _.HasDecoration(inst->id(), spv::Decoration::AliasedPointer); bool foundRestrict = - _.HasDecoration(inst->id(), SpvDecorationRestrictPointer); + _.HasDecoration(inst->id(), spv::Decoration::RestrictPointer); if (!foundAliased && !foundRestrict) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpVariable " << inst->id() @@ -690,8 +706,8 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { // OpTypeRuntimeArray should only ever be in a container like OpTypeStruct, // so should never appear as a bare variable. // Unless the module has the RuntimeDescriptorArrayEXT capability. - if (value_type && value_type->opcode() == SpvOpTypeRuntimeArray) { - if (!_.HasCapability(SpvCapabilityRuntimeDescriptorArrayEXT)) { + if (value_type && value_type->opcode() == spv::Op::OpTypeRuntimeArray) { + if (!_.HasCapability(spv::Capability::RuntimeDescriptorArrayEXT)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4680) << "OpVariable, " << _.getIdName(inst->id()) @@ -702,9 +718,9 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { } else { // A bare variable OpTypeRuntimeArray is allowed in this context, but // still need to check the storage class. - if (storage_class != SpvStorageClassStorageBuffer && - storage_class != SpvStorageClassUniform && - storage_class != SpvStorageClassUniformConstant) { + if (storage_class != spv::StorageClass::StorageBuffer && + storage_class != spv::StorageClass::Uniform && + storage_class != spv::StorageClass::UniformConstant) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4680) << "For Vulkan with RuntimeDescriptorArrayEXT, a variable " @@ -718,11 +734,11 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { // must either have the storage class StorageBuffer and be decorated // with Block, or it must be in the Uniform storage class and be decorated // as BufferBlock. - if (value_type && value_type->opcode() == SpvOpTypeStruct) { + if (value_type && value_type->opcode() == spv::Op::OpTypeStruct) { if (DoesStructContainRTA(_, value_type)) { - if (storage_class == SpvStorageClassStorageBuffer || - storage_class == SpvStorageClassPhysicalStorageBuffer) { - if (!_.HasDecoration(value_id, SpvDecorationBlock)) { + if (storage_class == spv::StorageClass::StorageBuffer || + storage_class == spv::StorageClass::PhysicalStorageBuffer) { + if (!_.HasDecoration(value_id, spv::Decoration::Block)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4680) << "For Vulkan, an OpTypeStruct variable containing an " @@ -730,8 +746,8 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { << "has storage class StorageBuffer or " "PhysicalStorageBuffer."; } - } else if (storage_class == SpvStorageClassUniform) { - if (!_.HasDecoration(value_id, SpvDecorationBufferBlock)) { + } else if (storage_class == spv::StorageClass::Uniform) { + if (!_.HasDecoration(value_id, spv::Decoration::BufferBlock)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4680) << "For Vulkan, an OpTypeStruct variable containing an " @@ -750,8 +766,8 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { } // Cooperative matrix types can only be allocated in Function or Private - if ((storage_class != SpvStorageClassFunction && - storage_class != SpvStorageClassPrivate) && + if ((storage_class != spv::StorageClass::Function && + storage_class != spv::StorageClass::Private) && ContainsCooperativeMatrix(_, pointee)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Cooperative matrix types (or types containing them) can only be " @@ -760,57 +776,59 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { "parameters"; } - if (_.HasCapability(SpvCapabilityShader)) { + if (_.HasCapability(spv::Capability::Shader)) { // Don't allow variables containing 16-bit elements without the appropriate // capabilities. - if ((!_.HasCapability(SpvCapabilityInt16) && - _.ContainsSizedIntOrFloatType(value_id, SpvOpTypeInt, 16)) || - (!_.HasCapability(SpvCapabilityFloat16) && - _.ContainsSizedIntOrFloatType(value_id, SpvOpTypeFloat, 16))) { + if ((!_.HasCapability(spv::Capability::Int16) && + _.ContainsSizedIntOrFloatType(value_id, spv::Op::OpTypeInt, 16)) || + (!_.HasCapability(spv::Capability::Float16) && + _.ContainsSizedIntOrFloatType(value_id, spv::Op::OpTypeFloat, 16))) { auto underlying_type = value_type; - while (underlying_type->opcode() == SpvOpTypePointer) { - storage_class = underlying_type->GetOperandAs(1u); + while (underlying_type->opcode() == spv::Op::OpTypePointer) { + storage_class = underlying_type->GetOperandAs(1u); underlying_type = _.FindDef(underlying_type->GetOperandAs(2u)); } bool storage_class_ok = true; std::string sc_name = _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_STORAGE_CLASS, storage_class); + SPV_OPERAND_TYPE_STORAGE_CLASS, uint32_t(storage_class)); switch (storage_class) { - case SpvStorageClassStorageBuffer: - case SpvStorageClassPhysicalStorageBuffer: - if (!_.HasCapability(SpvCapabilityStorageBuffer16BitAccess)) { + case spv::StorageClass::StorageBuffer: + case spv::StorageClass::PhysicalStorageBuffer: + if (!_.HasCapability(spv::Capability::StorageBuffer16BitAccess)) { storage_class_ok = false; } break; - case SpvStorageClassUniform: + case spv::StorageClass::Uniform: if (!_.HasCapability( - SpvCapabilityUniformAndStorageBuffer16BitAccess)) { - if (underlying_type->opcode() == SpvOpTypeArray || - underlying_type->opcode() == SpvOpTypeRuntimeArray) { + spv::Capability::UniformAndStorageBuffer16BitAccess)) { + if (underlying_type->opcode() == spv::Op::OpTypeArray || + underlying_type->opcode() == spv::Op::OpTypeRuntimeArray) { underlying_type = _.FindDef(underlying_type->GetOperandAs(1u)); } - if (!_.HasCapability(SpvCapabilityStorageBuffer16BitAccess) || + if (!_.HasCapability(spv::Capability::StorageBuffer16BitAccess) || !_.HasDecoration(underlying_type->id(), - SpvDecorationBufferBlock)) { + spv::Decoration::BufferBlock)) { storage_class_ok = false; } } break; - case SpvStorageClassPushConstant: - if (!_.HasCapability(SpvCapabilityStoragePushConstant16)) { + case spv::StorageClass::PushConstant: + if (!_.HasCapability(spv::Capability::StoragePushConstant16)) { storage_class_ok = false; } break; - case SpvStorageClassInput: - case SpvStorageClassOutput: - if (!_.HasCapability(SpvCapabilityStorageInputOutput16)) { + case spv::StorageClass::Input: + case spv::StorageClass::Output: + if (!_.HasCapability(spv::Capability::StorageInputOutput16)) { storage_class_ok = false; } break; - case SpvStorageClassWorkgroup: - if (!_.HasCapability(SpvCapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR)) { + case spv::StorageClass::Workgroup: + if (!_.HasCapability( + spv::Capability:: + WorkgroupMemoryExplicitLayout16BitAccessKHR)) { storage_class_ok = false; } break; @@ -827,46 +845,48 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { } // Don't allow variables containing 8-bit elements without the appropriate // capabilities. - if (!_.HasCapability(SpvCapabilityInt8) && - _.ContainsSizedIntOrFloatType(value_id, SpvOpTypeInt, 8)) { + if (!_.HasCapability(spv::Capability::Int8) && + _.ContainsSizedIntOrFloatType(value_id, spv::Op::OpTypeInt, 8)) { auto underlying_type = value_type; - while (underlying_type->opcode() == SpvOpTypePointer) { - storage_class = underlying_type->GetOperandAs(1u); + while (underlying_type->opcode() == spv::Op::OpTypePointer) { + storage_class = underlying_type->GetOperandAs(1u); underlying_type = _.FindDef(underlying_type->GetOperandAs(2u)); } bool storage_class_ok = true; std::string sc_name = _.grammar().lookupOperandName( - SPV_OPERAND_TYPE_STORAGE_CLASS, storage_class); + SPV_OPERAND_TYPE_STORAGE_CLASS, uint32_t(storage_class)); switch (storage_class) { - case SpvStorageClassStorageBuffer: - case SpvStorageClassPhysicalStorageBuffer: - if (!_.HasCapability(SpvCapabilityStorageBuffer8BitAccess)) { + case spv::StorageClass::StorageBuffer: + case spv::StorageClass::PhysicalStorageBuffer: + if (!_.HasCapability(spv::Capability::StorageBuffer8BitAccess)) { storage_class_ok = false; } break; - case SpvStorageClassUniform: + case spv::StorageClass::Uniform: if (!_.HasCapability( - SpvCapabilityUniformAndStorageBuffer8BitAccess)) { - if (underlying_type->opcode() == SpvOpTypeArray || - underlying_type->opcode() == SpvOpTypeRuntimeArray) { + spv::Capability::UniformAndStorageBuffer8BitAccess)) { + if (underlying_type->opcode() == spv::Op::OpTypeArray || + underlying_type->opcode() == spv::Op::OpTypeRuntimeArray) { underlying_type = _.FindDef(underlying_type->GetOperandAs(1u)); } - if (!_.HasCapability(SpvCapabilityStorageBuffer8BitAccess) || + if (!_.HasCapability(spv::Capability::StorageBuffer8BitAccess) || !_.HasDecoration(underlying_type->id(), - SpvDecorationBufferBlock)) { + spv::Decoration::BufferBlock)) { storage_class_ok = false; } } break; - case SpvStorageClassPushConstant: - if (!_.HasCapability(SpvCapabilityStoragePushConstant8)) { + case spv::StorageClass::PushConstant: + if (!_.HasCapability(spv::Capability::StoragePushConstant8)) { storage_class_ok = false; } break; - case SpvStorageClassWorkgroup: - if (!_.HasCapability(SpvCapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR)) { + case spv::StorageClass::Workgroup: + if (!_.HasCapability( + spv::Capability:: + WorkgroupMemoryExplicitLayout8BitAccessKHR)) { storage_class_ok = false; } break; @@ -898,7 +918,7 @@ spv_result_t ValidateLoad(ValidationState_t& _, const Instruction* inst) { const auto pointer_id = inst->GetOperandAs(pointer_index); const auto pointer = _.FindDef(pointer_id); if (!pointer || - ((_.addressing_model() == SpvAddressingModelLogical) && + ((_.addressing_model() == spv::AddressingModel::Logical) && ((!_.features().variable_pointers && !spvOpcodeReturnsLogicalPointer(pointer->opcode())) || (_.features().variable_pointers && @@ -909,14 +929,14 @@ spv_result_t ValidateLoad(ValidationState_t& _, const Instruction* inst) { } const auto pointer_type = _.FindDef(pointer->type_id()); - if (!pointer_type || pointer_type->opcode() != SpvOpTypePointer) { + if (!pointer_type || pointer_type->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpLoad type for pointer " << _.getIdName(pointer_id) << " is not a pointer type."; } uint32_t pointee_data_type; - uint32_t storage_class; + spv::StorageClass storage_class; if (!_.GetPointerTypeInfo(pointer_type->id(), &pointee_data_type, &storage_class) || result_type->id() != pointee_data_type) { @@ -934,18 +954,20 @@ spv_result_t ValidateLoad(ValidationState_t& _, const Instruction* inst) { if (auto error = CheckMemoryAccess(_, inst, 3)) return error; - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id()) && - result_type->opcode() != SpvOpTypePointer) { - if (result_type->opcode() != SpvOpTypeInt && - result_type->opcode() != SpvOpTypeFloat && - result_type->opcode() != SpvOpTypeVector && - result_type->opcode() != SpvOpTypeMatrix) { + result_type->opcode() != spv::Op::OpTypePointer) { + if (result_type->opcode() != spv::Op::OpTypeInt && + result_type->opcode() != spv::Op::OpTypeFloat && + result_type->opcode() != spv::Op::OpTypeVector && + result_type->opcode() != spv::Op::OpTypeMatrix) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "8- or 16-bit loads must be a scalar, vector or matrix type"; } } + _.RegisterQCOMImageProcessingTextureConsumer(pointer_id, inst, nullptr); + return SPV_SUCCESS; } @@ -954,7 +976,7 @@ spv_result_t ValidateStore(ValidationState_t& _, const Instruction* inst) { const auto pointer_id = inst->GetOperandAs(pointer_index); const auto pointer = _.FindDef(pointer_id); if (!pointer || - (_.addressing_model() == SpvAddressingModelLogical && + (_.addressing_model() == spv::AddressingModel::Logical && ((!_.features().variable_pointers && !spvOpcodeReturnsLogicalPointer(pointer->opcode())) || (_.features().variable_pointers && @@ -964,14 +986,14 @@ spv_result_t ValidateStore(ValidationState_t& _, const Instruction* inst) { << " is not a logical pointer."; } const auto pointer_type = _.FindDef(pointer->type_id()); - if (!pointer_type || pointer_type->opcode() != SpvOpTypePointer) { + if (!pointer_type || pointer_type->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpStore type for pointer " << _.getIdName(pointer_id) << " is not a pointer type."; } const auto type_id = pointer_type->GetOperandAs(2); const auto type = _.FindDef(type_id); - if (!type || SpvOpTypeVoid == type->opcode()) { + if (!type || spv::Op::OpTypeVoid == type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpStore Pointer " << _.getIdName(pointer_id) << "s type is void."; @@ -980,29 +1002,29 @@ spv_result_t ValidateStore(ValidationState_t& _, const Instruction* inst) { // validate storage class { uint32_t data_type; - uint32_t storage_class; + spv::StorageClass storage_class; if (!_.GetPointerTypeInfo(pointer_type->id(), &data_type, &storage_class)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpStore Pointer " << _.getIdName(pointer_id) << " is not pointer type"; } - if (storage_class == SpvStorageClassUniformConstant || - storage_class == SpvStorageClassInput || - storage_class == SpvStorageClassPushConstant) { + if (storage_class == spv::StorageClass::UniformConstant || + storage_class == spv::StorageClass::Input || + storage_class == spv::StorageClass::PushConstant) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpStore Pointer " << _.getIdName(pointer_id) << " storage class is read-only"; - } else if (storage_class == SpvStorageClassShaderRecordBufferKHR) { + } else if (storage_class == spv::StorageClass::ShaderRecordBufferKHR) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "ShaderRecordBufferKHR Storage Class variables are read only"; - } else if (storage_class == SpvStorageClassHitAttributeKHR) { + } else if (storage_class == spv::StorageClass::HitAttributeKHR) { std::string errorVUID = _.VkErrorID(4703); _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [errorVUID](SpvExecutionModel model, std::string* message) { - if (model == SpvExecutionModelAnyHitKHR || - model == SpvExecutionModelClosestHitKHR) { + [errorVUID](spv::ExecutionModel model, std::string* message) { + if (model == spv::ExecutionModel::AnyHitKHR || + model == spv::ExecutionModel::ClosestHitKHR) { if (message) { *message = errorVUID + @@ -1016,18 +1038,18 @@ spv_result_t ValidateStore(ValidationState_t& _, const Instruction* inst) { } if (spvIsVulkanEnv(_.context()->target_env) && - storage_class == SpvStorageClassUniform) { + storage_class == spv::StorageClass::Uniform) { auto base_ptr = _.TracePointer(pointer); - if (base_ptr->opcode() == SpvOpVariable) { + if (base_ptr->opcode() == spv::Op::OpVariable) { // If it's not a variable a different check should catch the problem. auto base_type = _.FindDef(base_ptr->GetOperandAs(0)); // Get the pointed-to type. base_type = _.FindDef(base_type->GetOperandAs(2u)); - if (base_type->opcode() == SpvOpTypeArray || - base_type->opcode() == SpvOpTypeRuntimeArray) { + if (base_type->opcode() == spv::Op::OpTypeArray || + base_type->opcode() == spv::Op::OpTypeRuntimeArray) { base_type = _.FindDef(base_type->GetOperandAs(1u)); } - if (_.HasDecoration(base_type->id(), SpvDecorationBlock)) { + if (_.HasDecoration(base_type->id(), spv::Decoration::Block)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(6925) << "In the Vulkan environment, cannot store to Uniform Blocks"; @@ -1045,15 +1067,16 @@ spv_result_t ValidateStore(ValidationState_t& _, const Instruction* inst) { << " is not an object."; } const auto object_type = _.FindDef(object->type_id()); - if (!object_type || SpvOpTypeVoid == object_type->opcode()) { + if (!object_type || spv::Op::OpTypeVoid == object_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpStore Object " << _.getIdName(object_id) << "s type is void."; } if (type->id() != object_type->id()) { - if (!_.options()->relax_struct_store || type->opcode() != SpvOpTypeStruct || - object_type->opcode() != SpvOpTypeStruct) { + if (!_.options()->relax_struct_store || + type->opcode() != spv::Op::OpTypeStruct || + object_type->opcode() != spv::Op::OpTypeStruct) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpStore Pointer " << _.getIdName(pointer_id) << "s type does not match Object " @@ -1071,13 +1094,13 @@ spv_result_t ValidateStore(ValidationState_t& _, const Instruction* inst) { if (auto error = CheckMemoryAccess(_, inst, 2)) return error; - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id()) && - object_type->opcode() != SpvOpTypePointer) { - if (object_type->opcode() != SpvOpTypeInt && - object_type->opcode() != SpvOpTypeFloat && - object_type->opcode() != SpvOpTypeVector && - object_type->opcode() != SpvOpTypeMatrix) { + object_type->opcode() != spv::Op::OpTypePointer) { + if (object_type->opcode() != spv::Op::OpTypeInt && + object_type->opcode() != spv::Op::OpTypeFloat && + object_type->opcode() != spv::Op::OpTypeVector && + object_type->opcode() != spv::Op::OpTypeMatrix) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "8- or 16-bit stores must be a scalar, vector or matrix type"; } @@ -1088,9 +1111,10 @@ spv_result_t ValidateStore(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateCopyMemoryMemoryAccess(ValidationState_t& _, const Instruction* inst) { - assert(inst->opcode() == SpvOpCopyMemory || - inst->opcode() == SpvOpCopyMemorySized); - const uint32_t first_access_index = inst->opcode() == SpvOpCopyMemory ? 2 : 3; + assert(inst->opcode() == spv::Op::OpCopyMemory || + inst->opcode() == spv::Op::OpCopyMemorySized); + const uint32_t first_access_index = + inst->opcode() == spv::Op::OpCopyMemory ? 2 : 3; if (inst->operands().size() > first_access_index) { if (auto error = CheckMemoryAccess(_, inst, first_access_index)) return error; @@ -1108,21 +1132,23 @@ spv_result_t ValidateCopyMemoryMemoryAccess(ValidationState_t& _, // make-visible. // - the second is the source (read) access and it can't have // make-available. - if (first_access & SpvMemoryAccessMakePointerVisibleKHRMask) { + if (first_access & + uint32_t(spv::MemoryAccessMask::MakePointerVisibleKHR)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Target memory access must not include " "MakePointerVisibleKHR"; } const auto second_access = inst->GetOperandAs(second_access_index); - if (second_access & SpvMemoryAccessMakePointerAvailableKHRMask) { + if (second_access & + uint32_t(spv::MemoryAccessMask::MakePointerAvailableKHR)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Source memory access must not include " "MakePointerAvailableKHR"; } } else { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << spvOpcodeString(static_cast(inst->opcode())) + << spvOpcodeString(static_cast(inst->opcode())) << " with two memory access operands requires SPIR-V 1.4 or " "later"; } @@ -1152,7 +1178,7 @@ spv_result_t ValidateCopyMemory(ValidationState_t& _, const Instruction* inst) { const auto target_pointer_type = _.FindDef(target->type_id()); if (!target_pointer_type || - target_pointer_type->opcode() != SpvOpTypePointer) { + target_pointer_type->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Target operand " << _.getIdName(target_id) << " is not a pointer."; @@ -1160,16 +1186,16 @@ spv_result_t ValidateCopyMemory(ValidationState_t& _, const Instruction* inst) { const auto source_pointer_type = _.FindDef(source->type_id()); if (!source_pointer_type || - source_pointer_type->opcode() != SpvOpTypePointer) { + source_pointer_type->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Source operand " << _.getIdName(source_id) << " is not a pointer."; } - if (inst->opcode() == SpvOpCopyMemory) { + if (inst->opcode() == spv::Op::OpCopyMemory) { const auto target_type = _.FindDef(target_pointer_type->GetOperandAs(2)); - if (!target_type || target_type->opcode() == SpvOpTypeVoid) { + if (!target_type || target_type->opcode() == spv::Op::OpTypeVoid) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Target operand " << _.getIdName(target_id) << " cannot be a void pointer."; @@ -1177,7 +1203,7 @@ spv_result_t ValidateCopyMemory(ValidationState_t& _, const Instruction* inst) { const auto source_type = _.FindDef(source_pointer_type->GetOperandAs(2)); - if (!source_type || source_type->opcode() == SpvOpTypeVoid) { + if (!source_type || source_type->opcode() == spv::Op::OpTypeVoid) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Source operand " << _.getIdName(source_id) << " cannot be a void pointer."; @@ -1207,11 +1233,11 @@ spv_result_t ValidateCopyMemory(ValidationState_t& _, const Instruction* inst) { bool is_zero = true; switch (size->opcode()) { - case SpvOpConstantNull: + case spv::Op::OpConstantNull: return _.diag(SPV_ERROR_INVALID_ID, inst) << "Size operand " << _.getIdName(size_id) << " cannot be a constant zero."; - case SpvOpConstant: + case spv::Op::OpConstant: if (size_type->word(3) == 1 && size->word(size->words().size() - 1) & 0x80000000) { return _.diag(SPV_ERROR_INVALID_ID, inst) @@ -1236,10 +1262,10 @@ spv_result_t ValidateCopyMemory(ValidationState_t& _, const Instruction* inst) { // Get past the pointers to avoid checking a pointer copy. auto sub_type = _.FindDef(target_pointer_type->GetOperandAs(2)); - while (sub_type->opcode() == SpvOpTypePointer) { + while (sub_type->opcode() == spv::Op::OpTypePointer) { sub_type = _.FindDef(sub_type->GetOperandAs(2)); } - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(sub_type->id())) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Cannot copy memory of objects containing 8- or 16-bit types"; @@ -1251,15 +1277,16 @@ spv_result_t ValidateCopyMemory(ValidationState_t& _, const Instruction* inst) { spv_result_t ValidateAccessChain(ValidationState_t& _, const Instruction* inst) { std::string instr_name = - "Op" + std::string(spvOpcodeString(static_cast(inst->opcode()))); + "Op" + std::string(spvOpcodeString(static_cast(inst->opcode()))); // The result type must be OpTypePointer. auto result_type = _.FindDef(inst->type_id()); - if (SpvOpTypePointer != result_type->opcode()) { + if (spv::Op::OpTypePointer != result_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "The Result Type of " << instr_name << " " << _.getIdName(inst->id()) << " must be OpTypePointer. Found Op" - << spvOpcodeString(static_cast(result_type->opcode())) << "."; + << spvOpcodeString(static_cast(result_type->opcode())) + << "."; } // Result type is a pointer. Find out what it's pointing to. @@ -1272,7 +1299,7 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, const auto base_id = inst->GetOperandAs(base_index); const auto base = _.FindDef(base_id); const auto base_type = _.FindDef(base->type_id()); - if (!base_type || SpvOpTypePointer != base_type->opcode()) { + if (!base_type || spv::Op::OpTypePointer != base_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "The Base " << _.getIdName(base_id) << " in " << instr_name << " instruction must be a pointer."; @@ -1296,8 +1323,8 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, // The number of indexes passed to OpAccessChain may not exceed 255 // The instruction includes 4 words + N words (for N indexes) size_t num_indexes = inst->words().size() - 4; - if (inst->opcode() == SpvOpPtrAccessChain || - inst->opcode() == SpvOpInBoundsPtrAccessChain) { + if (inst->opcode() == spv::Op::OpPtrAccessChain || + inst->opcode() == spv::Op::OpInBoundsPtrAccessChain) { // In pointer access chains, the element operand is required, but not // counted as an index. --num_indexes; @@ -1317,8 +1344,8 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, // on. Once any non-composite type is reached, there must be no remaining // (unused) indexes. auto starting_index = 4; - if (inst->opcode() == SpvOpPtrAccessChain || - inst->opcode() == SpvOpInBoundsPtrAccessChain) { + if (inst->opcode() == spv::Op::OpPtrAccessChain || + inst->opcode() == spv::Op::OpInBoundsPtrAccessChain) { ++starting_index; } for (size_t i = starting_index; i < inst->words().size(); ++i) { @@ -1327,26 +1354,27 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, auto cur_word_instr = _.FindDef(cur_word); // The index must be a scalar integer type (See OpAccessChain in the Spec.) auto index_type = _.FindDef(cur_word_instr->type_id()); - if (!index_type || SpvOpTypeInt != index_type->opcode()) { + if (!index_type || spv::Op::OpTypeInt != index_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Indexes passed to " << instr_name << " must be of type integer."; } switch (type_pointee->opcode()) { - case SpvOpTypeMatrix: - case SpvOpTypeVector: - case SpvOpTypeCooperativeMatrixNV: - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: { - // In OpTypeMatrix, OpTypeVector, SpvOpTypeCooperativeMatrixNV, + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixKHR: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: { + // In OpTypeMatrix, OpTypeVector, spv::Op::OpTypeCooperativeMatrixNV, // OpTypeArray, and OpTypeRuntimeArray, word 2 is the Element Type. type_pointee = _.FindDef(type_pointee->word(2)); break; } - case SpvOpTypeStruct: { + case spv::Op::OpTypeStruct: { // In case of structures, there is an additional constraint on the // index: the index must be an OpConstant. - if (SpvOpConstant != cur_word_instr->opcode()) { + if (spv::Op::OpConstant != cur_word_instr->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, cur_word_instr) << "The passed to " << instr_name << " to index into a " @@ -1378,7 +1406,7 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, } default: { // Give an error. reached non-composite type while indexes still remain. - return _.diag(SPV_ERROR_INVALID_ID, cur_word_instr) + return _.diag(SPV_ERROR_INVALID_ID, inst) << instr_name << " reached non-composite type while indexes " "still remain to be traversed."; @@ -1390,11 +1418,12 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, if (type_pointee->id() != result_type_pointee->id()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << instr_name << " result type (Op" - << spvOpcodeString(static_cast(result_type_pointee->opcode())) + << spvOpcodeString( + static_cast(result_type_pointee->opcode())) << ") does not match the type that results from indexing into the " "base " " (Op" - << spvOpcodeString(static_cast(type_pointee->opcode())) + << spvOpcodeString(static_cast(type_pointee->opcode())) << ")."; } @@ -1403,24 +1432,72 @@ spv_result_t ValidateAccessChain(ValidationState_t& _, spv_result_t ValidatePtrAccessChain(ValidationState_t& _, const Instruction* inst) { - if (_.addressing_model() == SpvAddressingModelLogical) { + if (_.addressing_model() == spv::AddressingModel::Logical) { if (!_.features().variable_pointers) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Generating variable pointers requires capability " << "VariablePointers or VariablePointersStorageBuffer"; } } - return ValidateAccessChain(_, inst); + + // Need to call first, will make sure Base is a valid ID + if (auto error = ValidateAccessChain(_, inst)) return error; + + const auto base_id = inst->GetOperandAs(2); + const auto base = _.FindDef(base_id); + const auto base_type = _.FindDef(base->type_id()); + const auto base_type_storage_class = + base_type->GetOperandAs(1); + + if (_.HasCapability(spv::Capability::Shader) && + (base_type_storage_class == spv::StorageClass::Uniform || + base_type_storage_class == spv::StorageClass::StorageBuffer || + base_type_storage_class == spv::StorageClass::PhysicalStorageBuffer || + base_type_storage_class == spv::StorageClass::PushConstant || + (_.HasCapability(spv::Capability::WorkgroupMemoryExplicitLayoutKHR) && + base_type_storage_class == spv::StorageClass::Workgroup)) && + !_.HasDecoration(base_type->id(), spv::Decoration::ArrayStride)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "OpPtrAccessChain must have a Base whose type is decorated " + "with ArrayStride"; + } + + if (spvIsVulkanEnv(_.context()->target_env)) { + if (base_type_storage_class == spv::StorageClass::Workgroup) { + if (!_.HasCapability(spv::Capability::VariablePointers)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << _.VkErrorID(7651) + << "OpPtrAccessChain Base operand pointing to Workgroup " + "storage class must use VariablePointers capability"; + } + } else if (base_type_storage_class == spv::StorageClass::StorageBuffer) { + if (!_.features().variable_pointers) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << _.VkErrorID(7652) + << "OpPtrAccessChain Base operand pointing to StorageBuffer " + "storage class must use VariablePointers or " + "VariablePointersStorageBuffer capability"; + } + } else if (base_type_storage_class != + spv::StorageClass::PhysicalStorageBuffer) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << _.VkErrorID(7650) + << "OpPtrAccessChain Base operand must point to Workgroup, " + "StorageBuffer, or PhysicalStorageBuffer storage class"; + } + } + + return SPV_SUCCESS; } spv_result_t ValidateArrayLength(ValidationState_t& state, const Instruction* inst) { std::string instr_name = - "Op" + std::string(spvOpcodeString(static_cast(inst->opcode()))); + "Op" + std::string(spvOpcodeString(static_cast(inst->opcode()))); // Result type must be a 32-bit unsigned int. auto result_type = state.FindDef(inst->type_id()); - if (result_type->opcode() != SpvOpTypeInt || + if (result_type->opcode() != spv::Op::OpTypeInt || result_type->GetOperandAs(1) != 32 || result_type->GetOperandAs(2) != 0) { return state.diag(SPV_ERROR_INVALID_ID, inst) @@ -1433,7 +1510,7 @@ spv_result_t ValidateArrayLength(ValidationState_t& state, // last element is a runtime array. auto pointer = state.FindDef(inst->GetOperandAs(2)); auto pointer_type = state.FindDef(pointer->type_id()); - if (pointer_type->opcode() != SpvOpTypePointer) { + if (pointer_type->opcode() != spv::Op::OpTypePointer) { return state.diag(SPV_ERROR_INVALID_ID, inst) << "The Structure's type in " << instr_name << " " << state.getIdName(inst->id()) @@ -1441,7 +1518,7 @@ spv_result_t ValidateArrayLength(ValidationState_t& state, } auto structure_type = state.FindDef(pointer_type->GetOperandAs(2)); - if (structure_type->opcode() != SpvOpTypeStruct) { + if (structure_type->opcode() != spv::Op::OpTypeStruct) { return state.diag(SPV_ERROR_INVALID_ID, inst) << "The Structure's type in " << instr_name << " " << state.getIdName(inst->id()) @@ -1451,7 +1528,7 @@ spv_result_t ValidateArrayLength(ValidationState_t& state, auto num_of_members = structure_type->operands().size() - 1; auto last_member = state.FindDef(structure_type->GetOperandAs(num_of_members)); - if (last_member->opcode() != SpvOpTypeRuntimeArray) { + if (last_member->opcode() != spv::Op::OpTypeRuntimeArray) { return state.diag(SPV_ERROR_INVALID_ID, inst) << "The Structure's last member in " << instr_name << " " << state.getIdName(inst->id()) << " must be an OpTypeRuntimeArray."; @@ -1471,11 +1548,11 @@ spv_result_t ValidateArrayLength(ValidationState_t& state, spv_result_t ValidateCooperativeMatrixLengthNV(ValidationState_t& state, const Instruction* inst) { std::string instr_name = - "Op" + std::string(spvOpcodeString(static_cast(inst->opcode()))); + "Op" + std::string(spvOpcodeString(static_cast(inst->opcode()))); // Result type must be a 32-bit unsigned int. auto result_type = state.FindDef(inst->type_id()); - if (result_type->opcode() != SpvOpTypeInt || + if (result_type->opcode() != spv::Op::OpTypeInt || result_type->GetOperandAs(1) != 32 || result_type->GetOperandAs(2) != 0) { return state.diag(SPV_ERROR_INVALID_ID, inst) @@ -1484,9 +1561,15 @@ spv_result_t ValidateCooperativeMatrixLengthNV(ValidationState_t& state, << " must be OpTypeInt with width 32 and signedness 0."; } + bool isKhr = inst->opcode() == spv::Op::OpCooperativeMatrixLengthKHR; auto type_id = inst->GetOperandAs(2); auto type = state.FindDef(type_id); - if (type->opcode() != SpvOpTypeCooperativeMatrixNV) { + if (isKhr && type->opcode() != spv::Op::OpTypeCooperativeMatrixKHR) { + return state.diag(SPV_ERROR_INVALID_ID, inst) + << "The type in " << instr_name << " " + << state.getIdName(type_id) + << " must be OpTypeCooperativeMatrixKHR."; + } else if (!isKhr && type->opcode() != spv::Op::OpTypeCooperativeMatrixNV) { return state.diag(SPV_ERROR_INVALID_ID, inst) << "The type in " << instr_name << " " << state.getIdName(type_id) << " must be OpTypeCooperativeMatrixNV."; @@ -1498,35 +1581,35 @@ spv_result_t ValidateCooperativeMatrixLoadStoreNV(ValidationState_t& _, const Instruction* inst) { uint32_t type_id; const char* opname; - if (inst->opcode() == SpvOpCooperativeMatrixLoadNV) { + if (inst->opcode() == spv::Op::OpCooperativeMatrixLoadNV) { type_id = inst->type_id(); - opname = "SpvOpCooperativeMatrixLoadNV"; + opname = "spv::Op::OpCooperativeMatrixLoadNV"; } else { // get Object operand's type type_id = _.FindDef(inst->GetOperandAs(1))->type_id(); - opname = "SpvOpCooperativeMatrixStoreNV"; + opname = "spv::Op::OpCooperativeMatrixStoreNV"; } auto matrix_type = _.FindDef(type_id); - if (matrix_type->opcode() != SpvOpTypeCooperativeMatrixNV) { - if (inst->opcode() == SpvOpCooperativeMatrixLoadNV) { + if (matrix_type->opcode() != spv::Op::OpTypeCooperativeMatrixNV) { + if (inst->opcode() == spv::Op::OpCooperativeMatrixLoadNV) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "SpvOpCooperativeMatrixLoadNV Result Type " + << "spv::Op::OpCooperativeMatrixLoadNV Result Type " << _.getIdName(type_id) << " is not a cooperative matrix type."; } else { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "SpvOpCooperativeMatrixStoreNV Object type " + << "spv::Op::OpCooperativeMatrixStoreNV Object type " << _.getIdName(type_id) << " is not a cooperative matrix type."; } } const auto pointer_index = - (inst->opcode() == SpvOpCooperativeMatrixLoadNV) ? 2u : 0u; + (inst->opcode() == spv::Op::OpCooperativeMatrixLoadNV) ? 2u : 0u; const auto pointer_id = inst->GetOperandAs(pointer_index); const auto pointer = _.FindDef(pointer_id); if (!pointer || - ((_.addressing_model() == SpvAddressingModelLogical) && + ((_.addressing_model() == spv::AddressingModel::Logical) && ((!_.features().variable_pointers && !spvOpcodeReturnsLogicalPointer(pointer->opcode())) || (_.features().variable_pointers && @@ -1538,7 +1621,7 @@ spv_result_t ValidateCooperativeMatrixLoadStoreNV(ValidationState_t& _, const auto pointer_type_id = pointer->type_id(); const auto pointer_type = _.FindDef(pointer_type_id); - if (!pointer_type || pointer_type->opcode() != SpvOpTypePointer) { + if (!pointer_type || pointer_type->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << opname << " type for pointer " << _.getIdName(pointer_id) << " is not a pointer type."; @@ -1546,11 +1629,11 @@ spv_result_t ValidateCooperativeMatrixLoadStoreNV(ValidationState_t& _, const auto storage_class_index = 1u; const auto storage_class = - pointer_type->GetOperandAs(storage_class_index); + pointer_type->GetOperandAs(storage_class_index); - if (storage_class != SpvStorageClassWorkgroup && - storage_class != SpvStorageClassStorageBuffer && - storage_class != SpvStorageClassPhysicalStorageBuffer) { + if (storage_class != spv::StorageClass::Workgroup && + storage_class != spv::StorageClass::StorageBuffer && + storage_class != spv::StorageClass::PhysicalStorageBuffer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << opname << " storage class for pointer type " << _.getIdName(pointer_type_id) @@ -1567,7 +1650,7 @@ spv_result_t ValidateCooperativeMatrixLoadStoreNV(ValidationState_t& _, } const auto stride_index = - (inst->opcode() == SpvOpCooperativeMatrixLoadNV) ? 3u : 2u; + (inst->opcode() == spv::Op::OpCooperativeMatrixLoadNV) ? 3u : 2u; const auto stride_id = inst->GetOperandAs(stride_index); const auto stride = _.FindDef(stride_id); if (!stride || !_.IsIntScalarType(stride->type_id())) { @@ -1577,7 +1660,7 @@ spv_result_t ValidateCooperativeMatrixLoadStoreNV(ValidationState_t& _, } const auto colmajor_index = - (inst->opcode() == SpvOpCooperativeMatrixLoadNV) ? 4u : 3u; + (inst->opcode() == spv::Op::OpCooperativeMatrixLoadNV) ? 4u : 3u; const auto colmajor_id = inst->GetOperandAs(colmajor_index); const auto colmajor = _.FindDef(colmajor_id); if (!colmajor || !_.IsBoolScalarType(colmajor->type_id()) || @@ -1589,7 +1672,114 @@ spv_result_t ValidateCooperativeMatrixLoadStoreNV(ValidationState_t& _, } const auto memory_access_index = - (inst->opcode() == SpvOpCooperativeMatrixLoadNV) ? 5u : 4u; + (inst->opcode() == spv::Op::OpCooperativeMatrixLoadNV) ? 5u : 4u; + if (inst->operands().size() > memory_access_index) { + if (auto error = CheckMemoryAccess(_, inst, memory_access_index)) + return error; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateCooperativeMatrixLoadStoreKHR(ValidationState_t& _, + const Instruction* inst) { + uint32_t type_id; + const char* opname; + if (inst->opcode() == spv::Op::OpCooperativeMatrixLoadKHR) { + type_id = inst->type_id(); + opname = "spv::Op::OpCooperativeMatrixLoadKHR"; + } else { + // get Object operand's type + type_id = _.FindDef(inst->GetOperandAs(1))->type_id(); + opname = "spv::Op::OpCooperativeMatrixStoreKHR"; + } + + auto matrix_type = _.FindDef(type_id); + + if (matrix_type->opcode() != spv::Op::OpTypeCooperativeMatrixKHR) { + if (inst->opcode() == spv::Op::OpCooperativeMatrixLoadKHR) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "spv::Op::OpCooperativeMatrixLoadKHR Result Type " + << _.getIdName(type_id) << " is not a cooperative matrix type."; + } else { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "spv::Op::OpCooperativeMatrixStoreKHR Object type " + << _.getIdName(type_id) << " is not a cooperative matrix type."; + } + } + + const auto pointer_index = + (inst->opcode() == spv::Op::OpCooperativeMatrixLoadKHR) ? 2u : 0u; + const auto pointer_id = inst->GetOperandAs(pointer_index); + const auto pointer = _.FindDef(pointer_id); + if (!pointer || + ((_.addressing_model() == spv::AddressingModel::Logical) && + ((!_.features().variable_pointers && + !spvOpcodeReturnsLogicalPointer(pointer->opcode())) || + (_.features().variable_pointers && + !spvOpcodeReturnsLogicalVariablePointer(pointer->opcode()))))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opname << " Pointer " << _.getIdName(pointer_id) + << " is not a logical pointer."; + } + + const auto pointer_type_id = pointer->type_id(); + const auto pointer_type = _.FindDef(pointer_type_id); + if (!pointer_type || pointer_type->opcode() != spv::Op::OpTypePointer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opname << " type for pointer " << _.getIdName(pointer_id) + << " is not a pointer type."; + } + + const auto storage_class_index = 1u; + const auto storage_class = + pointer_type->GetOperandAs(storage_class_index); + + if (storage_class != spv::StorageClass::Workgroup && + storage_class != spv::StorageClass::StorageBuffer && + storage_class != spv::StorageClass::PhysicalStorageBuffer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(8973) << opname + << " storage class for pointer type " + << _.getIdName(pointer_type_id) + << " is not Workgroup, StorageBuffer, or PhysicalStorageBuffer."; + } + + const auto pointee_id = pointer_type->GetOperandAs(2); + const auto pointee_type = _.FindDef(pointee_id); + if (!pointee_type || !(_.IsIntScalarOrVectorType(pointee_id) || + _.IsFloatScalarOrVectorType(pointee_id))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opname << " Pointer " << _.getIdName(pointer->id()) + << "s Type must be a scalar or vector type."; + } + + const auto layout_index = + (inst->opcode() == spv::Op::OpCooperativeMatrixLoadKHR) ? 3u : 2u; + const auto colmajor_id = inst->GetOperandAs(layout_index); + const auto colmajor = _.FindDef(colmajor_id); + if (!colmajor || !_.IsIntScalarType(colmajor->type_id()) || + !(spvOpcodeIsConstant(colmajor->opcode()) || + spvOpcodeIsSpecConstant(colmajor->opcode()))) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "MemoryLayout operand " << _.getIdName(colmajor_id) + << " must be a 32-bit integer constant instruction."; + } + + const auto stride_index = + (inst->opcode() == spv::Op::OpCooperativeMatrixLoadKHR) ? 4u : 3u; + if (inst->operands().size() > stride_index) { + const auto stride_id = inst->GetOperandAs(stride_index); + const auto stride = _.FindDef(stride_id); + if (!stride || !_.IsIntScalarType(stride->type_id())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Stride operand " << _.getIdName(stride_id) + << " must be a scalar integer type."; + } + } + + const auto memory_access_index = + (inst->opcode() == spv::Op::OpCooperativeMatrixLoadKHR) ? 5u : 4u; if (inst->operands().size() > memory_access_index) { if (auto error = CheckMemoryAccess(_, inst, memory_access_index)) return error; @@ -1600,7 +1790,7 @@ spv_result_t ValidateCooperativeMatrixLoadStoreNV(ValidationState_t& _, spv_result_t ValidatePtrComparison(ValidationState_t& _, const Instruction* inst) { - if (_.addressing_model() == SpvAddressingModelLogical && + if (_.addressing_model() == spv::AddressingModel::Logical && !_.features().variable_pointers) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Instruction cannot for logical addressing model be used without " @@ -1608,13 +1798,13 @@ spv_result_t ValidatePtrComparison(ValidationState_t& _, } const auto result_type = _.FindDef(inst->type_id()); - if (inst->opcode() == SpvOpPtrDiff) { - if (!result_type || result_type->opcode() != SpvOpTypeInt) { + if (inst->opcode() == spv::Op::OpPtrDiff) { + if (!result_type || result_type->opcode() != spv::Op::OpTypeInt) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Result Type must be an integer scalar"; } } else { - if (!result_type || result_type->opcode() != SpvOpTypeBool) { + if (!result_type || result_type->opcode() != spv::Op::OpTypeBool) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Result Type must be OpTypeBool"; } @@ -1627,25 +1817,26 @@ spv_result_t ValidatePtrComparison(ValidationState_t& _, << "The types of Operand 1 and Operand 2 must match"; } const auto op1_type = _.FindDef(op1->type_id()); - if (!op1_type || op1_type->opcode() != SpvOpTypePointer) { + if (!op1_type || op1_type->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Operand type must be a pointer"; } - SpvStorageClass sc = op1_type->GetOperandAs(1u); - if (_.addressing_model() == SpvAddressingModelLogical) { - if (sc != SpvStorageClassWorkgroup && sc != SpvStorageClassStorageBuffer) { + spv::StorageClass sc = op1_type->GetOperandAs(1u); + if (_.addressing_model() == spv::AddressingModel::Logical) { + if (sc != spv::StorageClass::Workgroup && + sc != spv::StorageClass::StorageBuffer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Invalid pointer storage class"; } - if (sc == SpvStorageClassWorkgroup && - !_.HasCapability(SpvCapabilityVariablePointers)) { + if (sc == spv::StorageClass::Workgroup && + !_.HasCapability(spv::Capability::VariablePointers)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Workgroup storage class pointer requires VariablePointers " "capability to be specified"; } - } else if (sc == SpvStorageClassPhysicalStorageBuffer) { + } else if (sc == spv::StorageClass::PhysicalStorageBuffer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Cannot use a pointer in the PhysicalStorageBuffer storage class"; } @@ -1657,45 +1848,51 @@ spv_result_t ValidatePtrComparison(ValidationState_t& _, spv_result_t MemoryPass(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { - case SpvOpVariable: + case spv::Op::OpVariable: if (auto error = ValidateVariable(_, inst)) return error; break; - case SpvOpLoad: + case spv::Op::OpLoad: if (auto error = ValidateLoad(_, inst)) return error; break; - case SpvOpStore: + case spv::Op::OpStore: if (auto error = ValidateStore(_, inst)) return error; break; - case SpvOpCopyMemory: - case SpvOpCopyMemorySized: + case spv::Op::OpCopyMemory: + case spv::Op::OpCopyMemorySized: if (auto error = ValidateCopyMemory(_, inst)) return error; break; - case SpvOpPtrAccessChain: + case spv::Op::OpPtrAccessChain: if (auto error = ValidatePtrAccessChain(_, inst)) return error; break; - case SpvOpAccessChain: - case SpvOpInBoundsAccessChain: - case SpvOpInBoundsPtrAccessChain: + case spv::Op::OpAccessChain: + case spv::Op::OpInBoundsAccessChain: + case spv::Op::OpInBoundsPtrAccessChain: if (auto error = ValidateAccessChain(_, inst)) return error; break; - case SpvOpArrayLength: + case spv::Op::OpArrayLength: if (auto error = ValidateArrayLength(_, inst)) return error; break; - case SpvOpCooperativeMatrixLoadNV: - case SpvOpCooperativeMatrixStoreNV: + case spv::Op::OpCooperativeMatrixLoadNV: + case spv::Op::OpCooperativeMatrixStoreNV: if (auto error = ValidateCooperativeMatrixLoadStoreNV(_, inst)) return error; break; - case SpvOpCooperativeMatrixLengthNV: + case spv::Op::OpCooperativeMatrixLengthKHR: + case spv::Op::OpCooperativeMatrixLengthNV: if (auto error = ValidateCooperativeMatrixLengthNV(_, inst)) return error; break; - case SpvOpPtrEqual: - case SpvOpPtrNotEqual: - case SpvOpPtrDiff: + case spv::Op::OpCooperativeMatrixLoadKHR: + case spv::Op::OpCooperativeMatrixStoreKHR: + if (auto error = ValidateCooperativeMatrixLoadStoreKHR(_, inst)) + return error; + break; + case spv::Op::OpPtrEqual: + case spv::Op::OpPtrNotEqual: + case spv::Op::OpPtrDiff: if (auto error = ValidatePtrComparison(_, inst)) return error; break; - case SpvOpImageTexelPointer: - case SpvOpGenericPtrMemSemantics: + case spv::Op::OpImageTexelPointer: + case spv::Op::OpGenericPtrMemSemantics: default: break; } diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_memory_semantics.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_memory_semantics.cpp index d9189313..c4f22a61 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_memory_semantics.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_memory_semantics.cpp @@ -14,7 +14,6 @@ #include "source/val/validate_memory_semantics.h" -#include "source/diagnostic.h" #include "source/spirv_target_env.h" #include "source/util/bitutils.h" #include "source/val/instruction.h" @@ -27,7 +26,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, const Instruction* inst, uint32_t operand_index, uint32_t memory_scope) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); const auto id = inst->GetOperandAs(operand_index); bool is_int32 = false, is_const_int32 = false; uint32_t value = 0; @@ -40,15 +39,15 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, } if (!is_const_int32) { - if (_.HasCapability(SpvCapabilityShader) && - !_.HasCapability(SpvCapabilityCooperativeMatrixNV)) { + if (_.HasCapability(spv::Capability::Shader) && + !_.HasCapability(spv::Capability::CooperativeMatrixNV)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Memory Semantics ids must be OpConstant when Shader " "capability is present"; } - if (_.HasCapability(SpvCapabilityShader) && - _.HasCapability(SpvCapabilityCooperativeMatrixNV) && + if (_.HasCapability(spv::Capability::Shader) && + _.HasCapability(spv::Capability::CooperativeMatrixNV) && !spvOpcodeIsConstant(_.GetIdOpcode(id))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Memory Semantics must be a constant instruction when " @@ -58,9 +57,10 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, } const size_t num_memory_order_set_bits = spvtools::utils::CountSetBits( - value & (SpvMemorySemanticsAcquireMask | SpvMemorySemanticsReleaseMask | - SpvMemorySemanticsAcquireReleaseMask | - SpvMemorySemanticsSequentiallyConsistentMask)); + value & uint32_t(spv::MemorySemanticsMask::Acquire | + spv::MemorySemanticsMask::Release | + spv::MemorySemanticsMask::AcquireRelease | + spv::MemorySemanticsMask::SequentiallyConsistent)); if (num_memory_order_set_bits > 1) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -71,40 +71,40 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, "SequentiallyConsistent"; } - if (_.memory_model() == SpvMemoryModelVulkanKHR && - value & SpvMemorySemanticsSequentiallyConsistentMask) { + if (_.memory_model() == spv::MemoryModel::VulkanKHR && + value & uint32_t(spv::MemorySemanticsMask::SequentiallyConsistent)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "SequentiallyConsistent memory " "semantics cannot be used with " "the VulkanKHR memory model."; } - if (value & SpvMemorySemanticsMakeAvailableKHRMask && - !_.HasCapability(SpvCapabilityVulkanMemoryModelKHR)) { + if (value & uint32_t(spv::MemorySemanticsMask::MakeAvailableKHR) && + !_.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Memory Semantics MakeAvailableKHR requires capability " << "VulkanMemoryModelKHR"; } - if (value & SpvMemorySemanticsMakeVisibleKHRMask && - !_.HasCapability(SpvCapabilityVulkanMemoryModelKHR)) { + if (value & uint32_t(spv::MemorySemanticsMask::MakeVisibleKHR) && + !_.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Memory Semantics MakeVisibleKHR requires capability " << "VulkanMemoryModelKHR"; } - if (value & SpvMemorySemanticsOutputMemoryKHRMask && - !_.HasCapability(SpvCapabilityVulkanMemoryModelKHR)) { + if (value & uint32_t(spv::MemorySemanticsMask::OutputMemoryKHR) && + !_.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Memory Semantics OutputMemoryKHR requires capability " << "VulkanMemoryModelKHR"; } - if (value & SpvMemorySemanticsVolatileMask) { - if (!_.HasCapability(SpvCapabilityVulkanMemoryModelKHR)) { + if (value & uint32_t(spv::MemorySemanticsMask::Volatile)) { + if (!_.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Memory Semantics Volatile requires capability " @@ -118,26 +118,27 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, } } - if (value & SpvMemorySemanticsUniformMemoryMask && - !_.HasCapability(SpvCapabilityShader)) { + if (value & uint32_t(spv::MemorySemanticsMask::UniformMemory) && + !_.HasCapability(spv::Capability::Shader)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Memory Semantics UniformMemory requires capability Shader"; } - // Checking for SpvCapabilityAtomicStorage is intentionally not done here. See - // https://github.com/KhronosGroup/glslang/issues/1618 for the reasoning why. + // Checking for spv::Capability::AtomicStorage is intentionally not done here. + // See https://github.com/KhronosGroup/glslang/issues/1618 for the reasoning + // why. - if (value & (SpvMemorySemanticsMakeAvailableKHRMask | - SpvMemorySemanticsMakeVisibleKHRMask)) { + if (value & uint32_t(spv::MemorySemanticsMask::MakeAvailableKHR | + spv::MemorySemanticsMask::MakeVisibleKHR)) { const bool includes_storage_class = - value & (SpvMemorySemanticsUniformMemoryMask | - SpvMemorySemanticsSubgroupMemoryMask | - SpvMemorySemanticsWorkgroupMemoryMask | - SpvMemorySemanticsCrossWorkgroupMemoryMask | - SpvMemorySemanticsAtomicCounterMemoryMask | - SpvMemorySemanticsImageMemoryMask | - SpvMemorySemanticsOutputMemoryKHRMask); + value & uint32_t(spv::MemorySemanticsMask::UniformMemory | + spv::MemorySemanticsMask::SubgroupMemory | + spv::MemorySemanticsMask::WorkgroupMemory | + spv::MemorySemanticsMask::CrossWorkgroupMemory | + spv::MemorySemanticsMask::AtomicCounterMemory | + spv::MemorySemanticsMask::ImageMemory | + spv::MemorySemanticsMask::OutputMemoryKHR); if (!includes_storage_class) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -146,18 +147,18 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, } } - if (value & SpvMemorySemanticsMakeVisibleKHRMask && - !(value & (SpvMemorySemanticsAcquireMask | - SpvMemorySemanticsAcquireReleaseMask))) { + if (value & uint32_t(spv::MemorySemanticsMask::MakeVisibleKHR) && + !(value & uint32_t(spv::MemorySemanticsMask::Acquire | + spv::MemorySemanticsMask::AcquireRelease))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": MakeVisibleKHR Memory Semantics also requires either Acquire " "or AcquireRelease Memory Semantics"; } - if (value & SpvMemorySemanticsMakeAvailableKHRMask && - !(value & (SpvMemorySemanticsReleaseMask | - SpvMemorySemanticsAcquireReleaseMask))) { + if (value & uint32_t(spv::MemorySemanticsMask::MakeAvailableKHR) && + !(value & uint32_t(spv::MemorySemanticsMask::Release | + spv::MemorySemanticsMask::AcquireRelease))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": MakeAvailableKHR Memory Semantics also requires either " @@ -166,12 +167,12 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, if (spvIsVulkanEnv(_.context()->target_env)) { const bool includes_storage_class = - value & (SpvMemorySemanticsUniformMemoryMask | - SpvMemorySemanticsWorkgroupMemoryMask | - SpvMemorySemanticsImageMemoryMask | - SpvMemorySemanticsOutputMemoryKHRMask); + value & uint32_t(spv::MemorySemanticsMask::UniformMemory | + spv::MemorySemanticsMask::WorkgroupMemory | + spv::MemorySemanticsMask::ImageMemory | + spv::MemorySemanticsMask::OutputMemoryKHR); - if (opcode == SpvOpMemoryBarrier && !num_memory_order_set_bits) { + if (opcode == spv::Op::OpMemoryBarrier && !num_memory_order_set_bits) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4732) << spvOpcodeString(opcode) << ": Vulkan specification requires Memory Semantics to have " @@ -179,13 +180,15 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, "of the following bits set: Acquire, Release, " "AcquireRelease " "or SequentiallyConsistent"; - } else if (opcode != SpvOpMemoryBarrier && num_memory_order_set_bits) { + } else if (opcode != spv::Op::OpMemoryBarrier && + num_memory_order_set_bits) { // should leave only atomics and control barriers for Vulkan env bool memory_is_int32 = false, memory_is_const_int32 = false; uint32_t memory_value = 0; std::tie(memory_is_int32, memory_is_const_int32, memory_value) = _.EvalInt32IfConst(memory_scope); - if (memory_is_int32 && memory_value == SpvScopeInvocation) { + if (memory_is_int32 && + spv::Scope(memory_value) == spv::Scope::Invocation) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4641) << spvOpcodeString(opcode) << ": Vulkan specification requires Memory Semantics to be None " @@ -193,7 +196,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, } } - if (opcode == SpvOpMemoryBarrier && !includes_storage_class) { + if (opcode == spv::Op::OpMemoryBarrier && !includes_storage_class) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4733) << spvOpcodeString(opcode) << ": expected Memory Semantics to include a Vulkan-supported " @@ -202,7 +205,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, #if 0 // TODO(atgoo@github.com): this check fails Vulkan CTS, reenable once fixed. - if (opcode == SpvOpControlBarrier && value && !includes_storage_class) { + if (opcode == spv::Op::OpControlBarrier && value && !includes_storage_class) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": expected Memory Semantics to include a Vulkan-supported " @@ -211,18 +214,18 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, #endif } - if (opcode == SpvOpAtomicFlagClear && - (value & SpvMemorySemanticsAcquireMask || - value & SpvMemorySemanticsAcquireReleaseMask)) { + if (opcode == spv::Op::OpAtomicFlagClear && + (value & uint32_t(spv::MemorySemanticsMask::Acquire) || + value & uint32_t(spv::MemorySemanticsMask::AcquireRelease))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Memory Semantics Acquire and AcquireRelease cannot be used " "with " << spvOpcodeString(opcode); } - if (opcode == SpvOpAtomicCompareExchange && operand_index == 5 && - (value & SpvMemorySemanticsReleaseMask || - value & SpvMemorySemanticsAcquireReleaseMask)) { + if (opcode == spv::Op::OpAtomicCompareExchange && operand_index == 5 && + (value & uint32_t(spv::MemorySemanticsMask::Release) || + value & uint32_t(spv::MemorySemanticsMask::AcquireRelease))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Memory Semantics Release and AcquireRelease cannot be " @@ -231,20 +234,20 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _, } if (spvIsVulkanEnv(_.context()->target_env)) { - if (opcode == SpvOpAtomicLoad && - (value & SpvMemorySemanticsReleaseMask || - value & SpvMemorySemanticsAcquireReleaseMask || - value & SpvMemorySemanticsSequentiallyConsistentMask)) { + if (opcode == spv::Op::OpAtomicLoad && + (value & uint32_t(spv::MemorySemanticsMask::Release) || + value & uint32_t(spv::MemorySemanticsMask::AcquireRelease) || + value & uint32_t(spv::MemorySemanticsMask::SequentiallyConsistent))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4731) << "Vulkan spec disallows OpAtomicLoad with Memory Semantics " "Release, AcquireRelease and SequentiallyConsistent"; } - if (opcode == SpvOpAtomicStore && - (value & SpvMemorySemanticsAcquireMask || - value & SpvMemorySemanticsAcquireReleaseMask || - value & SpvMemorySemanticsSequentiallyConsistentMask)) { + if (opcode == spv::Op::OpAtomicStore && + (value & uint32_t(spv::MemorySemanticsMask::Acquire) || + value & uint32_t(spv::MemorySemanticsMask::AcquireRelease) || + value & uint32_t(spv::MemorySemanticsMask::SequentiallyConsistent))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4730) << "Vulkan spec disallows OpAtomicStore with Memory Semantics " diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_mesh_shading.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_mesh_shading.cpp index a7f07267..e569e251 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_mesh_shading.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_mesh_shading.cpp @@ -23,13 +23,13 @@ namespace spvtools { namespace val { spv_result_t MeshShadingPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); switch (opcode) { - case SpvOpEmitMeshTasksEXT: { + case spv::Op::OpEmitMeshTasksEXT: { _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelTaskEXT) { + [](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::TaskEXT) { if (message) { *message = "OpEmitMeshTasksEXT requires TaskEXT execution model"; @@ -62,12 +62,12 @@ spv_result_t MeshShadingPass(ValidationState_t& _, const Instruction* inst) { if (inst->operands().size() == 4) { const auto payload = _.FindDef(inst->GetOperandAs(3)); - if (payload->opcode() != SpvOpVariable) { + if (payload->opcode() != spv::Op::OpVariable) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Payload must be the result of a OpVariable"; } - if (SpvStorageClass(payload->GetOperandAs(2)) != - SpvStorageClassTaskPayloadWorkgroupEXT) { + if (payload->GetOperandAs(2) != + spv::StorageClass::TaskPayloadWorkgroupEXT) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Payload OpVariable must have a storage class of " "TaskPayloadWorkgroupEXT"; @@ -76,11 +76,11 @@ spv_result_t MeshShadingPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpSetMeshOutputsEXT: { + case spv::Op::OpSetMeshOutputsEXT: { _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelMeshEXT) { + [](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::MeshEXT) { if (message) { *message = "OpSetMeshOutputsEXT requires MeshEXT execution model"; @@ -107,7 +107,7 @@ spv_result_t MeshShadingPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpWritePackedPrimitiveIndices4x8NV: { + case spv::Op::OpWritePackedPrimitiveIndices4x8NV: { // No validation rules (for the moment). break; } diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_misc.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_misc.cpp index 5acc21ea..d71fd2d2 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_misc.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_misc.cpp @@ -30,7 +30,7 @@ spv_result_t ValidateUndef(ValidationState_t& _, const Instruction* inst) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Cannot create undefined values with void type"; } - if (_.HasCapability(SpvCapabilityShader) && + if (_.HasCapability(spv::Capability::Shader) && _.ContainsLimitedUseIntOrFloatType(inst->type_id()) && !_.IsPointerType(inst->type_id())) { return _.diag(SPV_ERROR_INVALID_ID, inst) @@ -50,7 +50,8 @@ spv_result_t ValidateShaderClock(ValidationState_t& _, bool is_int32 = false, is_const_int32 = false; uint32_t value = 0; std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(scope); - if (is_const_int32 && value != SpvScopeSubgroup && value != SpvScopeDevice) { + if (is_const_int32 && spv::Scope(value) != spv::Scope::Subgroup && + spv::Scope(value) != spv::Scope::Device) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4652) << "Scope must be Subgroup or Device"; } @@ -104,18 +105,18 @@ spv_result_t ValidateExpect(ValidationState_t& _, const Instruction* inst) { spv_result_t MiscPass(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { - case SpvOpUndef: + case spv::Op::OpUndef: if (auto error = ValidateUndef(_, inst)) return error; break; default: break; } switch (inst->opcode()) { - case SpvOpBeginInvocationInterlockEXT: - case SpvOpEndInvocationInterlockEXT: + case spv::Op::OpBeginInvocationInterlockEXT: + case spv::Op::OpEndInvocationInterlockEXT: _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - SpvExecutionModelFragment, + spv::ExecutionModel::Fragment, "OpBeginInvocationInterlockEXT/OpEndInvocationInterlockEXT " "require Fragment execution model"); @@ -126,14 +127,14 @@ spv_result_t MiscPass(ValidationState_t& _, const Instruction* inst) { const auto* execution_modes = state.GetExecutionModes(entry_point->id()); - auto find_interlock = [](const SpvExecutionMode& mode) { + auto find_interlock = [](const spv::ExecutionMode& mode) { switch (mode) { - case SpvExecutionModePixelInterlockOrderedEXT: - case SpvExecutionModePixelInterlockUnorderedEXT: - case SpvExecutionModeSampleInterlockOrderedEXT: - case SpvExecutionModeSampleInterlockUnorderedEXT: - case SpvExecutionModeShadingRateInterlockOrderedEXT: - case SpvExecutionModeShadingRateInterlockUnorderedEXT: + case spv::ExecutionMode::PixelInterlockOrderedEXT: + case spv::ExecutionMode::PixelInterlockUnorderedEXT: + case spv::ExecutionMode::SampleInterlockOrderedEXT: + case spv::ExecutionMode::SampleInterlockUnorderedEXT: + case spv::ExecutionMode::ShadingRateInterlockOrderedEXT: + case spv::ExecutionMode::ShadingRateInterlockUnorderedEXT: return true; default: return false; @@ -156,18 +157,18 @@ spv_result_t MiscPass(ValidationState_t& _, const Instruction* inst) { return true; }); break; - case SpvOpDemoteToHelperInvocationEXT: + case spv::Op::OpDemoteToHelperInvocationEXT: _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - SpvExecutionModelFragment, + spv::ExecutionModel::Fragment, "OpDemoteToHelperInvocationEXT requires Fragment execution " "model"); break; - case SpvOpIsHelperInvocationEXT: { + case spv::Op::OpIsHelperInvocationEXT: { const uint32_t result_type = inst->type_id(); _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - SpvExecutionModelFragment, + spv::ExecutionModel::Fragment, "OpIsHelperInvocationEXT requires Fragment execution model"); if (!_.IsBoolScalarType(result_type)) return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -175,17 +176,17 @@ spv_result_t MiscPass(ValidationState_t& _, const Instruction* inst) { << spvOpcodeString(inst->opcode()); break; } - case SpvOpReadClockKHR: + case spv::Op::OpReadClockKHR: if (auto error = ValidateShaderClock(_, inst)) { return error; } break; - case SpvOpAssumeTrueKHR: + case spv::Op::OpAssumeTrueKHR: if (auto error = ValidateAssumeTrue(_, inst)) { return error; } break; - case SpvOpExpectKHR: + case spv::Op::OpExpectKHR: if (auto error = ValidateExpect(_, inst)) { return error; } diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_mode_setting.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_mode_setting.cpp index 672192b9..d757d4f8 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_mode_setting.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_mode_setting.cpp @@ -27,16 +27,16 @@ namespace { spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { const auto entry_point_id = inst->GetOperandAs(1); auto entry_point = _.FindDef(entry_point_id); - if (!entry_point || SpvOpFunction != entry_point->opcode()) { + if (!entry_point || spv::Op::OpFunction != entry_point->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpEntryPoint Entry Point " << _.getIdName(entry_point_id) << " is not a function."; } // Only check the shader execution models - const SpvExecutionModel execution_model = - inst->GetOperandAs(0); - if (execution_model != SpvExecutionModelKernel) { + const spv::ExecutionModel execution_model = + inst->GetOperandAs(0); + if (execution_model != spv::ExecutionModel::Kernel) { const auto entry_point_type_id = entry_point->GetOperandAs(3); const auto entry_point_type = _.FindDef(entry_point_type_id); if (!entry_point_type || 3 != entry_point_type->words().size()) { @@ -48,7 +48,7 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { } auto return_type = _.FindDef(entry_point->type_id()); - if (!return_type || SpvOpTypeVoid != return_type->opcode()) { + if (!return_type || spv::Op::OpTypeVoid != return_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4633) << "OpEntryPoint Entry Point " << _.getIdName(entry_point_id) @@ -56,31 +56,31 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { } const auto* execution_modes = _.GetExecutionModes(entry_point_id); - if (_.HasCapability(SpvCapabilityShader)) { + if (_.HasCapability(spv::Capability::Shader)) { switch (execution_model) { - case SpvExecutionModelFragment: + case spv::ExecutionModel::Fragment: if (execution_modes && - execution_modes->count(SpvExecutionModeOriginUpperLeft) && - execution_modes->count(SpvExecutionModeOriginLowerLeft)) { + execution_modes->count(spv::ExecutionMode::OriginUpperLeft) && + execution_modes->count(spv::ExecutionMode::OriginLowerLeft)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Fragment execution model entry points can only specify " "one of OriginUpperLeft or OriginLowerLeft execution " "modes."; } if (!execution_modes || - (!execution_modes->count(SpvExecutionModeOriginUpperLeft) && - !execution_modes->count(SpvExecutionModeOriginLowerLeft))) { + (!execution_modes->count(spv::ExecutionMode::OriginUpperLeft) && + !execution_modes->count(spv::ExecutionMode::OriginLowerLeft))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Fragment execution model entry points require either an " "OriginUpperLeft or OriginLowerLeft execution mode."; } if (execution_modes && 1 < std::count_if(execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { + [](const spv::ExecutionMode& mode) { switch (mode) { - case SpvExecutionModeDepthGreater: - case SpvExecutionModeDepthLess: - case SpvExecutionModeDepthUnchanged: + case spv::ExecutionMode::DepthGreater: + case spv::ExecutionMode::DepthLess: + case spv::ExecutionMode::DepthUnchanged: return true; default: return false; @@ -94,14 +94,15 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { if (execution_modes && 1 < std::count_if( execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { + [](const spv::ExecutionMode& mode) { switch (mode) { - case SpvExecutionModePixelInterlockOrderedEXT: - case SpvExecutionModePixelInterlockUnorderedEXT: - case SpvExecutionModeSampleInterlockOrderedEXT: - case SpvExecutionModeSampleInterlockUnorderedEXT: - case SpvExecutionModeShadingRateInterlockOrderedEXT: - case SpvExecutionModeShadingRateInterlockUnorderedEXT: + case spv::ExecutionMode::PixelInterlockOrderedEXT: + case spv::ExecutionMode::PixelInterlockUnorderedEXT: + case spv::ExecutionMode::SampleInterlockOrderedEXT: + case spv::ExecutionMode::SampleInterlockUnorderedEXT: + case spv::ExecutionMode::ShadingRateInterlockOrderedEXT: + case spv::ExecutionMode:: + ShadingRateInterlockUnorderedEXT: return true; default: return false; @@ -114,11 +115,11 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { if (execution_modes && 1 < std::count_if( execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { + [](const spv::ExecutionMode& mode) { switch (mode) { - case SpvExecutionModeStencilRefUnchangedFrontAMD: - case SpvExecutionModeStencilRefLessFrontAMD: - case SpvExecutionModeStencilRefGreaterFrontAMD: + case spv::ExecutionMode::StencilRefUnchangedFrontAMD: + case spv::ExecutionMode::StencilRefLessFrontAMD: + case spv::ExecutionMode::StencilRefGreaterFrontAMD: return true; default: return false; @@ -133,11 +134,11 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { if (execution_modes && 1 < std::count_if( execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { + [](const spv::ExecutionMode& mode) { switch (mode) { - case SpvExecutionModeStencilRefUnchangedBackAMD: - case SpvExecutionModeStencilRefLessBackAMD: - case SpvExecutionModeStencilRefGreaterBackAMD: + case spv::ExecutionMode::StencilRefUnchangedBackAMD: + case spv::ExecutionMode::StencilRefLessBackAMD: + case spv::ExecutionMode::StencilRefGreaterBackAMD: return true; default: return false; @@ -150,20 +151,21 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { "execution modes."; } break; - case SpvExecutionModelTessellationControl: - case SpvExecutionModelTessellationEvaluation: + case spv::ExecutionModel::TessellationControl: + case spv::ExecutionModel::TessellationEvaluation: if (execution_modes && - 1 < std::count_if(execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { - switch (mode) { - case SpvExecutionModeSpacingEqual: - case SpvExecutionModeSpacingFractionalEven: - case SpvExecutionModeSpacingFractionalOdd: - return true; - default: - return false; - } - })) { + 1 < std::count_if( + execution_modes->begin(), execution_modes->end(), + [](const spv::ExecutionMode& mode) { + switch (mode) { + case spv::ExecutionMode::SpacingEqual: + case spv::ExecutionMode::SpacingFractionalEven: + case spv::ExecutionMode::SpacingFractionalOdd: + return true; + default: + return false; + } + })) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Tessellation execution model entry points can specify at " "most one of SpacingEqual, SpacingFractionalOdd or " @@ -171,11 +173,11 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { } if (execution_modes && 1 < std::count_if(execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { + [](const spv::ExecutionMode& mode) { switch (mode) { - case SpvExecutionModeTriangles: - case SpvExecutionModeQuads: - case SpvExecutionModeIsolines: + case spv::ExecutionMode::Triangles: + case spv::ExecutionMode::Quads: + case spv::ExecutionMode::Isolines: return true; default: return false; @@ -187,10 +189,10 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { } if (execution_modes && 1 < std::count_if(execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { + [](const spv::ExecutionMode& mode) { switch (mode) { - case SpvExecutionModeVertexOrderCw: - case SpvExecutionModeVertexOrderCcw: + case spv::ExecutionMode::VertexOrderCw: + case spv::ExecutionMode::VertexOrderCcw: return true; default: return false; @@ -202,21 +204,22 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { "modes."; } break; - case SpvExecutionModelGeometry: + case spv::ExecutionModel::Geometry: if (!execution_modes || - 1 != std::count_if(execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { - switch (mode) { - case SpvExecutionModeInputPoints: - case SpvExecutionModeInputLines: - case SpvExecutionModeInputLinesAdjacency: - case SpvExecutionModeTriangles: - case SpvExecutionModeInputTrianglesAdjacency: - return true; - default: - return false; - } - })) { + 1 != std::count_if( + execution_modes->begin(), execution_modes->end(), + [](const spv::ExecutionMode& mode) { + switch (mode) { + case spv::ExecutionMode::InputPoints: + case spv::ExecutionMode::InputLines: + case spv::ExecutionMode::InputLinesAdjacency: + case spv::ExecutionMode::Triangles: + case spv::ExecutionMode::InputTrianglesAdjacency: + return true; + default: + return false; + } + })) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Geometry execution model entry points must specify " "exactly one of InputPoints, InputLines, " @@ -225,11 +228,11 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { } if (!execution_modes || 1 != std::count_if(execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { + [](const spv::ExecutionMode& mode) { switch (mode) { - case SpvExecutionModeOutputPoints: - case SpvExecutionModeOutputLineStrip: - case SpvExecutionModeOutputTriangleStrip: + case spv::ExecutionMode::OutputPoints: + case spv::ExecutionMode::OutputLineStrip: + case spv::ExecutionMode::OutputTriangleStrip: return true; default: return false; @@ -241,14 +244,14 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { "OutputTriangleStrip execution modes."; } break; - case SpvExecutionModelMeshEXT: + case spv::ExecutionModel::MeshEXT: if (!execution_modes || 1 != std::count_if(execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { + [](const spv::ExecutionMode& mode) { switch (mode) { - case SpvExecutionModeOutputPoints: - case SpvExecutionModeOutputLinesEXT: - case SpvExecutionModeOutputTrianglesEXT: + case spv::ExecutionMode::OutputPoints: + case spv::ExecutionMode::OutputLinesEXT: + case spv::ExecutionMode::OutputTrianglesEXT: return true; default: return false; @@ -260,10 +263,10 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { "OutputTrianglesEXT Execution Modes."; } else if (2 != std::count_if( execution_modes->begin(), execution_modes->end(), - [](const SpvExecutionMode& mode) { + [](const spv::ExecutionMode& mode) { switch (mode) { - case SpvExecutionModeOutputPrimitivesEXT: - case SpvExecutionModeOutputVertices: + case spv::ExecutionMode::OutputPrimitivesEXT: + case spv::ExecutionMode::OutputVertices: return true; default: return false; @@ -281,23 +284,25 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { if (spvIsVulkanEnv(_.context()->target_env)) { switch (execution_model) { - case SpvExecutionModelGLCompute: + case spv::ExecutionModel::GLCompute: if (!execution_modes || - !execution_modes->count(SpvExecutionModeLocalSize)) { + !execution_modes->count(spv::ExecutionMode::LocalSize)) { bool ok = false; for (auto& i : _.ordered_instructions()) { - if (i.opcode() == SpvOpDecorate) { + if (i.opcode() == spv::Op::OpDecorate) { if (i.operands().size() > 2) { - if (i.GetOperandAs(1) == SpvDecorationBuiltIn && - i.GetOperandAs(2) == SpvBuiltInWorkgroupSize) { + if (i.GetOperandAs(1) == + spv::Decoration::BuiltIn && + i.GetOperandAs(2) == + spv::BuiltIn::WorkgroupSize) { ok = true; break; } } } - if (i.opcode() == SpvOpExecutionModeId) { - const auto mode = i.GetOperandAs(1); - if (mode == SpvExecutionModeLocalSizeId) { + if (i.opcode() == spv::Op::OpExecutionModeId) { + const auto mode = i.GetOperandAs(1); + if (mode == spv::ExecutionMode::LocalSizeId) { ok = true; break; } @@ -333,15 +338,15 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _, "operand of an OpEntryPoint."; } - const auto mode = inst->GetOperandAs(1); - if (inst->opcode() == SpvOpExecutionModeId) { + const auto mode = inst->GetOperandAs(1); + if (inst->opcode() == spv::Op::OpExecutionModeId) { size_t operand_count = inst->operands().size(); for (size_t i = 2; i < operand_count; ++i) { const auto operand_id = inst->GetOperandAs(2); const auto* operand_inst = _.FindDef(operand_id); - if (mode == SpvExecutionModeSubgroupsPerWorkgroupId || - mode == SpvExecutionModeLocalSizeHintId || - mode == SpvExecutionModeLocalSizeId) { + if (mode == spv::ExecutionMode::SubgroupsPerWorkgroupId || + mode == spv::ExecutionMode::LocalSizeHintId || + mode == spv::ExecutionMode::LocalSizeId) { if (!spvOpcodeIsConstant(operand_inst->opcode())) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "For OpExecutionModeId all Extra Operand ids must be " @@ -355,9 +360,9 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _, "operands."; } } - } else if (mode == SpvExecutionModeSubgroupsPerWorkgroupId || - mode == SpvExecutionModeLocalSizeHintId || - mode == SpvExecutionModeLocalSizeId) { + } else if (mode == spv::ExecutionMode::SubgroupsPerWorkgroupId || + mode == spv::ExecutionMode::LocalSizeHintId || + mode == spv::ExecutionMode::LocalSizeId) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "OpExecutionMode is only valid when the Mode operand is an " "execution mode that takes no Extra Operands, or takes Extra " @@ -366,39 +371,39 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _, const auto* models = _.GetExecutionModels(entry_point_id); switch (mode) { - case SpvExecutionModeInvocations: - case SpvExecutionModeInputPoints: - case SpvExecutionModeInputLines: - case SpvExecutionModeInputLinesAdjacency: - case SpvExecutionModeInputTrianglesAdjacency: - case SpvExecutionModeOutputLineStrip: - case SpvExecutionModeOutputTriangleStrip: + case spv::ExecutionMode::Invocations: + case spv::ExecutionMode::InputPoints: + case spv::ExecutionMode::InputLines: + case spv::ExecutionMode::InputLinesAdjacency: + case spv::ExecutionMode::InputTrianglesAdjacency: + case spv::ExecutionMode::OutputLineStrip: + case spv::ExecutionMode::OutputTriangleStrip: if (!std::all_of(models->begin(), models->end(), - [](const SpvExecutionModel& model) { - return model == SpvExecutionModelGeometry; + [](const spv::ExecutionModel& model) { + return model == spv::ExecutionModel::Geometry; })) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Execution mode can only be used with the Geometry execution " "model."; } break; - case SpvExecutionModeOutputPoints: - if (!std::all_of(models->begin(), models->end(), - [&_](const SpvExecutionModel& model) { - switch (model) { - case SpvExecutionModelGeometry: - return true; - case SpvExecutionModelMeshNV: - return _.HasCapability(SpvCapabilityMeshShadingNV); - case SpvExecutionModelMeshEXT: - return _.HasCapability( - SpvCapabilityMeshShadingEXT); - default: - return false; - } - })) { - if (_.HasCapability(SpvCapabilityMeshShadingNV) || - _.HasCapability(SpvCapabilityMeshShadingEXT)) { + case spv::ExecutionMode::OutputPoints: + if (!std::all_of( + models->begin(), models->end(), + [&_](const spv::ExecutionModel& model) { + switch (model) { + case spv::ExecutionModel::Geometry: + return true; + case spv::ExecutionModel::MeshNV: + return _.HasCapability(spv::Capability::MeshShadingNV); + case spv::ExecutionModel::MeshEXT: + return _.HasCapability(spv::Capability::MeshShadingEXT); + default: + return false; + } + })) { + if (_.HasCapability(spv::Capability::MeshShadingNV) || + _.HasCapability(spv::Capability::MeshShadingEXT)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Execution mode can only be used with the Geometry " "MeshNV or MeshEXT execution model."; @@ -410,32 +415,32 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _, } } break; - case SpvExecutionModeSpacingEqual: - case SpvExecutionModeSpacingFractionalEven: - case SpvExecutionModeSpacingFractionalOdd: - case SpvExecutionModeVertexOrderCw: - case SpvExecutionModeVertexOrderCcw: - case SpvExecutionModePointMode: - case SpvExecutionModeQuads: - case SpvExecutionModeIsolines: + case spv::ExecutionMode::SpacingEqual: + case spv::ExecutionMode::SpacingFractionalEven: + case spv::ExecutionMode::SpacingFractionalOdd: + case spv::ExecutionMode::VertexOrderCw: + case spv::ExecutionMode::VertexOrderCcw: + case spv::ExecutionMode::PointMode: + case spv::ExecutionMode::Quads: + case spv::ExecutionMode::Isolines: if (!std::all_of( models->begin(), models->end(), - [](const SpvExecutionModel& model) { - return (model == SpvExecutionModelTessellationControl) || - (model == SpvExecutionModelTessellationEvaluation); + [](const spv::ExecutionModel& model) { + return (model == spv::ExecutionModel::TessellationControl) || + (model == spv::ExecutionModel::TessellationEvaluation); })) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Execution mode can only be used with a tessellation " "execution model."; } break; - case SpvExecutionModeTriangles: + case spv::ExecutionMode::Triangles: if (!std::all_of(models->begin(), models->end(), - [](const SpvExecutionModel& model) { + [](const spv::ExecutionModel& model) { switch (model) { - case SpvExecutionModelGeometry: - case SpvExecutionModelTessellationControl: - case SpvExecutionModelTessellationEvaluation: + case spv::ExecutionModel::Geometry: + case spv::ExecutionModel::TessellationControl: + case spv::ExecutionModel::TessellationEvaluation: return true; default: return false; @@ -446,25 +451,25 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _, "tessellation execution model."; } break; - case SpvExecutionModeOutputVertices: - if (!std::all_of(models->begin(), models->end(), - [&_](const SpvExecutionModel& model) { - switch (model) { - case SpvExecutionModelGeometry: - case SpvExecutionModelTessellationControl: - case SpvExecutionModelTessellationEvaluation: - return true; - case SpvExecutionModelMeshNV: - return _.HasCapability(SpvCapabilityMeshShadingNV); - case SpvExecutionModelMeshEXT: - return _.HasCapability( - SpvCapabilityMeshShadingEXT); - default: - return false; - } - })) { - if (_.HasCapability(SpvCapabilityMeshShadingNV) || - _.HasCapability(SpvCapabilityMeshShadingEXT)) { + case spv::ExecutionMode::OutputVertices: + if (!std::all_of( + models->begin(), models->end(), + [&_](const spv::ExecutionModel& model) { + switch (model) { + case spv::ExecutionModel::Geometry: + case spv::ExecutionModel::TessellationControl: + case spv::ExecutionModel::TessellationEvaluation: + return true; + case spv::ExecutionModel::MeshNV: + return _.HasCapability(spv::Capability::MeshShadingNV); + case spv::ExecutionModel::MeshEXT: + return _.HasCapability(spv::Capability::MeshShadingEXT); + default: + return false; + } + })) { + if (_.HasCapability(spv::Capability::MeshShadingNV) || + _.HasCapability(spv::Capability::MeshShadingEXT)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Execution mode can only be used with a Geometry, " "tessellation, MeshNV or MeshEXT execution model."; @@ -475,13 +480,13 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _, } } break; - case SpvExecutionModeOutputLinesEXT: - case SpvExecutionModeOutputTrianglesEXT: - case SpvExecutionModeOutputPrimitivesEXT: + case spv::ExecutionMode::OutputLinesEXT: + case spv::ExecutionMode::OutputTrianglesEXT: + case spv::ExecutionMode::OutputPrimitivesEXT: if (!std::all_of(models->begin(), models->end(), - [](const SpvExecutionModel& model) { - return (model == SpvExecutionModelMeshEXT || - model == SpvExecutionModelMeshNV); + [](const spv::ExecutionModel& model) { + return (model == spv::ExecutionModel::MeshEXT || + model == spv::ExecutionModel::MeshNV); })) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Execution mode can only be used with the MeshEXT or MeshNV " @@ -489,74 +494,77 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _, "model."; } break; - case SpvExecutionModePixelCenterInteger: - case SpvExecutionModeOriginUpperLeft: - case SpvExecutionModeOriginLowerLeft: - case SpvExecutionModeEarlyFragmentTests: - case SpvExecutionModeDepthReplacing: - case SpvExecutionModeDepthGreater: - case SpvExecutionModeDepthLess: - case SpvExecutionModeDepthUnchanged: - case SpvExecutionModePixelInterlockOrderedEXT: - case SpvExecutionModePixelInterlockUnorderedEXT: - case SpvExecutionModeSampleInterlockOrderedEXT: - case SpvExecutionModeSampleInterlockUnorderedEXT: - case SpvExecutionModeShadingRateInterlockOrderedEXT: - case SpvExecutionModeShadingRateInterlockUnorderedEXT: - case SpvExecutionModeEarlyAndLateFragmentTestsAMD: - case SpvExecutionModeStencilRefUnchangedFrontAMD: - case SpvExecutionModeStencilRefGreaterFrontAMD: - case SpvExecutionModeStencilRefLessFrontAMD: - case SpvExecutionModeStencilRefUnchangedBackAMD: - case SpvExecutionModeStencilRefGreaterBackAMD: - case SpvExecutionModeStencilRefLessBackAMD: + case spv::ExecutionMode::PixelCenterInteger: + case spv::ExecutionMode::OriginUpperLeft: + case spv::ExecutionMode::OriginLowerLeft: + case spv::ExecutionMode::EarlyFragmentTests: + case spv::ExecutionMode::DepthReplacing: + case spv::ExecutionMode::DepthGreater: + case spv::ExecutionMode::DepthLess: + case spv::ExecutionMode::DepthUnchanged: + case spv::ExecutionMode::NonCoherentColorAttachmentReadEXT: + case spv::ExecutionMode::NonCoherentDepthAttachmentReadEXT: + case spv::ExecutionMode::NonCoherentStencilAttachmentReadEXT: + case spv::ExecutionMode::PixelInterlockOrderedEXT: + case spv::ExecutionMode::PixelInterlockUnorderedEXT: + case spv::ExecutionMode::SampleInterlockOrderedEXT: + case spv::ExecutionMode::SampleInterlockUnorderedEXT: + case spv::ExecutionMode::ShadingRateInterlockOrderedEXT: + case spv::ExecutionMode::ShadingRateInterlockUnorderedEXT: + case spv::ExecutionMode::EarlyAndLateFragmentTestsAMD: + case spv::ExecutionMode::StencilRefUnchangedFrontAMD: + case spv::ExecutionMode::StencilRefGreaterFrontAMD: + case spv::ExecutionMode::StencilRefLessFrontAMD: + case spv::ExecutionMode::StencilRefUnchangedBackAMD: + case spv::ExecutionMode::StencilRefGreaterBackAMD: + case spv::ExecutionMode::StencilRefLessBackAMD: if (!std::all_of(models->begin(), models->end(), - [](const SpvExecutionModel& model) { - return model == SpvExecutionModelFragment; + [](const spv::ExecutionModel& model) { + return model == spv::ExecutionModel::Fragment; })) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Execution mode can only be used with the Fragment execution " "model."; } break; - case SpvExecutionModeLocalSizeHint: - case SpvExecutionModeVecTypeHint: - case SpvExecutionModeContractionOff: - case SpvExecutionModeLocalSizeHintId: + case spv::ExecutionMode::LocalSizeHint: + case spv::ExecutionMode::VecTypeHint: + case spv::ExecutionMode::ContractionOff: + case spv::ExecutionMode::LocalSizeHintId: if (!std::all_of(models->begin(), models->end(), - [](const SpvExecutionModel& model) { - return model == SpvExecutionModelKernel; + [](const spv::ExecutionModel& model) { + return model == spv::ExecutionModel::Kernel; })) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Execution mode can only be used with the Kernel execution " "model."; } break; - case SpvExecutionModeLocalSize: - case SpvExecutionModeLocalSizeId: - if (mode == SpvExecutionModeLocalSizeId && !_.IsLocalSizeIdAllowed()) + case spv::ExecutionMode::LocalSize: + case spv::ExecutionMode::LocalSizeId: + if (mode == spv::ExecutionMode::LocalSizeId && !_.IsLocalSizeIdAllowed()) return _.diag(SPV_ERROR_INVALID_DATA, inst) << "LocalSizeId mode is not allowed by the current environment."; - if (!std::all_of(models->begin(), models->end(), - [&_](const SpvExecutionModel& model) { - switch (model) { - case SpvExecutionModelKernel: - case SpvExecutionModelGLCompute: - return true; - case SpvExecutionModelTaskNV: - case SpvExecutionModelMeshNV: - return _.HasCapability(SpvCapabilityMeshShadingNV); - case SpvExecutionModelTaskEXT: - case SpvExecutionModelMeshEXT: - return _.HasCapability( - SpvCapabilityMeshShadingEXT); - default: - return false; - } - })) { - if (_.HasCapability(SpvCapabilityMeshShadingNV) || - _.HasCapability(SpvCapabilityMeshShadingEXT)) { + if (!std::all_of( + models->begin(), models->end(), + [&_](const spv::ExecutionModel& model) { + switch (model) { + case spv::ExecutionModel::Kernel: + case spv::ExecutionModel::GLCompute: + return true; + case spv::ExecutionModel::TaskNV: + case spv::ExecutionModel::MeshNV: + return _.HasCapability(spv::Capability::MeshShadingNV); + case spv::ExecutionModel::TaskEXT: + case spv::ExecutionModel::MeshEXT: + return _.HasCapability(spv::Capability::MeshShadingEXT); + default: + return false; + } + })) { + if (_.HasCapability(spv::Capability::MeshShadingNV) || + _.HasCapability(spv::Capability::MeshShadingEXT)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Execution mode can only be used with a Kernel, GLCompute, " "MeshNV, MeshEXT, TaskNV or TaskEXT execution model."; @@ -572,13 +580,13 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _, } if (spvIsVulkanEnv(_.context()->target_env)) { - if (mode == SpvExecutionModeOriginLowerLeft) { + if (mode == spv::ExecutionMode::OriginLowerLeft) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4653) << "In the Vulkan environment, the OriginLowerLeft execution mode " "must not be used."; } - if (mode == SpvExecutionModePixelCenterInteger) { + if (mode == spv::ExecutionMode::PixelCenterInteger) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4654) << "In the Vulkan environment, the PixelCenterInteger execution " @@ -593,29 +601,30 @@ spv_result_t ValidateMemoryModel(ValidationState_t& _, const Instruction* inst) { // Already produced an error if multiple memory model instructions are // present. - if (_.memory_model() != SpvMemoryModelVulkanKHR && - _.HasCapability(SpvCapabilityVulkanMemoryModelKHR)) { + if (_.memory_model() != spv::MemoryModel::VulkanKHR && + _.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "VulkanMemoryModelKHR capability must only be specified if " "the VulkanKHR memory model is used."; } if (spvIsOpenCLEnv(_.context()->target_env)) { - if ((_.addressing_model() != SpvAddressingModelPhysical32) && - (_.addressing_model() != SpvAddressingModelPhysical64)) { + if ((_.addressing_model() != spv::AddressingModel::Physical32) && + (_.addressing_model() != spv::AddressingModel::Physical64)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Addressing model must be Physical32 or Physical64 " << "in the OpenCL environment."; } - if (_.memory_model() != SpvMemoryModelOpenCL) { + if (_.memory_model() != spv::MemoryModel::OpenCL) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Memory model must be OpenCL in the OpenCL environment."; } } if (spvIsVulkanEnv(_.context()->target_env)) { - if ((_.addressing_model() != SpvAddressingModelLogical) && - (_.addressing_model() != SpvAddressingModelPhysicalStorageBuffer64)) { + if ((_.addressing_model() != spv::AddressingModel::Logical) && + (_.addressing_model() != + spv::AddressingModel::PhysicalStorageBuffer64)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4635) << "Addressing model must be Logical or PhysicalStorageBuffer64 " @@ -629,14 +638,14 @@ spv_result_t ValidateMemoryModel(ValidationState_t& _, spv_result_t ModeSettingPass(ValidationState_t& _, const Instruction* inst) { switch (inst->opcode()) { - case SpvOpEntryPoint: + case spv::Op::OpEntryPoint: if (auto error = ValidateEntryPoint(_, inst)) return error; break; - case SpvOpExecutionMode: - case SpvOpExecutionModeId: + case spv::Op::OpExecutionMode: + case spv::Op::OpExecutionModeId: if (auto error = ValidateExecutionMode(_, inst)) return error; break; - case SpvOpMemoryModel: + case spv::Op::OpMemoryModel: if (auto error = ValidateMemoryModel(_, inst)) return error; break; default: diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_non_uniform.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_non_uniform.cpp index 6d4f8a28..2c36ce33 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_non_uniform.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_non_uniform.cpp @@ -14,14 +14,11 @@ // Validates correctness of barrier SPIR-V instructions. -#include "source/val/validate.h" - -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_constant.h" #include "source/spirv_target_env.h" -#include "source/util/bitutils.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validate_scopes.h" #include "source/val/validation_state.h" @@ -29,6 +26,207 @@ namespace spvtools { namespace val { namespace { +spv_result_t ValidateGroupNonUniformElect(ValidationState_t& _, + const Instruction* inst) { + if (!_.IsBoolScalarType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a boolean scalar type"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupNonUniformAnyAll(ValidationState_t& _, + const Instruction* inst) { + if (!_.IsBoolScalarType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a boolean scalar type"; + } + + if (!_.IsBoolScalarType(_.GetOperandTypeId(inst, 3))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Predicate must be a boolean scalar type"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupNonUniformAllEqual(ValidationState_t& _, + const Instruction* inst) { + if (!_.IsBoolScalarType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a boolean scalar type"; + } + + const auto value_type = _.GetOperandTypeId(inst, 3); + if (!_.IsFloatScalarOrVectorType(value_type) && + !_.IsIntScalarOrVectorType(value_type) && + !_.IsBoolScalarOrVectorType(value_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Value must be a scalar or vector of integer, floating-point, or " + "boolean type"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupNonUniformBroadcastShuffle(ValidationState_t& _, + const Instruction* inst) { + const auto type_id = inst->type_id(); + if (!_.IsFloatScalarOrVectorType(type_id) && + !_.IsIntScalarOrVectorType(type_id) && + !_.IsBoolScalarOrVectorType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a scalar or vector of integer, floating-point, " + "or boolean type"; + } + + const auto value_type_id = _.GetOperandTypeId(inst, 3); + if (value_type_id != type_id) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The type of Value must match the Result type"; + } + + const auto GetOperandName = [](const spv::Op opcode) { + std::string operand; + switch (opcode) { + case spv::Op::OpGroupNonUniformBroadcast: + case spv::Op::OpGroupNonUniformShuffle: + operand = "Id"; + break; + case spv::Op::OpGroupNonUniformShuffleXor: + operand = "Mask"; + break; + case spv::Op::OpGroupNonUniformQuadBroadcast: + operand = "Index"; + break; + case spv::Op::OpGroupNonUniformQuadSwap: + operand = "Direction"; + break; + case spv::Op::OpGroupNonUniformShuffleUp: + case spv::Op::OpGroupNonUniformShuffleDown: + default: + operand = "Delta"; + break; + } + return operand; + }; + + const auto id_type_id = _.GetOperandTypeId(inst, 4); + if (!_.IsUnsignedIntScalarType(id_type_id)) { + std::string operand = GetOperandName(inst->opcode()); + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << operand << " must be an unsigned integer scalar"; + } + + const bool should_be_constant = + inst->opcode() == spv::Op::OpGroupNonUniformQuadSwap || + ((inst->opcode() == spv::Op::OpGroupNonUniformBroadcast || + inst->opcode() == spv::Op::OpGroupNonUniformQuadBroadcast) && + _.version() < SPV_SPIRV_VERSION_WORD(1, 5)); + if (should_be_constant) { + const auto id_id = inst->GetOperandAs(4); + const auto id_op = _.GetIdOpcode(id_id); + if (!spvOpcodeIsConstant(id_op)) { + std::string operand = GetOperandName(inst->opcode()); + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Before SPIR-V 1.5, " << operand + << " must be a constant instruction"; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupNonUniformBroadcastFirst(ValidationState_t& _, + const Instruction* inst) { + const auto type_id = inst->type_id(); + if (!_.IsFloatScalarOrVectorType(type_id) && + !_.IsIntScalarOrVectorType(type_id) && + !_.IsBoolScalarOrVectorType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a scalar or vector of integer, floating-point, " + "or boolean type"; + } + + const auto value_type_id = _.GetOperandTypeId(inst, 3); + if (value_type_id != type_id) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The type of Value must match the Result type"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupNonUniformBallot(ValidationState_t& _, + const Instruction* inst) { + if (!_.IsUnsignedIntVectorType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a 4-component unsigned integer vector"; + } + + if (_.GetDimension(inst->type_id()) != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a 4-component unsigned integer vector"; + } + + const auto pred_type_id = _.GetOperandTypeId(inst, 3); + if (!_.IsBoolScalarType(pred_type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Predicate must be a boolean scalar"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupNonUniformInverseBallot(ValidationState_t& _, + const Instruction* inst) { + if (!_.IsBoolScalarType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a boolean scalar"; + } + + const auto value_type_id = _.GetOperandTypeId(inst, 3); + if (!_.IsUnsignedIntVectorType(value_type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Value must be a 4-component unsigned integer vector"; + } + + if (_.GetDimension(value_type_id) != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Value must be a 4-component unsigned integer vector"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupNonUniformBallotBitExtract(ValidationState_t& _, + const Instruction* inst) { + if (!_.IsBoolScalarType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a boolean scalar"; + } + + const auto value_type_id = _.GetOperandTypeId(inst, 3); + if (!_.IsUnsignedIntVectorType(value_type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Value must be a 4-component unsigned integer vector"; + } + + if (_.GetDimension(value_type_id) != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Value must be a 4-component unsigned integer vector"; + } + + const auto id_type_id = _.GetOperandTypeId(inst, 4); + if (!_.IsUnsignedIntScalarType(id_type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Id must be an unsigned integer scalar"; + } + + return SPV_SUCCESS; +} + spv_result_t ValidateGroupNonUniformBallotBitCount(ValidationState_t& _, const Instruction* inst) { // Scope is already checked by ValidateExecutionScope() above. @@ -48,11 +246,11 @@ spv_result_t ValidateGroupNonUniformBallotBitCount(ValidationState_t& _, "of integer type scalar"; } - const auto group = inst->GetOperandAs(3); + const auto group = inst->GetOperandAs(3); if (spvIsVulkanEnv(_.context()->target_env)) { - if ((group != SpvGroupOperationReduce) && - (group != SpvGroupOperationInclusiveScan) && - (group != SpvGroupOperationExclusiveScan)) { + if ((group != spv::GroupOperation::Reduce) && + (group != spv::GroupOperation::InclusiveScan) && + (group != spv::GroupOperation::ExclusiveScan)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4685) << "In Vulkan: The OpGroupNonUniformBallotBitCount group " @@ -63,6 +261,107 @@ spv_result_t ValidateGroupNonUniformBallotBitCount(ValidationState_t& _, return SPV_SUCCESS; } +spv_result_t ValidateGroupNonUniformBallotFind(ValidationState_t& _, + const Instruction* inst) { + if (!_.IsUnsignedIntScalarType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be an unsigned integer scalar"; + } + + const auto value_type_id = _.GetOperandTypeId(inst, 3); + if (!_.IsUnsignedIntVectorType(value_type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Value must be a 4-component unsigned integer vector"; + } + + if (_.GetDimension(value_type_id) != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Value must be a 4-component unsigned integer vector"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupNonUniformArithmetic(ValidationState_t& _, + const Instruction* inst) { + const bool is_unsigned = inst->opcode() == spv::Op::OpGroupNonUniformUMin || + inst->opcode() == spv::Op::OpGroupNonUniformUMax; + const bool is_float = inst->opcode() == spv::Op::OpGroupNonUniformFAdd || + inst->opcode() == spv::Op::OpGroupNonUniformFMul || + inst->opcode() == spv::Op::OpGroupNonUniformFMin || + inst->opcode() == spv::Op::OpGroupNonUniformFMax; + const bool is_bool = inst->opcode() == spv::Op::OpGroupNonUniformLogicalAnd || + inst->opcode() == spv::Op::OpGroupNonUniformLogicalOr || + inst->opcode() == spv::Op::OpGroupNonUniformLogicalXor; + if (is_float) { + if (!_.IsFloatScalarOrVectorType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a floating-point scalar or vector"; + } + } else if (is_bool) { + if (!_.IsBoolScalarOrVectorType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be a boolean scalar or vector"; + } + } else if (is_unsigned) { + if (!_.IsUnsignedIntScalarOrVectorType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be an unsigned integer scalar or vector"; + } + } else if (!_.IsIntScalarOrVectorType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result must be an integer scalar or vector"; + } + + const auto value_type_id = _.GetOperandTypeId(inst, 4); + if (value_type_id != inst->type_id()) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The type of Value must match the Result type"; + } + + const auto group_op = inst->GetOperandAs(3); + bool is_clustered_reduce = group_op == spv::GroupOperation::ClusteredReduce; + bool is_partitioned_nv = + group_op == spv::GroupOperation::PartitionedReduceNV || + group_op == spv::GroupOperation::PartitionedInclusiveScanNV || + group_op == spv::GroupOperation::PartitionedExclusiveScanNV; + if (inst->operands().size() <= 5) { + if (is_clustered_reduce) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "ClusterSize must be present when Operation is ClusteredReduce"; + } else if (is_partitioned_nv) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ballot must be present when Operation is PartitionedReduceNV, " + "PartitionedInclusiveScanNV, or PartitionedExclusiveScanNV"; + } + } else { + const auto operand_id = inst->GetOperandAs(5); + const auto* operand = _.FindDef(operand_id); + if (is_partitioned_nv) { + if (!operand || !_.IsIntScalarOrVectorType(operand->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ballot must be a 4-component integer vector"; + } + + if (_.GetDimension(operand->type_id()) != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ballot must be a 4-component integer vector"; + } + } else { + if (!operand || !_.IsUnsignedIntScalarType(operand->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "ClusterSize must be an unsigned integer scalar"; + } + + if (!spvOpcodeIsConstant(operand->opcode())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "ClusterSize must be a constant instruction"; + } + } + } + return SPV_SUCCESS; +} + spv_result_t ValidateGroupNonUniformRotateKHR(ValidationState_t& _, const Instruction* inst) { // Scope is already checked by ValidateExecutionScope() above. @@ -120,19 +419,62 @@ spv_result_t ValidateGroupNonUniformRotateKHR(ValidationState_t& _, // Validates correctness of non-uniform group instructions. spv_result_t NonUniformPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); if (spvOpcodeIsNonUniformGroupOperation(opcode)) { - const uint32_t execution_scope = inst->word(3); + const uint32_t execution_scope = inst->GetOperandAs(2); if (auto error = ValidateExecutionScope(_, inst, execution_scope)) { return error; } } switch (opcode) { - case SpvOpGroupNonUniformBallotBitCount: + case spv::Op::OpGroupNonUniformElect: + return ValidateGroupNonUniformElect(_, inst); + case spv::Op::OpGroupNonUniformAny: + case spv::Op::OpGroupNonUniformAll: + return ValidateGroupNonUniformAnyAll(_, inst); + case spv::Op::OpGroupNonUniformAllEqual: + return ValidateGroupNonUniformAllEqual(_, inst); + case spv::Op::OpGroupNonUniformBroadcast: + case spv::Op::OpGroupNonUniformShuffle: + case spv::Op::OpGroupNonUniformShuffleXor: + case spv::Op::OpGroupNonUniformShuffleUp: + case spv::Op::OpGroupNonUniformShuffleDown: + case spv::Op::OpGroupNonUniformQuadBroadcast: + case spv::Op::OpGroupNonUniformQuadSwap: + return ValidateGroupNonUniformBroadcastShuffle(_, inst); + case spv::Op::OpGroupNonUniformBroadcastFirst: + return ValidateGroupNonUniformBroadcastFirst(_, inst); + case spv::Op::OpGroupNonUniformBallot: + return ValidateGroupNonUniformBallot(_, inst); + case spv::Op::OpGroupNonUniformInverseBallot: + return ValidateGroupNonUniformInverseBallot(_, inst); + case spv::Op::OpGroupNonUniformBallotBitExtract: + return ValidateGroupNonUniformBallotBitExtract(_, inst); + case spv::Op::OpGroupNonUniformBallotBitCount: return ValidateGroupNonUniformBallotBitCount(_, inst); - case SpvOpGroupNonUniformRotateKHR: + case spv::Op::OpGroupNonUniformBallotFindLSB: + case spv::Op::OpGroupNonUniformBallotFindMSB: + return ValidateGroupNonUniformBallotFind(_, inst); + case spv::Op::OpGroupNonUniformIAdd: + case spv::Op::OpGroupNonUniformFAdd: + case spv::Op::OpGroupNonUniformIMul: + case spv::Op::OpGroupNonUniformFMul: + case spv::Op::OpGroupNonUniformSMin: + case spv::Op::OpGroupNonUniformUMin: + case spv::Op::OpGroupNonUniformFMin: + case spv::Op::OpGroupNonUniformSMax: + case spv::Op::OpGroupNonUniformUMax: + case spv::Op::OpGroupNonUniformFMax: + case spv::Op::OpGroupNonUniformBitwiseAnd: + case spv::Op::OpGroupNonUniformBitwiseOr: + case spv::Op::OpGroupNonUniformBitwiseXor: + case spv::Op::OpGroupNonUniformLogicalAnd: + case spv::Op::OpGroupNonUniformLogicalOr: + case spv::Op::OpGroupNonUniformLogicalXor: + return ValidateGroupNonUniformArithmetic(_, inst); + case spv::Op::OpGroupNonUniformRotateKHR: return ValidateGroupNonUniformRotateKHR(_, inst); default: break; diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_primitives.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_primitives.cpp index 7d11f2e7..6769090d 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_primitives.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_primitives.cpp @@ -14,13 +14,11 @@ // Validates correctness of primitive SPIR-V instructions. -#include "source/val/validate.h" - #include -#include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools { @@ -28,16 +26,16 @@ namespace val { // Validates correctness of primitive instructions. spv_result_t PrimitivesPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); switch (opcode) { - case SpvOpEmitVertex: - case SpvOpEndPrimitive: - case SpvOpEmitStreamVertex: - case SpvOpEndStreamPrimitive: + case spv::Op::OpEmitVertex: + case spv::Op::OpEndPrimitive: + case spv::Op::OpEmitStreamVertex: + case spv::Op::OpEndStreamPrimitive: _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - SpvExecutionModelGeometry, + spv::ExecutionModel::Geometry, std::string(spvOpcodeString(opcode)) + " instructions require Geometry execution model"); break; @@ -46,8 +44,8 @@ spv_result_t PrimitivesPass(ValidationState_t& _, const Instruction* inst) { } switch (opcode) { - case SpvOpEmitStreamVertex: - case SpvOpEndStreamPrimitive: { + case spv::Op::OpEmitStreamVertex: + case spv::Op::OpEndStreamPrimitive: { const uint32_t stream_id = inst->word(1); const uint32_t stream_type = _.GetTypeId(stream_id); if (!_.IsIntScalarType(stream_type)) { @@ -56,7 +54,7 @@ spv_result_t PrimitivesPass(ValidationState_t& _, const Instruction* inst) { << ": expected Stream to be int scalar"; } - const SpvOp stream_opcode = _.GetIdOpcode(stream_id); + const spv::Op stream_opcode = _.GetIdOpcode(stream_id); if (!spvOpcodeIsConstant(stream_opcode)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_ray_query.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_ray_query.cpp index b553449d..9b67fc92 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_ray_query.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_ray_query.cpp @@ -29,19 +29,19 @@ spv_result_t ValidateRayQueryPointer(ValidationState_t& _, const uint32_t ray_query_id = inst->GetOperandAs(ray_query_index); auto variable = _.FindDef(ray_query_id); const auto var_opcode = variable->opcode(); - if (!variable || - (var_opcode != SpvOpVariable && var_opcode != SpvOpFunctionParameter && - var_opcode != SpvOpAccessChain)) { + if (!variable || (var_opcode != spv::Op::OpVariable && + var_opcode != spv::Op::OpFunctionParameter && + var_opcode != spv::Op::OpAccessChain)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray Query must be a memory object declaration"; } auto pointer = _.FindDef(variable->GetOperandAs(0)); - if (!pointer || pointer->opcode() != SpvOpTypePointer) { + if (!pointer || pointer->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray Query must be a pointer"; } auto type = _.FindDef(pointer->GetOperandAs(2)); - if (!type || type->opcode() != SpvOpTypeRayQueryKHR) { + if (!type || type->opcode() != spv::Op::OpTypeRayQueryKHR) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Ray Query must be a pointer to OpTypeRayQueryKHR"; } @@ -54,7 +54,7 @@ spv_result_t ValidateIntersectionId(ValidationState_t& _, const uint32_t intersection_id = inst->GetOperandAs(intersection_index); const uint32_t intersection_type = _.GetTypeId(intersection_id); - const SpvOp intersection_opcode = _.GetIdOpcode(intersection_id); + const spv::Op intersection_opcode = _.GetIdOpcode(intersection_id); if (!_.IsIntScalarType(intersection_type) || _.GetBitWidth(intersection_type) != 32 || !spvOpcodeIsConstant(intersection_opcode)) { @@ -68,15 +68,15 @@ spv_result_t ValidateIntersectionId(ValidationState_t& _, } // namespace spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); const uint32_t result_type = inst->type_id(); switch (opcode) { - case SpvOpRayQueryInitializeKHR: { + case spv::Op::OpRayQueryInitializeKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 0)) return error; if (_.GetIdOpcode(_.GetOperandTypeId(inst, 1)) != - SpvOpTypeAccelerationStructureKHR) { + spv::Op::OpTypeAccelerationStructureKHR) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Acceleration Structure to be of type " "OpTypeAccelerationStructureKHR"; @@ -123,13 +123,13 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpRayQueryTerminateKHR: - case SpvOpRayQueryConfirmIntersectionKHR: { + case spv::Op::OpRayQueryTerminateKHR: + case spv::Op::OpRayQueryConfirmIntersectionKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 0)) return error; break; } - case SpvOpRayQueryGenerateIntersectionKHR: { + case spv::Op::OpRayQueryGenerateIntersectionKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 0)) return error; const uint32_t hit_t_id = _.GetOperandTypeId(inst, 1); @@ -141,9 +141,9 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpRayQueryGetIntersectionFrontFaceKHR: - case SpvOpRayQueryProceedKHR: - case SpvOpRayQueryGetIntersectionCandidateAABBOpaqueKHR: { + case spv::Op::OpRayQueryGetIntersectionFrontFaceKHR: + case spv::Op::OpRayQueryProceedKHR: + case spv::Op::OpRayQueryGetIntersectionCandidateAABBOpaqueKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 2)) return error; if (!_.IsBoolScalarType(result_type)) { @@ -151,15 +151,15 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { << "expected Result Type to be bool scalar type"; } - if (opcode == SpvOpRayQueryGetIntersectionFrontFaceKHR) { + if (opcode == spv::Op::OpRayQueryGetIntersectionFrontFaceKHR) { if (auto error = ValidateIntersectionId(_, inst, 3)) return error; } break; } - case SpvOpRayQueryGetIntersectionTKHR: - case SpvOpRayQueryGetRayTMinKHR: { + case spv::Op::OpRayQueryGetIntersectionTKHR: + case spv::Op::OpRayQueryGetRayTMinKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 2)) return error; if (!_.IsFloatScalarType(result_type) || @@ -168,20 +168,21 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { << "expected Result Type to be 32-bit float scalar type"; } - if (opcode == SpvOpRayQueryGetIntersectionTKHR) { + if (opcode == spv::Op::OpRayQueryGetIntersectionTKHR) { if (auto error = ValidateIntersectionId(_, inst, 3)) return error; } break; } - case SpvOpRayQueryGetIntersectionTypeKHR: - case SpvOpRayQueryGetIntersectionInstanceCustomIndexKHR: - case SpvOpRayQueryGetIntersectionInstanceIdKHR: - case SpvOpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR: - case SpvOpRayQueryGetIntersectionGeometryIndexKHR: - case SpvOpRayQueryGetIntersectionPrimitiveIndexKHR: - case SpvOpRayQueryGetRayFlagsKHR: { + case spv::Op::OpRayQueryGetIntersectionTypeKHR: + case spv::Op::OpRayQueryGetIntersectionInstanceCustomIndexKHR: + case spv::Op::OpRayQueryGetIntersectionInstanceIdKHR: + case spv::Op:: + OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR: + case spv::Op::OpRayQueryGetIntersectionGeometryIndexKHR: + case spv::Op::OpRayQueryGetIntersectionPrimitiveIndexKHR: + case spv::Op::OpRayQueryGetRayFlagsKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 2)) return error; if (!_.IsIntScalarType(result_type) || _.GetBitWidth(result_type) != 32) { @@ -189,17 +190,17 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { << "expected Result Type to be 32-bit int scalar type"; } - if (opcode != SpvOpRayQueryGetRayFlagsKHR) { + if (opcode != spv::Op::OpRayQueryGetRayFlagsKHR) { if (auto error = ValidateIntersectionId(_, inst, 3)) return error; } break; } - case SpvOpRayQueryGetIntersectionObjectRayDirectionKHR: - case SpvOpRayQueryGetIntersectionObjectRayOriginKHR: - case SpvOpRayQueryGetWorldRayDirectionKHR: - case SpvOpRayQueryGetWorldRayOriginKHR: { + case spv::Op::OpRayQueryGetIntersectionObjectRayDirectionKHR: + case spv::Op::OpRayQueryGetIntersectionObjectRayOriginKHR: + case spv::Op::OpRayQueryGetWorldRayDirectionKHR: + case spv::Op::OpRayQueryGetWorldRayOriginKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 2)) return error; if (!_.IsFloatVectorType(result_type) || @@ -210,15 +211,15 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { "vector type"; } - if (opcode == SpvOpRayQueryGetIntersectionObjectRayDirectionKHR || - opcode == SpvOpRayQueryGetIntersectionObjectRayOriginKHR) { + if (opcode == spv::Op::OpRayQueryGetIntersectionObjectRayDirectionKHR || + opcode == spv::Op::OpRayQueryGetIntersectionObjectRayOriginKHR) { if (auto error = ValidateIntersectionId(_, inst, 3)) return error; } break; } - case SpvOpRayQueryGetIntersectionBarycentricsKHR: { + case spv::Op::OpRayQueryGetIntersectionBarycentricsKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 2)) return error; if (auto error = ValidateIntersectionId(_, inst, 3)) return error; @@ -233,8 +234,8 @@ spv_result_t RayQueryPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpRayQueryGetIntersectionObjectToWorldKHR: - case SpvOpRayQueryGetIntersectionWorldToObjectKHR: { + case spv::Op::OpRayQueryGetIntersectionObjectToWorldKHR: + case spv::Op::OpRayQueryGetIntersectionWorldToObjectKHR: { if (auto error = ValidateRayQueryPointer(_, inst, 2)) return error; if (auto error = ValidateIntersectionId(_, inst, 3)) return error; diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_ray_tracing.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_ray_tracing.cpp index 5b5c8da1..f74e9d4b 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_ray_tracing.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_ray_tracing.cpp @@ -23,17 +23,17 @@ namespace spvtools { namespace val { spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); const uint32_t result_type = inst->type_id(); switch (opcode) { - case SpvOpTraceRayKHR: { + case spv::Op::OpTraceRayKHR: { _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelRayGenerationKHR && - model != SpvExecutionModelClosestHitKHR && - model != SpvExecutionModelMissKHR) { + [](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::MissKHR) { if (message) { *message = "OpTraceRayKHR requires RayGenerationKHR, " @@ -45,7 +45,7 @@ spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst) { }); if (_.GetIdOpcode(_.GetOperandTypeId(inst, 0)) != - SpvOpTypeAccelerationStructureKHR) { + spv::Op::OpTypeAccelerationStructureKHR) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Expected Acceleration Structure to be of type " "OpTypeAccelerationStructureKHR"; @@ -109,13 +109,13 @@ spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst) { } const Instruction* payload = _.FindDef(inst->GetOperandAs(10)); - if (payload->opcode() != SpvOpVariable) { + if (payload->opcode() != spv::Op::OpVariable) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Payload must be the result of a OpVariable"; - } else if (payload->GetOperandAs(2) != - SpvStorageClassRayPayloadKHR && - payload->GetOperandAs(2) != - SpvStorageClassIncomingRayPayloadKHR) { + } else if (payload->GetOperandAs(2) != + spv::StorageClass::RayPayloadKHR && + payload->GetOperandAs(2) != + spv::StorageClass::IncomingRayPayloadKHR) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Payload must have storage class RayPayloadKHR or " "IncomingRayPayloadKHR"; @@ -123,11 +123,11 @@ spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpReportIntersectionKHR: { + case spv::Op::OpReportIntersectionKHR: { _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelIntersectionKHR) { + [](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::IntersectionKHR) { if (message) { *message = "OpReportIntersectionKHR requires IntersectionKHR " @@ -158,14 +158,14 @@ spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst) { break; } - case SpvOpExecuteCallableKHR: { + case spv::Op::OpExecuteCallableKHR: { _.function(inst->function()->id()) - ->RegisterExecutionModelLimitation([](SpvExecutionModel model, + ->RegisterExecutionModelLimitation([](spv::ExecutionModel model, std::string* message) { - if (model != SpvExecutionModelRayGenerationKHR && - model != SpvExecutionModelClosestHitKHR && - model != SpvExecutionModelMissKHR && - model != SpvExecutionModelCallableKHR) { + if (model != spv::ExecutionModel::RayGenerationKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::MissKHR && + model != spv::ExecutionModel::CallableKHR) { if (message) { *message = "OpExecuteCallableKHR requires RayGenerationKHR, " @@ -184,13 +184,13 @@ spv_result_t RayTracingPass(ValidationState_t& _, const Instruction* inst) { } const auto callable_data = _.FindDef(inst->GetOperandAs(1)); - if (callable_data->opcode() != SpvOpVariable) { + if (callable_data->opcode() != spv::Op::OpVariable) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Callable Data must be the result of a OpVariable"; - } else if (callable_data->GetOperandAs(2) != - SpvStorageClassCallableDataKHR && - callable_data->GetOperandAs(2) != - SpvStorageClassIncomingCallableDataKHR) { + } else if (callable_data->GetOperandAs(2) != + spv::StorageClass::CallableDataKHR && + callable_data->GetOperandAs(2) != + spv::StorageClass::IncomingCallableDataKHR) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Callable Data must have storage class CallableDataKHR or " "IncomingCallableDataKHR"; diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_ray_tracing_reorder.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_ray_tracing_reorder.cpp new file mode 100644 index 00000000..cb190f91 --- /dev/null +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_ray_tracing_reorder.cpp @@ -0,0 +1,625 @@ +// Copyright (c) 2022 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Validates ray tracing instructions from SPV_NV_shader_execution_reorder + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validate.h" +#include "source/val/validation_state.h" + +#include + +namespace spvtools { +namespace val { + +static const uint32_t KRayParamInvalidId = std::numeric_limits::max(); + +spv_result_t ValidateHitObjectPointer(ValidationState_t& _, + const Instruction* inst, + uint32_t hit_object_index) { + const uint32_t hit_object_id = inst->GetOperandAs(hit_object_index); + auto variable = _.FindDef(hit_object_id); + const auto var_opcode = variable->opcode(); + if (!variable || (var_opcode != spv::Op::OpVariable && + var_opcode != spv::Op::OpFunctionParameter && + var_opcode != spv::Op::OpAccessChain)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hit Object must be a memory object declaration"; + } + auto pointer = _.FindDef(variable->GetOperandAs(0)); + if (!pointer || pointer->opcode() != spv::Op::OpTypePointer) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hit Object must be a pointer"; + } + auto type = _.FindDef(pointer->GetOperandAs(2)); + if (!type || type->opcode() != spv::Op::OpTypeHitObjectNV) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Type must be OpTypeHitObjectNV"; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateHitObjectInstructionCommonParameters( + ValidationState_t& _, const Instruction* inst, + uint32_t acceleration_struct_index, uint32_t instance_id_index, + uint32_t primtive_id_index, uint32_t geometry_index, + uint32_t ray_flags_index, uint32_t cull_mask_index, uint32_t hit_kind_index, + uint32_t sbt_index, uint32_t sbt_offset_index, uint32_t sbt_stride_index, + uint32_t sbt_record_offset_index, uint32_t sbt_record_stride_index, + uint32_t miss_index, uint32_t ray_origin_index, uint32_t ray_tmin_index, + uint32_t ray_direction_index, uint32_t ray_tmax_index, + uint32_t payload_index, uint32_t hit_object_attr_index) { + auto isValidId = [](uint32_t spvid) { return spvid < KRayParamInvalidId; }; + if (isValidId(acceleration_struct_index) && + _.GetIdOpcode(_.GetOperandTypeId(inst, acceleration_struct_index)) != + spv::Op::OpTypeAccelerationStructureKHR) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Acceleration Structure to be of type " + "OpTypeAccelerationStructureKHR"; + } + + if (isValidId(instance_id_index)) { + const uint32_t instance_id = _.GetOperandTypeId(inst, instance_id_index); + if (!_.IsIntScalarType(instance_id) || _.GetBitWidth(instance_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Instance Id must be a 32-bit int scalar"; + } + } + + if (isValidId(primtive_id_index)) { + const uint32_t primitive_id = _.GetOperandTypeId(inst, primtive_id_index); + if (!_.IsIntScalarType(primitive_id) || _.GetBitWidth(primitive_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Primitive Id must be a 32-bit int scalar"; + } + } + + if (isValidId(geometry_index)) { + const uint32_t geometry_index_id = _.GetOperandTypeId(inst, geometry_index); + if (!_.IsIntScalarType(geometry_index_id) || + _.GetBitWidth(geometry_index_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Geometry Index must be a 32-bit int scalar"; + } + } + + if (isValidId(miss_index)) { + const uint32_t miss_index_id = _.GetOperandTypeId(inst, miss_index); + if (!_.IsUnsignedIntScalarType(miss_index_id) || + _.GetBitWidth(miss_index_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Miss Index must be a 32-bit int scalar"; + } + } + + if (isValidId(cull_mask_index)) { + const uint32_t cull_mask_id = _.GetOperandTypeId(inst, cull_mask_index); + if (!_.IsUnsignedIntScalarType(cull_mask_id) || + _.GetBitWidth(cull_mask_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Cull mask must be a 32-bit int scalar"; + } + } + + if (isValidId(sbt_index)) { + const uint32_t sbt_index_id = _.GetOperandTypeId(inst, sbt_index); + if (!_.IsUnsignedIntScalarType(sbt_index_id) || + _.GetBitWidth(sbt_index_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "SBT Index must be a 32-bit unsigned int scalar"; + } + } + + if (isValidId(sbt_offset_index)) { + const uint32_t sbt_offset_id = _.GetOperandTypeId(inst, sbt_offset_index); + if (!_.IsUnsignedIntScalarType(sbt_offset_id) || + _.GetBitWidth(sbt_offset_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "SBT Offset must be a 32-bit unsigned int scalar"; + } + } + + if (isValidId(sbt_stride_index)) { + const uint32_t sbt_stride_index_id = + _.GetOperandTypeId(inst, sbt_stride_index); + if (!_.IsUnsignedIntScalarType(sbt_stride_index_id) || + _.GetBitWidth(sbt_stride_index_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "SBT Stride must be a 32-bit unsigned int scalar"; + } + } + + if (isValidId(sbt_record_offset_index)) { + const uint32_t sbt_record_offset_index_id = + _.GetOperandTypeId(inst, sbt_record_offset_index); + if (!_.IsUnsignedIntScalarType(sbt_record_offset_index_id) || + _.GetBitWidth(sbt_record_offset_index_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "SBT record offset must be a 32-bit unsigned int scalar"; + } + } + + if (isValidId(sbt_record_stride_index)) { + const uint32_t sbt_record_stride_index_id = + _.GetOperandTypeId(inst, sbt_record_stride_index); + if (!_.IsUnsignedIntScalarType(sbt_record_stride_index_id) || + _.GetBitWidth(sbt_record_stride_index_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "SBT record stride must be a 32-bit unsigned int scalar"; + } + } + + if (isValidId(ray_origin_index)) { + const uint32_t ray_origin_id = _.GetOperandTypeId(inst, ray_origin_index); + if (!_.IsFloatVectorType(ray_origin_id) || + _.GetDimension(ray_origin_id) != 3 || + _.GetBitWidth(ray_origin_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Origin must be a 32-bit float 3-component vector"; + } + } + + if (isValidId(ray_tmin_index)) { + const uint32_t ray_tmin_id = _.GetOperandTypeId(inst, ray_tmin_index); + if (!_.IsFloatScalarType(ray_tmin_id) || _.GetBitWidth(ray_tmin_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray TMin must be a 32-bit float scalar"; + } + } + + if (isValidId(ray_direction_index)) { + const uint32_t ray_direction_id = + _.GetOperandTypeId(inst, ray_direction_index); + if (!_.IsFloatVectorType(ray_direction_id) || + _.GetDimension(ray_direction_id) != 3 || + _.GetBitWidth(ray_direction_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Direction must be a 32-bit float 3-component vector"; + } + } + + if (isValidId(ray_tmax_index)) { + const uint32_t ray_tmax_id = _.GetOperandTypeId(inst, ray_tmax_index); + if (!_.IsFloatScalarType(ray_tmax_id) || _.GetBitWidth(ray_tmax_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray TMax must be a 32-bit float scalar"; + } + } + + if (isValidId(ray_flags_index)) { + const uint32_t ray_flags_id = _.GetOperandTypeId(inst, ray_flags_index); + if (!_.IsIntScalarType(ray_flags_id) || _.GetBitWidth(ray_flags_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Flags must be a 32-bit int scalar"; + } + } + + if (isValidId(payload_index)) { + const uint32_t payload_id = inst->GetOperandAs(payload_index); + auto variable = _.FindDef(payload_id); + const auto var_opcode = variable->opcode(); + if (!variable || var_opcode != spv::Op::OpVariable || + (variable->GetOperandAs(2) != + spv::StorageClass::RayPayloadKHR && + variable->GetOperandAs(2) != + spv::StorageClass::IncomingRayPayloadKHR)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "payload must be a OpVariable of storage " + "class RayPayloadKHR or IncomingRayPayloadKHR"; + } + } + + if (isValidId(hit_kind_index)) { + const uint32_t hit_kind_id = _.GetOperandTypeId(inst, hit_kind_index); + if (!_.IsUnsignedIntScalarType(hit_kind_id) || + _.GetBitWidth(hit_kind_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hit Kind must be a 32-bit unsigned int scalar"; + } + } + + if (isValidId(hit_object_attr_index)) { + const uint32_t hit_object_attr_id = + inst->GetOperandAs(hit_object_attr_index); + auto variable = _.FindDef(hit_object_attr_id); + const auto var_opcode = variable->opcode(); + if (!variable || var_opcode != spv::Op::OpVariable || + (variable->GetOperandAs(2)) != + spv::StorageClass::HitObjectAttributeNV) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hit Object Attributes id must be a OpVariable of storage " + "class HitObjectAttributeNV"; + } + } + + return SPV_SUCCESS; +} + +spv_result_t RayReorderNVPass(ValidationState_t& _, const Instruction* inst) { + const spv::Op opcode = inst->opcode(); + const uint32_t result_type = inst->type_id(); + + auto RegisterOpcodeForValidModel = [](ValidationState_t& vs, + const Instruction* rtinst) { + std::string opcode_name = spvOpcodeString(rtinst->opcode()); + vs.function(rtinst->function()->id()) + ->RegisterExecutionModelLimitation( + [opcode_name](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::MissKHR) { + if (message) { + *message = opcode_name + + " requires RayGenerationKHR, ClosestHitKHR and " + "MissKHR execution models"; + } + return false; + } + return true; + }); + return; + }; + + switch (opcode) { + case spv::Op::OpHitObjectIsMissNV: + case spv::Op::OpHitObjectIsHitNV: + case spv::Op::OpHitObjectIsEmptyNV: { + RegisterOpcodeForValidModel(_, inst); + if (!_.IsBoolScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "expected Result Type to be bool scalar type"; + } + + if (auto error = ValidateHitObjectPointer(_, inst, 2)) return error; + break; + } + + case spv::Op::OpHitObjectGetShaderRecordBufferHandleNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 2)) return error; + + if (!_.IsIntVectorType(result_type) || + (_.GetDimension(result_type) != 2) || + (_.GetBitWidth(result_type) != 32)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected 32-bit integer type 2-component vector as Result " + "Type: " + << spvOpcodeString(opcode); + break; + } + + case spv::Op::OpHitObjectGetHitKindNV: + case spv::Op::OpHitObjectGetPrimitiveIndexNV: + case spv::Op::OpHitObjectGetGeometryIndexNV: + case spv::Op::OpHitObjectGetInstanceIdNV: + case spv::Op::OpHitObjectGetInstanceCustomIndexNV: + case spv::Op::OpHitObjectGetShaderBindingTableRecordIndexNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 2)) return error; + + if (!_.IsIntScalarType(result_type) || !_.GetBitWidth(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected 32-bit integer type scalar as Result Type: " + << spvOpcodeString(opcode); + break; + } + + case spv::Op::OpHitObjectGetCurrentTimeNV: + case spv::Op::OpHitObjectGetRayTMaxNV: + case spv::Op::OpHitObjectGetRayTMinNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 2)) return error; + + if (!_.IsFloatScalarType(result_type) || _.GetBitWidth(result_type) != 32) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected 32-bit floating-point type scalar as Result Type: " + << spvOpcodeString(opcode); + break; + } + + case spv::Op::OpHitObjectGetObjectToWorldNV: + case spv::Op::OpHitObjectGetWorldToObjectNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 2)) return error; + + uint32_t num_rows = 0; + uint32_t num_cols = 0; + uint32_t col_type = 0; + uint32_t component_type = 0; + + if (!_.GetMatrixTypeInfo(result_type, &num_rows, &num_cols, &col_type, + &component_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "expected matrix type as Result Type: " + << spvOpcodeString(opcode); + } + + if (num_cols != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "expected Result Type matrix to have a Column Count of 4" + << spvOpcodeString(opcode); + } + + if (!_.IsFloatScalarType(component_type) || + _.GetBitWidth(result_type) != 32 || num_rows != 3) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "expected Result Type matrix to have a Column Type of " + "3-component 32-bit float vectors: " + << spvOpcodeString(opcode); + } + break; + } + + case spv::Op::OpHitObjectGetObjectRayOriginNV: + case spv::Op::OpHitObjectGetObjectRayDirectionNV: + case spv::Op::OpHitObjectGetWorldRayDirectionNV: + case spv::Op::OpHitObjectGetWorldRayOriginNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 2)) return error; + + if (!_.IsFloatVectorType(result_type) || + (_.GetDimension(result_type) != 3) || + (_.GetBitWidth(result_type) != 32)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected 32-bit floating-point type 3-component vector as " + "Result Type: " + << spvOpcodeString(opcode); + break; + } + + case spv::Op::OpHitObjectGetAttributesNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 0)) return error; + + const uint32_t hit_object_attr_id = inst->GetOperandAs(1); + auto variable = _.FindDef(hit_object_attr_id); + const auto var_opcode = variable->opcode(); + if (!variable || var_opcode != spv::Op::OpVariable || + variable->GetOperandAs(2) != + spv::StorageClass::HitObjectAttributeNV) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hit Object Attributes id must be a OpVariable of storage " + "class HitObjectAttributeNV"; + } + break; + } + + case spv::Op::OpHitObjectExecuteShaderNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 0)) return error; + + const uint32_t hit_object_attr_id = inst->GetOperandAs(1); + auto variable = _.FindDef(hit_object_attr_id); + const auto var_opcode = variable->opcode(); + if (!variable || var_opcode != spv::Op::OpVariable || + (variable->GetOperandAs(2)) != + spv::StorageClass::RayPayloadKHR) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hit Object Attributes id must be a OpVariable of storage " + "class RayPayloadKHR"; + } + break; + } + + case spv::Op::OpHitObjectRecordEmptyNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 0)) return error; + break; + } + + case spv::Op::OpHitObjectRecordMissNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 0)) return error; + + const uint32_t miss_index = _.GetOperandTypeId(inst, 1); + if (!_.IsUnsignedIntScalarType(miss_index) || + _.GetBitWidth(miss_index) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Miss Index must be a 32-bit int scalar"; + } + + const uint32_t ray_origin = _.GetOperandTypeId(inst, 2); + if (!_.IsFloatVectorType(ray_origin) || _.GetDimension(ray_origin) != 3 || + _.GetBitWidth(ray_origin) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Origin must be a 32-bit float 3-component vector"; + } + + const uint32_t ray_tmin = _.GetOperandTypeId(inst, 3); + if (!_.IsFloatScalarType(ray_tmin) || _.GetBitWidth(ray_tmin) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray TMin must be a 32-bit float scalar"; + } + + const uint32_t ray_direction = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatVectorType(ray_direction) || + _.GetDimension(ray_direction) != 3 || + _.GetBitWidth(ray_direction) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray Direction must be a 32-bit float 3-component vector"; + } + + const uint32_t ray_tmax = _.GetOperandTypeId(inst, 5); + if (!_.IsFloatScalarType(ray_tmax) || _.GetBitWidth(ray_tmax) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Ray TMax must be a 32-bit float scalar"; + } + break; + } + + case spv::Op::OpHitObjectRecordHitWithIndexNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 0)) return error; + + if (auto error = ValidateHitObjectInstructionCommonParameters( + _, inst, 1 /* Acceleration Struct */, 2 /* Instance Id */, + 3 /* Primtive Id */, 4 /* Geometry Index */, + KRayParamInvalidId /* Ray Flags */, + KRayParamInvalidId /* Cull Mask */, 5 /* Hit Kind*/, + 6 /* SBT index */, KRayParamInvalidId /* SBT Offset */, + KRayParamInvalidId /* SBT Stride */, + KRayParamInvalidId /* SBT Record Offset */, + KRayParamInvalidId /* SBT Record Stride */, + KRayParamInvalidId /* Miss Index */, 7 /* Ray Origin */, + 8 /* Ray TMin */, 9 /* Ray Direction */, 10 /* Ray TMax */, + KRayParamInvalidId /* Payload */, 11 /* Hit Object Attribute */)) + return error; + + break; + } + + case spv::Op::OpHitObjectRecordHitNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 0)) return error; + + if (auto error = ValidateHitObjectInstructionCommonParameters( + _, inst, 1 /* Acceleration Struct */, 2 /* Instance Id */, + 3 /* Primtive Id */, 4 /* Geometry Index */, + KRayParamInvalidId /* Ray Flags */, + KRayParamInvalidId /* Cull Mask */, 5 /* Hit Kind*/, + KRayParamInvalidId /* SBT index */, + KRayParamInvalidId /* SBT Offset */, + KRayParamInvalidId /* SBT Stride */, 6 /* SBT Record Offset */, + 7 /* SBT Record Stride */, KRayParamInvalidId /* Miss Index */, + 8 /* Ray Origin */, 9 /* Ray TMin */, 10 /* Ray Direction */, + 11 /* Ray TMax */, KRayParamInvalidId /* Payload */, + 12 /* Hit Object Attribute */)) + return error; + + break; + } + + case spv::Op::OpHitObjectTraceRayMotionNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 0)) return error; + + if (auto error = ValidateHitObjectInstructionCommonParameters( + _, inst, 1 /* Acceleration Struct */, + KRayParamInvalidId /* Instance Id */, + KRayParamInvalidId /* Primtive Id */, + KRayParamInvalidId /* Geometry Index */, 2 /* Ray Flags */, + 3 /* Cull Mask */, KRayParamInvalidId /* Hit Kind*/, + KRayParamInvalidId /* SBT index */, 4 /* SBT Offset */, + 5 /* SBT Stride */, KRayParamInvalidId /* SBT Record Offset */, + KRayParamInvalidId /* SBT Record Stride */, 6 /* Miss Index */, + 7 /* Ray Origin */, 8 /* Ray TMin */, 9 /* Ray Direction */, + 10 /* Ray TMax */, 12 /* Payload */, + KRayParamInvalidId /* Hit Object Attribute */)) + return error; + // Current Time + const uint32_t current_time_id = _.GetOperandTypeId(inst, 11); + if (!_.IsFloatScalarType(current_time_id) || + _.GetBitWidth(current_time_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Current Times must be a 32-bit float scalar type"; + } + + break; + } + + case spv::Op::OpHitObjectTraceRayNV: { + RegisterOpcodeForValidModel(_, inst); + if (auto error = ValidateHitObjectPointer(_, inst, 0)) return error; + + if (auto error = ValidateHitObjectInstructionCommonParameters( + _, inst, 1 /* Acceleration Struct */, + KRayParamInvalidId /* Instance Id */, + KRayParamInvalidId /* Primtive Id */, + KRayParamInvalidId /* Geometry Index */, 2 /* Ray Flags */, + 3 /* Cull Mask */, KRayParamInvalidId /* Hit Kind*/, + KRayParamInvalidId /* SBT index */, 4 /* SBT Offset */, + 5 /* SBT Stride */, KRayParamInvalidId /* SBT Record Offset */, + KRayParamInvalidId /* SBT Record Stride */, 6 /* Miss Index */, + 7 /* Ray Origin */, 8 /* Ray TMin */, 9 /* Ray Direction */, + 10 /* Ray TMax */, 11 /* Payload */, + KRayParamInvalidId /* Hit Object Attribute */)) + return error; + break; + } + + case spv::Op::OpReorderThreadWithHitObjectNV: { + std::string opcode_name = spvOpcodeString(inst->opcode()); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + [opcode_name](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR) { + if (message) { + *message = opcode_name + + " requires RayGenerationKHR execution model"; + } + return false; + } + return true; + }); + + if (auto error = ValidateHitObjectPointer(_, inst, 0)) return error; + + if (inst->operands().size() > 1) { + if (inst->operands().size() != 3) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint and Bits are optional together i.e " + << " Either both Hint and Bits should be provided or neither."; + } + + // Validate the optional opreands Hint and Bits + const uint32_t hint_id = _.GetOperandTypeId(inst, 1); + if (!_.IsIntScalarType(hint_id) || _.GetBitWidth(hint_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint must be a 32-bit int scalar"; + } + const uint32_t bits_id = _.GetOperandTypeId(inst, 2); + if (!_.IsIntScalarType(bits_id) || _.GetBitWidth(bits_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "bits must be a 32-bit int scalar"; + } + } + break; + } + + case spv::Op::OpReorderThreadWithHintNV: { + std::string opcode_name = spvOpcodeString(inst->opcode()); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + [opcode_name](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR) { + if (message) { + *message = opcode_name + + " requires RayGenerationKHR execution model"; + } + return false; + } + return true; + }); + + const uint32_t hint_id = _.GetOperandTypeId(inst, 0); + if (!_.IsIntScalarType(hint_id) || _.GetBitWidth(hint_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Hint must be a 32-bit int scalar"; + } + + const uint32_t bits_id = _.GetOperandTypeId(inst, 1); + if (!_.IsIntScalarType(bits_id) || _.GetBitWidth(bits_id) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "bits must be a 32-bit int scalar"; + } + } + + default: + break; + } + return SPV_SUCCESS; +} +} // namespace val +} // namespace spvtools diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_scopes.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_scopes.cpp index e9781802..40c49d1f 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_scopes.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_scopes.cpp @@ -14,7 +14,6 @@ #include "source/val/validate_scopes.h" -#include "source/diagnostic.h" #include "source/spirv_target_env.h" #include "source/val/instruction.h" #include "source/val/validation_state.h" @@ -25,16 +24,16 @@ namespace val { bool IsValidScope(uint32_t scope) { // Deliberately avoid a default case so we have to update the list when the // scopes list changes. - switch (static_cast(scope)) { - case SpvScopeCrossDevice: - case SpvScopeDevice: - case SpvScopeWorkgroup: - case SpvScopeSubgroup: - case SpvScopeInvocation: - case SpvScopeQueueFamilyKHR: - case SpvScopeShaderCallKHR: + switch (static_cast(scope)) { + case spv::Scope::CrossDevice: + case spv::Scope::Device: + case spv::Scope::Workgroup: + case spv::Scope::Subgroup: + case spv::Scope::Invocation: + case spv::Scope::QueueFamilyKHR: + case spv::Scope::ShaderCallKHR: return true; - case SpvScopeMax: + case spv::Scope::Max: break; } return false; @@ -42,7 +41,7 @@ bool IsValidScope(uint32_t scope) { spv_result_t ValidateScope(ValidationState_t& _, const Instruction* inst, uint32_t scope) { - SpvOp opcode = inst->opcode(); + spv::Op opcode = inst->opcode(); bool is_int32 = false, is_const_int32 = false; uint32_t value = 0; std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(scope); @@ -53,14 +52,14 @@ spv_result_t ValidateScope(ValidationState_t& _, const Instruction* inst, } if (!is_const_int32) { - if (_.HasCapability(SpvCapabilityShader) && - !_.HasCapability(SpvCapabilityCooperativeMatrixNV)) { + if (_.HasCapability(spv::Capability::Shader) && + !_.HasCapability(spv::Capability::CooperativeMatrixNV)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Scope ids must be OpConstant when Shader capability is " << "present"; } - if (_.HasCapability(SpvCapabilityShader) && - _.HasCapability(SpvCapabilityCooperativeMatrixNV) && + if (_.HasCapability(spv::Capability::Shader) && + _.HasCapability(spv::Capability::CooperativeMatrixNV) && !spvOpcodeIsConstant(_.GetIdOpcode(scope))) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Scope ids must be constant or specialization constant when " @@ -78,10 +77,10 @@ spv_result_t ValidateScope(ValidationState_t& _, const Instruction* inst, spv_result_t ValidateExecutionScope(ValidationState_t& _, const Instruction* inst, uint32_t scope) { - SpvOp opcode = inst->opcode(); + spv::Op opcode = inst->opcode(); bool is_int32 = false, is_const_int32 = false; - uint32_t value = 0; - std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(scope); + uint32_t tmp_value = 0; + std::tie(is_int32, is_const_int32, tmp_value) = _.EvalInt32IfConst(scope); if (auto error = ValidateScope(_, inst, scope)) { return error; @@ -91,13 +90,15 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _, return SPV_SUCCESS; } + spv::Scope value = spv::Scope(tmp_value); + // Vulkan specific rules if (spvIsVulkanEnv(_.context()->target_env)) { // Vulkan 1.1 specific rules if (_.context()->target_env != SPV_ENV_VULKAN_1_0) { // Scope for Non Uniform Group Operations must be limited to Subgroup if (spvOpcodeIsNonUniformGroupOperation(opcode) && - value != SpvScopeSubgroup) { + value != spv::Scope::Subgroup) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4642) << spvOpcodeString(opcode) << ": in Vulkan environment Execution scope is limited to " @@ -107,21 +108,21 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _, // OpControlBarrier must only use Subgroup execution scope for a subset of // execution models. - if (opcode == SpvOpControlBarrier && value != SpvScopeSubgroup) { + if (opcode == spv::Op::OpControlBarrier && value != spv::Scope::Subgroup) { std::string errorVUID = _.VkErrorID(4682); _.function(inst->function()->id()) ->RegisterExecutionModelLimitation([errorVUID]( - SpvExecutionModel model, + spv::ExecutionModel model, std::string* message) { - if (model == SpvExecutionModelFragment || - model == SpvExecutionModelVertex || - model == SpvExecutionModelGeometry || - model == SpvExecutionModelTessellationEvaluation || - model == SpvExecutionModelRayGenerationKHR || - model == SpvExecutionModelIntersectionKHR || - model == SpvExecutionModelAnyHitKHR || - model == SpvExecutionModelClosestHitKHR || - model == SpvExecutionModelMissKHR) { + if (model == spv::ExecutionModel::Fragment || + model == spv::ExecutionModel::Vertex || + model == spv::ExecutionModel::Geometry || + model == spv::ExecutionModel::TessellationEvaluation || + model == spv::ExecutionModel::RayGenerationKHR || + model == spv::ExecutionModel::IntersectionKHR || + model == spv::ExecutionModel::AnyHitKHR || + model == spv::ExecutionModel::ClosestHitKHR || + model == spv::ExecutionModel::MissKHR) { if (message) { *message = errorVUID + @@ -137,17 +138,17 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _, } // Only subset of execution models support Workgroup. - if (value == SpvScopeWorkgroup) { + if (value == spv::Scope::Workgroup) { std::string errorVUID = _.VkErrorID(4637); _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [errorVUID](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelTaskNV && - model != SpvExecutionModelMeshNV && - model != SpvExecutionModelTaskEXT && - model != SpvExecutionModelMeshEXT && - model != SpvExecutionModelTessellationControl && - model != SpvExecutionModelGLCompute) { + [errorVUID](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::TaskNV && + model != spv::ExecutionModel::MeshNV && + model != spv::ExecutionModel::TaskEXT && + model != spv::ExecutionModel::MeshEXT && + model != spv::ExecutionModel::TessellationControl && + model != spv::ExecutionModel::GLCompute) { if (message) { *message = errorVUID + @@ -163,7 +164,7 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _, // Vulkan generic rules // Scope for execution must be limited to Workgroup or Subgroup - if (value != SpvScopeWorkgroup && value != SpvScopeSubgroup) { + if (value != spv::Scope::Workgroup && value != spv::Scope::Subgroup) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4636) << spvOpcodeString(opcode) << ": in Vulkan environment Execution Scope is limited to " @@ -177,7 +178,7 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _, // Scope for execution must be limited to Workgroup or Subgroup for // non-uniform operations if (spvOpcodeIsNonUniformGroupOperation(opcode) && - value != SpvScopeSubgroup && value != SpvScopeWorkgroup) { + value != spv::Scope::Subgroup && value != spv::Scope::Workgroup) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode) << ": Execution scope is limited to Subgroup or Workgroup"; @@ -188,10 +189,10 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _, spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst, uint32_t scope) { - const SpvOp opcode = inst->opcode(); + const spv::Op opcode = inst->opcode(); bool is_int32 = false, is_const_int32 = false; - uint32_t value = 0; - std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(scope); + uint32_t tmp_value = 0; + std::tie(is_int32, is_const_int32, tmp_value) = _.EvalInt32IfConst(scope); if (auto error = ValidateScope(_, inst, scope)) { return error; @@ -201,8 +202,10 @@ spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst, return SPV_SUCCESS; } - if (value == SpvScopeQueueFamilyKHR) { - if (_.HasCapability(SpvCapabilityVulkanMemoryModelKHR)) { + spv::Scope value = spv::Scope(tmp_value); + + if (value == spv::Scope::QueueFamilyKHR) { + if (_.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { return SPV_SUCCESS; } else { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -212,9 +215,9 @@ spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst, } } - if (value == SpvScopeDevice && - _.HasCapability(SpvCapabilityVulkanMemoryModelKHR) && - !_.HasCapability(SpvCapabilityVulkanMemoryModelDeviceScopeKHR)) { + if (value == spv::Scope::Device && + _.HasCapability(spv::Capability::VulkanMemoryModelKHR) && + !_.HasCapability(spv::Capability::VulkanMemoryModelDeviceScopeKHR)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Use of device scope with VulkanKHR memory model requires the " << "VulkanMemoryModelDeviceScopeKHR capability"; @@ -222,36 +225,37 @@ spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst, // Vulkan Specific rules if (spvIsVulkanEnv(_.context()->target_env)) { - if (value != SpvScopeDevice && value != SpvScopeWorkgroup && - value != SpvScopeSubgroup && value != SpvScopeInvocation && - value != SpvScopeShaderCallKHR && value != SpvScopeQueueFamily) { + if (value != spv::Scope::Device && value != spv::Scope::Workgroup && + value != spv::Scope::Subgroup && value != spv::Scope::Invocation && + value != spv::Scope::ShaderCallKHR && + value != spv::Scope::QueueFamily) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << _.VkErrorID(4638) << spvOpcodeString(opcode) << ": in Vulkan environment Memory Scope is limited to Device, " "QueueFamily, Workgroup, ShaderCallKHR, Subgroup, or " "Invocation"; } else if (_.context()->target_env == SPV_ENV_VULKAN_1_0 && - value == SpvScopeSubgroup && - !_.HasCapability(SpvCapabilitySubgroupBallotKHR) && - !_.HasCapability(SpvCapabilitySubgroupVoteKHR)) { + value == spv::Scope::Subgroup && + !_.HasCapability(spv::Capability::SubgroupBallotKHR) && + !_.HasCapability(spv::Capability::SubgroupVoteKHR)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) - << _.VkErrorID(6997) << spvOpcodeString(opcode) + << _.VkErrorID(7951) << spvOpcodeString(opcode) << ": in Vulkan 1.0 environment Memory Scope is can not be " "Subgroup without SubgroupBallotKHR or SubgroupVoteKHR " "declared"; } - if (value == SpvScopeShaderCallKHR) { + if (value == spv::Scope::ShaderCallKHR) { std::string errorVUID = _.VkErrorID(4640); _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [errorVUID](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelRayGenerationKHR && - model != SpvExecutionModelIntersectionKHR && - model != SpvExecutionModelAnyHitKHR && - model != SpvExecutionModelClosestHitKHR && - model != SpvExecutionModelMissKHR && - model != SpvExecutionModelCallableKHR) { + [errorVUID](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR && + model != spv::ExecutionModel::IntersectionKHR && + model != spv::ExecutionModel::AnyHitKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::MissKHR && + model != spv::ExecutionModel::CallableKHR) { if (message) { *message = errorVUID + @@ -264,17 +268,17 @@ spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst, }); } - if (value == SpvScopeWorkgroup) { + if (value == spv::Scope::Workgroup) { std::string errorVUID = _.VkErrorID(7321); _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [errorVUID](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelGLCompute && - model != SpvExecutionModelTessellationControl && - model != SpvExecutionModelTaskNV && - model != SpvExecutionModelMeshNV && - model != SpvExecutionModelTaskEXT && - model != SpvExecutionModelMeshEXT) { + [errorVUID](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::GLCompute && + model != spv::ExecutionModel::TessellationControl && + model != spv::ExecutionModel::TaskNV && + model != spv::ExecutionModel::MeshNV && + model != spv::ExecutionModel::TaskEXT && + model != spv::ExecutionModel::MeshEXT) { if (message) { *message = errorVUID + "Workgroup Memory Scope is limited to MeshNV, " @@ -286,12 +290,12 @@ spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst, return true; }); - if (_.memory_model() == SpvMemoryModelGLSL450) { + if (_.memory_model() == spv::MemoryModel::GLSL450) { errorVUID = _.VkErrorID(7320); _.function(inst->function()->id()) ->RegisterExecutionModelLimitation( - [errorVUID](SpvExecutionModel model, std::string* message) { - if (model == SpvExecutionModelTessellationControl) { + [errorVUID](spv::ExecutionModel model, std::string* message) { + if (model == spv::ExecutionModel::TessellationControl) { if (message) { *message = errorVUID + diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_small_type_uses.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_small_type_uses.cpp index 9db82e7c..69f61ee4 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_small_type_uses.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_small_type_uses.cpp @@ -22,7 +22,7 @@ namespace val { spv_result_t ValidateSmallTypeUses(ValidationState_t& _, const Instruction* inst) { - if (!_.HasCapability(SpvCapabilityShader) || inst->type_id() == 0 || + if (!_.HasCapability(spv::Capability::Shader) || inst->type_id() == 0 || !_.ContainsLimitedUseIntOrFloatType(inst->type_id())) { return SPV_SUCCESS; } @@ -36,13 +36,13 @@ spv_result_t ValidateSmallTypeUses(ValidationState_t& _, for (auto use : inst->uses()) { const auto* user = use.first; switch (user->opcode()) { - case SpvOpDecorate: - case SpvOpDecorateId: - case SpvOpCopyObject: - case SpvOpStore: - case SpvOpFConvert: - case SpvOpUConvert: - case SpvOpSConvert: + case spv::Op::OpDecorate: + case spv::Op::OpDecorateId: + case spv::Op::OpCopyObject: + case spv::Op::OpStore: + case spv::Op::OpFConvert: + case spv::Op::OpUConvert: + case spv::Op::OpSConvert: break; default: return _.diag(SPV_ERROR_INVALID_ID, user) diff --git a/bgfx/3rdparty/spirv-tools/source/val/validate_type.cpp b/bgfx/3rdparty/spirv-tools/source/val/validate_type.cpp index 6b0881cf..7edd12ff 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validate_type.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validate_type.cpp @@ -19,7 +19,6 @@ #include "source/val/instruction.h" #include "source/val/validate.h" #include "source/val/validation_state.h" -#include "spirv/unified1/spirv.h" namespace spvtools { namespace val { @@ -50,8 +49,8 @@ spv_result_t ValidateUniqueness(ValidationState_t& _, const Instruction* inst) { return SPV_SUCCESS; const auto opcode = inst->opcode(); - if (opcode != SpvOpTypeArray && opcode != SpvOpTypeRuntimeArray && - opcode != SpvOpTypeStruct && opcode != SpvOpTypePointer && + if (opcode != spv::Op::OpTypeArray && opcode != spv::Op::OpTypeRuntimeArray && + opcode != spv::Op::OpTypeStruct && opcode != spv::Op::OpTypePointer && !_.RegisterUniqueTypeDeclaration(inst)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Duplicate non-aggregate type declarations are not allowed. " @@ -84,7 +83,7 @@ spv_result_t ValidateTypeInt(ValidationState_t& _, const Instruction* inst) { << "Using a 16-bit integer type requires the Int16 capability," " or an extension that explicitly enables 16-bit integers."; } else if (num_bits == 64) { - if (_.HasCapability(SpvCapabilityInt64)) { + if (_.HasCapability(spv::Capability::Int64)) { return SPV_SUCCESS; } return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -105,7 +104,8 @@ spv_result_t ValidateTypeInt(ValidationState_t& _, const Instruction* inst) { // SPIR-V Spec 2.16.3: Validation Rules for Kernel Capabilities: The // Signedness in OpTypeInt must always be 0. - if (SpvOpTypeInt == inst->opcode() && _.HasCapability(SpvCapabilityKernel) && + if (spv::Op::OpTypeInt == inst->opcode() && + _.HasCapability(spv::Capability::Kernel) && inst->GetOperandAs(2) != 0u) { return _.diag(SPV_ERROR_INVALID_BINARY, inst) << "The Signedness in OpTypeInt " @@ -135,7 +135,7 @@ spv_result_t ValidateTypeFloat(ValidationState_t& _, const Instruction* inst) { " or an extension that explicitly enables 16-bit floating point."; } if (num_bits == 64) { - if (_.HasCapability(SpvCapabilityFloat64)) { + if (_.HasCapability(spv::Capability::Float64)) { return SPV_SUCCESS; } return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -163,7 +163,7 @@ spv_result_t ValidateTypeVector(ValidationState_t& _, const Instruction* inst) { if (num_components == 2 || num_components == 3 || num_components == 4) { return SPV_SUCCESS; } else if (num_components == 8 || num_components == 16) { - if (_.HasCapability(SpvCapabilityVector16)) { + if (_.HasCapability(spv::Capability::Vector16)) { return SPV_SUCCESS; } return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -183,7 +183,7 @@ spv_result_t ValidateTypeMatrix(ValidationState_t& _, const Instruction* inst) { const auto column_type_index = 1; const auto column_type_id = inst->GetOperandAs(column_type_index); const auto column_type = _.FindDef(column_type_id); - if (!column_type || SpvOpTypeVector != column_type->opcode()) { + if (!column_type || spv::Op::OpTypeVector != column_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Columns in a matrix must be of type vector."; } @@ -192,7 +192,7 @@ spv_result_t ValidateTypeMatrix(ValidationState_t& _, const Instruction* inst) { // Operand 1 is the of the type of data in the vector. const auto comp_type_id = column_type->GetOperandAs(1); auto comp_type_instruction = _.FindDef(comp_type_id); - if (comp_type_instruction->opcode() != SpvOpTypeFloat) { + if (comp_type_instruction->opcode() != spv::Op::OpTypeFloat) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Matrix types can only be " "parameterized with " "floating-point types."; @@ -219,14 +219,14 @@ spv_result_t ValidateTypeArray(ValidationState_t& _, const Instruction* inst) { << " is not a type."; } - if (element_type->opcode() == SpvOpTypeVoid) { + if (element_type->opcode() == spv::Op::OpTypeVoid) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpTypeArray Element Type " << _.getIdName(element_type_id) << " is a void type."; } if (spvIsVulkanEnv(_.context()->target_env) && - element_type->opcode() == SpvOpTypeRuntimeArray) { + element_type->opcode() == spv::Op::OpTypeRuntimeArray) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4680) << "OpTypeArray Element Type " << _.getIdName(element_type_id) << " is not valid in " @@ -246,15 +246,15 @@ spv_result_t ValidateTypeArray(ValidationState_t& _, const Instruction* inst) { const auto const_inst = length->words(); const auto const_result_type_index = 1; const auto const_result_type = _.FindDef(const_inst[const_result_type_index]); - if (!const_result_type || SpvOpTypeInt != const_result_type->opcode()) { + if (!const_result_type || spv::Op::OpTypeInt != const_result_type->opcode()) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpTypeArray Length " << _.getIdName(length_id) << " is not a constant integer type."; } switch (length->opcode()) { - case SpvOpSpecConstant: - case SpvOpConstant: { + case spv::Op::OpSpecConstant: + case spv::Op::OpConstant: { auto& type_words = const_result_type->words(); const bool is_signed = type_words[3] > 0; const uint32_t width = type_words[2]; @@ -265,11 +265,11 @@ spv_result_t ValidateTypeArray(ValidationState_t& _, const Instruction* inst) { << " default value must be at least 1: found " << ivalue; } } break; - case SpvOpConstantNull: + case spv::Op::OpConstantNull: return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpTypeArray Length " << _.getIdName(length_id) << " default value must be at least 1."; - case SpvOpSpecConstantOp: + case spv::Op::OpSpecConstantOp: // Assume it's OK, rather than try to evaluate the operation. break; default: @@ -289,14 +289,14 @@ spv_result_t ValidateTypeRuntimeArray(ValidationState_t& _, << " is not a type."; } - if (element_type->opcode() == SpvOpTypeVoid) { + if (element_type->opcode() == spv::Op::OpTypeVoid) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpTypeRuntimeArray Element Type " << _.getIdName(element_id) << " is a void type."; } if (spvIsVulkanEnv(_.context()->target_env) && - element_type->opcode() == SpvOpTypeRuntimeArray) { + element_type->opcode() == spv::Op::OpTypeRuntimeArray) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4680) << "OpTypeRuntimeArray Element Type " << _.getIdName(element_id) << " is not valid in " @@ -322,11 +322,11 @@ spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { << "OpTypeStruct Member Type " << _.getIdName(member_type_id) << " is not a type."; } - if (member_type->opcode() == SpvOpTypeVoid) { + if (member_type->opcode() == spv::Op::OpTypeVoid) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Structures cannot contain a void type."; } - if (SpvOpTypeStruct == member_type->opcode() && + if (spv::Op::OpTypeStruct == member_type->opcode() && _.IsStructTypeWithBuiltInMember(member_type_id)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Structure " << _.getIdName(member_type_id) @@ -339,7 +339,7 @@ spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { } if (spvIsVulkanEnv(_.context()->target_env) && - member_type->opcode() == SpvOpTypeRuntimeArray) { + member_type->opcode() == spv::Op::OpTypeRuntimeArray) { const bool is_last_member = member_type_index == inst->operands().size() - 1; if (!is_last_member) { @@ -349,6 +349,15 @@ spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { << ", OpTypeRuntimeArray must only be used for the last member " "of an OpTypeStruct"; } + + if (!_.HasDecoration(inst->id(), spv::Decoration::Block) && + !_.HasDecoration(inst->id(), spv::Decoration::BufferBlock)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << _.VkErrorID(4680) + << spvLogStringForEnv(_.context()->target_env) + << ", OpTypeStruct containing an OpTypeRuntimeArray " + << "must be decorated with Block or BufferBlock."; + } } } @@ -357,9 +366,10 @@ spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { for (size_t word_i = 2; word_i < inst->words().size(); ++word_i) { auto member = inst->word(word_i); auto memberTypeInstr = _.FindDef(member); - if (memberTypeInstr && SpvOpTypeStruct == memberTypeInstr->opcode()) { - if (_.HasDecoration(memberTypeInstr->id(), SpvDecorationBlock) || - _.HasDecoration(memberTypeInstr->id(), SpvDecorationBufferBlock) || + if (memberTypeInstr && spv::Op::OpTypeStruct == memberTypeInstr->opcode()) { + if (_.HasDecoration(memberTypeInstr->id(), spv::Decoration::Block) || + _.HasDecoration(memberTypeInstr->id(), + spv::Decoration::BufferBlock) || _.GetHasNestedBlockOrBufferBlockStruct(memberTypeInstr->id())) has_nested_blockOrBufferBlock_struct = true; } @@ -368,8 +378,8 @@ spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { _.SetHasNestedBlockOrBufferBlockStruct(inst->id(), has_nested_blockOrBufferBlock_struct); if (_.GetHasNestedBlockOrBufferBlockStruct(inst->id()) && - (_.HasDecoration(inst->id(), SpvDecorationBufferBlock) || - _.HasDecoration(inst->id(), SpvDecorationBlock))) { + (_.HasDecoration(inst->id(), spv::Decoration::BufferBlock) || + _.HasDecoration(inst->id(), spv::Decoration::Block))) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "rules: A Block or BufferBlock cannot be nested within another " "Block or BufferBlock. "; @@ -377,7 +387,7 @@ spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { std::unordered_set built_in_members; for (auto decoration : _.id_decorations(struct_id)) { - if (decoration.dec_type() == SpvDecorationBuiltIn && + if (decoration.dec_type() == spv::Decoration::BuiltIn && decoration.struct_member_index() != Decoration::kInvalidMember) { built_in_members.insert(decoration.struct_member_index()); } @@ -398,9 +408,9 @@ spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { const auto isOpaqueType = [&_](const Instruction* opaque_inst) { auto opcode = opaque_inst->opcode(); - if (_.HasCapability(SpvCapabilityBindlessTextureNV) && - (opcode == SpvOpTypeImage || opcode == SpvOpTypeSampler || - opcode == SpvOpTypeSampledImage)) { + if (_.HasCapability(spv::Capability::BindlessTextureNV) && + (opcode == spv::Op::OpTypeImage || opcode == spv::Op::OpTypeSampler || + opcode == spv::Op::OpTypeSampledImage)) { return false; } else if (spvOpcodeIsBaseOpaqueType(opcode)) { return true; @@ -430,15 +440,15 @@ spv_result_t ValidateTypePointer(ValidationState_t& _, << " is not a type."; } // See if this points to a storage image. - const auto storage_class = inst->GetOperandAs(1); - if (storage_class == SpvStorageClassUniformConstant) { + const auto storage_class = inst->GetOperandAs(1); + if (storage_class == spv::StorageClass::UniformConstant) { // Unpack an optional level of arraying. - if (type->opcode() == SpvOpTypeArray || - type->opcode() == SpvOpTypeRuntimeArray) { + if (type->opcode() == spv::Op::OpTypeArray || + type->opcode() == spv::Op::OpTypeRuntimeArray) { type_id = type->GetOperandAs(1); type = _.FindDef(type_id); } - if (type->opcode() == SpvOpTypeImage) { + if (type->opcode() == spv::Op::OpTypeImage) { const auto sampled = type->GetOperandAs(6); // 2 indicates this image is known to be be used without a sampler, i.e. // a storage image. @@ -475,7 +485,7 @@ spv_result_t ValidateTypeFunction(ValidationState_t& _, << " is not a type."; } - if (param_type->opcode() == SpvOpTypeVoid) { + if (param_type->opcode() == spv::Op::OpTypeVoid) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpTypeFunction Parameter Type " << _.getIdName(param_id) << " cannot be OpTypeVoid."; @@ -495,8 +505,9 @@ spv_result_t ValidateTypeFunction(ValidationState_t& _, // decoration instruction. for (auto& pair : inst->uses()) { const auto* use = pair.first; - if (use->opcode() != SpvOpFunction && !spvOpcodeIsDebug(use->opcode()) && - !use->IsNonSemantic() && !spvOpcodeIsDecoration(use->opcode())) { + if (use->opcode() != spv::Op::OpFunction && + !spvOpcodeIsDebug(use->opcode()) && !use->IsNonSemantic() && + !spvOpcodeIsDecoration(use->opcode())) { return _.diag(SPV_ERROR_INVALID_ID, use) << "Invalid use of function type result id " << _.getIdName(inst->id()) << "."; @@ -510,13 +521,13 @@ spv_result_t ValidateTypeForwardPointer(ValidationState_t& _, const Instruction* inst) { const auto pointer_type_id = inst->GetOperandAs(0); const auto pointer_type_inst = _.FindDef(pointer_type_id); - if (pointer_type_inst->opcode() != SpvOpTypePointer) { + if (pointer_type_inst->opcode() != spv::Op::OpTypePointer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Pointer type in OpTypeForwardPointer is not a pointer type."; } - const auto storage_class = inst->GetOperandAs(1); - if (storage_class != pointer_type_inst->GetOperandAs(1)) { + const auto storage_class = inst->GetOperandAs(1); + if (storage_class != pointer_type_inst->GetOperandAs(1)) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Storage class in OpTypeForwardPointer does not match the " << "pointer definition."; @@ -524,13 +535,13 @@ spv_result_t ValidateTypeForwardPointer(ValidationState_t& _, const auto pointee_type_id = pointer_type_inst->GetOperandAs(2); const auto pointee_type = _.FindDef(pointee_type_id); - if (!pointee_type || pointee_type->opcode() != SpvOpTypeStruct) { + if (!pointee_type || pointee_type->opcode() != spv::Op::OpTypeStruct) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "Forward pointers must point to a structure"; } if (spvIsVulkanEnv(_.context()->target_env)) { - if (storage_class != SpvStorageClassPhysicalStorageBuffer) { + if (storage_class != spv::StorageClass::PhysicalStorageBuffer) { return _.diag(SPV_ERROR_INVALID_ID, inst) << _.VkErrorID(4711) << "In Vulkan, OpTypeForwardPointer must have " @@ -541,16 +552,16 @@ spv_result_t ValidateTypeForwardPointer(ValidationState_t& _, return SPV_SUCCESS; } -spv_result_t ValidateTypeCooperativeMatrixNV(ValidationState_t& _, - const Instruction* inst) { +spv_result_t ValidateTypeCooperativeMatrix(ValidationState_t& _, + const Instruction* inst) { const auto component_type_index = 1; const auto component_type_id = inst->GetOperandAs(component_type_index); const auto component_type = _.FindDef(component_type_id); - if (!component_type || (SpvOpTypeFloat != component_type->opcode() && - SpvOpTypeInt != component_type->opcode())) { + if (!component_type || (spv::Op::OpTypeFloat != component_type->opcode() && + spv::Op::OpTypeInt != component_type->opcode())) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "OpTypeCooperativeMatrixNV Component Type " + << "OpTypeCooperativeMatrix Component Type " << _.getIdName(component_type_id) << " is not a scalar numerical type."; } @@ -561,7 +572,7 @@ spv_result_t ValidateTypeCooperativeMatrixNV(ValidationState_t& _, if (!scope || !_.IsIntScalarType(scope->type_id()) || !spvOpcodeIsConstant(scope->opcode())) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "OpTypeCooperativeMatrixNV Scope " << _.getIdName(scope_id) + << "OpTypeCooperativeMatrix Scope " << _.getIdName(scope_id) << " is not a constant instruction with scalar integer type."; } @@ -571,7 +582,7 @@ spv_result_t ValidateTypeCooperativeMatrixNV(ValidationState_t& _, if (!rows || !_.IsIntScalarType(rows->type_id()) || !spvOpcodeIsConstant(rows->opcode())) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "OpTypeCooperativeMatrixNV Rows " << _.getIdName(rows_id) + << "OpTypeCooperativeMatrix Rows " << _.getIdName(rows_id) << " is not a constant instruction with scalar integer type."; } @@ -581,55 +592,68 @@ spv_result_t ValidateTypeCooperativeMatrixNV(ValidationState_t& _, if (!cols || !_.IsIntScalarType(cols->type_id()) || !spvOpcodeIsConstant(cols->opcode())) { return _.diag(SPV_ERROR_INVALID_ID, inst) - << "OpTypeCooperativeMatrixNV Cols " << _.getIdName(cols_id) + << "OpTypeCooperativeMatrix Cols " << _.getIdName(cols_id) << " is not a constant instruction with scalar integer type."; } + if (inst->opcode() == spv::Op::OpTypeCooperativeMatrixKHR) { + const auto use_index = 5; + const auto use_id = inst->GetOperandAs(use_index); + const auto use = _.FindDef(use_id); + if (!use || !_.IsIntScalarType(use->type_id()) || + !spvOpcodeIsConstant(use->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeCooperativeMatrixKHR Use " << _.getIdName(use_id) + << " is not a constant instruction with scalar integer type."; + } + } + return SPV_SUCCESS; } } // namespace spv_result_t TypePass(ValidationState_t& _, const Instruction* inst) { if (!spvOpcodeGeneratesType(inst->opcode()) && - inst->opcode() != SpvOpTypeForwardPointer) { + inst->opcode() != spv::Op::OpTypeForwardPointer) { return SPV_SUCCESS; } if (auto error = ValidateUniqueness(_, inst)) return error; switch (inst->opcode()) { - case SpvOpTypeInt: + case spv::Op::OpTypeInt: if (auto error = ValidateTypeInt(_, inst)) return error; break; - case SpvOpTypeFloat: + case spv::Op::OpTypeFloat: if (auto error = ValidateTypeFloat(_, inst)) return error; break; - case SpvOpTypeVector: + case spv::Op::OpTypeVector: if (auto error = ValidateTypeVector(_, inst)) return error; break; - case SpvOpTypeMatrix: + case spv::Op::OpTypeMatrix: if (auto error = ValidateTypeMatrix(_, inst)) return error; break; - case SpvOpTypeArray: + case spv::Op::OpTypeArray: if (auto error = ValidateTypeArray(_, inst)) return error; break; - case SpvOpTypeRuntimeArray: + case spv::Op::OpTypeRuntimeArray: if (auto error = ValidateTypeRuntimeArray(_, inst)) return error; break; - case SpvOpTypeStruct: + case spv::Op::OpTypeStruct: if (auto error = ValidateTypeStruct(_, inst)) return error; break; - case SpvOpTypePointer: + case spv::Op::OpTypePointer: if (auto error = ValidateTypePointer(_, inst)) return error; break; - case SpvOpTypeFunction: + case spv::Op::OpTypeFunction: if (auto error = ValidateTypeFunction(_, inst)) return error; break; - case SpvOpTypeForwardPointer: + case spv::Op::OpTypeForwardPointer: if (auto error = ValidateTypeForwardPointer(_, inst)) return error; break; - case SpvOpTypeCooperativeMatrixNV: - if (auto error = ValidateTypeCooperativeMatrixNV(_, inst)) return error; + case spv::Op::OpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixKHR: + if (auto error = ValidateTypeCooperativeMatrix(_, inst)) return error; break; default: break; diff --git a/bgfx/3rdparty/spirv-tools/source/val/validation_state.cpp b/bgfx/3rdparty/spirv-tools/source/val/validation_state.cpp index d5ddc9c1..6685985b 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validation_state.cpp +++ b/bgfx/3rdparty/spirv-tools/source/val/validation_state.cpp @@ -21,6 +21,7 @@ #include "source/opcode.h" #include "source/spirv_constant.h" #include "source/spirv_target_env.h" +#include "source/util/make_unique.h" #include "source/val/basic_block.h" #include "source/val/construct.h" #include "source/val/function.h" @@ -31,66 +32,66 @@ namespace val { namespace { ModuleLayoutSection InstructionLayoutSection( - ModuleLayoutSection current_section, SpvOp op) { + ModuleLayoutSection current_section, spv::Op op) { // See Section 2.4 if (spvOpcodeGeneratesType(op) || spvOpcodeIsConstant(op)) return kLayoutTypes; switch (op) { - case SpvOpCapability: + case spv::Op::OpCapability: return kLayoutCapabilities; - case SpvOpExtension: + case spv::Op::OpExtension: return kLayoutExtensions; - case SpvOpExtInstImport: + case spv::Op::OpExtInstImport: return kLayoutExtInstImport; - case SpvOpMemoryModel: + case spv::Op::OpMemoryModel: return kLayoutMemoryModel; - case SpvOpEntryPoint: + case spv::Op::OpEntryPoint: return kLayoutEntryPoint; - case SpvOpExecutionMode: - case SpvOpExecutionModeId: + case spv::Op::OpExecutionMode: + case spv::Op::OpExecutionModeId: return kLayoutExecutionMode; - case SpvOpSourceContinued: - case SpvOpSource: - case SpvOpSourceExtension: - case SpvOpString: + case spv::Op::OpSourceContinued: + case spv::Op::OpSource: + case spv::Op::OpSourceExtension: + case spv::Op::OpString: return kLayoutDebug1; - case SpvOpName: - case SpvOpMemberName: + case spv::Op::OpName: + case spv::Op::OpMemberName: return kLayoutDebug2; - case SpvOpModuleProcessed: + case spv::Op::OpModuleProcessed: return kLayoutDebug3; - case SpvOpDecorate: - case SpvOpMemberDecorate: - case SpvOpGroupDecorate: - case SpvOpGroupMemberDecorate: - case SpvOpDecorationGroup: - case SpvOpDecorateId: - case SpvOpDecorateStringGOOGLE: - case SpvOpMemberDecorateStringGOOGLE: + case spv::Op::OpDecorate: + case spv::Op::OpMemberDecorate: + case spv::Op::OpGroupDecorate: + case spv::Op::OpGroupMemberDecorate: + case spv::Op::OpDecorationGroup: + case spv::Op::OpDecorateId: + case spv::Op::OpDecorateStringGOOGLE: + case spv::Op::OpMemberDecorateStringGOOGLE: return kLayoutAnnotations; - case SpvOpTypeForwardPointer: + case spv::Op::OpTypeForwardPointer: return kLayoutTypes; - case SpvOpVariable: + case spv::Op::OpVariable: if (current_section == kLayoutTypes) return kLayoutTypes; return kLayoutFunctionDefinitions; - case SpvOpExtInst: - // SpvOpExtInst is only allowed in types section for certain extended - // instruction sets. This will be checked separately. + case spv::Op::OpExtInst: + // spv::Op::OpExtInst is only allowed in types section for certain + // extended instruction sets. This will be checked separately. if (current_section == kLayoutTypes) return kLayoutTypes; return kLayoutFunctionDefinitions; - case SpvOpLine: - case SpvOpNoLine: - case SpvOpUndef: + case spv::Op::OpLine: + case spv::Op::OpNoLine: + case spv::Op::OpUndef: if (current_section == kLayoutTypes) return kLayoutTypes; return kLayoutFunctionDefinitions; - case SpvOpFunction: - case SpvOpFunctionParameter: - case SpvOpFunctionEnd: + case spv::Op::OpFunction: + case spv::Op::OpFunctionParameter: + case spv::Op::OpFunctionEnd: if (current_section == kLayoutFunctionDeclarations) return kLayoutFunctionDeclarations; return kLayoutFunctionDefinitions; - case SpvOpSamplerImageAddressingModeNV: + case spv::Op::OpSamplerImageAddressingModeNV: return kLayoutSamplerImageAddressMode; default: break; @@ -98,7 +99,7 @@ ModuleLayoutSection InstructionLayoutSection( return kLayoutFunctionDefinitions; } -bool IsInstructionInLayoutSection(ModuleLayoutSection layout, SpvOp op) { +bool IsInstructionInLayoutSection(ModuleLayoutSection layout, spv::Op op) { return layout == InstructionLayoutSection(layout, op); } @@ -106,7 +107,9 @@ bool IsInstructionInLayoutSection(ModuleLayoutSection layout, SpvOp op) { spv_result_t CountInstructions(void* user_data, const spv_parsed_instruction_t* inst) { ValidationState_t& _ = *(reinterpret_cast(user_data)); - if (inst->opcode == SpvOpFunction) _.increment_total_functions(); + if (spv::Op(inst->opcode) == spv::Op::OpFunction) { + _.increment_total_functions(); + } _.increment_total_instructions(); return SPV_SUCCESS; @@ -160,8 +163,8 @@ ValidationState_t::ValidationState_t(const spv_const_context ctx, struct_nesting_depth_(), struct_has_nested_blockorbufferblock_struct_(), grammar_(ctx), - addressing_model_(SpvAddressingModelMax), - memory_model_(SpvMemoryModelMax), + addressing_model_(spv::AddressingModel::Max), + memory_model_(spv::MemoryModel::Max), pointer_size_and_alignment_(0), sampler_image_addressing_mode_(0), in_function_(false), @@ -290,13 +293,13 @@ void ValidationState_t::ProgressToNextLayoutSectionOrder() { } } -bool ValidationState_t::IsOpcodeInPreviousLayoutSection(SpvOp op) { +bool ValidationState_t::IsOpcodeInPreviousLayoutSection(spv::Op op) { ModuleLayoutSection section = InstructionLayoutSection(current_layout_section_, op); return section < current_layout_section_; } -bool ValidationState_t::IsOpcodeInCurrentLayoutSection(SpvOp op) { +bool ValidationState_t::IsOpcodeInCurrentLayoutSection(spv::Op op) { return IsInstructionInLayoutSection(current_layout_section_, op); } @@ -353,59 +356,61 @@ bool ValidationState_t::in_block() const { module_functions_.back().current_block() != nullptr; } -void ValidationState_t::RegisterCapability(SpvCapability cap) { +void ValidationState_t::RegisterCapability(spv::Capability cap) { // Avoid redundant work. Otherwise the recursion could induce work // quadrdatic in the capability dependency depth. (Ok, not much, but // it's something.) - if (module_capabilities_.Contains(cap)) return; + if (module_capabilities_.contains(cap)) return; - module_capabilities_.Add(cap); + module_capabilities_.insert(cap); spv_operand_desc desc; - if (SPV_SUCCESS == - grammar_.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, cap, &desc)) { - CapabilitySet(desc->numCapabilities, desc->capabilities) - .ForEach([this](SpvCapability c) { RegisterCapability(c); }); + if (SPV_SUCCESS == grammar_.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, + uint32_t(cap), &desc)) { + for (auto capability : + CapabilitySet(desc->numCapabilities, desc->capabilities)) { + RegisterCapability(capability); + } } switch (cap) { - case SpvCapabilityKernel: + case spv::Capability::Kernel: features_.group_ops_reduce_and_scans = true; break; - case SpvCapabilityInt8: + case spv::Capability::Int8: features_.use_int8_type = true; features_.declare_int8_type = true; break; - case SpvCapabilityStorageBuffer8BitAccess: - case SpvCapabilityUniformAndStorageBuffer8BitAccess: - case SpvCapabilityStoragePushConstant8: - case SpvCapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR: + case spv::Capability::StorageBuffer8BitAccess: + case spv::Capability::UniformAndStorageBuffer8BitAccess: + case spv::Capability::StoragePushConstant8: + case spv::Capability::WorkgroupMemoryExplicitLayout8BitAccessKHR: features_.declare_int8_type = true; break; - case SpvCapabilityInt16: + case spv::Capability::Int16: features_.declare_int16_type = true; break; - case SpvCapabilityFloat16: - case SpvCapabilityFloat16Buffer: + case spv::Capability::Float16: + case spv::Capability::Float16Buffer: features_.declare_float16_type = true; break; - case SpvCapabilityStorageUniformBufferBlock16: - case SpvCapabilityStorageUniform16: - case SpvCapabilityStoragePushConstant16: - case SpvCapabilityStorageInputOutput16: - case SpvCapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR: + case spv::Capability::StorageUniformBufferBlock16: + case spv::Capability::StorageUniform16: + case spv::Capability::StoragePushConstant16: + case spv::Capability::StorageInputOutput16: + case spv::Capability::WorkgroupMemoryExplicitLayout16BitAccessKHR: features_.declare_int16_type = true; features_.declare_float16_type = true; features_.free_fp_rounding_mode = true; break; - case SpvCapabilityVariablePointers: - case SpvCapabilityVariablePointersStorageBuffer: + case spv::Capability::VariablePointers: + case spv::Capability::VariablePointersStorageBuffer: features_.variable_pointers = true; break; default: // TODO(dneto): For now don't validate SPV_NV_ray_tracing, which uses - // capability SpvCapabilityRayTracingNV. - // SpvCapabilityRayTracingProvisionalKHR would need the same treatment. - // One of the differences going from SPV_KHR_ray_tracing from + // capability spv::Capability::RayTracingNV. + // spv::Capability::RayTracingProvisionalKHR would need the same + // treatment. One of the differences going from SPV_KHR_ray_tracing from // provisional to final spec was the provisional spec uses Locations // for variables in certain storage classes, just like the // SPV_NV_ray_tracing extension. So it mimics the NVIDIA extension. @@ -416,9 +421,9 @@ void ValidationState_t::RegisterCapability(SpvCapability cap) { } void ValidationState_t::RegisterExtension(Extension ext) { - if (module_extensions_.Contains(ext)) return; + if (module_extensions_.contains(ext)) return; - module_extensions_.Add(ext); + module_extensions_.insert(ext); switch (ext) { case kSPV_AMD_gpu_shader_half_float: @@ -454,30 +459,32 @@ bool ValidationState_t::HasAnyOfExtensions( return module_extensions_.HasAnyOf(extensions); } -void ValidationState_t::set_addressing_model(SpvAddressingModel am) { +void ValidationState_t::set_addressing_model(spv::AddressingModel am) { addressing_model_ = am; switch (am) { - case SpvAddressingModelPhysical32: + case spv::AddressingModel::Physical32: pointer_size_and_alignment_ = 4; break; default: // fall through - case SpvAddressingModelPhysical64: - case SpvAddressingModelPhysicalStorageBuffer64: + case spv::AddressingModel::Physical64: + case spv::AddressingModel::PhysicalStorageBuffer64: pointer_size_and_alignment_ = 8; break; } } -SpvAddressingModel ValidationState_t::addressing_model() const { +spv::AddressingModel ValidationState_t::addressing_model() const { return addressing_model_; } -void ValidationState_t::set_memory_model(SpvMemoryModel mm) { +void ValidationState_t::set_memory_model(spv::MemoryModel mm) { memory_model_ = mm; } -SpvMemoryModel ValidationState_t::memory_model() const { return memory_model_; } +spv::MemoryModel ValidationState_t::memory_model() const { + return memory_model_; +} void ValidationState_t::set_samplerimage_variable_address_mode( uint32_t bit_width) { @@ -489,8 +496,8 @@ uint32_t ValidationState_t::samplerimage_variable_address_mode() const { } spv_result_t ValidationState_t::RegisterFunction( - uint32_t id, uint32_t ret_type_id, SpvFunctionControlMask function_control, - uint32_t function_type_id) { + uint32_t id, uint32_t ret_type_id, + spv::FunctionControlMask function_control, uint32_t function_type_id) { assert(in_function_body() == false && "RegisterFunction can only be called when parsing the binary outside " "of another function"); @@ -526,24 +533,24 @@ Instruction* ValidationState_t::AddOrderedInstruction( // Improves diagnostic messages by collecting names of IDs void ValidationState_t::RegisterDebugInstruction(const Instruction* inst) { switch (inst->opcode()) { - case SpvOpName: { + case spv::Op::OpName: { const auto target = inst->GetOperandAs(0); const std::string str = inst->GetOperandAs(1); AssignNameToId(target, str); break; } - case SpvOpMemberName: { + case spv::Op::OpMemberName: { const auto target = inst->GetOperandAs(0); const std::string str = inst->GetOperandAs(2); AssignNameToId(target, str); break; } - case SpvOpSourceContinued: - case SpvOpSource: - case SpvOpSourceExtension: - case SpvOpString: - case SpvOpLine: - case SpvOpNoLine: + case spv::Op::OpSourceContinued: + case spv::Op::OpSource: + case spv::Op::OpSourceExtension: + case spv::Op::OpString: + case spv::Op::OpLine: + case spv::Op::OpNoLine: default: break; } @@ -567,7 +574,7 @@ void ValidationState_t::RegisterInstruction(Instruction* inst) { // should be recorded. The validator will ensure that all usages of an // OpTypeSampledImage and its definition are in the same basic block. if ((SPV_OPERAND_TYPE_ID == operand.type) && - (SpvOpSampledImage == operand_inst->opcode())) { + (spv::Op::OpSampledImage == operand_inst->opcode())) { RegisterSampledImageConsumer(operand_word, inst); } @@ -577,12 +584,12 @@ void ValidationState_t::RegisterInstruction(Instruction* inst) { // Instead just need to register storage class usage for consumers in a // function block. if (inst->function()) { - if (operand_inst->opcode() == SpvOpTypePointer) { + if (operand_inst->opcode() == spv::Op::OpTypePointer) { RegisterStorageClassConsumer( - operand_inst->GetOperandAs(1), inst); - } else if (operand_inst->opcode() == SpvOpVariable) { + operand_inst->GetOperandAs(1), inst); + } else if (operand_inst->opcode() == spv::Op::OpVariable) { RegisterStorageClassConsumer( - operand_inst->GetOperandAs(2), inst); + operand_inst->GetOperandAs(2), inst); } } } @@ -604,22 +611,34 @@ void ValidationState_t::RegisterSampledImageConsumer(uint32_t sampled_image_id, sampled_image_consumers_[sampled_image_id].push_back(consumer); } +void ValidationState_t::RegisterQCOMImageProcessingTextureConsumer( + uint32_t texture_id, const Instruction* consumer0, + const Instruction* consumer1) { + if (HasDecoration(texture_id, spv::Decoration::WeightTextureQCOM) || + HasDecoration(texture_id, spv::Decoration::BlockMatchTextureQCOM)) { + qcom_image_processing_consumers_.insert(consumer0->id()); + if (consumer1) { + qcom_image_processing_consumers_.insert(consumer1->id()); + } + } +} + void ValidationState_t::RegisterStorageClassConsumer( - SpvStorageClass storage_class, Instruction* consumer) { + spv::StorageClass storage_class, Instruction* consumer) { if (spvIsVulkanEnv(context()->target_env)) { - if (storage_class == SpvStorageClassOutput) { + if (storage_class == spv::StorageClass::Output) { std::string errorVUID = VkErrorID(4644); function(consumer->function()->id()) ->RegisterExecutionModelLimitation([errorVUID]( - SpvExecutionModel model, + spv::ExecutionModel model, std::string* message) { - if (model == SpvExecutionModelGLCompute || - model == SpvExecutionModelRayGenerationKHR || - model == SpvExecutionModelIntersectionKHR || - model == SpvExecutionModelAnyHitKHR || - model == SpvExecutionModelClosestHitKHR || - model == SpvExecutionModelMissKHR || - model == SpvExecutionModelCallableKHR) { + if (model == spv::ExecutionModel::GLCompute || + model == spv::ExecutionModel::RayGenerationKHR || + model == spv::ExecutionModel::IntersectionKHR || + model == spv::ExecutionModel::AnyHitKHR || + model == spv::ExecutionModel::ClosestHitKHR || + model == spv::ExecutionModel::MissKHR || + model == spv::ExecutionModel::CallableKHR) { if (message) { *message = errorVUID + @@ -634,17 +653,17 @@ void ValidationState_t::RegisterStorageClassConsumer( }); } - if (storage_class == SpvStorageClassWorkgroup) { + if (storage_class == spv::StorageClass::Workgroup) { std::string errorVUID = VkErrorID(4645); function(consumer->function()->id()) ->RegisterExecutionModelLimitation([errorVUID]( - SpvExecutionModel model, + spv::ExecutionModel model, std::string* message) { - if (model != SpvExecutionModelGLCompute && - model != SpvExecutionModelTaskNV && - model != SpvExecutionModelMeshNV && - model != SpvExecutionModelTaskEXT && - model != SpvExecutionModelMeshEXT) { + if (model != spv::ExecutionModel::GLCompute && + model != spv::ExecutionModel::TaskNV && + model != spv::ExecutionModel::MeshNV && + model != spv::ExecutionModel::TaskEXT && + model != spv::ExecutionModel::MeshEXT) { if (message) { *message = errorVUID + @@ -658,48 +677,51 @@ void ValidationState_t::RegisterStorageClassConsumer( } } - if (storage_class == SpvStorageClassCallableDataKHR) { + if (storage_class == spv::StorageClass::CallableDataKHR) { std::string errorVUID = VkErrorID(4704); function(consumer->function()->id()) - ->RegisterExecutionModelLimitation([errorVUID](SpvExecutionModel model, - std::string* message) { - if (model != SpvExecutionModelRayGenerationKHR && - model != SpvExecutionModelClosestHitKHR && - model != SpvExecutionModelCallableKHR && - model != SpvExecutionModelMissKHR) { - if (message) { - *message = errorVUID + - "CallableDataKHR Storage Class is limited to " - "RayGenerationKHR, ClosestHitKHR, CallableKHR, and " - "MissKHR execution model"; - } - return false; - } - return true; - }); - } else if (storage_class == SpvStorageClassIncomingCallableDataKHR) { + ->RegisterExecutionModelLimitation( + [errorVUID](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::CallableKHR && + model != spv::ExecutionModel::MissKHR) { + if (message) { + *message = + errorVUID + + "CallableDataKHR Storage Class is limited to " + "RayGenerationKHR, ClosestHitKHR, CallableKHR, and " + "MissKHR execution model"; + } + return false; + } + return true; + }); + } else if (storage_class == spv::StorageClass::IncomingCallableDataKHR) { std::string errorVUID = VkErrorID(4705); function(consumer->function()->id()) - ->RegisterExecutionModelLimitation([errorVUID](SpvExecutionModel model, - std::string* message) { - if (model != SpvExecutionModelCallableKHR) { - if (message) { - *message = errorVUID + - "IncomingCallableDataKHR Storage Class is limited to " - "CallableKHR execution model"; - } - return false; - } - return true; - }); - } else if (storage_class == SpvStorageClassRayPayloadKHR) { + ->RegisterExecutionModelLimitation( + [errorVUID](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::CallableKHR) { + if (message) { + *message = + errorVUID + + "IncomingCallableDataKHR Storage Class is limited to " + "CallableKHR execution model"; + } + return false; + } + return true; + }); + } else if (storage_class == spv::StorageClass::RayPayloadKHR) { std::string errorVUID = VkErrorID(4698); function(consumer->function()->id()) - ->RegisterExecutionModelLimitation([errorVUID](SpvExecutionModel model, - std::string* message) { - if (model != SpvExecutionModelRayGenerationKHR && - model != SpvExecutionModelClosestHitKHR && - model != SpvExecutionModelMissKHR) { + ->RegisterExecutionModelLimitation([errorVUID]( + spv::ExecutionModel model, + std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::MissKHR) { if (message) { *message = errorVUID + @@ -710,14 +732,14 @@ void ValidationState_t::RegisterStorageClassConsumer( } return true; }); - } else if (storage_class == SpvStorageClassHitAttributeKHR) { + } else if (storage_class == spv::StorageClass::HitAttributeKHR) { std::string errorVUID = VkErrorID(4701); function(consumer->function()->id()) ->RegisterExecutionModelLimitation( - [errorVUID](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelIntersectionKHR && - model != SpvExecutionModelAnyHitKHR && - model != SpvExecutionModelClosestHitKHR) { + [errorVUID](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::IntersectionKHR && + model != spv::ExecutionModel::AnyHitKHR && + model != spv::ExecutionModel::ClosestHitKHR) { if (message) { *message = errorVUID + "HitAttributeKHR Storage Class is limited to " @@ -728,14 +750,14 @@ void ValidationState_t::RegisterStorageClassConsumer( } return true; }); - } else if (storage_class == SpvStorageClassIncomingRayPayloadKHR) { + } else if (storage_class == spv::StorageClass::IncomingRayPayloadKHR) { std::string errorVUID = VkErrorID(4699); function(consumer->function()->id()) ->RegisterExecutionModelLimitation( - [errorVUID](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelAnyHitKHR && - model != SpvExecutionModelClosestHitKHR && - model != SpvExecutionModelMissKHR) { + [errorVUID](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::AnyHitKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::MissKHR) { if (message) { *message = errorVUID + @@ -746,17 +768,17 @@ void ValidationState_t::RegisterStorageClassConsumer( } return true; }); - } else if (storage_class == SpvStorageClassShaderRecordBufferKHR) { + } else if (storage_class == spv::StorageClass::ShaderRecordBufferKHR) { std::string errorVUID = VkErrorID(7119); function(consumer->function()->id()) ->RegisterExecutionModelLimitation( - [errorVUID](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelRayGenerationKHR && - model != SpvExecutionModelIntersectionKHR && - model != SpvExecutionModelAnyHitKHR && - model != SpvExecutionModelClosestHitKHR && - model != SpvExecutionModelCallableKHR && - model != SpvExecutionModelMissKHR) { + [errorVUID](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR && + model != spv::ExecutionModel::IntersectionKHR && + model != spv::ExecutionModel::AnyHitKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::CallableKHR && + model != spv::ExecutionModel::MissKHR) { if (message) { *message = errorVUID + @@ -768,12 +790,12 @@ void ValidationState_t::RegisterStorageClassConsumer( } return true; }); - } else if (storage_class == SpvStorageClassTaskPayloadWorkgroupEXT) { + } else if (storage_class == spv::StorageClass::TaskPayloadWorkgroupEXT) { function(consumer->function()->id()) ->RegisterExecutionModelLimitation( - [](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelTaskEXT && - model != SpvExecutionModelMeshEXT) { + [](spv::ExecutionModel model, std::string* message) { + if (model != spv::ExecutionModel::TaskEXT && + model != spv::ExecutionModel::MeshEXT) { if (message) { *message = "TaskPayloadWorkgroupEXT Storage Class is limited to " @@ -783,6 +805,22 @@ void ValidationState_t::RegisterStorageClassConsumer( } return true; }); + } else if (storage_class == spv::StorageClass::HitObjectAttributeNV) { + function(consumer->function()->id()) + ->RegisterExecutionModelLimitation([](spv::ExecutionModel model, + std::string* message) { + if (model != spv::ExecutionModel::RayGenerationKHR && + model != spv::ExecutionModel::ClosestHitKHR && + model != spv::ExecutionModel::MissKHR) { + if (message) { + *message = + "HitObjectAttributeNV Storage Class is limited to " + "RayGenerationKHR, ClosestHitKHR or MissKHR execution model"; + } + return false; + } + return true; + }); } } @@ -814,9 +852,9 @@ uint32_t ValidationState_t::GetTypeId(uint32_t id) const { return inst ? inst->type_id() : 0; } -SpvOp ValidationState_t::GetIdOpcode(uint32_t id) const { +spv::Op ValidationState_t::GetIdOpcode(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst ? inst->opcode() : SpvOpNop; + return inst ? inst->opcode() : spv::Op::OpNop; } uint32_t ValidationState_t::GetComponentType(uint32_t id) const { @@ -824,18 +862,19 @@ uint32_t ValidationState_t::GetComponentType(uint32_t id) const { assert(inst); switch (inst->opcode()) { - case SpvOpTypeFloat: - case SpvOpTypeInt: - case SpvOpTypeBool: + case spv::Op::OpTypeFloat: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeBool: return id; - case SpvOpTypeVector: + case spv::Op::OpTypeVector: return inst->word(2); - case SpvOpTypeMatrix: + case spv::Op::OpTypeMatrix: return GetComponentType(inst->word(2)); - case SpvOpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixKHR: return inst->word(2); default: @@ -853,16 +892,17 @@ uint32_t ValidationState_t::GetDimension(uint32_t id) const { assert(inst); switch (inst->opcode()) { - case SpvOpTypeFloat: - case SpvOpTypeInt: - case SpvOpTypeBool: + case spv::Op::OpTypeFloat: + case spv::Op::OpTypeInt: + case spv::Op::OpTypeBool: return 1; - case SpvOpTypeVector: - case SpvOpTypeMatrix: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: return inst->word(3); - case SpvOpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixKHR: // Actual dimension isn't known, return 0 return 0; @@ -881,10 +921,11 @@ uint32_t ValidationState_t::GetBitWidth(uint32_t id) const { const Instruction* inst = FindDef(component_type_id); assert(inst); - if (inst->opcode() == SpvOpTypeFloat || inst->opcode() == SpvOpTypeInt) + if (inst->opcode() == spv::Op::OpTypeFloat || + inst->opcode() == spv::Op::OpTypeInt) return inst->word(2); - if (inst->opcode() == SpvOpTypeBool) return 1; + if (inst->opcode() == spv::Op::OpTypeBool) return 1; assert(0); return 0; @@ -892,12 +933,12 @@ uint32_t ValidationState_t::GetBitWidth(uint32_t id) const { bool ValidationState_t::IsVoidType(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == SpvOpTypeVoid; + return inst && inst->opcode() == spv::Op::OpTypeVoid; } bool ValidationState_t::IsFloatScalarType(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == SpvOpTypeFloat; + return inst && inst->opcode() == spv::Op::OpTypeFloat; } bool ValidationState_t::IsFloatVectorType(uint32_t id) const { @@ -906,7 +947,7 @@ bool ValidationState_t::IsFloatVectorType(uint32_t id) const { return false; } - if (inst->opcode() == SpvOpTypeVector) { + if (inst->opcode() == spv::Op::OpTypeVector) { return IsFloatScalarType(GetComponentType(id)); } @@ -919,11 +960,11 @@ bool ValidationState_t::IsFloatScalarOrVectorType(uint32_t id) const { return false; } - if (inst->opcode() == SpvOpTypeFloat) { + if (inst->opcode() == spv::Op::OpTypeFloat) { return true; } - if (inst->opcode() == SpvOpTypeVector) { + if (inst->opcode() == spv::Op::OpTypeVector) { return IsFloatScalarType(GetComponentType(id)); } @@ -932,7 +973,7 @@ bool ValidationState_t::IsFloatScalarOrVectorType(uint32_t id) const { bool ValidationState_t::IsIntScalarType(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == SpvOpTypeInt; + return inst && inst->opcode() == spv::Op::OpTypeInt; } bool ValidationState_t::IsIntVectorType(uint32_t id) const { @@ -941,7 +982,7 @@ bool ValidationState_t::IsIntVectorType(uint32_t id) const { return false; } - if (inst->opcode() == SpvOpTypeVector) { + if (inst->opcode() == spv::Op::OpTypeVector) { return IsIntScalarType(GetComponentType(id)); } @@ -954,11 +995,11 @@ bool ValidationState_t::IsIntScalarOrVectorType(uint32_t id) const { return false; } - if (inst->opcode() == SpvOpTypeInt) { + if (inst->opcode() == spv::Op::OpTypeInt) { return true; } - if (inst->opcode() == SpvOpTypeVector) { + if (inst->opcode() == spv::Op::OpTypeVector) { return IsIntScalarType(GetComponentType(id)); } @@ -967,7 +1008,7 @@ bool ValidationState_t::IsIntScalarOrVectorType(uint32_t id) const { bool ValidationState_t::IsUnsignedIntScalarType(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == SpvOpTypeInt && inst->word(3) == 0; + return inst && inst->opcode() == spv::Op::OpTypeInt && inst->word(3) == 0; } bool ValidationState_t::IsUnsignedIntVectorType(uint32_t id) const { @@ -976,7 +1017,24 @@ bool ValidationState_t::IsUnsignedIntVectorType(uint32_t id) const { return false; } - if (inst->opcode() == SpvOpTypeVector) { + if (inst->opcode() == spv::Op::OpTypeVector) { + return IsUnsignedIntScalarType(GetComponentType(id)); + } + + return false; +} + +bool ValidationState_t::IsUnsignedIntScalarOrVectorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + if (!inst) { + return false; + } + + if (inst->opcode() == spv::Op::OpTypeInt) { + return inst->GetOperandAs(2) == 0; + } + + if (inst->opcode() == spv::Op::OpTypeVector) { return IsUnsignedIntScalarType(GetComponentType(id)); } @@ -985,7 +1043,7 @@ bool ValidationState_t::IsUnsignedIntVectorType(uint32_t id) const { bool ValidationState_t::IsSignedIntScalarType(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == SpvOpTypeInt && inst->word(3) == 1; + return inst && inst->opcode() == spv::Op::OpTypeInt && inst->word(3) == 1; } bool ValidationState_t::IsSignedIntVectorType(uint32_t id) const { @@ -994,7 +1052,7 @@ bool ValidationState_t::IsSignedIntVectorType(uint32_t id) const { return false; } - if (inst->opcode() == SpvOpTypeVector) { + if (inst->opcode() == spv::Op::OpTypeVector) { return IsSignedIntScalarType(GetComponentType(id)); } @@ -1003,7 +1061,7 @@ bool ValidationState_t::IsSignedIntVectorType(uint32_t id) const { bool ValidationState_t::IsBoolScalarType(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == SpvOpTypeBool; + return inst && inst->opcode() == spv::Op::OpTypeBool; } bool ValidationState_t::IsBoolVectorType(uint32_t id) const { @@ -1012,7 +1070,7 @@ bool ValidationState_t::IsBoolVectorType(uint32_t id) const { return false; } - if (inst->opcode() == SpvOpTypeVector) { + if (inst->opcode() == spv::Op::OpTypeVector) { return IsBoolScalarType(GetComponentType(id)); } @@ -1025,11 +1083,11 @@ bool ValidationState_t::IsBoolScalarOrVectorType(uint32_t id) const { return false; } - if (inst->opcode() == SpvOpTypeBool) { + if (inst->opcode() == spv::Op::OpTypeBool) { return true; } - if (inst->opcode() == SpvOpTypeVector) { + if (inst->opcode() == spv::Op::OpTypeVector) { return IsBoolScalarType(GetComponentType(id)); } @@ -1042,7 +1100,7 @@ bool ValidationState_t::IsFloatMatrixType(uint32_t id) const { return false; } - if (inst->opcode() == SpvOpTypeMatrix) { + if (inst->opcode() == spv::Op::OpTypeMatrix) { return IsFloatScalarType(GetComponentType(id)); } @@ -1057,13 +1115,13 @@ bool ValidationState_t::GetMatrixTypeInfo(uint32_t id, uint32_t* num_rows, const Instruction* mat_inst = FindDef(id); assert(mat_inst); - if (mat_inst->opcode() != SpvOpTypeMatrix) return false; + if (mat_inst->opcode() != spv::Op::OpTypeMatrix) return false; const uint32_t vec_type = mat_inst->word(2); const Instruction* vec_inst = FindDef(vec_type); assert(vec_inst); - if (vec_inst->opcode() != SpvOpTypeVector) { + if (vec_inst->opcode() != spv::Op::OpTypeVector) { assert(0); return false; } @@ -1083,7 +1141,7 @@ bool ValidationState_t::GetStructMemberTypes( const Instruction* inst = FindDef(struct_type_id); assert(inst); - if (inst->opcode() != SpvOpTypeStruct) return false; + if (inst->opcode() != spv::Op::OpTypeStruct) return false; *member_types = std::vector(inst->words().cbegin() + 2, inst->words().cend()); @@ -1095,44 +1153,91 @@ bool ValidationState_t::GetStructMemberTypes( bool ValidationState_t::IsPointerType(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == SpvOpTypePointer; + return inst && inst->opcode() == spv::Op::OpTypePointer; } -bool ValidationState_t::GetPointerTypeInfo(uint32_t id, uint32_t* data_type, - uint32_t* storage_class) const { +bool ValidationState_t::GetPointerTypeInfo( + uint32_t id, uint32_t* data_type, spv::StorageClass* storage_class) const { + *storage_class = spv::StorageClass::Max; if (!id) return false; const Instruction* inst = FindDef(id); assert(inst); - if (inst->opcode() != SpvOpTypePointer) return false; + if (inst->opcode() != spv::Op::OpTypePointer) return false; - *storage_class = inst->word(2); + *storage_class = spv::StorageClass(inst->word(2)); *data_type = inst->word(3); return true; } bool ValidationState_t::IsAccelerationStructureType(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == SpvOpTypeAccelerationStructureKHR; + return inst && inst->opcode() == spv::Op::OpTypeAccelerationStructureKHR; } bool ValidationState_t::IsCooperativeMatrixType(uint32_t id) const { const Instruction* inst = FindDef(id); - return inst && inst->opcode() == SpvOpTypeCooperativeMatrixNV; + return inst && (inst->opcode() == spv::Op::OpTypeCooperativeMatrixNV || + inst->opcode() == spv::Op::OpTypeCooperativeMatrixKHR); +} + +bool ValidationState_t::IsCooperativeMatrixNVType(uint32_t id) const { + const Instruction* inst = FindDef(id); + return inst && inst->opcode() == spv::Op::OpTypeCooperativeMatrixNV; +} + +bool ValidationState_t::IsCooperativeMatrixKHRType(uint32_t id) const { + const Instruction* inst = FindDef(id); + return inst && inst->opcode() == spv::Op::OpTypeCooperativeMatrixKHR; +} + +bool ValidationState_t::IsCooperativeMatrixAType(uint32_t id) const { + if (!IsCooperativeMatrixKHRType(id)) return false; + const Instruction* inst = FindDef(id); + uint64_t matrixUse = 0; + if (GetConstantValUint64(inst->word(6), &matrixUse)) { + return matrixUse == + static_cast(spv::CooperativeMatrixUse::MatrixAKHR); + } + return false; +} + +bool ValidationState_t::IsCooperativeMatrixBType(uint32_t id) const { + if (!IsCooperativeMatrixKHRType(id)) return false; + const Instruction* inst = FindDef(id); + uint64_t matrixUse = 0; + if (GetConstantValUint64(inst->word(6), &matrixUse)) { + return matrixUse == + static_cast(spv::CooperativeMatrixUse::MatrixBKHR); + } + return false; +} +bool ValidationState_t::IsCooperativeMatrixAccType(uint32_t id) const { + if (!IsCooperativeMatrixKHRType(id)) return false; + const Instruction* inst = FindDef(id); + uint64_t matrixUse = 0; + if (GetConstantValUint64(inst->word(6), &matrixUse)) { + return matrixUse == static_cast( + spv::CooperativeMatrixUse::MatrixAccumulatorKHR); + } + return false; } bool ValidationState_t::IsFloatCooperativeMatrixType(uint32_t id) const { - if (!IsCooperativeMatrixType(id)) return false; + if (!IsCooperativeMatrixNVType(id) && !IsCooperativeMatrixKHRType(id)) + return false; return IsFloatScalarType(FindDef(id)->word(2)); } bool ValidationState_t::IsIntCooperativeMatrixType(uint32_t id) const { - if (!IsCooperativeMatrixType(id)) return false; + if (!IsCooperativeMatrixNVType(id) && !IsCooperativeMatrixKHRType(id)) + return false; return IsIntScalarType(FindDef(id)->word(2)); } bool ValidationState_t::IsUnsignedIntCooperativeMatrixType(uint32_t id) const { - if (!IsCooperativeMatrixType(id)) return false; + if (!IsCooperativeMatrixNVType(id) && !IsCooperativeMatrixKHRType(id)) + return false; return IsUnsignedIntScalarType(FindDef(id)->word(2)); } @@ -1148,8 +1253,7 @@ spv_result_t ValidationState_t::CooperativeMatrixShapesMatch( const auto m1_type = FindDef(m1); const auto m2_type = FindDef(m2); - if (m1_type->opcode() != SpvOpTypeCooperativeMatrixNV || - m2_type->opcode() != SpvOpTypeCooperativeMatrixNV) { + if (m1_type->opcode() != m2_type->opcode()) { return diag(SPV_ERROR_INVALID_DATA, inst) << "Expected cooperative matrix types"; } @@ -1199,6 +1303,21 @@ spv_result_t ValidationState_t::CooperativeMatrixShapesMatch( << "identical"; } + if (m1_type->opcode() == spv::Op::OpTypeCooperativeMatrixKHR) { + uint32_t m1_use_id = m1_type->GetOperandAs(5); + uint32_t m2_use_id = m2_type->GetOperandAs(5); + std::tie(m1_is_int32, m1_is_const_int32, m1_value) = + EvalInt32IfConst(m1_use_id); + std::tie(m2_is_int32, m2_is_const_int32, m2_value) = + EvalInt32IfConst(m2_use_id); + + if (m1_is_const_int32 && m2_is_const_int32 && m1_value != m2_value) { + return diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Use of Matrix type and Result Type to be " + << "identical"; + } + } + return SPV_SUCCESS; } @@ -1214,7 +1333,8 @@ bool ValidationState_t::GetConstantValUint64(uint32_t id, uint64_t* val) const { return false; } - if (inst->opcode() != SpvOpConstant && inst->opcode() != SpvOpSpecConstant) + if (inst->opcode() != spv::Op::OpConstant && + inst->opcode() != spv::Op::OpSpecConstant) return false; if (!IsIntScalarType(inst->type_id())) return false; @@ -1246,7 +1366,7 @@ std::tuple ValidationState_t::EvalInt32IfConst( return std::make_tuple(true, false, 0); } - if (inst->opcode() == SpvOpConstantNull) { + if (inst->opcode() == spv::Op::OpConstantNull) { return std::make_tuple(true, true, 0); } @@ -1380,7 +1500,7 @@ bool ValidationState_t::LogicallyMatch(const Instruction* lhs, } } - if (lhs->opcode() == SpvOpTypeArray) { + if (lhs->opcode() == spv::Op::OpTypeArray) { // Size operands must match. if (lhs->GetOperandAs(2u) != rhs->GetOperandAs(2u)) { return false; @@ -1399,7 +1519,7 @@ bool ValidationState_t::LogicallyMatch(const Instruction* lhs, return false; } return LogicallyMatch(lhs_ele, rhs_ele, check_decorations); - } else if (lhs->opcode() == SpvOpTypeStruct) { + } else if (lhs->opcode() == spv::Op::OpTypeStruct) { // Number of elements must match. if (lhs->operands().size() != rhs->operands().size()) { return false; @@ -1437,11 +1557,11 @@ bool ValidationState_t::LogicallyMatch(const Instruction* lhs, const Instruction* ValidationState_t::TracePointer( const Instruction* inst) const { auto base_ptr = inst; - while (base_ptr->opcode() == SpvOpAccessChain || - base_ptr->opcode() == SpvOpInBoundsAccessChain || - base_ptr->opcode() == SpvOpPtrAccessChain || - base_ptr->opcode() == SpvOpInBoundsPtrAccessChain || - base_ptr->opcode() == SpvOpCopyObject) { + while (base_ptr->opcode() == spv::Op::OpAccessChain || + base_ptr->opcode() == spv::Op::OpInBoundsAccessChain || + base_ptr->opcode() == spv::Op::OpPtrAccessChain || + base_ptr->opcode() == spv::Op::OpInBoundsPtrAccessChain || + base_ptr->opcode() == spv::Op::OpCopyObject) { base_ptr = FindDef(base_ptr->GetOperandAs(2u)); } return base_ptr; @@ -1456,25 +1576,26 @@ bool ValidationState_t::ContainsType( if (f(inst)) return true; switch (inst->opcode()) { - case SpvOpTypeArray: - case SpvOpTypeRuntimeArray: - case SpvOpTypeVector: - case SpvOpTypeMatrix: - case SpvOpTypeImage: - case SpvOpTypeSampledImage: - case SpvOpTypeCooperativeMatrixNV: + case spv::Op::OpTypeArray: + case spv::Op::OpTypeRuntimeArray: + case spv::Op::OpTypeVector: + case spv::Op::OpTypeMatrix: + case spv::Op::OpTypeImage: + case spv::Op::OpTypeSampledImage: + case spv::Op::OpTypeCooperativeMatrixNV: + case spv::Op::OpTypeCooperativeMatrixKHR: return ContainsType(inst->GetOperandAs(1u), f, traverse_all_types); - case SpvOpTypePointer: + case spv::Op::OpTypePointer: if (IsForwardPointer(id)) return false; if (traverse_all_types) { return ContainsType(inst->GetOperandAs(2u), f, traverse_all_types); } break; - case SpvOpTypeFunction: - case SpvOpTypeStruct: - if (inst->opcode() == SpvOpTypeFunction && !traverse_all_types) { + case spv::Op::OpTypeFunction: + case spv::Op::OpTypeStruct: + if (inst->opcode() == spv::Op::OpTypeFunction && !traverse_all_types) { return false; } for (uint32_t i = 1; i < inst->operands().size(); ++i) { @@ -1491,9 +1612,9 @@ bool ValidationState_t::ContainsType( return false; } -bool ValidationState_t::ContainsSizedIntOrFloatType(uint32_t id, SpvOp type, +bool ValidationState_t::ContainsSizedIntOrFloatType(uint32_t id, spv::Op type, uint32_t width) const { - if (type != SpvOpTypeInt && type != SpvOpTypeFloat) return false; + if (type != spv::Op::OpTypeInt && type != spv::Op::OpTypeFloat) return false; const auto f = [type, width](const Instruction* inst) { if (inst->opcode() == type) { @@ -1505,12 +1626,12 @@ bool ValidationState_t::ContainsSizedIntOrFloatType(uint32_t id, SpvOp type, } bool ValidationState_t::ContainsLimitedUseIntOrFloatType(uint32_t id) const { - if ((!HasCapability(SpvCapabilityInt16) && - ContainsSizedIntOrFloatType(id, SpvOpTypeInt, 16)) || - (!HasCapability(SpvCapabilityInt8) && - ContainsSizedIntOrFloatType(id, SpvOpTypeInt, 8)) || - (!HasCapability(SpvCapabilityFloat16) && - ContainsSizedIntOrFloatType(id, SpvOpTypeFloat, 16))) { + if ((!HasCapability(spv::Capability::Int16) && + ContainsSizedIntOrFloatType(id, spv::Op::OpTypeInt, 16)) || + (!HasCapability(spv::Capability::Int8) && + ContainsSizedIntOrFloatType(id, spv::Op::OpTypeInt, 8)) || + (!HasCapability(spv::Capability::Float16) && + ContainsSizedIntOrFloatType(id, spv::Op::OpTypeFloat, 16))) { return true; } return false; @@ -1518,33 +1639,35 @@ bool ValidationState_t::ContainsLimitedUseIntOrFloatType(uint32_t id) const { bool ValidationState_t::ContainsRuntimeArray(uint32_t id) const { const auto f = [](const Instruction* inst) { - return inst->opcode() == SpvOpTypeRuntimeArray; + return inst->opcode() == spv::Op::OpTypeRuntimeArray; }; return ContainsType(id, f, /* traverse_all_types = */ false); } bool ValidationState_t::IsValidStorageClass( - SpvStorageClass storage_class) const { + spv::StorageClass storage_class) const { if (spvIsVulkanEnv(context()->target_env)) { switch (storage_class) { - case SpvStorageClassUniformConstant: - case SpvStorageClassUniform: - case SpvStorageClassStorageBuffer: - case SpvStorageClassInput: - case SpvStorageClassOutput: - case SpvStorageClassImage: - case SpvStorageClassWorkgroup: - case SpvStorageClassPrivate: - case SpvStorageClassFunction: - case SpvStorageClassPushConstant: - case SpvStorageClassPhysicalStorageBuffer: - case SpvStorageClassRayPayloadKHR: - case SpvStorageClassIncomingRayPayloadKHR: - case SpvStorageClassHitAttributeKHR: - case SpvStorageClassCallableDataKHR: - case SpvStorageClassIncomingCallableDataKHR: - case SpvStorageClassShaderRecordBufferKHR: - case SpvStorageClassTaskPayloadWorkgroupEXT: + case spv::StorageClass::UniformConstant: + case spv::StorageClass::Uniform: + case spv::StorageClass::StorageBuffer: + case spv::StorageClass::Input: + case spv::StorageClass::Output: + case spv::StorageClass::Image: + case spv::StorageClass::Workgroup: + case spv::StorageClass::Private: + case spv::StorageClass::Function: + case spv::StorageClass::PushConstant: + case spv::StorageClass::PhysicalStorageBuffer: + case spv::StorageClass::RayPayloadKHR: + case spv::StorageClass::IncomingRayPayloadKHR: + case spv::StorageClass::HitAttributeKHR: + case spv::StorageClass::CallableDataKHR: + case spv::StorageClass::IncomingCallableDataKHR: + case spv::StorageClass::ShaderRecordBufferKHR: + case spv::StorageClass::TaskPayloadWorkgroupEXT: + case spv::StorageClass::HitObjectAttributeNV: + case spv::StorageClass::TileImageEXT: return true; default: return false; @@ -2020,8 +2143,6 @@ std::string ValidationState_t::VkErrorID(uint32_t id, return VUID_WRAP(VUID-StandaloneSpirv-OpImageTexelPointer-04658); case 4659: return VUID_WRAP(VUID-StandaloneSpirv-OpImageQuerySizeLod-04659); - case 4662: - return VUID_WRAP(VUID-StandaloneSpirv-Offset-04662); case 4663: return VUID_WRAP(VUID-StandaloneSpirv-Offset-04663); case 4664: @@ -2094,6 +2215,16 @@ std::string ValidationState_t::VkErrorID(uint32_t id, return VUID_WRAP(VUID-StandaloneSpirv-Location-04918); case 4919: return VUID_WRAP(VUID-StandaloneSpirv-Location-04919); + case 4920: + return VUID_WRAP(VUID-StandaloneSpirv-Component-04920); + case 4921: + return VUID_WRAP(VUID-StandaloneSpirv-Component-04921); + case 4922: + return VUID_WRAP(VUID-StandaloneSpirv-Component-04922); + case 4923: + return VUID_WRAP(VUID-StandaloneSpirv-Component-04923); + case 4924: + return VUID_WRAP(VUID-StandaloneSpirv-Component-04924); case 6201: return VUID_WRAP(VUID-StandaloneSpirv-Flat-06201); case 6202: @@ -2126,14 +2257,28 @@ std::string ValidationState_t::VkErrorID(uint32_t id, return VUID_WRAP(VUID-StandaloneSpirv-PushConstant-06808); case 6925: return VUID_WRAP(VUID-StandaloneSpirv-Uniform-06925); - case 6997: - return VUID_WRAP(VUID-StandaloneSpirv-SubgroupVoteKHR-06997); case 7102: return VUID_WRAP(VUID-StandaloneSpirv-MeshEXT-07102); case 7320: return VUID_WRAP(VUID-StandaloneSpirv-ExecutionModel-07320); case 7290: return VUID_WRAP(VUID-StandaloneSpirv-Input-07290); + case 7650: + return VUID_WRAP(VUID-StandaloneSpirv-Base-07650); + case 7651: + return VUID_WRAP(VUID-StandaloneSpirv-Base-07651); + case 7652: + return VUID_WRAP(VUID-StandaloneSpirv-Base-07652); + case 7703: + return VUID_WRAP(VUID-StandaloneSpirv-Component-07703); + case 7951: + return VUID_WRAP(VUID-StandaloneSpirv-SubgroupVoteKHR-07951); + case 8721: + return VUID_WRAP(VUID-StandaloneSpirv-OpEntryPoint-08721); + case 8722: + return VUID_WRAP(VUID-StandaloneSpirv-OpEntryPoint-08722); + case 8973: + return VUID_WRAP(VUID-StandaloneSpirv-Pointer-08973); default: return ""; // unknown id } diff --git a/bgfx/3rdparty/spirv-tools/source/val/validation_state.h b/bgfx/3rdparty/spirv-tools/source/val/validation_state.h index 1b599ff3..0cd6c789 100644 --- a/bgfx/3rdparty/spirv-tools/source/val/validation_state.h +++ b/bgfx/3rdparty/spirv-tools/source/val/validation_state.h @@ -185,10 +185,10 @@ class ValidationState_t { void ProgressToNextLayoutSectionOrder(); /// Determines if the op instruction is in a previous layout section - bool IsOpcodeInPreviousLayoutSection(SpvOp op); + bool IsOpcodeInPreviousLayoutSection(spv::Op op); /// Determines if the op instruction is part of the current section - bool IsOpcodeInCurrentLayoutSection(SpvOp op); + bool IsOpcodeInCurrentLayoutSection(spv::Op op); DiagnosticStream diag(spv_result_t error_code, const Instruction* inst); @@ -217,7 +217,8 @@ class ValidationState_t { }; /// Registers |id| as an entry point with |execution_model| and |interfaces|. - void RegisterEntryPoint(const uint32_t id, SpvExecutionModel execution_model, + void RegisterEntryPoint(const uint32_t id, + spv::ExecutionModel execution_model, EntryPointDescription&& desc) { entry_points_.push_back(id); entry_point_to_execution_models_[id].insert(execution_model); @@ -235,7 +236,7 @@ class ValidationState_t { /// Registers execution mode for the given entry point. void RegisterExecutionModeForEntryPoint(uint32_t entry_point, - SpvExecutionMode execution_mode) { + spv::ExecutionMode execution_mode) { entry_point_to_execution_modes_[entry_point].insert(execution_mode); } @@ -247,7 +248,7 @@ class ValidationState_t { /// Returns Execution Models for the given Entry Point. /// Returns nullptr if none found (would trigger assertion). - const std::set* GetExecutionModels( + const std::set* GetExecutionModels( uint32_t entry_point) const { const auto it = entry_point_to_execution_models_.find(entry_point); if (it == entry_point_to_execution_models_.end()) { @@ -259,7 +260,7 @@ class ValidationState_t { /// Returns Execution Modes for the given Entry Point. /// Returns nullptr if none found. - const std::set* GetExecutionModes( + const std::set* GetExecutionModes( uint32_t entry_point) const { const auto it = entry_point_to_execution_modes_.find(entry_point); if (it == entry_point_to_execution_modes_.end()) { @@ -300,7 +301,7 @@ class ValidationState_t { return (id_to_function_.find(id) != id_to_function_.end()); } /// Registers the capability and its dependent capabilities - void RegisterCapability(SpvCapability cap); + void RegisterCapability(spv::Capability cap); /// Registers the extension. void RegisterExtension(Extension ext); @@ -308,15 +309,15 @@ class ValidationState_t { /// Registers the function in the module. Subsequent instructions will be /// called against this function spv_result_t RegisterFunction(uint32_t id, uint32_t ret_type_id, - SpvFunctionControlMask function_control, + spv::FunctionControlMask function_control, uint32_t function_type_id); /// Register a function end instruction spv_result_t RegisterFunctionEnd(); /// Returns true if the capability is enabled in the module. - bool HasCapability(SpvCapability cap) const { - return module_capabilities_.Contains(cap); + bool HasCapability(spv::Capability cap) const { + return module_capabilities_.contains(cap); } /// Returns a reference to the set of capabilities in the module. @@ -327,7 +328,7 @@ class ValidationState_t { /// Returns true if the extension is enabled in the module. bool HasExtension(Extension ext) const { - return module_extensions_.Contains(ext); + return module_extensions_.contains(ext); } /// Returns true if any of the capabilities is enabled, or if |capabilities| @@ -339,16 +340,16 @@ class ValidationState_t { bool HasAnyOfExtensions(const ExtensionSet& extensions) const; /// Sets the addressing model of this module (logical/physical). - void set_addressing_model(SpvAddressingModel am); + void set_addressing_model(spv::AddressingModel am); /// Returns true if the OpMemoryModel was found. bool has_memory_model_specified() const { - return addressing_model_ != SpvAddressingModelMax && - memory_model_ != SpvMemoryModelMax; + return addressing_model_ != spv::AddressingModel::Max && + memory_model_ != spv::MemoryModel::Max; } /// Returns the addressing model of this module, or Logical if uninitialized. - SpvAddressingModel addressing_model() const; + spv::AddressingModel addressing_model() const; /// Returns the addressing model of this module, or Logical if uninitialized. uint32_t pointer_size_and_alignment() const { @@ -356,10 +357,10 @@ class ValidationState_t { } /// Sets the memory model of this module. - void set_memory_model(SpvMemoryModel mm); + void set_memory_model(spv::MemoryModel mm); /// Returns the memory model of this module, or Simple if uninitialized. - SpvMemoryModel memory_model() const; + spv::MemoryModel memory_model() const; /// Sets the bit width for sampler/image type variables. If not set, they are /// considered opaque @@ -432,8 +433,8 @@ class ValidationState_t { // The decorations are sorted by member_index, so this look up will give the // exact range of decorations for this member index. - Decoration min_decoration((SpvDecoration)0, {}, member_index); - Decoration max_decoration(SpvDecorationMax, {}, member_index); + Decoration min_decoration((spv::Decoration)0, {}, member_index); + Decoration max_decoration(spv::Decoration::Max, {}, member_index); FieldDecorationsIter result; result.begin = decorations.lower_bound(min_decoration); @@ -449,7 +450,7 @@ class ValidationState_t { /// Returns true if the given id has the given decoration , /// otherwise returns false. - bool HasDecoration(uint32_t id, SpvDecoration dec) { + bool HasDecoration(uint32_t id, spv::Decoration dec) { const auto& decorations = id_decorations_.find(id); if (decorations == id_decorations_.end()) return false; @@ -484,8 +485,15 @@ class ValidationState_t { void RegisterSampledImageConsumer(uint32_t sampled_image_id, Instruction* consumer); + // Record a cons_id as a consumer of texture_id + // if texture 'texture_id' has a QCOM image processing decoration + // and consumer is a load or a sampled image instruction + void RegisterQCOMImageProcessingTextureConsumer(uint32_t texture_id, + const Instruction* consumer0, + const Instruction* consumer1); + // Record a function's storage class consumer instruction - void RegisterStorageClassConsumer(SpvStorageClass storage_class, + void RegisterStorageClassConsumer(spv::StorageClass storage_class, Instruction* consumer); /// Returns the set of Global Variables. @@ -601,6 +609,7 @@ class ValidationState_t { bool IsIntScalarOrVectorType(uint32_t id) const; bool IsUnsignedIntScalarType(uint32_t id) const; bool IsUnsignedIntVectorType(uint32_t id) const; + bool IsUnsignedIntScalarOrVectorType(uint32_t id) const; bool IsSignedIntScalarType(uint32_t id) const; bool IsSignedIntVectorType(uint32_t id) const; bool IsBoolScalarType(uint32_t id) const; @@ -609,6 +618,11 @@ class ValidationState_t { bool IsPointerType(uint32_t id) const; bool IsAccelerationStructureType(uint32_t id) const; bool IsCooperativeMatrixType(uint32_t id) const; + bool IsCooperativeMatrixNVType(uint32_t id) const; + bool IsCooperativeMatrixKHRType(uint32_t id) const; + bool IsCooperativeMatrixAType(uint32_t id) const; + bool IsCooperativeMatrixBType(uint32_t id) const; + bool IsCooperativeMatrixAccType(uint32_t id) const; bool IsFloatCooperativeMatrixType(uint32_t id) const; bool IsIntCooperativeMatrixType(uint32_t id) const; bool IsUnsignedIntCooperativeMatrixType(uint32_t id) const; @@ -616,7 +630,7 @@ class ValidationState_t { // Returns true if |id| is a type id that contains |type| (or integer or // floating point type) of |width| bits. - bool ContainsSizedIntOrFloatType(uint32_t id, SpvOp type, + bool ContainsSizedIntOrFloatType(uint32_t id, spv::Op type, uint32_t width) const; // Returns true if |id| is a type id that contains a 8- or 16-bit int or // 16-bit float that is not generally enabled for use. @@ -642,7 +656,7 @@ class ValidationState_t { // Returns opcode of the instruction which issued the id or OpNop if the // instruction is not registered. - SpvOp GetIdOpcode(uint32_t id) const; + spv::Op GetIdOpcode(uint32_t id) const; // Returns type_id for given id operand if it has a type or zero otherwise. // |operand_index| is expected to be pointing towards an operand which is an @@ -652,7 +666,7 @@ class ValidationState_t { // Provides information on pointer type. Returns false iff not pointer type. bool GetPointerTypeInfo(uint32_t id, uint32_t* data_type, - uint32_t* storage_class) const; + spv::StorageClass* storage_class) const; // Is the ID the type of a pointer to a uniform block: Block-decorated struct // in uniform storage class? The result is only valid after internal method @@ -732,6 +746,9 @@ class ValidationState_t { } return std::string(desc->name); } + std::string SpvDecorationString(spv::Decoration decoration) { + return SpvDecorationString(uint32_t(decoration)); + } // Returns whether type m1 and type m2 are cooperative matrices with // the same "shape" (matching scope, rows, cols). If any are specialization @@ -764,7 +781,7 @@ class ValidationState_t { const Instruction* TracePointer(const Instruction* inst) const; // Validates the storage class for the target environment. - bool IsValidStorageClass(SpvStorageClass storage_class) const; + bool IsValidStorageClass(spv::StorageClass storage_class) const; // Takes a Vulkan Valid Usage ID (VUID) as |id| and optional |reference| and // will return a non-empty string only if ID is known and targeting Vulkan. @@ -782,6 +799,13 @@ class ValidationState_t { current_layout_section_ = section; } + // Check if instruction 'id' is a consumer of a texture decorated + // with a QCOM image processing decoration + bool IsQCOMImageProcessingTextureConsumer(uint32_t id) { + return qcom_image_processing_consumers_.find(id) != + qcom_image_processing_consumers_.end(); + } + private: ValidationState_t(const ValidationState_t&); @@ -816,6 +840,10 @@ class ValidationState_t { std::unordered_map> sampled_image_consumers_; + /// Stores load instructions that load textures used + // in QCOM image processing functions + std::unordered_set qcom_image_processing_consumers_; + /// A map of operand IDs and their names defined by the OpName instruction std::unordered_map operand_names_; @@ -883,8 +911,8 @@ class ValidationState_t { AssemblyGrammar grammar_; - SpvAddressingModel addressing_model_; - SpvMemoryModel memory_model_; + spv::AddressingModel addressing_model_; + spv::MemoryModel memory_model_; // pointer size derived from addressing model. Assumes all storage classes // have the same pointer size (for physical pointer types). uint32_t pointer_size_and_alignment_; @@ -905,11 +933,11 @@ class ValidationState_t { /// Mapping entry point -> execution models. It is presumed that the same /// function could theoretically be used as 'main' by multiple OpEntryPoint /// instructions. - std::unordered_map> + std::unordered_map> entry_point_to_execution_models_; /// Mapping entry point -> execution modes. - std::unordered_map> + std::unordered_map> entry_point_to_execution_modes_; /// Mapping function -> array of entry points inside this diff --git a/bgfx/LICENSE b/bgfx/LICENSE index e21e5d5f..f8393b90 100644 --- a/bgfx/LICENSE +++ b/bgfx/LICENSE @@ -1,4 +1,4 @@ -Copyright 2010-2022 Branimir Karadzic +Copyright 2010-2023 Branimir Karadzic Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/bgfx/README.md b/bgfx/README.md index e11cb4db..6bb68341 100644 --- a/bgfx/README.md +++ b/bgfx/README.md @@ -21,7 +21,7 @@ [![Join the chat at https://discord.gg/9eMbv7J](https://img.shields.io/discord/712512073522872352?color=%237289DA&label=bgfx&logo=discord&logoColor=white)](https://discord.gg/9eMbv7J) * [GitHub Discussions](https://github.com/bkaradzic/bgfx/discussions) - * [Discord Chat](https://discord.gg/9eMbv7J) + * [Discord Chat](https://discord.gg/g99upRc9pf) * [GitHub Actions](https://github.com/bkaradzic/bgfx/actions) [What is it?](https://bkaradzic.github.io/bgfx/overview.html) @@ -49,29 +49,28 @@ Supported rendering backends: Supported platforms: * Android (14+, ARM, x86, MIPS) - * FreeBSD - * iOS (iPhone, iPad, AppleTV) + * iOS/iPadOS/tvOS (iPhone, iPad, AppleTV) * Linux - * MIPS Creator CI20 - * OSX (10.12+) + * macOS (11+) * PlayStation 4 * RaspberryPi * UWP (Universal Windows, Xbox One) * Wasm/Emscripten - * Windows (XP, Vista, 7, 8, 10) + * Windows (7+) Supported compilers: - * Clang 3.3 and above - * GCC 5 and above - * VS2017 and above + * Clang 11 and above + * GCC 8 and above + * VS2019 and above + * Apple clang 12 and above Languages: * [C/C++ API documentation](https://bkaradzic.github.io/bgfx/bgfx.html) * [Beef API bindings](https://github.com/bkaradzic/bgfx/tree/master/bindings/bf) * [C# language API bindings #1](https://github.com/bkaradzic/bgfx/tree/master/bindings/cs) - * [D language API bindings](https://github.com/GoaLitiuM/bindbc-bgfx) + * [D language API bindings](https://github.com/BindBC/bindbc-bgfx) * [Go language API bindings](https://github.com/james4k/go-bgfx) * [Haskell language API bindings](https://github.com/haskell-game/bgfx) * [Lightweight Java Game Library 3 bindings](https://github.com/LWJGL/lwjgl3) @@ -87,77 +86,88 @@ Languages: Who is using it? [#madewithbgfx](https://twitter.com/search?q=%23madewithbgfx&src=typed_query&f=live) ----------------------------------------------------------------------------------------------------- -## Airmech +## AirMech -http://airmech.com/ AirMech is a free-to-play futuristic action real-time -strategy video game developed and published by Carbon Games. -![airmech](https://www.mobygames.com/images/shots/l/830630-airmech-playstation-4-screenshot-blue-bar-on-your-mech-indicates.jpg) +https://www.carbongames.com/airmech-strike - AirMech is a free-to-play +futuristic action real-time strategy video game developed and published by +Carbon Games. + +![AirMech screenshot](https://www.mobygames.com/images/shots/l/830630-airmech-playstation-4-screenshot-blue-bar-on-your-mech-indicates.jpg) ## cmftStudio -https://github.com/dariomanesku/cmftStudio cmftStudio - cubemap filtering tool. -![cmftStudio](https://github.com/dariomanesku/cmftStudio/raw/master/screenshots/cmftStudio_small.jpg) +https://github.com/dariomanesku/cmftStudio - cmftStudio - Cubemap filtering +tool. + +![cmftStudio screenshot](https://github.com/dariomanesku/cmftStudio/raw/master/screenshots/cmftStudio_small.jpg) ## Crown -https://github.com/dbartolini/crown Crown is a general purpose data-driven game -engine, written from scratch with a minimalistic and data-oriented design -philosophy in mind. +https://github.com/dbartolini/crown - Crown is a general purpose data-driven +game engine, written from scratch with a minimalistic and data-oriented design +philosophy in mind. + ![Crown screenshot](https://raw.githubusercontent.com/dbartolini/crown/master/docs/shots/level-editor.png) ## Offroad Legends 2 -http://www.dogbytegames.com/ Dogbyte Games is an indie mobile developer studio -focusing on racing games. -![ios](http://www.dogbytegames.com/bgfx/offroadlegends2_bgfx_ipad2.jpg) +http://www.dogbytegames.com/ - Dogbyte Games is an indie mobile developer studio +focusing on racing games. + +![Offroad Legends 2](http://www.dogbytegames.com/bgfx/offroadlegends2_bgfx_ipad2.jpg) ## Torque6 -https://github.com/andr3wmac/Torque6 Torque 6 is an MIT licensed 3D engine +https://github.com/andr3wmac/Torque6 - Torque 6 is an MIT licensed 3D engine loosely based on Torque2D. Being neither Torque2D or Torque3D it is the 6th derivative of the original Torque Engine. + Torque 6 Material Editor ## Kepler Orbits -https://github.com/podgorskiy/KeplerOrbits KeplerOrbits - Tool that calculates -positions of celestial bodies using their orbital elements. [Web Demo](http://podgorskiy.com/KeplerOrbits/KeplerOrbits.html) +https://github.com/podgorskiy/KeplerOrbits - KeplerOrbits - Tool that calculates +positions of celestial bodies using their orbital elements. ## CETech -https://github.com/cyberegoorg/cetech - CETech is Data-Driven game engine and -toolbox inspired by Bitsquid/Stingray engine. +https://github.com/cyberegoorg/cetech - CETech is a data-driven game engine and +toolbox inspired by Bitsquid/Stingray engine. + ![CETech screenshot](https://github.com/cyberegoorg/cetech/raw/master/docs/img/prototyp.png) ## ioquake3 https://github.com/jpcy/ioq3-renderer-bgfx - A renderer for ioquake3 written in -C++ and using bgfx to support multiple rendering APIs. +C++ and using bgfx to support multiple rendering APIs. + ![ioq3-renderer-bgfx screenshot](https://camo.githubusercontent.com/052aa40c05120e56306294d3a1bb5f99f97de8c8/687474703a2f2f692e696d6775722e636f6d2f64364f6856594b2e6a7067) ## DLS -http://makingartstudios.itch.io/dls - DLS the digital logic simulator game. +http://makingartstudios.itch.io/dls - DLS, the digital logic simulator game. + DLS - Creating a 4-bit Register -http://dls.makingartstudios.com/sandbox/ - DLS: The Sandbox -![dls-sandbox-screenshot](https://pbs.twimg.com/media/DBaFwOKWAAEq0mp.jpg:large) +http://dls.makingartstudios.com/sandbox/ - DLS: The Sandbox. + +![DLS: The Sandbox screenshot](https://pbs.twimg.com/media/DBaFwOKWAAEq0mp.jpg:large) ## MAME -https://github.com/mamedev/mame MAME - Multiple Arcade Machine Emulator -[Try MAME in Browser!](http://fos.textfiles.com/dfjustin/pacman/pacman/) -![mame-screenshot](https://raw.githubusercontent.com/mamedev/www.mamedev.org/d8d716dbb63919a11964b5d47b9b7f6cfa006b56/bgfx/Raiden.png) +https://github.com/mamedev/mame - MAME - Multiple Arcade Machine Emulator. + +![MAME screenshot](https://raw.githubusercontent.com/mamedev/www.mamedev.org/d8d716dbb63919a11964b5d47b9b7f6cfa006b56/bgfx/Raiden.png) ## Blackshift https://blackshift.itch.io/blackshift - Blackshift is a grid-based, space-themed -action puzzle game which isn't afraid of complexity — think Chip's Challenge on +action puzzle game which isn't afraid of complexity - think Chip's Challenge on crack. https://eheitzresearch.wordpress.com/415-2/ - Real-Time Polygonal-Light Shading with Linearly Transformed Cosines, Eric Heitz, Jonathan Dupuy, Stephen Hill and -David Neubelt, ACM SIGGRAPH 2016 +David Neubelt, ACM SIGGRAPH 2016. ## REGoth -https://github.com/degenerated1123/REGoth - Open source reimplementation of the -zEngine, used by the game "Gothic" and "Gothic II". - -Browser demo: http://gothic-dx11.de/gothic-js/REGoth.html +https://github.com/degenerated1123/REGoth - REGoth is an open-source +reimplementation of the zEngine, used by the game "Gothic" and "Gothic II". ## Ethereal Engine -https://github.com/volcoma/EtherealEngine EtherealEngine C++ Game Engine and -WYSIWYG Editor +https://github.com/volcoma/EtherealEngine - EtherealEngine is a C++ game engine +and WYSIWYG dditor. + ![EtherealEngine screenshot](https://user-images.githubusercontent.com/1499411/29488403-ff3c3df6-8512-11e7-869f-32a783530cc3.png) ## Go Rally @@ -217,16 +226,18 @@ width="640" height="480" border="0" /> ## vg-renderer -https://github.com/jdryg/vg-renderer#vg-renderer - A vector graphics renderer -for bgfx, based on ideas from both NanoVG and ImDrawList (Dear ImGUI) -![vg-renderer](https://raw.githubusercontent.com/jdryg/vg-renderer/master/img/vgrenderer_tiger.png) +https://github.com/jdryg/vg-renderer#vg-renderer - vg-renderer is a vector +graphics renderer for bgfx, based on ideas from both NanoVG and ImDrawList (Dear +ImGUI). + +![vg-renderer screenshot](https://raw.githubusercontent.com/jdryg/vg-renderer/master/img/vgrenderer_tiger.png) ## Zombie Safari http://www.dogbytegames.com/zombie_safari.html - Do what you please in this -Open-World Offroad Driving game: explore massive landscapes, complete challenges, -smash zombies, find secret locations, unlock and upgrade cars and weapons, it's -up to you! +open-world offroad driving game: explore massive landscapes, complete +challenges, smash zombies, find secret locations, unlock and upgrade cars and +weapons, it's up to you! http://www.smithandwinston.com/ - Smith and Winston is an exploration twin stick shooter for PC, PS4 & XBoxOne arriving in late 2018. Smith and Winston features a massively destructable voxel world, rapid twin stick combat, physics puzzles -and Metroid style discovery. +and Metroid-style discovery. ## WonderWorlds -http://wonderworlds.me/ - WonderWorlds is a place to play thousands -of user-created levels and stories, make your own using the extensive in-game -tools and share them with whomever you want. +http://wonderworlds.me/ - WonderWorlds is a place to play thousands of +user-created levels and stories, make your own using the extensive in-game tools +and share them with whomever you want. ## two-io / mud -https://hugoam.github.io/two-io/ - an all-purpose c++ app prototyping library, +https://hugoam.github.io/two-io/ - An all-purpose c++ app prototyping library, focused towards live graphical apps and games. -![mud](https://raw.githubusercontent.com/hugoam/mud-io/master/media/14_live_gfx.png) +![two-io / mud screenshot](https://raw.githubusercontent.com/hugoam/mud-io/master/media/14_live_gfx.png) ## Talking Tom Pool -https://outfit7.com/apps/talking-tom-pool/ - "Sling and match†puzzle game for +https://outfit7.com/apps/talking-tom-pool/ - A "sling and match" puzzle game for mobile devices. ## GPlayEngine -https://github.com/fredakilla/GPlayEngine#gplayengine - GPlayEngine is C++ -cross-platform game engine for creating 2D/3D games based on the GamePlay 3D +https://github.com/fredakilla/GPlayEngine#gplayengine - GPlayEngine is a C++ +cross-platform game engine for creating 2D/3D games based on the GamePlay 3D engine v3.0. -![](https://camo.githubusercontent.com/d89a364fb306f208ca14a58267c8303f60f0f0cf/68747470733a2f2f692e696d6775722e636f6d2f306569395932382e706e67) +![GPlayEngine screenshot](https://camo.githubusercontent.com/d89a364fb306f208ca14a58267c8303f60f0f0cf/68747470733a2f2f692e696d6775722e636f6d2f306569395932382e706e67) ## Off The Road -http://www.dogbytegames.com/off_the_road.html - Sandbox off-road driving +http://www.dogbytegames.com/off_the_road.html - A sandbox off-road driving simulator. ## Coal Burnout -https://beardsvibe.com/ - Multiplayer PVP rhythm game. +https://beardsvibe.com/ - A multiplayer PVP rhythm game. -![coal-burnout](https://beardsvibe.com/scr/0l.png) +![Coal Burnout screenshot](https://beardsvibe.com/scr/0l.png) ## My Talking Tom 2 @@ -321,21 +332,21 @@ width="640" height="480" border="0" /> https://www.neoaxis.com/ - Versatile 3D project development environment. -![neoaxis-engine](https://www.neoaxis.com/files/NeoAxisEngine04.jpg) +![NeoAxis Engine screenshot](https://www.neoaxis.com/files/NeoAxisEngine04.jpg) ## xatlas -https://github.com/jpcy/xatlas#xatlas - Mesh parameterization library +https://github.com/jpcy/xatlas#xatlas - Mesh parameterization library. -![xatlas](https://user-images.githubusercontent.com/3744372/43034066-53a62dee-8d18-11e8-9767-0b38ed3fa2d3.png) +![xatlas screenshot](https://user-images.githubusercontent.com/3744372/43034066-53a62dee-8d18-11e8-9767-0b38ed3fa2d3.png) ## Heroes of Hammerwatch -https://store.steampowered.com/app/677120/Heroes_of_Hammerwatch/ Heroes of Hammerwatch -is a rogue-lite action-adventure game set in the same universe as Hammerwatch. -Encounter endless hordes of enemies, traps, puzzles, secrets and lots of loot, -as you battle your way through procedurally generated levels to reach the top -of the Forsaken Spire. +https://store.steampowered.com/app/677120/Heroes_of_Hammerwatch/ - Heroes of +Hammerwatch is a rogue-lite action-adventure game set in the same universe as +Hammerwatch. Encounter endless hordes of enemies, traps, puzzles, secrets and +lots of loot, as you battle your way through procedurally generated levels to +reach the top of the Forsaken Spire. ## Babylon Native -Build cross-platform native applications with the power of the Babylon.js -JavaScript framework. - -[Babylon Native](https://github.com/BabylonJS/BabylonNative#babylon-native) +https://github.com/BabylonJS/BabylonNative#babylon-native - Build cross-platform +native applications with the power of the Babylon.js JavaScript framework. ## Nira -Instantly load and view assets on any device. All you need is a web browser. +https://nira.app/ - Instantly load and view assets on any device. All you need +is a web browser. -[Nira](https://nira.app/) -[SIGGRAPH 2019: Project Nira: Instant Interactive Real-Time Access to Multi-Gigabyte Sized 3D Assets on Any Device](https://s2019.siggraph.org/presentation/?sess=sess104&id=real_130#038;id=real_130) +SIGGRAPH 2019: Project Nira: Instant Interactive Real-Time Access to +Multi-Gigabyte Sized 3D Assets on Any Device: +https://s2019.siggraph.org/presentation/?sess=sess104&id=real_130#038;id=real_130 ## openblack -An open source reimplementation of the game Black & White (2001). +https://github.com/openblack/openblack#openblack - An open-source +reimplementation of the game Black & White (2001). -[openblack](https://github.com/openblack/openblack#openblack) - -![openblack](https://user-images.githubusercontent.com/32263167/184559293-56cfc6a7-a7da-4876-8fce-434ba8827eae.png) +![openblack screenshot](https://user-images.githubusercontent.com/32263167/184559293-56cfc6a7-a7da-4876-8fce-434ba8827eae.png) ## Cluster -Implementation of Clustered Shading and Physically Based Rendering with the bgfx rendering library. - -[Cluster](https://github.com/pezcode/Cluster#cluster) +https://github.com/pezcode/Cluster#cluster - Implementation of Clustered Shading +and Physically Based Rendering with the bgfx rendering library. -![cluster](https://raw.githubusercontent.com/pezcode/Cluster/master/images/sponza.jpg) +![Cluster screenshot](https://raw.githubusercontent.com/pezcode/Cluster/master/images/sponza.jpg) ## NIMBY Rails -NIMBY Rails is a management and design sandbox game for railways you build in the real world. +https://store.steampowered.com/app/1134710/NIMBY_Rails/ - NIMBY Rails is a +management and design sandbox game for railways you build in the real world. -[NIMBY Rails](https://store.steampowered.com/app/1134710/NIMBY_Rails/) - -![NIMBY Rails](https://user-images.githubusercontent.com/28320/78472283-03d5e200-7727-11ea-8bd4-db8754f52dc3.jpg) +![NIMBY Rails screenshot](https://user-images.githubusercontent.com/28320/78472283-03d5e200-7727-11ea-8bd4-db8754f52dc3.jpg) ## Minecraft https://www.minecraft.net/zh-hant/attribution/ -![home-hero-1200x600](https://user-images.githubusercontent.com/814772/79185288-57050000-7dcb-11ea-87b4-2126fcd1545b.jpg) +![Minecraft screenshot](https://user-images.githubusercontent.com/814772/79185288-57050000-7dcb-11ea-87b4-2126fcd1545b.jpg) ## FFNx -Next generation driver for Final Fantasy VII and Final Fantasy VIII -(with native Steam 2013 release support!) - -[FFNx](https://github.com/julianxhokaxhiu/FFNx#ffnx) +https://github.com/julianxhokaxhiu/FFNx#ffnx - Next generation driver for Final +Fantasy VII and Final Fantasy VIII (with native Steam 2013 release support!) -![FFVIII](https://raw.githubusercontent.com/julianxhokaxhiu/FFNx/master/.screens/ff8.png) +![FFVIII screenshot](https://raw.githubusercontent.com/julianxhokaxhiu/FFNx/master/.screens/ff8.png) ## Shadow Gangs -Shadow Gangs is an arcade style ninja action game. +https://www.microsoft.com/en-gb/p/shadow-gangs/9n6hkcr65qdq - Shadow Gangs is an +arcade style ninja action game. -https://www.microsoft.com/en-gb/p/shadow-gangs/9n6hkcr65qdq - -![Shadow Gangs](https://user-images.githubusercontent.com/814772/94508248-64ba1080-01c6-11eb-800f-47dc374ef054.jpeg) +![Shadow Gangs screenshot](https://user-images.githubusercontent.com/814772/94508248-64ba1080-01c6-11eb-800f-47dc374ef054.jpeg) ## Growtopia -Growtopia is a free-to-play sandbox MMO game with almost endless possibilities -for world creation, customization and having fun with your friends. Enjoy -thousands of items, challenges and events. - -https://growtopiagame.com/ +https://growtopiagame.com/ - Growtopia is a free-to-play sandbox MMO game with +almost endless possibilities for world creation, customization and having fun +with your friends. Enjoy thousands of items, challenges and events. -![growtopia](https://s3.eu-west-1.amazonaws.com/cdn.growtopiagame.com/website/resources/assets/images/grow_header.jpg) +![Growtopia screenshot](https://s3.eu-west-1.amazonaws.com/cdn.growtopiagame.com/website/resources/assets/images/grow_header.jpg) ## Galaxy Trucker -Digital implementation of tabletop spaceship building in real-time or turn-based mode, -then surviving space adventures, with AI opponents, multiplayer, achievements -and solo campaign. - -https://galaxytrucker.com/ +https://galaxytrucker.com/ - Digital implementation of tabletop spaceship +building in real-time or turn-based mode, then surviving space adventures, with +AI opponents, multiplayer, achievements and solo campaign. -![Galaxy Trucker](https://press.galaxytrucker.com/images/GTAT_junk.png) +![Galaxy Trucker screenshot](https://press.galaxytrucker.com/images/GTAT_junk.png) ## Through the Ages -The card tabletop deep strategy game in your devices. Lead your civilization from pyramids -to space flights. Challenges, achievements, skilled AIs and online multiplayer. +https://throughtheages.com/ - The card tabletop deep strategy game in your +devices. Lead your civilization from pyramids to space flights. Challenges, +achievements, skilled AIs and online multiplayer. -https://throughtheages.com/ - -![Through the Ages](https://press.throughtheages.com/images/tta01.png) +![Through the Ages screenshot](https://press.throughtheages.com/images/tta01.png) ## Codenames -One of the best party game. Two rival spymasters know the secret identities of 25 agents. -Their teammates know the agents only by their codenames. Simple to explain, -easy to understand, challenging gameplay. - -https://codenamesgame.com/ +https://codenamesgame.com/ - One of the best party games. Two rival spymasters +know the secret identities of 25 agents. Their teammates know the agents only by +their codenames. Simple to explain, easy to understand, challenging gameplay. -![Codenames](https://codenamesgame.com/img/game-features-img-1.jpg) +![Codenames screenshot](https://codenamesgame.com/img/game-features-img-1.jpg) ## PeakFinder -PeakFinder shows the names of all mountains and peaks with a 360° panorama display. -More than 850'000 peaks - from Mount Everest to the little hill around the corner. +https://www.peakfinder.org/ - PeakFinder shows the names of all mountains and +peaks with a 360° panorama display. More than 850'000 peaks - from Mount Everest +to the little hill around the corner. -https://www.peakfinder.org/ - -![PeakFinder](https://pfweb-c125.kxcdn.com/images/mobile/cards//en/cameramode.jpg) +![PeakFinder screenshot](https://pfweb-c125.kxcdn.com/videos/mobile/manual/v4/light/en/peakfinder-trecime.jpg) ## Ember Sword -Ember Sword is a free to play MMORPG running directly in your browser and is -being developed and published by Bright Star Studios. - -https://embersword.com +https://embersword.com - Ember Sword is a free to play MMORPG running directly +in your browser and is being developed and published by Bright Star Studios. -![Ember-Sword-ConceptArt5](https://user-images.githubusercontent.com/814772/120714133-a860ca80-c477-11eb-8680-f5a948dfd050.png) +![Ember Sword screenshot](https://user-images.githubusercontent.com/814772/120714133-a860ca80-c477-11eb-8680-f5a948dfd050.png) ## Off The Road Unleashed -Off The Road Unleashed is a sandbox driving game for the Nintendo Switch. -If you see a vehicle you bet you can hop into it! Pilot big rigs, helicopters, boats, airplanes or even trains. Sand dunes, frozen plains, mountains to climb and conquer. - -https://www.nintendo.com/games/detail/off-the-road-unleashed-switch/ +https://www.nintendo.com/games/detail/off-the-road-unleashed-switch/ - Off The +Road Unleashed is a sandbox driving game for the Nintendo Switch. If you see a +vehicle you bet you can hop into it! Pilot big rigs, helicopters, boats, +airplanes or even trains. Sand dunes, frozen plains, mountains to climb and +conquer. ## Guild Wars 2 -Guild Wars 2 is an online role-playing game with fast-paced action combat, a rich and detailed universe of stories, awe-inspiring landscapes to explore, two challenging player vs. player modes—and no subscription fees! - -https://www.guildwars2.com/ +https://www.guildwars2.com/ - Guild Wars 2 is an online role-playing game with +fast-paced action combat, a rich and detailed universe of stories, awe-inspiring +landscapes to explore, two challenging player vs. player modes—and no +subscription fees! -![Guild-Wars-2-wallpaper](https://d3b4yo2b5lbfy.cloudfront.net/wp-content/uploads/wallpapers/GuildWars2-01-800x600.jpg) +![Guild Wars 2 screenshot](https://d3b4yo2b5lbfy.cloudfront.net/wp-content/uploads/2017/07/1a684WvW_ArmorT3.jpg) ## Griftlands -Griftlands is a roguelike deck-building game with role-playing story elements in a science fiction setting, developed and published by Klei Entertainment. - -https://klei.com/games/griftlands +https://klei.com/games/griftlands - Griftlands is a roguelike deck-building game +with role-playing story elements in a science fiction setting, developed and +published by Klei Entertainment. ## HARFANG 3D -[HARFANG® 3D](https://www.harfang3d.com) is a **BGFX-powered** 3D visualization framework for C++, Python, Go, and Lua. -It comes with a 3D editor, HARFANG Studio. +https://www.harfang3d.com - HARFANG® 3D is a **BGFX-powered** 3D visualization +framework for C++, Python, Go, and Lua. It comes with a 3D editor, HARFANG +Studio. -![HARFANG-STUDIO](https://raw.githubusercontent.com/harfang3d/image-storage/main/portfolio/3.2.2/harfang-studio-cyber-city.png) +![HARFANG Studio screenshot](https://raw.githubusercontent.com/harfang3d/image-storage/main/portfolio/3.2.2/harfang-studio-cyber-city.png) ## Marine Melodies / Resistance -Demoscene musicdisk released at Evoke 2022 demoparty. +https://www.pouet.net/prod.php?which=91906 - Demoscene musicdisk released at +Evoke 2022 demoparty. + +https://github.com/astrofra/demo-marine-melodies Marine Melodies -https://www.pouet.net/prod.php?which=91906 - -https://github.com/astrofra/demo-marine-melodies - ## Activeworlds -[Activeworlds](https://www.activeworlds.com/) is an online VR platform with rich multimedia and presentation features. Create your own worlds or build in free community worlds, hold your own event / meeting or join inworld events! +https://www.activeworlds.com/ - Activeworlds is an online VR platform with rich +multimedia and presentation features. Create your own worlds or build in free +community worlds, hold your own event / meeting or join inworld events! -![Activeworlds-wallpaper](http://www.activeworlds.com/img/181107-213544_small_enkii.jpg) +![Activeworlds screenshot](http://www.activeworlds.com/img/181107-213544_small_enkii.jpg) ## Equilibrium Engine -[Equilibrium Engine](https://github.com/clibequilibrium/EquilibriumEngine) is a Data-oriented and multi-threaded C11 Game Engine with libraries & shaders hot-reloading. +https://github.com/clibequilibrium/EquilibriumEngine - Equilibrium Engine is a +data-oriented and multi-threaded C11 Game Engine with libraries & shaders +hot-reloading. + +![Equilibrium Engine screenshot](https://raw.githubusercontent.com/clibequilibrium/EquilibriumEngine/master/docs/city.png) + +## Pinhole Universe + +https://festina-lente-productions.com/pinhole-universe/ - Explore a generated +world where you can zoom in on anything, forever. -![Equilibrium Engine](https://raw.githubusercontent.com/clibequilibrium/EquilibriumEngine/master/docs/city.png) +![Pinhole Universe capsule image](https://festina-lente-productions.com/ext/capsule_small.jpg) [License (BSD 2-clause)](https://bkaradzic.github.io/bgfx/license.html) ----------------------------------------------------------------------- - + - Copyright 2010-2022 Branimir Karadzic + Copyright 2010-2023 Branimir Karadzic Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/bgfx/bindings/bf/bgfx.bf b/bgfx/bindings/bf/bgfx.bf index 59e94a4f..cc13110f 100644 --- a/bgfx/bindings/bf/bgfx.bf +++ b/bgfx/bindings/bf/bgfx.bf @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -1147,15 +1147,20 @@ public static class bgfx /// VertexId = 0x0000000008000000, + /// + /// PrimitiveID is available in fragment shader. + /// + PrimitiveId = 0x0000000010000000, + /// /// Viewport layer is available in vertex shader. /// - ViewportLayerArray = 0x0000000010000000, + ViewportLayerArray = 0x0000000020000000, /// /// Draw indirect with indirect count is supported. /// - DrawIndirectCount = 0x0000000020000000, + DrawIndirectCount = 0x0000000040000000, /// /// All texture compare modes are supported. @@ -1678,11 +1683,21 @@ public static class bgfx /// ASTC4x4, + /// + /// ASTC 5x4 6.40 BPP + /// + ASTC5x4, + /// /// ASTC 5x5 5.12 BPP /// ASTC5x5, + /// + /// ASTC 6x5 4.27 BPP + /// + ASTC6x5, + /// /// ASTC 6x6 3.56 BPP /// @@ -1698,11 +1713,41 @@ public static class bgfx /// ASTC8x6, + /// + /// ASTC 8x8 2.00 BPP + /// + ASTC8x8, + /// /// ASTC 10x5 2.56 BPP /// ASTC10x5, + /// + /// ASTC 10x6 2.13 BPP + /// + ASTC10x6, + + /// + /// ASTC 10x8 1.60 BPP + /// + ASTC10x8, + + /// + /// ASTC 10x10 1.28 BPP + /// + ASTC10x10, + + /// + /// ASTC 12x10 1.07 BPP + /// + ASTC12x10, + + /// + /// ASTC 12x12 0.89 BPP + /// + ASTC12x12, + /// /// Compressed formats above. /// @@ -1971,6 +2016,22 @@ public static class bgfx Count } + [AllowDuplicates] + public enum NativeWindowHandleType : uint32 + { + /// + /// Platform default handle type (X11 on Linux). + /// + Default, + + /// + /// Wayland. + /// + Wayland, + + Count + } + [AllowDuplicates] public enum RenderFrame : uint32 { @@ -2045,7 +2106,7 @@ public static class bgfx public uint8 numGPUs; public GPU[4] gpu; public Limits limits; - public uint16[88] formats; + public uint16[96] formats; } [CRepr] @@ -2063,6 +2124,7 @@ public static class bgfx public void* context; public void* backBuffer; public void* backBufferDS; + public NativeWindowHandleType type; } [CRepr] @@ -2074,6 +2136,7 @@ public static class bgfx public uint32 reset; public uint8 numBackBuffers; public uint8 maxFrameLatency; + public uint8 debugTextScale; } [CRepr] @@ -3829,7 +3892,7 @@ public static class bgfx /// /// Vertex buffer. /// First instance data. - /// Number of data instances. Set instance data buffer for draw primitive. + /// Number of data instances. /// [LinkName("bgfx_encoder_set_instance_data_from_vertex_buffer")] public static extern void encoder_set_instance_data_from_vertex_buffer(Encoder* _this, VertexBufferHandle _handle, uint32 _startVertex, uint32 _num); @@ -4407,7 +4470,7 @@ public static class bgfx /// /// Vertex buffer. /// First instance data. - /// Number of data instances. Set instance data buffer for draw primitive. + /// Number of data instances. /// [LinkName("bgfx_set_instance_data_from_vertex_buffer")] public static extern void set_instance_data_from_vertex_buffer(VertexBufferHandle _handle, uint32 _startVertex, uint32 _num); diff --git a/bgfx/bindings/cs/bgfx.cs b/bgfx/bindings/cs/bgfx.cs index 8d3360cb..baccff2c 100644 --- a/bgfx/bindings/cs/bgfx.cs +++ b/bgfx/bindings/cs/bgfx.cs @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -1146,15 +1146,20 @@ public enum CapsFlags : ulong /// VertexId = 0x0000000008000000, + /// + /// PrimitiveID is available in fragment shader. + /// + PrimitiveId = 0x0000000010000000, + /// /// Viewport layer is available in vertex shader. /// - ViewportLayerArray = 0x0000000010000000, + ViewportLayerArray = 0x0000000020000000, /// /// Draw indirect with indirect count is supported. /// - DrawIndirectCount = 0x0000000020000000, + DrawIndirectCount = 0x0000000040000000, /// /// All texture compare modes are supported. @@ -1671,11 +1676,21 @@ public enum TextureFormat /// ASTC4x4, + /// + /// ASTC 5x4 6.40 BPP + /// + ASTC5x4, + /// /// ASTC 5x5 5.12 BPP /// ASTC5x5, + /// + /// ASTC 6x5 4.27 BPP + /// + ASTC6x5, + /// /// ASTC 6x6 3.56 BPP /// @@ -1691,11 +1706,41 @@ public enum TextureFormat /// ASTC8x6, + /// + /// ASTC 8x8 2.00 BPP + /// + ASTC8x8, + /// /// ASTC 10x5 2.56 BPP /// ASTC10x5, + /// + /// ASTC 10x6 2.13 BPP + /// + ASTC10x6, + + /// + /// ASTC 10x8 1.60 BPP + /// + ASTC10x8, + + /// + /// ASTC 10x10 1.28 BPP + /// + ASTC10x10, + + /// + /// ASTC 12x10 1.07 BPP + /// + ASTC12x10, + + /// + /// ASTC 12x12 0.89 BPP + /// + ASTC12x12, + /// /// Compressed formats above. /// @@ -1957,6 +2002,21 @@ public enum ViewMode Count } + public enum NativeWindowHandleType + { + /// + /// Platform default handle type (X11 on Linux). + /// + Default, + + /// + /// Wayland. + /// + Wayland, + + Count + } + public enum RenderFrame { /// @@ -2027,7 +2087,7 @@ public unsafe struct Limits public byte numGPUs; public fixed uint gpu[4]; public Limits limits; - public fixed ushort formats[88]; + public fixed ushort formats[96]; } public unsafe struct InternalData @@ -2043,6 +2103,7 @@ public unsafe struct PlatformData public void* context; public void* backBuffer; public void* backBufferDS; + public NativeWindowHandleType type; } public unsafe struct Resolution @@ -2053,6 +2114,7 @@ public unsafe struct Resolution public uint reset; public byte numBackBuffers; public byte maxFrameLatency; + public byte debugTextScale; } public unsafe struct Init @@ -3786,7 +3848,7 @@ public struct VertexLayoutHandle { /// /// Vertex buffer. /// First instance data. - /// Number of data instances. Set instance data buffer for draw primitive. + /// Number of data instances. /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_instance_data_from_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] public static extern unsafe void encoder_set_instance_data_from_vertex_buffer(Encoder* _this, VertexBufferHandle _handle, uint _startVertex, uint _num); @@ -4364,7 +4426,7 @@ public struct VertexLayoutHandle { /// /// Vertex buffer. /// First instance data. - /// Number of data instances. Set instance data buffer for draw primitive. + /// Number of data instances. /// [DllImport(DllName, EntryPoint="bgfx_set_instance_data_from_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] public static extern unsafe void set_instance_data_from_vertex_buffer(VertexBufferHandle _handle, uint _startVertex, uint _num); diff --git a/bgfx/bindings/cs/bgfx_dllname.cs b/bgfx/bindings/cs/bgfx_dllname.cs index 54bb7cec..32418ce4 100644 --- a/bgfx/bindings/cs/bgfx_dllname.cs +++ b/bgfx/bindings/cs/bgfx_dllname.cs @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/bindings/d/fakeenum.d b/bgfx/bindings/d/fakeenum.d new file mode 100644 index 00000000..4fdc6135 --- /dev/null +++ b/bgfx/bindings/d/fakeenum.d @@ -0,0 +1,79 @@ +/+ ++ ┌==============================┠++ │ AUTO GENERATED! DO NOT EDIT! │ ++ └==============================┘ ++/ +module bgfx.fakeenum; + +//NOTE: Do NOT use this module! Use the enums with the same names in `bgfx/package.d` instead. +package: +extern(C++, "bgfx") package final abstract class Fatal{ + enum Enum{ + debugCheck,invalidShader,unableToInitialize,unableToCreateTexture,deviceLost,count + } +} +extern(C++, "bgfx") package final abstract class RendererType{ + enum Enum{ + noop,agc,direct3D9,direct3D11,direct3D12,gnm,metal,nvn,openGLES,openGL,vulkan,webGPU,count + } +} +extern(C++, "bgfx") package final abstract class Access{ + enum Enum{ + read,write,readWrite,count + } +} +extern(C++, "bgfx") package final abstract class Attrib{ + enum Enum{ + position,normal,tangent,bitangent,color0,color1,color2,color3,indices,weight,texCoord0,texCoord1,texCoord2,texCoord3,texCoord4,texCoord5,texCoord6,texCoord7,count + } +} +extern(C++, "bgfx") package final abstract class AttribType{ + enum Enum{ + uint8,uint10,int16,half,float_,count + } +} +extern(C++, "bgfx") package final abstract class TextureFormat{ + enum Enum{ + bc1,bc2,bc3,bc4,bc5,bc6h,bc7,etc1,etc2,etc2a,etc2a1,ptc12,ptc14,ptc12a,ptc14a,ptc22,ptc24,atc,atce,atci,astc4x4,astc5x4,astc5x5,astc6x5,astc6x6,astc8x5,astc8x6,astc8x8,astc10x5,astc10x6,astc10x8,astc10x10,astc12x10,astc12x12,unknown,r1,a8,r8,r8i,r8u,r8s,r16,r16i,r16u,r16f,r16s,r32i,r32u,r32f,rg8,rg8i,rg8u,rg8s,rg16,rg16i,rg16u,rg16f,rg16s,rg32i,rg32u,rg32f,rgb8,rgb8i,rgb8u,rgb8s,rgb9e5f,bgra8,rgba8,rgba8i,rgba8u,rgba8s,rgba16,rgba16i,rgba16u,rgba16f,rgba16s,rgba32i,rgba32u,rgba32f,b5g6r5,r5g6b5,bgra4,rgba4,bgr5a1,rgb5a1,rgb10a2,rg11b10f,unknownDepth,d16,d24,d24s8,d32,d16f,d24f,d32f,d0s8,count + } +} +extern(C++, "bgfx") package final abstract class UniformType{ + enum Enum{ + sampler,end,vec4,mat3,mat4,count + } +} +extern(C++, "bgfx") package final abstract class BackbufferRatio{ + enum Enum{ + equal,half,quarter,eighth,sixteenth,double_,count + } +} +extern(C++, "bgfx") package final abstract class OcclusionQueryResult{ + enum Enum{ + invisible,visible,noResult,count + } +} +extern(C++, "bgfx") package final abstract class Topology{ + enum Enum{ + triList,triStrip,lineList,lineStrip,pointList,count + } +} +extern(C++, "bgfx") package final abstract class TopologyConvert{ + enum Enum{ + triListFlipWinding,triStripFlipWinding,triListToLineList,triStripToTriList,lineStripToLineList,count + } +} +extern(C++, "bgfx") package final abstract class TopologySort{ + enum Enum{ + directionFrontToBackMin,directionFrontToBackAvg,directionFrontToBackMax,directionBackToFrontMin,directionBackToFrontAvg,directionBackToFrontMax,distanceFrontToBackMin,distanceFrontToBackAvg,distanceFrontToBackMax,distanceBackToFrontMin,distanceBackToFrontAvg,distanceBackToFrontMax,count + } +} +extern(C++, "bgfx") package final abstract class ViewMode{ + enum Enum{ + default_,sequential,depthAscending,depthDescending,count + } +} +extern(C++, "bgfx") package final abstract class RenderFrame{ + enum Enum{ + noContext,render,timeout,exiting,count + } +} diff --git a/bgfx/bindings/d/funcs.d b/bgfx/bindings/d/funcs.d deleted file mode 100644 index 561556ba..00000000 --- a/bgfx/bindings/d/funcs.d +++ /dev/null @@ -1,4569 +0,0 @@ -/* - * - * AUTO GENERATED! DO NOT EDIT! - * - */ - -module bindbc.bgfx.funcs; - -private import bindbc.bgfx.types; - -extern(C) @nogc nothrow: - -version(BindBgfx_Static) -{ - /** - * Init attachment. - * Params: - * _handle = Render target texture handle. - * _access = Access. See `Access::Enum`. - * _layer = Cubemap side or depth layer/slice to use. - * _numLayers = Number of texture layer/slice(s) in array to use. - * _mip = Mip level. - * _resolve = Resolve flags. See: `BGFX_RESOLVE_*` - */ - void bgfx_attachment_init(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, ushort _layer, ushort _numLayers, ushort _mip, ubyte _resolve); - - /** - * Start VertexLayout. - * Params: - * _rendererType = Renderer backend type. See: `bgfx::RendererType` - */ - bgfx_vertex_layout_t* bgfx_vertex_layout_begin(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType); - - /** - * Add attribute to VertexLayout. - * Remarks: Must be called between begin/end. - * Params: - * _attrib = Attribute semantics. See: `bgfx::Attrib` - * _num = Number of elements 1, 2, 3 or 4. - * _type = Element type. - * _normalized = When using fixed point AttribType (f.e. Uint8) - * value will be normalized for vertex shader usage. When normalized - * is set to true, AttribType::Uint8 value in range 0-255 will be - * in range 0.0-1.0 in vertex shader. - * _asInt = Packaging rule for vertexPack, vertexUnpack, and - * vertexConvert for AttribType::Uint8 and AttribType::Int16. - * Unpacking code must be implemented inside vertex shader. - */ - bgfx_vertex_layout_t* bgfx_vertex_layout_add(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, ubyte _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); - - /** - * Decode attribute. - * Params: - * _attrib = Attribute semantics. See: `bgfx::Attrib` - * _num = Number of elements. - * _type = Element type. - * _normalized = Attribute is normalized. - * _asInt = Attribute is packed as int. - */ - void bgfx_vertex_layout_decode(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib, ubyte* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt); - - /** - * Returns `true` if VertexLayout contains attribute. - * Params: - * _attrib = Attribute semantics. See: `bgfx::Attrib` - */ - bool bgfx_vertex_layout_has(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib); - - /** - * Skip `_num` bytes in vertex stream. - * Params: - * _num = Number of bytes to skip. - */ - bgfx_vertex_layout_t* bgfx_vertex_layout_skip(bgfx_vertex_layout_t* _this, ubyte _num); - - /** - * End VertexLayout. - */ - void bgfx_vertex_layout_end(bgfx_vertex_layout_t* _this); - - /** - * Pack vertex attribute into vertex stream format. - * Params: - * _input = Value to be packed into vertex stream. - * _inputNormalized = `true` if input value is already normalized. - * _attr = Attribute to pack. - * _layout = Vertex stream layout. - * _data = Destination vertex stream where data will be packed. - * _index = Vertex index that will be modified. - */ - void bgfx_vertex_pack(const float[4] _input, bool _inputNormalized, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, void* _data, uint _index); - - /** - * Unpack vertex attribute from vertex stream format. - * Params: - * _output = Result of unpacking. - * _attr = Attribute to unpack. - * _layout = Vertex stream layout. - * _data = Source vertex stream from where data will be unpacked. - * _index = Vertex index that will be unpacked. - */ - void bgfx_vertex_unpack(float[4] _output, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _index); - - /** - * Converts vertex stream data from one vertex stream format to another. - * Params: - * _dstLayout = Destination vertex stream layout. - * _dstData = Destination vertex stream. - * _srcLayout = Source vertex stream layout. - * _srcData = Source vertex stream data. - * _num = Number of vertices to convert from source to destination. - */ - void bgfx_vertex_convert(const(bgfx_vertex_layout_t)* _dstLayout, void* _dstData, const(bgfx_vertex_layout_t)* _srcLayout, const(void)* _srcData, uint _num); - - /** - * Weld vertices. - * Params: - * _output = Welded vertices remapping table. The size of buffer - * must be the same as number of vertices. - * _layout = Vertex stream layout. - * _data = Vertex stream. - * _num = Number of vertices in vertex stream. - * _index32 = Set to `true` if input indices are 32-bit. - * _epsilon = Error tolerance for vertex position comparison. - */ - uint bgfx_weld_vertices(void* _output, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _num, bool _index32, float _epsilon); - - /** - * Convert index buffer for use with different primitive topologies. - * Params: - * _conversion = Conversion type, see `TopologyConvert::Enum`. - * _dst = Destination index buffer. If this argument is NULL - * function will return number of indices after conversion. - * _dstSize = Destination index buffer in bytes. It must be - * large enough to contain output indices. If destination size is - * insufficient index buffer will be truncated. - * _indices = Source indices. - * _numIndices = Number of input indices. - * _index32 = Set to `true` if input indices are 32-bit. - */ - uint bgfx_topology_convert(bgfx_topology_convert_t _conversion, void* _dst, uint _dstSize, const(void)* _indices, uint _numIndices, bool _index32); - - /** - * Sort indices. - * Params: - * _sort = Sort order, see `TopologySort::Enum`. - * _dst = Destination index buffer. - * _dstSize = Destination index buffer in bytes. It must be - * large enough to contain output indices. If destination size is - * insufficient index buffer will be truncated. - * _dir = Direction (vector must be normalized). - * _pos = Position. - * _vertices = Pointer to first vertex represented as - * float x, y, z. Must contain at least number of vertices - * referencende by index buffer. - * _stride = Vertex stride. - * _indices = Source indices. - * _numIndices = Number of input indices. - * _index32 = Set to `true` if input indices are 32-bit. - */ - void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void* _dst, uint _dstSize, const float[3] _dir, const float[3] _pos, const(void)* _vertices, uint _stride, const(void)* _indices, uint _numIndices, bool _index32); - - /** - * Returns supported backend API renderers. - * Params: - * _max = Maximum number of elements in _enum array. - * _enum = Array where supported renderers will be written. - */ - ubyte bgfx_get_supported_renderers(ubyte _max, bgfx_renderer_type_t* _enum); - - /** - * Returns name of renderer. - * Params: - * _type = Renderer backend type. See: `bgfx::RendererType` - */ - const(char)* bgfx_get_renderer_name(bgfx_renderer_type_t _type); - - void bgfx_init_ctor(bgfx_init_t* _init); - - /** - * Initialize the bgfx library. - * Params: - * _init = Initialization parameters. See: `bgfx::Init` for more info. - */ - bool bgfx_init(const(bgfx_init_t)* _init); - - /** - * Shutdown bgfx library. - */ - void bgfx_shutdown(); - - /** - * Reset graphic settings and back-buffer size. - * Attention: This call doesn’t change the window size, it just resizes - * the back-buffer. Your windowing code controls the window size. - * Params: - * _width = Back-buffer width. - * _height = Back-buffer height. - * _flags = See: `BGFX_RESET_*` for more info. - * - `BGFX_RESET_NONE` - No reset flags. - * - `BGFX_RESET_FULLSCREEN` - Not supported yet. - * - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA. - * - `BGFX_RESET_VSYNC` - Enable V-Sync. - * - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy. - * - `BGFX_RESET_CAPTURE` - Begin screen capture. - * - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU. - * - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip - * occurs. Default behaviour is that flip occurs before rendering new - * frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. - * - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB back-buffer. - * _format = Texture format. See: `TextureFormat::Enum`. - */ - void bgfx_reset(uint _width, uint _height, uint _flags, bgfx_texture_format_t _format); - - /** - * Advance to next frame. When using multithreaded renderer, this call - * just swaps internal buffers, kicks render thread, and returns. In - * singlethreaded renderer this call does frame rendering. - * Params: - * _capture = Capture frame with graphics debugger. - */ - uint bgfx_frame(bool _capture); - - /** - * Returns current renderer backend API type. - * Remarks: - * Library must be initialized. - */ - bgfx_renderer_type_t bgfx_get_renderer_type(); - - /** - * Returns renderer capabilities. - * Remarks: - * Library must be initialized. - */ - const(bgfx_caps_t)* bgfx_get_caps(); - - /** - * Returns performance counters. - * Attention: Pointer returned is valid until `bgfx::frame` is called. - */ - const(bgfx_stats_t)* bgfx_get_stats(); - - /** - * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx. - * Params: - * _size = Size to allocate. - */ - const(bgfx_memory_t)* bgfx_alloc(uint _size); - - /** - * Allocate buffer and copy data into it. Data will be freed inside bgfx. - * Params: - * _data = Pointer to data to be copied. - * _size = Size of data to be copied. - */ - const(bgfx_memory_t)* bgfx_copy(const(void)* _data, uint _size); - - /** - * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call - * doesn't allocate memory for data. It just copies the _data pointer. You - * can pass `ReleaseFn` function pointer to release this memory after it's - * consumed, otherwise you must make sure _data is available for at least 2 - * `bgfx::frame` calls. `ReleaseFn` function must be able to be called - * from any thread. - * Attention: Data passed must be available for at least 2 `bgfx::frame` calls. - * Params: - * _data = Pointer to data. - * _size = Size of data. - */ - const(bgfx_memory_t)* bgfx_make_ref(const(void)* _data, uint _size); - - /** - * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call - * doesn't allocate memory for data. It just copies the _data pointer. You - * can pass `ReleaseFn` function pointer to release this memory after it's - * consumed, otherwise you must make sure _data is available for at least 2 - * `bgfx::frame` calls. `ReleaseFn` function must be able to be called - * from any thread. - * Attention: Data passed must be available for at least 2 `bgfx::frame` calls. - * Params: - * _data = Pointer to data. - * _size = Size of data. - * _releaseFn = Callback function to release memory after use. - * _userData = User data to be passed to callback function. - */ - const(bgfx_memory_t)* bgfx_make_ref_release(const(void)* _data, uint _size, void* _releaseFn, void* _userData); - - /** - * Set debug flags. - * Params: - * _debug = Available flags: - * - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set - * all rendering calls will be skipped. This is useful when profiling - * to quickly assess potential bottlenecks between CPU and GPU. - * - `BGFX_DEBUG_PROFILER` - Enable profiler. - * - `BGFX_DEBUG_STATS` - Display internal statistics. - * - `BGFX_DEBUG_TEXT` - Display debug text. - * - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering - * primitives will be rendered as lines. - */ - void bgfx_set_debug(uint _debug); - - /** - * Clear internal debug text buffer. - * Params: - * _attr = Background color. - * _small = Default 8x16 or 8x8 font. - */ - void bgfx_dbg_text_clear(ubyte _attr, bool _small); - - /** - * Print formatted data to internal debug text character-buffer (VGA-compatible text mode). - * Params: - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _attr = Color palette. Where top 4-bits represent index of background, and bottom - * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). - * _format = `printf` style format. - */ - void bgfx_dbg_text_printf(ushort _x, ushort _y, ubyte _attr, const(char)* _format, ... ); - - /** - * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode). - * Params: - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _attr = Color palette. Where top 4-bits represent index of background, and bottom - * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). - * _format = `printf` style format. - * _argList = Variable arguments list for format string. - */ - void bgfx_dbg_text_vprintf(ushort _x, ushort _y, ubyte _attr, const(char)* _format, va_list _argList); - - /** - * Draw image into internal debug text buffer. - * Params: - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _width = Image width. - * _height = Image height. - * _data = Raw image data (character/attribute raw encoding). - * _pitch = Image pitch in bytes. - */ - void bgfx_dbg_text_image(ushort _x, ushort _y, ushort _width, ushort _height, const(void)* _data, ushort _pitch); - - /** - * Create static index buffer. - * Params: - * _mem = Index buffer data. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic - * buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on - * index buffers. - */ - bgfx_index_buffer_handle_t bgfx_create_index_buffer(const(bgfx_memory_t)* _mem, ushort _flags); - - /** - * Set static index buffer debug name. - * Params: - * _handle = Static index buffer handle. - * _name = Static index buffer name. - * _len = Static index buffer name length (if length is INT32_MAX, it's expected - * that _name is zero terminated string. - */ - void bgfx_set_index_buffer_name(bgfx_index_buffer_handle_t _handle, const(char)* _name, int _len); - - /** - * Destroy static index buffer. - * Params: - * _handle = Static index buffer handle. - */ - void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle); - - /** - * Create vertex layout. - * Params: - * _layout = Vertex layout. - */ - bgfx_vertex_layout_handle_t bgfx_create_vertex_layout(const(bgfx_vertex_layout_t)* _layout); - - /** - * Destroy vertex layout. - * Params: - * _layoutHandle = Vertex layout handle. - */ - void bgfx_destroy_vertex_layout(bgfx_vertex_layout_handle_t _layoutHandle); - - /** - * Create static vertex buffer. - * Params: - * _mem = Vertex buffer data. - * _layout = Vertex layout. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers. - */ - bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags); - - /** - * Set static vertex buffer debug name. - * Params: - * _handle = Static vertex buffer handle. - * _name = Static vertex buffer name. - * _len = Static vertex buffer name length (if length is INT32_MAX, it's expected - * that _name is zero terminated string. - */ - void bgfx_set_vertex_buffer_name(bgfx_vertex_buffer_handle_t _handle, const(char)* _name, int _len); - - /** - * Destroy static vertex buffer. - * Params: - * _handle = Static vertex buffer handle. - */ - void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle); - - /** - * Create empty dynamic index buffer. - * Params: - * _num = Number of indices. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic - * buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on - * index buffers. - */ - bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint _num, ushort _flags); - - /** - * Create a dynamic index buffer and initialize it. - * Params: - * _mem = Index buffer data. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic - * buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on - * index buffers. - */ - bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const(bgfx_memory_t)* _mem, ushort _flags); - - /** - * Update dynamic index buffer. - * Params: - * _handle = Dynamic index buffer handle. - * _startIndex = Start index. - * _mem = Index buffer data. - */ - void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint _startIndex, const(bgfx_memory_t)* _mem); - - /** - * Destroy dynamic index buffer. - * Params: - * _handle = Dynamic index buffer handle. - */ - void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle); - - /** - * Create empty dynamic vertex buffer. - * Params: - * _num = Number of vertices. - * _layout = Vertex layout. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic - * buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on - * index buffers. - */ - bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint _num, const(bgfx_vertex_layout_t)* _layout, ushort _flags); - - /** - * Create dynamic vertex buffer and initialize it. - * Params: - * _mem = Vertex buffer data. - * _layout = Vertex layout. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic - * buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on - * index buffers. - */ - bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags); - - /** - * Update dynamic vertex buffer. - * Params: - * _handle = Dynamic vertex buffer handle. - * _startVertex = Start vertex. - * _mem = Vertex buffer data. - */ - void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, const(bgfx_memory_t)* _mem); - - /** - * Destroy dynamic vertex buffer. - * Params: - * _handle = Dynamic vertex buffer handle. - */ - void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle); - - /** - * Returns number of requested or maximum available indices. - * Params: - * _num = Number of required indices. - * _index32 = Set to `true` if input indices will be 32-bit. - */ - uint bgfx_get_avail_transient_index_buffer(uint _num, bool _index32); - - /** - * Returns number of requested or maximum available vertices. - * Params: - * _num = Number of required vertices. - * _layout = Vertex layout. - */ - uint bgfx_get_avail_transient_vertex_buffer(uint _num, const(bgfx_vertex_layout_t)* _layout); - - /** - * Returns number of requested or maximum available instance buffer slots. - * Params: - * _num = Number of required instances. - * _stride = Stride per instance. - */ - uint bgfx_get_avail_instance_data_buffer(uint _num, ushort _stride); - - /** - * Allocate transient index buffer. - * Params: - * _tib = TransientIndexBuffer structure will be filled, and will be valid - * for the duration of frame, and can be reused for multiple draw - * calls. - * _num = Number of indices to allocate. - * _index32 = Set to `true` if input indices will be 32-bit. - */ - void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint _num, bool _index32); - - /** - * Allocate transient vertex buffer. - * Params: - * _tvb = TransientVertexBuffer structure will be filled, and will be valid - * for the duration of frame, and can be reused for multiple draw - * calls. - * _num = Number of vertices to allocate. - * _layout = Vertex layout. - */ - void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint _num, const(bgfx_vertex_layout_t)* _layout); - - /** - * Check for required space and allocate transient vertex and index - * buffers. If both space requirements are satisfied function returns - * true. - * Params: - * _tvb = TransientVertexBuffer structure will be filled, and will be valid - * for the duration of frame, and can be reused for multiple draw - * calls. - * _layout = Vertex layout. - * _numVertices = Number of vertices to allocate. - * _tib = TransientIndexBuffer structure will be filled, and will be valid - * for the duration of frame, and can be reused for multiple draw - * calls. - * _numIndices = Number of indices to allocate. - * _index32 = Set to `true` if input indices will be 32-bit. - */ - bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const(bgfx_vertex_layout_t)* _layout, uint _numVertices, bgfx_transient_index_buffer_t* _tib, uint _numIndices, bool _index32); - - /** - * Allocate instance data buffer. - * Params: - * _idb = InstanceDataBuffer structure will be filled, and will be valid - * for duration of frame, and can be reused for multiple draw - * calls. - * _num = Number of instances. - * _stride = Instance stride. Must be multiple of 16. - */ - void bgfx_alloc_instance_data_buffer(bgfx_instance_data_buffer_t* _idb, uint _num, ushort _stride); - - /** - * Create draw indirect buffer. - * Params: - * _num = Number of indirect calls. - */ - bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint _num); - - /** - * Destroy draw indirect buffer. - * Params: - * _handle = Indirect buffer handle. - */ - void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _handle); - - /** - * Create shader from memory buffer. - * Params: - * _mem = Shader binary. - */ - bgfx_shader_handle_t bgfx_create_shader(const(bgfx_memory_t)* _mem); - - /** - * Returns the number of uniforms and uniform handles used inside a shader. - * Remarks: - * Only non-predefined uniforms are returned. - * Params: - * _handle = Shader handle. - * _uniforms = UniformHandle array where data will be stored. - * _max = Maximum capacity of array. - */ - ushort bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, ushort _max); - - /** - * Set shader debug name. - * Params: - * _handle = Shader handle. - * _name = Shader name. - * _len = Shader name length (if length is INT32_MAX, it's expected - * that _name is zero terminated string). - */ - void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const(char)* _name, int _len); - - /** - * Destroy shader. - * Remarks: Once a shader program is created with _handle, - * it is safe to destroy that shader. - * Params: - * _handle = Shader handle. - */ - void bgfx_destroy_shader(bgfx_shader_handle_t _handle); - - /** - * Create program with vertex and fragment shaders. - * Params: - * _vsh = Vertex shader. - * _fsh = Fragment shader. - * _destroyShaders = If true, shaders will be destroyed when program is destroyed. - */ - bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders); - - /** - * Create program with compute shader. - * Params: - * _csh = Compute shader. - * _destroyShaders = If true, shaders will be destroyed when program is destroyed. - */ - bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_t _csh, bool _destroyShaders); - - /** - * Destroy program. - * Params: - * _handle = Program handle. - */ - void bgfx_destroy_program(bgfx_program_handle_t _handle); - - /** - * Validate texture parameters. - * Params: - * _depth = Depth dimension of volume texture. - * _cubeMap = Indicates that texture contains cubemap. - * _numLayers = Number of layers in texture array. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture flags. See `BGFX_TEXTURE_*`. - */ - bool bgfx_is_texture_valid(ushort _depth, bool _cubeMap, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags); - - /** - * Validate frame buffer parameters. - * Params: - * _num = Number of attachments. - * _attachment = Attachment texture info. See: `bgfx::Attachment`. - */ - bool bgfx_is_frame_buffer_valid(ubyte _num, const(bgfx_attachment_t)* _attachment); - - /** - * Calculate amount of memory required for texture. - * Params: - * _info = Resulting texture info structure. See: `TextureInfo`. - * _width = Width. - * _height = Height. - * _depth = Depth dimension of volume texture. - * _cubeMap = Indicates that texture contains cubemap. - * _hasMips = Indicates that texture contains full mip-map chain. - * _numLayers = Number of layers in texture array. - * _format = Texture format. See: `TextureFormat::Enum`. - */ - void bgfx_calc_texture_size(bgfx_texture_info_t* _info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format); - - /** - * Create texture from memory buffer. - * Params: - * _mem = DDS, KTX or PVR texture binary data. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - * _skip = Skip top level mips when parsing texture. - * _info = When non-`NULL` is specified it returns parsed texture information. - */ - bgfx_texture_handle_t bgfx_create_texture(const(bgfx_memory_t)* _mem, ulong _flags, ubyte _skip, bgfx_texture_info_t* _info); - - /** - * Create 2D texture. - * Params: - * _width = Width. - * _height = Height. - * _hasMips = Indicates that texture contains full mip-map chain. - * _numLayers = Number of layers in texture array. Must be 1 if caps - * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If - * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than - * 1, expected memory layout is texture and all mips together for each array element. - */ - bgfx_texture_handle_t bgfx_create_texture_2d(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); - - /** - * Create texture with size based on back-buffer ratio. Texture will maintain ratio - * if back buffer resolution changes. - * Params: - * _ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`. - * _hasMips = Indicates that texture contains full mip-map chain. - * _numLayers = Number of layers in texture array. Must be 1 if caps - * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags); - - /** - * Create 3D texture. - * Params: - * _width = Width. - * _height = Height. - * _depth = Depth. - * _hasMips = Indicates that texture contains full mip-map chain. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If - * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than - * 1, expected memory layout is texture and all mips together for each array element. - */ - bgfx_texture_handle_t bgfx_create_texture_3d(ushort _width, ushort _height, ushort _depth, bool _hasMips, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); - - /** - * Create Cube texture. - * Params: - * _size = Cube side size. - * _hasMips = Indicates that texture contains full mip-map chain. - * _numLayers = Number of layers in texture array. Must be 1 if caps - * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If - * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than - * 1, expected memory layout is texture and all mips together for each array element. - */ - bgfx_texture_handle_t bgfx_create_texture_cube(ushort _size, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); - - /** - * Update 2D texture. - * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info. - * Params: - * _handle = Texture handle. - * _layer = Layer in texture array. - * _mip = Mip level. - * _x = X offset in texture. - * _y = Y offset in texture. - * _width = Width of texture block. - * _height = Height of texture block. - * _mem = Texture update data. - * _pitch = Pitch of input image (bytes). When _pitch is set to - * UINT16_MAX, it will be calculated internally based on _width. - */ - void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, ushort _layer, ubyte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch); - - /** - * Update 3D texture. - * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info. - * Params: - * _handle = Texture handle. - * _mip = Mip level. - * _x = X offset in texture. - * _y = Y offset in texture. - * _z = Z offset in texture. - * _width = Width of texture block. - * _height = Height of texture block. - * _depth = Depth of texture block. - * _mem = Texture update data. - */ - void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, ubyte _mip, ushort _x, ushort _y, ushort _z, ushort _width, ushort _height, ushort _depth, const(bgfx_memory_t)* _mem); - - /** - * Update Cube texture. - * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info. - * Params: - * _handle = Texture handle. - * _layer = Layer in texture array. - * _side = Cubemap side `BGFX_CUBE_MAP__`, - * where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z. - * +----------+ - * |-z 2| - * | ^ +y | - * | | | Unfolded cube: - * | +---->+x | - * +----------+----------+----------+----------+ - * |+y 1|+y 4|+y 0|+y 5| - * | ^ -x | ^ +z | ^ +x | ^ -z | - * | | | | | | | | | - * | +---->+z | +---->+x | +---->-z | +---->-x | - * +----------+----------+----------+----------+ - * |+z 3| - * | ^ -y | - * | | | - * | +---->+x | - * +----------+ - * _mip = Mip level. - * _x = X offset in texture. - * _y = Y offset in texture. - * _width = Width of texture block. - * _height = Height of texture block. - * _mem = Texture update data. - * _pitch = Pitch of input image (bytes). When _pitch is set to - * UINT16_MAX, it will be calculated internally based on _width. - */ - void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, ushort _layer, ubyte _side, ubyte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch); - - /** - * Read back texture content. - * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag. - * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`. - * Params: - * _handle = Texture handle. - * _data = Destination buffer. - * _mip = Mip level. - */ - uint bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, ubyte _mip); - - /** - * Set texture debug name. - * Params: - * _handle = Texture handle. - * _name = Texture name. - * _len = Texture name length (if length is INT32_MAX, it's expected - * that _name is zero terminated string. - */ - void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const(char)* _name, int _len); - - /** - * Returns texture direct access pointer. - * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature - * is available on GPUs that have unified memory architecture (UMA) support. - * Params: - * _handle = Texture handle. - */ - void* bgfx_get_direct_access_ptr(bgfx_texture_handle_t _handle); - - /** - * Destroy texture. - * Params: - * _handle = Texture handle. - */ - void bgfx_destroy_texture(bgfx_texture_handle_t _handle); - - /** - * Create frame buffer (simple). - * Params: - * _width = Texture width. - * _height = Texture height. - * _format = Texture format. See: `TextureFormat::Enum`. - * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(ushort _width, ushort _height, bgfx_texture_format_t _format, ulong _textureFlags); - - /** - * Create frame buffer with size based on back-buffer ratio. Frame buffer will maintain ratio - * if back buffer resolution changes. - * Params: - * _ratio = Frame buffer size in respect to back-buffer size. See: - * `BackbufferRatio::Enum`. - * _format = Texture format. See: `TextureFormat::Enum`. - * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, ulong _textureFlags); - - /** - * Create MRT frame buffer from texture handles (simple). - * Params: - * _num = Number of texture handles. - * _handles = Texture attachments. - * _destroyTexture = If true, textures will be destroyed when - * frame buffer is destroyed. - */ - bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(ubyte _num, const(bgfx_texture_handle_t)* _handles, bool _destroyTexture); - - /** - * Create MRT frame buffer from texture handles with specific layer and - * mip level. - * Params: - * _num = Number of attachments. - * _attachment = Attachment texture info. See: `bgfx::Attachment`. - * _destroyTexture = If true, textures will be destroyed when - * frame buffer is destroyed. - */ - bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(ubyte _num, const(bgfx_attachment_t)* _attachment, bool _destroyTexture); - - /** - * Create frame buffer for multiple window rendering. - * Remarks: - * Frame buffer cannot be used for sampling. - * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`. - * Params: - * _nwh = OS' target native window handle. - * _width = Window back buffer width. - * _height = Window back buffer height. - * _format = Window back buffer color format. - * _depthFormat = Window back buffer depth format. - */ - bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, ushort _width, ushort _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat); - - /** - * Set frame buffer debug name. - * Params: - * _handle = Frame buffer handle. - * _name = Frame buffer name. - * _len = Frame buffer name length (if length is INT32_MAX, it's expected - * that _name is zero terminated string. - */ - void bgfx_set_frame_buffer_name(bgfx_frame_buffer_handle_t _handle, const(char)* _name, int _len); - - /** - * Obtain texture handle of frame buffer attachment. - * Params: - * _handle = Frame buffer handle. - */ - bgfx_texture_handle_t bgfx_get_texture(bgfx_frame_buffer_handle_t _handle, ubyte _attachment); - - /** - * Destroy frame buffer. - * Params: - * _handle = Frame buffer handle. - */ - void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle); - - /** - * Create shader uniform parameter. - * Remarks: - * 1. Uniform names are unique. It's valid to call `bgfx::createUniform` - * multiple times with the same uniform name. The library will always - * return the same handle, but the handle reference count will be - * incremented. This means that the same number of `bgfx::destroyUniform` - * must be called to properly destroy the uniform. - * 2. Predefined uniforms (declared in `bgfx_shader.sh`): - * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current - * view, in pixels. - * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse - * width and height - * - `u_view mat4` - view matrix - * - `u_invView mat4` - inverted view matrix - * - `u_proj mat4` - projection matrix - * - `u_invProj mat4` - inverted projection matrix - * - `u_viewProj mat4` - concatenated view projection matrix - * - `u_invViewProj mat4` - concatenated inverted view projection matrix - * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices. - * - `u_modelView mat4` - concatenated model view matrix, only first - * model matrix from array is used. - * - `u_modelViewProj mat4` - concatenated model view projection matrix. - * - `u_alphaRef float` - alpha reference value for alpha test. - * Params: - * _name = Uniform name in shader. - * _type = Type of uniform (See: `bgfx::UniformType`). - * _num = Number of elements in array. - */ - bgfx_uniform_handle_t bgfx_create_uniform(const(char)* _name, bgfx_uniform_type_t _type, ushort _num); - - /** - * Retrieve uniform info. - * Params: - * _handle = Handle to uniform object. - * _info = Uniform info. - */ - void bgfx_get_uniform_info(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t* _info); - - /** - * Destroy shader uniform parameter. - * Params: - * _handle = Handle to uniform object. - */ - void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle); - - /** - * Create occlusion query. - */ - bgfx_occlusion_query_handle_t bgfx_create_occlusion_query(); - - /** - * Retrieve occlusion query result from previous frame. - * Params: - * _handle = Handle to occlusion query object. - * _result = Number of pixels that passed test. This argument - * can be `NULL` if result of occlusion query is not needed. - */ - bgfx_occlusion_query_result_t bgfx_get_result(bgfx_occlusion_query_handle_t _handle, int* _result); - - /** - * Destroy occlusion query. - * Params: - * _handle = Handle to occlusion query object. - */ - void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _handle); - - /** - * Set palette color value. - * Params: - * _index = Index into palette. - * _rgba = RGBA floating point values. - */ - void bgfx_set_palette_color(ubyte _index, const float[4] _rgba); - - /** - * Set palette color value. - * Params: - * _index = Index into palette. - * _rgba = Packed 32-bit RGBA value. - */ - void bgfx_set_palette_color_rgba8(ubyte _index, uint _rgba); - - /** - * Set view name. - * Remarks: - * This is debug only feature. - * In graphics debugger view name will appear as: - * "nnnc " - * ^ ^ ^ - * | +--- compute (C) - * +------ view id - * Params: - * _id = View id. - * _name = View name. - */ - void bgfx_set_view_name(bgfx_view_id_t _id, const(char)* _name); - - /** - * Set view rectangle. Draw primitive outside view will be clipped. - * Params: - * _id = View id. - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _width = Width of view port region. - * _height = Height of view port region. - */ - void bgfx_set_view_rect(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height); - - /** - * Set view rectangle. Draw primitive outside view will be clipped. - * Params: - * _id = View id. - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _ratio = Width and height will be set in respect to back-buffer size. - * See: `BackbufferRatio::Enum`. - */ - void bgfx_set_view_rect_ratio(bgfx_view_id_t _id, ushort _x, ushort _y, bgfx_backbuffer_ratio_t _ratio); - - /** - * Set view scissor. Draw primitive outside view will be clipped. When - * _x, _y, _width and _height are set to 0, scissor will be disabled. - * Params: - * _id = View id. - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _width = Width of view scissor region. - * _height = Height of view scissor region. - */ - void bgfx_set_view_scissor(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height); - - /** - * Set view clear flags. - * Params: - * _id = View id. - * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear - * operation. See: `BGFX_CLEAR_*`. - * _rgba = Color clear value. - * _depth = Depth clear value. - * _stencil = Stencil clear value. - */ - void bgfx_set_view_clear(bgfx_view_id_t _id, ushort _flags, uint _rgba, float _depth, ubyte _stencil); - - /** - * Set view clear flags with different clear color for each - * frame buffer texture. `bgfx::setPaletteColor` must be used to set up a - * clear color palette. - * Params: - * _id = View id. - * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear - * operation. See: `BGFX_CLEAR_*`. - * _depth = Depth clear value. - * _stencil = Stencil clear value. - * _c0 = Palette index for frame buffer attachment 0. - * _c1 = Palette index for frame buffer attachment 1. - * _c2 = Palette index for frame buffer attachment 2. - * _c3 = Palette index for frame buffer attachment 3. - * _c4 = Palette index for frame buffer attachment 4. - * _c5 = Palette index for frame buffer attachment 5. - * _c6 = Palette index for frame buffer attachment 6. - * _c7 = Palette index for frame buffer attachment 7. - */ - void bgfx_set_view_clear_mrt(bgfx_view_id_t _id, ushort _flags, float _depth, ubyte _stencil, ubyte _c0, ubyte _c1, ubyte _c2, ubyte _c3, ubyte _c4, ubyte _c5, ubyte _c6, ubyte _c7); - - /** - * Set view sorting mode. - * Remarks: - * View mode must be set prior calling `bgfx::submit` for the view. - * Params: - * _id = View id. - * _mode = View sort mode. See `ViewMode::Enum`. - */ - void bgfx_set_view_mode(bgfx_view_id_t _id, bgfx_view_mode_t _mode); - - /** - * Set view frame buffer. - * Remarks: - * Not persistent after `bgfx::reset` call. - * Params: - * _id = View id. - * _handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as - * frame buffer handle will draw primitives from this view into - * default back buffer. - */ - void bgfx_set_view_frame_buffer(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle); - - /** - * Set view's view matrix and projection matrix, - * all draw primitives in this view will use these two matrices. - * Params: - * _id = View id. - * _view = View matrix. - * _proj = Projection matrix. - */ - void bgfx_set_view_transform(bgfx_view_id_t _id, const(void)* _view, const(void)* _proj); - - /** - * Post submit view reordering. - * Params: - * _id = First view id. - * _num = Number of views to remap. - * _order = View remap id table. Passing `NULL` will reset view ids - * to default state. - */ - void bgfx_set_view_order(bgfx_view_id_t _id, ushort _num, const(bgfx_view_id_t)* _order); - - /** - * Reset all view settings to default. - */ - void bgfx_reset_view(bgfx_view_id_t _id); - - /** - * Begin submitting draw calls from thread. - * Params: - * _forThread = Explicitly request an encoder for a worker thread. - */ - bgfx_encoder_t* bgfx_encoder_begin(bool _forThread); - - /** - * End submitting draw calls from thread. - * Params: - * _encoder = Encoder. - */ - void bgfx_encoder_end(bgfx_encoder_t* _encoder); - - /** - * Sets a debug marker. This allows you to group graphics calls together for easy browsing in - * graphics debugging tools. - * Params: - * _marker = Marker string. - */ - void bgfx_encoder_set_marker(bgfx_encoder_t* _this, const(char)* _marker); - - /** - * Set render states for draw primitive. - * Remarks: - * 1. To set up more complex states use: - * `BGFX_STATE_ALPHA_REF(_ref)`, - * `BGFX_STATE_POINT_SIZE(_size)`, - * `BGFX_STATE_BLEND_FUNC(_src, _dst)`, - * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, - * `BGFX_STATE_BLEND_EQUATION(_equation)`, - * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` - * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend - * equation is specified. - * Params: - * _state = State flags. Default state for primitive type is - * triangles. See: `BGFX_STATE_DEFAULT`. - * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. - * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. - * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. - * - `BGFX_STATE_CULL_*` - Backface culling mode. - * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. - * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. - * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. - * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and - * `BGFX_STATE_BLEND_INV_FACTOR` blend modes. - */ - void bgfx_encoder_set_state(bgfx_encoder_t* _this, ulong _state, uint _rgba); - - /** - * Set condition for rendering. - * Params: - * _handle = Occlusion query handle. - * _visible = Render if occlusion query is visible. - */ - void bgfx_encoder_set_condition(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible); - - /** - * Set stencil test state. - * Params: - * _fstencil = Front stencil state. - * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE` - * _fstencil is applied to both front and back facing primitives. - */ - void bgfx_encoder_set_stencil(bgfx_encoder_t* _this, uint _fstencil, uint _bstencil); - - /** - * Set scissor for draw primitive. - * Remarks: - * To scissor for all primitives in view see `bgfx::setViewScissor`. - * Params: - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _width = Width of view scissor region. - * _height = Height of view scissor region. - */ - ushort bgfx_encoder_set_scissor(bgfx_encoder_t* _this, ushort _x, ushort _y, ushort _width, ushort _height); - - /** - * Set scissor from cache for draw primitive. - * Remarks: - * To scissor for all primitives in view see `bgfx::setViewScissor`. - * Params: - * _cache = Index in scissor cache. - */ - void bgfx_encoder_set_scissor_cached(bgfx_encoder_t* _this, ushort _cache); - - /** - * Set model matrix for draw primitive. If it is not called, - * the model will be rendered with an identity model matrix. - * Params: - * _mtx = Pointer to first matrix in array. - * _num = Number of matrices in array. - */ - uint bgfx_encoder_set_transform(bgfx_encoder_t* _this, const(void)* _mtx, ushort _num); - - /** - * Set model matrix from matrix cache for draw primitive. - * Params: - * _cache = Index in matrix cache. - * _num = Number of matrices from cache. - */ - void bgfx_encoder_set_transform_cached(bgfx_encoder_t* _this, uint _cache, ushort _num); - - /** - * Reserve matrices in internal matrix cache. - * Attention: Pointer returned can be modified until `bgfx::frame` is called. - * Params: - * _transform = Pointer to `Transform` structure. - * _num = Number of matrices. - */ - uint bgfx_encoder_alloc_transform(bgfx_encoder_t* _this, bgfx_transform_t* _transform, ushort _num); - - /** - * Set shader uniform parameter for draw primitive. - * Params: - * _handle = Uniform. - * _value = Pointer to uniform data. - * _num = Number of elements. Passing `UINT16_MAX` will - * use the _num passed on uniform creation. - */ - void bgfx_encoder_set_uniform(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num); - - /** - * Set index buffer for draw primitive. - * Params: - * _handle = Index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - void bgfx_encoder_set_index_buffer(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); - - /** - * Set index buffer for draw primitive. - * Params: - * _handle = Dynamic index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - void bgfx_encoder_set_dynamic_index_buffer(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); - - /** - * Set index buffer for draw primitive. - * Params: - * _tib = Transient index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_t* _this, const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid - * handle is used, vertex layout used for creation - * of vertex buffer will be used. - */ - void bgfx_encoder_set_vertex_buffer_with_layout(bgfx_encoder_t* _this, ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Dynamic vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); - - void bgfx_encoder_set_dynamic_vertex_buffer_with_layout(bgfx_encoder_t* _this, ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _tvb = Transient vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _tvb = Transient vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid - * handle is used, vertex layout used for creation - * of vertex buffer will be used. - */ - void bgfx_encoder_set_transient_vertex_buffer_with_layout(bgfx_encoder_t* _this, ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - - /** - * Set number of vertices for auto generated vertices use in conjunction - * with gl_VertexID. - * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. - * Params: - * _numVertices = Number of vertices. - */ - void bgfx_encoder_set_vertex_count(bgfx_encoder_t* _this, uint _numVertices); - - /** - * Set instance data buffer for draw primitive. - * Params: - * _idb = Transient instance data buffer. - * _start = First instance data. - * _num = Number of data instances. - */ - void bgfx_encoder_set_instance_data_buffer(bgfx_encoder_t* _this, const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num); - - /** - * Set instance data buffer for draw primitive. - * Params: - * _handle = Vertex buffer. - * _startVertex = First instance data. - * _num = Number of data instances. - * Set instance data buffer for draw primitive. - */ - void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); - - /** - * Set instance data buffer for draw primitive. - * Params: - * _handle = Dynamic vertex buffer. - * _startVertex = First instance data. - * _num = Number of data instances. - */ - void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); - - /** - * Set number of instances for auto generated instances use in conjunction - * with gl_InstanceID. - * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. - */ - void bgfx_encoder_set_instance_count(bgfx_encoder_t* _this, uint _numInstances); - - /** - * Set texture stage for draw primitive. - * Params: - * _stage = Texture unit. - * _sampler = Program sampler. - * _handle = Texture handle. - * _flags = Texture sampling mode. Default value UINT32_MAX uses - * texture sampling settings from the texture. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - void bgfx_encoder_set_texture(bgfx_encoder_t* _this, ubyte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags); - - /** - * Submit an empty primitive for rendering. Uniforms and draw state - * will be applied but no geometry will be submitted. Useful in cases - * when no other draw/compute primitive is submitted to view, but it's - * desired to execute clear view. - * Remarks: - * These empty draw calls will sort before ordinary draw calls. - * Params: - * _id = View id. - */ - void bgfx_encoder_touch(bgfx_encoder_t* _this, bgfx_view_id_t _id); - - /** - * Submit primitive for rendering. - * Params: - * _id = View id. - * _program = Program. - * _depth = Depth for sorting. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, ubyte _flags); - - /** - * Submit primitive with occlusion query for rendering. - * Params: - * _id = View id. - * _program = Program. - * _occlusionQuery = Occlusion query. - * _depth = Depth for sorting. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - void bgfx_encoder_submit_occlusion_query(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, ubyte _flags); - - /** - * Submit primitive for rendering with index and instance data info from - * indirect buffer. - * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`. - * Params: - * _id = View id. - * _program = Program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _num = Number of draws. - * _depth = Depth for sorting. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - void bgfx_encoder_submit_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, ubyte _flags); - - /** - * Submit primitive for rendering with index and instance data info and - * draw count from indirect buffers. - * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`. - * Params: - * _id = View id. - * _program = Program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _numHandle = Buffer for number of draws. Must be - * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`. - * _numIndex = Element in number buffer. - * _numMax = Max number of draws. - * _depth = Depth for sorting. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - void bgfx_encoder_submit_indirect_count(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags); - - /** - * Set compute index buffer. - * Params: - * _stage = Compute stage. - * _handle = Index buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - void bgfx_encoder_set_compute_index_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); - - /** - * Set compute vertex buffer. - * Params: - * _stage = Compute stage. - * _handle = Vertex buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - void bgfx_encoder_set_compute_vertex_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); - - /** - * Set compute dynamic index buffer. - * Params: - * _stage = Compute stage. - * _handle = Dynamic index buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - void bgfx_encoder_set_compute_dynamic_index_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); - - /** - * Set compute dynamic vertex buffer. - * Params: - * _stage = Compute stage. - * _handle = Dynamic vertex buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - void bgfx_encoder_set_compute_dynamic_vertex_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); - - /** - * Set compute indirect buffer. - * Params: - * _stage = Compute stage. - * _handle = Indirect buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder_t* _this, ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); - - /** - * Set compute image from texture. - * Params: - * _stage = Compute stage. - * _handle = Texture handle. - * _mip = Mip level. - * _access = Image access. See `Access::Enum`. - * _format = Texture format. See: `TextureFormat::Enum`. - */ - void bgfx_encoder_set_image(bgfx_encoder_t* _this, ubyte _stage, bgfx_texture_handle_t _handle, ubyte _mip, bgfx_access_t _access, bgfx_texture_format_t _format); - - /** - * Dispatch compute. - * Params: - * _id = View id. - * _program = Compute program. - * _numX = Number of groups X. - * _numY = Number of groups Y. - * _numZ = Number of groups Z. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, ubyte _flags); - - /** - * Dispatch compute indirect. - * Params: - * _id = View id. - * _program = Compute program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _num = Number of dispatches. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, ubyte _flags); - - /** - * Discard previously set state for draw or compute call. - * Params: - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - void bgfx_encoder_discard(bgfx_encoder_t* _this, ubyte _flags); - - /** - * Blit 2D texture region between two 2D textures. - * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. - * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. - * Params: - * _id = View id. - * _dst = Destination texture handle. - * _dstMip = Destination texture mip level. - * _dstX = Destination texture X position. - * _dstY = Destination texture Y position. - * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube - * this argument represents destination texture cube face. For 3D texture this argument - * represents destination texture Z position. - * _src = Source texture handle. - * _srcMip = Source texture mip level. - * _srcX = Source texture X position. - * _srcY = Source texture Y position. - * _srcZ = If texture is 2D this argument should be 0. If source texture is cube - * this argument represents source texture cube face. For 3D texture this argument - * represents source texture Z position. - * _width = Width of region. - * _height = Height of region. - * _depth = If texture is 3D this argument represents depth of region, otherwise it's - * unused. - */ - void bgfx_encoder_blit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, ubyte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, ubyte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth); - - /** - * Request screen shot of window back buffer. - * Remarks: - * `bgfx::CallbackI::screenShot` must be implemented. - * Attention: Frame buffer handle must be created with OS' target native window handle. - * Params: - * _handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be - * made for main window back buffer. - * _filePath = Will be passed to `bgfx::CallbackI::screenShot` callback. - */ - void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const(char)* _filePath); - - /** - * Render frame. - * Attention: `bgfx::renderFrame` is blocking call. It waits for - * `bgfx::frame` to be called from API thread to process frame. - * If timeout value is passed call will timeout and return even - * if `bgfx::frame` is not called. - * Warning: This call should be only used on platforms that don't - * allow creating separate rendering thread. If it is called before - * to bgfx::init, render thread won't be created by bgfx::init call. - * Params: - * _msecs = Timeout in milliseconds. - */ - bgfx_render_frame_t bgfx_render_frame(int _msecs); - - /** - * Set platform data. - * Warning: Must be called before `bgfx::init`. - * Params: - * _data = Platform data. - */ - void bgfx_set_platform_data(const(bgfx_platform_data_t)* _data); - - /** - * Get internal data for interop. - * Attention: It's expected you understand some bgfx internals before you - * use this call. - * Warning: Must be called only on render thread. - */ - const(bgfx_internal_data_t)* bgfx_get_internal_data(); - - /** - * Override internal texture with externally created texture. Previously - * created internal texture will released. - * Attention: It's expected you understand some bgfx internals before you - * use this call. - * Warning: Must be called only on render thread. - * Params: - * _handle = Texture handle. - * _ptr = Native API pointer to texture. - */ - ulong bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, ulong _ptr); - - /** - * Override internal texture by creating new texture. Previously created - * internal texture will released. - * Attention: It's expected you understand some bgfx internals before you - * use this call. - * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the - * main thread. - * Warning: Must be called only on render thread. - * Params: - * _handle = Texture handle. - * _width = Width. - * _height = Height. - * _numMips = Number of mip-maps. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - ulong bgfx_override_internal_texture(bgfx_texture_handle_t _handle, ushort _width, ushort _height, ubyte _numMips, bgfx_texture_format_t _format, ulong _flags); - - /** - * Sets a debug marker. This allows you to group graphics calls together for easy browsing in - * graphics debugging tools. - * Params: - * _marker = Marker string. - */ - void bgfx_set_marker(const(char)* _marker); - - /** - * Set render states for draw primitive. - * Remarks: - * 1. To set up more complex states use: - * `BGFX_STATE_ALPHA_REF(_ref)`, - * `BGFX_STATE_POINT_SIZE(_size)`, - * `BGFX_STATE_BLEND_FUNC(_src, _dst)`, - * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, - * `BGFX_STATE_BLEND_EQUATION(_equation)`, - * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` - * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend - * equation is specified. - * Params: - * _state = State flags. Default state for primitive type is - * triangles. See: `BGFX_STATE_DEFAULT`. - * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. - * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. - * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. - * - `BGFX_STATE_CULL_*` - Backface culling mode. - * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. - * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. - * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. - * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and - * `BGFX_STATE_BLEND_INV_FACTOR` blend modes. - */ - void bgfx_set_state(ulong _state, uint _rgba); - - /** - * Set condition for rendering. - * Params: - * _handle = Occlusion query handle. - * _visible = Render if occlusion query is visible. - */ - void bgfx_set_condition(bgfx_occlusion_query_handle_t _handle, bool _visible); - - /** - * Set stencil test state. - * Params: - * _fstencil = Front stencil state. - * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE` - * _fstencil is applied to both front and back facing primitives. - */ - void bgfx_set_stencil(uint _fstencil, uint _bstencil); - - /** - * Set scissor for draw primitive. - * Remarks: - * To scissor for all primitives in view see `bgfx::setViewScissor`. - * Params: - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _width = Width of view scissor region. - * _height = Height of view scissor region. - */ - ushort bgfx_set_scissor(ushort _x, ushort _y, ushort _width, ushort _height); - - /** - * Set scissor from cache for draw primitive. - * Remarks: - * To scissor for all primitives in view see `bgfx::setViewScissor`. - * Params: - * _cache = Index in scissor cache. - */ - void bgfx_set_scissor_cached(ushort _cache); - - /** - * Set model matrix for draw primitive. If it is not called, - * the model will be rendered with an identity model matrix. - * Params: - * _mtx = Pointer to first matrix in array. - * _num = Number of matrices in array. - */ - uint bgfx_set_transform(const(void)* _mtx, ushort _num); - - /** - * Set model matrix from matrix cache for draw primitive. - * Params: - * _cache = Index in matrix cache. - * _num = Number of matrices from cache. - */ - void bgfx_set_transform_cached(uint _cache, ushort _num); - - /** - * Reserve matrices in internal matrix cache. - * Attention: Pointer returned can be modified until `bgfx::frame` is called. - * Params: - * _transform = Pointer to `Transform` structure. - * _num = Number of matrices. - */ - uint bgfx_alloc_transform(bgfx_transform_t* _transform, ushort _num); - - /** - * Set shader uniform parameter for draw primitive. - * Params: - * _handle = Uniform. - * _value = Pointer to uniform data. - * _num = Number of elements. Passing `UINT16_MAX` will - * use the _num passed on uniform creation. - */ - void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num); - - /** - * Set index buffer for draw primitive. - * Params: - * _handle = Index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); - - /** - * Set index buffer for draw primitive. - * Params: - * _handle = Dynamic index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); - - /** - * Set index buffer for draw primitive. - * Params: - * _tib = Transient index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - void bgfx_set_transient_index_buffer(const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - void bgfx_set_vertex_buffer(ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid - * handle is used, vertex layout used for creation - * of vertex buffer will be used. - */ - void bgfx_set_vertex_buffer_with_layout(ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Dynamic vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - void bgfx_set_dynamic_vertex_buffer(ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Dynamic vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid - * handle is used, vertex layout used for creation - * of vertex buffer will be used. - */ - void bgfx_set_dynamic_vertex_buffer_with_layout(ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _tvb = Transient vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - void bgfx_set_transient_vertex_buffer(ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices); - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _tvb = Transient vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid - * handle is used, vertex layout used for creation - * of vertex buffer will be used. - */ - void bgfx_set_transient_vertex_buffer_with_layout(ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - - /** - * Set number of vertices for auto generated vertices use in conjunction - * with gl_VertexID. - * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. - * Params: - * _numVertices = Number of vertices. - */ - void bgfx_set_vertex_count(uint _numVertices); - - /** - * Set instance data buffer for draw primitive. - * Params: - * _idb = Transient instance data buffer. - * _start = First instance data. - * _num = Number of data instances. - */ - void bgfx_set_instance_data_buffer(const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num); - - /** - * Set instance data buffer for draw primitive. - * Params: - * _handle = Vertex buffer. - * _startVertex = First instance data. - * _num = Number of data instances. - * Set instance data buffer for draw primitive. - */ - void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); - - /** - * Set instance data buffer for draw primitive. - * Params: - * _handle = Dynamic vertex buffer. - * _startVertex = First instance data. - * _num = Number of data instances. - */ - void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); - - /** - * Set number of instances for auto generated instances use in conjunction - * with gl_InstanceID. - * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. - */ - void bgfx_set_instance_count(uint _numInstances); - - /** - * Set texture stage for draw primitive. - * Params: - * _stage = Texture unit. - * _sampler = Program sampler. - * _handle = Texture handle. - * _flags = Texture sampling mode. Default value UINT32_MAX uses - * texture sampling settings from the texture. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - void bgfx_set_texture(ubyte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags); - - /** - * Submit an empty primitive for rendering. Uniforms and draw state - * will be applied but no geometry will be submitted. - * Remarks: - * These empty draw calls will sort before ordinary draw calls. - * Params: - * _id = View id. - */ - void bgfx_touch(bgfx_view_id_t _id); - - /** - * Submit primitive for rendering. - * Params: - * _id = View id. - * _program = Program. - * _depth = Depth for sorting. - * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. - */ - void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, ubyte _flags); - - /** - * Submit primitive with occlusion query for rendering. - * Params: - * _id = View id. - * _program = Program. - * _occlusionQuery = Occlusion query. - * _depth = Depth for sorting. - * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. - */ - void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, ubyte _flags); - - /** - * Submit primitive for rendering with index and instance data info from - * indirect buffer. - * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`. - * Params: - * _id = View id. - * _program = Program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _num = Number of draws. - * _depth = Depth for sorting. - * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. - */ - void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, ubyte _flags); - - /** - * Submit primitive for rendering with index and instance data info and - * draw count from indirect buffers. - * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`. - * Params: - * _id = View id. - * _program = Program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _numHandle = Buffer for number of draws. Must be - * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`. - * _numIndex = Element in number buffer. - * _numMax = Max number of draws. - * _depth = Depth for sorting. - * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. - */ - void bgfx_submit_indirect_count(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags); - - /** - * Set compute index buffer. - * Params: - * _stage = Compute stage. - * _handle = Index buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - void bgfx_set_compute_index_buffer(ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); - - /** - * Set compute vertex buffer. - * Params: - * _stage = Compute stage. - * _handle = Vertex buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - void bgfx_set_compute_vertex_buffer(ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); - - /** - * Set compute dynamic index buffer. - * Params: - * _stage = Compute stage. - * _handle = Dynamic index buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - void bgfx_set_compute_dynamic_index_buffer(ubyte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); - - /** - * Set compute dynamic vertex buffer. - * Params: - * _stage = Compute stage. - * _handle = Dynamic vertex buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - void bgfx_set_compute_dynamic_vertex_buffer(ubyte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); - - /** - * Set compute indirect buffer. - * Params: - * _stage = Compute stage. - * _handle = Indirect buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - void bgfx_set_compute_indirect_buffer(ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); - - /** - * Set compute image from texture. - * Params: - * _stage = Compute stage. - * _handle = Texture handle. - * _mip = Mip level. - * _access = Image access. See `Access::Enum`. - * _format = Texture format. See: `TextureFormat::Enum`. - */ - void bgfx_set_image(ubyte _stage, bgfx_texture_handle_t _handle, ubyte _mip, bgfx_access_t _access, bgfx_texture_format_t _format); - - /** - * Dispatch compute. - * Params: - * _id = View id. - * _program = Compute program. - * _numX = Number of groups X. - * _numY = Number of groups Y. - * _numZ = Number of groups Z. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, ubyte _flags); - - /** - * Dispatch compute indirect. - * Params: - * _id = View id. - * _program = Compute program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _num = Number of dispatches. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, ubyte _flags); - - /** - * Discard previously set state for draw or compute call. - * Params: - * _flags = Draw/compute states to discard. - */ - void bgfx_discard(ubyte _flags); - - /** - * Blit 2D texture region between two 2D textures. - * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. - * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. - * Params: - * _id = View id. - * _dst = Destination texture handle. - * _dstMip = Destination texture mip level. - * _dstX = Destination texture X position. - * _dstY = Destination texture Y position. - * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube - * this argument represents destination texture cube face. For 3D texture this argument - * represents destination texture Z position. - * _src = Source texture handle. - * _srcMip = Source texture mip level. - * _srcX = Source texture X position. - * _srcY = Source texture Y position. - * _srcZ = If texture is 2D this argument should be 0. If source texture is cube - * this argument represents source texture cube face. For 3D texture this argument - * represents source texture Z position. - * _width = Width of region. - * _height = Height of region. - * _depth = If texture is 3D this argument represents depth of region, otherwise it's - * unused. - */ - void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, ubyte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, ubyte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth); - -} -else -{ - __gshared - { - /** - * Init attachment. - * Params: - * _handle = Render target texture handle. - * _access = Access. See `Access::Enum`. - * _layer = Cubemap side or depth layer/slice to use. - * _numLayers = Number of texture layer/slice(s) in array to use. - * _mip = Mip level. - * _resolve = Resolve flags. See: `BGFX_RESOLVE_*` - */ - alias da_bgfx_attachment_init = void function(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, ushort _layer, ushort _numLayers, ushort _mip, ubyte _resolve); - da_bgfx_attachment_init bgfx_attachment_init; - - /** - * Start VertexLayout. - * Params: - * _rendererType = Renderer backend type. See: `bgfx::RendererType` - */ - alias da_bgfx_vertex_layout_begin = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType); - da_bgfx_vertex_layout_begin bgfx_vertex_layout_begin; - - /** - * Add attribute to VertexLayout. - * Remarks: Must be called between begin/end. - * Params: - * _attrib = Attribute semantics. See: `bgfx::Attrib` - * _num = Number of elements 1, 2, 3 or 4. - * _type = Element type. - * _normalized = When using fixed point AttribType (f.e. Uint8) - * value will be normalized for vertex shader usage. When normalized - * is set to true, AttribType::Uint8 value in range 0-255 will be - * in range 0.0-1.0 in vertex shader. - * _asInt = Packaging rule for vertexPack, vertexUnpack, and - * vertexConvert for AttribType::Uint8 and AttribType::Int16. - * Unpacking code must be implemented inside vertex shader. - */ - alias da_bgfx_vertex_layout_add = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, ubyte _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); - da_bgfx_vertex_layout_add bgfx_vertex_layout_add; - - /** - * Decode attribute. - * Params: - * _attrib = Attribute semantics. See: `bgfx::Attrib` - * _num = Number of elements. - * _type = Element type. - * _normalized = Attribute is normalized. - * _asInt = Attribute is packed as int. - */ - alias da_bgfx_vertex_layout_decode = void function(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib, ubyte* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt); - da_bgfx_vertex_layout_decode bgfx_vertex_layout_decode; - - /** - * Returns `true` if VertexLayout contains attribute. - * Params: - * _attrib = Attribute semantics. See: `bgfx::Attrib` - */ - alias da_bgfx_vertex_layout_has = bool function(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib); - da_bgfx_vertex_layout_has bgfx_vertex_layout_has; - - /** - * Skip `_num` bytes in vertex stream. - * Params: - * _num = Number of bytes to skip. - */ - alias da_bgfx_vertex_layout_skip = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, ubyte _num); - da_bgfx_vertex_layout_skip bgfx_vertex_layout_skip; - - /** - * End VertexLayout. - */ - alias da_bgfx_vertex_layout_end = void function(bgfx_vertex_layout_t* _this); - da_bgfx_vertex_layout_end bgfx_vertex_layout_end; - - /** - * Pack vertex attribute into vertex stream format. - * Params: - * _input = Value to be packed into vertex stream. - * _inputNormalized = `true` if input value is already normalized. - * _attr = Attribute to pack. - * _layout = Vertex stream layout. - * _data = Destination vertex stream where data will be packed. - * _index = Vertex index that will be modified. - */ - alias da_bgfx_vertex_pack = void function(const float[4] _input, bool _inputNormalized, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, void* _data, uint _index); - da_bgfx_vertex_pack bgfx_vertex_pack; - - /** - * Unpack vertex attribute from vertex stream format. - * Params: - * _output = Result of unpacking. - * _attr = Attribute to unpack. - * _layout = Vertex stream layout. - * _data = Source vertex stream from where data will be unpacked. - * _index = Vertex index that will be unpacked. - */ - alias da_bgfx_vertex_unpack = void function(float[4] _output, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _index); - da_bgfx_vertex_unpack bgfx_vertex_unpack; - - /** - * Converts vertex stream data from one vertex stream format to another. - * Params: - * _dstLayout = Destination vertex stream layout. - * _dstData = Destination vertex stream. - * _srcLayout = Source vertex stream layout. - * _srcData = Source vertex stream data. - * _num = Number of vertices to convert from source to destination. - */ - alias da_bgfx_vertex_convert = void function(const(bgfx_vertex_layout_t)* _dstLayout, void* _dstData, const(bgfx_vertex_layout_t)* _srcLayout, const(void)* _srcData, uint _num); - da_bgfx_vertex_convert bgfx_vertex_convert; - - /** - * Weld vertices. - * Params: - * _output = Welded vertices remapping table. The size of buffer - * must be the same as number of vertices. - * _layout = Vertex stream layout. - * _data = Vertex stream. - * _num = Number of vertices in vertex stream. - * _index32 = Set to `true` if input indices are 32-bit. - * _epsilon = Error tolerance for vertex position comparison. - */ - alias da_bgfx_weld_vertices = uint function(void* _output, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _num, bool _index32, float _epsilon); - da_bgfx_weld_vertices bgfx_weld_vertices; - - /** - * Convert index buffer for use with different primitive topologies. - * Params: - * _conversion = Conversion type, see `TopologyConvert::Enum`. - * _dst = Destination index buffer. If this argument is NULL - * function will return number of indices after conversion. - * _dstSize = Destination index buffer in bytes. It must be - * large enough to contain output indices. If destination size is - * insufficient index buffer will be truncated. - * _indices = Source indices. - * _numIndices = Number of input indices. - * _index32 = Set to `true` if input indices are 32-bit. - */ - alias da_bgfx_topology_convert = uint function(bgfx_topology_convert_t _conversion, void* _dst, uint _dstSize, const(void)* _indices, uint _numIndices, bool _index32); - da_bgfx_topology_convert bgfx_topology_convert; - - /** - * Sort indices. - * Params: - * _sort = Sort order, see `TopologySort::Enum`. - * _dst = Destination index buffer. - * _dstSize = Destination index buffer in bytes. It must be - * large enough to contain output indices. If destination size is - * insufficient index buffer will be truncated. - * _dir = Direction (vector must be normalized). - * _pos = Position. - * _vertices = Pointer to first vertex represented as - * float x, y, z. Must contain at least number of vertices - * referencende by index buffer. - * _stride = Vertex stride. - * _indices = Source indices. - * _numIndices = Number of input indices. - * _index32 = Set to `true` if input indices are 32-bit. - */ - alias da_bgfx_topology_sort_tri_list = void function(bgfx_topology_sort_t _sort, void* _dst, uint _dstSize, const float[3] _dir, const float[3] _pos, const(void)* _vertices, uint _stride, const(void)* _indices, uint _numIndices, bool _index32); - da_bgfx_topology_sort_tri_list bgfx_topology_sort_tri_list; - - /** - * Returns supported backend API renderers. - * Params: - * _max = Maximum number of elements in _enum array. - * _enum = Array where supported renderers will be written. - */ - alias da_bgfx_get_supported_renderers = ubyte function(ubyte _max, bgfx_renderer_type_t* _enum); - da_bgfx_get_supported_renderers bgfx_get_supported_renderers; - - /** - * Returns name of renderer. - * Params: - * _type = Renderer backend type. See: `bgfx::RendererType` - */ - alias da_bgfx_get_renderer_name = const(char)* function(bgfx_renderer_type_t _type); - da_bgfx_get_renderer_name bgfx_get_renderer_name; - - alias da_bgfx_init_ctor = void function(bgfx_init_t* _init); - da_bgfx_init_ctor bgfx_init_ctor; - - /** - * Initialize the bgfx library. - * Params: - * _init = Initialization parameters. See: `bgfx::Init` for more info. - */ - alias da_bgfx_init = bool function(const(bgfx_init_t)* _init); - da_bgfx_init bgfx_init; - - /** - * Shutdown bgfx library. - */ - alias da_bgfx_shutdown = void function(); - da_bgfx_shutdown bgfx_shutdown; - - /** - * Reset graphic settings and back-buffer size. - * Attention: This call doesn’t change the window size, it just resizes - * the back-buffer. Your windowing code controls the window size. - * Params: - * _width = Back-buffer width. - * _height = Back-buffer height. - * _flags = See: `BGFX_RESET_*` for more info. - * - `BGFX_RESET_NONE` - No reset flags. - * - `BGFX_RESET_FULLSCREEN` - Not supported yet. - * - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA. - * - `BGFX_RESET_VSYNC` - Enable V-Sync. - * - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy. - * - `BGFX_RESET_CAPTURE` - Begin screen capture. - * - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU. - * - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip - * occurs. Default behaviour is that flip occurs before rendering new - * frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. - * - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB back-buffer. - * _format = Texture format. See: `TextureFormat::Enum`. - */ - alias da_bgfx_reset = void function(uint _width, uint _height, uint _flags, bgfx_texture_format_t _format); - da_bgfx_reset bgfx_reset; - - /** - * Advance to next frame. When using multithreaded renderer, this call - * just swaps internal buffers, kicks render thread, and returns. In - * singlethreaded renderer this call does frame rendering. - * Params: - * _capture = Capture frame with graphics debugger. - */ - alias da_bgfx_frame = uint function(bool _capture); - da_bgfx_frame bgfx_frame; - - /** - * Returns current renderer backend API type. - * Remarks: - * Library must be initialized. - */ - alias da_bgfx_get_renderer_type = bgfx_renderer_type_t function(); - da_bgfx_get_renderer_type bgfx_get_renderer_type; - - /** - * Returns renderer capabilities. - * Remarks: - * Library must be initialized. - */ - alias da_bgfx_get_caps = const(bgfx_caps_t)* function(); - da_bgfx_get_caps bgfx_get_caps; - - /** - * Returns performance counters. - * Attention: Pointer returned is valid until `bgfx::frame` is called. - */ - alias da_bgfx_get_stats = const(bgfx_stats_t)* function(); - da_bgfx_get_stats bgfx_get_stats; - - /** - * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx. - * Params: - * _size = Size to allocate. - */ - alias da_bgfx_alloc = const(bgfx_memory_t)* function(uint _size); - da_bgfx_alloc bgfx_alloc; - - /** - * Allocate buffer and copy data into it. Data will be freed inside bgfx. - * Params: - * _data = Pointer to data to be copied. - * _size = Size of data to be copied. - */ - alias da_bgfx_copy = const(bgfx_memory_t)* function(const(void)* _data, uint _size); - da_bgfx_copy bgfx_copy; - - /** - * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call - * doesn't allocate memory for data. It just copies the _data pointer. You - * can pass `ReleaseFn` function pointer to release this memory after it's - * consumed, otherwise you must make sure _data is available for at least 2 - * `bgfx::frame` calls. `ReleaseFn` function must be able to be called - * from any thread. - * Attention: Data passed must be available for at least 2 `bgfx::frame` calls. - * Params: - * _data = Pointer to data. - * _size = Size of data. - */ - alias da_bgfx_make_ref = const(bgfx_memory_t)* function(const(void)* _data, uint _size); - da_bgfx_make_ref bgfx_make_ref; - - /** - * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call - * doesn't allocate memory for data. It just copies the _data pointer. You - * can pass `ReleaseFn` function pointer to release this memory after it's - * consumed, otherwise you must make sure _data is available for at least 2 - * `bgfx::frame` calls. `ReleaseFn` function must be able to be called - * from any thread. - * Attention: Data passed must be available for at least 2 `bgfx::frame` calls. - * Params: - * _data = Pointer to data. - * _size = Size of data. - * _releaseFn = Callback function to release memory after use. - * _userData = User data to be passed to callback function. - */ - alias da_bgfx_make_ref_release = const(bgfx_memory_t)* function(const(void)* _data, uint _size, void* _releaseFn, void* _userData); - da_bgfx_make_ref_release bgfx_make_ref_release; - - /** - * Set debug flags. - * Params: - * _debug = Available flags: - * - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set - * all rendering calls will be skipped. This is useful when profiling - * to quickly assess potential bottlenecks between CPU and GPU. - * - `BGFX_DEBUG_PROFILER` - Enable profiler. - * - `BGFX_DEBUG_STATS` - Display internal statistics. - * - `BGFX_DEBUG_TEXT` - Display debug text. - * - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering - * primitives will be rendered as lines. - */ - alias da_bgfx_set_debug = void function(uint _debug); - da_bgfx_set_debug bgfx_set_debug; - - /** - * Clear internal debug text buffer. - * Params: - * _attr = Background color. - * _small = Default 8x16 or 8x8 font. - */ - alias da_bgfx_dbg_text_clear = void function(ubyte _attr, bool _small); - da_bgfx_dbg_text_clear bgfx_dbg_text_clear; - - /** - * Print formatted data to internal debug text character-buffer (VGA-compatible text mode). - * Params: - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _attr = Color palette. Where top 4-bits represent index of background, and bottom - * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). - * _format = `printf` style format. - */ - alias da_bgfx_dbg_text_printf = void function(ushort _x, ushort _y, ubyte _attr, const(char)* _format, ... ); - da_bgfx_dbg_text_printf bgfx_dbg_text_printf; - - /** - * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode). - * Params: - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _attr = Color palette. Where top 4-bits represent index of background, and bottom - * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). - * _format = `printf` style format. - * _argList = Variable arguments list for format string. - */ - alias da_bgfx_dbg_text_vprintf = void function(ushort _x, ushort _y, ubyte _attr, const(char)* _format, va_list _argList); - da_bgfx_dbg_text_vprintf bgfx_dbg_text_vprintf; - - /** - * Draw image into internal debug text buffer. - * Params: - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _width = Image width. - * _height = Image height. - * _data = Raw image data (character/attribute raw encoding). - * _pitch = Image pitch in bytes. - */ - alias da_bgfx_dbg_text_image = void function(ushort _x, ushort _y, ushort _width, ushort _height, const(void)* _data, ushort _pitch); - da_bgfx_dbg_text_image bgfx_dbg_text_image; - - /** - * Create static index buffer. - * Params: - * _mem = Index buffer data. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic - * buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on - * index buffers. - */ - alias da_bgfx_create_index_buffer = bgfx_index_buffer_handle_t function(const(bgfx_memory_t)* _mem, ushort _flags); - da_bgfx_create_index_buffer bgfx_create_index_buffer; - - /** - * Set static index buffer debug name. - * Params: - * _handle = Static index buffer handle. - * _name = Static index buffer name. - * _len = Static index buffer name length (if length is INT32_MAX, it's expected - * that _name is zero terminated string. - */ - alias da_bgfx_set_index_buffer_name = void function(bgfx_index_buffer_handle_t _handle, const(char)* _name, int _len); - da_bgfx_set_index_buffer_name bgfx_set_index_buffer_name; - - /** - * Destroy static index buffer. - * Params: - * _handle = Static index buffer handle. - */ - alias da_bgfx_destroy_index_buffer = void function(bgfx_index_buffer_handle_t _handle); - da_bgfx_destroy_index_buffer bgfx_destroy_index_buffer; - - /** - * Create vertex layout. - * Params: - * _layout = Vertex layout. - */ - alias da_bgfx_create_vertex_layout = bgfx_vertex_layout_handle_t function(const(bgfx_vertex_layout_t)* _layout); - da_bgfx_create_vertex_layout bgfx_create_vertex_layout; - - /** - * Destroy vertex layout. - * Params: - * _layoutHandle = Vertex layout handle. - */ - alias da_bgfx_destroy_vertex_layout = void function(bgfx_vertex_layout_handle_t _layoutHandle); - da_bgfx_destroy_vertex_layout bgfx_destroy_vertex_layout; - - /** - * Create static vertex buffer. - * Params: - * _mem = Vertex buffer data. - * _layout = Vertex layout. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers. - */ - alias da_bgfx_create_vertex_buffer = bgfx_vertex_buffer_handle_t function(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags); - da_bgfx_create_vertex_buffer bgfx_create_vertex_buffer; - - /** - * Set static vertex buffer debug name. - * Params: - * _handle = Static vertex buffer handle. - * _name = Static vertex buffer name. - * _len = Static vertex buffer name length (if length is INT32_MAX, it's expected - * that _name is zero terminated string. - */ - alias da_bgfx_set_vertex_buffer_name = void function(bgfx_vertex_buffer_handle_t _handle, const(char)* _name, int _len); - da_bgfx_set_vertex_buffer_name bgfx_set_vertex_buffer_name; - - /** - * Destroy static vertex buffer. - * Params: - * _handle = Static vertex buffer handle. - */ - alias da_bgfx_destroy_vertex_buffer = void function(bgfx_vertex_buffer_handle_t _handle); - da_bgfx_destroy_vertex_buffer bgfx_destroy_vertex_buffer; - - /** - * Create empty dynamic index buffer. - * Params: - * _num = Number of indices. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic - * buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on - * index buffers. - */ - alias da_bgfx_create_dynamic_index_buffer = bgfx_dynamic_index_buffer_handle_t function(uint _num, ushort _flags); - da_bgfx_create_dynamic_index_buffer bgfx_create_dynamic_index_buffer; - - /** - * Create a dynamic index buffer and initialize it. - * Params: - * _mem = Index buffer data. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic - * buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on - * index buffers. - */ - alias da_bgfx_create_dynamic_index_buffer_mem = bgfx_dynamic_index_buffer_handle_t function(const(bgfx_memory_t)* _mem, ushort _flags); - da_bgfx_create_dynamic_index_buffer_mem bgfx_create_dynamic_index_buffer_mem; - - /** - * Update dynamic index buffer. - * Params: - * _handle = Dynamic index buffer handle. - * _startIndex = Start index. - * _mem = Index buffer data. - */ - alias da_bgfx_update_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle, uint _startIndex, const(bgfx_memory_t)* _mem); - da_bgfx_update_dynamic_index_buffer bgfx_update_dynamic_index_buffer; - - /** - * Destroy dynamic index buffer. - * Params: - * _handle = Dynamic index buffer handle. - */ - alias da_bgfx_destroy_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle); - da_bgfx_destroy_dynamic_index_buffer bgfx_destroy_dynamic_index_buffer; - - /** - * Create empty dynamic vertex buffer. - * Params: - * _num = Number of vertices. - * _layout = Vertex layout. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic - * buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on - * index buffers. - */ - alias da_bgfx_create_dynamic_vertex_buffer = bgfx_dynamic_vertex_buffer_handle_t function(uint _num, const(bgfx_vertex_layout_t)* _layout, ushort _flags); - da_bgfx_create_dynamic_vertex_buffer bgfx_create_dynamic_vertex_buffer; - - /** - * Create dynamic vertex buffer and initialize it. - * Params: - * _mem = Vertex buffer data. - * _layout = Vertex layout. - * _flags = Buffer creation flags. - * - `BGFX_BUFFER_NONE` - No flags. - * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer - * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of - * data is passed. If this flag is not specified, and more data is passed on update, the buffer - * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic - * buffers. - * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on - * index buffers. - */ - alias da_bgfx_create_dynamic_vertex_buffer_mem = bgfx_dynamic_vertex_buffer_handle_t function(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags); - da_bgfx_create_dynamic_vertex_buffer_mem bgfx_create_dynamic_vertex_buffer_mem; - - /** - * Update dynamic vertex buffer. - * Params: - * _handle = Dynamic vertex buffer handle. - * _startVertex = Start vertex. - * _mem = Vertex buffer data. - */ - alias da_bgfx_update_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, const(bgfx_memory_t)* _mem); - da_bgfx_update_dynamic_vertex_buffer bgfx_update_dynamic_vertex_buffer; - - /** - * Destroy dynamic vertex buffer. - * Params: - * _handle = Dynamic vertex buffer handle. - */ - alias da_bgfx_destroy_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle); - da_bgfx_destroy_dynamic_vertex_buffer bgfx_destroy_dynamic_vertex_buffer; - - /** - * Returns number of requested or maximum available indices. - * Params: - * _num = Number of required indices. - * _index32 = Set to `true` if input indices will be 32-bit. - */ - alias da_bgfx_get_avail_transient_index_buffer = uint function(uint _num, bool _index32); - da_bgfx_get_avail_transient_index_buffer bgfx_get_avail_transient_index_buffer; - - /** - * Returns number of requested or maximum available vertices. - * Params: - * _num = Number of required vertices. - * _layout = Vertex layout. - */ - alias da_bgfx_get_avail_transient_vertex_buffer = uint function(uint _num, const(bgfx_vertex_layout_t)* _layout); - da_bgfx_get_avail_transient_vertex_buffer bgfx_get_avail_transient_vertex_buffer; - - /** - * Returns number of requested or maximum available instance buffer slots. - * Params: - * _num = Number of required instances. - * _stride = Stride per instance. - */ - alias da_bgfx_get_avail_instance_data_buffer = uint function(uint _num, ushort _stride); - da_bgfx_get_avail_instance_data_buffer bgfx_get_avail_instance_data_buffer; - - /** - * Allocate transient index buffer. - * Params: - * _tib = TransientIndexBuffer structure will be filled, and will be valid - * for the duration of frame, and can be reused for multiple draw - * calls. - * _num = Number of indices to allocate. - * _index32 = Set to `true` if input indices will be 32-bit. - */ - alias da_bgfx_alloc_transient_index_buffer = void function(bgfx_transient_index_buffer_t* _tib, uint _num, bool _index32); - da_bgfx_alloc_transient_index_buffer bgfx_alloc_transient_index_buffer; - - /** - * Allocate transient vertex buffer. - * Params: - * _tvb = TransientVertexBuffer structure will be filled, and will be valid - * for the duration of frame, and can be reused for multiple draw - * calls. - * _num = Number of vertices to allocate. - * _layout = Vertex layout. - */ - alias da_bgfx_alloc_transient_vertex_buffer = void function(bgfx_transient_vertex_buffer_t* _tvb, uint _num, const(bgfx_vertex_layout_t)* _layout); - da_bgfx_alloc_transient_vertex_buffer bgfx_alloc_transient_vertex_buffer; - - /** - * Check for required space and allocate transient vertex and index - * buffers. If both space requirements are satisfied function returns - * true. - * Params: - * _tvb = TransientVertexBuffer structure will be filled, and will be valid - * for the duration of frame, and can be reused for multiple draw - * calls. - * _layout = Vertex layout. - * _numVertices = Number of vertices to allocate. - * _tib = TransientIndexBuffer structure will be filled, and will be valid - * for the duration of frame, and can be reused for multiple draw - * calls. - * _numIndices = Number of indices to allocate. - * _index32 = Set to `true` if input indices will be 32-bit. - */ - alias da_bgfx_alloc_transient_buffers = bool function(bgfx_transient_vertex_buffer_t* _tvb, const(bgfx_vertex_layout_t)* _layout, uint _numVertices, bgfx_transient_index_buffer_t* _tib, uint _numIndices, bool _index32); - da_bgfx_alloc_transient_buffers bgfx_alloc_transient_buffers; - - /** - * Allocate instance data buffer. - * Params: - * _idb = InstanceDataBuffer structure will be filled, and will be valid - * for duration of frame, and can be reused for multiple draw - * calls. - * _num = Number of instances. - * _stride = Instance stride. Must be multiple of 16. - */ - alias da_bgfx_alloc_instance_data_buffer = void function(bgfx_instance_data_buffer_t* _idb, uint _num, ushort _stride); - da_bgfx_alloc_instance_data_buffer bgfx_alloc_instance_data_buffer; - - /** - * Create draw indirect buffer. - * Params: - * _num = Number of indirect calls. - */ - alias da_bgfx_create_indirect_buffer = bgfx_indirect_buffer_handle_t function(uint _num); - da_bgfx_create_indirect_buffer bgfx_create_indirect_buffer; - - /** - * Destroy draw indirect buffer. - * Params: - * _handle = Indirect buffer handle. - */ - alias da_bgfx_destroy_indirect_buffer = void function(bgfx_indirect_buffer_handle_t _handle); - da_bgfx_destroy_indirect_buffer bgfx_destroy_indirect_buffer; - - /** - * Create shader from memory buffer. - * Params: - * _mem = Shader binary. - */ - alias da_bgfx_create_shader = bgfx_shader_handle_t function(const(bgfx_memory_t)* _mem); - da_bgfx_create_shader bgfx_create_shader; - - /** - * Returns the number of uniforms and uniform handles used inside a shader. - * Remarks: - * Only non-predefined uniforms are returned. - * Params: - * _handle = Shader handle. - * _uniforms = UniformHandle array where data will be stored. - * _max = Maximum capacity of array. - */ - alias da_bgfx_get_shader_uniforms = ushort function(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, ushort _max); - da_bgfx_get_shader_uniforms bgfx_get_shader_uniforms; - - /** - * Set shader debug name. - * Params: - * _handle = Shader handle. - * _name = Shader name. - * _len = Shader name length (if length is INT32_MAX, it's expected - * that _name is zero terminated string). - */ - alias da_bgfx_set_shader_name = void function(bgfx_shader_handle_t _handle, const(char)* _name, int _len); - da_bgfx_set_shader_name bgfx_set_shader_name; - - /** - * Destroy shader. - * Remarks: Once a shader program is created with _handle, - * it is safe to destroy that shader. - * Params: - * _handle = Shader handle. - */ - alias da_bgfx_destroy_shader = void function(bgfx_shader_handle_t _handle); - da_bgfx_destroy_shader bgfx_destroy_shader; - - /** - * Create program with vertex and fragment shaders. - * Params: - * _vsh = Vertex shader. - * _fsh = Fragment shader. - * _destroyShaders = If true, shaders will be destroyed when program is destroyed. - */ - alias da_bgfx_create_program = bgfx_program_handle_t function(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders); - da_bgfx_create_program bgfx_create_program; - - /** - * Create program with compute shader. - * Params: - * _csh = Compute shader. - * _destroyShaders = If true, shaders will be destroyed when program is destroyed. - */ - alias da_bgfx_create_compute_program = bgfx_program_handle_t function(bgfx_shader_handle_t _csh, bool _destroyShaders); - da_bgfx_create_compute_program bgfx_create_compute_program; - - /** - * Destroy program. - * Params: - * _handle = Program handle. - */ - alias da_bgfx_destroy_program = void function(bgfx_program_handle_t _handle); - da_bgfx_destroy_program bgfx_destroy_program; - - /** - * Validate texture parameters. - * Params: - * _depth = Depth dimension of volume texture. - * _cubeMap = Indicates that texture contains cubemap. - * _numLayers = Number of layers in texture array. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture flags. See `BGFX_TEXTURE_*`. - */ - alias da_bgfx_is_texture_valid = bool function(ushort _depth, bool _cubeMap, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags); - da_bgfx_is_texture_valid bgfx_is_texture_valid; - - /** - * Validate frame buffer parameters. - * Params: - * _num = Number of attachments. - * _attachment = Attachment texture info. See: `bgfx::Attachment`. - */ - alias da_bgfx_is_frame_buffer_valid = bool function(ubyte _num, const(bgfx_attachment_t)* _attachment); - da_bgfx_is_frame_buffer_valid bgfx_is_frame_buffer_valid; - - /** - * Calculate amount of memory required for texture. - * Params: - * _info = Resulting texture info structure. See: `TextureInfo`. - * _width = Width. - * _height = Height. - * _depth = Depth dimension of volume texture. - * _cubeMap = Indicates that texture contains cubemap. - * _hasMips = Indicates that texture contains full mip-map chain. - * _numLayers = Number of layers in texture array. - * _format = Texture format. See: `TextureFormat::Enum`. - */ - alias da_bgfx_calc_texture_size = void function(bgfx_texture_info_t* _info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format); - da_bgfx_calc_texture_size bgfx_calc_texture_size; - - /** - * Create texture from memory buffer. - * Params: - * _mem = DDS, KTX or PVR texture binary data. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - * _skip = Skip top level mips when parsing texture. - * _info = When non-`NULL` is specified it returns parsed texture information. - */ - alias da_bgfx_create_texture = bgfx_texture_handle_t function(const(bgfx_memory_t)* _mem, ulong _flags, ubyte _skip, bgfx_texture_info_t* _info); - da_bgfx_create_texture bgfx_create_texture; - - /** - * Create 2D texture. - * Params: - * _width = Width. - * _height = Height. - * _hasMips = Indicates that texture contains full mip-map chain. - * _numLayers = Number of layers in texture array. Must be 1 if caps - * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If - * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than - * 1, expected memory layout is texture and all mips together for each array element. - */ - alias da_bgfx_create_texture_2d = bgfx_texture_handle_t function(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); - da_bgfx_create_texture_2d bgfx_create_texture_2d; - - /** - * Create texture with size based on back-buffer ratio. Texture will maintain ratio - * if back buffer resolution changes. - * Params: - * _ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`. - * _hasMips = Indicates that texture contains full mip-map chain. - * _numLayers = Number of layers in texture array. Must be 1 if caps - * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - alias da_bgfx_create_texture_2d_scaled = bgfx_texture_handle_t function(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags); - da_bgfx_create_texture_2d_scaled bgfx_create_texture_2d_scaled; - - /** - * Create 3D texture. - * Params: - * _width = Width. - * _height = Height. - * _depth = Depth. - * _hasMips = Indicates that texture contains full mip-map chain. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If - * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than - * 1, expected memory layout is texture and all mips together for each array element. - */ - alias da_bgfx_create_texture_3d = bgfx_texture_handle_t function(ushort _width, ushort _height, ushort _depth, bool _hasMips, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); - da_bgfx_create_texture_3d bgfx_create_texture_3d; - - /** - * Create Cube texture. - * Params: - * _size = Cube side size. - * _hasMips = Indicates that texture contains full mip-map chain. - * _numLayers = Number of layers in texture array. Must be 1 if caps - * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If - * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than - * 1, expected memory layout is texture and all mips together for each array element. - */ - alias da_bgfx_create_texture_cube = bgfx_texture_handle_t function(ushort _size, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); - da_bgfx_create_texture_cube bgfx_create_texture_cube; - - /** - * Update 2D texture. - * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info. - * Params: - * _handle = Texture handle. - * _layer = Layer in texture array. - * _mip = Mip level. - * _x = X offset in texture. - * _y = Y offset in texture. - * _width = Width of texture block. - * _height = Height of texture block. - * _mem = Texture update data. - * _pitch = Pitch of input image (bytes). When _pitch is set to - * UINT16_MAX, it will be calculated internally based on _width. - */ - alias da_bgfx_update_texture_2d = void function(bgfx_texture_handle_t _handle, ushort _layer, ubyte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch); - da_bgfx_update_texture_2d bgfx_update_texture_2d; - - /** - * Update 3D texture. - * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info. - * Params: - * _handle = Texture handle. - * _mip = Mip level. - * _x = X offset in texture. - * _y = Y offset in texture. - * _z = Z offset in texture. - * _width = Width of texture block. - * _height = Height of texture block. - * _depth = Depth of texture block. - * _mem = Texture update data. - */ - alias da_bgfx_update_texture_3d = void function(bgfx_texture_handle_t _handle, ubyte _mip, ushort _x, ushort _y, ushort _z, ushort _width, ushort _height, ushort _depth, const(bgfx_memory_t)* _mem); - da_bgfx_update_texture_3d bgfx_update_texture_3d; - - /** - * Update Cube texture. - * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info. - * Params: - * _handle = Texture handle. - * _layer = Layer in texture array. - * _side = Cubemap side `BGFX_CUBE_MAP__`, - * where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z. - * +----------+ - * |-z 2| - * | ^ +y | - * | | | Unfolded cube: - * | +---->+x | - * +----------+----------+----------+----------+ - * |+y 1|+y 4|+y 0|+y 5| - * | ^ -x | ^ +z | ^ +x | ^ -z | - * | | | | | | | | | - * | +---->+z | +---->+x | +---->-z | +---->-x | - * +----------+----------+----------+----------+ - * |+z 3| - * | ^ -y | - * | | | - * | +---->+x | - * +----------+ - * _mip = Mip level. - * _x = X offset in texture. - * _y = Y offset in texture. - * _width = Width of texture block. - * _height = Height of texture block. - * _mem = Texture update data. - * _pitch = Pitch of input image (bytes). When _pitch is set to - * UINT16_MAX, it will be calculated internally based on _width. - */ - alias da_bgfx_update_texture_cube = void function(bgfx_texture_handle_t _handle, ushort _layer, ubyte _side, ubyte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch); - da_bgfx_update_texture_cube bgfx_update_texture_cube; - - /** - * Read back texture content. - * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag. - * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`. - * Params: - * _handle = Texture handle. - * _data = Destination buffer. - * _mip = Mip level. - */ - alias da_bgfx_read_texture = uint function(bgfx_texture_handle_t _handle, void* _data, ubyte _mip); - da_bgfx_read_texture bgfx_read_texture; - - /** - * Set texture debug name. - * Params: - * _handle = Texture handle. - * _name = Texture name. - * _len = Texture name length (if length is INT32_MAX, it's expected - * that _name is zero terminated string. - */ - alias da_bgfx_set_texture_name = void function(bgfx_texture_handle_t _handle, const(char)* _name, int _len); - da_bgfx_set_texture_name bgfx_set_texture_name; - - /** - * Returns texture direct access pointer. - * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature - * is available on GPUs that have unified memory architecture (UMA) support. - * Params: - * _handle = Texture handle. - */ - alias da_bgfx_get_direct_access_ptr = void* function(bgfx_texture_handle_t _handle); - da_bgfx_get_direct_access_ptr bgfx_get_direct_access_ptr; - - /** - * Destroy texture. - * Params: - * _handle = Texture handle. - */ - alias da_bgfx_destroy_texture = void function(bgfx_texture_handle_t _handle); - da_bgfx_destroy_texture bgfx_destroy_texture; - - /** - * Create frame buffer (simple). - * Params: - * _width = Texture width. - * _height = Texture height. - * _format = Texture format. See: `TextureFormat::Enum`. - * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - alias da_bgfx_create_frame_buffer = bgfx_frame_buffer_handle_t function(ushort _width, ushort _height, bgfx_texture_format_t _format, ulong _textureFlags); - da_bgfx_create_frame_buffer bgfx_create_frame_buffer; - - /** - * Create frame buffer with size based on back-buffer ratio. Frame buffer will maintain ratio - * if back buffer resolution changes. - * Params: - * _ratio = Frame buffer size in respect to back-buffer size. See: - * `BackbufferRatio::Enum`. - * _format = Texture format. See: `TextureFormat::Enum`. - * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - alias da_bgfx_create_frame_buffer_scaled = bgfx_frame_buffer_handle_t function(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, ulong _textureFlags); - da_bgfx_create_frame_buffer_scaled bgfx_create_frame_buffer_scaled; - - /** - * Create MRT frame buffer from texture handles (simple). - * Params: - * _num = Number of texture handles. - * _handles = Texture attachments. - * _destroyTexture = If true, textures will be destroyed when - * frame buffer is destroyed. - */ - alias da_bgfx_create_frame_buffer_from_handles = bgfx_frame_buffer_handle_t function(ubyte _num, const(bgfx_texture_handle_t)* _handles, bool _destroyTexture); - da_bgfx_create_frame_buffer_from_handles bgfx_create_frame_buffer_from_handles; - - /** - * Create MRT frame buffer from texture handles with specific layer and - * mip level. - * Params: - * _num = Number of attachments. - * _attachment = Attachment texture info. See: `bgfx::Attachment`. - * _destroyTexture = If true, textures will be destroyed when - * frame buffer is destroyed. - */ - alias da_bgfx_create_frame_buffer_from_attachment = bgfx_frame_buffer_handle_t function(ubyte _num, const(bgfx_attachment_t)* _attachment, bool _destroyTexture); - da_bgfx_create_frame_buffer_from_attachment bgfx_create_frame_buffer_from_attachment; - - /** - * Create frame buffer for multiple window rendering. - * Remarks: - * Frame buffer cannot be used for sampling. - * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`. - * Params: - * _nwh = OS' target native window handle. - * _width = Window back buffer width. - * _height = Window back buffer height. - * _format = Window back buffer color format. - * _depthFormat = Window back buffer depth format. - */ - alias da_bgfx_create_frame_buffer_from_nwh = bgfx_frame_buffer_handle_t function(void* _nwh, ushort _width, ushort _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat); - da_bgfx_create_frame_buffer_from_nwh bgfx_create_frame_buffer_from_nwh; - - /** - * Set frame buffer debug name. - * Params: - * _handle = Frame buffer handle. - * _name = Frame buffer name. - * _len = Frame buffer name length (if length is INT32_MAX, it's expected - * that _name is zero terminated string. - */ - alias da_bgfx_set_frame_buffer_name = void function(bgfx_frame_buffer_handle_t _handle, const(char)* _name, int _len); - da_bgfx_set_frame_buffer_name bgfx_set_frame_buffer_name; - - /** - * Obtain texture handle of frame buffer attachment. - * Params: - * _handle = Frame buffer handle. - */ - alias da_bgfx_get_texture = bgfx_texture_handle_t function(bgfx_frame_buffer_handle_t _handle, ubyte _attachment); - da_bgfx_get_texture bgfx_get_texture; - - /** - * Destroy frame buffer. - * Params: - * _handle = Frame buffer handle. - */ - alias da_bgfx_destroy_frame_buffer = void function(bgfx_frame_buffer_handle_t _handle); - da_bgfx_destroy_frame_buffer bgfx_destroy_frame_buffer; - - /** - * Create shader uniform parameter. - * Remarks: - * 1. Uniform names are unique. It's valid to call `bgfx::createUniform` - * multiple times with the same uniform name. The library will always - * return the same handle, but the handle reference count will be - * incremented. This means that the same number of `bgfx::destroyUniform` - * must be called to properly destroy the uniform. - * 2. Predefined uniforms (declared in `bgfx_shader.sh`): - * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current - * view, in pixels. - * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse - * width and height - * - `u_view mat4` - view matrix - * - `u_invView mat4` - inverted view matrix - * - `u_proj mat4` - projection matrix - * - `u_invProj mat4` - inverted projection matrix - * - `u_viewProj mat4` - concatenated view projection matrix - * - `u_invViewProj mat4` - concatenated inverted view projection matrix - * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices. - * - `u_modelView mat4` - concatenated model view matrix, only first - * model matrix from array is used. - * - `u_modelViewProj mat4` - concatenated model view projection matrix. - * - `u_alphaRef float` - alpha reference value for alpha test. - * Params: - * _name = Uniform name in shader. - * _type = Type of uniform (See: `bgfx::UniformType`). - * _num = Number of elements in array. - */ - alias da_bgfx_create_uniform = bgfx_uniform_handle_t function(const(char)* _name, bgfx_uniform_type_t _type, ushort _num); - da_bgfx_create_uniform bgfx_create_uniform; - - /** - * Retrieve uniform info. - * Params: - * _handle = Handle to uniform object. - * _info = Uniform info. - */ - alias da_bgfx_get_uniform_info = void function(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t* _info); - da_bgfx_get_uniform_info bgfx_get_uniform_info; - - /** - * Destroy shader uniform parameter. - * Params: - * _handle = Handle to uniform object. - */ - alias da_bgfx_destroy_uniform = void function(bgfx_uniform_handle_t _handle); - da_bgfx_destroy_uniform bgfx_destroy_uniform; - - /** - * Create occlusion query. - */ - alias da_bgfx_create_occlusion_query = bgfx_occlusion_query_handle_t function(); - da_bgfx_create_occlusion_query bgfx_create_occlusion_query; - - /** - * Retrieve occlusion query result from previous frame. - * Params: - * _handle = Handle to occlusion query object. - * _result = Number of pixels that passed test. This argument - * can be `NULL` if result of occlusion query is not needed. - */ - alias da_bgfx_get_result = bgfx_occlusion_query_result_t function(bgfx_occlusion_query_handle_t _handle, int* _result); - da_bgfx_get_result bgfx_get_result; - - /** - * Destroy occlusion query. - * Params: - * _handle = Handle to occlusion query object. - */ - alias da_bgfx_destroy_occlusion_query = void function(bgfx_occlusion_query_handle_t _handle); - da_bgfx_destroy_occlusion_query bgfx_destroy_occlusion_query; - - /** - * Set palette color value. - * Params: - * _index = Index into palette. - * _rgba = RGBA floating point values. - */ - alias da_bgfx_set_palette_color = void function(ubyte _index, const float[4] _rgba); - da_bgfx_set_palette_color bgfx_set_palette_color; - - /** - * Set palette color value. - * Params: - * _index = Index into palette. - * _rgba = Packed 32-bit RGBA value. - */ - alias da_bgfx_set_palette_color_rgba8 = void function(ubyte _index, uint _rgba); - da_bgfx_set_palette_color_rgba8 bgfx_set_palette_color_rgba8; - - /** - * Set view name. - * Remarks: - * This is debug only feature. - * In graphics debugger view name will appear as: - * "nnnc " - * ^ ^ ^ - * | +--- compute (C) - * +------ view id - * Params: - * _id = View id. - * _name = View name. - */ - alias da_bgfx_set_view_name = void function(bgfx_view_id_t _id, const(char)* _name); - da_bgfx_set_view_name bgfx_set_view_name; - - /** - * Set view rectangle. Draw primitive outside view will be clipped. - * Params: - * _id = View id. - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _width = Width of view port region. - * _height = Height of view port region. - */ - alias da_bgfx_set_view_rect = void function(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height); - da_bgfx_set_view_rect bgfx_set_view_rect; - - /** - * Set view rectangle. Draw primitive outside view will be clipped. - * Params: - * _id = View id. - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _ratio = Width and height will be set in respect to back-buffer size. - * See: `BackbufferRatio::Enum`. - */ - alias da_bgfx_set_view_rect_ratio = void function(bgfx_view_id_t _id, ushort _x, ushort _y, bgfx_backbuffer_ratio_t _ratio); - da_bgfx_set_view_rect_ratio bgfx_set_view_rect_ratio; - - /** - * Set view scissor. Draw primitive outside view will be clipped. When - * _x, _y, _width and _height are set to 0, scissor will be disabled. - * Params: - * _id = View id. - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _width = Width of view scissor region. - * _height = Height of view scissor region. - */ - alias da_bgfx_set_view_scissor = void function(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height); - da_bgfx_set_view_scissor bgfx_set_view_scissor; - - /** - * Set view clear flags. - * Params: - * _id = View id. - * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear - * operation. See: `BGFX_CLEAR_*`. - * _rgba = Color clear value. - * _depth = Depth clear value. - * _stencil = Stencil clear value. - */ - alias da_bgfx_set_view_clear = void function(bgfx_view_id_t _id, ushort _flags, uint _rgba, float _depth, ubyte _stencil); - da_bgfx_set_view_clear bgfx_set_view_clear; - - /** - * Set view clear flags with different clear color for each - * frame buffer texture. `bgfx::setPaletteColor` must be used to set up a - * clear color palette. - * Params: - * _id = View id. - * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear - * operation. See: `BGFX_CLEAR_*`. - * _depth = Depth clear value. - * _stencil = Stencil clear value. - * _c0 = Palette index for frame buffer attachment 0. - * _c1 = Palette index for frame buffer attachment 1. - * _c2 = Palette index for frame buffer attachment 2. - * _c3 = Palette index for frame buffer attachment 3. - * _c4 = Palette index for frame buffer attachment 4. - * _c5 = Palette index for frame buffer attachment 5. - * _c6 = Palette index for frame buffer attachment 6. - * _c7 = Palette index for frame buffer attachment 7. - */ - alias da_bgfx_set_view_clear_mrt = void function(bgfx_view_id_t _id, ushort _flags, float _depth, ubyte _stencil, ubyte _c0, ubyte _c1, ubyte _c2, ubyte _c3, ubyte _c4, ubyte _c5, ubyte _c6, ubyte _c7); - da_bgfx_set_view_clear_mrt bgfx_set_view_clear_mrt; - - /** - * Set view sorting mode. - * Remarks: - * View mode must be set prior calling `bgfx::submit` for the view. - * Params: - * _id = View id. - * _mode = View sort mode. See `ViewMode::Enum`. - */ - alias da_bgfx_set_view_mode = void function(bgfx_view_id_t _id, bgfx_view_mode_t _mode); - da_bgfx_set_view_mode bgfx_set_view_mode; - - /** - * Set view frame buffer. - * Remarks: - * Not persistent after `bgfx::reset` call. - * Params: - * _id = View id. - * _handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as - * frame buffer handle will draw primitives from this view into - * default back buffer. - */ - alias da_bgfx_set_view_frame_buffer = void function(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle); - da_bgfx_set_view_frame_buffer bgfx_set_view_frame_buffer; - - /** - * Set view's view matrix and projection matrix, - * all draw primitives in this view will use these two matrices. - * Params: - * _id = View id. - * _view = View matrix. - * _proj = Projection matrix. - */ - alias da_bgfx_set_view_transform = void function(bgfx_view_id_t _id, const(void)* _view, const(void)* _proj); - da_bgfx_set_view_transform bgfx_set_view_transform; - - /** - * Post submit view reordering. - * Params: - * _id = First view id. - * _num = Number of views to remap. - * _order = View remap id table. Passing `NULL` will reset view ids - * to default state. - */ - alias da_bgfx_set_view_order = void function(bgfx_view_id_t _id, ushort _num, const(bgfx_view_id_t)* _order); - da_bgfx_set_view_order bgfx_set_view_order; - - /** - * Reset all view settings to default. - */ - alias da_bgfx_reset_view = void function(bgfx_view_id_t _id); - da_bgfx_reset_view bgfx_reset_view; - - /** - * Begin submitting draw calls from thread. - * Params: - * _forThread = Explicitly request an encoder for a worker thread. - */ - alias da_bgfx_encoder_begin = bgfx_encoder_t* function(bool _forThread); - da_bgfx_encoder_begin bgfx_encoder_begin; - - /** - * End submitting draw calls from thread. - * Params: - * _encoder = Encoder. - */ - alias da_bgfx_encoder_end = void function(bgfx_encoder_t* _encoder); - da_bgfx_encoder_end bgfx_encoder_end; - - /** - * Sets a debug marker. This allows you to group graphics calls together for easy browsing in - * graphics debugging tools. - * Params: - * _marker = Marker string. - */ - alias da_bgfx_encoder_set_marker = void function(bgfx_encoder_t* _this, const(char)* _marker); - da_bgfx_encoder_set_marker bgfx_encoder_set_marker; - - /** - * Set render states for draw primitive. - * Remarks: - * 1. To set up more complex states use: - * `BGFX_STATE_ALPHA_REF(_ref)`, - * `BGFX_STATE_POINT_SIZE(_size)`, - * `BGFX_STATE_BLEND_FUNC(_src, _dst)`, - * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, - * `BGFX_STATE_BLEND_EQUATION(_equation)`, - * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` - * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend - * equation is specified. - * Params: - * _state = State flags. Default state for primitive type is - * triangles. See: `BGFX_STATE_DEFAULT`. - * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. - * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. - * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. - * - `BGFX_STATE_CULL_*` - Backface culling mode. - * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. - * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. - * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. - * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and - * `BGFX_STATE_BLEND_INV_FACTOR` blend modes. - */ - alias da_bgfx_encoder_set_state = void function(bgfx_encoder_t* _this, ulong _state, uint _rgba); - da_bgfx_encoder_set_state bgfx_encoder_set_state; - - /** - * Set condition for rendering. - * Params: - * _handle = Occlusion query handle. - * _visible = Render if occlusion query is visible. - */ - alias da_bgfx_encoder_set_condition = void function(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible); - da_bgfx_encoder_set_condition bgfx_encoder_set_condition; - - /** - * Set stencil test state. - * Params: - * _fstencil = Front stencil state. - * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE` - * _fstencil is applied to both front and back facing primitives. - */ - alias da_bgfx_encoder_set_stencil = void function(bgfx_encoder_t* _this, uint _fstencil, uint _bstencil); - da_bgfx_encoder_set_stencil bgfx_encoder_set_stencil; - - /** - * Set scissor for draw primitive. - * Remarks: - * To scissor for all primitives in view see `bgfx::setViewScissor`. - * Params: - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _width = Width of view scissor region. - * _height = Height of view scissor region. - */ - alias da_bgfx_encoder_set_scissor = ushort function(bgfx_encoder_t* _this, ushort _x, ushort _y, ushort _width, ushort _height); - da_bgfx_encoder_set_scissor bgfx_encoder_set_scissor; - - /** - * Set scissor from cache for draw primitive. - * Remarks: - * To scissor for all primitives in view see `bgfx::setViewScissor`. - * Params: - * _cache = Index in scissor cache. - */ - alias da_bgfx_encoder_set_scissor_cached = void function(bgfx_encoder_t* _this, ushort _cache); - da_bgfx_encoder_set_scissor_cached bgfx_encoder_set_scissor_cached; - - /** - * Set model matrix for draw primitive. If it is not called, - * the model will be rendered with an identity model matrix. - * Params: - * _mtx = Pointer to first matrix in array. - * _num = Number of matrices in array. - */ - alias da_bgfx_encoder_set_transform = uint function(bgfx_encoder_t* _this, const(void)* _mtx, ushort _num); - da_bgfx_encoder_set_transform bgfx_encoder_set_transform; - - /** - * Set model matrix from matrix cache for draw primitive. - * Params: - * _cache = Index in matrix cache. - * _num = Number of matrices from cache. - */ - alias da_bgfx_encoder_set_transform_cached = void function(bgfx_encoder_t* _this, uint _cache, ushort _num); - da_bgfx_encoder_set_transform_cached bgfx_encoder_set_transform_cached; - - /** - * Reserve matrices in internal matrix cache. - * Attention: Pointer returned can be modified until `bgfx::frame` is called. - * Params: - * _transform = Pointer to `Transform` structure. - * _num = Number of matrices. - */ - alias da_bgfx_encoder_alloc_transform = uint function(bgfx_encoder_t* _this, bgfx_transform_t* _transform, ushort _num); - da_bgfx_encoder_alloc_transform bgfx_encoder_alloc_transform; - - /** - * Set shader uniform parameter for draw primitive. - * Params: - * _handle = Uniform. - * _value = Pointer to uniform data. - * _num = Number of elements. Passing `UINT16_MAX` will - * use the _num passed on uniform creation. - */ - alias da_bgfx_encoder_set_uniform = void function(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num); - da_bgfx_encoder_set_uniform bgfx_encoder_set_uniform; - - /** - * Set index buffer for draw primitive. - * Params: - * _handle = Index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - alias da_bgfx_encoder_set_index_buffer = void function(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); - da_bgfx_encoder_set_index_buffer bgfx_encoder_set_index_buffer; - - /** - * Set index buffer for draw primitive. - * Params: - * _handle = Dynamic index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - alias da_bgfx_encoder_set_dynamic_index_buffer = void function(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); - da_bgfx_encoder_set_dynamic_index_buffer bgfx_encoder_set_dynamic_index_buffer; - - /** - * Set index buffer for draw primitive. - * Params: - * _tib = Transient index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - alias da_bgfx_encoder_set_transient_index_buffer = void function(bgfx_encoder_t* _this, const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices); - da_bgfx_encoder_set_transient_index_buffer bgfx_encoder_set_transient_index_buffer; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - alias da_bgfx_encoder_set_vertex_buffer = void function(bgfx_encoder_t* _this, ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); - da_bgfx_encoder_set_vertex_buffer bgfx_encoder_set_vertex_buffer; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid - * handle is used, vertex layout used for creation - * of vertex buffer will be used. - */ - alias da_bgfx_encoder_set_vertex_buffer_with_layout = void function(bgfx_encoder_t* _this, ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - da_bgfx_encoder_set_vertex_buffer_with_layout bgfx_encoder_set_vertex_buffer_with_layout; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Dynamic vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - alias da_bgfx_encoder_set_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); - da_bgfx_encoder_set_dynamic_vertex_buffer bgfx_encoder_set_dynamic_vertex_buffer; - - alias da_bgfx_encoder_set_dynamic_vertex_buffer_with_layout = void function(bgfx_encoder_t* _this, ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - da_bgfx_encoder_set_dynamic_vertex_buffer_with_layout bgfx_encoder_set_dynamic_vertex_buffer_with_layout; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _tvb = Transient vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - alias da_bgfx_encoder_set_transient_vertex_buffer = void function(bgfx_encoder_t* _this, ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices); - da_bgfx_encoder_set_transient_vertex_buffer bgfx_encoder_set_transient_vertex_buffer; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _tvb = Transient vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid - * handle is used, vertex layout used for creation - * of vertex buffer will be used. - */ - alias da_bgfx_encoder_set_transient_vertex_buffer_with_layout = void function(bgfx_encoder_t* _this, ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - da_bgfx_encoder_set_transient_vertex_buffer_with_layout bgfx_encoder_set_transient_vertex_buffer_with_layout; - - /** - * Set number of vertices for auto generated vertices use in conjunction - * with gl_VertexID. - * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. - * Params: - * _numVertices = Number of vertices. - */ - alias da_bgfx_encoder_set_vertex_count = void function(bgfx_encoder_t* _this, uint _numVertices); - da_bgfx_encoder_set_vertex_count bgfx_encoder_set_vertex_count; - - /** - * Set instance data buffer for draw primitive. - * Params: - * _idb = Transient instance data buffer. - * _start = First instance data. - * _num = Number of data instances. - */ - alias da_bgfx_encoder_set_instance_data_buffer = void function(bgfx_encoder_t* _this, const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num); - da_bgfx_encoder_set_instance_data_buffer bgfx_encoder_set_instance_data_buffer; - - /** - * Set instance data buffer for draw primitive. - * Params: - * _handle = Vertex buffer. - * _startVertex = First instance data. - * _num = Number of data instances. - * Set instance data buffer for draw primitive. - */ - alias da_bgfx_encoder_set_instance_data_from_vertex_buffer = void function(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); - da_bgfx_encoder_set_instance_data_from_vertex_buffer bgfx_encoder_set_instance_data_from_vertex_buffer; - - /** - * Set instance data buffer for draw primitive. - * Params: - * _handle = Dynamic vertex buffer. - * _startVertex = First instance data. - * _num = Number of data instances. - */ - alias da_bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); - da_bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer; - - /** - * Set number of instances for auto generated instances use in conjunction - * with gl_InstanceID. - * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. - */ - alias da_bgfx_encoder_set_instance_count = void function(bgfx_encoder_t* _this, uint _numInstances); - da_bgfx_encoder_set_instance_count bgfx_encoder_set_instance_count; - - /** - * Set texture stage for draw primitive. - * Params: - * _stage = Texture unit. - * _sampler = Program sampler. - * _handle = Texture handle. - * _flags = Texture sampling mode. Default value UINT32_MAX uses - * texture sampling settings from the texture. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - alias da_bgfx_encoder_set_texture = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags); - da_bgfx_encoder_set_texture bgfx_encoder_set_texture; - - /** - * Submit an empty primitive for rendering. Uniforms and draw state - * will be applied but no geometry will be submitted. Useful in cases - * when no other draw/compute primitive is submitted to view, but it's - * desired to execute clear view. - * Remarks: - * These empty draw calls will sort before ordinary draw calls. - * Params: - * _id = View id. - */ - alias da_bgfx_encoder_touch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id); - da_bgfx_encoder_touch bgfx_encoder_touch; - - /** - * Submit primitive for rendering. - * Params: - * _id = View id. - * _program = Program. - * _depth = Depth for sorting. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_encoder_submit = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, ubyte _flags); - da_bgfx_encoder_submit bgfx_encoder_submit; - - /** - * Submit primitive with occlusion query for rendering. - * Params: - * _id = View id. - * _program = Program. - * _occlusionQuery = Occlusion query. - * _depth = Depth for sorting. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_encoder_submit_occlusion_query = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, ubyte _flags); - da_bgfx_encoder_submit_occlusion_query bgfx_encoder_submit_occlusion_query; - - /** - * Submit primitive for rendering with index and instance data info from - * indirect buffer. - * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`. - * Params: - * _id = View id. - * _program = Program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _num = Number of draws. - * _depth = Depth for sorting. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_encoder_submit_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, ubyte _flags); - da_bgfx_encoder_submit_indirect bgfx_encoder_submit_indirect; - - /** - * Submit primitive for rendering with index and instance data info and - * draw count from indirect buffers. - * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`. - * Params: - * _id = View id. - * _program = Program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _numHandle = Buffer for number of draws. Must be - * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`. - * _numIndex = Element in number buffer. - * _numMax = Max number of draws. - * _depth = Depth for sorting. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_encoder_submit_indirect_count = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags); - da_bgfx_encoder_submit_indirect_count bgfx_encoder_submit_indirect_count; - - /** - * Set compute index buffer. - * Params: - * _stage = Compute stage. - * _handle = Index buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - alias da_bgfx_encoder_set_compute_index_buffer = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); - da_bgfx_encoder_set_compute_index_buffer bgfx_encoder_set_compute_index_buffer; - - /** - * Set compute vertex buffer. - * Params: - * _stage = Compute stage. - * _handle = Vertex buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - alias da_bgfx_encoder_set_compute_vertex_buffer = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); - da_bgfx_encoder_set_compute_vertex_buffer bgfx_encoder_set_compute_vertex_buffer; - - /** - * Set compute dynamic index buffer. - * Params: - * _stage = Compute stage. - * _handle = Dynamic index buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - alias da_bgfx_encoder_set_compute_dynamic_index_buffer = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); - da_bgfx_encoder_set_compute_dynamic_index_buffer bgfx_encoder_set_compute_dynamic_index_buffer; - - /** - * Set compute dynamic vertex buffer. - * Params: - * _stage = Compute stage. - * _handle = Dynamic vertex buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - alias da_bgfx_encoder_set_compute_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); - da_bgfx_encoder_set_compute_dynamic_vertex_buffer bgfx_encoder_set_compute_dynamic_vertex_buffer; - - /** - * Set compute indirect buffer. - * Params: - * _stage = Compute stage. - * _handle = Indirect buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - alias da_bgfx_encoder_set_compute_indirect_buffer = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); - da_bgfx_encoder_set_compute_indirect_buffer bgfx_encoder_set_compute_indirect_buffer; - - /** - * Set compute image from texture. - * Params: - * _stage = Compute stage. - * _handle = Texture handle. - * _mip = Mip level. - * _access = Image access. See `Access::Enum`. - * _format = Texture format. See: `TextureFormat::Enum`. - */ - alias da_bgfx_encoder_set_image = void function(bgfx_encoder_t* _this, ubyte _stage, bgfx_texture_handle_t _handle, ubyte _mip, bgfx_access_t _access, bgfx_texture_format_t _format); - da_bgfx_encoder_set_image bgfx_encoder_set_image; - - /** - * Dispatch compute. - * Params: - * _id = View id. - * _program = Compute program. - * _numX = Number of groups X. - * _numY = Number of groups Y. - * _numZ = Number of groups Z. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_encoder_dispatch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, ubyte _flags); - da_bgfx_encoder_dispatch bgfx_encoder_dispatch; - - /** - * Dispatch compute indirect. - * Params: - * _id = View id. - * _program = Compute program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _num = Number of dispatches. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_encoder_dispatch_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, ubyte _flags); - da_bgfx_encoder_dispatch_indirect bgfx_encoder_dispatch_indirect; - - /** - * Discard previously set state for draw or compute call. - * Params: - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_encoder_discard = void function(bgfx_encoder_t* _this, ubyte _flags); - da_bgfx_encoder_discard bgfx_encoder_discard; - - /** - * Blit 2D texture region between two 2D textures. - * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. - * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. - * Params: - * _id = View id. - * _dst = Destination texture handle. - * _dstMip = Destination texture mip level. - * _dstX = Destination texture X position. - * _dstY = Destination texture Y position. - * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube - * this argument represents destination texture cube face. For 3D texture this argument - * represents destination texture Z position. - * _src = Source texture handle. - * _srcMip = Source texture mip level. - * _srcX = Source texture X position. - * _srcY = Source texture Y position. - * _srcZ = If texture is 2D this argument should be 0. If source texture is cube - * this argument represents source texture cube face. For 3D texture this argument - * represents source texture Z position. - * _width = Width of region. - * _height = Height of region. - * _depth = If texture is 3D this argument represents depth of region, otherwise it's - * unused. - */ - alias da_bgfx_encoder_blit = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, ubyte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, ubyte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth); - da_bgfx_encoder_blit bgfx_encoder_blit; - - /** - * Request screen shot of window back buffer. - * Remarks: - * `bgfx::CallbackI::screenShot` must be implemented. - * Attention: Frame buffer handle must be created with OS' target native window handle. - * Params: - * _handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be - * made for main window back buffer. - * _filePath = Will be passed to `bgfx::CallbackI::screenShot` callback. - */ - alias da_bgfx_request_screen_shot = void function(bgfx_frame_buffer_handle_t _handle, const(char)* _filePath); - da_bgfx_request_screen_shot bgfx_request_screen_shot; - - /** - * Render frame. - * Attention: `bgfx::renderFrame` is blocking call. It waits for - * `bgfx::frame` to be called from API thread to process frame. - * If timeout value is passed call will timeout and return even - * if `bgfx::frame` is not called. - * Warning: This call should be only used on platforms that don't - * allow creating separate rendering thread. If it is called before - * to bgfx::init, render thread won't be created by bgfx::init call. - * Params: - * _msecs = Timeout in milliseconds. - */ - alias da_bgfx_render_frame = bgfx_render_frame_t function(int _msecs); - da_bgfx_render_frame bgfx_render_frame; - - /** - * Set platform data. - * Warning: Must be called before `bgfx::init`. - * Params: - * _data = Platform data. - */ - alias da_bgfx_set_platform_data = void function(const(bgfx_platform_data_t)* _data); - da_bgfx_set_platform_data bgfx_set_platform_data; - - /** - * Get internal data for interop. - * Attention: It's expected you understand some bgfx internals before you - * use this call. - * Warning: Must be called only on render thread. - */ - alias da_bgfx_get_internal_data = const(bgfx_internal_data_t)* function(); - da_bgfx_get_internal_data bgfx_get_internal_data; - - /** - * Override internal texture with externally created texture. Previously - * created internal texture will released. - * Attention: It's expected you understand some bgfx internals before you - * use this call. - * Warning: Must be called only on render thread. - * Params: - * _handle = Texture handle. - * _ptr = Native API pointer to texture. - */ - alias da_bgfx_override_internal_texture_ptr = ulong function(bgfx_texture_handle_t _handle, ulong _ptr); - da_bgfx_override_internal_texture_ptr bgfx_override_internal_texture_ptr; - - /** - * Override internal texture by creating new texture. Previously created - * internal texture will released. - * Attention: It's expected you understand some bgfx internals before you - * use this call. - * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the - * main thread. - * Warning: Must be called only on render thread. - * Params: - * _handle = Texture handle. - * _width = Width. - * _height = Height. - * _numMips = Number of mip-maps. - * _format = Texture format. See: `TextureFormat::Enum`. - * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) - * flags. Default texture sampling mode is linear, and wrap mode is repeat. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - alias da_bgfx_override_internal_texture = ulong function(bgfx_texture_handle_t _handle, ushort _width, ushort _height, ubyte _numMips, bgfx_texture_format_t _format, ulong _flags); - da_bgfx_override_internal_texture bgfx_override_internal_texture; - - /** - * Sets a debug marker. This allows you to group graphics calls together for easy browsing in - * graphics debugging tools. - * Params: - * _marker = Marker string. - */ - alias da_bgfx_set_marker = void function(const(char)* _marker); - da_bgfx_set_marker bgfx_set_marker; - - /** - * Set render states for draw primitive. - * Remarks: - * 1. To set up more complex states use: - * `BGFX_STATE_ALPHA_REF(_ref)`, - * `BGFX_STATE_POINT_SIZE(_size)`, - * `BGFX_STATE_BLEND_FUNC(_src, _dst)`, - * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, - * `BGFX_STATE_BLEND_EQUATION(_equation)`, - * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` - * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend - * equation is specified. - * Params: - * _state = State flags. Default state for primitive type is - * triangles. See: `BGFX_STATE_DEFAULT`. - * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. - * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. - * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. - * - `BGFX_STATE_CULL_*` - Backface culling mode. - * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. - * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. - * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. - * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and - * `BGFX_STATE_BLEND_INV_FACTOR` blend modes. - */ - alias da_bgfx_set_state = void function(ulong _state, uint _rgba); - da_bgfx_set_state bgfx_set_state; - - /** - * Set condition for rendering. - * Params: - * _handle = Occlusion query handle. - * _visible = Render if occlusion query is visible. - */ - alias da_bgfx_set_condition = void function(bgfx_occlusion_query_handle_t _handle, bool _visible); - da_bgfx_set_condition bgfx_set_condition; - - /** - * Set stencil test state. - * Params: - * _fstencil = Front stencil state. - * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE` - * _fstencil is applied to both front and back facing primitives. - */ - alias da_bgfx_set_stencil = void function(uint _fstencil, uint _bstencil); - da_bgfx_set_stencil bgfx_set_stencil; - - /** - * Set scissor for draw primitive. - * Remarks: - * To scissor for all primitives in view see `bgfx::setViewScissor`. - * Params: - * _x = Position x from the left corner of the window. - * _y = Position y from the top corner of the window. - * _width = Width of view scissor region. - * _height = Height of view scissor region. - */ - alias da_bgfx_set_scissor = ushort function(ushort _x, ushort _y, ushort _width, ushort _height); - da_bgfx_set_scissor bgfx_set_scissor; - - /** - * Set scissor from cache for draw primitive. - * Remarks: - * To scissor for all primitives in view see `bgfx::setViewScissor`. - * Params: - * _cache = Index in scissor cache. - */ - alias da_bgfx_set_scissor_cached = void function(ushort _cache); - da_bgfx_set_scissor_cached bgfx_set_scissor_cached; - - /** - * Set model matrix for draw primitive. If it is not called, - * the model will be rendered with an identity model matrix. - * Params: - * _mtx = Pointer to first matrix in array. - * _num = Number of matrices in array. - */ - alias da_bgfx_set_transform = uint function(const(void)* _mtx, ushort _num); - da_bgfx_set_transform bgfx_set_transform; - - /** - * Set model matrix from matrix cache for draw primitive. - * Params: - * _cache = Index in matrix cache. - * _num = Number of matrices from cache. - */ - alias da_bgfx_set_transform_cached = void function(uint _cache, ushort _num); - da_bgfx_set_transform_cached bgfx_set_transform_cached; - - /** - * Reserve matrices in internal matrix cache. - * Attention: Pointer returned can be modified until `bgfx::frame` is called. - * Params: - * _transform = Pointer to `Transform` structure. - * _num = Number of matrices. - */ - alias da_bgfx_alloc_transform = uint function(bgfx_transform_t* _transform, ushort _num); - da_bgfx_alloc_transform bgfx_alloc_transform; - - /** - * Set shader uniform parameter for draw primitive. - * Params: - * _handle = Uniform. - * _value = Pointer to uniform data. - * _num = Number of elements. Passing `UINT16_MAX` will - * use the _num passed on uniform creation. - */ - alias da_bgfx_set_uniform = void function(bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num); - da_bgfx_set_uniform bgfx_set_uniform; - - /** - * Set index buffer for draw primitive. - * Params: - * _handle = Index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - alias da_bgfx_set_index_buffer = void function(bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); - da_bgfx_set_index_buffer bgfx_set_index_buffer; - - /** - * Set index buffer for draw primitive. - * Params: - * _handle = Dynamic index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - alias da_bgfx_set_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); - da_bgfx_set_dynamic_index_buffer bgfx_set_dynamic_index_buffer; - - /** - * Set index buffer for draw primitive. - * Params: - * _tib = Transient index buffer. - * _firstIndex = First index to render. - * _numIndices = Number of indices to render. - */ - alias da_bgfx_set_transient_index_buffer = void function(const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices); - da_bgfx_set_transient_index_buffer bgfx_set_transient_index_buffer; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - alias da_bgfx_set_vertex_buffer = void function(ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); - da_bgfx_set_vertex_buffer bgfx_set_vertex_buffer; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid - * handle is used, vertex layout used for creation - * of vertex buffer will be used. - */ - alias da_bgfx_set_vertex_buffer_with_layout = void function(ubyte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - da_bgfx_set_vertex_buffer_with_layout bgfx_set_vertex_buffer_with_layout; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Dynamic vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - alias da_bgfx_set_dynamic_vertex_buffer = void function(ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); - da_bgfx_set_dynamic_vertex_buffer bgfx_set_dynamic_vertex_buffer; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _handle = Dynamic vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid - * handle is used, vertex layout used for creation - * of vertex buffer will be used. - */ - alias da_bgfx_set_dynamic_vertex_buffer_with_layout = void function(ubyte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - da_bgfx_set_dynamic_vertex_buffer_with_layout bgfx_set_dynamic_vertex_buffer_with_layout; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _tvb = Transient vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - */ - alias da_bgfx_set_transient_vertex_buffer = void function(ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices); - da_bgfx_set_transient_vertex_buffer bgfx_set_transient_vertex_buffer; - - /** - * Set vertex buffer for draw primitive. - * Params: - * _stream = Vertex stream. - * _tvb = Transient vertex buffer. - * _startVertex = First vertex to render. - * _numVertices = Number of vertices to render. - * _layoutHandle = Vertex layout for aliasing vertex buffer. If invalid - * handle is used, vertex layout used for creation - * of vertex buffer will be used. - */ - alias da_bgfx_set_transient_vertex_buffer_with_layout = void function(ubyte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); - da_bgfx_set_transient_vertex_buffer_with_layout bgfx_set_transient_vertex_buffer_with_layout; - - /** - * Set number of vertices for auto generated vertices use in conjunction - * with gl_VertexID. - * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. - * Params: - * _numVertices = Number of vertices. - */ - alias da_bgfx_set_vertex_count = void function(uint _numVertices); - da_bgfx_set_vertex_count bgfx_set_vertex_count; - - /** - * Set instance data buffer for draw primitive. - * Params: - * _idb = Transient instance data buffer. - * _start = First instance data. - * _num = Number of data instances. - */ - alias da_bgfx_set_instance_data_buffer = void function(const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num); - da_bgfx_set_instance_data_buffer bgfx_set_instance_data_buffer; - - /** - * Set instance data buffer for draw primitive. - * Params: - * _handle = Vertex buffer. - * _startVertex = First instance data. - * _num = Number of data instances. - * Set instance data buffer for draw primitive. - */ - alias da_bgfx_set_instance_data_from_vertex_buffer = void function(bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); - da_bgfx_set_instance_data_from_vertex_buffer bgfx_set_instance_data_from_vertex_buffer; - - /** - * Set instance data buffer for draw primitive. - * Params: - * _handle = Dynamic vertex buffer. - * _startVertex = First instance data. - * _num = Number of data instances. - */ - alias da_bgfx_set_instance_data_from_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); - da_bgfx_set_instance_data_from_dynamic_vertex_buffer bgfx_set_instance_data_from_dynamic_vertex_buffer; - - /** - * Set number of instances for auto generated instances use in conjunction - * with gl_InstanceID. - * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. - */ - alias da_bgfx_set_instance_count = void function(uint _numInstances); - da_bgfx_set_instance_count bgfx_set_instance_count; - - /** - * Set texture stage for draw primitive. - * Params: - * _stage = Texture unit. - * _sampler = Program sampler. - * _handle = Texture handle. - * _flags = Texture sampling mode. Default value UINT32_MAX uses - * texture sampling settings from the texture. - * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap - * mode. - * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic - * sampling. - */ - alias da_bgfx_set_texture = void function(ubyte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags); - da_bgfx_set_texture bgfx_set_texture; - - /** - * Submit an empty primitive for rendering. Uniforms and draw state - * will be applied but no geometry will be submitted. - * Remarks: - * These empty draw calls will sort before ordinary draw calls. - * Params: - * _id = View id. - */ - alias da_bgfx_touch = void function(bgfx_view_id_t _id); - da_bgfx_touch bgfx_touch; - - /** - * Submit primitive for rendering. - * Params: - * _id = View id. - * _program = Program. - * _depth = Depth for sorting. - * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_submit = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, ubyte _flags); - da_bgfx_submit bgfx_submit; - - /** - * Submit primitive with occlusion query for rendering. - * Params: - * _id = View id. - * _program = Program. - * _occlusionQuery = Occlusion query. - * _depth = Depth for sorting. - * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_submit_occlusion_query = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, ubyte _flags); - da_bgfx_submit_occlusion_query bgfx_submit_occlusion_query; - - /** - * Submit primitive for rendering with index and instance data info from - * indirect buffer. - * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`. - * Params: - * _id = View id. - * _program = Program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _num = Number of draws. - * _depth = Depth for sorting. - * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_submit_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, ubyte _flags); - da_bgfx_submit_indirect bgfx_submit_indirect; - - /** - * Submit primitive for rendering with index and instance data info and - * draw count from indirect buffers. - * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`. - * Params: - * _id = View id. - * _program = Program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _numHandle = Buffer for number of draws. Must be - * created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`. - * _numIndex = Element in number buffer. - * _numMax = Max number of draws. - * _depth = Depth for sorting. - * _flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_submit_indirect_count = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, bgfx_index_buffer_handle_t _numHandle, uint _numIndex, ushort _numMax, uint _depth, ubyte _flags); - da_bgfx_submit_indirect_count bgfx_submit_indirect_count; - - /** - * Set compute index buffer. - * Params: - * _stage = Compute stage. - * _handle = Index buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - alias da_bgfx_set_compute_index_buffer = void function(ubyte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); - da_bgfx_set_compute_index_buffer bgfx_set_compute_index_buffer; - - /** - * Set compute vertex buffer. - * Params: - * _stage = Compute stage. - * _handle = Vertex buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - alias da_bgfx_set_compute_vertex_buffer = void function(ubyte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); - da_bgfx_set_compute_vertex_buffer bgfx_set_compute_vertex_buffer; - - /** - * Set compute dynamic index buffer. - * Params: - * _stage = Compute stage. - * _handle = Dynamic index buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - alias da_bgfx_set_compute_dynamic_index_buffer = void function(ubyte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); - da_bgfx_set_compute_dynamic_index_buffer bgfx_set_compute_dynamic_index_buffer; - - /** - * Set compute dynamic vertex buffer. - * Params: - * _stage = Compute stage. - * _handle = Dynamic vertex buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - alias da_bgfx_set_compute_dynamic_vertex_buffer = void function(ubyte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); - da_bgfx_set_compute_dynamic_vertex_buffer bgfx_set_compute_dynamic_vertex_buffer; - - /** - * Set compute indirect buffer. - * Params: - * _stage = Compute stage. - * _handle = Indirect buffer handle. - * _access = Buffer access. See `Access::Enum`. - */ - alias da_bgfx_set_compute_indirect_buffer = void function(ubyte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); - da_bgfx_set_compute_indirect_buffer bgfx_set_compute_indirect_buffer; - - /** - * Set compute image from texture. - * Params: - * _stage = Compute stage. - * _handle = Texture handle. - * _mip = Mip level. - * _access = Image access. See `Access::Enum`. - * _format = Texture format. See: `TextureFormat::Enum`. - */ - alias da_bgfx_set_image = void function(ubyte _stage, bgfx_texture_handle_t _handle, ubyte _mip, bgfx_access_t _access, bgfx_texture_format_t _format); - da_bgfx_set_image bgfx_set_image; - - /** - * Dispatch compute. - * Params: - * _id = View id. - * _program = Compute program. - * _numX = Number of groups X. - * _numY = Number of groups Y. - * _numZ = Number of groups Z. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_dispatch = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, ubyte _flags); - da_bgfx_dispatch bgfx_dispatch; - - /** - * Dispatch compute indirect. - * Params: - * _id = View id. - * _program = Compute program. - * _indirectHandle = Indirect buffer. - * _start = First element in indirect buffer. - * _num = Number of dispatches. - * _flags = Discard or preserve states. See `BGFX_DISCARD_*`. - */ - alias da_bgfx_dispatch_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, ubyte _flags); - da_bgfx_dispatch_indirect bgfx_dispatch_indirect; - - /** - * Discard previously set state for draw or compute call. - * Params: - * _flags = Draw/compute states to discard. - */ - alias da_bgfx_discard = void function(ubyte _flags); - da_bgfx_discard bgfx_discard; - - /** - * Blit 2D texture region between two 2D textures. - * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. - * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. - * Params: - * _id = View id. - * _dst = Destination texture handle. - * _dstMip = Destination texture mip level. - * _dstX = Destination texture X position. - * _dstY = Destination texture Y position. - * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube - * this argument represents destination texture cube face. For 3D texture this argument - * represents destination texture Z position. - * _src = Source texture handle. - * _srcMip = Source texture mip level. - * _srcX = Source texture X position. - * _srcY = Source texture Y position. - * _srcZ = If texture is 2D this argument should be 0. If source texture is cube - * this argument represents source texture cube face. For 3D texture this argument - * represents source texture Z position. - * _width = Width of region. - * _height = Height of region. - * _depth = If texture is 3D this argument represents depth of region, otherwise it's - * unused. - */ - alias da_bgfx_blit = void function(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, ubyte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, ubyte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth); - da_bgfx_blit bgfx_blit; - - } -} diff --git a/bgfx/bindings/d/package.d b/bgfx/bindings/d/package.d new file mode 100644 index 00000000..606959c6 --- /dev/null +++ b/bgfx/bindings/d/package.d @@ -0,0 +1,3581 @@ +/+ ++ ┌==============================┠++ │ AUTO GENERATED! DO NOT EDIT! │ ++ └==============================┘ ++/ +module bgfx; + +import bindbc.bgfx.config; + +import bindbc.common.types: va_list; +static import bgfx.fakeenum; + +enum uint apiVersion = 122; + +alias ViewID = ushort; +deprecated("Please use `ViewID` instead.") alias ViewId = ushort; + +enum invalidHandle(T) = T(ushort.max); + +alias ReleaseFn = void function(void* ptr, void* userData); + +///Memory release callback. + +///Color RGB/alpha/depth write. When it's not specified write will be disabled. +alias StateWrite_ = ulong; +enum StateWrite: StateWrite_{ + r = 0x0000_0000_0000_0001, ///Enable R write. + g = 0x0000_0000_0000_0002, ///Enable G write. + b = 0x0000_0000_0000_0004, ///Enable B write. + a = 0x0000_0000_0000_0008, ///Enable alpha write. + z = 0x0000_0040_0000_0000, ///Enable depth write. + rgb = 0x0000_0000_0000_0007, ///Enable RGB write. + mask = 0x0000_0040_0000_000F, ///Write all channels mask. +} + +///Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled. +alias StateDepthTest_ = ulong; +enum StateDepthTest: StateDepthTest_{ + less = 0x0000_0000_0000_0010, ///Enable depth test, less. + lEqual = 0x0000_0000_0000_0020, ///Enable depth test, less or equal. + equal = 0x0000_0000_0000_0030, ///Enable depth test, equal. + gEqual = 0x0000_0000_0000_0040, ///Enable depth test, greater or equal. + greater = 0x0000_0000_0000_0050, ///Enable depth test, greater. + notEqual = 0x0000_0000_0000_0060, ///Enable depth test, not equal. + never = 0x0000_0000_0000_0070, ///Enable depth test, never. + always = 0x0000_0000_0000_0080, ///Enable depth test, always. + shift = 4, ///Depth test state bit shift + mask = 0x0000_0000_0000_00F0, ///Depth test state bit mask +} + +/** +Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) +helper macros. +*/ +alias StateBlend_ = ulong; +enum StateBlend: StateBlend_{ + zero = 0x0000_0000_0000_1000, ///0, 0, 0, 0 + one = 0x0000_0000_0000_2000, ///1, 1, 1, 1 + srcColor = 0x0000_0000_0000_3000, ///Rs, Gs, Bs, As + srcColour = srcColor, + invSrcColor = 0x0000_0000_0000_4000, ///1-Rs, 1-Gs, 1-Bs, 1-As + invSrcColour = invSrcColor, + srcAlpha = 0x0000_0000_0000_5000, ///As, As, As, As + invSrcAlpha = 0x0000_0000_0000_6000, ///1-As, 1-As, 1-As, 1-As + dstAlpha = 0x0000_0000_0000_7000, ///Ad, Ad, Ad, Ad + invDstAlpha = 0x0000_0000_0000_8000, ///1-Ad, 1-Ad, 1-Ad ,1-Ad + dstColor = 0x0000_0000_0000_9000, ///Rd, Gd, Bd, Ad + dstColour = dstColor, + invDstColor = 0x0000_0000_0000_A000, ///1-Rd, 1-Gd, 1-Bd, 1-Ad + invDstColour = invDstColor, + srcAlphaSat = 0x0000_0000_0000_B000, ///f, f, f, 1; f = min(As, 1-Ad) + factor = 0x0000_0000_0000_C000, ///Blend factor + invFactor = 0x0000_0000_0000_D000, ///1-Blend factor + shift = 12, ///Blend state bit shift + mask = 0x0000_0000_0FFF_F000, ///Blend state bit mask +} + +/** +Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA) +helper macros. +*/ +alias StateBlendEquation_ = ulong; +enum StateBlendEquation: StateBlendEquation_{ + add = 0x0000_0000_0000_0000, ///Blend add: src + dst. + sub = 0x0000_0000_1000_0000, ///Blend subtract: src - dst. + revSub = 0x0000_0000_2000_0000, ///Blend reverse subtract: dst - src. + min = 0x0000_0000_3000_0000, ///Blend min: min(src, dst). + max = 0x0000_0000_4000_0000, ///Blend max: max(src, dst). + shift = 28, ///Blend equation bit shift + mask = 0x0000_0003_F000_0000, ///Blend equation bit mask +} + +///Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled. +alias StateCull_ = ulong; +enum StateCull: StateCull_{ + cw = 0x0000_0010_0000_0000, ///Cull clockwise triangles. + ccw = 0x0000_0020_0000_0000, ///Cull counter-clockwise triangles. + acw = ccw, + shift = 36, ///Culling mode bit shift + mask = 0x0000_0030_0000_0000, ///Culling mode bit mask +} + +///Alpha reference value. +alias StateAlphaRef_ = ulong; +enum StateAlphaRef: StateAlphaRef_{ + shift = 40, ///Alpha reference bit shift + mask = 0x0000_FF00_0000_0000, ///Alpha reference bit mask +} +StateAlphaRef_ toStateAlphaRef(ulong v){ return (v << StateAlphaRef.shift) & StateAlphaRef.mask; } + +alias StatePT_ = ulong; +enum StatePT: StatePT_{ + triStrip = 0x0001_0000_0000_0000, ///Tristrip. + lines = 0x0002_0000_0000_0000, ///Lines. + lineStrip = 0x0003_0000_0000_0000, ///Line strip. + points = 0x0004_0000_0000_0000, ///Points. + shift = 48, ///Primitive type bit shift + mask = 0x0007_0000_0000_0000, ///Primitive type bit mask +} + +///Point size value. +alias StatePointSize_ = ulong; +enum StatePointSize: StatePointSize_{ + shift = 52, ///Point size bit shift + mask = 0x00F0_0000_0000_0000, ///Point size bit mask +} +StatePointSize_ toStatePointSize(ulong v){ return (v << StatePointSize.shift) & StatePointSize.mask; } + +/** +Enable MSAA write when writing into MSAA frame buffer. +This flag is ignored when not writing into MSAA frame buffer. +*/ +alias State_ = ulong; +enum State: State_{ + msaa = 0x0100_0000_0000_0000, ///Enable MSAA rasterization. + lineAA = 0x0200_0000_0000_0000, ///Enable line AA rasterization. + conservativeRaster = 0x0400_0000_0000_0000, ///Enable conservative rasterization. + none = 0x0000_0000_0000_0000, ///No state. + frontCCW = 0x0000_0080_0000_0000, ///Front counter-clockwise (default is clockwise). + frontACW = frontCCW, + blendIndependent = 0x0000_0004_0000_0000, ///Enable blend independent. + blendAlphaToCoverage = 0x0000_0008_0000_0000, ///Enable alpha to coverage. + /** + Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise + culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored). + */ + default_ = StateWrite.rgb | StateWrite.a | StateWrite.z | StateDepthTest.less | StateCull.cw | State.msaa, + mask = 0xFFFF_FFFF_FFFF_FFFF, ///State bit mask +} + +///Do not use! +alias StateReserved_ = ulong; +enum StateReserved: StateReserved_{ + shift = 61, + mask = 0xE000_0000_0000_0000, +} + +///Set stencil ref value. +alias StencilFuncRef_ = uint; +enum StencilFuncRef: StencilFuncRef_{ + shift = 0, + mask = 0x0000_00FF, +} +StencilFuncRef_ toStencilFuncRef(uint v){ return (v << StencilFuncRef.shift) & StencilFuncRef.mask; } + +///Set stencil rmask value. +alias StencilFuncRmask_ = uint; +enum StencilFuncRmask: StencilFuncRmask_{ + shift = 8, + mask = 0x0000_FF00, +} +StencilFuncRmask_ toStencilFuncRmask(uint v){ return (v << StencilFuncRmask.shift) & StencilFuncRmask.mask; } + +alias Stencil_ = uint; +enum Stencil: Stencil_{ + none = 0x0000_0000, + mask = 0xFFFF_FFFF, + default_ = 0x0000_0000, +} + +alias StencilTest_ = uint; +enum StencilTest: StencilTest_{ + less = 0x0001_0000, ///Enable stencil test, less. + lEqual = 0x0002_0000, ///Enable stencil test, less or equal. + equal = 0x0003_0000, ///Enable stencil test, equal. + gEqual = 0x0004_0000, ///Enable stencil test, greater or equal. + greater = 0x0005_0000, ///Enable stencil test, greater. + notEqual = 0x0006_0000, ///Enable stencil test, not equal. + never = 0x0007_0000, ///Enable stencil test, never. + always = 0x0008_0000, ///Enable stencil test, always. + shift = 16, ///Stencil test bit shift + mask = 0x000F_0000, ///Stencil test bit mask +} + +alias StencilOpFailS_ = uint; +enum StencilOpFailS: StencilOpFailS_{ + zero = 0x0000_0000, ///Zero. + keep = 0x0010_0000, ///Keep. + replace = 0x0020_0000, ///Replace. + incr = 0x0030_0000, ///Increment and wrap. + incrSat = 0x0040_0000, ///Increment and clamp. + decr = 0x0050_0000, ///Decrement and wrap. + decrSat = 0x0060_0000, ///Decrement and clamp. + invert = 0x0070_0000, ///Invert. + shift = 20, ///Stencil operation fail bit shift + mask = 0x00F0_0000, ///Stencil operation fail bit mask +} + +alias StencilOpFailZ_ = uint; +enum StencilOpFailZ: StencilOpFailZ_{ + zero = 0x0000_0000, ///Zero. + keep = 0x0100_0000, ///Keep. + replace = 0x0200_0000, ///Replace. + incr = 0x0300_0000, ///Increment and wrap. + incrSat = 0x0400_0000, ///Increment and clamp. + decr = 0x0500_0000, ///Decrement and wrap. + decrSat = 0x0600_0000, ///Decrement and clamp. + invert = 0x0700_0000, ///Invert. + shift = 24, ///Stencil operation depth fail bit shift + mask = 0x0F00_0000, ///Stencil operation depth fail bit mask +} + +alias StencilOpPassZ_ = uint; +enum StencilOpPassZ: StencilOpPassZ_{ + zero = 0x0000_0000, ///Zero. + keep = 0x1000_0000, ///Keep. + replace = 0x2000_0000, ///Replace. + incr = 0x3000_0000, ///Increment and wrap. + incrSat = 0x4000_0000, ///Increment and clamp. + decr = 0x5000_0000, ///Decrement and wrap. + decrSat = 0x6000_0000, ///Decrement and clamp. + invert = 0x7000_0000, ///Invert. + shift = 28, ///Stencil operation depth pass bit shift + mask = 0xF000_0000, ///Stencil operation depth pass bit mask +} + +alias Clear_ = ushort; +enum Clear: Clear_{ + none = 0x0000, ///No clear flags. + color = 0x0001, ///Clear color. + colour = color, + depth = 0x0002, ///Clear depth. + stencil = 0x0004, ///Clear stencil. + discardColor0 = 0x0008, ///Discard frame buffer attachment 0. + discardColour0 = discardColor0, + discardColor1 = 0x0010, ///Discard frame buffer attachment 1. + discardColour1 = discardColor1, + discardColor2 = 0x0020, ///Discard frame buffer attachment 2. + discardColour2 = discardColor2, + discardColor3 = 0x0040, ///Discard frame buffer attachment 3. + discardColour3 = discardColor3, + discardColor4 = 0x0080, ///Discard frame buffer attachment 4. + discardColour4 = discardColor4, + discardColor5 = 0x0100, ///Discard frame buffer attachment 5. + discardColour5 = discardColor5, + discardColor6 = 0x0200, ///Discard frame buffer attachment 6. + discardColour6 = discardColor6, + discardColor7 = 0x0400, ///Discard frame buffer attachment 7. + discardColour7 = discardColor7, + discardDepth = 0x0800, ///Discard frame buffer depth attachment. + discardStencil = 0x1000, ///Discard frame buffer stencil attachment. + discardColorMask = 0x07F8, + discardColourMask = discardColorMask, + discardMask = 0x1FF8, +} + +/** +Rendering state discard. When state is preserved in submit, rendering states can be discarded +on a finer grain. +*/ +alias Discard_ = ubyte; +enum Discard: Discard_{ + none = 0x00, ///Preserve everything. + bindings = 0x01, ///Discard texture sampler and buffer bindings. + indexBuffer = 0x02, ///Discard index buffer. + instanceData = 0x04, ///Discard instance data. + state = 0x08, ///Discard state and uniform bindings. + transform = 0x10, ///Discard transform. + vertexStreams = 0x20, ///Discard vertex streams. + all = 0xFF, ///Discard all states. +} + +alias Debug_ = uint; +enum Debug: Debug_{ + none = 0x0000_0000, ///No debug. + wireframe = 0x0000_0001, ///Enable wireframe for all primitives. + /** + Enable infinitely fast hardware test. No draw calls will be submitted to driver. + It's useful when profiling to quickly assess bottleneck between CPU and GPU. + */ + ifh = 0x0000_0002, + stats = 0x0000_0004, ///Enable statistics display. + text = 0x0000_0008, ///Enable debug text display. + profiler = 0x0000_0010, ///Enable profiler. This causes per-view statistics to be collected, available through `bgfx::Stats::ViewStats`. This is unrelated to the profiler functions in `bgfx::CallbackI`. +} + +alias BufferComputeFormat_ = ushort; +enum BufferComputeFormat: BufferComputeFormat_{ + _8x1 = 0x0001, ///1 8-bit value + _8x2 = 0x0002, ///2 8-bit values + _8x4 = 0x0003, ///4 8-bit values + _16x1 = 0x0004, ///1 16-bit value + _16x2 = 0x0005, ///2 16-bit values + _16x4 = 0x0006, ///4 16-bit values + _32x1 = 0x0007, ///1 32-bit value + _32x2 = 0x0008, ///2 32-bit values + _32x4 = 0x0009, ///4 32-bit values + shift = 0, + mask = 0x000F, +} + +alias BufferComputeType_ = ushort; +enum BufferComputeType: BufferComputeType_{ + int_ = 0x0010, ///Type `int`. + uint_ = 0x0020, ///Type `uint`. + float_ = 0x0030, ///Type `float`. + shift = 4, + mask = 0x0030, +} + +alias Buffer_ = ushort; +enum Buffer: Buffer_{ + none = 0x0000, + computeRead = 0x0100, ///Buffer will be read by shader. + computeWrite = 0x0200, ///Buffer will be used for writing. + drawIndirect = 0x0400, ///Buffer will be used for storing draw indirect commands. + allowResize = 0x0800, ///Allow dynamic index/vertex buffer resize during update. + index32 = 0x1000, ///Index buffer contains 32-bit indices. + computeReadWrite = 0x0300, +} + +alias Texture_ = ulong; +enum Texture: Texture_{ + none = 0x0000_0000_0000_0000, + msaaSample = 0x0000_0008_0000_0000, ///Texture will be used for MSAA sampling. + rt = 0x0000_0010_0000_0000, ///Render target no MSAA. + computeWrite = 0x0000_1000_0000_0000, ///Texture will be used for compute write. + srgb = 0x0000_2000_0000_0000, ///Sample texture as sRGB. + blitDst = 0x0000_4000_0000_0000, ///Texture will be used as blit destination. + readBack = 0x0000_8000_0000_0000, ///Texture will be used for read back from GPU. +} + +alias TextureRTMSAA_ = ulong; +enum TextureRTMSAA: TextureRTMSAA_{ + x2 = 0x0000_0020_0000_0000, ///Render target MSAAx2 mode. + x4 = 0x0000_0030_0000_0000, ///Render target MSAAx4 mode. + x8 = 0x0000_0040_0000_0000, ///Render target MSAAx8 mode. + x16 = 0x0000_0050_0000_0000, ///Render target MSAAx16 mode. + shift = 36, + mask = 0x0000_0070_0000_0000, +} + +alias TextureRT_ = ulong; +enum TextureRT: TextureRT_{ + writeOnly = 0x0000_0080_0000_0000, ///Render target will be used for writing + shift = 36, + mask = 0x0000_00F0_0000_0000, +} + +///Sampler flags. +alias SamplerU_ = uint; +enum SamplerU: SamplerU_{ + mirror = 0x0000_0001, ///Wrap U mode: Mirror + clamp = 0x0000_0002, ///Wrap U mode: Clamp + border = 0x0000_0003, ///Wrap U mode: Border + shift = 0, + mask = 0x0000_0003, +} + +alias SamplerV_ = uint; +enum SamplerV: SamplerV_{ + mirror = 0x0000_0004, ///Wrap V mode: Mirror + clamp = 0x0000_0008, ///Wrap V mode: Clamp + border = 0x0000_000C, ///Wrap V mode: Border + shift = 2, + mask = 0x0000_000C, +} + +alias SamplerW_ = uint; +enum SamplerW: SamplerW_{ + mirror = 0x0000_0010, ///Wrap W mode: Mirror + clamp = 0x0000_0020, ///Wrap W mode: Clamp + border = 0x0000_0030, ///Wrap W mode: Border + shift = 4, + mask = 0x0000_0030, +} + +alias SamplerMin_ = uint; +enum SamplerMin: SamplerMin_{ + point = 0x0000_0040, ///Min sampling mode: Point + anisotropic = 0x0000_0080, ///Min sampling mode: Anisotropic + shift = 6, + mask = 0x0000_00C0, +} + +alias SamplerMag_ = uint; +enum SamplerMag: SamplerMag_{ + point = 0x0000_0100, ///Mag sampling mode: Point + anisotropic = 0x0000_0200, ///Mag sampling mode: Anisotropic + shift = 8, + mask = 0x0000_0300, +} + +alias SamplerMIP_ = uint; +enum SamplerMIP: SamplerMIP_{ + point = 0x0000_0400, ///Mip sampling mode: Point + shift = 10, + mask = 0x0000_0400, +} + +alias SamplerCompare_ = uint; +enum SamplerCompare: SamplerCompare_{ + less = 0x0001_0000, ///Compare when sampling depth texture: less. + lEqual = 0x0002_0000, ///Compare when sampling depth texture: less or equal. + equal = 0x0003_0000, ///Compare when sampling depth texture: equal. + gEqual = 0x0004_0000, ///Compare when sampling depth texture: greater or equal. + greater = 0x0005_0000, ///Compare when sampling depth texture: greater. + notEqual = 0x0006_0000, ///Compare when sampling depth texture: not equal. + never = 0x0007_0000, ///Compare when sampling depth texture: never. + always = 0x0008_0000, ///Compare when sampling depth texture: always. + shift = 16, + mask = 0x000F_0000, +} + +alias SamplerBorderColor_ = uint; +enum SamplerBorderColor: SamplerBorderColor_{ + shift = 24, + mask = 0x0F00_0000, +} +alias SamplerBorderColour = SamplerBorderColor; +SamplerBorderColor_ toSamplerBorderColor(uint v){ return (v << SamplerBorderColor.shift) & SamplerBorderColor.mask; } +alias toSamplerBorderColour = toSamplerBorderColor; + +alias SamplerReserved_ = uint; +enum SamplerReserved: SamplerReserved_{ + shift = 28, + mask = 0xF000_0000, +} + +alias Sampler_ = uint; +enum Sampler: Sampler_{ + none = 0x0000_0000, + sampleStencil = 0x0010_0000, ///Sample stencil instead of depth. + point = SamplerMin.point | SamplerMag.point | SamplerMIP.point, + uvwMirror = SamplerU.mirror | SamplerV.mirror | SamplerW.mirror, + uvwClamp = SamplerU.clamp | SamplerV.clamp | SamplerW.clamp, + uvwBorder = SamplerU.border | SamplerV.border | SamplerW.border, + bitsMask = SamplerU.mask | SamplerV.mask | SamplerW.mask | SamplerMin.mask | SamplerMag.mask | SamplerMIP.mask | SamplerCompare.mask, +} + +alias ResetMSAA_ = uint; +enum ResetMSAA: ResetMSAA_{ + x2 = 0x0000_0010, ///Enable 2x MSAA. + x4 = 0x0000_0020, ///Enable 4x MSAA. + x8 = 0x0000_0030, ///Enable 8x MSAA. + x16 = 0x0000_0040, ///Enable 16x MSAA. + shift = 4, + mask = 0x0000_0070, +} + +alias Reset_ = uint; +enum Reset: Reset_{ + none = 0x0000_0000, ///No reset flags. + fullscreen = 0x0000_0001, ///Not supported yet. + vsync = 0x0000_0080, ///Enable V-Sync. + maxAnisotropy = 0x0000_0100, ///Turn on/off max anisotropy. + capture = 0x0000_0200, ///Begin screen capture. + flushAfterRender = 0x0000_2000, ///Flush rendering after submitting to GPU. + /** + This flag specifies where flip occurs. Default behaviour is that flip occurs + before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. + */ + flipAfterRender = 0x0000_4000, + srgbBackbuffer = 0x0000_8000, ///Enable sRGB backbuffer. + hdr10 = 0x0001_0000, ///Enable HDR10 rendering. + hiDPI = 0x0002_0000, ///Enable HiDPI rendering. + depthClamp = 0x0004_0000, ///Enable depth clamp. + suspend = 0x0008_0000, ///Suspend rendering. + transparentBackbuffer = 0x0010_0000, ///Transparent backbuffer. Availability depends on: `BGFX_CAPS_TRANSPARENT_BACKBUFFER`. +} + +alias ResetFullscreen_ = uint; +enum ResetFullscreen: ResetFullscreen_{ + shift = 0, + mask = 0x0000_0001, +} + +alias ResetReserved_ = uint; +enum ResetReserved: ResetReserved_{ + shift = 31, ///Internal bit shift + mask = 0x8000_0000, ///Internal bit mask +} + +alias CapFlags_ = ulong; +enum CapFlags: CapFlags_{ + alphaToCoverage = 0x0000_0000_0000_0001, ///Alpha to coverage is supported. + blendIndependent = 0x0000_0000_0000_0002, ///Blend independent is supported. + compute = 0x0000_0000_0000_0004, ///Compute shaders are supported. + conservativeRaster = 0x0000_0000_0000_0008, ///Conservative rasterization is supported. + drawIndirect = 0x0000_0000_0000_0010, ///Draw indirect is supported. + fragmentDepth = 0x0000_0000_0000_0020, ///Fragment depth is available in fragment shader. + fragmentOrdering = 0x0000_0000_0000_0040, ///Fragment ordering is available in fragment shader. + graphicsDebugger = 0x0000_0000_0000_0080, ///Graphics debugger is present. + hdr10 = 0x0000_0000_0000_0100, ///HDR10 rendering is supported. + hiDPI = 0x0000_0000_0000_0200, ///HiDPI rendering is supported. + imageRW = 0x0000_0000_0000_0400, ///Image Read/Write is supported. + index32 = 0x0000_0000_0000_0800, ///32-bit indices are supported. + instancing = 0x0000_0000_0000_1000, ///Instancing is supported. + occlusionQuery = 0x0000_0000_0000_2000, ///Occlusion query is supported. + rendererMultithreaded = 0x0000_0000_0000_4000, ///Renderer is on separate thread. + swapChain = 0x0000_0000_0000_8000, ///Multiple windows are supported. + texture2DArray = 0x0000_0000_0001_0000, ///2D texture array is supported. + texture3D = 0x0000_0000_0002_0000, ///3D textures are supported. + textureBlit = 0x0000_0000_0004_0000, ///Texture blit is supported. + transparentBackbuffer = 0x0000_0000_0008_0000, ///Transparent back buffer supported. + textureCompareReserved = 0x0000_0000_0010_0000, + textureCompareLEqual = 0x0000_0000_0020_0000, ///Texture compare less equal mode is supported. + textureCubeArray = 0x0000_0000_0040_0000, ///Cubemap texture array is supported. + textureDirectAccess = 0x0000_0000_0080_0000, ///CPU direct access to GPU texture memory. + textureReadBack = 0x0000_0000_0100_0000, ///Read-back texture is supported. + vertexAttribHalf = 0x0000_0000_0200_0000, ///Vertex attribute half-float is supported. + vertexAttribUint10 = 0x0000_0000_0400_0000, ///Vertex attribute 10_10_10_2 is supported. + vertexID = 0x0000_0000_0800_0000, ///Rendering with VertexID only is supported. + primitiveID = 0x0000_0000_1000_0000, ///PrimitiveID is available in fragment shader. + viewportLayerArray = 0x0000_0000_2000_0000, ///Viewport layer is available in vertex shader. + drawIndirectCount = 0x0000_0000_4000_0000, ///Draw indirect with indirect count is supported. + textureCompareAll = 0x0000_0000_0030_0000, ///All texture compare modes are supported. +} + +alias CapsFormat_ = uint; +enum CapsFormat: CapsFormat_{ + textureNone = 0x0000_0000, ///Texture format is not supported. + texture2D = 0x0000_0001, ///Texture format is supported. + texture2DSRGB = 0x0000_0002, ///Texture as sRGB format is supported. + texture2DEmulated = 0x0000_0004, ///Texture format is emulated. + texture3D = 0x0000_0008, ///Texture format is supported. + texture3DSRGB = 0x0000_0010, ///Texture as sRGB format is supported. + texture3DEmulated = 0x0000_0020, ///Texture format is emulated. + textureCube = 0x0000_0040, ///Texture format is supported. + textureCubeSRGB = 0x0000_0080, ///Texture as sRGB format is supported. + textureCubeEmulated = 0x0000_0100, ///Texture format is emulated. + textureVertex = 0x0000_0200, ///Texture format can be used from vertex shader. + textureImageRead = 0x0000_0400, ///Texture format can be used as image and read from. + textureImageWrite = 0x0000_0800, ///Texture format can be used as image and written to. + textureFramebuffer = 0x0000_1000, ///Texture format can be used as frame buffer. + textureFramebufferMSAA = 0x0000_2000, ///Texture format can be used as MSAA frame buffer. + textureMSAA = 0x0000_4000, ///Texture can be sampled as MSAA. + textureMIPAutogen = 0x0000_8000, ///Texture format supports auto-generated mips. +} + +alias Resolve_ = ubyte; +enum Resolve: Resolve_{ + none = 0x00, ///No resolve flags. + autoGenMIPs = 0x01, ///Auto-generate mip maps on resolve. +} + +alias PCIID_ = ushort; +enum PCIID: PCIID_{ + none = 0x0000, ///Autoselect adapter. + softwareRasterizer = 0x0001, ///Software rasterizer. + softwareRasteriser = softwareRasterizer, + amd = 0x1002, ///AMD adapter. + apple = 0x106B, ///Apple adapter. + intel = 0x8086, ///Intel adapter. + nvidia = 0x10DE, ///nVidia adapter. + microsoft = 0x1414, ///Microsoft adapter. + arm = 0x13B5, ///ARM adapter. +} + +alias CubeMap_ = ubyte; +enum CubeMap: CubeMap_{ + positiveX = 0x00, ///Cubemap +x. + negativeX = 0x01, ///Cubemap -x. + positiveY = 0x02, ///Cubemap +y. + negativeY = 0x03, ///Cubemap -y. + positiveZ = 0x04, ///Cubemap +z. + negativeZ = 0x05, ///Cubemap -z. +} + +///Fatal error enum. +enum Fatal: bgfx.fakeenum.Fatal.Enum{ + debugCheck = bgfx.fakeenum.Fatal.Enum.debugCheck, + invalidShader = bgfx.fakeenum.Fatal.Enum.invalidShader, + unableToInitialize = bgfx.fakeenum.Fatal.Enum.unableToInitialize, + unableToInitialise = bgfx.fakeenum.Fatal.Enum.unableToInitialize, + unableToCreateTexture = bgfx.fakeenum.Fatal.Enum.unableToCreateTexture, + deviceLost = bgfx.fakeenum.Fatal.Enum.deviceLost, + count = bgfx.fakeenum.Fatal.Enum.count, +} + +///Renderer backend type enum. +enum RendererType: bgfx.fakeenum.RendererType.Enum{ + noop = bgfx.fakeenum.RendererType.Enum.noop, + agc = bgfx.fakeenum.RendererType.Enum.agc, + direct3D9 = bgfx.fakeenum.RendererType.Enum.direct3D9, + direct3D11 = bgfx.fakeenum.RendererType.Enum.direct3D11, + direct3D12 = bgfx.fakeenum.RendererType.Enum.direct3D12, + gnm = bgfx.fakeenum.RendererType.Enum.gnm, + metal = bgfx.fakeenum.RendererType.Enum.metal, + nvn = bgfx.fakeenum.RendererType.Enum.nvn, + openGLES = bgfx.fakeenum.RendererType.Enum.openGLES, + openGL = bgfx.fakeenum.RendererType.Enum.openGL, + vulkan = bgfx.fakeenum.RendererType.Enum.vulkan, + webGPU = bgfx.fakeenum.RendererType.Enum.webGPU, + count = bgfx.fakeenum.RendererType.Enum.count, +} + +///Access mode enum. +enum Access: bgfx.fakeenum.Access.Enum{ + read = bgfx.fakeenum.Access.Enum.read, + write = bgfx.fakeenum.Access.Enum.write, + readWrite = bgfx.fakeenum.Access.Enum.readWrite, + count = bgfx.fakeenum.Access.Enum.count, +} + +///Vertex attribute enum. +enum Attrib: bgfx.fakeenum.Attrib.Enum{ + position = bgfx.fakeenum.Attrib.Enum.position, + normal = bgfx.fakeenum.Attrib.Enum.normal, + tangent = bgfx.fakeenum.Attrib.Enum.tangent, + bitangent = bgfx.fakeenum.Attrib.Enum.bitangent, + color0 = bgfx.fakeenum.Attrib.Enum.color0, + colour0 = bgfx.fakeenum.Attrib.Enum.color0, + color1 = bgfx.fakeenum.Attrib.Enum.color1, + colour1 = bgfx.fakeenum.Attrib.Enum.color1, + color2 = bgfx.fakeenum.Attrib.Enum.color2, + colour2 = bgfx.fakeenum.Attrib.Enum.color2, + color3 = bgfx.fakeenum.Attrib.Enum.color3, + colour3 = bgfx.fakeenum.Attrib.Enum.color3, + indices = bgfx.fakeenum.Attrib.Enum.indices, + weight = bgfx.fakeenum.Attrib.Enum.weight, + texCoord0 = bgfx.fakeenum.Attrib.Enum.texCoord0, + texCoord1 = bgfx.fakeenum.Attrib.Enum.texCoord1, + texCoord2 = bgfx.fakeenum.Attrib.Enum.texCoord2, + texCoord3 = bgfx.fakeenum.Attrib.Enum.texCoord3, + texCoord4 = bgfx.fakeenum.Attrib.Enum.texCoord4, + texCoord5 = bgfx.fakeenum.Attrib.Enum.texCoord5, + texCoord6 = bgfx.fakeenum.Attrib.Enum.texCoord6, + texCoord7 = bgfx.fakeenum.Attrib.Enum.texCoord7, + count = bgfx.fakeenum.Attrib.Enum.count, +} + +///Vertex attribute type enum. +enum AttribType: bgfx.fakeenum.AttribType.Enum{ + uint8 = bgfx.fakeenum.AttribType.Enum.uint8, + uint10 = bgfx.fakeenum.AttribType.Enum.uint10, + int16 = bgfx.fakeenum.AttribType.Enum.int16, + half = bgfx.fakeenum.AttribType.Enum.half, + float_ = bgfx.fakeenum.AttribType.Enum.float_, + count = bgfx.fakeenum.AttribType.Enum.count, +} + +/** +Texture format enum. +Notation: + RGBA16S + ^ ^ ^ + | | +-- [ ]Unorm + | | [F]loat + | | [S]norm + | | [I]nt + | | [U]int + | +---- Number of bits per component + +-------- Components +@attention Availability depends on Caps (see: formats). +*/ +enum TextureFormat: bgfx.fakeenum.TextureFormat.Enum{ + bc1 = bgfx.fakeenum.TextureFormat.Enum.bc1, + bc2 = bgfx.fakeenum.TextureFormat.Enum.bc2, + bc3 = bgfx.fakeenum.TextureFormat.Enum.bc3, + bc4 = bgfx.fakeenum.TextureFormat.Enum.bc4, + bc5 = bgfx.fakeenum.TextureFormat.Enum.bc5, + bc6h = bgfx.fakeenum.TextureFormat.Enum.bc6h, + bc7 = bgfx.fakeenum.TextureFormat.Enum.bc7, + etc1 = bgfx.fakeenum.TextureFormat.Enum.etc1, + etc2 = bgfx.fakeenum.TextureFormat.Enum.etc2, + etc2a = bgfx.fakeenum.TextureFormat.Enum.etc2a, + etc2a1 = bgfx.fakeenum.TextureFormat.Enum.etc2a1, + ptc12 = bgfx.fakeenum.TextureFormat.Enum.ptc12, + ptc14 = bgfx.fakeenum.TextureFormat.Enum.ptc14, + ptc12a = bgfx.fakeenum.TextureFormat.Enum.ptc12a, + ptc14a = bgfx.fakeenum.TextureFormat.Enum.ptc14a, + ptc22 = bgfx.fakeenum.TextureFormat.Enum.ptc22, + ptc24 = bgfx.fakeenum.TextureFormat.Enum.ptc24, + atc = bgfx.fakeenum.TextureFormat.Enum.atc, + atce = bgfx.fakeenum.TextureFormat.Enum.atce, + atci = bgfx.fakeenum.TextureFormat.Enum.atci, + astc4x4 = bgfx.fakeenum.TextureFormat.Enum.astc4x4, + astc5x4 = bgfx.fakeenum.TextureFormat.Enum.astc5x4, + astc5x5 = bgfx.fakeenum.TextureFormat.Enum.astc5x5, + astc6x5 = bgfx.fakeenum.TextureFormat.Enum.astc6x5, + astc6x6 = bgfx.fakeenum.TextureFormat.Enum.astc6x6, + astc8x5 = bgfx.fakeenum.TextureFormat.Enum.astc8x5, + astc8x6 = bgfx.fakeenum.TextureFormat.Enum.astc8x6, + astc8x8 = bgfx.fakeenum.TextureFormat.Enum.astc8x8, + astc10x5 = bgfx.fakeenum.TextureFormat.Enum.astc10x5, + astc10x6 = bgfx.fakeenum.TextureFormat.Enum.astc10x6, + astc10x8 = bgfx.fakeenum.TextureFormat.Enum.astc10x8, + astc10x10 = bgfx.fakeenum.TextureFormat.Enum.astc10x10, + astc12x10 = bgfx.fakeenum.TextureFormat.Enum.astc12x10, + astc12x12 = bgfx.fakeenum.TextureFormat.Enum.astc12x12, + unknown = bgfx.fakeenum.TextureFormat.Enum.unknown, + r1 = bgfx.fakeenum.TextureFormat.Enum.r1, + a8 = bgfx.fakeenum.TextureFormat.Enum.a8, + r8 = bgfx.fakeenum.TextureFormat.Enum.r8, + r8i = bgfx.fakeenum.TextureFormat.Enum.r8i, + r8u = bgfx.fakeenum.TextureFormat.Enum.r8u, + r8s = bgfx.fakeenum.TextureFormat.Enum.r8s, + r16 = bgfx.fakeenum.TextureFormat.Enum.r16, + r16i = bgfx.fakeenum.TextureFormat.Enum.r16i, + r16u = bgfx.fakeenum.TextureFormat.Enum.r16u, + r16f = bgfx.fakeenum.TextureFormat.Enum.r16f, + r16s = bgfx.fakeenum.TextureFormat.Enum.r16s, + r32i = bgfx.fakeenum.TextureFormat.Enum.r32i, + r32u = bgfx.fakeenum.TextureFormat.Enum.r32u, + r32f = bgfx.fakeenum.TextureFormat.Enum.r32f, + rg8 = bgfx.fakeenum.TextureFormat.Enum.rg8, + rg8i = bgfx.fakeenum.TextureFormat.Enum.rg8i, + rg8u = bgfx.fakeenum.TextureFormat.Enum.rg8u, + rg8s = bgfx.fakeenum.TextureFormat.Enum.rg8s, + rg16 = bgfx.fakeenum.TextureFormat.Enum.rg16, + rg16i = bgfx.fakeenum.TextureFormat.Enum.rg16i, + rg16u = bgfx.fakeenum.TextureFormat.Enum.rg16u, + rg16f = bgfx.fakeenum.TextureFormat.Enum.rg16f, + rg16s = bgfx.fakeenum.TextureFormat.Enum.rg16s, + rg32i = bgfx.fakeenum.TextureFormat.Enum.rg32i, + rg32u = bgfx.fakeenum.TextureFormat.Enum.rg32u, + rg32f = bgfx.fakeenum.TextureFormat.Enum.rg32f, + rgb8 = bgfx.fakeenum.TextureFormat.Enum.rgb8, + rgb8i = bgfx.fakeenum.TextureFormat.Enum.rgb8i, + rgb8u = bgfx.fakeenum.TextureFormat.Enum.rgb8u, + rgb8s = bgfx.fakeenum.TextureFormat.Enum.rgb8s, + rgb9e5f = bgfx.fakeenum.TextureFormat.Enum.rgb9e5f, + bgra8 = bgfx.fakeenum.TextureFormat.Enum.bgra8, + rgba8 = bgfx.fakeenum.TextureFormat.Enum.rgba8, + rgba8i = bgfx.fakeenum.TextureFormat.Enum.rgba8i, + rgba8u = bgfx.fakeenum.TextureFormat.Enum.rgba8u, + rgba8s = bgfx.fakeenum.TextureFormat.Enum.rgba8s, + rgba16 = bgfx.fakeenum.TextureFormat.Enum.rgba16, + rgba16i = bgfx.fakeenum.TextureFormat.Enum.rgba16i, + rgba16u = bgfx.fakeenum.TextureFormat.Enum.rgba16u, + rgba16f = bgfx.fakeenum.TextureFormat.Enum.rgba16f, + rgba16s = bgfx.fakeenum.TextureFormat.Enum.rgba16s, + rgba32i = bgfx.fakeenum.TextureFormat.Enum.rgba32i, + rgba32u = bgfx.fakeenum.TextureFormat.Enum.rgba32u, + rgba32f = bgfx.fakeenum.TextureFormat.Enum.rgba32f, + b5g6r5 = bgfx.fakeenum.TextureFormat.Enum.b5g6r5, + r5g6b5 = bgfx.fakeenum.TextureFormat.Enum.r5g6b5, + bgra4 = bgfx.fakeenum.TextureFormat.Enum.bgra4, + rgba4 = bgfx.fakeenum.TextureFormat.Enum.rgba4, + bgr5a1 = bgfx.fakeenum.TextureFormat.Enum.bgr5a1, + rgb5a1 = bgfx.fakeenum.TextureFormat.Enum.rgb5a1, + rgb10a2 = bgfx.fakeenum.TextureFormat.Enum.rgb10a2, + rg11b10f = bgfx.fakeenum.TextureFormat.Enum.rg11b10f, + unknownDepth = bgfx.fakeenum.TextureFormat.Enum.unknownDepth, + d16 = bgfx.fakeenum.TextureFormat.Enum.d16, + d24 = bgfx.fakeenum.TextureFormat.Enum.d24, + d24s8 = bgfx.fakeenum.TextureFormat.Enum.d24s8, + d32 = bgfx.fakeenum.TextureFormat.Enum.d32, + d16f = bgfx.fakeenum.TextureFormat.Enum.d16f, + d24f = bgfx.fakeenum.TextureFormat.Enum.d24f, + d32f = bgfx.fakeenum.TextureFormat.Enum.d32f, + d0s8 = bgfx.fakeenum.TextureFormat.Enum.d0s8, + count = bgfx.fakeenum.TextureFormat.Enum.count, +} + +///Uniform type enum. +enum UniformType: bgfx.fakeenum.UniformType.Enum{ + sampler = bgfx.fakeenum.UniformType.Enum.sampler, + end = bgfx.fakeenum.UniformType.Enum.end, + vec4 = bgfx.fakeenum.UniformType.Enum.vec4, + mat3 = bgfx.fakeenum.UniformType.Enum.mat3, + mat4 = bgfx.fakeenum.UniformType.Enum.mat4, + count = bgfx.fakeenum.UniformType.Enum.count, +} + +///Backbuffer ratio enum. +enum BackbufferRatio: bgfx.fakeenum.BackbufferRatio.Enum{ + equal = bgfx.fakeenum.BackbufferRatio.Enum.equal, + half = bgfx.fakeenum.BackbufferRatio.Enum.half, + quarter = bgfx.fakeenum.BackbufferRatio.Enum.quarter, + eighth = bgfx.fakeenum.BackbufferRatio.Enum.eighth, + sixteenth = bgfx.fakeenum.BackbufferRatio.Enum.sixteenth, + double_ = bgfx.fakeenum.BackbufferRatio.Enum.double_, + count = bgfx.fakeenum.BackbufferRatio.Enum.count, +} + +///Occlusion query result. +enum OcclusionQueryResult: bgfx.fakeenum.OcclusionQueryResult.Enum{ + invisible = bgfx.fakeenum.OcclusionQueryResult.Enum.invisible, + visible = bgfx.fakeenum.OcclusionQueryResult.Enum.visible, + noResult = bgfx.fakeenum.OcclusionQueryResult.Enum.noResult, + count = bgfx.fakeenum.OcclusionQueryResult.Enum.count, +} + +///Primitive topology. +enum Topology: bgfx.fakeenum.Topology.Enum{ + triList = bgfx.fakeenum.Topology.Enum.triList, + triStrip = bgfx.fakeenum.Topology.Enum.triStrip, + lineList = bgfx.fakeenum.Topology.Enum.lineList, + lineStrip = bgfx.fakeenum.Topology.Enum.lineStrip, + pointList = bgfx.fakeenum.Topology.Enum.pointList, + count = bgfx.fakeenum.Topology.Enum.count, +} + +///Topology conversion function. +enum TopologyConvert: bgfx.fakeenum.TopologyConvert.Enum{ + triListFlipWinding = bgfx.fakeenum.TopologyConvert.Enum.triListFlipWinding, + triStripFlipWinding = bgfx.fakeenum.TopologyConvert.Enum.triStripFlipWinding, + triListToLineList = bgfx.fakeenum.TopologyConvert.Enum.triListToLineList, + triStripToTriList = bgfx.fakeenum.TopologyConvert.Enum.triStripToTriList, + lineStripToLineList = bgfx.fakeenum.TopologyConvert.Enum.lineStripToLineList, + count = bgfx.fakeenum.TopologyConvert.Enum.count, +} + +///Topology sort order. +enum TopologySort: bgfx.fakeenum.TopologySort.Enum{ + directionFrontToBackMin = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackMin, + directionFrontToBackAvg = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackAvg, + directionFrontToBackMax = bgfx.fakeenum.TopologySort.Enum.directionFrontToBackMax, + directionBackToFrontMin = bgfx.fakeenum.TopologySort.Enum.directionBackToFrontMin, + directionBackToFrontAvg = bgfx.fakeenum.TopologySort.Enum.directionBackToFrontAvg, + directionBackToFrontMax = bgfx.fakeenum.TopologySort.Enum.directionBackToFrontMax, + distanceFrontToBackMin = bgfx.fakeenum.TopologySort.Enum.distanceFrontToBackMin, + distanceFrontToBackAvg = bgfx.fakeenum.TopologySort.Enum.distanceFrontToBackAvg, + distanceFrontToBackMax = bgfx.fakeenum.TopologySort.Enum.distanceFrontToBackMax, + distanceBackToFrontMin = bgfx.fakeenum.TopologySort.Enum.distanceBackToFrontMin, + distanceBackToFrontAvg = bgfx.fakeenum.TopologySort.Enum.distanceBackToFrontAvg, + distanceBackToFrontMax = bgfx.fakeenum.TopologySort.Enum.distanceBackToFrontMax, + count = bgfx.fakeenum.TopologySort.Enum.count, +} + +///View mode sets draw call sort order. +enum ViewMode: bgfx.fakeenum.ViewMode.Enum{ + default_ = bgfx.fakeenum.ViewMode.Enum.default_, + sequential = bgfx.fakeenum.ViewMode.Enum.sequential, + depthAscending = bgfx.fakeenum.ViewMode.Enum.depthAscending, + depthDescending = bgfx.fakeenum.ViewMode.Enum.depthDescending, + count = bgfx.fakeenum.ViewMode.Enum.count, +} + +///Native window handle type. +enum NativeWindowHandleType: bgfx.fakeenum.NativeWindowHandleType.Enum{ + default_ = bgfx.fakeenum.NativeWindowHandleType.Enum.default_, + wayland = bgfx.fakeenum.NativeWindowHandleType.Enum.wayland, + count = bgfx.fakeenum.NativeWindowHandleType.Enum.count, +} + +///Render frame enum. +enum RenderFrame: bgfx.fakeenum.RenderFrame.Enum{ + noContext = bgfx.fakeenum.RenderFrame.Enum.noContext, + render = bgfx.fakeenum.RenderFrame.Enum.render, + timeout = bgfx.fakeenum.RenderFrame.Enum.timeout, + exiting = bgfx.fakeenum.RenderFrame.Enum.exiting, + count = bgfx.fakeenum.RenderFrame.Enum.count, +} + +extern(C++, "bgfx") struct DynamicIndexBufferHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct DynamicVertexBufferHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct FrameBufferHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct IndexBufferHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct IndirectBufferHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct OcclusionQueryHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct ProgramHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct ShaderHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct TextureHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct UniformHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct VertexBufferHandle{ + ushort idx; +} + +extern(C++, "bgfx") struct VertexLayoutHandle{ + ushort idx; +} + +pragma(inline,true) nothrow @nogc pure @safe{ + StateBlend_ blendFuncSeparate(StateBlend_ srcRGB, StateBlend_ dstRGB, StateBlend_ srcA, StateBlend_ dstA){ + return (srcRGB | ((dstRGB) << 4)) | ((srcA | (dstA << 4)) << 8); + } + + ///Blend equation separate. + StateBlendEquation_ blendEquationSeparate(StateBlendEquation_ equationRGB, StateBlendEquation_ equationA){ + return equationRGB | (equationA << 3); + } + + ///Blend function. + StateBlend_ blendFunc(StateBlend_ src, StateBlend_ dst){ return blendFuncSeparate(src, dst, src, dst); } + + ///Blend equation. + StateBlendEquation_ blendEquation(StateBlendEquation_ equation){ return blendEquationSeparate(equation, equation); } + + ///Utility predefined blend modes. + enum StateBlendFunc: StateBlend_{ + ///Additive blending. + add = blendFunc(StateBlend.one, StateBlend.one), + + ///Alpha blend. + alpha = blendFunc(StateBlend.srcAlpha, StateBlend.invSrcAlpha), + + ///Selects darker color of blend. + darken = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.min), + + ///Selects lighter color of blend. + lighten = blendFunc(StateBlend.one, StateBlend.one) | blendEquation(StateBlendEquation.max), + + ///Multiplies colors. + multiply = blendFunc(StateBlend.dstColor, StateBlend.zero), + + ///Opaque pixels will cover the pixels directly below them without any math or algorithm applied to them. + normal = blendFunc(StateBlend.one, StateBlend.invSrcAlpha), + + ///Multiplies the inverse of the blend and base colors. + screen = blendFunc(StateBlend.one, StateBlend.invSrcColor), + + ///Decreases the brightness of the base color based on the value of the blend color. + linearBurn = blendFunc(StateBlend.dstColor, StateBlend.invDstColor) | blendEquation(StateBlendEquation.sub), + } + + StateBlend_ blendFuncRTx(StateBlend_ src, StateBlend_ dst){ + return cast(uint)(src >> StateBlend.shift) | (cast(uint)(dst >> StateBlend.shift) << 4); + } + + StateBlend_ blendFuncRTxE(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){ + return blendFuncRTx(src, dst) | (cast(uint)(equation >> StateBlendEquation.shift) << 8); + } + + StateBlend_ blendFuncRT1(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 0; } + StateBlend_ blendFuncRT2(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 11; } + StateBlend_ blendFuncRT3(StateBlend_ src, StateBlend_ dst){ return blendFuncRTx(src, dst) << 22; } + + StateBlend_ blendFuncRT1E(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){ + return blendFuncRTxE(src, dst, equation) << 0; + } + StateBlend_ blendFuncRT2E(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){ + return blendFuncRTxE(src, dst, equation) << 11; + } + StateBlend_ blendFuncRT3E(StateBlend_ src, StateBlend_ dst, StateBlendEquation_ equation){ + return blendFuncRTxE(src, dst, equation) << 22; + } +} + +///Renderer capabilities. +extern(C++, "bgfx") struct Caps{ + ///GPU info. + extern(C++) struct GPU{ + ushort vendorID; ///Vendor PCI id. See `BGFX_PCI_ID_*`. + ushort deviceID; ///Device id. + } + ///Renderer runtime limits. + extern(C++) struct Limits{ + uint maxDrawCalls; ///Maximum number of draw calls. + uint maxBlits; ///Maximum number of blit calls. + uint maxTextureSize; ///Maximum texture size. + uint maxTextureLayers; ///Maximum texture layers. + uint maxViews; ///Maximum number of views. + uint maxFrameBuffers; ///Maximum number of frame buffer handles. + uint maxFBAttachments; ///Maximum number of frame buffer attachments. + uint maxPrograms; ///Maximum number of program handles. + uint maxShaders; ///Maximum number of shader handles. + uint maxTextures; ///Maximum number of texture handles. + uint maxTextureSamplers; ///Maximum number of texture samplers. + uint maxComputeBindings; ///Maximum number of compute bindings. + uint maxVertexLayouts; ///Maximum number of vertex format layouts. + uint maxVertexStreams; ///Maximum number of vertex streams. + uint maxIndexBuffers; ///Maximum number of index buffer handles. + uint maxVertexBuffers; ///Maximum number of vertex buffer handles. + uint maxDynamicIndexBuffers; ///Maximum number of dynamic index buffer handles. + uint maxDynamicVertexBuffers; ///Maximum number of dynamic vertex buffer handles. + uint maxUniforms; ///Maximum number of uniform handles. + uint maxOcclusionQueries; ///Maximum number of occlusion query handles. + uint maxEncoders; ///Maximum number of encoder threads. + uint minResourceCBSize; ///Minimum resource command buffer size. + uint transientVBSize; ///Maximum transient vertex buffer size. + uint transientIBSize; ///Maximum transient index buffer size. + } + + RendererType rendererType; ///Renderer backend type. See: `bgfx::RendererType` + + /** + Supported functionality. + @attention See `BGFX_CAPS_*` flags at https://bkaradzic.github.io/bgfx/bgfx.html#available-caps + */ + ulong supported; + ushort vendorID; ///Selected GPU vendor PCI id. + ushort deviceID; ///Selected GPU device id. + bool homogeneousDepth; ///True when NDC depth is in [-1, 1] range, otherwise its [0, 1]. + bool originBottomLeft; ///True when NDC origin is at bottom left. + ubyte numGPUs; ///Number of enumerated GPUs. + GPU[4] gpu; ///Enumerated GPUs. + Limits limits; ///Renderer runtime limits. + + /** + Supported texture format capabilities flags: + - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - Texture format is not supported. + - `BGFX_CAPS_FORMAT_TEXTURE_2D` - Texture format is supported. + - `BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB` - Texture as sRGB format is supported. + - `BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED` - Texture format is emulated. + - `BGFX_CAPS_FORMAT_TEXTURE_3D` - Texture format is supported. + - `BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB` - Texture as sRGB format is supported. + - `BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED` - Texture format is emulated. + - `BGFX_CAPS_FORMAT_TEXTURE_CUBE` - Texture format is supported. + - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB` - Texture as sRGB format is supported. + - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED` - Texture format is emulated. + - `BGFX_CAPS_FORMAT_TEXTURE_VERTEX` - Texture format can be used from vertex shader. + - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ` - Texture format can be used as image + and read from. + - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE` - Texture format can be used as image + and written to. + - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER` - Texture format can be used as frame + buffer. + - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA` - Texture format can be used as MSAA + frame buffer. + - `BGFX_CAPS_FORMAT_TEXTURE_MSAA` - Texture can be sampled as MSAA. + - `BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN` - Texture format supports auto-generated + mips. + */ + ushort[TextureFormat.count] formats; +} + +///Internal data. +extern(C++, "bgfx") struct InternalData{ + const(Caps)* caps; ///Renderer capabilities. + void* context; ///GL context, or D3D device. +} + +///Platform data. +extern(C++, "bgfx") struct PlatformData{ + void* ndt; ///Native display type (*nix specific). + + /** + Native window handle. If `NULL`, bgfx will create a headless + context/device, provided the rendering API supports it. + */ + void* nwh; + + /** + GL context, D3D device, or Vulkan device. If `NULL`, bgfx + will create context/device. + */ + void* context; + + /** + GL back-buffer, or D3D render target view. If `NULL` bgfx will + create back-buffer color surface. + */ + void* backBuffer; + + /** + Backbuffer depth/stencil. If `NULL`, bgfx will create a back-buffer + depth/stencil surface. + */ + void* backBufferDS; + NativeWindowHandleType type; ///Handle type. Needed for platforms having more than one option. +} + +///Backbuffer resolution and reset parameters. +extern(C++, "bgfx") struct Resolution{ + TextureFormat format; ///Backbuffer format. + uint width; ///Backbuffer width. + uint height; ///Backbuffer height. + uint reset; ///Reset parameters. + ubyte numBackBuffers; ///Number of back buffers. + ubyte maxFrameLatency; ///Maximum frame latency. + ubyte debugTextScale; ///Scale factor for debug text. + extern(D) mixin(joinFnBinds((){ + string[][] ret; + ret ~= makeFnBinds([ + [q{void}, q{this}, q{}, `C++`], + ], true); + return ret; + }(), typeof(this).stringof)); +} + +///Initialization parameters used by `bgfx::init`. +extern(C++, "bgfx") struct Init{ + ///Configurable runtime limits parameters. + extern(C++) struct Limits{ + ushort maxEncoders; ///Maximum number of encoder threads. + uint minResourceCBSize; ///Minimum resource command buffer size. + uint transientVBSize; ///Maximum transient vertex buffer size. + uint transientIBSize; ///Maximum transient index buffer size. + } + + /** + Select rendering backend. When set to RendererType::Count + a default rendering backend will be selected appropriate to the platform. + See: `bgfx::RendererType` + */ + RendererType type; + + /** + Vendor PCI ID. If set to `BGFX_PCI_ID_NONE`, discrete and integrated + GPUs will be prioritised. + - `BGFX_PCI_ID_NONE` - Autoselect adapter. + - `BGFX_PCI_ID_SOFTWARE_RASTERIZER` - Software rasterizer. + - `BGFX_PCI_ID_AMD` - AMD adapter. + - `BGFX_PCI_ID_APPLE` - Apple adapter. + - `BGFX_PCI_ID_INTEL` - Intel adapter. + - `BGFX_PCI_ID_NVIDIA` - NVIDIA adapter. + - `BGFX_PCI_ID_MICROSOFT` - Microsoft adapter. + */ + ushort vendorID; + + /** + Device ID. If set to 0 it will select first device, or device with + matching ID. + */ + ushort deviceID; + ulong capabilities; ///Capabilities initialization mask (default: UINT64_MAX). + bool debug_; ///Enable device for debugging. + bool profile; ///Enable device for profiling. + PlatformData platformData; ///Platform data. + Resolution resolution; ///Backbuffer resolution and reset parameters. See: `bgfx::Resolution`. + Limits limits; ///Configurable runtime limits parameters. + + /** + Provide application specific callback interface. + See: `bgfx::CallbackI` + */ + void* callback; + + /** + Custom allocator. When a custom allocator is not + specified, bgfx uses the CRT allocator. Bgfx assumes + custom allocator is thread safe. + */ + void* allocator; + extern(D) mixin(joinFnBinds((){ + string[][] ret; + ret ~= makeFnBinds([ + [q{void}, q{this}, q{}, `C++`], + ], true); + return ret; + }(), typeof(this).stringof)); +} + +/** +Memory must be obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`. +@attention It is illegal to create this structure on stack and pass it to any bgfx API. +*/ +extern(C++, "bgfx") struct Memory{ + ubyte* data; ///Pointer to data. + uint size; ///Data size. +} + +///Transient index buffer. +extern(C++, "bgfx") struct TransientIndexBuffer{ + ubyte* data; ///Pointer to data. + uint size; ///Data size. + uint startIndex; ///First index. + IndexBufferHandle handle; ///Index buffer handle. + bool isIndex16; ///Index buffer format is 16-bits if true, otherwise it is 32-bit. +} + +///Transient vertex buffer. +extern(C++, "bgfx") struct TransientVertexBuffer{ + ubyte* data; ///Pointer to data. + uint size; ///Data size. + uint startVertex; ///First vertex. + ushort stride; ///Vertex stride. + VertexBufferHandle handle; ///Vertex buffer handle. + VertexLayoutHandle layoutHandle; ///Vertex layout handle. +} + +///Instance data buffer info. +extern(C++, "bgfx") struct InstanceDataBuffer{ + ubyte* data; ///Pointer to data. + uint size; ///Data size. + uint offset; ///Offset in vertex buffer. + uint num; ///Number of instances. + ushort stride; ///Vertex buffer stride. + VertexBufferHandle handle; ///Vertex buffer object handle. +} + +///Texture info. +extern(C++, "bgfx") struct TextureInfo{ + TextureFormat format; ///Texture format. + uint storageSize; ///Total amount of bytes required to store texture. + ushort width; ///Texture width. + ushort height; ///Texture height. + ushort depth; ///Texture depth. + ushort numLayers; ///Number of layers in texture array. + ubyte numMIPs; ///Number of MIP maps. + ubyte bitsPerPixel; ///Format bits per pixel. + bool cubeMap; ///Texture is cubemap. +} + +///Uniform info. +extern(C++, "bgfx") struct UniformInfo{ + char[256] name; ///Uniform name. + UniformType type; ///Uniform type. + ushort num; ///Number of elements in array. +} + +///Frame buffer texture attachment info. +extern(C++, "bgfx") struct Attachment{ + Access access; ///Attachment access. See `Access::Enum`. + TextureHandle handle; ///Render target texture handle. + ushort mip; ///Mip level. + ushort layer; ///Cubemap side or depth layer/slice to use. + ushort numLayers; ///Number of texture layer/slice(s) in array to use. + ubyte resolve; ///Resolve flags. See: `BGFX_RESOLVE_*` + extern(D) mixin(joinFnBinds((){ + string[][] ret; + ret ~= makeFnBinds([ + /** + Init attachment. + Params: + handle = Render target texture handle. + access = Access. See `Access::Enum`. + layer = Cubemap side or depth layer/slice to use. + numLayers = Number of texture layer/slice(s) in array to use. + mip = Mip level. + resolve = Resolve flags. See: `BGFX_RESOLVE_*` + */ + [q{void}, q{init}, q{TextureHandle handle, bgfx.fakeenum.Access.Enum access=Access.write, ushort layer=0, ushort numLayers=1, ushort mip=0, ubyte resolve=Resolve.autoGenMIPs}, `C++`], + ], true); + return ret; + }(), typeof(this).stringof)); +} + +///Transform data. +extern(C++, "bgfx") struct Transform{ + float* data; ///Pointer to first 4x4 matrix. + ushort num; ///Number of matrices. +} + +///View stats. +extern(C++, "bgfx") struct ViewStats{ + char[256] name; ///View name. + ViewID view; ///View id. + long cpuTimeBegin; ///CPU (submit) begin time. + long cpuTimeEnd; ///CPU (submit) end time. + long gpuTimeBegin; ///GPU begin time. + long gpuTimeEnd; ///GPU end time. + uint gpuFrameNum; ///Frame which generated gpuTimeBegin, gpuTimeEnd. +} + +///Encoder stats. +extern(C++, "bgfx") struct EncoderStats{ + long cpuTimeBegin; ///Encoder thread CPU submit begin time. + long cpuTimeEnd; ///Encoder thread CPU submit end time. +} + +/** +Renderer statistics data. +@remarks All time values are high-resolution timestamps, while +time frequencies define timestamps-per-second for that hardware. +*/ +extern(C++, "bgfx") struct Stats{ + long cpuTimeFrame; ///CPU time between two `bgfx::frame` calls. + long cpuTimeBegin; ///Render thread CPU submit begin time. + long cpuTimeEnd; ///Render thread CPU submit end time. + long cpuTimerFreq; ///CPU timer frequency. Timestamps-per-second + long gpuTimeBegin; ///GPU frame begin time. + long gpuTimeEnd; ///GPU frame end time. + long gpuTimerFreq; ///GPU timer frequency. + long waitRender; ///Time spent waiting for render backend thread to finish issuing draw commands to underlying graphics API. + long waitSubmit; ///Time spent waiting for submit thread to advance to next frame. + uint numDraw; ///Number of draw calls submitted. + uint numCompute; ///Number of compute calls submitted. + uint numBlit; ///Number of blit calls submitted. + uint maxGpuLatency; ///GPU driver latency. + uint gpuFrameNum; ///Frame which generated gpuTimeBegin, gpuTimeEnd. + ushort numDynamicIndexBuffers; ///Number of used dynamic index buffers. + ushort numDynamicVertexBuffers; ///Number of used dynamic vertex buffers. + ushort numFrameBuffers; ///Number of used frame buffers. + ushort numIndexBuffers; ///Number of used index buffers. + ushort numOcclusionQueries; ///Number of used occlusion queries. + ushort numPrograms; ///Number of used programs. + ushort numShaders; ///Number of used shaders. + ushort numTextures; ///Number of used textures. + ushort numUniforms; ///Number of used uniforms. + ushort numVertexBuffers; ///Number of used vertex buffers. + ushort numVertexLayouts; ///Number of used vertex layouts. + long textureMemoryUsed; ///Estimate of texture memory used. + long rtMemoryUsed; ///Estimate of render target memory used. + int transientVBUsed; ///Amount of transient vertex buffer used. + int transientIBUsed; ///Amount of transient index buffer used. + uint[Topology.count] numPrims; ///Number of primitives rendered. + long gpuMemoryMax; ///Maximum available GPU memory for application. + long gpuMemoryUsed; ///Amount of GPU memory used by the application. + ushort width; ///Backbuffer width in pixels. + ushort height; ///Backbuffer height in pixels. + ushort textWidth; ///Debug text width in characters. + ushort textHeight; ///Debug text height in characters. + ushort numViews; ///Number of view stats. + ViewStats* viewStats; ///Array of View stats. + ubyte numEncoders; ///Number of encoders used during frame. + EncoderStats* encoderStats; ///Array of encoder stats. +} + +///Vertex layout. +extern(C++, "bgfx") struct VertexLayout{ + uint hash; ///Hash. + ushort stride; ///Stride. + ushort[Attrib.count] offset; ///Attribute offsets. + ushort[Attrib.count] attributes; ///Used attributes. + extern(D) mixin(joinFnBinds((){ + string[][] ret; + ret ~= makeFnBinds([ + [q{void}, q{this}, q{}, `C++`], + + /** + Start VertexLayout. + Params: + rendererType = Renderer backend type. See: `bgfx::RendererType` + */ + [q{VertexLayout*}, q{begin}, q{bgfx.fakeenum.RendererType.Enum rendererType=RendererType.noop}, `C++`], + + /** + Add attribute to VertexLayout. + Remarks: Must be called between begin/end. + Params: + attrib = Attribute semantics. See: `bgfx::Attrib` + num = Number of elements 1, 2, 3 or 4. + type = Element type. + normalized = When using fixed point AttribType (f.e. Uint8) + value will be normalized for vertex shader usage. When normalized + is set to true, AttribType::Uint8 value in range 0-255 will be + in range 0.0-1.0 in vertex shader. + asInt = Packaging rule for vertexPack, vertexUnpack, and + vertexConvert for AttribType::Uint8 and AttribType::Int16. + Unpacking code must be implemented inside vertex shader. + */ + [q{VertexLayout*}, q{add}, q{bgfx.fakeenum.Attrib.Enum attrib, ubyte num, bgfx.fakeenum.AttribType.Enum type, bool normalized=false, bool asInt=false}, `C++`], + + /** + Decode attribute. + Params: + attrib = Attribute semantics. See: `bgfx::Attrib` + num = Number of elements. + type = Element type. + normalized = Attribute is normalized. + asInt = Attribute is packed as int. + */ + [q{void}, q{decode}, q{bgfx.fakeenum.Attrib.Enum attrib, ref ubyte num, ref bgfx.fakeenum.AttribType.Enum type, ref bool normalized, ref bool asInt}, `C++`, q{const}], + + /** + Skip `_num` bytes in vertex stream. + Params: + num = Number of bytes to skip. + */ + [q{VertexLayout*}, q{skip}, q{ubyte num}, `C++`], + + /** + End VertexLayout. + */ + [q{void}, q{end}, q{}, `C++`], + ], true); + return ret; + }(), typeof(this).stringof)); +} + +/** +Encoders are used for submitting draw calls from multiple threads. Only one encoder +per thread should be used. Use `bgfx::begin()` to obtain an encoder for a thread. +*/ +extern(C++, "bgfx") struct Encoder{ + extern(D) mixin(joinFnBinds((){ + string[][] ret; + ret ~= makeFnBinds([ + /** + Sets a debug marker. This allows you to group graphics calls together for easy browsing in + graphics debugging tools. + Params: + marker = Marker string. + */ + [q{void}, q{setMarker}, q{const(char)* marker}, `C++`], + + /** + Set render states for draw primitive. + Remarks: + 1. To set up more complex states use: + `BGFX_STATE_ALPHA_REF(_ref)`, + `BGFX_STATE_POINT_SIZE(_size)`, + `BGFX_STATE_BLEND_FUNC(_src, _dst)`, + `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, + `BGFX_STATE_BLEND_EQUATION(_equation)`, + `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` + 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend + equation is specified. + Params: + state = State flags. Default state for primitive type is + triangles. See: `BGFX_STATE_DEFAULT`. + - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. + - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. + - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. + - `BGFX_STATE_CULL_*` - Backface culling mode. + - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. + - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. + - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. + rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and + `BGFX_STATE_BLEND_INV_FACTOR` blend modes. + */ + [q{void}, q{setState}, q{ulong state, uint rgba=0}, `C++`], + + /** + Set condition for rendering. + Params: + handle = Occlusion query handle. + visible = Render if occlusion query is visible. + */ + [q{void}, q{setCondition}, q{OcclusionQueryHandle handle, bool visible}, `C++`], + + /** + Set stencil test state. + Params: + fstencil = Front stencil state. + bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE` + _fstencil is applied to both front and back facing primitives. + */ + [q{void}, q{setStencil}, q{uint fstencil, uint bstencil=Stencil.none}, `C++`], + + /** + Set scissor for draw primitive. + Remarks: + To scissor for all primitives in view see `bgfx::setViewScissor`. + Params: + x = Position x from the left corner of the window. + y = Position y from the top corner of the window. + width = Width of view scissor region. + height = Height of view scissor region. + */ + [q{ushort}, q{setScissor}, q{ushort x, ushort y, ushort width, ushort height}, `C++`], + + /** + Set scissor from cache for draw primitive. + Remarks: + To scissor for all primitives in view see `bgfx::setViewScissor`. + Params: + cache = Index in scissor cache. + */ + [q{void}, q{setScissor}, q{ushort cache=ushort.max}, `C++`], + + /** + Set model matrix for draw primitive. If it is not called, + the model will be rendered with an identity model matrix. + Params: + mtx = Pointer to first matrix in array. + num = Number of matrices in array. + */ + [q{uint}, q{setTransform}, q{const(void)* mtx, ushort num=1}, `C++`], + + /** + Set model matrix from matrix cache for draw primitive. + Params: + cache = Index in matrix cache. + num = Number of matrices from cache. + */ + [q{void}, q{setTransform}, q{uint cache, ushort num=1}, `C++`], + + /** + Reserve matrices in internal matrix cache. + Attention: Pointer returned can be modified until `bgfx::frame` is called. + Params: + transform = Pointer to `Transform` structure. + num = Number of matrices. + */ + [q{uint}, q{allocTransform}, q{Transform* transform, ushort num}, `C++`], + + /** + Set shader uniform parameter for draw primitive. + Params: + handle = Uniform. + value = Pointer to uniform data. + num = Number of elements. Passing `UINT16_MAX` will + use the _num passed on uniform creation. + */ + [q{void}, q{setUniform}, q{UniformHandle handle, const(void)* value, ushort num=1}, `C++`], + + /** + Set index buffer for draw primitive. + Params: + handle = Index buffer. + */ + [q{void}, q{setIndexBuffer}, q{IndexBufferHandle handle}, `C++`], + + /** + Set index buffer for draw primitive. + Params: + handle = Index buffer. + firstIndex = First index to render. + numIndices = Number of indices to render. + */ + [q{void}, q{setIndexBuffer}, q{IndexBufferHandle handle, uint firstIndex, uint numIndices}, `C++`], + + /** + Set index buffer for draw primitive. + Params: + handle = Dynamic index buffer. + */ + [q{void}, q{setIndexBuffer}, q{DynamicIndexBufferHandle handle}, `C++`], + + /** + Set index buffer for draw primitive. + Params: + handle = Dynamic index buffer. + firstIndex = First index to render. + numIndices = Number of indices to render. + */ + [q{void}, q{setIndexBuffer}, q{DynamicIndexBufferHandle handle, uint firstIndex, uint numIndices}, `C++`], + + /** + Set index buffer for draw primitive. + Params: + tib = Transient index buffer. + */ + [q{void}, q{setIndexBuffer}, q{const(TransientIndexBuffer)* tib}, `C++`], + + /** + Set index buffer for draw primitive. + Params: + tib = Transient index buffer. + firstIndex = First index to render. + numIndices = Number of indices to render. + */ + [q{void}, q{setIndexBuffer}, q{const(TransientIndexBuffer)* tib, uint firstIndex, uint numIndices}, `C++`], + + /** + Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + handle = Vertex buffer. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, VertexBufferHandle handle}, `C++`], + + /** + Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + handle = Vertex buffer. + startVertex = First vertex to render. + numVertices = Number of vertices to render. + layoutHandle = Vertex layout for aliasing vertex buffer. If invalid + handle is used, vertex layout used for creation + of vertex buffer will be used. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, VertexBufferHandle handle, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++`], + + /** + Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + handle = Dynamic vertex buffer. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, DynamicVertexBufferHandle handle}, `C++`], + [q{void}, q{setVertexBuffer}, q{ubyte stream, DynamicVertexBufferHandle handle, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++`], + + /** + Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + tvb = Transient vertex buffer. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, const(TransientVertexBuffer)* tvb}, `C++`], + + /** + Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + tvb = Transient vertex buffer. + startVertex = First vertex to render. + numVertices = Number of vertices to render. + layoutHandle = Vertex layout for aliasing vertex buffer. If invalid + handle is used, vertex layout used for creation + of vertex buffer will be used. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, const(TransientVertexBuffer)* tvb, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++`], + + /** + Set number of vertices for auto generated vertices use in conjunction + with gl_VertexID. + Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. + Params: + numVertices = Number of vertices. + */ + [q{void}, q{setVertexCount}, q{uint numVertices}, `C++`], + + /** + Set instance data buffer for draw primitive. + Params: + idb = Transient instance data buffer. + */ + [q{void}, q{setInstanceDataBuffer}, q{const(InstanceDataBuffer)* idb}, `C++`], + + /** + Set instance data buffer for draw primitive. + Params: + idb = Transient instance data buffer. + start = First instance data. + num = Number of data instances. + */ + [q{void}, q{setInstanceDataBuffer}, q{const(InstanceDataBuffer)* idb, uint start, uint num}, `C++`], + + /** + Set instance data buffer for draw primitive. + Params: + handle = Vertex buffer. + startVertex = First instance data. + num = Number of data instances. + */ + [q{void}, q{setInstanceDataBuffer}, q{VertexBufferHandle handle, uint startVertex, uint num}, `C++`], + + /** + Set instance data buffer for draw primitive. + Params: + handle = Dynamic vertex buffer. + startVertex = First instance data. + num = Number of data instances. + */ + [q{void}, q{setInstanceDataBuffer}, q{DynamicVertexBufferHandle handle, uint startVertex, uint num}, `C++`], + + /** + Set number of instances for auto generated instances use in conjunction + with gl_InstanceID. + Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. + */ + [q{void}, q{setInstanceCount}, q{uint numInstances}, `C++`], + + /** + Set texture stage for draw primitive. + Params: + stage = Texture unit. + sampler = Program sampler. + handle = Texture handle. + flags = Texture sampling mode. Default value UINT32_MAX uses + texture sampling settings from the texture. + - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + mode. + - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + sampling. + */ + [q{void}, q{setTexture}, q{ubyte stage, UniformHandle sampler, TextureHandle handle, uint flags=uint.max}, `C++`], + + /** + Submit an empty primitive for rendering. Uniforms and draw state + will be applied but no geometry will be submitted. Useful in cases + when no other draw/compute primitive is submitted to view, but it's + desired to execute clear view. + Remarks: + These empty draw calls will sort before ordinary draw calls. + Params: + id = View id. + */ + [q{void}, q{touch}, q{ViewID id}, `C++`], + + /** + Submit primitive for rendering. + Params: + id = View id. + program = Program. + depth = Depth for sorting. + flags = Discard or preserve states. See `BGFX_DISCARD_*`. + */ + [q{void}, q{submit}, q{ViewID id, ProgramHandle program, uint depth=0, ubyte flags=Discard.all}, `C++`], + + /** + Submit primitive with occlusion query for rendering. + Params: + id = View id. + program = Program. + occlusionQuery = Occlusion query. + depth = Depth for sorting. + flags = Discard or preserve states. See `BGFX_DISCARD_*`. + */ + [q{void}, q{submit}, q{ViewID id, ProgramHandle program, OcclusionQueryHandle occlusionQuery, uint depth=0, ubyte flags=Discard.all}, `C++`], + + /** + Submit primitive for rendering with index and instance data info from + indirect buffer. + Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`. + Params: + id = View id. + program = Program. + indirectHandle = Indirect buffer. + start = First element in indirect buffer. + num = Number of draws. + depth = Depth for sorting. + flags = Discard or preserve states. See `BGFX_DISCARD_*`. + */ + [q{void}, q{submit}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, uint depth=0, ubyte flags=Discard.all}, `C++`], + + /** + Submit primitive for rendering with index and instance data info and + draw count from indirect buffers. + Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`. + Params: + id = View id. + program = Program. + indirectHandle = Indirect buffer. + start = First element in indirect buffer. + numHandle = Buffer for number of draws. Must be + created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`. + numIndex = Element in number buffer. + numMax = Max number of draws. + depth = Depth for sorting. + flags = Discard or preserve states. See `BGFX_DISCARD_*`. + */ + [q{void}, q{submit}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start, IndexBufferHandle numHandle, uint numIndex=0, ushort numMax=ushort.max, uint depth=0, ubyte flags=Discard.all}, `C++`], + + /** + Set compute index buffer. + Params: + stage = Compute stage. + handle = Index buffer handle. + access = Buffer access. See `Access::Enum`. + */ + [q{void}, q{setBuffer}, q{ubyte stage, IndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++`], + + /** + Set compute vertex buffer. + Params: + stage = Compute stage. + handle = Vertex buffer handle. + access = Buffer access. See `Access::Enum`. + */ + [q{void}, q{setBuffer}, q{ubyte stage, VertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++`], + + /** + Set compute dynamic index buffer. + Params: + stage = Compute stage. + handle = Dynamic index buffer handle. + access = Buffer access. See `Access::Enum`. + */ + [q{void}, q{setBuffer}, q{ubyte stage, DynamicIndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++`], + + /** + Set compute dynamic vertex buffer. + Params: + stage = Compute stage. + handle = Dynamic vertex buffer handle. + access = Buffer access. See `Access::Enum`. + */ + [q{void}, q{setBuffer}, q{ubyte stage, DynamicVertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++`], + + /** + Set compute indirect buffer. + Params: + stage = Compute stage. + handle = Indirect buffer handle. + access = Buffer access. See `Access::Enum`. + */ + [q{void}, q{setBuffer}, q{ubyte stage, IndirectBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++`], + + /** + Set compute image from texture. + Params: + stage = Compute stage. + handle = Texture handle. + mip = Mip level. + access = Image access. See `Access::Enum`. + format = Texture format. See: `TextureFormat::Enum`. + */ + [q{void}, q{setImage}, q{ubyte stage, TextureHandle handle, ubyte mip, bgfx.fakeenum.Access.Enum access, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count}, `C++`], + + /** + Dispatch compute. + Params: + id = View id. + program = Compute program. + numX = Number of groups X. + numY = Number of groups Y. + numZ = Number of groups Z. + flags = Discard or preserve states. See `BGFX_DISCARD_*`. + */ + [q{void}, q{dispatch}, q{ViewID id, ProgramHandle program, uint numX=1, uint numY=1, uint numZ=1, ubyte flags=Discard.all}, `C++`], + + /** + Dispatch compute indirect. + Params: + id = View id. + program = Compute program. + indirectHandle = Indirect buffer. + start = First element in indirect buffer. + num = Number of dispatches. + flags = Discard or preserve states. See `BGFX_DISCARD_*`. + */ + [q{void}, q{dispatch}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, ubyte flags=Discard.all}, `C++`], + + /** + Discard previously set state for draw or compute call. + Params: + flags = Discard or preserve states. See `BGFX_DISCARD_*`. + */ + [q{void}, q{discard}, q{ubyte flags=Discard.all}, `C++`], + + /** + Blit 2D texture region between two 2D textures. + Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. + Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. + Params: + id = View id. + dst = Destination texture handle. + dstX = Destination texture X position. + dstY = Destination texture Y position. + src = Source texture handle. + srcX = Source texture X position. + srcY = Source texture Y position. + width = Width of region. + height = Height of region. + */ + [q{void}, q{blit}, q{ViewID id, TextureHandle dst, ushort dstX, ushort dstY, TextureHandle src, ushort srcX=0, ushort srcY=0, ushort width=ushort.max, ushort height=ushort.max}, `C++`], + + /** + Blit 2D texture region between two 2D textures. + Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. + Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. + Params: + id = View id. + dst = Destination texture handle. + dstMIP = Destination texture mip level. + dstX = Destination texture X position. + dstY = Destination texture Y position. + dstZ = If texture is 2D this argument should be 0. If destination texture is cube + this argument represents destination texture cube face. For 3D texture this argument + represents destination texture Z position. + src = Source texture handle. + srcMIP = Source texture mip level. + srcX = Source texture X position. + srcY = Source texture Y position. + srcZ = If texture is 2D this argument should be 0. If source texture is cube + this argument represents source texture cube face. For 3D texture this argument + represents source texture Z position. + width = Width of region. + height = Height of region. + depth = If texture is 3D this argument represents depth of region, otherwise it's + unused. + */ + [q{void}, q{blit}, q{ViewID id, TextureHandle dst, ubyte dstMIP, ushort dstX, ushort dstY, ushort dstZ, TextureHandle src, ubyte srcMIP=0, ushort srcX=0, ushort srcY=0, ushort srcZ=0, ushort width=ushort.max, ushort height=ushort.max, ushort depth=ushort.max}, `C++`], + ], true); + return ret; + }(), typeof(this).stringof)); +} + +mixin(joinFnBinds((){ + string[][] ret; + ret ~= makeFnBinds([ + /** + * Pack vertex attribute into vertex stream format. + Params: + input = Value to be packed into vertex stream. + inputNormalized = `true` if input value is already normalized. + attr = Attribute to pack. + layout = Vertex stream layout. + data = Destination vertex stream where data will be packed. + index = Vertex index that will be modified. + */ + [q{void}, q{vertexPack}, q{const(float)* input, bool inputNormalized, bgfx.fakeenum.Attrib.Enum attr, ref const VertexLayout layout, void* data, uint index=0}, `C++, "bgfx"`], + + /** + * Unpack vertex attribute from vertex stream format. + Params: + output = Result of unpacking. + attr = Attribute to unpack. + layout = Vertex stream layout. + data = Source vertex stream from where data will be unpacked. + index = Vertex index that will be unpacked. + */ + [q{void}, q{vertexUnpack}, q{float* output, bgfx.fakeenum.Attrib.Enum attr, ref const VertexLayout layout, const(void)* data, uint index=0}, `C++, "bgfx"`], + + /** + * Converts vertex stream data from one vertex stream format to another. + Params: + dstLayout = Destination vertex stream layout. + dstData = Destination vertex stream. + srcLayout = Source vertex stream layout. + srcData = Source vertex stream data. + num = Number of vertices to convert from source to destination. + */ + [q{void}, q{vertexConvert}, q{ref const VertexLayout dstLayout, void* dstData, ref const VertexLayout srcLayout, const(void)* srcData, uint num=1}, `C++, "bgfx"`], + + /** + * Weld vertices. + Params: + output = Welded vertices remapping table. The size of buffer + must be the same as number of vertices. + layout = Vertex stream layout. + data = Vertex stream. + num = Number of vertices in vertex stream. + index32 = Set to `true` if input indices are 32-bit. + epsilon = Error tolerance for vertex position comparison. + */ + [q{uint}, q{weldVertices}, q{void* output, ref const VertexLayout layout, const(void)* data, uint num, bool index32, float epsilon=0.001f}, `C++, "bgfx"`], + + /** + * Convert index buffer for use with different primitive topologies. + Params: + conversion = Conversion type, see `TopologyConvert::Enum`. + dst = Destination index buffer. If this argument is NULL + function will return number of indices after conversion. + dstSize = Destination index buffer in bytes. It must be + large enough to contain output indices. If destination size is + insufficient index buffer will be truncated. + indices = Source indices. + numIndices = Number of input indices. + index32 = Set to `true` if input indices are 32-bit. + */ + [q{uint}, q{topologyConvert}, q{bgfx.fakeenum.TopologyConvert.Enum conversion, void* dst, uint dstSize, const(void)* indices, uint numIndices, bool index32}, `C++, "bgfx"`], + + /** + * Sort indices. + Params: + sort = Sort order, see `TopologySort::Enum`. + dst = Destination index buffer. + dstSize = Destination index buffer in bytes. It must be + large enough to contain output indices. If destination size is + insufficient index buffer will be truncated. + dir = Direction (vector must be normalized). + pos = Position. + vertices = Pointer to first vertex represented as + float x, y, z. Must contain at least number of vertices + referencende by index buffer. + stride = Vertex stride. + indices = Source indices. + numIndices = Number of input indices. + index32 = Set to `true` if input indices are 32-bit. + */ + [q{void}, q{topologySortTriList}, q{bgfx.fakeenum.TopologySort.Enum sort, void* dst, uint dstSize, const(float)* dir, const(float)* pos, const(void)* vertices, uint stride, const(void)* indices, uint numIndices, bool index32}, `C++, "bgfx"`], + + /** + * Returns supported backend API renderers. + Params: + max = Maximum number of elements in _enum array. + enum_ = Array where supported renderers will be written. + */ + [q{ubyte}, q{getSupportedRenderers}, q{ubyte max=0, bgfx.fakeenum.RendererType.Enum* enum_=null}, `C++, "bgfx"`], + + /** + * Returns name of renderer. + Params: + type = Renderer backend type. See: `bgfx::RendererType` + */ + [q{const(char)*}, q{getRendererName}, q{bgfx.fakeenum.RendererType.Enum type}, `C++, "bgfx"`], + + /** + * Initialize the bgfx library. + Params: + init = Initialization parameters. See: `bgfx::Init` for more info. + */ + [q{bool}, q{init}, q{ref const Init init}, `C++, "bgfx"`], + + /** + * Shutdown bgfx library. + */ + [q{void}, q{shutdown}, q{}, `C++, "bgfx"`], + + /** + * Reset graphic settings and back-buffer size. + * Attention: This call doesn’t change the window size, it just resizes + * the back-buffer. Your windowing code controls the window size. + Params: + width = Back-buffer width. + height = Back-buffer height. + flags = See: `BGFX_RESET_*` for more info. + - `BGFX_RESET_NONE` - No reset flags. + - `BGFX_RESET_FULLSCREEN` - Not supported yet. + - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA. + - `BGFX_RESET_VSYNC` - Enable V-Sync. + - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy. + - `BGFX_RESET_CAPTURE` - Begin screen capture. + - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU. + - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip + occurs. Default behaviour is that flip occurs before rendering new + frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. + - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB back-buffer. + format = Texture format. See: `TextureFormat::Enum`. + */ + [q{void}, q{reset}, q{uint width, uint height, uint flags=Reset.none, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count}, `C++, "bgfx"`], + + /** + * Advance to next frame. When using multithreaded renderer, this call + * just swaps internal buffers, kicks render thread, and returns. In + * singlethreaded renderer this call does frame rendering. + Params: + capture = Capture frame with graphics debugger. + */ + [q{uint}, q{frame}, q{bool capture=false}, `C++, "bgfx"`], + + /** + * Returns current renderer backend API type. + * Remarks: + * Library must be initialized. + */ + [q{RendererType}, q{getRendererType}, q{}, `C++, "bgfx"`], + + /** + * Returns renderer capabilities. + * Remarks: + * Library must be initialized. + */ + [q{const(Caps)*}, q{getCaps}, q{}, `C++, "bgfx"`], + + /** + * Returns performance counters. + * Attention: Pointer returned is valid until `bgfx::frame` is called. + */ + [q{const(Stats)*}, q{getStats}, q{}, `C++, "bgfx"`], + + /** + * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx. + Params: + size = Size to allocate. + */ + [q{const(Memory)*}, q{alloc}, q{uint size}, `C++, "bgfx"`], + + /** + * Allocate buffer and copy data into it. Data will be freed inside bgfx. + Params: + data = Pointer to data to be copied. + size = Size of data to be copied. + */ + [q{const(Memory)*}, q{copy}, q{const(void)* data, uint size}, `C++, "bgfx"`], + + /** + * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call + * doesn't allocate memory for data. It just copies the _data pointer. You + * can pass `ReleaseFn` function pointer to release this memory after it's + * consumed, otherwise you must make sure _data is available for at least 2 + * `bgfx::frame` calls. `ReleaseFn` function must be able to be called + * from any thread. + * Attention: Data passed must be available for at least 2 `bgfx::frame` calls. + Params: + data = Pointer to data. + size = Size of data. + releaseFn = Callback function to release memory after use. + userData = User data to be passed to callback function. + */ + [q{const(Memory)*}, q{makeRef}, q{const(void)* data, uint size, ReleaseFn releaseFn=null, void* userData=null}, `C++, "bgfx"`], + + /** + * Set debug flags. + Params: + debug_ = Available flags: + - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set + all rendering calls will be skipped. This is useful when profiling + to quickly assess potential bottlenecks between CPU and GPU. + - `BGFX_DEBUG_PROFILER` - Enable profiler. + - `BGFX_DEBUG_STATS` - Display internal statistics. + - `BGFX_DEBUG_TEXT` - Display debug text. + - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering + primitives will be rendered as lines. + */ + [q{void}, q{setDebug}, q{uint debug_}, `C++, "bgfx"`], + + /** + * Clear internal debug text buffer. + Params: + attr = Background color. + small = Default 8x16 or 8x8 font. + */ + [q{void}, q{dbgTextClear}, q{ubyte attr=0, bool small=false}, `C++, "bgfx"`], + + /** + * Print formatted data to internal debug text character-buffer (VGA-compatible text mode). + Params: + x = Position x from the left corner of the window. + y = Position y from the top corner of the window. + attr = Color palette. Where top 4-bits represent index of background, and bottom + 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). + format = `printf` style format. + */ + [q{void}, q{dbgTextPrintf}, q{ushort x, ushort y, ubyte attr, const(char)* format, ...}, `C++, "bgfx"`], + + /** + * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode). + Params: + x = Position x from the left corner of the window. + y = Position y from the top corner of the window. + attr = Color palette. Where top 4-bits represent index of background, and bottom + 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). + format = `printf` style format. + argList = Variable arguments list for format string. + */ + [q{void}, q{dbgTextPrintfVargs}, q{ushort x, ushort y, ubyte attr, const(char)* format, va_list argList}, `C++, "bgfx"`], + + /** + * Draw image into internal debug text buffer. + Params: + x = Position x from the left corner of the window. + y = Position y from the top corner of the window. + width = Image width. + height = Image height. + data = Raw image data (character/attribute raw encoding). + pitch = Image pitch in bytes. + */ + [q{void}, q{dbgTextImage}, q{ushort x, ushort y, ushort width, ushort height, const(void)* data, ushort pitch}, `C++, "bgfx"`], + + /** + * Create static index buffer. + Params: + mem = Index buffer data. + flags = Buffer creation flags. + - `BGFX_BUFFER_NONE` - No flags. + - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. + - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer + is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. + - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. + - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + data is passed. If this flag is not specified, and more data is passed on update, the buffer + will be trimmed to fit the existing buffer size. This flag has effect only on dynamic + buffers. + - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on + index buffers. + */ + [q{IndexBufferHandle}, q{createIndexBuffer}, q{const(Memory)* mem, ushort flags=Buffer.none}, `C++, "bgfx"`], + + /** + * Set static index buffer debug name. + Params: + handle = Static index buffer handle. + name = Static index buffer name. + len = Static index buffer name length (if length is INT32_MAX, it's expected + that _name is zero terminated string. + */ + [q{void}, q{setName}, q{IndexBufferHandle handle, const(char)* name, int len=int.max}, `C++, "bgfx"`], + + /** + * Destroy static index buffer. + Params: + handle = Static index buffer handle. + */ + [q{void}, q{destroy}, q{IndexBufferHandle handle}, `C++, "bgfx"`], + + /** + * Create vertex layout. + Params: + layout = Vertex layout. + */ + [q{VertexLayoutHandle}, q{createVertexLayout}, q{ref const VertexLayout layout}, `C++, "bgfx"`], + + /** + * Destroy vertex layout. + Params: + layoutHandle = Vertex layout handle. + */ + [q{void}, q{destroy}, q{VertexLayoutHandle layoutHandle}, `C++, "bgfx"`], + + /** + * Create static vertex buffer. + Params: + mem = Vertex buffer data. + layout = Vertex layout. + flags = Buffer creation flags. + - `BGFX_BUFFER_NONE` - No flags. + - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. + - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer + is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. + - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. + - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + data is passed. If this flag is not specified, and more data is passed on update, the buffer + will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. + - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers. + */ + [q{VertexBufferHandle}, q{createVertexBuffer}, q{const(Memory)* mem, ref const VertexLayout layout, ushort flags=Buffer.none}, `C++, "bgfx"`], + + /** + * Set static vertex buffer debug name. + Params: + handle = Static vertex buffer handle. + name = Static vertex buffer name. + len = Static vertex buffer name length (if length is INT32_MAX, it's expected + that _name is zero terminated string. + */ + [q{void}, q{setName}, q{VertexBufferHandle handle, const(char)* name, int len=int.max}, `C++, "bgfx"`], + + /** + * Destroy static vertex buffer. + Params: + handle = Static vertex buffer handle. + */ + [q{void}, q{destroy}, q{VertexBufferHandle handle}, `C++, "bgfx"`], + + /** + * Create empty dynamic index buffer. + Params: + num = Number of indices. + flags = Buffer creation flags. + - `BGFX_BUFFER_NONE` - No flags. + - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. + - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer + is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. + - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. + - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + data is passed. If this flag is not specified, and more data is passed on update, the buffer + will be trimmed to fit the existing buffer size. This flag has effect only on dynamic + buffers. + - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on + index buffers. + */ + [q{DynamicIndexBufferHandle}, q{createDynamicIndexBuffer}, q{uint num, ushort flags=Buffer.none}, `C++, "bgfx"`], + + /** + * Create a dynamic index buffer and initialize it. + Params: + mem = Index buffer data. + flags = Buffer creation flags. + - `BGFX_BUFFER_NONE` - No flags. + - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. + - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer + is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. + - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. + - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + data is passed. If this flag is not specified, and more data is passed on update, the buffer + will be trimmed to fit the existing buffer size. This flag has effect only on dynamic + buffers. + - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on + index buffers. + */ + [q{DynamicIndexBufferHandle}, q{createDynamicIndexBuffer}, q{const(Memory)* mem, ushort flags=Buffer.none}, `C++, "bgfx"`], + + /** + * Update dynamic index buffer. + Params: + handle = Dynamic index buffer handle. + startIndex = Start index. + mem = Index buffer data. + */ + [q{void}, q{update}, q{DynamicIndexBufferHandle handle, uint startIndex, const(Memory)* mem}, `C++, "bgfx"`], + + /** + * Destroy dynamic index buffer. + Params: + handle = Dynamic index buffer handle. + */ + [q{void}, q{destroy}, q{DynamicIndexBufferHandle handle}, `C++, "bgfx"`], + + /** + * Create empty dynamic vertex buffer. + Params: + num = Number of vertices. + layout = Vertex layout. + flags = Buffer creation flags. + - `BGFX_BUFFER_NONE` - No flags. + - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. + - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer + is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. + - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. + - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + data is passed. If this flag is not specified, and more data is passed on update, the buffer + will be trimmed to fit the existing buffer size. This flag has effect only on dynamic + buffers. + - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on + index buffers. + */ + [q{DynamicVertexBufferHandle}, q{createDynamicVertexBuffer}, q{uint num, ref const VertexLayout layout, ushort flags=Buffer.none}, `C++, "bgfx"`], + + /** + * Create dynamic vertex buffer and initialize it. + Params: + mem = Vertex buffer data. + layout = Vertex layout. + flags = Buffer creation flags. + - `BGFX_BUFFER_NONE` - No flags. + - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. + - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer + is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. + - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. + - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + data is passed. If this flag is not specified, and more data is passed on update, the buffer + will be trimmed to fit the existing buffer size. This flag has effect only on dynamic + buffers. + - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on + index buffers. + */ + [q{DynamicVertexBufferHandle}, q{createDynamicVertexBuffer}, q{const(Memory)* mem, ref const VertexLayout layout, ushort flags=Buffer.none}, `C++, "bgfx"`], + + /** + * Update dynamic vertex buffer. + Params: + handle = Dynamic vertex buffer handle. + startVertex = Start vertex. + mem = Vertex buffer data. + */ + [q{void}, q{update}, q{DynamicVertexBufferHandle handle, uint startVertex, const(Memory)* mem}, `C++, "bgfx"`], + + /** + * Destroy dynamic vertex buffer. + Params: + handle = Dynamic vertex buffer handle. + */ + [q{void}, q{destroy}, q{DynamicVertexBufferHandle handle}, `C++, "bgfx"`], + + /** + * Returns number of requested or maximum available indices. + Params: + num = Number of required indices. + index32 = Set to `true` if input indices will be 32-bit. + */ + [q{uint}, q{getAvailTransientIndexBuffer}, q{uint num, bool index32=false}, `C++, "bgfx"`], + + /** + * Returns number of requested or maximum available vertices. + Params: + num = Number of required vertices. + layout = Vertex layout. + */ + [q{uint}, q{getAvailTransientVertexBuffer}, q{uint num, ref const VertexLayout layout}, `C++, "bgfx"`], + + /** + * Returns number of requested or maximum available instance buffer slots. + Params: + num = Number of required instances. + stride = Stride per instance. + */ + [q{uint}, q{getAvailInstanceDataBuffer}, q{uint num, ushort stride}, `C++, "bgfx"`], + + /** + * Allocate transient index buffer. + Params: + tib = TransientIndexBuffer structure will be filled, and will be valid + for the duration of frame, and can be reused for multiple draw + calls. + num = Number of indices to allocate. + index32 = Set to `true` if input indices will be 32-bit. + */ + [q{void}, q{allocTransientIndexBuffer}, q{TransientIndexBuffer* tib, uint num, bool index32=false}, `C++, "bgfx"`], + + /** + * Allocate transient vertex buffer. + Params: + tvb = TransientVertexBuffer structure will be filled, and will be valid + for the duration of frame, and can be reused for multiple draw + calls. + num = Number of vertices to allocate. + layout = Vertex layout. + */ + [q{void}, q{allocTransientVertexBuffer}, q{TransientVertexBuffer* tvb, uint num, ref const VertexLayout layout}, `C++, "bgfx"`], + + /** + * Check for required space and allocate transient vertex and index + * buffers. If both space requirements are satisfied function returns + * true. + Params: + tvb = TransientVertexBuffer structure will be filled, and will be valid + for the duration of frame, and can be reused for multiple draw + calls. + layout = Vertex layout. + numVertices = Number of vertices to allocate. + tib = TransientIndexBuffer structure will be filled, and will be valid + for the duration of frame, and can be reused for multiple draw + calls. + numIndices = Number of indices to allocate. + index32 = Set to `true` if input indices will be 32-bit. + */ + [q{bool}, q{allocTransientBuffers}, q{TransientVertexBuffer* tvb, ref const VertexLayout layout, uint numVertices, TransientIndexBuffer* tib, uint numIndices, bool index32=false}, `C++, "bgfx"`], + + /** + * Allocate instance data buffer. + Params: + idb = InstanceDataBuffer structure will be filled, and will be valid + for duration of frame, and can be reused for multiple draw + calls. + num = Number of instances. + stride = Instance stride. Must be multiple of 16. + */ + [q{void}, q{allocInstanceDataBuffer}, q{InstanceDataBuffer* idb, uint num, ushort stride}, `C++, "bgfx"`], + + /** + * Create draw indirect buffer. + Params: + num = Number of indirect calls. + */ + [q{IndirectBufferHandle}, q{createIndirectBuffer}, q{uint num}, `C++, "bgfx"`], + + /** + * Destroy draw indirect buffer. + Params: + handle = Indirect buffer handle. + */ + [q{void}, q{destroy}, q{IndirectBufferHandle handle}, `C++, "bgfx"`], + + /** + * Create shader from memory buffer. + Params: + mem = Shader binary. + */ + [q{ShaderHandle}, q{createShader}, q{const(Memory)* mem}, `C++, "bgfx"`], + + /** + * Returns the number of uniforms and uniform handles used inside a shader. + * Remarks: + * Only non-predefined uniforms are returned. + Params: + handle = Shader handle. + uniforms = UniformHandle array where data will be stored. + max = Maximum capacity of array. + */ + [q{ushort}, q{getShaderUniforms}, q{ShaderHandle handle, UniformHandle* uniforms=null, ushort max=0}, `C++, "bgfx"`], + + /** + * Set shader debug name. + Params: + handle = Shader handle. + name = Shader name. + len = Shader name length (if length is INT32_MAX, it's expected + that _name is zero terminated string). + */ + [q{void}, q{setName}, q{ShaderHandle handle, const(char)* name, int len=int.max}, `C++, "bgfx"`], + + /** + * Destroy shader. + * Remarks: Once a shader program is created with _handle, + * it is safe to destroy that shader. + Params: + handle = Shader handle. + */ + [q{void}, q{destroy}, q{ShaderHandle handle}, `C++, "bgfx"`], + + /** + * Create program with vertex and fragment shaders. + Params: + vsh = Vertex shader. + fsh = Fragment shader. + destroyShaders = If true, shaders will be destroyed when program is destroyed. + */ + [q{ProgramHandle}, q{createProgram}, q{ShaderHandle vsh, ShaderHandle fsh, bool destroyShaders=false}, `C++, "bgfx"`], + + /** + * Create program with compute shader. + Params: + csh = Compute shader. + destroyShaders = If true, shaders will be destroyed when program is destroyed. + */ + [q{ProgramHandle}, q{createProgram}, q{ShaderHandle csh, bool destroyShaders=false}, `C++, "bgfx"`], + + /** + * Destroy program. + Params: + handle = Program handle. + */ + [q{void}, q{destroy}, q{ProgramHandle handle}, `C++, "bgfx"`], + + /** + * Validate texture parameters. + Params: + depth = Depth dimension of volume texture. + cubeMap = Indicates that texture contains cubemap. + numLayers = Number of layers in texture array. + format = Texture format. See: `TextureFormat::Enum`. + flags = Texture flags. See `BGFX_TEXTURE_*`. + */ + [q{bool}, q{isTextureValid}, q{ushort depth, bool cubeMap, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, ulong flags}, `C++, "bgfx"`], + + /** + * Validate frame buffer parameters. + Params: + num = Number of attachments. + attachment = Attachment texture info. See: `bgfx::Attachment`. + */ + [q{bool}, q{isFrameBufferValid}, q{ubyte num, const(Attachment)* attachment}, `C++, "bgfx"`], + + /** + * Calculate amount of memory required for texture. + Params: + info = Resulting texture info structure. See: `TextureInfo`. + width = Width. + height = Height. + depth = Depth dimension of volume texture. + cubeMap = Indicates that texture contains cubemap. + hasMIPs = Indicates that texture contains full mip-map chain. + numLayers = Number of layers in texture array. + format = Texture format. See: `TextureFormat::Enum`. + */ + [q{void}, q{calcTextureSize}, q{ref TextureInfo info, ushort width, ushort height, ushort depth, bool cubeMap, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format}, `C++, "bgfx"`], + + /** + * Create texture from memory buffer. + Params: + mem = DDS, KTX or PVR texture binary data. + flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + flags. Default texture sampling mode is linear, and wrap mode is repeat. + - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + mode. + - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + sampling. + skip = Skip top level mips when parsing texture. + info = When non-`NULL` is specified it returns parsed texture information. + */ + [q{TextureHandle}, q{createTexture}, q{const(Memory)* mem, ulong flags, ubyte skip=0, TextureInfo* info=null}, `C++, "bgfx"`], + + /** + * Create 2D texture. + Params: + width = Width. + height = Height. + hasMIPs = Indicates that texture contains full mip-map chain. + numLayers = Number of layers in texture array. Must be 1 if caps + `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. + format = Texture format. See: `TextureFormat::Enum`. + flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + flags. Default texture sampling mode is linear, and wrap mode is repeat. + - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + mode. + - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + sampling. + mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If + `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than + 1, expected memory layout is texture and all mips together for each array element. + */ + [q{TextureHandle}, q{createTexture2D}, q{ushort width, ushort height, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, ulong flags, const(Memory)* mem=null}, `C++, "bgfx"`], + + /** + * Create texture with size based on back-buffer ratio. Texture will maintain ratio + * if back buffer resolution changes. + Params: + ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`. + hasMIPs = Indicates that texture contains full mip-map chain. + numLayers = Number of layers in texture array. Must be 1 if caps + `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. + format = Texture format. See: `TextureFormat::Enum`. + flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + flags. Default texture sampling mode is linear, and wrap mode is repeat. + - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + mode. + - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + sampling. + */ + [q{TextureHandle}, q{createTexture2D}, q{bgfx.fakeenum.BackbufferRatio.Enum ratio, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, ulong flags=Texture.none|Sampler.none}, `C++, "bgfx"`], + + /** + * Create 3D texture. + Params: + width = Width. + height = Height. + depth = Depth. + hasMIPs = Indicates that texture contains full mip-map chain. + format = Texture format. See: `TextureFormat::Enum`. + flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + flags. Default texture sampling mode is linear, and wrap mode is repeat. + - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + mode. + - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + sampling. + mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If + `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than + 1, expected memory layout is texture and all mips together for each array element. + */ + [q{TextureHandle}, q{createTexture3D}, q{ushort width, ushort height, ushort depth, bool hasMIPs, bgfx.fakeenum.TextureFormat.Enum format, ulong flags=Texture.none|Sampler.none, const(Memory)* mem=null}, `C++, "bgfx"`], + + /** + * Create Cube texture. + Params: + size = Cube side size. + hasMIPs = Indicates that texture contains full mip-map chain. + numLayers = Number of layers in texture array. Must be 1 if caps + `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. + format = Texture format. See: `TextureFormat::Enum`. + flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + flags. Default texture sampling mode is linear, and wrap mode is repeat. + - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + mode. + - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + sampling. + mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If + `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than + 1, expected memory layout is texture and all mips together for each array element. + */ + [q{TextureHandle}, q{createTextureCube}, q{ushort size, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, ulong flags=Texture.none|Sampler.none, const(Memory)* mem=null}, `C++, "bgfx"`], + + /** + * Update 2D texture. + * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info. + Params: + handle = Texture handle. + layer = Layer in texture array. + mip = Mip level. + x = X offset in texture. + y = Y offset in texture. + width = Width of texture block. + height = Height of texture block. + mem = Texture update data. + pitch = Pitch of input image (bytes). When _pitch is set to + UINT16_MAX, it will be calculated internally based on _width. + */ + [q{void}, q{updateTexture2D}, q{TextureHandle handle, ushort layer, ubyte mip, ushort x, ushort y, ushort width, ushort height, const(Memory)* mem, ushort pitch=ushort.max}, `C++, "bgfx"`], + + /** + * Update 3D texture. + * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info. + Params: + handle = Texture handle. + mip = Mip level. + x = X offset in texture. + y = Y offset in texture. + z = Z offset in texture. + width = Width of texture block. + height = Height of texture block. + depth = Depth of texture block. + mem = Texture update data. + */ + [q{void}, q{updateTexture3D}, q{TextureHandle handle, ubyte mip, ushort x, ushort y, ushort z, ushort width, ushort height, ushort depth, const(Memory)* mem}, `C++, "bgfx"`], + + /** + * Update Cube texture. + * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info. + Params: + handle = Texture handle. + layer = Layer in texture array. + side = Cubemap side `BGFX_CUBE_MAP__`, + where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z. + +----------+ + |-z 2| + | ^ +y | + | | | Unfolded cube: + | +---->+x | + +----------+----------+----------+----------+ + |+y 1|+y 4|+y 0|+y 5| + | ^ -x | ^ +z | ^ +x | ^ -z | + | | | | | | | | | + | +---->+z | +---->+x | +---->-z | +---->-x | + +----------+----------+----------+----------+ + |+z 3| + | ^ -y | + | | | + | +---->+x | + +----------+ + mip = Mip level. + x = X offset in texture. + y = Y offset in texture. + width = Width of texture block. + height = Height of texture block. + mem = Texture update data. + pitch = Pitch of input image (bytes). When _pitch is set to + UINT16_MAX, it will be calculated internally based on _width. + */ + [q{void}, q{updateTextureCube}, q{TextureHandle handle, ushort layer, ubyte side, ubyte mip, ushort x, ushort y, ushort width, ushort height, const(Memory)* mem, ushort pitch=ushort.max}, `C++, "bgfx"`], + + /** + * Read back texture content. + * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag. + * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`. + Params: + handle = Texture handle. + data = Destination buffer. + mip = Mip level. + */ + [q{uint}, q{readTexture}, q{TextureHandle handle, void* data, ubyte mip=0}, `C++, "bgfx"`], + + /** + * Set texture debug name. + Params: + handle = Texture handle. + name = Texture name. + len = Texture name length (if length is INT32_MAX, it's expected + that _name is zero terminated string. + */ + [q{void}, q{setName}, q{TextureHandle handle, const(char)* name, int len=int.max}, `C++, "bgfx"`], + + /** + * Returns texture direct access pointer. + * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature + * is available on GPUs that have unified memory architecture (UMA) support. + Params: + handle = Texture handle. + */ + [q{void*}, q{getDirectAccessPtr}, q{TextureHandle handle}, `C++, "bgfx"`], + + /** + * Destroy texture. + Params: + handle = Texture handle. + */ + [q{void}, q{destroy}, q{TextureHandle handle}, `C++, "bgfx"`], + + /** + * Create frame buffer (simple). + Params: + width = Texture width. + height = Texture height. + format = Texture format. See: `TextureFormat::Enum`. + textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + flags. Default texture sampling mode is linear, and wrap mode is repeat. + - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + mode. + - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + sampling. + */ + [q{FrameBufferHandle}, q{createFrameBuffer}, q{ushort width, ushort height, bgfx.fakeenum.TextureFormat.Enum format, ulong textureFlags=SamplerU.clamp|SamplerV.clamp}, `C++, "bgfx"`], + + /** + * Create frame buffer with size based on back-buffer ratio. Frame buffer will maintain ratio + * if back buffer resolution changes. + Params: + ratio = Frame buffer size in respect to back-buffer size. See: + `BackbufferRatio::Enum`. + format = Texture format. See: `TextureFormat::Enum`. + textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + flags. Default texture sampling mode is linear, and wrap mode is repeat. + - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + mode. + - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + sampling. + */ + [q{FrameBufferHandle}, q{createFrameBuffer}, q{bgfx.fakeenum.BackbufferRatio.Enum ratio, bgfx.fakeenum.TextureFormat.Enum format, ulong textureFlags=SamplerU.clamp|SamplerV.clamp}, `C++, "bgfx"`], + + /** + * Create MRT frame buffer from texture handles (simple). + Params: + num = Number of texture handles. + handles = Texture attachments. + destroyTexture = If true, textures will be destroyed when + frame buffer is destroyed. + */ + [q{FrameBufferHandle}, q{createFrameBuffer}, q{ubyte num, const(TextureHandle)* handles, bool destroyTexture=false}, `C++, "bgfx"`], + + /** + * Create MRT frame buffer from texture handles with specific layer and + * mip level. + Params: + num = Number of attachments. + attachment = Attachment texture info. See: `bgfx::Attachment`. + destroyTexture = If true, textures will be destroyed when + frame buffer is destroyed. + */ + [q{FrameBufferHandle}, q{createFrameBuffer}, q{ubyte num, const(Attachment)* attachment, bool destroyTexture=false}, `C++, "bgfx"`], + + /** + * Create frame buffer for multiple window rendering. + * Remarks: + * Frame buffer cannot be used for sampling. + * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`. + Params: + nwh = OS' target native window handle. + width = Window back buffer width. + height = Window back buffer height. + format = Window back buffer color format. + depthFormat = Window back buffer depth format. + */ + [q{FrameBufferHandle}, q{createFrameBuffer}, q{void* nwh, ushort width, ushort height, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count, bgfx.fakeenum.TextureFormat.Enum depthFormat=TextureFormat.count}, `C++, "bgfx"`], + + /** + * Set frame buffer debug name. + Params: + handle = Frame buffer handle. + name = Frame buffer name. + len = Frame buffer name length (if length is INT32_MAX, it's expected + that _name is zero terminated string. + */ + [q{void}, q{setName}, q{FrameBufferHandle handle, const(char)* name, int len=int.max}, `C++, "bgfx"`], + + /** + * Obtain texture handle of frame buffer attachment. + Params: + handle = Frame buffer handle. + */ + [q{TextureHandle}, q{getTexture}, q{FrameBufferHandle handle, ubyte attachment=0}, `C++, "bgfx"`], + + /** + * Destroy frame buffer. + Params: + handle = Frame buffer handle. + */ + [q{void}, q{destroy}, q{FrameBufferHandle handle}, `C++, "bgfx"`], + + /** + * Create shader uniform parameter. + * Remarks: + * 1. Uniform names are unique. It's valid to call `bgfx::createUniform` + * multiple times with the same uniform name. The library will always + * return the same handle, but the handle reference count will be + * incremented. This means that the same number of `bgfx::destroyUniform` + * must be called to properly destroy the uniform. + * 2. Predefined uniforms (declared in `bgfx_shader.sh`): + * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current + * view, in pixels. + * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse + * width and height + * - `u_view mat4` - view matrix + * - `u_invView mat4` - inverted view matrix + * - `u_proj mat4` - projection matrix + * - `u_invProj mat4` - inverted projection matrix + * - `u_viewProj mat4` - concatenated view projection matrix + * - `u_invViewProj mat4` - concatenated inverted view projection matrix + * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices. + * - `u_modelView mat4` - concatenated model view matrix, only first + * model matrix from array is used. + * - `u_modelViewProj mat4` - concatenated model view projection matrix. + * - `u_alphaRef float` - alpha reference value for alpha test. + Params: + name = Uniform name in shader. + type = Type of uniform (See: `bgfx::UniformType`). + num = Number of elements in array. + */ + [q{UniformHandle}, q{createUniform}, q{const(char)* name, bgfx.fakeenum.UniformType.Enum type, ushort num=1}, `C++, "bgfx"`], + + /** + * Retrieve uniform info. + Params: + handle = Handle to uniform object. + info = Uniform info. + */ + [q{void}, q{getUniformInfo}, q{UniformHandle handle, ref UniformInfo info}, `C++, "bgfx"`], + + /** + * Destroy shader uniform parameter. + Params: + handle = Handle to uniform object. + */ + [q{void}, q{destroy}, q{UniformHandle handle}, `C++, "bgfx"`], + + /** + * Create occlusion query. + */ + [q{OcclusionQueryHandle}, q{createOcclusionQuery}, q{}, `C++, "bgfx"`], + + /** + * Retrieve occlusion query result from previous frame. + Params: + handle = Handle to occlusion query object. + result = Number of pixels that passed test. This argument + can be `NULL` if result of occlusion query is not needed. + */ + [q{OcclusionQueryResult}, q{getResult}, q{OcclusionQueryHandle handle, int* result=null}, `C++, "bgfx"`], + + /** + * Destroy occlusion query. + Params: + handle = Handle to occlusion query object. + */ + [q{void}, q{destroy}, q{OcclusionQueryHandle handle}, `C++, "bgfx"`], + + /** + * Set palette color value. + Params: + index = Index into palette. + rgba = RGBA floating point values. + */ + [q{void}, q{setPaletteColor}, q{ubyte index, const(float)* rgba}, `C++, "bgfx"`], + + /** + * Set palette color value. + Params: + index = Index into palette. + rgba = Packed 32-bit RGBA value. + */ + [q{void}, q{setPaletteColor}, q{ubyte index, uint rgba}, `C++, "bgfx"`], + + /** + * Set view name. + * Remarks: + * This is debug only feature. + * In graphics debugger view name will appear as: + * "nnnc " + * ^ ^ ^ + * | +--- compute (C) + * +------ view id + Params: + id = View id. + name = View name. + */ + [q{void}, q{setViewName}, q{ViewID id, const(char)* name}, `C++, "bgfx"`], + + /** + * Set view rectangle. Draw primitive outside view will be clipped. + Params: + id = View id. + x = Position x from the left corner of the window. + y = Position y from the top corner of the window. + width = Width of view port region. + height = Height of view port region. + */ + [q{void}, q{setViewRect}, q{ViewID id, ushort x, ushort y, ushort width, ushort height}, `C++, "bgfx"`], + + /** + * Set view rectangle. Draw primitive outside view will be clipped. + Params: + id = View id. + x = Position x from the left corner of the window. + y = Position y from the top corner of the window. + ratio = Width and height will be set in respect to back-buffer size. + See: `BackbufferRatio::Enum`. + */ + [q{void}, q{setViewRect}, q{ViewID id, ushort x, ushort y, bgfx.fakeenum.BackbufferRatio.Enum ratio}, `C++, "bgfx"`], + + /** + * Set view scissor. Draw primitive outside view will be clipped. When + * _x, _y, _width and _height are set to 0, scissor will be disabled. + Params: + id = View id. + x = Position x from the left corner of the window. + y = Position y from the top corner of the window. + width = Width of view scissor region. + height = Height of view scissor region. + */ + [q{void}, q{setViewScissor}, q{ViewID id, ushort x=0, ushort y=0, ushort width=0, ushort height=0}, `C++, "bgfx"`], + + /** + * Set view clear flags. + Params: + id = View id. + flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear + operation. See: `BGFX_CLEAR_*`. + rgba = Color clear value. + depth = Depth clear value. + stencil = Stencil clear value. + */ + [q{void}, q{setViewClear}, q{ViewID id, ushort flags, uint rgba=0x000000ff, float depth=1.0f, ubyte stencil=0}, `C++, "bgfx"`], + + /** + * Set view clear flags with different clear color for each + * frame buffer texture. `bgfx::setPaletteColor` must be used to set up a + * clear color palette. + Params: + id = View id. + flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear + operation. See: `BGFX_CLEAR_*`. + depth = Depth clear value. + stencil = Stencil clear value. + c0 = Palette index for frame buffer attachment 0. + c1 = Palette index for frame buffer attachment 1. + c2 = Palette index for frame buffer attachment 2. + c3 = Palette index for frame buffer attachment 3. + c4 = Palette index for frame buffer attachment 4. + c5 = Palette index for frame buffer attachment 5. + c6 = Palette index for frame buffer attachment 6. + c7 = Palette index for frame buffer attachment 7. + */ + [q{void}, q{setViewClear}, q{ViewID id, ushort flags, float depth, ubyte stencil, ubyte c0=ubyte.max, ubyte c1=ubyte.max, ubyte c2=ubyte.max, ubyte c3=ubyte.max, ubyte c4=ubyte.max, ubyte c5=ubyte.max, ubyte c6=ubyte.max, ubyte c7=ubyte.max}, `C++, "bgfx"`], + + /** + * Set view sorting mode. + * Remarks: + * View mode must be set prior calling `bgfx::submit` for the view. + Params: + id = View id. + mode = View sort mode. See `ViewMode::Enum`. + */ + [q{void}, q{setViewMode}, q{ViewID id, bgfx.fakeenum.ViewMode.Enum mode=ViewMode.default_}, `C++, "bgfx"`], + + /** + * Set view frame buffer. + * Remarks: + * Not persistent after `bgfx::reset` call. + Params: + id = View id. + handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as + frame buffer handle will draw primitives from this view into + default back buffer. + */ + [q{void}, q{setViewFrameBuffer}, q{ViewID id, FrameBufferHandle handle}, `C++, "bgfx"`], + + /** + * Set view's view matrix and projection matrix, + * all draw primitives in this view will use these two matrices. + Params: + id = View id. + view = View matrix. + proj = Projection matrix. + */ + [q{void}, q{setViewTransform}, q{ViewID id, const(void)* view, const(void)* proj}, `C++, "bgfx"`], + + /** + * Post submit view reordering. + Params: + id = First view id. + num = Number of views to remap. + order = View remap id table. Passing `NULL` will reset view ids + to default state. + */ + [q{void}, q{setViewOrder}, q{ViewID id=0, ushort num=ushort.max, const(ViewID)* order=null}, `C++, "bgfx"`], + + /** + * Reset all view settings to default. + */ + [q{void}, q{resetView}, q{ViewID id}, `C++, "bgfx"`], + + /** + * Begin submitting draw calls from thread. + Params: + forThread = Explicitly request an encoder for a worker thread. + */ + [q{Encoder*}, q{begin}, q{bool forThread=false}, `C++, "bgfx"`], + + /** + * End submitting draw calls from thread. + Params: + encoder = Encoder. + */ + [q{void}, q{end}, q{Encoder* encoder}, `C++, "bgfx"`], + + /** + * Request screen shot of window back buffer. + * Remarks: + * `bgfx::CallbackI::screenShot` must be implemented. + * Attention: Frame buffer handle must be created with OS' target native window handle. + Params: + handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be + made for main window back buffer. + filePath = Will be passed to `bgfx::CallbackI::screenShot` callback. + */ + [q{void}, q{requestScreenShot}, q{FrameBufferHandle handle, const(char)* filePath}, `C++, "bgfx"`], + + /** + * Render frame. + * Attention: `bgfx::renderFrame` is blocking call. It waits for + * `bgfx::frame` to be called from API thread to process frame. + * If timeout value is passed call will timeout and return even + * if `bgfx::frame` is not called. + * Warning: This call should be only used on platforms that don't + * allow creating separate rendering thread. If it is called before + * to bgfx::init, render thread won't be created by bgfx::init call. + Params: + msecs = Timeout in milliseconds. + */ + [q{RenderFrame}, q{renderFrame}, q{int msecs=-1}, `C++, "bgfx"`], + + /** + * Set platform data. + * Warning: Must be called before `bgfx::init`. + Params: + data = Platform data. + */ + [q{void}, q{setPlatformData}, q{ref const PlatformData data}, `C++, "bgfx"`], + + /** + * Get internal data for interop. + * Attention: It's expected you understand some bgfx internals before you + * use this call. + * Warning: Must be called only on render thread. + */ + [q{const(InternalData)*}, q{getInternalData}, q{}, `C++, "bgfx"`], + + /** + * Override internal texture with externally created texture. Previously + * created internal texture will released. + * Attention: It's expected you understand some bgfx internals before you + * use this call. + * Warning: Must be called only on render thread. + Params: + handle = Texture handle. + ptr = Native API pointer to texture. + */ + [q{size_t}, q{overrideInternal}, q{TextureHandle handle, size_t ptr}, `C++, "bgfx"`], + + /** + * Override internal texture by creating new texture. Previously created + * internal texture will released. + * Attention: It's expected you understand some bgfx internals before you + * use this call. + * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the + * main thread. + * Warning: Must be called only on render thread. + Params: + handle = Texture handle. + width = Width. + height = Height. + numMIPs = Number of mip-maps. + format = Texture format. See: `TextureFormat::Enum`. + flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + flags. Default texture sampling mode is linear, and wrap mode is repeat. + - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + mode. + - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + sampling. + */ + [q{size_t}, q{overrideInternal}, q{TextureHandle handle, ushort width, ushort height, ubyte numMIPs, bgfx.fakeenum.TextureFormat.Enum format, ulong flags}, `C++, "bgfx"`], + + /** + * Sets a debug marker. This allows you to group graphics calls together for easy browsing in + * graphics debugging tools. + Params: + marker = Marker string. + */ + [q{void}, q{setMarker}, q{const(char)* marker}, `C++, "bgfx"`], + + /** + * Set render states for draw primitive. + * Remarks: + * 1. To set up more complex states use: + * `BGFX_STATE_ALPHA_REF(_ref)`, + * `BGFX_STATE_POINT_SIZE(_size)`, + * `BGFX_STATE_BLEND_FUNC(_src, _dst)`, + * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, + * `BGFX_STATE_BLEND_EQUATION(_equation)`, + * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` + * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend + * equation is specified. + Params: + state = State flags. Default state for primitive type is + triangles. See: `BGFX_STATE_DEFAULT`. + - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. + - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. + - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. + - `BGFX_STATE_CULL_*` - Backface culling mode. + - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. + - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. + - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. + rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and + `BGFX_STATE_BLEND_INV_FACTOR` blend modes. + */ + [q{void}, q{setState}, q{ulong state, uint rgba=0}, `C++, "bgfx"`], + + /** + * Set condition for rendering. + Params: + handle = Occlusion query handle. + visible = Render if occlusion query is visible. + */ + [q{void}, q{setCondition}, q{OcclusionQueryHandle handle, bool visible}, `C++, "bgfx"`], + + /** + * Set stencil test state. + Params: + fstencil = Front stencil state. + bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE` + _fstencil is applied to both front and back facing primitives. + */ + [q{void}, q{setStencil}, q{uint fstencil, uint bstencil=Stencil.none}, `C++, "bgfx"`], + + /** + * Set scissor for draw primitive. + * Remarks: + * To scissor for all primitives in view see `bgfx::setViewScissor`. + Params: + x = Position x from the left corner of the window. + y = Position y from the top corner of the window. + width = Width of view scissor region. + height = Height of view scissor region. + */ + [q{ushort}, q{setScissor}, q{ushort x, ushort y, ushort width, ushort height}, `C++, "bgfx"`], + + /** + * Set scissor from cache for draw primitive. + * Remarks: + * To scissor for all primitives in view see `bgfx::setViewScissor`. + Params: + cache = Index in scissor cache. + */ + [q{void}, q{setScissor}, q{ushort cache=ushort.max}, `C++, "bgfx"`], + + /** + * Set model matrix for draw primitive. If it is not called, + * the model will be rendered with an identity model matrix. + Params: + mtx = Pointer to first matrix in array. + num = Number of matrices in array. + */ + [q{uint}, q{setTransform}, q{const(void)* mtx, ushort num}, `C++, "bgfx"`], + + /** + * Set model matrix from matrix cache for draw primitive. + Params: + cache = Index in matrix cache. + num = Number of matrices from cache. + */ + [q{void}, q{setTransform}, q{uint cache, ushort num=1}, `C++, "bgfx"`], + + /** + * Reserve matrices in internal matrix cache. + * Attention: Pointer returned can be modified until `bgfx::frame` is called. + Params: + transform = Pointer to `Transform` structure. + num = Number of matrices. + */ + [q{uint}, q{allocTransform}, q{Transform* transform, ushort num}, `C++, "bgfx"`], + + /** + * Set shader uniform parameter for draw primitive. + Params: + handle = Uniform. + value = Pointer to uniform data. + num = Number of elements. Passing `UINT16_MAX` will + use the _num passed on uniform creation. + */ + [q{void}, q{setUniform}, q{UniformHandle handle, const(void)* value, ushort num=1}, `C++, "bgfx"`], + + /** + * Set index buffer for draw primitive. + Params: + handle = Index buffer. + */ + [q{void}, q{setIndexBuffer}, q{IndexBufferHandle handle}, `C++, "bgfx"`], + + /** + * Set index buffer for draw primitive. + Params: + handle = Index buffer. + firstIndex = First index to render. + numIndices = Number of indices to render. + */ + [q{void}, q{setIndexBuffer}, q{IndexBufferHandle handle, uint firstIndex, uint numIndices}, `C++, "bgfx"`], + + /** + * Set index buffer for draw primitive. + Params: + handle = Dynamic index buffer. + */ + [q{void}, q{setIndexBuffer}, q{DynamicIndexBufferHandle handle}, `C++, "bgfx"`], + + /** + * Set index buffer for draw primitive. + Params: + handle = Dynamic index buffer. + firstIndex = First index to render. + numIndices = Number of indices to render. + */ + [q{void}, q{setIndexBuffer}, q{DynamicIndexBufferHandle handle, uint firstIndex, uint numIndices}, `C++, "bgfx"`], + + /** + * Set index buffer for draw primitive. + Params: + tib = Transient index buffer. + */ + [q{void}, q{setIndexBuffer}, q{const(TransientIndexBuffer)* tib}, `C++, "bgfx"`], + + /** + * Set index buffer for draw primitive. + Params: + tib = Transient index buffer. + firstIndex = First index to render. + numIndices = Number of indices to render. + */ + [q{void}, q{setIndexBuffer}, q{const(TransientIndexBuffer)* tib, uint firstIndex, uint numIndices}, `C++, "bgfx"`], + + /** + * Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + handle = Vertex buffer. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, VertexBufferHandle handle}, `C++, "bgfx"`], + + /** + * Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + handle = Vertex buffer. + startVertex = First vertex to render. + numVertices = Number of vertices to render. + layoutHandle = Vertex layout for aliasing vertex buffer. If invalid + handle is used, vertex layout used for creation + of vertex buffer will be used. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, VertexBufferHandle handle, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++, "bgfx"`], + + /** + * Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + handle = Dynamic vertex buffer. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, DynamicVertexBufferHandle handle}, `C++, "bgfx"`], + + /** + * Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + handle = Dynamic vertex buffer. + startVertex = First vertex to render. + numVertices = Number of vertices to render. + layoutHandle = Vertex layout for aliasing vertex buffer. If invalid + handle is used, vertex layout used for creation + of vertex buffer will be used. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, DynamicVertexBufferHandle handle, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++, "bgfx"`], + + /** + * Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + tvb = Transient vertex buffer. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, const(TransientVertexBuffer)* tvb}, `C++, "bgfx"`], + + /** + * Set vertex buffer for draw primitive. + Params: + stream = Vertex stream. + tvb = Transient vertex buffer. + startVertex = First vertex to render. + numVertices = Number of vertices to render. + layoutHandle = Vertex layout for aliasing vertex buffer. If invalid + handle is used, vertex layout used for creation + of vertex buffer will be used. + */ + [q{void}, q{setVertexBuffer}, q{ubyte stream, const(TransientVertexBuffer)* tvb, uint startVertex, uint numVertices, VertexLayoutHandle layoutHandle=invalidHandle!VertexLayoutHandle}, `C++, "bgfx"`], + + /** + * Set number of vertices for auto generated vertices use in conjunction + * with gl_VertexID. + * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. + Params: + numVertices = Number of vertices. + */ + [q{void}, q{setVertexCount}, q{uint numVertices}, `C++, "bgfx"`], + + /** + * Set instance data buffer for draw primitive. + Params: + idb = Transient instance data buffer. + */ + [q{void}, q{setInstanceDataBuffer}, q{const(InstanceDataBuffer)* idb}, `C++, "bgfx"`], + + /** + * Set instance data buffer for draw primitive. + Params: + idb = Transient instance data buffer. + start = First instance data. + num = Number of data instances. + */ + [q{void}, q{setInstanceDataBuffer}, q{const(InstanceDataBuffer)* idb, uint start, uint num}, `C++, "bgfx"`], + + /** + * Set instance data buffer for draw primitive. + Params: + handle = Vertex buffer. + startVertex = First instance data. + num = Number of data instances. + */ + [q{void}, q{setInstanceDataBuffer}, q{VertexBufferHandle handle, uint startVertex, uint num}, `C++, "bgfx"`], + + /** + * Set instance data buffer for draw primitive. + Params: + handle = Dynamic vertex buffer. + startVertex = First instance data. + num = Number of data instances. + */ + [q{void}, q{setInstanceDataBuffer}, q{DynamicVertexBufferHandle handle, uint startVertex, uint num}, `C++, "bgfx"`], + + /** + * Set number of instances for auto generated instances use in conjunction + * with gl_InstanceID. + * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. + */ + [q{void}, q{setInstanceCount}, q{uint numInstances}, `C++, "bgfx"`], + + /** + * Set texture stage for draw primitive. + Params: + stage = Texture unit. + sampler = Program sampler. + handle = Texture handle. + flags = Texture sampling mode. Default value UINT32_MAX uses + texture sampling settings from the texture. + - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + mode. + - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + sampling. + */ + [q{void}, q{setTexture}, q{ubyte stage, UniformHandle sampler, TextureHandle handle, uint flags=uint.max}, `C++, "bgfx"`], + + /** + * Submit an empty primitive for rendering. Uniforms and draw state + * will be applied but no geometry will be submitted. + * Remarks: + * These empty draw calls will sort before ordinary draw calls. + Params: + id = View id. + */ + [q{void}, q{touch}, q{ViewID id}, `C++, "bgfx"`], + + /** + * Submit primitive for rendering. + Params: + id = View id. + program = Program. + depth = Depth for sorting. + flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. + */ + [q{void}, q{submit}, q{ViewID id, ProgramHandle program, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`], + + /** + * Submit primitive with occlusion query for rendering. + Params: + id = View id. + program = Program. + occlusionQuery = Occlusion query. + depth = Depth for sorting. + flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. + */ + [q{void}, q{submit}, q{ViewID id, ProgramHandle program, OcclusionQueryHandle occlusionQuery, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`], + + /** + * Submit primitive for rendering with index and instance data info from + * indirect buffer. + * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT`. + Params: + id = View id. + program = Program. + indirectHandle = Indirect buffer. + start = First element in indirect buffer. + num = Number of draws. + depth = Depth for sorting. + flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. + */ + [q{void}, q{submit}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`], + + /** + * Submit primitive for rendering with index and instance data info and + * draw count from indirect buffers. + * Attention: Availability depends on: `BGFX_CAPS_DRAW_INDIRECT_COUNT`. + Params: + id = View id. + program = Program. + indirectHandle = Indirect buffer. + start = First element in indirect buffer. + numHandle = Buffer for number of draws. Must be + created with `BGFX_BUFFER_INDEX32` and `BGFX_BUFFER_DRAW_INDIRECT`. + numIndex = Element in number buffer. + numMax = Max number of draws. + depth = Depth for sorting. + flags = Which states to discard for next draw. See `BGFX_DISCARD_*`. + */ + [q{void}, q{submit}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start, IndexBufferHandle numHandle, uint numIndex=0, ushort numMax=ushort.max, uint depth=0, ubyte flags=Discard.all}, `C++, "bgfx"`], + + /** + * Set compute index buffer. + Params: + stage = Compute stage. + handle = Index buffer handle. + access = Buffer access. See `Access::Enum`. + */ + [q{void}, q{setBuffer}, q{ubyte stage, IndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++, "bgfx"`], + + /** + * Set compute vertex buffer. + Params: + stage = Compute stage. + handle = Vertex buffer handle. + access = Buffer access. See `Access::Enum`. + */ + [q{void}, q{setBuffer}, q{ubyte stage, VertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++, "bgfx"`], + + /** + * Set compute dynamic index buffer. + Params: + stage = Compute stage. + handle = Dynamic index buffer handle. + access = Buffer access. See `Access::Enum`. + */ + [q{void}, q{setBuffer}, q{ubyte stage, DynamicIndexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++, "bgfx"`], + + /** + * Set compute dynamic vertex buffer. + Params: + stage = Compute stage. + handle = Dynamic vertex buffer handle. + access = Buffer access. See `Access::Enum`. + */ + [q{void}, q{setBuffer}, q{ubyte stage, DynamicVertexBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++, "bgfx"`], + + /** + * Set compute indirect buffer. + Params: + stage = Compute stage. + handle = Indirect buffer handle. + access = Buffer access. See `Access::Enum`. + */ + [q{void}, q{setBuffer}, q{ubyte stage, IndirectBufferHandle handle, bgfx.fakeenum.Access.Enum access}, `C++, "bgfx"`], + + /** + * Set compute image from texture. + Params: + stage = Compute stage. + handle = Texture handle. + mip = Mip level. + access = Image access. See `Access::Enum`. + format = Texture format. See: `TextureFormat::Enum`. + */ + [q{void}, q{setImage}, q{ubyte stage, TextureHandle handle, ubyte mip, bgfx.fakeenum.Access.Enum access, bgfx.fakeenum.TextureFormat.Enum format=TextureFormat.count}, `C++, "bgfx"`], + + /** + * Dispatch compute. + Params: + id = View id. + program = Compute program. + numX = Number of groups X. + numY = Number of groups Y. + numZ = Number of groups Z. + flags = Discard or preserve states. See `BGFX_DISCARD_*`. + */ + [q{void}, q{dispatch}, q{ViewID id, ProgramHandle program, uint numX=1, uint numY=1, uint numZ=1, ubyte flags=Discard.all}, `C++, "bgfx"`], + + /** + * Dispatch compute indirect. + Params: + id = View id. + program = Compute program. + indirectHandle = Indirect buffer. + start = First element in indirect buffer. + num = Number of dispatches. + flags = Discard or preserve states. See `BGFX_DISCARD_*`. + */ + [q{void}, q{dispatch}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, ubyte flags=Discard.all}, `C++, "bgfx"`], + + /** + * Discard previously set state for draw or compute call. + Params: + flags = Draw/compute states to discard. + */ + [q{void}, q{discard}, q{ubyte flags=Discard.all}, `C++, "bgfx"`], + + /** + * Blit 2D texture region between two 2D textures. + * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. + * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. + Params: + id = View id. + dst = Destination texture handle. + dstX = Destination texture X position. + dstY = Destination texture Y position. + src = Source texture handle. + srcX = Source texture X position. + srcY = Source texture Y position. + width = Width of region. + height = Height of region. + */ + [q{void}, q{blit}, q{ViewID id, TextureHandle dst, ushort dstX, ushort dstY, TextureHandle src, ushort srcX=0, ushort srcY=0, ushort width=ushort.max, ushort height=ushort.max}, `C++, "bgfx"`], + + /** + * Blit 2D texture region between two 2D textures. + * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. + * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. + Params: + id = View id. + dst = Destination texture handle. + dstMIP = Destination texture mip level. + dstX = Destination texture X position. + dstY = Destination texture Y position. + dstZ = If texture is 2D this argument should be 0. If destination texture is cube + this argument represents destination texture cube face. For 3D texture this argument + represents destination texture Z position. + src = Source texture handle. + srcMIP = Source texture mip level. + srcX = Source texture X position. + srcY = Source texture Y position. + srcZ = If texture is 2D this argument should be 0. If source texture is cube + this argument represents source texture cube face. For 3D texture this argument + represents source texture Z position. + width = Width of region. + height = Height of region. + depth = If texture is 3D this argument represents depth of region, otherwise it's + unused. + */ + [q{void}, q{blit}, q{ViewID id, TextureHandle dst, ubyte dstMIP, ushort dstX, ushort dstY, ushort dstZ, TextureHandle src, ubyte srcMIP=0, ushort srcX=0, ushort srcY=0, ushort srcZ=0, ushort width=ushort.max, ushort height=ushort.max, ushort depth=ushort.max}, `C++, "bgfx"`], + + ]); + return ret; +}(), __MODULE__, "Resolution, Init, Attachment, VertexLayout, Encoder, ")); + +static if(!staticBinding): +import bindbc.loader; + +debug{ + mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libDebug", "bgfxDebug", "bgfx"]), [__MODULE__])); +}else{ + mixin(makeDynloadFns("Bgfx", makeLibPaths(["bgfx-shared-libRelease", "bgfxRelease", "bgfx"]), [__MODULE__])); +} diff --git a/bgfx/bindings/d/types.d b/bgfx/bindings/d/types.d deleted file mode 100644 index e812ffa6..00000000 --- a/bgfx/bindings/d/types.d +++ /dev/null @@ -1,1132 +0,0 @@ -/* - * - * AUTO GENERATED! DO NOT EDIT! - * - */ - -module bindbc.bgfx.types; - -public import core.stdc.stdarg : va_list; - -enum expandEnum(EnumType, string fqnEnumType = EnumType.stringof) = (){ - string expandEnum; - foreach(m; __traits(allMembers, EnumType)){ - expandEnum ~= "alias " ~ m ~ " = " ~ fqnEnumType ~ "." ~ m ~ ";"; - } - return expandEnum; -}(); - -extern(C) @nogc nothrow: - -enum uint BGFX_API_VERSION = 117; - -alias bgfx_view_id_t = ushort; - -//NOTE: TEMPORARY fix to some missing preprocessor function-macros... -static BGFX_STATE_BLEND_FUNC_SEPARATE(ulong _srcRGB, ulong _dstRGB, ulong _srcA, ulong _dstA){ - return (0UL - | ( ( cast(ulong)_srcRGB | ( cast(ulong)_dstRGB<<4) ) ) - | ( ( cast(ulong)_srcA | ( cast(ulong)_dstA <<4) )<<8) - ); -} - -/// Blend equation separate. -static BGFX_STATE_BLEND_EQUATION_SEPARATE(ulong _equationRGB, ulong _equationA){ return ( cast(ulong)_equationRGB | (cast(ulong)_equationA<<3) ); } - -/// Blend function. -static BGFX_STATE_BLEND_FUNC(ulong _src, ulong _dst){ return BGFX_STATE_BLEND_FUNC_SEPARATE(_src, _dst, _src, _dst); } - -/// Blend equation. -static BGFX_STATE_BLEND_EQUATION(ulong _equation){ return BGFX_STATE_BLEND_EQUATION_SEPARATE(_equation, _equation); } - -/// Utility predefined blend modes. - -/// Additive blending. -static BGFX_STATE_BLEND_ADD(){ return (0 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE)); } - -/// Alpha blend. -static BGFX_STATE_BLEND_ALPHA(){ return (0 | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA)); } - -/// Memory release callback. - -/// Color RGB/alpha/depth write. When it's not specified write will be disabled. -enum ulong BGFX_STATE_WRITE_R = 0x0000000000000001; /// Enable R write. -enum ulong BGFX_STATE_WRITE_G = 0x0000000000000002; /// Enable G write. -enum ulong BGFX_STATE_WRITE_B = 0x0000000000000004; /// Enable B write. -enum ulong BGFX_STATE_WRITE_A = 0x0000000000000008; /// Enable alpha write. -enum ulong BGFX_STATE_WRITE_Z = 0x0000004000000000; /// Enable depth write. -enum ulong BGFX_STATE_WRITE_RGB = 0x0000000000000007; /// Enable RGB write. -enum ulong BGFX_STATE_WRITE_MASK = 0x000000400000000f; /// Write all channels mask. - -/// Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled. -enum ulong BGFX_STATE_DEPTH_TEST_LESS = 0x0000000000000010; /// Enable depth test, less. -enum ulong BGFX_STATE_DEPTH_TEST_LEQUAL = 0x0000000000000020; /// Enable depth test, less or equal. -enum ulong BGFX_STATE_DEPTH_TEST_EQUAL = 0x0000000000000030; /// Enable depth test, equal. -enum ulong BGFX_STATE_DEPTH_TEST_GEQUAL = 0x0000000000000040; /// Enable depth test, greater or equal. -enum ulong BGFX_STATE_DEPTH_TEST_GREATER = 0x0000000000000050; /// Enable depth test, greater. -enum ulong BGFX_STATE_DEPTH_TEST_NOTEQUAL = 0x0000000000000060; /// Enable depth test, not equal. -enum ulong BGFX_STATE_DEPTH_TEST_NEVER = 0x0000000000000070; /// Enable depth test, never. -enum ulong BGFX_STATE_DEPTH_TEST_ALWAYS = 0x0000000000000080; /// Enable depth test, always. -enum ulong BGFX_STATE_DEPTH_TEST_SHIFT = 4; /// Depth test state bit shift -enum ulong BGFX_STATE_DEPTH_TEST_MASK = 0x00000000000000f0; /// Depth test state bit mask - -/** - * Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) - * helper macros. - */ -enum ulong BGFX_STATE_BLEND_ZERO = 0x0000000000001000; /// 0, 0, 0, 0 -enum ulong BGFX_STATE_BLEND_ONE = 0x0000000000002000; /// 1, 1, 1, 1 -enum ulong BGFX_STATE_BLEND_SRC_COLOR = 0x0000000000003000; /// Rs, Gs, Bs, As -enum ulong BGFX_STATE_BLEND_INV_SRC_COLOR = 0x0000000000004000; /// 1-Rs, 1-Gs, 1-Bs, 1-As -enum ulong BGFX_STATE_BLEND_SRC_ALPHA = 0x0000000000005000; /// As, As, As, As -enum ulong BGFX_STATE_BLEND_INV_SRC_ALPHA = 0x0000000000006000; /// 1-As, 1-As, 1-As, 1-As -enum ulong BGFX_STATE_BLEND_DST_ALPHA = 0x0000000000007000; /// Ad, Ad, Ad, Ad -enum ulong BGFX_STATE_BLEND_INV_DST_ALPHA = 0x0000000000008000; /// 1-Ad, 1-Ad, 1-Ad ,1-Ad -enum ulong BGFX_STATE_BLEND_DST_COLOR = 0x0000000000009000; /// Rd, Gd, Bd, Ad -enum ulong BGFX_STATE_BLEND_INV_DST_COLOR = 0x000000000000a000; /// 1-Rd, 1-Gd, 1-Bd, 1-Ad -enum ulong BGFX_STATE_BLEND_SRC_ALPHA_SAT = 0x000000000000b000; /// f, f, f, 1; f = min(As, 1-Ad) -enum ulong BGFX_STATE_BLEND_FACTOR = 0x000000000000c000; /// Blend factor -enum ulong BGFX_STATE_BLEND_INV_FACTOR = 0x000000000000d000; /// 1-Blend factor -enum ulong BGFX_STATE_BLEND_SHIFT = 12; /// Blend state bit shift -enum ulong BGFX_STATE_BLEND_MASK = 0x000000000ffff000; /// Blend state bit mask - -/** - * Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA) - * helper macros. - */ -enum ulong BGFX_STATE_BLEND_EQUATION_ADD = 0x0000000000000000; /// Blend add: src + dst. -enum ulong BGFX_STATE_BLEND_EQUATION_SUB = 0x0000000010000000; /// Blend subtract: src - dst. -enum ulong BGFX_STATE_BLEND_EQUATION_REVSUB = 0x0000000020000000; /// Blend reverse subtract: dst - src. -enum ulong BGFX_STATE_BLEND_EQUATION_MIN = 0x0000000030000000; /// Blend min: min(src, dst). -enum ulong BGFX_STATE_BLEND_EQUATION_MAX = 0x0000000040000000; /// Blend max: max(src, dst). -enum ulong BGFX_STATE_BLEND_EQUATION_SHIFT = 28; /// Blend equation bit shift -enum ulong BGFX_STATE_BLEND_EQUATION_MASK = 0x00000003f0000000; /// Blend equation bit mask - -/// Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled. -enum ulong BGFX_STATE_CULL_CW = 0x0000001000000000; /// Cull clockwise triangles. -enum ulong BGFX_STATE_CULL_CCW = 0x0000002000000000; /// Cull counter-clockwise triangles. -enum ulong BGFX_STATE_CULL_SHIFT = 36; /// Culling mode bit shift -enum ulong BGFX_STATE_CULL_MASK = 0x0000003000000000; /// Culling mode bit mask - -/// Alpha reference value. -enum ulong BGFX_STATE_ALPHA_REF_SHIFT = 40; /// Alpha reference bit shift -enum ulong BGFX_STATE_ALPHA_REF_MASK = 0x0000ff0000000000; /// Alpha reference bit mask -ulong BGFX_STATE_ALPHA_REF (ulong v) { return (v << BGFX_STATE_ALPHA_REF_SHIFT) & BGFX_STATE_ALPHA_REF_MASK; } - -enum ulong BGFX_STATE_PT_TRISTRIP = 0x0001000000000000; /// Tristrip. -enum ulong BGFX_STATE_PT_LINES = 0x0002000000000000; /// Lines. -enum ulong BGFX_STATE_PT_LINESTRIP = 0x0003000000000000; /// Line strip. -enum ulong BGFX_STATE_PT_POINTS = 0x0004000000000000; /// Points. -enum ulong BGFX_STATE_PT_SHIFT = 48; /// Primitive type bit shift -enum ulong BGFX_STATE_PT_MASK = 0x0007000000000000; /// Primitive type bit mask - -/// Point size value. -enum ulong BGFX_STATE_POINT_SIZE_SHIFT = 52; /// Point size bit shift -enum ulong BGFX_STATE_POINT_SIZE_MASK = 0x00f0000000000000; /// Point size bit mask -ulong BGFX_STATE_POINT_SIZE (ulong v) { return (v << BGFX_STATE_POINT_SIZE_SHIFT) & BGFX_STATE_POINT_SIZE_MASK; } - -/** - * Enable MSAA write when writing into MSAA frame buffer. - * This flag is ignored when not writing into MSAA frame buffer. - */ -enum ulong BGFX_STATE_MSAA = 0x0100000000000000; /// Enable MSAA rasterization. -enum ulong BGFX_STATE_LINEAA = 0x0200000000000000; /// Enable line AA rasterization. -enum ulong BGFX_STATE_CONSERVATIVE_RASTER = 0x0400000000000000; /// Enable conservative rasterization. -enum ulong BGFX_STATE_NONE = 0x0000000000000000; /// No state. -enum ulong BGFX_STATE_FRONT_CCW = 0x0000008000000000; /// Front counter-clockwise (default is clockwise). -enum ulong BGFX_STATE_BLEND_INDEPENDENT = 0x0000000400000000; /// Enable blend independent. -enum ulong BGFX_STATE_BLEND_ALPHA_TO_COVERAGE = 0x0000000800000000; /// Enable alpha to coverage. -/** - * Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise - * culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored). - */ -enum ulong BGFX_STATE_DEFAULT = BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CW | BGFX_STATE_MSAA; -enum ulong BGFX_STATE_MASK = 0xffffffffffffffff; /// State bit mask - -/// Do not use! -enum ulong BGFX_STATE_RESERVED_SHIFT = 61; -enum ulong BGFX_STATE_RESERVED_MASK = 0xe000000000000000; - -/// Set stencil ref value. -enum uint BGFX_STENCIL_FUNC_REF_SHIFT = 0; -enum uint BGFX_STENCIL_FUNC_REF_MASK = 0x000000ff; -uint BGFX_STENCIL_FUNC_REF (uint v) { return (v << BGFX_STENCIL_FUNC_REF_SHIFT) & BGFX_STENCIL_FUNC_REF_MASK; } - -/// Set stencil rmask value. -enum uint BGFX_STENCIL_FUNC_RMASK_SHIFT = 8; -enum uint BGFX_STENCIL_FUNC_RMASK_MASK = 0x0000ff00; -uint BGFX_STENCIL_FUNC_RMASK (uint v) { return (v << BGFX_STENCIL_FUNC_RMASK_SHIFT) & BGFX_STENCIL_FUNC_RMASK_MASK; } - -enum uint BGFX_STENCIL_NONE = 0x00000000; -enum uint BGFX_STENCIL_MASK = 0xffffffff; -enum uint BGFX_STENCIL_DEFAULT = 0x00000000; - -enum uint BGFX_STENCIL_TEST_LESS = 0x00010000; /// Enable stencil test, less. -enum uint BGFX_STENCIL_TEST_LEQUAL = 0x00020000; /// Enable stencil test, less or equal. -enum uint BGFX_STENCIL_TEST_EQUAL = 0x00030000; /// Enable stencil test, equal. -enum uint BGFX_STENCIL_TEST_GEQUAL = 0x00040000; /// Enable stencil test, greater or equal. -enum uint BGFX_STENCIL_TEST_GREATER = 0x00050000; /// Enable stencil test, greater. -enum uint BGFX_STENCIL_TEST_NOTEQUAL = 0x00060000; /// Enable stencil test, not equal. -enum uint BGFX_STENCIL_TEST_NEVER = 0x00070000; /// Enable stencil test, never. -enum uint BGFX_STENCIL_TEST_ALWAYS = 0x00080000; /// Enable stencil test, always. -enum uint BGFX_STENCIL_TEST_SHIFT = 16; /// Stencil test bit shift -enum uint BGFX_STENCIL_TEST_MASK = 0x000f0000; /// Stencil test bit mask - -enum uint BGFX_STENCIL_OP_FAIL_S_ZERO = 0x00000000; /// Zero. -enum uint BGFX_STENCIL_OP_FAIL_S_KEEP = 0x00100000; /// Keep. -enum uint BGFX_STENCIL_OP_FAIL_S_REPLACE = 0x00200000; /// Replace. -enum uint BGFX_STENCIL_OP_FAIL_S_INCR = 0x00300000; /// Increment and wrap. -enum uint BGFX_STENCIL_OP_FAIL_S_INCRSAT = 0x00400000; /// Increment and clamp. -enum uint BGFX_STENCIL_OP_FAIL_S_DECR = 0x00500000; /// Decrement and wrap. -enum uint BGFX_STENCIL_OP_FAIL_S_DECRSAT = 0x00600000; /// Decrement and clamp. -enum uint BGFX_STENCIL_OP_FAIL_S_INVERT = 0x00700000; /// Invert. -enum uint BGFX_STENCIL_OP_FAIL_S_SHIFT = 20; /// Stencil operation fail bit shift -enum uint BGFX_STENCIL_OP_FAIL_S_MASK = 0x00f00000; /// Stencil operation fail bit mask - -enum uint BGFX_STENCIL_OP_FAIL_Z_ZERO = 0x00000000; /// Zero. -enum uint BGFX_STENCIL_OP_FAIL_Z_KEEP = 0x01000000; /// Keep. -enum uint BGFX_STENCIL_OP_FAIL_Z_REPLACE = 0x02000000; /// Replace. -enum uint BGFX_STENCIL_OP_FAIL_Z_INCR = 0x03000000; /// Increment and wrap. -enum uint BGFX_STENCIL_OP_FAIL_Z_INCRSAT = 0x04000000; /// Increment and clamp. -enum uint BGFX_STENCIL_OP_FAIL_Z_DECR = 0x05000000; /// Decrement and wrap. -enum uint BGFX_STENCIL_OP_FAIL_Z_DECRSAT = 0x06000000; /// Decrement and clamp. -enum uint BGFX_STENCIL_OP_FAIL_Z_INVERT = 0x07000000; /// Invert. -enum uint BGFX_STENCIL_OP_FAIL_Z_SHIFT = 24; /// Stencil operation depth fail bit shift -enum uint BGFX_STENCIL_OP_FAIL_Z_MASK = 0x0f000000; /// Stencil operation depth fail bit mask - -enum uint BGFX_STENCIL_OP_PASS_Z_ZERO = 0x00000000; /// Zero. -enum uint BGFX_STENCIL_OP_PASS_Z_KEEP = 0x10000000; /// Keep. -enum uint BGFX_STENCIL_OP_PASS_Z_REPLACE = 0x20000000; /// Replace. -enum uint BGFX_STENCIL_OP_PASS_Z_INCR = 0x30000000; /// Increment and wrap. -enum uint BGFX_STENCIL_OP_PASS_Z_INCRSAT = 0x40000000; /// Increment and clamp. -enum uint BGFX_STENCIL_OP_PASS_Z_DECR = 0x50000000; /// Decrement and wrap. -enum uint BGFX_STENCIL_OP_PASS_Z_DECRSAT = 0x60000000; /// Decrement and clamp. -enum uint BGFX_STENCIL_OP_PASS_Z_INVERT = 0x70000000; /// Invert. -enum uint BGFX_STENCIL_OP_PASS_Z_SHIFT = 28; /// Stencil operation depth pass bit shift -enum uint BGFX_STENCIL_OP_PASS_Z_MASK = 0xf0000000; /// Stencil operation depth pass bit mask - -enum ushort BGFX_CLEAR_NONE = 0x0000; /// No clear flags. -enum ushort BGFX_CLEAR_COLOR = 0x0001; /// Clear color. -enum ushort BGFX_CLEAR_DEPTH = 0x0002; /// Clear depth. -enum ushort BGFX_CLEAR_STENCIL = 0x0004; /// Clear stencil. -enum ushort BGFX_CLEAR_DISCARD_COLOR_0 = 0x0008; /// Discard frame buffer attachment 0. -enum ushort BGFX_CLEAR_DISCARD_COLOR_1 = 0x0010; /// Discard frame buffer attachment 1. -enum ushort BGFX_CLEAR_DISCARD_COLOR_2 = 0x0020; /// Discard frame buffer attachment 2. -enum ushort BGFX_CLEAR_DISCARD_COLOR_3 = 0x0040; /// Discard frame buffer attachment 3. -enum ushort BGFX_CLEAR_DISCARD_COLOR_4 = 0x0080; /// Discard frame buffer attachment 4. -enum ushort BGFX_CLEAR_DISCARD_COLOR_5 = 0x0100; /// Discard frame buffer attachment 5. -enum ushort BGFX_CLEAR_DISCARD_COLOR_6 = 0x0200; /// Discard frame buffer attachment 6. -enum ushort BGFX_CLEAR_DISCARD_COLOR_7 = 0x0400; /// Discard frame buffer attachment 7. -enum ushort BGFX_CLEAR_DISCARD_DEPTH = 0x0800; /// Discard frame buffer depth attachment. -enum ushort BGFX_CLEAR_DISCARD_STENCIL = 0x1000; /// Discard frame buffer stencil attachment. -enum ushort BGFX_CLEAR_DISCARD_COLOR_MASK = 0x07f8; -enum ushort BGFX_CLEAR_DISCARD_MASK = 0x1ff8; - -/** - * Rendering state discard. When state is preserved in submit, rendering states can be discarded - * on a finer grain. - */ -enum ubyte BGFX_DISCARD_NONE = 0x00; /// Preserve everything. -enum ubyte BGFX_DISCARD_BINDINGS = 0x01; /// Discard texture sampler and buffer bindings. -enum ubyte BGFX_DISCARD_INDEX_BUFFER = 0x02; /// Discard index buffer. -enum ubyte BGFX_DISCARD_INSTANCE_DATA = 0x04; /// Discard instance data. -enum ubyte BGFX_DISCARD_STATE = 0x08; /// Discard state and uniform bindings. -enum ubyte BGFX_DISCARD_TRANSFORM = 0x10; /// Discard transform. -enum ubyte BGFX_DISCARD_VERTEX_STREAMS = 0x20; /// Discard vertex streams. -enum ubyte BGFX_DISCARD_ALL = 0xff; /// Discard all states. - -enum uint BGFX_DEBUG_NONE = 0x00000000; /// No debug. -enum uint BGFX_DEBUG_WIREFRAME = 0x00000001; /// Enable wireframe for all primitives. -/** - * Enable infinitely fast hardware test. No draw calls will be submitted to driver. - * It's useful when profiling to quickly assess bottleneck between CPU and GPU. - */ -enum uint BGFX_DEBUG_IFH = 0x00000002; -enum uint BGFX_DEBUG_STATS = 0x00000004; /// Enable statistics display. -enum uint BGFX_DEBUG_TEXT = 0x00000008; /// Enable debug text display. -enum uint BGFX_DEBUG_PROFILER = 0x00000010; /// Enable profiler. This causes per-view statistics to be collected, available through `bgfx::Stats::ViewStats`. This is unrelated to the profiler functions in `bgfx::CallbackI`. - -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X1 = 0x0001; /// 1 8-bit value -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X2 = 0x0002; /// 2 8-bit values -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_8X4 = 0x0003; /// 4 8-bit values -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X1 = 0x0004; /// 1 16-bit value -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X2 = 0x0005; /// 2 16-bit values -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_16X4 = 0x0006; /// 4 16-bit values -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X1 = 0x0007; /// 1 32-bit value -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X2 = 0x0008; /// 2 32-bit values -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_32X4 = 0x0009; /// 4 32-bit values -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_SHIFT = 0; -enum ushort BGFX_BUFFER_COMPUTE_FORMAT_MASK = 0x000f; - -enum ushort BGFX_BUFFER_COMPUTE_TYPE_INT = 0x0010; /// Type `int`. -enum ushort BGFX_BUFFER_COMPUTE_TYPE_UINT = 0x0020; /// Type `uint`. -enum ushort BGFX_BUFFER_COMPUTE_TYPE_FLOAT = 0x0030; /// Type `float`. -enum ushort BGFX_BUFFER_COMPUTE_TYPE_SHIFT = 4; -enum ushort BGFX_BUFFER_COMPUTE_TYPE_MASK = 0x0030; - -enum ushort BGFX_BUFFER_NONE = 0x0000; -enum ushort BGFX_BUFFER_COMPUTE_READ = 0x0100; /// Buffer will be read by shader. -enum ushort BGFX_BUFFER_COMPUTE_WRITE = 0x0200; /// Buffer will be used for writing. -enum ushort BGFX_BUFFER_DRAW_INDIRECT = 0x0400; /// Buffer will be used for storing draw indirect commands. -enum ushort BGFX_BUFFER_ALLOW_RESIZE = 0x0800; /// Allow dynamic index/vertex buffer resize during update. -enum ushort BGFX_BUFFER_INDEX32 = 0x1000; /// Index buffer contains 32-bit indices. -enum ushort BGFX_BUFFER_COMPUTE_READ_WRITE = 0x0300; - -enum ulong BGFX_TEXTURE_NONE = 0x0000000000000000; -enum ulong BGFX_TEXTURE_MSAA_SAMPLE = 0x0000000800000000; /// Texture will be used for MSAA sampling. -enum ulong BGFX_TEXTURE_RT = 0x0000001000000000; /// Render target no MSAA. -enum ulong BGFX_TEXTURE_COMPUTE_WRITE = 0x0000100000000000; /// Texture will be used for compute write. -enum ulong BGFX_TEXTURE_SRGB = 0x0000200000000000; /// Sample texture as sRGB. -enum ulong BGFX_TEXTURE_BLIT_DST = 0x0000400000000000; /// Texture will be used as blit destination. -enum ulong BGFX_TEXTURE_READ_BACK = 0x0000800000000000; /// Texture will be used for read back from GPU. - -enum ulong BGFX_TEXTURE_RT_MSAA_X2 = 0x0000002000000000; /// Render target MSAAx2 mode. -enum ulong BGFX_TEXTURE_RT_MSAA_X4 = 0x0000003000000000; /// Render target MSAAx4 mode. -enum ulong BGFX_TEXTURE_RT_MSAA_X8 = 0x0000004000000000; /// Render target MSAAx8 mode. -enum ulong BGFX_TEXTURE_RT_MSAA_X16 = 0x0000005000000000; /// Render target MSAAx16 mode. -enum ulong BGFX_TEXTURE_RT_MSAA_SHIFT = 36; -enum ulong BGFX_TEXTURE_RT_MSAA_MASK = 0x0000007000000000; - -enum ulong BGFX_TEXTURE_RT_WRITE_ONLY = 0x0000008000000000; /// Render target will be used for writing -enum ulong BGFX_TEXTURE_RT_SHIFT = 36; -enum ulong BGFX_TEXTURE_RT_MASK = 0x000000f000000000; - -/// Sampler flags. -enum uint BGFX_SAMPLER_U_MIRROR = 0x00000001; /// Wrap U mode: Mirror -enum uint BGFX_SAMPLER_U_CLAMP = 0x00000002; /// Wrap U mode: Clamp -enum uint BGFX_SAMPLER_U_BORDER = 0x00000003; /// Wrap U mode: Border -enum uint BGFX_SAMPLER_U_SHIFT = 0; -enum uint BGFX_SAMPLER_U_MASK = 0x00000003; - -enum uint BGFX_SAMPLER_V_MIRROR = 0x00000004; /// Wrap V mode: Mirror -enum uint BGFX_SAMPLER_V_CLAMP = 0x00000008; /// Wrap V mode: Clamp -enum uint BGFX_SAMPLER_V_BORDER = 0x0000000c; /// Wrap V mode: Border -enum uint BGFX_SAMPLER_V_SHIFT = 2; -enum uint BGFX_SAMPLER_V_MASK = 0x0000000c; - -enum uint BGFX_SAMPLER_W_MIRROR = 0x00000010; /// Wrap W mode: Mirror -enum uint BGFX_SAMPLER_W_CLAMP = 0x00000020; /// Wrap W mode: Clamp -enum uint BGFX_SAMPLER_W_BORDER = 0x00000030; /// Wrap W mode: Border -enum uint BGFX_SAMPLER_W_SHIFT = 4; -enum uint BGFX_SAMPLER_W_MASK = 0x00000030; - -enum uint BGFX_SAMPLER_MIN_POINT = 0x00000040; /// Min sampling mode: Point -enum uint BGFX_SAMPLER_MIN_ANISOTROPIC = 0x00000080; /// Min sampling mode: Anisotropic -enum uint BGFX_SAMPLER_MIN_SHIFT = 6; -enum uint BGFX_SAMPLER_MIN_MASK = 0x000000c0; - -enum uint BGFX_SAMPLER_MAG_POINT = 0x00000100; /// Mag sampling mode: Point -enum uint BGFX_SAMPLER_MAG_ANISOTROPIC = 0x00000200; /// Mag sampling mode: Anisotropic -enum uint BGFX_SAMPLER_MAG_SHIFT = 8; -enum uint BGFX_SAMPLER_MAG_MASK = 0x00000300; - -enum uint BGFX_SAMPLER_MIP_POINT = 0x00000400; /// Mip sampling mode: Point -enum uint BGFX_SAMPLER_MIP_SHIFT = 10; -enum uint BGFX_SAMPLER_MIP_MASK = 0x00000400; - -enum uint BGFX_SAMPLER_COMPARE_LESS = 0x00010000; /// Compare when sampling depth texture: less. -enum uint BGFX_SAMPLER_COMPARE_LEQUAL = 0x00020000; /// Compare when sampling depth texture: less or equal. -enum uint BGFX_SAMPLER_COMPARE_EQUAL = 0x00030000; /// Compare when sampling depth texture: equal. -enum uint BGFX_SAMPLER_COMPARE_GEQUAL = 0x00040000; /// Compare when sampling depth texture: greater or equal. -enum uint BGFX_SAMPLER_COMPARE_GREATER = 0x00050000; /// Compare when sampling depth texture: greater. -enum uint BGFX_SAMPLER_COMPARE_NOTEQUAL = 0x00060000; /// Compare when sampling depth texture: not equal. -enum uint BGFX_SAMPLER_COMPARE_NEVER = 0x00070000; /// Compare when sampling depth texture: never. -enum uint BGFX_SAMPLER_COMPARE_ALWAYS = 0x00080000; /// Compare when sampling depth texture: always. -enum uint BGFX_SAMPLER_COMPARE_SHIFT = 16; -enum uint BGFX_SAMPLER_COMPARE_MASK = 0x000f0000; - -enum uint BGFX_SAMPLER_BORDER_COLOR_SHIFT = 24; -enum uint BGFX_SAMPLER_BORDER_COLOR_MASK = 0x0f000000; -uint BGFX_SAMPLER_BORDER_COLOR (uint v) { return (v << BGFX_SAMPLER_BORDER_COLOR_SHIFT) & BGFX_SAMPLER_BORDER_COLOR_MASK; } - -enum uint BGFX_SAMPLER_RESERVED_SHIFT = 28; -enum uint BGFX_SAMPLER_RESERVED_MASK = 0xf0000000; - -enum uint BGFX_SAMPLER_NONE = 0x00000000; -enum uint BGFX_SAMPLER_SAMPLE_STENCIL = 0x00100000; /// Sample stencil instead of depth. -enum uint BGFX_SAMPLER_POINT = BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT; -enum uint BGFX_SAMPLER_UVW_MIRROR = BGFX_SAMPLER_U_MIRROR | BGFX_SAMPLER_V_MIRROR | BGFX_SAMPLER_W_MIRROR; -enum uint BGFX_SAMPLER_UVW_CLAMP = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_W_CLAMP; -enum uint BGFX_SAMPLER_UVW_BORDER = BGFX_SAMPLER_U_BORDER | BGFX_SAMPLER_V_BORDER | BGFX_SAMPLER_W_BORDER; -enum uint BGFX_SAMPLER_BITS_MASK = BGFX_SAMPLER_U_MASK | BGFX_SAMPLER_V_MASK | BGFX_SAMPLER_W_MASK | BGFX_SAMPLER_MIN_MASK | BGFX_SAMPLER_MAG_MASK | BGFX_SAMPLER_MIP_MASK | BGFX_SAMPLER_COMPARE_MASK; - -enum uint BGFX_RESET_MSAA_X2 = 0x00000010; /// Enable 2x MSAA. -enum uint BGFX_RESET_MSAA_X4 = 0x00000020; /// Enable 4x MSAA. -enum uint BGFX_RESET_MSAA_X8 = 0x00000030; /// Enable 8x MSAA. -enum uint BGFX_RESET_MSAA_X16 = 0x00000040; /// Enable 16x MSAA. -enum uint BGFX_RESET_MSAA_SHIFT = 4; -enum uint BGFX_RESET_MSAA_MASK = 0x00000070; - -enum uint BGFX_RESET_NONE = 0x00000000; /// No reset flags. -enum uint BGFX_RESET_FULLSCREEN = 0x00000001; /// Not supported yet. -enum uint BGFX_RESET_VSYNC = 0x00000080; /// Enable V-Sync. -enum uint BGFX_RESET_MAXANISOTROPY = 0x00000100; /// Turn on/off max anisotropy. -enum uint BGFX_RESET_CAPTURE = 0x00000200; /// Begin screen capture. -enum uint BGFX_RESET_FLUSH_AFTER_RENDER = 0x00002000; /// Flush rendering after submitting to GPU. -/** - * This flag specifies where flip occurs. Default behaviour is that flip occurs - * before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. - */ -enum uint BGFX_RESET_FLIP_AFTER_RENDER = 0x00004000; -enum uint BGFX_RESET_SRGB_BACKBUFFER = 0x00008000; /// Enable sRGB backbuffer. -enum uint BGFX_RESET_HDR10 = 0x00010000; /// Enable HDR10 rendering. -enum uint BGFX_RESET_HIDPI = 0x00020000; /// Enable HiDPI rendering. -enum uint BGFX_RESET_DEPTH_CLAMP = 0x00040000; /// Enable depth clamp. -enum uint BGFX_RESET_SUSPEND = 0x00080000; /// Suspend rendering. -enum uint BGFX_RESET_TRANSPARENT_BACKBUFFER = 0x00100000; /// Transparent backbuffer. Availability depends on: `BGFX_CAPS_TRANSPARENT_BACKBUFFER`. - -enum uint BGFX_RESET_FULLSCREEN_SHIFT = 0; -enum uint BGFX_RESET_FULLSCREEN_MASK = 0x00000001; - -enum uint BGFX_RESET_RESERVED_SHIFT = 31; /// Internal bit shift -enum uint BGFX_RESET_RESERVED_MASK = 0x80000000; /// Internal bit mask - -enum ulong BGFX_CAPS_ALPHA_TO_COVERAGE = 0x0000000000000001; /// Alpha to coverage is supported. -enum ulong BGFX_CAPS_BLEND_INDEPENDENT = 0x0000000000000002; /// Blend independent is supported. -enum ulong BGFX_CAPS_COMPUTE = 0x0000000000000004; /// Compute shaders are supported. -enum ulong BGFX_CAPS_CONSERVATIVE_RASTER = 0x0000000000000008; /// Conservative rasterization is supported. -enum ulong BGFX_CAPS_DRAW_INDIRECT = 0x0000000000000010; /// Draw indirect is supported. -enum ulong BGFX_CAPS_FRAGMENT_DEPTH = 0x0000000000000020; /// Fragment depth is available in fragment shader. -enum ulong BGFX_CAPS_FRAGMENT_ORDERING = 0x0000000000000040; /// Fragment ordering is available in fragment shader. -enum ulong BGFX_CAPS_GRAPHICS_DEBUGGER = 0x0000000000000080; /// Graphics debugger is present. -enum ulong BGFX_CAPS_HDR10 = 0x0000000000000100; /// HDR10 rendering is supported. -enum ulong BGFX_CAPS_HIDPI = 0x0000000000000200; /// HiDPI rendering is supported. -enum ulong BGFX_CAPS_IMAGE_RW = 0x0000000000000400; /// Image Read/Write is supported. -enum ulong BGFX_CAPS_INDEX32 = 0x0000000000000800; /// 32-bit indices are supported. -enum ulong BGFX_CAPS_INSTANCING = 0x0000000000001000; /// Instancing is supported. -enum ulong BGFX_CAPS_OCCLUSION_QUERY = 0x0000000000002000; /// Occlusion query is supported. -enum ulong BGFX_CAPS_RENDERER_MULTITHREADED = 0x0000000000004000; /// Renderer is on separate thread. -enum ulong BGFX_CAPS_SWAP_CHAIN = 0x0000000000008000; /// Multiple windows are supported. -enum ulong BGFX_CAPS_TEXTURE_2D_ARRAY = 0x0000000000010000; /// 2D texture array is supported. -enum ulong BGFX_CAPS_TEXTURE_3D = 0x0000000000020000; /// 3D textures are supported. -enum ulong BGFX_CAPS_TEXTURE_BLIT = 0x0000000000040000; /// Texture blit is supported. -enum ulong BGFX_CAPS_TRANSPARENT_BACKBUFFER = 0x0000000000080000; /// Transparent back buffer supported. -enum ulong BGFX_CAPS_TEXTURE_COMPARE_RESERVED = 0x0000000000100000; -enum ulong BGFX_CAPS_TEXTURE_COMPARE_LEQUAL = 0x0000000000200000; /// Texture compare less equal mode is supported. -enum ulong BGFX_CAPS_TEXTURE_CUBE_ARRAY = 0x0000000000400000; /// Cubemap texture array is supported. -enum ulong BGFX_CAPS_TEXTURE_DIRECT_ACCESS = 0x0000000000800000; /// CPU direct access to GPU texture memory. -enum ulong BGFX_CAPS_TEXTURE_READ_BACK = 0x0000000001000000; /// Read-back texture is supported. -enum ulong BGFX_CAPS_VERTEX_ATTRIB_HALF = 0x0000000002000000; /// Vertex attribute half-float is supported. -enum ulong BGFX_CAPS_VERTEX_ATTRIB_UINT10 = 0x0000000004000000; /// Vertex attribute 10_10_10_2 is supported. -enum ulong BGFX_CAPS_VERTEX_ID = 0x0000000008000000; /// Rendering with VertexID only is supported. -enum ulong BGFX_CAPS_VIEWPORT_LAYER_ARRAY = 0x0000000010000000; /// Viewport layer is available in vertex shader. -enum ulong BGFX_CAPS_DRAW_INDIRECT_COUNT = 0x0000000020000000; /// Draw indirect with indirect count is supported. -enum ulong BGFX_CAPS_TEXTURE_COMPARE_ALL = 0x0000000000300000; /// All texture compare modes are supported. - -enum uint BGFX_CAPS_FORMAT_TEXTURE_NONE = 0x00000000; /// Texture format is not supported. -enum uint BGFX_CAPS_FORMAT_TEXTURE_2D = 0x00000001; /// Texture format is supported. -enum uint BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB = 0x00000002; /// Texture as sRGB format is supported. -enum uint BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED = 0x00000004; /// Texture format is emulated. -enum uint BGFX_CAPS_FORMAT_TEXTURE_3D = 0x00000008; /// Texture format is supported. -enum uint BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB = 0x00000010; /// Texture as sRGB format is supported. -enum uint BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED = 0x00000020; /// Texture format is emulated. -enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE = 0x00000040; /// Texture format is supported. -enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB = 0x00000080; /// Texture as sRGB format is supported. -enum uint BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED = 0x00000100; /// Texture format is emulated. -enum uint BGFX_CAPS_FORMAT_TEXTURE_VERTEX = 0x00000200; /// Texture format can be used from vertex shader. -enum uint BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ = 0x00000400; /// Texture format can be used as image and read from. -enum uint BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE = 0x00000800; /// Texture format can be used as image and written to. -enum uint BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER = 0x00001000; /// Texture format can be used as frame buffer. -enum uint BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA = 0x00002000; /// Texture format can be used as MSAA frame buffer. -enum uint BGFX_CAPS_FORMAT_TEXTURE_MSAA = 0x00004000; /// Texture can be sampled as MSAA. -enum uint BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN = 0x00008000; /// Texture format supports auto-generated mips. - -enum ubyte BGFX_RESOLVE_NONE = 0x00; /// No resolve flags. -enum ubyte BGFX_RESOLVE_AUTO_GEN_MIPS = 0x01; /// Auto-generate mip maps on resolve. - -enum ushort BGFX_PCI_ID_NONE = 0x0000; /// Autoselect adapter. -enum ushort BGFX_PCI_ID_SOFTWARE_RASTERIZER = 0x0001; /// Software rasterizer. -enum ushort BGFX_PCI_ID_AMD = 0x1002; /// AMD adapter. -enum ushort BGFX_PCI_ID_APPLE = 0x106b; /// Apple adapter. -enum ushort BGFX_PCI_ID_INTEL = 0x8086; /// Intel adapter. -enum ushort BGFX_PCI_ID_NVIDIA = 0x10de; /// nVidia adapter. -enum ushort BGFX_PCI_ID_MICROSOFT = 0x1414; /// Microsoft adapter. -enum ushort BGFX_PCI_ID_ARM = 0x13b5; /// ARM adapter. - -enum ubyte BGFX_CUBE_MAP_POSITIVE_X = 0x00; /// Cubemap +x. -enum ubyte BGFX_CUBE_MAP_NEGATIVE_X = 0x01; /// Cubemap -x. -enum ubyte BGFX_CUBE_MAP_POSITIVE_Y = 0x02; /// Cubemap +y. -enum ubyte BGFX_CUBE_MAP_NEGATIVE_Y = 0x03; /// Cubemap -y. -enum ubyte BGFX_CUBE_MAP_POSITIVE_Z = 0x04; /// Cubemap +z. -enum ubyte BGFX_CUBE_MAP_NEGATIVE_Z = 0x05; /// Cubemap -z. - -/// Fatal error enum. -enum bgfx_fatal_t -{ - BGFX_FATAL_DEBUGCHECK, - BGFX_FATAL_INVALIDSHADER, - BGFX_FATAL_UNABLETOINITIALIZE, - BGFX_FATAL_UNABLETOCREATETEXTURE, - BGFX_FATAL_DEVICELOST, - - BGFX_FATAL_COUNT -} -mixin(expandEnum!bgfx_fatal_t); - -/// Renderer backend type enum. -enum bgfx_renderer_type_t -{ - BGFX_RENDERER_TYPE_NOOP, /// No rendering. - BGFX_RENDERER_TYPE_AGC, /// AGC - BGFX_RENDERER_TYPE_DIRECT3D9, /// Direct3D 9.0 - BGFX_RENDERER_TYPE_DIRECT3D11, /// Direct3D 11.0 - BGFX_RENDERER_TYPE_DIRECT3D12, /// Direct3D 12.0 - BGFX_RENDERER_TYPE_GNM, /// GNM - BGFX_RENDERER_TYPE_METAL, /// Metal - BGFX_RENDERER_TYPE_NVN, /// NVN - BGFX_RENDERER_TYPE_OPENGLES, /// OpenGL ES 2.0+ - BGFX_RENDERER_TYPE_OPENGL, /// OpenGL 2.1+ - BGFX_RENDERER_TYPE_VULKAN, /// Vulkan - BGFX_RENDERER_TYPE_WEBGPU, /// WebGPU - - BGFX_RENDERER_TYPE_COUNT -} -mixin(expandEnum!bgfx_renderer_type_t); - -/// Access mode enum. -enum bgfx_access_t -{ - BGFX_ACCESS_READ, /// Read. - BGFX_ACCESS_WRITE, /// Write. - BGFX_ACCESS_READWRITE, /// Read and write. - - BGFX_ACCESS_COUNT -} -mixin(expandEnum!bgfx_access_t); - -/// Vertex attribute enum. -enum bgfx_attrib_t -{ - BGFX_ATTRIB_POSITION, /// a_position - BGFX_ATTRIB_NORMAL, /// a_normal - BGFX_ATTRIB_TANGENT, /// a_tangent - BGFX_ATTRIB_BITANGENT, /// a_bitangent - BGFX_ATTRIB_COLOR0, /// a_color0 - BGFX_ATTRIB_COLOR1, /// a_color1 - BGFX_ATTRIB_COLOR2, /// a_color2 - BGFX_ATTRIB_COLOR3, /// a_color3 - BGFX_ATTRIB_INDICES, /// a_indices - BGFX_ATTRIB_WEIGHT, /// a_weight - BGFX_ATTRIB_TEXCOORD0, /// a_texcoord0 - BGFX_ATTRIB_TEXCOORD1, /// a_texcoord1 - BGFX_ATTRIB_TEXCOORD2, /// a_texcoord2 - BGFX_ATTRIB_TEXCOORD3, /// a_texcoord3 - BGFX_ATTRIB_TEXCOORD4, /// a_texcoord4 - BGFX_ATTRIB_TEXCOORD5, /// a_texcoord5 - BGFX_ATTRIB_TEXCOORD6, /// a_texcoord6 - BGFX_ATTRIB_TEXCOORD7, /// a_texcoord7 - - BGFX_ATTRIB_COUNT -} -mixin(expandEnum!bgfx_attrib_t); - -/// Vertex attribute type enum. -enum bgfx_attrib_type_t -{ - BGFX_ATTRIB_TYPE_UINT8, /// Uint8 - BGFX_ATTRIB_TYPE_UINT10, /// Uint10, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_UINT10`. - BGFX_ATTRIB_TYPE_INT16, /// Int16 - BGFX_ATTRIB_TYPE_HALF, /// Half, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_HALF`. - BGFX_ATTRIB_TYPE_FLOAT, /// Float - - BGFX_ATTRIB_TYPE_COUNT -} -mixin(expandEnum!bgfx_attrib_type_t); - -/** - * Texture format enum. - * Notation: - * RGBA16S - * ^ ^ ^ - * | | +-- [ ]Unorm - * | | [F]loat - * | | [S]norm - * | | [I]nt - * | | [U]int - * | +---- Number of bits per component - * +-------- Components - * @attention Availability depends on Caps (see: formats). - */ -enum bgfx_texture_format_t -{ - BGFX_TEXTURE_FORMAT_BC1, /// DXT1 R5G6B5A1 - BGFX_TEXTURE_FORMAT_BC2, /// DXT3 R5G6B5A4 - BGFX_TEXTURE_FORMAT_BC3, /// DXT5 R5G6B5A8 - BGFX_TEXTURE_FORMAT_BC4, /// LATC1/ATI1 R8 - BGFX_TEXTURE_FORMAT_BC5, /// LATC2/ATI2 RG8 - BGFX_TEXTURE_FORMAT_BC6H, /// BC6H RGB16F - BGFX_TEXTURE_FORMAT_BC7, /// BC7 RGB 4-7 bits per color channel, 0-8 bits alpha - BGFX_TEXTURE_FORMAT_ETC1, /// ETC1 RGB8 - BGFX_TEXTURE_FORMAT_ETC2, /// ETC2 RGB8 - BGFX_TEXTURE_FORMAT_ETC2A, /// ETC2 RGBA8 - BGFX_TEXTURE_FORMAT_ETC2A1, /// ETC2 RGB8A1 - BGFX_TEXTURE_FORMAT_PTC12, /// PVRTC1 RGB 2BPP - BGFX_TEXTURE_FORMAT_PTC14, /// PVRTC1 RGB 4BPP - BGFX_TEXTURE_FORMAT_PTC12A, /// PVRTC1 RGBA 2BPP - BGFX_TEXTURE_FORMAT_PTC14A, /// PVRTC1 RGBA 4BPP - BGFX_TEXTURE_FORMAT_PTC22, /// PVRTC2 RGBA 2BPP - BGFX_TEXTURE_FORMAT_PTC24, /// PVRTC2 RGBA 4BPP - BGFX_TEXTURE_FORMAT_ATC, /// ATC RGB 4BPP - BGFX_TEXTURE_FORMAT_ATCE, /// ATCE RGBA 8 BPP explicit alpha - BGFX_TEXTURE_FORMAT_ATCI, /// ATCI RGBA 8 BPP interpolated alpha - BGFX_TEXTURE_FORMAT_ASTC4X4, /// ASTC 4x4 8.0 BPP - BGFX_TEXTURE_FORMAT_ASTC5X5, /// ASTC 5x5 5.12 BPP - BGFX_TEXTURE_FORMAT_ASTC6X6, /// ASTC 6x6 3.56 BPP - BGFX_TEXTURE_FORMAT_ASTC8X5, /// ASTC 8x5 3.20 BPP - BGFX_TEXTURE_FORMAT_ASTC8X6, /// ASTC 8x6 2.67 BPP - BGFX_TEXTURE_FORMAT_ASTC10X5, /// ASTC 10x5 2.56 BPP - BGFX_TEXTURE_FORMAT_UNKNOWN, /// Compressed formats above. - BGFX_TEXTURE_FORMAT_R1, - BGFX_TEXTURE_FORMAT_A8, - BGFX_TEXTURE_FORMAT_R8, - BGFX_TEXTURE_FORMAT_R8I, - BGFX_TEXTURE_FORMAT_R8U, - BGFX_TEXTURE_FORMAT_R8S, - BGFX_TEXTURE_FORMAT_R16, - BGFX_TEXTURE_FORMAT_R16I, - BGFX_TEXTURE_FORMAT_R16U, - BGFX_TEXTURE_FORMAT_R16F, - BGFX_TEXTURE_FORMAT_R16S, - BGFX_TEXTURE_FORMAT_R32I, - BGFX_TEXTURE_FORMAT_R32U, - BGFX_TEXTURE_FORMAT_R32F, - BGFX_TEXTURE_FORMAT_RG8, - BGFX_TEXTURE_FORMAT_RG8I, - BGFX_TEXTURE_FORMAT_RG8U, - BGFX_TEXTURE_FORMAT_RG8S, - BGFX_TEXTURE_FORMAT_RG16, - BGFX_TEXTURE_FORMAT_RG16I, - BGFX_TEXTURE_FORMAT_RG16U, - BGFX_TEXTURE_FORMAT_RG16F, - BGFX_TEXTURE_FORMAT_RG16S, - BGFX_TEXTURE_FORMAT_RG32I, - BGFX_TEXTURE_FORMAT_RG32U, - BGFX_TEXTURE_FORMAT_RG32F, - BGFX_TEXTURE_FORMAT_RGB8, - BGFX_TEXTURE_FORMAT_RGB8I, - BGFX_TEXTURE_FORMAT_RGB8U, - BGFX_TEXTURE_FORMAT_RGB8S, - BGFX_TEXTURE_FORMAT_RGB9E5F, - BGFX_TEXTURE_FORMAT_BGRA8, - BGFX_TEXTURE_FORMAT_RGBA8, - BGFX_TEXTURE_FORMAT_RGBA8I, - BGFX_TEXTURE_FORMAT_RGBA8U, - BGFX_TEXTURE_FORMAT_RGBA8S, - BGFX_TEXTURE_FORMAT_RGBA16, - BGFX_TEXTURE_FORMAT_RGBA16I, - BGFX_TEXTURE_FORMAT_RGBA16U, - BGFX_TEXTURE_FORMAT_RGBA16F, - BGFX_TEXTURE_FORMAT_RGBA16S, - BGFX_TEXTURE_FORMAT_RGBA32I, - BGFX_TEXTURE_FORMAT_RGBA32U, - BGFX_TEXTURE_FORMAT_RGBA32F, - BGFX_TEXTURE_FORMAT_B5G6R5, - BGFX_TEXTURE_FORMAT_R5G6B5, - BGFX_TEXTURE_FORMAT_BGRA4, - BGFX_TEXTURE_FORMAT_RGBA4, - BGFX_TEXTURE_FORMAT_BGR5A1, - BGFX_TEXTURE_FORMAT_RGB5A1, - BGFX_TEXTURE_FORMAT_RGB10A2, - BGFX_TEXTURE_FORMAT_RG11B10F, - BGFX_TEXTURE_FORMAT_UNKNOWNDEPTH, /// Depth formats below. - BGFX_TEXTURE_FORMAT_D16, - BGFX_TEXTURE_FORMAT_D24, - BGFX_TEXTURE_FORMAT_D24S8, - BGFX_TEXTURE_FORMAT_D32, - BGFX_TEXTURE_FORMAT_D16F, - BGFX_TEXTURE_FORMAT_D24F, - BGFX_TEXTURE_FORMAT_D32F, - BGFX_TEXTURE_FORMAT_D0S8, - - BGFX_TEXTURE_FORMAT_COUNT -} -mixin(expandEnum!bgfx_texture_format_t); - -/// Uniform type enum. -enum bgfx_uniform_type_t -{ - BGFX_UNIFORM_TYPE_SAMPLER, /// Sampler. - BGFX_UNIFORM_TYPE_END, /// Reserved, do not use. - BGFX_UNIFORM_TYPE_VEC4, /// 4 floats vector. - BGFX_UNIFORM_TYPE_MAT3, /// 3x3 matrix. - BGFX_UNIFORM_TYPE_MAT4, /// 4x4 matrix. - - BGFX_UNIFORM_TYPE_COUNT -} -mixin(expandEnum!bgfx_uniform_type_t); - -/// Backbuffer ratio enum. -enum bgfx_backbuffer_ratio_t -{ - BGFX_BACKBUFFER_RATIO_EQUAL, /// Equal to backbuffer. - BGFX_BACKBUFFER_RATIO_HALF, /// One half size of backbuffer. - BGFX_BACKBUFFER_RATIO_QUARTER, /// One quarter size of backbuffer. - BGFX_BACKBUFFER_RATIO_EIGHTH, /// One eighth size of backbuffer. - BGFX_BACKBUFFER_RATIO_SIXTEENTH, /// One sixteenth size of backbuffer. - BGFX_BACKBUFFER_RATIO_DOUBLE, /// Double size of backbuffer. - - BGFX_BACKBUFFER_RATIO_COUNT -} -mixin(expandEnum!bgfx_backbuffer_ratio_t); - -/// Occlusion query result. -enum bgfx_occlusion_query_result_t -{ - BGFX_OCCLUSION_QUERY_RESULT_INVISIBLE, /// Query failed test. - BGFX_OCCLUSION_QUERY_RESULT_VISIBLE, /// Query passed test. - BGFX_OCCLUSION_QUERY_RESULT_NORESULT, /// Query result is not available yet. - - BGFX_OCCLUSION_QUERY_RESULT_COUNT -} -mixin(expandEnum!bgfx_occlusion_query_result_t); - -/// Primitive topology. -enum bgfx_topology_t -{ - BGFX_TOPOLOGY_TRILIST, /// Triangle list. - BGFX_TOPOLOGY_TRISTRIP, /// Triangle strip. - BGFX_TOPOLOGY_LINELIST, /// Line list. - BGFX_TOPOLOGY_LINESTRIP, /// Line strip. - BGFX_TOPOLOGY_POINTLIST, /// Point list. - - BGFX_TOPOLOGY_COUNT -} -mixin(expandEnum!bgfx_topology_t); - -/// Topology conversion function. -enum bgfx_topology_convert_t -{ - BGFX_TOPOLOGY_CONVERT_TRILISTFLIPWINDING, /// Flip winding order of triangle list. - BGFX_TOPOLOGY_CONVERT_TRISTRIPFLIPWINDING, /// Flip winding order of triangle strip. - BGFX_TOPOLOGY_CONVERT_TRILISTTOLINELIST, /// Convert triangle list to line list. - BGFX_TOPOLOGY_CONVERT_TRISTRIPTOTRILIST, /// Convert triangle strip to triangle list. - BGFX_TOPOLOGY_CONVERT_LINESTRIPTOLINELIST, /// Convert line strip to line list. - - BGFX_TOPOLOGY_CONVERT_COUNT -} -mixin(expandEnum!bgfx_topology_convert_t); - -/// Topology sort order. -enum bgfx_topology_sort_t -{ - BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKMIN, - BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKAVG, - BGFX_TOPOLOGY_SORT_DIRECTIONFRONTTOBACKMAX, - BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTMIN, - BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTAVG, - BGFX_TOPOLOGY_SORT_DIRECTIONBACKTOFRONTMAX, - BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKMIN, - BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKAVG, - BGFX_TOPOLOGY_SORT_DISTANCEFRONTTOBACKMAX, - BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTMIN, - BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTAVG, - BGFX_TOPOLOGY_SORT_DISTANCEBACKTOFRONTMAX, - - BGFX_TOPOLOGY_SORT_COUNT -} -mixin(expandEnum!bgfx_topology_sort_t); - -/// View mode sets draw call sort order. -enum bgfx_view_mode_t -{ - BGFX_VIEW_MODE_DEFAULT, /// Default sort order. - BGFX_VIEW_MODE_SEQUENTIAL, /// Sort in the same order in which submit calls were called. - BGFX_VIEW_MODE_DEPTHASCENDING, /// Sort draw call depth in ascending order. - BGFX_VIEW_MODE_DEPTHDESCENDING, /// Sort draw call depth in descending order. - - BGFX_VIEW_MODE_COUNT -} -mixin(expandEnum!bgfx_view_mode_t); - -/// Render frame enum. -enum bgfx_render_frame_t -{ - BGFX_RENDER_FRAME_NOCONTEXT, /// Renderer context is not created yet. - BGFX_RENDER_FRAME_RENDER, /// Renderer context is created and rendering. - BGFX_RENDER_FRAME_TIMEOUT, /// Renderer context wait for main thread signal timed out without rendering. - BGFX_RENDER_FRAME_EXITING, /// Renderer context is getting destroyed. - - BGFX_RENDER_FRAME_COUNT -} -mixin(expandEnum!bgfx_render_frame_t); - -/// GPU info. -struct bgfx_caps_gpu_t -{ - ushort vendorId; /// Vendor PCI id. See `BGFX_PCI_ID_*`. - ushort deviceId; /// Device id. -} - -/// Renderer runtime limits. -struct bgfx_caps_limits_t -{ - uint maxDrawCalls; /// Maximum number of draw calls. - uint maxBlits; /// Maximum number of blit calls. - uint maxTextureSize; /// Maximum texture size. - uint maxTextureLayers; /// Maximum texture layers. - uint maxViews; /// Maximum number of views. - uint maxFrameBuffers; /// Maximum number of frame buffer handles. - uint maxFBAttachments; /// Maximum number of frame buffer attachments. - uint maxPrograms; /// Maximum number of program handles. - uint maxShaders; /// Maximum number of shader handles. - uint maxTextures; /// Maximum number of texture handles. - uint maxTextureSamplers; /// Maximum number of texture samplers. - uint maxComputeBindings; /// Maximum number of compute bindings. - uint maxVertexLayouts; /// Maximum number of vertex format layouts. - uint maxVertexStreams; /// Maximum number of vertex streams. - uint maxIndexBuffers; /// Maximum number of index buffer handles. - uint maxVertexBuffers; /// Maximum number of vertex buffer handles. - uint maxDynamicIndexBuffers; /// Maximum number of dynamic index buffer handles. - uint maxDynamicVertexBuffers; /// Maximum number of dynamic vertex buffer handles. - uint maxUniforms; /// Maximum number of uniform handles. - uint maxOcclusionQueries; /// Maximum number of occlusion query handles. - uint maxEncoders; /// Maximum number of encoder threads. - uint minResourceCbSize; /// Minimum resource command buffer size. - uint transientVbSize; /// Maximum transient vertex buffer size. - uint transientIbSize; /// Maximum transient index buffer size. -} - -/// Renderer capabilities. -struct bgfx_caps_t -{ - bgfx_renderer_type_t rendererType; /// Renderer backend type. See: `bgfx::RendererType` - - /** - * Supported functionality. - * @attention See `BGFX_CAPS_*` flags at https://bkaradzic.github.io/bgfx/bgfx.html#available-caps - */ - ulong supported; - ushort vendorId; /// Selected GPU vendor PCI id. - ushort deviceId; /// Selected GPU device id. - bool homogeneousDepth; /// True when NDC depth is in [-1, 1] range, otherwise its [0, 1]. - bool originBottomLeft; /// True when NDC origin is at bottom left. - ubyte numGPUs; /// Number of enumerated GPUs. - bgfx_caps_gpu_t[4] gpu; /// Enumerated GPUs. - bgfx_caps_limits_t limits; /// Renderer runtime limits. - - /** - * Supported texture format capabilities flags: - * - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - Texture format is not supported. - * - `BGFX_CAPS_FORMAT_TEXTURE_2D` - Texture format is supported. - * - `BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB` - Texture as sRGB format is supported. - * - `BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED` - Texture format is emulated. - * - `BGFX_CAPS_FORMAT_TEXTURE_3D` - Texture format is supported. - * - `BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB` - Texture as sRGB format is supported. - * - `BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED` - Texture format is emulated. - * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE` - Texture format is supported. - * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB` - Texture as sRGB format is supported. - * - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED` - Texture format is emulated. - * - `BGFX_CAPS_FORMAT_TEXTURE_VERTEX` - Texture format can be used from vertex shader. - * - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ` - Texture format can be used as image - * and read from. - * - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE` - Texture format can be used as image - * and written to. - * - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER` - Texture format can be used as frame - * buffer. - * - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA` - Texture format can be used as MSAA - * frame buffer. - * - `BGFX_CAPS_FORMAT_TEXTURE_MSAA` - Texture can be sampled as MSAA. - * - `BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN` - Texture format supports auto-generated - * mips. - */ - ushort[bgfx_texture_format_t.BGFX_TEXTURE_FORMAT_COUNT] formats; -} - -/// Internal data. -struct bgfx_internal_data_t -{ - const(bgfx_caps_t)* caps; /// Renderer capabilities. - void* context; /// GL context, or D3D device. -} - -/// Platform data. -struct bgfx_platform_data_t -{ - void* ndt; /// Native display type (*nix specific). - - /** - * Native window handle. If `NULL`, bgfx will create a headless - * context/device, provided the rendering API supports it. - */ - void* nwh; - - /** - * GL context, D3D device, or Vulkan device. If `NULL`, bgfx - * will create context/device. - */ - void* context; - - /** - * GL back-buffer, or D3D render target view. If `NULL` bgfx will - * create back-buffer color surface. - */ - void* backBuffer; - - /** - * Backbuffer depth/stencil. If `NULL`, bgfx will create a back-buffer - * depth/stencil surface. - */ - void* backBufferDS; -} - -/// Backbuffer resolution and reset parameters. -struct bgfx_resolution_t -{ - bgfx_texture_format_t format; /// Backbuffer format. - uint width; /// Backbuffer width. - uint height; /// Backbuffer height. - uint reset; /// Reset parameters. - ubyte numBackBuffers; /// Number of back buffers. - ubyte maxFrameLatency; /// Maximum frame latency. -} - -/// Configurable runtime limits parameters. -struct bgfx_init_limits_t -{ - ushort maxEncoders; /// Maximum number of encoder threads. - uint minResourceCbSize; /// Minimum resource command buffer size. - uint transientVbSize; /// Maximum transient vertex buffer size. - uint transientIbSize; /// Maximum transient index buffer size. -} - -/// Initialization parameters used by `bgfx::init`. -struct bgfx_init_t -{ - - /** - * Select rendering backend. When set to RendererType::Count - * a default rendering backend will be selected appropriate to the platform. - * See: `bgfx::RendererType` - */ - bgfx_renderer_type_t type; - - /** - * Vendor PCI ID. If set to `BGFX_PCI_ID_NONE`, discrete and integrated - * GPUs will be prioritised. - * - `BGFX_PCI_ID_NONE` - Autoselect adapter. - * - `BGFX_PCI_ID_SOFTWARE_RASTERIZER` - Software rasterizer. - * - `BGFX_PCI_ID_AMD` - AMD adapter. - * - `BGFX_PCI_ID_APPLE` - Apple adapter. - * - `BGFX_PCI_ID_INTEL` - Intel adapter. - * - `BGFX_PCI_ID_NVIDIA` - NVIDIA adapter. - * - `BGFX_PCI_ID_MICROSOFT` - Microsoft adapter. - */ - ushort vendorId; - - /** - * Device ID. If set to 0 it will select first device, or device with - * matching ID. - */ - ushort deviceId; - ulong capabilities; /// Capabilities initialization mask (default: UINT64_MAX). - bool debug_; /// Enable device for debugging. - bool profile; /// Enable device for profiling. - bgfx_platform_data_t platformData; /// Platform data. - bgfx_resolution_t resolution; /// Backbuffer resolution and reset parameters. See: `bgfx::Resolution`. - bgfx_init_limits_t limits; /// Configurable runtime limits parameters. - - /** - * Provide application specific callback interface. - * See: `bgfx::CallbackI` - */ - void* callback; - - /** - * Custom allocator. When a custom allocator is not - * specified, bgfx uses the CRT allocator. Bgfx assumes - * custom allocator is thread safe. - */ - void* allocator; -} - -/** - * Memory must be obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`. - * @attention It is illegal to create this structure on stack and pass it to any bgfx API. - */ -struct bgfx_memory_t -{ - ubyte* data; /// Pointer to data. - uint size; /// Data size. -} - -/// Transient index buffer. -struct bgfx_transient_index_buffer_t -{ - ubyte* data; /// Pointer to data. - uint size; /// Data size. - uint startIndex; /// First index. - bgfx_index_buffer_handle_t handle; /// Index buffer handle. - bool isIndex16; /// Index buffer format is 16-bits if true, otherwise it is 32-bit. -} - -/// Transient vertex buffer. -struct bgfx_transient_vertex_buffer_t -{ - ubyte* data; /// Pointer to data. - uint size; /// Data size. - uint startVertex; /// First vertex. - ushort stride; /// Vertex stride. - bgfx_vertex_buffer_handle_t handle; /// Vertex buffer handle. - bgfx_vertex_layout_handle_t layoutHandle; /// Vertex layout handle. -} - -/// Instance data buffer info. -struct bgfx_instance_data_buffer_t -{ - ubyte* data; /// Pointer to data. - uint size; /// Data size. - uint offset; /// Offset in vertex buffer. - uint num; /// Number of instances. - ushort stride; /// Vertex buffer stride. - bgfx_vertex_buffer_handle_t handle; /// Vertex buffer object handle. -} - -/// Texture info. -struct bgfx_texture_info_t -{ - bgfx_texture_format_t format; /// Texture format. - uint storageSize; /// Total amount of bytes required to store texture. - ushort width; /// Texture width. - ushort height; /// Texture height. - ushort depth; /// Texture depth. - ushort numLayers; /// Number of layers in texture array. - ubyte numMips; /// Number of MIP maps. - ubyte bitsPerPixel; /// Format bits per pixel. - bool cubeMap; /// Texture is cubemap. -} - -/// Uniform info. -struct bgfx_uniform_info_t -{ - char[256] name; /// Uniform name. - bgfx_uniform_type_t type; /// Uniform type. - ushort num; /// Number of elements in array. -} - -/// Frame buffer texture attachment info. -struct bgfx_attachment_t -{ - bgfx_access_t access; /// Attachment access. See `Access::Enum`. - bgfx_texture_handle_t handle; /// Render target texture handle. - ushort mip; /// Mip level. - ushort layer; /// Cubemap side or depth layer/slice to use. - ushort numLayers; /// Number of texture layer/slice(s) in array to use. - ubyte resolve; /// Resolve flags. See: `BGFX_RESOLVE_*` -} - -/// Transform data. -struct bgfx_transform_t -{ - float* data; /// Pointer to first 4x4 matrix. - ushort num; /// Number of matrices. -} - -/// View stats. -struct bgfx_view_stats_t -{ - char[256] name; /// View name. - bgfx_view_id_t view; /// View id. - long cpuTimeBegin; /// CPU (submit) begin time. - long cpuTimeEnd; /// CPU (submit) end time. - long gpuTimeBegin; /// GPU begin time. - long gpuTimeEnd; /// GPU end time. - uint gpuFrameNum; /// Frame which generated gpuTimeBegin, gpuTimeEnd. -} - -/// Encoder stats. -struct bgfx_encoder_stats_t -{ - long cpuTimeBegin; /// Encoder thread CPU submit begin time. - long cpuTimeEnd; /// Encoder thread CPU submit end time. -} - -/** - * Renderer statistics data. - * @remarks All time values are high-resolution timestamps, while - * time frequencies define timestamps-per-second for that hardware. - */ -struct bgfx_stats_t -{ - long cpuTimeFrame; /// CPU time between two `bgfx::frame` calls. - long cpuTimeBegin; /// Render thread CPU submit begin time. - long cpuTimeEnd; /// Render thread CPU submit end time. - long cpuTimerFreq; /// CPU timer frequency. Timestamps-per-second - long gpuTimeBegin; /// GPU frame begin time. - long gpuTimeEnd; /// GPU frame end time. - long gpuTimerFreq; /// GPU timer frequency. - long waitRender; /// Time spent waiting for render backend thread to finish issuing draw commands to underlying graphics API. - long waitSubmit; /// Time spent waiting for submit thread to advance to next frame. - uint numDraw; /// Number of draw calls submitted. - uint numCompute; /// Number of compute calls submitted. - uint numBlit; /// Number of blit calls submitted. - uint maxGpuLatency; /// GPU driver latency. - uint gpuFrameNum; /// Frame which generated gpuTimeBegin, gpuTimeEnd. - ushort numDynamicIndexBuffers; /// Number of used dynamic index buffers. - ushort numDynamicVertexBuffers; /// Number of used dynamic vertex buffers. - ushort numFrameBuffers; /// Number of used frame buffers. - ushort numIndexBuffers; /// Number of used index buffers. - ushort numOcclusionQueries; /// Number of used occlusion queries. - ushort numPrograms; /// Number of used programs. - ushort numShaders; /// Number of used shaders. - ushort numTextures; /// Number of used textures. - ushort numUniforms; /// Number of used uniforms. - ushort numVertexBuffers; /// Number of used vertex buffers. - ushort numVertexLayouts; /// Number of used vertex layouts. - long textureMemoryUsed; /// Estimate of texture memory used. - long rtMemoryUsed; /// Estimate of render target memory used. - int transientVbUsed; /// Amount of transient vertex buffer used. - int transientIbUsed; /// Amount of transient index buffer used. - uint[bgfx_topology_t.BGFX_TOPOLOGY_COUNT] numPrims; /// Number of primitives rendered. - long gpuMemoryMax; /// Maximum available GPU memory for application. - long gpuMemoryUsed; /// Amount of GPU memory used by the application. - ushort width; /// Backbuffer width in pixels. - ushort height; /// Backbuffer height in pixels. - ushort textWidth; /// Debug text width in characters. - ushort textHeight; /// Debug text height in characters. - ushort numViews; /// Number of view stats. - bgfx_view_stats_t* viewStats; /// Array of View stats. - ubyte numEncoders; /// Number of encoders used during frame. - bgfx_encoder_stats_t* encoderStats; /// Array of encoder stats. -} - -/// Vertex layout. -struct bgfx_vertex_layout_t -{ - uint hash; /// Hash. - ushort stride; /// Stride. - ushort[bgfx_attrib_t.BGFX_ATTRIB_COUNT] offset; /// Attribute offsets. - ushort[bgfx_attrib_t.BGFX_ATTRIB_COUNT] attributes; /// Used attributes. -} - -/** - * Encoders are used for submitting draw calls from multiple threads. Only one encoder - * per thread should be used. Use `bgfx::begin()` to obtain an encoder for a thread. - */ -struct bgfx_encoder_t -{ -} - -struct bgfx_dynamic_index_buffer_handle_t { ushort idx; } - -struct bgfx_dynamic_vertex_buffer_handle_t { ushort idx; } - -struct bgfx_frame_buffer_handle_t { ushort idx; } - -struct bgfx_index_buffer_handle_t { ushort idx; } - -struct bgfx_indirect_buffer_handle_t { ushort idx; } - -struct bgfx_occlusion_query_handle_t { ushort idx; } - -struct bgfx_program_handle_t { ushort idx; } - -struct bgfx_shader_handle_t { ushort idx; } - -struct bgfx_texture_handle_t { ushort idx; } - -struct bgfx_uniform_handle_t { ushort idx; } - -struct bgfx_vertex_buffer_handle_t { ushort idx; } - -struct bgfx_vertex_layout_handle_t { ushort idx; } - diff --git a/bgfx/bindings/zig/bgfx.zig b/bgfx/bindings/zig/bgfx.zig index 6ad5f7e1..59292685 100644 --- a/bgfx/bindings/zig/bgfx.zig +++ b/bgfx/bindings/zig/bgfx.zig @@ -1,4 +1,4 @@ -// Copyright 2011-2022 Branimir Karadzic. All rights reserved. +// Copyright 2011-2023 Branimir Karadzic. All rights reserved. // License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE @@ -708,11 +708,14 @@ pub const CapsFlags_VertexAttribUint10: CapsFlags = 0x0000000004000000; /// Rendering with VertexID only is supported. pub const CapsFlags_VertexId: CapsFlags = 0x0000000008000000; +/// PrimitiveID is available in fragment shader. +pub const CapsFlags_PrimitiveId: CapsFlags = 0x0000000010000000; + /// Viewport layer is available in vertex shader. -pub const CapsFlags_ViewportLayerArray: CapsFlags = 0x0000000010000000; +pub const CapsFlags_ViewportLayerArray: CapsFlags = 0x0000000020000000; /// Draw indirect with indirect count is supported. -pub const CapsFlags_DrawIndirectCount: CapsFlags = 0x0000000020000000; +pub const CapsFlags_DrawIndirectCount: CapsFlags = 0x0000000040000000; /// All texture compare modes are supported. pub const CapsFlags_TextureCompareAll: CapsFlags = 0x0000000000300000; @@ -1024,9 +1027,15 @@ pub const TextureFormat = enum(c_int) { /// ASTC 4x4 8.0 BPP ASTC4x4, + /// ASTC 5x4 6.40 BPP + ASTC5x4, + /// ASTC 5x5 5.12 BPP ASTC5x5, + /// ASTC 6x5 4.27 BPP + ASTC6x5, + /// ASTC 6x6 3.56 BPP ASTC6x6, @@ -1036,9 +1045,27 @@ pub const TextureFormat = enum(c_int) { /// ASTC 8x6 2.67 BPP ASTC8x6, + /// ASTC 8x8 2.00 BPP + ASTC8x8, + /// ASTC 10x5 2.56 BPP ASTC10x5, + /// ASTC 10x6 2.13 BPP + ASTC10x6, + + /// ASTC 10x8 1.60 BPP + ASTC10x8, + + /// ASTC 10x10 1.28 BPP + ASTC10x10, + + /// ASTC 12x10 1.07 BPP + ASTC12x10, + + /// ASTC 12x12 0.89 BPP + ASTC12x12, + /// Compressed formats above. Unknown, R1, @@ -1233,6 +1260,16 @@ pub const ViewMode = enum(c_int) { Count }; +pub const NativeWindowHandleType = enum(c_int) { + /// Platform default handle type (X11 on Linux). + Default, + + /// Wayland. + Wayland, + + Count +}; + pub const RenderFrame = enum(c_int) { /// Renderer context is not created yet. NoContext, @@ -1291,7 +1328,7 @@ pub const Caps = extern struct { numGPUs: u8, gpu: [4]GPU, limits: Limits, - formats: [88]u16, + formats: [96]u16, }; pub const InternalData = extern struct { @@ -1305,6 +1342,7 @@ pub const Caps = extern struct { context: ?*anyopaque, backBuffer: ?*anyopaque, backBufferDS: ?*anyopaque, + type: NativeWindowHandleType, }; pub const Resolution = extern struct { @@ -1314,6 +1352,7 @@ pub const Caps = extern struct { reset: u32, numBackBuffers: u8, maxFrameLatency: u8, + debugTextScale: u8, }; pub const Init = extern struct { @@ -1675,7 +1714,7 @@ pub const Init = extern struct { /// Set instance data buffer for draw primitive. /// Vertex buffer. /// First instance data. - /// Number of data instances. Set instance data buffer for draw primitive. + /// Number of data instances. pub inline fn setInstanceDataFromVertexBuffer(self: ?*Encoder, _handle: VertexBufferHandle, _startVertex: u32, _num: u32) void { return bgfx_encoder_set_instance_data_from_vertex_buffer(self, _handle, _startVertex, _num); } @@ -3042,7 +3081,7 @@ extern fn bgfx_encoder_set_instance_data_buffer(self: ?*Encoder, _idb: [*c]const /// Set instance data buffer for draw primitive. /// Vertex buffer. /// First instance data. -/// Number of data instances. Set instance data buffer for draw primitive. +/// Number of data instances. extern fn bgfx_encoder_set_instance_data_from_vertex_buffer(self: ?*Encoder, _handle: VertexBufferHandle, _startVertex: u32, _num: u32) void; /// Set instance data buffer for draw primitive. @@ -3473,7 +3512,7 @@ extern fn bgfx_set_instance_data_buffer(_idb: [*c]const InstanceDataBuffer, _sta /// Set instance data buffer for draw primitive. /// Vertex buffer. /// First instance data. -/// Number of data instances. Set instance data buffer for draw primitive. +/// Number of data instances. pub inline fn setInstanceDataFromVertexBuffer(_handle: VertexBufferHandle, _startVertex: u32, _num: u32) void { return bgfx_set_instance_data_from_vertex_buffer(_handle, _startVertex, _num); } diff --git a/bgfx/docs/build.rst b/bgfx/docs/build.rst index 7d990a53..3fd670d2 100644 --- a/bgfx/docs/build.rst +++ b/bgfx/docs/build.rst @@ -28,17 +28,17 @@ Enter bgfx directory: cd bgfx -Generate Visual Studio 2017 project files: +Generate Visual Studio 2019 project files: :: - ..\bx\tools\bin\windows\genie --with-examples vs2017 + ..\bx\tools\bin\windows\genie --with-examples vs2019 -Open bgfx solution in Visual Studio 2017: +Open bgfx solution in Visual Studio 2019: :: - start .build\projects\vs2017\bgfx.sln + start .build\projects\vs2019\bgfx.sln .. note:: For more detailed prerequisites and build steps on other platforms see below. @@ -48,7 +48,7 @@ Prerequisites Android ~~~~~~~ -Download AndroidNDK: +Download Android NDK (r23 or newer): - https://developer.android.com/tools/sdk/ndk/index.html @@ -57,15 +57,8 @@ Set following environment variables: :: setx ANDROID_NDK_ROOT - setx ANDROID_NDK_ARM \toolchains\arm-linux-androideabi-4.7\prebuilt\windows-x86_64 - setx ANDROID_NDK_MIPS \toolchains\mipsel-linux-android-4.7\prebuilt\windows-x86_64 - setx ANDROID_NDK_X86 \toolchains\x86-4.7\prebuilt\windows-x86_64 -To deploy on Android you can use bgfx android activity: - - - https://github.com/Nodrev/bgfx-android-activity#bgfx-android-activity---android-glue-for-bgfx - Linux ~~~~~ @@ -90,7 +83,7 @@ Build ----- bgfx uses `GENie - Project generator tool `__ -to generate project files for various platform. Binaries for Linux, OSX, and Windows are included in +to generate project files for various platform. Binaries for Linux, macOS, and Windows are included in bx repository. General @@ -118,17 +111,17 @@ Configuration is ``-[32/64]``. For example: Windows ~~~~~~~ -Visual Studio 2017 command line: +Visual Studio 2019 command line: :: - make vs2017-release64 + make vs2019-release64 -Visual Studio 2017 IDE: +Visual Studio 2019 IDE: :: - start .build/projects/vs2017/bgfx.sln + start .build/projects/vs2019/bgfx.sln Xcode ~~~~~ @@ -169,7 +162,7 @@ WinRT / UWP :: - ..\bx\tools\bin\windows\genie --vs=winstore100 vs2017 + ..\bx\tools\bin\windows\genie --vs=winstore100 vs2019 Build the resulting solution and deploy to device. @@ -181,7 +174,7 @@ Amalgamated Build For ease of integration to other build system bgfx library can be built with single .cpp file. It's only necessary to build `src/amalgamated.cpp `__ -(for OSX/iOS use +(for macOS/iOS/iPadOS/tvOS use `src/amalgamated.mm `__ instead) inside different build system. @@ -192,7 +185,7 @@ To build bgfx project files for tools, use ``--with-tools`` option: :: - ..\bx\tools\bin\windows\genie --with-tools vs2017 + ..\bx\tools\bin\windows\genie --with-tools vs2019 Alternative build systems diff --git a/bgfx/docs/internals.rst b/bgfx/docs/internals.rst index 8e71d76e..00b2fd18 100644 --- a/bgfx/docs/internals.rst +++ b/bgfx/docs/internals.rst @@ -35,7 +35,7 @@ Encoder API can be obtained by calling ``bgfx::begin``. bgfx by default allows 8 Customization ------------- -By default each platform has sane default values. For example on Windows default renderer is DirectX, on Linux it is OpenGL, and on OSX it's Metal. On Windows platform almost all rendering backends are available. For OpenGL ES on desktop you can find more information at:- `OpenGL ES 2.0 and EGL on desktop `__ +By default each platform has sane default values. For example on Windows default renderer is DirectX, on Linux it is OpenGL, and on macOS it's Metal. On Windows platform almost all rendering backends are available. For OpenGL ES on desktop you can find more information at:- `OpenGL ES 2.0 and EGL on desktop `__ If you're targeting specific mobile hardware, you can find GLES support in their official SDKs: `Adreno SDK `__, `Mali SDK `__, `PowerVR SDK `__. diff --git a/bgfx/docs/license.rst b/bgfx/docs/license.rst index 130b994d..47f48e7b 100644 --- a/bgfx/docs/license.rst +++ b/bgfx/docs/license.rst @@ -6,7 +6,7 @@ License :: - Copyright 2010-2022 Branimir Karadzic + Copyright 2010-2023 Branimir Karadzic Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/bgfx/docs/overview.rst b/bgfx/docs/overview.rst index b0a73882..58335373 100644 --- a/bgfx/docs/overview.rst +++ b/bgfx/docs/overview.rst @@ -35,23 +35,22 @@ Supported Platforms ~~~~~~~~~~~~~~~~~~~ - Android (14+, ARM, x86, MIPS) -- FreeBSD -- iOS (iPhone, iPad, AppleTV) +- iOS/iPadOS/tvOS (iPhone, iPad, AppleTV) - Linux -- MIPS Creator CI20 -- OSX (10.12+) +- macOS (11+) - PlayStation 4 - RaspberryPi - UWP (Universal Windows, Xbox One) - Wasm/Emscripten -- Windows (XP, Vista, 7, 8, 10) +- Windows (7+) Supported Compilers ~~~~~~~~~~~~~~~~~~~ -- Clang 3.3 and above -- GCC 5 and above -- vs2017 and above +- Clang 11 and above +- GCC 8 and above +- VS2019 and above +- Apple clang 12 and above Supported Languages ~~~~~~~~~~~~~~~~~~~ @@ -59,7 +58,7 @@ Supported Languages - `C/C++ API documentation `__ - `Beef API bindings `__ - `C# language API bindings #1 `__ -- `D language API bindings `__ +- `D language API bindings `__ - `Go language API bindings `__ - `Haskell language API bindings `__ - `Lightweight Java Game Library 3 bindings `__ @@ -123,13 +122,13 @@ Other Debuggers and Profilers +-------------+-----------------+-------+--------+------+-------+------+------+-------+--------+ | Name | OS | DX9 | DX11 | DX12 | Metal | GL | GLES | Vulkan| Source | +=============+=================+=======+========+======+=======+======+======+=======+========+ -| APITrace | Linux/OSX/Win | |x| | |x| | | | |x| | |x| | | |x| | +| APITrace | Linux/macOS/Win | |x| | |x| | | | |x| | |x| | | |x| | +-------------+-----------------+-------+--------+------+-------+------+------+-------+--------+ | CodeXL | Linux/Win | | | | | |x| | | | | +-------------+-----------------+-------+--------+------+-------+------+------+-------+--------+ | Dissector | Win | |x| | | | | | | | |x| | +-------------+-----------------+-------+--------+------+-------+------+------+-------+--------+ -| IntelGPA | Linux/OSX/Win | |x| | |x| | | | | |x| | | | +| IntelGPA | Linux/macOS/Win | |x| | |x| | | | | |x| | | | +-------------+-----------------+-------+--------+------+-------+------+------+-------+--------+ | Nsight | Win | |x| | |x| | | | |x| | | | | +-------------+-----------------+-------+--------+------+-------+------+------+-------+--------+ @@ -196,7 +195,7 @@ Contributors Chronological order: - Branimir Karadžić (`@bkaradzic `__) - - Garett Bass (`@garettbass `__) - OSX port. + - Garett Bass (`@garettbass `__) - macOS port. - Jeremie Roy (`@jeremieroy `__) - `10-font `__, and `11-fontsdf `__ examples. @@ -221,7 +220,7 @@ Chronological order: - Andre Weissflog (`@floooh `__) - Alternative build system fips. - Andrew Johnson (`@ajohnson23 `__) - TeamCity build. - Tony McCrary (`@enleeten `__) - Java language API bindings. - - Attila Kocsis (`@attilaz `__) - Metal rendering backend, various OSX + - Attila Kocsis (`@attilaz `__) - Metal rendering backend, various macOS and iOS improvements and bug fixes, `39-assao `__ example. - Richard Gale (`@RichardGale `__) - Emscripten entry input handling. @@ -286,6 +285,8 @@ Chronological order: - Liam Twigger (`@SnapperTT `__) - `48-drawindirect `__ example. - Preetish Kakkar (`@blackhole `__) - `49-hextile `__ example. - Biswapriyo Nath (`@Biswa96 `__) - GitHub Actions CI. + - Raziel Alphadios (`@RazielXYZ `__) - Various fixes and improvements. + - IchorDev (`@IchorDev `__) - Improved D language bindings. and `others `__... diff --git a/bgfx/docs/tools.rst b/bgfx/docs/tools.rst index 9dc667a8..3a78c3a0 100644 --- a/bgfx/docs/tools.rst +++ b/bgfx/docs/tools.rst @@ -136,6 +136,49 @@ Predefined Uniforms For more info, see the `shader helper macros `__. +Vertex Shader Attributes +~~~~~~~~~~~~~~~~~~~~~~~~ + +``$input`` tokens for vertex shader can be only following: + + ================ =================== + Attribute bgfx::Attrib::Enum + ================ =================== + a_position Position + a_normal Normal + a_tangent Tangent + a_bitangent Bitangent + a_color0 Color0 + a_color1 Color1 + a_color2 Color2 + a_color3 Color3 + a_indices Indices + a_weight Weight + a_texcoord0 TexCoord0 + a_texcoord1 TexCoord1 + a_texcoord2 TexCoord2 + a_texcoord3 TexCoord3 + a_texcoord4 TexCoord4 + a_texcoord5 TexCoord5 + a_texcoord6 TexCoord6 + a_texcoord7 TexCoord7 + ================ =================== + +In ``varying.def.sc``, instance buffer input must use ``i_dataN`` as identifier where ``N`` is the index +of the attribute in the buffer. Type must be ``vec4``, and the stride must be multiple of 16. +The semantic must be ``TEXCOORDN`` with a decreasing index starting from ``TEXCOORD7``. + +:: + + vec4 i_data0 : TEXCOORD7; + vec4 i_data1 : TEXCOORD6; + vec4 i_data2 : TEXCOORD5; + vec4 i_data3 : TEXCOORD4; + vec4 i_data4 : TEXCOORD3; + +Options +~~~~~~~ + Options: -h, --help Display this help and exit. diff --git a/bgfx/examples/00-helloworld/helloworld.cpp b/bgfx/examples/00-helloworld/helloworld.cpp index 97a79463..8b989195 100644 --- a/bgfx/examples/00-helloworld/helloworld.cpp +++ b/bgfx/examples/00-helloworld/helloworld.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -34,6 +34,7 @@ class ExampleHelloWorld : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; @@ -90,9 +91,12 @@ class ExampleHelloWorld : public entry::AppI // Use debug font to print information about this example. bgfx::dbgTextClear(); + + const bgfx::Stats* stats = bgfx::getStats(); + bgfx::dbgTextImage( - bx::max(uint16_t(m_width /2/8 ), 20)-20 - , bx::max(uint16_t(m_height/2/16), 6)-6 + bx::max(uint16_t(stats->textWidth/2), 20)-20 + , bx::max(uint16_t(stats->textHeight/2), 6)-6 , 40 , 12 , s_logo @@ -103,7 +107,6 @@ class ExampleHelloWorld : public entry::AppI bgfx::dbgTextPrintf(80, 1, 0x0f, "\x1b[;0m \x1b[;1m \x1b[; 2m \x1b[; 3m \x1b[; 4m \x1b[; 5m \x1b[; 6m \x1b[; 7m \x1b[0m"); bgfx::dbgTextPrintf(80, 2, 0x0f, "\x1b[;8m \x1b[;9m \x1b[;10m \x1b[;11m \x1b[;12m \x1b[;13m \x1b[;14m \x1b[;15m \x1b[0m"); - const bgfx::Stats* stats = bgfx::getStats(); bgfx::dbgTextPrintf(0, 2, 0x0f, "Backbuffer %dW x %dH in pixels, debug text %dW x %dH in characters." , stats->width , stats->height diff --git a/bgfx/examples/01-cubes/cubes.cpp b/bgfx/examples/01-cubes/cubes.cpp index de456673..4c3da5c5 100644 --- a/bgfx/examples/01-cubes/cubes.cpp +++ b/bgfx/examples/01-cubes/cubes.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -149,6 +149,7 @@ class ExampleCubes : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/01-cubes/fs_cubes.sc b/bgfx/examples/01-cubes/fs_cubes.sc index 8ea959c8..6f31cbe2 100644 --- a/bgfx/examples/01-cubes/fs_cubes.sc +++ b/bgfx/examples/01-cubes/fs_cubes.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/01-cubes/makefile b/bgfx/examples/01-cubes/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/01-cubes/makefile +++ b/bgfx/examples/01-cubes/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/01-cubes/vs_cubes.sc b/bgfx/examples/01-cubes/vs_cubes.sc index d80005d4..a9637c80 100644 --- a/bgfx/examples/01-cubes/vs_cubes.sc +++ b/bgfx/examples/01-cubes/vs_cubes.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/02-metaballs/fs_metaballs.sc b/bgfx/examples/02-metaballs/fs_metaballs.sc index 9173da91..9f36e301 100644 --- a/bgfx/examples/02-metaballs/fs_metaballs.sc +++ b/bgfx/examples/02-metaballs/fs_metaballs.sc @@ -1,7 +1,7 @@ $input v_normal, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/02-metaballs/makefile b/bgfx/examples/02-metaballs/makefile index efdae05b..38377fb8 100644 --- a/bgfx/examples/02-metaballs/makefile +++ b/bgfx/examples/02-metaballs/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/02-metaballs/metaballs.cpp b/bgfx/examples/02-metaballs/metaballs.cpp index 305bf53b..8c42f221 100644 --- a/bgfx/examples/02-metaballs/metaballs.cpp +++ b/bgfx/examples/02-metaballs/metaballs.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -508,6 +508,7 @@ class ExampleMetaballs : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/02-metaballs/vs_metaballs.sc b/bgfx/examples/02-metaballs/vs_metaballs.sc index 1470977f..0312e7b7 100644 --- a/bgfx/examples/02-metaballs/vs_metaballs.sc +++ b/bgfx/examples/02-metaballs/vs_metaballs.sc @@ -2,7 +2,7 @@ $input a_position, a_normal, a_color0 $output v_normal, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/03-raymarch/fs_raymarching.sc b/bgfx/examples/03-raymarch/fs_raymarching.sc index 39a0972f..41ba8516 100644 --- a/bgfx/examples/03-raymarch/fs_raymarching.sc +++ b/bgfx/examples/03-raymarch/fs_raymarching.sc @@ -1,7 +1,7 @@ $input v_color0, v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/03-raymarch/makefile b/bgfx/examples/03-raymarch/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/03-raymarch/makefile +++ b/bgfx/examples/03-raymarch/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/03-raymarch/raymarch.cpp b/bgfx/examples/03-raymarch/raymarch.cpp index 6fb30b91..ddbd73fe 100644 --- a/bgfx/examples/03-raymarch/raymarch.cpp +++ b/bgfx/examples/03-raymarch/raymarch.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -121,6 +121,7 @@ class ExampleRaymarch : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/03-raymarch/vs_raymarching.sc b/bgfx/examples/03-raymarch/vs_raymarching.sc index ab32d2a2..94eac94f 100644 --- a/bgfx/examples/03-raymarch/vs_raymarching.sc +++ b/bgfx/examples/03-raymarch/vs_raymarching.sc @@ -2,7 +2,7 @@ $input a_position, a_color0, a_texcoord0 $output v_color0, v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/04-mesh/fs_mesh.sc b/bgfx/examples/04-mesh/fs_mesh.sc index 93991561..4e344472 100644 --- a/bgfx/examples/04-mesh/fs_mesh.sc +++ b/bgfx/examples/04-mesh/fs_mesh.sc @@ -1,7 +1,7 @@ $input v_pos, v_view, v_normal, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/04-mesh/makefile b/bgfx/examples/04-mesh/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/04-mesh/makefile +++ b/bgfx/examples/04-mesh/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/04-mesh/mesh.cpp b/bgfx/examples/04-mesh/mesh.cpp index 59c6c070..40469bd1 100644 --- a/bgfx/examples/04-mesh/mesh.cpp +++ b/bgfx/examples/04-mesh/mesh.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -32,6 +32,7 @@ class ExampleMesh : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/04-mesh/vs_mesh.sc b/bgfx/examples/04-mesh/vs_mesh.sc index 8ca8dbf5..6c8b2cb5 100644 --- a/bgfx/examples/04-mesh/vs_mesh.sc +++ b/bgfx/examples/04-mesh/vs_mesh.sc @@ -2,7 +2,7 @@ $input a_position, a_normal $output v_pos, v_view, v_normal, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/05-instancing/fs_instancing.sc b/bgfx/examples/05-instancing/fs_instancing.sc index 8ea959c8..6f31cbe2 100644 --- a/bgfx/examples/05-instancing/fs_instancing.sc +++ b/bgfx/examples/05-instancing/fs_instancing.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/05-instancing/instancing.cpp b/bgfx/examples/05-instancing/instancing.cpp index 6b066c16..9d5a804b 100644 --- a/bgfx/examples/05-instancing/instancing.cpp +++ b/bgfx/examples/05-instancing/instancing.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -84,6 +84,7 @@ class ExampleInstancing : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/05-instancing/makefile b/bgfx/examples/05-instancing/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/05-instancing/makefile +++ b/bgfx/examples/05-instancing/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/05-instancing/vs_instancing.sc b/bgfx/examples/05-instancing/vs_instancing.sc index 5d952e65..5fdf6399 100644 --- a/bgfx/examples/05-instancing/vs_instancing.sc +++ b/bgfx/examples/05-instancing/vs_instancing.sc @@ -2,7 +2,7 @@ $input a_position, a_color0, i_data0, i_data1, i_data2, i_data3, i_data4 $output v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/06-bump/bump.cpp b/bgfx/examples/06-bump/bump.cpp index bbfe793f..93aeeb38 100644 --- a/bgfx/examples/06-bump/bump.cpp +++ b/bgfx/examples/06-bump/bump.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -104,6 +104,7 @@ class ExampleBump : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/06-bump/fs_bump.sc b/bgfx/examples/06-bump/fs_bump.sc index 7d56dbd0..b0636e96 100644 --- a/bgfx/examples/06-bump/fs_bump.sc +++ b/bgfx/examples/06-bump/fs_bump.sc @@ -1,7 +1,7 @@ $input v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0// in... /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/06-bump/makefile b/bgfx/examples/06-bump/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/06-bump/makefile +++ b/bgfx/examples/06-bump/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/06-bump/vs_bump.sc b/bgfx/examples/06-bump/vs_bump.sc index 325c9871..292192cb 100644 --- a/bgfx/examples/06-bump/vs_bump.sc +++ b/bgfx/examples/06-bump/vs_bump.sc @@ -2,7 +2,7 @@ $input a_position, a_normal, a_tangent, a_texcoord0 $output v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/06-bump/vs_bump_instanced.sc b/bgfx/examples/06-bump/vs_bump_instanced.sc index 7e45b313..0b903b8f 100644 --- a/bgfx/examples/06-bump/vs_bump_instanced.sc +++ b/bgfx/examples/06-bump/vs_bump_instanced.sc @@ -2,7 +2,7 @@ $input a_position, a_normal, a_tangent, a_texcoord0, i_data0, i_data1, i_data2, $output v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/07-callback/callback.cpp b/bgfx/examples/07-callback/callback.cpp index 418b2a96..2b7f59c8 100644 --- a/bgfx/examples/07-callback/callback.cpp +++ b/bgfx/examples/07-callback/callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -202,7 +202,7 @@ struct BgfxCallback : public bgfx::CallbackI m_writer = BX_NEW(entry::getAllocator(), AviWriter)(entry::getFileWriter() ); if (!m_writer->open("temp/capture.avi", _width, _height, 60, _yflip) ) { - BX_DELETE(entry::getAllocator(), m_writer); + bx::deleteObject(entry::getAllocator(), m_writer); m_writer = NULL; } } @@ -212,7 +212,7 @@ struct BgfxCallback : public bgfx::CallbackI if (NULL != m_writer) { m_writer->close(); - BX_DELETE(entry::getAllocator(), m_writer); + bx::deleteObject(entry::getAllocator(), m_writer); m_writer = NULL; } } @@ -257,7 +257,7 @@ class BgfxAllocator : public bx::AllocatorI } else { - bx::alignedFree(this, _ptr, _align, _file, _line); + bx::alignedFree(this, _ptr, _align, bx::Location(_file, _line) ); } } @@ -274,7 +274,7 @@ class BgfxAllocator : public bx::AllocatorI return ptr; } - return bx::alignedAlloc(this, _size, _align, _file, _line); + return bx::alignedAlloc(this, _size, _align, bx::Location(_file, _line) ); } if (kNaturalAlignment >= _align) @@ -292,7 +292,7 @@ class BgfxAllocator : public bx::AllocatorI return ptr; } - return bx::alignedRealloc(this, _ptr, _size, _align, _file, _line); + return bx::alignedRealloc(this, _ptr, _size, _align, bx::Location(_file, _line) ); } void dumpStats() const @@ -331,6 +331,7 @@ class ExampleCallback : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/07-callback/fs_callback.sc b/bgfx/examples/07-callback/fs_callback.sc index 3e8f850e..07feb33b 100644 --- a/bgfx/examples/07-callback/fs_callback.sc +++ b/bgfx/examples/07-callback/fs_callback.sc @@ -1,7 +1,7 @@ $input v_world, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/07-callback/makefile b/bgfx/examples/07-callback/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/07-callback/makefile +++ b/bgfx/examples/07-callback/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/07-callback/vs_callback.sc b/bgfx/examples/07-callback/vs_callback.sc index aba775fd..cf5a0ed6 100644 --- a/bgfx/examples/07-callback/vs_callback.sc +++ b/bgfx/examples/07-callback/vs_callback.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_world, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/08-update/fs_update.sc b/bgfx/examples/08-update/fs_update.sc index 41e24ed1..76d5f0e3 100644 --- a/bgfx/examples/08-update/fs_update.sc +++ b/bgfx/examples/08-update/fs_update.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/08-update/fs_update_3d.sc b/bgfx/examples/08-update/fs_update_3d.sc index 8986846d..213d8540 100644 --- a/bgfx/examples/08-update/fs_update_3d.sc +++ b/bgfx/examples/08-update/fs_update_3d.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/08-update/fs_update_cmp.sc b/bgfx/examples/08-update/fs_update_cmp.sc index 076d8965..a06f4bed 100644 --- a/bgfx/examples/08-update/fs_update_cmp.sc +++ b/bgfx/examples/08-update/fs_update_cmp.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/08-update/makefile b/bgfx/examples/08-update/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/08-update/makefile +++ b/bgfx/examples/08-update/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/08-update/update.cpp b/bgfx/examples/08-update/update.cpp index 9e9f63fc..d6fe7796 100644 --- a/bgfx/examples/08-update/update.cpp +++ b/bgfx/examples/08-update/update.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -247,6 +247,7 @@ class ExampleUpdate : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; @@ -738,7 +739,10 @@ class ExampleUpdate : public entry::AppI ; bgfx::setViewClear(viewId, BGFX_CLEAR_COLOR, colorRGB8); - bgfx::setViewRect(viewId, 0,0,512,512); + + const float maxBorder = 64.0f; + const uint16_t border = uint16_t(bx::abs(bx::sin(time * 4.0f)*0.5f+0.5f)*maxBorder); + bgfx::setViewRect(viewId, border, border, 512-border*2, 512-border*2); bgfx::touch(viewId); } diff --git a/bgfx/examples/08-update/vs_update.sc b/bgfx/examples/08-update/vs_update.sc index 54536927..0483c189 100644 --- a/bgfx/examples/08-update/vs_update.sc +++ b/bgfx/examples/08-update/vs_update.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/common.sh b/bgfx/examples/09-hdr/common.sh index 056d9d60..18c3b6eb 100644 --- a/bgfx/examples/09-hdr/common.sh +++ b/bgfx/examples/09-hdr/common.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/fs_hdr_blur.sc b/bgfx/examples/09-hdr/fs_hdr_blur.sc index d6130d77..049f8b38 100644 --- a/bgfx/examples/09-hdr/fs_hdr_blur.sc +++ b/bgfx/examples/09-hdr/fs_hdr_blur.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/fs_hdr_bright.sc b/bgfx/examples/09-hdr/fs_hdr_bright.sc index 321fac73..246d532c 100644 --- a/bgfx/examples/09-hdr/fs_hdr_bright.sc +++ b/bgfx/examples/09-hdr/fs_hdr_bright.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/fs_hdr_lum.sc b/bgfx/examples/09-hdr/fs_hdr_lum.sc index 392ab748..691b2812 100644 --- a/bgfx/examples/09-hdr/fs_hdr_lum.sc +++ b/bgfx/examples/09-hdr/fs_hdr_lum.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/fs_hdr_lumavg.sc b/bgfx/examples/09-hdr/fs_hdr_lumavg.sc index 4c682a98..fc1e27e9 100644 --- a/bgfx/examples/09-hdr/fs_hdr_lumavg.sc +++ b/bgfx/examples/09-hdr/fs_hdr_lumavg.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/fs_hdr_mesh.sc b/bgfx/examples/09-hdr/fs_hdr_mesh.sc index 760a0928..093d3d3e 100644 --- a/bgfx/examples/09-hdr/fs_hdr_mesh.sc +++ b/bgfx/examples/09-hdr/fs_hdr_mesh.sc @@ -1,7 +1,7 @@ $input v_pos, v_view, v_normal /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/fs_hdr_skybox.sc b/bgfx/examples/09-hdr/fs_hdr_skybox.sc index c2880f57..2eea2fbd 100644 --- a/bgfx/examples/09-hdr/fs_hdr_skybox.sc +++ b/bgfx/examples/09-hdr/fs_hdr_skybox.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/fs_hdr_tonemap.sc b/bgfx/examples/09-hdr/fs_hdr_tonemap.sc index 44f3df9b..97860718 100644 --- a/bgfx/examples/09-hdr/fs_hdr_tonemap.sc +++ b/bgfx/examples/09-hdr/fs_hdr_tonemap.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/hdr.cpp b/bgfx/examples/09-hdr/hdr.cpp index 6184611b..626f10aa 100644 --- a/bgfx/examples/09-hdr/hdr.cpp +++ b/bgfx/examples/09-hdr/hdr.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -159,6 +159,7 @@ class ExampleHDR : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/09-hdr/makefile b/bgfx/examples/09-hdr/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/09-hdr/makefile +++ b/bgfx/examples/09-hdr/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/09-hdr/vs_hdr_blur.sc b/bgfx/examples/09-hdr/vs_hdr_blur.sc index e4dad017..80bb703d 100644 --- a/bgfx/examples/09-hdr/vs_hdr_blur.sc +++ b/bgfx/examples/09-hdr/vs_hdr_blur.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/vs_hdr_bright.sc b/bgfx/examples/09-hdr/vs_hdr_bright.sc index 54536927..0483c189 100644 --- a/bgfx/examples/09-hdr/vs_hdr_bright.sc +++ b/bgfx/examples/09-hdr/vs_hdr_bright.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/vs_hdr_lum.sc b/bgfx/examples/09-hdr/vs_hdr_lum.sc index 54536927..0483c189 100644 --- a/bgfx/examples/09-hdr/vs_hdr_lum.sc +++ b/bgfx/examples/09-hdr/vs_hdr_lum.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/vs_hdr_lumavg.sc b/bgfx/examples/09-hdr/vs_hdr_lumavg.sc index 54536927..0483c189 100644 --- a/bgfx/examples/09-hdr/vs_hdr_lumavg.sc +++ b/bgfx/examples/09-hdr/vs_hdr_lumavg.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/vs_hdr_mesh.sc b/bgfx/examples/09-hdr/vs_hdr_mesh.sc index a10d5599..6204caa4 100644 --- a/bgfx/examples/09-hdr/vs_hdr_mesh.sc +++ b/bgfx/examples/09-hdr/vs_hdr_mesh.sc @@ -2,7 +2,7 @@ $input a_position, a_normal $output v_pos, v_view, v_normal /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/vs_hdr_skybox.sc b/bgfx/examples/09-hdr/vs_hdr_skybox.sc index 54536927..0483c189 100644 --- a/bgfx/examples/09-hdr/vs_hdr_skybox.sc +++ b/bgfx/examples/09-hdr/vs_hdr_skybox.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/09-hdr/vs_hdr_tonemap.sc b/bgfx/examples/09-hdr/vs_hdr_tonemap.sc index e7fea0c3..9d50c792 100644 --- a/bgfx/examples/09-hdr/vs_hdr_tonemap.sc +++ b/bgfx/examples/09-hdr/vs_hdr_tonemap.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/10-font/font.cpp b/bgfx/examples/10-font/font.cpp index 34daca64..0a886594 100644 --- a/bgfx/examples/10-font/font.cpp +++ b/bgfx/examples/10-font/font.cpp @@ -32,7 +32,7 @@ TrueTypeHandle loadTtf(FontManager* _fm, const char* _filePath) if (NULL != data) { TrueTypeHandle handle = _fm->createTtf( (uint8_t*)data, size); - BX_FREE(entry::getAllocator(), data); + bx::free(entry::getAllocator(), data); return handle; } @@ -73,6 +73,7 @@ class ExampleFont : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/11-fontsdf/fontsdf.cpp b/bgfx/examples/11-fontsdf/fontsdf.cpp index a7e7362a..08a2dbf5 100644 --- a/bgfx/examples/11-fontsdf/fontsdf.cpp +++ b/bgfx/examples/11-fontsdf/fontsdf.cpp @@ -26,7 +26,7 @@ TrueTypeHandle loadTtf(FontManager* _fm, const char* _filePath) if (NULL != data) { TrueTypeHandle handle = _fm->createTtf( (uint8_t*)data, size); - BX_FREE(entry::getAllocator(), data); + bx::free(entry::getAllocator(), data); return handle; } @@ -56,6 +56,7 @@ class ExampleFontSDF : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/12-lod/lod.cpp b/bgfx/examples/12-lod/lod.cpp index b717c961..b429334a 100644 --- a/bgfx/examples/12-lod/lod.cpp +++ b/bgfx/examples/12-lod/lod.cpp @@ -48,6 +48,7 @@ class ExampleLod : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/12-lod/makefile b/bgfx/examples/12-lod/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/12-lod/makefile +++ b/bgfx/examples/12-lod/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/13-stencil/makefile b/bgfx/examples/13-stencil/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/13-stencil/makefile +++ b/bgfx/examples/13-stencil/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/13-stencil/stencil.cpp b/bgfx/examples/13-stencil/stencil.cpp index 3acd5d50..cfbf0615 100644 --- a/bgfx/examples/13-stencil/stencil.cpp +++ b/bgfx/examples/13-stencil/stencil.cpp @@ -814,6 +814,7 @@ class ExampleStencil : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_viewState.m_width; init.resolution.height = m_viewState.m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/14-shadowvolumes/makefile b/bgfx/examples/14-shadowvolumes/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/14-shadowvolumes/makefile +++ b/bgfx/examples/14-shadowvolumes/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp b/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp index 2df07dec..48828eba 100644 --- a/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp @@ -1786,6 +1786,7 @@ class ExampleShadowVolumes : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_viewState.m_width; init.resolution.height = m_viewState.m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/15-shadowmaps-simple/makefile b/bgfx/examples/15-shadowmaps-simple/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/15-shadowmaps-simple/makefile +++ b/bgfx/examples/15-shadowmaps-simple/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp b/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp index 236b859e..bfd4a75a 100644 --- a/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp +++ b/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp @@ -80,6 +80,7 @@ class ExampleShadowmapsSimple : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/16-shadowmaps/makefile b/bgfx/examples/16-shadowmaps/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/16-shadowmaps/makefile +++ b/bgfx/examples/16-shadowmaps/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/16-shadowmaps/shadowmaps.cpp b/bgfx/examples/16-shadowmaps/shadowmaps.cpp index 4ab7b7e6..e85f6dfa 100644 --- a/bgfx/examples/16-shadowmaps/shadowmaps.cpp +++ b/bgfx/examples/16-shadowmaps/shadowmaps.cpp @@ -1159,6 +1159,7 @@ class ExampleShadowmaps : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_viewState.m_width; init.resolution.height = m_viewState.m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/16-shadowmaps/vs_shadowmaps_hblur.sc b/bgfx/examples/16-shadowmaps/vs_shadowmaps_hblur.sc index 99ddaf2c..0af78acd 100644 --- a/bgfx/examples/16-shadowmaps/vs_shadowmaps_hblur.sc +++ b/bgfx/examples/16-shadowmaps/vs_shadowmaps_hblur.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/17-drawstress/drawstress.cpp b/bgfx/examples/17-drawstress/drawstress.cpp index 5dd17370..c76cf9d2 100644 --- a/bgfx/examples/17-drawstress/drawstress.cpp +++ b/bgfx/examples/17-drawstress/drawstress.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -131,6 +131,7 @@ class ExampleDrawStress : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/17-drawstress/fs_drawstress.sc b/bgfx/examples/17-drawstress/fs_drawstress.sc index 8ea959c8..6f31cbe2 100644 --- a/bgfx/examples/17-drawstress/fs_drawstress.sc +++ b/bgfx/examples/17-drawstress/fs_drawstress.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/17-drawstress/makefile b/bgfx/examples/17-drawstress/makefile index efdae05b..38377fb8 100644 --- a/bgfx/examples/17-drawstress/makefile +++ b/bgfx/examples/17-drawstress/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/17-drawstress/vs_drawstress.sc b/bgfx/examples/17-drawstress/vs_drawstress.sc index d80005d4..a9637c80 100644 --- a/bgfx/examples/17-drawstress/vs_drawstress.sc +++ b/bgfx/examples/17-drawstress/vs_drawstress.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/18-ibl/ibl.cpp b/bgfx/examples/18-ibl/ibl.cpp index a2d15492..fc3286b4 100644 --- a/bgfx/examples/18-ibl/ibl.cpp +++ b/bgfx/examples/18-ibl/ibl.cpp @@ -291,8 +291,8 @@ struct Camera struct Interp3f { - bx::Vec3 curr = bx::init::None; - bx::Vec3 dest = bx::init::None; + bx::Vec3 curr = bx::InitNone; + bx::Vec3 dest = bx::InitNone; }; Interp3f m_target; @@ -420,6 +420,7 @@ class ExampleIbl : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/18-ibl/makefile b/bgfx/examples/18-ibl/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/18-ibl/makefile +++ b/bgfx/examples/18-ibl/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/19-oit/fs_oit.sc b/bgfx/examples/19-oit/fs_oit.sc index a087e5f3..e3cc677e 100644 --- a/bgfx/examples/19-oit/fs_oit.sc +++ b/bgfx/examples/19-oit/fs_oit.sc @@ -1,7 +1,7 @@ $input v_pos /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/19-oit/fs_oit_wb.sc b/bgfx/examples/19-oit/fs_oit_wb.sc index 9cb69a52..f8d77f4d 100644 --- a/bgfx/examples/19-oit/fs_oit_wb.sc +++ b/bgfx/examples/19-oit/fs_oit_wb.sc @@ -1,7 +1,7 @@ $input v_pos /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/19-oit/fs_oit_wb_blit.sc b/bgfx/examples/19-oit/fs_oit_wb_blit.sc index f6f45c82..b4bcf515 100644 --- a/bgfx/examples/19-oit/fs_oit_wb_blit.sc +++ b/bgfx/examples/19-oit/fs_oit_wb_blit.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/19-oit/fs_oit_wb_separate.sc b/bgfx/examples/19-oit/fs_oit_wb_separate.sc index 3e4c6d8c..2a6a9364 100644 --- a/bgfx/examples/19-oit/fs_oit_wb_separate.sc +++ b/bgfx/examples/19-oit/fs_oit_wb_separate.sc @@ -1,7 +1,7 @@ $input v_pos /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/19-oit/fs_oit_wb_separate_blit.sc b/bgfx/examples/19-oit/fs_oit_wb_separate_blit.sc index 58c888aa..cfff5f7d 100644 --- a/bgfx/examples/19-oit/fs_oit_wb_separate_blit.sc +++ b/bgfx/examples/19-oit/fs_oit_wb_separate_blit.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/19-oit/makefile b/bgfx/examples/19-oit/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/19-oit/makefile +++ b/bgfx/examples/19-oit/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/19-oit/oit.cpp b/bgfx/examples/19-oit/oit.cpp index 576cd091..fa846b52 100644 --- a/bgfx/examples/19-oit/oit.cpp +++ b/bgfx/examples/19-oit/oit.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -171,6 +171,7 @@ class ExampleOIT : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/19-oit/vs_oit.sc b/bgfx/examples/19-oit/vs_oit.sc index b38d28fd..f2296d52 100644 --- a/bgfx/examples/19-oit/vs_oit.sc +++ b/bgfx/examples/19-oit/vs_oit.sc @@ -2,7 +2,7 @@ $input a_position $output v_pos /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/19-oit/vs_oit_blit.sc b/bgfx/examples/19-oit/vs_oit_blit.sc index 54536927..0483c189 100644 --- a/bgfx/examples/19-oit/vs_oit_blit.sc +++ b/bgfx/examples/19-oit/vs_oit_blit.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/20-nanovg/nanovg.cpp b/bgfx/examples/20-nanovg/nanovg.cpp index 144d21b8..62c17bcb 100644 --- a/bgfx/examples/20-nanovg/nanovg.cpp +++ b/bgfx/examples/20-nanovg/nanovg.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -1404,6 +1404,7 @@ class ExampleNanoVG : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/21-deferred/common.sh b/bgfx/examples/21-deferred/common.sh index 14dd727b..8589a431 100644 --- a/bgfx/examples/21-deferred/common.sh +++ b/bgfx/examples/21-deferred/common.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/deferred.cpp b/bgfx/examples/21-deferred/deferred.cpp index 6c379fd3..5fa1636c 100644 --- a/bgfx/examples/21-deferred/deferred.cpp +++ b/bgfx/examples/21-deferred/deferred.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -213,6 +213,7 @@ class ExampleDeferred : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/21-deferred/fs_deferred_clear_uav.sc b/bgfx/examples/21-deferred/fs_deferred_clear_uav.sc index bf355703..d56ed893 100644 --- a/bgfx/examples/21-deferred/fs_deferred_clear_uav.sc +++ b/bgfx/examples/21-deferred/fs_deferred_clear_uav.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -11,6 +11,6 @@ IMAGE2D_RW(i_light, rgba8, 2); void main() { - ivec2 coord = ivec2(gl_FragCoord.xy); - imageStore(i_light, coord, vec4(0.0, 0.0, 0.0, 0.0) ); + ivec2 coord = ivec2(gl_FragCoord.xy); + imageStore(i_light, coord, vec4(0.0, 0.0, 0.0, 0.0) ); } diff --git a/bgfx/examples/21-deferred/fs_deferred_combine.sc b/bgfx/examples/21-deferred/fs_deferred_combine.sc index 31318e33..31c3872b 100644 --- a/bgfx/examples/21-deferred/fs_deferred_combine.sc +++ b/bgfx/examples/21-deferred/fs_deferred_combine.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/fs_deferred_combine_ta.sc b/bgfx/examples/21-deferred/fs_deferred_combine_ta.sc index ce18dcc1..9ede7b86 100644 --- a/bgfx/examples/21-deferred/fs_deferred_combine_ta.sc +++ b/bgfx/examples/21-deferred/fs_deferred_combine_ta.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/fs_deferred_debug.sc b/bgfx/examples/21-deferred/fs_deferred_debug.sc index 1d3b0951..9ee68140 100644 --- a/bgfx/examples/21-deferred/fs_deferred_debug.sc +++ b/bgfx/examples/21-deferred/fs_deferred_debug.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/fs_deferred_debug_line.sc b/bgfx/examples/21-deferred/fs_deferred_debug_line.sc index 8ea959c8..6f31cbe2 100644 --- a/bgfx/examples/21-deferred/fs_deferred_debug_line.sc +++ b/bgfx/examples/21-deferred/fs_deferred_debug_line.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/fs_deferred_debug_ta.sc b/bgfx/examples/21-deferred/fs_deferred_debug_ta.sc index e69f2fcd..9766ef90 100644 --- a/bgfx/examples/21-deferred/fs_deferred_debug_ta.sc +++ b/bgfx/examples/21-deferred/fs_deferred_debug_ta.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/fs_deferred_geom.sc b/bgfx/examples/21-deferred/fs_deferred_geom.sc index 0466d720..18006e74 100644 --- a/bgfx/examples/21-deferred/fs_deferred_geom.sc +++ b/bgfx/examples/21-deferred/fs_deferred_geom.sc @@ -1,7 +1,7 @@ $input v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/fs_deferred_light.sc b/bgfx/examples/21-deferred/fs_deferred_light.sc index 680b5a8e..892d384e 100644 --- a/bgfx/examples/21-deferred/fs_deferred_light.sc +++ b/bgfx/examples/21-deferred/fs_deferred_light.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/fs_deferred_light_ta.sc b/bgfx/examples/21-deferred/fs_deferred_light_ta.sc index 19102eff..e400115b 100644 --- a/bgfx/examples/21-deferred/fs_deferred_light_ta.sc +++ b/bgfx/examples/21-deferred/fs_deferred_light_ta.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/fs_deferred_light_uav.sc b/bgfx/examples/21-deferred/fs_deferred_light_uav.sc index 08442333..ab093c61 100644 --- a/bgfx/examples/21-deferred/fs_deferred_light_uav.sc +++ b/bgfx/examples/21-deferred/fs_deferred_light_uav.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -32,7 +32,7 @@ void main() vec3 view = mul(u_view, vec4(wpos, 0.0) ).xyz; view = -normalize(view); - ivec2 coord = ivec2(gl_FragCoord.xy); + ivec2 coord = ivec2(gl_FragCoord.xy); vec3 lightColor = calcLight(wpos, normal, view, u_lightPosRadius[0].xyz, u_lightPosRadius[0].w, u_lightRgbInnerR[0].xyz, u_lightRgbInnerR[0].w); vec4 color = imageLoad(i_light, coord); diff --git a/bgfx/examples/21-deferred/makefile b/bgfx/examples/21-deferred/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/21-deferred/makefile +++ b/bgfx/examples/21-deferred/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/21-deferred/vs_deferred_combine.sc b/bgfx/examples/21-deferred/vs_deferred_combine.sc index 54536927..0483c189 100644 --- a/bgfx/examples/21-deferred/vs_deferred_combine.sc +++ b/bgfx/examples/21-deferred/vs_deferred_combine.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/vs_deferred_debug.sc b/bgfx/examples/21-deferred/vs_deferred_debug.sc index 54536927..0483c189 100644 --- a/bgfx/examples/21-deferred/vs_deferred_debug.sc +++ b/bgfx/examples/21-deferred/vs_deferred_debug.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/vs_deferred_debug_line.sc b/bgfx/examples/21-deferred/vs_deferred_debug_line.sc index d80005d4..a9637c80 100644 --- a/bgfx/examples/21-deferred/vs_deferred_debug_line.sc +++ b/bgfx/examples/21-deferred/vs_deferred_debug_line.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/vs_deferred_geom.sc b/bgfx/examples/21-deferred/vs_deferred_geom.sc index 5c4e5bf3..2886bd75 100644 --- a/bgfx/examples/21-deferred/vs_deferred_geom.sc +++ b/bgfx/examples/21-deferred/vs_deferred_geom.sc @@ -2,7 +2,7 @@ $input a_position, a_normal, a_tangent, a_texcoord0 $output v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/21-deferred/vs_deferred_light.sc b/bgfx/examples/21-deferred/vs_deferred_light.sc index 54536927..0483c189 100644 --- a/bgfx/examples/21-deferred/vs_deferred_light.sc +++ b/bgfx/examples/21-deferred/vs_deferred_light.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/22-windows/windows.cpp b/bgfx/examples/22-windows/windows.cpp index 03a5259e..04b9b26e 100644 --- a/bgfx/examples/22-windows/windows.cpp +++ b/bgfx/examples/22-windows/windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -88,6 +88,7 @@ class ExampleWindows : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; @@ -98,7 +99,7 @@ class ExampleWindows : public entry::AppI if (swapChainSupported) { - m_bindings = (InputBinding*)BX_ALLOC(entry::getAllocator(), sizeof(InputBinding)*3); + m_bindings = (InputBinding*)bx::alloc(entry::getAllocator(), sizeof(InputBinding)*3); m_bindings[0].set(entry::Key::KeyC, entry::Modifier::None, 1, cmdCreateWindow, this); m_bindings[1].set(entry::Key::KeyD, entry::Modifier::None, 1, cmdDestroyWindow, this); m_bindings[2].end(); @@ -160,7 +161,7 @@ class ExampleWindows : public entry::AppI } inputRemoveBindings("22-windows"); - BX_FREE(entry::getAllocator(), m_bindings); + bx::free(entry::getAllocator(), m_bindings); // Cleanup. bgfx::destroy(m_ibh); diff --git a/bgfx/examples/23-vectordisplay/makefile b/bgfx/examples/23-vectordisplay/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/23-vectordisplay/makefile +++ b/bgfx/examples/23-vectordisplay/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/24-nbody/makefile b/bgfx/examples/24-nbody/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/24-nbody/makefile +++ b/bgfx/examples/24-nbody/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/24-nbody/nbody.cpp b/bgfx/examples/24-nbody/nbody.cpp index 62047054..b47469d8 100644 --- a/bgfx/examples/24-nbody/nbody.cpp +++ b/bgfx/examples/24-nbody/nbody.cpp @@ -132,6 +132,7 @@ class ExampleNbody : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/25-c99/helloworld.c b/bgfx/examples/25-c99/helloworld.c index 29b1a65d..fcbff3d6 100644 --- a/bgfx/examples/25-c99/helloworld.c +++ b/bgfx/examples/25-c99/helloworld.c @@ -7,8 +7,9 @@ #include "../00-helloworld/logo.h" extern bool entry_process_events(uint32_t* _width, uint32_t* _height, uint32_t* _debug, uint32_t* _reset); -extern void* entry_get_default_native_window_handle(); -extern void* entry_get_native_display_handle(); +extern void* entry_get_default_native_window_handle(void); +extern void* entry_get_native_display_handle(void); +extern bgfx_native_window_handle_type_t entry_get_native_window_handle_type(void); uint16_t uint16_max(uint16_t _a, uint16_t _b) { @@ -29,6 +30,7 @@ int32_t _main_(int32_t _argc, char** _argv) init.platformData.nwh = entry_get_default_native_window_handle(); init.platformData.ndt = entry_get_native_display_handle(); + init.platformData.type = entry_get_native_window_handle_type(); bgfx_init(&init); bgfx_reset(width, height, reset, init.resolution.format); diff --git a/bgfx/examples/26-occlusion/occlusion.cpp b/bgfx/examples/26-occlusion/occlusion.cpp index d0149838..57cfa097 100644 --- a/bgfx/examples/26-occlusion/occlusion.cpp +++ b/bgfx/examples/26-occlusion/occlusion.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -84,6 +84,7 @@ class ExampleOcclusion : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/27-terrain/makefile b/bgfx/examples/27-terrain/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/27-terrain/makefile +++ b/bgfx/examples/27-terrain/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/27-terrain/terrain.cpp b/bgfx/examples/27-terrain/terrain.cpp index 3b493304..867e5089 100644 --- a/bgfx/examples/27-terrain/terrain.cpp +++ b/bgfx/examples/27-terrain/terrain.cpp @@ -80,6 +80,7 @@ ExampleTerrain(const char* _name, const char* _description, const char* _url) init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; @@ -127,9 +128,9 @@ ExampleTerrain(const char* _name, const char* _description, const char* _url) m_terrain.m_mode = 0; m_terrain.m_dirty = true; - m_terrain.m_vertices = (PosTexCoord0Vertex*)BX_ALLOC(entry::getAllocator(), num * sizeof(PosTexCoord0Vertex) ); - m_terrain.m_indices = (uint16_t*)BX_ALLOC(entry::getAllocator(), num * sizeof(uint16_t) * 6); - m_terrain.m_heightMap = (uint8_t*)BX_ALLOC(entry::getAllocator(), num); + m_terrain.m_vertices = (PosTexCoord0Vertex*)bx::alloc(entry::getAllocator(), num * sizeof(PosTexCoord0Vertex) ); + m_terrain.m_indices = (uint16_t*)bx::alloc(entry::getAllocator(), num * sizeof(uint16_t) * 6); + m_terrain.m_heightMap = (uint8_t*)bx::alloc(entry::getAllocator(), num); bx::mtxSRT(m_terrain.m_transform, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); bx::memSet(m_terrain.m_heightMap, 0, sizeof(uint8_t) * s_terrainSize * s_terrainSize); @@ -181,9 +182,9 @@ ExampleTerrain(const char* _name, const char* _description, const char* _url) bgfx::frame(); bx::AllocatorI* allocator = entry::getAllocator(); - BX_FREE(allocator, m_terrain.m_vertices); - BX_FREE(allocator, m_terrain.m_indices); - BX_FREE(allocator, m_terrain.m_heightMap); + bx::free(allocator, m_terrain.m_vertices); + bx::free(allocator, m_terrain.m_indices); + bx::free(allocator, m_terrain.m_heightMap); // Shutdown bgfx. bgfx::shutdown(); diff --git a/bgfx/examples/28-wireframe/makefile b/bgfx/examples/28-wireframe/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/28-wireframe/makefile +++ b/bgfx/examples/28-wireframe/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/28-wireframe/wireframe.cpp b/bgfx/examples/28-wireframe/wireframe.cpp index 905ab2c6..397577ba 100644 --- a/bgfx/examples/28-wireframe/wireframe.cpp +++ b/bgfx/examples/28-wireframe/wireframe.cpp @@ -29,8 +29,8 @@ struct Camera void reset() { - m_target.curr = bx::init::Zero; - m_target.dest = bx::init::Zero; + m_target.curr = bx::InitZero; + m_target.dest = bx::InitZero; m_pos.curr = { 0.0f, 0.0f, -2.0f }; m_pos.dest = { 0.0f, 0.0f, -2.0f }; @@ -135,8 +135,8 @@ struct Camera struct Interp3f { - bx::Vec3 curr = bx::init::None; - bx::Vec3 dest = bx::init::None; + bx::Vec3 curr = bx::InitNone; + bx::Vec3 dest = bx::InitNone; }; Interp3f m_target; @@ -293,6 +293,7 @@ class ExampleWireframe : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/29-debugdraw/debugdraw.cpp b/bgfx/examples/29-debugdraw/debugdraw.cpp index fb13bb7e..20a240fb 100644 --- a/bgfx/examples/29-debugdraw/debugdraw.cpp +++ b/bgfx/examples/29-debugdraw/debugdraw.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -601,7 +601,7 @@ void initA(Shape& _outShape, Shape::Type::Enum _type, bx::Vec3 _pos) case Shape::Type::Plane: { - bx::Plane plane(bx::init::None); + bx::Plane plane(bx::InitNone); bx::calcPlane(plane, bx::normalize(bx::Vec3{0.0f, 1.0f, 1.0f}), _pos); _outShape = Shape(plane); } @@ -688,7 +688,7 @@ void initB(Shape& _outShape, Shape::Type::Enum _type, bx::Vec3 _pos) case Shape::Type::Plane: { - bx::Plane plane(bx::init::None); + bx::Plane plane(bx::InitNone); bx::calcPlane(plane, bx::normalize(bx::Vec3{1.0f, 1.0f, 0.0f}), _pos); _outShape = Shape(plane); } @@ -780,6 +780,7 @@ class ExampleDebugDraw : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; @@ -1001,7 +1002,7 @@ class ExampleDebugDraw : public entry::AppI const bx::Vec3 normal = { 0.0f, 1.0f, 0.0f }; const bx::Vec3 pos = { 0.0f, -2.0f, 0.0f }; - bx::Plane plane(bx::init::None); + bx::Plane plane(bx::InitNone); bx::calcPlane(plane, normal, pos); dde.setColor(false diff --git a/bgfx/examples/30-picking/fs_picking_id.sc b/bgfx/examples/30-picking/fs_picking_id.sc index 8a229310..723265fc 100644 --- a/bgfx/examples/30-picking/fs_picking_id.sc +++ b/bgfx/examples/30-picking/fs_picking_id.sc @@ -1,7 +1,7 @@ $input v_pos, v_view, v_normal, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/30-picking/fs_picking_shaded.sc b/bgfx/examples/30-picking/fs_picking_shaded.sc index 05c873e9..74cc160b 100644 --- a/bgfx/examples/30-picking/fs_picking_shaded.sc +++ b/bgfx/examples/30-picking/fs_picking_shaded.sc @@ -1,7 +1,7 @@ $input v_pos, v_view, v_normal, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/30-picking/makefile b/bgfx/examples/30-picking/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/30-picking/makefile +++ b/bgfx/examples/30-picking/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/30-picking/picking.cpp b/bgfx/examples/30-picking/picking.cpp index a77395e8..9a5c36d8 100644 --- a/bgfx/examples/30-picking/picking.cpp +++ b/bgfx/examples/30-picking/picking.cpp @@ -40,6 +40,7 @@ class ExamplePicking : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/30-picking/vs_picking_shaded.sc b/bgfx/examples/30-picking/vs_picking_shaded.sc index f4ba4f35..1458070d 100644 --- a/bgfx/examples/30-picking/vs_picking_shaded.sc +++ b/bgfx/examples/30-picking/vs_picking_shaded.sc @@ -2,7 +2,7 @@ $input a_position, a_normal $output v_pos, v_view, v_normal, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/31-rsm/makefile b/bgfx/examples/31-rsm/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/31-rsm/makefile +++ b/bgfx/examples/31-rsm/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/31-rsm/reflectiveshadowmap.cpp b/bgfx/examples/31-rsm/reflectiveshadowmap.cpp index 358893f9..65dfe345 100644 --- a/bgfx/examples/31-rsm/reflectiveshadowmap.cpp +++ b/bgfx/examples/31-rsm/reflectiveshadowmap.cpp @@ -213,6 +213,7 @@ class ExampleRSM : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/32-particles/particles.cpp b/bgfx/examples/32-particles/particles.cpp index d5642b4b..12ab607a 100644 --- a/bgfx/examples/32-particles/particles.cpp +++ b/bgfx/examples/32-particles/particles.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -248,6 +248,7 @@ class ExampleParticles : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/33-pom/makefile b/bgfx/examples/33-pom/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/33-pom/makefile +++ b/bgfx/examples/33-pom/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/33-pom/pom.cpp b/bgfx/examples/33-pom/pom.cpp index 71e7e1d8..508178fa 100644 --- a/bgfx/examples/33-pom/pom.cpp +++ b/bgfx/examples/33-pom/pom.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -130,6 +130,7 @@ class ExamplePom : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/34-mvs/mvs.cpp b/bgfx/examples/34-mvs/mvs.cpp index bbe469b9..7fecebea 100644 --- a/bgfx/examples/34-mvs/mvs.cpp +++ b/bgfx/examples/34-mvs/mvs.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -126,6 +126,7 @@ class ExampleMvs : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/35-dynamic/dynamic.cpp b/bgfx/examples/35-dynamic/dynamic.cpp index 76544852..7ee451f5 100644 --- a/bgfx/examples/35-dynamic/dynamic.cpp +++ b/bgfx/examples/35-dynamic/dynamic.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -104,6 +104,7 @@ class ExampleDynamic : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/36-sky/makefile b/bgfx/examples/36-sky/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/36-sky/makefile +++ b/bgfx/examples/36-sky/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/36-sky/sky.cpp b/bgfx/examples/36-sky/sky.cpp index 3648881c..b82c31fd 100644 --- a/bgfx/examples/36-sky/sky.cpp +++ b/bgfx/examples/36-sky/sky.cpp @@ -72,7 +72,7 @@ static constexpr float M_XYZ2RGB[] = // Converts color representation from CIE XYZ to RGB color-space. Color xyzToRgb(const Color& xyz) { - Color rgb(bx::init::None); + Color rgb(bx::InitNone); rgb.x = M_XYZ2RGB[0] * xyz.x + M_XYZ2RGB[3] * xyz.y + M_XYZ2RGB[6] * xyz.z; rgb.y = M_XYZ2RGB[1] * xyz.x + M_XYZ2RGB[4] * xyz.y + M_XYZ2RGB[7] * xyz.z; rgb.z = M_XYZ2RGB[2] * xyz.x + M_XYZ2RGB[5] * xyz.y + M_XYZ2RGB[8] * xyz.z; @@ -333,7 +333,7 @@ struct ProceduralSky bx::AllocatorI* allocator = entry::getAllocator(); - ScreenPosVertex* vertices = (ScreenPosVertex*)BX_ALLOC(allocator + ScreenPosVertex* vertices = (ScreenPosVertex*)bx::alloc(allocator , verticalCount * horizontalCount * sizeof(ScreenPosVertex) ); @@ -347,7 +347,7 @@ struct ProceduralSky } } - uint16_t* indices = (uint16_t*)BX_ALLOC(allocator + uint16_t* indices = (uint16_t*)bx::alloc(allocator , (verticalCount - 1) * (horizontalCount - 1) * 6 * sizeof(uint16_t) ); @@ -369,8 +369,8 @@ struct ProceduralSky m_vbh = bgfx::createVertexBuffer(bgfx::copy(vertices, sizeof(ScreenPosVertex) * verticalCount * horizontalCount), ScreenPosVertex::ms_layout); m_ibh = bgfx::createIndexBuffer(bgfx::copy(indices, sizeof(uint16_t) * k)); - BX_FREE(allocator, indices); - BX_FREE(allocator, vertices); + bx::free(allocator, indices); + bx::free(allocator, vertices); } void shutdown() @@ -420,6 +420,7 @@ class ExampleProceduralSky : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/36-sky/vs_sky_landscape.sc b/bgfx/examples/36-sky/vs_sky_landscape.sc index 8a22e90e..6bc0868b 100644 --- a/bgfx/examples/36-sky/vs_sky_landscape.sc +++ b/bgfx/examples/36-sky/vs_sky_landscape.sc @@ -2,7 +2,7 @@ $input a_position, a_normal, a_texcoord0 $output v_normal, v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/37-gpudrivenrendering/gpudrivenrendering.cpp b/bgfx/examples/37-gpudrivenrendering/gpudrivenrendering.cpp index 312ef489..5a3ff9ac 100644 --- a/bgfx/examples/37-gpudrivenrendering/gpudrivenrendering.cpp +++ b/bgfx/examples/37-gpudrivenrendering/gpudrivenrendering.cpp @@ -139,8 +139,8 @@ struct Camera struct Interp3f { - bx::Vec3 curr = bx::init::None; - bx::Vec3 dest = bx::init::None; + bx::Vec3 curr = bx::InitNone; + bx::Vec3 dest = bx::InitNone; }; Interp3f m_target; @@ -330,6 +330,7 @@ class GPUDrivenRendering : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/37-gpudrivenrendering/makefile b/bgfx/examples/37-gpudrivenrendering/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/37-gpudrivenrendering/makefile +++ b/bgfx/examples/37-gpudrivenrendering/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/38-bloom/bloom.cpp b/bgfx/examples/38-bloom/bloom.cpp index 312eef0e..99dcb730 100644 --- a/bgfx/examples/38-bloom/bloom.cpp +++ b/bgfx/examples/38-bloom/bloom.cpp @@ -200,6 +200,7 @@ class ExampleBloom : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/38-bloom/fs_bloom_combine.sc b/bgfx/examples/38-bloom/fs_bloom_combine.sc index 6b9073b8..b3ad7a16 100644 --- a/bgfx/examples/38-bloom/fs_bloom_combine.sc +++ b/bgfx/examples/38-bloom/fs_bloom_combine.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/38-bloom/makefile b/bgfx/examples/38-bloom/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/38-bloom/makefile +++ b/bgfx/examples/38-bloom/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/38-bloom/vs_deferred_combine.sc b/bgfx/examples/38-bloom/vs_deferred_combine.sc index 54536927..0483c189 100644 --- a/bgfx/examples/38-bloom/vs_deferred_combine.sc +++ b/bgfx/examples/38-bloom/vs_deferred_combine.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/39-assao/assao.cpp b/bgfx/examples/39-assao/assao.cpp index 45d1e92b..fbff0f29 100644 --- a/bgfx/examples/39-assao/assao.cpp +++ b/bgfx/examples/39-assao/assao.cpp @@ -271,6 +271,7 @@ namespace init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/39-assao/makefile b/bgfx/examples/39-assao/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/39-assao/makefile +++ b/bgfx/examples/39-assao/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/40-svt/fs_vt_mip.sc b/bgfx/examples/40-svt/fs_vt_mip.sc index 31f0b2b6..5d79b6c6 100644 --- a/bgfx/examples/40-svt/fs_vt_mip.sc +++ b/bgfx/examples/40-svt/fs_vt_mip.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/40-svt/fs_vt_unlit.sc b/bgfx/examples/40-svt/fs_vt_unlit.sc index a079bc11..1ee16116 100644 --- a/bgfx/examples/40-svt/fs_vt_unlit.sc +++ b/bgfx/examples/40-svt/fs_vt_unlit.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/40-svt/makefile b/bgfx/examples/40-svt/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/40-svt/makefile +++ b/bgfx/examples/40-svt/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/40-svt/svt.cpp b/bgfx/examples/40-svt/svt.cpp index caab49c3..3256f649 100644 --- a/bgfx/examples/40-svt/svt.cpp +++ b/bgfx/examples/40-svt/svt.cpp @@ -82,6 +82,7 @@ class ExampleSVT : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/40-svt/virtualtexture.sh b/bgfx/examples/40-svt/virtualtexture.sh index 32a3381c..f0ffde2e 100644 --- a/bgfx/examples/40-svt/virtualtexture.sh +++ b/bgfx/examples/40-svt/virtualtexture.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/40-svt/vs_vt_generic.sc b/bgfx/examples/40-svt/vs_vt_generic.sc index 1f39a873..997b8698 100644 --- a/bgfx/examples/40-svt/vs_vt_generic.sc +++ b/bgfx/examples/40-svt/vs_vt_generic.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/40-svt/vt.cpp b/bgfx/examples/40-svt/vt.cpp index 64f479ea..cabc06c4 100644 --- a/bgfx/examples/40-svt/vt.cpp +++ b/bgfx/examples/40-svt/vt.cpp @@ -296,7 +296,7 @@ Quadtree::~Quadtree() { if (m_children[i] != nullptr) { - BX_DELETE(VirtualTexture::getAllocator(), m_children[i]); + bx::deleteObject(VirtualTexture::getAllocator(), m_children[i]); } } } @@ -344,7 +344,7 @@ void Quadtree::remove(Page request) if (node != nullptr) { - BX_DELETE(VirtualTexture::getAllocator(), node->m_children[index]); + bx::deleteObject(VirtualTexture::getAllocator(), node->m_children[index]); node->m_children[index] = nullptr; } } @@ -459,12 +459,12 @@ PageTable::PageTable(PageCache* _cache, VirtualTextureInfo* _info, PageIndexer* PageTable::~PageTable() { - BX_DELETE(VirtualTexture::getAllocator(), m_quadtree); + bx::deleteObject(VirtualTexture::getAllocator(), m_quadtree); bgfx::destroy(m_texture); for (int i = 0; i < (int)m_images.size(); ++i) { - BX_DELETE(VirtualTexture::getAllocator(), m_images[i]); + bx::deleteObject(VirtualTexture::getAllocator(), m_images[i]); } for (int i = 0; i < (int)m_stagingTextures.size(); ++i) @@ -785,7 +785,7 @@ FeedbackBuffer::FeedbackBuffer(VirtualTextureInfo* _info, int _width, int _heigh FeedbackBuffer::~FeedbackBuffer() { - BX_DELETE(VirtualTexture::getAllocator(), m_indexer); + bx::deleteObject(VirtualTexture::getAllocator(), m_indexer); bgfx::destroy(m_feedbackFrameBuffer); } @@ -906,11 +906,11 @@ VirtualTexture::VirtualTexture(TileDataFile* _tileDataFile, VirtualTextureInfo* VirtualTexture::~VirtualTexture() { // Destroy - BX_DELETE(VirtualTexture::getAllocator(), m_indexer); - BX_DELETE(VirtualTexture::getAllocator(), m_atlas); - BX_DELETE(VirtualTexture::getAllocator(), m_loader); - BX_DELETE(VirtualTexture::getAllocator(), m_cache); - BX_DELETE(VirtualTexture::getAllocator(), m_pageTable); + bx::deleteObject(VirtualTexture::getAllocator(), m_indexer); + bx::deleteObject(VirtualTexture::getAllocator(), m_atlas); + bx::deleteObject(VirtualTexture::getAllocator(), m_loader); + bx::deleteObject(VirtualTexture::getAllocator(), m_cache); + bx::deleteObject(VirtualTexture::getAllocator(), m_pageTable); // Destroy all uniforms and textures bgfx::destroy(u_vt_settings_1); bgfx::destroy(u_vt_settings_2); @@ -1155,13 +1155,13 @@ TileGenerator::~TileGenerator() bimg::imageFree(m_sourceImage); } - BX_DELETE(VirtualTexture::getAllocator(), m_indexer); + bx::deleteObject(VirtualTexture::getAllocator(), m_indexer); - BX_DELETE(VirtualTexture::getAllocator(), m_page1Image); - BX_DELETE(VirtualTexture::getAllocator(), m_page2Image); - BX_DELETE(VirtualTexture::getAllocator(), m_2xtileImage); - BX_DELETE(VirtualTexture::getAllocator(), m_4xtileImage); - BX_DELETE(VirtualTexture::getAllocator(), m_tileImage); + bx::deleteObject(VirtualTexture::getAllocator(), m_page1Image); + bx::deleteObject(VirtualTexture::getAllocator(), m_page2Image); + bx::deleteObject(VirtualTexture::getAllocator(), m_2xtileImage); + bx::deleteObject(VirtualTexture::getAllocator(), m_4xtileImage); + bx::deleteObject(VirtualTexture::getAllocator(), m_tileImage); } bool TileGenerator::generate(const bx::FilePath& _filePath) @@ -1210,7 +1210,7 @@ bool TileGenerator::generate(const bx::FilePath& _filePath) return false; } - uint8_t* rawImage = (uint8_t*)BX_ALLOC(VirtualTexture::getAllocator(), size_t(size) ); + uint8_t* rawImage = (uint8_t*)bx::alloc(VirtualTexture::getAllocator(), size_t(size) ); bx::read(&fileReader, rawImage, int32_t(size), &err); bx::close(&fileReader); @@ -1218,12 +1218,12 @@ bool TileGenerator::generate(const bx::FilePath& _filePath) if (!err.isOk() ) { bx::debugPrintf("Image read failed'%s'.\n", _filePath.getCPtr() ); - BX_FREE(VirtualTexture::getAllocator(), rawImage); + bx::free(VirtualTexture::getAllocator(), rawImage); return false; } m_sourceImage = bimg::imageParse(VirtualTexture::getAllocator(), rawImage, uint32_t(size), bimg::TextureFormat::BGRA8, &err); - BX_FREE(VirtualTexture::getAllocator(), rawImage); + bx::free(VirtualTexture::getAllocator(), rawImage); if (!err.isOk() ) { @@ -1267,7 +1267,7 @@ bool TileGenerator::generate(const bx::FilePath& _filePath) // Write header m_tileDataFile->writeInfo(); // Close tile file - BX_DELETE(VirtualTexture::getAllocator(), m_tileDataFile); + bx::deleteObject(VirtualTexture::getAllocator(), m_tileDataFile); m_tileDataFile = nullptr; bx::debugPrintf("Done!\n"); return true; diff --git a/bgfx/examples/41-tess/makefile b/bgfx/examples/41-tess/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/41-tess/makefile +++ b/bgfx/examples/41-tess/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/41-tess/tess.cpp b/bgfx/examples/41-tess/tess.cpp index 45566ddc..8f0ef164 100644 --- a/bgfx/examples/41-tess/tess.cpp +++ b/bgfx/examples/41-tess/tess.cpp @@ -339,6 +339,7 @@ class ExampleTessellation : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/42-bunnylod/bunnylod.cpp b/bgfx/examples/42-bunnylod/bunnylod.cpp index bd44b1f8..4bfbbf90 100644 --- a/bgfx/examples/42-bunnylod/bunnylod.cpp +++ b/bgfx/examples/42-bunnylod/bunnylod.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -31,8 +31,8 @@ class ExampleBunnyLOD : public entry::AppI if (m_cachePermutation == NULL) { - m_cachePermutation = (uint32_t*)BX_ALLOC(entry::getAllocator(), numVertices * sizeof(uint32_t) ); - m_map = (uint32_t*)BX_ALLOC(entry::getAllocator(), numVertices * sizeof(uint32_t) ); + m_cachePermutation = (uint32_t*)bx::alloc(entry::getAllocator(), numVertices * sizeof(uint32_t) ); + m_map = (uint32_t*)bx::alloc(entry::getAllocator(), numVertices * sizeof(uint32_t) ); // It will takes long time if there are too many vertices. ProgressiveMesh( @@ -47,7 +47,7 @@ class ExampleBunnyLOD : public entry::AppI } // rearrange the vertex Array - char* temp = (char*)BX_ALLOC(entry::getAllocator(), numVertices * stride); + char* temp = (char*)bx::alloc(entry::getAllocator(), numVertices * stride); bx::memCopy(temp, _vb->data, _vb->size); for (uint32_t ii = 0; ii < numVertices; ++ii) @@ -55,7 +55,7 @@ class ExampleBunnyLOD : public entry::AppI bx::memCopy(_vb->data + m_cachePermutation[ii] * stride , temp + ii * stride, stride); } - BX_FREE(entry::getAllocator(), temp); + bx::free(entry::getAllocator(), temp); // update the changes in the entries in the triangle Array for (uint32_t ii = 0, num = numTriangles*3; ii < num; ++ii) @@ -107,7 +107,7 @@ class ExampleBunnyLOD : public entry::AppI } const bgfx::Memory* ib = bgfx::alloc(numIndices * sizeof(uint32_t) ); - uint8_t* vbData = (uint8_t*)BX_ALLOC(entry::getAllocator(), _mesh->m_layout.getSize(numVertices) ); + uint8_t* vbData = (uint8_t*)bx::alloc(entry::getAllocator(), _mesh->m_layout.getSize(numVertices) ); { uint32_t voffset = 0; @@ -144,11 +144,11 @@ class ExampleBunnyLOD : public entry::AppI cacheInvalid = true; m_originalVertices = numVertices; - BX_FREE(entry::getAllocator(), m_cachePermutation); + bx::free(entry::getAllocator(), m_cachePermutation); m_cachePermutation = NULL; - BX_FREE(entry::getAllocator(), m_cacheWeld); - m_cacheWeld = (uint32_t*)BX_ALLOC(entry::getAllocator(), numVertices * sizeof(uint32_t) ); + bx::free(entry::getAllocator(), m_cacheWeld); + m_cacheWeld = (uint32_t*)bx::alloc(entry::getAllocator(), numVertices * sizeof(uint32_t) ); m_totalVertices = bgfx::weldVertices(m_cacheWeld, _mesh->m_layout, vbData, numVertices, true, 0.00001f); remapIndices(m_cacheWeld, numVertices); @@ -161,7 +161,7 @@ class ExampleBunnyLOD : public entry::AppI , numVertices , m_totalVertices ); - BX_FREE(entry::getAllocator(), vbData); + bx::free(entry::getAllocator(), vbData); { uint32_t* ibData = (uint32_t*)ib->data; @@ -178,7 +178,7 @@ class ExampleBunnyLOD : public entry::AppI saveCache(); } - m_triangle = (uint32_t*)BX_ALLOC(entry::getAllocator(), ib->size); + m_triangle = (uint32_t*)bx::alloc(entry::getAllocator(), ib->size); bx::memCopy(m_triangle, ib->data, ib->size); m_vb = bgfx::createVertexBuffer(vb, _mesh->m_layout); @@ -205,26 +205,26 @@ class ExampleBunnyLOD : public entry::AppI { bx::read(&reader, m_originalVertices, &err); bx::read(&reader, m_totalVertices, &err); - m_cacheWeld = (uint32_t*)BX_ALLOC(entry::getAllocator(), m_originalVertices * sizeof(uint32_t) ); + m_cacheWeld = (uint32_t*)bx::alloc(entry::getAllocator(), m_originalVertices * sizeof(uint32_t) ); bx::read(&reader, m_cacheWeld, m_originalVertices * sizeof(uint32_t), &err); - m_cachePermutation = (uint32_t*)BX_ALLOC(entry::getAllocator(), m_totalVertices * sizeof(uint32_t) ); + m_cachePermutation = (uint32_t*)bx::alloc(entry::getAllocator(), m_totalVertices * sizeof(uint32_t) ); bx::read(&reader, m_cachePermutation, m_totalVertices * sizeof(uint32_t), &err); - m_map = (uint32_t*)BX_ALLOC(entry::getAllocator(), m_totalVertices * sizeof(uint32_t) ); + m_map = (uint32_t*)bx::alloc(entry::getAllocator(), m_totalVertices * sizeof(uint32_t) ); bx::read(&reader, m_map, m_totalVertices * sizeof(uint32_t), &err); if (!err.isOk() ) { // read fail - BX_FREE(entry::getAllocator(), m_cacheWeld); + bx::free(entry::getAllocator(), m_cacheWeld); m_cacheWeld = NULL; - BX_FREE(entry::getAllocator(), m_cachePermutation); + bx::free(entry::getAllocator(), m_cachePermutation); m_cachePermutation = NULL; - BX_FREE(entry::getAllocator(), m_map); + bx::free(entry::getAllocator(), m_map); m_map = NULL; } @@ -264,6 +264,7 @@ class ExampleBunnyLOD : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; @@ -306,10 +307,10 @@ class ExampleBunnyLOD : public entry::AppI bgfx::destroy(m_ib); bgfx::destroy(u_tint); - BX_FREE(entry::getAllocator(), m_map); - BX_FREE(entry::getAllocator(), m_triangle); - BX_FREE(entry::getAllocator(), m_cacheWeld); - BX_FREE(entry::getAllocator(), m_cachePermutation); + bx::free(entry::getAllocator(), m_map); + bx::free(entry::getAllocator(), m_triangle); + bx::free(entry::getAllocator(), m_cacheWeld); + bx::free(entry::getAllocator(), m_cachePermutation); // Shutdown bgfx. bgfx::shutdown(); diff --git a/bgfx/examples/42-bunnylod/fs_bunnylod.sc b/bgfx/examples/42-bunnylod/fs_bunnylod.sc index 3e8f850e..07feb33b 100644 --- a/bgfx/examples/42-bunnylod/fs_bunnylod.sc +++ b/bgfx/examples/42-bunnylod/fs_bunnylod.sc @@ -1,7 +1,7 @@ $input v_world, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/42-bunnylod/makefile b/bgfx/examples/42-bunnylod/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/42-bunnylod/makefile +++ b/bgfx/examples/42-bunnylod/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/42-bunnylod/vs_bunnylod.sc b/bgfx/examples/42-bunnylod/vs_bunnylod.sc index 74209e35..d40fc67c 100644 --- a/bgfx/examples/42-bunnylod/vs_bunnylod.sc +++ b/bgfx/examples/42-bunnylod/vs_bunnylod.sc @@ -2,7 +2,7 @@ $input a_position, a_normal $output v_world, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/43-denoise/denoise.cpp b/bgfx/examples/43-denoise/denoise.cpp index 3c9c2ef2..f9ff556a 100644 --- a/bgfx/examples/43-denoise/denoise.cpp +++ b/bgfx/examples/43-denoise/denoise.cpp @@ -253,6 +253,7 @@ class ExampleDenoise : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/44-sss/screen_space_shadows.cpp b/bgfx/examples/44-sss/screen_space_shadows.cpp index 7a142baa..1bf85b0e 100644 --- a/bgfx/examples/44-sss/screen_space_shadows.cpp +++ b/bgfx/examples/44-sss/screen_space_shadows.cpp @@ -265,6 +265,7 @@ class ExampleScreenSpaceShadows : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/45-bokeh/bokeh.cpp b/bgfx/examples/45-bokeh/bokeh.cpp index b1ed78f4..965db747 100644 --- a/bgfx/examples/45-bokeh/bokeh.cpp +++ b/bgfx/examples/45-bokeh/bokeh.cpp @@ -247,6 +247,7 @@ class ExampleBokeh : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/46-fsr/makefile b/bgfx/examples/46-fsr/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/46-fsr/makefile +++ b/bgfx/examples/46-fsr/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/47-pixelformats/makefile b/bgfx/examples/47-pixelformats/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/47-pixelformats/makefile +++ b/bgfx/examples/47-pixelformats/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/47-pixelformats/pixelformats.cpp b/bgfx/examples/47-pixelformats/pixelformats.cpp index 8cfdcc59..4eb79532 100644 --- a/bgfx/examples/47-pixelformats/pixelformats.cpp +++ b/bgfx/examples/47-pixelformats/pixelformats.cpp @@ -42,14 +42,13 @@ inline bimg::TextureFormat::Enum indexToFormat(int32_t index) { return bimg::TextureFormat::Enum(index); } - else if (index >= kNumCompressedFormats && index < kNumFormats) + + if (index >= kNumCompressedFormats && index < kNumFormats) { return bimg::TextureFormat::Enum(index + 1); } - else - { - return bimg::TextureFormat::Unknown; - } + + return bimg::TextureFormat::Unknown; } struct TextureStatus @@ -67,11 +66,11 @@ struct TextureStatus { switch (value) { - case Ok: return "Ok"; - case NotInitialized: return "Texture was not initialized"; - case FormatNotSupported: return "Format not supported by GPU/backend"; + case Ok: return "Ok"; + case NotInitialized: return "Texture was not initialized"; + case FormatNotSupported: return "Format not supported by GPU/backend"; case ConversionNotSupported: return "Conversion from RGBA8 not supported"; - case FormatIgnored: return "Format is ignored by this example"; + case FormatIgnored: return "Format is ignored by this example"; } return "Unknown"; @@ -87,7 +86,7 @@ struct TextureStatus struct Texture { - uint16_t m_width = 0; + uint16_t m_width = 0; uint16_t m_height = 0; TextureStatus::Enum m_status = TextureStatus::NotInitialized; bgfx::TextureHandle m_texture = BGFX_INVALID_HANDLE; @@ -96,7 +95,7 @@ struct Texture struct TextureSet { stl::string m_name; - uint16_t m_maxWidth = 0; + uint16_t m_maxWidth = 0; uint16_t m_maxHeight = 0; bool m_hasCompressedTextures = false; Texture m_textures[kNumFormats]; @@ -266,8 +265,8 @@ static void textureSetPopulateUncompressedFormats(TextureSet& textureSet, bimg:: continue; } - if ( formatName[formatNameLen - 1] == 'I' - || formatName[formatNameLen - 1] == 'U') + if (formatName[formatNameLen - 1] == 'I' + || formatName[formatNameLen - 1] == 'U') { texture.m_status = TextureStatus::FormatIgnored; continue; @@ -283,7 +282,7 @@ static void textureSetPopulateUncompressedFormats(TextureSet& textureSet, bimg:: , false , 1 , format - ); + ); const bgfx::Memory* mem = bgfx::alloc(info.storageSize); bimg::imageConvert( @@ -295,7 +294,7 @@ static void textureSetPopulateUncompressedFormats(TextureSet& textureSet, bimg:: , source->m_width , source->m_height , 1 - ); + ); texture.m_width = info.width; texture.m_height = info.height; @@ -308,7 +307,7 @@ static void textureSetPopulateUncompressedFormats(TextureSet& textureSet, bimg:: , bgfx::TextureFormat::Enum(info.format) , flags , mem - ); + ); bgfx::setName(texture.m_texture, formatName); @@ -430,6 +429,7 @@ class ExamplePixelFormats : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; @@ -470,27 +470,35 @@ class ExamplePixelFormats : public entry::AppI m_textureSets.push_back(generateTextureSetFromFile("textures/pf_uv_filtering_test.dds") ); const char* textureCompressionSetFiles[] = { - "textures/texture_compression_astc_10x5.dds" - , "textures/texture_compression_astc_4x4.dds" - , "textures/texture_compression_astc_5x5.dds" - , "textures/texture_compression_astc_6x6.dds" - , "textures/texture_compression_astc_8x5.dds" - , "textures/texture_compression_astc_8x6.dds" - , "textures/texture_compression_atc.dds" - , "textures/texture_compression_atce.dds" - , "textures/texture_compression_atci.dds" - , "textures/texture_compression_bc1.ktx" - , "textures/texture_compression_bc2.ktx" - , "textures/texture_compression_bc3.ktx" - , "textures/texture_compression_bc7.ktx" - , "textures/texture_compression_etc1.ktx" - , "textures/texture_compression_etc2.ktx" - , "textures/texture_compression_ptc12.pvr" - , "textures/texture_compression_ptc14.pvr" - , "textures/texture_compression_ptc22.pvr" - , "textures/texture_compression_ptc24.pvr" - , "textures/texture_compression_rgba8.dds" - , nullptr + "textures/texture_compression_astc_4x4.dds", + "textures/texture_compression_astc_5x4.dds", + "textures/texture_compression_astc_5x5.dds", + "textures/texture_compression_astc_6x5.dds", + "textures/texture_compression_astc_6x6.dds", + "textures/texture_compression_astc_8x5.dds", + "textures/texture_compression_astc_8x6.dds", + "textures/texture_compression_astc_8x8.dds", + "textures/texture_compression_astc_10x5.dds", + "textures/texture_compression_astc_10x6.dds", + "textures/texture_compression_astc_10x8.dds", + "textures/texture_compression_astc_10x10.dds", + "textures/texture_compression_astc_12x10.dds", + "textures/texture_compression_astc_12x12.dds", + "textures/texture_compression_atc.dds", + "textures/texture_compression_atce.dds", + "textures/texture_compression_atci.dds", + "textures/texture_compression_bc1.ktx", + "textures/texture_compression_bc2.ktx", + "textures/texture_compression_bc3.ktx", + "textures/texture_compression_bc7.ktx", + "textures/texture_compression_etc1.ktx", + "textures/texture_compression_etc2.ktx", + "textures/texture_compression_ptc12.pvr", + "textures/texture_compression_ptc14.pvr", + "textures/texture_compression_ptc22.pvr", + "textures/texture_compression_ptc24.pvr", + "textures/texture_compression_rgba8.dds", + nullptr }; m_textureSets.push_back(generateTextureSetFromFileSet("texture_compression_* set", textureCompressionSetFiles)); @@ -627,9 +635,13 @@ class ExamplePixelFormats : public entry::AppI ImVec2 previewSize = ImVec2(m_previewSize, m_previewSize); if (m_currentTextureSet->m_maxWidth > m_currentTextureSet->m_maxHeight) + { previewSize.y /= float(m_currentTextureSet->m_maxWidth) / m_currentTextureSet->m_maxHeight; + } else if (m_currentTextureSet->m_maxWidth < m_currentTextureSet->m_maxHeight) + { previewSize.x *= float(m_currentTextureSet->m_maxWidth) / m_currentTextureSet->m_maxHeight; + } float cellWidth = previewSize.x; for (int32_t i = 0; i < kNumFormats; ++i) @@ -650,11 +662,15 @@ class ExamplePixelFormats : public entry::AppI { m_currentTextureSet = &textureSet; if (!m_currentTextureSet->m_hasCompressedTextures && formatToIndex(m_selectedFormat) < kNumCompressedFormats) + { m_selectedFormat = bimg::TextureFormat::RGBA8; + } } } + ImGui::EndCombo(); } + ImGui::DragFloat("Preview Size", &m_previewSize, 1.0f, 10.0f, m_largestTextureSize, "%.0f px"); ImGui::SameLine(); ImGui::Checkbox("Alpha", &m_useAlpha); @@ -683,6 +699,7 @@ class ExamplePixelFormats : public entry::AppI label.append(bimg::getName(bimg::TextureFormat::Enum(format) ) ); ImGui::PushStyleColor(ImGuiCol_Text, labelColor); imguiTextBoxUnformatted(ImVec2(cellWidth, 0.0f), label.c_str() ); + if (TextureStatus::isError(texture.m_status) ) { imguiStrikethroughItem(); @@ -703,7 +720,7 @@ class ExamplePixelFormats : public entry::AppI if (ImGui::Selectable( "##selectable" , &isSelected - , ImGuiSelectableFlags_AllowItemOverlap + , ImGuiSelectableFlags_AllowOverlap , ImGui::GetItemRectSize() ) ) { diff --git a/bgfx/examples/48-drawindirect/drawindirect.cpp b/bgfx/examples/48-drawindirect/drawindirect.cpp index d8b4d6d5..65fffa12 100644 --- a/bgfx/examples/48-drawindirect/drawindirect.cpp +++ b/bgfx/examples/48-drawindirect/drawindirect.cpp @@ -146,6 +146,7 @@ class DrawIndirect : public entry::AppI init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/48-drawindirect/makefile b/bgfx/examples/48-drawindirect/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/48-drawindirect/makefile +++ b/bgfx/examples/48-drawindirect/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/49-hextile/hextile.cpp b/bgfx/examples/49-hextile/hextile.cpp index ecef40bf..58dc2c7e 100644 --- a/bgfx/examples/49-hextile/hextile.cpp +++ b/bgfx/examples/49-hextile/hextile.cpp @@ -85,6 +85,7 @@ namespace init.vendorId = args.m_pciId; init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle); init.platformData.ndt = entry::getNativeDisplayHandle(); + init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); init.resolution.width = m_width; init.resolution.height = m_height; init.resolution.reset = m_reset; diff --git a/bgfx/examples/49-hextile/makefile b/bgfx/examples/49-hextile/makefile index 19c81e43..dd0194e1 100644 --- a/bgfx/examples/49-hextile/makefile +++ b/bgfx/examples/49-hextile/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/assets/textures/textures.ninja b/bgfx/examples/assets/textures/textures.ninja index 3436042e..22fd3e32 100644 --- a/bgfx/examples/assets/textures/textures.ninja +++ b/bgfx/examples/assets/textures/textures.ninja @@ -1,20 +1,34 @@ -textures = $pwd/../../runtime/textures - -build $textures/texture_compression_bc1.ktx: texturec_bc1 $pwd/texture-compression-test.png -build $textures/texture_compression_bc2.ktx: texturec_bc2 $pwd/texture-compression-test.png -build $textures/texture_compression_bc3.ktx: texturec_bc3 $pwd/texture-compression-test.png -build $textures/texture_compression_bc7.ktx: texturec_bc7 $pwd/texture-compression-test.png -build $textures/texture_compression_etc1.ktx: texturec_etc1 $pwd/texture-compression-test.png -build $textures/texture_compression_etc2.ktx: texturec_etc2 $pwd/texture-compression-test.png - -build $textures/parallax-d.ktx: texturec_diffuse $pwd/parallax-d.png -build $textures/parallax-n.ktx: texturec_normal $pwd/parallax-n.png -build $textures/parallax-h.ktx: texturec_height $pwd/parallax-h.png -build $textures/lightmap.ktx: texturec_height $pwd/../sky/lightmap.png -build $textures/uffizi.ktx: texturec_equirect $pwd/uffizi-large.exr - -build $textures/texture_compression_rgba8.dds: texturec_rgba8 $pwd/texture-compression-test.png -build $textures/pf_alpha_test.dds: texturec_rgba8 $pwd/texture-alpha-test.png -build $textures/pf_uv_filtering_test.dds: texturec_rgba8 $pwd/texture-uv-filtering-test.png - -build $textures/aerial_rocks_04_diff_2k.ktx: texturec_bc7 $pwd/aerial_rocks_04_diff_2k.jpg \ No newline at end of file +textures = $pwd/../../runtime/textures + +build $textures/texture_compression_bc1.ktx: texturec_bc1 $pwd/texture-compression-test.png +build $textures/texture_compression_bc2.ktx: texturec_bc2 $pwd/texture-compression-test.png +build $textures/texture_compression_bc3.ktx: texturec_bc3 $pwd/texture-compression-test.png +build $textures/texture_compression_bc7.ktx: texturec_bc7 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_4x4.dds: texturec_astc4x4 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_5x4.dds: texturec_astc5x4 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_5x5.dds: texturec_astc5x5 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_6x5.dds: texturec_astc6x5 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_6x6.dds: texturec_astc6x6 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_8x5.dds: texturec_astc8x5 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_8x6.dds: texturec_astc8x6 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_8x8.dds: texturec_astc8x8 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_10x5.dds: texturec_astc10x5 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_10x6.dds: texturec_astc10x6 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_10x8.dds: texturec_astc10x8 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_10x10.dds: texturec_astc10x10 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_12x10.dds: texturec_astc12x10 $pwd/texture-compression-test.png +build $textures/texture_compression_astc_12x12.dds: texturec_astc12x12 $pwd/texture-compression-test.png +build $textures/texture_compression_etc1.ktx: texturec_etc1 $pwd/texture-compression-test.png +build $textures/texture_compression_etc2.ktx: texturec_etc2 $pwd/texture-compression-test.png + +build $textures/parallax-d.ktx: texturec_diffuse $pwd/parallax-d.png +build $textures/parallax-n.ktx: texturec_normal $pwd/parallax-n.png +build $textures/parallax-h.ktx: texturec_height $pwd/parallax-h.png +build $textures/lightmap.ktx: texturec_height $pwd/../sky/lightmap.png +build $textures/uffizi.ktx: texturec_equirect $pwd/uffizi-large.exr + +build $textures/texture_compression_rgba8.dds: texturec_rgba8 $pwd/texture-compression-test.png +build $textures/pf_alpha_test.dds: texturec_rgba8 $pwd/texture-alpha-test.png +build $textures/pf_uv_filtering_test.dds: texturec_rgba8 $pwd/texture-uv-filtering-test.png + +build $textures/aerial_rocks_04_diff_2k.ktx: texturec_bc7 $pwd/aerial_rocks_04_diff_2k.jpg diff --git a/bgfx/examples/common/aviwriter.h b/bgfx/examples/common/aviwriter.h index 32eb49f6..016e0122 100644 --- a/bgfx/examples/common/aviwriter.h +++ b/bgfx/examples/common/aviwriter.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/bgfx_utils.cpp b/bgfx/examples/common/bgfx_utils.cpp index 209e3ea7..fd9cfe9a 100644 --- a/bgfx/examples/common/bgfx_utils.cpp +++ b/bgfx/examples/common/bgfx_utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -28,7 +28,7 @@ void* load(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const char* _fi if (bx::open(_reader, _filePath) ) { uint32_t size = (uint32_t)bx::getSize(_reader); - void* data = BX_ALLOC(_allocator, size); + void* data = bx::alloc(_allocator, size); bx::read(_reader, data, size, bx::ErrorAssert{}); bx::close(_reader); if (NULL != _size) @@ -57,7 +57,7 @@ void* load(const char* _filePath, uint32_t* _size) void unload(void* _ptr) { - BX_FREE(entry::getAllocator(), _ptr); + bx::free(entry::getAllocator(), _ptr); } static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePath) @@ -81,7 +81,7 @@ static void* loadMem(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const if (bx::open(_reader, _filePath) ) { uint32_t size = (uint32_t)bx::getSize(_reader); - void* data = BX_ALLOC(_allocator, size); + void* data = bx::alloc(_allocator, size); bx::read(_reader, data, size, bx::ErrorAssert{}); bx::close(_reader); @@ -416,7 +416,7 @@ void Mesh::load(bx::ReaderSeekerI* _reader, bool _ramcopy) if (_ramcopy) { - group.m_vertices = (uint8_t*)BX_ALLOC(allocator, group.m_numVertices*stride); + group.m_vertices = (uint8_t*)bx::alloc(allocator, group.m_numVertices*stride); bx::memCopy(group.m_vertices, mem->data, mem->size); } @@ -441,16 +441,16 @@ void Mesh::load(bx::ReaderSeekerI* _reader, bool _ramcopy) uint32_t compressedSize; bx::read(_reader, compressedSize, &err); - void* compressedVertices = BX_ALLOC(allocator, compressedSize); + void* compressedVertices = bx::alloc(allocator, compressedSize); bx::read(_reader, compressedVertices, compressedSize, &err); meshopt_decodeVertexBuffer(mem->data, group.m_numVertices, stride, (uint8_t*)compressedVertices, compressedSize); - BX_FREE(allocator, compressedVertices); + bx::free(allocator, compressedVertices); if (_ramcopy) { - group.m_vertices = (uint8_t*)BX_ALLOC(allocator, group.m_numVertices*stride); + group.m_vertices = (uint8_t*)bx::alloc(allocator, group.m_numVertices*stride); bx::memCopy(group.m_vertices, mem->data, mem->size); } @@ -467,7 +467,7 @@ void Mesh::load(bx::ReaderSeekerI* _reader, bool _ramcopy) if (_ramcopy) { - group.m_indices = (uint16_t*)BX_ALLOC(allocator, group.m_numIndices*2); + group.m_indices = (uint16_t*)bx::alloc(allocator, group.m_numIndices*2); bx::memCopy(group.m_indices, mem->data, mem->size); } @@ -484,17 +484,17 @@ void Mesh::load(bx::ReaderSeekerI* _reader, bool _ramcopy) uint32_t compressedSize; bx::read(_reader, compressedSize, &err); - void* compressedIndices = BX_ALLOC(allocator, compressedSize); + void* compressedIndices = bx::alloc(allocator, compressedSize); bx::read(_reader, compressedIndices, compressedSize, &err); meshopt_decodeIndexBuffer(mem->data, group.m_numIndices, 2, (uint8_t*)compressedIndices, compressedSize); - BX_FREE(allocator, compressedIndices); + bx::free(allocator, compressedIndices); if (_ramcopy) { - group.m_indices = (uint16_t*)BX_ALLOC(allocator, group.m_numIndices*2); + group.m_indices = (uint16_t*)bx::alloc(allocator, group.m_numIndices*2); bx::memCopy(group.m_indices, mem->data, mem->size); } @@ -562,12 +562,12 @@ void Mesh::unload() if (NULL != group.m_vertices) { - BX_FREE(allocator, group.m_vertices); + bx::free(allocator, group.m_vertices); } if (NULL != group.m_indices) { - BX_FREE(allocator, group.m_indices); + bx::free(allocator, group.m_indices); } } m_groups.clear(); @@ -683,13 +683,13 @@ void meshUnload(Mesh* _mesh) MeshState* meshStateCreate() { - MeshState* state = (MeshState*)BX_ALLOC(entry::getAllocator(), sizeof(MeshState) ); + MeshState* state = (MeshState*)bx::alloc(entry::getAllocator(), sizeof(MeshState) ); return state; } void meshStateDestroy(MeshState* _meshState) { - BX_FREE(entry::getAllocator(), _meshState); + bx::free(entry::getAllocator(), _meshState); } void meshSubmit(const Mesh* _mesh, bgfx::ViewId _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state) diff --git a/bgfx/examples/common/bgfx_utils.h b/bgfx/examples/common/bgfx_utils.h index 7146293f..03c48f65 100644 --- a/bgfx/examples/common/bgfx_utils.h +++ b/bgfx/examples/common/bgfx_utils.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/camera.cpp b/bgfx/examples/common/camera.cpp index 2578d327..c686b31d 100644 --- a/bgfx/examples/common/camera.cpp +++ b/bgfx/examples/common/camera.cpp @@ -265,9 +265,9 @@ struct Camera MouseCoords m_mouseNow; MouseCoords m_mouseLast; - bx::Vec3 m_eye = bx::init::Zero; - bx::Vec3 m_at = bx::init::Zero; - bx::Vec3 m_up = bx::init::Zero; + bx::Vec3 m_eye = bx::InitZero; + bx::Vec3 m_at = bx::InitZero; + bx::Vec3 m_up = bx::InitZero; float m_horizontalAngle; float m_verticalAngle; @@ -288,7 +288,7 @@ void cameraCreate() void cameraDestroy() { - BX_DELETE(entry::getAllocator(), s_camera); + bx::deleteObject(entry::getAllocator(), s_camera); s_camera = NULL; } diff --git a/bgfx/examples/common/common.h b/bgfx/examples/common/common.h index c15209bb..225352e2 100644 --- a/bgfx/examples/common/common.h +++ b/bgfx/examples/common/common.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/common.sh b/bgfx/examples/common/common.sh index fab6caf1..6c649feb 100644 --- a/bgfx/examples/common/common.sh +++ b/bgfx/examples/common/common.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/debugdraw.cpp b/bgfx/examples/common/debugdraw/debugdraw.cpp index eee5aef0..201262c9 100644 --- a/bgfx/examples/common/debugdraw/debugdraw.cpp +++ b/bgfx/examples/common/debugdraw/debugdraw.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -640,11 +640,11 @@ struct DebugDrawShared const uint32_t numVertices = genSphere(tess); const uint32_t numIndices = numVertices; - vertices[id] = BX_ALLOC(m_allocator, numVertices*stride); + vertices[id] = bx::alloc(m_allocator, numVertices*stride); bx::memSet(vertices[id], 0, numVertices*stride); genSphere(tess, vertices[id], stride); - uint16_t* trilist = (uint16_t*)BX_ALLOC(m_allocator, numIndices*sizeof(uint16_t) ); + uint16_t* trilist = (uint16_t*)bx::alloc(m_allocator, numIndices*sizeof(uint16_t) ); for (uint32_t ii = 0; ii < numIndices; ++ii) { trilist[ii] = uint16_t(ii); @@ -658,7 +658,7 @@ struct DebugDrawShared , numIndices , false ); - indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) ); + indices[id] = (uint16_t*)bx::alloc(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) ); uint16_t* indicesOut = indices[id]; bx::memCopy(indicesOut, trilist, numIndices*sizeof(uint16_t) ); @@ -681,7 +681,7 @@ struct DebugDrawShared startVertex += numVertices; startIndex += numIndices + numLineListIndices; - BX_FREE(m_allocator, trilist); + bx::free(m_allocator, trilist); } for (uint32_t mesh = 0; mesh < 4; ++mesh) @@ -695,8 +695,8 @@ struct DebugDrawShared const uint32_t numIndices = num*6; const uint32_t numLineListIndices = num*4; - vertices[id] = BX_ALLOC(m_allocator, numVertices*stride); - indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) ); + vertices[id] = bx::alloc(m_allocator, numVertices*stride); + indices[id] = (uint16_t*)bx::alloc(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) ); bx::memSet(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) ); DebugShapeVertex* vertex = (DebugShapeVertex*)vertices[id]; @@ -756,8 +756,8 @@ struct DebugDrawShared const uint32_t numIndices = num*12; const uint32_t numLineListIndices = num*6; - vertices[id] = BX_ALLOC(m_allocator, numVertices*stride); - indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) ); + vertices[id] = bx::alloc(m_allocator, numVertices*stride); + indices[id] = (uint16_t*)bx::alloc(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) ); bx::memSet(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) ); DebugShapeVertex* vertex = (DebugShapeVertex*)vertices[id]; @@ -826,8 +826,8 @@ struct DebugDrawShared const uint32_t numIndices = num*6; const uint32_t numLineListIndices = num*6; - vertices[id] = BX_ALLOC(m_allocator, numVertices*stride); - indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) ); + vertices[id] = bx::alloc(m_allocator, numVertices*stride); + indices[id] = (uint16_t*)bx::alloc(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) ); bx::memSet(indices[id], 0, (numIndices + numLineListIndices)*sizeof(uint16_t) ); DebugShapeVertex* vertex = (DebugShapeVertex*)vertices[id]; @@ -919,8 +919,8 @@ struct DebugDrawShared , (m_mesh[id].m_numIndices[0]+m_mesh[id].m_numIndices[1])*sizeof(uint16_t) ); - BX_FREE(m_allocator, vertices[id]); - BX_FREE(m_allocator, indices[id]); + bx::free(m_allocator, vertices[id]); + bx::free(m_allocator, indices[id]); } bx::memCopy(&vb->data[m_mesh[DebugMesh::Quad].m_startVertex * stride] @@ -1650,7 +1650,7 @@ struct DebugDrawEncoderImpl void drawFrustum(const float* _viewProj) { - bx::Plane planes[6] = { bx::init::None, bx::init::None, bx::init::None, bx::init::None, bx::init::None, bx::init::None }; + bx::Plane planes[6] = { bx::InitNone, bx::InitNone, bx::InitNone, bx::InitNone, bx::InitNone, bx::InitNone }; buildFrustumPlanes(planes, _viewProj); const bx::Vec3 points[8] = @@ -1747,8 +1747,8 @@ struct DebugDrawEncoderImpl const float step = bx::kPi * 2.0f / num; _weight = bx::clamp(_weight, 0.0f, 2.0f); - bx::Vec3 udir(bx::init::None); - bx::Vec3 vdir(bx::init::None); + bx::Vec3 udir(bx::InitNone); + bx::Vec3 vdir(bx::InitNone); bx::calcTangentFrame(udir, vdir, _normal, attrib.m_spin); float xy0[2]; @@ -1819,8 +1819,8 @@ struct DebugDrawEncoderImpl const Attrib& attrib = m_attrib[m_stack]; if (attrib.m_wireframe) { - bx::Vec3 udir(bx::init::None); - bx::Vec3 vdir(bx::init::None); + bx::Vec3 udir(bx::InitNone); + bx::Vec3 vdir(bx::InitNone); bx::calcTangentFrame(udir, vdir, _normal, attrib.m_spin); const float halfExtent = _size*0.5f; @@ -1861,8 +1861,8 @@ struct DebugDrawEncoderImpl const Attrib& attrib = m_attrib[m_stack]; - bx::Vec3 udir(bx::init::None); - bx::Vec3 vdir(bx::init::None); + bx::Vec3 udir(bx::InitNone); + bx::Vec3 vdir(bx::InitNone); bx::calcTangentFrame(udir, vdir, _normal, attrib.m_spin); const Pack2D& pack = s_dds.m_sprite.get(_handle); @@ -1982,8 +1982,8 @@ struct DebugDrawEncoderImpl if (_thickness > 0.0f) { const bx::Vec3 from = { _x, _y, _z }; - bx::Vec3 mid(bx::init::None); - bx::Vec3 to(bx::init::None); + bx::Vec3 mid(bx::InitNone); + bx::Vec3 to(bx::InitNone); setColor(Axis::X == _highlight ? 0xff00ffff : 0xff0000ff); mid = { _x + _len - _thickness, _y, _z }; @@ -2025,8 +2025,8 @@ struct DebugDrawEncoderImpl { const Attrib& attrib = m_attrib[m_stack]; - bx::Vec3 udir(bx::init::None); - bx::Vec3 vdir(bx::init::None); + bx::Vec3 udir(bx::InitNone); + bx::Vec3 vdir(bx::InitNone); bx::calcTangentFrame(udir, vdir, _normal, attrib.m_spin); udir = bx::mul(udir, _step); diff --git a/bgfx/examples/common/debugdraw/debugdraw.h b/bgfx/examples/common/debugdraw/debugdraw.h index 7770ed15..71dd5746 100644 --- a/bgfx/examples/common/debugdraw/debugdraw.h +++ b/bgfx/examples/common/debugdraw/debugdraw.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc b/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc index 85f9bc7d..80f3c1a0 100644 --- a/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc +++ b/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc b/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc index 0ed3fa60..9489c9d5 100644 --- a/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc +++ b/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc @@ -1,7 +1,7 @@ $input v_view, v_world /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.sc b/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.sc index 67adb209..9a641514 100644 --- a/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.sc +++ b/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc b/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc index 1e1a4020..bb9c0d4f 100644 --- a/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc +++ b/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc b/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc index e4881721..4140391c 100644 --- a/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc +++ b/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc @@ -1,7 +1,7 @@ $input v_color0, v_stipple /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/makefile b/bgfx/examples/common/debugdraw/makefile index 554063e5..9fe95f71 100644 --- a/bgfx/examples/common/debugdraw/makefile +++ b/bgfx/examples/common/debugdraw/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc b/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc index db5c3498..bee7f33d 100644 --- a/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc +++ b/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc @@ -1,7 +1,7 @@ $input a_position, a_indices /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc b/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc index 0964f592..9d6f483e 100644 --- a/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc +++ b/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc @@ -2,7 +2,7 @@ $input a_position, a_indices $output v_view, v_world /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.sc b/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.sc index 7083351a..25e55547 100644 --- a/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.sc +++ b/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.sc @@ -2,7 +2,7 @@ $input a_position $output v_view, v_world /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.sc b/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.sc index 44901d09..1b3e3807 100644 --- a/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.sc +++ b/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.sc @@ -1,7 +1,7 @@ $input a_position /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.sc b/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.sc index 073c7de4..7c72921a 100644 --- a/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.sc +++ b/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0, a_color0 $output v_texcoord0, v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc b/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc index 50143cf9..850384f6 100644 --- a/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc +++ b/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_color0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc b/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc index 121d7120..cc559096 100644 --- a/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc +++ b/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc @@ -2,7 +2,7 @@ $input a_position, a_color0, a_texcoord0 $output v_color0, v_stipple /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/entry/cmd.cpp b/bgfx/examples/common/entry/cmd.cpp index 51742b8e..c80b64d5 100644 --- a/bgfx/examples/common/entry/cmd.cpp +++ b/bgfx/examples/common/entry/cmd.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 Branimir Karadzic. All rights reserved. + * Copyright 2010-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -109,7 +109,7 @@ void cmdInit() void cmdShutdown() { - BX_DELETE(entry::getAllocator(), s_cmdContext); + bx::deleteObject(entry::getAllocator(), s_cmdContext); } void cmdAdd(const char* _name, ConsoleFn _fn, void* _userData) diff --git a/bgfx/examples/common/entry/cmd.h b/bgfx/examples/common/entry/cmd.h index fe219424..cd1e611b 100644 --- a/bgfx/examples/common/entry/cmd.h +++ b/bgfx/examples/common/entry/cmd.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 Branimir Karadzic. All rights reserved. + * Copyright 2010-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/entry/dbg.h b/bgfx/examples/common/entry/dbg.h index bafe4a51..6ac2c417 100644 --- a/bgfx/examples/common/entry/dbg.h +++ b/bgfx/examples/common/entry/dbg.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/entry/dialog.cpp b/bgfx/examples/common/entry/dialog.cpp index 76c84108..913cc8a1 100644 --- a/bgfx/examples/common/entry/dialog.cpp +++ b/bgfx/examples/common/entry/dialog.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 Branimir Karadzic. All rights reserved. + * Copyright 2010-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -42,6 +42,7 @@ struct OPENFILENAMEA }; extern "C" bool __stdcall GetOpenFileNameA(OPENFILENAMEA* _ofn); +extern "C" bool __stdcall GetSaveFileNameA(OPENFILENAMEA * _ofn); extern "C" void* __stdcall GetModuleHandleA(const char* _moduleName); extern "C" uint32_t __stdcall GetModuleFileNameA(void* _module, char* _outFilePath, uint32_t _size); extern "C" void* __stdcall ShellExecuteA(void* _hwnd, void* _operation, void* _file, void* _parameters, void* _directory, int32_t _showCmd); @@ -104,6 +105,17 @@ class Split char m_ch; }; +#if BX_PLATFORM_WINDOWS +extern "C" typedef bool(__stdcall* OPENFILENAMEFUNCTION)(OPENFILENAMEA* _ofn); +static const struct { OPENFILENAMEFUNCTION m_function; uint32_t m_flags; } +s_getFileNameA[] = +{ + { GetOpenFileNameA, /* OFN_EXPLORER */ 0x00080000 | /* OFN_DONTADDTORECENT */ 0x02000000 | /* OFN_FILEMUSTEXIST */ 0x00001000 }, + { GetSaveFileNameA, /* OFN_EXPLORER */ 0x00080000 | /* OFN_DONTADDTORECENT */ 0x02000000 }, +}; +BX_STATIC_ASSERT(BX_COUNTOF(s_getFileNameA) == FileSelectionDialogType::Count); +#endif + #if !BX_PLATFORM_OSX bool openFileSelectionDialog( bx::FilePath& _inOutFilePath @@ -156,7 +168,8 @@ bool openFileSelectionDialog( } } #elif BX_PLATFORM_WINDOWS - BX_UNUSED(_type); + if (_type < 0 || _type >= BX_COUNTOF(s_getFileNameA)) + return false; char out[bx::kMaxFilePath] = { '\0' }; @@ -166,11 +179,7 @@ bool openFileSelectionDialog( ofn.initialDir = _inOutFilePath.getCPtr(); ofn.file = out; ofn.maxFile = sizeof(out); - ofn.flags = 0 - | /* OFN_EXPLORER */ 0x00080000 - | /* OFN_FILEMUSTEXIST */ 0x00001000 - | /* OFN_DONTADDTORECENT */ 0x02000000 - ; + ofn.flags = s_getFileNameA[_type].m_flags; char tmp[4096]; bx::StaticMemoryBlockWriter writer(tmp, sizeof(tmp) ); @@ -220,7 +229,7 @@ bool openFileSelectionDialog( bx::write(&writer, '\0', &err); if (err.isOk() - && GetOpenFileNameA(&ofn) ) + && s_getFileNameA[_type].m_function(&ofn)) { _inOutFilePath.set(ofn.file); return true; diff --git a/bgfx/examples/common/entry/dialog.h b/bgfx/examples/common/entry/dialog.h index 8c13d2be..2ea7e009 100644 --- a/bgfx/examples/common/entry/dialog.h +++ b/bgfx/examples/common/entry/dialog.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 Branimir Karadzic. All rights reserved. + * Copyright 2010-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/entry/dialog_darwin.mm b/bgfx/examples/common/entry/dialog_darwin.mm index c80a7a91..acf4278f 100644 --- a/bgfx/examples/common/entry/dialog_darwin.mm +++ b/bgfx/examples/common/entry/dialog_darwin.mm @@ -104,7 +104,7 @@ bool openFileSelectionDialog( panel.message = [[NSString alloc] initWithBytes:_title.getPtr() length:_title.getLength() encoding:NSASCIIStringEncoding]; panel.directoryURL = [NSURL URLWithString:@(_inOutFilePath.getCPtr())]; - panel.allowedFileTypes = fileTypes; + panel.allowedContentTypes = fileTypes; if ([panel runModal] == NSModalResponseOK) { diff --git a/bgfx/examples/common/entry/entry.cpp b/bgfx/examples/common/entry/entry.cpp index 58a671e6..14a48925 100644 --- a/bgfx/examples/common/entry/entry.cpp +++ b/bgfx/examples/common/entry/entry.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -530,11 +530,11 @@ BX_PRAGMA_DIAGNOSTIC_POP(); int runApp(AppI* _app, int _argc, const char* const* _argv) { + setWindowSize(kDefaultWindowHandle, s_width, s_height); + _app->init(_argc, _argv, s_width, s_height); bgfx::frame(); - setWindowSize(kDefaultWindowHandle, s_width, s_height); - #if BX_PLATFORM_EMSCRIPTEN s_app = _app; emscripten_set_main_loop(&updateApp, -1, 1); @@ -566,7 +566,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return; } - AppI** apps = (AppI**)BX_ALLOC(g_allocator, s_numApps*sizeof(AppI*) ); + AppI** apps = (AppI**)bx::alloc(g_allocator, s_numApps*sizeof(AppI*) ); uint32_t ii = 0; for (AppI* app = getFirstApp(); NULL != app; app = app->getNext() ) @@ -589,7 +589,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ai->m_next = NULL; } - BX_FREE(g_allocator, apps); + bx::free(g_allocator, apps); } int main(int _argc, const char* const* _argv) @@ -666,10 +666,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); cmdShutdown(); - BX_DELETE(g_allocator, s_fileReader); + bx::deleteObject(g_allocator, s_fileReader); s_fileReader = NULL; - BX_DELETE(g_allocator, s_fileWriter); + bx::deleteObject(g_allocator, s_fileWriter); s_fileWriter = NULL; return result; @@ -1010,14 +1010,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void* TinyStlAllocator::static_allocate(size_t _bytes) { - return BX_ALLOC(getAllocator(), _bytes); + return bx::alloc(getAllocator(), _bytes); } void TinyStlAllocator::static_deallocate(void* _ptr, size_t /*_bytes*/) { if (NULL != _ptr) { - BX_FREE(getAllocator(), _ptr); + bx::free(getAllocator(), _ptr); } } @@ -1037,3 +1037,8 @@ extern "C" void* entry_get_native_display_handle() { return entry::getNativeDisplayHandle(); } + +extern "C" bgfx::NativeWindowHandleType::Enum entry_get_native_window_handle_type() +{ + return entry::getNativeWindowHandleType(entry::kDefaultWindowHandle); +} diff --git a/bgfx/examples/common/entry/entry.h b/bgfx/examples/common/entry/entry.h index 2dc7acc7..9867aa87 100644 --- a/bgfx/examples/common/entry/entry.h +++ b/bgfx/examples/common/entry/entry.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -7,6 +7,7 @@ #define ENTRY_H_HEADER_GUARD #include "dbg.h" +#include #include #include #include @@ -297,6 +298,9 @@ namespace entry /// void* getNativeDisplayHandle(); + /// + bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle); + /// void setCurrentDir(const char* _dir); diff --git a/bgfx/examples/common/entry/entry_android.cpp b/bgfx/examples/common/entry/entry_android.cpp index 3a6ac856..de6bd5ab 100644 --- a/bgfx/examples/common/entry/entry_android.cpp +++ b/bgfx/examples/common/entry/entry_android.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -550,16 +550,24 @@ namespace entry return NULL; } + bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle) + { + BX_UNUSED(_handle); + return bgfx::NativeWindowHandleType::Default; + } + int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData) { BX_UNUSED(_thread); int32_t result = chdir("/sdcard/bgfx/examples/runtime"); - BX_ASSERT(0 == result, "Failed to chdir to dir. android.permission.WRITE_EXTERNAL_STORAGE?", errno); + BX_ASSERT(0 == result + , "Failed to chdir to directory (errno: %d, android.permission.WRITE_EXTERNAL_STORAGE?)." + , errno + ); MainThreadEntry* self = (MainThreadEntry*)_userData; result = main(self->m_argc, self->m_argv); -// PostMessage(s_ctx.m_hwnd, WM_QUIT, 0, 0); return result; } diff --git a/bgfx/examples/common/entry/entry_glfw.cpp b/bgfx/examples/common/entry/entry_glfw.cpp index da155024..07167269 100644 --- a/bgfx/examples/common/entry/entry_glfw.cpp +++ b/bgfx/examples/common/entry/entry_glfw.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -875,6 +875,19 @@ namespace entry # endif // BX_PLATFORM_* } + bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle) + { +# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD +# if ENTRY_CONFIG_USE_WAYLAND + return bgfx::NativeWindowHandleType::Wayland; +# else + return bgfx::NativeWindowHandleType::Default; +# endif // ENTRY_CONFIG_USE_WAYLAND +# else + return bgfx::NativeWindowHandleType::Default; +# endif // BX_PLATFORM_* + } + int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData) { BX_UNUSED(_thread); diff --git a/bgfx/examples/common/entry/entry_html5.cpp b/bgfx/examples/common/entry/entry_html5.cpp index 884a563b..998cb950 100644 --- a/bgfx/examples/common/entry/entry_html5.cpp +++ b/bgfx/examples/common/entry/entry_html5.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -427,6 +427,12 @@ namespace entry { return NULL; } + + bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle) + { + BX_UNUSED(_handle); + return bgfx::NativeWindowHandleType::Default; + } } int main(int _argc, const char* const* _argv) diff --git a/bgfx/examples/common/entry/entry_ios.mm b/bgfx/examples/common/entry/entry_ios.mm index f123b668..d5676fef 100644 --- a/bgfx/examples/common/entry/entry_ios.mm +++ b/bgfx/examples/common/entry/entry_ios.mm @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -150,7 +150,7 @@ void setMouseLock(WindowHandle _handle, bool _lock) { if (kDefaultWindowHandle.idx == _handle.idx) { - return s_ctx.m_window; + return s_ctx->m_window; } return NULL; @@ -161,6 +161,12 @@ void setMouseLock(WindowHandle _handle, bool _lock) return NULL; } + bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle) + { + BX_UNUSED(_handle); + return bgfx::NativeWindowHandleType::Default; + } + } // namespace entry using namespace entry; @@ -212,8 +218,6 @@ - (id)initWithFrame:(CGRect)rect return nil; } - s_ctx->m_window = self.layer; - return self; } @@ -335,6 +339,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [m_view setContentScaleFactor: scaleFactor ]; s_ctx = new Context((uint32_t)(scaleFactor*rect.size.width), (uint32_t)(scaleFactor*rect.size.height)); + s_ctx->m_window = m_view.layer; return YES; } diff --git a/bgfx/examples/common/entry/entry_noop.cpp b/bgfx/examples/common/entry/entry_noop.cpp index 22d160f5..1e1e61d0 100644 --- a/bgfx/examples/common/entry/entry_noop.cpp +++ b/bgfx/examples/common/entry/entry_noop.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -78,6 +78,12 @@ namespace entry return NULL; } + bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle) + { + BX_UNUSED(_handle); + return bgfx::NativeWindowHandleType::Default; + } + } // namespace entry int main(int _argc, const char* const* _argv) diff --git a/bgfx/examples/common/entry/entry_osx.mm b/bgfx/examples/common/entry/entry_osx.mm index 948483ca..201033f1 100644 --- a/bgfx/examples/common/entry/entry_osx.mm +++ b/bgfx/examples/common/entry/entry_osx.mm @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -725,6 +725,12 @@ void setMouseLock(WindowHandle _handle, bool _lock) return NULL; } + bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle) + { + BX_UNUSED(_handle); + return bgfx::NativeWindowHandleType::Default; + } + } // namespace entry @implementation AppDelegate diff --git a/bgfx/examples/common/entry/entry_p.h b/bgfx/examples/common/entry/entry_p.h index 59307c2f..b2f1f579 100644 --- a/bgfx/examples/common/entry/entry_p.h +++ b/bgfx/examples/common/entry/entry_p.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -318,7 +318,7 @@ namespace entry void release(const Event* _event) const { - BX_DELETE(getAllocator(), const_cast(_event) ); + bx::deleteObject(getAllocator(), const_cast(_event) ); } private: diff --git a/bgfx/examples/common/entry/entry_sdl.cpp b/bgfx/examples/common/entry/entry_sdl.cpp index 8744b98e..2d5e9c15 100644 --- a/bgfx/examples/common/entry/entry_sdl.cpp +++ b/bgfx/examples/common/entry/entry_sdl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -50,21 +50,24 @@ namespace entry # if BX_PLATFORM_LINUX || BX_PLATFORM_BSD # if ENTRY_CONFIG_USE_WAYLAND - wl_egl_window *win_impl = (wl_egl_window*)SDL_GetWindowData(_window, "wl_egl_window"); - if(!win_impl) - { - int width, height; - SDL_GetWindowSize(_window, &width, &height); - struct wl_surface* surface = wmi.info.wl.surface; - if(!surface) - return nullptr; - win_impl = wl_egl_window_create(surface, width, height); - SDL_SetWindowData(_window, "wl_egl_window", win_impl); - } - return (void*)(uintptr_t)win_impl; -# else - return (void*)wmi.info.x11.window; -# endif + if (wmi.subsystem == SDL_SYSWM_WAYLAND) + { + wl_egl_window *win_impl = (wl_egl_window*)SDL_GetWindowData(_window, "wl_egl_window"); + if(!win_impl) + { + int width, height; + SDL_GetWindowSize(_window, &width, &height); + struct wl_surface* surface = wmi.info.wl.surface; + if(!surface) + return nullptr; + win_impl = wl_egl_window_create(surface, width, height); + SDL_SetWindowData(_window, "wl_egl_window", win_impl); + } + return (void*)(uintptr_t)win_impl; + } + else +# endif // ENTRY_CONFIG_USE_WAYLAND + return (void*)wmi.info.x11.window; # elif BX_PLATFORM_OSX || BX_PLATFORM_IOS return wmi.info.cocoa.window; # elif BX_PLATFORM_WINDOWS @@ -505,7 +508,7 @@ namespace entry { bx::AllocatorI* allocator = getAllocator(); uint32_t size = (uint32_t)bx::getSize(reader); - void* data = BX_ALLOC(allocator, size + 1); + void* data = bx::alloc(allocator, size + 1); bx::read(reader, data, size, bx::ErrorAssert{}); bx::close(reader); ((char*)data)[size] = '\0'; @@ -514,7 +517,7 @@ namespace entry DBG("SDL game controller add mapping failed: %s", SDL_GetError()); } - BX_FREE(allocator, data); + bx::free(allocator, data); } bool exit = false; @@ -1145,18 +1148,38 @@ namespace entry { return NULL; } - # if BX_PLATFORM_LINUX || BX_PLATFORM_BSD # if ENTRY_CONFIG_USE_WAYLAND - return wmi.info.wl.display; -# else - return wmi.info.x11.display; + if (wmi.subsystem == SDL_SYSWM_WAYLAND) + return wmi.info.wl.display; + else # endif // ENTRY_CONFIG_USE_WAYLAND + return wmi.info.x11.display; # else return NULL; # endif // BX_PLATFORM_* } + bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle) + { + SDL_SysWMinfo wmi; + SDL_VERSION(&wmi.version); + if (!SDL_GetWindowWMInfo(s_ctx.m_window[_handle.idx], &wmi) ) + { + return bgfx::NativeWindowHandleType::Default; + } +# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD +# if ENTRY_CONFIG_USE_WAYLAND + if (wmi.subsystem == SDL_SYSWM_WAYLAND) + return bgfx::NativeWindowHandleType::Wayland; + else +# endif // ENTRY_CONFIG_USE_WAYLAND + return bgfx::NativeWindowHandleType::Default; +# else + return bgfx::NativeWindowHandleType::Default; +# endif // BX_PLATFORM_* + } + int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData) { BX_UNUSED(_thread); diff --git a/bgfx/examples/common/entry/entry_windows.cpp b/bgfx/examples/common/entry/entry_windows.cpp index 5d60573d..7db32cd1 100644 --- a/bgfx/examples/common/entry/entry_windows.cpp +++ b/bgfx/examples/common/entry/entry_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -1169,6 +1169,12 @@ namespace entry return NULL; } + bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle) + { + BX_UNUSED(_handle); + return bgfx::NativeWindowHandleType::Default; + } + int32_t MainThreadEntry::threadFunc(bx::Thread* /*_thread*/, void* _userData) { MainThreadEntry* self = (MainThreadEntry*)_userData; diff --git a/bgfx/examples/common/entry/entry_x11.cpp b/bgfx/examples/common/entry/entry_x11.cpp index a5f4b3fa..9d80593f 100644 --- a/bgfx/examples/common/entry/entry_x11.cpp +++ b/bgfx/examples/common/entry/entry_x11.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -771,6 +771,12 @@ namespace entry return s_ctx.m_display; } + bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle) + { + BX_UNUSED(_handle); + return bgfx::NativeWindowHandleType::Default; + } + } // namespace entry int main(int _argc, const char* const* _argv) diff --git a/bgfx/examples/common/entry/input.cpp b/bgfx/examples/common/entry/input.cpp index 770922d6..3fa13801 100644 --- a/bgfx/examples/common/entry/input.cpp +++ b/bgfx/examples/common/entry/input.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 Branimir Karadzic. All rights reserved. + * Copyright 2010-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -292,7 +292,7 @@ void inputInit() void inputShutdown() { - BX_DELETE(entry::getAllocator(), s_input); + bx::deleteObject(entry::getAllocator(), s_input); } void inputAddBindings(const char* _name, const InputBinding* _bindings) diff --git a/bgfx/examples/common/entry/input.h b/bgfx/examples/common/entry/input.h index d51a7f33..00d7bfc6 100644 --- a/bgfx/examples/common/entry/input.h +++ b/bgfx/examples/common/entry/input.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 Branimir Karadzic. All rights reserved. + * Copyright 2010-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/example-glue.cpp b/bgfx/examples/common/example-glue.cpp index 74ff3719..bcc40033 100644 --- a/bgfx/examples/common/example-glue.cpp +++ b/bgfx/examples/common/example-glue.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/font/makefile b/bgfx/examples/common/font/makefile index 554063e5..9fe95f71 100644 --- a/bgfx/examples/common/font/makefile +++ b/bgfx/examples/common/font/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/common/imgui/imgui.cpp b/bgfx/examples/common/imgui/imgui.cpp index 951c118e..da932cb7 100644 --- a/bgfx/examples/common/imgui/imgui.cpp +++ b/bgfx/examples/common/imgui/imgui.cpp @@ -188,6 +188,8 @@ struct OcornutImguiContext void create(float _fontSize, bx::AllocatorI* _allocator) { + IMGUI_CHECKVERSION(); + m_allocator = _allocator; if (NULL == _allocator) @@ -507,13 +509,13 @@ static OcornutImguiContext s_ctx; static void* memAlloc(size_t _size, void* _userData) { BX_UNUSED(_userData); - return BX_ALLOC(s_ctx.m_allocator, _size); + return bx::alloc(s_ctx.m_allocator, _size); } static void memFree(void* _ptr, void* _userData) { BX_UNUSED(_userData); - BX_FREE(s_ctx.m_allocator, _ptr); + bx::free(s_ctx.m_allocator, _ptr); } void imguiCreate(float _fontSize, bx::AllocatorI* _allocator) diff --git a/bgfx/examples/common/imgui/imgui.h b/bgfx/examples/common/imgui/imgui.h index 98072777..ac1bafc0 100644 --- a/bgfx/examples/common/imgui/imgui.h +++ b/bgfx/examples/common/imgui/imgui.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/imgui/makefile b/bgfx/examples/common/imgui/makefile index 1979d957..7e77033b 100644 --- a/bgfx/examples/common/imgui/makefile +++ b/bgfx/examples/common/imgui/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/common/imgui/varying.def.sc b/bgfx/examples/common/imgui/varying.def.sc index 4bbd2c8d..5f4c47ac 100644 --- a/bgfx/examples/common/imgui/varying.def.sc +++ b/bgfx/examples/common/imgui/varying.def.sc @@ -1,8 +1,6 @@ vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); -vec3 v_normal : NORMAL = vec3(0.0, 0.0, 1.0); vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); vec2 a_position : POSITION; -vec4 a_normal : NORMAL; vec4 a_color0 : COLOR0; vec2 a_texcoord0 : TEXCOORD0; diff --git a/bgfx/examples/common/nanovg/fontstash.h b/bgfx/examples/common/nanovg/fontstash.h index 7285d7e0..39a48fb9 100644 --- a/bgfx/examples/common/nanovg/fontstash.h +++ b/bgfx/examples/common/nanovg/fontstash.h @@ -231,7 +231,7 @@ void fons__tt_renderGlyphBitmap(FONSttFontImpl *font, unsigned char *output, int { FT_GlyphSlot ftGlyph = font->font->glyph; int ftGlyphOffset = 0; - int x, y; + unsigned int x, y; FONS_NOTUSED(outWidth); FONS_NOTUSED(outHeight); FONS_NOTUSED(scaleX); diff --git a/bgfx/examples/common/nanovg/makefile b/bgfx/examples/common/nanovg/makefile index 554063e5..9fe95f71 100644 --- a/bgfx/examples/common/nanovg/makefile +++ b/bgfx/examples/common/nanovg/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/common/nanovg/nanovg_bgfx.cpp b/bgfx/examples/common/nanovg/nanovg_bgfx.cpp index fccee88d..3446e405 100644 --- a/bgfx/examples/common/nanovg/nanovg_bgfx.cpp +++ b/bgfx/examples/common/nanovg/nanovg_bgfx.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -58,11 +58,6 @@ namespace NSVG_SHADER_IMG }; - // These are additional flags on top of NVGimageFlags. - enum NVGimageFlagsGL { - NVG_IMAGE_NODELETE = 1<<16, // Do not delete GL texture handle. - }; - struct GLNVGtexture { bgfx::TextureHandle id; @@ -197,7 +192,7 @@ namespace { int old = gl->ctextures; gl->ctextures = (gl->ctextures == 0) ? 2 : gl->ctextures*2; - gl->textures = (struct GLNVGtexture*)BX_REALLOC(gl->allocator, gl->textures, sizeof(struct GLNVGtexture)*gl->ctextures); + gl->textures = (struct GLNVGtexture*)bx::realloc(gl->allocator, gl->textures, sizeof(struct GLNVGtexture)*gl->ctextures); bx::memSet(&gl->textures[old], 0xff, (gl->ctextures-old)*sizeof(struct GLNVGtexture) ); if (gl->textures == NULL) @@ -325,9 +320,12 @@ namespace mem = bgfx::copy(_rgba, tex->height * pitch); } + BX_ASSERT(tex->width >= 0 && tex->width <= bx::max(), "Invalid tex width %d (max: %u)", tex->width, bx::max()); + BX_ASSERT(tex->height >= 0 && tex->height <= bx::max(), "Invalid tex height %d (max: %u)", tex->height, bx::max()); + tex->id = bgfx::createTexture2D( - tex->width - , tex->height + uint16_t(tex->width) + , uint16_t(tex->height) , false , 1 , NVG_TEXTURE_RGBA == _type ? bgfx::TextureFormat::RGBA8 : bgfx::TextureFormat::R8 @@ -342,8 +340,8 @@ namespace , 0 , 0 , 0 - , tex->width - , tex->height + , uint16_t(tex->width) + , uint16_t(tex->height) , mem ); } @@ -376,14 +374,19 @@ namespace w * bytesPerPixel, // stride h); // num + BX_ASSERT(x >= 0 && x <= bx::max(), "Invalid tex x pos %d (max: %u)", x, bx::max()); + BX_ASSERT(y >= 0 && y <= bx::max(), "Invalid tex y pos %d (max: %u)", y, bx::max()); + BX_ASSERT(w >= 0 && w <= bx::max(), "Invalid tex width %d (max: %u)", w, bx::max()); + BX_ASSERT(h >= 0 && h <= bx::max(), "Invalid tex width %d (max: %u)", h, bx::max()); + bgfx::updateTexture2D( tex->id , 0 , 0 - , x - , y - , w - , h + , uint16_t(x) + , uint16_t(y) + , uint16_t(w) + , uint16_t(h) , mem , UINT16_MAX ); @@ -574,9 +577,9 @@ namespace uint16_t* data = (uint16_t*)tib.data; for (uint32_t ii = 0; ii < numTris; ++ii) { - data[ii*3+0] = _start; - data[ii*3+1] = _start + ii + 1; - data[ii*3+2] = _start + ii + 2; + data[ii*3+0] = uint16_t(_start); + data[ii*3+1] = uint16_t(_start + ii + 1); + data[ii*3+2] = uint16_t(_start + ii + 2); } bgfx::setIndexBuffer(&tib); @@ -844,7 +847,7 @@ namespace if (gl->ncalls+1 > gl->ccalls) { gl->ccalls = gl->ccalls == 0 ? 32 : gl->ccalls * 2; - gl->calls = (struct GLNVGcall*)BX_REALLOC(gl->allocator, gl->calls, sizeof(struct GLNVGcall) * gl->ccalls); + gl->calls = (struct GLNVGcall*)bx::realloc(gl->allocator, gl->calls, sizeof(struct GLNVGcall) * gl->ccalls); } ret = &gl->calls[gl->ncalls++]; bx::memSet(ret, 0, sizeof(struct GLNVGcall) ); @@ -857,7 +860,7 @@ namespace if (gl->npaths + n > gl->cpaths) { GLNVGpath* paths; int cpaths = glnvg__maxi(gl->npaths + n, 128) + gl->cpaths / 2; // 1.5x Overallocate - paths = (GLNVGpath*)BX_REALLOC(gl->allocator, gl->paths, sizeof(GLNVGpath) * cpaths); + paths = (GLNVGpath*)bx::realloc(gl->allocator, gl->paths, sizeof(GLNVGpath) * cpaths); if (paths == NULL) return -1; gl->paths = paths; gl->cpaths = cpaths; @@ -874,7 +877,7 @@ namespace { NVGvertex* verts; int cverts = glnvg__maxi(gl->nverts + n, 4096) + gl->cverts/2; // 1.5x Overallocate - verts = (NVGvertex*)BX_REALLOC(gl->allocator, gl->verts, sizeof(NVGvertex) * cverts); + verts = (NVGvertex*)bx::realloc(gl->allocator, gl->verts, sizeof(NVGvertex) * cverts); if (verts == NULL) return -1; gl->verts = verts; gl->cverts = cverts; @@ -890,7 +893,7 @@ namespace if (gl->nuniforms+n > gl->cuniforms) { gl->cuniforms = gl->cuniforms == 0 ? glnvg__maxi(n, 32) : gl->cuniforms * 2; - gl->uniforms = (unsigned char*)BX_REALLOC(gl->allocator, gl->uniforms, gl->cuniforms * structSize); + gl->uniforms = (unsigned char*)bx::realloc(gl->allocator, gl->uniforms, gl->cuniforms * structSize); } ret = gl->nuniforms * structSize; gl->nuniforms += n; @@ -1095,12 +1098,12 @@ namespace } } - BX_FREE(gl->allocator, gl->uniforms); - BX_FREE(gl->allocator, gl->verts); - BX_FREE(gl->allocator, gl->paths); - BX_FREE(gl->allocator, gl->calls); - BX_FREE(gl->allocator, gl->textures); - BX_FREE(gl->allocator, gl); + bx::free(gl->allocator, gl->uniforms); + bx::free(gl->allocator, gl->verts); + bx::free(gl->allocator, gl->paths); + bx::free(gl->allocator, gl->calls); + bx::free(gl->allocator, gl->textures); + bx::free(gl->allocator, gl); } } // namespace @@ -1115,7 +1118,7 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId, bx::AllocatorI* _al struct NVGparams params; struct NVGcontext* ctx = NULL; - struct GLNVGcontext* gl = (struct GLNVGcontext*)BX_ALLOC(_allocator, sizeof(struct GLNVGcontext) ); + struct GLNVGcontext* gl = (struct GLNVGcontext*)bx::alloc(_allocator, sizeof(struct GLNVGcontext) ); if (gl == NULL) { goto error; @@ -1202,10 +1205,14 @@ NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int32_t width, int32_t NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* _ctx, int32_t _width, int32_t _height, int32_t _imageFlags) { BX_UNUSED(_imageFlags); + BX_ASSERT(_width >= 0 && _width <= bx::max(), "Invalid tex width %d (max: %u)", _width, bx::max()); + BX_ASSERT(_height >= 0 && _height <= bx::max(), "Invalid tex height %d (max: %u)", _height, bx::max()); + const uint16_t w = uint16_t(_width); + const uint16_t h = uint16_t(_height); bgfx::TextureHandle textures[] = { - bgfx::createTexture2D(_width, _height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), - bgfx::createTexture2D(_width, _height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT | BGFX_TEXTURE_RT_WRITE_ONLY) + bgfx::createTexture2D(w, h, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), + bgfx::createTexture2D(w, h, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT | BGFX_TEXTURE_RT_WRITE_ONLY) }; bgfx::FrameBufferHandle fbh = bgfx::createFrameBuffer( BX_COUNTOF(textures) @@ -1328,7 +1335,7 @@ void nvgluDeleteFramebuffer(NVGLUframebuffer* _framebuffer) struct NVGparams* params = nvgInternalParams(_framebuffer->ctx); struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr; glnvg__deleteTexture(gl, _framebuffer->image); - BX_DELETE(gl->allocator, _framebuffer); + bx::deleteObject(gl->allocator, _framebuffer); } void nvgluSetViewFramebuffer(bgfx::ViewId _viewId, NVGLUframebuffer* _framebuffer) diff --git a/bgfx/examples/common/nanovg/nanovg_bgfx.h b/bgfx/examples/common/nanovg/nanovg_bgfx.h index ca7a4f20..a0beb926 100644 --- a/bgfx/examples/common/nanovg/nanovg_bgfx.h +++ b/bgfx/examples/common/nanovg/nanovg_bgfx.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -20,6 +20,11 @@ struct NVGLUframebuffer bgfx::ViewId viewId; }; +// These are additional flags on top of NVGimageFlags. +enum NVGimageFlagsGL { + NVG_IMAGE_NODELETE = 1<<16, // Do not delete GL texture handle. +}; + /// NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId, bx::AllocatorI* _allocator); @@ -76,4 +81,7 @@ void nvgluDeleteFramebuffer(NVGLUframebuffer* _framebuffer); /// void nvgluSetViewFramebuffer(bgfx::ViewId _viewId, NVGLUframebuffer* _framebuffer); +/// +int nvgCreateBgfxTexture(struct NVGcontext *_ctx, bgfx::TextureHandle _id, int _width, int _height, int _flags); + #endif // NANOVG_BGFX_H_HEADER_GUARD diff --git a/bgfx/examples/common/packrect.h b/bgfx/examples/common/packrect.h index bdc4c1f8..f1a95b30 100644 --- a/bgfx/examples/common/packrect.h +++ b/bgfx/examples/common/packrect.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/ps/fs_particle.sc b/bgfx/examples/common/ps/fs_particle.sc index f8fc5f27..6e731a14 100644 --- a/bgfx/examples/common/ps/fs_particle.sc +++ b/bgfx/examples/common/ps/fs_particle.sc @@ -1,7 +1,7 @@ $input v_color0, v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/ps/makefile b/bgfx/examples/common/ps/makefile index 554063e5..9fe95f71 100644 --- a/bgfx/examples/common/ps/makefile +++ b/bgfx/examples/common/ps/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # diff --git a/bgfx/examples/common/ps/particle_system.cpp b/bgfx/examples/common/ps/particle_system.cpp index 721779f1..1939bdfd 100644 --- a/bgfx/examples/common/ps/particle_system.cpp +++ b/bgfx/examples/common/ps/particle_system.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -248,7 +248,7 @@ namespace ps Particle& particle = m_particles[m_num]; m_num++; - bx::Vec3 pos(bx::init::None); + bx::Vec3 pos(bx::InitNone); switch (m_shape) { default: @@ -281,7 +281,7 @@ namespace ps break; } - bx::Vec3 dir(bx::init::None); + bx::Vec3 dir(bx::InitNone); switch (m_direction) { default: @@ -331,8 +331,8 @@ namespace ps bx::Aabb aabb = { - { bx::kInfinity, bx::kInfinity, bx::kInfinity }, - { -bx::kInfinity, -bx::kInfinity, -bx::kInfinity }, + { bx::kFloatInfinity, bx::kFloatInfinity, bx::kFloatInfinity }, + { -bx::kFloatInfinity, -bx::kFloatInfinity, -bx::kFloatInfinity }, }; for (uint32_t jj = 0, num = m_num, current = _first @@ -452,7 +452,7 @@ namespace ps } m_emitterAlloc = bx::createHandleAlloc(m_allocator, _maxEmitters); - m_emitter = (Emitter*)BX_ALLOC(m_allocator, sizeof(Emitter)*_maxEmitters); + m_emitter = (Emitter*)bx::alloc(m_allocator, sizeof(Emitter)*_maxEmitters); PosColorTexCoord0Vertex::init(); @@ -482,7 +482,7 @@ namespace ps bgfx::destroy(s_texColor); bx::destroyHandleAlloc(m_allocator, m_emitterAlloc); - BX_FREE(m_allocator, m_emitter); + bx::free(m_allocator, m_emitter); m_allocator = NULL; } @@ -554,7 +554,7 @@ namespace ps ); PosColorTexCoord0Vertex* vertices = (PosColorTexCoord0Vertex*)tvb.data; - ParticleSort* particleSort = (ParticleSort*)BX_ALLOC(m_allocator, max*sizeof(ParticleSort) ); + ParticleSort* particleSort = (ParticleSort*)bx::alloc(m_allocator, max*sizeof(ParticleSort) ); uint32_t pos = 0; for (uint16_t ii = 0, numEmitters = m_emitterAlloc->getNumHandles(); ii < numEmitters; ++ii) @@ -595,7 +595,7 @@ namespace ps index[5] = idx*4+0; } - BX_FREE(m_allocator, particleSort); + bx::free(m_allocator, particleSort); bgfx::setState(0 | BGFX_STATE_WRITE_RGB @@ -687,12 +687,12 @@ namespace ps m_shape = _shape; m_direction = _direction; m_max = _maxParticles; - m_particles = (Particle*)BX_ALLOC(s_ctx.m_allocator, m_max*sizeof(Particle) ); + m_particles = (Particle*)bx::alloc(s_ctx.m_allocator, m_max*sizeof(Particle) ); } void Emitter::destroy() { - BX_FREE(s_ctx.m_allocator, m_particles); + bx::free(s_ctx.m_allocator, m_particles); m_particles = NULL; } diff --git a/bgfx/examples/common/ps/particle_system.h b/bgfx/examples/common/ps/particle_system.h index 38c124ed..13206e82 100644 --- a/bgfx/examples/common/ps/particle_system.h +++ b/bgfx/examples/common/ps/particle_system.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/ps/vs_particle.sc b/bgfx/examples/common/ps/vs_particle.sc index 446ac1d9..3a6bd43a 100644 --- a/bgfx/examples/common/ps/vs_particle.sc +++ b/bgfx/examples/common/ps/vs_particle.sc @@ -2,7 +2,7 @@ $input a_position, a_color0, a_texcoord0 $output v_color0, v_texcoord0 /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/common/shaderlib.sh b/bgfx/examples/common/shaderlib.sh index d4953d04..389a1ec6 100644 --- a/bgfx/examples/common/shaderlib.sh +++ b/bgfx/examples/common/shaderlib.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2022 Branimir Karadzic. All rights reserved. + * Copyright 2011-2023 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/bgfx/examples/makefile b/bgfx/examples/makefile index 225ee641..7bc16837 100644 --- a/bgfx/examples/makefile +++ b/bgfx/examples/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2022 Branimir Karadzic. All rights reserved. +# Copyright 2011-2023 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE # @@ -40,9 +40,9 @@ all: #reused @make -s --no-print-directory build -C 34-mvs #reused @make -s --no-print-directory build -C 35-dynamic @make -s --no-print-directory build -C 36-sky -# @make -s --no-print-directory build -C 37-gpudrivenrendering + @make -s --no-print-directory build -C 37-gpudrivenrendering @make -s --no-print-directory build -C 38-bloom -# @make -s --no-print-directory build -C 39-assao + @make -s --no-print-directory build -C 39-assao @make -s --no-print-directory build -C 40-svt @make -s --no-print-directory build -C 41-tess @make -s --no-print-directory build -C 42-bunnylod @@ -91,9 +91,9 @@ rebuild: #reused @make -s --no-print-directory rebuild -C 34-mvs #reused @make -s --no-print-directory rebuild -C 35-dynamic @make -s --no-print-directory rebuild -C 36-sky -# @make -s --no-print-directory rebuild -C 37-gpudrivenrendering + @make -s --no-print-directory rebuild -C 37-gpudrivenrendering @make -s --no-print-directory rebuild -C 38-bloom -# @make -s --no-print-directory rebuild -C 39-assao + @make -s --no-print-directory rebuild -C 39-assao @make -s --no-print-directory rebuild -C 40-svt @make -s --no-print-directory rebuild -C 41-tess @make -s --no-print-directory rebuild -C 42-bunnylod diff --git a/bgfx/examples/runtime/shaders/dx11/cs_assao_apply.bin b/bgfx/examples/runtime/shaders/dx11/cs_assao_apply.bin index fdd6bb65f47db91330c1dae38ed515374753edd0..02ee6e88aa82cf44af033305505f897a1bac717d 100644 GIT binary patch delta 102 zcmaDM&?Ok_9PGi(00k@z9HsFEiA9OI#Z1Bs3_t_~Y^CuDoW delta 53 zcmeAYd?BFe9PGiy00qnp9HsFEiA9OI#Z1Bs48ja-rSV0n$t6q-28@go4TU$x>2Lr5 D9rz0X diff --git a/bgfx/examples/runtime/shaders/dx11/cs_assao_generate_importance_map.bin b/bgfx/examples/runtime/shaders/dx11/cs_assao_generate_importance_map.bin index fcc1c197a08b46dd31fa6c3aba1445b560542e88..ce5290d2d5fca25b251b03410e8323a9447a1ce1 100644 GIT binary patch delta 85 zcmbO%uu;IrIoN}n0ScHII7;IS5{nXZiC1f`c9X6&M*A7;%ek I)O*Sf0JHB9Z~y=R delta 55 zcmdleFj+v)IoN}Z0ScHHI7;IS5{nXZiXXXXU0$il$5@#|eV0NN@P*Z=?k diff --git a/bgfx/examples/runtime/shaders/dx11/cs_assao_generate_q3base.bin b/bgfx/examples/runtime/shaders/dx11/cs_assao_generate_q3base.bin index aad9afd7ab50c0429e6d2369a0402ec66b7fdfaf..61be1d6eb1dd7b941be0c1a6cad0635b8247c568 100644 GIT binary patch delta 86 zcmdlbJ4w#aIoN}n0Sed{I7;IS5{nXZiXXXtO)^ DDK-m@ diff --git a/bgfx/examples/runtime/shaders/dx11/cs_assao_non_smart_half_apply.bin b/bgfx/examples/runtime/shaders/dx11/cs_assao_non_smart_half_apply.bin index ce6886e214895847e5f06bd2ac3fd520215afe0e..43d7f55e94115a5efec4cd30c6e621030f9e3c21 100644 GIT binary patch delta 102 zcmeyvI*%>ZIoN}n0SZ_cI7;IS5{nXZiu|IoN}Z0ScHII7;IS5{nXZiX1E+a|`l|N)q#uQ+*Q)6c`y9 M81c(&G?HWn0Jhc?Gynhq delta 40 qcmaFMcA8DbIoN}Z0ScHHI7;IS5{nXZi1E+a|`l|N)q#uQ+*Q)6c`y9 M81c(&GXF zkN6h_1_qZ1C+ArSXL`kdtkdv!Uz-pTdDIf53na%3q;-JU28ewaCdR9AE&z%KFt9Rc UZ0y^|$k;h~FO$dSnM^a}0DlK24FCWD delta 98 zcmX@>w9!e%IoN}Z0ScHHI7;IS5{nXZiV!Z diff --git a/bgfx/examples/runtime/shaders/dx11/cs_assao_prepare_depths_and_normals_half.bin b/bgfx/examples/runtime/shaders/dx11/cs_assao_prepare_depths_and_normals_half.bin index 0547b75c853154bf7d8704c6597ae584823ef865..a505bc848f3cdf45f202045743c29c9fc8bfc9ab 100644 GIT binary patch delta 160 zcmdn0c2TX~IoN}n0ScHII7;IS5{nXZiF zkN6KE1_qZ1C+9ey{+~xq#Jgyei;DZbxU>|c3na%3q;-JU28ewaCdR9AE&+-LFt9SL U+}Jmdk+E~~Tqcjrl}vjC0B^e{NdN!< delta 98 zcmcbpwpC5WIoN}Z0ScHHI7;IS5{nXZiXX+!n+OLe delta 37 ncmcb}b)HMcIoN}f0SXuyI7;IS5{nXZiTljTP2%0O@ZNLI3~& delta 110 zcmdmQyV+LOIoN}f0Sed{I7{O*^UA_9Q_ER^Vk{Ho#a;MI<8$*PIoN}n0SXuyI7;IS5{nXZi&5XGXVg10tTM| delta 35 kcmbQuHj_=tIoN}f0SXuy*h=F|GILXzfC7vgW&Se(0BrIGod5s; diff --git a/bgfx/examples/runtime/shaders/dx11/cs_update_instances.bin b/bgfx/examples/runtime/shaders/dx11/cs_update_instances.bin index e546b21447005bb8b584f4191a552de3e5fc550a..3833c00fc7191230f845a5b0fb2b742f4c4a2792 100644 GIT binary patch delta 39 ncmcc2bCpNVIoN}n0SXuyI7;IS5{nXZi@^kP-(u diff --git a/bgfx/examples/runtime/shaders/dx11/fs_albedo_output.bin b/bgfx/examples/runtime/shaders/dx11/fs_albedo_output.bin index 974de8bc91b68a1f805fc6f902daf6ada891be2f..ffef4451b7f6fc19bd051554a2c0712808f2ba0c 100644 GIT binary patch delta 38 pcmeyy{DWE6E!czG^2EGH3_!rhz+M`koS&0lBn0L$Y?Qvu2ms&b3N-)# delta 36 ocmeyt{Eb=KE!cz8^2EGH3_!rhz+M`koS&0lBn0AZl)cRe0M1_uGXMYp diff --git a/bgfx/examples/runtime/shaders/dx11/fs_assao_deferred_combine.bin b/bgfx/examples/runtime/shaders/dx11/fs_assao_deferred_combine.bin index d80c9be53ffc687d6ce67133045ee0ce009a16df..bb7a539c5e57f44fe0a1a44882d073921c863620 100644 GIT binary patch delta 307 zcmX@XzJi0-E!cxQU(U{k0SMS9@`~4k8O8C*`8oMT28;|0Km-IF#qoLhMY)MN28@hQ zA(rC!#C!urCMcJk3_TN=85mq5oSgriR9U`=_qtKn#4xTT|JiAZAWJ7q%v>ns8gYS% zfgu3M-2%i}91M(;B^Y0Gbsu72XmAb{Whk1=%A|zE-K@#P$H)hl7Ge-!V3=&ntnLKV t&A{jYA{*>QflLdacOQXdfnXUIgl6Lu0DA@`SEK+HgQ}UvK6x3l5&#q3H;MoN delta 210 zcmZ3%ae|%KE!cxCU(U{k0SH(o@`}5%7sn^(=j0a|FfuSOGH?{f=j9jWCgvD0G6K0Q z#qo*x28>KVW(hL`gG+>ya~#K2W!rs;D4Do+A)iao7A6J;2OxJX z5Km5Ee9gr9X>ur&5|G;5$i&A8;x;k~PhP_;;RIC4zz9;y&|ohLWLhvVuop21fCLzp eaY1M|CIO(m3=Cj71&A0MPz^}08`ESq79{}dX(=B7 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_assao_gbuffer.bin b/bgfx/examples/runtime/shaders/dx11/fs_assao_gbuffer.bin index d723252cf743b461925c082ae7bb116702f817ae..690bb1cf37c9030ec7b1805fa67597f535cd2534 100644 GIT binary patch delta 126 zcmdnX{D3*oE!cy5;s&!L3_!rdz)>8Zn3I&6l5fDszyL%*fJJBtP{t*~$yx7;n6$R4 z;YNeh*_|~(+j2k}mQ1v|D&!im0muvhVjUpP;$UE$EX!EV*?owCp}{#+lwtBzMhyUI C1081o delta 91 zcmaFByqDR^E!cx?;s&!L3_!rhz)>8Zn3I&6l5fBW;?4k)E)h=7Kf1DP57_FgPkZrA mtohDY5uh-`jER9)`CNjQ0GSRztO>-EEf~ugIVbO6)Bpg>4jHom diff --git a/bgfx/examples/runtime/shaders/dx11/fs_bloom_combine.bin b/bgfx/examples/runtime/shaders/dx11/fs_bloom_combine.bin index 2b41fef87bcf5fa056f144f9ab543a1489ec8966..2ab2a31ccd2beb6f137bae72043e00f2ee9fbfa2 100644 GIT binary patch delta 94 zcmcb?@_;4OE!cxQU(U{k0SH(aIEv#FbCOb1@(man7=Q=}*o)(HGSf3k3>X=qB7_xf I^yOv(0HZV#MgRZ+ delta 70 zcmaFBa)U+3E!cxIU(U{k0SH(aIEv#FbCOb1@(man7=Va@y*NH6Gd-ikfRT}baiW0; LFN(m%P;MpwI3Ev^ diff --git a/bgfx/examples/runtime/shaders/dx11/fs_bokeh_copy.bin b/bgfx/examples/runtime/shaders/dx11/fs_bokeh_copy.bin index 40c1b9428145680263ca26b892a0aa2d49ee0cc0..de3af7ae5bb1cace6a8b615b6c1a2503af24875a 100644 GIT binary patch delta 56 ucmaFH^omK}E!cxQU(U{k0SK5F*o)(n^KX<0fCvcCL^f($GXel*jtgY~ delta 52 scmaFG^o&W{E!cxIU(U{k0SK5F*o)(n^KX<0fC!bpQQw*o070q?V*mgE diff --git a/bgfx/examples/runtime/shaders/dx11/fs_bokeh_copy_linear_to_gamma.bin b/bgfx/examples/runtime/shaders/dx11/fs_bokeh_copy_linear_to_gamma.bin index adfd0a11e02e7cfe1911efb64e97735973730c93..025286af41c33c9efe5e9aec118d188b5f38f1b3 100644 GIT binary patch delta 56 ucmcb{e2ZD%E!cxQU(U{k0SK5F*o)(n^KX<0fCvcCL^f)#W&{9V`U|%J delta 52 scmcb`e2rP#E!cxIU(U{k0SK5F*o)(n^KX<0fC!bpQGYcf06dNhwEzGB diff --git a/bgfx/examples/runtime/shaders/dx11/fs_bokeh_dof_combine.bin b/bgfx/examples/runtime/shaders/dx11/fs_bokeh_dof_combine.bin index 0f459946b73acb1187a5ffda6f87670d6b57da77..cc03954f6f1ffd4776c52b553d18aafe109f7213 100644 GIT binary patch delta 62 xcmZ3(x`kENE!cxQU(U{k0SH(a*o)(n^KX<0fM}w$lpq5Z!HrQtOaPg&49@@n delta 56 wcmdnOx`tKSE!cxIU(U{k0SH(a*o)(n^KX<07$?d~@uCZCObK8D0B2JS(*OVf diff --git a/bgfx/examples/runtime/shaders/dx11/fs_bokeh_dof_debug.bin b/bgfx/examples/runtime/shaders/dx11/fs_bokeh_dof_debug.bin index f5955d4127e63bbc60ac5ba77ed6d81fbe6905b8..8a8347920272d7d2d61b1995152a455b59d2736a 100644 GIT binary patch delta 111 zcmey(-pY~Y7VN>DFK1`N00gWI9HsFEiA9OI#X`Ic3_t_~?8WiP`8oMT28;|0Km-v< UNi8VJFkoavh~QVVF=jq90O_R_zW@LL delta 101 zcmZqW_{|>U7VN>9FK1`N00gWI9HsFEiA9OI#X`Ic3_!%dUL2pCpOar?z{tP=L?C`j TYC%bc0V5-fk6V6Y+I(gJT9FmK diff --git a/bgfx/examples/runtime/shaders/dx11/fs_bokeh_dof_downsample.bin b/bgfx/examples/runtime/shaders/dx11/fs_bokeh_dof_downsample.bin index bebe7ebec75494b2474eeb5917b4e47d1951a580..0252c4408b00a736bee64df5ab5203213edb2a6e 100644 GIT binary patch delta 111 zcmey)+Q^pX7VN>DFK1`N00gWI9HsFEiA9OI#X`Ic3_t_~?8WiP`8oMT28;|0Km-v< UNi8VJFkoavh~QVVF=jRs0OWWTt^fc4 delta 101 zcmZo<`_3BU7VN>9FK1`N00gWI9HsFEiA9OI#X`Ic3_!%dUL2pCpOar?z{tP=L?C`j TYC%bc0V5-fk6V6Y+H58ORooS< diff --git a/bgfx/examples/runtime/shaders/dx11/fs_bokeh_dof_second_pass.bin b/bgfx/examples/runtime/shaders/dx11/fs_bokeh_dof_second_pass.bin index 0cda7938337d7e2c4221344c282976a4d2ba1966..e683ed525179b4050742238114647647b77869c3 100644 GIT binary patch delta 99 zcmeC;pTe);7VN>DFK1`N00gWIT&3}4nW^PLsmUcmKmkSuhKX|GW(*7*rSS!cMTxn^ fLc9tLydbp9FK1`N00gWIT&3}4nW^PLsmUcmKmo>y3gUVkrSS!cMTxn^Lc9tL Zyg*U*;`rqJoctmKMxY9G{>EH&b^wL36U_hs diff --git a/bgfx/examples/runtime/shaders/dx11/fs_bokeh_dof_single_pass.bin b/bgfx/examples/runtime/shaders/dx11/fs_bokeh_dof_single_pass.bin index b77066a599f29784fdb6150b23b07fef0254c424..baa9390878877a598ccbeb9b8c82864a8bff326d 100644 GIT binary patch delta 135 zcmca4{6JX2E!cxQU(U{k0SMR`xJu*8GE>WgQj<%BfC7vR3=`$VqZk-CO5+O>ixP8- rg?JShctL6z*o)(n^KWgQj<%BfC7vY6~z5GO5+O>ixP8-g?JSh kctOgFt?C9VVB delta 15 WcmZ3+wSX<0fCy7$ Iqs??i0AZyMJOBUy delta 69 zcmcb~e3{wCE!cxIU(U{k0SK5GI7;IS5{nXZi-mX@7=Va@y*NH4wV))!fRTX#h*0?( Iou)Ga03bOJIsgCw diff --git a/bgfx/examples/runtime/shaders/dx11/fs_bump.bin b/bgfx/examples/runtime/shaders/dx11/fs_bump.bin index 45117553f34a3565e117ec0cbd90e24ee465ba4c..96b02640a451d12656bb8010f51926d120e05662 100644 GIT binary patch delta 91 zcmbOxy-1qHE!cy5B8##<1A{SJPY3-;jN$il@402b~7(EtDd delta 13 UcmeBU>SJPY3-;jL$il@402br|&j0`b diff --git a/bgfx/examples/runtime/shaders/dx11/fs_denoise_apply_lighting.bin b/bgfx/examples/runtime/shaders/dx11/fs_denoise_apply_lighting.bin index 9b13db3bd1ecb2fa219cac1e790d8b6046a6e82b..50ce8dde4215d239e0895377b8d378496bd62da6 100644 GIT binary patch delta 94 zcmdnMx`Q>;E!cxQU(U{k0SH(a*o)(n^KX<0fCvaUisKV=l2TLh4Hy}rLWC7< I^i5_00EI;oUH||9 delta 86 zcmdnNx`EZ#E!cxIU(U{k0SH(a*o)(n^KX<0fQW&kI6g5aDK#bEfRPa_fM3DJ H&}1e6BC!%& diff --git a/bgfx/examples/runtime/shaders/dx11/fs_denoise_copy.bin b/bgfx/examples/runtime/shaders/dx11/fs_denoise_copy.bin index 40c1b9428145680263ca26b892a0aa2d49ee0cc0..de3af7ae5bb1cace6a8b615b6c1a2503af24875a 100644 GIT binary patch delta 56 ucmaFH^omK}E!cxQU(U{k0SK5F*o)(n^KX<0fCvcCL^f($GXel*jtgY~ delta 52 scmaFG^o&W{E!cxIU(U{k0SK5F*o)(n^KX<0fC!bpQQw*o070q?V*mgE diff --git a/bgfx/examples/runtime/shaders/dx11/fs_denoise_deferred_combine.bin b/bgfx/examples/runtime/shaders/dx11/fs_denoise_deferred_combine.bin index 1b2c4923773d648f6d65ba654cc36e1ac246b229..24c19796df9cc4954ac5e36e3617e5f4a12d49c3 100644 GIT binary patch delta 77 zcmZqVZs&G!3-;j7m$S2B00L$Pj?(yo#G=I9Vj*4z1|R|gj^g;d{G!~%90Nv121cwx I8||D~0b%tINB{r; delta 43 xcmZqYZseA63-;j5m$S2B00L$Pj?(yo#G=I9Vj*4z2HuH=A`?vnH@Z8p0szd_38Vl3 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_denoise_gbuffer.bin b/bgfx/examples/runtime/shaders/dx11/fs_denoise_gbuffer.bin index de874793df51b8fb10753042e0ebe6a5a742a6c4..421ff4662c2e05b92850461f48b1928297bfa467 100644 GIT binary patch delta 54 zcmaDS@Iye+E!czm+{F7S3_!rjz+D<&mYG@}l3J0PBLoy-WMG)+C^FGdc%qXqkldKU G#Q^}r{|^TM delta 76 zcmew%@J>M9E!cze+{F7S3_!rjz+D<&mYG@}l3J0PBLoy-oTw9GE>V#QY%t(gn%N9AYlfM()fbJqQu-{AzlFn aUIvDViNX_$geL|GO-vGkFg8y9#|{9~#S}OI delta 139 zcmZ1|I8jjEE!cxIU(U{k0SGu4xJ%>9GE>V#QY%t(gn%N96BR|`*^A?o^Kbj| mAZ5kzdHF@Ti8%(0j9>wvf|S&Pk_-bzCK#Ut4I3BzX9oa+(jQ&` diff --git a/bgfx/examples/runtime/shaders/dx11/fs_denoise_spatial_5x5.bin b/bgfx/examples/runtime/shaders/dx11/fs_denoise_spatial_5x5.bin index 7c27045a79421a0c5646204cb6d5e9108b776876..b0ec3477ee1c8a523e7719f088d993625a59ec35 100644 GIT binary patch delta 79 zcmX>ocu~;AE!cxQU(U{k0SGu4xJ%>9GE>V#QY%t(gn%N9AYlfM()fbJqQu-{AzlFn aUIvDViNX_$geL|GO-vGkFg8xs;{X8fW)sN( delta 139 zcmca8cu-K@E!cxIU(U{k0SGu4xJ%>9GE>V#QY%t(gn%N96BR|`*^A?o^Kbj| mAZ5kzdHF@Ti8%(0j9>wvf|S&Pk_-bzCK#Ut4I3Bfa{vIe^B(U2 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_denoise_temporal.bin b/bgfx/examples/runtime/shaders/dx11/fs_denoise_temporal.bin index 528198e68cf4aec47584c0d405f24a640e865f6e..5314809bd042c481eb09c8713955617a46945fcc 100644 GIT binary patch delta 172 zcmX>sdRtV%E!cxQU(U{k0SI^)xJu*8GE>WgQj<%BfC7vR3=`$VEg2Zti{q2?bMlJ} zfFeKy1RTZjdHF@Ti8%(0j8Gx2;`p-Eoc!d>l1c+cCa~ty(i7{YDb>I6?=emQvY98D delta 155 zcmcaDdRSD>E!cxIU(U{k0SI^)xJu*8GE>WgQj<%BfC7vY6~qnMi{q2?bMlJ}7=Z#n wL5|}1y!@iv#2f=gMz8=^aeP^7PJVJ`Nu>cJ6Hrru^u%6Ca`kN%XFS3Q08f7=1ONa4 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_denoise_txaa.bin b/bgfx/examples/runtime/shaders/dx11/fs_denoise_txaa.bin index 70da9caf9fb6f4a2044eac06c83d00e608d0230c..cf9363cab81c72700d926bd83f85325e9fcb3839 100644 GIT binary patch delta 181 zcmX@B{!rb`E!cxQU(U{k0SLGlxJ%>9GE>V#QY%t(gn%N9AYlfM()fbJqQu-{AzlFn zUa$~*aeQ)qPJWRAPz4Z8bda_H>MxEjOU=no&Mc`kU}S=72C7U+Ehxz_U}Q#!py^d3 KPVdHJ?7{%tawX~j delta 113 zcmaE;epX%HE!cxIU(U{k0SLGlxJ%>9GE>V#QY%t(gn%N96BR{x*^A?o^KZNI jGo>dc3(Eq_G7K1*8GynJSk!>@A=GTV#V!m0T$CJ| diff --git a/bgfx/examples/runtime/shaders/dx11/fs_downsample.bin b/bgfx/examples/runtime/shaders/dx11/fs_downsample.bin index 7d2b83339480ffbd1da45d7fb907f4c27813987d..7e2ef7cb433086371d0fb6554ab4d225f3e8d685 100644 GIT binary patch delta 74 zcmaFH|AybuE!cxQU(U{k0SK5GxJ%;;GAmMZf-|d9g@7WAAYlg9;`ox(3IiYq3xA{a GYIXo{#1AO| delta 68 zcmaFE|BT<-E!cxIU(U{k0SK5GxJ%;;GAmMZf-|d9g@7WAK+IYkUy@p30A!-^Haf0m F2LLO?4<`Ts diff --git a/bgfx/examples/runtime/shaders/dx11/fs_hdr_blur.bin b/bgfx/examples/runtime/shaders/dx11/fs_hdr_blur.bin index a4be7566d5e925120f84f70ac3dcf54dd9b24888..60ac1d50824825e5dd23bfc291faddd8c2fc7898 100644 GIT binary patch delta 28 icmeC-n!v^D7VN=&`|`2Ts4og6Hmu|SA{fsqj? q!c`n!l3L-MpOar?0OW&&IKV#E!cxIU(U{k0SK5GI7;L5)6$AlON0a%7z8HDiA_`#-spXU69Cz!3UvSg diff --git a/bgfx/examples/runtime/shaders/dx11/fs_hdr_lumavg.bin b/bgfx/examples/runtime/shaders/dx11/fs_hdr_lumavg.bin index d3efc2a695e4636baa1006456e566f318f322b18..5b550b6dbb067094051e0bf345dd5c1570fb106e 100644 GIT binary patch delta 45 xcmZ20xmi-qE!cxQU(U{k0SK5GI7;L5)6$AlON0a%7=UP^zSu+q(T&boJOJ;E3Q_<7 delta 43 xcmdlixmHrfE!cxIU(U{k0SK5GI7;L5)6$AlON0a%7z8HDiA_`#-sqjd0|4Kn3Nioy diff --git a/bgfx/examples/runtime/shaders/dx11/fs_hdr_mesh.bin b/bgfx/examples/runtime/shaders/dx11/fs_hdr_mesh.bin index 488489fb15e0e6c57a8fc86f1086a6b0144c708b..6d13f26675dc63704a9bc414e7d4e31d8ea180b0 100644 GIT binary patch delta 46 zcmeyt_m5BBE!czGY^_ii0}wDXaF)iG2LKT93qSw> diff --git a/bgfx/examples/runtime/shaders/dx11/fs_hdr_skybox.bin b/bgfx/examples/runtime/shaders/dx11/fs_hdr_skybox.bin index 1b298d355038c285ab9f3eb599dfbd6ad80caae3..4a166b2b1e4fe946ecd77626ceb8ff251c91cc8e 100644 GIT binary patch delta 76 zcmX@Xc8<;2E!cxQU(U{k0SK5GSWDw`ODaTwY!;9J17~r3Nos|2X;P{IBLf2vVH4YE H%gqb`SojXy delta 40 tcmX@dc7jdPE!cxIU(U{k0SK5GSWDw`ODaTwY?g`oq7#jTH@dSk0|2`j2&Vu5 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_hdr_tonemap.bin b/bgfx/examples/runtime/shaders/dx11/fs_hdr_tonemap.bin index 55d0931c14844bfe5f98fa4253c65030e1f12dd4..4d443699e321f405a38df5a30debd2a41df1c196 100644 GIT binary patch delta 94 zcmZn=?GrU|3-;i?{rLAA1|VQ(;4FU+I&YU?j zbLO3!@#&*mKKtg*cb%xib-%c9>g3YN=TGCYUR zIx;pRrRk$%^Pk)iecP)wpX+v&N1f{&KRXaqvGo|sKGg_+&+l}d?o^!5&N{c)a2->P zMp*M1;eH#4GVMEK_K;lZbCK8I90)deRlIZSpB_6Xd2KPtt2XvUdwZq3oOs}&!Gevu zU1!H&l8-s}=9+WO(b?_Je0Z-bt~>r}9BmKEdgW#3y7ozz{Tc2-=c;RoH`mi>9ttZu z_lmH_zql>x$nX01Y3;dsw4eE?@YR(kJ>RJ?z z9M9EKyu=$xy8Zd+y3C&KT`GB;cDt6}F=ox-qFi?JeVP7UDMzd=UM{zoD@HYP*dcj6 z`DnHesD$ww8TrFT=Jg5`)(*4Ghe5BV_8$3G8=c}7*OiaK-aajdZRB&+mS1zqtF6Z< z3N@ti1s8n4m!hm%l&La{vJms6cdT zT)>s%LQSE=DB2L0lI(vMm#x|mak))nIWF78v$%kx|AFP)WL~d$_UTE1=)K4kzdZL< zozE6tyGA@$NB6wDsAm3h6|*h6Oas9Ef_@a^r9lg#VY#vU@W#~Hz13%}8x^(-uv zf6t0NOy?`~@pQhz*@H)4F&@5azu}B(%zvkd85m@o@1krx>C2C;i<(0>i)XbG^<|^J zobZ`%oQ%PIqLJ11SJsWaE%p)C zG8v=E&?6`0vYlR0W_lCOy}hPp%69c3@0$qD4j&>hM$JWNyX1*5BnBnmUeUr8G z)nuH_vaiUBzAgz#&Su0Qn5SCio@ykcBUhOb2#`pC+@ij~*>&3wg{q8@6P z`HK1@Imx_pZ|pcf^x@c!;V;kpbWp5-v-QVSTf`&t?QzsP_P{}zzY!;Powyo~G4p!G zZvnms^n^3n+YWc({H|epz-3;q@H@?SME)&NLpRigeBqk`pBQzff~?3x2G(SzR~${Y zncijFlg?P!n?|sr{NB#}2$}9gVN~DgS=JoVJvi_f(X-!36jJ$%4 gfmnx@1L`uYo9dH0;Bvx58_i+;>$Rdwn_vz14-aa!!T9D5want_GaVEM2&ql3l^UZv3oU1rc1#!ln5Cz32U(dG5(QjsX`geBqqu+~?!} ze7w*5-uIql=hDlM{`!v}{BhElOG{t7{^slZuYdW*X?+~PON%$Ie|7)n_0K<}kA0lq zKb_J`*EYBQ{L7zz@+()~xOwZsjX&M`&U=4DAK9GfM|Ay6*L%8lFP*>eMN#-mx?a`A zKp!6Cl&;U{g2#Z*^Ws9ohsS_l6?*CF^;h>U?Oxv9yO1t#U)$Q-yZBPNbLY;U{NW#a z{H^Npi2h`M`NfOpw=c`+(#zY|($h_BwT!;>?KF5TrTLxjuVz!QK8^d&E$7eI&ZPPD zX7haIN=k1mr@4#E%h~4_q<4R{kty%$F(rG;~;;T;yePbj?2!dscFW?XKAI;DHR zdgXb^7j3gs^lpzDjEHC1vjGnb#zw&XaGIYxTX1ICZ>RL#qm(9FSDr}srAN-j-uY(Z z*ZE`L>O9`)s*47*aC>+|=YBTCi0(m&ksQ|7*T-KkwPW5LkMxE|(t|ggU!J@u%J_zK z&A+Xx1TAx4dV>Ui(SF!>;MIX*}u&9`PaX;t`ko8j3FS z=eiRI`N3N&&(y^{{5pU0j>H3(bqdAyoOq5MYF_jYZ z)coQPoNgV&YUimBkF_AXDLnfz9uz%|c0Mh0jiSsv&uN_JC<8Fgb3exaPQNTF$Zo&D zqo16c`vtyuxwbsJUwEcp%wztFZp))z;L$JEqhIFW7253=WTPVcZ}iJ7y#M!0N^yTt z$@9FMdLQxr!uj84X74ZX+%G)3U*Nl6cy_<=Ouv{%zZBh;N58+&M!at7_fK@R^o;tVc}f!|U#Y z;+;57@1e8ew2V0MMSRY$s%M_Lb4*dsagr~#P{%pab5-lsQ%~gBn8td-qsCF@dg7mY zBCBfM%IMY;J?aTnOha-kxb40!Q9hU14^WPYnw^%-qk(s*&wNk0o>BJOa-NeopB+86UY zJ6HSr-rvuj=dwS3@7Uh9lFiHsj96Rg=h{+pjT6_FJ-x5C$TTu0_{3)F+7dT)M+SXZ zZKK}5tF851Td-%+y4j@4G|oU18%)Q^60ZIB)6Gy9)w z8)ft@GL0Mu5A>XMp!6-ZWsOpcvQ~57BCl%R2~78G)T6f6>-MenTwC;9Tb|vwJfmxz zzS>4TnY1}!%P@x5BK7t6o;~lYu@~jxv-t9PUXjyj)w%Mur&(Dr6#!XIftwkBJSw z>#;Y}!(Nl}`@)0k!J6glRMon5hWjF)afJhQ-%@X|O&_)#Q!9;`F;Z`2?%9=+M|a(!6xSV}`_>&Y=jd8Moe$>?Y5^SFKWl%HQto7KKPwk@(_3g?AH5zrz-*UP#YSHCcUwP#BnOMuu)c)pN?BB8T z4$pYzHF(WCJnIYcSl;&QcfLJ1HMW~2?`a>CvH#X1o&0?OrJfAOL5#LH&p6E8!Ib{w zu1wolH#&at=UUj0u?lv64{m?x%n1-3DE3h%R@(=zmEVgZn`LkRj?H$C%{H6 zkvU(m8I}>7Wf7b81vb?AlZ*X=gUmMl{wL#p|IJ+fC;rLpVg6ks*QDfF$Jjdg*W?B^ z!?{7b`EM5g#&-U;>DdqRT6Ek{^o#|DdHdy=eJJw0M?tYYiQdC()pJX(*`SsKjnQN^ xQ*OMEcfR&*OviYjxZySSld=EqPMp?-V&Bze58y)P|54b{{))c7v_+QFzW}M_M!Nt2 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_ibl_mesh.bin b/bgfx/examples/runtime/shaders/dx11/fs_ibl_mesh.bin index 00ea80c62bde95b3dec744ba28a59d1f1fa4efdd..ff96193307ca60c5b310c1004a532ace27c63979 100644 GIT binary patch delta 85 zcmaDV{a)J0E!cxQsQQ~20}!w>aFoUuBo-y+77Ot(FaQw{a2Cgxq*geWCZ!rMGB5zq OL_G;%?7|zft9Su-^b@ZD delta 77 zcmaDa{Zv}dE!cxIsQQ~20}!w>aFoUuBo-y+77Ot(FaQw)XK{QaFoUuBo-y+77Ot(FaQw{a2Cgxq*geWCZ!rMGB5zq OL_G;%?7|zfjaUIL&k}h6 delta 77 zcmZ3^J(pY0E!czeK(3=H0}!w>aFoUuBo-y+77Ot(FaQw)XK{QRUf0k#+j82|tP delta 36 ncmZ3(w2DdEE!cx|Z%Dm00}wDWu$RUs=jY@X34wSUW%(Har!WW? diff --git a/bgfx/examples/runtime/shaders/dx11/fs_oit_wb.bin b/bgfx/examples/runtime/shaders/dx11/fs_oit_wb.bin index 8aae251cbf13f5443d1968296b5b51f78696b6a5..a81aaa10c647a420d46ccb169818e1e342f6d5e0 100644 GIT binary patch delta 38 pcmX@adW2QhE!cy5Z%Dm00}wDWu$RUs=jY@X34wVG8>N>s0RX=d2X<0fM}w;xF`b-iH$Lz7y(18 B5QYE% delta 64 zcmcb{a*jpbE!cxIU(U{k0SH(axQpXUQY)PEbMlJ}3>X<07$+)<3t|)8nD&7Y00c!4 AiU0rr diff --git a/bgfx/examples/runtime/shaders/dx11/fs_oit_wb_separate.bin b/bgfx/examples/runtime/shaders/dx11/fs_oit_wb_separate.bin index 525c8a6eff627dd0df0af4380c7f245ae8245492..2dec6e1d223b1032f294f998ec70e1eff4b45f94 100644 GIT binary patch delta 38 ocmZo;?O>I43-;jN8&Yr000fK-?4|L^`8oMTLSP=lM(J!O0Ifj?Gynhq delta 36 ncmeBRZDW;o3-;jL8&Yr000fK-?4|L^`8oMTLLlBo*=!~Np4|vC diff --git a/bgfx/examples/runtime/shaders/dx11/fs_oit_wb_separate_blit.bin b/bgfx/examples/runtime/shaders/dx11/fs_oit_wb_separate_blit.bin index fb2048ca8e4f475b8cca5b0284cece00017bba7a..304cbde198648234d029e95c0583b548cadc9975 100644 GIT binary patch delta 70 zcmX@da*ajNE!cxQU(U{k0SH(axQpXUQY)PEbMlJ}3>X<0fM}w;xF`b-iH$Lz7y(18 B5QYE% delta 64 zcmcb{a*jpbE!cxIU(U{k0SH(axQpXUQY)PEbMlJ}3>X<07$+)<3t|)8nD&7Y00c!4 AiU0rr diff --git a/bgfx/examples/runtime/shaders/dx11/fs_particle.bin b/bgfx/examples/runtime/shaders/dx11/fs_particle.bin index b5349cad0cce8ec4d21ed45543e26b61cebf41ef..aae4be9366cfd623c3eae54f966f346fab37e46a 100644 GIT binary patch delta 39 rcmaFP@{&c)E!cxQOKjIp1|VQ$;3$nRNGwXsEf!*CU;v_xGTux8*o6sc delta 37 rcmaFK@|;D+E!cxIOKjIp1|VQ$;3$nRNGwXsEf!*CU|`-T=gkBF$8`y3 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_picking_id.bin b/bgfx/examples/runtime/shaders/dx11/fs_picking_id.bin index 1131b5f76a070c341bab126f1743dad2846c0e2a..3acbb977ebd7b44f05b98fa6fc575c8a991e2f2c 100644 GIT binary patch delta 35 mcmeBYp2#fa7VN=2b*}4g1|VQ$U@48yOc4Sz88%9kGXemcnFpBw delta 33 lcmbQp+|MlG7VN<}b*}4g1|VQ$U@48yOc4SxH%gT=0sxMO2bTZ< diff --git a/bgfx/examples/runtime/shaders/dx11/fs_picking_shaded.bin b/bgfx/examples/runtime/shaders/dx11/fs_picking_shaded.bin index 43fc4ef972515e2d141b2f25896bce4accb396ad..3ab09f1ab315218e8da1147910625d07e6ee438c 100644 GIT binary patch delta 13 UcmdnRxr>vvw+!01-G5f&c&j delta 119 zcmdmQwb4q>E!cx|@1cpu7=VDCfvYsWAU`)Cu_!TD2q?ffQ9(?FyEwiiwZbpIC^s?3 cfRT}b5h%e07IR50D9JEjWFlVO#s%|b0KCT_8UO$Q diff --git a/bgfx/examples/runtime/shaders/dx11/fs_raymarching.bin b/bgfx/examples/runtime/shaders/dx11/fs_raymarching.bin index 9aee69bdcbcb1e3e4df3aa7327255396fd10d679..b66c01b194b6dbe0af2968ab29330ef0c695b45e 100644 GIT binary patch delta 61 zcmZ4Nx7^RfE!cybvH8q}2_ce_T2PWX5Df#6tnYqQDd1XQj6BrnQ;@qY2Ma8*}x%s7eB|;1fz+xQ5@p<`0xrsRjKouZG x?8WiP`8oMT28@g_KG;qJMkW|PCAFX=!+?<)#GiOr)Q&PUCLR>uY{_WD3joLjIGO+e diff --git a/bgfx/examples/runtime/shaders/dx11/fs_rsm_gbuffer.bin b/bgfx/examples/runtime/shaders/dx11/fs_rsm_gbuffer.bin index 439498419b8f9b358f9c22449dda0b12fc6f2957..078cb906c5d5068f28de29678948574ad589d0a3 100644 GIT binary patch delta 37 ocmey%^q)z_E!czm@u8Sh1|VQ$U@MI;$;>Me0&^HPN+mM_0Mj7}O8@`> delta 35 ncmey*^p{D>E!cze@u8Sh1|VQ$U@MI;$;>Me0&zCVBr^g4!hZ=# diff --git a/bgfx/examples/runtime/shaders/dx11/fs_rsm_lbuffer.bin b/bgfx/examples/runtime/shaders/dx11/fs_rsm_lbuffer.bin index 24b763040d1b942c969c5bb509766a49ae5c02ad..258c79cc7eb59c9fdd9be5b768514ef0fd96c042 100644 GIT binary patch delta 73 zcmeC>n#pD27VN=&`uy~A1|VQ#;4Y0X%SL4Z XSQr>428v8{5}Ft!3?w%e&td@pyIm5r delta 107 zcmbQq)ypOC7VN=!`uy~A1|VQ#;4Y0X%SMe0&^HPO6fBK0K^#xuK)l5 delta 35 ncmX@jbdpKRE!cze@u8Sh1|VQ$U@MI;$;>Me0&zCV=raNUv_}Z7 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_screen_space_shadows.bin b/bgfx/examples/runtime/shaders/dx11/fs_screen_space_shadows.bin index db283942e57cf7d067a66b160a9f9d99e162867c..55b4f2caad62606217b58df5c2dd4df429e0e9e3 100644 GIT binary patch delta 97 zcmaDa^j#>zE!cxQU(U{k0SH(axJ%>9GE>V#QY%t(gn%N9AYlfM()fbJqQu-{Aszt+ a99GE>V#QY%t(gn%N96BR{d*^A>-QVU8l3>bj| MKtUA##t3;%0HCZ9A^-pY diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_black.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_black.bin index 98e9679bd9fb10c635034b32daa28a22a1f5f9c8..ae5c80e7070da72541b17628cf8ca228d9d7cd50 100644 GIT binary patch delta 12 TcmaFI_>PgqE!cy5BFifP9LWSu delta 12 TcmaFI_>PgqE!cx|BFifP9Ki%k diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin index 8dde3aa0bb022eab253b57fcc4355679a29e3c10..00dd1e0390ed01a007d3f51720e105c9a4c1d2b3 100644 GIT binary patch delta 182 zcmdlcb4kY4E!cybqae$J0SNdQI7{OT5{nXZiw%W#YoUK*dApOarC z#Gn8YnP@Me%fP@>8lRh3l3J9RnB$!y#NYr`i!59$#1H`1P$xZcx|}QngK%klPG)*W qiA!c$T4`}=Kz?~D(9j03nsW*h->6LHV^o`L#3&BJn`0Pn@c;n2`7F`^ delta 175 zcmca4vrR_UE!cyTqae$J0SNdQI7{OT5{nXZiw%Wn0PG)*WiDPb3W@=tZKz?~D s(3}FWIWRew%(S%9;#8m5fE!czGt#R!f1|Se&;4F2k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u>;m(EQ@~;*7+U{BqyK0z(5vR*<5} T>lq~`7cz#YoUK*dApOarC z#Gn8YnP@Me%fP@>8lRh3l3J9RnB$!y#NYr`i!59$#1H`1P$xZcx|}QngK%klPG)*W qiA!c$T4`}=Kz?~D(9j03nsW*h->6LHV^o`L#3&BJn`0RF@c;mmDJ*^f delta 175 zcmdlcGfPI+E!cyTqae$J0SNdQI7{OT5{nXZiw%Wn0PG)*WiDPb3W@=tZKz?~D s(3}FWIWRew%(S%9;#82k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u>;m(EQ@~;*7+U{BqyK0z(5vR*<5} T>lq~`7cz2k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u@y6Uq-pfnT#@03=9IL@g=DxMTvg- dMY)MNL8(ByK7ce#-oPj^c_X9v=3|W4ga8^VIkW%( delta 243 zcmX@0IY(30E!cz8t#R!f1|Se(;4F2k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u@y6Uq-pfnT#@03=9IL@g=DxMTvg- dMY)MNL8(ByK7ce#-oPj^c_X9v=3|VXgaAr|ItTy& delta 243 zcmcbkxkFRdE!cz8t#R!f1|Se(;4FkeNWoeE!cybqae$J0SNdQI7{OT5{nXZiw%W#YoUK*dApOarC z#Gn8YnP@Me%fP@>8lRh3l3J9RnB$!y#NYr`i!59$#1H`1P$xZcx|}QngK%klPG)*W piA!c$T4`}=Kz?~D(9j03nsW*h->6LHV^o`L#3&BJn`0Q$cmT delta 175 zcmca7eMnl?E!cyTqae$J0SNdQI7{OT5{nXZiw%Wn0PG)*WiDPb3W@=tZKz?~D s(3}FWIWRew%(S%9;#82k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u>;m(EQ@~;*7+U{BqyK0z(5vR*<5} T>lq~`7cz#YoUK*dApOarC z#Gn8YnP@Me%fP@>8lRh3l3J9RnB$!y#NYr`i!59$#1H`1P$xZcx|}QngK%klPG)*W piA!c$T4`}=Kz?~D(9j03nsW*h->6LHV^o`L#3&BJn`0QgcmSc%EFb^? delta 175 zcmX>ky-ZrxE!cyTqae$J0SNdQI7{OT5{nXZiw%Wn0PG)*WiDPb3W@=tZKz?~D s(3}FWIWRew%(S%9;#8K0}zNXaF)gwBo-y+78?oy`HUbzgqV>Kg8)>Fy)-^KKPSIP zh(Q4)GSOZ_mw|z&G(I=6B(*3rF~>Vah`|A>7FoDhh#>&1p-y_@bU9fD2I129oXqr$ z5|_-hw9?|#fc)}QprH+5HRlv2zEPRX$EY^hh*4Y&Xnt{gaYkZFez|XAfuR8-D@f7g T^^6je3mL_UP_p?JBbOKeEPp(6 delta 259 zcmeA%c%m=s7VN?4*0^>K0}zNXaF)gwBo-y+78?oy`HU0gMU~h~xa2B5|V3X_=_l_sk(stEBE#}{WLrsS9VCKebNFtRW(PEKG1 Z+J+=-WWdM<6z)S4CZt+&Gb2k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u@y6Uq-pfnT#@03=9IL@g=DxMTvg- dMY)MNL8(ByK7ce#-oPj^c_X9v=3|UWLI5l+IaUAw delta 243 zcmX@3u|h-EE!cz8t#R!f1|Se(;4F2k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u@y6Uq-pfnT#@03=9IL@g=DxMTvg- dMY)MNL8(ByK7ce#-oPj^c_X9v=3|U?LI7NaIjR5v delta 243 zcmaE%aYRGbE!cz8t#R!f1|Se(;4FZ_dL$kE!cybqae$J0SNdRI7{OT5{nXZiw%W#YoUK*dApOarC z#Gn8YnP@Me%fP@>8lRh3l3J9RnB$!y#NYr`i!59$#1H`1P$xZcx|}QngK%klPG)*W uiA!c$T4`}=Kz?~D(9j03nsW*h->6LHV^o`L#3(yCiBTMcHn0PG)*WiDPb3W@=tZKz?~D x(3}FWIWRew%(S%9;#86TJ6b0eU(-|-50ssghGR6P^ diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin index c5e379b0720dd61c0e92e0e9fe90c21642dab4d0..f546b5baf31beb32993fae409a4f3f5197dc37f2 100644 GIT binary patch delta 250 zcmZqQ$Fy-DldD^>2e(_}+BpnBAj-g58efoDl$cv=Cv_MnVh%P%-w>_~iVY z{30O+1(3)@dkI|z2A50?jWEmKQOXG7g z(=$q3GSkvZi&F#g%Ts}dHh|TfQ<(ThWilV5+GHa}*~tqT#V02*ii-j5DUL7BNKDBu a_f0G?GGJr_DV}_vQGy61o4+y&%>@8Gqd*P- delta 267 zcmdnEkEwkhldM~?2d7)(+BpnBAj-g58efoDl$cv=CKmZTPCCgyl23NaV}RmDgMA&V9ZF$4fbyQEEpOXG7g(=$pObCWVt^GX8p z%Ts~o6oAcv$+={vrIi+^LggBO8XqW3W@1#Dtj4G^*@sbDh^IKdI3qD7zuY&mz`%f! kg@JK$Eu+Nb&y1q#$Wq1zjO-8x;#7}f6h!@IIVRz`01YBaXaE2J diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin index 44fb68691c7722f2cd191b1d12c39e7d70da75ec..1d692dfb0d387ec2f7084dde484d24f422eeda7a 100644 GIT binary patch delta 186 zcmbOmwmZz#E!cybqae$J0SNdRI7{OT5{nXZiw%W#YoUK*dApOarC z#Gn8YnP@Me%fP@>8lRh3l3J9RnB$!y#NYr`i!59$#1H`1P$xZcx|}QngK%klPG)*W uiA!c$T4`}=Kz?~D(9j03nsW*h->6LHV^o`L#3(yCiBTMcHn0PG)*WiDPb3W@=tZKz?~D x(3}FWIWRew%(S%9;#86TJ6b0eU(;1g&0sy~uGA;lB diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin index cb262b3357b0045a433f61a54ab726e3369bfd37..e3a42504378004ea6a83ac3f35e8f430701ef11f 100644 GIT binary patch delta 250 zcmZpk!?bn|ldD^>2e(_}+BpnBAj-g58efoDl$cv=Cv_MnVh%P%-w>_~iVY z{30O+1(3)@dkI|z2A50?jWEmKQOXG7g z(=$q3GSkvZi&F#g%Ts}dHh|TfQ<(ThWilV5+GHa}*~tqT#V02*ii-j5DUL7BNKDBu a_f0G?GGJr_DV}_vQGy61o4+#h^#B0#`9G}y delta 267 zcmZ2GhpBlEldM~?2d7)(+BpnBAj-g58efoDl$cv=CKmZTPCCgyl23NaV}RmDgMA&V9ZF$4fbyQEEpOXG7g(=$pObCWVt^GX8p z%Ts~o6oAcv$+={vrIi+^LggBO8XqW3W@1#Dtj4G^*@sbDh^IKdI3qD7zuY&mz`%f! kg@JK$Eu+Nb&y1q#$Wq1zjO-8x;#7}f6h!@IIVS!d0KRNW2LJ#7 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin index 54b5e104794a44f0a661133e1fe90118f6a48c6d..36fb0f819f8855227fdad122f6dbe59457eac210 100644 GIT binary patch delta 264 zcmcbf^f$@XE!czGt#R!f1|Se-;4F2k6_D@)^ZGSf3k zTr$(rN{dqi^2<|!hBkoJoKu+iMrAS|quOL6M%l@}K%BuSC(XbhSQ=lFT2hqgmtT~d unB$aFnkvNb0i!kamnO7sD33qYs< diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin index 50fde0f934f8d23eb572b55fa3e5d541fd822b9b..66a84649b23222d4438255ea6f387455baaadfe1 100644 GIT binary patch delta 264 zcmbQ9y*Jy{E!czGt#R!f1|Se-;4F2k6_D@)^ZGSf3k zTr$(rN{dqi^2<|!hBkoJoKu+iMrAS|quOL6M%l@}K%BuSC(XbhSQ=lFT2hqgmtT~d unB$aFnkvNb0i!kamnwip8d5UoId diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin index 8c6d5e267461861874efce11b9b02ae6c06f1b23..8e64eec5566665daf77fa99d308c54bc309749fc 100644 GIT binary patch delta 182 zcmX>m`$*Q+E!cybqae$J0SNdQI7{OT5{nXZiw%W#YoUK*dApOarC z#Gn8YnP@Me%fP@>8lRh3l3J9RnB$!y#NYr`i!59$#1H`1P$xZcx|}QngK%klPG)*W piA!c$T4`}=Kz?~D(9j03nsW*h->6LHV^o`L#3&BJn`0QWcmdKPEQJ67 delta 175 zcmaDPdrVf=E!cyTqae$J0SNdQI7{OT5{nXZiw%Wn0PG)*WiDPb3W@=tZKz?~D s(3}FWIWRew%(S%9;#82k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u>;m(EQ@~;*7+U{BqyK0z(5vR*<5} T>lq~`7cz<{9 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin index b32b0c3165d55b70dd5ae0b1fa1487844a5abc9d..7bf767f9a928c201159976ecf55dcd841c297337 100644 GIT binary patch delta 182 zcmZ1_dra2VE!cybqae$J0SNdQI7{OT5{nXZiw%W#YoUK*dApOarC z#Gn8YnP@Me%fP@>8lRh3l3J9RnB$!y#NYr`i!59$#1H`1P$xZcx|}QngK%klPG)*W piA!c$T4`}=Kz?~D(9j03nsW*h->6LHV^o`L#3&BJn`0RLcmb+XEHMB8 delta 175 zcmX>myGmBpE!cyTqae$J0SNdQI7{OT5{nXZiw%Wn0PG)*WiDPb3W@=tZKz?~D s(3}FWIWRew%(S%9;#82k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u>;m(EQ@~;*7+U{BqyK0z(5vR*<5} T>lq~`7cz2k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u@y6Uq-pfnT#@03=9IL@g=DxMTvg- dMY)MNL8(ByK7ce#-oPj^c_X9v=3|U$!T>gcIcER> delta 243 zcmcbhwMI+UE!cz8t#R!f1|Se(;4F2k6R48o=HIhpAh zB`%q1X{E)f0r};rKtmhAYR)N4e4{d%k5O&15u@y6Uq-pfnT#@03=9IL@g=DxMTvg- dMY)MNL8(ByK7ce#-oPj^c_X9v=3|Ua!T@I4IlBM= delta 243 zcmaE(bwW$lE!cz8t#R!f1|Se(;4F0KMMMAq diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_texture.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_texture.bin index 96702e2ec6840628e3c80b030fe316dc124f6997..40db6774a03a3cea43928cd55c5024f25718337a 100644 GIT binary patch delta 44 xcmbQiI*(P>E!cxQU(U{k0SK5G*h}M+^KDe`PhUux`#6X E09@n{kN^Mx diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_hblur.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_hblur.bin index 9b6ed6039966e87705c93e444ab180658bbaf439..f0d3daf32d79d4f5b954756fdd8451c806f22309 100644 GIT binary patch delta 46 zcmeC+@8MT+3-;i?{rLAA1|VQ!;3Ffd?bVPIrnn5ZDJ(JY7^08i}< A*#H0l delta 62 zcmeC-@8CCe3-;i={rLAA1|VQ!;3Ffd?bVPFIbV+wAx3}y!aNH7r% diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_hblur_vsm.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_hblur_vsm.bin index 2c8d9fba4164d5db86a216aff90099c128dfdbd8..8a04fac5229d23f6adfedfc27d7a3f23c67f0e49 100644 GIT binary patch delta 46 zcmew$_(f33E!czm_T%4g7=VC@fu}gWI3qD7zuY&mz`%f!g@KWQVWNV>MzdWU0CoNj A761SM delta 62 zcmew&_(9OrE!cze_T%4g7=VC@fu}gWI3qD7zuY&mz`%f!g@F+$j48O$ayJJ6dw~*4 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_packdepth.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_packdepth.bin index a45d2e525b353670cb7068bf14bdbe1d9f1b88bd..bbb3dbd2c6c768d1f2a257a1b8963fe5fda0b3bc 100644 GIT binary patch delta 13 UcmdnSyp5T~E!cy5Bg-a602~wp%K!iX delta 13 UcmdnSyp5T~E!cx|Bg-a602~Sf$p8QV diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_packdepth_linear.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_packdepth_linear.bin index db58239db462347c113e3d3358cca317028d58c6..cf700daa6c75fe4df6844152b923be603bc81360 100644 GIT binary patch delta 13 UcmaFI^p1(eE!cy5BTE(|03fad@c;k- delta 13 UcmaFI^p1(eE!cx|BTE(|03f6T?*IS* diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_packdepth_vsm.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_packdepth_vsm.bin index d0d4ceb700772ac2965029144d60be46397a75f4..c7b9015b77b75f606a9f1864d0f7ede6e63cd015 100644 GIT binary patch delta 13 UcmX@aa)^b+E!cy5Ba0mq032fjasU7T delta 13 UcmX@aa)^b+E!cx|Ba0mq032BZZ~y=R diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_packdepth_vsm_linear.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_packdepth_vsm_linear.bin index 2905185464b4817a4553eff5f8739f4dc7e63cb3..b6129499b5dff2d21ca8bb752e596e4378fcd999 100644 GIT binary patch delta 13 Ucmeyx{EL~zE!cy5Bg;2N03!SZmjD0& delta 13 Ucmeyx{EL~zE!cx|Bg;2N03z}Pl>h($ diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_texture.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_texture.bin index 9c86c1dbf124500895f14222e409f817944d9a72..69ea57862f5fa60c5cff4af15f2a9c82bf27ac3c 100644 GIT binary patch delta 28 icmaFE^nr=jE!cxQU(U{k0SK5TDu_&!7u{%N#RvduyatN^ delta 42 wcmeys^oB{!E!cxIU(U{k0SK5FxQgRTQY)PEbMlJ}7#SECCn|_-w6I_V0OywqIRF3v diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_unpackdepth.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_unpackdepth.bin index c4c4cc68533b83ca359f627df3599697b0452473..6836501a60711db4cc68f4f3fe3b0caaec4aba54 100644 GIT binary patch delta 46 zcmbQovV=w6E!cxQU(U{k0SK5GI7{OT5{nXZi;aYUd`1R_iLw$C<-|97Tw??P>&6OV delta 44 xcmZ3&GLJ>pE!cxIU(U{k0SK5GI7{OT5{nXZi;aYUe8!3L5)+j~HwIi`1OVM)3TOZT diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_unpackdepth_vsm.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_unpackdepth_vsm.bin index f102ce703976d5f1e231ba8992d4d26fb0c3f29e..63e2d7cc3ae65dee5dbf97d2bef077c2110d3d8b 100644 GIT binary patch delta 46 zcmbQovV=w6E!cxQU(U{k0SK5GI7{OT5{nXZi;aYUd`1R_iLw$C<-|97Tw??P>&6OV delta 44 xcmZ3&GLJ>pE!cxIU(U{k0SK5GI7{OT5{nXZi;aYUe8!3L5)+j~HwIi`1OVM)3TOZT diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_vblur.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_vblur.bin index 9b6ed6039966e87705c93e444ab180658bbaf439..f0d3daf32d79d4f5b954756fdd8451c806f22309 100644 GIT binary patch delta 46 zcmeC+@8MT+3-;i?{rLAA1|VQ!;3Ffd?bVPIrnn5ZDJ(JY7^08i}< A*#H0l delta 62 zcmeC-@8CCe3-;i={rLAA1|VQ!;3Ffd?bVPFIbV+wAx3}y!aNH7r% diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_vblur_vsm.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_vblur_vsm.bin index 2c8d9fba4164d5db86a216aff90099c128dfdbd8..8a04fac5229d23f6adfedfc27d7a3f23c67f0e49 100644 GIT binary patch delta 46 zcmew$_(f33E!czm_T%4g7=VC@fu}gWI3qD7zuY&mz`%f!g@KWQVWNV>MzdWU0CoNj A761SM delta 62 zcmew&_(9OrE!cze_T%4g7=VC@fu}gWI3qD7zuY&mz`%f!g@F+$j48O$ayJJ6dw~*4 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_color_lighting.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_color_lighting.bin index 3383a1b26a79cf8fdc1c85a9374a11febf1b4a14..e641a0cdd940ec3ca23a9469f5f60f3c47bb3138 100644 GIT binary patch delta 211 zcmca1{7Kl=E!cxQsQQ~20}${saF@oHWu}&gq*kQn2mwVHLBb4d5K$2Z0R|SZ07q$j zL1Iy2Zm|$U07%V5dofD}2F}v>#N4FJ)VvZQh61Qopjb*~T3Tswst`j1RE)heJ~=-p zzetE-0$6jK0zU%-YiWF1e!39D2C&dZnTe;Rbr~3VisMUCD}qZ>^O7@j3>X=qCSViZ J%*%M10{{vWFr@$h delta 196 zcmew)d_%b2E!cxIsQQ~20}${saF@oHWu}&gq*kQn2mwVHftU>3Ytfld3`RPIo8^H1crSUnL=@}&f`NctrDVe1}`wjrr-IJLt%qR-N Ko3$8EZ~y?YM=`E!cxQU(U{k0SK5G*h}M+^KDe`PhUux`#6X E09@n{kN^Mx diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbackblank.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbackblank.bin index 87d8e706133a2d819cd6347c5121ca8d0c941062..de5196e15fe7c32e9f3350f914539738ff24abb6 100644 GIT binary patch delta 12 TcmaFI_>PgqE!cy5BFifP9LWSu delta 12 TcmaFI_>PgqE!cx|BFifP9Ki%k diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbackcolor.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbackcolor.bin index b6f5521d0ba75afddb25f0700c4ddae9de96a441..ede6f6cbd1a098ea4c6054b470b638fbfe194b56 100644 GIT binary patch delta 37 mcmbQmG>1vnE!cyb0SXuy*h}M+^Kb{vE!cyT0SXuy*h}M+^KPgqE!cy5BFifP9LWSu delta 12 TcmaFI_>PgqE!cx|BFifP9Ki%k diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svfrontcolor.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svfrontcolor.bin index b6f5521d0ba75afddb25f0700c4ddae9de96a441..ede6f6cbd1a098ea4c6054b470b638fbfe194b56 100644 GIT binary patch delta 37 mcmbQmG>1vnE!cyb0SXuy*h}M+^Kb{vE!cyT0SXuy*h}M+^KSAJX3-;jN$il`502YP<#Q*>R delta 13 UcmeBT>SAJX3-;jL$il`502X`#!vFvP diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svsidecolor.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svsidecolor.bin index 5ffeee79100c3fd35578f56ae3adc5e35cd6157c..7ad817c2d1b1ffce89e0204d4c1bd003a2a39689 100644 GIT binary patch delta 38 pcmdnSw1Y|3E!cy5@Aj|R3_!rhz+M`koS&0lBn0L$Y?PK}1OU~}2}S?_ delta 36 ocmdnNw2evHE!cx|@Aj|R3_!rhz+M`koS&0lBn0AZl$B-#0K}vTL;wH) diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svsidetex.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svsidetex.bin index 58aed2ed3e35f2850106f125f135faeba9bae305..bb3c5fcec72934a307884b69e8ad960cadeff09d 100644 GIT binary patch delta 41 scmX@ga-2oME!cy5@Aj|R3_!rhz*QPwTvm`+l$cvA1QuY}D5uT@00t@w%m4rY delta 39 rcmX@ka+F2RE!cx|@Aj|R3_!rhz*QPwTvm`+l$cvA1QOV&pw0vU@%akM diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_texture.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_texture.bin index 9c86c1dbf124500895f14222e409f817944d9a72..69ea57862f5fa60c5cff4af15f2a9c82bf27ac3c 100644 GIT binary patch delta 28 icmaFE^nr=jE!cxQU(U{k0SK5TDu_&!7u{%N#RvduyatN^ delta 42 wcmeys^oB{!E!cxIU(U{k0SK5FxQgRTQY)PEbMlJ}7#SECCn|_-w6I_V0OywqIRF3v diff --git a/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_texture_lighting.bin b/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_texture_lighting.bin index 0ba4a124246f9fded73db550082635bf749121cc..882eab1c1d4beaf7d0118a59229b16f828a54c5a 100644 GIT binary patch delta 197 zcmZ1`dPvmOE!cy*&i9WG0}${raF@oHWu}&gq*kQn2mwVHLBb4d5K$2Z0R|SZ07q$j zL1Iy2Zm|$U07%V5dogte2F}v>#N4FJ)VvZQh61Qopjb*~T3Tswst`j1SZSF8KLZ16 xX?$9Kx)8$xu+T!8iMypm7#O&U<4aO2obz+?iwuCK0?}kXMhTn}n^hQ_I00I@EF}N{ delta 218 zcmX>kx=gg*E!cyz&i9WG0}${raF@oHWu}&gq*kQn2mwVHftU>*ve>M$8fD diff --git a/bgfx/examples/runtime/shaders/dx11/fs_sky_color_banding_fix.bin b/bgfx/examples/runtime/shaders/dx11/fs_sky_color_banding_fix.bin index cea5f3c105f24b613c018a52500beba675769026..1e85dba653158490cddfe86f9de94d4c94de33e2 100644 GIT binary patch delta 46 zcmdnTdx%%bE!cy5d!PGz1|VQ!;3vlE(SUVBb diff --git a/bgfx/examples/runtime/shaders/dx11/fs_sky_landscape.bin b/bgfx/examples/runtime/shaders/dx11/fs_sky_landscape.bin index 24ebf30d3ebed91ff5caa7da6a2d9056b9090f96..54e04304967a1f49b9a3dfc12b3d5a0a1e46779e 100644 GIT binary patch delta 75 zcmbQhH;0eKE!cy5B8#FS0|Q@ad~s=>PibyuUSeKyst|(!10w?nfF!ajkt7sA5)%U? MCf0z^#z}Q-0NfK4DF6Tf delta 65 zcmbQkH-V4EE!cx|B8#F3Uuk@CX`WAMZf0I$UUI4sg8&2LL|Z8#p3?Y&#G=I9)RNSq TVj%_tplGh-!~(I63u@Q^WJVK8 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.bin b/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.bin index 33bec766f886631abd0c3dd1c18da6371efeec44..022f471f12c03a414c9c58ae71db198a949602b8 100644 GIT binary patch delta 47 zcmdm}v|UNTE!cybqae$J0SK5GxJu)5GSf3k0`iN6fC7vR3=`$VC(4U$bbloP026i# Ap8x;= delta 45 ycmdn4v{6aUE!cyTqae$J0SK5GxJu)5GSf3k0`iN6fC7vY6~rehi){3NApigZ*bAiq diff --git a/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin b/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin index d1ee69e0229bed6f0ee550c902e9bc926b9a300d..8ccdda5c9ee611defd5a134a33daf05fd6092bd0 100644 GIT binary patch delta 47 zcmZ3eyIfbnE!cybqae$J0SK5GxJu)5GSf3k0`iN6fC7vR3=`$VC(4U$bdM4P01$c$ A3jhEB delta 45 ycmZ3kyHHooE!cyTqae$J0SK5GxJu)5GSf3k0`iN6fC7vY6~rehi){3d5CZ`J;R_J} diff --git a/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow.bin b/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow.bin index 32085af1cce37ec8350351a711a15f9874d7da06..ae5c80e7070da72541b17628cf8ca228d9d7cd50 100644 GIT binary patch literal 238 zcmZ<@_TXlKgBw7WON5iN=yRV-c2nex|G&7A5m3DEEF(}HB*zTIIzXHN#8ZISGuYh^ z#0SZ90I>oPg8+yRQVRn7KpY$vAK)MC8RF^h$Ka1c4@fPVo)E_%ch?Yx)vJR&TqA6N m@&P~$GB1mRfiV@R{F8zJkjKDa2DBc=W^w?DpaMIHlNbOIa~>W5 delta 108 zcmaFIIFHfVE!cyT0S-EVESCr;=Vf+FT~z0vT^sG!J7aT3>U>6^I7p5eh;@KC0f-AG jT3c&y02v?vqJuqLBLskS01&ePaTW&yqa6bSNG}5brw|cp diff --git a/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin b/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin index aa91b79e9f6a5c8557ff9ec4576dc6f4ee6708c7..e6a6193746b97312b7087683eb8fe4dba253b705 100644 GIT binary patch delta 16 XcmaFK{F<4?E!cy5B8%!q^+SvRE~Et@ delta 16 XcmaFO{F0f)E!cx|B8%!q?E{PeE}#V< diff --git a/bgfx/examples/runtime/shaders/dx11/fs_sss_deferred_combine.bin b/bgfx/examples/runtime/shaders/dx11/fs_sss_deferred_combine.bin index 8ab38ed8ee7c0d07f7c8c57c593fb150de37e373..cde2e77eed344d4c740ce822c3df4632488853b8 100644 GIT binary patch delta 155 zcmdlfbXq9XE!cxQU(U{k0SGu5I7;IS5{nXZi-mX?7=Q=}*o)(n^KX<0fCvaU oisSS0i*gfl3>X=qLO?|+sRbn&28>J~k%<#T&B)fdaq%<`0GTi!+yDRo delta 107 zcmX>tv{OjOE!cxIU(U{k0SGu5I7;IS5{nXZi-mX?7=Va@y*NHOKPSJ)fRTZLaiW0; bFHj&QwV))!fRPC(us{?ffM3PN?Nc}aJ|h}Z diff --git a/bgfx/examples/runtime/shaders/dx11/fs_sss_gbuffer.bin b/bgfx/examples/runtime/shaders/dx11/fs_sss_gbuffer.bin index b6db882c234457b198a814830b70a66582d3acbb..5720547c03690ab4c88cc3b591ea0ad704ad5d88 100644 GIT binary patch delta 96 zcmdlayh}LTE!cxQS@~530}!wX;^LWERp I^iSpl02PN6KmY&$ delta 72 zcmdlbyh&KsE!cxIS@~530}!wsIhWKIB!xDky2 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_sss_linear_depth.bin b/bgfx/examples/runtime/shaders/dx11/fs_sss_linear_depth.bin index 3bd5a442c8ec641e10fdd29c1720a1ac1f7fe631..83c5ff9f27d7482522ec05bde6291954707f6a4e 100644 GIT binary patch delta 75 zcmcc2e3RM9E!cxQU(U{k0SK5GI7;IS5{nXZi-mX?7=Q=}*o)&+QVU8l3>X<0fCy7$ Iqs??i0AWlIIsgCw delta 69 zcmcb~e3{wCE!cxIU(U{k0SK5GI7;IS5{nXZi-mX?7=Va@y*NH4wV))!fRTX#h*0?( Iou)Ga03YlRH~;_u diff --git a/bgfx/examples/runtime/shaders/dx11/fs_sss_unlit.bin b/bgfx/examples/runtime/shaders/dx11/fs_sss_unlit.bin index c47f1e731f5839b4dee95ae0680942fc0735ac0f..73c61b4ff5c54322f14f7efe7fa268519f40cde0 100644 GIT binary patch delta 13 UcmdnSxs8*>E!cy5Bg-Zh034eG+5i9m delta 13 UcmdnSxs8*>E!cx|Bg-Zh034A6*Z=?k diff --git a/bgfx/examples/runtime/shaders/dx11/fs_stencil_color_black.bin b/bgfx/examples/runtime/shaders/dx11/fs_stencil_color_black.bin index 98e9679bd9fb10c635034b32daa28a22a1f5f9c8..ae5c80e7070da72541b17628cf8ca228d9d7cd50 100644 GIT binary patch delta 12 TcmaFI_>PgqE!cy5BFifP9LWSu delta 12 TcmaFI_>PgqE!cx|BFifP9Ki%k diff --git a/bgfx/examples/runtime/shaders/dx11/fs_stencil_color_lighting.bin b/bgfx/examples/runtime/shaders/dx11/fs_stencil_color_lighting.bin index 8f9ca94e8198d9eb701a4bd3ed63b70a0311c49c..d84850ee723983ae5ee22c7ab29528a0362af9ab 100644 GIT binary patch delta 147 zcmeAankkg&7VNV%fE*T(2m?oHd_iJSVs5bzg98I2SctPU zJ~1~bGc~V7h#>$WmXev4R$81Y#E<|LV=s+Q&d3B%p5&RAms%7g#QK1Nm4RX7x@ZmnNzWoC delta 116 zcmbO!)G4Ix7VNV%fE*T(KxuqIVo_plu@Hj;1LH(}QF+eN z_>|1Fw9?{KA%+A7MxYw@()i^3octmoh613HOofTvl41g-@j03486`pKNuGImsYO9T NtPdDiH|~q(0049F9^3!` diff --git a/bgfx/examples/runtime/shaders/dx11/fs_stencil_color_texture.bin b/bgfx/examples/runtime/shaders/dx11/fs_stencil_color_texture.bin index 96702e2ec6840628e3c80b030fe316dc124f6997..40db6774a03a3cea43928cd55c5024f25718337a 100644 GIT binary patch delta 44 xcmbQiI*(P>E!cxQU(U{k0SK5G*h}M+^KDe`PhUux`#6X E09@n{kN^Mx diff --git a/bgfx/examples/runtime/shaders/dx11/fs_stencil_texture.bin b/bgfx/examples/runtime/shaders/dx11/fs_stencil_texture.bin index 9c86c1dbf124500895f14222e409f817944d9a72..69ea57862f5fa60c5cff4af15f2a9c82bf27ac3c 100644 GIT binary patch delta 28 icmaFE^nr=jE!cxQU(U{k0SK5TDu_&!7u{%N#RvduyatN^ delta 42 wcmeys^oB{!E!cxIU(U{k0SK5FxQgRTQY)PEbMlJ}7#SECCn|_-w6I_V0OywqIRF3v diff --git a/bgfx/examples/runtime/shaders/dx11/fs_stencil_texture_lighting.bin b/bgfx/examples/runtime/shaders/dx11/fs_stencil_texture_lighting.bin index ee07d6350b87be93742762d617ee88ab7db6e2fa..efeb9810d378cf6b337232f8dbd8e23378ed95e9 100644 GIT binary patch delta 153 zcmaDZ{98EFE!cy*&i9WG0}yaAu$9J_Wu}&k068om5eAOZ_=3cu#N1*b1_uU4un=cy zd}3}=W@=uE5JLb$EG087t+Y5*h#>(g#$FnqoS&0lB*ahv5}6pUFtJuzih)6(G(IOY hJ)!CDQ-^ delta 122 zcmew@{9IVuE!cyz&i9WG0}yaAu$9J_Wu}&k068o`%uyO&kXV$MTP(!jz`!_BUsRs6 zG(IIWEv>XTRfr*hff1;Ny)-^KKPSIPh@k+eBvWBxx1^XrX?#v*dPYf5dXi^eUTRU0 U5bFa5)`|PXCLR>t_*#Gy0IjhihX4Qo diff --git a/bgfx/examples/runtime/shaders/dx11/fs_terrain.bin b/bgfx/examples/runtime/shaders/dx11/fs_terrain.bin index d9d6e9f680240833302d25011d71d8db9108b247..1d5585ce9b1fe77f720a6692e5c4e0fd593961e9 100644 GIT binary patch delta 13 UcmaFH^o)tcE!cy5BTEt^03Y51*#H0l delta 13 UcmaFH^o)tcE!cx|BTEt^03Xx?*8l(j diff --git a/bgfx/examples/runtime/shaders/dx11/fs_terrain_render.bin b/bgfx/examples/runtime/shaders/dx11/fs_terrain_render.bin index 98e25f77fe48615dde2ea7b4268a4dc014797a6a..5d610b7a849976182331160df88d8e06a8aab351 100644 GIT binary patch delta 73 zcmX@ga+<}#E!cxQU(U{k0SK5GI7;IS5{nXZi-njN7=Q=}*h=Gra}x^;7#SHDu?TFm H;${K>D7OuH delta 67 zcmX@ja+Jl&E!cxIU(U{k0SK5GI7;IS5{nXZi-njN7=Va@tu#J3H?hEgk&%HBjl0o- Gn+X8xgbjB9 diff --git a/bgfx/examples/runtime/shaders/dx11/fs_terrain_render_normal.bin b/bgfx/examples/runtime/shaders/dx11/fs_terrain_render_normal.bin index 1d09b1493006328b5d2260b8d3c6c2a92eb3c320..30bb3f83e98323ec296017af71348da4f0887e6f 100644 GIT binary patch delta 73 zcmcb}a-GG&E!cxQU(U{k0SK5GI7;IS5{nXZi-njN7=Q=}*h=Gra}x^;7#SHDu?TFm H5@!McFOLnK delta 67 zcmcc4a*@T#E!cxIU(U{k0SK5GI7;IS5{nXZi-njN7=Va@tu#J3H?hEgk&%HBjl0o7 GoCyH&%nh3W diff --git a/bgfx/examples/runtime/shaders/dx11/fs_tree.bin b/bgfx/examples/runtime/shaders/dx11/fs_tree.bin index a566382b823f08a2810a4530b653b00cb61d5f11..43debfd1d964ce0220a9aebc05fc665c6391a910 100644 GIT binary patch delta 113 zcmX@leVg0FE!czmWv*E_0}!w=aFxcFWu}$~r6!jM0R*X1qC^&LJR^R dv55v^VhjvC#qlMn6~Pc014c&tG8-HGSphDW8y)}v delta 86 zcmcc3eV$v+E!czeWv*E_0}!w=aFxcFWu}$~r6!jM0RF2r$Gp>RU4c0IA{(+W-In delta 28 icmaFI^oohsE!cxIU(U{k0SK5TDhf|j6542H!3Y3qJO+mV diff --git a/bgfx/examples/runtime/shaders/dx11/fs_update_3d.bin b/bgfx/examples/runtime/shaders/dx11/fs_update_3d.bin index 4ea5a18609b4ba52dba8f7d53c675d3561dcf134..75163a1dad1adf1c75de654f324b54a709525659 100644 GIT binary patch delta 79 zcmZ3?vXaHkE!cxQU(U{k0SK5G*h=F|GILXffE-4U2m@Dfd`W7BbAC>KkpWNym*7T+ G$BY1pjS#*7 delta 41 ucmZ3n&hGG*$7VN>DFK1`N00b-y+@Bl28N09;_?g(ti|yqsTBr5 OJ`e!`3V);jZdL$oQx8@E delta 69 zcmbQl)5Rn27VN>9FK1`N00b-y+@D5iHhQqti|yqsTBr{KrT=S KiMKI)H!A=bs}EKH diff --git a/bgfx/examples/runtime/shaders/dx11/fs_vectordisplay_blit.bin b/bgfx/examples/runtime/shaders/dx11/fs_vectordisplay_blit.bin index 2b070e8fda4dc963f9bbbf24bf6d5edbefe69039..15a94588370d289bfeecd845a863a524d971e6a1 100644 GIT binary patch delta 45 ycmeBV>1UC13-;h12^{3-;h-Z2t6+0SK5GI7;IS5{nXZi-mw(#))!b6BUIwdLLl~0QBw)KL7v# diff --git a/bgfx/examples/runtime/shaders/dx11/fs_vectordisplay_blur.bin b/bgfx/examples/runtime/shaders/dx11/fs_vectordisplay_blur.bin index b10370fc8abeec5ffbbd83a6bae07edf73b9f191..88e91df2c3193d6aa049e3a85a205f86f3ccace9 100644 GIT binary patch delta 45 ycmZ3>vzbTEE!cybvH8WfV@5Z&nfiWLAAx(nX` delta 43 wcmdnYvzAB3E!cyTvH838f00XHDzW@LL diff --git a/bgfx/examples/runtime/shaders/dx11/fs_vectordisplay_fb.bin b/bgfx/examples/runtime/shaders/dx11/fs_vectordisplay_fb.bin index 003ac8467009907d170ff99fe64b65d407aa56ba..20638f1b9f27dafe568bf37f6858a0d45e260182 100644 GIT binary patch delta 45 ycmeBWnam>R7VN>z*!<}s0}wDXaFoUuBo-y+77GEnj0_AD^~EL{h;DQ~#Rvcg#tUlz delta 43 wcmbQt(#s;_7VN>v*!<}s0}wDXaFoUuBo-y+77GEnj1%R=CMpVV^gh7|0QN=;O8@`> diff --git a/bgfx/examples/runtime/shaders/dx11/fs_vt_mip.bin b/bgfx/examples/runtime/shaders/dx11/fs_vt_mip.bin index 455094899b73dcec7098646f3105c0226e3cd525..c5a1dc777c2110d253e829940262c34c05ae1763 100644 GIT binary patch delta 129 zcmZ3)K8u~jE!cy5B8!qG0|S3)d|63+acW6PW?p)6ypa%t00Scf2m~-QFt|iGIp1ct zjhVXDHc3}k_&ooKfP)~}fQiwIIVUgy89>gG$?S~bf@Ta1Y=?lFL4b`#puur+IHNgV S4Fdyf5>#{<_vQnPj~D^jC>;I( delta 143 zcmbQmzKEU0E!cx|B8!qKe`$PKNqli?Nl9j2dU3pw5Q6{%BLf3N3^N0RON5j2Z?-E{ zJR9!FM&5Tz6&3!v6f8F}elh19CI*H8pu**oxf#PJS1}qGSuikgCIPjB0GpsdgCmdz ZDQ9a?0Fn?;!@$4_QxnFvc?aVoMgS2(9&-Qy diff --git a/bgfx/examples/runtime/shaders/dx11/fs_vt_unlit.bin b/bgfx/examples/runtime/shaders/dx11/fs_vt_unlit.bin index 3e149417a637a1294610968b05a35931999ba892..b57bde7bdef3905e1628641add0c5d0867e53192 100644 GIT binary patch delta 141 zcmeC+>fmB=3-;ii$f6|4z`$P`Use)doLW+nnU`K1ZzRMZz`)4BFfmVhV!Q0bd?_F) z&%hAC!oc7X;pBXL`Sj*l7K^K1C28NTWlj78RLKx9@!(?43CutSkn?16E@Qu-83O~` hA)rAZz{Vob;5hj!qd8v<0|RRkRCF2l<~XKROaR`EB;f!6 delta 153 zcmeC+>fmB=3-;ig$f6|5Um9Ol5?`EJQj(dMUL0>E#2~=HIMH5u;$-QGP7**;Him_P z!6m}Uxldi@<*`Xj7LIvGOe*g)NI1OP3wA{+n! diff --git a/bgfx/examples/runtime/shaders/dx11/fs_wf_mesh.bin b/bgfx/examples/runtime/shaders/dx11/fs_wf_mesh.bin index 5fba2483c65894c25d02739437bf0966c1cdcd54..20b6314937f132d5f49e13ca9d8cd8c0e4e3d1c8 100644 GIT binary patch delta 39 rcmbQwvyey5E!cxQ{Aq#^0}wDWaFoUuBo-y+77H;mFaXg;8D=&BzO4vg delta 37 rcmZ3;GoMGsE!cxI{Aq#^0}wDWaFoUuBo-y+77H;mFfebFV`c*YuO|pz diff --git a/bgfx/examples/runtime/shaders/dx11/fs_wf_wireframe.bin b/bgfx/examples/runtime/shaders/dx11/fs_wf_wireframe.bin index 61c940db2575cec7b9be7ae64120d24906d77b20..31503377c32d50e89a6dcbad4f0ab73dba2634c5 100644 GIT binary patch delta 39 rcmZo>Z)KNr3-;hn|FdO10}wDWaFoUuBo-y+77H;mFaXg;nRI3V)9MMA delta 37 rcmZo=Z)TTq3-;hl|FdO10}wDWaFoUuBo-y+77H;mFfebFOJ@cE!ng^Q diff --git a/bgfx/examples/runtime/shaders/dx11/vs_albedo_output.bin b/bgfx/examples/runtime/shaders/dx11/vs_albedo_output.bin index 0cdc2427c020ff4aa126e345f6d5a5603a09478b..349e8cf62d173c18019bfd95ba908c63b8f0c877 100644 GIT binary patch delta 59 zcmcc1@sPtPEZBpa0SGKl%zMPdz*QPwmYG@}P?Vp=0u%&c1_t)h_}u)I)EpKC2Zja) JhK+jqECAoJ4xRu2 delta 55 zcmaFJahF3cEZBpS0SGKl%zMPdz*QPwmYG@}P?Vp=0u%&c_R{#={FKxj76k`}hK)x0 FEC8?z4x9i0 diff --git a/bgfx/examples/runtime/shaders/dx11/vs_assao.bin b/bgfx/examples/runtime/shaders/dx11/vs_assao.bin index 15134f92288a60caea121c69a74d4750fed286e7..87db9fceadc71e222775c67cea1c212cbe53f7b8 100644 GIT binary patch delta 72 zcmeBSnZm*n7VN=2kwrm~0SF#2GBCJAI5~%?mqy>Q%CD&HaTIU&R$~JSGd!5+cu>eS Vf&s`501^&Bp)3vt#>oPVe*kf^5O4qh delta 64 zcmbQj(!;_M7VN<`kwroF4kH7DON5hi?kW&nkftgB3-;h<0D|Z5z8_^~;4F>L%qt7aOf6>tih(c#1AA$FZhlH?4vT^VLjwcD LL|y5PZUL%qt7aOf6>tih(eDX?$*eN@@;^f&)XtL__I~ He*0Je(-aUL diff --git a/bgfx/examples/runtime/shaders/dx11/vs_bokeh_screenquad.bin b/bgfx/examples/runtime/shaders/dx11/vs_bokeh_screenquad.bin index 6c9e1ce72ee58fed1164690c36fc15f12549329c..87db9fceadc71e222775c67cea1c212cbe53f7b8 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_bump.bin b/bgfx/examples/runtime/shaders/dx11/vs_bump.bin index 91baf17bdaaf907965633529f77352ef83e43072..7b7a5b058b052a3a704ab2f28319458724bdf32b 100644 GIT binary patch delta 254 zcmcb@cZx41EZBpa0SGKl%zMPlz*ZVxmYG`40u%sY1_myOKtNG`77K#|RFJ(iJ~uxl zHHSr^fuRAc>y^Vwr&E=(9;ag!K1U04|y0vH$> z0w@1uT+GP2c`nm&W>z5v0S1=IE7_zufeJa5z`RT-&k4-?$fh4Cz`($+q#(cmG=ag5 b38(`~GXrUmoDdc{Ca9bf7CFYrj_kq!)2J=H delta 267 zcmX@bcZE+kEZBpS0SGKl%zMPlz*ZVxmYG`40u%sYE(kZEC_jsZ!GVEgqM@)H3p)dY zON5iN0kh?AAK7aq-@B{d*>O8-03UPwz00fpN<~?F!U@MI;%Sv00fpN<~?F!U@MI;%SCIIZq3%39O diff --git a/bgfx/examples/runtime/shaders/dx11/vs_cubes.bin b/bgfx/examples/runtime/shaders/dx11/vs_cubes.bin index 5cb0c42fd1cfd5764ed99a6273f6a8b2da6a77a8..762007cc96535af5aafaf59ddff1d0a462c934b6 100644 GIT binary patch delta 16 XcmeBT>0x0B3-;ii$fC4Sv delta 16 XcmeBS>0)6C3-;ig$fC4S;|U`GBzgpr diff --git a/bgfx/examples/runtime/shaders/dx11/vs_denoise_gbuffer.bin b/bgfx/examples/runtime/shaders/dx11/vs_denoise_gbuffer.bin index 8ebcbd19aa60d12527b094f7230c955f74a95d24..4853de9cc20d72416a4133f89e00fe5c8ec409c5 100644 GIT binary patch delta 80 zcmZqX>ESm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_fullscreen.bin b/bgfx/examples/runtime/shaders/dx11/vs_fullscreen.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_hdr_blur.bin b/bgfx/examples/runtime/shaders/dx11/vs_hdr_blur.bin index c10d32ffdc015c403650ab85d0410b0fc4218141..ddd151b7e19e1688b332ea852e79bf08f9d36a5a 100644 GIT binary patch delta 45 ycmX@caf(AREZBpa0SInC{{4oDfx9%mEHkw{B()+nhY2Xk$iOgBUS^{uFAD%j5)8`# delta 43 wcmX@bag0MgEZBpS0SInC{{4oDfx9%mEHkw{B()+nhY2XkI8jk%qdhkZ05O;h%>V!Z diff --git a/bgfx/examples/runtime/shaders/dx11/vs_hdr_bright.bin b/bgfx/examples/runtime/shaders/dx11/vs_hdr_bright.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_hdr_lum.bin b/bgfx/examples/runtime/shaders/dx11/vs_hdr_lum.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_hdr_lumavg.bin b/bgfx/examples/runtime/shaders/dx11/vs_hdr_lumavg.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_hdr_mesh.bin b/bgfx/examples/runtime/shaders/dx11/vs_hdr_mesh.bin index 842a2138aa40fe6b6a3fc161903c2afc2b223221..a617a9a2c2b7039736d4ae27fe40a31a48539b63 100644 GIT binary patch delta 45 wcmdnTeu!N$EZBpa0SL_23Ux6taF@pC=BK3Qgk`3dvj9bbc%r=YMvFFP00Sio{Qv*} delta 43 wcmX@azK>l#EZBpS0SL_23Ux6taF@pC=BK3Qgk`3dvj9a|CMrsAv}<7o0P!RW{{R30 diff --git a/bgfx/examples/runtime/shaders/dx11/vs_hdr_skybox.bin b/bgfx/examples/runtime/shaders/dx11/vs_hdr_skybox.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_hdr_tonemap.bin b/bgfx/examples/runtime/shaders/dx11/vs_hdr_tonemap.bin index 31628cd76ff47a62635c474512c3f200fd279cb8..4dfcd18a5acc74fc1316a10ae4973ff0f089b941 100644 GIT binary patch delta 45 ycmbQlF^xkpEZBpa0SInC{{4oDfx9%mEHkw{B()+nhY2Xk$iOgBUV5X&EoJ~W!woF} delta 43 wcmbQnF^NMyEZBpS0SInC{{4oDfx9%mEHkw{B()+nhY2XkI8jl0qumW=03sO;F8}}l diff --git a/bgfx/examples/runtime/shaders/dx11/vs_hextile.bin b/bgfx/examples/runtime/shaders/dx11/vs_hextile.bin index 7702cea0ec3cfe8c79d52b881fd3c6c12bdc39c2..c4e5ff8c28093bd63b3f5ee70fa98e2213f23a52 100644 GIT binary patch literal 861 zcmZuvJxc>Y5S?5uxg&~6W1|*VSXfwHAyyJiawZ_T!wW|Q;TnS)lt3WbSOhy88~q1D znt**8|AIC)g0-#W7x-p(CyHdr+|Isv^RaJ}#PtQjdi_{^w5Tvhug*KyQNP!<0kRP} zgY>d@(z&p`G7S~7mL;mT_bSbe&xdDw@-%s~zltw6?-@inh97OhhOlo~Bi?TwV7Fi{ zY#Szvxx5^QXji-H%Q)A|!imDT(Q1TEYSr46Fg&c%cpReU8OLEY5S?61E*Mc88wI%^V3k5_)KlYWK)m3^5J5;|P@^IQ{3t|%SXgP}Z?Fm2 z+G}H{t^NRO@fY~s?T#Apb6{>~XXd?~+1V>cvsr=MJr0~Z(z#RJU9asG8{72`IH@A; zPIYU0rMB7O`O=I%%LwEvlT(NFo6+FxV6b#~d$oAKzmY(cu_V?ZXcPJjEkrZ(b66c{ z208*&VJ^jWMJ9|Hf9WS*5=JqM3Z+6gFQw_qR2VMgrPT_-xyCq@oJA-l#u!t2ur6C4 zUCQYKK)(w8tS#9k5|yi89oLFxrzS1SUsDh%=+Z*p`=U}s* zRph;R#?O6?dDyF+gU$2NkAv&u{bU+q^3#?tIPwrNGtoHl28uHpm7#<4R0 zBle=d9h?3gn&jVf_8gzl^kO2tlWQAi&y1&! zOiGD)iPkUfe|X;eSE4`hWL{7kXP(AN(RW0fcfmN{WjWOz zXWtN4@jS diff --git a/bgfx/examples/runtime/shaders/dx11/vs_mesh.bin b/bgfx/examples/runtime/shaders/dx11/vs_mesh.bin index 7122b8d542bb35dc5266c219122ce37104b9dab7..c45f0b75e53697a2db6707238581294ee1075069 100644 GIT binary patch delta 62 zcmZ3)2&SpoHc4%z?! delta 56 zcmZ3_y^>o#EZBpS0SKnfb^XoEz+D=jo1c=J6PB4;&H@x=nW!ku!&Vw!l9`*z#L&RN JxX~w>6#%ik4%z?! diff --git a/bgfx/examples/runtime/shaders/dx11/vs_oit.bin b/bgfx/examples/runtime/shaders/dx11/vs_oit.bin index a4af8c35a32110922bb654cbcf97202110b5d1a9..1581688f639fcc4e790dde15f5a62bb6e6e87575 100644 GIT binary patch delta 76 zcmdnQwu8+%EZBpa0SNYn)LSz%u$9J_Wu}(100lspfq@Gm5Kxq##lqkK6=W}s&&^Ls R&0$e!U}#`q*l7Ee2>_JB5t0A^ delta 57 zcmdnNwuwzQEZBpS0SNYn)LSz%u$9J_Wu}(100lsp3&IU3%Fkk9aA07WXehkV?GqCK Dj6DuT diff --git a/bgfx/examples/runtime/shaders/dx11/vs_oit_blit.bin b/bgfx/examples/runtime/shaders/dx11/vs_oit_blit.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_particle.bin b/bgfx/examples/runtime/shaders/dx11/vs_particle.bin index f68346d2fc447adac6d9105220197a4d7dafaa7a..0526cec1745ebe711a6e4bbb38971f45712aa155 100644 GIT binary patch delta 73 zcmeC>oXqJE7VN>z00dcLyLK`&u$9J_Wu}(100lsp0VGgRl%K`I-~bii016})CFT}0 PF*h(UGcatl3T6QSI}Q&C delta 67 zcmbQt*~@7a7VN>v00dcLyLK`&u$9J_Wu}(100lr8$So+!&thS40CPEj+{B{9++rr? L1_tJh4#6w{``r%* diff --git a/bgfx/examples/runtime/shaders/dx11/vs_picking_shaded.bin b/bgfx/examples/runtime/shaders/dx11/vs_picking_shaded.bin index ba1415713eed259947b9a07a318fb67fd2fd8f61..db73ad048eb62ad19b6e605d06b1b310bbf4da0d 100644 GIT binary patch delta 62 zcmZ3=v6@3MEZBpa0SKnfb^XoEz+D=jo1c=J6PB4;&H@w#;)(Lo0t^gnrST=1c_mB? O4GfG73>)3nW^OgMfq7Q d3;`fEZBpS0SNXUns|(bfvYq=FTW@^KDVTT1t`ceQ9)b*C{~u4S{_i8pT)uu ZzyK0wFOAR5Pf5*TQJBEcurZdK9RNMU6y*Q_ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_raymarching.bin b/bgfx/examples/runtime/shaders/dx11/vs_raymarching.bin index 3df6a7e9c07660b7e8a09d4726235217e256b4b2..b1d55423e87a9c7cf0d27c940f58b7d5fb66d083 100644 GIT binary patch delta 16 Xcmeyt@{5HfEZBp4B8$>Sl@KNXFh2y{ delta 16 Xcmeyx@`HsXEZBo{B8$>SjUXlfFgpa@ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_rsm_combine.bin b/bgfx/examples/runtime/shaders/dx11/vs_rsm_combine.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_rsm_gbuffer.bin b/bgfx/examples/runtime/shaders/dx11/vs_rsm_gbuffer.bin index 72f6fc3bb8e5069f9e1482d0f956b9b4760e39b5..3c1b7126e9711e19ad25d9ef611d3bdb93ae857c 100644 GIT binary patch delta 41 vcmdnRwvSCVEZBpa0SF!+ib-W+U@wi&%}+_qVNqaUXkcKNC@sCwgpC;h=r{^X delta 39 tcmdnTwu?i gl3&ik5C9Yp5a(tsjxQ?CRbXUhU_|3?oWsci0IJ#;O8@`> diff --git a/bgfx/examples/runtime/shaders/dx11/vs_rsm_shadow.bin b/bgfx/examples/runtime/shaders/dx11/vs_rsm_shadow.bin index a9e616ca033c272391fec67cbeb83d6d557312f6..5203e96a9091b8461603c3e42fc435e603522cde 100644 GIT binary patch delta 45 wcmZo-YhzOk3-;h<0D{MdVp5qHxJ%=6^HWlD!ZK6KS%9KIJW*bHqs1vE01I3TtpET3 delta 43 wcmZo;YhsfR3-;h-0D{MdVp5qHxJ%=6^HWlD!ZK6KS%9J}6BVU5+MQqm0Qi9muK)l5 diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color.bin index 7dd8ccdec5254597fb2d86a1ebc6deb9b3762daf..a748d1935e1278cf4fcf4fa1930ae60a5b62f3ac 100644 GIT binary patch delta 16 XcmZ3$yoi}4EZBp4B8$>Sl^R9>CL#n< delta 16 XcmZ3)ynvY{EZBo{B8$>SjVeX}CLRP* diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting.bin index 6007d6e438d2a4b110c80241dd9069ad0410bea3..ee4f5f79c50ef3d50f38c1a03f54137a4f18b05f 100644 GIT binary patch delta 86 zcmdnbd7M)*EZBpa0SGt>vOHKAxJ%=6^HWlD!ZK6KS%9KIJW*a+gMopoG(IOYJ)^|8 iq=JQ^0VECtoTc#viA9OI#fD4_2N)O`7&gWvvj6~Q+Y{;l delta 63 zcmX@kxt~)$EZBpS0SGt>vOHKAxJ%=6^HWlD!ZK6KS%9J}6BVTexJu)5GSf3kd`l`= O7#e_L0iqkz6IcNF{}6cq diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting_csm.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting_csm.bin index 7df276f74394b6734619c0a4dfd2379ed7f1e8e7..36dc1571f5dabf7f6c6c085539a90004d3b204d0 100644 GIT binary patch delta 95 zcmew(&?9IZ7VN>z00eH0Yv*tv00eH0Yv*t F*a4YCALRf5 diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting_linear.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting_linear.bin index fca18fdea8eb4a00ee0cd2428d66b1ab5a7ae22c..689a815d887227e665a923fc59004e264e866738 100644 GIT binary patch delta 86 zcmaFP`JPiTEZBpa0SGt>vOHKAxJ%=6^HWlD!ZK6KS%9KIJW*a+gMopoG(IOYJ)^|8 iq=JQ^0VECtoTc#viA9OI#fD4_2N)O`7&gXqvj6~ryA)yo delta 63 zcmaFQ`J7WeEZBpS0SGt>vOHKAxJ%=6^HWlD!ZK6KS%9J}6BVTexJu)5GSf3kd`l`= O7#e_L0iqkzJ6He=z7X*M diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting_linear_csm.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting_linear_csm.bin index c2ac25021abf80cad550f5460a5b60ec29f32d5f..3bd3c12f269f978851ff5c792111f546a8ff87ba 100644 GIT binary patch delta 95 zcmbOuv_{A{EZBpa0SMe0*UsT!U@wi&%}+_qVNqaUXaET_a6?7HGE>W07#KK!c%r_v oFarZ;X?#IqQDSbfArnIb2P058QhH*M)Wj~SiHoE*?n>eS08Qc;V*mgE delta 110 zcmZ1@G)G7}EZBpS0SMe0*UsT!U@wi&%}+_qVNqaUXqYG~uFek?2+K?@4=BpdVqtLL zU;!%UER8QnEK1BRHe_OG;9#7XC_S-GLKLXFI3qD7zuY&mz_+Brh=oCblV#$1>5XR+ FH~@bKA4vcJ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting_linear_omni.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting_linear_omni.bin index 7eff8d9415965dc93e2da95dc873a43c64d57d58..5b5127097b0191ee6454ffd2a3ca948c34e9d60b 100644 GIT binary patch delta 144 zcmX>scv(;}EZBpa0SMe0*UsT!;4Y2N%}+_q3Cm0^X90==@kDuP4F(3z()fbJqQu-{ zLnej>21bw$2CmZhoXqr$65o;v7KRC6wK39?3=I6G@x>X5Df#8Ti3LD8Lly=BMvy^0 QSR{>sIzf^f_poyS02DDJ)Bpeg delta 133 zcmcaCcvw(AEZBpS0SMe0*UsT!;4Y2N%}+_q3Cm0^X90?`OjMNS=PZpcNGwXsEjDCg zXkcKR=r1P9Um9PWk(iQS?weTPTT)@b!f*kowoY0XO~QzUA%GEN5Sq9#3&R9PmW^lF FIRMRjCHnvX diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting_omni.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_lighting_omni.bin index c81967941e54924da58351769dcba3002496b6eb..7a520dda584de8583d83c3a5716d8f2aea06fd10 100644 GIT binary patch delta 144 zcmZ21uvtJcEZBpa0SMe0*UsT!;4Y2N%}+_q3Cm0^X90==@kDuP4F(3z()fbJqQu-{ zLnej>21bw$2CmZhoXqr$65o;v7KRC6wK39?3=I6G@x>X5Df#8Ti3LD8Lly=BMvy^0 QSR{>sIzf^f_oTA}0PqDP@c;k- delta 133 zcmdliuvkDoEZBpS0SMe0*UsT!;4Y2N%}+_q3Cm0^X90?`OjMNS=PZpcNGwXsEjDCg zXkcKR=r1P9Um9PWk(iQS?weTPTT)@b!f*kowoY0XO~QzUA%GEN5Sq9#3&R9PmW^l9 F*#WFHCKvz! diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_texture.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_color_texture.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_depth.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_depth.bin index 7dd8ccdec5254597fb2d86a1ebc6deb9b3762daf..a748d1935e1278cf4fcf4fa1930ae60a5b62f3ac 100644 GIT binary patch delta 16 XcmZ3$yoi}4EZBp4B8$>Sl^R9>CL#n< delta 16 XcmZ3)ynvY{EZBo{B8$>SjVeX}CLRP* diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_hblur.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_hblur.bin index f1b5faa2a9bb991c21b92670879d62d117dc40cb..f29c1742268749167f196d432a141a062e1c20d4 100644 GIT binary patch delta 48 zcmeC>oXn{h7VN>z00g%m|9->Fz+D<&mYG@}l3J0P!vqv%WMG&mFFnyhc4M#=3jkf? B4T=B& delta 46 zcmbQt*~=*(7VN>v00g%m|9->Fz+D<&mYG@}l3J0P!vqv%oTw;0(N20}v;_+QNMQ|< diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_packdepth.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_packdepth.bin index 941e2697977cd0cbc7c77571aeb104cbbaad1234..5806f71a4e1edceb923534868071249566bd1122 100644 GIT binary patch delta 16 Xcmeyt{EL|-EZBp4B8$>Sl`D(@F(L(8 delta 16 Xcmeyx{DYY#EZBo{B8$>SjZ2IGF&+h4 diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_packdepth_linear.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_packdepth_linear.bin index ec4751153070770fe153ea7151b46c4a5b9d200b..d2f3edeb47ec4eea45056124a620e77a27c684ed 100644 GIT binary patch delta 16 XcmZo*X<}gs3-;ii$fC4SSm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_texture_lighting.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_texture_lighting.bin index fa30a2c39e1a6b796522b92043d45341ed5d623f..9f30acdcb3b80312ca432ac1eaef3f50f777ae18 100644 GIT binary patch delta 45 wcmcb^{(xOEEZBpa0SM}R|M)O5aF@pC=BK3Qgk`3dvj9bbc%r=YMvEoP03UY?>i_@% delta 43 wcmaFBeurH?EZBpS0SM}R|M)O5aF@pC=BK3Qgk`3dvj9a|CMrsAv|Gds01M>{?EnA( diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_unpackdepth.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_unpackdepth.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_vblur.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowmaps_vblur.bin index e71543339536a4d27614fb110c408a46a2e6b75d..01a78ec9c144765c9cbd088a580ca3f9af3e17b7 100644 GIT binary patch delta 48 zcmeC>oXn{h7VN>z00g%m|9->Fz+D<&mYG@}l3J0P!vqv%WMG&mFFnyhc4M#=3jkf? B4T=B& delta 46 zcmbQt*~=*(7VN>v00g%m|9->Fz+D<&mYG@}l3J0P!vqv%oTw;0(N20}v;_+QNMQ|< diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_color_lighting.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_color_lighting.bin index 5307fde9dab6c2ee3b7fd3dffd0f6d2706a28bae..7ebe9c4b1f8ae29ac140755df99d982ac681a72d 100644 GIT binary patch delta 45 wcmdnSzKdNkEZBpa0SJPszlkw1aF@pC=BK3Qgk`3dvj9bbc%r=YMvFRT01I0SKL7v# delta 43 wcmdnRzKvZzEZBpS0SJPszlkw1aF@pC=BK3Qgk`3dvj9a|CMrsAw5wqT0QklWK>z>% diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_color_texture.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_color_texture.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_svback.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_svback.bin index 28d83c26177588728b8b8bd7cbf9f548dd2a01d3..bead5d5c7588d48f77c8e9f3c2550c614ada4a7a 100644 GIT binary patch delta 19 acmaFB@`QyYEZBp4B8$>Q6|IdvB1`~1umyGi delta 19 acmaFD@_>aUEZBo{B8$>Q4ULUKLQDWXz6E*! diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_svfront.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_svfront.bin index 7dd8ccdec5254597fb2d86a1ebc6deb9b3762daf..a748d1935e1278cf4fcf4fa1930ae60a5b62f3ac 100644 GIT binary patch delta 16 XcmZ3$yoi}4EZBp4B8$>Sl^R9>CL#n< delta 16 XcmZ3)ynvY{EZBo{B8$>SjVeX}CLRP* diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_svside.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_svside.bin index d8059b559a91bfb4c2c7df7599f22700d0ec1f56..7175c50f829557d796554598cca144d66f5582aa 100644 GIT binary patch delta 19 acmeBT>tkaH3-;ii$f7h+MQfwaJ|+M&Fa>x3 delta 19 acmeBU>tbUG3-;ig$f7h+Lt|sm9wq=YJ_URL diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_texture.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_texture.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_texture_lighting.bin b/bgfx/examples/runtime/shaders/dx11/vs_shadowvolume_texture_lighting.bin index 068fde4f9ef41052986bb9777262166ca1ac9f23..1fd3583cfecbe9a5773d77df60b594de310515f8 100644 GIT binary patch delta 45 wcmcb^{(xOEEZBpa0SM}R|M)O5aF@pC=BK3Qgk`3dvj9bbc%r=YMvEoP03UY?>i_@% delta 43 wcmaFBeurH?EZBpS0SM}R|M)O5aF@pC=BK3Qgk`3dvj9a|CMrsAv|Gds01M>{?EnA( diff --git a/bgfx/examples/runtime/shaders/dx11/vs_sky.bin b/bgfx/examples/runtime/shaders/dx11/vs_sky.bin index fbe836b521c4369d26323aada1b130972b1ff8be..d6c0d0cf5a15cf465ca8bfa8795c20077b53527b 100644 GIT binary patch delta 74 zcmeB_m@L5(7VN=2kwsCOfkCh|zBs$mr!+S+FEKAUH6k*Ki9vvYk%3{Njl{$tad8F) d-qQHYyt1&&)bfC${45rR1_l-ehK)77+yLI}6T1Ka delta 65 zcmbO%(J8?a7VN<}kwsBlur$6nyV9pLH#09WFF7?LGKz^ofPrzMgM<)IX?#IyQEHWQ Uerj486RQCO>%=_Cjh$WG0Buqe6#xJL diff --git a/bgfx/examples/runtime/shaders/dx11/vs_sky_landscape.bin b/bgfx/examples/runtime/shaders/dx11/vs_sky_landscape.bin index ba776106dc6a936ee435ceeb92cd7e53a06dd88a..0e05f90274a3d94e9ac69c780f67d9a82a1e210e 100644 GIT binary patch delta 41 ucmZ3&wt`JIEZBpa0SG2;FgwD;z+M`ko1c=J!=k{z&;S&amfmRcfe8TJxC-3> delta 39 tcmZ3%wuDVOEZBpS0SG2;FgwD;z+M`ko1c=J!=k{z&@fR}dZX1lCIHOX3f}+# diff --git a/bgfx/examples/runtime/shaders/dx11/vs_sms_mesh.bin b/bgfx/examples/runtime/shaders/dx11/vs_sms_mesh.bin index 8a38cf28df2980c2e7fd2cbfbb3713c2f33312a7..2749f2b3ba4f73cdc8cbc492b0cccc95b5e017b7 100644 GIT binary patch delta 66 zcmdnWxtmilEZBpa0SGt>vOJg>xJ%=6^HWlD!ZK6KS%9KIJW*a+gn@ypG(IOYJ)^|8 Pq=JQ^0VKZBE1LxX162=T delta 60 zcmdnZxs_8sEZBpS0SGt>vOJg>xJ%=6^HWlD!ZK6KS%9J}6BVTexJu)5GSf3kd`l`= N7#bK@HU?y~006^04`2WQ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_sms_shadow.bin b/bgfx/examples/runtime/shaders/dx11/vs_sms_shadow.bin index 7dd8ccdec5254597fb2d86a1ebc6deb9b3762daf..a748d1935e1278cf4fcf4fa1930ae60a5b62f3ac 100644 GIT binary patch delta 16 XcmZ3$yoi}4EZBp4B8$>Sl^R9>CL#n< delta 16 XcmZ3)ynvY{EZBo{B8$>SjVeX}CLRP* diff --git a/bgfx/examples/runtime/shaders/dx11/vs_sms_shadow_pd.bin b/bgfx/examples/runtime/shaders/dx11/vs_sms_shadow_pd.bin index fcd6e07ffe96f039473e18f3b41a7ee9d4134dd6..c9d088d1e9f6602a8adf83456e469799059d85d8 100644 GIT binary patch delta 16 Xcmeyt{EL|-EZBp4B8$>Sl`D(@F(L(8 delta 16 Xcmeyx{DYY#EZBo{B8$>SjZ2IGF&+h4 diff --git a/bgfx/examples/runtime/shaders/dx11/vs_sss_gbuffer.bin b/bgfx/examples/runtime/shaders/dx11/vs_sss_gbuffer.bin index 5a5260beab4c21842de35acb499c2496d4b03a99..b3bdf3c19384d9e479e5d32e3f9f70796a5d4db4 100644 GIT binary patch delta 41 vcmdnNv4=x8EZBpa0SJSm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_stencil_color.bin b/bgfx/examples/runtime/shaders/dx11/vs_stencil_color.bin index 7dd8ccdec5254597fb2d86a1ebc6deb9b3762daf..a748d1935e1278cf4fcf4fa1930ae60a5b62f3ac 100644 GIT binary patch delta 16 XcmZ3$yoi}4EZBp4B8$>Sl^R9>CL#n< delta 16 XcmZ3)ynvY{EZBo{B8$>SjVeX}CLRP* diff --git a/bgfx/examples/runtime/shaders/dx11/vs_stencil_color_lighting.bin b/bgfx/examples/runtime/shaders/dx11/vs_stencil_color_lighting.bin index eed65c5ec6efe46a3ade361ec8189ca01a24aaa1..c942259c2b6f9802ec4b9a74913a4128fc5eb285 100644 GIT binary patch delta 45 wcmbQiK8IZ~EZBpa0SJPszlkw1aF@pC=BK3Qgk`3dvj9bbc%r=YMvDYy007SlSm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_stencil_texture.bin b/bgfx/examples/runtime/shaders/dx11/vs_stencil_texture.bin index 13b8211d69b80ce9d14fdadc27430e26be308344..22a962034a6e586bd3f82b556a1c5a6a65405a0f 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_stencil_texture_lighting.bin b/bgfx/examples/runtime/shaders/dx11/vs_stencil_texture_lighting.bin index a51b08affd3c2fd904959d5f56b1d961bfb7d1c6..50e0f4ea97f5e4fdb3b07dd81bbf1ad0ea8002c4 100644 GIT binary patch delta 45 wcmcb^{(xOEEZBpa0SM}R|M)O5aF@pC=BK3Qgk`3dvj9bbc%r=YMvEoP03UY?>i_@% delta 43 wcmaFBeurH?EZBpS0SM}R|M)O5aF@pC=BK3Qgk`3dvj9a|CMrsAv|Gds01M>{?EnA( diff --git a/bgfx/examples/runtime/shaders/dx11/vs_terrain.bin b/bgfx/examples/runtime/shaders/dx11/vs_terrain.bin index 711accf10c7d331457d580cced9d6d5087335723..291aa918f67d39628794a8f529ce2d2a8e5e8b83 100644 GIT binary patch delta 16 XcmX@ba)yN^EZBp4B8$>S6*VRRDt`o1 delta 16 XcmX@Za*Bl|EZBo{B8$>S4HYH;DtiP| diff --git a/bgfx/examples/runtime/shaders/dx11/vs_terrain_height_texture.bin b/bgfx/examples/runtime/shaders/dx11/vs_terrain_height_texture.bin index d2d9715edd09bebbcb7b8c78ba8bd179cd01fe29..b432e7683659a94eb8c84de2a21de708b790183c 100644 GIT binary patch delta 61 zcmey&`jeFvbX|xgEZBp4B8!p<0|Q5Cd_iJSVs0@LlLG@20|>B{#=GPu7AP<>FaQyTz{a4z F8~_=04qyNP delta 61 zcmcaEbY6%hEZBo{B8!p^M`?UPVo_plF%y#m0}}%S16yglOKxI;0wV(h5TS54M*Zag E0M!%@UH||9 diff --git a/bgfx/examples/runtime/shaders/dx11/vs_tree.bin b/bgfx/examples/runtime/shaders/dx11/vs_tree.bin index c78dc45dd2f9ee81dcf25624a0f3b158c5eeef45..8816c25c75d964b115a7191d67a695c2c72bc0e8 100644 GIT binary patch delta 45 wcmdnMv4ul1EZBpa0SI2^nsqZVaF@pC=BK3Qgk`3dvj9bbc%r=YMvEWJ01|`??EnA( delta 43 wcmdnOv4KNAEZBpS0SI2^nsqZVaF@pC=BK3Qgk`3dvj9a|CMrsAwEM;k0RM*z?*IS* diff --git a/bgfx/examples/runtime/shaders/dx11/vs_update.bin b/bgfx/examples/runtime/shaders/dx11/vs_update.bin index 927b92914928a2a40f2b9aa2613a713c003cd470..6b42d2092f5c86bb09db793b96dbd7f339848170 100644 GIT binary patch delta 16 XcmbQlGKGaDEZBp4B8$>Sm3NE)C4K~| delta 16 XcmbQjGKqyHEZBo{B8$>SjW>({C3*y^ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_vectordisplay_fb.bin b/bgfx/examples/runtime/shaders/dx11/vs_vectordisplay_fb.bin index 3df6a7e9c07660b7e8a09d4726235217e256b4b2..b1d55423e87a9c7cf0d27c940f58b7d5fb66d083 100644 GIT binary patch delta 16 Xcmeyt@{5HfEZBp4B8$>Sl@KNXFh2y{ delta 16 Xcmeyx@`HsXEZBo{B8$>SjUXlfFgpa@ diff --git a/bgfx/examples/runtime/shaders/dx11/vs_vt_generic.bin b/bgfx/examples/runtime/shaders/dx11/vs_vt_generic.bin index 6e21fde9b8729541defcec7e46ff4a4a8461c77f..511467d9f25a16695174db8fe495aaa37a078afd 100644 GIT binary patch delta 59 zcmZ3>x{=i=EZBpa0SNNt>};4AxJu*8GE>U~it@8qfPx^*z`$M_pPQeOn!}>tz|g?J Juu-p`2>^(x4GaJP delta 55 zcmdnUx|UThEZBpS0SNNt>};4AxJu*8GE>U~it@8qfPx^*UK*d9pOTuxqTs;Lu+gZV F2>@V&4GI7N diff --git a/bgfx/examples/runtime/shaders/dx11/vs_wf_mesh.bin b/bgfx/examples/runtime/shaders/dx11/vs_wf_mesh.bin index 7ed67c059a555a5ff49fde73c290ba3fe03899ca..43937ebf872ced2307533e22dc9fff63fff88bdb 100644 GIT binary patch delta 60 zcmeC==;x3P3-;h<0D|zR2|~;a?4|L!`6;P6ED8(^4GaturKN=!7&uDf3lfVGbBmdn O9XOa77&f{bWd;DApbg0Y delta 54 zcmeC@=;V+N3-;h-0D|zR2|~;a?4|L!`6;P6ED8(^4HIRh`8Z1B3lfVGbBmdn9XOab IdL3m30A>aa$p8QV diff --git a/bgfx/examples/runtime/shaders/dx11/vs_wf_wireframe.bin b/bgfx/examples/runtime/shaders/dx11/vs_wf_wireframe.bin index d3b8379107e1ad830f5222caecaeae8023014c6b..575d96c96b7d10c43b847035f1e0fa50ebf9c26c 100644 GIT binary patch delta 60 zcmZo?>t&M-3-;h<0D|;CTh=o(u$RW?=BK3QuqZGvG%zqsl$I7^VBjc?FGws(%q?bO OcHm%UVA$w#m+1P4f?rZ$kGf#tdnK|rjToq+MZxxU6^kI2871?TC`PVqVaDd@+?C~eEgc2@7IlKyA`odbp>`FDbhi08 zJH1e+3WeZasM8CzIJ=gct^%1=YTH|-g}C{U+`LM#tvBRZh%E|88|E;~c^2lhU^R5j z5=cKw@Y;_u*3%S}_Lg8RlMS{8+0TLwgfh_4z)I@z*^Wxp)q)~>pTyx!yiK_eumz*4 zc*fPhss^?(_%bNFB1>eHuHsY)<`E2Yfp8J*+6Ebu!Q-Gk!@D^6k24(OEm>{q=|+_m zx-lqpV_-cc7kRAZHd1TSO6pfhp|C^6>ei9Jh?7v453SveueLX8o=uK9ZdI;=#-r0! zKn{$4w7CP-fqj+4e;pVR{PCEb#T<2%>_>fJ?5W_BZGAqNMthE`sy$uCqFP-Utd{ad zEu4n2^sHne!}Qbmr`BYpE73^|D5tn|Kr(|7Rm>1{-&8V2`!_Do_lR-T+bGj_pg=m0p-q4Q*{XnC9 zgibmq+Z?qqyC*QtGnoAo80#6#_6ZCU-qThd3G)D174_oi73#m-(bu1`)FF*b^c`Om z+$qIgk_h6t4BXV;E0@!Ot!-I&v0V!}5;PZ3d^u@8a! zYY^Yd;5yo1mJDwI*Hbg!8LW-N#oFbcFG$EB5P?e5+og;IbHO#lI&{>2i_=1H zeo+xJMg{9xSAPC6PV0F~AUNCZD;X>hQpTQ_3UFXrJUMQOkk>D`jEWc&x5oFi*YiWp zhA!$EvL&jrHq2d#XTQdC?AiFNq``U{8h?%;%=C&thZ-%Q{*s~Nvk+7EJew+>-JohP zUK>+*Pr;`%GFMTi5^k1D%J`gnud?|Pn(Iy*l8;EcTq`FBmbrl{Ap=>T3}g&!&12^M zMuNA~rcLOM@1J6i7CNbVEU>u7+_VuE)tGa|i>iy*+|d~|zd8iH$ZaQb4^Ewk_2!Bh z%aTBH*@`noZvmbPu#tJ8`vOCOG5#$$)BHVUC!TdHjXs-u+yhkwGCA^#H&vW;`ZW6x zd)+kaETh`4kl!U$39jYc9g|n7z`GRsm32W;p%hENSiMXhlfO{j9T&u*JnrVB+0$v$ zVsiCARq`A!R5^u8udC9b`#?qBp9+^wmQDukU;2bc276ZBsI9WXGMZny$FKoC3?F>0 z!rXT-IGJ>%^e}vei;kWhU>(E0MiwR2cFxuz2)sBG9Zc~)D7Z3o;+qGTY}vRPh0=2b z$#{rAl%I^T$ugdD{@U{ZcHS{y;*w?+Zw2s}>fAE*LCKf;EQ^!o0OZ2qrmBuzp2N)X KftE*nPyPibuVFy| literal 0 HcmV?d00001 diff --git a/bgfx/examples/runtime/shaders/essl/cs_assao_generate_importance_map.bin b/bgfx/examples/runtime/shaders/essl/cs_assao_generate_importance_map.bin new file mode 100644 index 0000000000000000000000000000000000000000..9c2bb63838558bc8a66e910056aa9d64935b1f13 GIT binary patch literal 2607 zcmb7GOOM+&5Z<%;7kU_=7pki`wxkp()I9_-n(QHHuuk_9ECjAi+bk&2plDlmu>ZX? z)YG=&v|50q=kd+QnIXCFXCHsMX}_Pno10&D!W2^H5KYD)3U4Ro5y-r-pSFs*A1RIj zWZXuOX14U<8yI1?CI<$Lls^253#alEcsYe={Q_vw&LEs8K{%`iBJQ(@p=E)~|H`6+ zKo*ssV^N{~n8i|QZo$kqtXieK=QA0NU#Gm@Z|JO$e+VZ=Bw=XjccxKeis|g*QFhKu znTr zym1kJk1po1rQ1<$K^v++1Vx4?P{eMV%cVA%YaiIAJ1O=LVs4Wm#TQWu)oEP1DwhkP z%y*9nbs^sv{m+FEjXw{`iOis)MjzB=dLh);D15pI<1~Y;TFoh9)vYO4n>BwB%eX_V zH5+btR(zfO-V0W%j7y^82fek-yba)4<_npx?#4dsjkH4N>Html*K)PqfXw(xgi|O| z%gsvkics)uql5{k?~LIGG+4@6nfQ2} zC*DrW1wJJ*XVii2xWmHUPtl?}`zw`xQ2Lpx`+SE{EWS+l(@}ZAQ&U^Z42>QC84_U4 z4tz99Jh=qMm10U1#g{eD8G)lFfQ8Jkp`i==%nR{Z7j5L)k{+`ViPB|7CVxMo1zi9k zt37hFs?7lhe25C&QY1n(pe z3`>KEZ7O16sKCdkQqh6{6>=X_A)!4^#d%rfji{$9Pkx%@)}CPKe>=(5c|%?W`a|I? zq7e@(`|Z+5F9kboc*LE~(pWDA!JVaXXK6^>4JYeWnKznRTU1QQt9 zNh)g#l}}9lD`ql5TvEbmK#KAGzS8A-5&f0M(>E3KSGNpoqH7a(-Ub z3sxVonS7oXSI5P)+21vBT3i=pJHzafTeb%0%g^rtYHNH|SAX9c#Nv0m#)+7n6AJpy zxkWWA%8ya_X$uX{?4-)fxDchbPV#bfnI9MDaSKt+tnxZvtUm^sg-lJ=%*1I0pDlTN zFDhi;W!-=YOIg5G{Syb?`MXfI2(_{(cPf;g{T8;KS)6|ZH|M?4-(!G z@)3AAiNaBu5J5zA8f4KZ!y0_?$DyAD!I-e6BZVOVSE4Z18`2;cjp8KbHDFO31{r-G z=@Ss4aTvww#Br345*&!ugaDrTA&>#SUXR14qmWq2BJfA!ag0B-W(*17e@Rc=o;bnj zLv?^49A!ROszfkOF((nwdXgCq5N2`61koWOjv$ak_+cDGX$X;lAiX{wjFaqG!2z+oW0f$%yBR|W6P;xPbGy|V>g2bWL`@<+o!YEZ7@*$7W z$cG+~JixgOXK*MAhS@lb#+s$+I18a?tV9uM$0(KvB7-1Ip}Av)Ak4t{alkB%fGUXt zxxN)a96}SJq*95X)3HBhv1Vy94wKB~kUxx}H!X*7!XPH4#sQ#w$e0o-Gopt?5MnsV zVrVIwO`Ila2sTQVW}|qNW>TT_2EZ9-qm<2t*d8SDc$D#pp`Sh!n-$8)EEt9{aY8B4 zI0N*^#|f}G4q+{E>}-Gp>i( z5NC+fSV}}6!RJ8BI3y!WrIy0XA_&yo5DmvfCX|BBARcEhmIQnUMbH(PwZvvo1Qz)c z1J(p1Sf<7>4!}@oNr$8)fXC5x5JedsNRkx#qbP*&I~#&wnt|6WHDJgBNGeu_lfa6= zS9?7;2UC(KAc7KjzLd0-zQkFaMdT!uj>1>^E|1`4lJPjw zLWlz>MUb-QK)pel)LFwKC=PsS%7ndtBU*s1B<6k1J$je2( z(x?@vbu)u9x3G|X8CYkV^Yfwx@yPLKFRINFq4H3UeG$wIXX@i8Wcs_$G+(T$y2+Q* z;!VD?j$s`lu@LV(#P@Zb-+-92d|jNJeE)Vgn6xjh>UmS#&kPNx$?J;(sge0nG-4{X03h#HKTd16{3f$-W1QfKgy3K`UT(a=vQjaB*XtZF=A z*2;|76KOp3#kV3%65g5G-`uHoMj+)Blqw>#iNsGYUz}EyM6qfy>7hVgJrMF#l(V&3 z$4B9PAd6`mUf)26z0E}BPT?mSc}5`U!*k@I?ab{Joy-L(q1*zjk zFQ*$6U&V1gn{U?dC|@g}Q{cHYFiG@ke*K~#T{|k47tQ5BO@eToZH}b(<-9&VG^ak9 z-xl9Da>s{(fPJXLW9?B@{bRF|=-yN_d$xdXPa8R9kDupdS)HE~ttjtLev|UI7UQgj zD+&0ey@Mpasj3$x3Y(+(V%`8HR!dFkoC=&YP|{DsE8*%75*~0LermsG6Dpn^h%Scx z-u6LBr~r`wi@m)MZF`J^bf7K|4k&Z-&#~LH!9BCTaLvZ)wh{9W(w=PDPFb)JlRa1# z=S^p*hWqM{HPx!K>a1#-YVkqqb=;a5DI^L~Pbkw6@2k}wdG8n}{m(fodbzqwLC z$k^gLa-46^*3%7IFVjM420H`EJ`PHexSTgHi?Yde1nIg0K8b`~vU`SyJYdONTQv}h zfO73m5dKTG&_Sw~l51N3RyUr8YPKp0;EWppSmf89jI??o3}TDO=M;yn_$zk}gd}6H z)lO*NEey$kAS|p~6t5`DK&JP4xh!fOqNpGD+a@pP&COBqxhNs$WgBuT!{C$6!kxM* z$ffbH^nI+XoFXEJ`}w`=5*PE80&f;a7J5+I!_%yXGKZb!gYi&BP2`-jlWAQPOUo9e zSwN%TveVbt<#1P3w1YLQW(O?c|MIJzr5N?guQCxPWnmK74ho4x>zf>VS6zizyf0VA zVp&{Cb_E*E=2VoiwlfH=cU?@f zp0d#!*KeEy(PMjE@fYEt>g|8$`Tak8&e>rDMgoRP$txHLGFcnb@P>U(Xn7?pu~*>i zCQqkqh-^$I4vq@!_uOD%6N~D?4GWSv910kf^8fm@NJJb*-}UaUXW!N&%Q zgKlX7THUs`>U!LkSqm9w=1RF0a68u#v^DXc5qXQSje`Fs(L-kg$qGtqek_pBpb96A zJ-I~R=xY6%%I#%ddRF<2tVYhB7BzAiN^+n-F@5-f3Ld*?#@OFDzZs}j8Ee|fd&@a) zCr)QoRf>F;uNtJvhv@1U2ge(asn5c-S5t46Q%~?HX%Sz6%CDO_#3-*s<$&IWWiox? zJ{4MaXGQ(?97zl%7M_FkI}g35Kf}Yctv%a(KM_jl!(o@GK=JcP{&On-IhOw%eqam3 zrQgy)A35q3L`XbEu=WSWA@R)c2KA-iA70(w z$P7voaCqD$Kw8hgkqoYRP`x6334~1+aSqgI&XC__HrivL9%HA@Is^=i9k*kL$3r=G z=#0se?~Kks;pmgaS?$mbLoslR=mk!@**0KwlhGYPfK>zC2(6*#o3cDE)-S56rWS%! zQ>F!K3y%z$8q5*J7W~C#jlC$zBjzQxZk3px4V%NUDF+^Jk^vx?YLX!&m=;fT3(!!; zOtLJX(^Jzk-8iJjWsk^|C$izT-!rN9b}vvCcAi5cDHCXZr1ysv9qIaYnC^dj79Sl%K81mm59Jo_pJ9`^ao{9!qjS zb>N8_&22#6KGT4vxc|LFkuXJua?h@-om1os?o{w_l0eV`=4%@<385Z_3$S{T7^MN~ z3d$P>7P^!?5P%|M%On-U5$c`EJnjif94H-bdyZB;%mJS*(usd6@To8ekIct?qSa`G zTea~Y4n*8G%uJP!#>NNf5GnJPJVDdZK0T%9+~GF-7~b9*K54&t#0@S3U=I);^ebea z6n5zc^bdj9+^V=Fp-dv}_|R!J3~w!`e(WND{x3$3Na^-D9OS1iaz51K6u`$k?c@mE z4f&6jaKN&f+ZwGR_?}f(aMRCmC4?O04!H(mA zc7QOwLkekpWu)9wKAX)OV9Kq&>wa(7DBO`{Z11|QTGkP%`ZD`uP9iGYM=11dCmO1M zP2hbLja1d&f#&wB&`72H9cZq;3XN31htaq$8oe&#O6k&ryg%2uyLgL4!`uR~7rc9F z_CS4%*4-_sj5@>f04Z;(As$Ko)J=njr!_EC*_&Zk*8xSs-Kf&~dlvsnCzV8af%-Q=y-JHFUDAr$WaQ2?WK5IMbR2bpyLnxl@(8^u8Bmb(WWJ zbQ6_Cx)%>4$W(b}duC@-P<)44o(zF%`m(w}#s|T63InFOi%Tkw?!f{z>`3m`wHW0B zmX<)qhA=vpZq;I|u43dcEmNPq)nM%nD46Z9?Q-1*W6h2M#ngGYz;&;EfRusYathhC zlNb>^%Cp?s1&J1(`~35tP7_AnNmRJ-;!K|UEB?NiqvL8fQ84oSIWINceY-4rsO3pz zz#KJ=PRp60CSgOj&^?vIZ`n)a1KRC()9~G{>r|>NnX6lolBwVc9(VPMa$V@ox~i(V z9ZFj|m^uaf?G+MEt(WZ+CveQU2Ww~W_z4ust^nQmaau(=x*K?4Bwm6@P(DSJG+<*cdTx^lkN3o^fP04tH%vp6Jth@R#-60_u@v+*X z1c9)H%Jq@_^$F^mJ);B)oODls9iFuXzrUcbiqQ4e93!v5ugX9uyI(2-jjPa)q;}Oj ztz9_&oyfV9Q_Vw~J7Jzvm zyWL~wg&o`w8A2yoSJbHOQpkli*YDjKLpzSYd+TWhLb!oJZ$7*G*HCSKDTm*Cuv|_e zUC!3()2j76-AO|Vt`l%@Wc89|<~{^;NV(p-^O?mfaL^I%f4!qK=hSXa|LeFr3Ik3{ ztG$D6Z5W(tztFAjx9X;s%@^JN_GZ9Y3O}H32QbV%3xB}>k%!QC1eh|uML)IK)h2Nu zZxJD7d!EmVx44$3nGofE#q9ID-aD7#l zcqg@9pI+umk6>YnxWKFEnXW7-rG`4ZFx=P1sCpGx^aIte`@P3*2V1`K1t9O@Pk)ma zfHG%RM9~!x=VZ9tQ~3!nA!yN0F26d|(dp<_&AQ;^l9v&8@j=3eC)!RvOcF=ieQ|(L z)|V(~Z|7+@Ur*tNivAL#@P3mrK!eI!jxjzTEkZp{kLgcf;%)0%=Tepo^lzb|VQ_`x PGuZ2!8xkF5o8SCD-?3hFs?7lhe25C&QY1n(pe z3`>KEZ7O16sKCdkQqh6{6>=X_A)!4^#d%rfji{$9Pkx%@)}CPKe>=(5c|%?W`a|I? zq7e@(`|Z+5F9kboc*LE~(pWDA!JVaXXK6^>4JYeWnKznRTU1QQt9 zNh)g#l}}9lD`ql5TvEbmK#KAGzS8A-5&f0M(>E3KSGNpoqH7a(-Ub z3sxVonS7oXSI5P)+21vBT3i=pJHzafTeb%0%g^rtYHNH|SAX9c#Nv0m#)+7n6AJpy zxkWWA%8ya_X$uX{?4-)fxDchbPV#bfnI9MDaSKt+tnxZvtUm^sg-lJ=%*1I0pDlTN zFDhi;W!-=YOIg5G{Syb?`MXfI2(_{(cPf;g{T8;KS)6|ZH|M?4-(!G z@)3AAiNaBu5J5zA8f4KZ!y0_?$DyAD!I-e6BZVOVSE4Z18`2;cjp8KbHDFO31{r-G z=@Ss4aTvww#Br345*&!ugaDrTA&>#SUXR14qmWq2BJfA!ag0B-W(*17e@Rc=o;bnj zLv?^49A!ROszfkOF((nwdXgCq5N2`61koWOjv$ak_+cDGX$X;lAiX{wjFaqG!2z+oW0f$%yBR|W6P;xPbGy|V>g2bWL`@<+o!YEZ7@*$7W z$cG+~JixgOXK*MAhS@lb#+s$+I18a?tV9uM$0(KvB7-1Ip}Av)Ak4t{alkB%fGUXt zxxN)a96}SJq*95X)3HBhv1Vy94wKB~kUxx}H!X*7!XPH4#sQ#w$e0o-Gopt?5MnsV zVrVIwO`Ila2sTQVW}|qNW>TT_2EZ9-qm<2t*d8SDc$D#pp`Sh!n-$8)EEt9{aY8B4 zI0N*^#|f}G4q+{E>}-Gp>i( z5NC+fSV}}6!RJ8BI3y!WrIy0XA_&yo5DmvfCX|BBARcEhmIQnUMbH(PwZvvo1Qz)c z1J(p1Sf<7>4!}@oNr$8)fXC5x5JedsNRkx#qbP*&I~#&wnt|6WHDJgBNGeu_lfa6= zS9?7;2UC(KAc7KjzLd0-zQkFaMdT!uj>1>^E|1`4lJPjw zLWlz>MUb-QK)pel)LFwKC=PsS%7ndtBU*s1B<6k1J$je2( z(x?@vbu)u9x3G|X8CYkV^Yfwx@yPLKFRINFq4H3UeG$wIXX@i8Wcs_$G+(T$y2+Q* z;!VD?j$s`lu@LV(#P@Zb-+-92d|jNJeE)Vgn6xjh>UmS#&kPNx$?J;(sge0nG-4{X03h#HKTd16{3f$-W1QfKgy3K`UT(a=vQjaB*XtZF=A z*2;|76KOp3#kV3%65g5G-`uHoMj+)Blqw>#iNsGYUz}EyM6qfy>7hVgJrMF#l(V&3 z$4B9PAd6`mUf)26z0E}BPT?mSc}5`U!*k@I?ab{Joy-L(q1*zjk zFQ*$6U&V1gn{U?dC|@g}Q{cHYFiG@ke*K~#T{|k47tQ5BO@eToZH}b(<-9&VG^ak9 z-xl9Da>s{(fPJXLW9?B@{bRF|=-yN_d$xdXPa8R9kDupdS)HE~ttjtLev|UI7UQgj zD+&0ey@Mpasj3$x3Y(+(V%`8HR!dFkoC=&YP|{DsE8*%75*~0LermsG6Dpn^h%Scx z-u6LBr~r`wi@m)MZF`J^bf7K|4k&Z-&#~LH!9BCTaLvZ)wh{9W(w=PDPFb)JlRa1# z=S^p*hWqM{HPx!K>a1#-YVkqqb=;a5DI^L~Pbkw6@2k}wdG8n}{m(fodbzqwLC z$k^gLa-46^*3%7IFVjM420H`EJ`PHexSTgHi?Yde1nIg0K8b`~vU`SyJYdONTQv}h zfO73m5dKTG&_Sw~l51N3RyUr8YPKp0;EWppSmf89jI??o3}TDO=M;yn_$zk}gd}6H z)lO*NEey$kAS|p~6t5`DK&JP4xh!fOqNpGD+a@pP&COBqxhNs$WgBuT!{C$6!kxM* z$ffbH^nI+XoFXEJ`}w`=5*PE80&f;a7J5+I!_%yXGKZb!gYi&BP2`-jlWAQPOUo9e zSwN%TveVbt<#1P3w1YLQW(O?c|MIJzr5N?guQCxPWnmK74ho4x>zf>VS6zizyf0VA zVp&{Cb_E*E=2VoiwlfH=cU?@f zp0d#!*KeEy(PMjE@fYEt>g|8$`Tak8&e>rDMgoRP$txHLGFcnb@P>U(Xn7?pu~*>i zCQqkqh-^$I4vq@!_uOD%6N~D?4GWSv910kf^8fm@NJJb*-}UaUXW!N&%Q zgKlX7THUs`>U!LkSqm9w=1RF0a68u#v^DXc5qXQSje`Fs(L-kg$qGtqek_pBpb96A zJ-I~R=xY6%%I#%ddRF<2tVYhB7BzAiN^+n-F@5-f3Ld*?#@OFDzZs}j8Ee|fd&@a) zCr)QoRf>F;uNtJvhv@1U2ge(asn5c-S5t46Q%~?HX%Sz6%CDO_#3-*s<$&IWWiox? zJ{4MaXGQ(?97zl%7M_FkI}g35Kf}Yctv%a(KM_jl!(o@GK=JcP{&On-IhOw%eqam3 zrQgy)A35q3L`XbEu=WSWA@R)c2KA-iA70(w z$P7voaCqD$Kw8hgkqoYRP`x6334~1+aSqgI&XC__HrivL9%HA@Is^=i9k*kL$3r=G z=#0se?~Kks;pmgaS?$mbLoslR=mk!@**0KwlhGYPfK>zC2(6*#o3cDE)-S56rWS%! zQ>F!K3y%z$8q5*J7W~C#jlC$zBjzQxZk3px4V%NUDF+^Jk^vx?YLX!&m=;fT3(!!; zOtLJX(^Jzk-8iJjWsk^|C$izT-!rN9b}vvCcAi5cDHCXZr1ysv9qIaYnC^dj79Sl%K81mm59Jo_pJ9`^ao{9!qjS zb>N8_&22#6KGT4vxc|LFkuXJua?h@-om1os?o{w_l0eV`=4%@<385Z_3$S{T7^MN~ z3d$P>7P^!?5P%|M%On-U5$c`EJnjif94H-bdyZB;%mJS*(usd6@To8ekIct?qSa`G zTea~Y4n*8G%uJP!#>NNf5GnJPJVDdZK0T%9+~GF-7~b9*K54&t#0@S3U=I);^ebea z6n5zc^bdj9+^V=Fp-dv}_|R!J3~w!`e(WND{x3$3Na^-D9OS1iaz51K6u`$k?c@mE z4f&6jaKN&f+ZwGR_?}f(aMRCmC4?O04!H(mA zc7QOwLkekpWu)9wKAX)OV9Kq&>wa(7DBO`{Z11|QTGkP%`ZD`uP9iGYM=11dCmO1M zP2hbLja1d&f#&wB&`72H9cZq;3XN31htaq$8oe&#O6k&ryg%2uyLgL4!`uR~7rc9F z_CS4%*4-_sj5@>f04Z;(As$Ko)J=njr!_EC*_&Zk*8xSs-Kf&~dlvsnCzV8af%-Q=y-JHFUDAr$WaQ2?WK5IMbR2bpyLnxl@(8^u8Bmb(WWJ zbQ6_Cx)%>4$W(b}duC@-P<)44o(zF%`m(w}#s|T63InFOi%Tkw?!f{z>`3m`wHW0B zmX<)qhA=vpZq;I|u43dcEmNPq)nM%nD46Z9?Q-1*W6h2M#ngGYz;&;EfRusYathhC zlNb>^%Cp?s1&J1(`~35tP7_AnNmRJ-;!K|UEB?NiqvL8fQ84oSIWINceY-4rsO3pz zz#KJ=PRp60CSgOj&^?vIZ`n)a1KRC()9~G{>r|>NnX6lolBwVc9(VPMa$V@ox~i(V z9ZFj|m^uaf?G+MEt(WZ+CveQU2Ww~W_z4ust^nQmaau(=x*K?4Bwm6@P(DSJG+<*cdTx^lkN3o^fP04tH%vp6Jth@R#-60_u@v+*X z1c9)H%Jq@_^$F^mJ);B)oODls9iFuXzrUcbiqQ4e93!v5ugX9uyI(2-jjPa)q;}Oj ztz9_&oyfV9Q_Vw~J7Jzvm zyWL~wg&o`w8A2yoSJbHOQpkli*YDjKLpzSYd+TWhLb!oJZ$7*G*HCSKDTm*Cuv|_e zUC!3()2j76-AO|Vt`l%@Wc89|<~{^;NV(p-^O?mfaL^I%f4!qK=hSXa|LeFr3Ik3{ ztG$D6Z5W(tztFAjx9X;s%@^JN_GZ9Y3O}H32QbV%3xB}>k%!QC1eh|uML)IK)h2Nu zZxJD7d!EmVx44$3nGofE#q9ID-aD7#l zcqg@9pI+umk6>YnxWKFEnXW7-rG`4ZFx=P1sCpGx^aIte`@P3*2V1`K1t9O@Pk)ma zfHG%RL?O+?T@bDYaJi@Q6JSEnqMuxTb*Q7$$@QFE@-pHsK1lfRMBB-SN#baGAPx}9 z`Vs~0?L6(~>nTu0e~D3ezeyROL1it+7@v<8p`NG5^d~U!wsoy@DN6?Wx6sfqxWe%n O?DfqJiH@?(Z~hhFs?7lhe25C&QY1n(pe z3`>KEZ7O16sKCdkQqh6{6>=X_A)!4^#d%rfji{$9Pkx%@)}CPKe>=(5c|%?W`a|I? zq7e@(`|Z+5F9kboc*LE~(pWDA!JVaXXK6^>4JYeWnKznRTU1QQt9 zNh)g#l}}9lD`ql5TvEbmK#KAGzS8A-5&f0M(>E3KSGNpoqH7a(-Ub z3sxVonS7oXSI5P)+21vBT3i=pJHzafTeb%0%g^rtYHNH|SAX9c#Nv0m#)+7n6AJpy zxkWWA%8ya_X$uX{?4-)fxDchbPV#bfnI9MDaSKt+tnxZvtUm^sg-lJ=%*1I0pDlTN zFDhi;W!-=YOIg5G{Syb?`MXfI2(_{(cPf;g{T8;KS)6|ZH|M?4-(!G z@)3AAiNaBu5J5zA8f4KZ!y0_?$DyAD!I-e6BZVOVSE4Z18`2;cjp8KbHDFO31{r-G z=@Ss4aTvww#Br345*&!ugaDrTA&>#SUXR14qmWq2BJfA!ag0B-W(*17e@Rc=o;bnj zLv?^49A!ROszfkOF((nwdXgCq5N2`61koWOjv$ak_+cDGX$X;lAiX{wjFaqG!2z+oW0f$%yBR|W6P;xPbGy|V>g2bWL`@<+o!YEZ7@*$7W z$cG+~JixgOXK*MAhS@lb#+s$+I18a?tV9uM$0(KvB7-1Ip}Av)Ak4t{alkB%fGUXt zxxN)a96}SJq*95X)3HBhv1Vy94wKB~kUxx}H!X*7!XPH4#sQ#w$e0o-Gopt?5MnsV zVrVIwO`Ila2sTQVW}|qNW>TT_2EZ9-qm<2t*d8SDc$D#pp`Sh!n-$8)EEt9{aY8B4 zI0N*^#|f}G4q+{E>}-Gp>i( z5NC+fSV}}6!RJ8BI3y!WrIy0XA_&yo5DmvfCX|BBARcEhmIQnUMbH(PwZvvo1Qz)c z1J(p1Sf<7>4!}@oNr$8)fXC5x5JedsNRkx#qbP*&I~#&wnt|6WHDJgBNGeu_lfa6= zS9?7;2UC(KAc7KjzLd0-zQkFaMdT!uj>1>^E|1`4lJPjw zLWlz>MUb-QK)pel)LFwKC=PsS%7ndtBU*s1B<6k1J$je2( z(x?@vbu)u9x3G|X8CYkV^Yfwx@yPLKFRINFq4H3UeG$wIXX@i8Wcs_$G+(T$y2+Q* z;!VD?j$s`lu@LV(#P@Zb-+-92d|jNJeE)Vgn6xjh>UmS#&kPNx$?J;(sge0nG-4{X03h#HKTd16{3f$-W1QfKgy3K`UT(a=vQjaB*XtZF=A z*2;|76KOp3#kV3%65g5G-`uHoMj+)Blqw>#iNsGYUz}EyM6qfy>7hVgJrMF#l(V&3 z$4B9PAd6`mUf)26z0E}BPT?mSc}5`U!*k@I?ab{Joy-L(q1*zjk zFQ*$6U&V1gn{U?dC|@g}Q{cHYFiG@ke*K~#T{|k47tQ5BO@eToZH}b(<-9&VG^ak9 z-xl9Da>s{(fPJXLW9?B@{bRF|=-yN_d$xdXPa8R9kDupdS)HE~ttjtLev|UI7UQgj zD+&0ey@Mpasj3$x3Y(+(V%`8HR!dFkoC=&YP|{DsE8*%75*~0LermsG6Dpn^h%Scx z-u6LBr~r`wi@m)MZF`J^bf7K|4k&Z-&#~LH!9BCTaLvZ)wh{9W(w=PDPFb)JlRa1# z=S^p*hWqM{HPx!K>a1#-YVkqqb=;a5DI^L~Pbkw6@2k}wdG8n}{m(fodbzqwLC z$k^gLa-46^*3%7IFVjM420H`EJ`PHexSTgHi?Yde1nIg0K8b`~vU`SyJYdONTQv}h zfO73m5dKTG&_Sw~l51N3RyUr8YPKp0;EWppSmf89jI??o3}TDO=M;yn_$zk}gd}6H z)lO*NEey$kAS|p~6t5`DK&JP4xh!fOqNpGD+a@pP&COBqxhNs$WgBuT!{C$6!kxM* z$ffbH^nI+XoFXEJ`}w`=5*PE80&f;a7J5+I!_%yXGKZb!gYi&BP2`-jlWAQPOUo9e zSwN%TveVbt<#1P3w1YLQW(O?c|MIJzr5N?guQCxPWnmK74ho4x>zf>VS6zizyf0VA zVp&{Cb_E*E=2VoiwlfH=cU?@f zp0d#!*KeEy(PMjE@fYEt>g|8$`Tak8&e>rDMgoRP$txHLGFcnb@P>U(Xn7?pu~*>i zCQqkqh-^$I4vq@!_uOD%6N~D?4GWSv910kf^8fm@NJJb*-}UaUXW!N&%Q zgKlX7THUs`>U!LkSqm9w=1RF0a68u#v^DXc5qXQSje`Fs(L-kg$qGtqek_pBpb96A zJ-I~R=xY6%%I#%ddRF<2tVYhB7BzAiN^+n-F@5-f3Ld*?#@OFDzZs}j8Ee|fd&@a) zCr)QoRf>F;uNtJvhv@1U2ge(asn5c-S5t46Q%~?HX%Sz6%CDO_#3-*s<$&IWWiox? zJ{4MaXGQ(?97zl%7M_FkI}g35Kf}Yctv%a(KM_jl!(o@GK=JcP{&On-IhOw%eqam3 zrQgy)A35q3L`XbEu=WSWA@R)c2KA-iA70(w z$P7voaCqD$Kw8hgkqoYRP`x6334~1+aSqgI&XC__HrivL9%HA@Is^=i9k*kL$3r=G z=#0se?~Kks;pmgaS?$mbLoslR=mk!@**0KwlhGYPfK>zC2(6*#o3cDE)-S56rWS%! zQ>F!K3y%z$8q5*J7W~C#jlC$zBjzQxZk3px4V%NUDF+^Jk^vx?YLX!&m=;fT3(!!; zOtLJX(^Jzk-8iJjWsk^|C$izT-!rN9b}vvCcAi5cDHCXZr1ysv9qIaYnC^dj79Sl%K81mm59Jo_pJ9`^ao{9!qjS zb>N8_&22#6KGT4vxc|LFkuXJua?h@-om1os?o{w_l0eV`=4%@<385Z_3$S{T7^MN~ z3d$P>7P^!?5P%|M%On-U5$c`EJnjif94H-bdyZB;%mJS*(usd6@To8ekIct?qSa`G zTea~Y4n*8G%uJP!#>NNf5GnJPJVDdZK0T%9+~GF-7~b9*K54&t#0@S3U=I);^ebea z6n5zc^bdj9+^V=Fp-dv}_|R!J3~w!`e(WND{x3$3Na^-D9OS1iaz51K6u`$k?c@mE z4f&6jaKN&f+ZwGR_?}f(aMRCmC4?O04!H(mA zc7QOwLkekpWu)9wKAX)OV9Kq&>wa(7DBO`{Z11|QTGkP%`ZD`uP9iGYM=11dCmO1M zP2hbLja1d&f#&wB&`72H9cZq;3XN31htaq$8oe&#O6k&ryg%2uyLgL4!`uR~7rc9F z_CS4%*4-_sj5@>f04Z;(As$Ko)J=njr!_EC*_&Zk*8xSs-Kf&~dlvsnCzV8af%-Q=y-JHFUDAr$WaQ2?WK5IMbR2bpyLnxl@(8^u8Bmb(WWJ zbQ6_Cx)%>4$W(b}duC@-P<)44o(zF%`m(w}#s|T63InFOi%Tkw?!f{z>`3m`wHW0B zmX<)qhA=vpZq;I|u43dcEmNPq)nM%nD46Z9?Q-1*W6h2M#ngGYz;&;EfRusYathhC zlNb>^%Cp?s1&J1(`~35tP7_AnNmRJ-;!K|UEB?NiqvL8fQ84oSIWINceY-4rsO3pz zz#KJ=PRp60CSgOj&^?vIZ`n)a1KRC()9~G{>r|>NnX6lolBwVc9(VPMa$V@ox~i(V z9ZFj|m^uaf?G+MEt(WZ+CveQU2Ww~W_z4ust^nQmaau(=x*K?4Bwm6@P(DSJG+<*cdTx^lkN3o^fP04tH%vp6Jth@R#-60_u@v+*X z1c9)H%Jq@_^$F^mJ);B)oODls9iFuXzrUcbiqQ4e93!v5ugX9uyI(2-jjPa)q;}Oj ztz9_&oyfV9Q_Vw~J7Jzvm zyWL~wg&o`w8A2yoSJbHOQpkli*YDjKLpzSYd+TWhLb!oJZ$7*G*HCSKDTm*Cuv|_e zUC!3()2j76-AO|Vt`l%@Wc89|<~{^;NV(p-^O?mfaL^I%f4!qK=hSXa|LeFr3Ik3{ ztG$D6Z5W(tztFAjx9X;s%@^JN_GZ9Y3O}H32QbV%3xB}>k%!QC1eh|uML)IK)h2Nu zZxJD7d!EmVx44$3nGofE#q9ID-aD7#l zcqg@9pI+umk6>YnxWKFEnXW7-rG`4ZFx=P1sCpGx^aIte`@P3*2V1`K1t9O@Pk)ma zfHG%RL?O+C&&SmOF85S^0!#>6^pnf44s~=oxt^0tUPj!-2MHgZXgm2ZNgQnt#Q{QD zU!tJBou}P=J%t-8`b&($`%TIK4JvCn#`t`+2=zQYrays+x2hFs?7lhe25C&QY1n(pe z3`>KEZ7O16sKCdkQqh6{6>=X_A)!4^#d%rfji{$9Pkx%@)}CPKe>=(5c|%?W`a|I? zq7e@(`|Z+5F9kboc*LE~(pWDA!JVaXXK6^>4JYeWnKznRTU1QQt9 zNh)g#l}}9lD`ql5TvEbmK#KAGzS8A-5&f0M(>E3KSGNpoqH7a(-Ub z3sxVonS7oXSI5P)+21vBT3i=pJHzafTeb%0%g^rtYHNH|SAX9c#Nv0m#)+7n6AJpy zxkWWA%8ya_X$uX{?4-)fxDchbPV#bfnI9MDaSKt+tnxZvtUm^sg-lJ=%*1I0pDlTN zFDhi;W!-=YOIg5G{Syb?`MXfI2(_{(cPf;g{T8;KS)6|ZH|M?4-(!G z@)3AAiNaBu5J5zA8f4KZ!y0_?$DyAD!I-e6BZVOVSE4Z18`2;cjp8KbHDFO31{r-G z=@Ss4aTvww#Br345*&!ugaDrTA&>#SUXR14qmWq2BJfA!ag0B-W(*17e@Rc=o;bnj zLv?^49A!ROszfkOF((nwdXgCq5N2`61koWOjv$ak_+cDGX$X;lAiX{wjFaqG!2z+oW0f$%yBR|W6P;xPbGy|V>g2bWL`@<+o!YEZ7@*$7W z$cG+~JixgOXK*MAhS@lb#+s$+I18a?tV9uM$0(KvB7-1Ip}Av)Ak4t{alkB%fGUXt zxxN)a96}SJq*95X)3HBhv1Vy94wKB~kUxx}H!X*7!XPH4#sQ#w$e0o-Gopt?5MnsV zVrVIwO`Ila2sTQVW}|qNW>TT_2EZ9-qm<2t*d8SDc$D#pp`Sh!n-$8)EEt9{aY8B4 zI0N*^#|f}G4q+{E>}-Gp>i( z5NC+fSV}}6!RJ8BI3y!WrIy0XA_&yo5DmvfCX|BBARcEhmIQnUMbH(PwZvvo1Qz)c z1J(p1Sf<7>4!}@oNr$8)fXC5x5JedsNRkx#qbP*&I~#&wnt|6WHDJgBNGeu_lfa6= zS9?7;2UC(KAc7KjzLd0-zQkFaMdT!uj>1>^E|1`4lJPjw zLWlz>MUb-QK)pel)LFwKC=PsS%7ndtBU*s1B<6k1J$je2( z(x?@vbu)u9x3G|X8CYkV^Yfwx@yPLKFRINFq4H3UeG$wIXX@i8Wcs_$G+(T$y2+Q* z;!VD?j$s`lu@LV(#P@Zb-+-92d|jNJeE)Vgn6xjh>UmS#&kPNx$?J;(sge0nG-4{X03h#HKTd16{3f$-W1QfKgy3K`UT(a=vQjaB*XtZF=A z*2;|76KOp3#kV3%65g5G-`uHoMj+)Blqw>#iNsGYUz}EyM6qfy>7hVgJrMF#l(V&3 z$4B9PAd6`mUf)26z0E}BPT?mSc}5`U!*k@I?ab{Joy-L(q1*zjk zFQ*$6U&V1gn{U?dC|@g}Q{cHYFiG@ke*K~#T{|k47tQ5BO@eToZH}b(<-9&VG^ak9 z-xl9Da>s{(fPJXLW9?B@{bRF|=-yN_d$xdXPa8R9kDupdS)HE~ttjtLev|UI7UQgj zD+&0ey@Mpasj3$x3Y(+(V%`8HR!dFkoC=&YP|{DsE8*%75*~0LermsG6Dpn^h%Scx z-u6LBr~r`wi@m)MZF`J^bf7K|4k&Z-&#~LH!9BCTaLvZ)wh{9W(w=PDPFb)JlRa1# z=S^p*hWqM{HPx!K>a1#-YVkqqb=;a5DI^L~Pbkw6@2k}wdG8n}{m(fodbzqwLC z$k^gLa-46^*3%7IFVjM420H`EJ`PHexSTgHi?Yde1nIg0K8b`~vU`SyJYdONTQv}h zfO73m5dKTG&_Sw~l51N3RyUr8YPKp0;EWppSmf89jI??o3}TDO=M;yn_$zk}gd}6H z)lO*NEey$kAS|p~6t5`DK&JP4xh!fOqNpGD+a@pP&COBqxhNs$WgBuT!{C$6!kxM* z$ffbH^nI+XoFXEJ`}w`=5*PE80&f;a7J5+I!_%yXGKZb!gYi&BP2`-jlWAQPOUo9e zSwN%TveVbt<#1P3w1YLQW(O?c|MIJzr5N?guQCxPWnmK74ho4x>zf>VS6zizyf0VA zVp&{Cb_E*E=2VoiwlfH=cU?@f zp0d#!*KeEy(PMjE@fYEt>g|8$`Tak8&e>rDMgoRP$txHLGFcnb@P>U(Xn7?pu~*>i zCQqkqh-^$I4vq@!_uOD%6N~D?4GWSv910kf^8fm@NJJb*-}UaUXW!N&%Q zgKlX7THUs`>U!LkSqm9w=1RF0a68u#v^DXc5qXQSje`Fs(L-kg$qGtqek_pBpb96A zJ-I~R=xY6%%I#%ddRF<2tVYhB7BzAiN^+n-F@5-f3Ld*?#@OFDzZs}j8Ee|fd&@a) zCr)QoRf>F;uNtJvhv@1U2ge(asn5c-S5t46Q%~?HX%Sz6%CDO_#3-*s<$&IWWiox? zJ{4MaXGQ(?97zl%7M_FkI}g35Kf}Yctv%a(KM_jl!(o@GK=JcP{&On-IhOw%eqam3 zrQgy)A35q3L`XbEu=WSWA@R)c2KA-iA70(w z$P7voaCqD$Kw8hgkqoYRP`x6334~1+aSqgI&XC__HrivL9%HA@Is^=i9k*kL$3r=G z=#0se?~Kks;pmgaS?$mbLoslR=mk!@**0KwlhGYPfK>zC2(6*#o3cDE)-S56rWS%! zQ>F!K3y%z$8q5*J7W~C#jlC$zBjzQxZk3px4V%NUDF+^Jk^vx?YLX!&m=;fT3(!!; zOtLJX(^Jzk-8iJjWsk^|C$izT-!rN9b}vvCcAi5cDHCXZr1ysv9qIaYnC^dj79Sl%K81mm59Jo_pJ9`^ao{9!qjS zb>N8_&22#6KGT4vxc|LFkuXJua?h@-om1os?o{w_l0eV`=4%@<385Z_3$S{T7^MN~ z3d$P>7P^!?5P%|M%On-U5$c`EJnjif94H-bdyZB;%mJS*(usd6@To8ekIct?qSa`G zTea~Y4n*8G%uJP!#>NNf5GnJPJVDdZK0T%9+~GF-7~b9*K54&t#0@S3U=I);^ebea z6n5zc^bdj9+^V=Fp-dv}_|R!J3~w!`e(WND{x3$3Na^-D9OS1iaz51K6u`$k?c@mE z4f&6jaKN&f+ZwGR_?}f(aMRCmC4?O04!H(mA zc7QOwLkekpWu)9wKAX)OV9Kq&>wa(7DBO`{Z11|QTGkP%`ZD`uP9iGYM=11dCmO1M zP2hbLja1d&f#&wB&`72H9cZq;3XN31htaq$8oe&#O6k&ryg%2uyLgL4!`uR~7rc9F z_CS4%*4-_sj5@>f04Z;(As$Ko)J=njr!_EC*_&Zk*8xSs-Kf&~dlvsnCzV8af%-Q=y-JHFUDAr$WaQ2?WK5IMbR2bpyLnxl@(8^u8Bmb(WWJ zbQ6_Cx)%>4$W(b}duC@-P<)44o(zF%`m(w}#s|T63InFOi%Tkw?!f{z>`3m`wHW0B zmX<)qhA=vpZq;I|u43dcEmNPq)nM%nD46Z9?Q-1*W6h2M#ngGYz;&;EfRusYathhC zlNb>^%Cp?s1&J1(`~35tP7_AnNmRJ-;!K|UEB?NiqvL8fQ84oSIWINceY-4rsO3pz zz#KJ=PRp60CSgOj&^?vIZ`n)a1KRC()9~G{>r|>NnX6lolBwVc9(VPMa$V@ox~i(V z9ZFj|m^uaf?G+MEt(WZ+CveQU2Ww~W_z4ust^nQmaau(=x*K?4Bwm6@P(DSJG+<*cdTx^lkN3o^fP04tH%vp6Jth@R#-60_u@v+*X z1c9)H%Jq@_^$F^mJ);B)oODls9iFuXzrUcbiqQ4e93!v5ugX9uyI(2-jjPa)q;}Oj ztz9_&oyfV9Q_Vw~J7Jzvm zyWL~wg&o`w8A2yoSJbHOQpkli*YDjKLpzSYd+TWhLb!oJZ$7*G*HCSKDTm*Cuv|_e zUC!3()2j76-AO|Vt`l%@Wc89|<~{^;NV(p-^O?mfaL^I%f4!qK=hSXa|LeFr3Ik3{ ztG$D6Z5W(tztFAjx9X;s%@^JN_GZ9Y3O}H32QbV%3xB}>k%!QC1eh|uML)IK)h2Nu zZxJD7d!EmVx44$3nGofE#q9ID-aD7#l zcqg@9pI+umk6>YnxWKFEnXW7-rG`4ZFx=P1sCpGx^aIte`@P3*2V1`K1t9O@Pk)ma zfHG%RL?O+?^LShh;BrspC%}ZDML)Ux>QG0glj}LTXNE{%P z^(6}0+j-i}*HgHmqQAr_yx*h@(4exGV~o#7i%`$gWBL=Ac-y+xxs)XX{aa{g7+m4_ P4EFlwhD1l%<~RQj5Iyf&Nf9 zi)h5d%6_{v(o4Zk8y<0|vozLAL2zej+*ukDcf-kgRpyPR))o~LGPxdz$+c#1!~%J6 zOXSHd_O_U|#SdAEJKmOHWxvQ|HU|s#+Hw!SQI@1Un{JJc;_E zzu&v-*%)3_3<(quI{OCnt|C2a?mVOcba5Rp`V?T`t_?)C^8l)rWMlei#`ZExF z{xAqre;nNnV4VICpTjVWpuw04vt*P6BYd$oz{jPrANguS;KxZ8B_l!rFrzRD@i`a< zfkF@tN0FbTi~umxaX3!Lgc|GPERC?A*87CPWYsod#Jn%CH7s{Bh_fK`B!aLx3CBqg2aEuCH3A>pO28qO!N||DAe3B;A*(hbRA+`reJRW6yV(6z2#b$*vG7E-bOq@_k zG|m7$@^J!ejzd^W96KAJ2H`l!v=TwTp_UPmikTqEf+XbQTL_XEqSP!+{m}?Y!Fmt} zDa0A#G?o(4NANk&G7ibeQmLgdvj_rpH$=lRkqM<>Gl<6-j3oizK@oHXW-YN<6oEy) z#DF!y2$rcai~}$fTGAmY3E*+G9Yj$^2a+U({wNAz{LY48m}cNLOAQ#Z0FsK8;Uusk z@YP-q&cT%A35cKso-ZXWr7v+7XAwC{i$}q5oTb>Kc$7qtY&Mbvfur!1zRM$cnPfbU zv=HI|N)e>2IZ$tqCUw@Z2#Nz=8uNM(0b}>U7pZnIx-durSM6}(G=Z((_3rk2GIDTw zbTL_O7N_}Y{V_qXfDS{MKqs3KjwG;JM{yZq>hPslb0}Z0@@et1ST&a?)ux^nPha_F zUe{H<-z)Q*YSVc2#aRxkI-4(N^X0`s*hjUI&#Gm4BQ);I`Nic*%oq7Z!T6U*EAn!Y zuQX}}YTeAB%q=WrUk29M=KQ>NJF6N` zn6)w^_Cy*FeetablZ1Ds_BVH`oe@Ym1*M9}Y$EZ~%NM5=B~h$eOnNAgR}X|d73FNL z*6~qzAIM_bhSxXHVQ({0xl{OwMxGG}`tTe%XghOzMJIDXN+`DgvSXa;U&aJ#tNBd4 z$jj*l#aD5h&*q!;JIdDz=oEM^4NMZfnqR*tNY{>v56!7h z=C{T7jok5JAYdQr@K}3PRsYzmB)T`%%$_Zv+tWr)+2iMVSyt!gL@Ubsli#HLt;IO2 z;YtF2Y40G3Z>s7=iNfY+zL+;aiPch5I;R3B4V3iL@JhJ)gMz+!LjL)#wXARVa7g9FN({B!K~Y;e!)FI=;6x^2Y#gS01Gwo?`?#AFYa z#d*^is^Px6V@aLK zBA{IR6NLX#Ep(9TrR18{ztxSWp_;9V0yyIa02cYRCnK$12!q%n@;Sv}EB?w|10l)S zYqb;FcMC%@AP5WV7R4*dGLY%LUM`DThbZdD{kF-=d2@4Ad@f4JdD(`X$}sq3vv8-b z3UX;YEPWpFBj=ZFk${ zmIfsyCF$f~DL2uHXJ;48h*@z>>5yD$BK`@tQa(UBO>vE`cX3paeVKVHtXx;3lv(>=Y_?7YU>9t+~3_cRPJ%@iW2M*I%~bO0A_m{}LI&9qf;R7&~;q@d)H)Vz!k>Z|3e;V3C#3!(Q` zDzV=)gdib6a{LS#8AEyw0~grPD%!ysR=gYzKuzqV-LVy{oQ5EZ&zZ zW3eo*q;WtIceOk<_s}u5fnqi8tuz-&X*>f7R!cRA-k>mIN4o-zW^*daSlbzd*1Iky zSx?#Mjq5kgf#|WluK0`aQ1$k|^ZfpwJ?HGO0V4rJrQ{V11evUjX?VjvC$zj0me?zB zc9W-5Hbgci69-2H_Iqxyu!%)=;f4jt91aDHO8I|%S|lQlqwjim*RyZymErxsSO-oK zf*D)dBl`-)?C1Ag&fMd(vdnf`2hi@(90rTsZUt67#(r8zRJqEy_o~hMR zu?2-=$X&xpK5*hayBljxzdfn)`xH9r=}XHbQc z#-3cFZ*;YOP3877FFmV#Mph$dPm3D43?(_xpO`-UKn0IoG-K>y>;{~XJI4nMGk z;qo^xH^utrBVbYq(T{m^i5zlwP9zm!;L>mDppP8&3L+$)B3SzaqT zZ)66g2{=6N5+JST-$(}6Jg8ogz68Q1i#P{rG-t@~G8^qNP>-=wXB`3t#*W*u!{ebG zJ9Nh6$#+I)pm6lb;;eS)hM^d^Mf3uv-E12$y2QRZ|N= zswvX~wS`B9ObzCUVhjFav&LSO$` zVxDk(3EEKhpcdiVk%H)&J_?-<`QT zxg+IJl(zrD_7&n!e-fVU95|6jP_(1svdC+h8y-UNXrQaE5VwYQsLc?`t4zgrPSVlu z-HHn8{;eue+d+>kA_6!Qim+XJsqvV)Rm3)DWn$-^l%g&B+ts?*%&OyjIja_&o|F0` z0wAm8D+%h^!VSq5e1CXD?ZrLYO5xO$g*cZ=Y#EQ{4aFp-7k_L%C?Lz9_E107U{%475G#bgh%G%KGAA4 z!mZl)4+kP{8)l};M`PoIbcmFBOP-+VXrG?abM9~(ehhDK4WG1MJ>mwJ0k8)M5Be3d zPYS#A1Nw(RY;ILtl29g*c6{ix8iu!)Q$Kc*KmQjaN2GN791ikR7dap5aSGsLo_2DC z?gx+`?m+%H@1Kku+P4F_-Se4KU?a-*vyYYZUItGPZZ!RxRs@RDGF!GA9ug?jscXwi6B2 zzb5cLibksH??7|=RcNGA{th%(Uxh}h-@|BJ7mZ$*aiw(WLEfM1++DmyqG4`<*bCl0 zHG7~wM(ggDR7RcQd4QBR)ew&)f9j^e!_yiVs_f0MtLuQGYT&7$9)@)K6_DUI!~1DE z{5nW`3Y2ZtkjUv}U92ywl7a#Xq(r(~biX)#=Ga9y`TD-f46xa$8#flLV`v@r9kJ_o zuyrorI_S9D^i=4_Uk#m%?5WUCzZyE()>EP5i3Eb;L!4<%gSvrTsobebU3%Y(vO3Gl zH@b;RBHfFJ5oD^ovpuu3DJZ@}El-9(HGNrKAmf8zJB0z$+{GmoNB3ZX8g?Xi>spL* z0ZU6DV?!97OSfvVRaY@`n3kze-)gY-1{BQp*LJz?gRy4EfMV)AT;RIbK0wMqa5;tS z+DVKE9_3kX?Se!L&wc*+Pp1hZ?<6W*cyT6A{S|*-%+YbRnP?NBsTj-w3;kWE1@&WDkyJ`4t*L5mYmdw?yNXb<21dqFVMY%3?XI)j* z+zzEJ9Za2q{q_n8r`F5%i4!>H+=I0DwkWmkZ1{5Y+m9Ni5(FcL38BFhR-uae2W zP&nx~RER?u-9y*PUc*^ODCl|Adu~914lcIH>7&@v@1|tDK<2DE5!PM(nC_4ejQCh> zQG!6&Lgo5M{`v&<&7M&L1x~srzz)yag5O`zS4HT0YmSju;8$fJl-(~CfyPznM^d|L zp4RB{&ljgvlb5es<{T)#xo^|_Peg->=O~TPMv@+-Wh_71;euWIK708Un7soV3z3zK zOsu5>GHkyoxEf)bKb-K*DKp^}UvDe9KC?D!lb6Jv!LQ6vSYH(28eW;*H~V_|84JKX zklpUF^TG~phzy|6% zORK$uZfzKxYQNB}?zifum(3U5{`O|TSqeX(ZU->TJqv%p|B;8#cLbO+zC}N^+0`a- zAa4;NWqY2_inq9#(2_-LHlf7rYtlO-+kfNxjoah;%D#mpfc(`f5P{RZ%BM|5-9D8# zk?~n?xPadN#tkk!|L1qsvaLgI{+_+J&R%|qNqgM`XlB6oNH8r0E{Tp_-&wvJ#2cT7 zcU#m7YxTf(@>s|w-OgHJ1Us+DMYogGmQvJdtE{Hea>Kt>Dc#hbi^-Z@Rag4CZM(@j zf{U47OF$Z~hH7w*f|^)!uX5h07uUioD?BKetdUtws8}BlkXf1$s;k`*%Fgk=V~(qM ze)_t=FBo}bY4YxB*1V?IQ1V9LqMZE5NiRGOU{cHA^-H=6Aa&&obTgq}V4@*P<8Xad zmUt(%UY}m(OOIe-inze5=$Wo8D5ZuvyfEC?#;AG~So8zculv2nZU-r|FV4nMS=dYBZBc1Pj> zfvhhv(B96&ZoZtt{S^HrHsSRq<$ng1wH#x7I$DHko}SX5z`)zawa%n03FzNJL%ZM# Qhi9skBx^J+GGbKs^BS^-(az>DC(w*-VL?3Yr8{tLzD95QAJ z(9E79xPaldGzvlpT{42VxbUfH2~R_dRyT*%?aIO{orU*mEYdzj3M~aL|COS%K#EG| zDJr*@DfUt`3uc>#)rzv7X7Mh5Pg(tY6JLe=2@Hx{B*e<7DUHl+xB zRhnLvCa${)Epo|hL)$+p4?<6Kpr@w6#2?5_2?;AnUzR#qdQ+D6WUaJx2;iT!xD?7d zo^GIgwibI#7a(3lZi+^rPMCUOgF3z2B&wel9I{VFXKQ^d+bJrgrixq_Jaj&xlTlPqET$xaXc;^O{T)_X{^t%;zO^fXD{h>!iW?UdH!hOraIudq zZim{MHmEO}BH_Tw(UnTrBoJ%ZmHOhu&s& z%J?QqcGjg03%g4R9^r#fJE4Bw#St8huv{y7hKF*$=LQOj_u6iyOJ%wFSj8^j-;Y7+ zeuKB$GN_y(lzPh~EyN?IC%6L~re5SciafeVgqQd-IB2oMKMSfWjgTh2^R#qPB_%8Wm{%uZkT7 zswi<*MalNMin&xQ13gVhX;Id~4Ep{D%BuGbY!>PdU@ysd2xhvw)UZy)cDDIUcMejc zIu!*Uq(%p+f$45Q(?qhYR@+`GD})vv(4uZ|Xcy!~NJvUZ8x|Q@^dc;3!5V08B!GQZ z;9SI+(X$&U8?C@rrg4N86ut;L5^8{v1=do#t944X(}F|xS*z8J+N5S5;1c-t@C<4r zsEyEdo}6k|WSYfkqEb!_4>2%`2#U!xbio}u&rZ9-m69h`=;EzdLpaclQ&#FmqtuN? z@GrU8$42f>YC~E}eU%gy?ok+P`_Q>;yo`H+U`OsM_ zF~h4w#KcUX-R>~Uu1A>^YPhh0NRzrc?@ IC!d|OzbYiifB*mh literal 0 HcmV?d00001 diff --git a/bgfx/examples/runtime/shaders/essl/cs_assao_non_smart_blur.bin b/bgfx/examples/runtime/shaders/essl/cs_assao_non_smart_blur.bin new file mode 100644 index 0000000000000000000000000000000000000000..788a3e2cad720b404b5b8fc9ea79c07d94d94712 GIT binary patch literal 2549 zcmbVNZEw>s5Z+h9pE!vx4hyACf&{Ae0c`>%frQ4`7c^O3>$XO2963&#ZrY#amvDAo z>b7AoRBGhh-SgbzyK{W{klB3SWB0wOESw^9=KLh%{F zl9>eP(o`Ybf##;v84w`W8NzE^I9E7^`(26-7eU9iN8yl`!f~|}sjni1P6aNXs$xrl zDr%flQL{a+VkQ+cpeH%0SCn~}(O~$NvSz=ri$eV|>;zd0!N_nMnzW%8u zLs9TvXu1~~+v>)&$R#taTEA6J2(2QZRa@Z1HRM4^LTZQ)OD!yY5SDtd4q93X;GPY* z6q&Jlwgct74cN)FhQxuA2SEoyEiiS!R%(B?Ua4+caL7JswY*U4!kzcpKIP_H^Tv)w*#}>&8X= zFS%I9PVQD}N7_n#loS>2P+4_lCT2=6-S|LBSAwrE_{5C+9GAS}a_e#Bsv!qPk*%(f z>cF0B_4~kx!QcDrR!py>Vej=V)s)L$Nql{f#(8>Gb)H?udRi%y`GQ^WS-NFxJUP>B zS^OG(@RBty?TRSbMwN!>`TGcNL^c)K{A3uyS_{KfCO6QQe<9|J9K@2%d3^R!Yqo)c z8m8ymYem79x#W5qa3f27p5-OR)R}-tHDQt#;+E42P5|?Imd%0X7A>O?KkDOPrNk63 z6p;}-hwjkB)SRDTMEwPrOZr)=8z#@Q6=pGbKb@Zqs!a&TO+-oUwykL#h#3$jC6T-+ zE*C5#mJ3}GPMM3kUE?f+&4ne4QNqtFOx1=RTO%0`-bMHi?PXTdrrg8p!7WafLoJw` zeHS>ER^?6rA`m$n2VKa(ZvTz<+Hg#GW;92i;T7JXZ3DilDJf`IV)s!=h?N;3^DuNz z2ysh}2fx5f7P!Rcz?S~0Y*;XXQ~Y#_u+;Oum1n^bmF&rWr`tpeUYeobuR zf2Fd+^6XR|Ii~UwZyrju{-0DHc~d~o(pNxt-hLRRId-}}Z4n6UM$(R9)D6`ry&kNw s>F7<#R2ky>ZMzW_uKp=GY!=m_C$-ZH0}Ert3>7LQRxJL$-`;Cr(TM_nqV) zaT2dv192{Q_kH*IbdoNnUtgbepEs{gPTsD$&V@=L9Q(j?XU%6Jh%_(0my*~&6rUa> ztO$W7MdiXHXkL^$1p>qbU3iCv4Y@Hq?Nf9(4?4C33X3!pmaCcETm!u=vhW;i?SYOJo4XD*1T_EvrvBkdr8JaFw@uCu$4MoZBVM6796tAS|wL%lbd~jOW?P|Gj5Hb zHA2^UbedgJXqM)g$~iGS#K0&bC??a;1vhq{oPLE1C0|%!h__)4;XpS|S*;t5S~nWO z-{fK+JGncl9ce4|pQNa8kIJYkQ?XDwvEu_JT?@Xs;}{hJ7%Ws5zInVQ_a;#zqEJb&-9>dRi%y*@|89MYLmVA{o;x z$#2J>dc~TMwoR05tIC4tj~?8MbS~26neW0zi-N0EZlUe|N-S3yh=eV9FoB#FOfPwF z5ptGflIvh{t~J|Y!a}4>PN(NTVyCVFM5-B+G#3w?R&WMbvgg?zc^=R+cJVlmowX8k zyh=n$%mmu)4)fx2f*JMRUrPE#s(U6c(=}Ep@MgN4jH;~*r%gsl%?le>?1%*rCMA(P z&#zZ3C58(_9?qA|df4C;gQ`KIQi*BW~agv9dO@;#Vp|f3tKPE8?e*4(Tlocr*>s( pL(uZfy%dZB(;c(O(?V&ETI+T8K-hO~`h+48GOF-nkEJK)p!|HMgrao&Z}B|!pJd}0D7y-3pr;{!sLY2DVyi6h5t)1m$E@7c}| zw+$Q6X_0$(&vQ@i&UWA4e)#9C|9pwg&Yo?#u7xTgyO;v6qb;9jAj;Z&+(_cSP<$p( zFp~i-OcTRT(A;cv2?U6B#_%sLoGYHe!y!eFOQ2^vqHst{;kY`AJXDcGuL769t74!) z6&~kQc($iiETv)w^t>W|MOlEkm`q<#*1m7*qELSd2SL_CFftxOvn~|N8S>fc9EIjx zC<;Cb&5uG;Tiuk_m1L$<8@9>`p-lp`=?a{=hCB+%h=+u*+`{rlVR-=Sp&Kg!+_MF5 zL}{#^VW6D11v{D6kU3EHDCk6}1?CReNgdBND%DL34%s`ciW{}7?LNR3OuON^=oV?W z$l~Z{)b0wSSy@-A=EU+43!{jj7)-Mm;#u?%g&E!|`G*I zN-oy1mpe%9Njs@elA^)`Dywc&ilx$p8z0!vt>C*GJ~y*5$0y!!Ie1*TJmkbE%IzIe zo!Bd_ew-LF_SK(r+heoM%*3?>S`j(@L4F*6fBa^MSGTR7|s? z{(A8`NY=WvE23n3wJ}7$O5nRF7ouFfnZ~fw!f;i}J#^Jyi`BXUQLq(HFQKM}=@k!} zP_v?vTsxmADy0o8=lmn9X3<>XwE+GooZl8onKdu3`WScvc+$-xuLOuxb0%pm?m2DH zhr$BO{={-`@i89yvuLZt0xuj<5<92vP=JNGy2J>7LaZcxFV%M@ugWcEF?fGnT~3-k z?yWXj6d3H@@)iYgh@#xuj@~1RuW5&o&*-6z_EuRE$-t!Ya4}0u<|J? z{d|YM4t#EnWIB17;D2oI#0_n`_UhZ@9tX6o950RL2sFIGTa^E&7AWta)QRIxU^?qV khf#XiAUJw%j=Nb$v_P~cPQdF=U~K#2q~Zs)JmBBi|8H1YvH$=8 literal 0 HcmV?d00001 diff --git a/bgfx/examples/runtime/shaders/essl/cs_assao_postprocess_importance_map_b.bin b/bgfx/examples/runtime/shaders/essl/cs_assao_postprocess_importance_map_b.bin new file mode 100644 index 0000000000000000000000000000000000000000..facdc1613bab233b7928294dbf5cbcc33f6f9804 GIT binary patch literal 2855 zcmbVO+iv4F5Z!0>wI47*QGi-2t}Q9R7DgW01nmas0*hpummm-riMCl#q9IYXoFM<+ z8B&tv%O<<)AOg*qbLMC+q%Utj{`9W@{EX{g)}pMWE+CptKvdpZq!GxXGM{S2?3VaqX^jEp|K$AvZdGkDpj=y3t`YzGt;Nfef=qlkwpV(3-i@>^Bx zC{TsNSrv}$Z54B+xq&iWF}F(i05cs=eoJ`!zM=I({UPi*(GEjTf9D!?u9(gtA7$sj zHSSzd@PTW5;2KhP!=zd%ZaTHYQduEM6F|~*365+*UWG)=L58rHVDYQ4cmV66HAw*b zY{9iG4C&c5l(n{CE0Z=N3yNL^9SJ31Y=NEB)6q^!wcUbE_E)L%8@;J$4zL81u6d^2 zBJ38C?>&3%RG5+%)k;@_5f39+f`|m2lgI~u=Dm2s2$x!YXM|I{Eo%e^y0OcgZd^Fs zxCp-{7xUQ5-AV09JE?DyqQX5YQdbvpuFKrE57fz8ip`Bk&Fqxni)e(}S!}u-pP@6+FzCWzoSib{(Nem#GEv=>?dux&V;&;!iS?U)^bu+Z`o&b-I{QIsH!hZUN9m@O8}Y7ag2b%Vzok4^Y0xJbq*uiWRvlEfd4+- zqjl0&`oqKc37fjjjwnni5NJe$H?R0dXDDH>Jb~p7U^1Qns=}A1cuTJ4pC!%`z3Lt{ z#=@9$>xV}=R~0VtIi}pc6$VE3x?ynE2N>hsGWfPd{s{b`9wMhQeKYxJKu&ZA0glM2 z;y*+lz#!CDlyAO=e2|F7Dc=h)RPGAQ*NZz&Mar~cwi@ncVOXT_oU*w8q@L>PMLErR z<6ySyY#pCAU<_;7In z*yA2II+y7m8I8i=+_|4T1XcmD(lK{ybh(>YoD(~A?TBJ2oVam=AB4Q%-@E?-<|~sy literal 0 HcmV?d00001 diff --git a/bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depth_mip.bin b/bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depth_mip.bin new file mode 100644 index 0000000000000000000000000000000000000000..505f7546e941ba6109b2a33b9af3f3737410d237 GIT binary patch literal 5133 zcmbVQ!EW0|5cOF-_6HUy3Q)G9NTTefP_GUQT{9puM* z>YH7Xq9{^ftb^w}-ya?Quo6isRm9x!h>5hf5_6ZyDAjMX zz%f5Od=FU2wadIvZ~E*rON7pnh&jw5W1k)4!kGFq_GK5Mj2o~Ltp;Ht3Bq6%5YsA) zDJxmvvMY-%1X$QO!@{C{oy8(hT(e{zJNC-sm6-8x^xEV3{Z5P*_)pl56RkM#>~CG& z!WD8>@kpJT>$GqM;hO8T<~kvDCtex{To-JsM`eh3n*sASg}|;kkb@zvV?(N8Qwp0N z44YQM%Fv7`F!P-UXEM^nXPZ#Qng<)2wBVW`_h8T-Q3{-zz=CS?ZjDq;wjjxVOH_EP z)+s#)ID%1;JmcbGQe3$G-sfKaROp09X{=J=5ROA(9wIzAdv2fgXT2}I>JFDG_{JTY zaC20b)p#SzEN@&`-nf{w(S?pB-7VD;w4nM`P%zwqB6e9M7b*!&`moGfNwK~ab3JP^ zycZi0Y%NAE8?v`3qtypM?XAa&`e$zu&hMJmiA$cXGeCjj=ScDlNN+ zHd{R&#E<+|ET&t;+!FJIhv~=h&y~$`Q({C6_>;=ClZ?+61NI;zUq;LGQ6Ht6`zi{a zSRwzTTt3E3hI}a|S1dK>kj8v2u0*UK?^Kq|#c0-R#2dd5Z`^`6c_H4U1rLwci|*HL z!JGEkI+0o&6j1YIDRi4;r`;jiR66Sp(I(7K-65dGN=ctx@?f5!n}}QP%Pf6I2`Ds% z1&7TQ<^yJXVk|e8BEtHOh?e?skQ?&WL;an-kIz|shglEMwHw8* z4j@i}R1NR5*I!kTZm6!oIeP_O3q(6rxZ~;%(}e6J&YVEadEliu8E*qFZw9Qg^0c?| zj1?3D8Rdx*av3?KyXoG{*Vk9@u&sO_bX;=a>TC{b&-+n?myGo;3d_4|OB^>#2x%@<;# zc{gLydAtylQn-=l`sJA5*?>9jrYC|A>RFW&kX__#fh^^$L3UBI1+rAL2H8c-7Dy~x zF{_Z1ZdzjA?5rgqyJ*=0*{CHTyJ*=0*{CHTyJ*=0*{G%4O-uJ1v;<@qEn6TPwFG1r zEn6TPwFG1rEn6TfTH1bUtNGoBcPh;!iia)#rWv4W(@Rh8NAG-bDl%W)^2k@=1)QBc z4)wB+Mmj;+E|*MfUaqq+eEKWOQsHA%+FL`Vw`=u=IAE2P3*U#IN*pvW&4}t~hCjcs zDgKP%o{fKkTTX5dz0wS}?W3)?ggp!CLlnwMm3P6&Gj|FbO2IPTU}5xry5vIdSB;UAt-jonz;t zNt<?ap3k+=Qaw zz0i0sG_>6fX<0~S8nxZ6azf}P0J>=!9JviSni7#JrJEMpwD@RR+(~OwS5^YJ?>c!U za%1)E2FiKsWGB-aB9{~$O*#;26JwXyNFA;=DAi314%t_&vKw_*+H-(gFlvTp+$_Ro z5&7POSDy-_SzZ>ZsGi_^27>5+?pD}o^G77N;fVl-M9#! zl8b$8O+`1hcU^9-tLJ$+&|t(3`P$!_>O-Vtk0!8FUt zKjTlGVzo>6npm=|kX(mXP|}naW;sBoLa)5F;9q`5l! z!4`ahFWJ7;BHlw!m_1$9_5zVAVUm`pi*B&g#{fE(?SbVUEjR=spLlB}Qhd#eoY*II zS23jK`pOE%Q47gJ(r;4Dn7q!{SjFJKhU+VQSiI5dXpv#C8=NT$ASJCw$H%CNC+0wy zltl8fyj`-KSUP$FNJWOXjq9+mrC`QNeyNnU-Ex*D*8bPP8L0Mwq1V`(;wv}F63e+x zRRfPR-ZI|R48Xf>41NG36x2Xwr$X=+J%A*qLQu(QUx|I#lO6|^bRbpVjnbXQ2YcNM q;ONjZz{cPQcXWV;<@$T^3~hFlhOfhuXvtApbRsR?(H`;ioc#xTh^Pbr literal 0 HcmV?d00001 diff --git a/bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depths_and_normals.bin b/bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depths_and_normals.bin new file mode 100644 index 0000000000000000000000000000000000000000..132710d46cc626f3e10948aa96b3d3ed4220911f GIT binary patch literal 7906 zcmcIp+iu%95bd+~9~K1mMQ$ChEIE6D(T6tKOMz@#BxxU71cG8Si59XXNOIzM(Qn*e z+A~8@BxNPdCUp@QA~|!;3}-k)sRt*2e)p{X_wV=5p8aqw%PPq;5l(y|tHHILha$&9E#_7;HBYAd~qRKy^(0qIuNW$5R9cE zrnVJR(OQAWhgxAEV1?3SD-_z-t++_@xEAHS@YGWjTRM}m|6>$4{st@s`vc(!(ToSl zp%D$WD7MqaquuFg+^Z6LO2t;2 zlG^lMwW+1ns;cH$0QW5Hp*-!O@yoz-mA1_C@D@^QJdP&)@v$f3zF>j zGG89&Hx-=&guvIyGtm!$eh7zye+JE|sLMF3ioB8@;drDLK_h~26b{93Huy5I84mLF ze=_vpHmITK*o`bxcH=?WjfdbabFq)DxyIBMRGa!$P*~_dk#(yqxyZ{Ur;k`g*NMD2 zmh*bnw{R-gGBqo_T}owZGRdw#0%~i%DD%I!CL#R3Z=Q_lU1-pI*OvK0rk}&$Y>S3h zdaY_#TttMyP zvq2i)=BwH(CqG?`#Ceh}lI-&3WGHURq?UP>-U=O{tK{;k5XmyWlnhhH<)y6sJ0OCG zLrm^~z^Qns6~P@4(}zQZ2IBHO{>5y@{zEV_q;Q;8?^boOsz1E?I2)+ma568Y%ub4U zE>Cj`JwF~&1U#WcDi+}>K?hLHa*&RaOvYuhk?6YOB~FKq_t|)TJ6>xNSN7Fnu`PQ$ z({;!dCg2~@vE5mM*b|OnbX1X9p?G_EpggI_DUTbBKwTR(?$DXxr9*O(Jz_nSLAC*w z!#uC`B_LmLRR9D%yf9v3WphKf2p3YJYyi?TPxlXIVr!@3AWr8iG(Y*<;!;+gnCG~| zG?va~R?G6!$eB##MctVyk@(%YIxjj>=XqV{%TL~kyQn76zCmXC+te%Cv0mZ2z;^#KRu zJ>?RsW9rBm9Xq2_XY?8)v-$CSj`WiYMO?KZXuTM(pPT2+$hbG&SPQrI!mYJ%V=vrT z3v24+jp1Nbbpa>X({p={r%IUo>I(B*pD?-I73R4dyG9mX3WdHLh7|a!~>hDT)rRSwu7KT4FukmhahY^2r6}e zpz?%cbiWNZ9RyMwX?ME&U~e(Ww9v4%IZoCr6;suCg_q{@IE^Z#NVLYDqw!cXR4UyW zs(Wb9NrobkCkwoQ;gD0?;7hVt)Nc+Up>E8VY4k^$pU3H&>>4aJ-sj#NqR7IgMmkwS zm|OY@M*G zv@oRt+A~Y7ib9r0sIVVCLX7Uuff0Mbt;F-k!T!h}|GYmW&9+TUsZGEnm+cNR)j~Hu zmhWxAHQgtFm-YPW-Ni*EYis~FLUlR96+nB%M?kqnhhaj#Q=01zyqWBT3ODm@s$eHn zbjr893U@*UuPiE+eRW=1={M@6&`50j@f!bV$9oij=;j<0Cif}erE5zexKAPMQ3zWF zm2WuUpQ_K(GyHLR!C-QRKWyR#*JQOE=o#F4)eK|;mcc1$Wz-Drq-w@*w7!t+ln*XshbG8m3J-U4!s29wv&jrPx0Q(#=6x> zIf0k|zjwo`5fI3S*K^Mlb@j23%9DQrhC7^!NPr#K)Yr=z|bqAPc05LvGMuQ{sVqUs8~fmsPco?u7}?B){~@an~N-7qLb!@vQ3 z0)u|TGYksRFo2Qk>0@_^eZY@lP>6;>x5CFV?CEW4fDdi`3;Fwk(}MJu7XG+_deGPbPn#M|mBw_Vw(i)HzN+(0 z)oc5OVsrYD!-gJdytdd}ZcbHO(qe1RI!dNubDERGhP##Vt?3nwZ`OzrZAsUz&Q3a= z%3;I(-}q+X!#8Whr^J@D*xI-`?=M;ByRr4oS)rXcubk?CmAoeA^yzIMBKU2pKJxkz m*y{RbV^7etz700@BRU&&n^ATL-wYdecd)~L>@WD(^6WpEP!g~J literal 0 HcmV?d00001 diff --git a/bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depths_and_normals_half.bin b/bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depths_and_normals_half.bin new file mode 100644 index 0000000000000000000000000000000000000000..77bd2534a3a09705c7dc715df441853d25941cbc GIT binary patch literal 6878 zcmcIo+iu%95bd+~5B7<`zQ~R3%967e7=37y?QVf=TO?^8S_Fb((}@aM5+pgk6#c^e zsXa3kNl8}IYzhZKAd)lZ%nXM!WKJ&r{^^PN`S<51PkyE4 zN!^NxFjnC6p;lN3SfTXT3WfH4D;9AYmLi{Jj`|A1n$CFSJ`2LiUyr3=zb6_(G~+bA|C@D@@QJdP$)@dqd3zF!>_(O;yYZpy#)tPUa}h^lt~J$wYE!=p3JV)hWZf!>7HPiZ^bxDzE|TkW zIV-1K3zu>uW4prPQYw3sQF8YIPJ*nSq{%xl*llTb`t$gJV##YNMDUM+tEgoG-Y4R=linTsjdJ`VFG@JUfG-_h@og0 zMu!A@>Weq0C(4t8oN~Cd3sjUr=Ems0I?0Q9OgO37ms{FlLiER99b{1 zvRhOCZbB-Q9Y8wfsq-@vTRRaaVLV%*?Z`jpH?nZVEXD1ivUDbsQsy5AjmcOp%GOkl zlxxqGY1WduPRlY~e$)<6ge1nZ^UIfHDQdJMDr}9XFpM4|URgAyNY?-^;xv;l=ATzZ zDQRyl@{#=>Z8z)Pv}f0zi)EBJBD{v%cD6rg%{0Neu2#Kb7UQ@&ju?-8*k&P+FO{L# z8+YVRTxf{_eGVY(aueY_H_?B?$3us|=^eKzUu4ndgg4|JZ~z3Z;UP*qn8-j z;D@sr(ofD6abdQ=crn^Mwcopeb#Jt*Eo|!x+uFjqzOb$>Y^aA;hJ#hr1)N|<&kY-% zDq-@gEzEOW!sK>anCH5LIVvqPcy3QvM_k4#W-4U9Be1FX9b$J~_qg)T2p!=li&n5l zhygNVmZt?$&uk(-*i7Z}{RrC@g4${za8w?GuxlZx)B%FZ6W*iyZCJMuNO7RuX~&@+ zVv;e?u(di)wOJ~rs^tkMPG?~p6iAU^gP5c7)MltuHfN~rp)p1YibNXC@$|tVr?$b@ zQ!y`JpF%?2Rd3?puQ_Fz5mfE852W?ZDK-g0wy)tzCos1=+4FRy$!geo7^i|&Tii>7KJPk z0B(fpT7oNp_KJ^ya*Gbbn0%)+*By8_J_r@=#QRjynd-^(@pUqYUx^X^=$oeji?T4|MU!)Cmc5ujuv4o5kxWuD^n59%gf zptYQ%s z1R+l_BnEc#2N>`$;<|1b6ryF|4gCQI{r<8H3ehrvk?ZMWqr^Vok7ZDZmO;0|$1)6c zn9M#XM9aXr_XAP#^ea_wv;wpQ2pZSp$GX7VKz`ULDM(9!sBtxXECmM%j#vhT2nM9H z&#%r#>C^9Te)1v@tDJ^i)zPI4w^h*OdtI_BQ`KoRbxN@{sz`&)HyE5NX2iK^Mz*5t za~t0pH$U~Vw*PUf-PQ{n^~Pmg{U_Y1;zIwlIED!RRwoj1djz(+m({U-)RPYEuXye~ F`40p($m0M2 literal 0 HcmV?d00001 diff --git a/bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depths_half.bin b/bgfx/examples/runtime/shaders/essl/cs_assao_prepare_depths_half.bin new file mode 100644 index 0000000000000000000000000000000000000000..797b93f2b1441df5910d5143b17af2c7572ba7b9 GIT binary patch literal 2413 zcmb7FQE$^Q5Z)`{Pn^Vy17WmDgh16E&?aCKNNAmSV45tiaa$uNjvTjZH|@W3cH%T? zvyJs3a__$HyU*uyaytF~`l$W=d3AL3X3cdaQ~}9&1iT8?e3pPHD)VzCiTgwG89~lW z0yH<95bi;9v(g0+AT}AoTU@wQIDv=0M9YhyRojzrOe^8EyhPe{kwWVNm;dWxCxI?% zo^w&FJ?~;J6*Hh`C8<}GbvWbW(Fe+!{l*T3{$uEYY=j^(+(8o$#ddb}YhT9uL+@3wnX&IsK^KsUa@i93)dDG8}5U0P~s>65gyLu;ukYXRJ|A+JPX zte@RLxoksrHfypki`q9X;>YY_ zA6vUStF5TF`m88A>`7U7t3u3`&fWOHimnB}z2Gx58A@F84VSx&YgbJ<2#R9;8>J57 zrB;6rf(ZUK6t`vu6OH;{E>{_sS4n(*P{w5jUA39MVm+;t$#Tgq_&nVyHkp!XmRDEf z&z)jTO81&rvAmRA$7fK{jF)CPRVzK?lR&bqS{b6pALkL=h$0ik;$$4ctrmu>LT!A`$<;#CQ_aFVg8ub6!kKHshDd_Q@^JtX%>%q;e1!0z0jB z)a~epC^*yNj^if^PH>cbbFPm!+vANd(#L+uvP0~4;xBCg>X?Zj6FJ^< z*I{8x!40eUsZ!c@%SAlae&u7|TZUO<@90-a2;5Y1;7{SN~aD5%7%IFeFqVR(TYdjv>&@7A`lpxvDMO&K}o(A`R|<} zC5pC{qq{)BaOS;voP$&@Zod6;VEO#c$& z&o0b(5kfpGRv!EWC5lp|z<`m_gF{?slh=pmZ3>I)f@RyG&`6@tTs1}Hs))d?;XdyI&Yx8P=5ehPPD_&(`#JA+7;93@=I8?nAg@9~W*{ysB3Se)EOKBLT9O3N zKPzyVqy_0|8cJI$u$D<1p$3Jog7$kC6S2xc| zy$I?>=yiT}s;MXxPxE<}3r0MQU@;`O^tjnUqeV~n3{a-!ef$-lXNoZd9YMTA+l7ip-%ranM~)9%=knE zmuE`xHRN%@)kHX@$oXt8g=!ogWvQ;xd5Jzc>|HwNqklh-Cn9H1-Hx;)#`jzTwU?f^ zW@`Yn!Qy7;5Q5WF{}kszGYaCm9^Rh!J9g=>U|`r8Yk;3V!5<#{4!uO%b;nc|H1c0W zF`BYGw(W*zK%S6k9)Gp&Vv0OW6nOr6w{ehUt1Vsry2}=ny8Q0i1jMfx@s$@-p|)e{ zkVfu@rbxX9f3w7Iot}S+wWH%PDwr*zw)<<6XGD7ba+yniZ!F|9rLYg-t3v_Wc4Baee=0%Zpdvz4JfZqmKD2j(6kzVpvA#ik{Laz+Z!z@hwxNbDYW-f+t&7^c7j^EUmTjme-)D;n9Uqf$>>k{n zw#p5<_3O_L-H%Piy0Fv!&mHqb0F&8>%Q#OqBBuKl9}H)QZqMx z{C3JyMqD)HICI)-v&4@OePifQNqTpWp=!4yO^98Cm%^z>e}!z%0|ua1?xx6;!1*?B iTz#Q9q3X9adhnMxylwYb9TLr2goi5EbcAR8fAAmH@>3B2 literal 0 HcmV?d00001 diff --git a/bgfx/examples/runtime/shaders/essl/cs_assao_smart_blur_wide.bin b/bgfx/examples/runtime/shaders/essl/cs_assao_smart_blur_wide.bin new file mode 100644 index 0000000000000000000000000000000000000000..3148abd916738a96c9a23aabab567cbaa2d6d05b GIT binary patch literal 3591 zcmbVPZBOGy5azS1{)dq&Rcr7WCpHyTl#>YDwMd*=g&gdG^`anOW!Z_RpV=^w0O7kB)vRMVf_43~tW>kr}0!x)8=${;7zV z{Kv;n3l=79)*@;= zGF=LCU<~8(4yg|8%QX4tz=*+rciBlyr=w!;^evJ=L|@(h{lPNQ)2T{(b{SQ*`aD`b z^0AnC4P)h5@{}*Kuf5+}i&d^vCNbihq{vx1Keyl^jDs+q4;>R$X_$*7jy6!I|1q3D zE+Jg-x#(YAq$%G(=I1<}i`G$Oe6fr~+5|jAMS2}C3yhJ=evX%X`tOHeE;0tybR>%i z?sx=LUb5dB(-6qO{Kj$&{j)Rs4EsSc3gWsMPeubnKiX>;Dt5*i;QRORn+d;yvv#nb zPQkUEHfHk-#(M#?eFoEi0ke7rgIV9xRt<(}gjr>Jb8v!PP@U`fJ#N(k$HwlX>w@~F zOu_&zg5Xx3MV;j=;|Zp?5LT6T;;Rf{j3rQ+vtnW44Z36aBJk{Uc{=LIR?090O)@YL z2q!~emG2nzil_>m6$yr@2q~3DyV5zrLP|K9H+4${b z2f{{g=R#q%E_L9li9S%PA!~VQt6X}r0A%-}x!v0>03N@tU98sQ-N5q3-k3z!#B2{@ zCKQ9Cx{28w#EdCs-Huru#Ed9rJ22Fybb+cZA$HGBb%Od19dzd9q{BhySB^UzbQtBR z<9w(ohE40>8?tVlfzdRzmVRS3M_}V?nrvSU!PIwP#%;{zb(l#TvwaGEb$|uC758MQiw#(mOnKyI;a2!`E8sQP zve3-mwa`TGnK%J)SkNF{@GxfbUXpVt$gi(3LcMU#Bma*mdEn7?T;eJ@ejU2L!Z~Bo zh?e>apKe()4UBLGj7JfRM3zk+dCZ6lT^5dW8MR&EtCO6va;Y%>e1}WbVJDK%vCl00 zGwHjNz6G3ndyCy6@8;V)Nd-OPxyQE EA1{ZEGynhq literal 0 HcmV?d00001 diff --git a/bgfx/examples/runtime/shaders/essl/cs_drawindirect.bin b/bgfx/examples/runtime/shaders/essl/cs_drawindirect.bin index 42deaaa491fa5def1f1ca2020e1c108c26e2300b..735252691c8b99b9a75b0d54cc220c1ee0743334 100755 GIT binary patch delta 179 zcmcaA-XJO99PGi(00+4|8wIkN>PyQ~lZ_O>WPEW!PGX5hX=YxDLVSg$LbXCsYDsBP t9z<3nzCs5iY^_ks1yXJd7Bgs0s!qrINtyO delta 30 ecmZpWyecl>9PGi(00)P-Hwt7kZB}EB;sgL%Tm`uR diff --git a/bgfx/examples/runtime/shaders/essl/cs_drawindirect_count.bin b/bgfx/examples/runtime/shaders/essl/cs_drawindirect_count.bin new file mode 100644 index 0000000000000000000000000000000000000000..908fc5e29d999cb8962497b80a65f1bca1bec12a GIT binary patch literal 3355 zcmb7G$!_CD5cM%&kbfv32taDHxOj3H5=I@7}uC9LG1z8^P6l`+|L9Xor&xRqfOE0o%9tAr4@nt@xX0^6b?7a_JTAzhe5Fy|u7>A)IjNfJPO z*5EQq3)0gbDB-QaLM9n(0kSWGPJ|NB5kMt%Jlm*Laa!<@{gLtHk?(W52iSt8Iy|OY zSZZM#+J{!(iXvla{>Jk_Cmx+(E+SkEc5MTUm3Gv+8SZ%eof*b>YgQWuy781r-MEmt zabca4i*;<|wo)5XCH0%6sIW&x>dG_k;LWkP~B+ z?*2il6Z>1n|2;8c@WYs$#Ed#>_EBHL{UCm^t=E$@!ZWI>@$?zxX?0or_LV&bp|jFr zcHm{9=Y{Xs*pf|@`ceAjc4^@7Wj;^i18mAL3^Fk$S?UG%tYGW(cWL~PWu`&i`d(gf zT%Dyh4cKQ<5%jtJD8nX6)`nZ&E|SzbFOyrN!)l;5hWDSV|bT|5>`EPN`?Leg(|{{TFjuUrIja94?*_)l};+b z71i}82c}@k1d(4o6)Y<-05?BDvH`LQ`^>1mB%)!OfsUZ5X^h}#cRT}~%DP3MO0>dX zztJz`!}WBE4<1p|1NCYP*Pym0Ggp*#3%_*C>NS8oqIOfjs0l0=mKmy|x{Ua0H*%BP z{&Xl&7NRo{Y*d3YWbg>ZV9EH*Xfp5a!UFi@Ax-Fc(&c9Tt1iD}1s~z{WUC zcP`#(;}3^69viJM1+tp}4aS5BjTzueRoH0fG0#?-M_&t7-ns#;mTNEtNHpYz@-7!Q z*cJ&>W$nR8(q$N3YHE>y$=%W}hBCmJO zYm?VM=XC^DR`B>;H>WrK^{p|n0(X)MB?6GU*42Rs%@jhmx_f$2Xv9{%mCkSOOU%|*xc~~J01PNnE7Mz~Y?7{$BZZV!aa;)t06`fx2_OJygL0CG z+h^Ga*>maBeflyNkdWilIu&s+)8{+))0dg)d3ka6Z@;tu{m=jY?sxz3(`ddJPbXR4 zX=kIw)=#5ho{cAqVO=R41W3VjBn6{YOL2WO?Ju+WaMs|X%f6!N z?6#j?_Km(>Y6bFlGp`YzX+X=SYnn?_FsH^t>jX`E(i8*^n)ZUGU9@iZaxuHCAb^bSSH=wCy8H=Zm}9v4t_)ew`Icp@jF zyp$*s6bXAoD59phB}JuZfgn4XPjAnsKQAy3zy)myo{k)JFy@u>*@TK!Y8}C{AoP;`Fu27zDQkoJ6ery+!ZnxlSC)Slb`+@prZ4$ z`SgeABs6}LI*-C6FBtUXwcF{{=;ph;`{#%aT}eu1ulR@@t(X0q+4ueP(RI%unk%#Z zynnm+E=OLNHb?I|mq%yt|C7$;$|QWh`HKm`S%3KBS^ws`yXri{;O#d0tu|Dl=8L~? zaVbmF(X~b&n;}(pbka?r8$fB6L$f^HEC;^uKZDnUhP`yd9yjEsR>4(+4xL{3lf|P- z0aify!bVy?E+9wmP{2exB_LOfqjxA_qGdwDqru|hT_;Eat-&Szvm7 z%?E?=a$$oDeq4`7H&P*ctc687}&7$18Bfy)7+J zs)$k~W*6M^pJFo5fXGAvY@cUDrgJUi1_}|G=!0ZECezvGks1BI>92C<0Hc@a_t6^W zwvYPZzxS<=R1GM!j)**|WCbl~O0-E$D`-JoqD`t>M$7q+w6;#JIPvfKk0ZvWFkV_w z)m$}6bv$*?B?W9?Ya;lXA*GT6CRqnS>90b?-waDf0!%*;nhrF$vD3vnskjV|L4n|T z=7Z-JJZ~uQoaDy#4GnG#dGSsvGlOI3Ab2kT?^*Dk2JZ=Y&w*0`N2^GGRAgr~u^(7$ zGcxJBYKx}njn!%xElqC>Q^PI^dePm+Sl@J7Hk-WQ>YGj~45$mMJp31X*1|D7hMhMQJ6#^rNsS6L{^SjDi9l z7iIgyfX79dz-t#}gU3bL{xINCQ3mYFq6{EVl;K|qEGf!JTy0ULjOk5u)hWtJdJ|!F zigHZPMR`22F;-BNff9o&U6herv@a~mh(MuJRFn}#0;jMj8x)*J(WoFQ%7`KnQdpD? z3QnvDB`nIne>q*a(Vy*JhSNo3wXLS)jc2>vgS>OFm$&yj2i(V?j@c0*NUezg>}m~#93i}563g#}ozt`!g=vVs8Au>t}_RuF(X zRzQHr3Ib5a3g<&L(Xn>aL4fPV&8I6nDMN}#X|+T{OTv}_e2oN=l4`NWCjj3fL8O#g zv{3}cm*1ycWk)cLFRzo9?4D|xC8hSZ0quoV6HCvXI0Iemh zuC??T@}8SfBUGfYLvk@INbZbA0vjMwWCMrff>)5-8I1&HL8Qnm4#`EaAh|OZiH8#x z-_I*5Jy-cJzQDgQ-o@1+u4qJBRpq6^13lGxhkyn_=2aD*hXeg4BT#uaGN2(4p{lwg z0#kNE1n())y6kEfMn3V$du<$8-$YSkQCFMXO~Nm)h-&-Z?`~V+kl={Ip}uIY&3=hBp0qPD+2Jz znGL!mfm(MJ&5WLCo+JsF9@moH5;3(pdXK7L5C%kYiWRwIF|(uhsEAzCE2F+1+#d9J zk9rigS86Z?#KC)XS0P1#7Pwyfo|lpf_24CCybL;Vkcd`94mo6gJAaxpyyPn?YGP24 zh#`IGvR?KwXB4qpW~RoVEfGWJnBO61P#4AKt0J}yGP9O>W)@#bbF% zIes8UU*ZDoS=XdW7nWn?65x;o-I4`TY5>+?l-!`?76n&l8Kq=_mK%Us7^UaZ*3jZg ztu!ju$mRgAoBH-~b;T{(ih8EKvO#fc(3MtY&y=pktwASlt#nGZcCzCVsV_P&cal5J zk|!Ozpz&8sjn8PUHR)FXF>OjAKvR-MDQaCQ5IXJ?Qh@pdp|rPt6o~SrU(%FT*=pIu zEi=X|UZOOkDQ8=Ah)7+vqF96j*7*h&4s{qLtWzxyn22!7O;mHbb29>{D@3fP>aToZ9gf;i&k6 z*}T`?md6($@$i*zAnN`TZ$=<-JDb7W(WI^qgNfr> z`l=bE)fyn`YaIfh?f_6<_YeRr008wZpa7g5V5V4LhoQMG9{S%*8U2|C8`+y#Aacq) z4%ZJ3!S&DD=_uDOuo~i~tmbh2$PrxsY=8^KMBJ1y9j+f%g6p5PxUMGQ9JGE-lD?0o zqdfVMX|)6%0oJQaJV3|$S}?g~dJhfliQ?6(ON@Y3Nzm+co3PP}h*qyIxygf|*{L_i zCycdc_ZJ`Bg5s6AsqP+FK^q^#6D)71H2J2<89(m9XWwCQr%6fUs@eQo!KFpB`58WS z#gn^6dv(y}|L&kapy?RR`$ZhH)^o*=Ae0D0-2rh|($LAIFm#1wk*REfEZ{U_8naqN zvgBF0ERZv3R$rDpZ5WUxZ?G&fO)iiHTyA7B>rEs}uR<2cvsjj1p)5Tki%h^%vJfD| z-}u91bY)jA-BgU$#5#>zZ#6y{K<(A_HHSbD00!FxKmZMQkpbEkFN(z|Hq+3UgeZpnSZ!!y?bGF-M)T<-t-YVNw!waswNubwZ3F!% zYp0;W+6MYj){dab+B^^7Wb?XgQy1yFUjjPMI0EsBQF1MfhrWkjt_r|&q!ykNu;e7^~Wc zM(m7r^_NBi;vDZ)bzsRx4My`04nhB>&bZ+zk4-HwzSEM1{>NjX-%iiQY3Q`noxQcB zE&@->T@RdkL$#6vN3(8QN_*rlA3f$ z6R-cXns{eDO%w}Kq=<>p<6%rF{@;w|x9zXmN9Ik5v1CA_G2UHe&ChUrd%r%PBfD-d?B#X=~pikP?)b?WUs#X!lFpVh)0}1IInF(wuaOoikK{~B0~*@OzsCBp=#iKxS1n!Q1=YMee;*q_F?cK46bKC&Aa>04(R2|`>F== ziZDO*^9~}Co&=)MJi=bjWn=@N;&Cm^ytZIU27N6KrRd3@`ZVyQ5&wtv4%ZbkvH(O6 zbnWz8CX-#vE|fAG9IhwV7-n{MwTou5p2?8^3u_fx+ax=$2lJQB{`?O zCd~29k;fcdSciFPTv)(7b|y17H?6eh;Mr>C=|N)w^VrA8oLRHxGMt1oEFY}NaB_!| zP7Nx-W95`;P?;dEKeS8`*B@Xeh)H2*aM#*`uLqYHR(-1 z`S`uU;xGo<;P9S%)8D>s4;lS)AO4%y?Lm_R9y$Ehbz5)lAoFF)Hz<6+CGDWTw%gd% z;`qjvtjA8SWqkCnrRjrn@n6lS56{ehF-_OYQ#Z$#ai+wt8+Co6IsQ&+G{P&Xaw`od z9h+Nts5AAiC)BUJB2Z7LUwNURo=`HB-(Xbf@{I$iXvk_;k?M&kGlh+a$T7BQ5oH## z5fOO}YSSXh3}+)E@)xr8|ID3KG#y-`ppPOnfLd~=7KB@aOJ{T8;4cg`0_ zd~E~@-|;DvNFpc-hW-76UbDFq->(v8C~G2C{C9-PSet-|{9ee}MUdhvLE*n(RLM7Q z1Ws?S%K1{LD8Ax-|LvqozCGX@c(R-?#RT&e%afa7_pF4UY5j>FR~j4^my49M;ep#~ zXPez=2iuLE!FC_k4!ms$8eP1J8kP?us8>FuyrhII35&FhURXpD`u8pa2|0L-gkD8q z3E`#Cgc*rpI)F+flmLn(v=97Kwg(b&m>CJZBEu5Gi>5^qrbDenLJ74Sa7RY+6ZpDEke%H_RPSSd{+oGPR#?#^62Q+=p?y~G!VAMQRu@AD%- z(K|)F=+0fId%uf&arYa#%T}NQku0VL;)u zq4+BCx$ug7ZU+;d&#mHa_qDYYukd-=8{%{6Z^-B7g}HL>FhffCT)Gpx!N2%i#?wik z3wO-(n#|oN1S)+lLniV$vobz+yujx&N(=KG`c$V)mCuD&xyb`0cW`u0sfJIwm+zl38T1m2_v>OmZ>*?cso7q z-`@6Ns7%8G;%S`3#)Zw{z}h~^tMO#ipC?FA?U3M=;qZ3)<_`%H9FTk20l(uaK>Tq` zmBF(SYGj1VR@oDMroHN(JU{Av)q6&xJx_MXP}Vk-h1DBCoPKI?45uEjV*3ujzLMD4 zPBy?Vat(TL1g?0RHT1reJ)C93^+7N2$=UeB_i4opGVKgP|9}a7f4-WsH$#&c%E#FQ zCUlW|^8JG^5B9rwDG&wRla^&u?x_~Xa5@0@U@Rw{bC7fnJx7ktIS8~u=cLt&oFg70 z1gcX(lDgVuXmyTy1SUlz0+*q-xtE|3K@tu^(3(y@oso{fWu#BwWu%PPRW*+|q+DMzS>hhk zPLFIx+B3{gG@_GCMXukZEX-&_8Ob`u8R`2Ym675WRmV5%7MlgiEs2b@Zb?eA zA-7b^!i+YOkW3--%=vI{`A+Qv<#SIr&wX#{F%)<)Hq z2fCqP2A|+q9rDJ;z{mgiM0*#ur+A`gPVL=&+_B=t3ZFv{7sYq<8QR|Oh0#&eP+vcI zgF-lQtqkxUr?)$p$l#V@eHq+&y6*=vxHAbE@HJ6*Is?26ubrXE0$Z?&?$@`-Jw8~! zu0>dX*ouO8yeH;#@0mpN9%3nSDc?h5UDWO}Ma^+>!f*i1Lk{8vIFIic`1hubC!(_| zB7$qiBf;6&E6C2>>qEz&Z0@cjC}Sm~_z2#B5Xr3P>4v5kCjo^>=2IjjGw~v~+a+W| z!#U4M=sduL6heWqL{Q%qNkNT_Hkz<%XGedU-W*M?vYgf&4DtBFTqyF5c8n!KJ{Mfgj7 zN^$x;Vc-#HZ`ClL<}0LNHGslu5&OgE!CC-?Re~rycPI)`;)LJq{WDZ0*rh!+<|1zc`c2jpe0NH4*UeSj<97f^I94|IYFUTx#5m{8`h?j zDm^HWlo30Q;GJewX1MBR#YPSiUgl%B1^6sHwwD+)U%5@SH!56ExutM3YxMFtWhYew zqGS8s8&`2bmvM;$kpWVun1!$%81E|$G0%!Rh$3Ar1eP_91SJLN?jVZPw-8w7d@|$wKXPH+!7M<9Dm9t~{8X(H$JPr=8gwzOkB-LFHLWhXv%Hsq4qOe;O`X({Mpd5gYq~0xsO>h(OwSOTNbN!F z@nPMOPpr7wT-eb#jZ#Tu6}xrav(1}0X$qRNyW=b=XwEvsX_0E~#J?EblobJPI6tJ4 z^6|+>nK@!o&9#pZM*`kdMOzC<^->I06*0tTTnfzh&LO9%e3oLc{)izyq83NSkc>wJ3y~lA5!SX zzTRfs0ea2)5TQHE<8It<`U~|b(rB=eEIQFWGJ=FLRP)~t)jR~B;{GrH_kU7Lb$5*^ zX$LAD;8wCA%58c@a$(pf7bbCRO>)`Ej*(0Mj^rXZB^G5D8W68$xf9(Jj}g7`E#WHI$VViC`6-YzV^!YXFC-?lL57 zVDaoa3wI2(*QwxvT^wGyX)K;ybV=YrP&vGEi&;Fo0^{R_@$!0JY(y13{@MnRxU~(= zM~OecOB&FcGC)!*H0%o-Q-G8-osF*mNv+ldK?X=kquGE9kT4s~s*#F12v}aC@C{~z z9M@RLFkv~23yoA&SjtI$8p5$sw)7d%WGyIxYcgU>8=aJ?eMU5I3(DS_jJPHmM#>XD zBbvemrLI0BFRo!cSLCEr9iV&Wwi1Bxkv?hpz~EFx6g68EsgvdmtQbEy>X6pED0z$NSmUBpEv92#ixM+Q=V=LxExw0Ut%48z+P09{?nlW2j4EOX zt(&R;L=U@BVO;~{h;U1TRYI~ z`E$1eA%COu2l$3aYqCIoQLNHO|)3ZZV1HSm9)}Y(F zoxSII8y~f_`|4pU@BNzg?m-T%4uXfrItRN4d$5ygb9>f&>Jd=y=HC!K*nM_@PZmL2 zPk?;@=^?ZZQIej5AB3mBPIhO!64`YlCA&Kv%C4^9TmWQOXMEY+g-~{KpvVr-&6ost zvOAZR$gUeH+1=?-c6G(buFm+fy9=J|Hf%2D9|ksX;;d}voxFXp-RbT=@3zdp@VSWY zF1&aZ)T+Hbs#SYX#bm$62h=K(M^Y-Pmm3mi&ALT0NrHYdnbxdfZ+~_lBL%5>u#M ztb5c(cHE<|yf;4RJjI?EiREvySAGgDpl7CznU7t_)3A*0l)3>Lm}|I$J$BRUvR!A* zowu`-i0bSFxt3>c+^|VWyA362mnF5LO3#k6N|%n(LN9N`1;>cE&M}`*Tv*hz!%>J> zGVE$)EGq*564&(nB<@ENS4Bd42ml4VFrMMwlJ6mg5FeS2J4SFZ?GTL7l3jm{;NsdK zC_UBhXhyA>a0KDeVKc)NnXS?0~ecElt-XO(b zksh;addzO-dQ4|793K~p+$E89Yw0>kWOu=Kp8k{NzR0e5D6(;th+Nglmx-K{$j+OA zmE8p`vUgTn*?1$~*pz%DS0~ zS3WA(sK6VldFdg;aC_(_XL7(`8<})S4i~tQ3c#Yl0yGSnrpE=Up)gJl0i+=@=k*bq zZ+eSPFies~n;#C%QF0c}*Ki_kjvhZ37f7B4s|Bl1CsfT*t}%p}psRJSPbk?MV_k73 z^_9Lmxyz*nskwWwbnIr{$`_34R<(vzn6{%pwt61UHzVz`fVN{5rmf^5rd<|=sKIjM zt6vb!WpgCa+zaf-P22=hL{zr?H3VEg$jOjyd9f(UH)_V!0|FjOZ0PTJS|;n@Z>QMY zvwcBhsH5E2GeO)~#~#)30%6SLD@Zn+L)pon3K2$1$tgH~f+cWR0qh2Jj)epF_}-0@ z$LVIKE}?ELG0wQm5q1-WlP=NE%c>faMBwV?GVr7BBvJUu#LM^luOz!3M1cT250e>g z#k5gGv@N@8Fio@%8u{IhXS}yhw{w4()t&RR-uF zx(Xr*?$~#MJ^UY6!{pgOBluY)IU7yntR=hH8EnDQm!UpZ0lJAXogEzwa5IDH-7=#y zSFQ1ckH8C8hqzY*?B-`e=!)mdd1mNxq02L&!;N%`=z2oe6S|(I!)-f?=(k&w(tk`_2cLV~>-&2h8m zRG_;6vPaOTUmYG9ntp50f?G?8B%lUq*b$u8g>;ep0fp!5}Wf$=K(T4&zp>uZnsnUToY2PGi$RS9R7CA{nUO1;6|5G7^ zG)H_nJ>bD>#Uc_Z?u8y`N0K6Gv7|(bJF#ifyUF-^I={^p{oC2iXx{xY`+73FTfQBw zmUr{fi>;gfJ!sK@wb6d(*>x)$j3-y)$%n&EGy8cyUXG@doBK>azK8v1XW96+|6v3` zukV%`>8I)VDmz)szv?gUUQQ>CEwm1Acrlz#+AaTgC-~hBe&;Q-QS=za{qOPU=h<|= z{Ce_cyc*ps{#bhTTkq<{_~R%|r>|HVkQx~3OO{!D>D%TnTd3T3?LQwiQPHGX}4 zy%;V3f7E2J`m^Hc`tM)+7QT_NrTQ=Gv@-a&)53qd^l#qE(si-m{I}-3S7H+9pk1Ob zNS*vvN^1AdutjUS(}{{XY$l%;8!nV|MX)=44E2PeeB(hmu$BJtVtrdC7Wk>QSWs79 zY`J7OANCh7qoIk!%i{a~d^Q;^7SO5N7zMWv z9kbvJ%>tle`lU*7uO2X}A7{;h7lW^()p zRswQ-n09yG8t#68{}24lZAm-q*`4zd{p-n3^%&qvhOQWZ_tbu<+IxwC?U)h>*oXY1 z;9~`YP(mf~&K4?(H-kMTgIk8himt_r^o^ml&hb_F(p^f%l->`@0SIf!koj;%lTo<8 z%q-zPGlVY0-!V8o^>QbK<@xp@&_QsUzsLMH3W>7~O2>wbQq41Dbk!PCX$7%UtN`Uc z&QafvW>;U1mnUYE#~JTHdX1LD@{r+PyKdL1+3xBId@k{YxrqDQ>Wla8Qs29T54}C1 z9mn@@Ob9Q1z`uer@S0Mh>^^&r*Kud*{*%W2HmnHBiy(0Gu0N#xuyk&q8ZQt0)HEgk zYPc5(o#%gAzL9eQ6%21KeWQ=>R`%I>2$b{fbM8VxEz~I_(Wx%tjmx zU2F-E(a}@63Wd&$5KZBbpG7vagukZIgehf@xpA&?2fDZ@dnlV$P^Whbx{1~9{UKcR z-sYrldP(j7HF^-e_z$C5@AXXVT3p}4et{7JCmn5>rv`xB$vmvHw*zmTm)&e~Zn`8G zL))>+l3qm|_uZLjFo%PQT zC+FLfbEj04!!;P&fr}4_b~MA(>bTZ{1n=q?hH=Dc63g)JBD`0JA>n}9i4*_ z#5oNifCHMuY`4;FK&ll%oJ|+_RaM-@$=jwFhYSs7x4VM*B7A4Iw9Ut#VKtx}s3Smx4R_mG z8SHejS4oA?FSh6&?!|ICA2nX<+qkeaO?aqCD_ini;#bqF#@FhuaVwk6S{dEvz|~d0 zg`72Rro;Ztb@Duh%*E4gM_0)5+Ig?ye{l$mDSS{dE50>3n)O!z2lk~md=26=3Mbq`( zhv_(tX7lyt+wFBsUoPO^Zgi7x(&*x5Q*@%=qSbV>UCpC7it%J8+J_Hxs`EJd!-ddt z-AJRAAV?A+2und^Hj6CMEZ}2X76t-XupF^qv}P8U*Nc1;t;WlkKV9UOO#i6&;35}& z6KVzglgMd=M`CE%F-=p|6wGPkp>;}4Gu0Fbmzrj!rU_a%xmYi+^NnI_yNZZh6y4~e zPzFxPA+;iD%p$f}hGJQ*SZ0Z7(JfMl=wA`u&gL8BV*-lKiZIc{11SlmwL%_I6wF9a zQ4RMNq)O2OL3XxU+`L+RTw@-93wkPe`szcXKBS$!-}WRcHmiKTUM|+t7;$10y8wv` zXnc`&qR!*JKlbb%o-VF$*+U3dP}8Wy8={PP!w2RKACfA%U`I{YP}QJ{Y9lBxbfA#k zc0RjYtZpcLqV2_p+4SS9>3H)vbmH~2m|mMRWG)u*4$kHu{smCp@#Sjqt9K9@zYHBm zGQksq9z1umm`tyKN|T?xZs<&ql|JJlazKKc&4n!qBr$)pv|_?2!k;=?2y9D2DG8;K zD+KIC2tFAhurmo|B$SneKoJpwPa;GS^~L3sby=^*U9!O9@{&J{W}CGRF8Fden_f@8 zDxlJhH!(IxU7>Y{K2U4)If0yhaXBmD!t{c1Z}RnfjSB`_e@;h!N6gRTKk17D^lcSV zkm0lWdb&~s*WI4WP7>kib$+uv>q`z5T|PXQzc-rR7~91~ciz1*`N6^oTUj#YDHchlED6Q7rcdxKOJ+PMkz~e_S+%4}dUTl4RrhmAj)a+k&UQ9BL;FpHEl5Gj`$(6a6={0$j1vr3FeANh-$df*t><76T1POeuiv z(}=|ETr2km3Xz!72gNcLv$M?+6aBu;i_|zk^iukL(uTRoQ9t~5*ZoA*fI{n(#DhvU z$bzOM8`QKx7Stu#pt^Okoc}1R>tw-+zvDkf7@NX;si3M^bVzkPwBwQjHqbQ@e9e%m zk^&}K2SDksg^J%9mOd$9`hw8(!3GyQoxf2Pm%%Y85Il`s@Kl4Ru?3zIZ)_ji;9|)0 zH>xr-IED^_XC?4VgJ(8)rob};P6ZsTqQ;{tJEMu+z+#(`N#8VEG%PPxYhkpoycnj1 zT>|n-cO7H73|cyyoZ!l3kSYh%xz--!F)pH!0l@Ft8!($vp))clYy%TGjFOg6?0^xJ zG`3LK5+*_zB`cxWks&CVLQ#cgI%!*IZf0{VrjT^-fej2_oU(&pEy_*<5}F8+S`?uM zBs3EuwJ1q-NXk~Tc`I9yoe-~7lu^9NIw4uK2g)|tBP5F!K-ne>c(PKIK~^VBRk7f_ z0R*hXSl;AgMNuZm<`P256%!Vvl>(+Ol|`ArTNh;{3V2+U^%nv6i!yc4JWn5Gcy