summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-12-05 04:10:35 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-12-05 04:10:35 +0000
commit000fdae6ccfe0067b8621400b3c92cab1d86cedc (patch)
tree527ff57608662df4c54efc91d0344f4d197cea00 /Graphics/GraphicsEngineVulkan
parentReplaced SET_RENDER_TARGETS_FLAGS with RESOURCE_STATE_TRANSITION_MODE. (diff)
downloadDiligentCore-000fdae6ccfe0067b8621400b3c92cab1d86cedc.tar.gz
DiligentCore-000fdae6ccfe0067b8621400b3c92cab1d86cedc.zip
Minor code improvements in Vk backend
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h4
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp88
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp25
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp22
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp8
6 files changed, 80 insertions, 69 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
index 35274c2b..bd770629 100644
--- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
@@ -249,7 +249,7 @@ public:
private:
void TransitionRenderTargets(RESOURCE_STATE_TRANSITION_MODE StateTransitionMode);
- inline void CommitRenderPassAndFramebuffer();
+ inline void CommitRenderPassAndFramebuffer(bool VerifyStates);
void CommitVkVertexBuffers();
void CommitViewports();
void CommitScissorRects();
@@ -380,7 +380,7 @@ private:
RefCntAutoPtr<IShaderResourceBinding> m_GenerateMipsSRB;
// In Vulkan we can't bind null vertex buffer, so we have to create a dummy VB
- RefCntAutoPtr<IBuffer> m_DummyVB;
+ RefCntAutoPtr<BufferVkImpl> m_DummyVB;
};
}
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 754325fe..8ec11f0b 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -61,7 +61,7 @@ namespace Diligent
bIsDeferred ? std::numeric_limits<decltype(m_NumCommandsToFlush)>::max() : Attribs.NumCommandsToFlushCmdBuffer,
bIsDeferred
},
- m_CmdListAllocator { GetRawAllocator(), sizeof(CommandListVkImpl), 64 },
+ m_CmdListAllocator { GetRawAllocator(), sizeof(CommandListVkImpl), 64 },
// Command pools must be thread safe because command buffers are returned into pools by release queues
// potentially running in another thread
m_CmdPool
@@ -97,17 +97,25 @@ namespace Diligent
DummyVBDesc.BindFlags = BIND_VERTEX_BUFFER;
DummyVBDesc.Usage = USAGE_DEFAULT;
DummyVBDesc.uiSizeInBytes = 32;
- m_pDevice->CreateBuffer(DummyVBDesc, BufferData{}, &m_DummyVB);
+ RefCntAutoPtr<IBuffer> pDummyVB;
+ m_pDevice->CreateBuffer(DummyVBDesc, BufferData{}, &pDummyVB);
+ m_DummyVB = pDummyVB.RawPtr<BufferVkImpl>();
}
DeviceContextVkImpl::~DeviceContextVkImpl()
{
if (m_State.NumCommands != 0)
{
- LOG_ERROR_MESSAGE(m_bIsDeferred ?
- "There are outstanding commands in deferred context #", m_ContextId, " being destroyed, which indicates that FinishCommandList() has not been called." :
- "There are outstanding commands in the immediate context being destroyed, which indicates the context has not been Flush()'ed.",
- " This is unexpected and may result in synchronization errors");
+ if (m_bIsDeferred)
+ {
+ LOG_ERROR_MESSAGE("There are outstanding commands in deferred context #", m_ContextId, " being destroyed, which indicates that FinishCommandList() has not been called."
+ " This may cause synchronization issues.");
+ }
+ else
+ {
+ LOG_ERROR_MESSAGE("There are outstanding commands in the immediate context being destroyed, which indicates the context has not been Flush()'ed.",
+ " This may cause synchronization issues.");
+ }
}
if (!m_bIsDeferred)
@@ -242,7 +250,7 @@ namespace Diligent
{
m_CommandBuffer.SetStencilReference(m_StencilRef);
m_CommandBuffer.SetBlendConstants(m_BlendFactors);
- CommitRenderPassAndFramebuffer();
+ CommitRenderPassAndFramebuffer(true);
CommitViewports();
}
@@ -293,9 +301,9 @@ namespace Diligent
{
#ifdef DEVELOPMENT
if (m_NumVertexStreams < m_pPipelineState->GetNumBufferSlotsUsed())
- LOG_ERROR("Currently bound pipeline state \"", m_pPipelineState->GetDesc().Name, "\" expects ", m_pPipelineState->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound");
+ LOG_ERROR("Currently bound pipeline state '", m_pPipelineState->GetDesc().Name, "' expects ", m_pPipelineState->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound");
#endif
- // Do not initialize array with zeroes for performance reasons
+ // Do not initialize array with zeros for performance reasons
VkBuffer vkVertexBuffers[MaxBufferSlots];// = {}
VkDeviceSize Offsets[MaxBufferSlots];
VERIFY( m_NumVertexStreams <= MaxBufferSlots, "Too many buffers are being set" );
@@ -321,7 +329,7 @@ namespace Diligent
else
{
// We can't bind null vertex buffer in Vulkan and have to use a dummy one
- vkVertexBuffers[slot] = m_DummyVB.RawPtr<BufferVkImpl>()->GetVkBuffer();
+ vkVertexBuffers[slot] = m_DummyVB->GetVkBuffer();
Offsets[slot] = 0;
}
}
@@ -422,7 +430,7 @@ namespace Diligent
else
{
if ( m_pPipelineState->dbgContainsShaderResources() )
- LOG_ERROR_MESSAGE("Pipeline state \"", m_pPipelineState->GetDesc().Name, "\" contains shader resources, but IDeviceContext::CommitShaderResources() was not called" );
+ LOG_ERROR_MESSAGE("Pipeline state '", m_pPipelineState->GetDesc().Name, "' contains shader resources, but IDeviceContext::CommitShaderResources() was not called" );
}
#endif
#endif
@@ -442,7 +450,7 @@ namespace Diligent
}
#endif
- CommitRenderPassAndFramebuffer();
+ CommitRenderPassAndFramebuffer(VerifyStates);
if (pIndirectDrawAttribsVk != nullptr)
{
@@ -487,30 +495,25 @@ namespace Diligent
else
{
if ( m_pPipelineState->dbgContainsShaderResources() )
- LOG_ERROR_MESSAGE("Pipeline state \"", m_pPipelineState->GetDesc().Name, "\" contains shader resources, but IDeviceContext::CommitShaderResources() was not called" );
+ LOG_ERROR_MESSAGE("Pipeline state '", m_pPipelineState->GetDesc().Name, "' contains shader resources, but IDeviceContext::CommitShaderResources() was not called" );
}
#endif
#endif
- if ( DispatchAttrs.pIndirectDispatchAttribs )
+ if (DispatchAttrs.pIndirectDispatchAttribs != nullptr)
{
- if ( auto *pBufferVk = ValidatedCast<BufferVkImpl>(DispatchAttrs.pIndirectDispatchAttribs) )
- {
+ auto *pBufferVk = ValidatedCast<BufferVkImpl>(DispatchAttrs.pIndirectDispatchAttribs);
+
#ifdef DEVELOPMENT
- if (pBufferVk->GetDesc().Usage == USAGE_DYNAMIC)
- pBufferVk->DvpVerifyDynamicAllocation(this);
+ if (pBufferVk->GetDesc().Usage == USAGE_DYNAMIC)
+ pBufferVk->DvpVerifyDynamicAllocation(this);
#endif
- // Buffer memory barries must be executed outside of render pass
- TransitionOrVerifyBufferState(*pBufferVk, DispatchAttrs.IndirectAttribsBufferStateTransitionMode, RESOURCE_STATE_INDIRECT_ARGUMENT,
- VK_ACCESS_INDIRECT_COMMAND_READ_BIT, "Indirect dispatch (DeviceContextVkImpl::DispatchCompute)");
+ // Buffer memory barries must be executed outside of render pass
+ TransitionOrVerifyBufferState(*pBufferVk, DispatchAttrs.IndirectAttribsBufferStateTransitionMode, RESOURCE_STATE_INDIRECT_ARGUMENT,
+ VK_ACCESS_INDIRECT_COMMAND_READ_BIT, "Indirect dispatch (DeviceContextVkImpl::DispatchCompute)");
- m_CommandBuffer.DispatchIndirect(pBufferVk->GetVkBuffer(), pBufferVk->GetDynamicOffset(m_ContextId, this) + DispatchAttrs.DispatchArgsByteOffset);
- }
- else
- {
- LOG_ERROR_MESSAGE("Valid pIndirectDrawAttribs must be provided for indirect dispatch command");
- }
+ m_CommandBuffer.DispatchIndirect(pBufferVk->GetVkBuffer(), pBufferVk->GetDynamicOffset(m_ContextId, this) + DispatchAttrs.DispatchArgsByteOffset);
}
else
m_CommandBuffer.Dispatch(DispatchAttrs.ThreadGroupCountX, DispatchAttrs.ThreadGroupCountY, DispatchAttrs.ThreadGroupCountZ);
@@ -559,7 +562,9 @@ namespace Diligent
{
// Render pass may not be currently committed
VERIFY_EXPR(m_RenderPass != VK_NULL_HANDLE && m_Framebuffer != VK_NULL_HANDLE);
- CommitRenderPassAndFramebuffer();
+ TransitionRenderTargets(StateTransitionMode);
+ // No need to verify states again
+ CommitRenderPassAndFramebuffer(false);
VkClearAttachment ClearAttachment = {};
ClearAttachment.aspectMask = 0;
@@ -688,7 +693,9 @@ namespace Diligent
{
// Render pass may not be currently committed
VERIFY_EXPR(m_RenderPass != VK_NULL_HANDLE && m_Framebuffer != VK_NULL_HANDLE);
- CommitRenderPassAndFramebuffer();
+ TransitionRenderTargets(StateTransitionMode);
+ // No need to verify states again
+ CommitRenderPassAndFramebuffer(false);
VkClearAttachment ClearAttachment = {};
ClearAttachment.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
@@ -981,17 +988,15 @@ namespace Diligent
{
if (m_pBoundDepthStencil)
{
- auto* pDSVVk = m_pBoundDepthStencil.RawPtr<TextureViewVkImpl>();
- auto* pDepthBufferVk = ValidatedCast<TextureVkImpl>(pDSVVk->GetTexture());
+ auto* pDepthBufferVk = ValidatedCast<TextureVkImpl>(m_pBoundDepthStencil->GetTexture());
TransitionOrVerifyTextureState(*pDepthBufferVk, StateTransitionMode, RESOURCE_STATE_DEPTH_WRITE, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
"Binding depth-stencil buffer (DeviceContextVkImpl::TransitionRenderTargets)");
}
for (Uint32 rt=0; rt < m_NumBoundRenderTargets; ++rt)
{
- if (ITextureView* pRTV = m_pBoundRenderTargets[rt])
+ if (ITextureView* pRTVVk = m_pBoundRenderTargets[rt].RawPtr())
{
- auto* pRTVVk = ValidatedCast<TextureViewVkImpl>(pRTV);
auto* pRenderTargetVk = ValidatedCast<TextureVkImpl>(pRTVVk->GetTexture());
TransitionOrVerifyTextureState(*pRenderTargetVk, StateTransitionMode, RESOURCE_STATE_RENDER_TARGET, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
"Binding render targets (DeviceContextVkImpl::TransitionRenderTargets)");
@@ -999,7 +1004,7 @@ namespace Diligent
}
}
- inline void DeviceContextVkImpl::CommitRenderPassAndFramebuffer()
+ inline void DeviceContextVkImpl::CommitRenderPassAndFramebuffer(bool VerifyStates)
{
const auto& CmdBufferState = m_CommandBuffer.GetState();
if (CmdBufferState.Framebuffer != m_Framebuffer)
@@ -1011,7 +1016,10 @@ namespace Diligent
{
VERIFY_EXPR(m_RenderPass != VK_NULL_HANDLE);
#ifdef DEVELOPMENT
- TransitionRenderTargets(RESOURCE_STATE_TRANSITION_MODE_VERIFY);
+ if (VerifyStates)
+ {
+ TransitionRenderTargets(RESOURCE_STATE_TRANSITION_MODE_VERIFY);
+ }
#endif
m_CommandBuffer.BeginRenderPass(m_RenderPass, m_Framebuffer, m_FramebufferWidth, m_FramebufferHeight);
}
@@ -1029,10 +1037,9 @@ namespace Diligent
RenderPassCache::RenderPassCacheKey RenderPassKey;
if (m_pBoundDepthStencil)
{
- auto* pDSVVk = m_pBoundDepthStencil.RawPtr<TextureViewVkImpl>();
- auto* pDepthBuffer = pDSVVk->GetTexture();
- FBKey.DSV = pDSVVk->GetVulkanImageView();
- RenderPassKey.DSVFormat = pDSVVk->GetDesc().Format;
+ auto* pDepthBuffer = m_pBoundDepthStencil->GetTexture();
+ FBKey.DSV = m_pBoundDepthStencil->GetVulkanImageView();
+ RenderPassKey.DSVFormat = m_pBoundDepthStencil->GetDesc().Format;
RenderPassKey.SampleCount = static_cast<Uint8>(pDepthBuffer->GetDesc().SampleCount);
}
else
@@ -1046,9 +1053,8 @@ namespace Diligent
for (Uint32 rt=0; rt < m_NumBoundRenderTargets; ++rt)
{
- if (ITextureView* pRTV = m_pBoundRenderTargets[rt])
+ if (auto* pRTVVk = m_pBoundRenderTargets[rt].RawPtr())
{
- auto* pRTVVk = ValidatedCast<TextureViewVkImpl>(pRTV);
auto* pRenderTarget = pRTVVk->GetTexture();
FBKey.RTVs[rt] = pRTVVk->GetVulkanImageView();
RenderPassKey.RTVFormats[rt] = pRenderTarget->GetDesc().Format;
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp
index 9897a1d2..5c18e2eb 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp
@@ -449,7 +449,7 @@ void PipelineLayout::PrepareDescriptorSets(DeviceContextVkImpl* pCtxVkI
BindInfo.SetCout = 0;
for(SHADER_VARIABLE_TYPE VarType = SHADER_VARIABLE_TYPE_MUTABLE; VarType <= SHADER_VARIABLE_TYPE_DYNAMIC; VarType = static_cast<SHADER_VARIABLE_TYPE>(VarType+1))
{
- const auto &Set = m_LayoutMgr.GetDescriptorSet(VarType);
+ const auto& Set = m_LayoutMgr.GetDescriptorSet(VarType);
if (Set.SetIndex >= 0)
{
BindInfo.SetCout = std::max(BindInfo.SetCout, static_cast<Uint32>(Set.SetIndex + 1));
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
index 407e6f43..1b21d91e 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
@@ -511,6 +511,8 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind
RESOURCE_STATE_TRANSITION_MODE StateTransitionMode,
PipelineLayout::DescriptorSetBindInfo* pDescrSetBindInfo)const
{
+ VERIFY(CommitResources || StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION, "Resources should be transitioned or committed or both");
+
if (!m_HasStaticResources && !m_HasNonStaticResources)
return;
@@ -518,7 +520,7 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind
if (pShaderResourceBinding == nullptr)
{
LOG_ERROR_MESSAGE("Pipeline state '", m_Desc.Name, "' requires shader resource binding object to ",
- (CommitResources ? "commit" : "transition"), " resources, but none is provided.");
+ (CommitResources ? "commit" : "transition"), " resources, but none is provided.");
return;
}
#endif
@@ -550,17 +552,19 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind
}
#endif
- if (CommitResources)
+ if (StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION)
{
- if (StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION)
- ResourceCache.TransitionResources<false>(pCtxVkImpl);
+ ResourceCache.TransitionResources<false>(pCtxVkImpl);
+ }
#ifdef DEVELOPMENT
- else if (StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY)
- {
- ResourceCache.TransitionResources<true>(pCtxVkImpl);
- }
+ else if (StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY)
+ {
+ ResourceCache.TransitionResources<true>(pCtxVkImpl);
+ }
#endif
+ if (CommitResources)
+ {
VkDescriptorSet DynamicDescrSet = VK_NULL_HANDLE;
auto DynamicDescriptorSetVkLayout = m_PipelineLayout.GetDynamicDescriptorSetVkLayout();
if (DynamicDescriptorSetVkLayout != VK_NULL_HANDLE)
@@ -587,11 +591,6 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind
// Dynamic descriptor sets are not released individually. Instead, all dynamic descriptor pools
// are released at the end of the frame by DeviceContextVkImpl::FinishFrame().
}
- else
- {
- VERIFY(StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION, "Resources should be transitioned or committed or both");
- ResourceCache.TransitionResources<false>(pCtxVkImpl);
- }
}
}
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp
index 5e5dcaee..a9cc05f3 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp
@@ -102,10 +102,10 @@ ShaderResourceCacheVk::~ShaderResourceCacheVk()
template<bool VerifyOnly>
void ShaderResourceCacheVk::TransitionResources(DeviceContextVkImpl* pCtxVkImpl)
{
- auto *pResources = GetFirstResourcePtr();
+ auto* pResources = GetFirstResourcePtr();
for (Uint32 res = 0; res < m_TotalResources; ++res)
{
- auto &Res = pResources[res];
+ auto& Res = pResources[res];
switch (Res.Type)
{
case SPIRVShaderResourceAttribs::ResourceType::UniformBuffer:
@@ -113,7 +113,7 @@ void ShaderResourceCacheVk::TransitionResources(DeviceContextVkImpl* pCtxVkImpl)
auto* pBufferVk = Res.pObject.RawPtr<BufferVkImpl>();
if (pBufferVk != nullptr && pBufferVk->IsInKnownState())
{
- RESOURCE_STATE RequiredState = RESOURCE_STATE_CONSTANT_BUFFER;
+ constexpr RESOURCE_STATE RequiredState = RESOURCE_STATE_CONSTANT_BUFFER;
VERIFY_EXPR((ResourceStateFlagsToVkAccessFlags(RequiredState) & VK_ACCESS_UNIFORM_READ_BIT) == VK_ACCESS_UNIFORM_READ_BIT);
if (!pBufferVk->CheckState(RequiredState))
{
@@ -122,7 +122,9 @@ void ShaderResourceCacheVk::TransitionResources(DeviceContextVkImpl* pCtxVkImpl)
LOG_ERROR_MESSAGE("State of buffer '", pBufferVk->GetDesc().Name, "' is incorrect. Required state: ",
GetResourceStateString(RequiredState), ". Actual state: ",
GetResourceStateString(pBufferVk->GetState()),
- ". Call TransitionShaderResources() or provide RESOURCE_STATE_TRANSITION_MODE_TRANSITION flag to CommitShaderResources()");
+ ". Call IDeviceContext::TransitionShaderResources(), use RESOURCE_STATE_TRANSITION_MODE_TRANSITION "
+ "when calling IDeviceContext::CommitShaderResources() or explicitly transition the buffer state "
+ "with IDeviceContext::TransitionResourceStates().");
}
else
{
@@ -142,10 +144,10 @@ void ShaderResourceCacheVk::TransitionResources(DeviceContextVkImpl* pCtxVkImpl)
auto* pBufferVk = pBuffViewVk != nullptr ? ValidatedCast<BufferVkImpl>(pBuffViewVk->GetBuffer()) : nullptr;
if (pBufferVk != nullptr && pBufferVk->IsInKnownState())
{
- RESOURCE_STATE RequiredState = (Res.Type == SPIRVShaderResourceAttribs::ResourceType::UniformTexelBuffer) ?
+ const RESOURCE_STATE RequiredState = (Res.Type == SPIRVShaderResourceAttribs::ResourceType::UniformTexelBuffer) ?
RESOURCE_STATE_SHADER_RESOURCE : RESOURCE_STATE_UNORDERED_ACCESS;
#ifdef _DEBUG
- VkAccessFlags RequiredAccessFlags = (Res.Type == SPIRVShaderResourceAttribs::ResourceType::UniformTexelBuffer) ?
+ const VkAccessFlags RequiredAccessFlags = (Res.Type == SPIRVShaderResourceAttribs::ResourceType::UniformTexelBuffer) ?
VK_ACCESS_SHADER_READ_BIT : (VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT);
VERIFY_EXPR( (ResourceStateFlagsToVkAccessFlags(RequiredState) & RequiredAccessFlags) == RequiredAccessFlags);
#endif
@@ -156,7 +158,9 @@ void ShaderResourceCacheVk::TransitionResources(DeviceContextVkImpl* pCtxVkImpl)
LOG_ERROR_MESSAGE("State of buffer '", pBufferVk->GetDesc().Name, "' is incorrect. Required state: ",
GetResourceStateString(RequiredState), ". Actual state: ",
GetResourceStateString(pBufferVk->GetState()),
- ". Call TransitionShaderResources() or provide RESOURCE_STATE_TRANSITION_MODE_TRANSITION flag to CommitShaderResources()");
+ ". Call IDeviceContext::TransitionShaderResources(), use RESOURCE_STATE_TRANSITION_MODE_TRANSITION "
+ "when calling IDeviceContext::CommitShaderResources() or explicitly transition the buffer state "
+ "with IDeviceContext::TransitionResourceStates().");
}
else
{
@@ -212,7 +216,9 @@ void ShaderResourceCacheVk::TransitionResources(DeviceContextVkImpl* pCtxVkImpl)
LOG_ERROR_MESSAGE("State of texture '", pTextureVk->GetDesc().Name, "' is incorrect. Required state: ",
GetResourceStateString(RequiredState), ". Actual state: ",
GetResourceStateString(pTextureVk->GetState()),
- ". Call TransitionShaderResources() or specify RESOURCE_STATE_TRANSITION_MODE_TRANSITION flag in a call to CommitShaderResources()");
+ ". Call IDeviceContext::TransitionShaderResources(), use RESOURCE_STATE_TRANSITION_MODE_TRANSITION "
+ "when calling IDeviceContext::CommitShaderResources() or explicitly transition the texture state "
+ "with IDeviceContext::TransitionResourceStates().");
}
else
{
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp
index f544e6cb..f4a28167 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp
@@ -732,12 +732,12 @@ bool ShaderResourceLayoutVk::dvpVerifyBindings(const ShaderResourceCacheVk& Reso
{
for(Uint32 r=0; r < m_NumResources[VarType]; ++r)
{
- const auto &Res = GetResource(VarType, r);
+ const auto& Res = GetResource(VarType, r);
VERIFY(Res.SpirvAttribs.VarType == VarType, "Unexpected variable type");
for(Uint32 ArrInd = 0; ArrInd < Res.SpirvAttribs.ArraySize; ++ArrInd)
{
- auto &CachedDescrSet = ResourceCache.GetDescriptorSet(Res.DescriptorSet);
- const auto &CachedRes = CachedDescrSet.GetResource(Res.CacheOffset + ArrInd);
+ const auto& CachedDescrSet = ResourceCache.GetDescriptorSet(Res.DescriptorSet);
+ const auto& CachedRes = CachedDescrSet.GetResource(Res.CacheOffset + ArrInd);
VERIFY(CachedRes.Type == Res.SpirvAttribs.Type, "Inconsistent types");
if (CachedRes.pObject == nullptr &&
!(Res.SpirvAttribs.Type == SPIRVShaderResourceAttribs::ResourceType::SeparateSampler && Res.SpirvAttribs.IsImmutableSamplerAssigned()))
@@ -858,7 +858,7 @@ void ShaderResourceLayoutVk::CommitDynamicResources(const ShaderResourceCacheVk&
else
VERIFY(DynamicDescrSetIndex == Res.DescriptorSet, "Inconsistent dynamic resource desriptor set index");
#endif
- auto& SetResources = ResourceCache.GetDescriptorSet(Res.DescriptorSet);
+ const auto& SetResources = ResourceCache.GetDescriptorSet(Res.DescriptorSet);
WriteDescrSetIt->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
WriteDescrSetIt->pNext = nullptr;
VERIFY(SetResources.GetVkDescriptorSet() == VK_NULL_HANDLE, "Dynamic descriptor set must not be assigned to the resource cache");