Add support for Depth Bounds test in all graphics APIs

This commit is contained in:
Wojtek Figat
2026-01-19 17:44:45 +01:00
parent ee75cab73e
commit d049a16882
21 changed files with 332 additions and 98 deletions

View File

@@ -713,10 +713,16 @@ void GPUContextVulkan::OnDrawCall()
if (_psDirtyFlag && pipelineState && (_rtDepth || _rtCount))
{
_psDirtyFlag = false;
const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer();
const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer()->GetHandle();
const auto pipeline = pipelineState->GetState(_renderPass, _vertexLayout);
vkCmdBindPipeline(cmdBuffer->GetHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
vkCmdBindPipeline(cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
RENDER_STAT_PS_STATE_CHANGE();
if (_depthBoundsEnable && (!_currentState || !_currentState->DepthBoundsEnable))
{
// Auto-disable depth bounds
_depthBoundsEnable = false;
//vkCmdSetDepthBoundsTestEnable(cmdBuffer, false);
}
}
// Bind descriptors sets to the graphics pipeline
@@ -1381,6 +1387,17 @@ void GPUContextVulkan::SetScissor(const Rectangle& scissorRect)
vkCmdSetScissor(_cmdBufferManager->GetCmdBuffer()->GetHandle(), 0, 1, &rect);
}
void GPUContextVulkan::SetDepthBounds(float minDepth, float maxDepth)
{
const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer()->GetHandle();
if (!_depthBoundsEnable)
{
_depthBoundsEnable = true;
//vkCmdSetDepthBoundsTestEnable(cmdBuffer, true);
}
vkCmdSetDepthBounds(cmdBuffer, minDepth, maxDepth);
}
GPUPipelineState* GPUContextVulkan::GetState() const
{
return _currentState;