Rework depth raster to fully support software transform

This commit is contained in:
Henrik Rydgård committed 2024-12-21 21:22:22 +01:00
1 parent bd3a252104
commit 2371fdfedd
5 files changed
+148 -30

No files matched your search

+7 -5
View File
@@ -434,6 +434,13 @@ void DrawEngineVulkan::Flush() {
UpdateCachedViewportState(vpAndScissor);
}
// At this point, rect and line primitives are still preserved as such. So, it's the best time to do software depth raster.
// We could piggyback on the viewport transform below, but it gets complicated since it's different per-backend. Which we really
// should clean up one day...
if (useDepthRaster_) {
DepthRasterPredecoded(prim, decoded_, numDecodedVerts_, swDec, vertexCount);
}
SoftwareTransform swTransform(params);
const Lin::Vec3 trans(gstate_c.vpXOffset, gstate_c.vpYOffset, gstate_c.vpZOffset * 0.5f + 0.5f);
@@ -442,11 +449,6 @@ void DrawEngineVulkan::Flush() {
swTransform.Transform(prim, swDec->VertexType(), swDec->GetDecVtxFmt(), numDecodedVerts_, &result);
// At this point, rect and line primitives are still preserved as such. So, it's the best time to do software depth raster.
if (useDepthRaster_) {
DepthRasterPretransformed(prim, transformed_, numDecodedVerts_);
}
// Non-zero depth clears are unusual, but some drivers don't match drawn depth values to cleared values.
// Games sometimes expect exact matches (see #12626, for example) for equal comparisons.
if (result.action == SW_CLEAR && everUsedEqualDepth_ && gstate.isClearModeDepthMask() && result.depth > 0.0f && result.depth < 1.0f)