softgpu: Skip zero size triangles.

These were drawing before, incorrectly, which caused artifacts.
Noticeable in Blade Dancer.
This commit is contained in:
Unknown W. Brackets committed 2021-12-31 00:20:12 -08:00
1 parent fd540f1780
commit 33e9841a4a
3 files changed
+5 -2

No files matched your search

+1 -1
View File
@@ -861,7 +861,7 @@ bool PixelJitCache::Jit_ApplyStencilOp(const PixelFuncID &id, GEStencilOp op, Re
bool PixelJitCache::Jit_WriteStencilOnly(const PixelFuncID &id, RegCache::Reg stencilReg) {
_assert_(stencilReg != INVALID_REG);
// It's okay to destory stencilReg here, we know we're the last writing it.
// It's okay to destroy stencilReg here, we know we're the last writing it.
X64Reg colorOffReg = GetColorOff(id);
if (id.applyColorWriteMask) {
X64Reg gstateReg = GetGState();
+3
View File
@@ -873,6 +873,9 @@ void DrawTriangle(const VertexData& v0, const VertexData& v1, const VertexData&
// Drop primitives which are not in CCW order by checking the cross product
if (d01.x * d02.y - d01.y * d02.x < 0)
return;
// If all points have identical coords, we'll have 0 weights and not skip properly, so skip here.
if (d01.x == 0 && d01.y == 0 && d02.x == 0 && d02.y == 0)
return;
int minX = std::min(std::min(v0.screenpos.x, v1.screenpos.x), v2.screenpos.x) & ~0xF;
int minY = std::min(std::min(v0.screenpos.y, v1.screenpos.y), v2.screenpos.y) & ~0xF;
+1 -1
View File
@@ -733,7 +733,7 @@ bool SamplerJitCache::Jit_ApplyTextureFunc(const SamplerID &id) {
if (!id.useTextureAlpha) {
useAlphaFrom(primColorReg);
} else if (id.useColorDoubling) {
// We still need to finish dividing alpha, it's currently doubled (frmo the 7 above.)
// We still need to finish dividing alpha, it's currently doubled (from the 7 above.)
MOVDQA(primColorReg, R(resultReg));
PSRLW(primColorReg, 1);
useAlphaFrom(primColorReg);