Browse Source

TestFramework: Changed depth test so that object rendered later at the same depth overwrite earlier objects (#1791)

Jorrit Rouwe 1 month ago
parent
commit
de7cf0a262

+ 1 - 1
TestFramework/Renderer/DX12/PipelineStateDX12.cpp

@@ -110,7 +110,7 @@ PipelineStateDX12::PipelineStateDX12(RendererDX12 *inRenderer, const VertexShade
 
 	pso_desc.DepthStencilState.DepthEnable = inDepthTest == EDepthTest::On? TRUE : FALSE;
 	pso_desc.DepthStencilState.DepthWriteMask = inDepthTest == EDepthTest::On? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO;
-	pso_desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_GREATER;
+	pso_desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_GREATER_EQUAL;
 	pso_desc.DepthStencilState.StencilEnable = FALSE;
 
 	pso_desc.SampleMask = UINT_MAX;

+ 1 - 1
TestFramework/Renderer/MTL/PipelineStateMTL.mm

@@ -123,7 +123,7 @@ PipelineStateMTL::PipelineStateMTL(RendererMTL *inRenderer, const VertexShaderMT
 	MTLDepthStencilDescriptor *depth_descriptor = [[MTLDepthStencilDescriptor new] init];
 	if (inDepthTest == EDepthTest::On)
 	{
-		depth_descriptor.depthCompareFunction = MTLCompareFunctionGreater;
+		depth_descriptor.depthCompareFunction = MTLCompareFunctionGreaterEqual;
 		depth_descriptor.depthWriteEnabled = YES;
 	}
 	else

+ 1 - 1
TestFramework/Renderer/VK/PipelineStateVK.cpp

@@ -108,7 +108,7 @@ PipelineStateVK::PipelineStateVK(RendererVK *inRenderer, const VertexShaderVK *i
 	depth_stencil.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
 	depth_stencil.depthTestEnable = inDepthTest == EDepthTest::On? VK_TRUE : VK_FALSE;
 	depth_stencil.depthWriteEnable = inDepthTest == EDepthTest::On? VK_TRUE : VK_FALSE;
-	depth_stencil.depthCompareOp = VK_COMPARE_OP_GREATER; // Reverse-Z, greater is closer
+	depth_stencil.depthCompareOp = VK_COMPARE_OP_GREATER_OR_EQUAL; // Reverse-Z, greater is closer
 
 	VkPipelineColorBlendAttachmentState color_blend_attachment = {};
 	color_blend_attachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;