From 5dba447dab6f8021631ad6628b2754727c52d284 Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 3 Aug 2020 19:14:25 -0700 Subject: Added render pass test, fixed default viewport setting issue when beginning the render pass --- Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 3 +++ Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 3214c30f..6a5d5ced 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -1300,6 +1300,9 @@ void DeviceContextVkImpl::BeginRenderPass(const BeginRenderPassAttribs& Attribs) EnsureVkCmdBuffer(); m_CommandBuffer.BeginRenderPass(m_vkRenderPass, m_vkFramebuffer, m_FramebufferWidth, m_FramebufferHeight, Attribs.ClearValueCount, pVkClearValues); + + // Set the viewport to match the framebuffer size + SetViewports(1, nullptr, 0, 0); } void DeviceContextVkImpl::NextSubpass() diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index 73485070..a4f61fd1 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -394,13 +394,15 @@ PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* pRefCoun DepthStencilStateDesc_To_VkDepthStencilStateCI(GraphicsPipeline.DepthStencilDesc); PipelineCI.pDepthStencilState = &DepthStencilStateCI; - std::vector ColorBlendAttachmentStates(m_Desc.GraphicsPipeline.NumRenderTargets); + const auto& RPDesc = m_pRenderPass->GetDesc(); + VERIFY_EXPR(GraphicsPipeline.pRenderPass != nullptr || GraphicsPipeline.NumRenderTargets == RPDesc.AttachmentCount); + std::vector ColorBlendAttachmentStates(RPDesc.AttachmentCount); VkPipelineColorBlendStateCreateInfo BlendStateCI = {}; BlendStateCI.pAttachments = !ColorBlendAttachmentStates.empty() ? ColorBlendAttachmentStates.data() : nullptr; - BlendStateCI.attachmentCount = m_Desc.GraphicsPipeline.NumRenderTargets; // must equal the colorAttachmentCount for the subpass - // in which this pipeline is used. + BlendStateCI.attachmentCount = RPDesc.AttachmentCount; // must equal the colorAttachmentCount for the subpass + // in which this pipeline is used. BlendStateDesc_To_VkBlendStateCI(GraphicsPipeline.BlendDesc, BlendStateCI, ColorBlendAttachmentStates); PipelineCI.pColorBlendState = &BlendStateCI; -- cgit v1.2.3