Fix scissor bugs (fixes Deferred Shading flare on Vulkan and widget scissor on OpenGL)

This commit is contained in:
Jérôme Leclercq
2021-12-25 20:25:39 +01:00
parent b98fd65a01
commit b43ed890d0
3 changed files with 17 additions and 4 deletions

View File

@@ -122,9 +122,15 @@ namespace Nz
return createInfo;
}
std::vector<VkDynamicState> VulkanRenderPipeline::BuildDynamicStateList(const RenderPipelineInfo& /*pipelineInfo*/)
std::vector<VkDynamicState> VulkanRenderPipeline::BuildDynamicStateList(const RenderPipelineInfo& pipelineInfo)
{
return { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
std::vector<VkDynamicState> dynamicStates;
dynamicStates.push_back(VK_DYNAMIC_STATE_VIEWPORT);
if (pipelineInfo.scissorTest)
dynamicStates.push_back(VK_DYNAMIC_STATE_SCISSOR);
return dynamicStates;
}
VkPipelineInputAssemblyStateCreateInfo VulkanRenderPipeline::BuildInputAssemblyInfo(const RenderPipelineInfo& pipelineInfo)
@@ -159,11 +165,14 @@ namespace Nz
return createInfo;
}
VkPipelineViewportStateCreateInfo VulkanRenderPipeline::BuildViewportInfo(const RenderPipelineInfo& /*pipelineInfo*/)
VkPipelineViewportStateCreateInfo VulkanRenderPipeline::BuildViewportInfo(const RenderPipelineInfo& pipelineInfo)
{
VkPipelineViewportStateCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
createInfo.scissorCount = createInfo.viewportCount = 1; //< TODO
createInfo.viewportCount = 1; //< TODO: Handle multiple viewport regions
if (pipelineInfo.scissorTest)
createInfo.scissorCount = 1; //< TODO: Handle multiple scissor regions
return createInfo;
}