psx - test rasterizer code

This commit is contained in:
zeromus 2015-02-15 18:08:09 +00:00
parent 36f9145483
commit f491f76207
2 changed files with 40 additions and 35 deletions

Binary file not shown.

View File

@ -144,43 +144,43 @@ INLINE void PS_GPU::DrawSpan(int y, const int32 x_start, const int32 x_bound, i_
if(LineSkipTest(y))
return;
if(textured)
int32 x_ig_adjust = x_start;
int32 w = x_bound - x_start;
int32 x = sign_x_to_s32(11, x_start);
if(x < ClipX0)
{
ig.u += (x_start * idl.du_dx) + (y * idl.du_dy);
ig.v += (x_start * idl.dv_dx) + (y * idl.dv_dy);
int32 delta = ClipX0 - x;
x_ig_adjust += delta;
x += delta;
w -= delta;
}
if(goraud)
if((x + w) > (ClipX1 + 1))
w = ClipX1 + 1 - x;
if(w <= 0)
return;
//printf("%d %d %d %d\n", x, w, ClipX0, ClipX1);
AddIDeltas_DX<goraud, textured>(ig, idl, x_ig_adjust);
AddIDeltas_DY<goraud, textured>(ig, idl, y);
if(goraud || textured)
DrawTimeAvail -= w * 2;
else if((BlendMode >= 0) || MaskEval_TA)
DrawTimeAvail -= w + ((w + 1) >> 1);
else
DrawTimeAvail -= w;
do
{
ig.r += (x_start * idl.dr_dx) + (y * idl.dr_dy);
ig.g += (x_start * idl.dg_dx) + (y * idl.dg_dy);
ig.b += (x_start * idl.db_dx) + (y * idl.db_dy);
}
const uint32 r = ig.r >> (COORD_FBS + COORD_POST_PADDING);
const uint32 g = ig.g >> (COORD_FBS + COORD_POST_PADDING);
const uint32 b = ig.b >> (COORD_FBS + COORD_POST_PADDING);
for(int32 xi = x_start; MDFN_LIKELY(xi < x_bound); xi++, AddIDeltas_DX<goraud, textured>(ig, idl))
{
uint32 r, g, b;
int32 x = sign_x_to_s32(11, xi);
if(goraud || textured)
DrawTimeAvail -= 2;
else
DrawTimeAvail--;
if(x > ClipX1)
break;
if(x < ClipX0)
continue;
if(!(goraud || textured) && ((BlendMode >= 0) || MaskEval_TA))
{
DrawTimeAvail -= (x & 1);
}
r = ig.r >> (COORD_FBS + COORD_POST_PADDING);
g = ig.g >> (COORD_FBS + COORD_POST_PADDING);
b = ig.b >> (COORD_FBS + COORD_POST_PADDING);
//assert(x >= ClipX0 && x <= ClipX1);
if(textured)
{
@ -223,7 +223,10 @@ INLINE void PS_GPU::DrawSpan(int y, const int32 x_start, const int32 x_bound, i_
PlotPixel<BlendMode, MaskEval_TA, false>(x, y, pix);
}
}
x++;
AddIDeltas_DX<goraud, textured>(ig, idl);
} while(MDFN_LIKELY(--w > 0));
}
template<bool goraud, bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA>
@ -245,6 +248,8 @@ INLINE void PS_GPU::DrawTriangle(tri_vertex *vertices)
else
cvtemp = (1 << 1);
}
else if(vertices[2].x < vertices[0].x)
cvtemp = (1 << 2);
else
cvtemp = (1 << 0);
@ -454,7 +459,7 @@ INLINE void PS_GPU::DrawTriangle(tri_vertex *vertices)
continue;
}
DrawSpan<goraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(y, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl);
DrawSpan<goraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(yi, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl);
}
}
else
@ -472,7 +477,7 @@ INLINE void PS_GPU::DrawTriangle(tri_vertex *vertices)
goto skipit;
}
DrawSpan<goraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(y, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl);
DrawSpan<goraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(yi, GetPolyXFP_Int(lc), GetPolyXFP_Int(rc), ig, idl);
//
//
//