From e7469133e85474bec9bf284c2e98ef533032fc0d Mon Sep 17 00:00:00 2001 From: catbot Date: Wed, 3 Jun 2026 02:10:23 +0000 Subject: [PATCH] feat(vulkan): re-enable GPU-Assisted Validation The GPU-AV enable list was removed to dodge a crash in SDK 1.4.341, whose GPU-AV null-deref'd on descriptor_heap pipelines (VK_PIPELINE_CREATE_2_DESCRIPTOR_HEAP_BIT_EXT, layout = VK_NULL_HANDLE) in PipelineSubState::GetPipelineLayoutUnion: https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/12103 That was fixed in the next SDK release. The validation layer is now 1.4.350 (> 1.4.341), so restore VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT in the VkValidationFeaturesEXT enable list. Verified by running the HelloUI example (which draws through the descriptor_heap compute pipelines) with the layer active: it renders the full UI for the entire run with GPU-AV reporting "Both GPU Assisted Validation and Normal Core Check Validation are enabled" and no descriptor-heap null-deref or VUID errors. Co-Authored-By: Claude Opus 4.8 --- implementations/Crafter.Graphics-Device.cpp | 34 +++++++++------------ 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/implementations/Crafter.Graphics-Device.cpp b/implementations/Crafter.Graphics-Device.cpp index 770d50c..b766b9b 100644 --- a/implementations/Crafter.Graphics-Device.cpp +++ b/implementations/Crafter.Graphics-Device.cpp @@ -432,30 +432,24 @@ void Device::Initialize() { app.pEngineName = "Crafter.Graphics"; app.apiVersion = VK_MAKE_VERSION(1, 4, 0); - // TODO(re-enable GPU-AV): once Vulkan SDK > 1.4.341 is the floor. + // GPU-Assisted Validation: shader-execution-time instrumentation that + // catches out-of-bounds descriptor / buffer access the standard layer + // can't see. Opt-in via the enable list below. // - // GPU-Assisted Validation is opt-in via the enable list — leaving it - // out disables it. SDK 1.4.341's GPU-AV does not handle - // descriptor_heap pipelines (VK_PIPELINE_CREATE_2_DESCRIPTOR_HEAP_BIT_EXT - // with layout = VK_NULL_HANDLE): `PipelineSubState::GetPipelineLayoutUnion` - // null-derefs on the first dispatch/draw against such a pipeline. - // - // Tracked + fixed upstream: + // This was previously disabled to work around a bug in SDK 1.4.341's + // GPU-AV, which null-deref'd on descriptor_heap pipelines + // (VK_PIPELINE_CREATE_2_DESCRIPTOR_HEAP_BIT_EXT with layout = + // VK_NULL_HANDLE) in `PipelineSubState::GetPipelineLayoutUnion`: // https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/12103 - // Per spencer-lunarg (LunarG): broken in 1.4.341, fixed and landing - // in the next SDK release. Once we bump our Vulkan-Headers / SDK - // dependency past 1.4.341, restore the original enable list: - // - // VkValidationFeatureEnableEXT enables[] = { - // VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT - // }; - // validationFeatures.enabledValidationFeatureCount = 1; - // validationFeatures.pEnabledValidationFeatures = enables; - // - // Standard validation (the layer itself) is still on; only the GPU-AV - // out-of-bounds / shader-instrumentation checks are temporarily off. + // Per spencer-lunarg (LunarG) that was fixed in the next SDK release. + // The validation layer is now 1.4.350 (> 1.4.341), so re-enable it. + VkValidationFeatureEnableEXT enabledValidationFeatures[] = { + VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT, + }; VkValidationFeaturesEXT validationFeatures = { .sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT, + .enabledValidationFeatureCount = sizeof(enabledValidationFeatures) / sizeof(enabledValidationFeatures[0]), + .pEnabledValidationFeatures = enabledValidationFeatures, }; VkInstanceCreateInfo instanceCreateInfo = {}; -- 2.54.0