Skip to content

Commit 5baf02e

Browse files
DeviceContextVk: set dynamic rendering view mask when committing render pass
1 parent edfe8e2 commit 5baf02e

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

Graphics/GraphicsEngineVulkan/include/FramebufferCache.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ class FramebufferCache
8181

8282
struct CreateDyanmicRenderInfoAttribs
8383
{
84-
VkExtent2D Extent = {};
85-
uint32_t Layers = 0;
86-
uint32_t ViewMask = 0;
84+
VkExtent2D Extent = {};
85+
uint32_t Layers = 0;
8786

8887
VkExtent2D ShadingRateTexelSize = {};
8988

Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,8 @@ void DeviceContextVkImpl::CommitRenderPassAndFramebuffer(bool VerifyStates)
18321832
}
18331833
else if (DynamicRenderingHash != 0)
18341834
{
1835+
// Set view mask now as viewports may not be set when ChooseRenderPassAndFramebuffer() is called
1836+
m_DynamicRenderingInfo->SetViewMask((1u << m_NumViewports) - 1u);
18351837
m_CommandBuffer.BeginRendering(*m_DynamicRenderingInfo, DynamicRenderingHash);
18361838
}
18371839
}
@@ -1912,9 +1914,8 @@ void DeviceContextVkImpl::ChooseRenderPassAndFramebuffer()
19121914
else
19131915
{
19141916
FramebufferCache::CreateDyanmicRenderInfoAttribs CreateRIAttribs;
1915-
CreateRIAttribs.Extent = {m_FramebufferWidth, m_FramebufferHeight};
1916-
CreateRIAttribs.Layers = m_FramebufferSlices;
1917-
CreateRIAttribs.ViewMask = (1u << m_NumViewports) - 1u;
1917+
CreateRIAttribs.Extent = {m_FramebufferWidth, m_FramebufferHeight};
1918+
CreateRIAttribs.Layers = m_FramebufferSlices;
19181919
if (m_pBoundDepthStencil)
19191920
{
19201921
const TEXTURE_FORMAT DepthStencilFmt = m_pBoundDepthStencil->GetTexture()->GetDesc().Format;

Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ std::unique_ptr<VulkanUtilities::RenderingInfoWrapper> FramebufferCache::CreateD
143143
std::unique_ptr<VulkanUtilities::RenderingInfoWrapper> RI = std::make_unique<VulkanUtilities::RenderingInfoWrapper>(
144144
Key.GetHash(), Key.NumRenderTargets, Attribs.UseDepthAttachment, Attribs.UseStencilAttachment);
145145

146-
RI->SetRenderArea({{0, 0}, Attribs.Extent})
147-
.SetLayerCount(Attribs.Layers)
148-
.SetViewMask(Attribs.ViewMask);
146+
RI->SetRenderArea({{0, 0}, Attribs.Extent});
147+
RI->SetLayerCount(Attribs.Layers);
149148

150149
auto InitAttachment = [](VkRenderingAttachmentInfoKHR& Attachment, VkImageView View, VkImageLayout Layout) {
151150
Attachment.imageView = View;

0 commit comments

Comments
 (0)