diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-12-25 05:48:54 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-12-25 05:48:54 +0000 |
| commit | 8c14255393ca877bb82914ce6ac568fdc6092599 (patch) | |
| tree | 43b58e23b6960462c7d3fdd9700bd63ae8e03a21 /Graphics/GraphicsEngineVulkan | |
| parent | D3D12 backend: reworked immutable sampler initialization (diff) | |
| download | DiligentCore-8c14255393ca877bb82914ce6ac568fdc6092599.tar.gz DiligentCore-8c14255393ca877bb82914ce6ac568fdc6092599.zip | |
D3D12 and Vk backends: few minor code improvements
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
3 files changed, 27 insertions, 43 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp index 171d2047..2df3aaa3 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp @@ -206,37 +206,32 @@ public: #endif // clang-format on - VkResource(const ShaderResourceLayoutVk& _ParentLayout, - const char* _Name, - Uint16 _ArraySize, - ResourceType _Type, - RESOURCE_DIMENSION _ResourceDim, - bool _IsMS, - SHADER_RESOURCE_VARIABLE_TYPE _VariableType, - uint32_t _Binding, - uint32_t _DescriptorSet, - Uint32 _CacheOffset, - Uint32 _SamplerInd, - bool _ImmutableSamplerAssigned, - Uint32 _BufferStaticSize, - Uint32 _BufferStride) noexcept : + VkResource(const ShaderResourceLayoutVk& _ParentLayout, + const char* _Name, + const SPIRVShaderResourceAttribs& _Attribs, + SHADER_RESOURCE_VARIABLE_TYPE _VariableType, + uint32_t _Binding, + uint32_t _DescriptorSet, + Uint32 _CacheOffset, + Uint32 _SamplerInd, + bool _ImmutableSamplerAssigned) noexcept : // clang-format off Binding {static_cast<decltype(Binding)>(_Binding) }, DescriptorSet {static_cast<decltype(DescriptorSet)>(_DescriptorSet)}, - CacheOffset {_CacheOffset }, - SamplerInd {_SamplerInd }, - VariableType {_VariableType }, + CacheOffset {_CacheOffset }, + SamplerInd {_SamplerInd }, + VariableType {_VariableType}, ImmutableSamplerAssigned {_ImmutableSamplerAssigned ? 1U : 0U}, - ArraySize {_ArraySize }, - Type {_Type }, - ResourceDim {_ResourceDim }, - IsMS {_IsMS ? Uint8{1} : Uint8{0}}, + ArraySize {_Attribs.ArraySize }, + Type {_Attribs.Type }, + ResourceDim {_Attribs.ResourceDim}, + IsMS {_Attribs.IsMS }, #ifdef DILIGENT_DEVELOPMENT - BufferStaticSize {_BufferStaticSize}, - BufferStride {_BufferStride }, + BufferStaticSize {_Attribs.BufferStaticSize}, + BufferStride {_Attribs.BufferStride }, #endif - Name {_Name }, - ParentResLayout {_ParentLayout } + Name {_Name }, + ParentResLayout {_ParentLayout} // clang-format on { #if defined(_MSC_VER) && defined(_WIN64) && !defined(DILIGENT_DEVELOPMENT) @@ -248,7 +243,7 @@ public: VERIFY(_Binding <= std::numeric_limits<decltype(Binding)>::max(), "Binding (", _Binding, ") exceeds max representable value ", std::numeric_limits<decltype(Binding)>::max() ); VERIFY(_DescriptorSet <= std::numeric_limits<decltype(DescriptorSet)>::max(), "Descriptor set (", _DescriptorSet, ") exceeds max representable value ", std::numeric_limits<decltype(DescriptorSet)>::max()); VERIFY(_VariableType < (1 << VariableTypeBits), "Variable type (", Uint32{_VariableType}, ") exceeds max representable value ", (1 << VariableTypeBits) ); - VERIFY(_ResourceDim < (1 << ResourceDimBits), "Resource dimension (", Uint32{_ResourceDim}, ") exceeds max representable value ", (1 << ResourceDimBits) ); + VERIFY(_Attribs.ResourceDim < (1 << ResourceDimBits), "Resource dimension (", Uint32{_Attribs.ResourceDim}, ") exceeds max representable value ", (1 << ResourceDimBits) ); // clang-format on } diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index 5d52dd86..35ef4240 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -756,8 +756,7 @@ PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* { try { - const auto& LogicalDevice = pDeviceVk->GetLogicalDevice(); - const auto ShaderGroupHandleSize = pDeviceVk->GetProperties().ShaderGroupHandleSize; + const auto& LogicalDevice = pDeviceVk->GetLogicalDevice(); std::vector<VkPipelineShaderStageCreateInfo> vkShaderStages; std::vector<VulkanUtilities::ShaderModuleWrapper> ShaderModules; diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp index 1700c492..c85c194a 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp @@ -377,18 +377,13 @@ void ShaderResourceLayoutVk::InitializeStaticResourceLayout(const std::vector<co { *this, stringPool.CopyString(Attribs.Name), - Attribs.ArraySize, - Attribs.Type, - Attribs.GetResourceDimension(), - Attribs.IsMultisample(), + Attribs, VarType, Binding, DescriptorSet, CacheOffset, SamplerInd, - SrcImmutableSamplerInd >= 0, - Attribs.BufferStaticSize, - Attribs.BufferStride // + SrcImmutableSamplerInd >= 0 // }; } else @@ -667,18 +662,13 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice* pRende { ResLayout, stringPools[ShaderStageInd].CopyString(Attribs.Name), - Attribs.ArraySize, - Attribs.Type, - Attribs.GetResourceDimension(), - Attribs.IsMultisample(), + Attribs, VarType, Binding, DescriptorSet, CacheOffset, SamplerInd, - vkImmutableSampler != VK_NULL_HANDLE, - Attribs.BufferStaticSize, - Attribs.BufferStride // + vkImmutableSampler != VK_NULL_HANDLE // }; } else @@ -1322,7 +1312,7 @@ void ShaderResourceLayoutVk::InitializeStaticResources(const ShaderResourceLayou if (DstRes.Type == SPIRVShaderResourceAttribs::ResourceType::SeparateSampler && DstRes.IsImmutableSamplerAssigned()) - continue; // Skip immutable samplers + continue; // Skip immutable separate samplers for (Uint32 ArrInd = 0; ArrInd < DstRes.ArraySize; ++ArrInd) { |
