Add GEqual Z-test option for pipeline backends

This commit is contained in:
Jack Andersen 2017-09-02 19:52:53 -10:00
parent 04ff1692d8
commit 18cbfd2865
5 changed files with 13 additions and 0 deletions

View File

@ -198,6 +198,7 @@ enum class ZTest
None, None,
LEqual, /* Flipped on Vulkan, D3D, Metal */ LEqual, /* Flipped on Vulkan, D3D, Metal */
Greater, Greater,
GEqual,
Equal Equal
}; };

View File

@ -564,6 +564,9 @@ class D3D11ShaderPipeline : public IShaderPipeline
case ZTest::Greater: case ZTest::Greater:
dsDesc.DepthFunc = D3D11_COMPARISON_LESS; dsDesc.DepthFunc = D3D11_COMPARISON_LESS;
break; break;
case ZTest::GEqual:
dsDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
break;
case ZTest::Equal: case ZTest::Equal:
dsDesc.DepthFunc = D3D11_COMPARISON_EQUAL; dsDesc.DepthFunc = D3D11_COMPARISON_EQUAL;
break; break;

View File

@ -720,6 +720,9 @@ class D3D12ShaderPipeline : public IShaderPipeline
case ZTest::Greater: case ZTest::Greater:
desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_LESS; desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_LESS;
break; break;
case ZTest::GEqual:
desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL;
break;
case ZTest::Equal: case ZTest::Equal:
desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_EQUAL; desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_EQUAL;
break; break;

View File

@ -503,6 +503,9 @@ public:
case ZTest::Greater: case ZTest::Greater:
glDepthFunc(GL_GREATER); glDepthFunc(GL_GREATER);
break; break;
case ZTest::GEqual:
glDepthFunc(GL_GEQUAL);
break;
case ZTest::Equal: case ZTest::Equal:
glDepthFunc(GL_EQUAL); glDepthFunc(GL_EQUAL);
break; break;

View File

@ -656,6 +656,9 @@ class MetalShaderPipeline : public IShaderPipeline
case ZTest::Greater: case ZTest::Greater:
dsDesc.depthCompareFunction = MTLCompareFunctionLess; dsDesc.depthCompareFunction = MTLCompareFunctionLess;
break; break;
case ZTest::GEqual:
dsDesc.depthCompareFunction = MTLCompareFunctionLessEqual;
break;
case ZTest::Equal: case ZTest::Equal:
dsDesc.depthCompareFunction = MTLCompareFunctionEqual; dsDesc.depthCompareFunction = MTLCompareFunctionEqual;
break; break;