Fix scissor bugs (fixes Deferred Shading flare on Vulkan and widget scissor on OpenGL)
This commit is contained in:
parent
b98fd65a01
commit
b43ed890d0
|
|
@ -906,6 +906,8 @@ int main()
|
|||
builder.SetScissor(renderArea);
|
||||
builder.SetViewport(renderArea);
|
||||
|
||||
flareSprite.UpdateScissorBox(renderArea);
|
||||
|
||||
builder.BindShaderBinding(0, *skyboxShaderBinding);
|
||||
|
||||
builder.BindIndexBuffer(*cubeMeshGfx->GetIndexBuffer(0));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ namespace Nz
|
|||
m_opaqueMaterialPass = std::make_shared<MaterialPass>(BasicMaterial::GetSettings());
|
||||
m_opaqueMaterialPass->EnableDepthBuffer(true);
|
||||
m_opaqueMaterialPass->EnableDepthWrite(false);
|
||||
m_opaqueMaterialPass->EnableScissorTest(true);
|
||||
|
||||
m_opaqueMaterial = std::make_shared<Material>();
|
||||
m_opaqueMaterial->AddPass("ForwardPass", m_opaqueMaterialPass);
|
||||
|
|
@ -35,6 +36,7 @@ namespace Nz
|
|||
m_transparentMaterialPass = std::make_shared<MaterialPass>(BasicMaterial::GetSettings());
|
||||
m_transparentMaterialPass->EnableDepthBuffer(true);
|
||||
m_transparentMaterialPass->EnableDepthWrite(false);
|
||||
m_transparentMaterialPass->EnableScissorTest(true);
|
||||
m_transparentMaterialPass->EnableBlending(true);
|
||||
m_transparentMaterialPass->SetBlendEquation(BlendEquation::Add, BlendEquation::Add);
|
||||
m_transparentMaterialPass->SetBlendFunc(BlendFunc::SrcAlpha, BlendFunc::InvSrcAlpha, BlendFunc::One, BlendFunc::One);
|
||||
|
|
|
|||
Loading…
Reference in New Issue