From 0a438ad614184de9de5ed0127a2c3ae072fb8acb Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Wed, 8 May 2024 18:12:11 -0400 Subject: [PATCH 01/10] Remove unneeded VkPhysicalDeviceBufferAddressFeaturesEXT from CreateDevice() pNext chain --- neo/sys/DeviceManager_VK.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index 2dc0b6ef..522fdaca 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -948,8 +948,6 @@ bool DeviceManager_VK::createDevice() auto accelStructFeatures = vk::PhysicalDeviceAccelerationStructureFeaturesKHR() .setAccelerationStructure( true ); - auto bufferAddressFeatures = vk::PhysicalDeviceBufferAddressFeaturesEXT() - .setBufferDeviceAddress( true ); auto rayPipelineFeatures = vk::PhysicalDeviceRayTracingPipelineFeaturesKHR() .setRayTracingPipeline( true ) .setRayTraversalPrimitiveCulling( true ); @@ -986,7 +984,6 @@ bool DeviceManager_VK::createDevice() #endif #define APPEND_EXTENSION(condition, desc) if (condition) { (desc).pNext = pNext; pNext = &(desc); } // NOLINT(cppcoreguidelines-macro-usage) APPEND_EXTENSION( accelStructSupported, accelStructFeatures ) - APPEND_EXTENSION( bufferAddressSupported, bufferAddressFeatures ) APPEND_EXTENSION( rayPipelineSupported, rayPipelineFeatures ) APPEND_EXTENSION( rayQuerySupported, rayQueryFeatures ) APPEND_EXTENSION( meshletsSupported, meshletFeatures ) From 01768625817a6b7326190751665baf1092fe632f Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Wed, 8 May 2024 18:17:47 -0400 Subject: [PATCH 02/10] Remove VK_EXT_debug_utils and enable VK_EXT_debug_marker only when debugging --- neo/sys/DeviceManager_VK.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index 522fdaca..5c765565 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -252,14 +252,12 @@ private: VK_EXT_LAYER_SETTINGS_EXTENSION_NAME, #endif #endif - VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME, - VK_EXT_DEBUG_UTILS_EXTENSION_NAME + VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME }, // layers { }, // device { - VK_EXT_DEBUG_MARKER_EXTENSION_NAME, VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME, VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME, VK_NV_MESH_SHADER_EXTENSION_NAME, @@ -1244,6 +1242,7 @@ bool DeviceManager_VK::CreateDeviceAndSwapChain() if( m_DeviceParams.enableDebugRuntime ) { enabledExtensions.instance.insert( VK_EXT_DEBUG_REPORT_EXTENSION_NAME ); + optionalExtensions.device.insert( VK_EXT_DEBUG_MARKER_EXTENSION_NAME ); #if defined(__APPLE__) && defined( USE_MoltenVK ) } From 30f92b8103565b5187d073176028dc96e53192e5 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Fri, 10 May 2024 11:54:43 -0400 Subject: [PATCH 03/10] Suppress Vulkan [Shader-OutputNotConsumed] validation layer message since by design --- neo/sys/DeviceManager_VK.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index 5c765565..13ab8d7b 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -1250,6 +1250,13 @@ bool DeviceManager_VK::CreateDeviceAndSwapChain() static const vk::DynamicLoader dl( "libMoltenVK.dylib" ); #else enabledExtensions.layers.insert( "VK_LAYER_KHRONOS_validation" ); + + // SRS - Suppress WARNING-Shader-OutputNotConsumed: by design for vertex shader layouts + #ifdef _WIN32 + SetEnvironmentVariable( "VK_LAYER_MESSAGE_ID_FILTER", "0xc81ad50e" ); + #else + setenv( "VK_LAYER_MESSAGE_ID_FILTER", "0xc81ad50e", 1 ); + #endif } // SRS - make static so ~DynamicLoader() does not prematurely unload vulkan dynamic lib From 23adc49344530aea8e8738106916bd576b9224e6 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Fri, 10 May 2024 11:55:14 -0400 Subject: [PATCH 04/10] Suppress DX12 [RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH] error caused by cinematics --- neo/sys/DeviceManager_DX12.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/neo/sys/DeviceManager_DX12.cpp b/neo/sys/DeviceManager_DX12.cpp index 4669a3af..ff15e67b 100644 --- a/neo/sys/DeviceManager_DX12.cpp +++ b/neo/sys/DeviceManager_DX12.cpp @@ -382,7 +382,9 @@ bool DeviceManager_DX12::CreateDeviceAndSwapChain() D3D12_MESSAGE_ID disableMessageIDs[] = { D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_MISMATCHINGCLEARVALUE, + D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE, D3D12_MESSAGE_ID_COMMAND_LIST_STATIC_DESCRIPTOR_RESOURCE_DIMENSION_MISMATCH, // descriptor validation doesn't understand acceleration structures + D3D12_MESSAGE_ID_RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH // barrier validation error caused by cinematics - not sure how to fix, suppress for now }; D3D12_INFO_QUEUE_FILTER filter = {}; From d16c13057b810c3c8d2ffc46e4ca920568e8a8b0 Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Fri, 10 May 2024 19:05:52 -0400 Subject: [PATCH 05/10] Fix Vulkan & D3D12 pipeline validation warnings if no color attachments (e.g. atlas) --- neo/renderer/PipelineCache.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neo/renderer/PipelineCache.cpp b/neo/renderer/PipelineCache.cpp index 7e12caf1..53323e0a 100644 --- a/neo/renderer/PipelineCache.cpp +++ b/neo/renderer/PipelineCache.cpp @@ -88,6 +88,12 @@ nvrhi::GraphicsPipelineHandle PipelineCache::GetOrCreatePipeline( const Pipeline // Specialize the state with the state key. GetRenderState( key.state, key, pipelineDesc.renderState ); + // SRS - if no color attachments (e.g. atlas), disable fragment shader to avoid validation warnings + if( key.framebuffer->GetApiObject()->getDesc().colorAttachments.size() == 0 ) + { + pipelineDesc.PS = nvrhi::ShaderHandle( NULL ); + } + auto pipeline = device->createGraphicsPipeline( pipelineDesc, key.framebuffer->GetApiObject() ); pipelineHash.Add( h, pipelines.Append( { key, pipeline } ) ); From 0efc9e24f36c1f6191ed542cbabf806b8df21fd8 Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Sat, 11 May 2024 17:45:07 -0400 Subject: [PATCH 06/10] Revert VK_EXT_debug_marker change and enable VK_EXT_Debug_Report as parent dependency --- neo/sys/DeviceManager_VK.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index 13ab8d7b..eafe5967 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -252,12 +252,14 @@ private: VK_EXT_LAYER_SETTINGS_EXTENSION_NAME, #endif #endif + VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME }, // layers { }, // device { + VK_EXT_DEBUG_MARKER_EXTENSION_NAME, VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME, VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME, VK_NV_MESH_SHADER_EXTENSION_NAME, @@ -1241,8 +1243,6 @@ bool DeviceManager_VK::CreateDeviceAndSwapChain() if( m_DeviceParams.enableDebugRuntime ) { - enabledExtensions.instance.insert( VK_EXT_DEBUG_REPORT_EXTENSION_NAME ); - optionalExtensions.device.insert( VK_EXT_DEBUG_MARKER_EXTENSION_NAME ); #if defined(__APPLE__) && defined( USE_MoltenVK ) } From 70a616e6eb93234f8d50096ec9bf85d5253d4cb4 Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Sat, 11 May 2024 17:47:42 -0400 Subject: [PATCH 07/10] Enable VK_KHR_maintenance4 for relaxed interface matching between input and output vectors --- neo/sys/DeviceManager_VK.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index eafe5967..f5fd167c 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -269,6 +269,9 @@ private: #endif #if defined( VK_KHR_format_feature_flags2 ) VK_KHR_FORMAT_FEATURE_FLAGS_2_EXTENSION_NAME, +#endif +#if defined( VK_KHR_maintenance4 ) + VK_KHR_MAINTENANCE_4_EXTENSION_NAME, #endif VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME, VK_EXT_MEMORY_BUDGET_EXTENSION_NAME From 37927c94a304cfb8debc4ab5097ed66a728014ac Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Sat, 11 May 2024 18:32:01 -0400 Subject: [PATCH 08/10] Revert no-color attachment change, instead suppress DX12 & Vulkan validation layer messages --- neo/renderer/PipelineCache.cpp | 6 ------ neo/sys/DeviceManager_DX12.cpp | 1 + neo/sys/DeviceManager_VK.cpp | 8 +++++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/neo/renderer/PipelineCache.cpp b/neo/renderer/PipelineCache.cpp index 53323e0a..7e12caf1 100644 --- a/neo/renderer/PipelineCache.cpp +++ b/neo/renderer/PipelineCache.cpp @@ -88,12 +88,6 @@ nvrhi::GraphicsPipelineHandle PipelineCache::GetOrCreatePipeline( const Pipeline // Specialize the state with the state key. GetRenderState( key.state, key, pipelineDesc.renderState ); - // SRS - if no color attachments (e.g. atlas), disable fragment shader to avoid validation warnings - if( key.framebuffer->GetApiObject()->getDesc().colorAttachments.size() == 0 ) - { - pipelineDesc.PS = nvrhi::ShaderHandle( NULL ); - } - auto pipeline = device->createGraphicsPipeline( pipelineDesc, key.framebuffer->GetApiObject() ); pipelineHash.Add( h, pipelines.Append( { key, pipeline } ) ); diff --git a/neo/sys/DeviceManager_DX12.cpp b/neo/sys/DeviceManager_DX12.cpp index ff15e67b..f8669342 100644 --- a/neo/sys/DeviceManager_DX12.cpp +++ b/neo/sys/DeviceManager_DX12.cpp @@ -384,6 +384,7 @@ bool DeviceManager_DX12::CreateDeviceAndSwapChain() D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_MISMATCHINGCLEARVALUE, D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE, D3D12_MESSAGE_ID_COMMAND_LIST_STATIC_DESCRIPTOR_RESOURCE_DIMENSION_MISMATCH, // descriptor validation doesn't understand acceleration structures + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RENDERTARGETVIEW_NOT_SET, // disable warning when there is no color attachment (e.g. shadow atlas) D3D12_MESSAGE_ID_RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH // barrier validation error caused by cinematics - not sure how to fix, suppress for now }; diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index f5fd167c..050e1adb 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -1254,11 +1254,13 @@ bool DeviceManager_VK::CreateDeviceAndSwapChain() #else enabledExtensions.layers.insert( "VK_LAYER_KHRONOS_validation" ); - // SRS - Suppress WARNING-Shader-OutputNotConsumed: by design for vertex shader layouts + // SRS - Suppress specific [ WARNING-Shader-OutputNotConsumed ] false positive validation warnings which are by design: + // 0xc81ad50e: vkCreateGraphicsPipelines(): pCreateInfos[0].pVertexInputState Vertex attribute at location X not consumed by vertex shader. + // 0x9805298c: vkCreateGraphicsPipelines(): pCreateInfos[0] fragment shader writes to output location 0 with no matching attachment. #ifdef _WIN32 - SetEnvironmentVariable( "VK_LAYER_MESSAGE_ID_FILTER", "0xc81ad50e" ); + SetEnvironmentVariable( "VK_LAYER_MESSAGE_ID_FILTER", "0xc81ad50e;0x9805298c" ); #else - setenv( "VK_LAYER_MESSAGE_ID_FILTER", "0xc81ad50e", 1 ); + setenv( "VK_LAYER_MESSAGE_ID_FILTER", "0xc81ad50e:0x9805298c", 1 ); #endif } From d5920c0b6a6df4c0f37cc09552888ff283323b95 Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Sat, 11 May 2024 18:36:43 -0400 Subject: [PATCH 09/10] Minor tweak to Vulkan extension order --- neo/sys/DeviceManager_VK.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index 050e1adb..11a74792 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -252,8 +252,8 @@ private: VK_EXT_LAYER_SETTINGS_EXTENSION_NAME, #endif #endif - VK_EXT_DEBUG_REPORT_EXTENSION_NAME, - VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME + VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME, + VK_EXT_DEBUG_REPORT_EXTENSION_NAME }, // layers { }, From f548ee56dede486424180a995a940a26ef2da466 Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Sat, 18 May 2024 11:42:05 -0400 Subject: [PATCH 10/10] Revert VK_KHR_maintenance4 and suppress messageID=0x609a13b for older Vulkan SDKs --- neo/sys/DeviceManager_VK.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index 11a74792..86599b71 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -269,9 +269,6 @@ private: #endif #if defined( VK_KHR_format_feature_flags2 ) VK_KHR_FORMAT_FEATURE_FLAGS_2_EXTENSION_NAME, -#endif -#if defined( VK_KHR_maintenance4 ) - VK_KHR_MAINTENANCE_4_EXTENSION_NAME, #endif VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME, VK_EXT_MEMORY_BUDGET_EXTENSION_NAME @@ -1254,13 +1251,17 @@ bool DeviceManager_VK::CreateDeviceAndSwapChain() #else enabledExtensions.layers.insert( "VK_LAYER_KHRONOS_validation" ); - // SRS - Suppress specific [ WARNING-Shader-OutputNotConsumed ] false positive validation warnings which are by design: + // SRS - Suppress specific [ WARNING-Shader-OutputNotConsumed ] validation warnings which are by design: // 0xc81ad50e: vkCreateGraphicsPipelines(): pCreateInfos[0].pVertexInputState Vertex attribute at location X not consumed by vertex shader. - // 0x9805298c: vkCreateGraphicsPipelines(): pCreateInfos[0] fragment shader writes to output location 0 with no matching attachment. + // 0x9805298c: vkCreateGraphicsPipelines(): pCreateInfos[0] fragment shader writes to output location X with no matching attachment. + // SRS - Suppress similar [ UNASSIGNED-CoreValidation-Shader-OutputNotConsumed ] warnings for older Vulkan SDKs: + // 0x609a13b: vertex shader writes to output location X.0 which is not consumed by fragment shader... + // 0x609a13b: Vertex attribute at location X not consumed by vertex shader. + // 0x609a13b: fragment shader writes to output location X with no matching attachment. #ifdef _WIN32 - SetEnvironmentVariable( "VK_LAYER_MESSAGE_ID_FILTER", "0xc81ad50e;0x9805298c" ); + SetEnvironmentVariable( "VK_LAYER_MESSAGE_ID_FILTER", "0xc81ad50e;0x9805298c;0x609a13b" ); #else - setenv( "VK_LAYER_MESSAGE_ID_FILTER", "0xc81ad50e:0x9805298c", 1 ); + setenv( "VK_LAYER_MESSAGE_ID_FILTER", "0xc81ad50e:0x9805298c:0x609a13b", 1 ); #endif }