Add depth function to conditional compiling
This commit is contained in:
@@ -182,11 +182,26 @@ public:
|
||||
API_FUNCTION() virtual void Clear(GPUTextureView* rt, const Color& color) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Clears depth buffer.
|
||||
/// Clears depth buffer with custom value.
|
||||
/// </summary>
|
||||
/// <param name="depthBuffer">The depth buffer to clear.</param>
|
||||
/// <param name="depthValue">The clear depth value.</param>
|
||||
API_FUNCTION() virtual void ClearDepth(GPUTextureView* depthBuffer, float depthValue = 0.0f) = 0;
|
||||
API_FUNCTION() virtual void ClearDepthCustom(GPUTextureView* depthBuffer, float depthValue) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Clears depth buffer with default value.
|
||||
/// </summary>
|
||||
/// <param name="depthBuffer">The depth buffer to clear.</param>
|
||||
/// <param name="depthValue">The clear depth value.</param>
|
||||
API_FUNCTION() FORCE_INLINE void ClearDepth(GPUTextureView* depthBuffer) {
|
||||
|
||||
#if FLAX_REVERSE_Z
|
||||
ClearDepthCustom(depthBuffer, 0.0f);
|
||||
#else
|
||||
ClearDepthCustom(depthBuffer, 0.0f);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears an unordered access buffer with a float value.
|
||||
|
||||
@@ -130,7 +130,11 @@ GPUPipelineState::Description GPUPipelineState::Description::Default =
|
||||
true, // DepthEnable
|
||||
true, // DepthWriteEnable
|
||||
true, // DepthClipEnable
|
||||
#if FLAX_REVERSE_Z
|
||||
ComparisonFunc::Greater, // DepthFunc
|
||||
#else
|
||||
ComparisonFunc::Less, // DepthFunc
|
||||
#endif
|
||||
false, // StencilEnable
|
||||
0xff, // StencilReadMask
|
||||
0xff, // StencilWriteMask
|
||||
@@ -154,7 +158,11 @@ GPUPipelineState::Description GPUPipelineState::Description::DefaultNoDepth =
|
||||
false, // DepthEnable
|
||||
false, // DepthWriteEnable
|
||||
false, // DepthClipEnable
|
||||
#if FLAX_REVERSE_Z
|
||||
ComparisonFunc::Greater, // DepthFunc
|
||||
#else
|
||||
ComparisonFunc::Less, // DepthFunc
|
||||
#endif
|
||||
false, // StencilEnable
|
||||
0xff, // StencilReadMask
|
||||
0xff, // StencilWriteMask
|
||||
@@ -178,7 +186,11 @@ GPUPipelineState::Description GPUPipelineState::Description::DefaultFullscreenTr
|
||||
false, // DepthEnable
|
||||
false, // DepthWriteEnable
|
||||
false, // DepthClipEnable
|
||||
#if FLAX_REVERSE_Z
|
||||
ComparisonFunc::Greater, // DepthFunc
|
||||
#else
|
||||
ComparisonFunc::Less, // DepthFunc
|
||||
#endif
|
||||
false, // StencilEnable
|
||||
0xff, // StencilReadMask
|
||||
0xff, // StencilWriteMask
|
||||
|
||||
@@ -196,7 +196,11 @@ bool DeferredMaterialShader::Load()
|
||||
// Motion Vectors pass
|
||||
psDesc.DepthWriteEnable = false;
|
||||
psDesc.DepthEnable = true;
|
||||
#if FLAX_REVERSE_Z
|
||||
psDesc.DepthFunc = ComparisonFunc::GreaterEqual;
|
||||
#else
|
||||
psDesc.DepthFunc = ComparisonFunc::LessEqual;
|
||||
#endif
|
||||
psDesc.VS = _shader->GetVS("VS");
|
||||
psDesc.PS = _shader->GetPS("PS_MotionVectors");
|
||||
_cache.MotionVectors.Init(psDesc);
|
||||
@@ -214,7 +218,11 @@ bool DeferredMaterialShader::Load()
|
||||
psDesc.DepthClipEnable = false;
|
||||
psDesc.DepthWriteEnable = true;
|
||||
psDesc.DepthEnable = true;
|
||||
#if FLAX_REVERSE_Z
|
||||
psDesc.DepthFunc = ComparisonFunc::Greater;
|
||||
#else
|
||||
psDesc.DepthFunc = ComparisonFunc::Less;
|
||||
#endif
|
||||
psDesc.HS = nullptr;
|
||||
psDesc.DS = nullptr;
|
||||
GPUShaderProgramVS* instancedDepthPassVS;
|
||||
|
||||
@@ -173,7 +173,11 @@ bool DeformableMaterialShader::Load()
|
||||
psDesc.DepthClipEnable = false;
|
||||
psDesc.DepthWriteEnable = true;
|
||||
psDesc.DepthEnable = true;
|
||||
#if FLAX_REVERSE_Z
|
||||
psDesc.DepthFunc = ComparisonFunc::Greater;
|
||||
#else
|
||||
psDesc.DepthFunc = ComparisonFunc::Less;
|
||||
#endif
|
||||
psDesc.HS = nullptr;
|
||||
psDesc.DS = nullptr;
|
||||
_cache.Depth.Init(psDesc);
|
||||
|
||||
@@ -205,7 +205,11 @@ bool ForwardMaterialShader::Load()
|
||||
psDesc.DepthClipEnable = false;
|
||||
psDesc.DepthWriteEnable = true;
|
||||
psDesc.DepthEnable = true;
|
||||
#if FLAX_REVERSE_Z
|
||||
psDesc.DepthFunc = ComparisonFunc::Greater;
|
||||
#else
|
||||
psDesc.DepthFunc = ComparisonFunc::Less;
|
||||
#endif
|
||||
psDesc.HS = nullptr;
|
||||
psDesc.DS = nullptr;
|
||||
psDesc.VS = _shader->GetVS("VS");
|
||||
|
||||
@@ -185,7 +185,11 @@ bool TerrainMaterialShader::Load()
|
||||
psDesc.DepthClipEnable = false;
|
||||
psDesc.DepthWriteEnable = true;
|
||||
psDesc.DepthEnable = true;
|
||||
#if FLAX_REVERSE_Z
|
||||
psDesc.DepthFunc = ComparisonFunc::Greater;
|
||||
#else
|
||||
psDesc.DepthFunc = ComparisonFunc::Less;
|
||||
#endif
|
||||
psDesc.HS = nullptr;
|
||||
psDesc.DS = nullptr;
|
||||
// TODO: masked terrain materials (depth pass should clip holes)
|
||||
|
||||
@@ -166,7 +166,7 @@ void GPUContextDX11::Clear(GPUTextureView* rt, const Color& color)
|
||||
}
|
||||
}
|
||||
|
||||
void GPUContextDX11::ClearDepth(GPUTextureView* depthBuffer, float depthValue)
|
||||
void GPUContextDX11::ClearDepthCustom(GPUTextureView* depthBuffer, float depthValue)
|
||||
{
|
||||
auto depthBufferDX11 = static_cast<GPUTextureViewDX11*>(depthBuffer);
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
void* GetNativePtr() const override;
|
||||
bool IsDepthBufferBinded() override;
|
||||
void Clear(GPUTextureView* rt, const Color& color) override;
|
||||
void ClearDepth(GPUTextureView* depthBuffer, float depthValue) override;
|
||||
void ClearDepthCustom(GPUTextureView* depthBuffer, float depthValue) override;
|
||||
void ClearUA(GPUBuffer* buf, const Float4& value) override;
|
||||
void ClearUA(GPUBuffer* buf, const uint32 value[4]) override;
|
||||
void ClearUA(GPUTexture* texture, const uint32 value[4]) override;
|
||||
|
||||
@@ -713,7 +713,7 @@ void GPUContextDX12::Clear(GPUTextureView* rt, const Color& color)
|
||||
}
|
||||
}
|
||||
|
||||
void GPUContextDX12::ClearDepth(GPUTextureView* depthBuffer, float depthValue)
|
||||
void GPUContextDX12::ClearDepthCustom(GPUTextureView* depthBuffer, float depthValue)
|
||||
{
|
||||
auto depthBufferDX12 = static_cast<GPUTextureViewDX12*>(depthBuffer);
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
void* GetNativePtr() const override;
|
||||
bool IsDepthBufferBinded() override;
|
||||
void Clear(GPUTextureView* rt, const Color& color) override;
|
||||
void ClearDepth(GPUTextureView* depthBuffer, float depthValue) override;
|
||||
void ClearDepthCustom(GPUTextureView* depthBuffer, float depthValue) override;
|
||||
void ClearUA(GPUBuffer* buf, const Float4& value) override;
|
||||
void ClearUA(GPUBuffer* buf, const uint32 value[4]) override;
|
||||
void ClearUA(GPUTexture* texture, const uint32 value[4]) override;
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void ClearDepth(GPUTextureView* depthBuffer, float depthValue) override
|
||||
void ClearDepthCustom(GPUTextureView* depthBuffer, float depthValue) override
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -797,7 +797,7 @@ void GPUContextVulkan::Clear(GPUTextureView* rt, const Color& color)
|
||||
}
|
||||
}
|
||||
|
||||
void GPUContextVulkan::ClearDepth(GPUTextureView* depthBuffer, float depthValue)
|
||||
void GPUContextVulkan::ClearDepthCustom(GPUTextureView* depthBuffer, float depthValue)
|
||||
{
|
||||
const auto rtVulkan = static_cast<GPUTextureViewVulkan*>(depthBuffer);
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
void* GetNativePtr() const override;
|
||||
bool IsDepthBufferBinded() override;
|
||||
void Clear(GPUTextureView* rt, const Color& color) override;
|
||||
void ClearDepth(GPUTextureView* depthBuffer, float depthValue) override;
|
||||
void ClearDepthCustom(GPUTextureView* depthBuffer, float depthValue) override;
|
||||
void ClearUA(GPUBuffer* buf, const Float4& value) override;
|
||||
void ClearUA(GPUBuffer* buf, const uint32 value[4]) override;
|
||||
void ClearUA(GPUTexture* texture, const uint32 value[4]) override;
|
||||
|
||||
Reference in New Issue
Block a user