VideoSW: Drop SW bbox code

The hardware backends don't use this shared code any more, and it's not needed for video sw either. So this was just dead code.
This commit is contained in:
degasus 2015-09-17 18:19:47 +02:00
parent e3e0399af2
commit 3b5b80bf3c
2 changed files with 171 additions and 375 deletions

View File

@ -128,7 +128,7 @@ inline void Draw(s32 x, s32 y, s32 xi, s32 yi)
s32 z = (s32)MathUtil::Clamp<float>(ZSlope.GetValue(dx, dy), 0.0f, 16777215.0f);
if (!BoundingBox::active && bpmem.UseEarlyDepthTest() && g_SWVideoConfig.bZComploc)
if (bpmem.UseEarlyDepthTest() && g_SWVideoConfig.bZComploc)
{
// TODO: Test if perf regs are incremented even if test is disabled
EfbInterface::IncPerfCounterQuadCount(PQ_ZCOMP_INPUT_ZCOMPLOC);
@ -418,9 +418,6 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
if (DY23 < 0 || (DY23 == 0 && DX23 > 0)) C2++;
if (DY31 < 0 || (DY31 == 0 && DX31 > 0)) C3++;
// If drawing, rasterize every block
if (!BoundingBox::active)
{
// Start in corner of 8x8 block
minx &= ~(BLOCK_SIZE - 1);
miny &= ~(BLOCK_SIZE - 1);
@ -503,196 +500,6 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
}
}
}
}
else
{
// Calculating bbox
// First check for alpha channel - don't do anything it if always fails,
// Change bbox to primitive size if it always passes
AlphaTest::TEST_RESULT alphaRes = bpmem.alpha_test.TestResult();
if (alphaRes != AlphaTest::UNDETERMINED)
{
if (alphaRes == AlphaTest::PASS)
{
BoundingBox::coords[BoundingBox::TOP] = std::min(BoundingBox::coords[BoundingBox::TOP], (u16) miny);
BoundingBox::coords[BoundingBox::LEFT] = std::min(BoundingBox::coords[BoundingBox::LEFT], (u16) minx);
BoundingBox::coords[BoundingBox::BOTTOM] = std::max(BoundingBox::coords[BoundingBox::BOTTOM], (u16) maxy);
BoundingBox::coords[BoundingBox::RIGHT] = std::max(BoundingBox::coords[BoundingBox::RIGHT], (u16) maxx);
}
return;
}
// If we are calculating bbox with alpha, we only need to find the
// topmost, leftmost, bottom most and rightmost pixels to be drawn.
// So instead of drawing every single one of the triangle's pixels,
// four loops are run: one for the top pixel, one for the left, one for
// the bottom and one for the right. As soon as a pixel that is to be
// drawn is found, the loop breaks. This enables a ~150% speedbost in
// bbox calculation, albeit at the cost of some ugly repetitive code.
const s32 FLEFT = minx << 4;
const s32 FRIGHT = maxx << 4;
s32 FTOP = miny << 4;
s32 FBOTTOM = maxy << 4;
// Start checking for bbox top
s32 CY1 = C1 + DX12 * FTOP - DY12 * FLEFT;
s32 CY2 = C2 + DX23 * FTOP - DY23 * FLEFT;
s32 CY3 = C3 + DX31 * FTOP - DY31 * FLEFT;
// Loop
for (s32 y = miny; y <= maxy; ++y)
{
if (y >= BoundingBox::coords[BoundingBox::TOP])
break;
s32 CX1 = CY1;
s32 CX2 = CY2;
s32 CX3 = CY3;
for (s32 x = minx; x <= maxx; ++x)
{
if (CX1 > 0 && CX2 > 0 && CX3 > 0)
{
// Build the new raster block every other pixel
PrepareBlock(x, y);
Draw(x, y, x & (BLOCK_SIZE - 1), y & (BLOCK_SIZE - 1));
if (y >= BoundingBox::coords[BoundingBox::TOP])
break;
}
CX1 -= FDY12;
CX2 -= FDY23;
CX3 -= FDY31;
}
CY1 += FDX12;
CY2 += FDX23;
CY3 += FDX31;
}
// Update top limit
miny = std::max((s32) BoundingBox::coords[BoundingBox::TOP], miny);
FTOP = miny << 4;
// Checking for bbox left
s32 CX1 = C1 + DX12 * FTOP - DY12 * FLEFT;
s32 CX2 = C2 + DX23 * FTOP - DY23 * FLEFT;
s32 CX3 = C3 + DX31 * FTOP - DY31 * FLEFT;
// Loop
for (s32 x = minx; x <= maxx; ++x)
{
if (x >= BoundingBox::coords[BoundingBox::LEFT])
break;
CY1 = CX1;
CY2 = CX2;
CY3 = CX3;
for (s32 y = miny; y <= maxy; ++y)
{
if (CY1 > 0 && CY2 > 0 && CY3 > 0)
{
PrepareBlock(x, y);
Draw(x, y, x & (BLOCK_SIZE - 1), y & (BLOCK_SIZE - 1));
if (x >= BoundingBox::coords[BoundingBox::LEFT])
break;
}
CY1 += FDX12;
CY2 += FDX23;
CY3 += FDX31;
}
CX1 -= FDY12;
CX2 -= FDY23;
CX3 -= FDY31;
}
// Update left limit
minx = std::max((s32) BoundingBox::coords[BoundingBox::LEFT], minx);
// Checking for bbox bottom
CY1 = C1 + DX12 * FBOTTOM - DY12 * FRIGHT;
CY2 = C2 + DX23 * FBOTTOM - DY23 * FRIGHT;
CY3 = C3 + DX31 * FBOTTOM - DY31 * FRIGHT;
// Loop
for (s32 y = maxy; y >= miny; --y)
{
CX1 = CY1;
CX2 = CY2;
CX3 = CY3;
if (y <= BoundingBox::coords[BoundingBox::BOTTOM])
break;
for (s32 x = maxx; x >= minx; --x)
{
if (CX1 > 0 && CX2 > 0 && CX3 > 0)
{
// Build the new raster block every other pixel
PrepareBlock(x, y);
Draw(x, y, x & (BLOCK_SIZE - 1), y & (BLOCK_SIZE - 1));
if (y <= BoundingBox::coords[BoundingBox::BOTTOM])
break;
}
CX1 += FDY12;
CX2 += FDY23;
CX3 += FDY31;
}
CY1 -= FDX12;
CY2 -= FDX23;
CY3 -= FDX31;
}
// Update bottom limit
maxy = std::min((s32) BoundingBox::coords[BoundingBox::BOTTOM], maxy);
FBOTTOM = maxy << 4;
// Checking for bbox right
CX1 = C1 + DX12 * FBOTTOM - DY12 * FRIGHT;
CX2 = C2 + DX23 * FBOTTOM - DY23 * FRIGHT;
CX3 = C3 + DX31 * FBOTTOM - DY31 * FRIGHT;
// Loop
for (s32 x = maxx; x >= minx; --x)
{
if (x <= BoundingBox::coords[BoundingBox::RIGHT])
break;
CY1 = CX1;
CY2 = CX2;
CY3 = CX3;
for (s32 y = maxy; y >= miny; --y)
{
if (CY1 > 0 && CY2 > 0 && CY3 > 0)
{
// Build the new raster block every other pixel
PrepareBlock(x, y);
Draw(x, y, x & (BLOCK_SIZE - 1), y & (BLOCK_SIZE - 1));
if (x <= BoundingBox::coords[BoundingBox::RIGHT])
break;
}
CY1 -= FDX12;
CY2 -= FDX23;
CY3 -= FDX31;
}
CX1 += FDY12;
CX2 += FDY23;
CX3 += FDY31;
}
}
}

View File

@ -650,10 +650,6 @@ void Tev::Draw()
if (!TevAlphaTest(output[ALP_C]))
return;
// This part is only needed if we are not simply computing bbox
// (i. e., only needed when using the SW renderer)
if (!BoundingBox::active)
{
// z texture
if (bpmem.ztex2.op)
{
@ -769,7 +765,6 @@ void Tev::Draw()
EfbInterface::IncPerfCounterQuadCount(PQ_ZCOMP_OUTPUT);
}
}
// branchless bounding box update
BoundingBox::coords[BoundingBox::LEFT] = std::min((u16)Position[0], BoundingBox::coords[BoundingBox::LEFT]);
@ -777,12 +772,6 @@ void Tev::Draw()
BoundingBox::coords[BoundingBox::TOP] = std::min((u16)Position[1], BoundingBox::coords[BoundingBox::TOP]);
BoundingBox::coords[BoundingBox::BOTTOM] = std::max((u16)Position[1], BoundingBox::coords[BoundingBox::BOTTOM]);
// if we are only calculating the bounding box,
// there's no need to actually draw anything
if (BoundingBox::active)
return;
#if ALLOW_TEV_DUMPS
if (g_SWVideoConfig.bDumpTevStages)
{