Skip to content

Commit

Permalink
Enable depth raster in all backends, not just Vulkan
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Dec 24, 2024
1 parent 032f519 commit 4aaea67
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions GPU/D3D11/DrawEngineD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ void DrawEngineD3D11::Flush() {
context_->Draw(vertexCount, 0);
}
}
if (useDepthRaster_) {
DepthRasterTransform(prim, dec_, dec_->VertexType(), vertexCount);
}
} else {
PROFILE_THIS_SCOPE("soft");
VertexDecoder *swDec = dec_;
Expand Down Expand Up @@ -388,6 +391,13 @@ void DrawEngineD3D11::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);
Expand Down
10 changes: 10 additions & 0 deletions GPU/Directx9/DrawEngineDX9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ void DrawEngineDX9::Flush() {
}
}
}
if (useDepthRaster_) {
DepthRasterTransform(prim, dec_, dec_->VertexType(), vertexCount);
}
} else {
VertexDecoder *swDec = dec_;
if (swDec->nweights != 0) {
Expand Down Expand Up @@ -344,6 +347,13 @@ void DrawEngineDX9::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);
}

int maxIndex = numDecodedVerts_;
SoftwareTransform swTransform(params);

Expand Down
10 changes: 10 additions & 0 deletions GPU/GLES/DrawEngineGLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ void DrawEngineGLES::Flush() {
inputLayout, vertexBuffer, vertexBufferOffset,
glprim[prim], 0, vertexCount);
}
if (useDepthRaster_) {
DepthRasterTransform(prim, dec_, dec_->VertexType(), vertexCount);
}
} else {
PROFILE_THIS_SCOPE("soft");
VertexDecoder *swDec = dec_;
Expand Down Expand Up @@ -371,6 +374,13 @@ void DrawEngineGLES::Flush() {
}
}

// 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);
Expand Down

0 comments on commit 4aaea67

Please sign in to comment.