From 1b1824f90f107c5304dd7a018efbb1dcff8a6c58 Mon Sep 17 00:00:00 2001 From: Eric Werness Date: Tue, 23 Aug 2022 15:42:32 -0700 Subject: [PATCH] GL_EXT_opacity_micromap --- Test/baseResults/spv.ext.RayGenShader.rgen.out | 3 ++- Test/spv.ext.RayGenShader.rgen | 3 ++- glslang/MachineIndependent/Initialize.cpp | 2 ++ glslang/MachineIndependent/Versions.cpp | 3 ++- glslang/MachineIndependent/Versions.h | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Test/baseResults/spv.ext.RayGenShader.rgen.out b/Test/baseResults/spv.ext.RayGenShader.rgen.out index 46f920ac5..5a34fc7ea 100644 --- a/Test/baseResults/spv.ext.RayGenShader.rgen.out +++ b/Test/baseResults/spv.ext.RayGenShader.rgen.out @@ -10,6 +10,7 @@ spv.ext.RayGenShader.rgen MemoryModel Logical GLSL450 EntryPoint RayGenerationKHR 4 "main" 11 21 29 40 53 54 57 Source GLSL 460 + SourceExtension "GL_EXT_opacity_micromap" SourceExtension "GL_EXT_ray_flags_primitive_culling" SourceExtension "GL_EXT_ray_tracing" Name 4 "main" @@ -52,7 +53,7 @@ spv.ext.RayGenShader.rgen 27: TypeAccelerationStructureKHR 28: TypePointer UniformConstant 27 29(accEXT0): 28(ptr) Variable UniformConstant - 35: 6(int) Constant 768 + 35: 6(int) Constant 1792 36: TypeFloat 32 37: TypeVector 36(float) 3 38(block): TypeStruct 37(fvec3) 37(fvec3) diff --git a/Test/spv.ext.RayGenShader.rgen b/Test/spv.ext.RayGenShader.rgen index e9eb2cbb9..d342d863b 100644 --- a/Test/spv.ext.RayGenShader.rgen +++ b/Test/spv.ext.RayGenShader.rgen @@ -1,6 +1,7 @@ #version 460 #extension GL_EXT_ray_tracing : enable #extension GL_EXT_ray_flags_primitive_culling : enable +#extension GL_EXT_opacity_micromap : enable layout(binding = 0) uniform accelerationStructureEXT accEXT0; layout(binding = 1, set = 0) uniform accelerationStructureEXT accEXT1; // Unused layout(binding = 2, r32ui) shadercallcoherent uniform uimage2D imageu; @@ -18,5 +19,5 @@ void main() uint ly = gl_LaunchIDEXT.y; uint sx = gl_LaunchSizeEXT.x; uint sy = gl_LaunchSizeEXT.y; - traceRayEXT(accEXT0, lx, ly, sx, sy, gl_RayFlagsSkipTrianglesEXT | gl_RayFlagsSkipAABBEXT, origin, 0.5f, dir, 0.75f, 1); + traceRayEXT(accEXT0, lx, ly, sx, sy, gl_RayFlagsSkipTrianglesEXT | gl_RayFlagsSkipAABBEXT | gl_RayFlagsForceOpacityMicromap2StateEXT, origin, 0.5f, dir, 0.75f, 1); } diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 31b448adc..0cbb9e78f 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -5850,6 +5850,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"; @@ -8167,6 +8168,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("rayQueryGetWorldRayDirectionEXT", 1, &E_GL_EXT_ray_query); 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) || diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 226e94674..a5fd10753 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -342,11 +342,12 @@ 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; // OVR extensions extensionBehavior[E_GL_OVR_multiview] = EBhDisable; diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 6ab37880f..f06abdd6f 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -212,6 +212,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