diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-11-10 05:24:46 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-11-10 05:24:46 +0000 |
| commit | 5888241b0f6127c82b64caebb9cb61b933ba4535 (patch) | |
| tree | 55b46a800690c5450c613820dcbb84c2c425f5ea /Graphics/GraphicsEngineVulkan | |
| parent | Added ability to update AS. (diff) | |
| download | DiligentCore-5888241b0f6127c82b64caebb9cb61b933ba4535.tar.gz DiligentCore-5888241b0f6127c82b64caebb9cb61b933ba4535.zip | |
A bunch of minor updates
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
3 files changed, 25 insertions, 22 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp index 97e3dead..88885eee 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp @@ -307,6 +307,16 @@ public: return IsMS != 0; } + bool IsCompatibleWith(const VkResource& rhs) const + { + // clang-format off + return Binding == rhs.Binding && + DescriptorSet == rhs.DescriptorSet && + ArraySize == rhs.ArraySize && + Type == rhs.Type; + // clang-format on + } + private: void CacheUniformBuffer(IDeviceObject* pBuffer, ShaderResourceCacheVk::Resource& DstRes, diff --git a/Graphics/GraphicsEngineVulkan/interface/RenderDeviceVk.h b/Graphics/GraphicsEngineVulkan/interface/RenderDeviceVk.h index 0d566e70..cba7f360 100644 --- a/Graphics/GraphicsEngineVulkan/interface/RenderDeviceVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/RenderDeviceVk.h @@ -127,10 +127,10 @@ DILIGENT_BEGIN_INTERFACE(IRenderDeviceVk, IRenderDevice) /// destroy it once released. The application must not destroy Vulkan acceleration structure while it is /// in use by the engine. VIRTUAL void METHOD(CreateBLASFromVulkanResource)(THIS_ - VkAccelerationStructureKHR vkBLAS, - const BottomLevelASDesc REF Desc, - RESOURCE_STATE InitialState, - IBottomLevelAS** ppBLAS) PURE; + VkAccelerationStructureKHR vkBLAS, + const BottomLevelASDesc REF Desc, + RESOURCE_STATE InitialState, + IBottomLevelAS** ppBLAS) PURE; /// Creates a top-level AS object from native Vulkan resource @@ -146,10 +146,10 @@ DILIGENT_BEGIN_INTERFACE(IRenderDeviceVk, IRenderDevice) /// destroy it once released. The application must not destroy Vulkan acceleration structure while it is /// in use by the engine. VIRTUAL void METHOD(CreateTLASFromVulkanResource)(THIS_ - VkAccelerationStructureKHR vkTLAS, - const TopLevelASDesc REF Desc, - RESOURCE_STATE InitialState, - ITopLevelAS** ppTLAS) PURE; + VkAccelerationStructureKHR vkTLAS, + const TopLevelASDesc REF Desc, + RESOURCE_STATE InitialState, + ITopLevelAS** ppTLAS) PURE; }; DILIGENT_END_INTERFACE diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp index f45749e2..9a4caec8 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp @@ -828,7 +828,7 @@ void ShaderResourceLayoutVk::VkResource::CacheUniformBuffer(IDeviceObject* if (pBufferVk->GetDesc().uiSizeInBytes < BufferStaticSize) { - // It is OK if enabled robustBufferAccess feature, otherwise access outside of buffer range may lead to crash or undefined behavior. + // It is OK if robustBufferAccess feature is enabled, otherwise access outside of buffer range may lead to crash or undefined behavior. LOG_WARNING_MESSAGE("Error binding uniform buffer '", pBufferVk->GetDesc().Name, "' to shader variable '", Name, "' in shader '", ParentResLayout.GetShaderName(), "': buffer size in the shader (", BufferStaticSize, ") is incompatible with the actual buffer size (", pBufferVk->GetDesc().uiSizeInBytes, ")."); @@ -889,7 +889,7 @@ void ShaderResourceLayoutVk::VkResource::CacheStorageBuffer(IDeviceObject* if (BufferStride == 0 && ViewDesc.ByteWidth < BufferStaticSize) { - // It is OK if enabled robustBufferAccess feature, otherwise access outside of buffer range may lead to crash or undefined behavior. + // It is OK if robustBufferAccess feature is enabled, otherwise access outside of buffer range may lead to crash or undefined behavior. LOG_WARNING_MESSAGE("Error binding buffer view '", ViewDesc.Name, "' of buffer '", BuffDesc.Name, "' to shader variable '", Name, "' in shader '", ParentResLayout.GetShaderName(), "': buffer size in the shader (", BufferStaticSize, ") is incompatible with the actual buffer view size (", ViewDesc.ByteWidth, ")."); @@ -898,11 +898,11 @@ void ShaderResourceLayoutVk::VkResource::CacheStorageBuffer(IDeviceObject* if (BufferStride > 0 && (ViewDesc.ByteWidth < BufferStaticSize || (ViewDesc.ByteWidth - BufferStaticSize) % BufferStride != 0)) { // For buffers with dynamic arrays we know only static part size and array element stride. - // Element stride in shader may be differ than in code. Here we check that buffer size is exactly match to the array with N elements. + // Element stride in the shader may be differ than in the code. Here we check that the buffer size is exactly the same as the array with N elements. LOG_WARNING_MESSAGE("Error binding buffer view '", ViewDesc.Name, "' of buffer '", BuffDesc.Name, "' to shader variable '", Name, "' in shader '", ParentResLayout.GetShaderName(), "': static buffer size in the shader (", BufferStaticSize, ") and array element stride (", BufferStride, ") are incompatible with the actual buffer view size (", ViewDesc.ByteWidth, "),", - " this may be result of array element size mismatch."); + " this may be the result of the array element size mismatch."); } } } @@ -1551,23 +1551,16 @@ bool ShaderResourceLayoutVk::IsCompatibleWith(const ShaderResourceLayoutVk& ResL if (m_NumResources != ResLayout.m_NumResources) return false; - bool IsCompatible = true; for (Uint32 i = 0, Cnt = GetTotalResourceCount(); i < Cnt; ++i) { const auto& lhs = this->GetResource(i); const auto& rhs = ResLayout.GetResource(i); - // clang-format off - if (lhs.ArraySize != rhs.ArraySize || - lhs.Type != rhs.Type || - lhs.SamplerInd != rhs.SamplerInd) - // clang-format on - { - IsCompatible = false; - } + if (!lhs.IsCompatibleWith(rhs)) + return false; } - return IsCompatible; + return true; } } // namespace Diligent |
