Evict floats from the block code (too bad it didn't make any difference to the speed)

This commit is contained in:
Magnus Norddahl 2016-11-13 16:36:47 +01:00
parent f25579849a
commit acb2e821f0
2 changed files with 22 additions and 18 deletions

View file

@ -228,10 +228,20 @@ void DrawTriangleCodegen::LoopBlockX(TriDrawVariant variant, bool truecolor)
SSAFloat rcpWBR = 1.0f / (startW + offx1 * gradWX + offy1 * gradWY);
for (int i = 0; i < TriVertex::NumVarying; i++)
{
varyingTL[i] = (startVarying[i] + offx0 * gradVaryingX[i] + offy0 * gradVaryingY[i]) * rcpWTL;
varyingTR[i] = (startVarying[i] + offx1 * gradVaryingX[i] + offy0 * gradVaryingY[i]) * rcpWTR;
varyingBL[i] = ((startVarying[i] + offx0 * gradVaryingX[i] + offy1 * gradVaryingY[i]) * rcpWBL - varyingTL[i]) * (1.0f / q);
varyingBR[i] = ((startVarying[i] + offx1 * gradVaryingX[i] + offy1 * gradVaryingY[i]) * rcpWBR - varyingTR[i]) * (1.0f / q);
SSAFloat varyingTL = (startVarying[i] + offx0 * gradVaryingX[i] + offy0 * gradVaryingY[i]) * rcpWTL;
SSAFloat varyingTR = (startVarying[i] + offx1 * gradVaryingX[i] + offy0 * gradVaryingY[i]) * rcpWTR;
SSAFloat varyingBL = (startVarying[i] + offx0 * gradVaryingX[i] + offy1 * gradVaryingY[i]) * rcpWBL;
SSAFloat varyingBR = (startVarying[i] + offx1 * gradVaryingX[i] + offy1 * gradVaryingY[i]) * rcpWBR;
SSAFloat pos = varyingTL;
SSAFloat stepPos = (varyingBL - varyingTL) * (1.0f / q);
SSAFloat startStepX = (varyingTR - varyingTL) * (1.0f / q);
SSAFloat incrStepX = (varyingBR - varyingBL) * (1.0f / q) - startStepX;
varyingPos[i] = SSAInt(pos * SSAFloat((float)0x01000000), false);
varyingStepPos[i] = SSAInt(stepPos * SSAFloat((float)0x01000000), false);
varyingStartStepX[i] = SSAInt(startStepX * SSAFloat((float)0x01000000), false);
varyingIncrStepX[i] = SSAInt(incrStepX * SSAFloat((float)0x01000000), false);
}
SSAFloat globVis = SSAFloat(1706.0f);
@ -296,11 +306,8 @@ void DrawTriangleCodegen::LoopFullBlock(TriDrawVariant variant, bool truecolor)
SSAInt varyingStep[TriVertex::NumVarying];
for (int i = 0; i < TriVertex::NumVarying; i++)
{
SSAFloat pos = varyingTL[i] + varyingBL[i] * SSAFloat(iy);
SSAFloat step = (varyingTR[i] + varyingBR[i] * SSAFloat(iy) - pos) * (1.0f / q);
stack_varying[i].store(SSAInt((pos - SSAFloat::floor(pos)) * SSAFloat((float)0x100000000LL), true));
varyingStep[i] = SSAInt(step * SSAFloat((float)0x100000000LL), true);
stack_varying[i].store((varyingPos[i] + varyingStepPos[i] * iy) << 8);
varyingStep[i] = (varyingStartStepX[i] + varyingIncrStepX[i] * iy) << 8;
}
stack_ix.store(SSAInt(0));
@ -368,11 +375,8 @@ void DrawTriangleCodegen::LoopPartialBlock(TriDrawVariant variant, bool truecolo
SSAInt varyingStep[TriVertex::NumVarying];
for (int i = 0; i < TriVertex::NumVarying; i++)
{
SSAFloat pos = varyingTL[i] + varyingBL[i] * SSAFloat(iy);
SSAFloat step = (varyingTR[i] + varyingBR[i] * SSAFloat(iy) - pos) * (1.0f / q);
stack_varying[i].store(SSAInt((pos - SSAFloat::floor(pos)) * SSAFloat((float)0x100000000LL), true));
varyingStep[i] = SSAInt(step * SSAFloat((float)0x100000000LL), true);
stack_varying[i].store((varyingPos[i] + varyingStepPos[i] * iy) << 8);
varyingStep[i] = (varyingStartStepX[i] + varyingIncrStepX[i] * iy) << 8;
}
stack_CX1.store(CY1);

View file

@ -116,10 +116,10 @@ private:
SSAInt x, y;
SSAInt x0, x1, y0, y1;
SSAInt diminishedlight;
SSAFloat varyingTL[TriVertex::NumVarying];
SSAFloat varyingTR[TriVertex::NumVarying];
SSAFloat varyingBL[TriVertex::NumVarying];
SSAFloat varyingBR[TriVertex::NumVarying];
SSAInt varyingPos[TriVertex::NumVarying];
SSAInt varyingStepPos[TriVertex::NumVarying];
SSAInt varyingStartStepX[TriVertex::NumVarying];
SSAInt varyingIncrStepX[TriVertex::NumVarying];
SSAUBytePtr StencilBlock;
SSAIntPtr StencilBlockMask;