From cb217e22a69a0e3ac0a3afca387804e6aac42236 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Mon, 19 Oct 2026 03:03:16 +0200 Subject: [PATCH] feat(device): CRAFTER_GRAPHICS_NO_AS_WORKAROUND turns the NVIDIA AS rewrite off The SPIR-V rewrite for NVIDIA's descriptor-heap acceleration-structure read fault (#7, #15) was keyed on the driver ID alone, so nothing could check whether a newer driver still needs it. With CRAFTER_GRAPHICS_NO_AS_WORKAROUND set, to any value like the other CRAFTER_GRAPHICS_* switches, Device leaves it off. On 615.78.08 it is still needed. Co-Authored-By: Claude Opus 5.5 --- implementations/Crafter.Graphics-Device.cpp | 7 +++++-- interfaces/Crafter.Graphics-Device.cppm | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/implementations/Crafter.Graphics-Device.cpp b/implementations/Crafter.Graphics-Device.cpp index f9414c6..613c4ce 100644 --- a/implementations/Crafter.Graphics-Device.cpp +++ b/implementations/Crafter.Graphics-Device.cpp @@ -1061,9 +1061,12 @@ void Device::Initialize() { // the heap, so it is off whenever the heap is: otherwise a forced-fallback // run on NVIDIA would still rewrite SPIR-V, enable shaderInt64 and push the // TLAS address through vkCmdPushDataEXT, none of which a real heap-less - // driver does. + // driver does. Still needed on 615.78.08. CRAFTER_GRAPHICS_NO_AS_WORKAROUND, + // set to any value like the other CRAFTER_GRAPHICS_* switches, turns it off, + // which is how a new driver gets checked (tests/HeapASRead --no-workaround). workaroundDescriptorHeapAS = descriptorHeapSupported - && driverProperties.driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY; + && driverProperties.driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY + && std::getenv("CRAFTER_GRAPHICS_NO_AS_WORKAROUND") == nullptr; // Sanity-gate: GDeflate 1.0 must actually be in the supported method set. if (memoryDecompressionSupported && diff --git a/interfaces/Crafter.Graphics-Device.cppm b/interfaces/Crafter.Graphics-Device.cppm index 30e7959..ffca74e 100644 --- a/interfaces/Crafter.Graphics-Device.cppm +++ b/interfaces/Crafter.Graphics-Device.cppm @@ -281,8 +281,11 @@ export namespace Crafter { // VK_ERROR_DEVICE_LOST (a brand-new-extension driver fault, verified // engine-clean in #7). When set, VulkanShader rewrites heap AS reads // into a TLAS-device-address + OpConvertUToAccelerationStructureKHR - // path and RTPass pushes the active TLAS address as push data. Delete - // this flag and everything keyed on it once a fixed driver ships. + // path and RTPass pushes the active TLAS address as push data. Still + // needed on 615.78.08. CRAFTER_GRAPHICS_NO_AS_WORKAROUND, set to any + // value, turns it off to check a newer driver (tests/HeapASRead + // --no-workaround). Delete this flag and everything keyed on it once a + // fixed driver ships. inline static bool workaroundDescriptorHeapAS = false; // Count of ERROR-severity validation messages seen by the debug