Make depthBounds optional for the Vulkan renderer

This is already the case for the OpenGL renderer. This feature is not
supported by all the Vulkan drivers. For example Mesa ANV with
Coffe-lake (that is relatively recent) or Mesa v3dv (Broadcom) used on
the rpi4.
This commit is contained in:
Alejandro Piñeiro 2021-02-08 23:49:57 +01:00
parent 3b9c2ebd66
commit a0f107ec4a
2 changed files with 3 additions and 3 deletions

View file

@ -716,7 +716,7 @@ static void CreateLogicalDeviceAndQueues()
deviceFeatures.imageCubeArray = VK_TRUE;
deviceFeatures.depthClamp = VK_TRUE;
deviceFeatures.depthBiasClamp = VK_TRUE;
deviceFeatures.depthBounds = VK_TRUE;
deviceFeatures.depthBounds = vkcontext.physicalDeviceFeatures.depthBounds;
deviceFeatures.fillModeNonSolid = VK_TRUE;
deviceFeatures.samplerAnisotropy = vkcontext.physicalDeviceFeatures.samplerAnisotropy; // RB
@ -2279,7 +2279,7 @@ idRenderBackend::GL_DepthBoundsTest
*/
void idRenderBackend::GL_DepthBoundsTest( const float zmin, const float zmax )
{
if( zmin > zmax )
if( !vkcontext.physicalDeviceFeatures.depthBounds || zmin > zmax )
{
return;
}

View file

@ -1236,7 +1236,7 @@ static VkPipeline CreateGraphicsPipeline(
depthStencilState.depthTestEnable = VK_TRUE;
depthStencilState.depthWriteEnable = ( stateBits & GLS_DEPTHMASK ) == 0;
depthStencilState.depthCompareOp = depthCompareOp;
depthStencilState.depthBoundsTestEnable = ( stateBits & GLS_DEPTH_TEST_MASK ) != 0;
depthStencilState.depthBoundsTestEnable = vkcontext.physicalDeviceFeatures.depthBounds && ( stateBits & GLS_DEPTH_TEST_MASK ) != 0;
depthStencilState.minDepthBounds = 0.0f;
depthStencilState.maxDepthBounds = 1.0f;
depthStencilState.stencilTestEnable = ( stateBits & ( GLS_STENCIL_FUNC_BITS | GLS_STENCIL_OP_BITS | GLS_SEPARATE_STENCIL ) ) != 0;