From 7aaa988cc9375a18b46d3366dcf5be5bb106d728 Mon Sep 17 00:00:00 2001 From: azhirnov Date: Thu, 4 Mar 2021 16:10:58 +0300 Subject: Vulkan: update for new Vulkan SDK --- .../src/BottomLevelASVkImpl.cpp | 9 +++++++++ .../src/DeviceContextVkImpl.cpp | 6 +++--- .../src/VulkanUtilities/VulkanDebug.cpp | 22 ++-------------------- Graphics/ShaderTools/src/DXCompiler.cpp | 7 +------ 4 files changed, 15 insertions(+), 29 deletions(-) (limited to 'Graphics') diff --git a/Graphics/GraphicsEngineVulkan/src/BottomLevelASVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/BottomLevelASVkImpl.cpp index 07486716..c0f7ed2b 100644 --- a/Graphics/GraphicsEngineVulkan/src/BottomLevelASVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/BottomLevelASVkImpl.cpp @@ -75,6 +75,15 @@ BottomLevelASVkImpl::BottomLevelASVkImpl(IReferenceCounters* pRefCounters, MaxPrimitiveCounts[i] = src.MaxPrimitiveCount; MaxPrimitiveCount += src.MaxPrimitiveCount; + +#ifdef DILIGENT_DEVELOPMENT + VkFormatProperties2 vkProps = {VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2}; + vkGetPhysicalDeviceFormatProperties2KHR(PhysicalDevice.GetVkDeviceHandle(), tri.vertexFormat, &vkProps); + + DEV_CHECK_ERR((vkProps.formatProperties.bufferFeatures & VK_FORMAT_FEATURE_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR) != 0, + "combination of pTriangles[", i, "].VertexValueType (", GetValueTypeString(src.VertexValueType), + ") and pTriangles[", i, "].VertexComponentCount (", src.VertexComponentCount, ") is not supported by this device."); +#endif } DEV_CHECK_ERR(MaxPrimitiveCount <= Limits.maxPrimitiveCount, "Max primitives count (", MaxPrimitiveCount, ") exceeds device limit (", Limits.maxPrimitiveCount, ")"); diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index aacb8e71..878cf9a9 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -3376,9 +3376,9 @@ void DeviceContextVkImpl::WriteBLASCompactedSize(const WriteBLASCompactedSizeAtt TransitionOrVerifyBLASState(*pBLASVk, Attribs.BLASTransitionMode, RESOURCE_STATE_BUILD_AS_READ, OpName); TransitionOrVerifyBufferState(*pDestBuffVk, Attribs.BufferTransitionMode, RESOURCE_STATE_COPY_DEST, VK_ACCESS_TRANSFER_WRITE_BIT, OpName); + m_CommandBuffer.ResetQueryPool(m_ASQueryPool, QueryIndex, 1); m_CommandBuffer.WriteAccelerationStructuresProperties(pBLASVk->GetVkBLAS(), VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR, m_ASQueryPool, QueryIndex); m_CommandBuffer.CopyQueryPoolResults(m_ASQueryPool, QueryIndex, 1, pDestBuffVk->GetVkBuffer(), Attribs.DestBufferOffset, sizeof(Uint64), VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); - m_CommandBuffer.ResetQueryPool(m_ASQueryPool, QueryIndex, 1); ++m_State.NumCommands; } @@ -3397,9 +3397,9 @@ void DeviceContextVkImpl::WriteTLASCompactedSize(const WriteTLASCompactedSizeAtt TransitionOrVerifyTLASState(*pTLASVk, Attribs.TLASTransitionMode, RESOURCE_STATE_BUILD_AS_READ, OpName); TransitionOrVerifyBufferState(*pDestBuffVk, Attribs.BufferTransitionMode, RESOURCE_STATE_COPY_DEST, VK_ACCESS_TRANSFER_WRITE_BIT, OpName); + m_CommandBuffer.ResetQueryPool(m_ASQueryPool, QueryIndex, 1); m_CommandBuffer.WriteAccelerationStructuresProperties(pTLASVk->GetVkTLAS(), VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR, m_ASQueryPool, QueryIndex); m_CommandBuffer.CopyQueryPoolResults(m_ASQueryPool, QueryIndex, 1, pDestBuffVk->GetVkBuffer(), Attribs.DestBufferOffset, sizeof(Uint64), VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); - m_CommandBuffer.ResetQueryPool(m_ASQueryPool, QueryIndex, 1); ++m_State.NumCommands; } @@ -3414,7 +3414,7 @@ void DeviceContextVkImpl::CreateASCompactedSizeQueryPool() Info.queryCount = 1; Info.queryType = VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR; - m_ASQueryPool = LogicalDevice.CreateQueryPool(Info); + m_ASQueryPool = LogicalDevice.CreateQueryPool(Info, "AS Compacted Size Query"); } } diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp index e1583401..dca46b48 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp @@ -52,31 +52,13 @@ VKAPI_ATTR VkBool32 VKAPI_CALL DebugMessengerCallback(VkDebugUtilsMessageSeverit } } - // Temporarily disable false warnings from validation layers. + // Temporarily disable false warnings from validation layers (1.2.170). // TODO: check in next Vulkan SDK #if 1 - if (std::string{"VUID-vkCmdPipelineBarrier-srcAccessMask-02815"} == callbackData->pMessageIdName) - { - std::string msg{callbackData->pMessage}; - if (msg.find("srcAccessMask (0x20) is not supported by srcStageMask (0x2000000)") != std::string::npos) - return VK_FALSE; - } if (std::string{"VUID-vkCmdPipelineBarrier-dstAccessMask-02816"} == callbackData->pMessageIdName) { std::string msg{callbackData->pMessage}; - if (msg.find("dstAccessMask (0x20) is not supported by dstStageMask (0x2000000)") != std::string::npos) - return VK_FALSE; - } - if (std::string{"VUID-VkShaderModuleCreateInfo-pCode-01091"} == callbackData->pMessageIdName) - { - std::string msg{callbackData->pMessage}; - if (msg.find("The SPIR-V Capability (RayTracingNV) was declared, but none of the requirements were met to use it.") != std::string::npos) - return VK_FALSE; - } - if (std::string{"VUID-VkShaderModuleCreateInfo-pCode-04147"} == callbackData->pMessageIdName) - { - std::string msg{callbackData->pMessage}; - if (msg.find("The SPIR-V Extension (SPV_NV_ray_tracing) was declared, but none of the requirements were met to use it.") != std::string::npos) + if (msg.find("dstAccessMask bit VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR is not supported by stage mask (VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR)") != std::string::npos) return VK_FALSE; } #endif diff --git a/Graphics/ShaderTools/src/DXCompiler.cpp b/Graphics/ShaderTools/src/DXCompiler.cpp index 1b6d051f..862880f0 100644 --- a/Graphics/ShaderTools/src/DXCompiler.cpp +++ b/Graphics/ShaderTools/src/DXCompiler.cpp @@ -738,12 +738,7 @@ void DXCompilerImpl::Compile(const ShaderCreateInfo& ShaderCI, if (ShaderCI.Desc.ShaderType & RayTracingStages) { - // add default extensions because we override them - DxilArgs.push_back(L"-fspv-extension=SPV_GOOGLE_hlsl_functionality1"); - DxilArgs.push_back(L"-fspv-extension=SPV_GOOGLE_user_type"); - - DxilArgs.push_back(L"-fspv-extension=SPV_NV_ray_tracing"); // TODO: should be SPV_KHR_ray_tracing, current version may not work on AMD - //DxilArgs.push_back(L"-fspv-target-env=vulkan1.2"); // required for SPV_KHR_ray_tracing + DxilArgs.push_back(L"-fspv-target-env=vulkan1.2"); // required for SPV_KHR_ray_tracing } } else -- cgit v1.2.3