Skip to content

Commit 5def50c

Browse files
authored
Merge pull request #19764 from hrydgard/even-more-depth-raster-stuff
Enable depth raster in all backends
2 parents f8774a4 + 4aaea67 commit 5def50c

File tree

10 files changed

+32
-23
lines changed

10 files changed

+32
-23
lines changed

Common/Math/CrossSIMD.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ struct Vec4U16 {
172172
Vec4U16 operator ^(Vec4U16 other) const { return Vec4U16{ _mm_xor_si128(v, other.v) }; }
173173

174174
Vec4U16 Max(Vec4U16 other) const { return Vec4U16{ _mm_max_epu16_SSE2(v, other.v) }; }
175-
Vec4U16 Min(Vec4U16 other) const { return Vec4U16{ _mm_max_epu16_SSE2(v, other.v) }; }
175+
Vec4U16 Min(Vec4U16 other) const { return Vec4U16{ _mm_min_epu16_SSE2(v, other.v) }; }
176176
Vec4U16 CompareLT(Vec4U16 other) { return Vec4U16{ _mm_cmplt_epu16(v, other.v) }; }
177177
};
178178

GPU/Common/DepthRaster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ TriangleResult DepthRasterTriangle(uint16_t *depthBuf, int stride, int x1, int y
199199
switch (compareMode) {
200200
case ZCompareMode::Greater:
201201
// To implement the greater/greater-than comparison, we can combine mask and max.
202-
// It might be better to do the math in float space on x86 due to SSE2 deficiencies.
202+
// Unfortunately there's no unsigned max on SSE2, it's synthesized by xoring 0x8000 on input and output.
203203
// We use AndNot to zero out Z results, before doing Max with the buffer.
204204
AndNot(shortZ, shortMaskInv).Max(bufferValues).Store(rowPtr + x);
205205
break;

GPU/D3D11/DrawEngineD3D11.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,9 @@ void DrawEngineD3D11::Flush() {
335335
context_->Draw(vertexCount, 0);
336336
}
337337
}
338+
if (useDepthRaster_) {
339+
DepthRasterTransform(prim, dec_, dec_->VertexType(), vertexCount);
340+
}
338341
} else {
339342
PROFILE_THIS_SCOPE("soft");
340343
VertexDecoder *swDec = dec_;
@@ -388,6 +391,13 @@ void DrawEngineD3D11::Flush() {
388391
UpdateCachedViewportState(vpAndScissor);
389392
}
390393

394+
// At this point, rect and line primitives are still preserved as such. So, it's the best time to do software depth raster.
395+
// We could piggyback on the viewport transform below, but it gets complicated since it's different per-backend. Which we really
396+
// should clean up one day...
397+
if (useDepthRaster_) {
398+
DepthRasterPredecoded(prim, decoded_, numDecodedVerts_, swDec, vertexCount);
399+
}
400+
391401
SoftwareTransform swTransform(params);
392402

393403
const Lin::Vec3 trans(gstate_c.vpXOffset, -gstate_c.vpYOffset, gstate_c.vpZOffset * 0.5f + 0.5f);

GPU/Directx9/DrawEngineDX9.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ void DrawEngineDX9::Flush() {
292292
}
293293
}
294294
}
295+
if (useDepthRaster_) {
296+
DepthRasterTransform(prim, dec_, dec_->VertexType(), vertexCount);
297+
}
295298
} else {
296299
VertexDecoder *swDec = dec_;
297300
if (swDec->nweights != 0) {
@@ -344,6 +347,13 @@ void DrawEngineDX9::Flush() {
344347
UpdateCachedViewportState(vpAndScissor);
345348
}
346349

350+
// At this point, rect and line primitives are still preserved as such. So, it's the best time to do software depth raster.
351+
// We could piggyback on the viewport transform below, but it gets complicated since it's different per-backend. Which we really
352+
// should clean up one day...
353+
if (useDepthRaster_) {
354+
DepthRasterPredecoded(prim, decoded_, numDecodedVerts_, swDec, vertexCount);
355+
}
356+
347357
int maxIndex = numDecodedVerts_;
348358
SoftwareTransform swTransform(params);
349359

GPU/GLES/DrawEngineGLES.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ void DrawEngineGLES::Flush() {
315315
inputLayout, vertexBuffer, vertexBufferOffset,
316316
glprim[prim], 0, vertexCount);
317317
}
318+
if (useDepthRaster_) {
319+
DepthRasterTransform(prim, dec_, dec_->VertexType(), vertexCount);
320+
}
318321
} else {
319322
PROFILE_THIS_SCOPE("soft");
320323
VertexDecoder *swDec = dec_;
@@ -371,6 +374,13 @@ void DrawEngineGLES::Flush() {
371374
}
372375
}
373376

377+
// At this point, rect and line primitives are still preserved as such. So, it's the best time to do software depth raster.
378+
// We could piggyback on the viewport transform below, but it gets complicated since it's different per-backend. Which we really
379+
// should clean up one day...
380+
if (useDepthRaster_) {
381+
DepthRasterPredecoded(prim, decoded_, numDecodedVerts_, swDec, vertexCount);
382+
}
383+
374384
SoftwareTransform swTransform(params);
375385

376386
const Lin::Vec3 trans(gstate_c.vpXOffset, gstate_c.vpYOffset, gstate_c.vpZOffset);

UWP/lua/lua.cpp

Lines changed: 0 additions & 2 deletions
This file was deleted.

UWP/lua/lua.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

UWP/lua/pch.cpp

Lines changed: 0 additions & 1 deletion
This file was deleted.

UWP/lua/pch.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

UWP/lua/targetver.h

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)