Skip to content

Commit

Permalink
DeviceContextVk: set dynamic rendering view mask when committing rend…
Browse files Browse the repository at this point in the history
…er pass
  • Loading branch information
TheMostDiligent committed Feb 2, 2025
1 parent edfe8e2 commit 5baf02e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions Graphics/GraphicsEngineVulkan/include/FramebufferCache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ class FramebufferCache

struct CreateDyanmicRenderInfoAttribs
{
VkExtent2D Extent = {};
uint32_t Layers = 0;
uint32_t ViewMask = 0;
VkExtent2D Extent = {};
uint32_t Layers = 0;

VkExtent2D ShadingRateTexelSize = {};

Expand Down
7 changes: 4 additions & 3 deletions Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,8 @@ void DeviceContextVkImpl::CommitRenderPassAndFramebuffer(bool VerifyStates)
}
else if (DynamicRenderingHash != 0)
{
// Set view mask now as viewports may not be set when ChooseRenderPassAndFramebuffer() is called
m_DynamicRenderingInfo->SetViewMask((1u << m_NumViewports) - 1u);
m_CommandBuffer.BeginRendering(*m_DynamicRenderingInfo, DynamicRenderingHash);
}
}
Expand Down Expand Up @@ -1912,9 +1914,8 @@ void DeviceContextVkImpl::ChooseRenderPassAndFramebuffer()
else
{
FramebufferCache::CreateDyanmicRenderInfoAttribs CreateRIAttribs;
CreateRIAttribs.Extent = {m_FramebufferWidth, m_FramebufferHeight};
CreateRIAttribs.Layers = m_FramebufferSlices;
CreateRIAttribs.ViewMask = (1u << m_NumViewports) - 1u;
CreateRIAttribs.Extent = {m_FramebufferWidth, m_FramebufferHeight};
CreateRIAttribs.Layers = m_FramebufferSlices;
if (m_pBoundDepthStencil)
{
const TEXTURE_FORMAT DepthStencilFmt = m_pBoundDepthStencil->GetTexture()->GetDesc().Format;
Expand Down
5 changes: 2 additions & 3 deletions Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ std::unique_ptr<VulkanUtilities::RenderingInfoWrapper> FramebufferCache::CreateD
std::unique_ptr<VulkanUtilities::RenderingInfoWrapper> RI = std::make_unique<VulkanUtilities::RenderingInfoWrapper>(
Key.GetHash(), Key.NumRenderTargets, Attribs.UseDepthAttachment, Attribs.UseStencilAttachment);

RI->SetRenderArea({{0, 0}, Attribs.Extent})
.SetLayerCount(Attribs.Layers)
.SetViewMask(Attribs.ViewMask);
RI->SetRenderArea({{0, 0}, Attribs.Extent});
RI->SetLayerCount(Attribs.Layers);

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

0 comments on commit 5baf02e

Please sign in to comment.