Fix Z-fighting issues in Debug Draw when using TAA

This commit is contained in:
Wojtek Figat
2024-03-19 17:53:14 +01:00
parent 388b64a46d
commit 71dad84908
3 changed files with 8 additions and 4 deletions

View File

@@ -127,7 +127,8 @@ PACK_STRUCT(struct Vertex {
PACK_STRUCT(struct Data {
Matrix ViewProjection;
Float3 Padding;
Float2 Padding;
float ClipPosZBias;
bool EnableDepthTest;
});
@@ -785,6 +786,7 @@ void DebugDraw::Draw(RenderContext& renderContext, GPUTextureView* target, GPUTe
Matrix vp;
Matrix::Multiply(view.View, view.Projection, vp);
Matrix::Transpose(vp, data.ViewProjection);
data.ClipPosZBias = -0.2f; // Reduce Z-fighting artifacts (eg. editor grid)
data.EnableDepthTest = enableDepthTest;
context->UpdateCB(cb, &data);
context->BindCB(0, cb);