From d8150e70612b58fb1cfefa262d3d862a6e6e79ba Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 15 Mar 2021 09:27:48 -0700 Subject: Fix handling of RT accelerations structures for non-RT stages (#1753) * Fix handling of RT accelerations structures for non-RT stages The recent change that added support for the `GL_EXT_ray_query` extension made is so that a shader that declares a `RaytracingAccelerationStructure` as an input to a non-RT shader stage but then never *uses* it wouldn't enable any RT extension, resulting in a compilation failure in glslang. This change reverts that behavior so that such shaders enable `GL_EXT_ray_tracing`, since that is the older of the two RT extensions that introduce `accelerationStructureEXT`. It is possible that we will need to revisit this decision based on which of the two extensions ends up being more broadly supported, but I think that right now it is fair to say that there exist drivers that support `GL_EXT_ray_tracing` but not `GL_EXT_ray_query`, so the former is the better default. * fixup: failing test --- source/slang/slang-emit-glsl.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp index fb4417119..86339e94b 100644 --- a/source/slang/slang-emit-glsl.cpp +++ b/source/slang/slang-emit-glsl.cpp @@ -1831,17 +1831,13 @@ void GLSLSourceEmitter::emitSimpleTypeImpl(IRType* type) // could provide the `accelerationSturctureEXT` type, but there // can be drivers that provide only one and not the other. // - // Because we can't pick one upon just seeing the type, we need to - // emit the type here but *not* call `_requireRayTracing()` or - // anything like it, because we don't yet know the specific extension - // we should ask for. + // For now we will just kludge this by assuming that any driver + // that supports one of these extensions supports the other. // - // TODO: We might eventually want to have this step set a flag that - // will cause a compilation error if nothing else in the code requires - // a specific concrete ray-tracing extension. Ideally all of these - // details could be subusmed under the capability system sooner or - // later. - // + // TODO: Revisit that decision once the driver landscape is more stable/clear. + // + _requireRayTracing(); + m_writer->emit("accelerationStructureEXT"); } break; -- cgit v1.2.3