Add support for stencil buffer on Vulkan and D3D11/D3D12

This commit is contained in:
Wojtek Figat
2024-02-01 14:47:17 +01:00
parent 7fd6c43f84
commit 8488a8d387
15 changed files with 268 additions and 263 deletions

View File

@@ -174,7 +174,7 @@ VkPipeline GPUPipelineStateVulkan::GetState(RenderPassVulkan* renderPass)
// Update description to match the pipeline
_descColorBlend.attachmentCount = renderPass->Layout.RTsCount;
_descMultisample.rasterizationSamples = (VkSampleCountFlagBits)renderPass->Layout.MSAA;
_desc.renderPass = renderPass->GetHandle();
_desc.renderPass = renderPass->Handle;
// Check if has missing layout
if (_desc.layout == VK_NULL_HANDLE)
@@ -321,6 +321,10 @@ bool GPUPipelineStateVulkan::Init(const Description& desc)
_descDepthStencil.front.passOp = ToVulkanStencilOp(desc.StencilPassOp);
_descDepthStencil.front = _descDepthStencil.back;
_desc.pDepthStencilState = &_descDepthStencil;
DepthReadEnable = desc.DepthEnable && desc.DepthFunc != ComparisonFunc::Always;
DepthWriteEnable = _descDepthStencil.depthWriteEnable;
StencilReadEnable = desc.StencilEnable && desc.StencilReadMask != 0 && desc.StencilFunc != ComparisonFunc::Always;
StencilWriteEnable = desc.StencilEnable && desc.StencilWriteMask != 0;
// Rasterization
RenderToolsVulkan::ZeroStruct(_descRasterization, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO);