GPU/HW: Exclude 2D polygons from depth buffer

Fixes UI getting obscured in Kingsley's Adventure.
pull/3352/head
Stenzek 10 months ago
parent 1c9b9ca37a
commit 7d2898b94c
No known key found for this signature in database

@ -2798,13 +2798,14 @@ void GPU_HW::DrawPrecisePolygon(const GPUBackendDrawPrecisePolygonCommand* cmd)
GSVector4i clamped_draw_rect_012, clamped_draw_rect_123; GSVector4i clamped_draw_rect_012, clamped_draw_rect_123;
if (BeginPolygonDraw(cmd, vertices, num_vertices, clamped_draw_rect_012, clamped_draw_rect_123)) if (BeginPolygonDraw(cmd, vertices, num_vertices, clamped_draw_rect_012, clamped_draw_rect_123))
{ {
const bool use_depth = m_pgxp_depth_buffer && cmd->valid_w; // Use PGXP to exclude primitives that are definitely 3D.
const bool is_3d = (vertices[0].w != vertices[1].w || vertices[0].w != vertices[2].w ||
(num_vertices == 4 && vertices[0].w != vertices[3].w));
const bool use_depth = m_pgxp_depth_buffer && is_3d;
SetBatchDepthBuffer(cmd, use_depth); SetBatchDepthBuffer(cmd, use_depth);
if (use_depth) if (use_depth)
CheckForDepthClear(cmd, vertices.data(), num_vertices); CheckForDepthClear(cmd, vertices.data(), num_vertices);
// Use PGXP to exclude primitives that are definitely 3D.
const bool is_3d = (vertices[0].w != vertices[1].w || vertices[0].w != vertices[2].w);
FinishPolygonDraw(cmd, vertices, num_vertices, true, is_3d, clamped_draw_rect_012, clamped_draw_rect_123); FinishPolygonDraw(cmd, vertices, num_vertices, true, is_3d, clamped_draw_rect_012, clamped_draw_rect_123);
} }

Loading…
Cancel
Save