Fix stencil usage in Vulkan

This commit is contained in:
Wojtek Figat
2024-11-20 16:15:54 +01:00
parent 471d5c2a9b
commit 20704ef9dd
2 changed files with 5 additions and 2 deletions

View File

@@ -723,11 +723,14 @@ void GPUContextVulkan::FrameBegin()
Platform::MemoryCopy(_samplerHandles, _device->HelperResources.GetStaticSamplers(), sizeof(VkSampler) * GPU_STATIC_SAMPLERS_COUNT);
Platform::MemoryClear(_samplerHandles + GPU_STATIC_SAMPLERS_COUNT, sizeof(_samplerHandles) - sizeof(VkSampler) * GPU_STATIC_SAMPLERS_COUNT);
// Init command buffer
const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer();
vkCmdSetStencilReference(cmdBuffer->GetHandle(), VK_STENCIL_FRONT_AND_BACK, _stencilRef);
#if VULKAN_RESET_QUERY_POOLS
// Reset pending queries
if (_device->QueriesToReset.HasItems())
{
const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer();
for (auto query : _device->QueriesToReset)
query->Reset(cmdBuffer);
_device->QueriesToReset.Clear();

View File

@@ -337,7 +337,7 @@ bool GPUPipelineStateVulkan::Init(const Description& desc)
_descDepthStencil.front.failOp = ToVulkanStencilOp(desc.StencilFailOp);
_descDepthStencil.front.depthFailOp = ToVulkanStencilOp(desc.StencilDepthFailOp);
_descDepthStencil.front.passOp = ToVulkanStencilOp(desc.StencilPassOp);
_descDepthStencil.front = _descDepthStencil.back;
_descDepthStencil.back = _descDepthStencil.front;
_desc.pDepthStencilState = &_descDepthStencil;
DepthReadEnable = desc.DepthEnable && desc.DepthFunc != ComparisonFunc::Always;
DepthWriteEnable = _descDepthStencil.depthWriteEnable;